Search in sources :

Example 1 with OpenShiftServerBehaviour

use of org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour in project jbosstools-openshift by jbosstools.

the class OpenShiftShutdownController method stop.

@Override
public void stop(boolean force) {
    OpenShiftServerBehaviour behavior = getBehavior();
    behavior.setServerStopping();
    try {
        DebugLaunchConfigs configs = DebugLaunchConfigs.get();
        if (configs != null) {
            configs.terminateRemoteDebugger(behavior.getServer());
        }
        // configs should only be null if workspace is shutting down, so set server to stopped anyway
        behavior.setServerStopped();
    } catch (CoreException ce) {
        log(IStatus.ERROR, "Error shutting down server", ce);
        getBehavior().setServerStarted();
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) DebugLaunchConfigs(org.jboss.tools.openshift.internal.core.server.debug.DebugLaunchConfigs) OpenShiftServerBehaviour(org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour)

Example 2 with OpenShiftServerBehaviour

use of org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour in project jbosstools-openshift by jbosstools.

the class OpenShiftLaunchController method launch.

@Override
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    OpenShiftServerBehaviour beh = OpenShiftServerUtils.getOpenShiftServerBehaviour(configuration);
    String currentMode = beh.getServer().getMode();
    beh.setServerStarting();
    launchServerProcess(beh, launch, monitor);
    try {
        if (waitForDeploymentConfigReady(beh.getServer(), monitor)) {
            DebugContext context = createDebugContext(beh, monitor);
            toggleDebugging(mode, beh, context, monitor);
            if (!isDebugMode(mode)) {
                // enable devmode if we're not in debug mode. Debug mode has dev mode enabled
                // anyhow
                enableDevMode(context);
            }
            new OpenShiftDebugMode(context).execute(monitor);
        }
    } catch (Exception e) {
        mode = currentMode;
        throw new CoreException(StatusFactory.errorStatus(OpenShiftCoreActivator.PLUGIN_ID, NLS.bind("Could not launch server {0}", beh.getServer().getName()), e));
    } finally {
        setServerState(beh, mode, monitor);
    }
}
Also used : OpenShiftDebugMode(org.jboss.tools.openshift.internal.core.server.debug.OpenShiftDebugMode) CoreException(org.eclipse.core.runtime.CoreException) OpenShiftServerUtils.toCoreException(org.jboss.tools.openshift.core.server.OpenShiftServerUtils.toCoreException) DebugContext(org.jboss.tools.openshift.internal.core.server.debug.DebugContext) OpenShiftServerBehaviour(org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour) CoreException(org.eclipse.core.runtime.CoreException) DebugException(org.eclipse.debug.core.DebugException) OpenShiftServerUtils.toCoreException(org.jboss.tools.openshift.core.server.OpenShiftServerUtils.toCoreException) IOException(java.io.IOException)

Example 3 with OpenShiftServerBehaviour

use of org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour in project jbosstools-openshift by jbosstools.

the class OpenShiftNodejsShutdownController method stop.

@Override
public void stop(boolean force) {
    OpenShiftServerBehaviour behavior = getBehavior();
    behavior.setServerStopping();
    try {
        NodeDebugLauncher.terminate(behavior.getServer());
        behavior.setServerStopped();
    } catch (CoreException ce) {
        log(IStatus.ERROR, "Error shutting down server", ce);
        getBehavior().setServerStarted();
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) OpenShiftServerBehaviour(org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)3 OpenShiftServerBehaviour (org.jboss.tools.openshift.core.server.OpenShiftServerBehaviour)3 IOException (java.io.IOException)1 DebugException (org.eclipse.debug.core.DebugException)1 OpenShiftServerUtils.toCoreException (org.jboss.tools.openshift.core.server.OpenShiftServerUtils.toCoreException)1 DebugContext (org.jboss.tools.openshift.internal.core.server.debug.DebugContext)1 DebugLaunchConfigs (org.jboss.tools.openshift.internal.core.server.debug.DebugLaunchConfigs)1 OpenShiftDebugMode (org.jboss.tools.openshift.internal.core.server.debug.OpenShiftDebugMode)1