use of org.eclipse.wst.server.core.IServerLifecycleListener in project liferay-ide by liferay.
the class RemoteServerWizardFragment method performFinish.
@Override
public void performFinish(IProgressMonitor monitor) throws CoreException {
try {
this.wizard.run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (lastServerStatus == null || (!lastServerStatus.isOK())) {
lastServerStatus = getRemoteServerWC().validate(monitor);
if (!lastServerStatus.isOK()) {
throw new InterruptedException(lastServerStatus.getMessage());
}
}
}
});
} catch (Exception e) {
}
ServerCore.addServerLifecycleListener(new IServerLifecycleListener() {
String id = getServerWorkingCopy().getId();
public void serverAdded(final IServer server) {
if (server.getId().equals(id)) {
UIUtil.async(new Runnable() {
public void run() {
// $NON-NLS-1$
IViewPart serversView = UIUtil.showView("org.eclipse.wst.server.ui.ServersView");
CommonViewer viewer = (CommonViewer) serversView.getAdapter(CommonViewer.class);
viewer.setSelection(new StructuredSelection(server));
}
});
ServerCore.removeServerLifecycleListener(this);
server.addServerListener(new IServerListener() {
public void serverChanged(ServerEvent event) {
if (event.getServer().getServerState() == IServer.STATE_STARTED) {
server.publish(IServer.PUBLISH_INCREMENTAL, null, null, null);
server.removeServerListener(this);
}
}
});
}
}
public void serverChanged(IServer server) {
}
public void serverRemoved(IServer server) {
}
});
}
use of org.eclipse.wst.server.core.IServerLifecycleListener in project webtools.servertools by eclipse.
the class ServerLifecycleListenerTestCase method testListener.
public void testListener() {
IServerLifecycleListener listener = new IServerLifecycleListener() {
public void serverAdded(IServer server) {
// ignore
}
public void serverChanged(IServer server) {
// ignore
}
public void serverRemoved(IServer server) {
// ignore
}
};
listener.serverAdded(null);
listener.serverChanged(null);
listener.serverRemoved(null);
}
use of org.eclipse.wst.server.core.IServerLifecycleListener 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);
}
use of org.eclipse.wst.server.core.IServerLifecycleListener in project liferay-ide by liferay.
the class KaleoCore method getKaleoConnection.
public static IKaleoConnection getKaleoConnection(ILiferayServer liferayServer) {
if (_kaleoConnections == null) {
_kaleoConnections = new HashMap<>();
IServerLifecycleListener serverLifecycleListener = new IServerLifecycleListener() {
public void serverAdded(IServer server) {
}
public void serverChanged(IServer server) {
}
public void serverRemoved(IServer s) {
ILiferayServer server = (ILiferayServer) s.loadAdapter(ILiferayServer.class, new NullProgressMonitor());
if (liferayServer.equals(server)) {
IKaleoConnection service = _kaleoConnections.get(liferayServer.getId());
if (service != null) {
service = null;
_kaleoConnections.put(liferayServer.getId(), null);
}
}
}
};
ServerCore.addServerLifecycleListener(serverLifecycleListener);
}
IKaleoConnection service = _kaleoConnections.get(liferayServer.getId());
if (service == null) {
service = new KaleoConnection();
updateKaleoConnectionSettings(liferayServer, service);
_kaleoConnections.put(liferayServer.getId(), service);
}
return service;
}
Aggregations