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;
18 * A toolbar action which toggles the presentation model of the connected text
19 * editor. The editor shows either the highlight range only or always the whole
22 public class PresentationAction extends TextEditorAction {
25 * Constructs and updates the action.
27 public PresentationAction() {
28 super(PHPEditorMessages.getResourceBundle(),
29 "TogglePresentation.", null); //$NON-NLS-1$
34 * (non-Javadoc) Method declared on IAction
38 ITextEditor editor = getTextEditor();
40 editor.resetHighlightRange();
41 boolean show = editor.showsHighlightRangeOnly();
43 editor.showHighlightRangeOnly(!show);
47 * (non-Javadoc) Method declared on TextEditorAction
49 public void update() {
50 setChecked(getTextEditor() != null
51 && getTextEditor().showsHighlightRangeOnly());