Search in sources :

Example 21 with NavigatorContentExtension

use of org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension in project polymap4-core by Polymap4.

the class NavigatorContentServiceContentProvider method findParents.

private Set findParents(final Object anElement) {
    final Set descriptors = contentService.findDescriptorsWithPossibleChild(anElement, false);
    final Set parents = new LinkedHashSet();
    for (final Iterator itr = descriptors.iterator(); itr.hasNext(); ) {
        SafeRunner.run(new NavigatorSafeRunnable() {

            NavigatorContentDescriptor foundDescriptor;

            NavigatorContentExtension foundExtension;

            Object parent = null;

            public void run() throws Exception {
                foundDescriptor = (NavigatorContentDescriptor) itr.next();
                foundExtension = contentService.getExtension(foundDescriptor);
                if (!isOverridingDescriptorInSet(foundExtension.getDescriptor(), descriptors)) {
                    if (foundExtension.internalGetContentProvider().isTreePath()) {
                        TreePath[] parentTreePaths = ((ITreePathContentProvider) foundExtension.internalGetContentProvider()).getParents(anElement);
                        for (int i = 0; i < parentTreePaths.length; i++) {
                            parent = parentTreePaths[i].getLastSegment();
                            if ((parent = findParent(foundExtension, anElement, parent)) != null)
                                parents.add(parent);
                        }
                    } else {
                        parent = foundExtension.internalGetContentProvider().getParent(anElement);
                        if ((parent = findParent(foundExtension, anElement, parent)) != null)
                            parents.add(parent);
                    }
                }
            }

            public void handleException(Throwable e) {
                NavigatorPlugin.logError(0, NLS.bind(CommonNavigatorMessages.Exception_Invoking_Extension, new Object[] { foundExtension.getDescriptor().getId(), anElement }), e);
            }
        });
    }
    return parents;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension) Iterator(java.util.Iterator) NavigatorContentDescriptor(org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor) INavigatorContentDescriptor(org.eclipse.ui.navigator.INavigatorContentDescriptor)

Example 22 with NavigatorContentExtension

use of org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension in project polymap4-core by Polymap4.

the class NavigatorContentServiceLabelProvider method getColumnImage.

public Image getColumnImage(Object element, int columnIndex) {
    Collection contentExtensions = contentService.findPossibleLabelExtensions(element);
    Image image = null;
    for (Iterator itr = contentExtensions.iterator(); itr.hasNext() && image == null; ) {
        image = findImage((NavigatorContentExtension) itr.next(), element, columnIndex);
    }
    return image;
}
Also used : NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension) Iterator(java.util.Iterator) Collection(java.util.Collection) Image(org.eclipse.swt.graphics.Image)

Example 23 with NavigatorContentExtension

use of org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension in project polymap4-core by Polymap4.

the class NavigatorPipelineService method interceptUpdate.

public boolean interceptUpdate(PipelinedViewerUpdate anUpdateSynchronization) {
    boolean pipelined = false;
    Object refreshable = null;
    Set overrideableExtensions = new LinkedHashSet();
    for (Iterator iter = anUpdateSynchronization.getRefreshTargets().iterator(); iter.hasNext(); ) {
        refreshable = iter.next();
        overrideableExtensions.addAll(contentService.findOverrideableContentExtensionsForPossibleChild(refreshable));
    }
    for (Iterator overrideableExtensionItr = overrideableExtensions.iterator(); overrideableExtensionItr.hasNext(); ) {
        pipelined |= pipelineInterceptUpdate((NavigatorContentExtension) overrideableExtensionItr.next(), anUpdateSynchronization, refreshable);
    }
    return pipelined;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension) Iterator(java.util.Iterator)

Example 24 with NavigatorContentExtension

use of org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension in project polymap4-core by Polymap4.

the class NavigatorPipelineService method pipelineInterceptAdd.

private void pipelineInterceptAdd(final PipelinedShapeModification anAddModification, final ContributorTrackingSet trackedSet, final INavigatorContentDescriptor descriptor) {
    if (descriptor.hasOverridingExtensions()) {
        Set overridingDescriptors = descriptor.getOverriddingExtensions();
        for (Iterator overridingDescriptorsItr = overridingDescriptors.iterator(); overridingDescriptorsItr.hasNext(); ) {
            INavigatorContentDescriptor overridingDescriptor = (INavigatorContentDescriptor) overridingDescriptorsItr.next();
            if (contentService.isVisible(overridingDescriptor.getId()) && contentService.isActive(overridingDescriptor.getId())) {
                trackedSet.setContributor((NavigatorContentDescriptor) overridingDescriptor, (NavigatorContentDescriptor) descriptor);
                final NavigatorContentExtension extension = contentService.getExtension(overridingDescriptor);
                if (extension.internalGetContentProvider().isPipelined()) {
                    SafeRunner.run(new NavigatorSafeRunnable() {

                        public void run() throws Exception {
                            ((IPipelinedTreeContentProvider) extension.internalGetContentProvider()).interceptAdd(anAddModification);
                        }

                        public void handleException(Throwable e) {
                            NavigatorPlugin.logError(0, NLS.bind(CommonNavigatorMessages.Exception_Invoking_Extension, new Object[] { extension.getDescriptor().getId(), null }), e);
                        }
                    });
                }
                trackedSet.setContributor(null, null);
                pipelineInterceptAdd(anAddModification, trackedSet, overridingDescriptor);
            }
        }
    }
}
Also used : INavigatorContentDescriptor(org.eclipse.ui.navigator.INavigatorContentDescriptor) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension) Iterator(java.util.Iterator)

Aggregations

NavigatorContentExtension (org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension)24 Iterator (java.util.Iterator)14 LinkedHashSet (java.util.LinkedHashSet)9 Set (java.util.Set)9 INavigatorContentDescriptor (org.eclipse.ui.navigator.INavigatorContentDescriptor)7 INavigatorContentExtension (org.eclipse.ui.navigator.INavigatorContentExtension)6 NavigatorContentDescriptor (org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor)5 IPipelinedTreeContentProvider (org.eclipse.ui.navigator.IPipelinedTreeContentProvider)5 ListIterator (java.util.ListIterator)4 SafeDelegateTreeContentProvider (org.eclipse.ui.internal.navigator.extensions.SafeDelegateTreeContentProvider)2 BackingStoreException (org.osgi.service.prefs.BackingStoreException)2 Collection (java.util.Collection)1 SortedSet (java.util.SortedSet)1 TreeSet (java.util.TreeSet)1 CellLabelProvider (org.eclipse.jface.viewers.CellLabelProvider)1 ITreeContentProvider (org.eclipse.jface.viewers.ITreeContentProvider)1 StructuredViewer (org.eclipse.jface.viewers.StructuredViewer)1 TreePath (org.eclipse.jface.viewers.TreePath)1 Image (org.eclipse.swt.graphics.Image)1 NavigatorContentService (org.eclipse.ui.internal.navigator.NavigatorContentService)1