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();
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();
博客给出了 GotoDefinitionAction 方法的代码,包含其构造函数及 run 方法的实现。在 run 方法中,获取文本编辑器的选择内容,若不为空则跳转到定义处。还涉及到 Display、Shell 等对象的使用。

726

被折叠的 条评论
为什么被折叠?



