use of org.eclipse.jface.viewers.ITreeSelection in project egit by eclipse.
the class CompareTreeView method menuAboutToShow.
/*
* @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
* @since 2.1
*/
@Override
public void menuAboutToShow(IMenuManager manager) {
ITreeSelection selection = (ITreeSelection) tree.getSelection();
if (selection.isEmpty())
return;
manager.add(new Separator(ICommonMenuConstants.GROUP_OPEN));
manager.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
IAction openAction = createOpenAction(selection);
if (openAction != null)
manager.appendToGroup(ICommonMenuConstants.GROUP_OPEN, openAction);
MenuManager showInSubMenu = UIUtils.createShowInMenu(getSite().getWorkbenchWindow());
manager.appendToGroup(ICommonMenuConstants.GROUP_OPEN, showInSubMenu);
}
use of org.eclipse.jface.viewers.ITreeSelection in project ecf by eclipse.
the class EndpointDiscoveryView method fillContextMenu.
protected void fillContextMenu(IMenuManager manager) {
ITreeSelection selection = (ITreeSelection) viewer.getSelection();
if (selection != null) {
Object e = selection.getFirstElement();
if (e instanceof EndpointPropertyNode) {
manager.add(copyNameAction);
manager.add(copyValueAction);
} else if (e instanceof EndpointNode) {
EndpointNode edNode = (EndpointNode) e;
ImportReference ir = edNode.getImportReference();
if (ir == null) {
manager.add(importAction);
manager.add(undiscoverAction);
}
}
}
}
use of org.eclipse.jface.viewers.ITreeSelection in project titan.EclipsePlug-ins by eclipse.
the class LoggingTreeSubPage method getSelection.
public LoggingSectionHandler.LoggerTreeElement getSelection() {
ITreeSelection selection = (ITreeSelection) componentpluginViewer.getSelection();
Object o = selection.getFirstElement();
return (LoggingSectionHandler.LoggerTreeElement) o;
}
use of org.eclipse.jface.viewers.ITreeSelection in project polymap4-core by Polymap4.
the class NavigatorSaveablesService method getActiveSaveables.
public synchronized Saveable[] getActiveSaveables() {
ITreeContentProvider contentProvider = (ITreeContentProvider) viewer.getContentProvider();
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection instanceof ITreeSelection) {
return getActiveSaveablesFromTreeSelection((ITreeSelection) selection);
} else if (contentProvider instanceof ITreePathContentProvider) {
return getActiveSaveablesFromTreePathProvider(selection, (ITreePathContentProvider) contentProvider);
} else {
return getActiveSaveablesFromTreeProvider(selection, contentProvider);
}
}
use of org.eclipse.jface.viewers.ITreeSelection in project netxms by netxms.
the class ObjectBrowser method saveSelection.
/**
* Save tree viewer selection
*
* @param memento
*/
private void saveSelection(IMemento memento) {
ITreeSelection selection = (ITreeSelection) objectTree.getTreeViewer().getSelection();
if (selection.size() == 1) {
TreePath path = selection.getPaths()[0];
StringBuilder sb = new StringBuilder();
for (int i = 0; i < path.getSegmentCount(); i++) {
sb.append('/');
sb.append(((AbstractObject) path.getSegment(i)).getObjectId());
}
// $NON-NLS-1$
memento.putString("ObjectBrowser.selectedObject", sb.toString());
} else {
// $NON-NLS-1$ //$NON-NLS-2$
memento.putString("ObjectBrowser.selectedObject", "");
}
}
Aggregations