use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.
the class NavigatorPipelineService method interceptAdd.
public PipelinedShapeModification interceptAdd(PipelinedShapeModification anAddModification) {
ContributorTrackingSet trackedSet = (ContributorTrackingSet) anAddModification.getChildren();
Set contentDescriptors = contentService.findDescriptorsByTriggerPoint(anAddModification.getParent(), !NavigatorContentService.CONSIDER_OVERRIDES);
for (Iterator descriptorsItr = contentDescriptors.iterator(); descriptorsItr.hasNext(); ) {
INavigatorContentDescriptor descriptor = (INavigatorContentDescriptor) descriptorsItr.next();
pipelineInterceptAdd(anAddModification, trackedSet, descriptor);
}
return anAddModification;
}
use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.
the class NavigatorSorterService method findSorter.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.navigator.INavigatorSorterService#findSorterForParent(org.eclipse.ui.navigator.INavigatorContentDescriptor,
* java.lang.Object, java.lang.Object, java.lang.Object)
*/
public synchronized ViewerSorter findSorter(INavigatorContentDescriptor source, Object parent, Object lvalue, Object rvalue) {
CommonSorterDescriptorManager dm = CommonSorterDescriptorManager.getInstance();
CommonSorterDescriptor[] descriptors;
INavigatorContentDescriptor lookupDesc;
for (int i = 0; i < sortOnlyDescriptors.length; i++) {
lookupDesc = sortOnlyDescriptors[i];
if (source != null && source.getSequenceNumber() < lookupDesc.getSequenceNumber()) {
lookupDesc = source;
source = null;
i--;
}
descriptors = dm.findApplicableSorters(contentService, lookupDesc, parent);
if (descriptors.length > 0) {
return getSorter(descriptors[0]);
}
}
if (source != null) {
descriptors = dm.findApplicableSorters(contentService, source, parent);
if (descriptors.length > 0) {
return getSorter(descriptors[0]);
}
}
return null;
}
use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.
the class UpdateActiveExtensionsOperation method execute.
/*
* (non-Javadoc)
*
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor,
* org.eclipse.core.runtime.IAdaptable)
*/
public IStatus execute(IProgressMonitor monitor, IAdaptable info) {
boolean updateExtensionActivation = false;
// we sort the array in order to use Array.binarySearch();
Arrays.sort(contentExtensionsToActivate);
IStructuredSelection ssel = null;
try {
commonViewer.getControl().setRedraw(false);
ISelection selection = commonViewer.getSelection();
if (selection instanceof IStructuredSelection)
ssel = (IStructuredSelection) selection;
INavigatorContentDescriptor[] visibleContentDescriptors = contentService.getVisibleExtensions();
int indexofContentExtensionIdToBeActivated;
/* is there a delta? */
for (int i = 0; i < visibleContentDescriptors.length && !updateExtensionActivation; i++) {
indexofContentExtensionIdToBeActivated = Arrays.binarySearch(contentExtensionsToActivate, visibleContentDescriptors[i].getId());
/*
* Either we have a filter that should be active that isn't XOR
* a filter that shouldn't be active that is currently
*/
if (indexofContentExtensionIdToBeActivated >= 0 ^ contentService.isActive(visibleContentDescriptors[i].getId())) {
updateExtensionActivation = true;
}
}
/* If so, update */
if (updateExtensionActivation) {
contentService.getActivationService().activateExtensions(contentExtensionsToActivate, true);
contentService.getActivationService().persistExtensionActivations();
Object[] expandedElements = commonViewer.getExpandedElements();
contentService.update();
commonViewer.refresh();
Object[] originalObjects = ssel.toArray();
commonViewer.setExpandedElements(expandedElements);
IStructuredSelection newSelection = new StructuredSelection(originalObjects);
commonViewer.setSelection(newSelection, true);
}
} finally {
commonViewer.getControl().setRedraw(true);
}
return Status.OK_STATUS;
}
Aggregations