use of org.eclipse.ui.Saveable in project polymap4-core by Polymap4.
the class NavigatorSaveablesService method getSaveable.
/**
* @param element
* @return the saveable associated with the given element
*/
private Saveable getSaveable(Object element) {
if (saveablesProviderMap == null) {
// has the side effect of recomputing saveablesProviderMap:
getSaveablesProviders();
}
for (Iterator sItr = saveablesProviderMap.keySet().iterator(); sItr.hasNext(); ) {
NavigatorContentDescriptor descriptor = (NavigatorContentDescriptor) sItr.next();
if (descriptor.isTriggerPoint(element) || descriptor.isPossibleChild(element)) {
SaveablesProvider provider = (SaveablesProvider) saveablesProviderMap.get(descriptor);
Saveable saveable = provider.getSaveable(element);
if (saveable != null) {
return saveable;
}
}
}
return null;
}
use of org.eclipse.ui.Saveable in project polymap4-core by Polymap4.
the class NavigatorSaveablesService method findSaveable.
/**
* @param path
* @return a saveable, or null
*/
private Saveable findSaveable(TreePath path) {
int count = path.getSegmentCount();
for (int j = count - 1; j >= 0; j--) {
Object parent = path.getSegment(j);
Saveable saveable = getSaveable(parent);
if (saveable != null) {
return saveable;
}
}
return null;
}
use of org.eclipse.ui.Saveable in project polymap4-core by Polymap4.
the class NavigatorSaveablesService method getActiveSaveablesFromTreeProvider.
/**
* @param selection
* @param contentProvider
* @return the active saveables
*/
private Saveable[] getActiveSaveablesFromTreeProvider(IStructuredSelection selection, ITreeContentProvider contentProvider) {
Set result = new HashSet();
for (Iterator it = selection.iterator(); it.hasNext(); ) {
Object element = it.next();
Saveable saveable = findSaveable(element, contentProvider);
if (saveable != null) {
result.add(saveable);
}
}
return (Saveable[]) result.toArray(new Saveable[result.size()]);
}
use of org.eclipse.ui.Saveable in project polymap4-core by Polymap4.
the class NavigatorSaveablesService method findSaveable.
/**
* @param element
* @param contentProvider
* @return the saveable, or null
*/
private Saveable findSaveable(Object element, ITreeContentProvider contentProvider) {
while (element != null) {
Saveable saveable = getSaveable(element);
if (saveable != null) {
return saveable;
}
element = contentProvider.getParent(element);
}
return null;
}
use of org.eclipse.ui.Saveable 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()]);
}
Aggregations