use of org.jetbrains.idea.svn.properties.PropertyValue 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.PropertyValue in project intellij-community by JetBrains.
the class CreateExternalAction method addToExternalProperty.
public static void addToExternalProperty(@NotNull SvnVcs vcs, @NotNull File ioFile, String target, String url) throws VcsException {
ClientFactory factory = vcs.getFactory(ioFile);
PropertyValue propertyValue = factory.createPropertyClient().getProperty(SvnTarget.fromFile(ioFile), SvnPropertyKeys.SVN_EXTERNALS, false, SVNRevision.UNDEFINED);
boolean hasExternals = propertyValue != null && !isEmptyOrSpaces(propertyValue.toString());
String newExternals = "";
if (hasExternals) {
String externalsForTarget = parseExternalsProperty(propertyValue.toString()).get(target);
if (externalsForTarget != null) {
throw new VcsException("Selected destination conflicts with existing: " + externalsForTarget);
}
newExternals = propertyValue.toString().trim() + "\n";
}
newExternals += escape(url) + " " + target;
factory.createPropertyClient().setProperty(ioFile, SvnPropertyKeys.SVN_EXTERNALS, PropertyValue.create(newExternals), Depth.EMPTY, false);
}
use of org.jetbrains.idea.svn.properties.PropertyValue in project intellij-community by JetBrains.
the class SvnDiffViewer method getProperties.
@NotNull
private static Map<String, PropertyValue> getProperties(@NotNull DiffContent content) {
if (content instanceof EmptyContent)
return Collections.emptyMap();
List<PropertyData> properties = ((SvnPropertiesDiffRequest.PropertyContent) content).getProperties();
Map<String, PropertyValue> map = new HashMap<>();
for (PropertyData data : properties) {
if (map.containsKey(data.getName()))
LOG.warn("Duplicated property: " + data.getName());
map.put(data.getName(), data.getValue());
}
return map;
}
use of org.jetbrains.idea.svn.properties.PropertyValue in project intellij-community by JetBrains.
the class SetPropertyDialog method updatePropertyValue.
private void updatePropertyValue(String name) {
if (myFiles.length == 0 || myFiles.length > 1) {
return;
}
File file = myFiles[0];
PropertyValue property = !StringUtil.isEmpty(name) ? getProperty(file, name) : null;
if (property != null) {
myValueText.setText(property.toString());
myValueText.selectAll();
} else {
myValueText.setText("");
}
}
use of org.jetbrains.idea.svn.properties.PropertyValue 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;
}
Aggregations