/**
   * Sets the active page of the the multi-page editor to be the given editor. Switch the currently
   * active editor.
   *
   * <p>This method is called whenever the page changes. Subclasses must implement this method to
   * redirect actions to the given editor (if not already directed to it).
   *
   * @param activeEditor the new active editor, or <code>null</code> if there is no active page, or
   *     if the active page does not have a corresponding editor
   */
  @Override
  public void setActivePage(IEditorPart activeEditor) {
    // Check if we are already initialized
    // Return if we are not
    if (getPage() == null) return;

    // skip if the activeEditor doesn't change.
    if (activeEditor == activeNestedEditor) return;

    if (log.isLoggable(Level.FINE)) {
      log.fine("setActivePage(" + activeEditor + " " + ")");
    }

    activeNestedEditor = activeEditor;

    //		System.out.println(this.getClass().getSimpleName()
    //				+ ".setActivePage(" + activeEditor
    //				+ ") :" + getActiveContributor());

    // Propagate call if possible
    // Call setActiveEditor() on nested contributor.
    IEditorActionBarContributor contributor = getActiveContributor();
    if (contributor != this && contributor instanceof EditorActionBarContributor)
      ((EditorActionBarContributor) contributor).setActiveEditor(activeEditor);

    //		if(contributor != this && contributor instanceof IMultiPageEditorActionBarContributor)
    //			((IMultiPageEditorActionBarContributor)contributor).setActivePage(activeEditor);

  }
 public void dispose() {
   super.dispose();
   undoAction.removePropertyChangeListener(this);
   redoAction.removePropertyChangeListener(this);
   if (workbench != null) {
     workbench.removePartListener(this);
   }
 }
Example #3
0
 @Override
 public void setActiveEditor(IEditorPart targetEditor) {
   super.setActiveEditor(targetEditor);
   activeEditor = targetEditor;
   if (activeEditor instanceof ReportViewerEditor) {
     printLayoutFromViewerAction.setReportViewerEditor((ReportViewerEditor) activeEditor);
     refreshLayoutFromViewerAction.setReportViewerEditor((ReportViewerEditor) activeEditor);
   }
 }
 public void init(IActionBars bars) {
   super.init(bars);
   IMenuManager menuMgr = bars.getMenuManager();
   IMenuManager editMenu = menuMgr.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
   if (editMenu != null) {
     IContributionItem[] items = editMenu.getItems();
     undoAction = ((ActionContributionItem) items[0]).getAction();
     redoAction = ((ActionContributionItem) items[1]).getAction();
     undoAction.addPropertyChangeListener(this);
     redoAction.addPropertyChangeListener(this);
   }
 }
Example #5
0
  @Override
  public void contributeToToolBar(IToolBarManager toolBarManager) {
    logger.debug("contributeToToolBar() activeEditor = " + activeEditor); // $NON-NLS-1$
    super.contributeToToolBar(toolBarManager);

    printLayoutFromViewerAction =
        new PrintLayoutFromViewerAction((ReportViewerEditor) activeEditor);
    refreshLayoutFromViewerAction =
        new RefreshLayoutFromViewerAction((ReportViewerEditor) activeEditor);
    toolBarManager.add(printLayoutFromViewerAction);
    toolBarManager.add(refreshLayoutFromViewerAction);
  }
 public void setActiveEditor(IEditorPart targetEditor) {
   super.setActiveEditor(targetEditor);
   workbench = targetEditor.getSite().getWorkbenchWindow().getActivePage();
   workbench.addPartListener(this);
   targetEditor.addPropertyListener(this);
 }