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.microsoft.tfs.client.common.ui.framework.action.SelectionProviderAction.java
License:Open Source License
/** * Provides a new {@link ISelectionProvider} for this * {@link SelectionProviderAction} to track. If there is an existing * {@link ISelectionProvider}, it will be disassociated from this * {@link SelectionProviderAction}. This method will trigger a call to * {@link #selectionChanged(ISelection)}. * * @param selectionProvider/*from ww w . j a v a 2 s .c o m*/ * a new {@link ISelectionProvider} to track or <code>null</code> */ public void setSelectionProvider(final ISelectionProvider selectionProvider) { dispose(); this.selectionProvider = selectionProvider; if (selectionProvider != null) { selectionProvider.addSelectionChangedListener(selectionChangedListener); selectionChanged(selectionProvider.getSelection()); } else { selectionChanged(StructuredSelection.EMPTY); } }
From source file:com.microsoft.tfs.client.common.ui.framework.selection.SwitchingSelectionProvider.java
License:Open Source License
/** * Sets a new {@link ISelectionProvider} for this * {@link SwitchingSelectionProvider}. Any {@link ISelectionChangedListener} * s that are registered with this {@link SwitchingSelectionProvider} will * receive {@link SelectionChangedEvent}s. The new * {@link ISelectionProvider} may be <code>null</code>. * * @param selectionProvider//w w w . jav a 2 s . co m * a new {@link ISelectionProvider} to use (may be <code>null</code>) */ public void setSelectionProvider(final ISelectionProvider selectionProvider) { synchronized (currentWrappedProviderLock) { if (currentWrappedProvider != null) { currentWrappedProvider.removeSelectionChangedListener(selectionChangedListener); if (currentWrappedProvider instanceof IPostSelectionProvider) { ((IPostSelectionProvider) currentWrappedProvider) .removePostSelectionChangedListener(postSelectionChangedListener); } } currentWrappedProvider = selectionProvider; if (selectionProvider != null) { selectionProvider.addSelectionChangedListener(selectionChangedListener); if (selectionProvider instanceof IPostSelectionProvider) { ((IPostSelectionProvider) selectionProvider) .addPostSelectionChangedListener(postSelectionChangedListener); } } final ISelection selection = (selectionProvider != null ? selectionProvider.getSelection() : StructuredSelection.EMPTY); selectionChangedListener.fireChildListeners(selection); postSelectionChangedListener.fireChildListeners(selection); } }
From source file:com.microsoft.tfs.client.common.ui.framework.selection.SwitchingSelectionProvider.java
License:Open Source License
@Override public ISelection getSelection() { synchronized (currentWrappedProviderLock) { if (currentWrappedProvider != null) { return currentWrappedProvider.getSelection(); }//from w w w . j ava2s . c om } return StructuredSelection.EMPTY; }
From source file:com.microsoft.tfs.client.common.ui.framework.table.TableControl.java
License:Open Source License
@Override public ISelection getSelection() { if (selectedElements == null) { return StructuredSelection.EMPTY; }//from w w w.j a va2 s . co m /* * Note: StructuredSelection's constructor makes a copy of the passed-in * array. */ return new StructuredSelection(selectedElements); }
From source file:com.microsoft.tfs.client.common.ui.framework.table.TableControl.java
License:Open Source License
/** * Sets the currently selected elements in this {@link TableControl}. Any * existing selection is discarded. Any changes in the selected elements * will be reported to registered {@link ISelectionChangedListener}s. * * @param elementsToSelect/*from ww w .ja va 2s. c om*/ * the elements that should be selected in this control, or * <code>null</code> if no elements should be selected */ public void setSelectedElements(final Object[] elementsToSelect) { ISelection selection; if (elementsToSelect == null) { selection = StructuredSelection.EMPTY; } else { selection = new StructuredSelection(elementsToSelect); } setSelection(selection); }
From source file:com.microsoft.tfs.client.common.ui.framework.table.TableControl.java
License:Open Source License
/** * Sets the currently selected element in this {@link TableControl}. Any * existing selection is discarded. Any changes in the selected elements * will be reported to registered {@link ISelectionChangedListener}s. * * @param elementToSelect/* w ww. j ava 2 s . co m*/ * the element that should be selected in this control, or * <code>null</code> if no element should be selected */ public void setSelectedElement(final Object elementToSelect) { ISelection selection; if (elementToSelect == null) { selection = StructuredSelection.EMPTY; } else { selection = new StructuredSelection(elementToSelect); } setSelection(selection); }
From source file:com.microsoft.tfs.client.common.ui.framework.table.TableControl.java
License:Open Source License
/** * Unselects all elements in this {@link TableControl}. Any existing * selection is discarded. Any changes in the selected elements will be * reported to registered {@link ISelectionChangedListener}s. *//*from www . j a v a2 s . com*/ public void unselectAll() { setSelection(StructuredSelection.EMPTY); }
From source file:com.mountainminds.eclemma.internal.ui.actions.ExportSessionAction.java
License:Open Source License
public void run() { IWorkbenchWizard wizard = new SessionExportWizard(); wizard.init(window.getWorkbench(), StructuredSelection.EMPTY); WizardDialog dialog = new WizardDialog(window.getShell(), wizard); dialog.open();/* w w w . j ava2 s . co m*/ }
From source file:com.mountainminds.eclemma.internal.ui.actions.ImportSessionAction.java
License:Open Source License
public void run() { IWorkbenchWizard wizard = new SessionImportWizard(); wizard.init(window.getWorkbench(), StructuredSelection.EMPTY); WizardDialog dialog = new WizardDialog(window.getShell(), wizard); dialog.open();//from w ww.ja v a 2 s. c o m }
From source file:com.netxforge.netxstudio.screens.f3.NewEditSite.java
License:Open Source License
@Override public ISelection getSelection() { if (site != null) { return new StructuredSelection(site); } else/*from ww w. jav a 2s .c o m*/ return StructuredSelection.EMPTY; }