Fix missed files from cvs to svn migration. again!
[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.PlatformUI;
17 import org.eclipse.ui.texteditor.ITextEditor;
18 import org.eclipse.ui.texteditor.TextEditorAction;
19
20 public class GotoErrorAction extends TextEditorAction {
21
22         private boolean fForward;
23
24         public GotoErrorAction(String prefix, boolean forward) {
25                 super(PHPEditorMessages.getResourceBundle(), prefix, null);
26                 fForward = forward;
27                 if (forward)
28                         PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
29                                         IJavaHelpContextIds.GOTO_NEXT_ERROR_ACTION);
30                 else
31                         PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
32                                         IJavaHelpContextIds.GOTO_PREVIOUS_ERROR_ACTION);
33         }
34
35         public void run() {
36                 PHPEditor e = (PHPEditor) getTextEditor();
37                 e.gotoError(fForward);
38         }
39
40         public void setEditor(ITextEditor editor) {
41                 if (editor instanceof PHPEditor)
42                         super.setEditor(editor);
43                 update();
44         }
45
46         public void update() {
47                 setEnabled(getTextEditor() instanceof PHPEditor);
48         }
49 }