在我的Eclipse插件,我有以下代码:如何识别来自eclipse中CompareEditorInput的文本选择事件的来源?
public class MyHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection sel = HandlerUtil
.getActiveWorkbenchWindowChecked(event)
.getSelectionService()
.getSelection();
if(sel instanceof TextSelection) {
IEditorPart activeEditor = PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.getActiveEditor();
IEditorInput editorInput = activeEditor.getEditorInput();
if(editorInput instanceof CompareEditorInput) {
// here are two possible sources of the text selection, the
// left or the right side of the compare editor.
// How can I find out, which side it is from?
}
}
return null;
}
}
在这里我处理文本选择的事件从CompareEditorInput
到来,即与Subclipse的比较文件的两个远程修改的结果。
现在我想正确处理文本选择。为此,我必须知道它是否在左侧编辑器内或右侧编辑器内选择了一些文本。
我该怎么找到?
编辑2010-04-10:
的CompareEditorInput
具体实例org.tigris.subversion.subclipse.ui.compare.SVNCompareEditorInput
。