/** * @throws CoreException * @throws TimeoutException * @throws ExecutionException * @throws InterruptedException */ private IServer createLiveReloadServer(final String serverName, final boolean injectScript) throws CoreException, InterruptedException, ExecutionException, TimeoutException { final IServer server = WSTUtils.createLiveReloadServer( serverName, "localhost", liveReloadServerPort, injectScript, false); liveReloadServerBehaviour = (LiveReloadServerBehaviour) WSTUtils.findServerBehaviour(server); assertThat(liveReloadServerBehaviour).isNotNull(); liveReloadServer = liveReloadServerBehaviour.getServer(); assertThat(liveReloadServer).isNotNull(); assertThat(liveReloadServer.canStart(ILaunchManager.RUN_MODE).isOK()).isTrue(); return liveReloadServer; }
@Override public boolean preLaunchCheck( ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { IServer server = ServerUtil.getServer(configuration); IStatus s = server.canStart(mode); Trace.trace(Trace.STRING_FINEST, "Ensuring Server can start: " + s.getMessage()); // $NON-NLS-1$ if (!s.isOK()) throw new CoreException(s); IControllableServerBehavior jbsBehavior = JBossServerBehaviorUtils.getControllableBehavior(server); if (LaunchCommandPreferences.isIgnoreLaunchCommand(server)) { Trace.trace( Trace.STRING_FINEST, "Server is marked as ignore Launch. Marking as started."); //$NON-NLS-1$ ((ControllableServerBehavior) jbsBehavior).setRunMode(mode); ((ControllableServerBehavior) jbsBehavior).setServerStarting(); boolean attachDebugger = server.getAttribute(RemoteDebugUtils.ATTACH_DEBUGGER, true); if ("debug".equals(mode) && attachDebugger) { // add a listener which will run the debugger once server is started IServerListener listener = createAttachDebuggerListener(); server.addServerListener(listener); } initiatePolling(server); return false; } validateServerStructure(server); Trace.trace( Trace.STRING_FINEST, "Checking if similar server is already up on the same ports."); //$NON-NLS-1$ IStatus startedStatus = isServerStarted(server); boolean started = startedStatus.isOK(); if (started) { Trace.trace( Trace.STRING_FINEST, "A server is already started. Now handling the already started scenario."); //$NON-NLS-1$ return handleAlreadyStartedScenario(server, startedStatus); } Trace.trace(Trace.STRING_FINEST, "A full launch will now proceed."); // $NON-NLS-1$ return true; }