org.eclipse.equinox.app.IApplication Java Examples
The following examples show how to use
org.eclipse.equinox.app.IApplication.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BonitaStudioApplication.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public Object start(final IApplicationContext context) { START_TIME = System.currentTimeMillis(); //avoid the execution of AutoBuild job during startup addBuildJobListener(); if (display == null) { display = PlatformUI.createDisplay(); } if (!isJavaVersionSupported(display)) { return IApplication.EXIT_OK; } initWorkspaceLocation(); executePreStartupContributions(); //set our custom operation factory OperationHistoryFactory.setOperationHistory(new BonitaOperationHistory()); return createAndRunWorkbench(display); }
Example #2
Source File: Application.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { PreferenceUtil.initProductEdition(); deleteErrorMemoryInfo(); initSystemLan(); PreferenceUtil.checkCleanValue(); int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #3
Source File: JavaIndexerApplication.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public Object start(IApplicationContext context) throws Exception { boolean execute = processCommandLine((String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS)); if (execute) { if (this.jarToIndex != null && this.indexFile != null) { File f = new File(this.jarToIndex); if (f.exists()) { if (this.verbose) { System.out.println(Messages.bind(Messages.CommandLineProcessing, this.indexFile, this.jarToIndex)); } try { JavaIndexer.generateIndexForJar(this.jarToIndex, this.indexFile); } catch (IOException e) { System.out.println(Messages.bind(Messages.CaughtException, "IOException", e.getLocalizedMessage())); //$NON-NLS-1$ } } else { System.out.println(Messages.bind(Messages.CommandLineJarFileNotExist, this.jarToIndex)); } } else if (this.jarToIndex == null) { System.out.println(Messages.bind(Messages.CommandLineJarNotSpecified)); } else if (this.indexFile == null) { System.out.println(Messages.bind(Messages.CommandLineIndexFileNotSpecified)); } } return IApplication.EXIT_OK; }
Example #4
Source File: Application.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { PreferenceUtil.initProductEdition(); if (!PreferenceUtil.checkEdition()) { MessageDialog.openInformation(display.getActiveShell(), Messages.getString("dialog.AboutDialog.msgTitle"), Messages.getString("dialog.AboutDialog.msg")); return IApplication.EXIT_OK; } initSystemLan(); SystemResourceUtil.beforeload(); PreferenceUtil.checkCleanValue(); deleteErrorMemoryFile(); int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #5
Source File: GWTCodeFormatterApplication.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
@Override public Object start(IApplicationContext context) throws Exception { String[] args = (String[]) context.getArguments().get( IApplicationContext.APPLICATION_ARGS); if (args.length < 3) { System.err.println("Usage: eclipse -application com.google.gwt.eclipse.core.formatter.GWTCodeFormatterApplication " + "<javaFormatterConfigFile> <jsFormatterConfigFile> <sourceFile1> [<sourceFile2>] ..."); return IApplication.EXIT_OK; } javaConfig = getConfig(args[0]); jsConfig = getConfig(args[1]); // The JavaScriptCore plugin, which the JS formatter depends on, requires // the workbench, so start one manually startWorkbench(); for (int i = 2; i < args.length; i++) { File f = new File(args[i]); format(f); } return IApplication.EXIT_OK; }
Example #6
Source File: LanguageServer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Override public Object start(IApplicationContext context) throws Exception { JavaLanguageServerPlugin.startLanguageServer(this); synchronized(waitLock){ while (!shutdown) { try { context.applicationRunning(); JavaLanguageServerPlugin.logInfo("Main thread is waiting"); waitLock.wait(); } catch (InterruptedException e) { JavaLanguageServerPlugin.logException(e.getMessage(), e); } } } return IApplication.EXIT_OK; }
Example #7
Source File: Application.java From orion.server with Eclipse Public License 1.0 | 6 votes |
public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); display.asyncExec(new Runnable() { public void run() { launchOrionApplication(); new OSGiConsoleFactory().openConsole(); } }); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #8
Source File: Application.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public Object start ( final IApplicationContext context ) throws Exception { Display display = PlatformUI.createDisplay (); try { int returnCode = PlatformUI.createAndRunWorkbench ( display, new ApplicationWorkbenchAdvisor () ); if ( returnCode == PlatformUI.RETURN_RESTART ) { return IApplication.EXIT_RESTART; } else { return IApplication.EXIT_OK; } } finally { display.dispose (); } }
Example #9
Source File: Application.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public Object start ( final IApplicationContext context ) throws Exception { final Display display = PlatformUI.createDisplay (); try { final int returnCode = PlatformUI.createAndRunWorkbench ( display, new ApplicationWorkbenchAdvisor () ); if ( returnCode == PlatformUI.RETURN_RESTART ) { return IApplication.EXIT_RESTART; } else { return IApplication.EXIT_OK; } } finally { display.dispose (); } }
Example #10
Source File: RcpApplication.java From olca-app with Mozilla Public License 2.0 | 6 votes |
@Override public Object start(final IApplicationContext context) throws Exception { Object result = null; Display display = PlatformUI.createDisplay(); try { final int returnCode = PlatformUI.createAndRunWorkbench(display, new RcpWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { result = IApplication.EXIT_RESTART; } else { result = IApplication.EXIT_OK; } } finally { display.dispose(); } return result; }
Example #11
Source File: BonitaStudioApplicationTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void shoul_start_run_workbench_if_java_version_is_valid() throws Exception { doReturn("1.8").when(application).getJavaVersion(); final Object result = application.start(null); verify(application).createAndRunWorkbench(realm.getShell().getDisplay()); assertThat(result).isEqualTo(IApplication.EXIT_OK); }
Example #12
Source File: BonitaStudioApplicationTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Before public void setUp() throws Exception { application = spy(new BonitaStudioApplication(realm.getShell().getDisplay())); doNothing().when(application).initWorkspaceLocation(); doNothing().when(application).openErrorDialog(eq(realm.getShell().getDisplay()), anyString()); doReturn(false).when(application).isWorkbenchRunning(); doReturn(IApplication.EXIT_OK).when(application).createAndRunWorkbench(any(Display.class)); }
Example #13
Source File: BonitaStudioApplication.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected Object createAndRunWorkbench(final Display display) { try { final int returnCode = PlatformUI.createAndRunWorkbench(display, createWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #14
Source File: ExamplesApplication.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #15
Source File: Application.java From jbt with Apache License 2.0 | 5 votes |
public Object start(IApplicationContext context) throws Exception { Display display = PlatformUI.createDisplay(); /* * Before doing anything at all, standard nodes must be loaded. If they * cannot be loaded, the application will not start. */ try { NodesLoader.loadStandardNodes(); ApplicationIcons.loadIcons(); } catch (Exception e) { StandardDialogs .exceptionDialog( "Could not start application", "There were errors while loading the set of standard nodes", e); return IApplication.EXIT_OK; } try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) return IApplication.EXIT_RESTART; else return IApplication.EXIT_OK; } finally { /* Dispose loaded icons. */ ApplicationIcons.disposeIcons(); display.dispose(); } }
Example #16
Source File: ImportWorkspaceApplication.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public Object start(IApplicationContext context) throws Exception { repositoryAccessor.init(); final String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); final Optional<String> scan = Stream.of(args).filter("-scan"::equals).findFirst(); final Optional<String> export = Stream.of(args).filter(arg -> arg.startsWith("-export=")).findFirst(); final File exportTargetFolder = new File(System.getProperty("java.io.tmpdir"), IMPORT_CACHE_FOLDER); if (export.isPresent()) { if (exportTargetFolder.exists()) { PlatformUtil.delete(exportTargetFolder, Repository.NULL_PROGRESS_MONITOR); } exportTargetFolder.mkdirs(); } final IWorkspace workspace = ResourcesPlugin.getWorkspace(); if (scan.isPresent() || export.isPresent()) { Stream.of(workspace.getRoot().getProjects()) .filter(hasBonitaNature()) .map(IProject::getName) .map(repositoryAccessor::getRepository) .forEach(repository -> { System.out.println( String.format("$SCAN_PROGRESS_%s:%s:%s:%s", repository.getName(), repository.getVersion(), findEdition(repository), connected(repository))); export .map(value -> value.split("=")[1]) .map(repositories -> repositories.split(":")) .map(Stream::of) .orElse(Stream.empty()) .filter(repository.getName()::equals) .findFirst() .ifPresent(repoToExport -> migrateAndExportRepository(exportTargetFolder, repository)); }); } return IApplication.EXIT_OK; }
Example #17
Source File: Application.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #18
Source File: Application.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public Object start(IApplicationContext context) throws Exception { OpenDocumentEventProcessor openDocProcessor = new OpenDocumentEventProcessor(); Display display = PlatformUI.createDisplay(); display.addListener(SWT.OpenDocument, openDocProcessor); try { IProduct product = Platform.getProduct(); String id = product.getId(); String hsVersion = ""; if (id.equals("net.heartsome.cat.te.tmx_editor_product")) { hsVersion = "F"; } System.getProperties().put("TSVersion", "88"); System.getProperties().put("TSEdition", hsVersion); String versionDate = System.getProperty("date", ""); String version = System.getProperty("version", ""); System.getProperties().put("TSVersionDate", version + "." + versionDate); checkCleanValue(); int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor(openDocProcessor)); if (returnCode == PlatformUI.RETURN_RESTART) return IApplication.EXIT_RESTART; else return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #19
Source File: Application.java From codeexamples-eclipse with Eclipse Public License 1.0 | 5 votes |
@Override public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #20
Source File: Application.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #21
Source File: CodeFormatterApplication.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Runs the Java code formatter application */ public Object start(IApplicationContext context) throws Exception { File[] filesToFormat = processCommandLine((String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS)); if (filesToFormat == null) { return IApplication.EXIT_OK; } if (!this.quiet) { if (this.configName != null) { System.out.println(Messages.bind(Messages.CommandLineConfigFile, this.configName)); } System.out.println(Messages.bind(Messages.CommandLineStart)); } final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(this.options); // format the list of files and/or directories for (int i = 0, max = filesToFormat.length; i < max; i++) { final File file = filesToFormat[i]; if (file.isDirectory()) { formatDirTree(file, codeFormatter); } else if (Util.isJavaLikeFileName(file.getPath())) { formatFile(file, codeFormatter); } } if (!this.quiet) { System.out.println(Messages.bind(Messages.CommandLineDone)); } return IApplication.EXIT_OK; }
Example #22
Source File: Application.java From gradle-and-eclipse-rcp with Apache License 2.0 | 5 votes |
@Override public Object start(IApplicationContext context) throws Exception { Display.setAppName("RCP Demo"); Shells.builder(SWT.SHELL_TRIM, AppGui::new) .setTitle("RCP Demo") .setSize(SwtMisc.scaleByFontHeight(40, 30)) .openOnDisplayBlocking(); return IApplication.EXIT_OK; }
Example #23
Source File: Application.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #24
Source File: Application.java From depan with Apache License 2.0 | 5 votes |
@Override public Object start(IApplicationContext context) throws Exception { final Map<?, ?> args = context.getArguments(); final String[] appArgs = (String[]) args.get("application.args"); CommandDispatch cli = new CommandDispatch(); cli.dispatch(Arrays.asList(appArgs)); Object result = cli.getResult(); if (IApplication.EXIT_OK != result) { CmdLogger.LOG.error("Depan Cmd failure with result: {}", result); } return result; }
Example #25
Source File: Application.java From depan with Apache License 2.0 | 5 votes |
@Override public Object start(IApplicationContext context) throws Exception { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench( display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #26
Source File: Application.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public Object start(IApplicationContext context) throws Exception { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) return IApplication.EXIT_RESTART; else return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #27
Source File: Application.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) */ @Override public Object start(IApplicationContext context) throws Exception { Display display = PlatformUI.createDisplay(); try { int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) return IApplication.EXIT_RESTART; else return IApplication.EXIT_OK; } finally { display.dispose(); } }
Example #28
Source File: HeadlessApp.java From gradle-and-eclipse-rcp with Apache License 2.0 | 4 votes |
@Override public Object start(IApplicationContext context) throws Exception { String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); System.out.println(Arrays.asList(args)); return IApplication.EXIT_OK; }
Example #29
Source File: Application.java From gama with GNU General Public License v3.0 | 4 votes |
@Override public Object start(final IApplicationContext context) throws Exception { Thread.setDefaultUncaughtExceptionHandler((t, e) -> { if ( e instanceof OutOfMemoryError ) { final boolean close = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Out of memory", "GAMA is out of memory and will likely crash. Do you want to close now ?"); if ( close ) { this.stop(); } e.printStackTrace(); } }); Display.setAppName("Gama Platform"); Display.setAppVersion("1.8.1"); // DEBUG.OUT(System.getProperties()); createProcessor(); final Object check = checkWorkspace(); if ( EXIT_OK.equals(check) ) { return EXIT_OK; } // if ( check == EXIT_RESTART ) { // ClearWorkspace(true); // No need to restart : the value will be checked later // return EXIT_RESTART; // } Display display = null; try { display = Display.getDefault(); checkWorkbenchXMI(); // final String splash = getProperty("org.eclipse.equinox.launcher.splash.location"); // if ( splash != null ) { // setProperty("org.eclipse.equinox.launcher.splash.location", splash.replace("bmp", "png")); // } final int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if ( returnCode == PlatformUI.RETURN_RESTART ) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { if ( display != null ) { display.dispose(); } final Location instanceLoc = Platform.getInstanceLocation(); if ( instanceLoc != null ) { instanceLoc.release(); } } }
Example #30
Source File: Application.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override public Object start(IApplicationContext context) throws Exception { Display display = PlatformUI.createDisplay(); try { // fetch the Location that we will be modifying fInstanceLoc = Platform.getInstanceLocation(); // -data @noDefault in <applName>.ini allows us to set the workspace here. // If the user wants to change the location then he has to change // @noDefault to a specific location or remove -data @noDefault for // default location if (!fInstanceLoc.allowsDefault() && !fInstanceLoc.isSet()) { File workspaceRoot = new File(TracingRcpPlugin.getWorkspaceRoot()); if (!workspaceRoot.exists()) { MessageDialog.openError(display.getActiveShell(), Messages.Application_WorkspaceCreationError, MessageFormat.format(Messages.Application_WorkspaceRootNotExistError, new Object[] { TracingRcpPlugin.getWorkspaceRoot() })); return IApplication.EXIT_OK; } if (!workspaceRoot.canWrite()) { MessageDialog.openError(display.getActiveShell(), Messages.Application_WorkspaceCreationError, MessageFormat.format(Messages.Application_WorkspaceRootPermissionError, new Object[] { TracingRcpPlugin.getWorkspaceRoot() })); return IApplication.EXIT_OK; } String workspace = TracingRcpPlugin.getWorkspaceRoot() + File.separator + TracingRcpPlugin.WORKSPACE_NAME; // set location to workspace fInstanceLoc.set(new URL("file", null, workspace), false); //$NON-NLS-1$ } /* * Execute the early command line options. */ try { CliCommandLine cmdLine = CliParserManager.getInstance().parse(Platform.getCommandLineArgs()); TracingRcpPlugin.getDefault().setCommandLine(cmdLine); if (cmdLine != null && CliParserManager.applicationStartup(cmdLine)) { return IApplication.EXIT_OK; } } catch (CliParserException e) { TracingRcpPlugin.getDefault().logError("Error parsing command line arguments", e); //$NON-NLS-1$ return IApplication.EXIT_OK; } if (!fInstanceLoc.lock()) { MessageDialog.openError(display.getActiveShell(), Messages.Application_WorkspaceCreationError, MessageFormat.format(Messages.Application_WorkspaceInUseError, new Object[] { fInstanceLoc.getURL().getPath() })); return IApplication.EXIT_OK; } int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } return IApplication.EXIT_OK; } finally { display.dispose(); } }