TextEditorAction
梁巴英
2023-12-01
TextEditorAction
public GotoDefinitionAction(ResourceBundle aBundle, String aPrefix,
ITextEditor anEditor) {
super(aBundle, aPrefix, anEditor);
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
VelocityEditor editor = (VelocityEditor)getTextEditor();
ITextSelection selection = (ITextSelection)
editor.getSelectionProvider().getSelection();
if (!selection.isEmpty()) {
editor.gotoDefinition(new Region(selection.getOffset(),
selection.getLength()));
}
}
Display display=
null;
IWorkbenchPartSite site= editor.getSite();
Shell shell= site.getShell();