org.eclipse.equinox.app.IApplicationContext Java Examples

The following examples show how to use org.eclipse.equinox.app.IApplicationContext. 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: Application.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public Object start ( final IApplicationContext context ) throws Exception
{

    final Collection<Future<?>> tasks = new LinkedList<Future<?>> ();
    tasks.add ( this.executor.submit ( new ConnectionRunner ( "hd:net://localhost:1402", "h.1" ) ) );
    tasks.add ( this.executor.submit ( new ConnectionRunner ( "da:net://localhost:1402", "h.1" ) ) );
    tasks.add ( this.executor.submit ( new ConnectionRunner ( "hd:net://localhost:1402", "h.1" ) ) );
    tasks.add ( this.executor.submit ( new ConnectionRunner ( "hd:net://localhost:1402", "h.1" ) ) );

    for ( final Future<?> task : tasks )
    {
        task.get ();
    }

    this.executor.shutdown ();

    dumpPerformanData ();

    return null;
}
 
Example #2
Source File: GWTCodeFormatterApplication.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
@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 #3
Source File: LanguageServer.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
@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 #4
Source File: JavaIndexerApplication.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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 #5
Source File: Application.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
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 #6
Source File: DataServer.java    From dawnsci with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Method replaces main(...) when running things with OSGi
 * 
 * Not called on GDA server will will probably start the Data Server by calling 'start' from spring, no arguments.
 */
@Override
public Object start(IApplicationContext context) throws Exception {

	@SuppressWarnings("rawtypes")
	final Map      args          = context.getArguments();
	final String[] configuration = (String[])args.get("application.args");
       
	Map<String, String> conf = new HashMap<String, String>(7);
	for (int i = 0; i < configuration.length; i++) {
		final String pkey = configuration[i];
		if (pkey.startsWith("-")) {
			conf.put(pkey.substring(1), configuration[i+1]);
		}
	}
     
   	if (conf.containsKey("port")) {
   		setPort(Integer.parseInt(conf.get("port").toString()));
   	} 
   	start(true); // blocking
   	
   	return server;// We are done with this application now.
}
 
Example #7
Source File: Application.java    From orion.server with Eclipse Public License 1.0 6 votes vote down vote up
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 vote down vote up
@Override
public Object start ( final IApplicationContext context ) throws Exception
{
    final String[] args = (String[])context.getArguments ().get ( IApplicationContext.APPLICATION_ARGS );
    if ( args == null )
    {
        return null;
    }

    for ( final String uri : args )
    {
        new SystemRunner ().process ( URI.createURI ( uri ), URI.createURI ( uri + ".eswm" ), new NullProgressMonitor () );
    }

    return null;
}
 
Example #9
Source File: Application.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
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 #10
Source File: Application.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@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 #11
Source File: Application.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@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 #12
Source File: ReportDebugger.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Object start( IApplicationContext context ) throws Exception
{
	String[] appArgs = new String[0];

	if ( context.getArguments( ) != null )
	{
		Object args = context.getArguments( )
				.get( IApplicationContext.APPLICATION_ARGS );

		if ( args instanceof String[] )
		{
			appArgs = (String[]) args;
		}
	}

	ReportLauncher.main( appArgs );

	return null;
}
 
Example #13
Source File: BonitaStudioApplication.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@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 #14
Source File: RcpApplication.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@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 #15
Source File: Application.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
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 #16
Source File: Application.java    From depan with Apache License 2.0 5 votes vote down vote up
@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 #17
Source File: Application.java    From codeexamples-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@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 #18
Source File: Application.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
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 #19
Source File: Application.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
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 jbt with Apache License 2.0 5 votes vote down vote up
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 #21
Source File: CodeFormatterApplication.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 vote down vote up
@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: ImportWorkspaceApplication.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@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 #24
Source File: Application.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
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 #25
Source File: Application.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Object start(final IApplicationContext context) throws Exception {

	DEBUG.OFF();

	final Map<String, String[]> mm = context.getArguments();
	final List<String> args = Arrays.asList(mm.get("application.args"));
	if (args.contains(GAMA_VERSION)) {

	} else if (args.contains(HELP_PARAMETER)) {
		DEBUG.ON();
		DEBUG.LOG(showHelp());
		DEBUG.OFF();

	} else if (args.contains(RUN_LIBRARY_PARAMETER)) {
		return ModelLibraryRunner.getInstance().start(args);
	} else if (args.contains(VALIDATE_LIBRARY_PARAMETER)) {
		return ModelLibraryValidator.getInstance().start(args);
	} else if (args.contains(TEST_LIBRARY_PARAMETER)) {
		return ModelLibraryTester.getInstance().start(args);
	} else if (args.contains(CHECK_MODEL_PARAMETER)) {
		ModelLibraryGenerator.start(this, args);
	} else if (args.contains(BUILD_XML_PARAMETER)) {
		buildXML(args);
	} else {
		runSimulation(args);
	}
	return null;
}
 
Example #26
Source File: Application.java    From depan with Apache License 2.0 5 votes vote down vote up
@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 #27
Source File: ExamplesApplication.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@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 #28
Source File: Application1.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object start ( final IApplicationContext context ) throws Exception
{
    final NioSocketConnector connector = new NioSocketConnector ();

    connector.setHandler ( new SingleSessionIoHandlerDelegate ( new SingleSessionIoHandlerFactory () {

        @Override
        public SingleSessionIoHandler getHandler ( final IoSession session ) throws Exception
        {
            return new DaveHandler ( session );
        }
    } ) );

    connector.getFilterChain ().addLast ( "logger", new LoggingFilter ( this.getClass ().getName () ) );
    connector.getFilterChain ().addLast ( "tpkt", new TPKTFilter ( 3 ) );
    connector.getFilterChain ().addLast ( "cotp", new COTPFilter ( 0, (byte)3 ) );
    connector.getFilterChain ().addLast ( "dave", new DaveFilter () );

    connector.connect ( new InetSocketAddress ( "192.168.1.83", 102 ) );

    while ( this.running )
    {
        Thread.sleep ( 1000 );
    }

    return null;
}
 
Example #29
Source File: Application.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object start ( final IApplicationContext context ) throws Exception
{
    try ( Receiver receiver = new Receiver ( new StreamHandlerFactory ( System.out ), 1204 ) )
    {
        Thread.sleep ( 1_000_000 );
    }
    return null;
}
 
Example #30
Source File: Application.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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();
	}
	
}