1 11 12 package org.eclipse.jdt.internal.ui.javaeditor; 13 14 import org.eclipse.ui.PlatformUI; 15 import org.eclipse.ui.texteditor.ITextEditor; 16 import org.eclipse.ui.texteditor.TextEditorAction; 17 18 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 19 20 21 public class GotoAnnotationAction extends TextEditorAction { 22 23 private boolean fForward; 24 25 public GotoAnnotationAction(String prefix, boolean forward) { 26 super(JavaEditorMessages.getBundleForConstructedKeys(), prefix, null); 27 fForward= forward; 28 if (forward) 29 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GOTO_NEXT_ERROR_ACTION); 30 else 31 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.GOTO_PREVIOUS_ERROR_ACTION); 32 } 33 34 public void run() { 35 JavaEditor e= (JavaEditor) getTextEditor(); 36 e.gotoAnnotation(fForward); 37 } 38 39 public void setEditor(ITextEditor editor) { 40 if (editor instanceof JavaEditor) 41 super.setEditor(editor); 42 update(); 43 } 44 45 public void update() { 46 setEnabled(getTextEditor() instanceof JavaEditor); 47 } 48 } 49 | Popular Tags |