misc parser changes
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / GotoErrorAction.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation 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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11
12 package net.sourceforge.phpeclipse.phpeditor;
13
14 import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds;
15
16 import org.eclipse.ui.help.WorkbenchHelp;
17 import org.eclipse.ui.texteditor.ITextEditor;
18 import org.eclipse.ui.texteditor.TextEditorAction;
19
20
21 public class GotoErrorAction extends TextEditorAction {
22                 
23         private boolean fForward;
24         
25         public GotoErrorAction(String prefix, boolean forward) {
26                 super(PHPEditorMessages.getResourceBundle(), prefix, null);
27                 fForward= forward;
28                 if (forward)
29                         WorkbenchHelp.setHelp(this, IJavaHelpContextIds.GOTO_NEXT_ERROR_ACTION);
30                 else
31                         WorkbenchHelp.setHelp(this, IJavaHelpContextIds.GOTO_PREVIOUS_ERROR_ACTION);
32         }
33         
34         public void run() {
35                 PHPEditor e= (PHPEditor) getTextEditor();
36                 e.gotoError(fForward);
37         }
38         
39         public void setEditor(ITextEditor editor) {
40                 if (editor instanceof PHPEditor) 
41                         super.setEditor(editor);
42                 update();
43         }
44         
45         public void update() {
46                 setEnabled(getTextEditor() instanceof PHPEditor);
47         }
48 }