0
我有一個由兩個視角組成的rcp應用程序。在一個角度來看,我有一棵樹。雙擊樹中的任何項目,它將打開所選樹項目的細節,但是以相同的視角顯示。我想通過雙擊來切換視角,而不是以相同視角打開選定項目的細節。我該怎麼做?在rcp視角之間切換
我雙擊聽者
// Add double click listener to open an element editor on double click action:
getViewer().addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
if (currentTreeSelection instanceof StoreableElement) {
openElementContentEditor((StoreableElement)currentTreeSelection);
}
}
});
內容編輯器顯示所選樹項目的細節部分。
public void openElementContentEditor(StoreableElement element) {
ElementDescriptor ed = DataStoreManagement.getInstance().getElementDescriptorById(element.getDescriptor());
String editorID = ed.getEditor();
IDataStoreEditorInput editorInput = DataStoreManagement.getInstance().createEditorInput(element);
try {
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.openEditor(editorInput, editorID, true,
IWorkbenchPage.MATCH_INPUT);
} catch (PartInitException e) {
e.printStackTrace();
}
}
感謝
由於它的工作 – wearybands 2015-03-25 13:43:31