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:org.bonitasoft.studio.validators.ui.property.section.ValidatorsPropertySection.java
License:Open Source License
public void select(Validator validator) { /*Unselect in order to avoid issues with databinding*/ tableViewer.setSelection(StructuredSelection.EMPTY); tableViewer.refresh(true);// w w w .j av a 2 s . c om tableViewer.setSelection(new StructuredSelection(validator)); }
From source file:org.brainwy.liclipsetext.editor.views.partitioning.LiClipsePartitioningView.java
License:Open Source License
public ISelection getSelection() { if (treeViewer == null) { return StructuredSelection.EMPTY; } return treeViewer.getSelection(); }
From source file:org.codecover.eclipse.views.CoverageView.java
License:Open Source License
private void performFullUpdate() { synchronized (this.updateLock) { if (!this.viewer.getControl().isDisposed()) { /*//from w w w.j a v a2 s .c o m * The selection is set to EMPTY to prevent a bug/feature of the * tree viewer (StructuredViewer/AbstractTreeViewer) which tries * to restore the selection even after a call to setInput (which * can change the content of the viewer totally). The problem * is that the tree viewer seems to buffer the objects * (HierarchyLevels) which are selected before the call to * setInput and then tries to restore the selection by looking * for the elements in the content provider of the viewer, which * includes calls to ITreeContentProvider.getParent which in * turn calls TestSessionContainer.getParentOfHierarchyLevel of * the newly set (via setInput) TSC. The latter doesn't like * getting requests for HierarchyLevels which don't belong to * its test session container (they belong to the old TSC which * was active before the call to setInput) and throws an * exception. */ this.viewer.setSelection(StructuredSelection.EMPTY); this.viewer.setInput(this.getVisTSC()); if (this.getVisActiveTSCInfo() != null) { this.restoreExpandedElements(this.getVisActiveTSCInfo()); } } } }
From source file:org.cropinformatics.ui.actions.WorkbenchWizardAction.java
License:Apache License
@Override public final void run(IAction action) { IWorkbenchWizard wizard = createWorkbenchWizard(); ISelection selection = getWindow().getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) wizard.init(getWindow().getWorkbench(), (IStructuredSelection) selection); else/* ww w. ja va 2 s. c o m*/ wizard.init(getWindow().getWorkbench(), StructuredSelection.EMPTY); WizardDialog dialog = new WizardDialog(getWindow().getShell(), wizard); dialog.open(); }
From source file:org.cropinformatics.ui.components.impl.AbstractComboViewerEditComponent.java
License:Apache License
private void updateSelection() { E parsedValue = parseFromValue(getValue()); if (parsedValue != null) comboViewer.setSelection(new StructuredSelection(parseFromValue(getValue()))); else//from w w w.j a v a 2 s . c o m comboViewer.setSelection(StructuredSelection.EMPTY); }
From source file:org.cs3.pdt.editor.internal.views.lightweightOutline.AbstractInformationControl.java
License:Open Source License
/** * Selects the first element in the tree which * matches the current filter pattern./* w ww. j av a 2 s .co m*/ */ protected void selectFirstMatch() { Object selectedElement = fTreeViewer.testFindItem(fInitiallySelectedElement); TreeItem element; final Tree tree = fTreeViewer.getTree(); if (selectedElement instanceof TreeItem) element = findElement(new TreeItem[] { (TreeItem) selectedElement }); else element = findElement(tree.getItems()); if (element != null) { tree.setSelection(element); tree.showItem(element); } else fTreeViewer.setSelection(StructuredSelection.EMPTY); }
From source file:org.csstudio.display.builder.rcp.run.ContextMenuSupport.java
License:Open Source License
/** Create SWT context menu * @param site RCP site//ww w .j a va2 s .com * @param parent Parent SWT widget * @param representation Representation */ public ContextMenuSupport(final RuntimeViewPart view, final Control parent, final RCP_JFXRepresentation representation) { this.view = view; final IWorkbenchPartSite site = view.getSite(); shell = site.getShell(); // Tried to use a JFX context menu on the individual items, // but adding the existing PV contributions requires parsing // the registry and creating suitable JFX menu entries. // Finally, it was unclear how to set the "activeMenuSelection" // required by existing object contributions. // // So using SWT context menu, automatically populated with PV contributions. // Selection provider to inform RCP about PV for the context menu final ISelectionProvider sel_provider = new RCPSelectionProvider(); site.setSelectionProvider(sel_provider); // RCP context menu w/ "additions" placeholder for contributions final MenuManager mm = new MenuManager(); mm.setRemoveAllWhenShown(true); mm.addMenuListener(manager -> fillContextMenu(manager)); site.registerContextMenu(mm, sel_provider); // Create menu .. final Menu menu = mm.createContextMenu(parent); // .. but _don't_ attach to SWT control // parent.setMenu(menu); // Menu is shown by representation listener _after_ // setting the selection to widget's PV final ToolkitListener tkl = new ToolkitListener() { @Override public void handleContextMenu(final Widget widget) { IStructuredSelection sel = StructuredSelection.EMPTY; final Optional<WidgetProperty<String>> name_prop = widget.checkProperty(propPVName); if (name_prop.isPresent()) { final String pv_name = name_prop.get().getValue(); if (!pv_name.isEmpty()) sel = new StructuredSelection(new ProcessVariable(pv_name)); } sel_provider.setSelection(sel); // Show the menu view.setActiveWidget(widget); menu.setVisible(true); } @Override public void handleClick(final Widget widget, final boolean with_control) { // Track the widget that was last clicked (for DnD hack) view.setActiveWidget(widget); } }; representation.addListener(tkl); parent.addDisposeListener(event -> representation.removeListener(tkl)); }
From source file:org.csstudio.opibuilder.actions.AbstractWidgetTargetAction.java
License:Open Source License
protected IStructuredSelection getSelection() { if (selection != null) return selection; else/*www. ja v a 2s .com*/ return StructuredSelection.EMPTY; }
From source file:org.csstudio.opibuilder.visualparts.ActionsInputDialog.java
License:Open Source License
private void refreshActionsViewer(AbstractWidgetAction widgetAction) { actionsViewer.refresh();//from ww w. j a v a 2 s . c o m if (widgetAction == null) actionsViewer.setSelection(StructuredSelection.EMPTY); else { actionsViewer.setSelection(new StructuredSelection(widgetAction)); } }