use of org.jetbrains.idea.svn.properties.PropertyClient in project intellij-community by JetBrains.
the class SvnEditFileProvider method editFiles.
public void editFiles(VirtualFile[] files) throws VcsException {
File[] ioFiles = new File[files.length];
for (int i = 0; i < files.length; i++) {
ioFiles[i] = virtualToIoFile(files[i]);
PropertyClient client = myVCS.getFactory(ioFiles[i]).createPropertyClient();
PropertyValue property = client.getProperty(SvnTarget.fromFile(ioFiles[i], SVNRevision.WORKING), SvnPropertyKeys.SVN_NEEDS_LOCK, false, SVNRevision.WORKING);
if (property == null) {
throw new VcsException(SvnBundle.message("exception.text.file.miss.svn", ioFiles[i].getName()));
}
}
SvnUtil.doLockFiles(myVCS.getProject(), myVCS, ioFiles);
}
use of org.jetbrains.idea.svn.properties.PropertyClient 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.PropertyClient in project intellij-community by JetBrains.
the class SetPropertyDialog method getProperty.
@Nullable
private PropertyValue getProperty(@NotNull File file, @NotNull String name) {
PropertyValue result;
try {
PropertyClient client = myVCS.getFactory(file).createPropertyClient();
result = client.getProperty(SvnTarget.fromFile(file, SVNRevision.WORKING), name, false, SVNRevision.WORKING);
} catch (VcsException e) {
LOG.info(e);
result = null;
}
return result;
}
use of org.jetbrains.idea.svn.properties.PropertyClient in project intellij-community by JetBrains.
the class SvnMergeProvider method isBinary.
public boolean isBinary(@NotNull final VirtualFile file) {
SvnVcs vcs = SvnVcs.getInstance(myProject);
try {
File ioFile = virtualToIoFile(file);
PropertyClient client = vcs.getFactory(ioFile).createPropertyClient();
PropertyValue value = client.getProperty(SvnTarget.fromFile(ioFile), SvnPropertyKeys.SVN_MIME_TYPE, false, SVNRevision.WORKING);
if (value != null && isBinaryMimeType(value.toString())) {
return true;
}
} catch (VcsException e) {
LOG.warn(e);
}
return false;
}
use of org.jetbrains.idea.svn.properties.PropertyClient in project intellij-community by JetBrains.
the class SetPropertyAction method batchPerform.
@Override
protected void batchPerform(@NotNull SvnVcs vcs, @NotNull VirtualFile[] files, @NotNull DataContext context) throws VcsException {
File[] ioFiles = toIoFiles(files);
SetPropertyDialog dialog = new SetPropertyDialog(vcs.getProject(), ioFiles, null, true);
if (dialog.showAndGet()) {
String name = dialog.getPropertyName();
String value = dialog.getPropertyValue();
boolean recursive = dialog.isRecursive();
for (File ioFile : ioFiles) {
PropertyClient client = vcs.getFactory(ioFile).createPropertyClient();
// TODO: most likely SVNDepth.getInfinityOrEmptyDepth should be used instead of SVNDepth.fromRecursive - to have either "infinity"
// TODO: or "empty" depth, and not "infinity" or "files" depth. But previous logic used SVNDepth.fromRecursive implicitly
client.setProperty(ioFile, name, PropertyValue.create(value), Depth.allOrFiles(recursive), false);
}
for (VirtualFile file : files) {
if (recursive && file.isDirectory()) {
VcsDirtyScopeManager.getInstance(vcs.getProject()).dirDirtyRecursively(file, true);
} else {
VcsDirtyScopeManager.getInstance(vcs.getProject()).fileDirty(file);
}
}
}
}
Aggregations