@After public void tearDown() throws Exception { if (wb != null) { wb.close(); } appContext.dispose(); }
/* * (non-Javadoc) * * @see junit.framework.TestCase#tearDown() */ @Override protected void tearDown() throws Exception { if (wb != null) { wb.close(); } appContext.dispose(); }
@Override public Object start(IApplicationContext applicationContext) throws Exception { // set the display name before the Display is // created to ensure the app name is used in any // platform menus, etc. See // https://bugs.eclipse.org/bugs/show_bug.cgi?id=329456#c14 IProduct product = Platform.getProduct(); if (product != null && product.getName() != null) { Display.setAppName(product.getName()); } Display display = getApplicationDisplay(); Location instanceLocation = null; try { E4Workbench workbench = createE4Workbench(applicationContext, display); instanceLocation = (Location) workbench.getContext().get(E4Workbench.INSTANCE_LOCATION); Shell shell = display.getActiveShell(); if (shell == null) { shell = new Shell(); // place it off so it's not visible shell.setLocation(0, 10000); } if (!checkInstanceLocation(instanceLocation, shell, workbench.getContext())) return EXIT_OK; // Create and run the UI (if any) workbench.createAndRunUI(workbench.getApplication()); saveModel(); workbench.close(); if (workbench.isRestart()) { return EXIT_RESTART; } return EXIT_OK; } finally { if (display != null) display.dispose(); if (instanceLocation != null) instanceLocation.release(); } }
@Override public void stop() { if (workbench != null) { workbench.close(); } }