Search in sources :

Example 1 with PropertyData

use of org.jetbrains.idea.svn.properties.PropertyData 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);
        }
    };
}
Also used : PropertyConsumer(org.jetbrains.idea.svn.properties.PropertyConsumer) PropertyData(org.jetbrains.idea.svn.properties.PropertyData) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) SVNURL(org.tmatesoft.svn.core.SVNURL) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with PropertyData

use of org.jetbrains.idea.svn.properties.PropertyData 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;
}
Also used : PropertyData(org.jetbrains.idea.svn.properties.PropertyData) HashMap(com.intellij.util.containers.HashMap) PropertyValue(org.jetbrains.idea.svn.properties.PropertyValue) EmptyContent(com.intellij.diff.contents.EmptyContent) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with PropertyData

use of org.jetbrains.idea.svn.properties.PropertyData 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);
    }
}
Also used : PropertyClient(org.jetbrains.idea.svn.properties.PropertyClient) PropertyConsumer(org.jetbrains.idea.svn.properties.PropertyConsumer) PropertyData(org.jetbrains.idea.svn.properties.PropertyData) TreeSet(java.util.TreeSet) SVNURL(org.tmatesoft.svn.core.SVNURL) VcsException(com.intellij.openapi.vcs.VcsException) File(java.io.File)

Example 4 with PropertyData

use of org.jetbrains.idea.svn.properties.PropertyData 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;
}
Also used : PropertyData(org.jetbrains.idea.svn.properties.PropertyData) PropertyConsumer(org.jetbrains.idea.svn.properties.PropertyConsumer) ArrayList(java.util.ArrayList) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with PropertyData

use of org.jetbrains.idea.svn.properties.PropertyData in project intellij-community by JetBrains.

the class ShowPropertiesDiffAction method toSortedStringPresentation.

@NotNull
public static String toSortedStringPresentation(@NotNull List<PropertyData> lines) {
    StringBuilder sb = new StringBuilder();
    Collections.sort(lines, Comparator.comparing(PropertyData::getName));
    for (PropertyData line : lines) {
        addPropertyPresentation(line, sb);
    }
    return sb.toString();
}
Also used : PropertyData(org.jetbrains.idea.svn.properties.PropertyData) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PropertyData (org.jetbrains.idea.svn.properties.PropertyData)8 NotNull (org.jetbrains.annotations.NotNull)6 PropertyConsumer (org.jetbrains.idea.svn.properties.PropertyConsumer)4 VcsException (com.intellij.openapi.vcs.VcsException)3 File (java.io.File)3 PropertyValue (org.jetbrains.idea.svn.properties.PropertyValue)3 SVNURL (org.tmatesoft.svn.core.SVNURL)3 ArrayList (java.util.ArrayList)2 DiffRequestProducerException (com.intellij.diff.chains.DiffRequestProducerException)1 DiffContent (com.intellij.diff.contents.DiffContent)1 EmptyContent (com.intellij.diff.contents.EmptyContent)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Change (com.intellij.openapi.vcs.changes.Change)1 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)1 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 HashMap (com.intellij.util.containers.HashMap)1 HashMap (com.intellij.util.containers.hash.HashMap)1 TreeSet (java.util.TreeSet)1 SvnPropertiesDiffRequest (org.jetbrains.idea.svn.difftool.properties.SvnPropertiesDiffRequest)1