在我的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
。