use of org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor in project polymap4-core by Polymap4.
the class NavigatorContentService method findDescriptorsByTriggerPoint.
/**
* Search for extensions that declare the given element in their
* <b>triggerPoints</b> expression.
*
* @param anElement
* The element to use in the query
* @param considerOverrides
*
* @return The set of {@link INavigatorContentDescriptor}s that are
* <i>visible</i> and <i>active</i> for this content service and
* have a <b>triggerPoints</b> expression that is <i>enabled</i> for
* the given element.
*/
public Set findDescriptorsByTriggerPoint(Object anElement, boolean considerOverrides) {
// Here we use the cache, since objects are inserted into the
// cache in response to the trigger point
NavigatorContentDescriptor descriptor = getSourceOfContribution(anElement);
Set result = new TreeSet(ExtensionSequenceNumberComparator.INSTANCE);
if (descriptor != null) {
result.add(descriptor);
}
result.addAll(CONTENT_DESCRIPTOR_REGISTRY.findDescriptorsForTriggerPoint(anElement, assistant, considerOverrides));
return result;
}
use of org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor 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.internal.navigator.extensions.NavigatorContentDescriptor in project polymap4-core by Polymap4.
the class NavigatorContentService method findRootContentExtensions.
/**
* Search for extensions that declare the given element in their
* <b>triggerPoints</b> expression.
*
* @param anElement
* The element to use in the query
* @param toRespectViewerRoots
* True respect the <b>viewerContentBinding</b>s, False will look
* only for matching <b>triggerPoints</b> expressions.
* @return The set of {@link INavigatorContentExtension}s that are
* <i>visible</i> and <i>active</i> for this content service and
* either declared through a
* <b>org.eclipse.ui.navigator.viewer/viewerContentBinding</b> to be
* a root element or have a <b>triggerPoints</b> expression that is
* <i>enabled</i> for the given element.
*/
public Set findRootContentExtensions(Object anElement, boolean toRespectViewerRoots) {
SortedSet rootExtensions = new TreeSet(ExtensionSequenceNumberComparator.INSTANCE);
if (toRespectViewerRoots) /*&& viewerDescriptor.hasOverriddenRootExtensions()*/
{
NavigatorContentDescriptor[] descriptors = CONTENT_DESCRIPTOR_REGISTRY.getAllContentDescriptors();
NavigatorContentExtension extension = null;
for (int i = 0; i < descriptors.length; i++) {
if (isActive(descriptors[i].getId()) && isRootExtension(descriptors[i].getId())) {
extension = getExtension(descriptors[i]);
if (!extension.hasLoadingFailed()) {
rootExtensions.add(extension);
}
}
}
}
if (rootExtensions.isEmpty()) {
return findContentExtensionsByTriggerPoint(anElement);
}
return rootExtensions;
}
use of org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor in project polymap4-core by Polymap4.
the class NavigatorContentService method saveState.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.internal.navigator.INavigatorContentService#saveState(
* org.eclipse.ui.IMemento)
*/
public void saveState(final IMemento aMemento) {
synchronized (this) {
for (Iterator extensionItr = getExtensions().iterator(); extensionItr.hasNext(); ) {
final NavigatorContentExtension element = (NavigatorContentExtension) extensionItr.next();
SafeRunner.run(new NavigatorSafeRunnable(((NavigatorContentDescriptor) element.getDescriptor()).getConfigElement()) {
public void run() throws Exception {
element.saveState(aMemento);
}
});
}
}
}
use of org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor 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()]);
}
Aggregations