Search in sources :

Example 1 with IPipelinedTreeContentProvider

use of org.eclipse.ui.navigator.IPipelinedTreeContentProvider in project polymap4-core by Polymap4.

the class NavigatorContentServiceContentProvider method pipelineChildren.

/**
 * Query each of <code>theOverridingExtensions</code> for children, and then
 * pipe them through the Pipeline content provider.
 *
 * @param aParent
 *            The parent element in the tree
 * @param theOverridingExtensions
 *            The set of overriding extensions that should participate in
 *            the pipeline chain
 * @param pipelinedChildren
 *            The current children to return to the viewer (should be
 *            modifiable)
 */
private void pipelineChildren(Object aParent, NavigatorContentExtension[] theOverridingExtensions, INavigatorContentDescriptor firstClassDescriptor, ContributorTrackingSet pipelinedChildren, boolean elements) {
    IPipelinedTreeContentProvider pipelinedContentProvider;
    NavigatorContentExtension[] overridingExtensions;
    for (int i = 0; i < theOverridingExtensions.length; i++) {
        if (theOverridingExtensions[i].internalGetContentProvider().isPipelined()) {
            pipelinedContentProvider = (IPipelinedTreeContentProvider) theOverridingExtensions[i].internalGetContentProvider();
            pipelinedChildren.setContributor(theOverridingExtensions[i].getDescriptor(), firstClassDescriptor);
            if (elements) {
                pipelinedContentProvider.getPipelinedElements(aParent, pipelinedChildren);
            } else {
                pipelinedContentProvider.getPipelinedChildren(aParent, pipelinedChildren);
            }
            overridingExtensions = theOverridingExtensions[i].getOverridingExtensionsForTriggerPoint(aParent);
            if (overridingExtensions.length > 0) {
                pipelineChildren(aParent, overridingExtensions, firstClassDescriptor, pipelinedChildren, elements);
            }
        }
    }
}
Also used : IPipelinedTreeContentProvider(org.eclipse.ui.navigator.IPipelinedTreeContentProvider) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension)

Example 2 with IPipelinedTreeContentProvider

use of org.eclipse.ui.navigator.IPipelinedTreeContentProvider in project polymap4-core by Polymap4.

the class NavigatorContentServiceContentProvider method findParent.

private Object findParent(NavigatorContentExtension anExtension, Object anElement, Object aSuggestedParent) {
    /* the last valid (non-null) parent for the anElement */
    Object lastValidParent = aSuggestedParent;
    /* used to keep track of new suggestions */
    Object suggestedOverriddenParent = null;
    IPipelinedTreeContentProvider piplineContentProvider;
    NavigatorContentExtension[] overridingExtensions = anExtension.getOverridingExtensionsForPossibleChild(anElement);
    for (int i = 0; i < overridingExtensions.length; i++) {
        if (overridingExtensions[i].internalGetContentProvider().isPipelined()) {
            piplineContentProvider = (IPipelinedTreeContentProvider) overridingExtensions[i].internalGetContentProvider();
            suggestedOverriddenParent = piplineContentProvider.getPipelinedParent(anElement, lastValidParent);
            if (suggestedOverriddenParent != null && !suggestedOverriddenParent.equals(aSuggestedParent))
                lastValidParent = suggestedOverriddenParent;
            // should never return null
            lastValidParent = findParent(overridingExtensions[i], anElement, lastValidParent);
        }
    }
    return lastValidParent;
}
Also used : IPipelinedTreeContentProvider(org.eclipse.ui.navigator.IPipelinedTreeContentProvider) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension)

Example 3 with IPipelinedTreeContentProvider

use of org.eclipse.ui.navigator.IPipelinedTreeContentProvider in project polymap4-core by Polymap4.

the class NavigatorPipelineService method pipelineInterceptUpdate.

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

                public void run() throws Exception {
                    intercepted[0] |= ((IPipelinedTreeContentProvider) nceLocal.internalGetContentProvider()).interceptUpdate(anUpdateSynchronization);
                    if (nceLocal.getDescriptor().hasOverridingExtensions())
                        intercepted[0] |= pipelineInterceptUpdate(nceLocal, anUpdateSynchronization, 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 4 with IPipelinedTreeContentProvider

use of org.eclipse.ui.navigator.IPipelinedTreeContentProvider 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 5 with IPipelinedTreeContentProvider

use of org.eclipse.ui.navigator.IPipelinedTreeContentProvider in project polymap4-core by Polymap4.

the class NavigatorContentServiceContentProvider method pipelineParent.

/**
 * Query each of <code>theOverridingExtensions</code> for elements, and then
 * pipe them through the Pipeline content provider.
 *
 * @param anInputElement
 *            The input element in the tree
 * @param theOverridingExtensions
 *            The set of overriding extensions that should participate in
 *            the pipeline chain
 * @param theCurrentParent
 *            The current elements to return to the viewer (should be
 *            modifiable)
 * @return The set of elements to return to the viewer
 */
private Object pipelineParent(Object anInputElement, NavigatorContentExtension[] theOverridingExtensions, Object theCurrentParent) {
    IPipelinedTreeContentProvider pipelinedContentProvider;
    NavigatorContentExtension[] overridingExtensions;
    Object aSuggestedParent = null;
    for (int i = 0; i < theOverridingExtensions.length; i++) {
        if (theOverridingExtensions[i].internalGetContentProvider().isPipelined()) {
            pipelinedContentProvider = (IPipelinedTreeContentProvider) theOverridingExtensions[i].internalGetContentProvider();
            aSuggestedParent = pipelinedContentProvider.getPipelinedParent(anInputElement, aSuggestedParent);
            overridingExtensions = theOverridingExtensions[i].getOverridingExtensionsForTriggerPoint(anInputElement);
            if (overridingExtensions.length > 0) {
                aSuggestedParent = pipelineParent(anInputElement, overridingExtensions, aSuggestedParent);
            }
        }
    }
    return aSuggestedParent != null ? aSuggestedParent : theCurrentParent;
}
Also used : IPipelinedTreeContentProvider(org.eclipse.ui.navigator.IPipelinedTreeContentProvider) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension)

Aggregations

NavigatorContentExtension (org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension)5 IPipelinedTreeContentProvider (org.eclipse.ui.navigator.IPipelinedTreeContentProvider)5