Search in sources :

Example 11 with NavigatorContentExtension

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

the class NavigatorPipelineService method interceptRemove.

public PipelinedShapeModification interceptRemove(PipelinedShapeModification aRemoveModification) {
    ContributorTrackingSet trackedSet = (ContributorTrackingSet) aRemoveModification.getChildren();
    Set interestedExtensions = new LinkedHashSet();
    for (Iterator iter = trackedSet.iterator(); iter.hasNext(); ) {
        Object element = (Object) iter.next();
        if (element instanceof TreePath) {
            interestedExtensions.addAll(contentService.findOverrideableContentExtensionsForPossibleChild(((TreePath) element).getLastSegment()));
        } else {
            interestedExtensions = contentService.findOverrideableContentExtensionsForPossibleChild(element);
        }
    }
    for (Iterator overridingExtensionsIter = interestedExtensions.iterator(); overridingExtensionsIter.hasNext(); ) pipelineInterceptRemove(aRemoveModification, trackedSet, (NavigatorContentExtension) overridingExtensionsIter.next());
    return aRemoveModification;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) TreePath(org.eclipse.jface.viewers.TreePath) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension) Iterator(java.util.Iterator)

Example 12 with NavigatorContentExtension

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

the class NavigatorPipelineService method interceptRefresh.

public boolean interceptRefresh(PipelinedViewerUpdate aRefreshSynchronization) {
    boolean pipelined = false;
    Object refreshable = null;
    Set overrideableExtensions = new LinkedHashSet();
    for (Iterator iter = aRefreshSynchronization.getRefreshTargets().iterator(); iter.hasNext(); ) {
        refreshable = iter.next();
        overrideableExtensions.addAll(contentService.findOverrideableContentExtensionsForPossibleChild(refreshable));
    }
    for (Iterator overrideableExtensionItr = overrideableExtensions.iterator(); overrideableExtensionItr.hasNext(); ) {
        pipelined |= pipelineInterceptRefresh((NavigatorContentExtension) overrideableExtensionItr.next(), aRefreshSynchronization, 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 13 with NavigatorContentExtension

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

the class NavigatorPipelineService method pipelineInterceptRefresh.

private boolean pipelineInterceptRefresh(final NavigatorContentExtension overrideableExtension, final PipelinedViewerUpdate aRefreshSynchronization, final Object refreshable) {
    final boolean[] intercepted = new boolean[1];
    final NavigatorContentExtension[] overridingExtensions = overrideableExtension.getOverridingExtensions();
    for (int i = 0; i < overridingExtensions.length; i++) {
        final NavigatorContentExtension nceLocal = overridingExtensions[i];
        if (nceLocal.internalGetContentProvider().isPipelined()) {
            SafeRunner.run(new NavigatorSafeRunnable() {

                public void run() throws Exception {
                    intercepted[0] |= ((IPipelinedTreeContentProvider) nceLocal.internalGetContentProvider()).interceptRefresh(aRefreshSynchronization);
                    if (nceLocal.getDescriptor().hasOverridingExtensions())
                        intercepted[0] |= pipelineInterceptRefresh(nceLocal, aRefreshSynchronization, refreshable);
                }

                public void handleException(Throwable e) {
                    NavigatorPlugin.logError(0, NLS.bind(CommonNavigatorMessages.Exception_Invoking_Extension, new Object[] { nceLocal.getDescriptor().getId(), refreshable }), e);
                }
            });
        }
    }
    return intercepted[0];
}
Also used : IPipelinedTreeContentProvider(org.eclipse.ui.navigator.IPipelinedTreeContentProvider) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension)

Example 14 with NavigatorContentExtension

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

the class NavigatorSaveablesService method createSaveablesProvider.

/**
 * @param descriptor
 * @return the SaveablesProvider, or null
 */
private SaveablesProvider createSaveablesProvider(NavigatorContentDescriptor descriptor) {
    NavigatorContentExtension extension = contentService.getExtension(descriptor, true);
    // Use getContentProvider to get the client objects, this is important
    // for the adaptation below. See bug 306545
    ITreeContentProvider contentProvider = extension.getContentProvider();
    return (SaveablesProvider) AdaptabilityUtility.getAdapter(contentProvider, SaveablesProvider.class);
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension) SaveablesProvider(org.eclipse.ui.navigator.SaveablesProvider)

Example 15 with NavigatorContentExtension

use of org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension in project tmdm-studio-se by Talend.

the class MDMNavigatorDecoratingLabelProvider method getToolTipText.

@Override
public String getToolTipText(Object element) {
    if (getViewer() instanceof CommonViewer) {
        CommonViewer viewer = (CommonViewer) getViewer();
        INavigatorContentService contentService = viewer.getNavigatorContentService();
        if (contentService != null && contentService instanceof NavigatorContentService) {
            Collection<?> contentExtensions = ((NavigatorContentService) contentService).findPossibleLabelExtensions(element);
            for (Iterator<?> itr = contentExtensions.iterator(); itr.hasNext(); ) {
                Object extension = itr.next();
                if (extension instanceof NavigatorContentExtension) {
                    ICommonLabelProvider provider = ((NavigatorContentExtension) extension).getLabelProvider();
                    if (provider instanceof CellLabelProvider) {
                        String toolTipText = ((CellLabelProvider) provider).getToolTipText(element);
                        if (toolTipText != null) {
                            return toolTipText;
                        }
                    }
                }
            }
        }
    }
    return super.getToolTipText(element);
}
Also used : INavigatorContentService(org.eclipse.ui.navigator.INavigatorContentService) NavigatorContentService(org.eclipse.ui.internal.navigator.NavigatorContentService) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension) CommonViewer(org.eclipse.ui.navigator.CommonViewer) ICommonLabelProvider(org.eclipse.ui.navigator.ICommonLabelProvider) INavigatorContentService(org.eclipse.ui.navigator.INavigatorContentService) CellLabelProvider(org.eclipse.jface.viewers.CellLabelProvider)

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