/*
  * (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);
 }
Exemple #2
0
 @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);
  }