Package org.locationtech.udig.jconsole

Source Code of org.locationtech.udig.jconsole.PresentationAction

/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     IBM Corporation - initial API and implementation
*******************************************************************************/
package org.locationtech.udig.jconsole;


import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction;

/**
* A toolbar action which toggles the presentation model of the
* connected text editor. The editor shows either the highlight range
* only or always the whole document.
*/
public class PresentationAction extends TextEditorAction {

  /**
   * Constructs and updates the action.
   */
  public PresentationAction() {
    super(JavaEditorMessages.getResourceBundle(), "TogglePresentation.", null); //$NON-NLS-1$
    update();
  }

  /* (non-Javadoc)
   * Method declared on IAction
   */
  public void run() {

    ITextEditor editor= getTextEditor();

    editor.resetHighlightRange();
    boolean show= editor.showsHighlightRangeOnly();
    setChecked(!show);
    editor.showHighlightRangeOnly(!show);
  }

  /* (non-Javadoc)
   * Method declared on TextEditorAction
   */
  public void update() {
    setChecked(getTextEditor() != null && getTextEditor().showsHighlightRangeOnly());
    setEnabled(true);
  }
}
TOP

Related Classes of org.locationtech.udig.jconsole.PresentationAction

TOP
Copyright © 2018 www.massapi.com. 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.