/*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.action.ContributionItem#dispose()
  */
 public void dispose() {
   if (loadedDynamicContribution != null) {
     loadedDynamicContribution.dispose();
     loadedDynamicContribution = null;
   }
   super.dispose();
 }
  private void createContributionItem() {

    loadedDynamicContribution =
        (WorkbenchWindowControlContribution)
            Util.safeLoadExecutableExtension(
                dynamicAddition,
                IWorkbenchRegistryConstants.ATT_CLASS,
                WorkbenchWindowControlContribution.class);

    if (loadedDynamicContribution == null) {
      alreadyFailed = true;
      return;
    }

    loadedDynamicContribution.setId(getId());
    loadedDynamicContribution.setParent(getParent());
    loadedDynamicContribution.setWorkbenchWindow(getWorkbenchWindow());
    loadedDynamicContribution.setCurSide(getCurSide());
    if (loadedDynamicContribution instanceof IWorkbenchContribution) {
      ((IWorkbenchContribution) loadedDynamicContribution).initialize(locator);
    }
  }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.action.ContributionItem#isDirty()
  */
 public boolean isDirty() {
   if (loadedDynamicContribution != null) {
     return loadedDynamicContribution.isDirty();
   }
   return super.isDirty();
 }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.action.ContributionItem#isDynamic()
  */
 public boolean isDynamic() {
   if (loadedDynamicContribution != null) {
     return loadedDynamicContribution.isDynamic();
   }
   return true;
 }
  /*
   * (non-Javadoc)
   * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
   */
  public Control createControl(Composite parent) {

    WorkbenchWindowControlContribution contributionItem = getContributionItem();
    if (contributionItem != null) return contributionItem.delegateCreateControl(parent);
    return null;
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.ui.internal.menus.InternalControlContribution#setCurSide(int)
  */
 public void setCurSide(int curSide) {
   super.setCurSide(curSide);
   if (loadedDynamicContribution != null) {
     loadedDynamicContribution.setCurSide(curSide);
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.ui.internal.menus.InternalControlContribution#setWorkbenchWindow
  * (org.eclipse.ui.IWorkbenchWindow)
  */
 public void setWorkbenchWindow(IWorkbenchWindow wbw) {
   super.setWorkbenchWindow(wbw);
   if (loadedDynamicContribution != null) {
     loadedDynamicContribution.setWorkbenchWindow(wbw);
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.jface.action.ContributionItem#setParent(org.eclipse.jface
  * .action.IContributionManager)
  */
 public void setParent(IContributionManager parent) {
   super.setParent(parent);
   if (loadedDynamicContribution != null) {
     loadedDynamicContribution.setParent(parent);
   }
 }
 public void update(String id) {
   if (loadedDynamicContribution != null) {
     loadedDynamicContribution.update(id);
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.action.ContributionItem#update()
  */
 public void update() {
   if (loadedDynamicContribution != null) {
     loadedDynamicContribution.update();
   }
 }
예제 #11
0
 /**
  * ************************************************************************* Dispose the control
  * ************************************************************************
  */
 @Override
 public void dispose() {
   GuiNotifications.get().removeListener(this);
   super.dispose();
 }