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 Project: neoscada   Author: eclipse   File: Application.java    License: 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 #2
Source Project: neoscada   Author: eclipse   File: Application.java    License: 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 #3
Source Project: neoscada   Author: eclipse   File: Application.java    License: 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 #4
Source Project: neoscada   Author: eclipse   File: Application.java    License: 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 #5
Source Project: orion.server   Author: eclipse   File: Application.java    License: 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 #6
Source Project: eclipse.jdt.ls   Author: eclipse   File: LanguageServer.java    License: 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 #7
Source Project: gwt-eclipse-plugin   Author: gwt-plugins   File: GWTCodeFormatterApplication.java    License: 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 #8
Source Project: Eclipse-Postfix-Code-Completion   Author: trylimits   File: JavaIndexerApplication.java    License: 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 #9
Source Project: translationstudio8   Author: heartsome   File: Application.java    License: 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 #10
Source Project: dawnsci   Author: eclipse   File: DataServer.java    License: 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 #11
Source Project: tmxeditor8   Author: heartsome   File: Application.java    License: 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 #12
Source Project: birt   Author: eclipse   File: ReportDebugger.java    License: 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 Project: bonita-studio   Author: bonitasoft   File: BonitaStudioApplication.java    License: 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 Project: olca-app   Author: GreenDelta   File: RcpApplication.java    License: 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 Project: MergeProcessor   Author: aposin   File: Application.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @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 #16
Source Project: nebula   Author: eclipse   File: ExamplesApplication.java    License: 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 #17
Source Project: neoscada   Author: eclipse   File: Application1.java    License: 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 #18
Source Project: neoscada   Author: eclipse   File: Application.java    License: 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 #19
Source Project: neoscada   Author: eclipse   File: Application.java    License: 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();
	}
	
}
 
Example #20
Source Project: neoscada   Author: eclipse   File: ServerTest1.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object start ( final IApplicationContext context ) throws Exception
{
    final ProtocolConfigurationFactory factory = new ProtocolConfigurationFactory () {
        @Override
        public ProtocolConfiguration createConfiguration ( final boolean clientMode ) throws Exception
        {
            return makeProtocolConfiguration ();
        }
    };

    this.server = new ServerBase ( Arrays.asList ( new InetSocketAddress ( 1202 ) ), factory ) {
        @Override
        public org.eclipse.scada.core.server.ngp.ServerConnection createNewConnection ( final IoSession session )
        {
            return new ServerConnection ( session ) {

                @Override
                public void messageReceived ( final Object message )
                {
                    System.out.println ( "Message received: " + message );
                }
            };
        };
    };
    this.server.start ();
    return null;
}
 
Example #21
Source Project: neoscada   Author: eclipse   File: ConnectionTest1.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object start ( final IApplicationContext context ) throws Exception
{
    final String uri = System.getProperty ( "connectionUri", "da:ngp://localhost:1202" );

    final ConnectionInformation connectionInformation = ConnectionInformation.fromURI ( uri );

    final ProtocolConfigurationFactory protocolConfigurationFactory = new DefaultProtocolConfigurationFactory ( connectionInformation ) {
        @Override
        protected void customizeConfiguration ( final ProtocolConfiguration configuration, final boolean clientMode )
        {
            addJavaProtocol ( "1", configuration, ConnectionTest1.class.getClassLoader () );
        }
    };

    logger.info ( "Start - Begin" );
    this.connection = new ClientBaseConnection ( new ProtocolIoHandlerFactory ( protocolConfigurationFactory ), new FilterChainBuilder ( true ), connectionInformation ) {
        @Override
        protected void handleMessage ( final Object message )
        {
            System.out.println ( "Received message: " + message );
        }
    };
    this.connection.addConnectionStateListener ( new DumpingStateListener () );
    this.connection.connect ();

    logger.info ( "Start - Sleep" );

    Thread.sleep ( 1000 * 1000 );

    logger.info ( "Start - End" );
    return null;
}
 
Example #22
Source Project: devstudio-tooling-ei   Author: wso2   File: LifeCycleManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * This will fire once the workspece is selected in eclipse startup.
 * We use this method to start the Embedded jetty server and java version checker
 * @param appContext Eclipse Application Context
 * @param display Startup display instance
 */
@PostContextCreate
void postContextCreate(IApplicationContext appContext, Display display) {
    RCPPluginHandlerUtils rcpUtils = new RCPPluginHandlerUtils();
    rcpUtils.showJavaVersionChecker(display);
    JettyServerHandler.getInstance().startEmbeddedJetty(0);
}
 
Example #23
Source Project: scava   Author: crossminer   File: OssmeterApplication.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected void processArguments(IApplicationContext context) {
	String[] args = (String[])context.getArguments().get("application.args");
	if (args == null) return;
	
	for (int i = 0; i < args.length; i++) {
		if ("-config".equals(args[i])) {
			Properties configuration = new Properties();
			try {
				configuration.load(new FileReader(args[i+1]));
			} catch (Exception e) {
				loggerOssmeter.error("Unable to read the specified platform configuration file. Using defaults.", e);
			}
			// Update the configuraiton instance
			Configuration.getInstance().setConfigurationProperties(configuration);
			
			// Ensure maven is configured
			if (System.getProperty("MAVEN_EXECUTABLE") == null) {
				String mvn = configuration.getProperty(Configuration.MAVEN_EXECUTABLE, "/Applications/apache-maven-3.2.3/bin/mvn");
				System.setProperty("MAVEN_EXECUTABLE", mvn);
			}
			
			i++;
		}else if ("-worker".equals(args[i])) { 
			worker = true;
			if(args.length >=  i+1 && ! "-apiServer".equals(args[i+1]) && !"-config".equals(args[i]) ) {
				this.workerId = args[i+1];
			}
			
		} else if ("-apiServer".equals(args[i])) { 
			apiServer = true;
		}
	}
}
 
Example #24
Source Project: depan   Author: google   File: Application.java    License: 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 #25
Source Project: depan   Author: google   File: Application.java    License: 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 #26
Source Project: gama   Author: gama-platform   File: Application.java    License: 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 #27
Source Project: slr-toolkit   Author: sebastiangoetz   File: Application.java    License: 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 #28
Source Project: gradle-and-eclipse-rcp   Author: diffplug   File: Application.java    License: 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 #29
Source Project: Eclipse-Postfix-Code-Completion   Author: trylimits   File: CodeFormatterApplication.java    License: 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 #30
Source Project: translationstudio8   Author: heartsome   File: Application.java    License: 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();
	}
}