Java Code Examples for org.eclipse.debug.core.ILaunch#isTerminated()
The following examples show how to use
org.eclipse.debug.core.ILaunch#isTerminated() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlexMavenPackagedProjectStagingDelegate.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
/** * Waits until {@code launch} terminates or {@code monitor} is canceled. if the monitor is * canceled, attempts to terminate the launch before returning. * * @return true if the launch terminated normally; false otherwise */ @VisibleForTesting static boolean waitUntilLaunchTerminates(ILaunch launch, IProgressMonitor monitor) throws InterruptedException, DebugException { while (!launch.isTerminated() && !monitor.isCanceled()) { Thread.sleep(100 /*ms*/); } if (monitor.isCanceled()) { launch.terminate(); return false; } for (IProcess process : launch.getProcesses()) { if (process.getExitValue() != 0) { return false; } } return true; }
Example 2
Source File: LocalAppEngineServerLaunchConfigurationDelegate.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@VisibleForTesting void checkConflictingLaunches(ILaunchConfigurationType launchConfigType, String mode, RunConfiguration runConfig, ILaunch[] launches) throws CoreException { for (ILaunch launch : launches) { if (launch.isTerminated() || launch.getLaunchConfiguration() == null || launch.getLaunchConfiguration().getType() != launchConfigType) { continue; } IServer otherServer = ServerUtil.getServer(launch.getLaunchConfiguration()); List<Path> paths = new ArrayList<>(); RunConfiguration otherRunConfig = generateServerRunConfiguration(launch.getLaunchConfiguration(), otherServer, mode, paths); IStatus conflicts = checkConflicts(runConfig, otherRunConfig, new MultiStatus(Activator.PLUGIN_ID, 0, Messages.getString("conflicts.with.running.server", otherServer.getName()), //$NON-NLS-1$ null)); if (!conflicts.isOK()) { throw new CoreException(StatusUtil.filter(conflicts)); } } }
Example 3
Source File: SimulationView.java From statecharts with Eclipse Public License 1.0 | 6 votes |
private void sessionViewerInputChanged(ILaunch changedLaunch) { ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); List<ILaunch> activeLaunches = Lists.newArrayList(); for (ILaunch iLaunch : launches) { if (!iLaunch.isTerminated()) { activeLaunches.add(iLaunch); } } Display.getDefault().asyncExec(() -> { try { simulationSessionViewer.removeSelectionChangedListener(selectionChangedListener); ; simulationSessionViewer.setInput(activeLaunches.toArray()); simulationSessionViewer.expandAll(); } finally { simulationSessionViewer.addSelectionChangedListener(selectionChangedListener); if (changedLaunch != null) simulationSessionViewer.setSelection(new StructuredSelection(changedLaunch)); } }); }
Example 4
Source File: SwtBotLaunchManagerActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
public static void terminateAllLaunchConfigs(SWTBot bot) { SwtBotUtils.print("Terminating Launches"); ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunch[] launches = manager.getLaunches(); if (launches == null || launches.length == 0) { SwtBotUtils.print("No Launches to terminate"); } for (ILaunch launch : launches) { if (!launch.isTerminated()) { try { launch.terminate(); } catch (DebugException e) { SwtBotUtils.printError("Could not terminate launch." + e.getMessage()); } } } SwtBotWorkbenchActions.waitForIdle(bot); SwtBotUtils.print("Terminated Launches"); }
Example 5
Source File: TerminateAllLaunchesAction.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public static void terminateAllLaunches() { Job job = new Job("Terminate all Launches") { @Override protected IStatus run(IProgressMonitor monitor) { ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); for (ILaunch iLaunch : launches) { try { if (!iLaunch.isTerminated()) { iLaunch.terminate(); } } catch (Exception e) { Log.log(e); } } return Status.OK_STATUS; } }; job.setPriority(Job.INTERACTIVE); job.schedule(); }
Example 6
Source File: Model.java From tlaplus with MIT License | 5 votes |
public boolean isRunning() { final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); final ILaunch[] launches = launchManager.getLaunches(); for (int i = 0; i < launches.length; i++) { final ILaunch launch = launches[i]; if (launch.getLaunchConfiguration() != null && launch.getLaunchConfiguration().contentsEqual(this.launchConfig)) { if (!launch.isTerminated()) { return true; } } } return false; }
Example 7
Source File: TerminateAllLaunchesAction.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public void update() { ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); try { for (ILaunch iLaunch : launches) { if (!iLaunch.isTerminated()) { setEnabled(true); return; } } setEnabled(false); } catch (Exception e) { Log.log(e); } }
Example 8
Source File: ScanWorkspaceOperation.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(Messages.scanningWorkspace, IProgressMonitor.UNKNOWN); final ILaunchManager manager = getLaunchManager(); final ILaunchConfigurationType ltype = manager .getLaunchConfigurationType(IPDELauncherConstants.ECLIPSE_APPLICATION_LAUNCH_CONFIGURATION_TYPE); try { final ILaunchConfigurationWorkingCopy workingCopy = ltype.newInstance(null, "Scan workspace"); workingCopy.setAttribute(IPDELauncherConstants.APPLICATION, applicationId()); workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "-scan"); if (Objects.equals(Platform.getOS(), Platform.OS_MACOSX)) { workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_USE_START_ON_FIRST_THREAD, true); } workingCopy.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false); workingCopy.setAttribute(IPDELauncherConstants.RUN_IN_UI_THREAD, true); workingCopy.setAttribute(IPDELauncherConstants.DOCLEAR, false); workingCopy.setAttribute(IPDELauncherConstants.LOCATION, tmpWorskpaceFolder()); workingCopy.setAttribute(IPDELauncherConstants.USE_PRODUCT, false); final ILaunch launch = workingCopy.launch("run", Repository.NULL_PROGRESS_MONITOR); launch.getProcesses()[0].getStreamsProxy().getOutputStreamMonitor().addListener(new IStreamListener() { @Override public void streamAppended(String text, IStreamMonitor streamMonitor) { if (text.startsWith("$SCAN_PROGRESS_")) { scanStatus(text); } } }); while (!launch.isTerminated()) { Thread.sleep(1000); } if (workspaceModel.isEmpty()) { workspaceModel.setStatus(ValidationStatus.error(Messages.noRepositoryFoundAtLocation)); } if (launch.isTerminated()) { monitor.done(); } } catch (final CoreException | IOException e) { throw new InvocationTargetException(e); } }