use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.
the class NavigatorContentService method findPossibleLabelExtensions.
/**
* Returns the list of extensions that should be considered as possible
* contributors of CNF artifacts (labels, sorters, ...). The algorithm
* first considers the source of contribution and its overrides, and then
* any possibleChildren and their overrides in order.
*
* @param anElement
* An element from the tree (any element contributed to the
* tree).
* @return A Collection of NCEs sorted in the correct order for label provider application
*/
public Collection findPossibleLabelExtensions(Object anElement) {
LinkedHashSet contributors = new LinkedHashSet();
INavigatorContentDescriptor sourceDescriptor = getSourceOfContribution(anElement);
// This is a TreeSet sorted ascending
Set possibleChildDescriptors = findDescriptorsWithPossibleChild(anElement, false);
// Add the source so that it gets sorted into the right place
if (sourceDescriptor != null) {
possibleChildDescriptors.add(sourceDescriptor);
}
for (Iterator iter = possibleChildDescriptors.iterator(); iter.hasNext(); ) {
NavigatorContentDescriptor ncd = (NavigatorContentDescriptor) iter.next();
findOverridingLabelExtensions(anElement, ncd, contributors);
}
return contributors;
}
use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.
the class NavigatorContentService method findOverrideableContentExtensionsForPossibleChild.
/**
* Search for extensions that declare the given element in their
* <b>possibleChildren</b> expression.
*
* @param anElement
* The element to use in the query
* @return The set of {@link INavigatorContentExtension}s that are
* <i>visible</i> and <i>active</i> for this content service and
* have a <b>possibleChildren</b> expression that is <i>enabled</i>
* for the given element.
*/
public Set findOverrideableContentExtensionsForPossibleChild(Object anElement) {
Set overrideableExtensions = new TreeSet(ExtensionSequenceNumberComparator.INSTANCE);
Set descriptors = findDescriptorsWithPossibleChild(anElement, false);
for (Iterator iter = descriptors.iterator(); iter.hasNext(); ) {
INavigatorContentDescriptor descriptor = (INavigatorContentDescriptor) iter.next();
if (descriptor.hasOverridingExtensions()) {
overrideableExtensions.add(getExtension(descriptor));
}
}
return overrideableExtensions;
}
use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.
the class NavigatorContentService method findStateModel.
public IExtensionStateModel findStateModel(String anExtensionId) {
if (anExtensionId == null) {
return null;
}
INavigatorContentDescriptor desc = CONTENT_DESCRIPTOR_REGISTRY.getContentDescriptor(anExtensionId);
if (desc == null) {
return null;
}
INavigatorContentExtension ext = getExtension(desc);
if (ext == null) {
return null;
}
return ext.getStateModel();
}
use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.
the class NavigatorContentService method getActiveDescriptorsWithSaveables.
/* package */
INavigatorContentDescriptor[] getActiveDescriptorsWithSaveables() {
List result = new ArrayList();
NavigatorContentDescriptor[] descriptors = CONTENT_DESCRIPTOR_REGISTRY.getContentDescriptorsWithSaveables();
for (int i = 0; i < descriptors.length; i++) {
if (assistant.isVisible(descriptors[i].getId()) && assistant.isActive(descriptors[i])) {
result.add(descriptors[i]);
}
}
if (result.isEmpty()) {
return NO_DESCRIPTORS;
}
return (INavigatorContentDescriptor[]) result.toArray(new INavigatorContentDescriptor[result.size()]);
}
use of org.eclipse.ui.navigator.INavigatorContentDescriptor 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);
}
}
}
}
Aggregations