use of org.eclipse.jface.viewers.TreePath in project polymap4-core by Polymap4.
the class CommonViewerSorter method isSorterProperty.
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ViewerComparator#isSorterProperty(java.lang.Object, java.lang.String)
*/
public boolean isSorterProperty(Object element, String property) {
// Have to get the parent path from the content provider
NavigatorContentServiceContentProvider cp = (NavigatorContentServiceContentProvider) contentService.createCommonContentProvider();
TreePath[] parentPaths = cp.getParents(element);
for (int i = 0; i < parentPaths.length; i++) {
if (isSorterProperty(parentPaths[i], element, property))
return true;
}
return false;
}
use of org.eclipse.jface.viewers.TreePath in project polymap4-core by Polymap4.
the class SafeDelegateTreeContentProvider method getParents.
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreePathContentProvider#getParents(java.lang.Object)
*/
public TreePath[] getParents(Object element) {
if (contentProvider instanceof ITreePathContentProvider) {
ITreePathContentProvider tpcp = (ITreePathContentProvider) contentProvider;
return tpcp.getParents(element);
}
ArrayList segments = new ArrayList();
Object parent = element;
do {
parent = contentProvider.getParent(parent);
if (parent != null && parent != viewer.getInput())
segments.add(0, parent);
} while (parent != null && parent != viewer.getInput());
if (!segments.isEmpty()) {
// Loop backwards over the array to create the path.
return new TreePath[] { new TreePath(segments.toArray()) };
}
return NO_PATHS;
}
use of org.eclipse.jface.viewers.TreePath 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;
}
use of org.eclipse.jface.viewers.TreePath in project polymap4-core by Polymap4.
the class NavigatorSaveablesService method getActiveSaveablesFromTreeSelection.
/**
* @param selection
* @return the active saveables
*/
private Saveable[] getActiveSaveablesFromTreeSelection(ITreeSelection selection) {
Set result = new HashSet();
TreePath[] paths = selection.getPaths();
for (int i = 0; i < paths.length; i++) {
TreePath path = paths[i];
Saveable saveable = findSaveable(path);
if (saveable != null) {
result.add(saveable);
}
}
return (Saveable[]) result.toArray(new Saveable[result.size()]);
}
use of org.eclipse.jface.viewers.TreePath in project polymap4-core by Polymap4.
the class NavigatorSaveablesService method getActiveSaveablesFromTreePathProvider.
/**
* @param selection
* @param provider
* @return the active saveables
*/
private Saveable[] getActiveSaveablesFromTreePathProvider(IStructuredSelection selection, ITreePathContentProvider provider) {
Set result = new HashSet();
for (Iterator it = selection.iterator(); it.hasNext(); ) {
Object element = it.next();
Saveable saveable = getSaveable(element);
if (saveable != null) {
result.add(saveable);
} else {
TreePath[] paths = provider.getParents(element);
saveable = findSaveable(paths);
if (saveable != null) {
result.add(saveable);
}
}
}
return (Saveable[]) result.toArray(new Saveable[result.size()]);
}
Aggregations