1 11 12 package org.eclipse.ant.internal.ui.editor; 13 14 import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds; 15 import org.eclipse.jdt.ui.actions.OpenAction; 16 import org.eclipse.jface.text.ITextSelection; 17 18 public class OpenDeclarationAction extends OpenAction { 19 20 private AntEditor fEditor; 21 22 public OpenDeclarationAction(AntEditor antEditor) { 23 super(antEditor.getSite()); 24 fEditor= antEditor; 25 setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR); 26 antEditor.getSite().getKeyBindingService().registerAction(this); 27 28 setText(AntEditorMessages.getString("OpenDeclarationAction.0")); setDescription(AntEditorMessages.getString("OpenDeclarationAction.1")); setToolTipText(AntEditorMessages.getString("OpenDeclarationAction.1")); } 32 33 36 public void run() { 37 if (fEditor == null) { 38 return; 39 } 40 41 fEditor.openReferenceElement(); 42 } 43 44 47 public void selectionChanged(ITextSelection selection) { 48 setEnabled(fEditor != null); 49 } 50 51 public void setEditor(AntEditor editor) { 52 fEditor= editor; 53 } 54 } | Popular Tags |