1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
9 IBM Corporation - Initial implementation
11 **********************************************************************/
12 package net.sourceforge.phpeclipse.phpeditor;
14 import org.eclipse.ui.texteditor.ITextEditor;
15 import org.eclipse.ui.texteditor.TextEditorAction;
19 * A toolbar action which toggles the presentation model of the
20 * connected text editor. The editor shows either the highlight range
21 * only or always the whole document.
23 public class PresentationAction extends TextEditorAction {
26 * Constructs and updates the action.
28 public PresentationAction() {
29 super(PHPEditorMessages.getResourceBundle(), "TogglePresentation.", null); //$NON-NLS-1$
34 * Method declared on IAction
38 ITextEditor editor = getTextEditor();
40 editor.resetHighlightRange();
41 boolean show = editor.showsHighlightRangeOnly();
43 editor.showHighlightRangeOnly(!show);
47 * Method declared on TextEditorAction
49 public void update() {
50 setChecked(getTextEditor() != null && getTextEditor().showsHighlightRangeOnly());