Search in sources :

Example 1 with IRuntimeLifecycleListener

use of org.eclipse.wst.server.core.IRuntimeLifecycleListener in project webtools.servertools by eclipse.

the class JavaServerPlugin method start.

/**
 * @see Plugin#start(org.osgi.framework.BundleContext)
 */
public void start(BundleContext context) throws Exception {
    super.start(context);
    runtimeListener = new IRuntimeLifecycleListener() {

        public void runtimeAdded(IRuntime runtime) {
            handleRuntimeChange(runtime, 0);
        }

        public void runtimeChanged(IRuntime runtime) {
            handleRuntimeChange(runtime, 1);
        }

        public void runtimeRemoved(IRuntime runtime) {
            handleRuntimeChange(runtime, 2);
        }
    };
    ServerCore.addRuntimeLifecycleListener(runtimeListener);
    // register the debug options listener
    final Hashtable<String, String> props = new Hashtable<String, String>(4);
    props.put(DebugOptions.LISTENER_SYMBOLICNAME, JavaServerPlugin.PLUGIN_ID);
    context.registerService(DebugOptionsListener.class.getName(), new Trace(), props);
}
Also used : Hashtable(java.util.Hashtable) DebugOptionsListener(org.eclipse.osgi.service.debug.DebugOptionsListener) IRuntimeLifecycleListener(org.eclipse.wst.server.core.IRuntimeLifecycleListener) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 2 with IRuntimeLifecycleListener

use of org.eclipse.wst.server.core.IRuntimeLifecycleListener in project webtools.servertools by eclipse.

the class RuntimeLifecycleListenerTestCase method testListener.

public void testListener() {
    IRuntimeLifecycleListener listener = new IRuntimeLifecycleListener() {

        public void runtimeAdded(IRuntime runtime) {
        // ignore
        }

        public void runtimeChanged(IRuntime runtime) {
        // ignore
        }

        public void runtimeRemoved(IRuntime runtime) {
        // ignore
        }
    };
    listener.runtimeAdded(null);
    listener.runtimeChanged(null);
    listener.runtimeRemoved(null);
}
Also used : IRuntimeLifecycleListener(org.eclipse.wst.server.core.IRuntimeLifecycleListener) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 3 with IRuntimeLifecycleListener

use of org.eclipse.wst.server.core.IRuntimeLifecycleListener in project liferay-ide by liferay.

the class LiferayServerCore method start.

/*
     * (non-Javadoc)
     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext )
     */
@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;
    this.runtimeLifecycleListener = new IRuntimeLifecycleListener() {

        @Override
        public void runtimeAdded(IRuntime runtime) {
            saveGlobalRuntimeSettings(runtime);
        }

        @Override
        public void runtimeChanged(IRuntime runtime) {
            saveGlobalRuntimeSettings(runtime);
        }

        @Override
        public void runtimeRemoved(IRuntime runtime) {
            saveGlobalRuntimeSettings(runtime);
        }
    };
    this.serverLifecycleListener = new IServerLifecycleListener() {

        @Override
        public void serverAdded(IServer server) {
            saveGlobalServerSettings(server);
        }

        @Override
        public void serverChanged(IServer server) {
            saveGlobalServerSettings(server);
        }

        @Override
        public void serverRemoved(IServer server) {
            saveGlobalServerSettings(server);
            if (connections.get(server.getId()) != null) {
                connections.put(server.getId(), null);
            }
        }
    };
    ServerCore.addRuntimeLifecycleListener(this.runtimeLifecycleListener);
    ServerCore.addServerLifecycleListener(this.serverLifecycleListener);
}
Also used : IServerLifecycleListener(org.eclipse.wst.server.core.IServerLifecycleListener) IServer(org.eclipse.wst.server.core.IServer) IRuntimeLifecycleListener(org.eclipse.wst.server.core.IRuntimeLifecycleListener) IRuntime(org.eclipse.wst.server.core.IRuntime)

Aggregations

IRuntime (org.eclipse.wst.server.core.IRuntime)3 IRuntimeLifecycleListener (org.eclipse.wst.server.core.IRuntimeLifecycleListener)3 Hashtable (java.util.Hashtable)1 DebugOptionsListener (org.eclipse.osgi.service.debug.DebugOptionsListener)1 IServer (org.eclipse.wst.server.core.IServer)1 IServerLifecycleListener (org.eclipse.wst.server.core.IServerLifecycleListener)1