@Override public void doubleClick(DoubleClickEvent event) { IStructuredSelection sel = (IStructuredSelection) checkboxTableViewer.getSelection(); ESelectionService eSelectionService = getEclipseContext().get(ESelectionService.class); eSelectionService.setSelection(sel.getFirstElement()); }
@Inject void setSelectionService(@Optional ESelectionService selectionService) { if (this.selectionService != null) { this.selectionService.removeSelectionListener(listener); this.selectionService.removePostSelectionListener(postListener); } if (selectionService != null) { selectionService.addSelectionListener(listener); selectionService.addPostSelectionListener(postListener); this.selectionService = selectionService; } }
/* * (non-Javadoc) * * @see org.eclipse.ui.ISelectionService#getSelection(java.lang.String) */ public ISelection getSelection(String partId) { Object selection = selectionService.getSelection(partId); if (selection == null || selection instanceof ISelection) { return (ISelection) selection; } return new StructuredSelection(selection); }
@CanExecute public Boolean canExecute(ESelectionService selectionService) { Object sel = selectionService.getSelection(); if (sel instanceof IStructuredSelection) { Object o = ((IStructuredSelection) sel).getFirstElement(); return o instanceof IWaveform<?> || o instanceof ITx; } return false; }
/* * (non-Javadoc) * * @see org.eclipse.ui.ISelectionService#getSelection() */ public ISelection getSelection() { if (activePart != null) { // get the selection from the active part ISelectionProvider selectionProvider = activePart.getSite().getSelectionProvider(); return selectionProvider == null ? null : selectionProvider.getSelection(); } Object selection = selectionService.getSelection(); if (selection == null || selection instanceof ISelection) { return (ISelection) selection; } return new StructuredSelection(selection); }
/* * (non-Javadoc) * * @see * org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged( * org.eclipse.jface.viewers.SelectionChangedEvent) */ public void selectionChanged(SelectionChangedEvent e) { MPart part = page.findPart(activePart); ESelectionService selectionService = (ESelectionService) part.getContext().get(ESelectionService.class.getName()); selectionService.setSelection(e.getSelection()); }