List of usage examples for org.eclipse.jface.viewers StructuredSelection EMPTY
StructuredSelection EMPTY
To view the source code for org.eclipse.jface.viewers StructuredSelection EMPTY.
Click Source Link
From source file:com.google.dart.tools.ui.internal.text.functions.DartOutlineInformationControl_NEW.java
License:Open Source License
/** * Selects the first {@link TreeItem} which matches the {@link #matcher}. *///from w ww. j ava2s .c o m private void selectFirstMatch() { Tree tree = viewer.getTree(); TreeItem item = findFirstMatchingItem(tree.getItems()); if (item != null) { viewer.setSelection(new StructuredSelection(item), true); } else { viewer.setSelection(StructuredSelection.EMPTY); } }
From source file:com.google.dart.tools.ui.internal.util.DartUIHelp.java
License:Open Source License
/** * Creates and returns a help context provider for the given part. * //from w ww. j a v a2s . c om * @param part the part for which to create the help context provider * @param contextId the optional context ID used to retrieve static help * @return the help context provider */ public static IContextProvider getHelpContextProvider(IWorkbenchPart part, String contextId) { IStructuredSelection selection; try { selection = SelectionConverter.getStructuredSelection(part); } catch (DartModelException ex) { DartToolsPlugin.log(ex); selection = StructuredSelection.EMPTY; } Object[] elements = selection.toArray(); return new JavaUIHelpContextProvider(contextId, elements); }
From source file:com.google.dart.tools.ui.internal.viewsupport.SelectionProviderMediator.java
License:Open Source License
@Override public ISelection getSelection() { if (fViewerInFocus != null) { return fViewerInFocus.getSelection(); }/* w ww .ja v a2 s . c o m*/ return StructuredSelection.EMPTY; }
From source file:com.google.gdt.eclipse.core.actions.AbstractOpenWizardAction.java
License:Open Source License
private IStructuredSelection evaluateCurrentSelection() { IWorkbenchWindow window = JavaPlugin.getActiveWorkbenchWindow(); if (window != null) { ISelection localSelection = window.getSelectionService().getSelection(); if (localSelection instanceof IStructuredSelection) { return (IStructuredSelection) localSelection; }//from w w w . ja v a 2s . c o m } return StructuredSelection.EMPTY; }
From source file:com.google.gdt.eclipse.suite.actions.OpenNewWebApplicationWizardToolbarAction.java
License:Open Source License
public void selectionChanged(IAction action, ISelection selection) { if (selection instanceof IStructuredSelection) { setSelection((IStructuredSelection) selection); } else {/* w w w . j a v a2 s . c om*/ setSelection(StructuredSelection.EMPTY); } }
From source file:com.hangum.tadpole.commons.viewsupport.SelectionProviderMediator.java
License:Open Source License
public ISelection getSelection() { if (fViewerInFocus != null) { return fViewerInFocus.getSelection(); } return StructuredSelection.EMPTY; }
From source file:com.isencia.passerelle.workbench.model.editor.ui.views.ActorPalettePage.java
License:Open Source License
/** * Returns the current selection for this provider. * //from w ww .ja va2 s . c om * @return the current selection */ public ISelection getSelection() { if (getTreeViewer() == null) { return StructuredSelection.EMPTY; } return getTreeViewer().getSelection(); }
From source file:com.iw.plugins.spindle.editors.spec.outline.TapestryOutlinePage.java
License:Mozilla Public License
public ISelection getSelection() { if (treeViewer == null) return StructuredSelection.EMPTY; return treeViewer.getSelection(); }
From source file:com.iw.plugins.spindle.editors.spec.outline.XMLOutlinePage.java
License:Mozilla Public License
public void setSelection(ISelection selection) { if (!selection.isEmpty() && selection instanceof IStructuredSelection) { Object selected = ((IStructuredSelection) selection).getFirstElement(); if (selected instanceof IRegion && fRoot != null) { int documentOffset = ((IRegion) selected).getOffset(); Object found = null;/* w w w . j ava 2 s. c om*/ for (int i = 0; i < fFlatChildren.length; i++) { Position p = (Position) fFlatChildren[i]; if (p.offset <= documentOffset && documentOffset < p.offset + p.length) { found = p; } } if (found == null) { int index = 0; boolean exists = false; for (; index < fCorresponders.length; index++) { Position p = (Position) fCorresponders[index]; if (p != null && p.offset <= documentOffset && documentOffset < p.offset + p.length) { exists = true; break; } } if (exists) found = fFlatChildren[index]; } if (found != null) { treeViewer.setSelection(new StructuredSelection(found)); } else if (treeViewer != null && !treeViewer.getControl().isDisposed()) { treeViewer.setSelection(StructuredSelection.EMPTY); } } super.setSelection(selection); } }
From source file:com.iw.plugins.spindle.editors.spec.TreeInformationControl.java
License:Mozilla Public License
/** * Selects the first element in the tree which matches the current filter * pattern./* ww w . j a va 2s .com*/ */ private void selectFirstMatch() { Tree tree = fTreeViewer.getTree(); Object element = findElement(tree.getItems()); if (element != null) { Object parent = fContentProvider.getParent(element); if (parent != null) fTreeViewer.setSelection(new StructuredSelection(), true); fTreeViewer.setSelection(new StructuredSelection(element), true); } else { fTreeViewer.setSelection(StructuredSelection.EMPTY); } }