Пример #1
0
  /**
   * This accesses a cached version of the content outliner.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public IContentOutlinePage getContentOutlinePage() {
    if (contentOutlinePage == null) {
      // The content outline is just a tree.
      //
      class MyContentOutlinePage extends ContentOutlinePage {
        public void createControl(Composite parent) {
          super.createControl(parent);
          contentOutlineViewer = getTreeViewer();
          contentOutlineViewer.addSelectionChangedListener(this);

          // Set up the tree viewer.
          //
          contentOutlineViewer.setContentProvider(
              new AdapterFactoryContentProvider(adapterFactory));
          contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
          contentOutlineViewer.setInput(editingDomain.getResourceSet());

          // Make sure our popups work.
          //
          createContextMenuFor(contentOutlineViewer);

          if (!editingDomain.getResourceSet().getResources().isEmpty()) {
            // Select the root object in the view.
            //
            ArrayList selection = new ArrayList();
            selection.add(editingDomain.getResourceSet().getResources().get(0));
            contentOutlineViewer.setSelection(new StructuredSelection(selection), true);
          }
        }

        public void makeContributions(
            IMenuManager menuManager,
            IToolBarManager toolBarManager,
            IStatusLineManager statusLineManager) {
          super.makeContributions(menuManager, toolBarManager, statusLineManager);
          contentOutlineStatusLineManager = statusLineManager;
        }

        public void setActionBars(IActionBars actionBars) {
          super.setActionBars(actionBars);
          getActionBarContributor().shareGlobalActions(this, actionBars);
        }
      }

      contentOutlinePage = new MyContentOutlinePage();

      // Listen to selection so that we can handle it is a special way.
      //
      contentOutlinePage.addSelectionChangedListener(
          new ISelectionChangedListener() {
            // This ensures that we handle selections correctly.
            //
            public void selectionChanged(SelectionChangedEvent event) {
              handleContentOutlineSelection(event.getSelection());
            }
          });
    }

    return contentOutlinePage;
  }
Пример #2
0
  /**
   * This is used to track the active viewer.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  protected void pageChange(int pageIndex) {
    super.pageChange(pageIndex);

    if (contentOutlinePage != null) {
      handleContentOutlineSelection(contentOutlinePage.getSelection());
    }
  }
Пример #3
0
  /** @param page */
  public void setPageActive(IContentOutlinePage page) {

    synchronized (fEditor) // don't want to call this while a reconciling
    // action
    // is occuring!
    {
      Control control = fCurrentPage.getControl();
      if ((control != null && !control.isDisposed()) && page == fCurrentPage) return;

      if (page == fMessagePage && fCurrentPage != fTapestryOutlinePage) page = fCurrentPage;

      if (page == fTapestryOutlinePage && fReconciledObject == null) page = fMessagePage;

      if (fCurrentPage != null) {
        fCurrentPage.removeSelectionChangedListener(this);
      }
      page.addSelectionChangedListener(this);
      this.fCurrentPage = page;
      if (fPageBook == null) {
        // still not being made
        return;
      }
      control = page.getControl();
      if (control == null || control.isDisposed()) {
        // first time
        page.createControl(fPageBook);
        control = page.getControl();
      }
      fPageBook.showPage(control);
      this.fCurrentPage = page;
    }
    updateToolbar();
  }
Пример #4
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public void dispose() {
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);

    getSite().getPage().removePartListener(partListener);

    adapterFactory.dispose();

    if (getActionBarContributor().getActiveEditor() == this) {
      getActionBarContributor().setActiveEditor(null);
    }

    if (propertySheetPage != null) {
      propertySheetPage.dispose();
    }

    if (contentOutlinePage != null) {
      contentOutlinePage.dispose();
    }

    super.dispose();
  }
Пример #5
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.part.IPage#setFocus()
  */
 public void setFocus() {
   if (fCurrentPage != null) fCurrentPage.setFocus();
 }