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:de.uni_jena.iaa.linktype.atomic.model.pepper.wizard.PepperWizardPageModule.java
License:Apache License
/** * {@inheritDoc}/* w w w . jav a 2 s . co m*/ */ @Override public void setVisible(boolean visible) { if (visible) { P pepperModule = pepperWizard.getPepperModule(); if (pepperModule == null) { pepperModule = pepperWizard.getPreferredPepperModule(); } tableViewer.setInput(pepperWizard.getPepperModules()); tableViewer.setSelection( pepperModule != null ? new StructuredSelection(pepperModule) : StructuredSelection.EMPTY); } super.setVisible(visible); }
From source file:de.walware.ecommons.ui.components.TreeAndListGroup.java
License:Open Source License
public IStructuredSelection getListSelection() { final ISelection selection = fListViewer.getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; }/*from www .jav a 2s . co m*/ return StructuredSelection.EMPTY; }
From source file:de.walware.ecommons.ui.dialogs.QuickTreeInformationControl.java
License:Open Source License
/** * Selects the first element in the tree which matches the current filter pattern. *//*from w ww . java 2 s. c o m*/ protected void selectFirstMatch() { final Tree tree = this.treeViewer.getTree(); final Object element = findFirstMatch(tree.getItems()); if (element != null) { this.treeViewer.setSelection(new StructuredSelection(element), true); } else { this.treeViewer.setSelection(StructuredSelection.EMPTY); } }
From source file:de.walware.ecommons.ui.util.PostSelectionProviderProxy.java
License:Open Source License
protected ISelection getSelection(final ISelection originalSelection) { return (originalSelection != null) ? originalSelection : StructuredSelection.EMPTY; }
From source file:descent.internal.ui.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: * <ul>// w w w .ja v a2 s. com * <li><code>part instanceof JavaEditor</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 JavaModelException { if (part instanceof JavaEditor) return new StructuredSelection(codeResolve((JavaEditor) 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:descent.internal.ui.javaeditor.JavaOutlinePage.java
License:Open Source License
public ISelection getSelection() { if (fOutlineViewer == null) return StructuredSelection.EMPTY; return fOutlineViewer.getSelection(); }
From source file:descent.internal.ui.javaeditor.JavaOutlinePage.java
License:Open Source License
public void select(ISourceReference 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); }/*from www . java 2 s . c om*/ } } }
From source file:descent.internal.ui.text.AbstractInformationControl.java
License:Open Source License
/** * Selects the first element in the tree which * matches the current filter pattern.//w w w .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); }
From source file:descent.internal.ui.util.JavaUIHelp.java
License:Open Source License
/** * Creates and returns a help context provider for the given part. * //from w w w .j a va 2s .co m * @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 (JavaModelException ex) { JavaPlugin.log(ex); selection = StructuredSelection.EMPTY; } Object[] elements = selection.toArray(); return new JavaUIHelpContextProvider(contextId, elements); }
From source file:descent.internal.ui.wizards.buildpaths.newsourcepage.AddArchiveToBuildpathAction.java
License:Open Source License
/** * {@inheritDoc}// ww w . ja va 2s. c om */ public void selectionChanged(final SelectionChangedEvent event) { final ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { setEnabled(canHandle((IStructuredSelection) selection)); } else { setEnabled(canHandle(StructuredSelection.EMPTY)); } }