use of org.jetbrains.idea.svn.properties.PropertyConsumer in project intellij-community by JetBrains.
the class ShowPropertiesDiffAction method createHandler.
@NotNull
private static PropertyConsumer createHandler(SVNRevision revision, @NotNull final List<PropertyData> lines) {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.checkCanceled();
indicator.setText(SvnBundle.message("show.properties.diff.progress.text.revision.information", revision.toString()));
}
return new PropertyConsumer() {
public void handleProperty(final File path, final PropertyData property) throws SVNException {
registerProperty(property);
}
public void handleProperty(final SVNURL url, final PropertyData property) throws SVNException {
registerProperty(property);
}
public void handleProperty(final long revision, final PropertyData property) throws SVNException {
// revision properties here
}
private void registerProperty(@NotNull PropertyData property) {
if (indicator != null) {
indicator.checkCanceled();
indicator.setText2(SvnBundle.message("show.properties.diff.progress.text2.property.information", property.getName()));
}
lines.add(property);
}
};
}
use of org.jetbrains.idea.svn.properties.PropertyConsumer in project intellij-community by JetBrains.
the class Reverter method moveRenamesToTmp.
public void moveRenamesToTmp(@NotNull UnversionedAndNotTouchedFilesGroupCollector collector) {
try {
// copy also directories here - for moving with svn
// also, maybe still use just patching? -> well-tested thing, only deletion of folders might suffer
// todo: special case: addition + move. mark it
final File tmp = FileUtil.createTempDirectory("forRename", "");
final PropertyConsumer handler = createPropertyHandler(myProperties, collector);
for (Map.Entry<File, ThroughRenameInfo> entry : collector.getFromTo().entrySet()) {
final File source = entry.getKey();
final ThroughRenameInfo info = entry.getValue();
if (info.isVersioned()) {
myVcs.getFactory(source).createPropertyClient().list(SvnTarget.fromFile(source), SVNRevision.WORKING, Depth.EMPTY, handler);
}
if (source.isDirectory()) {
if (!FileUtil.filesEqual(info.getTo(), info.getFirstTo())) {
myFromToModified.add(new CopiedAsideInfo(info.getParentImmediateReverted(), info.getTo(), info.getFirstTo(), null));
}
continue;
}
final File tmpFile = FileUtil.createTempFile(tmp, source.getName(), "", false);
tmpFile.mkdirs();
FileUtil.delete(tmpFile);
FileUtil.copy(source, tmpFile);
myFromToModified.add(new CopiedAsideInfo(info.getParentImmediateReverted(), info.getTo(), info.getFirstTo(), tmpFile));
}
} catch (IOException e) {
myExceptions.add(new VcsException(e));
} catch (VcsException e) {
myExceptions.add(e);
}
}
use of org.jetbrains.idea.svn.properties.PropertyConsumer in project intellij-community by JetBrains.
the class SetPropertyDialog method fillPropertyNames.
private void fillPropertyNames(File[] files) {
final Collection<String> names = new TreeSet<>();
if (files.length == 1) {
File file = files[0];
try {
PropertyConsumer handler = new PropertyConsumer() {
public void handleProperty(File path, PropertyData property) {
String name = property.getName();
if (name != null) {
names.add(name);
}
}
public void handleProperty(SVNURL url, PropertyData property) {
}
public void handleProperty(long revision, PropertyData property) {
}
};
PropertyClient client = myVCS.getFactory(file).createPropertyClient();
client.list(SvnTarget.fromFile(file, SVNRevision.WORKING), SVNRevision.WORKING, Depth.EMPTY, handler);
} catch (VcsException e) {
LOG.info(e);
}
}
fillProperties(names);
for (final String name : names) {
myPropertyNameBox.addItem(name);
}
}
use of org.jetbrains.idea.svn.properties.PropertyConsumer in project intellij-community by JetBrains.
the class ShowPropertiesDiffAction method getPropertyList.
@NotNull
private static List<PropertyData> getPropertyList(@NotNull SvnVcs vcs, @NotNull SvnTarget target, @Nullable SVNRevision revision) throws VcsException {
final List<PropertyData> lines = new ArrayList<>();
final PropertyConsumer propertyHandler = createHandler(revision, lines);
vcs.getFactory(target).createPropertyClient().list(target, revision, Depth.EMPTY, propertyHandler);
return lines;
}
use of org.jetbrains.idea.svn.properties.PropertyConsumer in project intellij-community by JetBrains.
the class PropertiesComponent method collectProperties.
private static void collectProperties(@NotNull SvnVcs vcs, @NotNull File file, @NotNull final Map<String, String> props) {
try {
PropertyConsumer handler = new PropertyConsumer() {
public void handleProperty(File path, PropertyData property) throws SVNException {
final PropertyValue value = property.getValue();
if (value != null) {
props.put(property.getName(), PropertyValue.toString(property.getValue()));
}
}
public void handleProperty(SVNURL url, PropertyData property) throws SVNException {
}
public void handleProperty(long revision, PropertyData property) throws SVNException {
}
};
vcs.getFactory(file).createPropertyClient().list(SvnTarget.fromFile(file, SVNRevision.UNDEFINED), SVNRevision.WORKING, Depth.EMPTY, handler);
} catch (VcsException e) {
props.clear();
}
}
Aggregations