0
我已經創建了延伸類org.eclipse.ui.part.ViewPart和另一類/認爲延伸該基基類:在JUnit測試類從junit測試類打開eclipse編輯器/視圖?
public abstract class MyView extends ViewPart {
...
public class TestView extends MyView {
public static final String ID = "com.model.ui.editors.TestView";
// Different swt widgets
...
現在(在具有所述束的片段定義視圖作爲主體)我想打開這個觀點,也做了以下內容:
public class TestViewTest {
private TestView view;
@Before
public void setup() {
view = new TestView();
}
@Test
public void open() throws Exception {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
page.showView("com.model.ui.editors.TestView");
但是當我運行測試,我得到:
org.eclipse.ui.PartInitException:無法創建查看:com.model.ui.editors.TestView at org.eclipse.ui.internal.ViewFactory.createView(ViewFactory.java:158) ....
我知道我在這裏缺少一些基本的東西。運行測試之前,是否需要將TestView添加到工作臺/ editorRegistry?