Ejemplo n.º 1
0
 public void run(IAction action) {
   try {
     view.getViewSite().getWorkbenchWindow().getActivePage().showView(DatabaseBrowserView.ID);
   } catch (PartInitException e) {
     e.printStackTrace();
     String message = Messages.OpenInBrowserViewAction__errmsg_open_dbview;
     ExceptionDetailsDialog.openError(null, message, IStatus.ERROR, DatabasePlugin.PLUGIN_ID, e);
   }
 }
Ejemplo n.º 2
0
 private IAction getChartAction(IViewPart view) {
   IAction result = null;
   IToolBarManager manager = view.getViewSite().getActionBars().getToolBarManager();
   for (IContributionItem item : manager.getItems()) {
     if (item instanceof ActionContributionItem) {
       ActionContributionItem actionItem = (ActionContributionItem) item;
       if (actionItem.getAction().getId().equals(MassifViewPart.CHART_ACTION)) {
         result = actionItem.getAction();
       }
     }
   }
   return result;
 }
Ejemplo n.º 3
0
  public void setActiveView(IViewPart part) {
    IActionBars actionBars = part.getViewSite().getActionBars();
    if (!(part instanceof PropertySheet)) {
      actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), removeAction);
      actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cutAction);
      actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
      actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);
    }
    actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
    actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);

    actionBars.updateActionBars();
  }
Ejemplo n.º 4
0
 /**
  * Show something in the status line; this is used when we don't have easy access to the view for
  * getting the StatusLineManager.
  *
  * @param message
  * @param debugMessage
  */
 private void showStatusMessage(String message, String debugMessage) {
   if (false) {
     message += " - "; // $NON-NLS-1$
     message += debugMessage;
   }
   IWorkbenchWindow ww = CommonPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
   IWorkbenchPage page = ww.getActivePage();
   IViewReference[] viewRefs = page.getViewReferences();
   for (int j = 0; j < viewRefs.length; j++) {
     IViewReference reference = viewRefs[j];
     IViewPart vp = reference.getView(false);
     if (vp != null) {
       vp.getViewSite().getActionBars().getStatusLineManager().setMessage(message);
     }
   }
 }
  /** @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars) */
  @Override
  public void setActionBars(final IActionBars actionBars) {
    // Override the undo and redo global action handlers
    // to use the contributor action handlers
    IActionBars partActionBars = null;
    if (contributor instanceof IEditorPart) {
      final IEditorPart editorPart = (IEditorPart) contributor;
      partActionBars = editorPart.getEditorSite().getActionBars();
    } else if (contributor instanceof IViewPart) {
      final IViewPart viewPart = (IViewPart) contributor;
      partActionBars = viewPart.getViewSite().getActionBars();
    }

    if (partActionBars != null) {
      IAction action = partActionBars.getGlobalActionHandler(ActionFactory.UNDO.getId());
      if (action != null) {
        actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), action);
      }
      action = partActionBars.getGlobalActionHandler(ActionFactory.REDO.getId());
      if (action != null) {
        actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), action);
      }
    }
  }
 /**
  * Creates a new <code>DartSearchActionGroup</code>. The group requires that the selection
  * provided by the part's selection provider is of type <code>
  * org.eclipse.jface.viewers.IStructuredSelection</code>.
  *
  * @param part the view part that owns this action group
  */
 public DartSearchActionGroup_OLD(IViewPart part) {
   this(part.getViewSite());
 }
 /* (non-Javadoc)
  * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
  */
 public void init(IViewPart view) {
   this.window = view.getViewSite().getWorkbenchWindow();
 }
 @Override
 public void init(IViewPart view) {
   this.view = view;
   shell = view.getViewSite().getShell();
   System.out.println("VIEW::" + view.getClass());
 }
 /** @see IViewActionDelegate#init(IViewPart) */
 public void init(IViewPart view) {
   super.init(view);
   DebugPlugin.getDefault().addDebugEventListener(this);
   setWindow(view.getViewSite().getWorkbenchWindow());
 }