Java 类org.eclipse.core.runtime.adaptor.EclipseStarter 实例源码

项目:n4js    文件:ProductLauncher.java   
/**
 * {@link EclipseStarter#getSystemBundleContext}
 *
 * @throws Exception
 *             propagates exception from Equinox
 */
private static BundleContext startPlatform(String[] platformArgs, Path osgiConfigurationArea) throws Exception {
    Map<String, String> ip = new HashMap<>();
    ip.put("eclipse.ignoreApp", "true");
    ip.put("eclipse.consoleLog", "true");
    ip.put("eclipse.log.level", "ALL");

    /*
     * http://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-
     * options.html
     */
    // ip.put("osgi.debug", "");
    // ip.put("osgi.debug.verbose", "true");

    ip.put("osgi.clean", "true");
    ip.put("osgi.framework.shape", "jar");
    ip.put("osgi.configuration.area", osgiConfigurationArea.toAbsolutePath().toString());
    ip.put("osgi.noShutdown", "false");
    EclipseStarter.setInitialProperties(ip);

    BundleContext context = EclipseStarter.startup(platformArgs, null);
    return context;
}
项目:neoscada    文件:EclipseDaemon.java   
/**
 * This method starts OSGi container, and returns immediately
 * <p>
 * The method will actually fork a thread and run the started method from
 * inside the thread. If the framework fails the method checks
 * {@link #isExitOnError()} on how to proceed. If {@link #isExitOnError()}
 * returns <code>true</code> then the method will call
 * {@link System#exit(int)} with a negative return value (-1). Otherwise
 * only the thread starting the framework will shut down.
 * </p>
 * 
 * @param args
 *            arguments for the starter
 * @throws Exception
 *             if anything goes wrong
 */
public static void start ( final String[] args ) throws Exception
{
    final Thread runner = new Thread ( "EclipseStarter" ) { //$NON-NLS-1$
        @Override
        public void run ()
        {
            try
            {
                EclipseStarter.main ( args );
            }
            catch ( final Exception e )
            {
                if ( isExitOnError () )
                {
                    System.exit ( -1 );
                }
            }
        };
    };

    runner.start ();
}
项目:gemini.blueprint    文件:EquinoxPlatform.java   
public void start() throws Exception {

        if (context == null) {
            // copy configuration properties to sys properties
            System.getProperties().putAll(getConfigurationProperties());

            // Equinox 3.1.x returns void - use of reflection is required
            // use main since in 3.1.x it sets up some system properties
//          EclipseStarter.main(new String[0]);

//          final Field field = EclipseStarter.class.getDeclaredField("context");

//          AccessController.doPrivileged(new PrivilegedAction<Object>() {
//              public Object run() {
//                  field.setAccessible(true);
//                  return null;
//              }
//          });
//          context = (BundleContext) field.get(null);
            context = EclipseStarter.startup(new String[0], null);
        }
    }
项目:spring-osgi    文件:EquinoxPlatform.java   
public void start() throws Exception {

        if (context == null) {
            // copy configuration properties to sys properties
            System.getProperties().putAll(getConfigurationProperties());

            // Equinox 3.1.x returns void - use of reflection is required
            // use main since in 3.1.x it sets up some system properties
            EclipseStarter.main(new String[0]);

            final Field field = EclipseStarter.class.getDeclaredField("context");

            AccessController.doPrivileged(new PrivilegedAction() {

                public Object run() {
                    field.setAccessible(true);
                    return null;
                }
            });
            context = (BundleContext) field.get(null);
        }
    }
项目:goomph    文件:EquinoxLauncher.java   
private Running(Map<String, String> systemProps, List<String> args) throws Exception {
    Map<String, String> defaults = defaultSystemProperties();
    modifyDefaultBy(defaults, systemProps);
    EclipseStarter.setInitialProperties(defaults);
    bundleContext = EclipseStarter.startup(args.toArray(new String[0]), null);
    Objects.requireNonNull(bundleContext);
}
项目:goomph    文件:EclipseIniLauncher.java   
private Running() throws Exception {
    Box.Nullable<BundleContext> context = Box.Nullable.ofNull();
    Main main = new Main() {
        @SuppressFBWarnings(value = "DMI_THREAD_PASSED_WHERE_RUNNABLE_EXPECTED", justification = "splashHandler is a thread rather than a runnable.  Almost definitely a small bug, " +
                "but there's a lot of small bugs in the copy-pasted launcher code.  It's battle-tested, FWIW.")
        @Override
        protected void invokeFramework(String[] passThruArgs, URL[] bootPath) throws Exception {
            context.set(EclipseStarter.startup(passThruArgs, splashHandler));
        }
    };
    main.basicRun(eclipseIni.getLinesAsArray());
    this.bundleContext = Objects.requireNonNull(context.get());
}
项目:n4js    文件:ProductLauncher.java   
private static void shutdownPlatform() throws Exception {
    EclipseStarter.shutdown();
}
项目:gemini.blueprint    文件:EquinoxPlatform.java   
public void stop() throws Exception {
    if (context != null) {
        context = null;
        EclipseStarter.shutdown();
    }
}
项目:goomph    文件:EquinoxLauncher.java   
/** Runs an eclipse application, as specified by the `-application` argument. */
private void run() throws Exception {
    Object result = EclipseStarter.run(null);
    Preconditions.checkState(Integer.valueOf(0).equals(result), "Unexpected return=0, was: %s", result);
}
项目:goomph    文件:EquinoxLauncher.java   
/** Shutsdown the eclipse instance. */
@Override
public void close() throws Exception {
    EclipseStarter.shutdown();
}
项目:goomph    文件:EclipseIniLauncher.java   
/** Runs an eclipse application, as specified by the `-application` argument. */
private void run() throws Exception {
    Object result = EclipseStarter.run(null);
    Preconditions.checkState(Integer.valueOf(0).equals(result), "Unexpected return=0, was: %s", result);
}
项目:goomph    文件:EclipseIniLauncher.java   
/** Shutsdown the eclipse instance. */
@Override
public void close() throws Exception {
    EclipseStarter.shutdown();
}
项目:spring-osgi    文件:EquinoxPlatform.java   
public void stop() throws Exception {
    if (context != null) {
        context = null;
        EclipseStarter.shutdown();
    }
}
项目:neoscada    文件:EclipseDaemon.java   
/**
 * This method starts OSGi container, but does not return as long as the
 * container is active
 * 
 * @param args
 *            arguments for the starter
 * @throws Exception
 *             if anything goes wrong
 */
public static void main ( final String[] args ) throws Exception
{
    EclipseStarter.main ( args );
}
项目:neoscada    文件:EclipseDaemon.java   
/**
 * Stop the framework
 * 
 * @see #stop()
 * @param args
 * @throws Exception
 */

public static void stop ( final String[] args ) throws Exception
{
    EclipseStarter.shutdown ();
}
项目:neoscada    文件:EclipseDaemon.java   
/**
 * The method shuts down the framework
 * <p>
 * The framework could have been started by {@link #start(String[])} or
 * {@link #main(String[])}.
 * </p>
 * 
 * @throws Exception
 *             if anything goes wrong
 */
public static void stop () throws Exception
{
    EclipseStarter.shutdown ();
}