/**
   * The <code>PropertySheet</code> implementation of this <code>IPartListener</code> method first
   * sees if the active part is an <code>IContributedContentsView</code> adapter and if so, asks it
   * for its contributing part.
   */
  public void partActivated(IWorkbenchPart part) {
    // Look for a declaratively-contributed adapter - including not yet loaded adapter factories.
    // See bug 86362 [PropertiesView] Can not access AdapterFactory, when plugin is not loaded.
    IContributedContentsView view =
        (IContributedContentsView)
            ViewsPlugin.getAdapter(part, IContributedContentsView.class, true);
    IWorkbenchPart source = null;
    if (view != null) {
      source = view.getContributingPart();
    }
    if (source != null) {
      super.partActivated(source);
    } else {
      super.partActivated(part);
    }

    if (isImportant(part)) {
      currentPart = part;
      // reset the selection (to allow selectionChanged() accept part change for empty selections)
      currentSelection = null;
    }

    // When the view is first opened, pass the selection to the page
    if (bootstrapSelection != null) {
      IPropertySheetPage page = (IPropertySheetPage) getCurrentPage();
      if (page != null) {
        page.selectionChanged(part, bootstrapSelection);
      }
      bootstrapSelection = null;
    }
  }
Exemple #2
0
  @Override
  public void createPartControl(Composite parent) {
    createActions();

    fPageContent = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    fPageContent.setLayout(layout);

    fDescriptionComposite = null;

    super.createPartControl(fPageContent);
    getPageBook().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    fDefaultPartName = getPartName();
    initializeToolBar();
    InternalSearchUI.getInstance().getSearchManager().addQueryListener(this);
    initializePageSwitcher();

    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(parent, ISearchHelpContextIds.New_SEARCH_VIEW);
    restorePageFromMemento();

    showLatestSearch();
  }
Exemple #3
0
 @Override
 public void partActivated(IWorkbenchPart part) {
   super.partActivated(part);
   if (part == this) {
     InternalSearchUI.getInstance().getSearchViewManager().searchViewActivated(this);
   }
 }
  /**
   * The <code>PropertySheet</code> implementation of this <code>IWorkbenchPart</code> method
   * creates a <code>PageBook</code> control with its default page showing.
   */
  public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    pinPropertySheetAction.addPropertyChangeListener(
        new IPropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent event) {
            if (IAction.CHECKED.equals(event.getProperty())) {
              updateContentDescription();
            }
          }
        });
    IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
    menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    menuManager.add(pinPropertySheetAction);

    IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
    menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    toolBarManager.add(pinPropertySheetAction);

    getSite()
        .getPage()
        .getWorkbenchWindow()
        .getWorkbench()
        .getHelpSystem()
        .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW);
  }
Exemple #5
0
 @Override
 public void showBusy(boolean busy) {
   super.showBusy(busy);
   if (!busy) {
     getProgressService().warnOfContentChange();
   }
 }
 /* (non-Javadoc)
  * @see org.eclipse.ui.part.PageBookView#partClosed(org.eclipse.ui.IWorkbenchPart)
  * since 3.4
  */
 public void partClosed(IWorkbenchPart part) {
   if (part.equals(currentPart)) {
     if (isPinned()) pinPropertySheetAction.setChecked(false);
     currentPart = null;
   }
   super.partClosed(part);
 }
Exemple #7
0
 @Override
 public void dispose() {
   if (fUndoRedoActionGroup != null) {
     fUndoRedoActionGroup.dispose();
   }
   InternalSearchUI.getInstance().getSearchViewManager().searchViewClosed(this);
   InternalSearchUI.getInstance().getSearchManager().removeQueryListener(this);
   super.dispose();
 }
 /* (non-Javadoc)
  * @see org.eclipse.ui.part.ViewPart#saveState(org.eclipse.ui.IMemento)
  * since 3.4
  */
 public void saveState(IMemento memento) {
   // close all but the primary/parent property sheet
   String secondaryId = getViewSite().getSecondaryId();
   if (null == secondaryId) {
     super.saveState(memento);
   } else {
     getViewSite().getPage().hideView(this);
   }
 }
Exemple #9
0
 /*
  * TODO workaround for focus problem. Clarify focus behavior.
  *
  * @see org.eclipse.ui.IWorkbenchPart#setFocus()
  */
 @Override
 public void setFocus() {
   IPage currentPage = getCurrentPage();
   if (currentPage != null) {
     currentPage.setFocus();
   } else {
     super.setFocus();
   }
 }
  /* (non-Javadoc)
   * Method declared on IWorkbenchPart.
   */
  public void dispose() {
    // run super.
    super.dispose();

    // remove ourselves as a selection and registry listener
    getSite().getPage().removePostSelectionListener(this);
    RegistryFactory.getRegistry().removeListener(this);

    currentPart = null;
    currentSelection = null;
    pinPropertySheetAction = null;
  }
 @Override
 public void partDeactivated(IWorkbenchPart part) {
   super.partDeactivated(part);
   if (part instanceof ComponentEditor) {
     ComponentEditor componentEditor = (ComponentEditor) part;
     TemplateEditor templateEditor = componentEditor.getTemplateEditor();
     if (templateEditor != null) {
       templateEditor.getSourceEditor().removeCursorPositionListener(this);
     }
     WodEditor wodEditor = componentEditor.getWodEditor();
     if (wodEditor != null) {
       wodEditor.removeCursorPositionListener(this);
     }
   }
 }
 public void partActivated(IWorkbenchPart part) {
   super.partActivated(part);
   if (part instanceof ComponentEditor) {
     ComponentEditor componentEditor = (ComponentEditor) part;
     TemplateEditor templateEditor = componentEditor.getTemplateEditor();
     if (templateEditor != null) {
       templateEditor.getSourceEditor().addCursorPositionListener(this);
     }
     WodEditor wodEditor = componentEditor.getWodEditor();
     if (wodEditor != null) {
       wodEditor.addCursorPositionListener(this);
     }
   } else if (part instanceof BindingsInspectorPageBookView) {
     if (_lastEditor != null && _lastSelectionRange != null) {
       cursorPositionChanged(_lastEditor, _lastSelectionRange);
     }
   }
 }
Exemple #13
0
  @Override
  protected void initPage(IPageBookViewPage page) {
    super.initPage(page);
    IActionBars actionBars = page.getSite().getActionBars();
    actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fSearchAgainAction);
    actionBars.updateActionBars();

    fUndoRedoActionGroup.fillActionBars(actionBars);

    ISearchResultPage srPage = (ISearchResultPage) page;
    IMemento memento = null;
    if (fPageState != null) {
      IMemento[] mementos = fPageState.getChildren(MEMENTO_TYPE);
      for (int i = 0; i < mementos.length; i++) {
        if (mementos[i].getID().equals(srPage.getID())) {
          memento = mementos[i];
          break;
        }
      }
    }
    srPage.restoreState(memento);
  }
 public void dispose() {
   super.dispose();
   // getSite().getPage().removeSelectionListener(this);
 }
 @Override
 public void partBroughtToTop(IWorkbenchPart part) {
   super.partBroughtToTop(part);
 }
 /* (non-Javadoc)
  * Method declared on IViewPart.
  */
 public void init(IViewSite site) throws PartInitException {
   site.getPage().addPostSelectionListener(this);
   super.init(site);
 }
Exemple #17
0
 @Override
 public void init(IViewSite site, IMemento memento) throws PartInitException {
   super.init(site, memento);
   fPageState = memento;
 }
 public void createPartControl(Composite parent) {
   super.createPartControl(parent);
   // getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp(getPageBook(),
   // IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW);
 }
 /* (non-Javadoc)
  * @see org.eclipse.ui.part.PageBookView#partVisible(org.eclipse.ui.IWorkbenchPart)
  * since 3.4
  */
 protected void partVisible(IWorkbenchPart part) {
   super.partVisible(part);
 }