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.iw.plugins.spindle.html.HTMLContentOutlinePage.java
License:Mozilla Public License
private IStructuredSelection filterSelection(IFile file, IStructuredSelection selection) { if (selection == null || selection.isEmpty()) { return selection; }//w ww . j av a2s . co m if (file == null) { return StructuredSelection.EMPTY; } TapestryComponentModel model = editor.getComponentModel(file); if (model == null || !model.isLoaded()) { return StructuredSelection.EMPTY; } ILabelProvider provider = (ILabelProvider) getTreeViewer().getLabelProvider(); List collected = new ArrayList(); for (Iterator iter = selection.iterator(); iter.hasNext();) { ITypedRegion element = (ITypedRegion) iter.next(); String jwcId = provider.getText(element); if (jwcId.startsWith("$")) { continue; } if (editor.alreadyHasJWCID(jwcId, model)) { continue; } collected.add(jwcId); } return new StructuredSelection(collected); }
From source file:com.iw.plugins.spindle.ui.propertysheet.PropertySheetViewer.java
License:Open Source License
/** * The <code>PropertySheetViewer</code> implementation of this * <code>ISelectionProvider</code> method * returns the result as a <code>StructuredSelection</code>. * <p>// w ww . j a v a 2 s .c om * Note that this method only includes <code>IPropertySheetEntry</code> * in the selection (no categories). * </p> */ public ISelection getSelection() { if (tableTree.getSelectionCount() == 0) return StructuredSelection.EMPTY; TableTreeItem[] sel = tableTree.getSelection(); List entries = new ArrayList(sel.length); for (int i = 0; i < sel.length; i++) { TableTreeItem ti = sel[i]; Object data = ti.getData(); if (data instanceof IPropertySheetEntry) entries.add(data); } return new StructuredSelection(entries); }
From source file:com.iw.plugins.spindle.ui.widgets.SimpleTemplateSelector.java
License:Mozilla Public License
protected void fireSelectionChanged() { Template selected = getSelectedTemplate(); ISelection selection = selected == null ? StructuredSelection.EMPTY : new StructuredSelection(selected); SelectionChangedEvent event = new SelectionChangedEvent(this, selection); for (Iterator iter = fListeners.iterator(); iter.hasNext();) { ISelectionChangedListener listener = (ISelectionChangedListener) iter.next(); listener.selectionChanged(event); }/*from w ww . j a v a 2 s . c o m*/ }
From source file:com.iw.plugins.spindle.ui.widgets.TwoListSearchWidget.java
License:Mozilla Public License
public ISelection getSelection() { Object upperSelected = null;/*ww w. jav a 2 s . c o m*/ int upperSelectionIndex = upperList.getSelectionIndex(); if (upperSelectionIndex >= 0) { upperSelected = upperList.getSelection()[0].getData(); } else { return StructuredSelection.EMPTY; } Object lowerSelected = null; int lowerSelectionIndex = lowerList.getSelectionIndex(); if (lowerSelectionIndex >= 0) { lowerSelected = lowerList.getSelection()[0].getData(); } StructuredSelection selection = new StructuredSelection(new Object[] { upperSelected, lowerSelected }); return selection; }
From source file:com.knitml.dsl.ui.editor.MultiPageSelectionProvider.java
License:Open Source License
public ISelection getSelection() { IEditorPart activeEditor = multiPageEditor.getActiveEditor(); if (activeEditor != null) { ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider(); if (selectionProvider != null) { return selectionProvider.getSelection(); }/*from w ww . j a v a 2 s .c o m*/ } return StructuredSelection.EMPTY; }
From source file:com.liferay.ide.project.ui.action.NewWizardAction.java
License:Open Source License
private IStructuredSelection evaluateCurrentSelection() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { ISelection selection = window.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { return (IStructuredSelection) selection; }//from www. j a v a 2 s. c o m } return StructuredSelection.EMPTY; }
From source file:com.microsoft.tfs.client.common.ui.controls.generic.compatibility.table.CompatibilityVirtualTable.java
License:Open Source License
@Override public ISelection getSelection() { if (selectedElements == null) { return StructuredSelection.EMPTY; }//from w ww.ja v a 2 s.c om return new StructuredSelection(selectedElements.clone()); }
From source file:com.microsoft.tfs.client.common.ui.controls.vc.ConflictTable.java
License:Open Source License
@Override public ISelection getSelection() { final ConflictDescription[] selectedElements = getSelectedElements(); if (selectedElements == null) { return StructuredSelection.EMPTY; }//from w w w.ja v a 2 s. c o m return new StructuredSelection(selectedElements.clone()); }
From source file:com.microsoft.tfs.client.common.ui.controls.vc.ServerItemTreeControl.java
License:Open Source License
@Override public void setSelectedItem(final TypedServerItem serverItem) { if (serverItem == null) { setSelection(StructuredSelection.EMPTY); } else {//from w ww . j av a 2s . c o m setSelection(new StructuredSelection(serverItem)); } }
From source file:com.microsoft.tfs.client.common.ui.controls.vc.ServerItemTreeControl.java
License:Open Source License
public void setSelectedItems(final TypedServerItem[] serverItems) { if (serverItems == null) { setSelection(StructuredSelection.EMPTY); } else {/*ww w . j av a 2 s . c om*/ setSelection(new StructuredSelection(serverItems), true); } }