Search in sources :

Example 16 with ITreeSelection

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);
}
Also used : ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) IAction(org.eclipse.jface.action.IAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 17 with ITreeSelection

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);
            }
        }
    }
}
Also used : EndpointPropertyNode(org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointPropertyNode) ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) EndpointNode(org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.EndpointNode) AbstractEndpointNode(org.eclipse.ecf.remoteserviceadmin.ui.endpoint.model.AbstractEndpointNode) ImportReference(org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.ImportReference)

Example 18 with ITreeSelection

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;
}
Also used : ITreeSelection(org.eclipse.jface.viewers.ITreeSelection)

Example 19 with ITreeSelection

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);
    }
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) ITreePathContentProvider(org.eclipse.jface.viewers.ITreePathContentProvider) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 20 with ITreeSelection

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", "");
    }
}
Also used : ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) TreePath(org.eclipse.jface.viewers.TreePath)

Aggregations

ITreeSelection (org.eclipse.jface.viewers.ITreeSelection)56 TreePath (org.eclipse.jface.viewers.TreePath)17 ISelection (org.eclipse.jface.viewers.ISelection)16 TreeSelection (org.eclipse.jface.viewers.TreeSelection)8 ArrayList (java.util.ArrayList)7 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)7 ConsoleConfiguration (org.hibernate.console.ConsoleConfiguration)7 IFile (org.eclipse.core.resources.IFile)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 IErlFunction (org.erlide.engine.model.erlang.IErlFunction)5 IProject (org.eclipse.core.resources.IProject)4 IStatus (org.eclipse.core.runtime.IStatus)4 TreeViewer (org.eclipse.jface.viewers.TreeViewer)4 GridData (org.eclipse.swt.layout.GridData)4 Composite (org.eclipse.swt.widgets.Composite)4 TracePattern (org.erlide.tracing.core.mvc.model.TracePattern)4 Test (org.junit.Test)4 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)3 URL (java.net.URL)3 HashSet (java.util.HashSet)3