Java Code Examples for org.eclipse.debug.core.ILaunch#getDebugTarget()
The following examples show how to use
org.eclipse.debug.core.ILaunch#getDebugTarget() .
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: BaseTest.java From codewind-eclipse with Eclipse Public License 2.0 | 6 votes |
protected void checkMode(CodewindApplication app, StartMode mode) throws Exception { for (int i = 0; i < 5 && app.getStartMode() != mode; i++) { Thread.sleep(1000); } assertTrue("App is in " + app.getStartMode() + " when it should be in " + mode + " mode.", app.getStartMode() == mode); ILaunch launch = getLaunch(app); if (StartMode.DEBUG_MODES.contains(mode)) { assertNotNull("There should be a launch for the app", launch); IDebugTarget debugTarget = launch.getDebugTarget(); assertNotNull("The launch should have a debug target", debugTarget); assertTrue("The debug target should have threads", debugTarget.hasThreads()); } else { // There could be a launch if the app was previously in debug mode, but it should be terminated if (launch != null) { assertTrue("Any launch from a previous debug session should be terminated", launch.isTerminated()); } } }
Example 2
Source File: PydevConsoleInterpreter.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public void setLaunchAndRelatedInfo(ILaunch launch) { this.setLaunch(launch); if (launch != null) { IDebugTarget debugTarget = launch.getDebugTarget(); IInterpreterInfo projectInterpreter = null; if (debugTarget instanceof PyDebugTarget) { PyDebugTarget pyDebugTarget = (PyDebugTarget) debugTarget; PythonNature nature = PythonNature.getPythonNature(pyDebugTarget.project); if (nature != null) { ArrayList<IPythonNature> natures = new ArrayList<>(1); natures.add(nature); this.setNaturesUsed(natures); try { projectInterpreter = nature.getProjectInterpreter(); this.setInterpreterInfo(projectInterpreter); } catch (Throwable e1) { Log.log(e1); } } } } }
Example 3
Source File: NodeJSDebugLauncher.java From codewind-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public boolean canAttachDebugger(CodewindEclipseApplication app) { if (useBuiltinDebugger()) { ILaunch launch = app.getLaunch(); IDebugTarget debugTarget = launch == null ? null : launch.getDebugTarget(); return (debugTarget == null || debugTarget.isDisconnected()); } String host = app.getDebugConnectHost(); int debugPort = app.getDebugConnectPort(); if (app instanceof RemoteEclipseApplication && debugPort == -1) { // If the port forward is not running then the debugger cannot already be attached return true; } // If a debugger is already attached then the devtools url field will not be included in the result try { URI uri = new URI("http", null, host, debugPort, DEBUG_INFO, null, null); //$NON-NLS-1$ HttpResult result = HttpUtil.get(uri); if (result.isGoodResponse) { String response = result.response; JSONArray array = new JSONArray(response); JSONObject info = array.getJSONObject(0); if (info.has(DEVTOOLS_URL_FIELD)) { String url = info.getString(DEVTOOLS_URL_FIELD); if (url != null && !url.isEmpty()) { return true; } } } } catch (Exception e) { Logger.log("Failed to retrieve the debug information for the " + app.name + " app: " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ } return false; }
Example 4
Source File: RenameCompilationUnitHandler.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection sel= HandlerUtil.getCurrentSelection(event); IFile iFile = getIFileFrom(sel); RenameRefactoringInfo refactoringInfo = getRenameRefactoringInfo(iFile); if (refactoringInfo == null) { MessageDialog.openError(HandlerUtil.getActiveShell(event), Messages.RenameCompilationUnitHandler_InvalidSelection, Messages.RenameCompilationUnitHandler_CannotPerformRefactoringWithCurrentSelection); return null; } IProject iProject = iFile.getProject(); ILaunch launch = LaunchConfigurationUtils.getLaunch(iProject); if (launch != null && launch.getDebugTarget() != null && !launch.getDebugTarget().isTerminated()) { MessageDialog.openError(HandlerUtil.getActiveShell(event), Messages.RenameCompilationUnitHandler_ProjectDebugged, Messages.RenameCompilationUnitHandler_CannotChangeFilesOfDebuggedProject); return null; } RenameRefactoringProcessor refactoringProcessor = new RenameRefactoringProcessor(refactoringInfo); RenameRefactoring renameRefactoring = new RenameRefactoring(refactoringProcessor); RenameRefactoringWizard wizard = new RenameRefactoringWizard(renameRefactoring, refactoringInfo); RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation( wizard ); try { String titleForFailedChecks = ""; //$NON-NLS-1$ op.run( HandlerUtil.getActiveShell(event), titleForFailedChecks ); } catch( final InterruptedException irex ) { } return null; }
Example 5
Source File: DebuggerTestUtils.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Waits until a debug target is available in the passed launch * @return the debug target found */ public IDebugTarget waitForDebugTargetAvailable(final ILaunch launch) throws Throwable { waitForCondition(new ICallback() { @Override public Object call(Object args) throws Exception { return launch.getDebugTarget() != null; } }, "waitForDebugTargetAvailable"); return launch.getDebugTarget(); }
Example 6
Source File: DebugCommons.java From xds-ide with Eclipse Public License 1.0 | 2 votes |
/** * Are any debugging sessions running for this {@link IProject} * @param iProject * @return */ public static boolean isProjectInDebug(IProject iProject) { ILaunch launch = LaunchConfigurationUtils.getLaunch(iProject); return launch != null && launch.getDebugTarget() != null && !launch.getDebugTarget().isTerminated(); }