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.code.t4eclipse.tools.view.ToolBarAnalyzerView.java
License:Open Source License
public void update(CoolBar toolbar) { if (toolbar != null && !toolbar.isDisposed()) { // remove the following method will cause problem when reset input this.viewer.setSelection(StructuredSelection.EMPTY); this.viewer.setInput(toolbar); }//w w w. j av a2s.c o m }
From source file:com.google.code.t4eclipse.tools.view.ToolBarAnalyzerView.java
License:Open Source License
public void update(ICoolBarManager toolbar) { if (toolbar != null) { this.viewer.setSelection(StructuredSelection.EMPTY); this.viewer.setInput(toolbar); }//from w w w. j av a 2 s . c o m }
From source file:com.google.dart.tools.ui.actions.AbstractOpenWizardAction.java
License:Open Source License
private IStructuredSelection evaluateCurrentSelection() { IWorkbenchWindow window = DartToolsPlugin.getActiveWorkbenchWindow(); if (window != null) { ISelection selection = window.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; }//from w w w .j a v a 2 s . co m } return StructuredSelection.EMPTY; }
From source file:com.google.dart.tools.ui.callhierarchy.CallHierarchyUI.java
License:Open Source License
/** * Converts an ISelection (containing MethodWrapper instances) to an ISelection with the * MethodWrapper's replaced by their corresponding TypeMembers. If the selection contains elements * which are not MethodWrapper instances or not already TypeMember instances they are discarded. * /* w w w . jav a 2 s . com*/ * @param selection The selection to convert. * @return An ISelection containing TypeMember's in place of MethodWrapper instances. */ static ISelection convertSelection(ISelection selection) { if (selection.isEmpty()) { return selection; } if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; List<DartElement> elements = new ArrayList<DartElement>(); for (Iterator<?> iter = structuredSelection.iterator(); iter.hasNext();) { Object element = iter.next(); if (element instanceof MethodWrapper) { DartElement member = ((MethodWrapper) element).getMember(); if (member != null) { elements.add(member); } } else if (element instanceof DartElement) { elements.add((DartElement) element); } else if (element instanceof CallLocation) { DartElement member = ((CallLocation) element).getMember(); elements.add(member); } } return new StructuredSelection(elements); } return StructuredSelection.EMPTY; }
From source file:com.google.dart.tools.ui.callhierarchy.CallHierarchyViewPart.java
License:Open Source License
/** * Returns the current selection.// www.j a va 2s . co m * * @return selection */ protected ISelection getSelection() { StructuredViewer viewerInFocus = selectionProviderMediator.getViewerInFocus(); if (viewerInFocus != null) { return viewerInFocus.getSelection(); } return StructuredSelection.EMPTY; }
From source file:com.google.dart.tools.ui.internal.actions.SelectionConverter.java
License:Open Source License
/** * Converts the selection provided by the given part into a structured selection. The following * conversion rules are used:/*from w w w. ja va 2s. c o m*/ * <ul> * <li><code>part instanceof DartEditor</code>: returns a structured selection using code resolve * to convert the editor's text selection.</li> * <li><code>part instanceof IWorkbenchPart</code>: returns the part's selection if it is a * structured selection.</li> * <li><code>default</code>: returns an empty structured selection.</li> * </ul> */ public static IStructuredSelection getStructuredSelection(IWorkbenchPart part) throws DartModelException { if (part instanceof DartEditor) { return new StructuredSelection(codeResolve((DartEditor) part)); } ISelectionProvider provider = part.getSite().getSelectionProvider(); if (provider != null) { ISelection selection = provider.getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; } } return StructuredSelection.EMPTY; }
From source file:com.google.dart.tools.ui.internal.text.editor.DartOutlinePage.java
License:Open Source License
@Override public ISelection getSelection() { if (fOutlineViewer == null) { return StructuredSelection.EMPTY; }/* ww w . ja v a2 s . co m*/ return fOutlineViewer.getSelection(); }
From source file:com.google.dart.tools.ui.internal.text.editor.DartOutlinePage.java
License:Open Source License
public void select(SourceReference reference) { if (fOutlineViewer != null) { ISelection s = fOutlineViewer.getSelection(); if (s instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) s; List<?> elements = ss.toList(); if (!elements.contains(reference)) { s = (reference == null ? StructuredSelection.EMPTY : new StructuredSelection(reference)); fOutlineViewer.setSelection(s, true); }//w ww . jav a2s. c o m } } }
From source file:com.google.dart.tools.ui.internal.text.editor.DartOutlinePage_NEW.java
License:Open Source License
@Override public ISelection getSelection() { if (viewer == null) { return StructuredSelection.EMPTY; } return viewer.getSelection(); }
From source file:com.google.dart.tools.ui.internal.text.functions.AbstractInformationControl.java
License:Open Source License
/** * Selects the first element in the tree which matches the current filter pattern. *//*from w ww. j a v a 2 s. c om*/ protected void selectFirstMatch() { Tree tree = fTreeViewer.getTree(); Object element = findElement(tree.getItems()); if (element != null) { fTreeViewer.setSelection(new StructuredSelection(element), true); } else { fTreeViewer.setSelection(StructuredSelection.EMPTY); } }