Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Swanson2002-04-04 22:06:38 +0000
committerDarin Swanson2002-04-04 22:06:38 +0000
commitf122ade16dfc3f99a2fb7bde09e0463c4f67100b (patch)
tree2185a54f977c2d5f31996d1ba32765fa64dfe104
parent9baee023e2ae7ed0bdd5b901b8b2c3aedb63a087 (diff)
downloadeclipse.platform.debug-f122ade16dfc3f99a2fb7bde09e0463c4f67100b.tar.gz
eclipse.platform.debug-f122ade16dfc3f99a2fb7bde09e0463c4f67100b.tar.xz
eclipse.platform.debug-f122ade16dfc3f99a2fb7bde09e0463c4f67100b.zip
Bug 12160 - Launch creation/lifecycle
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java22
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java14
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java4
6 files changed, 52 insertions, 50 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java
index 5ac879cf6..e29de0941 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java
@@ -125,6 +125,7 @@ public class Launch extends PlatformObject implements ILaunch {
* or <code>null</code> if none
* @param target the debug target created by this launch, or <code>null</code>
* if none
+ * @deprecated to be removed
*/
public Launch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator, IProcess[] processes, IDebugTarget target) {
setLauncher(null);
@@ -137,6 +138,23 @@ public class Launch extends PlatformObject implements ILaunch {
}
/**
+ * Constructs a launch with the specified attributes.
+ *
+ * @param launchConfiguration the configuration that was launched
+ * @param mode the mode of this launch - run or debug (constants
+ * defined by <code>ILaunchManager</code>)
+ * @param locator the source locator to use for this debug session, or
+ * <code>null</code> if not supported
+ */
+ public Launch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
+ setLauncher(null);
+ setElement(launchConfiguration);
+ setSourceLocator(locator);
+ setLaunchMode(mode);
+ fSuppressChange = false;
+ }
+
+ /**
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
public final boolean canTerminate() {
@@ -207,7 +225,7 @@ public class Launch extends PlatformObject implements ILaunch {
* Returns the processes associated with this
* launch, in its internal form - a list.
*
- * @return list or processes
+ * @return list of processes
*/
protected List getProcesses0() {
return fProcesses;
@@ -421,7 +439,7 @@ public class Launch extends PlatformObject implements ILaunch {
}
/**
- * Adds the given processes to this lanuch.
+ * Adds the given processes to this launch.
*
* @param processes processes to add
*/
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java
index 40c57798b..6d3362fa8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java
@@ -5,8 +5,8 @@ package org.eclipse.debug.core.model;
* All Rights Reserved.
*/
-import org.eclipse.debug.core.ILaunch;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.ILaunch;
/**
* A process represents a program running in normal (non-debug) mode.
@@ -19,7 +19,7 @@ import org.eclipse.core.runtime.IAdaptable;
* provides an implementation of this interface for a
* <code>java.lang.Process</code>.
* </p>
- * @see org.eclipse.debug.core.DebugPlugin#newProcess(Process, String)
+ * @see org.eclipse.debug.core.DebugPlugin#newProcess(ILaunch, Process, String)
*/
public interface IProcess extends IAdaptable, ITerminate {
@@ -30,12 +30,7 @@ public interface IProcess extends IAdaptable, ITerminate {
*/
public String getLabel();
/**
- * Returns the launch this element originated from, or
- * <code>null</code> if this element is not registered with
- * an launch. This is a convenience method for
- * <code>ILaunchManager.findLaunch(IProcess)</code>.
- *
- * [Issue: this API will be changed to never return null.]
+ * Returns the launch this element originated from.
*
* @return the launch this process is contained in
*/
@@ -60,10 +55,9 @@ public interface IProcess extends IAdaptable, ITerminate {
* Returns the value of a client defined attribute.
*
* @param key the attribute key
- * @return value the attribute value, or <code>null</code> if undefined
+ * @return value the String attribute value, or <code>null</code> if undefined
*/
public String getAttribute(String key);
-
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
index 8137cab7b..6bdd542d0 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java
@@ -135,7 +135,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
* @see ILaunchConfiguration#launch(String, IProgressMonitor)
*/
public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException {
- ILaunch launch = new Launch(this, mode, null, null, null);
+ ILaunch launch = new Launch(this, mode, null);
getLaunchManager().addLaunch(launch);
getDelegate().launch(this, mode, launch, monitor);
if (monitor != null && monitor.isCanceled()) {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java
index d7aced68f..1ab66ae10 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java
@@ -35,7 +35,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
private static final int TIME_TO_WAIT_FOR_THREAD_DEATH = 500; // ms
/**
- * The launch this process is conatined in
+ * The launch this process is contained in
*/
private ILaunch fLaunch;
@@ -130,7 +130,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
}
/**
- * Sets the launch this process is conatined in
+ * Sets the launch this process is contained in
*
* @param launch the launch this process is contained in
*/
@@ -219,7 +219,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
private void fireEvent(DebugEvent event) {
DebugPlugin manager= DebugPlugin.getDefault();
if (manager != null) {
- manager.fireDebugEvent(event);
+ manager.fireDebugEventSet(new DebugEvent[]{event});
}
}
@@ -259,17 +259,14 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
}
if (adapter.equals(IDebugTarget.class)) {
ILaunch launch = getLaunch();
- if (launch != null) {
- IDebugTarget[] targets = launch.getDebugTargets();
- for (int i = 0; i < targets.length; i++) {
- if (this.equals(targets[i].getProcess())) {
- return targets[i];
- }
+ IDebugTarget[] targets = launch.getDebugTargets();
+ for (int i = 0; i < targets.length; i++) {
+ if (this.equals(targets[i].getProcess())) {
+ return targets[i];
}
}
return null;
}
return super.getAdapter(adapter);
}
-}
-
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index 62f3f882c..f7ee1c5a0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -502,11 +502,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
processInput= ((IDebugElement) input).getDebugTarget().getProcess();
}
- if ((processInput == null) || (processInput.getLaunch() == null)) {
- return null;
- } else {
- return processInput;
- }
+ return processInput;
}
/**
@@ -601,17 +597,18 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
public void launchRemoved(final ILaunch launch) {
getStandardDisplay().syncExec(new Runnable () {
public void run() {
+ IProcess currentProcess= getCurrentProcess();
IProcess[] processes= launch.getProcesses();
for (int i= 0; i < processes.length; i++) {
- ConsoleDocument doc= (ConsoleDocument)getConsoleDocument(processes[i]);
+ IProcess iProcess = processes[i];
+ ConsoleDocument doc= (ConsoleDocument)getConsoleDocument(iProcess);
if (doc != null) {
doc.close();
setConsoleDocument(processes[i], null);
}
- }
- IProcess currentProcess= getCurrentProcess();
- if (currentProcess != null && currentProcess.getLaunch() == null) {
- fCurrentProcess= null;
+ if (iProcess.equals(currentProcess)) {
+ fCurrentProcess= null;
+ }
}
}
});
@@ -624,13 +621,11 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
getStandardDisplay().syncExec(new Runnable () {
public void run() {
IProcess[] processes= launch.getProcesses();
- if (processes != null) {
- for (int i= 0; i < processes.length; i++) {
- if (getConsoleDocument(processes[i]) == null) {
- ConsoleDocument doc= new ConsoleDocument(processes[i]);
- doc.startReading();
- setConsoleDocument(processes[i], doc);
- }
+ for (int i= 0; i < processes.length; i++) {
+ if (getConsoleDocument(processes[i]) == null) {
+ ConsoleDocument doc= new ConsoleDocument(processes[i]);
+ doc.startReading();
+ setConsoleDocument(processes[i], doc);
}
}
}
@@ -648,12 +643,10 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
getStandardDisplay().syncExec(new Runnable () {
public void run() {
IProcess[] processes= launch.getProcesses();
- if (processes != null) {
- for (int i= 0; i < processes.length; i++) {
- ConsoleDocument doc= new ConsoleDocument(processes[i]);
- doc.startReading();
- setConsoleDocument(processes[i], doc);
- }
+ for (int i= 0; i < processes.length; i++) {
+ ConsoleDocument doc= new ConsoleDocument(processes[i]);
+ doc.startReading();
+ setConsoleDocument(processes[i], doc);
}
}
});
@@ -664,7 +657,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
newProcess= target.getProcess();
} else {
IProcess[] processes= launch.getProcesses();
- if ((processes != null) && (processes.length > 0)) {
+ if (processes.length > 0) {
newProcess= processes[processes.length - 1];
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java
index 02414b94a..0dc428229 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java
@@ -32,12 +32,12 @@ public class RemoveAllTerminatedAction extends AbstractRemoveAllActionDelegate i
Object source= event.getSource();
if (source instanceof IDebugTarget) {
ILaunch launch= ((IDebugTarget)source).getLaunch();
- if (launch != null && launch.isTerminated()) {
+ if (launch.isTerminated()) {
getAction().setEnabled(true);
}
} else if (source instanceof IProcess) {
ILaunch launch= ((IProcess)source).getLaunch();
- if (launch != null && launch.isTerminated()) {
+ if (launch.isTerminated()) {
getAction().setEnabled(true);
}
}

Back to the top