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.archimatetool.editor.diagram.DiagramEditorFindReplaceProviderTests.java
License:Open Source License
@Before public void runOnceBeforeEachTest() { // Deselect all nodes in Viewer editor.getGraphicalViewer().setSelection(StructuredSelection.EMPTY); }
From source file:com.archimatetool.editor.views.tree.TreeModelViewerFindReplaceProviderTests.java
License:Open Source License
@Before public void runOnceBeforeEachTest() { // Deselect all nodes in Tree treeViewer.setSelection(StructuredSelection.EMPTY); }
From source file:com.architexa.org.eclipse.gef.ui.actions.SelectionAction.java
License:Open Source License
/** * @see com.architexa.org.eclipse.gef.Disposable#dispose() *//*www. j a va 2s .co m*/ public void dispose() { this.selection = StructuredSelection.EMPTY; super.dispose(); }
From source file:com.architexa.org.eclipse.gef.ui.parts.ContentOutlinePage.java
License:Open Source License
/** * Forwards selection request to the viewer. * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() *///from ww w .j a va2 s. com public ISelection getSelection() { //$TODO when could this even happen? if (getViewer() == null) return StructuredSelection.EMPTY; return getViewer().getSelection(); }
From source file:com.atlassian.connector.eclipse.ui.actions.AbstractResourceAction.java
License:Open Source License
public void selectionChanged(IAction action, ISelection selection) { if (selection instanceof IStructuredSelection) { selectionChanged((IStructuredSelection) selection); } else {//from w w w . jav a2s . c o m selectionChanged(StructuredSelection.EMPTY); } action.setEnabled(isEnabled()); }
From source file:com.axmor.eclipse.typescript.editor.TypeScriptQuickOutlineDialog.java
License:Open Source License
/** * Selects the first element in the tree which * matches the current filter pattern./*from ww w. j a v a2 s .c o m*/ */ private void selectFirstMatch() { Tree tree = treeViewer.getTree(); Object element = findFirstMatchToPattern(tree.getItems()); if (element != null) { treeViewer.setSelection(new StructuredSelection(element), true); } else { treeViewer.setSelection(StructuredSelection.EMPTY); } }
From source file:com.bdaum.zoom.ui.internal.NavigationHistory.java
License:Open Source License
public void resetHistory() { previousStack.clear();//from w ww .ja va2 s .com nextStack.clear(); selectedAssets = AssetSelection.EMPTY; otherSelection = StructuredSelection.EMPTY; fireSelection(null, new StructuredSelection(ICollectionProcessor.EMPTYCOLLECTION)); }
From source file:com.bdaum.zoom.ui.internal.views.AbstractGalleryView.java
License:Open Source License
public ISelection getSelection() { return (selection != null) ? selection : StructuredSelection.EMPTY; }
From source file:com.bdaum.zoom.ui.internal.views.CatalogView.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { undoContext = new UndoContext() { @Override/*w w w . j a v a2s .co m*/ public String getLabel() { return Messages.getString("CatalogView.catalog_undo_context"); //$NON-NLS-1$ } }; viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); drillDownAdapter = new DrillDownAdapter((TreeViewer) viewer); viewer.setContentProvider(new CatalogContentProvider()); viewer.setLabelProvider(new CatalogLabelProvider(this)); viewer.setFilters(new ViewerFilter[] { colorCodeFilter, userFilter }); viewer.setComparator(new CatalogComparator()); viewer.setComparer(IdentifiedElementComparer.getInstance()); UiUtilities.installDoubleClickExpansion((TreeViewer) viewer); ZColumnViewerToolTipSupport.enableFor(viewer); PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), HelpContextIds.CATALOG_VIEW); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(final SelectionChangedEvent event) { selectionChanged = true; if (viewer.getStructuredSelection().getFirstElement() == WASTEBASKET) { try { getSite().getPage().showView(TrashcanView.ID); } catch (PartInitException e) { // shouldn't happen } return; } if (!settingSelection) { cancelJobs(CatalogView.this); new SelectionJob(viewer, event).schedule(); } if (cntrlDwn && editItemAction.isEnabled()) { if (!settingSelection) editItemAction.run(); cntrlDwn = false; } } }); addCtrlKeyListener(); viewer.addDropSupport(OPERATIONS, allTypes, new CatalogDropTargetListener(viewer.getControl())); viewer.addDragSupport(DND.DROP_MOVE, new Transfer[] { selectionTransfer }, new CatalogDragSourceListener()); addKeyListener(); Tree tree = ((TreeViewer) viewer).getTree(); addGestureListener(tree); makeActions(); installListeners(); hookContextMenu(viewer); contributeToActionBars(); addDragDropClipboard(tree); getSite().getWorkbenchWindow().addPerspectiveListener(this); Core.getCore().addCatalogListener(new CatalogAdapter() { @Override public void structureModified() { Shell shell = getSite().getShell(); if (shell != null && !shell.isDisposed()) shell.getDisplay().asyncExec(() -> { if (!shell.isDisposed()) refresh(); }); } @Override public void assetsModified(BagChange<Asset> changes, QueryField node) { forceSelectionUpdate(); } @Override public void applyRules(Collection<? extends Asset> assets, QueryField node) { OperationJob.executeSlaveOperation( new AutoRuleOperation(UiActivator.getDefault().obtainAutoRules(), assets, node), CatalogView.this, false); } private void forceSelectionUpdate() { Shell shell = getSite().getShell(); if (shell != null && !shell.isDisposed()) shell.getDisplay().asyncExec(() -> { if (!shell.isDisposed()) { ISelection selection = viewer.getSelection(); viewer.setSelection(StructuredSelection.EMPTY); setViewerSelection(selection, true); fireSelection(new SelectionChangedEvent(CatalogView.this, selection)); } }); } @Override public void setCatalogSelection(final ISelection selection, final boolean forceUpdate) { try { Job.getJobManager().join(CatalogView.this, null); } catch (Exception e) { // do nothing } Shell shell = getSite().getShell(); if (shell != null && !shell.isDisposed()) shell.getDisplay().asyncExec(() -> { if (!shell.isDisposed()) setSelection(selection, forceUpdate); }); } @Override public void catalogOpened(boolean newDb) { Display display = getSite().getShell().getDisplay(); display.syncExec(() -> BusyIndicator.showWhile(display, () -> { structureModified(); restoreLastSelection(); catOpen = true; })); } @Override public void catalogClosed(int mode) { if (mode != CatalogListener.EMERGENCY) { saveLastSelection(); catOpen = false; } } }); updateActions(viewer.getStructuredSelection(), true); }
From source file:com.bdaum.zoom.ui.internal.views.CatalogView.java
License:Open Source License
public void setSelection(ISelection selection) { if (selection instanceof IStructuredSelection) { Object firstElement = ((IStructuredSelection) selection).getFirstElement(); if ((firstElement instanceof SlideShow && ((SlideShow) firstElement).getAdhoc()) || (firstElement instanceof SmartCollection && ((SmartCollection) firstElement).getAdhoc())) selection = StructuredSelection.EMPTY; setViewerSelection(selection, selectionChanged); updateActions((IStructuredSelection) selection, false); }// w w w.j ava 2s .co m }