Package org.eclipse.ui.contexts

Examples of org.eclipse.ui.contexts.IWorkbenchContextSupport


   * (non-Javadoc) Method declared on IRunnableContext.
   */
  public void run(boolean fork, boolean cancelable,
      IRunnableWithProgress runnable) throws InvocationTargetException,
      InterruptedException {
    IWorkbenchContextSupport contextSupport = getWorkbench()
        .getContextSupport();
    final boolean keyFilterEnabled = contextSupport.isKeyFilterEnabled();

    Control fastViewBarControl = getFastViewBar() == null ? null
        : getFastViewBar().getControl();
    boolean fastViewBarWasEnabled = fastViewBarControl == null ? false
        : fastViewBarControl.getEnabled();

    Control perspectiveBarControl = getPerspectiveBar() == null ? null
        : getPerspectiveBar().getControl();
    boolean perspectiveBarWasEnabled = perspectiveBarControl == null ? false
        : perspectiveBarControl.getEnabled();

    // Cache for any diabled trim controls
    List disabledControls = null;
   
    try {
      if (fastViewBarControl != null && !fastViewBarControl.isDisposed()) {
        fastViewBarControl.setEnabled(false);
      }

      if (perspectiveBarControl != null
          && !perspectiveBarControl.isDisposed()) {
        perspectiveBarControl.setEnabled(false);
      }

      if (keyFilterEnabled) {
        contextSupport.setKeyFilterEnabled(false);
      }

      // Disable all trim -except- the StatusLine
      if (defaultLayout != null)
        disabledControls = defaultLayout.disableTrim(getStatusLineTrim());

      super.run(fork, cancelable, runnable);
    } finally {
      if (fastViewBarControl != null && !fastViewBarControl.isDisposed()) {
        fastViewBarControl.setEnabled(fastViewBarWasEnabled);
      }

      if (perspectiveBarControl != null
          && !perspectiveBarControl.isDisposed()) {
        perspectiveBarControl.setEnabled(perspectiveBarWasEnabled);
      }

      if (keyFilterEnabled) {
        contextSupport.setKeyFilterEnabled(true);
      }
     
      // Re-enable any disabled trim
      if (defaultLayout != null && disabledControls != null)
        defaultLayout.enableTrim(disabledControls);
View Full Code Here

TOP

Related Classes of org.eclipse.ui.contexts.IWorkbenchContextSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.