Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJared Burns2002-08-05 18:14:16 +0000
committerJared Burns2002-08-05 18:14:16 +0000
commitfe6dcd2945361ddd1cf8014753bf0d04f2a8ea1c (patch)
tree3c351c292e0c5a5b5c483a89c9f31adb64e5ca38 /org.eclipse.debug.core/core/org
parent19dde7bbedba3a357349ab300ced8148b63fc4af (diff)
downloadeclipse.platform.debug-fe6dcd2945361ddd1cf8014753bf0d04f2a8ea1c.tar.gz
eclipse.platform.debug-fe6dcd2945361ddd1cf8014753bf0d04f2a8ea1c.tar.xz
eclipse.platform.debug-fe6dcd2945361ddd1cf8014753bf0d04f2a8ea1c.zip
*** keyword substitution change ***
Diffstat (limited to 'org.eclipse.debug.core/core/org')
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java796
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java140
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java1080
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java124
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java288
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java64
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionListener.java92
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java176
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunch.java342
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java684
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationListener.java82
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java240
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java286
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchListener.java88
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java418
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IStreamListener.java54
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java776
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java514
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java430
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java114
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java184
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDisconnect.java88
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java122
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java86
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILineBreakpoint.java88
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlock.java152
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlockRetrieval.java92
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java142
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegister.java62
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegisterGroup.java112
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java124
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java352
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStep.java170
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java86
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java102
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISuspendResume.java114
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ITerminate.java80
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java210
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java194
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValueModification.java158
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java178
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java106
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/package.html194
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/package.html128
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java1164
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java52
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties110
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java378
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java248
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java924
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java1042
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java304
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java978
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java2222
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ListenerList.java262
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java344
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ProcessMonitor.java158
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java580
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java198
59 files changed, 9538 insertions, 9538 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java
index ff0454382..3db2baeb2 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugEvent.java
@@ -1,398 +1,398 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.EventObject;
-
-import org.eclipse.debug.internal.core.DebugCoreMessages;
-
-/**
- * A debug event describes an event in a program being debugged or
- * in a running process. Debug models and process implementations
- * are required to generate debug events as specified by this class.
- * <p>
- * The following list defines the events generated for each debug
- * model element.
- * The <code>getSource()</code> method of a debug event
- * returns the element associated with the event.
- * Creation events are guaranteed to occur in a top
- * down order - that is, parents are created before children.
- * Termination events are guaranteed to occur in a bottom up order -
- * that is, children before parents. However, termination events are not guaranteed
- * for all elements that are created. That is, terminate events can be coalesced - a
- * terminate event for a parent signals that all children have been terminated.
- * </p>
- * <p>
- * The generic <code>CHANGE</code> event can be fired at any time by any element.
- * Generally, a client of a debug model, such as as a UI, can get sufficient
- * information to update by listening/responding to the other event kinds. However,
- * if a debug model needs to inform clients of a change that is not specified
- * by create/terminate/suspend/resume, the <code>CHANGE</code> event may be used.
- * For example, generally, the only way a thread or any of its children can change
- * state between a suspend and resume operation, is if the thread or owning debug
- * target is terminated. However, if a debug model supports some other operation
- * that would allow a debug element to change state while suspended, the debug model
- * would fire a change event for that element. The valid detail codes for a
- * change event are:<ul>
- * <li><code>STATE</code> - indicates the state of an element has changed, but its
- * children are not affected. A client would use a state change event to update
- * a label of the affected element, but would not update any children.</li>
- * <li><code>CONTENT</code> - indicates that a debug element's value or contents have
- * changed in some way. For example, when the value of a variable is changed
- * explicitly, the variable should fire a content change event.</li>
- * </ul>
- * </p>
- * <ul>
- * <li><code>IProcess</code>
- * <ul>
- * <li><code>CREATE</code> - a process has been created and is executing.</li>
- * <li><code>TERMINATE</code> - a process has terminated.</li>
- * </ul>
- * <li><code>IDebugTarget</code>
- * <ul>
- * <li><code>CREATE</code> - a debug target has been created and is ready
- * to begin a debug session.</li>
- * <li><code>TERMINATE</code> - a debug target has terminated and the debug
- * session has ended.</li>
- * <li><code>SUSPEND</code> - a debug target has suspended. Event detail provides
- * the reason for the suspension:<ul>
- * <li><code>STEP_END</code> - a request to step has completed</li>
- * <li><code>BREAKPOINT</code> - a breakpoint has been hit</li>
- * <li><code>CLIENT_REQUEST</code> - a client request has caused the target to suspend
- * (i.e. an explicit call to <code>suspend()</code>)</li>
- * <li><code>UNSPECIFIED</code> - the reason for the suspend is not specified</li>
- * </ul>
- * </li>
- * <li><code>RESUME</code> - a debug target has resumed. Event detail provides
- * the reason for the resume:<ul>
- * <li><code>STEP_INTO</code> - a target is being resumed because of a request to step into</li>
- * <li><code>STEP_OVER</code> - a target is being resumed because of a request to step over</li>
- * <li><code>STEP_RETURN</code> - a target is being resumed because of a request to step return</li>
- * <li><code>CLIENT_REQUEST</code> - a client request has caused the target to be resumed
- * (i.e. an explicit call to <code>resume()</code>)</li>
- * <li><code>UNSPECIFIED</code> - The reason for the resume is not specified</li>
- * </ul>
- * </li>
- * </ul>
- * </li>
- * <li><code>IThread</code>
- * <ul>
- * <li><code>CREATE</code> - a thread has been created in a debug target.</li>
- * <li><code>TERMINATE</code> - a thread has terminated.</li>
- * <li><code>SUSPEND</code> - a thread has suspended execution. Event detail provides
- * the reason for the suspension:<ul>
- * <li><code>STEP_END</code> - a request to step has completed</li>
- * <li><code>BREAKPOINT</code> - a breakpoint has been hit</li>
- * <li><code>CLIENT_REQUEST</code> - a client request has caused the thread to suspend
- * (i.e. an explicit call to <code>suspend()</code>)</li>
- * <li><code>EVALUATION</code> - an expression evaluation has ended that may
- * have had side effects in the debug target.</li>
- * <li><code>EVALUATION_IMPLICIT</code> - an expression evaluation has ended that
- * had no side effects in the debug target.</li>
- * <li><code>UNSPECIFIED</code> - the reason for the suspend is not specified</li>
- * </ul>
- * </li>
- * <li><code>RESUME</code> - a thread has resumed execution. Event detail provides
- * the reason for the resume:<ul>
- * <li><code>STEP_INTO</code> - a thread is being resumed because of a request to step into</li>
- * <li><code>STEP_OVER</code> - a thread is being resumed because of a request to step over</li>
- * <li><code>STEP_RETURN</code> - a thread is being resumed because of a request to step return</li>
- * <li><code>CLIENT_REQUEST</code> - a client request has caused the thread to be resumed
- * (i.e. an explicit call to <code>resume()</code>)</li>
- * <li><code>EVALUATION</code> - an expression evaluation has started that may
- * have side effects in the debug target.</li>
- * <li><code>EVALUATION_IMPLICIT</code> - an expression evaluation has started that
- * will have no side effects in the debug target.</li>
- * <li><code>UNSPECIFIED</code> - The reason for the resume is not specified</li>
- * </ul>
- * </li>
- * </ul>
- * </li>
- * <li><code>IStackFrame</code> - no events are specified for stack frames.
- * When a thread is suspended, it has stack frames. When a thread resumes,
- * stack frames are unavailable.
- * </li>
- * <li><code>IVariable</code> - no events are specified for variables.
- * When a thread is suspended, stack frames have variables. When a thread resumes,
- * variables are unavailable.
- * </li>
- * <li><code>IValue</code> - no events are specified for values.
- * </li>
- * </ul>
- * <p>
- * Clients may instantiate this class. Clients are not intended to subclass this class.
- * </p>
- */
-public final class DebugEvent extends EventObject {
-
- /**
- * Resume event kind.
- */
- public static final int RESUME= 0x0001;
-
- /**
- * Suspend event kind.
- */
- public static final int SUSPEND= 0x0002;
-
- /**
- * Create event kind.
- */
- public static final int CREATE= 0x0004;
-
- /**
- * Terminate event kind.
- */
- public static final int TERMINATE= 0x0008;
-
- /**
- * Change event kind.
- */
- public static final int CHANGE= 0x0010;
-
- /**
- * Step start detail. Indicates a thread was resumed by a step
- * into action.
- * @since 2.0
- */
- public static final int STEP_INTO= 0x0001;
-
- /**
- * Step start detail. Indicates a thread was resumed by a step
- * over action.
- * @since 2.0
- */
- public static final int STEP_OVER= 0x0002;
-
- /**
- * Step start detail. Indicates a thread was resumed by a step
- * return action.
- * @since 2.0
- */
- public static final int STEP_RETURN= 0x0004;
-
- /**
- * Step end detail. Indicates a thread was suspended due
- * to the completion of a step action.
- */
- public static final int STEP_END= 0x0008;
-
- /**
- * Breakpoint detail. Indicates a thread was suspended by
- * a breakpoint.
- */
- public static final int BREAKPOINT= 0x0010;
-
- /**
- * Client request detail. Indicates a thread was suspended due
- * to a client request.
- */
- public static final int CLIENT_REQUEST= 0x0020;
-
- /**
- * Evaluation detail. Indicates that a thread was resumed or
- * suspended to perform an expression evaluation.
- *
- * @since 2.0
- */
- public static final int EVALUATION = 0x0040;
-
- /**
- * Evaluation detail. Indicates that a thread was resumed or
- * suspended to perform an implicit expression evaluation.
- * An implicit evaluation is an evaluation that is performed
- * as an indirect result of a user action.
- * Clients may use this detail event to decide whether or not
- * to alert the user that an evaluation is taking place..
- *
- * @since 2.0
- */
- public static final int EVALUATION_IMPLICIT = 0x0080;
-
- /**
- * State change detail. Indicates the state of a single
- * debug element has changed. Only valid for <code>CHANGE</code>
- * events.
- *
- * @since 2.0
- */
- public static final int STATE = 0x0100;
-
- /**
- * Content change detail. Indicates the content of a debug element
- * (and potentially its children) has changed. Only valid for
- * <code>CHANGE</code> events.
- *
- * @since 2.0
- */
- public static final int CONTENT = 0x0200;
-
- /**
- * Constant indicating that the kind or detail of a debug
- * event is unspecified.
- */
- public static final int UNSPECIFIED = 0;
-
- /**
- * The kind of event - one of the kind constants defined by
- * this class.
- */
- private int fKind= UNSPECIFIED;
-
- /**
- * The detail of the event - one of the detail constants defined by
- * this class.
- */
- private int fDetail= UNSPECIFIED;
- /**
- * Constructs a new debug event of the given kind with a detail code of
- * <code>UNSPECIFIED</code>.
- *
- * @param eventSource the object associated with the event
- * @param kind the kind of debug event (one of the
- * kind constants defined by this class)
- */
- public DebugEvent(Object eventSource, int kind) {
- this(eventSource, kind, UNSPECIFIED);
- }
-
- /**
- * Constructs a new debug event of the given kind with the given detail.
- *
- * @param eventSource the object associated with the event
- * @param kind the kind of debug event (one of the
- * kind constants defined by this class)
- * @param detail extra information about the event (one of the
- * detail constants defined by this class)
- */
- public DebugEvent(Object eventSource, int kind, int detail) {
- super(eventSource);
- if ((kind & (RESUME | SUSPEND | CREATE | TERMINATE | CHANGE)) == 0)
- throw new IllegalArgumentException(DebugCoreMessages.getString("DebugEvent.illegal_kind")); //$NON-NLS-1$
- if (detail != UNSPECIFIED && (detail & (STEP_END | STEP_INTO | STEP_OVER | STEP_RETURN | BREAKPOINT | CLIENT_REQUEST |EVALUATION | EVALUATION_IMPLICIT | STATE | CONTENT)) == 0)
- throw new IllegalArgumentException(DebugCoreMessages.getString("DebugEvent.illegal_detail")); //$NON-NLS-1$
- fKind= kind;
- fDetail= detail;
- }
-
- /**
- * Returns a constant describing extra detail about the event - one
- * of the detail constants defined by this class, possibly
- * <code>UNSPECIFIED</code>.
- *
- * @return the detail code
- */
- public int getDetail() {
- return fDetail;
- }
-
- /**
- * Returns this event's kind - one of the kind constants defined by this class.
- *
- * @return the kind code
- */
- public int getKind() {
- return fKind;
- }
-
- /**
- * Returns whether this event's detail indicates the
- * beginning of a step event. This event's detail is one
- * of <code>STEP_INTO</code>, <code>STEP_OVER</code>, or
- * <code>STEP_RETURN</code>.
- *
- * @return whether this event's detail indicates the beginning
- * of a step event.
- * @since 2.0
- */
- public boolean isStepStart() {
- return (getDetail() & (STEP_INTO | STEP_OVER | STEP_RETURN)) > 0;
- }
-
- /**
- * Returns whether this event's detail indicates an
- * evaluation. This event's detail is one
- * of <code>EVALUATION</code>, or <code>EVALUATION_IMPLICIT</code>.
- *
- * @return whether this event's detail indicates an evaluation.
- * @since 2.0
- */
- public boolean isEvaluation() {
- return (getDetail() & (EVALUATION | EVALUATION_IMPLICIT)) > 0;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer buf = new StringBuffer("DebugEvent["); //$NON-NLS-1$
- if (getSource() != null) {
- buf.append(getSource().toString());
- } else {
- buf.append("null"); //$NON-NLS-1$
- }
- buf.append(", "); //$NON-NLS-1$
- switch (getKind()) {
- case CREATE:
- buf.append("CREATE"); //$NON-NLS-1$
- break;
- case TERMINATE:
- buf.append("TERMINATE"); //$NON-NLS-1$
- break;
- case RESUME:
- buf.append("RESUME"); //$NON-NLS-1$
- break;
- case SUSPEND:
- buf.append("SUSPEND"); //$NON-NLS-1$
- break;
- case CHANGE:
- buf.append("CHANGE"); //$NON-NLS-1$
- break;
- case UNSPECIFIED:
- buf.append("UNSPECIFIED"); //$NON-NLS-1$
- break;
- }
- buf.append(", "); //$NON-NLS-1$
- switch (getDetail()) {
- case BREAKPOINT:
- buf.append("BREAKPOINT"); //$NON-NLS-1$
- break;
- case CLIENT_REQUEST:
- buf.append("CLIENT_REQUEST"); //$NON-NLS-1$
- break;
- case STEP_END:
- buf.append("STEP_END"); //$NON-NLS-1$
- break;
- case STEP_INTO:
- buf.append("STEP_INTO"); //$NON-NLS-1$
- break;
- case STEP_OVER:
- buf.append("STEP_OVER"); //$NON-NLS-1$
- break;
- case STEP_RETURN:
- buf.append("STEP_RETURN"); //$NON-NLS-1$
- break;
- case EVALUATION:
- buf.append("EVALUATION"); //$NON-NLS-1$
- break;
- case EVALUATION_IMPLICIT:
- buf.append("EVALUATION_IMPLICIT"); //$NON-NLS-1$
- break;
- case STATE:
- buf.append("STATE"); //$NON-NLS-1$
- break;
- case CONTENT:
- buf.append("CONTENT"); //$NON-NLS-1$
- break;
- case UNSPECIFIED:
- buf.append("UNSPECIFIED"); //$NON-NLS-1$
- break;
- }
- buf.append("]"); //$NON-NLS-1$
- return buf.toString();
- }
-}
-
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.util.EventObject;
+
+import org.eclipse.debug.internal.core.DebugCoreMessages;
+
+/**
+ * A debug event describes an event in a program being debugged or
+ * in a running process. Debug models and process implementations
+ * are required to generate debug events as specified by this class.
+ * <p>
+ * The following list defines the events generated for each debug
+ * model element.
+ * The <code>getSource()</code> method of a debug event
+ * returns the element associated with the event.
+ * Creation events are guaranteed to occur in a top
+ * down order - that is, parents are created before children.
+ * Termination events are guaranteed to occur in a bottom up order -
+ * that is, children before parents. However, termination events are not guaranteed
+ * for all elements that are created. That is, terminate events can be coalesced - a
+ * terminate event for a parent signals that all children have been terminated.
+ * </p>
+ * <p>
+ * The generic <code>CHANGE</code> event can be fired at any time by any element.
+ * Generally, a client of a debug model, such as as a UI, can get sufficient
+ * information to update by listening/responding to the other event kinds. However,
+ * if a debug model needs to inform clients of a change that is not specified
+ * by create/terminate/suspend/resume, the <code>CHANGE</code> event may be used.
+ * For example, generally, the only way a thread or any of its children can change
+ * state between a suspend and resume operation, is if the thread or owning debug
+ * target is terminated. However, if a debug model supports some other operation
+ * that would allow a debug element to change state while suspended, the debug model
+ * would fire a change event for that element. The valid detail codes for a
+ * change event are:<ul>
+ * <li><code>STATE</code> - indicates the state of an element has changed, but its
+ * children are not affected. A client would use a state change event to update
+ * a label of the affected element, but would not update any children.</li>
+ * <li><code>CONTENT</code> - indicates that a debug element's value or contents have
+ * changed in some way. For example, when the value of a variable is changed
+ * explicitly, the variable should fire a content change event.</li>
+ * </ul>
+ * </p>
+ * <ul>
+ * <li><code>IProcess</code>
+ * <ul>
+ * <li><code>CREATE</code> - a process has been created and is executing.</li>
+ * <li><code>TERMINATE</code> - a process has terminated.</li>
+ * </ul>
+ * <li><code>IDebugTarget</code>
+ * <ul>
+ * <li><code>CREATE</code> - a debug target has been created and is ready
+ * to begin a debug session.</li>
+ * <li><code>TERMINATE</code> - a debug target has terminated and the debug
+ * session has ended.</li>
+ * <li><code>SUSPEND</code> - a debug target has suspended. Event detail provides
+ * the reason for the suspension:<ul>
+ * <li><code>STEP_END</code> - a request to step has completed</li>
+ * <li><code>BREAKPOINT</code> - a breakpoint has been hit</li>
+ * <li><code>CLIENT_REQUEST</code> - a client request has caused the target to suspend
+ * (i.e. an explicit call to <code>suspend()</code>)</li>
+ * <li><code>UNSPECIFIED</code> - the reason for the suspend is not specified</li>
+ * </ul>
+ * </li>
+ * <li><code>RESUME</code> - a debug target has resumed. Event detail provides
+ * the reason for the resume:<ul>
+ * <li><code>STEP_INTO</code> - a target is being resumed because of a request to step into</li>
+ * <li><code>STEP_OVER</code> - a target is being resumed because of a request to step over</li>
+ * <li><code>STEP_RETURN</code> - a target is being resumed because of a request to step return</li>
+ * <li><code>CLIENT_REQUEST</code> - a client request has caused the target to be resumed
+ * (i.e. an explicit call to <code>resume()</code>)</li>
+ * <li><code>UNSPECIFIED</code> - The reason for the resume is not specified</li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </li>
+ * <li><code>IThread</code>
+ * <ul>
+ * <li><code>CREATE</code> - a thread has been created in a debug target.</li>
+ * <li><code>TERMINATE</code> - a thread has terminated.</li>
+ * <li><code>SUSPEND</code> - a thread has suspended execution. Event detail provides
+ * the reason for the suspension:<ul>
+ * <li><code>STEP_END</code> - a request to step has completed</li>
+ * <li><code>BREAKPOINT</code> - a breakpoint has been hit</li>
+ * <li><code>CLIENT_REQUEST</code> - a client request has caused the thread to suspend
+ * (i.e. an explicit call to <code>suspend()</code>)</li>
+ * <li><code>EVALUATION</code> - an expression evaluation has ended that may
+ * have had side effects in the debug target.</li>
+ * <li><code>EVALUATION_IMPLICIT</code> - an expression evaluation has ended that
+ * had no side effects in the debug target.</li>
+ * <li><code>UNSPECIFIED</code> - the reason for the suspend is not specified</li>
+ * </ul>
+ * </li>
+ * <li><code>RESUME</code> - a thread has resumed execution. Event detail provides
+ * the reason for the resume:<ul>
+ * <li><code>STEP_INTO</code> - a thread is being resumed because of a request to step into</li>
+ * <li><code>STEP_OVER</code> - a thread is being resumed because of a request to step over</li>
+ * <li><code>STEP_RETURN</code> - a thread is being resumed because of a request to step return</li>
+ * <li><code>CLIENT_REQUEST</code> - a client request has caused the thread to be resumed
+ * (i.e. an explicit call to <code>resume()</code>)</li>
+ * <li><code>EVALUATION</code> - an expression evaluation has started that may
+ * have side effects in the debug target.</li>
+ * <li><code>EVALUATION_IMPLICIT</code> - an expression evaluation has started that
+ * will have no side effects in the debug target.</li>
+ * <li><code>UNSPECIFIED</code> - The reason for the resume is not specified</li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </li>
+ * <li><code>IStackFrame</code> - no events are specified for stack frames.
+ * When a thread is suspended, it has stack frames. When a thread resumes,
+ * stack frames are unavailable.
+ * </li>
+ * <li><code>IVariable</code> - no events are specified for variables.
+ * When a thread is suspended, stack frames have variables. When a thread resumes,
+ * variables are unavailable.
+ * </li>
+ * <li><code>IValue</code> - no events are specified for values.
+ * </li>
+ * </ul>
+ * <p>
+ * Clients may instantiate this class. Clients are not intended to subclass this class.
+ * </p>
+ */
+public final class DebugEvent extends EventObject {
+
+ /**
+ * Resume event kind.
+ */
+ public static final int RESUME= 0x0001;
+
+ /**
+ * Suspend event kind.
+ */
+ public static final int SUSPEND= 0x0002;
+
+ /**
+ * Create event kind.
+ */
+ public static final int CREATE= 0x0004;
+
+ /**
+ * Terminate event kind.
+ */
+ public static final int TERMINATE= 0x0008;
+
+ /**
+ * Change event kind.
+ */
+ public static final int CHANGE= 0x0010;
+
+ /**
+ * Step start detail. Indicates a thread was resumed by a step
+ * into action.
+ * @since 2.0
+ */
+ public static final int STEP_INTO= 0x0001;
+
+ /**
+ * Step start detail. Indicates a thread was resumed by a step
+ * over action.
+ * @since 2.0
+ */
+ public static final int STEP_OVER= 0x0002;
+
+ /**
+ * Step start detail. Indicates a thread was resumed by a step
+ * return action.
+ * @since 2.0
+ */
+ public static final int STEP_RETURN= 0x0004;
+
+ /**
+ * Step end detail. Indicates a thread was suspended due
+ * to the completion of a step action.
+ */
+ public static final int STEP_END= 0x0008;
+
+ /**
+ * Breakpoint detail. Indicates a thread was suspended by
+ * a breakpoint.
+ */
+ public static final int BREAKPOINT= 0x0010;
+
+ /**
+ * Client request detail. Indicates a thread was suspended due
+ * to a client request.
+ */
+ public static final int CLIENT_REQUEST= 0x0020;
+
+ /**
+ * Evaluation detail. Indicates that a thread was resumed or
+ * suspended to perform an expression evaluation.
+ *
+ * @since 2.0
+ */
+ public static final int EVALUATION = 0x0040;
+
+ /**
+ * Evaluation detail. Indicates that a thread was resumed or
+ * suspended to perform an implicit expression evaluation.
+ * An implicit evaluation is an evaluation that is performed
+ * as an indirect result of a user action.
+ * Clients may use this detail event to decide whether or not
+ * to alert the user that an evaluation is taking place..
+ *
+ * @since 2.0
+ */
+ public static final int EVALUATION_IMPLICIT = 0x0080;
+
+ /**
+ * State change detail. Indicates the state of a single
+ * debug element has changed. Only valid for <code>CHANGE</code>
+ * events.
+ *
+ * @since 2.0
+ */
+ public static final int STATE = 0x0100;
+
+ /**
+ * Content change detail. Indicates the content of a debug element
+ * (and potentially its children) has changed. Only valid for
+ * <code>CHANGE</code> events.
+ *
+ * @since 2.0
+ */
+ public static final int CONTENT = 0x0200;
+
+ /**
+ * Constant indicating that the kind or detail of a debug
+ * event is unspecified.
+ */
+ public static final int UNSPECIFIED = 0;
+
+ /**
+ * The kind of event - one of the kind constants defined by
+ * this class.
+ */
+ private int fKind= UNSPECIFIED;
+
+ /**
+ * The detail of the event - one of the detail constants defined by
+ * this class.
+ */
+ private int fDetail= UNSPECIFIED;
+ /**
+ * Constructs a new debug event of the given kind with a detail code of
+ * <code>UNSPECIFIED</code>.
+ *
+ * @param eventSource the object associated with the event
+ * @param kind the kind of debug event (one of the
+ * kind constants defined by this class)
+ */
+ public DebugEvent(Object eventSource, int kind) {
+ this(eventSource, kind, UNSPECIFIED);
+ }
+
+ /**
+ * Constructs a new debug event of the given kind with the given detail.
+ *
+ * @param eventSource the object associated with the event
+ * @param kind the kind of debug event (one of the
+ * kind constants defined by this class)
+ * @param detail extra information about the event (one of the
+ * detail constants defined by this class)
+ */
+ public DebugEvent(Object eventSource, int kind, int detail) {
+ super(eventSource);
+ if ((kind & (RESUME | SUSPEND | CREATE | TERMINATE | CHANGE)) == 0)
+ throw new IllegalArgumentException(DebugCoreMessages.getString("DebugEvent.illegal_kind")); //$NON-NLS-1$
+ if (detail != UNSPECIFIED && (detail & (STEP_END | STEP_INTO | STEP_OVER | STEP_RETURN | BREAKPOINT | CLIENT_REQUEST |EVALUATION | EVALUATION_IMPLICIT | STATE | CONTENT)) == 0)
+ throw new IllegalArgumentException(DebugCoreMessages.getString("DebugEvent.illegal_detail")); //$NON-NLS-1$
+ fKind= kind;
+ fDetail= detail;
+ }
+
+ /**
+ * Returns a constant describing extra detail about the event - one
+ * of the detail constants defined by this class, possibly
+ * <code>UNSPECIFIED</code>.
+ *
+ * @return the detail code
+ */
+ public int getDetail() {
+ return fDetail;
+ }
+
+ /**
+ * Returns this event's kind - one of the kind constants defined by this class.
+ *
+ * @return the kind code
+ */
+ public int getKind() {
+ return fKind;
+ }
+
+ /**
+ * Returns whether this event's detail indicates the
+ * beginning of a step event. This event's detail is one
+ * of <code>STEP_INTO</code>, <code>STEP_OVER</code>, or
+ * <code>STEP_RETURN</code>.
+ *
+ * @return whether this event's detail indicates the beginning
+ * of a step event.
+ * @since 2.0
+ */
+ public boolean isStepStart() {
+ return (getDetail() & (STEP_INTO | STEP_OVER | STEP_RETURN)) > 0;
+ }
+
+ /**
+ * Returns whether this event's detail indicates an
+ * evaluation. This event's detail is one
+ * of <code>EVALUATION</code>, or <code>EVALUATION_IMPLICIT</code>.
+ *
+ * @return whether this event's detail indicates an evaluation.
+ * @since 2.0
+ */
+ public boolean isEvaluation() {
+ return (getDetail() & (EVALUATION | EVALUATION_IMPLICIT)) > 0;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buf = new StringBuffer("DebugEvent["); //$NON-NLS-1$
+ if (getSource() != null) {
+ buf.append(getSource().toString());
+ } else {
+ buf.append("null"); //$NON-NLS-1$
+ }
+ buf.append(", "); //$NON-NLS-1$
+ switch (getKind()) {
+ case CREATE:
+ buf.append("CREATE"); //$NON-NLS-1$
+ break;
+ case TERMINATE:
+ buf.append("TERMINATE"); //$NON-NLS-1$
+ break;
+ case RESUME:
+ buf.append("RESUME"); //$NON-NLS-1$
+ break;
+ case SUSPEND:
+ buf.append("SUSPEND"); //$NON-NLS-1$
+ break;
+ case CHANGE:
+ buf.append("CHANGE"); //$NON-NLS-1$
+ break;
+ case UNSPECIFIED:
+ buf.append("UNSPECIFIED"); //$NON-NLS-1$
+ break;
+ }
+ buf.append(", "); //$NON-NLS-1$
+ switch (getDetail()) {
+ case BREAKPOINT:
+ buf.append("BREAKPOINT"); //$NON-NLS-1$
+ break;
+ case CLIENT_REQUEST:
+ buf.append("CLIENT_REQUEST"); //$NON-NLS-1$
+ break;
+ case STEP_END:
+ buf.append("STEP_END"); //$NON-NLS-1$
+ break;
+ case STEP_INTO:
+ buf.append("STEP_INTO"); //$NON-NLS-1$
+ break;
+ case STEP_OVER:
+ buf.append("STEP_OVER"); //$NON-NLS-1$
+ break;
+ case STEP_RETURN:
+ buf.append("STEP_RETURN"); //$NON-NLS-1$
+ break;
+ case EVALUATION:
+ buf.append("EVALUATION"); //$NON-NLS-1$
+ break;
+ case EVALUATION_IMPLICIT:
+ buf.append("EVALUATION_IMPLICIT"); //$NON-NLS-1$
+ break;
+ case STATE:
+ buf.append("STATE"); //$NON-NLS-1$
+ break;
+ case CONTENT:
+ buf.append("CONTENT"); //$NON-NLS-1$
+ break;
+ case UNSPECIFIED:
+ buf.append("UNSPECIFIED"); //$NON-NLS-1$
+ break;
+ }
+ buf.append("]"); //$NON-NLS-1$
+ return buf.toString();
+ }
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java
index bca34fc23..ce226d0e7 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugException.java
@@ -1,70 +1,70 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-
-/**
- * A checked exception representing a failure.
- * <p>
- * Defines status codes relevant to the debug plug-in. When a
- * debug exception is thrown, it contains a status object describing
- * the cause of the exception. The status objects originating from the
- * debug plug-in use the codes defined in this class.
- * </p>
- * <p>
- * Clients may instantiate this class. Clients are not intended to subclass this class.
- * </p>
- * @see IStatus
- */
-public class DebugException extends CoreException {
- /**
- * Indicates a request made of a debug element has failed
- * on the target side.
- */
- public static final int TARGET_REQUEST_FAILED = 5010;
-
- /**
- * Indicates a request is not supported by the capabilities of a debug element.
- * For example, a request was made to terminate an element that does not
- * support termination.
- */
- public static final int NOT_SUPPORTED = 5011;
-
- /**
- * Indicates that a request made of manager has failed, or a request made of a
- * debug element has failed on the client side (that is, before the request was
- * sent to the debug target).
- */
- public static final int REQUEST_FAILED = 5012;
-
- /**
- * Indicates an internal error. This is an unexpected state.
- */
- public static final int INTERNAL_ERROR = 5013;
-
- /**
- * Indicates an improperly configured breakpoint. Breakpoints have a minimal
- * set of required attributes as defined by the breakpoint manager.
- *
- * @see IBreakpointManager
- */
- public static final int CONFIGURATION_INVALID = 5014;
-
- /**
- * Constructs a new debug exception with the given status object.
- *
- * @param status the status object describing this exception
- * @see IStatus
- */
- public DebugException(IStatus status) {
- super(status);
- }
-
-}
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+
+
+/**
+ * A checked exception representing a failure.
+ * <p>
+ * Defines status codes relevant to the debug plug-in. When a
+ * debug exception is thrown, it contains a status object describing
+ * the cause of the exception. The status objects originating from the
+ * debug plug-in use the codes defined in this class.
+ * </p>
+ * <p>
+ * Clients may instantiate this class. Clients are not intended to subclass this class.
+ * </p>
+ * @see IStatus
+ */
+public class DebugException extends CoreException {
+ /**
+ * Indicates a request made of a debug element has failed
+ * on the target side.
+ */
+ public static final int TARGET_REQUEST_FAILED = 5010;
+
+ /**
+ * Indicates a request is not supported by the capabilities of a debug element.
+ * For example, a request was made to terminate an element that does not
+ * support termination.
+ */
+ public static final int NOT_SUPPORTED = 5011;
+
+ /**
+ * Indicates that a request made of manager has failed, or a request made of a
+ * debug element has failed on the client side (that is, before the request was
+ * sent to the debug target).
+ */
+ public static final int REQUEST_FAILED = 5012;
+
+ /**
+ * Indicates an internal error. This is an unexpected state.
+ */
+ public static final int INTERNAL_ERROR = 5013;
+
+ /**
+ * Indicates an improperly configured breakpoint. Breakpoints have a minimal
+ * set of required attributes as defined by the breakpoint manager.
+ *
+ * @see IBreakpointManager
+ */
+ public static final int CONFIGURATION_INVALID = 5014;
+
+ /**
+ * Constructs a new debug exception with the given status object.
+ *
+ * @param status the status object describing this exception
+ * @see IStatus
+ */
+ public DebugException(IStatus status) {
+ super(status);
+ }
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index 4a7896780..e810dc4b6 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -1,540 +1,540 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.internal.core.BreakpointManager;
-import org.eclipse.debug.internal.core.DebugCoreMessages;
-import org.eclipse.debug.internal.core.ExpressionManager;
-import org.eclipse.debug.internal.core.LaunchManager;
-import org.eclipse.debug.internal.core.ListenerList;
-import org.eclipse.debug.internal.core.RuntimeProcess;
-
-/**
- * There is one instance of the debug plug-in available from
- * <code>DebugPlugin.getDefault()</code>. The debug plug-in provides:
- * <ul>
- * <li>access to the breakpoint manager</li>
- * <li>access to the launch manager</li>
- * <li>access to the expression manager</li>
- * <li>access to the registered launcher extensions</li>
- * <li>debug event notification</li>
- * <li>status handlers</li>
- * </ul>
- * <p>
- * Clients may not instantiate or subclass this class.
- * </p>
- */
-public class DebugPlugin extends Plugin {
-
- /**
- * Simple identifier constant (value <code>"launchConfigurationTypes"</code>)
- * for the launch configuration types extension point.
- *
- * @since 2.0
- */
- public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES= "launchConfigurationTypes"; //$NON-NLS-1$
-
- /**
- * Simple identifier constant (value <code>"launchConfigurationComparators"</code>)
- * for the launch configuration comparators extension point.
- *
- * @since 2.0
- */
- public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS= "launchConfigurationComparators"; //$NON-NLS-1$
-
- /**
- * Simple identifier constant (value <code>"breakpoints"</code>) for the
- * breakpoints extension point.
- *
- * @since 2.0
- */
- public static final String EXTENSION_POINT_BREAKPOINTS= "breakpoints"; //$NON-NLS-1$
-
- /**
- * Simple identifier constant (value <code>"statusHandlers"</code>) for the
- * status handlers extension point.
- *
- * @since 2.0
- */
- public static final String EXTENSION_POINT_STATUS_HANDLERS= "statusHandlers"; //$NON-NLS-1$
-
- /**
- * Simple identifier constant (value <code>"sourceLocators"</code>) for the
- * source locators extension point.
- *
- * @since 2.0
- */
- public static final String EXTENSION_POINT_SOURCE_LOCATORS= "sourceLocators"; //$NON-NLS-1$
-
- /**
- * Status code indicating an unexpected internal error.
- */
- public static final int INTERNAL_ERROR = 120;
-
- /**
- * The singleton debug plug-in instance.
- */
- private static DebugPlugin fgDebugPlugin= null;
-
- /**
- * The singleton breakpoint manager.
- */
- private BreakpointManager fBreakpointManager;
-
- /**
- * The singleton expression manager.
- */
- private ExpressionManager fExpressionManager;
-
- /**
- * The singleton launch manager.
- */
- private LaunchManager fLaunchManager;
-
- /**
- * The collection of debug event listeners.
- */
- private ListenerList fEventListeners= new ListenerList(20);
-
- /**
- * Event filters, or <code>null</code> if none.
- */
- private ListenerList fEventFilters = null;
-
- /**
- * Whether this plugin is in the process of shutting
- * down.
- */
- private boolean fShuttingDown= false;
-
- /**
- * Table of status handlers. Keys are {plug-in identifier, status code}
- * pairs, and values are associated <code>IConfigurationElement</code>s.
- */
- private HashMap fStatusHandlers = null;
-
- /**
- * Returns the singleton instance of the debug plug-in.
- */
- public static DebugPlugin getDefault() {
- return fgDebugPlugin;
- }
-
- /**
- * Sets the singleton instance of the debug plug-in.
- *
- * @param plugin the debug plug-in, or <code>null</code>
- * when shutting down
- */
- private static void setDefault(DebugPlugin plugin) {
- fgDebugPlugin = plugin;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- if (getDefault() == null) {
- // If the default instance is not yet initialized,
- // return a static identifier. This identifier must
- // match the plugin id defined in plugin.xml
- return "org.eclipse.debug.core"; //$NON-NLS-1$
- }
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- /**
- * Constructs the debug plug-in.
- * <p>
- * An instance of this plug-in runtime class is automatically created
- * when the facilities provided by this plug-in are required.
- * <b>Clients must never explicitly instantiate a plug-in runtime class.</b>
- * </p>
- *
- * @param pluginDescriptor the plug-in descriptor for the
- * debug plug-in
- */
- public DebugPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- setDefault(this);
- }
-
- /**
- * Adds the given listener to the collection of registered debug
- * event listeners. Has no effect if an identical listener is already
- * registered.
- *
- * @param listener the listener to add
- * @since 2.0
- */
- public void addDebugEventListener(IDebugEventSetListener listener) {
- fEventListeners.add(listener);
- }
-
- /**
- * Notifies all registered debug event set listeners of the given
- * debug events. Events which are filtered by a registered debug event
- * filter are not fired.
- *
- * @param events array of debug events to fire
- * @see IDebugEventFilter
- * @see IDebugEventSetListener
- * @since 2.0
- */
- public void fireDebugEventSet(DebugEvent[] events) {
- if (isShuttingDown() || events == null)
- return;
- events = filterEvents(events);
- if (events == null) {
- return;
- } else {
- Object[] listeners= getEventListeners();
- for (int i= 0; i < listeners.length; i++) {
- ((IDebugEventSetListener)listeners[i]).handleDebugEvents(events);
- }
- }
- }
-
- /**
- * Returns a collection of events, based on the given event
- * set, removing any events that are filtered by registered
- * debug event filters. Returns <code>null</code> or an empty
- * collection if all events are filtered.
- *
- * @param events the event set to filter
- * @return filtered event set
- */
- private DebugEvent[] filterEvents(DebugEvent[] events) {
- if (hasEventFilters()) {
- Object[] filters = fEventFilters.getListeners();
- for (int i = 0; i < filters.length; i++) {
- events = ((IDebugEventFilter)filters[i]).filterDebugEvents(events);
- if (events == null || events.length == 0) {
- break;
- }
- }
-
- }
- return events;
- }
-
- /**
- * Returns the breakpoint manager.
- *
- * @return the breakpoint manager
- * @see IBreakpointManager
- */
- public IBreakpointManager getBreakpointManager() {
- return fBreakpointManager;
- }
-
- /**
- * Returns the launch manager.
- *
- * @return the launch manager
- * @see ILaunchManager
- */
- public ILaunchManager getLaunchManager() {
- return fLaunchManager;
- }
-
- /**
- * Returns the status handler registered for the given
- * status, or <code>null</code> if none.
- *
- * @return the status handler registered for the given
- * status, or <code>null</code> if none
- * @since 2.0
- */
- public IStatusHandler getStatusHandler(IStatus status) {
- StatusHandlerKey key = new StatusHandlerKey(status.getPlugin(), status.getCode());
- if (fStatusHandlers == null) {
- try {
- initializeStatusHandlers();
- } catch (CoreException exception) {
- log(exception);
- return null;
- }
- }
- IConfigurationElement config = (IConfigurationElement)fStatusHandlers.get(key);
- if (config != null) {
- try {
- return (IStatusHandler)config.createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException e) {
- log(e);
- }
- }
- return null;
- }
-
- /**
- * Returns the expression manager.
- *
- * @return the expression manager
- * @see IExpressionManager
- * @since 2.0
- */
- public IExpressionManager getExpressionManager() {
- return fExpressionManager;
- }
-
- /**
- * Removes the given listener from the collection of registered debug
- * event listeners. Has no effect if an identical listener is not already
- * registered.
- *
- * @param listener the listener to remove
- * @since 2.0
- */
- public void removeDebugEventListener(IDebugEventSetListener listener) {
- fEventListeners.remove(listener);
- }
-
- /**
- * Shuts down this debug plug-in and discards all plug-in state.
- * <p>
- * This method will be automatically invoked by the platform when
- * the platform is shut down.
- * </p>
- * <b>Clients must never explicitly call this method.</b>
- *
- * @exception CoreException if this plug-in fails to shut down
- */
- public void shutdown() throws CoreException {
- setShuttingDown(true);
- super.shutdown();
- fLaunchManager.shutdown();
- fBreakpointManager.shutdown();
- fEventListeners.removeAll();
- setDefault(null);
- ResourcesPlugin.getWorkspace().removeSaveParticipant(this);
- }
-
- /**
- * Starts up the debug plug-in. This involves creating the launch and
- * breakpoint managers, creating proxies to all launcher extensions,
- * and restoring all persisted breakpoints.
- * <p>
- * This method is automatically invoked by the platform
- * the first time any code in this plug-in is executed.
- * </p>
- * <b>Clients must never explicitly call this method.</b>
- *
- * @see Plugin#startup
- * @exception CoreException if this plug-in fails to start up
- */
- public void startup() throws CoreException {
- fLaunchManager= new LaunchManager();
- fLaunchManager.startup();
- fBreakpointManager= new BreakpointManager();
- fBreakpointManager.startup();
- fExpressionManager = new ExpressionManager();
- fExpressionManager.startup();
- }
-
- /**
- * Creates and returns a new process representing the given
- * <code>java.lang.Process</code>. A streams proxy is created
- * for the I/O streams in the system process. The process
- * is added to the given launch.
- *
- * @param launch the launch the process is conatined in
- * @param process the system process to wrap
- * @param label the label assigned to the process
- * @return the process
- * @see IProcess
- */
- public static IProcess newProcess(ILaunch launch, Process process, String label) {
- return new RuntimeProcess(launch, process, label);
- }
-
- /**
- * Returns whether this plug-in is in the process of
- * being shutdown.
- *
- * @return whether this plug-in is in the process of
- * being shutdown
- */
- private boolean isShuttingDown() {
- return fShuttingDown;
- }
-
- /**
- * Sets whether this plug-in is in the process of
- * being shutdown.
- *
- * @param value whether this plug-in is in the process of
- * being shutdown
- */
- private void setShuttingDown(boolean value) {
- fShuttingDown = value;
- }
-
- /**
- * Returns the collection of debug event listeners registered
- * with this plug-in.
- *
- * @return list of registered debug event listeners, instances
- * of <code>IDebugEventSetListeners</code>
- */
- private Object[] getEventListeners() {
- return fEventListeners.getListeners();
- }
-
- /**
- * Adds the given debug event filter to the registered
- * event filters. Has no effect if an identical filter
- * is already registerd.
- *
- * @param filter debug event filter
- * @since 2.0
- */
- public void addDebugEventFilter(IDebugEventFilter filter) {
- if (fEventFilters == null) {
- fEventFilters = new ListenerList(2);
- }
- fEventFilters.add(filter);
- }
-
- /**
- * Removes the given debug event filter from the registered
- * event filters. Has no effect if an identical filter
- * is not already registered.
- *
- * @param filter debug event filter
- * @since 2.0
- */
- public void removeDebugEventFilter(IDebugEventFilter filter) {
- if (fEventFilters != null) {
- fEventFilters.remove(filter);
- if (fEventFilters.size() == 0) {
- fEventFilters = null;
- }
- }
- }
-
- /**
- * Logs the given message if in debug mode.
- *
- * @param message the message to log
- * @since 2.0
- */
- public static void logDebugMessage(String message) {
- if (getDefault().isDebugging()) {
- // this message is intentionally not internationalized, as an exception may
- // be due to the resource bundle itself
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), INTERNAL_ERROR, "Internal message logged from Debug Core: " + message, null)); //$NON-NLS-1$
- }
- }
-
- /**
- * Logs the specified status with this plug-in's log.
- *
- * @param status status to log
- * @since 2.0
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Logs the specified throwable with this plug-in's log.
- *
- * @param t throwable to log
- * @since 2.0
- */
- public static void log(Throwable t) {
- IStatus status= new Status(IStatus.ERROR, getUniqueIdentifier(), INTERNAL_ERROR, "Error logged from Debug Core: ", t); //$NON-NLS-1$
- log(status);
- }
-
- /**
- * Register status handlers.
- *
- * @exception CoreException if an exception occurs reading
- * the extensions
- */
- private void initializeStatusHandlers() throws CoreException {
- IPluginDescriptor descriptor= DebugPlugin.getDefault().getDescriptor();
- IExtensionPoint extensionPoint= descriptor.getExtensionPoint(EXTENSION_POINT_STATUS_HANDLERS);
- IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
- fStatusHandlers = new HashMap(infos.length);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
- String id = configurationElement.getAttribute("plugin"); //$NON-NLS-1$
- String code = configurationElement.getAttribute("code"); //$NON-NLS-1$
-
- if (id != null && code != null) {
- try {
- StatusHandlerKey key = new StatusHandlerKey(id, Integer.parseInt(code));
- fStatusHandlers.put(key, configurationElement);
- } catch (NumberFormatException e) {
- // invalid status handler
- invalidStatusHandler(e, configurationElement.getAttribute("id")); //$NON-NLS-1$
- }
- } else {
- // invalid status handler
- invalidStatusHandler(null, configurationElement.getAttribute("id")); //$NON-NLS-1$
- }
- }
- }
-
- private void invalidStatusHandler(Exception e, String id) {
- log(new Status(IStatus.ERROR, getDescriptor().getUniqueIdentifier(), INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.getString("DebugPlugin.Invalid_status_handler_extension__{0}_2"), new String[] {id}), e)); //$NON-NLS-1$
- }
-
- /**
- * Key for status handler extensions - a plug-in identifier/code pair
- */
- class StatusHandlerKey {
-
- String fPluginId;
- int fCode;
-
- StatusHandlerKey(String pluginId, int code) {
- fPluginId = pluginId;
- fCode = code;
- }
-
- public int hashCode() {
- return fPluginId.hashCode() + fCode;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof StatusHandlerKey) {
- StatusHandlerKey s = (StatusHandlerKey)obj;
- return fCode == s.fCode && fPluginId.equals(s.fPluginId);
- }
- return false;
- }
- }
-
- /**
- * Returns whether any event filters are registered
- *
- * @return whether any event filters are registered
- */
- private boolean hasEventFilters() {
- return fEventFilters != null && fEventFilters.size() > 0;
- }
-
-
-
-}
-
-
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.internal.core.BreakpointManager;
+import org.eclipse.debug.internal.core.DebugCoreMessages;
+import org.eclipse.debug.internal.core.ExpressionManager;
+import org.eclipse.debug.internal.core.LaunchManager;
+import org.eclipse.debug.internal.core.ListenerList;
+import org.eclipse.debug.internal.core.RuntimeProcess;
+
+/**
+ * There is one instance of the debug plug-in available from
+ * <code>DebugPlugin.getDefault()</code>. The debug plug-in provides:
+ * <ul>
+ * <li>access to the breakpoint manager</li>
+ * <li>access to the launch manager</li>
+ * <li>access to the expression manager</li>
+ * <li>access to the registered launcher extensions</li>
+ * <li>debug event notification</li>
+ * <li>status handlers</li>
+ * </ul>
+ * <p>
+ * Clients may not instantiate or subclass this class.
+ * </p>
+ */
+public class DebugPlugin extends Plugin {
+
+ /**
+ * Simple identifier constant (value <code>"launchConfigurationTypes"</code>)
+ * for the launch configuration types extension point.
+ *
+ * @since 2.0
+ */
+ public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES= "launchConfigurationTypes"; //$NON-NLS-1$
+
+ /**
+ * Simple identifier constant (value <code>"launchConfigurationComparators"</code>)
+ * for the launch configuration comparators extension point.
+ *
+ * @since 2.0
+ */
+ public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS= "launchConfigurationComparators"; //$NON-NLS-1$
+
+ /**
+ * Simple identifier constant (value <code>"breakpoints"</code>) for the
+ * breakpoints extension point.
+ *
+ * @since 2.0
+ */
+ public static final String EXTENSION_POINT_BREAKPOINTS= "breakpoints"; //$NON-NLS-1$
+
+ /**
+ * Simple identifier constant (value <code>"statusHandlers"</code>) for the
+ * status handlers extension point.
+ *
+ * @since 2.0
+ */
+ public static final String EXTENSION_POINT_STATUS_HANDLERS= "statusHandlers"; //$NON-NLS-1$
+
+ /**
+ * Simple identifier constant (value <code>"sourceLocators"</code>) for the
+ * source locators extension point.
+ *
+ * @since 2.0
+ */
+ public static final String EXTENSION_POINT_SOURCE_LOCATORS= "sourceLocators"; //$NON-NLS-1$
+
+ /**
+ * Status code indicating an unexpected internal error.
+ */
+ public static final int INTERNAL_ERROR = 120;
+
+ /**
+ * The singleton debug plug-in instance.
+ */
+ private static DebugPlugin fgDebugPlugin= null;
+
+ /**
+ * The singleton breakpoint manager.
+ */
+ private BreakpointManager fBreakpointManager;
+
+ /**
+ * The singleton expression manager.
+ */
+ private ExpressionManager fExpressionManager;
+
+ /**
+ * The singleton launch manager.
+ */
+ private LaunchManager fLaunchManager;
+
+ /**
+ * The collection of debug event listeners.
+ */
+ private ListenerList fEventListeners= new ListenerList(20);
+
+ /**
+ * Event filters, or <code>null</code> if none.
+ */
+ private ListenerList fEventFilters = null;
+
+ /**
+ * Whether this plugin is in the process of shutting
+ * down.
+ */
+ private boolean fShuttingDown= false;
+
+ /**
+ * Table of status handlers. Keys are {plug-in identifier, status code}
+ * pairs, and values are associated <code>IConfigurationElement</code>s.
+ */
+ private HashMap fStatusHandlers = null;
+
+ /**
+ * Returns the singleton instance of the debug plug-in.
+ */
+ public static DebugPlugin getDefault() {
+ return fgDebugPlugin;
+ }
+
+ /**
+ * Sets the singleton instance of the debug plug-in.
+ *
+ * @param plugin the debug plug-in, or <code>null</code>
+ * when shutting down
+ */
+ private static void setDefault(DebugPlugin plugin) {
+ fgDebugPlugin = plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getDefault() == null) {
+ // If the default instance is not yet initialized,
+ // return a static identifier. This identifier must
+ // match the plugin id defined in plugin.xml
+ return "org.eclipse.debug.core"; //$NON-NLS-1$
+ }
+ return getDefault().getDescriptor().getUniqueIdentifier();
+ }
+
+ /**
+ * Constructs the debug plug-in.
+ * <p>
+ * An instance of this plug-in runtime class is automatically created
+ * when the facilities provided by this plug-in are required.
+ * <b>Clients must never explicitly instantiate a plug-in runtime class.</b>
+ * </p>
+ *
+ * @param pluginDescriptor the plug-in descriptor for the
+ * debug plug-in
+ */
+ public DebugPlugin(IPluginDescriptor descriptor) {
+ super(descriptor);
+ setDefault(this);
+ }
+
+ /**
+ * Adds the given listener to the collection of registered debug
+ * event listeners. Has no effect if an identical listener is already
+ * registered.
+ *
+ * @param listener the listener to add
+ * @since 2.0
+ */
+ public void addDebugEventListener(IDebugEventSetListener listener) {
+ fEventListeners.add(listener);
+ }
+
+ /**
+ * Notifies all registered debug event set listeners of the given
+ * debug events. Events which are filtered by a registered debug event
+ * filter are not fired.
+ *
+ * @param events array of debug events to fire
+ * @see IDebugEventFilter
+ * @see IDebugEventSetListener
+ * @since 2.0
+ */
+ public void fireDebugEventSet(DebugEvent[] events) {
+ if (isShuttingDown() || events == null)
+ return;
+ events = filterEvents(events);
+ if (events == null) {
+ return;
+ } else {
+ Object[] listeners= getEventListeners();
+ for (int i= 0; i < listeners.length; i++) {
+ ((IDebugEventSetListener)listeners[i]).handleDebugEvents(events);
+ }
+ }
+ }
+
+ /**
+ * Returns a collection of events, based on the given event
+ * set, removing any events that are filtered by registered
+ * debug event filters. Returns <code>null</code> or an empty
+ * collection if all events are filtered.
+ *
+ * @param events the event set to filter
+ * @return filtered event set
+ */
+ private DebugEvent[] filterEvents(DebugEvent[] events) {
+ if (hasEventFilters()) {
+ Object[] filters = fEventFilters.getListeners();
+ for (int i = 0; i < filters.length; i++) {
+ events = ((IDebugEventFilter)filters[i]).filterDebugEvents(events);
+ if (events == null || events.length == 0) {
+ break;
+ }
+ }
+
+ }
+ return events;
+ }
+
+ /**
+ * Returns the breakpoint manager.
+ *
+ * @return the breakpoint manager
+ * @see IBreakpointManager
+ */
+ public IBreakpointManager getBreakpointManager() {
+ return fBreakpointManager;
+ }
+
+ /**
+ * Returns the launch manager.
+ *
+ * @return the launch manager
+ * @see ILaunchManager
+ */
+ public ILaunchManager getLaunchManager() {
+ return fLaunchManager;
+ }
+
+ /**
+ * Returns the status handler registered for the given
+ * status, or <code>null</code> if none.
+ *
+ * @return the status handler registered for the given
+ * status, or <code>null</code> if none
+ * @since 2.0
+ */
+ public IStatusHandler getStatusHandler(IStatus status) {
+ StatusHandlerKey key = new StatusHandlerKey(status.getPlugin(), status.getCode());
+ if (fStatusHandlers == null) {
+ try {
+ initializeStatusHandlers();
+ } catch (CoreException exception) {
+ log(exception);
+ return null;
+ }
+ }
+ IConfigurationElement config = (IConfigurationElement)fStatusHandlers.get(key);
+ if (config != null) {
+ try {
+ return (IStatusHandler)config.createExecutableExtension("class"); //$NON-NLS-1$
+ } catch (CoreException e) {
+ log(e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the expression manager.
+ *
+ * @return the expression manager
+ * @see IExpressionManager
+ * @since 2.0
+ */
+ public IExpressionManager getExpressionManager() {
+ return fExpressionManager;
+ }
+
+ /**
+ * Removes the given listener from the collection of registered debug
+ * event listeners. Has no effect if an identical listener is not already
+ * registered.
+ *
+ * @param listener the listener to remove
+ * @since 2.0
+ */
+ public void removeDebugEventListener(IDebugEventSetListener listener) {
+ fEventListeners.remove(listener);
+ }
+
+ /**
+ * Shuts down this debug plug-in and discards all plug-in state.
+ * <p>
+ * This method will be automatically invoked by the platform when
+ * the platform is shut down.
+ * </p>
+ * <b>Clients must never explicitly call this method.</b>
+ *
+ * @exception CoreException if this plug-in fails to shut down
+ */
+ public void shutdown() throws CoreException {
+ setShuttingDown(true);
+ super.shutdown();
+ fLaunchManager.shutdown();
+ fBreakpointManager.shutdown();
+ fEventListeners.removeAll();
+ setDefault(null);
+ ResourcesPlugin.getWorkspace().removeSaveParticipant(this);
+ }
+
+ /**
+ * Starts up the debug plug-in. This involves creating the launch and
+ * breakpoint managers, creating proxies to all launcher extensions,
+ * and restoring all persisted breakpoints.
+ * <p>
+ * This method is automatically invoked by the platform
+ * the first time any code in this plug-in is executed.
+ * </p>
+ * <b>Clients must never explicitly call this method.</b>
+ *
+ * @see Plugin#startup
+ * @exception CoreException if this plug-in fails to start up
+ */
+ public void startup() throws CoreException {
+ fLaunchManager= new LaunchManager();
+ fLaunchManager.startup();
+ fBreakpointManager= new BreakpointManager();
+ fBreakpointManager.startup();
+ fExpressionManager = new ExpressionManager();
+ fExpressionManager.startup();
+ }
+
+ /**
+ * Creates and returns a new process representing the given
+ * <code>java.lang.Process</code>. A streams proxy is created
+ * for the I/O streams in the system process. The process
+ * is added to the given launch.
+ *
+ * @param launch the launch the process is conatined in
+ * @param process the system process to wrap
+ * @param label the label assigned to the process
+ * @return the process
+ * @see IProcess
+ */
+ public static IProcess newProcess(ILaunch launch, Process process, String label) {
+ return new RuntimeProcess(launch, process, label);
+ }
+
+ /**
+ * Returns whether this plug-in is in the process of
+ * being shutdown.
+ *
+ * @return whether this plug-in is in the process of
+ * being shutdown
+ */
+ private boolean isShuttingDown() {
+ return fShuttingDown;
+ }
+
+ /**
+ * Sets whether this plug-in is in the process of
+ * being shutdown.
+ *
+ * @param value whether this plug-in is in the process of
+ * being shutdown
+ */
+ private void setShuttingDown(boolean value) {
+ fShuttingDown = value;
+ }
+
+ /**
+ * Returns the collection of debug event listeners registered
+ * with this plug-in.
+ *
+ * @return list of registered debug event listeners, instances
+ * of <code>IDebugEventSetListeners</code>
+ */
+ private Object[] getEventListeners() {
+ return fEventListeners.getListeners();
+ }
+
+ /**
+ * Adds the given debug event filter to the registered
+ * event filters. Has no effect if an identical filter
+ * is already registerd.
+ *
+ * @param filter debug event filter
+ * @since 2.0
+ */
+ public void addDebugEventFilter(IDebugEventFilter filter) {
+ if (fEventFilters == null) {
+ fEventFilters = new ListenerList(2);
+ }
+ fEventFilters.add(filter);
+ }
+
+ /**
+ * Removes the given debug event filter from the registered
+ * event filters. Has no effect if an identical filter
+ * is not already registered.
+ *
+ * @param filter debug event filter
+ * @since 2.0
+ */
+ public void removeDebugEventFilter(IDebugEventFilter filter) {
+ if (fEventFilters != null) {
+ fEventFilters.remove(filter);
+ if (fEventFilters.size() == 0) {
+ fEventFilters = null;
+ }
+ }
+ }
+
+ /**
+ * Logs the given message if in debug mode.
+ *
+ * @param message the message to log
+ * @since 2.0
+ */
+ public static void logDebugMessage(String message) {
+ if (getDefault().isDebugging()) {
+ // this message is intentionally not internationalized, as an exception may
+ // be due to the resource bundle itself
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), INTERNAL_ERROR, "Internal message logged from Debug Core: " + message, null)); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Logs the specified status with this plug-in's log.
+ *
+ * @param status status to log
+ * @since 2.0
+ */
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ /**
+ * Logs the specified throwable with this plug-in's log.
+ *
+ * @param t throwable to log
+ * @since 2.0
+ */
+ public static void log(Throwable t) {
+ IStatus status= new Status(IStatus.ERROR, getUniqueIdentifier(), INTERNAL_ERROR, "Error logged from Debug Core: ", t); //$NON-NLS-1$
+ log(status);
+ }
+
+ /**
+ * Register status handlers.
+ *
+ * @exception CoreException if an exception occurs reading
+ * the extensions
+ */
+ private void initializeStatusHandlers() throws CoreException {
+ IPluginDescriptor descriptor= DebugPlugin.getDefault().getDescriptor();
+ IExtensionPoint extensionPoint= descriptor.getExtensionPoint(EXTENSION_POINT_STATUS_HANDLERS);
+ IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
+ fStatusHandlers = new HashMap(infos.length);
+ for (int i= 0; i < infos.length; i++) {
+ IConfigurationElement configurationElement = infos[i];
+ String id = configurationElement.getAttribute("plugin"); //$NON-NLS-1$
+ String code = configurationElement.getAttribute("code"); //$NON-NLS-1$
+
+ if (id != null && code != null) {
+ try {
+ StatusHandlerKey key = new StatusHandlerKey(id, Integer.parseInt(code));
+ fStatusHandlers.put(key, configurationElement);
+ } catch (NumberFormatException e) {
+ // invalid status handler
+ invalidStatusHandler(e, configurationElement.getAttribute("id")); //$NON-NLS-1$
+ }
+ } else {
+ // invalid status handler
+ invalidStatusHandler(null, configurationElement.getAttribute("id")); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private void invalidStatusHandler(Exception e, String id) {
+ log(new Status(IStatus.ERROR, getDescriptor().getUniqueIdentifier(), INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.getString("DebugPlugin.Invalid_status_handler_extension__{0}_2"), new String[] {id}), e)); //$NON-NLS-1$
+ }
+
+ /**
+ * Key for status handler extensions - a plug-in identifier/code pair
+ */
+ class StatusHandlerKey {
+
+ String fPluginId;
+ int fCode;
+
+ StatusHandlerKey(String pluginId, int code) {
+ fPluginId = pluginId;
+ fCode = code;
+ }
+
+ public int hashCode() {
+ return fPluginId.hashCode() + fCode;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof StatusHandlerKey) {
+ StatusHandlerKey s = (StatusHandlerKey)obj;
+ return fCode == s.fCode && fPluginId.equals(s.fPluginId);
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Returns whether any event filters are registered
+ *
+ * @return whether any event filters are registered
+ */
+ private boolean hasEventFilters() {
+ return fEventFilters != null && fEventFilters.size() > 0;
+ }
+
+
+
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java
index e25f2fc70..bf9b7c7ee 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointListener.java
@@ -1,63 +1,63 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.debug.core.model.IBreakpoint;
-
-/**
- * A breakpoint listener is notified of breakpoint additions,
- * removals, and changes. Listeners register and deregister with the
- * breakpoint manager.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see IBreakpointManager
- */
-
-public interface IBreakpointListener {
-
- /**
- * Notifies this listener that the given breakpoint has been added
- * to the breakpoint manager.
- *
- * @param breakpoint the added breakpoint
- * @since 2.0
- */
- public void breakpointAdded(IBreakpoint breakpoint);
- /**
- * Notifies this listener that the given breakpoint has been removed
- * from the breakpoint manager.
- * If the given breakpoint has been removed because it has been deleted,
- * the associated marker delta is also provided.
- *
- * @param breakpoint the removed breakpoint
- * @param delta the associated marker delta, or <code>null</code> when
- * the breakpoint is removed from the breakpoint manager without
- * being deleted
- *
- * @see org.eclipse.core.resources.IMarkerDelta
- * @since 2.0
- */
- public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta);
-
- /**
- * Notifies this listener that an attribute of the given breakpoint has
- * changed, as described by the delta.
- *
- * @param breakpoint the changed breakpoint
- * @param delta the marker delta that describes the changes
- * with the marker associated with the given breakpoint, or
- * <code>null</code> when the breakpoint change does not generate
- * a marker delta
- *
- * @see org.eclipse.core.resources.IMarkerDelta
- * @since 2.0
- */
- public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta);
-
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.debug.core.model.IBreakpoint;
+
+/**
+ * A breakpoint listener is notified of breakpoint additions,
+ * removals, and changes. Listeners register and deregister with the
+ * breakpoint manager.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see IBreakpointManager
+ */
+
+public interface IBreakpointListener {
+
+ /**
+ * Notifies this listener that the given breakpoint has been added
+ * to the breakpoint manager.
+ *
+ * @param breakpoint the added breakpoint
+ * @since 2.0
+ */
+ public void breakpointAdded(IBreakpoint breakpoint);
+ /**
+ * Notifies this listener that the given breakpoint has been removed
+ * from the breakpoint manager.
+ * If the given breakpoint has been removed because it has been deleted,
+ * the associated marker delta is also provided.
+ *
+ * @param breakpoint the removed breakpoint
+ * @param delta the associated marker delta, or <code>null</code> when
+ * the breakpoint is removed from the breakpoint manager without
+ * being deleted
+ *
+ * @see org.eclipse.core.resources.IMarkerDelta
+ * @since 2.0
+ */
+ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta);
+
+ /**
+ * Notifies this listener that an attribute of the given breakpoint has
+ * changed, as described by the delta.
+ *
+ * @param breakpoint the changed breakpoint
+ * @param delta the marker delta that describes the changes
+ * with the marker associated with the given breakpoint, or
+ * <code>null</code> when the breakpoint change does not generate
+ * a marker delta
+ *
+ * @see org.eclipse.core.resources.IMarkerDelta
+ * @since 2.0
+ */
+ public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta);
+
} \ No newline at end of file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
index 3bd08f9fa..55fafaec8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBreakpointManager.java
@@ -1,144 +1,144 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.IBreakpoint;
-
-/**
- * The breakpoint manager manages the collection of breakpoints
- * in the workspace. A breakpoint suspends the execution of a
- * program being debugged. The kinds of breakpoints supported by each
- * debug architecture and the information required to create those
- * breakpoints is defined by each debug architecture.
- * Breakpoint creation is a client responsibility.
- * <p>
- * Clients interested in breakpoint change notification may
- * register with the breakpoint manager - see
- * <code>IBreakpointListener</code>.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @see IBreakpointListener
- */
-public interface IBreakpointManager {
- /**
- * Adds the given breakpoint to the collection of registered breakpoints
- * in the workspace and notifies all registered listeners. This has no effect
- * if the given breakpoint is already registered.
- *
- * @param breakpoint the breakpoint to add
- *
- * @exception DebugException if adding fails. Reasons include:<ul>
- * <li>CONFIGURATION_INVALID - the required <code>MODEL_IDENTIFIER</code> attribute
- * is not set on the breakpoint marker.</li>
- * <li>A <code>CoreException</code> occurred while verifying the <code>MODEL_IDENTIFIER</code>
- * attribute.</li>
- * </ul>
- * @since 2.0
- */
- public void addBreakpoint(IBreakpoint breakpoint) throws CoreException;
-
- /**
- * Returns the breakpoint associated with the given marker or
- * <code>null</code> if no such breakpoint exists
- *
- * @param marker the marker
- * @return the breakpoint associated with the marker
- * or <code>null</code> if none exists
- * @since 2.0
- */
- public IBreakpoint getBreakpoint(IMarker marker);
-
- /**
- * Returns a collection of all registered breakpoints.
- * Returns an empty array if no breakpoints are registered.
- *
- * @return an array of breakpoints
- * @since 2.0
- */
- public IBreakpoint[] getBreakpoints();
-
- /**
- * Returns whether there are any registered breakpoints.
- *
- * @return whether there are any registered breakpoints
- * @since 2.0
- */
- public boolean hasBreakpoints();
-
- /**
- * Returns a collection of all breakpoints registered for the
- * given debug model. Answers an empty array if no breakpoints are registered
- * for the given debug model.
- *
- * @param modelIdentifier identifier of a debug model plug-in
- * @return an array of breakpoints
- * @since 2.0
- */
- public IBreakpoint[] getBreakpoints(String modelIdentifier);
-
- /**
- * Returns whether the given breakpoint is currently
- * registered with this breakpoint manager.
- *
- * @return whether the breakpoint is registered
- * @since 2.0
- */
- public boolean isRegistered(IBreakpoint breakpoint);
-
- /**
- * Notifies all registered listeners that the given
- * breakpoint has changed. Has no effect if the given
- * breakpoint is not currently registered.
- *
- * This method is intended to be used when a breakpoint
- * attribute is changed that does not alter the breakpoint's
- * underlying marker, that is, when notification will not occur
- * via the marker delta mechanism.
- *
- * @param breakpoint the breakpoint that has changed.
- * @since 2.0
- */
- public void fireBreakpointChanged(IBreakpoint breakpoint);
-
- /**
- * Removes the given breakpoint from the breakpoint manager, deletes
- * the marker associated with the breakpoint if the <code>delete</code> flag
- * is <code>true</code>, and notifies all registered
- * listeners. Has no effect if the given breakpoint is not currently
- * registered.
- *
- * @param breakpoint the breakpoint to remove
- * @param delete whether to delete the marker associated with the
- * breakpoint
- * @exception CoreException if an exception occurs while deleting the
- * underlying marker.
- * @since 2.0
- */
- public void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException;
-
- /**
- * Adds the given listener to the collection of registered breakpoint listeners.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener to add
- */
- public void addBreakpointListener(IBreakpointListener listener);
-
- /**
- * Removes the given listener from the collection of registered breakpoint listeners.
- * Has no effect if an identical listener is not already registered.
- *
- * @param listener the listener to remove
- */
- public void removeBreakpointListener(IBreakpointListener listener);
-
-}
-
-
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IBreakpoint;
+
+/**
+ * The breakpoint manager manages the collection of breakpoints
+ * in the workspace. A breakpoint suspends the execution of a
+ * program being debugged. The kinds of breakpoints supported by each
+ * debug architecture and the information required to create those
+ * breakpoints is defined by each debug architecture.
+ * Breakpoint creation is a client responsibility.
+ * <p>
+ * Clients interested in breakpoint change notification may
+ * register with the breakpoint manager - see
+ * <code>IBreakpointListener</code>.
+ * </p>
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ * @see IBreakpointListener
+ */
+public interface IBreakpointManager {
+ /**
+ * Adds the given breakpoint to the collection of registered breakpoints
+ * in the workspace and notifies all registered listeners. This has no effect
+ * if the given breakpoint is already registered.
+ *
+ * @param breakpoint the breakpoint to add
+ *
+ * @exception DebugException if adding fails. Reasons include:<ul>
+ * <li>CONFIGURATION_INVALID - the required <code>MODEL_IDENTIFIER</code> attribute
+ * is not set on the breakpoint marker.</li>
+ * <li>A <code>CoreException</code> occurred while verifying the <code>MODEL_IDENTIFIER</code>
+ * attribute.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public void addBreakpoint(IBreakpoint breakpoint) throws CoreException;
+
+ /**
+ * Returns the breakpoint associated with the given marker or
+ * <code>null</code> if no such breakpoint exists
+ *
+ * @param marker the marker
+ * @return the breakpoint associated with the marker
+ * or <code>null</code> if none exists
+ * @since 2.0
+ */
+ public IBreakpoint getBreakpoint(IMarker marker);
+
+ /**
+ * Returns a collection of all registered breakpoints.
+ * Returns an empty array if no breakpoints are registered.
+ *
+ * @return an array of breakpoints
+ * @since 2.0
+ */
+ public IBreakpoint[] getBreakpoints();
+
+ /**
+ * Returns whether there are any registered breakpoints.
+ *
+ * @return whether there are any registered breakpoints
+ * @since 2.0
+ */
+ public boolean hasBreakpoints();
+
+ /**
+ * Returns a collection of all breakpoints registered for the
+ * given debug model. Answers an empty array if no breakpoints are registered
+ * for the given debug model.
+ *
+ * @param modelIdentifier identifier of a debug model plug-in
+ * @return an array of breakpoints
+ * @since 2.0
+ */
+ public IBreakpoint[] getBreakpoints(String modelIdentifier);
+
+ /**
+ * Returns whether the given breakpoint is currently
+ * registered with this breakpoint manager.
+ *
+ * @return whether the breakpoint is registered
+ * @since 2.0
+ */
+ public boolean isRegistered(IBreakpoint breakpoint);
+
+ /**
+ * Notifies all registered listeners that the given
+ * breakpoint has changed. Has no effect if the given
+ * breakpoint is not currently registered.
+ *
+ * This method is intended to be used when a breakpoint
+ * attribute is changed that does not alter the breakpoint's
+ * underlying marker, that is, when notification will not occur
+ * via the marker delta mechanism.
+ *
+ * @param breakpoint the breakpoint that has changed.
+ * @since 2.0
+ */
+ public void fireBreakpointChanged(IBreakpoint breakpoint);
+
+ /**
+ * Removes the given breakpoint from the breakpoint manager, deletes
+ * the marker associated with the breakpoint if the <code>delete</code> flag
+ * is <code>true</code>, and notifies all registered
+ * listeners. Has no effect if the given breakpoint is not currently
+ * registered.
+ *
+ * @param breakpoint the breakpoint to remove
+ * @param delete whether to delete the marker associated with the
+ * breakpoint
+ * @exception CoreException if an exception occurs while deleting the
+ * underlying marker.
+ * @since 2.0
+ */
+ public void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException;
+
+ /**
+ * Adds the given listener to the collection of registered breakpoint listeners.
+ * Has no effect if an identical listener is already registered.
+ *
+ * @param listener the listener to add
+ */
+ public void addBreakpointListener(IBreakpointListener listener);
+
+ /**
+ * Removes the given listener from the collection of registered breakpoint listeners.
+ * Has no effect if an identical listener is not already registered.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeBreakpointListener(IBreakpointListener listener);
+
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java
index 64c1c8e3a..269bb41f5 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IDebugEventFilter.java
@@ -1,32 +1,32 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * An event filter allows clients to intercept debug events.
- * Event filters are registered with the debug plug-in.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see DebugPlugin
- * @since 2.0
- */
-public interface IDebugEventFilter {
-
- /**
- * Filters the given set of debug events, and returns the set of debug
- * events that should be fired to registered listeners - <code>null</code>
- * or an empty collection if no debug events should be fired.
- * <p>
- * When multiple event filters are registered, events are passed through
- * all filters. That is, the events returned from the first filter are
- * passed through the second filter, and so on.
- * </p>
- *
- * @return the set of debug events to fire
- */
- public DebugEvent[] filterDebugEvents(DebugEvent[] events);
-}
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * An event filter allows clients to intercept debug events.
+ * Event filters are registered with the debug plug-in.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see DebugPlugin
+ * @since 2.0
+ */
+public interface IDebugEventFilter {
+
+ /**
+ * Filters the given set of debug events, and returns the set of debug
+ * events that should be fired to registered listeners - <code>null</code>
+ * or an empty collection if no debug events should be fired.
+ * <p>
+ * When multiple event filters are registered, events are passed through
+ * all filters. That is, the events returned from the first filter are
+ * passed through the second filter, and so on.
+ * </p>
+ *
+ * @return the set of debug events to fire
+ */
+ public DebugEvent[] filterDebugEvents(DebugEvent[] events);
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionListener.java
index c34bcf944..e71a8f661 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionListener.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionListener.java
@@ -1,47 +1,47 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-
-import org.eclipse.debug.core.model.IExpression;
-
-/**
- * An expression listener is notified of expression additions,
- * removals, and changes. Listeners register and deregister with the
- * expression manager.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see IExpressionManager
- * @since 2.0
- */
-
-public interface IExpressionListener {
-
- /**
- * Notifies this listener that the given expression has been added
- * to the expression manager.
- *
- * @param expression the added expression
- */
- public void expressionAdded(IExpression expression);
- /**
- * Notifies this listener that the given expression has been removed
- * from the expression manager.
- *
- * @param expression the removed expression
- */
- public void expressionRemoved(IExpression expression);
-
- /**
- * Notifies this listener that the given expression has
- * changed.
- *
- * @param expression the changed expression
- */
- public void expressionChanged(IExpression expression);
-
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+
+import org.eclipse.debug.core.model.IExpression;
+
+/**
+ * An expression listener is notified of expression additions,
+ * removals, and changes. Listeners register and deregister with the
+ * expression manager.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see IExpressionManager
+ * @since 2.0
+ */
+
+public interface IExpressionListener {
+
+ /**
+ * Notifies this listener that the given expression has been added
+ * to the expression manager.
+ *
+ * @param expression the added expression
+ */
+ public void expressionAdded(IExpression expression);
+ /**
+ * Notifies this listener that the given expression has been removed
+ * from the expression manager.
+ *
+ * @param expression the removed expression
+ */
+ public void expressionRemoved(IExpression expression);
+
+ /**
+ * Notifies this listener that the given expression has
+ * changed.
+ *
+ * @param expression the changed expression
+ */
+ public void expressionChanged(IExpression expression);
+
} \ No newline at end of file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java
index b04d82798..55443ac86 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IExpressionManager.java
@@ -1,88 +1,88 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.model.IExpression;
-
-/**
- * The expression manager manages the collection of registered
- * expressions in the workspace. An expression is a snippet of code
- * that can be evaluated to produce a value. Expression creation
- * and evaluation are client responsibilities.
- * <p>
- * Clients interested in expression change notification may
- * register with the expression manager - see
- * <code>IExpressionListener</code>.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @see IExpression
- * @see IExpressionListener
- * @since 2.0
- */
-public interface IExpressionManager {
- /**
- * Adds the given expression to the collection of registered expressions
- * in the workspace and notifies all registered listeners. This has no effect
- * if the given expression is already registered.
- *
- * @param expression the expression to add
- */
- public void addExpression(IExpression expression);
-
- /**
- * Returns a collection of all registered expressions,
- * possibly empty.
- *
- * @return an array of expressions
- */
- public IExpression[] getExpressions();
-
- /**
- * Returns whether there are any registered expressions
- *
- * @return whether there are any registered expressions
- */
- public boolean hasExpressions();
-
- /**
- * Returns a collection of all expressions registered for the
- * given debug model,possibly empty.
- *
- * @param modelIdentifier identifier of a debug model plug-in
- * @return an array of expressions
- */
- public IExpression[] getExpressions(String modelIdentifier);
-
- /**
- * Removes the given expression from the expression manager,
- * and notifies all registered listeners. Has no effect if the
- * given expression is not currently registered.
- *
- * @param expression the expression to remove
- */
- public void removeExpression(IExpression expression);
-
- /**
- * Adds the given listener to the collection of registered expression listeners.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener to add
- */
- public void addExpressionListener(IExpressionListener listener);
-
- /**
- * Removes the given listener from the collection of registered expression listeners.
- * Has no effect if an identical listener is not already registered.
- *
- * @param listener the listener to remove
- */
- public void removeExpressionListener(IExpressionListener listener);
-
-}
-
-
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.model.IExpression;
+
+/**
+ * The expression manager manages the collection of registered
+ * expressions in the workspace. An expression is a snippet of code
+ * that can be evaluated to produce a value. Expression creation
+ * and evaluation are client responsibilities.
+ * <p>
+ * Clients interested in expression change notification may
+ * register with the expression manager - see
+ * <code>IExpressionListener</code>.
+ * </p>
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ * @see IExpression
+ * @see IExpressionListener
+ * @since 2.0
+ */
+public interface IExpressionManager {
+ /**
+ * Adds the given expression to the collection of registered expressions
+ * in the workspace and notifies all registered listeners. This has no effect
+ * if the given expression is already registered.
+ *
+ * @param expression the expression to add
+ */
+ public void addExpression(IExpression expression);
+
+ /**
+ * Returns a collection of all registered expressions,
+ * possibly empty.
+ *
+ * @return an array of expressions
+ */
+ public IExpression[] getExpressions();
+
+ /**
+ * Returns whether there are any registered expressions
+ *
+ * @return whether there are any registered expressions
+ */
+ public boolean hasExpressions();
+
+ /**
+ * Returns a collection of all expressions registered for the
+ * given debug model,possibly empty.
+ *
+ * @param modelIdentifier identifier of a debug model plug-in
+ * @return an array of expressions
+ */
+ public IExpression[] getExpressions(String modelIdentifier);
+
+ /**
+ * Removes the given expression from the expression manager,
+ * and notifies all registered listeners. Has no effect if the
+ * given expression is not currently registered.
+ *
+ * @param expression the expression to remove
+ */
+ public void removeExpression(IExpression expression);
+
+ /**
+ * Adds the given listener to the collection of registered expression listeners.
+ * Has no effect if an identical listener is already registered.
+ *
+ * @param listener the listener to add
+ */
+ public void addExpressionListener(IExpressionListener listener);
+
+ /**
+ * Removes the given listener from the collection of registered expression listeners.
+ * Has no effect if an identical listener is not already registered.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeExpressionListener(IExpressionListener listener);
+
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunch.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunch.java
index 9fc699083..d31975479 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunch.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunch.java
@@ -1,171 +1,171 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.eclipse.debug.core.model.ITerminate;
-
-/**
- * A launch is the result of launching a debug session
- * and/or one or more system processes.
- * <p>
- * This interface is not intended to be implemented by clients. Clients
- * should create instances of this interface by using the implementation
- * provided by the class <code>Launch</code>.
- * </p>
- * @see Launch
- */
-public interface ILaunch extends ITerminate, IAdaptable {
- /**
- * Returns the children of this launch - a collection
- * of one or more debug targets and processes, possibly empty.
- *
- * @return an array (element type:<code>IDebugTarget</code> or <code>IProcess</code>),
- * or an empty array
- */
- public Object[] getChildren();
- /**
- * Returns the primary (first) debug target associated with this launch, or <code>null</code>
- * if no debug target is associated with this launch. All debug targets
- * associated with this launch may be retrieved by
- * <code>getDebugTargets()</code>.
- *
- * @return the primary debug target associated with this launch, or <code>null</code>
- */
- public IDebugTarget getDebugTarget();
-
- /**
- * Returns the processes that were launched,
- * or an empty collection if no processes were launched.
- *
- * @return array of processes
- */
- public IProcess[] getProcesses();
-
- /**
- * Returns all the debug targets associated with this launch,
- * or an empty collection if no debug targets are associated
- * with this launch. The primary debug target is the first
- * in the collection (if any).
- *
- * @return array of debug targets
- * @since 2.0
- */
- public IDebugTarget[] getDebugTargets();
-
- /**
- * Adds the given debug target to this launch. Has no effect
- * if the given debug target is already associated with this
- * launch. Registered listeners are notified that this launch
- * has changed.
- *
- * @param target debug target to add to this launch
- * @since 2.0
- */
- public void addDebugTarget(IDebugTarget target);
-
- /**
- * Removes the given debug target from this launch. Has no effect
- * if the given debug target is not already associated with this
- * launch. Registered listeners are notified that this launch
- * has changed.
- *
- * @param target debug target to remove from this launch
- * @since 2.0
- */
- public void removeDebugTarget(IDebugTarget target);
-
- /**
- * Adds the given process to this launch. Has no effect
- * if the given process is already associated with this
- * launch. Registered listeners are notified that this launch
- * has changed.
- *
- * @param process the process to add to this launch
- * @since 2.0
- */
- public void addProcess(IProcess process);
-
- /**
- * Removes the given process from this launch. Has no effect
- * if the given process is not already associated with this
- * launch. Registered listeners are notified that this launch
- * has changed.
- *
- * @param process the process to remove from this launch
- * @since 2.0
- */
- public void removeProcess(IProcess process);
-
- /**
- * Returns the source locator to use for locating source elements for
- * the debug target associated with this launch, or <code>null</code>
- * if source lookup is not supported.
- *
- * @return the source locator
- */
- public ISourceLocator getSourceLocator();
-
- /**
- * Sets the source locator to use for locating source elements for
- * the debug target associated with this launch, or <code>null</code>
- * if source lookup is not supported.
- *
- * @param sourceLocator source locator or <code>null</code>
- * @since 2.0
- */
- public void setSourceLocator(ISourceLocator sourceLocator);
-
- /**
- * Returns the mode of this launch - one of the mode constants defined by
- * the launch manager.
- *
- * @return the launch mode
- * @see ILaunchManager
- */
- public String getLaunchMode();
-
- /**
- * Returns the configuration that was launched, or <code>null</code>
- * if no configuration was launched.
- *
- * @return the launched configuration or <code>null</code>
- * @since 2.0
- */
- public ILaunchConfiguration getLaunchConfiguration();
-
- /**
- * Sets the value of a client defined attribute.
- *
- * @param key the attribute key
- * @param value the attribute value
- * @since 2.0
- */
- public void setAttribute(String key, String value);
-
- /**
- * Returns the value of a client defined attribute.
- *
- * @param key the attribute key
- * @return value the attribute value, or <code>null</code> if undefined
- * @since 2.0
- */
- public String getAttribute(String key);
-
- /**
- * Returns whether this launch contains at least one process
- * or debug target.
- *
- * @return whether this launch contains at least one process
- * or debug target
- * @since 2.0
- */
- public boolean hasChildren();
-
-}
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.core.model.ITerminate;
+
+/**
+ * A launch is the result of launching a debug session
+ * and/or one or more system processes.
+ * <p>
+ * This interface is not intended to be implemented by clients. Clients
+ * should create instances of this interface by using the implementation
+ * provided by the class <code>Launch</code>.
+ * </p>
+ * @see Launch
+ */
+public interface ILaunch extends ITerminate, IAdaptable {
+ /**
+ * Returns the children of this launch - a collection
+ * of one or more debug targets and processes, possibly empty.
+ *
+ * @return an array (element type:<code>IDebugTarget</code> or <code>IProcess</code>),
+ * or an empty array
+ */
+ public Object[] getChildren();
+ /**
+ * Returns the primary (first) debug target associated with this launch, or <code>null</code>
+ * if no debug target is associated with this launch. All debug targets
+ * associated with this launch may be retrieved by
+ * <code>getDebugTargets()</code>.
+ *
+ * @return the primary debug target associated with this launch, or <code>null</code>
+ */
+ public IDebugTarget getDebugTarget();
+
+ /**
+ * Returns the processes that were launched,
+ * or an empty collection if no processes were launched.
+ *
+ * @return array of processes
+ */
+ public IProcess[] getProcesses();
+
+ /**
+ * Returns all the debug targets associated with this launch,
+ * or an empty collection if no debug targets are associated
+ * with this launch. The primary debug target is the first
+ * in the collection (if any).
+ *
+ * @return array of debug targets
+ * @since 2.0
+ */
+ public IDebugTarget[] getDebugTargets();
+
+ /**
+ * Adds the given debug target to this launch. Has no effect
+ * if the given debug target is already associated with this
+ * launch. Registered listeners are notified that this launch
+ * has changed.
+ *
+ * @param target debug target to add to this launch
+ * @since 2.0
+ */
+ public void addDebugTarget(IDebugTarget target);
+
+ /**
+ * Removes the given debug target from this launch. Has no effect
+ * if the given debug target is not already associated with this
+ * launch. Registered listeners are notified that this launch
+ * has changed.
+ *
+ * @param target debug target to remove from this launch
+ * @since 2.0
+ */
+ public void removeDebugTarget(IDebugTarget target);
+
+ /**
+ * Adds the given process to this launch. Has no effect
+ * if the given process is already associated with this
+ * launch. Registered listeners are notified that this launch
+ * has changed.
+ *
+ * @param process the process to add to this launch
+ * @since 2.0
+ */
+ public void addProcess(IProcess process);
+
+ /**
+ * Removes the given process from this launch. Has no effect
+ * if the given process is not already associated with this
+ * launch. Registered listeners are notified that this launch
+ * has changed.
+ *
+ * @param process the process to remove from this launch
+ * @since 2.0
+ */
+ public void removeProcess(IProcess process);
+
+ /**
+ * Returns the source locator to use for locating source elements for
+ * the debug target associated with this launch, or <code>null</code>
+ * if source lookup is not supported.
+ *
+ * @return the source locator
+ */
+ public ISourceLocator getSourceLocator();
+
+ /**
+ * Sets the source locator to use for locating source elements for
+ * the debug target associated with this launch, or <code>null</code>
+ * if source lookup is not supported.
+ *
+ * @param sourceLocator source locator or <code>null</code>
+ * @since 2.0
+ */
+ public void setSourceLocator(ISourceLocator sourceLocator);
+
+ /**
+ * Returns the mode of this launch - one of the mode constants defined by
+ * the launch manager.
+ *
+ * @return the launch mode
+ * @see ILaunchManager
+ */
+ public String getLaunchMode();
+
+ /**
+ * Returns the configuration that was launched, or <code>null</code>
+ * if no configuration was launched.
+ *
+ * @return the launched configuration or <code>null</code>
+ * @since 2.0
+ */
+ public ILaunchConfiguration getLaunchConfiguration();
+
+ /**
+ * Sets the value of a client defined attribute.
+ *
+ * @param key the attribute key
+ * @param value the attribute value
+ * @since 2.0
+ */
+ public void setAttribute(String key, String value);
+
+ /**
+ * Returns the value of a client defined attribute.
+ *
+ * @param key the attribute key
+ * @return value the attribute value, or <code>null</code> if undefined
+ * @since 2.0
+ */
+ public String getAttribute(String key);
+
+ /**
+ * Returns whether this launch contains at least one process
+ * or debug target.
+ *
+ * @return whether this launch contains at least one process
+ * or debug target
+ * @since 2.0
+ */
+ public boolean hasChildren();
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
index 93c828fb2..436657958 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
@@ -1,342 +1,342 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * A launch configuration describes how to launch an application.
- * Each launch configuration is an instance of a type of launch
- * configuration as described by a launch configuration type
- * extension. Each launch configuration has a launch configuration
- * delegate which performs the actual launching of a
- * configuration.
- * <p>
- * A launch configuration may be shared in a repository via
- * standard VCM mechanisms, or may be stored locally, essentially
- * making the launch configuration private for a single user.
- * Thus, a launch configuration may stored as a file in the
- * workspace (shared), or as a file in the debug plug-in's state
- * location.
- * </p>
- * A launch configuration is a handle to its underlying storage.
- * </p>
- * <p>
- * A launch configuration is modified by obtaining a working copy
- * of a launch configuration, modifying the working copy, and then
- * saving the working copy.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients. Clients
- * that define a launch configuration delegate extension implement the
- * <code>ILaunchConfigurationDelegate</code> interface.
- * </p>
- * @see ILaunchConfigurationType
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate
- * @see ILaunchConfigurationWorkingCopy
- * @since 2.0
- */
-public interface ILaunchConfiguration extends IAdaptable {
-
- /**
- * The file extension for launch configuration files
- * (value <code>"launch"</code>).
- */
- public static final String LAUNCH_CONFIGURATION_FILE_EXTENSION = "launch"; //$NON-NLS-1$
-
- /**
- * Launch configuration attribute storing an identifier of
- * a persistable source locator extension. When this attribute is
- * specified, a new source locator will be created automatically and
- * associated with the launch for this configuration.
- *
- * @see IPersistableSourceLocator
- */
- public static final String ATTR_SOURCE_LOCATOR_ID = DebugPlugin.getUniqueIdentifier() + ".source_locator_id"; //$NON-NLS-1$
-
- /**
- * Launch configuration attribute storing a memento of a
- * source locator. When this attribute is specified in
- * conjunction with a source locator id, the source locator
- * created for a launch will be initialized with this memento.
- * When not specified, but a source locator id is specified,
- * the source locator will be initialized to default values.
- *
- * @see IPersistableSourceLocator
- */
- public static final String ATTR_SOURCE_LOCATOR_MEMENTO = DebugPlugin.getUniqueIdentifier() + ".source_locator_memento"; //$NON-NLS-1$
-
- /**
- * Launches this configuration in the specified mode by delegating to
- * this configuration's launch configuration delegate, and returns the
- * resulting launch.
- * A new launch object is created and registered with the launch manager
- * before passing it to this configuration's delegate for contributions
- * (debug targets and processes).
- * If the delegate contributes a source locator to the launch, that
- * source locator is used. Otherwise an appropriate source locator is
- * contributed to the launch based on the values of
- * <code>ATTR_SOURCE_LOCAOTOR_ID</code> and <code>ATTR_SOURCE_LOCATOR_MEMENTO</code>.
- * If the launch is cancelled (via the given progress monitor), the
- * launch is removed from the launch manager. The launch is returned
- * whether cancelled or not.
- * Invoking this method causes the underlying launch configuration delegate
- * to be instantiated (if not already).
- *
- * @param mode the mode in which to launch, one of the mode constants
- * defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or <code>DEBUG_MODE</code>.
- * @param monitor progress monitor, or <code>null</code>
- * @return the resulting launch.
- * @exception CoreException if this method fails. Reasons include:<ul>
- * <li>unable to instantiate the underlying launch configuration delegate</li>
- * <li>the launch fails (in the delegate)</code>
- * </ul>
- */
- public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Returns whether this launch configuration supports the
- * specified mode.
- *
- * @param mode a mode in which a configuration can be launched, one of
- * the mode constants defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or
- * <code>DEBUG_MODE</code>.
- * @return whether this launch configuration supports the
- * specified mode
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Unable to retrieve this launch configuration's type.</li>
- * </ul>
- */
- public boolean supportsMode(String mode) throws CoreException;
-
- /**
- * Returns the name of this launch configuration.
- *
- * @return the name of this launch configuration
- */
- public String getName();
-
- /**
- * Returns the location of this launch configuration as a
- * path.
- *
- * @return the location of this launch configuration as a
- * path
- */
- public IPath getLocation();
-
- /**
- * Returns whether this launch configuration's underlying
- * storage exists.
- *
- * @return whether this launch configuration's underlying
- * storage exists
- */
- public boolean exists();
-
- /**
- * Returns the integer-valued attribute with the given name.
- * Returns the given default value if the attribute is undefined.
- *
- * @param attributeName the name of the attribute
- * @param defaultValue the value to use if no value is found
- * @return the value or the default value if no value was found.
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>An exception occurs while retrieving the attribute from
- * underlying storage.</li>
- * <li>An attribute with the given name exists, but does not
- * have an integer value</li>
- * </ul>
- */
- public int getAttribute(String attributeName, int defaultValue) throws CoreException;
- /**
- * Returns the string-valued attribute with the given name.
- * Returns the given default value if the attribute is undefined.
- *
- * @param attributeName the name of the attribute
- * @param defaultValue the value to use if no value is found
- * @return the value or the default value if no value was found.
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>An exception occurs while retrieving the attribute from
- * underlying storage.</li>
- * <li>An attribute with the given name exists, but does not
- * have a String value</li>
- * </ul>
- */
- public String getAttribute(String attributeName, String defaultValue) throws CoreException;
- /**
- * Returns the boolean-valued attribute with the given name.
- * Returns the given default value if the attribute is undefined.
- *
- * @param attributeName the name of the attribute
- * @param defaultValue the value to use if no value is found
- * @return the value or the default value if no value was found.
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>An exception occurs while retrieving the attribute from
- * underlying storage.</li>
- * <li>An attribute with the given name exists, but does not
- * have a boolean value</li>
- * </ul>
- */
- public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException;
- /**
- * Returns the <code>java.util.List</code>-valued attribute with the given name.
- * Returns the given default value if the attribute is undefined.
- *
- * @param attributeName the name of the attribute
- * @param defaultValue the value to use if no value is found
- * @return the value or the default value if no value was found.
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>An exception occurs while retrieving the attribute from
- * underlying storage.</li>
- * <li>An attribute with the given name exists, but does not
- * have a List value</li>
- * </ul>
- */
- public List getAttribute(String attributeName, List defaultValue) throws CoreException;
- /**
- * Returns the <code>java.util.Map</code>-valued attribute with the given name.
- * Returns the given default value if the attribute is undefined.
- *
- * @param attributeName the name of the attribute
- * @param defaultValue the value to use if no value is found
- * @return the value or the default value if no value was found.
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>An exception occurs while retrieving the attribute from
- * underlying storage.</li>
- * <li>An attribute with the given name exists, but does not
- * have a Map value</li>
- * </ul>
- */
- public Map getAttribute(String attributeName, Map defaultValue) throws CoreException;
-
- /**
- * Returns the file this launch configuration is stored
- * in, or <code>null</code> if this configuration is stored
- * locally with the workspace.
- *
- * @return the file this launch configuration is stored
- * in, or <code>null</code> if this configuration is stored
- * locally with the workspace
- */
- public IFile getFile();
-
- /**
- * Returns the type of this launch configuration.
- *
- * @return the type of this launch configuration
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>Unable to retrieve or instantiate this launch configuration's type.</li>
- * </ul>
- * @see ILaunchConfigurationType
- */
- public ILaunchConfigurationType getType() throws CoreException;
-
- /**
- * Returns whether this launch configuration is stored
- * locally with the workspace.
- *
- * @return whether this launch configuration is stored
- * locally with the workspace
- */
- public boolean isLocal();
-
- /**
- * Returns a working copy of this launch configuration.
- * Changes to the working copy will be applied to this
- * launch configuration when saved. The working copy will
- * refer to this launch configuration as its original
- * launch configuration.
- *
- * @return a working copy of this launch configuration
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>An exception occurs while initializing the contents of the
- * working copy from this configuration's underlying storage.</li>
- * </ul>
- * @see ILaunchConfigurationWorkingCopy#getOriginal()
- */
- public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException;
-
- /**
- * Returns a copy of this launch configuration, as a
- * working copy, with the specified name. The new
- * working copy does not refer back to this configuration
- * as its original launch configuration (the working copy
- * will return <code>null</code> for <code>getOriginal()</code>).
- * When the working copy is saved it will not effect this
- * launch configuration.
- *
- * @param name the name of the copy
- * @return a copy of this launch configuration
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>An exception occurs while initializing the contents of the
- * working copy from this configuration's underlying storage.</li>
- * </ul>
- * @see ILaunchConfigurationWorkingCopy#getOriginal()
- */
- public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException;
-
- /**
- * Returns whether this launch configuration is a working
- * copy.
- *
- * @return whether this launch configuration is a working
- * copy
- */
- public boolean isWorkingCopy();
-
- /**
- * Deletes this launch configuration. This configuration's underlying
- * storage is deleted. Has no effect if this configuration
- * does not exist.
- *
- * @exception CoreException if this method fails. Reasons include:
- * <ul>
- * <li>An exception occurs while deleting this configuration's
- * underlying storage.</li>
- * </ul>
- */
- public void delete() throws CoreException;
-
- /**
- * Returns a memento for this launch configuration, or <code>null</code>
- * if unable to generate a memento for this configuration. A memento
- * can be used to re-create a launch configuration, via the
- * launch manager.
- *
- * @return a memento for this configuration
- * @see ILaunchManager#getLaunchConfiguration(String)
- * @exception CoreException if an exception occurs generating this
- * launch configuration's memento
- */
- public String getMemento() throws CoreException;
-
- /**
- * Returns whether the contents of this launch configuration are
- * equal to the contents of the given launch configuration.
- *
- * @return whether the contents of this launch configuration are equal to the contents
- * of the specified launch configuration.
- */
- public boolean contentsEqual(ILaunchConfiguration configuration);
-
-}
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * A launch configuration describes how to launch an application.
+ * Each launch configuration is an instance of a type of launch
+ * configuration as described by a launch configuration type
+ * extension. Each launch configuration has a launch configuration
+ * delegate which performs the actual launching of a
+ * configuration.
+ * <p>
+ * A launch configuration may be shared in a repository via
+ * standard VCM mechanisms, or may be stored locally, essentially
+ * making the launch configuration private for a single user.
+ * Thus, a launch configuration may stored as a file in the
+ * workspace (shared), or as a file in the debug plug-in's state
+ * location.
+ * </p>
+ * A launch configuration is a handle to its underlying storage.
+ * </p>
+ * <p>
+ * A launch configuration is modified by obtaining a working copy
+ * of a launch configuration, modifying the working copy, and then
+ * saving the working copy.
+ * </p>
+ * <p>
+ * This interface is not intended to be implemented by clients. Clients
+ * that define a launch configuration delegate extension implement the
+ * <code>ILaunchConfigurationDelegate</code> interface.
+ * </p>
+ * @see ILaunchConfigurationType
+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate
+ * @see ILaunchConfigurationWorkingCopy
+ * @since 2.0
+ */
+public interface ILaunchConfiguration extends IAdaptable {
+
+ /**
+ * The file extension for launch configuration files
+ * (value <code>"launch"</code>).
+ */
+ public static final String LAUNCH_CONFIGURATION_FILE_EXTENSION = "launch"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute storing an identifier of
+ * a persistable source locator extension. When this attribute is
+ * specified, a new source locator will be created automatically and
+ * associated with the launch for this configuration.
+ *
+ * @see IPersistableSourceLocator
+ */
+ public static final String ATTR_SOURCE_LOCATOR_ID = DebugPlugin.getUniqueIdentifier() + ".source_locator_id"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute storing a memento of a
+ * source locator. When this attribute is specified in
+ * conjunction with a source locator id, the source locator
+ * created for a launch will be initialized with this memento.
+ * When not specified, but a source locator id is specified,
+ * the source locator will be initialized to default values.
+ *
+ * @see IPersistableSourceLocator
+ */
+ public static final String ATTR_SOURCE_LOCATOR_MEMENTO = DebugPlugin.getUniqueIdentifier() + ".source_locator_memento"; //$NON-NLS-1$
+
+ /**
+ * Launches this configuration in the specified mode by delegating to
+ * this configuration's launch configuration delegate, and returns the
+ * resulting launch.
+ * A new launch object is created and registered with the launch manager
+ * before passing it to this configuration's delegate for contributions
+ * (debug targets and processes).
+ * If the delegate contributes a source locator to the launch, that
+ * source locator is used. Otherwise an appropriate source locator is
+ * contributed to the launch based on the values of
+ * <code>ATTR_SOURCE_LOCAOTOR_ID</code> and <code>ATTR_SOURCE_LOCATOR_MEMENTO</code>.
+ * If the launch is cancelled (via the given progress monitor), the
+ * launch is removed from the launch manager. The launch is returned
+ * whether cancelled or not.
+ * Invoking this method causes the underlying launch configuration delegate
+ * to be instantiated (if not already).
+ *
+ * @param mode the mode in which to launch, one of the mode constants
+ * defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or <code>DEBUG_MODE</code>.
+ * @param monitor progress monitor, or <code>null</code>
+ * @return the resulting launch.
+ * @exception CoreException if this method fails. Reasons include:<ul>
+ * <li>unable to instantiate the underlying launch configuration delegate</li>
+ * <li>the launch fails (in the delegate)</code>
+ * </ul>
+ */
+ public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Returns whether this launch configuration supports the
+ * specified mode.
+ *
+ * @param mode a mode in which a configuration can be launched, one of
+ * the mode constants defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or
+ * <code>DEBUG_MODE</code>.
+ * @return whether this launch configuration supports the
+ * specified mode
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>Unable to retrieve this launch configuration's type.</li>
+ * </ul>
+ */
+ public boolean supportsMode(String mode) throws CoreException;
+
+ /**
+ * Returns the name of this launch configuration.
+ *
+ * @return the name of this launch configuration
+ */
+ public String getName();
+
+ /**
+ * Returns the location of this launch configuration as a
+ * path.
+ *
+ * @return the location of this launch configuration as a
+ * path
+ */
+ public IPath getLocation();
+
+ /**
+ * Returns whether this launch configuration's underlying
+ * storage exists.
+ *
+ * @return whether this launch configuration's underlying
+ * storage exists
+ */
+ public boolean exists();
+
+ /**
+ * Returns the integer-valued attribute with the given name.
+ * Returns the given default value if the attribute is undefined.
+ *
+ * @param attributeName the name of the attribute
+ * @param defaultValue the value to use if no value is found
+ * @return the value or the default value if no value was found.
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>An exception occurs while retrieving the attribute from
+ * underlying storage.</li>
+ * <li>An attribute with the given name exists, but does not
+ * have an integer value</li>
+ * </ul>
+ */
+ public int getAttribute(String attributeName, int defaultValue) throws CoreException;
+ /**
+ * Returns the string-valued attribute with the given name.
+ * Returns the given default value if the attribute is undefined.
+ *
+ * @param attributeName the name of the attribute
+ * @param defaultValue the value to use if no value is found
+ * @return the value or the default value if no value was found.
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>An exception occurs while retrieving the attribute from
+ * underlying storage.</li>
+ * <li>An attribute with the given name exists, but does not
+ * have a String value</li>
+ * </ul>
+ */
+ public String getAttribute(String attributeName, String defaultValue) throws CoreException;
+ /**
+ * Returns the boolean-valued attribute with the given name.
+ * Returns the given default value if the attribute is undefined.
+ *
+ * @param attributeName the name of the attribute
+ * @param defaultValue the value to use if no value is found
+ * @return the value or the default value if no value was found.
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>An exception occurs while retrieving the attribute from
+ * underlying storage.</li>
+ * <li>An attribute with the given name exists, but does not
+ * have a boolean value</li>
+ * </ul>
+ */
+ public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException;
+ /**
+ * Returns the <code>java.util.List</code>-valued attribute with the given name.
+ * Returns the given default value if the attribute is undefined.
+ *
+ * @param attributeName the name of the attribute
+ * @param defaultValue the value to use if no value is found
+ * @return the value or the default value if no value was found.
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>An exception occurs while retrieving the attribute from
+ * underlying storage.</li>
+ * <li>An attribute with the given name exists, but does not
+ * have a List value</li>
+ * </ul>
+ */
+ public List getAttribute(String attributeName, List defaultValue) throws CoreException;
+ /**
+ * Returns the <code>java.util.Map</code>-valued attribute with the given name.
+ * Returns the given default value if the attribute is undefined.
+ *
+ * @param attributeName the name of the attribute
+ * @param defaultValue the value to use if no value is found
+ * @return the value or the default value if no value was found.
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>An exception occurs while retrieving the attribute from
+ * underlying storage.</li>
+ * <li>An attribute with the given name exists, but does not
+ * have a Map value</li>
+ * </ul>
+ */
+ public Map getAttribute(String attributeName, Map defaultValue) throws CoreException;
+
+ /**
+ * Returns the file this launch configuration is stored
+ * in, or <code>null</code> if this configuration is stored
+ * locally with the workspace.
+ *
+ * @return the file this launch configuration is stored
+ * in, or <code>null</code> if this configuration is stored
+ * locally with the workspace
+ */
+ public IFile getFile();
+
+ /**
+ * Returns the type of this launch configuration.
+ *
+ * @return the type of this launch configuration
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>Unable to retrieve or instantiate this launch configuration's type.</li>
+ * </ul>
+ * @see ILaunchConfigurationType
+ */
+ public ILaunchConfigurationType getType() throws CoreException;
+
+ /**
+ * Returns whether this launch configuration is stored
+ * locally with the workspace.
+ *
+ * @return whether this launch configuration is stored
+ * locally with the workspace
+ */
+ public boolean isLocal();
+
+ /**
+ * Returns a working copy of this launch configuration.
+ * Changes to the working copy will be applied to this
+ * launch configuration when saved. The working copy will
+ * refer to this launch configuration as its original
+ * launch configuration.
+ *
+ * @return a working copy of this launch configuration
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>An exception occurs while initializing the contents of the
+ * working copy from this configuration's underlying storage.</li>
+ * </ul>
+ * @see ILaunchConfigurationWorkingCopy#getOriginal()
+ */
+ public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException;
+
+ /**
+ * Returns a copy of this launch configuration, as a
+ * working copy, with the specified name. The new
+ * working copy does not refer back to this configuration
+ * as its original launch configuration (the working copy
+ * will return <code>null</code> for <code>getOriginal()</code>).
+ * When the working copy is saved it will not effect this
+ * launch configuration.
+ *
+ * @param name the name of the copy
+ * @return a copy of this launch configuration
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>An exception occurs while initializing the contents of the
+ * working copy from this configuration's underlying storage.</li>
+ * </ul>
+ * @see ILaunchConfigurationWorkingCopy#getOriginal()
+ */
+ public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException;
+
+ /**
+ * Returns whether this launch configuration is a working
+ * copy.
+ *
+ * @return whether this launch configuration is a working
+ * copy
+ */
+ public boolean isWorkingCopy();
+
+ /**
+ * Deletes this launch configuration. This configuration's underlying
+ * storage is deleted. Has no effect if this configuration
+ * does not exist.
+ *
+ * @exception CoreException if this method fails. Reasons include:
+ * <ul>
+ * <li>An exception occurs while deleting this configuration's
+ * underlying storage.</li>
+ * </ul>
+ */
+ public void delete() throws CoreException;
+
+ /**
+ * Returns a memento for this launch configuration, or <code>null</code>
+ * if unable to generate a memento for this configuration. A memento
+ * can be used to re-create a launch configuration, via the
+ * launch manager.
+ *
+ * @return a memento for this configuration
+ * @see ILaunchManager#getLaunchConfiguration(String)
+ * @exception CoreException if an exception occurs generating this
+ * launch configuration's memento
+ */
+ public String getMemento() throws CoreException;
+
+ /**
+ * Returns whether the contents of this launch configuration are
+ * equal to the contents of the given launch configuration.
+ *
+ * @return whether the contents of this launch configuration are equal to the contents
+ * of the specified launch configuration.
+ */
+ public boolean contentsEqual(ILaunchConfiguration configuration);
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationListener.java
index 2653d8a08..fc2750b06 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationListener.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationListener.java
@@ -1,41 +1,41 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Notified when a launch configuration is created,
- * deleted, or changed.
- * <p>
- * This interface is intended to be implemented by clients.
- * </p>
- * @since 2.0
- */
-public interface ILaunchConfigurationListener {
-
- /**
- * The given launch configuration has been created.
- *
- * @param configuration the newly created launch configuration
- */
- public void launchConfigurationAdded(ILaunchConfiguration configuration);
-
- /**
- * The given launch configuration has changed in some way.
- * The configuration may be a working copy.
- *
- * @param configuration the launch configuration that has
- * changed
- */
- public void launchConfigurationChanged(ILaunchConfiguration configuration);
-
- /**
- * The given launch configuration has been deleted.
- *
- * @param configuration the deleted launch configuration
- */
- public void launchConfigurationRemoved(ILaunchConfiguration configuration);
-}
-
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Notified when a launch configuration is created,
+ * deleted, or changed.
+ * <p>
+ * This interface is intended to be implemented by clients.
+ * </p>
+ * @since 2.0
+ */
+public interface ILaunchConfigurationListener {
+
+ /**
+ * The given launch configuration has been created.
+ *
+ * @param configuration the newly created launch configuration
+ */
+ public void launchConfigurationAdded(ILaunchConfiguration configuration);
+
+ /**
+ * The given launch configuration has changed in some way.
+ * The configuration may be a working copy.
+ *
+ * @param configuration the launch configuration that has
+ * changed
+ */
+ public void launchConfigurationChanged(ILaunchConfiguration configuration);
+
+ /**
+ * The given launch configuration has been deleted.
+ *
+ * @param configuration the deleted launch configuration
+ */
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration);
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
index 343b50c56..5dfc59411 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java
@@ -1,120 +1,120 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-
-/**
- * Describes and creates instances of a specific type of
- * launch configuration. Launch configuration types are
- * defined by extensions.
- * <p>
- * A launch configuration type extension is defined in <code>plugin.xml</code>.
- * Following is an example definition of a launch configuration
- * type extension.
- * <pre>
- * &lt;extension point="org.eclipse.debug.core.launchConfigurationTypes"&gt;
- * &lt;launchConfigurationType
- * id="com.example.ExampleIdentifier"
- * delegate="com.example.ExampleLaunchConfigurationDelegate"
- * modes="run, debug"
- * name="Example Application"&gt;
- * &lt;/launchConfigurationType&gt;
- * &lt;/extension&gt;
- * </pre>
- * The attributes are specified as follows:
- * <ul>
- * <li><code>id</code> specifies a unique identifier for this launch configuration
- * type.</li>
- * <li><code>delegate</code> specifies the fully qualified name of the java class
- * that implements <code>ILaunchConfigurationDelegate</code>. Launch configuration
- * instances of this type will delegate to instances of this class
- * to perform launching.</li>
- * <li><code>modes</code> specifies a comma separated list of the modes this
- * type of launch configuration suports - <code>"run"</code> and/or <code>"debug"</code>.</li>
- * <li><code>name</code> specifies a human readable name for this type
- * of launch configuration.</li>
- * </ul>
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients. Clients
- * that define a launch configuration delegate extension implement the
- * <code>ILaunchConfigurationDelegate</code> interface.
- * </p>
- * @see ILaunchConfiguration
- * @since 2.0
- */
-public interface ILaunchConfigurationType {
-
- /**
- * Returns whether this type of launch configuration supports
- * the specified mode.
- *
- * @param mode a mode in which a configuration can be launched, one of
- * the mode constants defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or
- * <code>DEBUG_MODE</code>.
- * @return whether this kind of launch configuration supports the
- * specified mode
- */
- public boolean supportsMode(String mode);
-
- /**
- * Returns the name of this type of launch configuration.
- *
- * @return the name of this type of launch configuration
- */
- public String getName();
-
- /**
- * Returns the unique identifier for this type of launch configuration
- *
- * @return the unique identifier for this type of launch configuration
- */
- public String getIdentifier();
-
- /**
- * Returns whether this launch configuration type is public. Public configuration
- * types are available for use by the user, for example, the user can create new
- * configurations based on public types through the UI. Private types are not
- * accessbile in this way, but are still available through the methods on
- * <code>ILaunchManager</code>.
- *
- * @return whether this launch configuration type is public.
- */
- public boolean isPublic();
-
- /**
- * Returns a new launch configuration working copy of this type,
- * that resides in the specified container, with the given name.
- * When <code>container</code> is </code>null</code>, the configuration
- * will reside locally in the metadata area.
- * Note: a launch configuration is not actually created until the working copy is saved.
- *
- * @param container the container in which the new configuration will
- * reside, or <code>null</code> if the configuration should reside
- * locally with the metadata.
- * @param name name for the launch configuration
- * @return a new launch configuration working copy instance of this type
- * @exception CoreException if an instance of this type
- * of launch configuration could not be created for any
- * reason
- */
- public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) throws CoreException;
-
- /**
- * Returns the launch configuration delegate for launch
- * configurations of this type. The first time this method
- * is called, the delegate is instantiated.
- *
- * @return launch configuration delegate
- * @exception CoreException if unable to instantiate the
- * delegate
- */
- public ILaunchConfigurationDelegate getDelegate() throws CoreException;
-
-}
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+
+/**
+ * Describes and creates instances of a specific type of
+ * launch configuration. Launch configuration types are
+ * defined by extensions.
+ * <p>
+ * A launch configuration type extension is defined in <code>plugin.xml</code>.
+ * Following is an example definition of a launch configuration
+ * type extension.
+ * <pre>
+ * &lt;extension point="org.eclipse.debug.core.launchConfigurationTypes"&gt;
+ * &lt;launchConfigurationType
+ * id="com.example.ExampleIdentifier"
+ * delegate="com.example.ExampleLaunchConfigurationDelegate"
+ * modes="run, debug"
+ * name="Example Application"&gt;
+ * &lt;/launchConfigurationType&gt;
+ * &lt;/extension&gt;
+ * </pre>
+ * The attributes are specified as follows:
+ * <ul>
+ * <li><code>id</code> specifies a unique identifier for this launch configuration
+ * type.</li>
+ * <li><code>delegate</code> specifies the fully qualified name of the java class
+ * that implements <code>ILaunchConfigurationDelegate</code>. Launch configuration
+ * instances of this type will delegate to instances of this class
+ * to perform launching.</li>
+ * <li><code>modes</code> specifies a comma separated list of the modes this
+ * type of launch configuration suports - <code>"run"</code> and/or <code>"debug"</code>.</li>
+ * <li><code>name</code> specifies a human readable name for this type
+ * of launch configuration.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * This interface is not intended to be implemented by clients. Clients
+ * that define a launch configuration delegate extension implement the
+ * <code>ILaunchConfigurationDelegate</code> interface.
+ * </p>
+ * @see ILaunchConfiguration
+ * @since 2.0
+ */
+public interface ILaunchConfigurationType {
+
+ /**
+ * Returns whether this type of launch configuration supports
+ * the specified mode.
+ *
+ * @param mode a mode in which a configuration can be launched, one of
+ * the mode constants defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> or
+ * <code>DEBUG_MODE</code>.
+ * @return whether this kind of launch configuration supports the
+ * specified mode
+ */
+ public boolean supportsMode(String mode);
+
+ /**
+ * Returns the name of this type of launch configuration.
+ *
+ * @return the name of this type of launch configuration
+ */
+ public String getName();
+
+ /**
+ * Returns the unique identifier for this type of launch configuration
+ *
+ * @return the unique identifier for this type of launch configuration
+ */
+ public String getIdentifier();
+
+ /**
+ * Returns whether this launch configuration type is public. Public configuration
+ * types are available for use by the user, for example, the user can create new
+ * configurations based on public types through the UI. Private types are not
+ * accessbile in this way, but are still available through the methods on
+ * <code>ILaunchManager</code>.
+ *
+ * @return whether this launch configuration type is public.
+ */
+ public boolean isPublic();
+
+ /**
+ * Returns a new launch configuration working copy of this type,
+ * that resides in the specified container, with the given name.
+ * When <code>container</code> is </code>null</code>, the configuration
+ * will reside locally in the metadata area.
+ * Note: a launch configuration is not actually created until the working copy is saved.
+ *
+ * @param container the container in which the new configuration will
+ * reside, or <code>null</code> if the configuration should reside
+ * locally with the metadata.
+ * @param name name for the launch configuration
+ * @return a new launch configuration working copy instance of this type
+ * @exception CoreException if an instance of this type
+ * of launch configuration could not be created for any
+ * reason
+ */
+ public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) throws CoreException;
+
+ /**
+ * Returns the launch configuration delegate for launch
+ * configurations of this type. The first time this method
+ * is called, the delegate is instantiated.
+ *
+ * @return launch configuration delegate
+ * @exception CoreException if unable to instantiate the
+ * delegate
+ */
+ public ILaunchConfigurationDelegate getDelegate() throws CoreException;
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
index 62e5bfcd5..c958d6aca 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
@@ -1,143 +1,143 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * An editable copy of a launch configuration. Attributes of a
- * launch configuration are modified by modifying the attributes
- * of a working copy, and then saving the working copy.
- * <p>
- * This interface is not intended to be implemented by clients. Clients
- * that define a launch configuration delegate extension implement the
- * <code>ILaunchConfigurationDelegate</code> interface.
- * </p>
- * @see ILaunchConfiguration
- * @see ILaunchConfigurationType
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate
- * @since 2.0
- */
-public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, IAdaptable {
-
- /**
- * Returns whether this configuration has been modified
- * since it was last saved or created.
- *
- * @return whether this configuration has been modified
- * since it was last saved or created
- */
- public boolean isDirty();
-
- /**
- * Saves this working copy to its underlying file and returns
- * a handle to the resulting launch configuration.
- * Has no effect if this configuration does not need saving.
- * Creates the underlying file if not yet created.
- *
- * @exception CoreException if an exception occurs while
- * writing this configuration to its underlying file.
- */
- public ILaunchConfiguration doSave() throws CoreException;
-
- /**
- * Sets the integer-valued attribute with the given name.
- *
- * @param attributeName the name of the attribute
- * @param value the value
- */
- public void setAttribute(String attributeName, int value);
-
- /**
- * Sets the String-valued attribute with the given name.
- * If the value is <code>null</code>, the attribute is removed from
- * this launch configuration.
- *
- * @param attributeName the name of the attribute
- * @param value the value, or <code>null</code> if the attribute is to be undefined
- */
- public void setAttribute(String attributeName, String value);
-
- /**
- * Sets the <code>java.util.List</code>-valued attribute with the given name.
- * The specified List <em>must</em> contain only String-valued entries.
- * If the value is <code>null</code>, the attribute is removed from
- * this launch configuration.
- *
- * @param attributeName the name of the attribute
- * @param value the value, or <code>null</code> if the attribute is to be undefined
- */
- public void setAttribute(String attributeName, List value);
-
- /**
- * Sets the <code>java.util.Map</code>-valued attribute with the given name.
- * The specified Map <em>must</em> contain only String keys and String values.
- * If the value is <code>null</code>, the attribute is removed from
- * this launch configuration.
- *
- * @param attributeName the name of the attribute
- * @param value the value, or <code>null</code> if the attribute is to be undefined
- */
- public void setAttribute(String attributeName, Map value);
-
- /**
- * Sets the boolean-valued attribute with the given name.
- *
- * @param attributeName the name of the attribute
- * @param value the value
- */
- public void setAttribute(String attributeName, boolean value);
-
- /**
- * Returns the original launch configuration this working copy
- * was created from, or <code>null</code> if this is a new
- * working copy created from a launch configuration type.
- *
- * @return the original launch configuration, or <code>null</code>
- */
- public ILaunchConfiguration getOriginal();
-
- /**
- * Renames this launch configuration to the specified name.
- * The new name cannot be <code>null</code>. Has no effect if the name
- * is the same as the current name. If this working copy is based
- * on an existing launch configuration, this will cause
- * the underlying launch configuration file to be renamed when
- * this working copy is saved.
- *
- * @param name the new name for this configuration
- */
- public void rename(String name);
-
- /**
- * Sets the container this launch configuration will be stored
- * in when saved. When set to <code>null</code>, this configuration
- * will be stored locally with the workspace. The specified
- * container must exist, if specified.
- * <p>
- * If this configuration is changed from local to non-local,
- * a file will be created in the specified container when
- * saved. The local file associated with this configuration
- * will be deleted.
- * </p>
- * <p>
- * If this configuration is changed from non-local to local,
- * a file will be created locally when saved.
- * The original file associated with this configuration in
- * the workspace will be deleted.
- * </p>
- *
- * @param container the container in which to store this
- * launch configuration, or <code>null</code> if this
- * configuration is to be stored locally
- */
- public void setContainer(IContainer container);
-}
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * An editable copy of a launch configuration. Attributes of a
+ * launch configuration are modified by modifying the attributes
+ * of a working copy, and then saving the working copy.
+ * <p>
+ * This interface is not intended to be implemented by clients. Clients
+ * that define a launch configuration delegate extension implement the
+ * <code>ILaunchConfigurationDelegate</code> interface.
+ * </p>
+ * @see ILaunchConfiguration
+ * @see ILaunchConfigurationType
+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate
+ * @since 2.0
+ */
+public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, IAdaptable {
+
+ /**
+ * Returns whether this configuration has been modified
+ * since it was last saved or created.
+ *
+ * @return whether this configuration has been modified
+ * since it was last saved or created
+ */
+ public boolean isDirty();
+
+ /**
+ * Saves this working copy to its underlying file and returns
+ * a handle to the resulting launch configuration.
+ * Has no effect if this configuration does not need saving.
+ * Creates the underlying file if not yet created.
+ *
+ * @exception CoreException if an exception occurs while
+ * writing this configuration to its underlying file.
+ */
+ public ILaunchConfiguration doSave() throws CoreException;
+
+ /**
+ * Sets the integer-valued attribute with the given name.
+ *
+ * @param attributeName the name of the attribute
+ * @param value the value
+ */
+ public void setAttribute(String attributeName, int value);
+
+ /**
+ * Sets the String-valued attribute with the given name.
+ * If the value is <code>null</code>, the attribute is removed from
+ * this launch configuration.
+ *
+ * @param attributeName the name of the attribute
+ * @param value the value, or <code>null</code> if the attribute is to be undefined
+ */
+ public void setAttribute(String attributeName, String value);
+
+ /**
+ * Sets the <code>java.util.List</code>-valued attribute with the given name.
+ * The specified List <em>must</em> contain only String-valued entries.
+ * If the value is <code>null</code>, the attribute is removed from
+ * this launch configuration.
+ *
+ * @param attributeName the name of the attribute
+ * @param value the value, or <code>null</code> if the attribute is to be undefined
+ */
+ public void setAttribute(String attributeName, List value);
+
+ /**
+ * Sets the <code>java.util.Map</code>-valued attribute with the given name.
+ * The specified Map <em>must</em> contain only String keys and String values.
+ * If the value is <code>null</code>, the attribute is removed from
+ * this launch configuration.
+ *
+ * @param attributeName the name of the attribute
+ * @param value the value, or <code>null</code> if the attribute is to be undefined
+ */
+ public void setAttribute(String attributeName, Map value);
+
+ /**
+ * Sets the boolean-valued attribute with the given name.
+ *
+ * @param attributeName the name of the attribute
+ * @param value the value
+ */
+ public void setAttribute(String attributeName, boolean value);
+
+ /**
+ * Returns the original launch configuration this working copy
+ * was created from, or <code>null</code> if this is a new
+ * working copy created from a launch configuration type.
+ *
+ * @return the original launch configuration, or <code>null</code>
+ */
+ public ILaunchConfiguration getOriginal();
+
+ /**
+ * Renames this launch configuration to the specified name.
+ * The new name cannot be <code>null</code>. Has no effect if the name
+ * is the same as the current name. If this working copy is based
+ * on an existing launch configuration, this will cause
+ * the underlying launch configuration file to be renamed when
+ * this working copy is saved.
+ *
+ * @param name the new name for this configuration
+ */
+ public void rename(String name);
+
+ /**
+ * Sets the container this launch configuration will be stored
+ * in when saved. When set to <code>null</code>, this configuration
+ * will be stored locally with the workspace. The specified
+ * container must exist, if specified.
+ * <p>
+ * If this configuration is changed from local to non-local,
+ * a file will be created in the specified container when
+ * saved. The local file associated with this configuration
+ * will be deleted.
+ * </p>
+ * <p>
+ * If this configuration is changed from non-local to local,
+ * a file will be created locally when saved.
+ * The original file associated with this configuration in
+ * the workspace will be deleted.
+ * </p>
+ *
+ * @param container the container in which to store this
+ * launch configuration, or <code>null</code> if this
+ * configuration is to be stored locally
+ */
+ public void setContainer(IContainer container);
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchListener.java
index 9ba10aed7..e85f7e06a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchListener.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchListener.java
@@ -1,44 +1,44 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A launch listener is notified of launches as they
- * are added and removed from the launch manager. Also,
- * when a process or debug target is added to a launch,
- * listeners are notified of a change.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see ILaunch
- */
-public interface ILaunchListener {
- /**
- * Notifies this listener that the specified
- * launch has been removed.
- *
- * @param launch the removed launch
- * @since 2.0
- */
- public void launchRemoved(ILaunch launch);
- /**
- * Notifies this listener that the specified launch
- * has been added.
- *
- * @param launch the newly added launch
- * @since 2.0
- */
- public void launchAdded(ILaunch launch);
- /**
- * Notifies this listener that the specified launch
- * has changed. For example, a process or debug target
- * has been added to the launch.
- *
- * @param launch the changed launch
- * @since 2.0
- */
- public void launchChanged(ILaunch launch);
-}
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * A launch listener is notified of launches as they
+ * are added and removed from the launch manager. Also,
+ * when a process or debug target is added to a launch,
+ * listeners are notified of a change.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see ILaunch
+ */
+public interface ILaunchListener {
+ /**
+ * Notifies this listener that the specified
+ * launch has been removed.
+ *
+ * @param launch the removed launch
+ * @since 2.0
+ */
+ public void launchRemoved(ILaunch launch);
+ /**
+ * Notifies this listener that the specified launch
+ * has been added.
+ *
+ * @param launch the newly added launch
+ * @since 2.0
+ */
+ public void launchAdded(ILaunch launch);
+ /**
+ * Notifies this listener that the specified launch
+ * has changed. For example, a process or debug target
+ * has been added to the launch.
+ *
+ * @param launch the changed launch
+ * @since 2.0
+ */
+ public void launchChanged(ILaunch launch);
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
index 54df22b36..6e3d34ad0 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
@@ -1,209 +1,209 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IPersistableSourceLocator;
-import org.eclipse.debug.core.model.IProcess;
-
-/**
- * The launch manager manages the set of registered launches, maintaining
- * a collection of active processes and debug targets. Clients interested
- * in launch notification may register with the launch manager.
- * <p>
- * Clients are not intended to implement this interface.
- * </p>
- * @see ILaunch
- * @see ILaunchListener
- */
-public interface ILaunchManager {
- /**
- * A launch in a normal, non-debug mode(value <code>"run"</code>).
- */
- public static final String RUN_MODE= "run"; //$NON-NLS-1$
- /**
- * A launch in a special debug mode (value <code>"debug"</code>).
- */
- public static final String DEBUG_MODE= "debug"; //$NON-NLS-1$
-
- /**
- * Adds the given listener to the collection of registered launch listeners.
- * Has no effect if an identical listener is already registerd.
- *
- * @param listener the listener to register
- */
- public void addLaunchListener(ILaunchListener listener);
- /**
- * Removes the specified launch and notifies listeners.
- * Has no effect if an identical launch is not already
- * registered.
- *
- * @param launch the launch to remove
- * @since 2.0
- */
- public void removeLaunch(ILaunch launch);
- /**
- * Returns the collection of debug targets currently registered with this
- * launch manager.
- *
- * @return an array of debug targets
- */
- public IDebugTarget[] getDebugTargets();
- /**
- * Returns the collection of launches currently registered
- * with this launch manager.
- *
- * @return an array of launches
- */
- public ILaunch[] getLaunches();
- /**
- * Returns the collection of processes currently registered with this
- * launch manager.
- *
- * @return an array of processes
- */
- public IProcess[] getProcesses();
- /**
- * Adds the specified launch and notifies listeners. Has no
- * effect if an identical launch is already registered.
- *
- * @param launch the launch to add
- * @since 2.0
- */
- public void addLaunch(ILaunch launch);
- /**
- * Removes the given listener from the collection of registered launch listeners.
- * Has no effect if an identical listener is not already registerd.
- *
- * @param listener the listener to deregister
- */
- public void removeLaunchListener(ILaunchListener listener);
- /**
- * Returns all launch configurations defined in the workspace.
- *
- * @return all launch configurations defined in the workspace
- * @exception CoreException if an exception occurs retrieving configurations
- * @since 2.0
- */
- public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException;
-
- /**
- * Returns all launch configurations of the specified type defined in the workspace
- *
- * @param type a launch configuration type
- * @return all launch configurations of the specified type defined in the workspace
- * @exception CoreException if an error occurs while retreiving
- * a launch configuration
- * @since 2.0
- */
- public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException;
-
- /**
- * Returns a handle to the launch configuration contained
- * in the specified file. The file is not verified to exist
- * or contain a launch configuration.
- *
- * @param file launch configuration file
- * @return a handle to the launch configuration contained
- * in the specified file
- * @since 2.0
- */
- public ILaunchConfiguration getLaunchConfiguration(IFile file);
-
- /**
- * Returns a handle to the launch configuration specified by
- * the given memento. The configuration may not exist.
- *
- * @return a handle to the launch configuration specified by
- * the given memento
- * @exception CoreException if the given memento is invalid or
- * an exception occurs parsing the memento
- * @see ILaunchConfiguration#getMemento()
- * @since 2.0
- */
- public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException;
-
- /**
- * Returns all defined launch configuration type extensions
- *
- * @return all defined launch configuration type extensions
- * @since 2.0
- */
- public ILaunchConfigurationType[] getLaunchConfigurationTypes();
-
- /**
- * Returns the launch configuration type extension with the specified
- * id, or <code>null</code> if it does not exist.
- *
- * @param id unique identifier for a launch configuration type extension
- * @return the launch configuration type extension with the specified
- * id, or <code>null</code> if it does not exist
- * @since 2.0
- */
- public ILaunchConfigurationType getLaunchConfigurationType(String id);
-
- /**
- * Adds the given launch configuration listener to the list
- * of listeners notified when a launch configuration is
- * added, removed, or changed. Has no effect if the given listener
- * is already registered.
- *
- * @param listener launch configuration listener
- * @since 2.0
- */
- public void addLaunchConfigurationListener(ILaunchConfigurationListener listener);
-
- /**
- * Removes the given launch configuration listener from the list
- * of listeners notified when a launch configuration is
- * added, removed, or changed. Has no effect if the given listener
- * is not already registered.
- *
- * @param listener launch configuration listener
- * @since 2.0
- */
- public void removeLaunchConfigurationListener(ILaunchConfigurationListener listener);
-
- /**
- * Return <code>true</code> if there is a launch configuration with the specified name,
- * <code>false</code> otherwise.
- *
- * @param name the name of the launch configuration whose existence is being checked
- * @exception CoreException if unable to retrieve existing launch configuration names
- * @since 2.0
- */
- public boolean isExistingLaunchConfigurationName(String name) throws CoreException;
-
- /**
- * Return a String that can be used as the name of a launch configuration. The name
- * is guaranteed to be unique (no existing launch configurations will have this name).
- * The name that is returned uses the <code>namePrefix</code> as a starting point. If
- * there is no existing launch configuration with this name, then <code>namePrefix</code>
- * is returned. Otherwise, the value returned consists of the specified prefix plus
- * some suffix that guarantees uniqueness.
- *
- * @param namePrefix the String that the returned name must begin with
- * @since 2.0
- */
- public String generateUniqueLaunchConfigurationNameFrom(String namePrefix);
-
- /**
- * Creates and returns a new source locator of the specified
- * type.
- *
- * @param identifier the identifier associated with a
- * persistable source locator extension
- * @return a source locator
- * @exception CoreException if an exception occurs creating
- * the source locator
- * @since 2.0
- */
- public IPersistableSourceLocator newSourceLocator(String identifier) throws CoreException;
-}
-
-
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IPersistableSourceLocator;
+import org.eclipse.debug.core.model.IProcess;
+
+/**
+ * The launch manager manages the set of registered launches, maintaining
+ * a collection of active processes and debug targets. Clients interested
+ * in launch notification may register with the launch manager.
+ * <p>
+ * Clients are not intended to implement this interface.
+ * </p>
+ * @see ILaunch
+ * @see ILaunchListener
+ */
+public interface ILaunchManager {
+ /**
+ * A launch in a normal, non-debug mode(value <code>"run"</code>).
+ */
+ public static final String RUN_MODE= "run"; //$NON-NLS-1$
+ /**
+ * A launch in a special debug mode (value <code>"debug"</code>).
+ */
+ public static final String DEBUG_MODE= "debug"; //$NON-NLS-1$
+
+ /**
+ * Adds the given listener to the collection of registered launch listeners.
+ * Has no effect if an identical listener is already registerd.
+ *
+ * @param listener the listener to register
+ */
+ public void addLaunchListener(ILaunchListener listener);
+ /**
+ * Removes the specified launch and notifies listeners.
+ * Has no effect if an identical launch is not already
+ * registered.
+ *
+ * @param launch the launch to remove
+ * @since 2.0
+ */
+ public void removeLaunch(ILaunch launch);
+ /**
+ * Returns the collection of debug targets currently registered with this
+ * launch manager.
+ *
+ * @return an array of debug targets
+ */
+ public IDebugTarget[] getDebugTargets();
+ /**
+ * Returns the collection of launches currently registered
+ * with this launch manager.
+ *
+ * @return an array of launches
+ */
+ public ILaunch[] getLaunches();
+ /**
+ * Returns the collection of processes currently registered with this
+ * launch manager.
+ *
+ * @return an array of processes
+ */
+ public IProcess[] getProcesses();
+ /**
+ * Adds the specified launch and notifies listeners. Has no
+ * effect if an identical launch is already registered.
+ *
+ * @param launch the launch to add
+ * @since 2.0
+ */
+ public void addLaunch(ILaunch launch);
+ /**
+ * Removes the given listener from the collection of registered launch listeners.
+ * Has no effect if an identical listener is not already registerd.
+ *
+ * @param listener the listener to deregister
+ */
+ public void removeLaunchListener(ILaunchListener listener);
+ /**
+ * Returns all launch configurations defined in the workspace.
+ *
+ * @return all launch configurations defined in the workspace
+ * @exception CoreException if an exception occurs retrieving configurations
+ * @since 2.0
+ */
+ public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException;
+
+ /**
+ * Returns all launch configurations of the specified type defined in the workspace
+ *
+ * @param type a launch configuration type
+ * @return all launch configurations of the specified type defined in the workspace
+ * @exception CoreException if an error occurs while retreiving
+ * a launch configuration
+ * @since 2.0
+ */
+ public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException;
+
+ /**
+ * Returns a handle to the launch configuration contained
+ * in the specified file. The file is not verified to exist
+ * or contain a launch configuration.
+ *
+ * @param file launch configuration file
+ * @return a handle to the launch configuration contained
+ * in the specified file
+ * @since 2.0
+ */
+ public ILaunchConfiguration getLaunchConfiguration(IFile file);
+
+ /**
+ * Returns a handle to the launch configuration specified by
+ * the given memento. The configuration may not exist.
+ *
+ * @return a handle to the launch configuration specified by
+ * the given memento
+ * @exception CoreException if the given memento is invalid or
+ * an exception occurs parsing the memento
+ * @see ILaunchConfiguration#getMemento()
+ * @since 2.0
+ */
+ public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException;
+
+ /**
+ * Returns all defined launch configuration type extensions
+ *
+ * @return all defined launch configuration type extensions
+ * @since 2.0
+ */
+ public ILaunchConfigurationType[] getLaunchConfigurationTypes();
+
+ /**
+ * Returns the launch configuration type extension with the specified
+ * id, or <code>null</code> if it does not exist.
+ *
+ * @param id unique identifier for a launch configuration type extension
+ * @return the launch configuration type extension with the specified
+ * id, or <code>null</code> if it does not exist
+ * @since 2.0
+ */
+ public ILaunchConfigurationType getLaunchConfigurationType(String id);
+
+ /**
+ * Adds the given launch configuration listener to the list
+ * of listeners notified when a launch configuration is
+ * added, removed, or changed. Has no effect if the given listener
+ * is already registered.
+ *
+ * @param listener launch configuration listener
+ * @since 2.0
+ */
+ public void addLaunchConfigurationListener(ILaunchConfigurationListener listener);
+
+ /**
+ * Removes the given launch configuration listener from the list
+ * of listeners notified when a launch configuration is
+ * added, removed, or changed. Has no effect if the given listener
+ * is not already registered.
+ *
+ * @param listener launch configuration listener
+ * @since 2.0
+ */
+ public void removeLaunchConfigurationListener(ILaunchConfigurationListener listener);
+
+ /**
+ * Return <code>true</code> if there is a launch configuration with the specified name,
+ * <code>false</code> otherwise.
+ *
+ * @param name the name of the launch configuration whose existence is being checked
+ * @exception CoreException if unable to retrieve existing launch configuration names
+ * @since 2.0
+ */
+ public boolean isExistingLaunchConfigurationName(String name) throws CoreException;
+
+ /**
+ * Return a String that can be used as the name of a launch configuration. The name
+ * is guaranteed to be unique (no existing launch configurations will have this name).
+ * The name that is returned uses the <code>namePrefix</code> as a starting point. If
+ * there is no existing launch configuration with this name, then <code>namePrefix</code>
+ * is returned. Otherwise, the value returned consists of the specified prefix plus
+ * some suffix that guarantees uniqueness.
+ *
+ * @param namePrefix the String that the returned name must begin with
+ * @since 2.0
+ */
+ public String generateUniqueLaunchConfigurationNameFrom(String namePrefix);
+
+ /**
+ * Creates and returns a new source locator of the specified
+ * type.
+ *
+ * @param identifier the identifier associated with a
+ * persistable source locator extension
+ * @return a source locator
+ * @exception CoreException if an exception occurs creating
+ * the source locator
+ * @since 2.0
+ */
+ public IPersistableSourceLocator newSourceLocator(String identifier) throws CoreException;
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IStreamListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IStreamListener.java
index 50be60d37..a2ada5bb9 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IStreamListener.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IStreamListener.java
@@ -1,27 +1,27 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.model.IStreamMonitor;
-
-/**
- * A stream listener is notified of changes
- * to a stream monitor.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see IStreamMonitor
- */
-public interface IStreamListener {
- /**
- * Notifies this listener that text has been appended to
- * the given stream monitor.
- *
- * @param text the appended text
- * @param monitor the stream monitor to which text was appended
- */
- public void streamAppended(String text, IStreamMonitor monitor);
-}
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.model.IStreamMonitor;
+
+/**
+ * A stream listener is notified of changes
+ * to a stream monitor.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see IStreamMonitor
+ */
+public interface IStreamListener {
+ /**
+ * Notifies this listener that text has been appended to
+ * the given stream monitor.
+ *
+ * @param text the appended text
+ * @param monitor the stream monitor to which text was appended
+ */
+ public void streamAppended(String text, IStreamMonitor monitor);
+}
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 3aa4d5661..036596209 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
@@ -1,388 +1,388 @@
-package org.eclipse.debug.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.eclipse.debug.internal.core.DebugCoreMessages;
-import org.eclipse.debug.internal.core.LaunchManager;
-
-/**
- * A launch is the result of launching a debug session
- * and/or one or more system processes. This class provides
- * a public implementation of <code>ILaunch</code> for client
- * use.
- * <p>
- * Clients may instantiate this class. Clients may subclass this class.
- * Many of the methods in this class that are part of the <code>ILaunch</code> interface
- * are final. Clients that subclass this class are not intended to change the behavior
- * or implementation of the provided methods. Subclassing is only intended
- * to add additional information to a specific launch. For example, a client that
- * implements a launch object representing a Java launch might store a classpath
- * with the launch.
- * </p>
- * @see ILaunch
- * @see ILaunchManager
- */
-
-public class Launch extends PlatformObject implements ILaunch {
-
- /**
- * The debug targets associated with this
- * launch (the primary target is the first one
- * in this collection), or empty if
- * there are no debug targets.
- */
- private List fTargets= new ArrayList();
-
- /**
- * The configuration that was launched, or null.
- */
- private ILaunchConfiguration fConfiguration= null;
-
- /**
- * The system processes associated with
- * this launch, or empty if none.
- */
- private List fProcesses= new ArrayList();
-
- /**
- * The source locator to use in the debug session
- * or <code>null</code> if not supported.
- */
- private ISourceLocator fLocator= null;
-
- /**
- * The mode this launch was launched in.
- */
- private String fMode;
-
- /**
- * Table of client defined attributes
- */
- private HashMap fAttributes;
-
- /**
- * Flag indiating that change notification should
- * be suppressed. <code>true</code> until this
- * launch has been initialzied.
- */
- private boolean fSuppressChange = true;
-
- /**
- * 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) {
- setLaunchConfiguration(launchConfiguration);
- setSourceLocator(locator);
- setLaunchMode(mode);
- fSuppressChange = false;
- }
-
- /**
- * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
- */
- public final boolean canTerminate() {
- return !isTerminated();
- }
-
- /**
- * @see ILaunch#getChildren()
- */
- public final Object[] getChildren() {
- ArrayList children = new ArrayList(getDebugTargets0());
- children.addAll(getProcesses0());
- return children.toArray();
- }
-
- /**
- * @see ILaunch#getDebugTarget()
- */
- public final IDebugTarget getDebugTarget() {
- if (!getDebugTargets0().isEmpty()) {
- return (IDebugTarget)getDebugTargets0().get(0);
- }
- return null;
- }
-
- /**
- * Sets the configuration that was launched
- *
- * @param configuration the configuration that was launched
- */
- private void setLaunchConfiguration(ILaunchConfiguration configuration) {
- fConfiguration = configuration;
- }
-
- /**
- * @see ILaunch#getProcesses()
- */
- public final IProcess[] getProcesses() {
- return (IProcess[])getProcesses0().toArray(new IProcess[getProcesses0().size()]);
- }
-
- /**
- * Returns the processes associated with this
- * launch, in its internal form - a list.
- *
- * @return list of processes
- */
- protected List getProcesses0() {
- return fProcesses;
- }
-
- /**
- * @see ILaunch#getSourceLocator()
- */
- public final ISourceLocator getSourceLocator() {
- return fLocator;
- }
-
- /**
- * @see ILaunch#setSourceLocator(ISourceLocator)
- */
- public final void setSourceLocator(ISourceLocator sourceLocator) {
- fLocator = sourceLocator;
- }
-
- /**
- * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
- */
- public final boolean isTerminated() {
- if (getProcesses0().isEmpty() && getDebugTargets0().isEmpty()) {
- return false;
- }
-
- Iterator processes = getProcesses0().iterator();
- while (processes.hasNext()) {
- IProcess process = (IProcess)processes.next();
- if (!process.isTerminated()) {
- return false;
- }
- }
-
- Iterator targets = getDebugTargets0().iterator();
- while (targets.hasNext()) {
- IDebugTarget target = (IDebugTarget)targets.next();
- if (!(target.isTerminated() || target.isDisconnected())) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * @see org.eclipse.debug.core.model.ITerminate#terminate()
- */
- public final void terminate() throws DebugException {
- MultiStatus status=
- new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, DebugCoreMessages.getString("Launch.terminate_failed"), null); //$NON-NLS-1$
-
- // terminate the system processes
- Iterator processes = getProcesses0().iterator();
- while (processes.hasNext()) {
- IProcess process = (IProcess)processes.next();
- if (process.canTerminate()) {
- try {
- process.terminate();
- } catch (DebugException e) {
- status.merge(e.getStatus());
- }
- }
- }
-
- // terminate or disconnect debug target if it is still alive
- Iterator targets = getDebugTargets0().iterator();
- while (targets.hasNext()) {
- IDebugTarget target= (IDebugTarget)targets.next();
- if (target != null) {
- if (target.canTerminate()) {
- try {
- target.terminate();
- } catch (DebugException e) {
- status.merge(e.getStatus());
- }
- } else {
- if (target.canDisconnect()) {
- try {
- target.disconnect();
- } catch (DebugException de) {
- status.merge(de.getStatus());
- }
- }
- }
- }
- }
- if (status.isOK())
- return;
- IStatus[] children= status.getChildren();
- if (children.length == 1) {
- throw new DebugException(children[0]);
- } else {
- throw new DebugException(status);
- }
- }
-
- /**
- * @see ILaunch#getLaunchMode()
- */
- public final String getLaunchMode() {
- return fMode;
- }
-
- /**
- * Sets the mode in which this launch was
- * launched.
- *
- * @param mode the mode in which this launch
- * was launched - one of the constants defined
- * by <code>ILaunchManager</code>.
- */
- private void setLaunchMode(String mode) {
- fMode = mode;
- }
-
- /**
- * @see ILaunch#getLaunchConfiguration()
- */
- public ILaunchConfiguration getLaunchConfiguration() {
- return fConfiguration;
- }
-
- /**
- * @see ILaunch#setAttribute(String, String)
- */
- public void setAttribute(String key, String value) {
- if (fAttributes == null) {
- fAttributes = new HashMap(5);
- }
- fAttributes.put(key, value);
- }
-
- /**
- * @see ILaunch#getAttribute(String)
- */
- public String getAttribute(String key) {
- if (fAttributes == null) {
- return null;
- }
- return (String)fAttributes.get(key);
- }
-
- /**
- * @see ILaunch#getDebugTargets()
- */
- public IDebugTarget[] getDebugTargets() {
- return (IDebugTarget[])fTargets.toArray(new IDebugTarget[fTargets.size()]);
- }
-
- /**
- * Returns the debug targets associated with this
- * launch, in its internal form - a list
- *
- * @return list of debug targets
- */
- protected List getDebugTargets0() {
- return fTargets;
- }
-
- /**
- * @see ILaunch#addDebugTarget(IDebugTarget)
- */
- public final void addDebugTarget(IDebugTarget target) {
- if (target != null) {
- if (!getDebugTargets0().contains(target)) {
- getDebugTargets0().add(target);
- fireChanged();
- }
- }
- }
-
- /**
- * @see ILaunch#removeDebugTarget(IDebugTarget)
- */
- public final void removeDebugTarget(IDebugTarget target) {
- if (target != null) {
- if (getDebugTargets0().remove(target)) {
- fireChanged();
- }
- }
- }
-
- /**
- * @see ILaunch#addProcess(IProcess)
- */
- public final void addProcess(IProcess process) {
- if (process != null) {
- if (!getProcesses0().contains(process)) {
- getProcesses0().add(process);
- fireChanged();
- }
- }
- }
-
- /**
- * @see ILaunch#removeProcess(IProcess)
- */
- public final void removeProcess(IProcess process) {
- if (process != null) {
- if (getProcesses0().remove(process)) {
- fireChanged();
- }
- }
- }
-
- /**
- * Adds the given processes to this launch.
- *
- * @param processes processes to add
- */
- protected void addProcesses(IProcess[] processes) {
- if (processes != null) {
- for (int i = 0; i < processes.length; i++) {
- addProcess(processes[i]);
- fireChanged();
- }
- }
- }
-
- /**
- * Notifies listeners that this launch has changed.
- * Has no effect of this launch has not yet been
- * properly created/initialized.
- */
- protected void fireChanged() {
- if (!fSuppressChange) {
- ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).fireUpdate(this, LaunchManager.CHANGED);
- }
- }
-
- /**
- * @see ILaunch#hasChildren()
- */
- public boolean hasChildren() {
- return getProcesses0().size() > 0 || (getDebugTargets0().size() > 0);
- }
-
-}
-
-
+package org.eclipse.debug.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.internal.core.DebugCoreMessages;
+import org.eclipse.debug.internal.core.LaunchManager;
+
+/**
+ * A launch is the result of launching a debug session
+ * and/or one or more system processes. This class provides
+ * a public implementation of <code>ILaunch</code> for client
+ * use.
+ * <p>
+ * Clients may instantiate this class. Clients may subclass this class.
+ * Many of the methods in this class that are part of the <code>ILaunch</code> interface
+ * are final. Clients that subclass this class are not intended to change the behavior
+ * or implementation of the provided methods. Subclassing is only intended
+ * to add additional information to a specific launch. For example, a client that
+ * implements a launch object representing a Java launch might store a classpath
+ * with the launch.
+ * </p>
+ * @see ILaunch
+ * @see ILaunchManager
+ */
+
+public class Launch extends PlatformObject implements ILaunch {
+
+ /**
+ * The debug targets associated with this
+ * launch (the primary target is the first one
+ * in this collection), or empty if
+ * there are no debug targets.
+ */
+ private List fTargets= new ArrayList();
+
+ /**
+ * The configuration that was launched, or null.
+ */
+ private ILaunchConfiguration fConfiguration= null;
+
+ /**
+ * The system processes associated with
+ * this launch, or empty if none.
+ */
+ private List fProcesses= new ArrayList();
+
+ /**
+ * The source locator to use in the debug session
+ * or <code>null</code> if not supported.
+ */
+ private ISourceLocator fLocator= null;
+
+ /**
+ * The mode this launch was launched in.
+ */
+ private String fMode;
+
+ /**
+ * Table of client defined attributes
+ */
+ private HashMap fAttributes;
+
+ /**
+ * Flag indiating that change notification should
+ * be suppressed. <code>true</code> until this
+ * launch has been initialzied.
+ */
+ private boolean fSuppressChange = true;
+
+ /**
+ * 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) {
+ setLaunchConfiguration(launchConfiguration);
+ setSourceLocator(locator);
+ setLaunchMode(mode);
+ fSuppressChange = false;
+ }
+
+ /**
+ * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
+ */
+ public final boolean canTerminate() {
+ return !isTerminated();
+ }
+
+ /**
+ * @see ILaunch#getChildren()
+ */
+ public final Object[] getChildren() {
+ ArrayList children = new ArrayList(getDebugTargets0());
+ children.addAll(getProcesses0());
+ return children.toArray();
+ }
+
+ /**
+ * @see ILaunch#getDebugTarget()
+ */
+ public final IDebugTarget getDebugTarget() {
+ if (!getDebugTargets0().isEmpty()) {
+ return (IDebugTarget)getDebugTargets0().get(0);
+ }
+ return null;
+ }
+
+ /**
+ * Sets the configuration that was launched
+ *
+ * @param configuration the configuration that was launched
+ */
+ private void setLaunchConfiguration(ILaunchConfiguration configuration) {
+ fConfiguration = configuration;
+ }
+
+ /**
+ * @see ILaunch#getProcesses()
+ */
+ public final IProcess[] getProcesses() {
+ return (IProcess[])getProcesses0().toArray(new IProcess[getProcesses0().size()]);
+ }
+
+ /**
+ * Returns the processes associated with this
+ * launch, in its internal form - a list.
+ *
+ * @return list of processes
+ */
+ protected List getProcesses0() {
+ return fProcesses;
+ }
+
+ /**
+ * @see ILaunch#getSourceLocator()
+ */
+ public final ISourceLocator getSourceLocator() {
+ return fLocator;
+ }
+
+ /**
+ * @see ILaunch#setSourceLocator(ISourceLocator)
+ */
+ public final void setSourceLocator(ISourceLocator sourceLocator) {
+ fLocator = sourceLocator;
+ }
+
+ /**
+ * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
+ */
+ public final boolean isTerminated() {
+ if (getProcesses0().isEmpty() && getDebugTargets0().isEmpty()) {
+ return false;
+ }
+
+ Iterator processes = getProcesses0().iterator();
+ while (processes.hasNext()) {
+ IProcess process = (IProcess)processes.next();
+ if (!process.isTerminated()) {
+ return false;
+ }
+ }
+
+ Iterator targets = getDebugTargets0().iterator();
+ while (targets.hasNext()) {
+ IDebugTarget target = (IDebugTarget)targets.next();
+ if (!(target.isTerminated() || target.isDisconnected())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @see org.eclipse.debug.core.model.ITerminate#terminate()
+ */
+ public final void terminate() throws DebugException {
+ MultiStatus status=
+ new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, DebugCoreMessages.getString("Launch.terminate_failed"), null); //$NON-NLS-1$
+
+ // terminate the system processes
+ Iterator processes = getProcesses0().iterator();
+ while (processes.hasNext()) {
+ IProcess process = (IProcess)processes.next();
+ if (process.canTerminate()) {
+ try {
+ process.terminate();
+ } catch (DebugException e) {
+ status.merge(e.getStatus());
+ }
+ }
+ }
+
+ // terminate or disconnect debug target if it is still alive
+ Iterator targets = getDebugTargets0().iterator();
+ while (targets.hasNext()) {
+ IDebugTarget target= (IDebugTarget)targets.next();
+ if (target != null) {
+ if (target.canTerminate()) {
+ try {
+ target.terminate();
+ } catch (DebugException e) {
+ status.merge(e.getStatus());
+ }
+ } else {
+ if (target.canDisconnect()) {
+ try {
+ target.disconnect();
+ } catch (DebugException de) {
+ status.merge(de.getStatus());
+ }
+ }
+ }
+ }
+ }
+ if (status.isOK())
+ return;
+ IStatus[] children= status.getChildren();
+ if (children.length == 1) {
+ throw new DebugException(children[0]);
+ } else {
+ throw new DebugException(status);
+ }
+ }
+
+ /**
+ * @see ILaunch#getLaunchMode()
+ */
+ public final String getLaunchMode() {
+ return fMode;
+ }
+
+ /**
+ * Sets the mode in which this launch was
+ * launched.
+ *
+ * @param mode the mode in which this launch
+ * was launched - one of the constants defined
+ * by <code>ILaunchManager</code>.
+ */
+ private void setLaunchMode(String mode) {
+ fMode = mode;
+ }
+
+ /**
+ * @see ILaunch#getLaunchConfiguration()
+ */
+ public ILaunchConfiguration getLaunchConfiguration() {
+ return fConfiguration;
+ }
+
+ /**
+ * @see ILaunch#setAttribute(String, String)
+ */
+ public void setAttribute(String key, String value) {
+ if (fAttributes == null) {
+ fAttributes = new HashMap(5);
+ }
+ fAttributes.put(key, value);
+ }
+
+ /**
+ * @see ILaunch#getAttribute(String)
+ */
+ public String getAttribute(String key) {
+ if (fAttributes == null) {
+ return null;
+ }
+ return (String)fAttributes.get(key);
+ }
+
+ /**
+ * @see ILaunch#getDebugTargets()
+ */
+ public IDebugTarget[] getDebugTargets() {
+ return (IDebugTarget[])fTargets.toArray(new IDebugTarget[fTargets.size()]);
+ }
+
+ /**
+ * Returns the debug targets associated with this
+ * launch, in its internal form - a list
+ *
+ * @return list of debug targets
+ */
+ protected List getDebugTargets0() {
+ return fTargets;
+ }
+
+ /**
+ * @see ILaunch#addDebugTarget(IDebugTarget)
+ */
+ public final void addDebugTarget(IDebugTarget target) {
+ if (target != null) {
+ if (!getDebugTargets0().contains(target)) {
+ getDebugTargets0().add(target);
+ fireChanged();
+ }
+ }
+ }
+
+ /**
+ * @see ILaunch#removeDebugTarget(IDebugTarget)
+ */
+ public final void removeDebugTarget(IDebugTarget target) {
+ if (target != null) {
+ if (getDebugTargets0().remove(target)) {
+ fireChanged();
+ }
+ }
+ }
+
+ /**
+ * @see ILaunch#addProcess(IProcess)
+ */
+ public final void addProcess(IProcess process) {
+ if (process != null) {
+ if (!getProcesses0().contains(process)) {
+ getProcesses0().add(process);
+ fireChanged();
+ }
+ }
+ }
+
+ /**
+ * @see ILaunch#removeProcess(IProcess)
+ */
+ public final void removeProcess(IProcess process) {
+ if (process != null) {
+ if (getProcesses0().remove(process)) {
+ fireChanged();
+ }
+ }
+ }
+
+ /**
+ * Adds the given processes to this launch.
+ *
+ * @param processes processes to add
+ */
+ protected void addProcesses(IProcess[] processes) {
+ if (processes != null) {
+ for (int i = 0; i < processes.length; i++) {
+ addProcess(processes[i]);
+ fireChanged();
+ }
+ }
+ }
+
+ /**
+ * Notifies listeners that this launch has changed.
+ * Has no effect of this launch has not yet been
+ * properly created/initialized.
+ */
+ protected void fireChanged() {
+ if (!fSuppressChange) {
+ ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).fireUpdate(this, LaunchManager.CHANGED);
+ }
+ }
+
+ /**
+ * @see ILaunch#hasChildren()
+ */
+ public boolean hasChildren() {
+ return getProcesses0().size() > 0 || (getDebugTargets0().size() > 0);
+ }
+
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
index fec369742..b6bab171a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
@@ -1,257 +1,257 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.internal.core.DebugCoreMessages;
-
-/**
- * Abstract implementation of a breakpoint. This class is
- * intended to be subclassed by implementations
- * of breakpoints.
- *
- * @see IBreakpoint
- * @since 2.0
- */
-
-public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
-
- /**
- * Underlying marker.
- */
- private IMarker fMarker= null;
-
- /**
- * @see IBreakpoint#setMarker(IMarker)
- */
- public void setMarker(IMarker marker) throws CoreException {
- fMarker= marker;
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object item) {
- if (item instanceof IBreakpoint) {
- return getMarker().equals(((IBreakpoint)item).getMarker());
- }
- return false;
- }
-
- /**
- * @see Object#hashCode()
- */
- public int hashCode() {
- return getMarker().hashCode();
- }
-
- /**
- * @see IBreakpoint#setEnabled(boolean)
- */
- public void setEnabled(boolean enabled) throws CoreException {
- if (enabled != isEnabled()) {
- setAttribute(ENABLED, enabled);
- }
- }
-
- /**
- * @see IBreakpoint#isEnabled()
- */
- public boolean isEnabled() throws CoreException {
- return getMarker().getAttribute(ENABLED, false);
- }
-
- /**
- * @see IBreakpoint#isRegistered()
- */
- public boolean isRegistered() throws CoreException {
- return getMarker().getAttribute(REGISTERED, true);
- }
-
- /**
- * @see IBreakpoint#setRegistered(boolean)
- */
- public void setRegistered(boolean registered) throws CoreException {
- if (isRegistered() != registered) {
- setAttribute(REGISTERED, registered);
- IBreakpointManager mgr = DebugPlugin.getDefault().getBreakpointManager();
- if (registered) {
- mgr.addBreakpoint(this);
- } else {
- mgr.removeBreakpoint(this, false);
- }
- }
- }
-
- /**
- * @see IBreakpoint#delete()
- */
- public void delete() throws CoreException {
- getMarker().delete();
- }
-
- /**
- * @see IBreakpoint#getMarker()
- */
- public IMarker getMarker() {
- return fMarker;
- }
-
- /**
- * @see IBreakpoint#isPersisted()
- */
- public boolean isPersisted() throws CoreException {
- return getMarker().getAttribute(PERSISTED, true);
- }
-
- /**
- * @see IBreakpoint#setPersisted(boolean)
- */
- public void setPersisted(boolean persisted) throws CoreException {
- if (isPersisted() != persisted) {
- setAttribute(PERSISTED, persisted);
- }
- }
-
- /**
- * Convenience method to set the given boolean attribute of
- * this breakpoint's underlying marker in a workspace
- * runnable. Setting marker attributes in a workspace runnable
- * prevents deadlock.
- *
- * @param attributeName attribute name
- * @param value attribute value
- * @exception CoreException is setting the attribute fails
- * @see IMarker#setAttribute(java.lang.String, boolean)
- */
- protected void setAttribute(final String attributeName, final boolean value) throws CoreException {
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttribute(attributeName, value);
- }
- };
-
- workspace.run(runnable, null);
- }
-
- /**
- * Convenience method to set the given integer attribute of
- * this breakpoint's underlying marker in a workspace
- * runnable. Setting marker attributes in a workspace runnable
- * prevents deadlock.
- *
- * @param attributeName attribute name
- * @param value attribute value
- * @exception CoreException is setting the attribute fails
- * @see IMarker#setAttribute(java.lang.String, int)
- */
- protected void setAttribute(final String attributeName, final int value) throws CoreException {
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttribute(attributeName, value);
- }
- };
-
- workspace.run(runnable, null);
- }
-
- /**
- * Convenience method to set the given attribute of
- * this breakpoint's underlying marker in a workspace
- * runnable. Setting marker attributes in a workspace runnable
- * prevents deadlock.
- *
- * @param attributeName attribute name
- * @param value attribute value
- * @exception CoreException is setting the attribute fails
- * @see IMarker#setAttribute(java.lang.String, java.lang.Object)
- */
- protected void setAttribute(final String attributeName, final Object value) throws CoreException {
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttribute(attributeName, value);
- }
- };
-
- workspace.run(runnable, null);
- }
-
- /**
- * Convenience method to set the given attributes of
- * this breakpoint's underlying marker in a workspace
- * runnable. Setting marker attributes in a workspace runnable
- * prevents deadlock.
- *
- * @param attributeNames attribute names
- * @param values attribute values
- * @exception CoreException is setting the attributes fails
- * @see IMarker#setAttributes(java.lang.String[], java.lang.Object[])
- */
- protected void setAttributes(final String[] attributeNames, final Object[] values) throws CoreException {
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttributes(attributeNames, values);
- }
- };
-
- workspace.run(runnable, null);
- }
-
- /**
- * Convenience method to set the attributes of
- * this breakpoint's underlying marker in a workspace
- * runnable. Setting marker attributes in a workspace runnable
- * prevents deadlock.
- *
- * @param attributes attribute map
- * @exception CoreException is setting the attributes fails
- * @see IMarker#setAttributes(java.util.Map)
- */
- protected void setAttributes(final Map attributes) throws CoreException{
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttributes(attributes);
- }
- };
-
- workspace.run(runnable, null);
- }
-
- /**
- * Returns the marker associated with this breakpoint.
- *
- * @return breakpoint marker
- * @exception DebugException if no marker is associated with
- * this breakpoint or the associated marker does not exist
- */
- protected IMarker ensureMarker() throws DebugException {
- IMarker m = getMarker();
- if (m == null || !m.exists()) {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED,
- DebugCoreMessages.getString("Breakpoint.no_associated_marker"), null)); //$NON-NLS-1$
- }
- return m;
- }
-}
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.internal.core.DebugCoreMessages;
+
+/**
+ * Abstract implementation of a breakpoint. This class is
+ * intended to be subclassed by implementations
+ * of breakpoints.
+ *
+ * @see IBreakpoint
+ * @since 2.0
+ */
+
+public abstract class Breakpoint extends PlatformObject implements IBreakpoint {
+
+ /**
+ * Underlying marker.
+ */
+ private IMarker fMarker= null;
+
+ /**
+ * @see IBreakpoint#setMarker(IMarker)
+ */
+ public void setMarker(IMarker marker) throws CoreException {
+ fMarker= marker;
+ }
+
+ /**
+ * @see Object#equals(Object)
+ */
+ public boolean equals(Object item) {
+ if (item instanceof IBreakpoint) {
+ return getMarker().equals(((IBreakpoint)item).getMarker());
+ }
+ return false;
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode() {
+ return getMarker().hashCode();
+ }
+
+ /**
+ * @see IBreakpoint#setEnabled(boolean)
+ */
+ public void setEnabled(boolean enabled) throws CoreException {
+ if (enabled != isEnabled()) {
+ setAttribute(ENABLED, enabled);
+ }
+ }
+
+ /**
+ * @see IBreakpoint#isEnabled()
+ */
+ public boolean isEnabled() throws CoreException {
+ return getMarker().getAttribute(ENABLED, false);
+ }
+
+ /**
+ * @see IBreakpoint#isRegistered()
+ */
+ public boolean isRegistered() throws CoreException {
+ return getMarker().getAttribute(REGISTERED, true);
+ }
+
+ /**
+ * @see IBreakpoint#setRegistered(boolean)
+ */
+ public void setRegistered(boolean registered) throws CoreException {
+ if (isRegistered() != registered) {
+ setAttribute(REGISTERED, registered);
+ IBreakpointManager mgr = DebugPlugin.getDefault().getBreakpointManager();
+ if (registered) {
+ mgr.addBreakpoint(this);
+ } else {
+ mgr.removeBreakpoint(this, false);
+ }
+ }
+ }
+
+ /**
+ * @see IBreakpoint#delete()
+ */
+ public void delete() throws CoreException {
+ getMarker().delete();
+ }
+
+ /**
+ * @see IBreakpoint#getMarker()
+ */
+ public IMarker getMarker() {
+ return fMarker;
+ }
+
+ /**
+ * @see IBreakpoint#isPersisted()
+ */
+ public boolean isPersisted() throws CoreException {
+ return getMarker().getAttribute(PERSISTED, true);
+ }
+
+ /**
+ * @see IBreakpoint#setPersisted(boolean)
+ */
+ public void setPersisted(boolean persisted) throws CoreException {
+ if (isPersisted() != persisted) {
+ setAttribute(PERSISTED, persisted);
+ }
+ }
+
+ /**
+ * Convenience method to set the given boolean attribute of
+ * this breakpoint's underlying marker in a workspace
+ * runnable. Setting marker attributes in a workspace runnable
+ * prevents deadlock.
+ *
+ * @param attributeName attribute name
+ * @param value attribute value
+ * @exception CoreException is setting the attribute fails
+ * @see IMarker#setAttribute(java.lang.String, boolean)
+ */
+ protected void setAttribute(final String attributeName, final boolean value) throws CoreException {
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ensureMarker().setAttribute(attributeName, value);
+ }
+ };
+
+ workspace.run(runnable, null);
+ }
+
+ /**
+ * Convenience method to set the given integer attribute of
+ * this breakpoint's underlying marker in a workspace
+ * runnable. Setting marker attributes in a workspace runnable
+ * prevents deadlock.
+ *
+ * @param attributeName attribute name
+ * @param value attribute value
+ * @exception CoreException is setting the attribute fails
+ * @see IMarker#setAttribute(java.lang.String, int)
+ */
+ protected void setAttribute(final String attributeName, final int value) throws CoreException {
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ensureMarker().setAttribute(attributeName, value);
+ }
+ };
+
+ workspace.run(runnable, null);
+ }
+
+ /**
+ * Convenience method to set the given attribute of
+ * this breakpoint's underlying marker in a workspace
+ * runnable. Setting marker attributes in a workspace runnable
+ * prevents deadlock.
+ *
+ * @param attributeName attribute name
+ * @param value attribute value
+ * @exception CoreException is setting the attribute fails
+ * @see IMarker#setAttribute(java.lang.String, java.lang.Object)
+ */
+ protected void setAttribute(final String attributeName, final Object value) throws CoreException {
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ensureMarker().setAttribute(attributeName, value);
+ }
+ };
+
+ workspace.run(runnable, null);
+ }
+
+ /**
+ * Convenience method to set the given attributes of
+ * this breakpoint's underlying marker in a workspace
+ * runnable. Setting marker attributes in a workspace runnable
+ * prevents deadlock.
+ *
+ * @param attributeNames attribute names
+ * @param values attribute values
+ * @exception CoreException is setting the attributes fails
+ * @see IMarker#setAttributes(java.lang.String[], java.lang.Object[])
+ */
+ protected void setAttributes(final String[] attributeNames, final Object[] values) throws CoreException {
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ensureMarker().setAttributes(attributeNames, values);
+ }
+ };
+
+ workspace.run(runnable, null);
+ }
+
+ /**
+ * Convenience method to set the attributes of
+ * this breakpoint's underlying marker in a workspace
+ * runnable. Setting marker attributes in a workspace runnable
+ * prevents deadlock.
+ *
+ * @param attributes attribute map
+ * @exception CoreException is setting the attributes fails
+ * @see IMarker#setAttributes(java.util.Map)
+ */
+ protected void setAttributes(final Map attributes) throws CoreException{
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ensureMarker().setAttributes(attributes);
+ }
+ };
+
+ workspace.run(runnable, null);
+ }
+
+ /**
+ * Returns the marker associated with this breakpoint.
+ *
+ * @return breakpoint marker
+ * @exception DebugException if no marker is associated with
+ * this breakpoint or the associated marker does not exist
+ */
+ protected IMarker ensureMarker() throws DebugException {
+ IMarker m = getMarker();
+ if (m == null || !m.exists()) {
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED,
+ DebugCoreMessages.getString("Breakpoint.no_associated_marker"), null)); //$NON-NLS-1$
+ }
+ return m;
+ }
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java
index aeac73c34..54ec0139f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java
@@ -1,215 +1,215 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugPlugin;
-
-/**
- * A breakpoint is capable of suspending the execution of a
- * program at a specific location when a program is running
- * in debug mode. Each breakpoint has an associated marker which
- * stores and persists all attributes associated with a breakpoint.
- * <p>
- * A breakpoint is defined in two parts:
- * <ol>
- * <li>By an extension of kind <code>"org.eclipse.debug.core.breakpoints"</code></li>
- * <li>By a marker definition that corresponds to the above breakpoint extension</li>
- * </ol>
- * <p>
- * For example, following is a definition of corresponding breakpoint
- * and breakpoint marker definitions. Note that the <code>markerType</code>
- * attribute defined by the breakpoint extension corresponds to the
- * type of the marker definition.
- * <pre>
- * &lt;extension point="org.eclipse.debug.core.breakpoints"&gt;
- * &lt;breakpoint
- * id="com.example.Breakpoint"
- * class="com.example.Breakpoint"
- * markerType="com.example.BreakpointMarker"&gt;
- * &lt;/breakpoint&gt;
- * &lt;/extension&gt;
- * &lt;extension point="org.eclipse.core.resources.markers"&gt;
- * &lt;marker
- * id="com.example.BreakpointMarker"
- * super type="org.eclipse.debug.core.breakpointMarker"
- * attribute name ="exampleAttribute"&gt;
- * &lt;/marker&gt;
- * &lt;/extension&gt;
- * </pre>
- * <p>
- * The breakpoint manager instantiates persisted breakpoints by
- * traversing all markers that are a subtype of
- * <code>"org.eclipse.debug.core.breakpointMarker"</code>, and
- * instantiating the class defined by the <code>class</code> attribute
- * on the associated breakpoint extension. The method <code>setMarker</code>
- * is then called to associate a marker with the breakpoint.
- * </p>
- * <p>
- * Breakpoints may or may not be registered with the breakpoint manager, and
- * are persisted and restored as such. Since marker definitions only allow
- * all or none of a specific marker type to be persisted, breakpoints define
- * a <code>PERSISTED</code> attribute for selective persistence of breakpoints
- * of the same type.
- * </p>
- *
- * @since 2.0
- */
-
-public interface IBreakpoint extends IAdaptable {
-
- /**
- * Root breakpoint marker type
- * (value <code>"org.eclipse.debug.core.breakpoint"</code>).
- */
- public static final String BREAKPOINT_MARKER = DebugPlugin.getUniqueIdentifier() + ".breakpointMarker"; //$NON-NLS-1$
-
- /**
- * Line breakpoint marker type
- * (value <code>"org.eclipse.debug.core.lineBreakpoint"</code>).
- */
- public static final String LINE_BREAKPOINT_MARKER = DebugPlugin.getUniqueIdentifier() + ".lineBreakpointMarker"; //$NON-NLS-1$
-
- /**
- * Enabled breakpoint marker attribute (value <code>"org.eclipse.debug.core.enabled"</code>).
- * The attribute is a <code>boolean</code> corresponding to the
- * enabled state of a breakpoint.
- *
- * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
- */
- public static final String ENABLED= "org.eclipse.debug.core.enabled"; //$NON-NLS-1$
-
- /**
- * Debug model identifier breakpoint marker attribute (value <code>"org.eclipse.debug.core.id"</code>).
- * The attribute is a <code>String</code> corresponding to the
- * identifier of the debug model a breakpoint is associated with.
- */
- public static final String ID= "org.eclipse.debug.core.id"; //$NON-NLS-1$
-
- /**
- * Registered breakpoint marker attribute (value <code>"org.eclipse.debug.core.registered"</code>).
- * The attribute is a <code>boolean</code> corresponding to
- * whether a breakpoint has been registered with the breakpoint manager.
- *
- * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
- */
- public static final String REGISTERED= "org.eclipse.debug.core.registered"; //$NON-NLS-1$
-
- /**
- * Persisted breakpoint marker attribute (value <code>"org.eclipse.debug.core.persisted"</code>).
- * The attribute is a <code>boolean</code> corresponding to
- * whether a breakpoint is to be persisted accross workspace
- * invocations.
- *
- * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
- */
- public static final String PERSISTED= "org.eclipse.debug.core.persisted"; //$NON-NLS-1$
-
- /**
- * Deletes this breakpoint's underlying marker, and removes
- * this breakpoint from the breakpoint manager.
- *
- * @exception CoreException if unable to delete this breakpoint's
- * underlying marker
- */
- public void delete() throws CoreException;
-
- /**
- * Returns the marker associated with this breakpoint, or
- * <code>null</code> if no marker is associated with this breakpoint.
- *
- * @return associated marker, or <code>null</code> if there is
- * no associated marker.
- */
- public IMarker getMarker();
- /**
- * Sets the marker associated with this breakpoint. This method is
- * called once at breakpoint creation.
- *
- * @param marker the marker to associate with this breakpoint
- * @exception CoreException if an error occurs accessing the marker
- */
- public void setMarker(IMarker marker) throws CoreException;
- /**
- * Returns the identifier of the debug model this breakpoint is
- * associated with.
- *
- * @return the identifier of the debug model this breakpoint is
- * associated with
- */
- public String getModelIdentifier();
- /**
- * Returns whether this breakpoint is enabled
- *
- * @return whether this breakpoint is enabled
- * @exception CoreException if unable to access the associated
- * attribute from this breakpoint's underlying marker
- */
- public boolean isEnabled() throws CoreException;
- /**
- * Sets the enabled state of this breakpoint. This has no effect
- * if the current enabled state is the same as specified by the
- * enabled parameter.
- *
- * @param enabled whether this breakpoint should be enabled
- * @exception CoreException if unable to set the associated attribute on
- * this breakpoint's underlying marker.
- */
- public void setEnabled(boolean enabled) throws CoreException;
-
- /**
- * Returns whether this breakpoint is currently registered with
- * the breakpoint manager.
- *
- * @return whether this breakpoint is currently registered with
- * the breakpoint manager
- * @exception CoreException if unable to access the associated
- * attribute on this breakpoint's underlying marker
- */
- public boolean isRegistered() throws CoreException;
-
- /**
- * Sets whether this breakpoint is currently registered with the
- * breakpoint manager.
- *
- * @param registered whether this breakpoint is registered with the
- * breakpoint manager
- * @exception CoreException if unable to set the associated attribute
- * on this breakpoint's underlying marker.
- */
- public void setRegistered(boolean registered) throws CoreException;
-
- /**
- * Returns whether this breakpoint is to be persisted across
- * workspace invocations, or when a project is closed and re-opened.
- * Since marker definitions only allow all/none of a specific type
- * of marker to be persisted (rather than selected markers of a
- * specific type), breakpoints define this functionality.
- *
- * @return whether this breakpoint is to be persisted
- * @exception CoreException if unable to access the associated attribute
- * on this breakpoint's underlying marker
- */
- public boolean isPersisted() throws CoreException;
-
- /**
- * Sets whether this breakpoint is to be persisted across
- * workspace invocations, or when a project is closed and re-opened.
- * Since marker definitions only allow all/none of a specific type of
- * marker to be persisted (rather than selected markers of a specific
- * type), breakpoints define this functionality. Has no effect if this
- * breakpoint's marker definition is defined as not persisted.
- *
- * @param persist whether this breakpoint is to be persisted
- * @exception CoreException if unable to set the associated attribute on
- * this breakpoint's underlying marker.
- */
- public void setPersisted(boolean registered) throws CoreException;
-}
-
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugPlugin;
+
+/**
+ * A breakpoint is capable of suspending the execution of a
+ * program at a specific location when a program is running
+ * in debug mode. Each breakpoint has an associated marker which
+ * stores and persists all attributes associated with a breakpoint.
+ * <p>
+ * A breakpoint is defined in two parts:
+ * <ol>
+ * <li>By an extension of kind <code>"org.eclipse.debug.core.breakpoints"</code></li>
+ * <li>By a marker definition that corresponds to the above breakpoint extension</li>
+ * </ol>
+ * <p>
+ * For example, following is a definition of corresponding breakpoint
+ * and breakpoint marker definitions. Note that the <code>markerType</code>
+ * attribute defined by the breakpoint extension corresponds to the
+ * type of the marker definition.
+ * <pre>
+ * &lt;extension point="org.eclipse.debug.core.breakpoints"&gt;
+ * &lt;breakpoint
+ * id="com.example.Breakpoint"
+ * class="com.example.Breakpoint"
+ * markerType="com.example.BreakpointMarker"&gt;
+ * &lt;/breakpoint&gt;
+ * &lt;/extension&gt;
+ * &lt;extension point="org.eclipse.core.resources.markers"&gt;
+ * &lt;marker
+ * id="com.example.BreakpointMarker"
+ * super type="org.eclipse.debug.core.breakpointMarker"
+ * attribute name ="exampleAttribute"&gt;
+ * &lt;/marker&gt;
+ * &lt;/extension&gt;
+ * </pre>
+ * <p>
+ * The breakpoint manager instantiates persisted breakpoints by
+ * traversing all markers that are a subtype of
+ * <code>"org.eclipse.debug.core.breakpointMarker"</code>, and
+ * instantiating the class defined by the <code>class</code> attribute
+ * on the associated breakpoint extension. The method <code>setMarker</code>
+ * is then called to associate a marker with the breakpoint.
+ * </p>
+ * <p>
+ * Breakpoints may or may not be registered with the breakpoint manager, and
+ * are persisted and restored as such. Since marker definitions only allow
+ * all or none of a specific marker type to be persisted, breakpoints define
+ * a <code>PERSISTED</code> attribute for selective persistence of breakpoints
+ * of the same type.
+ * </p>
+ *
+ * @since 2.0
+ */
+
+public interface IBreakpoint extends IAdaptable {
+
+ /**
+ * Root breakpoint marker type
+ * (value <code>"org.eclipse.debug.core.breakpoint"</code>).
+ */
+ public static final String BREAKPOINT_MARKER = DebugPlugin.getUniqueIdentifier() + ".breakpointMarker"; //$NON-NLS-1$
+
+ /**
+ * Line breakpoint marker type
+ * (value <code>"org.eclipse.debug.core.lineBreakpoint"</code>).
+ */
+ public static final String LINE_BREAKPOINT_MARKER = DebugPlugin.getUniqueIdentifier() + ".lineBreakpointMarker"; //$NON-NLS-1$
+
+ /**
+ * Enabled breakpoint marker attribute (value <code>"org.eclipse.debug.core.enabled"</code>).
+ * The attribute is a <code>boolean</code> corresponding to the
+ * enabled state of a breakpoint.
+ *
+ * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
+ */
+ public static final String ENABLED= "org.eclipse.debug.core.enabled"; //$NON-NLS-1$
+
+ /**
+ * Debug model identifier breakpoint marker attribute (value <code>"org.eclipse.debug.core.id"</code>).
+ * The attribute is a <code>String</code> corresponding to the
+ * identifier of the debug model a breakpoint is associated with.
+ */
+ public static final String ID= "org.eclipse.debug.core.id"; //$NON-NLS-1$
+
+ /**
+ * Registered breakpoint marker attribute (value <code>"org.eclipse.debug.core.registered"</code>).
+ * The attribute is a <code>boolean</code> corresponding to
+ * whether a breakpoint has been registered with the breakpoint manager.
+ *
+ * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
+ */
+ public static final String REGISTERED= "org.eclipse.debug.core.registered"; //$NON-NLS-1$
+
+ /**
+ * Persisted breakpoint marker attribute (value <code>"org.eclipse.debug.core.persisted"</code>).
+ * The attribute is a <code>boolean</code> corresponding to
+ * whether a breakpoint is to be persisted accross workspace
+ * invocations.
+ *
+ * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
+ */
+ public static final String PERSISTED= "org.eclipse.debug.core.persisted"; //$NON-NLS-1$
+
+ /**
+ * Deletes this breakpoint's underlying marker, and removes
+ * this breakpoint from the breakpoint manager.
+ *
+ * @exception CoreException if unable to delete this breakpoint's
+ * underlying marker
+ */
+ public void delete() throws CoreException;
+
+ /**
+ * Returns the marker associated with this breakpoint, or
+ * <code>null</code> if no marker is associated with this breakpoint.
+ *
+ * @return associated marker, or <code>null</code> if there is
+ * no associated marker.
+ */
+ public IMarker getMarker();
+ /**
+ * Sets the marker associated with this breakpoint. This method is
+ * called once at breakpoint creation.
+ *
+ * @param marker the marker to associate with this breakpoint
+ * @exception CoreException if an error occurs accessing the marker
+ */
+ public void setMarker(IMarker marker) throws CoreException;
+ /**
+ * Returns the identifier of the debug model this breakpoint is
+ * associated with.
+ *
+ * @return the identifier of the debug model this breakpoint is
+ * associated with
+ */
+ public String getModelIdentifier();
+ /**
+ * Returns whether this breakpoint is enabled
+ *
+ * @return whether this breakpoint is enabled
+ * @exception CoreException if unable to access the associated
+ * attribute from this breakpoint's underlying marker
+ */
+ public boolean isEnabled() throws CoreException;
+ /**
+ * Sets the enabled state of this breakpoint. This has no effect
+ * if the current enabled state is the same as specified by the
+ * enabled parameter.
+ *
+ * @param enabled whether this breakpoint should be enabled
+ * @exception CoreException if unable to set the associated attribute on
+ * this breakpoint's underlying marker.
+ */
+ public void setEnabled(boolean enabled) throws CoreException;
+
+ /**
+ * Returns whether this breakpoint is currently registered with
+ * the breakpoint manager.
+ *
+ * @return whether this breakpoint is currently registered with
+ * the breakpoint manager
+ * @exception CoreException if unable to access the associated
+ * attribute on this breakpoint's underlying marker
+ */
+ public boolean isRegistered() throws CoreException;
+
+ /**
+ * Sets whether this breakpoint is currently registered with the
+ * breakpoint manager.
+ *
+ * @param registered whether this breakpoint is registered with the
+ * breakpoint manager
+ * @exception CoreException if unable to set the associated attribute
+ * on this breakpoint's underlying marker.
+ */
+ public void setRegistered(boolean registered) throws CoreException;
+
+ /**
+ * Returns whether this breakpoint is to be persisted across
+ * workspace invocations, or when a project is closed and re-opened.
+ * Since marker definitions only allow all/none of a specific type
+ * of marker to be persisted (rather than selected markers of a
+ * specific type), breakpoints define this functionality.
+ *
+ * @return whether this breakpoint is to be persisted
+ * @exception CoreException if unable to access the associated attribute
+ * on this breakpoint's underlying marker
+ */
+ public boolean isPersisted() throws CoreException;
+
+ /**
+ * Sets whether this breakpoint is to be persisted across
+ * workspace invocations, or when a project is closed and re-opened.
+ * Since marker definitions only allow all/none of a specific type of
+ * marker to be persisted (rather than selected markers of a specific
+ * type), breakpoints define this functionality. Has no effect if this
+ * breakpoint's marker definition is defined as not persisted.
+ *
+ * @param persist whether this breakpoint is to be persisted
+ * @exception CoreException if unable to set the associated attribute on
+ * this breakpoint's underlying marker.
+ */
+ public void setPersisted(boolean registered) throws CoreException;
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java
index 7c65af84d..64836c3c2 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugElement.java
@@ -1,57 +1,57 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.ILaunch;
-
-/**
- * A debug element represents an artifact in a program being
- * debugged.
- * <p>
- * Some methods on debug elements require communication
- * with the target program. Such methods may throw a <code>DebugException</code>
- * with a status code of <code>TARGET_REQUEST_FAILED</code>
- * when unable to complete a request due to a failure on the target.
- * Methods that require communication with the target program or require
- * the target to be in a specific state (for example, suspended), are declared
- * as such.
- * </p>
- * <p>
- * Debug elements are language independent. However, language specific
- * features can be made available via the adapter mechanism provided by
- * <code>IAdaptable</code>, or by extending the debug element interfaces.
- * A debug model is responsible for declaring any special adapters
- * its debug elements implement.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- */
-public interface IDebugElement extends IAdaptable {
-
- /**
- * Returns the unique identifier of the plug-in
- * this debug element originated from.
- *
- * @return the plug-in identifier
- */
- public String getModelIdentifier();
- /**
- * Returns the debug target this element is contained in.
- *
- * @return the debug target this element is contained in
- */
- public IDebugTarget getDebugTarget();
- /**
- * Returns the launch this element is contained in.
- *
- * @return the launch this element is contained in
- */
- public ILaunch getLaunch();
-}
-
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.ILaunch;
+
+/**
+ * A debug element represents an artifact in a program being
+ * debugged.
+ * <p>
+ * Some methods on debug elements require communication
+ * with the target program. Such methods may throw a <code>DebugException</code>
+ * with a status code of <code>TARGET_REQUEST_FAILED</code>
+ * when unable to complete a request due to a failure on the target.
+ * Methods that require communication with the target program or require
+ * the target to be in a specific state (for example, suspended), are declared
+ * as such.
+ * </p>
+ * <p>
+ * Debug elements are language independent. However, language specific
+ * features can be made available via the adapter mechanism provided by
+ * <code>IAdaptable</code>, or by extending the debug element interfaces.
+ * A debug model is responsible for declaring any special adapters
+ * its debug elements implement.
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ */
+public interface IDebugElement extends IAdaptable {
+
+ /**
+ * Returns the unique identifier of the plug-in
+ * this debug element originated from.
+ *
+ * @return the plug-in identifier
+ */
+ public String getModelIdentifier();
+ /**
+ * Returns the debug target this element is contained in.
+ *
+ * @return the debug target this element is contained in
+ */
+ public IDebugTarget getDebugTarget();
+ /**
+ * Returns the launch this element is contained in.
+ *
+ * @return the launch this element is contained in
+ */
+ public ILaunch getLaunch();
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java
index d3389534d..222a6f19a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDebugTarget.java
@@ -1,92 +1,92 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.IBreakpointListener;
-
-/**
- * A debug target is a debuggable execution context. For example, a debug target
- * may represent a debuggable process or a virtual machine. A debug target is the root
- * of the debug element hierarchy. A debug target contains threads. Minimally, a debug
- * target supports the following:
- * <ul>
- * <li>terminate
- * <li>suspend/resume
- * <li>breakpoints
- * <li>disconnect
- * </ul>
- * <p>
- * Generally, launching a debug session results in the creation of a
- * debug target. Launching is a client responsibility, as is debug target
- * creation.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see ITerminate
- * @see ISuspendResume
- * @see IBreakpointListener
- * @see IDisconnect
- * @see IMemoryBlockRetrieval
- * @see org.eclipse.debug.core.ILaunch
- */
-public interface IDebugTarget extends IDebugElement, ITerminate, ISuspendResume, IBreakpointListener, IDisconnect, IMemoryBlockRetrieval {
- /**
- * Returns the system process associated with this debug target.
- *
- * @return the system process associated with this debug target
- */
- public IProcess getProcess();
- /**
- * Returns the threads contained in this debug target. An
- * empty collection is returned if this debug target contains
- * no threads.
- *
- * @return a collection of threads
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- * @since 2.0
- */
- public IThread[] getThreads() throws DebugException;
-
- /**
- * Returns whether this debug target currently contains any threads.
- *
- * @return whether this debug target currently contains any threads
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- * @since 2.0
- */
- public boolean hasThreads() throws DebugException;
-
- /**
- * Returns the name of this debug target. Name format is debug model
- * specific, and should be specified by a debug model.
- *
- * @return this target's name
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li></ul>
- */
- public String getName() throws DebugException;
-
- /**
- * Returns whether the given breakpoint is supported by this
- * target - i.e. whether the given breakpoint could be installed
- * in this target.
- *
- * @return whether the given breakpoint is supported by this
- * target
- */
- public boolean supportsBreakpoint(IBreakpoint breakpoint);
-}
-
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.IBreakpointListener;
+
+/**
+ * A debug target is a debuggable execution context. For example, a debug target
+ * may represent a debuggable process or a virtual machine. A debug target is the root
+ * of the debug element hierarchy. A debug target contains threads. Minimally, a debug
+ * target supports the following:
+ * <ul>
+ * <li>terminate
+ * <li>suspend/resume
+ * <li>breakpoints
+ * <li>disconnect
+ * </ul>
+ * <p>
+ * Generally, launching a debug session results in the creation of a
+ * debug target. Launching is a client responsibility, as is debug target
+ * creation.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see ITerminate
+ * @see ISuspendResume
+ * @see IBreakpointListener
+ * @see IDisconnect
+ * @see IMemoryBlockRetrieval
+ * @see org.eclipse.debug.core.ILaunch
+ */
+public interface IDebugTarget extends IDebugElement, ITerminate, ISuspendResume, IBreakpointListener, IDisconnect, IMemoryBlockRetrieval {
+ /**
+ * Returns the system process associated with this debug target.
+ *
+ * @return the system process associated with this debug target
+ */
+ public IProcess getProcess();
+ /**
+ * Returns the threads contained in this debug target. An
+ * empty collection is returned if this debug target contains
+ * no threads.
+ *
+ * @return a collection of threads
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li></ul>
+ * @since 2.0
+ */
+ public IThread[] getThreads() throws DebugException;
+
+ /**
+ * Returns whether this debug target currently contains any threads.
+ *
+ * @return whether this debug target currently contains any threads
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li></ul>
+ * @since 2.0
+ */
+ public boolean hasThreads() throws DebugException;
+
+ /**
+ * Returns the name of this debug target. Name format is debug model
+ * specific, and should be specified by a debug model.
+ *
+ * @return this target's name
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li></ul>
+ */
+ public String getName() throws DebugException;
+
+ /**
+ * Returns whether the given breakpoint is supported by this
+ * target - i.e. whether the given breakpoint could be installed
+ * in this target.
+ *
+ * @return whether the given breakpoint is supported by this
+ * target
+ */
+ public boolean supportsBreakpoint(IBreakpoint breakpoint);
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDisconnect.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDisconnect.java
index 7e06b6c4a..2b28297c8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDisconnect.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IDisconnect.java
@@ -1,44 +1,44 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * The ability to end a debug session with a target program
- * and allow the target to continue running.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see IDebugTarget
- */
-public interface IDisconnect {
- /**
- * Returns whether this element can currently disconnect.
- *
- * @return whether this element can currently disconnect
- */
- public boolean canDisconnect();
- /**
- * Disconnects this element from its target. Generally, disconnecting
- * ends a debug session with a debug target, but allows the target
- * program to continue running.
- *
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target
- * <li>NOT_SUPPORTED - The capability is not supported by the target
- * </ul>
- */
- public void disconnect() throws DebugException;
- /**
- * Returns whether this element is disconnected.
- *
- * @return whether this element is disconnected
- */
- public boolean isDisconnected();
-}
-
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * The ability to end a debug session with a target program
+ * and allow the target to continue running.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see IDebugTarget
+ */
+public interface IDisconnect {
+ /**
+ * Returns whether this element can currently disconnect.
+ *
+ * @return whether this element can currently disconnect
+ */
+ public boolean canDisconnect();
+ /**
+ * Disconnects this element from its target. Generally, disconnecting
+ * ends a debug session with a debug target, but allows the target
+ * program to continue running.
+ *
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target
+ * <li>NOT_SUPPORTED - The capability is not supported by the target
+ * </ul>
+ */
+ public void disconnect() throws DebugException;
+ /**
+ * Returns whether this element is disconnected.
+ *
+ * @return whether this element is disconnected
+ */
+ public boolean isDisconnected();
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java
index ee92662f9..bee5e9360 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IExpression.java
@@ -1,61 +1,61 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * An expression is a snippet of code that can be evaluated
- * to produce a value. When and how an experssion is evaluated
- * is implementation specific. The context/binding required to
- * evaluate an expression varies by debug model, and by
- * user intent. Furthermore, an expression may need to be evaluated
- * at a specific location in a program (for example, at a
- * breakpoint/line where certain variables referenced in the
- * expression are visible/allocated). A user may want to
- * evaluate an expression once to produce a value that can
- * be inspected iteratively, or they may wish to evaluate an
- * expression iteratively producing new values each time
- * (i.e. as in a watch list).
- * <p>
- * Clients are intended to implement this interface.
- * </p>
- * @since 2.0
- */
-public interface IExpression extends IDebugElement {
-
- /**
- * Returns this expression's snippet of code.
- *
- * @return the expression
- */
- public abstract String getExpressionText();
-
- /**
- * Returns the current value of this expression or
- * <code>null</code> if this expression does not
- * currently have a value.
- *
- * @return value or <code>null</code>
- */
- public abstract IValue getValue();
-
- /**
- * Returns the debug target this expression is associated
- * with, or <code>null</code> if this expression is not
- * associated with a debug target.
- *
- * @return debug target or <code>null</code>
- * @see IDebugElement#getDebugTarget()
- */
- public abstract IDebugTarget getDebugTarget();
-
- /**
- * Notifies this expression that it has been removed
- * from the expression manager. Any required clean up
- * is be performed such that this expression can be
- * garbage collected.
- */
- public abstract void dispose();
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * An expression is a snippet of code that can be evaluated
+ * to produce a value. When and how an experssion is evaluated
+ * is implementation specific. The context/binding required to
+ * evaluate an expression varies by debug model, and by
+ * user intent. Furthermore, an expression may need to be evaluated
+ * at a specific location in a program (for example, at a
+ * breakpoint/line where certain variables referenced in the
+ * expression are visible/allocated). A user may want to
+ * evaluate an expression once to produce a value that can
+ * be inspected iteratively, or they may wish to evaluate an
+ * expression iteratively producing new values each time
+ * (i.e. as in a watch list).
+ * <p>
+ * Clients are intended to implement this interface.
+ * </p>
+ * @since 2.0
+ */
+public interface IExpression extends IDebugElement {
+
+ /**
+ * Returns this expression's snippet of code.
+ *
+ * @return the expression
+ */
+ public abstract String getExpressionText();
+
+ /**
+ * Returns the current value of this expression or
+ * <code>null</code> if this expression does not
+ * currently have a value.
+ *
+ * @return value or <code>null</code>
+ */
+ public abstract IValue getValue();
+
+ /**
+ * Returns the debug target this expression is associated
+ * with, or <code>null</code> if this expression is not
+ * associated with a debug target.
+ *
+ * @return debug target or <code>null</code>
+ * @see IDebugElement#getDebugTarget()
+ */
+ public abstract IDebugTarget getDebugTarget();
+
+ /**
+ * Notifies this expression that it has been removed
+ * from the expression manager. Any required clean up
+ * is be performed such that this expression can be
+ * garbage collected.
+ */
+ public abstract void dispose();
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java
index 61aa6aca3..9a72f3017 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java
@@ -1,43 +1,43 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-
-/**
- * A launch configuration delegate performs launching for a
- * specific type of launch configuration. A launch configuration
- * delegate is defined by the <code>delegate</code> attribute
- * of a <code>launchConfigurationType</code> extension.
- * <p>
- * This interface is intended to be implemented by clients.
- * </p>
- * @see org.eclipse.debug.core.ILaunchConfigurationType
- * @see ILaunchConfiguration
- * @since 2.0
- */
-public interface ILaunchConfigurationDelegate {
-
- /**
- * Launches the given configuration in the specified mode, contributing
- * debug targets and/or processes to the given launch object. The
- * launch object has already been registered with the launch manager.
- *
- * @param configuration the configuration to launch
- * @param mode the mode in which to launch, one of the mode constants
- * defined by <code>ILaunchManager</code> -
- * <code>RUN_MODE</code> or <code>DEBUG_MODE</code>.
- * @param monitor progress monitor, or <code>null</code>
- * @param launch the launch object to contribute processes and debug
- * targets to
- * @exception CoreException if launching fails
- */
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException;
-
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * A launch configuration delegate performs launching for a
+ * specific type of launch configuration. A launch configuration
+ * delegate is defined by the <code>delegate</code> attribute
+ * of a <code>launchConfigurationType</code> extension.
+ * <p>
+ * This interface is intended to be implemented by clients.
+ * </p>
+ * @see org.eclipse.debug.core.ILaunchConfigurationType
+ * @see ILaunchConfiguration
+ * @since 2.0
+ */
+public interface ILaunchConfigurationDelegate {
+
+ /**
+ * Launches the given configuration in the specified mode, contributing
+ * debug targets and/or processes to the given launch object. The
+ * launch object has already been registered with the launch manager.
+ *
+ * @param configuration the configuration to launch
+ * @param mode the mode in which to launch, one of the mode constants
+ * defined by <code>ILaunchManager</code> -
+ * <code>RUN_MODE</code> or <code>DEBUG_MODE</code>.
+ * @param monitor progress monitor, or <code>null</code>
+ * @param launch the launch object to contribute processes and debug
+ * targets to
+ * @exception CoreException if launching fails
+ */
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException;
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILineBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILineBreakpoint.java
index e5173f7d0..55a7da471 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILineBreakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILineBreakpoint.java
@@ -1,44 +1,44 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A breakpoint that can be located at a specific line of source code.
- */
-public interface ILineBreakpoint extends IBreakpoint {
-
-/**
- * Returns the line number in the original source that corresponds
- * to the location of this breakpoint, or -1 if the attribute is not
- * present.
- *
- * @return this breakpoint's line number, or -1 if unknown
- * @exception CoreException if a <code>CoreException</code> is thrown
- * while accessing the underlying <code>IMarker.LINE_NUMBER</code> marker attribute
- */
-public int getLineNumber() throws CoreException;
-/**
- * Returns starting source index in the original source that corresponds
- * to the location of this breakpoint, or -1 if the attribute is not present.
- *
- * @return this breakpoint's char start value, or -1 if unknown
- * @exception CoreException if a <code>CoreException</code> is thrown
- * while accessing the underlying <code>IMarker.CHAR_START</code> marker attribute
- */
-public int getCharStart() throws CoreException;
-/**
- * Returns ending source index in the original source that corresponds
- * to the location of this breakpoint, or -1 if the attribute is not present.
- *
- * @return this breakpoint's char end value, or -1 if unknown
- * @exception CoreException if a <code>CoreException</code> is thrown
- * while accessing the underlying <code>IMarker.CHAR_END</code> marker attribute
- */
-public int getCharEnd() throws CoreException;
-}
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * A breakpoint that can be located at a specific line of source code.
+ */
+public interface ILineBreakpoint extends IBreakpoint {
+
+/**
+ * Returns the line number in the original source that corresponds
+ * to the location of this breakpoint, or -1 if the attribute is not
+ * present.
+ *
+ * @return this breakpoint's line number, or -1 if unknown
+ * @exception CoreException if a <code>CoreException</code> is thrown
+ * while accessing the underlying <code>IMarker.LINE_NUMBER</code> marker attribute
+ */
+public int getLineNumber() throws CoreException;
+/**
+ * Returns starting source index in the original source that corresponds
+ * to the location of this breakpoint, or -1 if the attribute is not present.
+ *
+ * @return this breakpoint's char start value, or -1 if unknown
+ * @exception CoreException if a <code>CoreException</code> is thrown
+ * while accessing the underlying <code>IMarker.CHAR_START</code> marker attribute
+ */
+public int getCharStart() throws CoreException;
+/**
+ * Returns ending source index in the original source that corresponds
+ * to the location of this breakpoint, or -1 if the attribute is not present.
+ *
+ * @return this breakpoint's char end value, or -1 if unknown
+ * @exception CoreException if a <code>CoreException</code> is thrown
+ * while accessing the underlying <code>IMarker.CHAR_END</code> marker attribute
+ */
+public int getCharEnd() throws CoreException;
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlock.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlock.java
index ec2bfcad9..249d4e0e8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlock.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlock.java
@@ -1,76 +1,76 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * A contiguous segment of memory in an execution context.
- * A memory block is represented by a starting memory address
- * and a length. Not all debug architectures support the retrieval
- * of memory blocks.
- *
- * @see IMemoryBlockRetrieval
- * @since 2.0
- */
-public interface IMemoryBlock extends IDebugElement {
-
- /**
- * Returns the start address of this memory block.
- *
- * @return the start address of this memory block
- */
- public long getStartAddress();
-
- /**
- * Returns the length of this memory block in bytes.
- *
- * @return the length of this memory block in bytes
- */
- public long getLength();
-
- /**
- * Returns the values of the bytes currently contained
- * in this this memory block.
- *
- * @return the values of the bytes currently contained
- * in this this memory block
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- */
- public byte[] getBytes() throws DebugException;
-
- /**
- * Returns whether this memory block supports value modification
- *
- * @return whether this memory block supports value modification
- */
- public boolean supportsValueModification();
-
- /**
- * Sets the value of the bytes in this memory block at the specified
- * offset within this memory block to the spcified bytes.
- * The offset is zero based.
- *
- * @param offset the offset at which to set the new values
- * @param bytes the new values
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * <li>This memory block does not support value modification</li>
- * <li>The specified offset is greater than or equal to the length
- * of this memory block, or the number of bytes specified goes
- * beyond the end of this memory block (index of out of range)</li>
- * </ul>
- */
- public void setValue(long offset, byte[] bytes) throws DebugException;
-
-}
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * A contiguous segment of memory in an execution context.
+ * A memory block is represented by a starting memory address
+ * and a length. Not all debug architectures support the retrieval
+ * of memory blocks.
+ *
+ * @see IMemoryBlockRetrieval
+ * @since 2.0
+ */
+public interface IMemoryBlock extends IDebugElement {
+
+ /**
+ * Returns the start address of this memory block.
+ *
+ * @return the start address of this memory block
+ */
+ public long getStartAddress();
+
+ /**
+ * Returns the length of this memory block in bytes.
+ *
+ * @return the length of this memory block in bytes
+ */
+ public long getLength();
+
+ /**
+ * Returns the values of the bytes currently contained
+ * in this this memory block.
+ *
+ * @return the values of the bytes currently contained
+ * in this this memory block
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ */
+ public byte[] getBytes() throws DebugException;
+
+ /**
+ * Returns whether this memory block supports value modification
+ *
+ * @return whether this memory block supports value modification
+ */
+ public boolean supportsValueModification();
+
+ /**
+ * Sets the value of the bytes in this memory block at the specified
+ * offset within this memory block to the spcified bytes.
+ * The offset is zero based.
+ *
+ * @param offset the offset at which to set the new values
+ * @param bytes the new values
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * <li>This memory block does not support value modification</li>
+ * <li>The specified offset is greater than or equal to the length
+ * of this memory block, or the number of bytes specified goes
+ * beyond the end of this memory block (index of out of range)</li>
+ * </ul>
+ */
+ public void setValue(long offset, byte[] bytes) throws DebugException;
+
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlockRetrieval.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlockRetrieval.java
index d9ab94b34..e4f3924cd 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlockRetrieval.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IMemoryBlockRetrieval.java
@@ -1,46 +1,46 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * Supports the retrieval of arbitrary blocks of memory.
- *
- * @see IMemoryBlock
- * @since 2.0
- */
-public interface IMemoryBlockRetrieval {
-
- /**
- * Returns whether this debug target supports the retrieval
- * of memory blocks.
- *
- * @return whether this debug target supports the retrieval
- * of memory blocks
- */
- public boolean supportsStorageRetrieval();
-
- /**
- * Returns a memory block that starts at the specified
- * memory address, with the specified length.
- *
- * @param startAddress starting address
- * @param length length of the memory block in bytes
- * @return a memory block that starts at the specified
- * memory address, with the specified length
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * <li>This debug target does not support memory block retrieval</li>
- * <li>The specified address and length are not within valid
- * ranges</li>
- * </ul>
- */
- public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException;
-}
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * Supports the retrieval of arbitrary blocks of memory.
+ *
+ * @see IMemoryBlock
+ * @since 2.0
+ */
+public interface IMemoryBlockRetrieval {
+
+ /**
+ * Returns whether this debug target supports the retrieval
+ * of memory blocks.
+ *
+ * @return whether this debug target supports the retrieval
+ * of memory blocks
+ */
+ public boolean supportsStorageRetrieval();
+
+ /**
+ * Returns a memory block that starts at the specified
+ * memory address, with the specified length.
+ *
+ * @param startAddress starting address
+ * @param length length of the memory block in bytes
+ * @return a memory block that starts at the specified
+ * memory address, with the specified length
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * <li>This debug target does not support memory block retrieval</li>
+ * <li>The specified address and length are not within valid
+ * ranges</li>
+ * </ul>
+ */
+ public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException;
+}
+
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 ed623bd4a..154b3ee67 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
@@ -1,71 +1,71 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-
-/**
- * A process represents a program running in normal (non-debug) mode.
- * Processes support setting and getting of client defined attributes.
- * This way, clients can annotate a process with any extra information
- * important to them. For example, classpath annotations, or command
- * line arguments used to launch the process may be important to a client.
- * <p>
- * Clients may implement this interface, however, the debug plug-in
- * provides an implementation of this interface for a
- * <code>java.lang.Process</code>.
- * </p>
- * @see org.eclipse.debug.core.DebugPlugin#newProcess(ILaunch, Process, String)
- */
-public interface IProcess extends IAdaptable, ITerminate {
-
- /**
- * Returns a human-readable label for this process.
- *
- * @return a label for this process
- */
- public String getLabel();
- /**
- * Returns the launch this element originated from.
- *
- * @return the launch this process is contained in
- */
- public ILaunch getLaunch();
- /**
- * Returns a proxy to the standard input, output, and error streams
- * for this process, or <code>null</code> if not supported.
- *
- * @return a streams proxy, or <code>null</code> if not supported
- */
- public IStreamsProxy getStreamsProxy();
-
- /**
- * Sets the value of a client defined attribute.
- *
- * @param key the attribute key
- * @param value the attribute value
- */
- public void setAttribute(String key, String value);
-
- /**
- * Returns the value of a client defined attribute.
- *
- * @param key the attribute key
- * @return value the String attribute value, or <code>null</code> if undefined
- */
- public String getAttribute(String key);
-
- /**
- * Returns the exit value of this process. Conventionally, 0 indicates
- * normal termination.
- *
- * @return the exit value of this process
- * @exception DebugException if this process has not yet terminated
- */
- public int getExitValue() throws DebugException;
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+
+/**
+ * A process represents a program running in normal (non-debug) mode.
+ * Processes support setting and getting of client defined attributes.
+ * This way, clients can annotate a process with any extra information
+ * important to them. For example, classpath annotations, or command
+ * line arguments used to launch the process may be important to a client.
+ * <p>
+ * Clients may implement this interface, however, the debug plug-in
+ * provides an implementation of this interface for a
+ * <code>java.lang.Process</code>.
+ * </p>
+ * @see org.eclipse.debug.core.DebugPlugin#newProcess(ILaunch, Process, String)
+ */
+public interface IProcess extends IAdaptable, ITerminate {
+
+ /**
+ * Returns a human-readable label for this process.
+ *
+ * @return a label for this process
+ */
+ public String getLabel();
+ /**
+ * Returns the launch this element originated from.
+ *
+ * @return the launch this process is contained in
+ */
+ public ILaunch getLaunch();
+ /**
+ * Returns a proxy to the standard input, output, and error streams
+ * for this process, or <code>null</code> if not supported.
+ *
+ * @return a streams proxy, or <code>null</code> if not supported
+ */
+ public IStreamsProxy getStreamsProxy();
+
+ /**
+ * Sets the value of a client defined attribute.
+ *
+ * @param key the attribute key
+ * @param value the attribute value
+ */
+ public void setAttribute(String key, String value);
+
+ /**
+ * Returns the value of a client defined attribute.
+ *
+ * @param key the attribute key
+ * @return value the String attribute value, or <code>null</code> if undefined
+ */
+ public String getAttribute(String key);
+
+ /**
+ * Returns the exit value of this process. Conventionally, 0 indicates
+ * normal termination.
+ *
+ * @return the exit value of this process
+ * @exception DebugException if this process has not yet terminated
+ */
+ public int getExitValue() throws DebugException;
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegister.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegister.java
index 6fecca6ee..5e5de25fc 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegister.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegister.java
@@ -1,31 +1,31 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * A register is a special kind of variable that is contained
- * in a register group. Each register has a name and a value.
- * Not all debug architectures provide access to registers.
- *
- * @since 2.0
- */
-public interface IRegister extends IVariable {
-
- /**
- * Returns the register group this register is contained in.
- *
- * @return the register group this register is contained in
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public IRegisterGroup getRegisterGroup() throws DebugException;
-
-}
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * A register is a special kind of variable that is contained
+ * in a register group. Each register has a name and a value.
+ * Not all debug architectures provide access to registers.
+ *
+ * @since 2.0
+ */
+public interface IRegister extends IVariable {
+
+ /**
+ * Returns the register group this register is contained in.
+ *
+ * @return the register group this register is contained in
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public IRegisterGroup getRegisterGroup() throws DebugException;
+
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegisterGroup.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegisterGroup.java
index 4a330f1b9..426dc5e56 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegisterGroup.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IRegisterGroup.java
@@ -1,56 +1,56 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * A register group is a group of registers that are
- * assigned to a stack frame. Some debug architectures
- * provide access to registers, and registers are often
- * grouped logically. For example, a floating point
- * register group.
- *
- * @since 2.0
- */
-public interface IRegisterGroup extends IDebugElement {
-
-
- /**
- * Returns the name of this register group.
- *
- * @return this register group's name
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public String getName() throws DebugException;
-
- /**
- * Returns the registers in this register group.
- *
- * @return the registers in this register group
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public IRegister[] getRegisters() throws DebugException;
-
- /**
- * Returns whether this register group currently contains any registers.
- *
- * @return whether this register group currently contains any registers
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public boolean hasRegisters() throws DebugException;
-
-}
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * A register group is a group of registers that are
+ * assigned to a stack frame. Some debug architectures
+ * provide access to registers, and registers are often
+ * grouped logically. For example, a floating point
+ * register group.
+ *
+ * @since 2.0
+ */
+public interface IRegisterGroup extends IDebugElement {
+
+
+ /**
+ * Returns the name of this register group.
+ *
+ * @return this register group's name
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public String getName() throws DebugException;
+
+ /**
+ * Returns the registers in this register group.
+ *
+ * @return the registers in this register group
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public IRegister[] getRegisters() throws DebugException;
+
+ /**
+ * Returns whether this register group currently contains any registers.
+ *
+ * @return whether this register group currently contains any registers
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public boolean hasRegisters() throws DebugException;
+
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java
index 181b83dd2..22a9b12eb 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java
@@ -1,62 +1,62 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.model.IStackFrame;
-
-/**
- * A source locator locates source elements for stack frames. A launch (optionally)
- * specifies a source locator which is
- * used to locate source for that debug session. If a launch does not
- * provide a source locator, source cannot be displayed.
- * Abstraction of source lookup allows clients to hide implementation
- * details of source location and representation.
- * <p>
- * Generally, an implementor of a debug model will also implement launch configuration types,
- * delegates, and source locators that work together as a whole. That is, the implementation
- * of a source locator will have knowledge of how to locate a source element
- * for a stack frame. For example, a Java stack frame could define API which
- * specifies a source file name. A Java source locator would use this information
- * to locate the associated file in the workspace.
- * </p>
- * <p>
- * Source is displayed by the debug UI plug-in. The debug UI uses a source locator
- * to resolve an object representing the source for a stack frame, and then uses
- * a debug model presentation to determine the editor and editor input to use to
- * display the actual source in an editor.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see org.eclipse.debug.core.ILaunch
- * @see org.eclipse.debug.core.model.IStackFrame
- * @see org.eclipse.debug.ui.IDebugModelPresentation
- * @see org.eclipse.debug.core.model.IPersistableSourceLocator
- */
-public interface ISourceLocator {
-
- /**
- * Returns a source element that corresponds to the given stack frame, or
- * <code>null</code> if a source element could not be located. The object returned
- * by this method will be used by the debug UI plug-in to display source.
- * The debug UI uses the debug model presentation associated
- * with the given stack frame's debug model to translate a source object into an
- * {editor input, editor id} pair in which to display source.
- * <p>
- * For example, a java source locator could return an object representing a
- * compilation unit or class file. The java debug model presentation would
- * then be responsible for providing an editor input and editor id for each
- * compilation unit and class file such that the debug UI could display source.
- * </p>
- *
- * @param stackFrame the stack frame for which to locate source
- * @return an object representing a source element.
- */
- public Object getSourceElement(IStackFrame stackFrame);
-
-}
-
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.model.IStackFrame;
+
+/**
+ * A source locator locates source elements for stack frames. A launch (optionally)
+ * specifies a source locator which is
+ * used to locate source for that debug session. If a launch does not
+ * provide a source locator, source cannot be displayed.
+ * Abstraction of source lookup allows clients to hide implementation
+ * details of source location and representation.
+ * <p>
+ * Generally, an implementor of a debug model will also implement launch configuration types,
+ * delegates, and source locators that work together as a whole. That is, the implementation
+ * of a source locator will have knowledge of how to locate a source element
+ * for a stack frame. For example, a Java stack frame could define API which
+ * specifies a source file name. A Java source locator would use this information
+ * to locate the associated file in the workspace.
+ * </p>
+ * <p>
+ * Source is displayed by the debug UI plug-in. The debug UI uses a source locator
+ * to resolve an object representing the source for a stack frame, and then uses
+ * a debug model presentation to determine the editor and editor input to use to
+ * display the actual source in an editor.
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see org.eclipse.debug.core.ILaunch
+ * @see org.eclipse.debug.core.model.IStackFrame
+ * @see org.eclipse.debug.ui.IDebugModelPresentation
+ * @see org.eclipse.debug.core.model.IPersistableSourceLocator
+ */
+public interface ISourceLocator {
+
+ /**
+ * Returns a source element that corresponds to the given stack frame, or
+ * <code>null</code> if a source element could not be located. The object returned
+ * by this method will be used by the debug UI plug-in to display source.
+ * The debug UI uses the debug model presentation associated
+ * with the given stack frame's debug model to translate a source object into an
+ * {editor input, editor id} pair in which to display source.
+ * <p>
+ * For example, a java source locator could return an object representing a
+ * compilation unit or class file. The java debug model presentation would
+ * then be responsible for providing an editor input and editor id for each
+ * compilation unit and class file such that the debug UI could display source.
+ * </p>
+ *
+ * @param stackFrame the stack frame for which to locate source
+ * @return an object representing a source element.
+ */
+ public Object getSourceElement(IStackFrame stackFrame);
+
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java
index bf9d787d7..500256f9a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStackFrame.java
@@ -1,176 +1,176 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * A stack frame represents an execution context in a suspended thread.
- * A stack frame contains variables representing visible locals and arguments at
- * the current execution location. Minimally, a stack frame supports
- * the following:
- * <ul>
- * <li>suspend/resume (convenience to resume this stack frame's thread)
- * <li>stepping
- * <li>termination (convenience to terminate this stack frame's thread or debug target)
- * </ul>
- * <p>
- * A debug model implementation may choose to re-use or discard
- * stack frames on iterative thread suspensions. Clients
- * cannot assume that stack frames are identical or equal across
- * iterative thread suspensions and must check for equality on iterative
- * suspensions if they wish to re-use the objects.
- * </p>
- * <p>
- * A debug model implementation that preserves equality
- * across iterative suspensions may display more desirable behavior in
- * some clients. For example, if stack frames are preserved
- * while stepping, a UI client would be able to update the UI incrementally,
- * rather than collapse and redraw the entire list.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see IStep
- * @see ISuspendResume
- * @see ITerminate
- */
-public interface IStackFrame extends IDebugElement, IStep, ISuspendResume, ITerminate {
- /**
- * Returns the thread this stack frame is contained in.
- *
- * @return thread
- * @since 2.0
- */
- public IThread getThread();
- /**
- * Returns the visible variables in this stack frame. An empty
- * collection is returned if there are no visible variables.
- *
- * @return collection of visible variables
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public IVariable[] getVariables() throws DebugException;
-
- /**
- * Returns whether this stack frame currently contains any visible variables.
- *
- * @return whether this stack frame currently contains any visible variables
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public boolean hasVariables() throws DebugException;
-
- /**
- * Returns the line number of the instruction pointer in
- * this stack frame that corresponds to a line in an associated source
- * element, or <code>-1</code> if line number information
- * is unavailable.
- *
- * @return line number of instruction pointer in this stack frame, or
- * <code>-1</code> if line number information is unavailable
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- */
- public int getLineNumber() throws DebugException;
-
- /**
- * Returns the index of the first character in the associated source
- * element that corresponds to the current location of the instruction pointer
- * in this stack frame, or <code>-1</code> if the information is unavailable.
- * <p>
- * If a debug model supports expression level stepping, the start/end
- * character ranges are used to highlight the expression within a line
- * that is being executed.
- * </p>
- * @return index of the first character in the associated source
- * element that corresponds to the current location of the instruction pointer
- * in this stack frame, or <code>-1</code> if the information is unavailable
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public int getCharStart() throws DebugException;
-
- /**
- * Returns the index of the last character in the associated source
- * element that corresponds to the current location of the instruction pointer
- * in this stack frame, or <code>-1</code> if the information is unavailable.
- * <p>
- * If a debug model supports expression level stepping, the start/end
- * character ranges are used to highlight the expression within a line
- * that is being executed.
- * </p>
- * @return index of the last character in the associated source
- * element that corresponds to the current location of the instruction pointer
- * in this stack frame, or <code>-1</code> if the information is unavailable
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public int getCharEnd() throws DebugException;
-
- /**
- * Returns the name of this stack frame. Name format is debug model
- * specific, and should be specified by a debug model.
- *
- * @return this frame's name
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- */
- public String getName() throws DebugException;
-
- /**
- * Returns the register groups assigned to this stack frame,
- * or an empty collection if no register groups are assigned
- * to this stack frame.
- *
- * @return the register groups assigned to this stack frame
- * or an empty collection if no register groups are assigned
- * to this stack frame
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public IRegisterGroup[] getRegisterGroups() throws DebugException;
-
- /**
- * Returns whether this stack frame contains any register groups.
- *
- * @return whether this stack frame contains any visible register groups
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public boolean hasRegisterGroups() throws DebugException;
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * A stack frame represents an execution context in a suspended thread.
+ * A stack frame contains variables representing visible locals and arguments at
+ * the current execution location. Minimally, a stack frame supports
+ * the following:
+ * <ul>
+ * <li>suspend/resume (convenience to resume this stack frame's thread)
+ * <li>stepping
+ * <li>termination (convenience to terminate this stack frame's thread or debug target)
+ * </ul>
+ * <p>
+ * A debug model implementation may choose to re-use or discard
+ * stack frames on iterative thread suspensions. Clients
+ * cannot assume that stack frames are identical or equal across
+ * iterative thread suspensions and must check for equality on iterative
+ * suspensions if they wish to re-use the objects.
+ * </p>
+ * <p>
+ * A debug model implementation that preserves equality
+ * across iterative suspensions may display more desirable behavior in
+ * some clients. For example, if stack frames are preserved
+ * while stepping, a UI client would be able to update the UI incrementally,
+ * rather than collapse and redraw the entire list.
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see IStep
+ * @see ISuspendResume
+ * @see ITerminate
+ */
+public interface IStackFrame extends IDebugElement, IStep, ISuspendResume, ITerminate {
+ /**
+ * Returns the thread this stack frame is contained in.
+ *
+ * @return thread
+ * @since 2.0
+ */
+ public IThread getThread();
+ /**
+ * Returns the visible variables in this stack frame. An empty
+ * collection is returned if there are no visible variables.
+ *
+ * @return collection of visible variables
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public IVariable[] getVariables() throws DebugException;
+
+ /**
+ * Returns whether this stack frame currently contains any visible variables.
+ *
+ * @return whether this stack frame currently contains any visible variables
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public boolean hasVariables() throws DebugException;
+
+ /**
+ * Returns the line number of the instruction pointer in
+ * this stack frame that corresponds to a line in an associated source
+ * element, or <code>-1</code> if line number information
+ * is unavailable.
+ *
+ * @return line number of instruction pointer in this stack frame, or
+ * <code>-1</code> if line number information is unavailable
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ */
+ public int getLineNumber() throws DebugException;
+
+ /**
+ * Returns the index of the first character in the associated source
+ * element that corresponds to the current location of the instruction pointer
+ * in this stack frame, or <code>-1</code> if the information is unavailable.
+ * <p>
+ * If a debug model supports expression level stepping, the start/end
+ * character ranges are used to highlight the expression within a line
+ * that is being executed.
+ * </p>
+ * @return index of the first character in the associated source
+ * element that corresponds to the current location of the instruction pointer
+ * in this stack frame, or <code>-1</code> if the information is unavailable
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public int getCharStart() throws DebugException;
+
+ /**
+ * Returns the index of the last character in the associated source
+ * element that corresponds to the current location of the instruction pointer
+ * in this stack frame, or <code>-1</code> if the information is unavailable.
+ * <p>
+ * If a debug model supports expression level stepping, the start/end
+ * character ranges are used to highlight the expression within a line
+ * that is being executed.
+ * </p>
+ * @return index of the last character in the associated source
+ * element that corresponds to the current location of the instruction pointer
+ * in this stack frame, or <code>-1</code> if the information is unavailable
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public int getCharEnd() throws DebugException;
+
+ /**
+ * Returns the name of this stack frame. Name format is debug model
+ * specific, and should be specified by a debug model.
+ *
+ * @return this frame's name
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ */
+ public String getName() throws DebugException;
+
+ /**
+ * Returns the register groups assigned to this stack frame,
+ * or an empty collection if no register groups are assigned
+ * to this stack frame.
+ *
+ * @return the register groups assigned to this stack frame
+ * or an empty collection if no register groups are assigned
+ * to this stack frame
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public IRegisterGroup[] getRegisterGroups() throws DebugException;
+
+ /**
+ * Returns whether this stack frame contains any register groups.
+ *
+ * @return whether this stack frame contains any visible register groups
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public boolean hasRegisterGroups() throws DebugException;
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStep.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStep.java
index b27ce940b..65c326f3f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStep.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStep.java
@@ -1,85 +1,85 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * Provides the ability to step into, over, and return
- * from the current execution location. Implementations
- * must be non-blocking.
- * <p>
- * Clients may implement this interface.
- * </p>
- */
-public interface IStep {
- /**
- * Returns whether this element can currently perform a step into.
- *
- * @return whether this element can currently perform a step into
- */
- public boolean canStepInto();
- /**
- * Returns whether this element can currently perform a step over.
- *
- * @return whether this element can currently perform a step over
- */
- public boolean canStepOver();
- /**
- * Returns whether this element can currently perform a step return.
- *
- * @return whether this element can currently perform a step return
- */
- public boolean canStepReturn();
- /**
- * Returns whether this element is currently stepping.
- * <p>
- * For example, a thread is considered to be stepping
- * after the <code>stepOver</code> call until the step over is completed,
- * a breakpoint is reached, an exception is thrown, or the thread or debug target is
- * terminated.
- * </p>
- *
- * @return whether this element is currently stepping
- */
- public boolean isStepping();
- /**
- * Steps into the current statement, generating <code>RESUME</code>
- * and <code>SUSPEND</code> events for the associated thread. Can only be called
- * when the associated thread is suspended. Implementations must implement
- * stepping as non-blocking.
- *
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target</li>
- * <li>NOT_SUPPORTED - The capability is not supported by the target</li>
- * </ul>
- */
- public void stepInto() throws DebugException;
- /**
- * Steps over the current statement, generating <code>RESUME</code>
- * and <code>SUSPEND</code> events for the associated thread. Can only be called
- * when the associated thread is suspended. Implementations must implement
- * stepping as non-blocking.
- *
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target</li>
- * <li>NOT_SUPPORTED - The capability is not supported by the target</li>
- * </ul>
- */
- public void stepOver() throws DebugException;
- /**
- * Steps to the next return statement in the current scope,
- * generating <code>RESUME</code> and <code>SUSPEND</code> events for
- * the associated thread. Can only be called when the associated thread is suspended.
- * Implementations must implement stepping as non-blocking.
- *
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target</li>
- * <li>NOT_SUPPORTED - The capability is not supported by the target</li>
- * </ul>
- */
- public void stepReturn() throws DebugException;
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * Provides the ability to step into, over, and return
+ * from the current execution location. Implementations
+ * must be non-blocking.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ */
+public interface IStep {
+ /**
+ * Returns whether this element can currently perform a step into.
+ *
+ * @return whether this element can currently perform a step into
+ */
+ public boolean canStepInto();
+ /**
+ * Returns whether this element can currently perform a step over.
+ *
+ * @return whether this element can currently perform a step over
+ */
+ public boolean canStepOver();
+ /**
+ * Returns whether this element can currently perform a step return.
+ *
+ * @return whether this element can currently perform a step return
+ */
+ public boolean canStepReturn();
+ /**
+ * Returns whether this element is currently stepping.
+ * <p>
+ * For example, a thread is considered to be stepping
+ * after the <code>stepOver</code> call until the step over is completed,
+ * a breakpoint is reached, an exception is thrown, or the thread or debug target is
+ * terminated.
+ * </p>
+ *
+ * @return whether this element is currently stepping
+ */
+ public boolean isStepping();
+ /**
+ * Steps into the current statement, generating <code>RESUME</code>
+ * and <code>SUSPEND</code> events for the associated thread. Can only be called
+ * when the associated thread is suspended. Implementations must implement
+ * stepping as non-blocking.
+ *
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target</li>
+ * <li>NOT_SUPPORTED - The capability is not supported by the target</li>
+ * </ul>
+ */
+ public void stepInto() throws DebugException;
+ /**
+ * Steps over the current statement, generating <code>RESUME</code>
+ * and <code>SUSPEND</code> events for the associated thread. Can only be called
+ * when the associated thread is suspended. Implementations must implement
+ * stepping as non-blocking.
+ *
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target</li>
+ * <li>NOT_SUPPORTED - The capability is not supported by the target</li>
+ * </ul>
+ */
+ public void stepOver() throws DebugException;
+ /**
+ * Steps to the next return statement in the current scope,
+ * generating <code>RESUME</code> and <code>SUSPEND</code> events for
+ * the associated thread. Can only be called when the associated thread is suspended.
+ * Implementations must implement stepping as non-blocking.
+ *
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target</li>
+ * <li>NOT_SUPPORTED - The capability is not supported by the target</li>
+ * </ul>
+ */
+ public void stepReturn() throws DebugException;
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java
index 0c8e4a807..895c7b777 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java
@@ -1,43 +1,43 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.IStreamListener;
-
-/**
- * A stream monitor manages the contents of the stream a process
- * is writing to, and notifies registered listeners of changes in
- * the stream.
- * <p>
- * Clients may implement this interface. Generally, a client that
- * provides an implementation of the <code>IStreamsProxy</code>
- * interface must also provide an implementation of this interface.
- * </p>
- * @see IStreamsProxy
- */
-public interface IStreamMonitor {
- /**
- * Adds the given listener to this stream monitor's registered listeners.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener to add
- */
- public void addListener(IStreamListener listener);
- /**
- * Returns the entire current contents of the stream. An empty
- * String is returned if the stream is empty.
- *
- * @return the stream contents as a <code>String</code>
- */
- public String getContents();
- /**
- * Removes the given listener from this stream monitor's registered listeners.
- * Has no effect if the listener is not already registered.
- *
- * @param listener the listener to remove
- */
- public void removeListener(IStreamListener listener);
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.IStreamListener;
+
+/**
+ * A stream monitor manages the contents of the stream a process
+ * is writing to, and notifies registered listeners of changes in
+ * the stream.
+ * <p>
+ * Clients may implement this interface. Generally, a client that
+ * provides an implementation of the <code>IStreamsProxy</code>
+ * interface must also provide an implementation of this interface.
+ * </p>
+ * @see IStreamsProxy
+ */
+public interface IStreamMonitor {
+ /**
+ * Adds the given listener to this stream monitor's registered listeners.
+ * Has no effect if an identical listener is already registered.
+ *
+ * @param listener the listener to add
+ */
+ public void addListener(IStreamListener listener);
+ /**
+ * Returns the entire current contents of the stream. An empty
+ * String is returned if the stream is empty.
+ *
+ * @return the stream contents as a <code>String</code>
+ */
+ public String getContents();
+ /**
+ * Removes the given listener from this stream monitor's registered listeners.
+ * Has no effect if the listener is not already registered.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeListener(IStreamListener listener);
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java
index 01c9741d8..8838512fe 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java
@@ -1,51 +1,51 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.IOException;
-
-/**
- * A streams proxy acts as proxy between the streams of a
- * process and interested clients. This abstraction allows
- * implementations of <code>IProcess</code> to handle I/O related
- * to the standard input, output, and error streams associated
- * with a process.
- * <p>
- * Clients implementing the <code>IProcess</code> interface must also
- * provide an implementation of this interface.
- * </p>
- * @see IProcess
- */
-public interface IStreamsProxy {
- /**
- * Returns a monitor for the error stream of this proxy's process,
- * or <code>null</code> if not supported.
- * The monitor is connected to the error stream of the
- * associated process.
- *
- * @return an error stream monitor, or <code>null</code> if none
- */
- public IStreamMonitor getErrorStreamMonitor();
- /**
- * Returns a monitor for the output stream of this proxy's process,
- * or <code>null</code> if not supported.
- * The monitor is connected to the output stream of the
- * associated process.
- *
- * @return an output stream monitor, or <code>null</code> if none
- */
- public IStreamMonitor getOutputStreamMonitor();
- /**
- * Writes the given text to the output stream connected to the
- * standard input stream of this proxy's process.
- *
- * @param input the text to be written
- * @exception IOException when an error occurs writing to the
- * underlying <code>OutputStream</code>.
- *
- */
- public void write(String input) throws IOException;
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+
+/**
+ * A streams proxy acts as proxy between the streams of a
+ * process and interested clients. This abstraction allows
+ * implementations of <code>IProcess</code> to handle I/O related
+ * to the standard input, output, and error streams associated
+ * with a process.
+ * <p>
+ * Clients implementing the <code>IProcess</code> interface must also
+ * provide an implementation of this interface.
+ * </p>
+ * @see IProcess
+ */
+public interface IStreamsProxy {
+ /**
+ * Returns a monitor for the error stream of this proxy's process,
+ * or <code>null</code> if not supported.
+ * The monitor is connected to the error stream of the
+ * associated process.
+ *
+ * @return an error stream monitor, or <code>null</code> if none
+ */
+ public IStreamMonitor getErrorStreamMonitor();
+ /**
+ * Returns a monitor for the output stream of this proxy's process,
+ * or <code>null</code> if not supported.
+ * The monitor is connected to the output stream of the
+ * associated process.
+ *
+ * @return an output stream monitor, or <code>null</code> if none
+ */
+ public IStreamMonitor getOutputStreamMonitor();
+ /**
+ * Writes the given text to the output stream connected to the
+ * standard input stream of this proxy's process.
+ *
+ * @param input the text to be written
+ * @exception IOException when an error occurs writing to the
+ * underlying <code>OutputStream</code>.
+ *
+ */
+ public void write(String input) throws IOException;
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISuspendResume.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISuspendResume.java
index d1d08f1cb..d87f36b45 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISuspendResume.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISuspendResume.java
@@ -1,57 +1,57 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * Provides the ability to suspend and resume a thread
- * or debug target.
- * <p>
- * Clients may implement this interface.
- * </p>
- */
-public interface ISuspendResume {
- /**
- * Returns whether this element can currently be resumed.
- *
- * @return whether this element can currently be resumed
- */
- public boolean canResume();
- /**
- * Returns whether this element can currently be suspended.
- *
- * @return whether this element can currently be suspended
- */
- public boolean canSuspend();
- /**
- * Returns whether this element is currently suspended.
- *
- * @return whether this element is currently suspended
- */
- public boolean isSuspended();
- /**
- * Causes this element to resume its execution, generating a <code>RESUME</code> event.
- * Has no effect on an element that is not suspended. This call is non-blocking.
- *
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target
- * <li>NOT_SUPPORTED - The capability is not supported by the target
- * </ul>
- */
- public void resume() throws DebugException;
- /**
- * Causes this element to suspend its execution, generating a <code>SUSPEND</code> event.
- * Has no effect on an already suspended element.
- * Implementations may be blocking or non-blocking.
- *
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target
- * <li>NOT_SUPPORTED - The capability is not supported by the target
- * </ul>
- */
- public void suspend() throws DebugException;
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * Provides the ability to suspend and resume a thread
+ * or debug target.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ */
+public interface ISuspendResume {
+ /**
+ * Returns whether this element can currently be resumed.
+ *
+ * @return whether this element can currently be resumed
+ */
+ public boolean canResume();
+ /**
+ * Returns whether this element can currently be suspended.
+ *
+ * @return whether this element can currently be suspended
+ */
+ public boolean canSuspend();
+ /**
+ * Returns whether this element is currently suspended.
+ *
+ * @return whether this element is currently suspended
+ */
+ public boolean isSuspended();
+ /**
+ * Causes this element to resume its execution, generating a <code>RESUME</code> event.
+ * Has no effect on an element that is not suspended. This call is non-blocking.
+ *
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target
+ * <li>NOT_SUPPORTED - The capability is not supported by the target
+ * </ul>
+ */
+ public void resume() throws DebugException;
+ /**
+ * Causes this element to suspend its execution, generating a <code>SUSPEND</code> event.
+ * Has no effect on an already suspended element.
+ * Implementations may be blocking or non-blocking.
+ *
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target
+ * <li>NOT_SUPPORTED - The capability is not supported by the target
+ * </ul>
+ */
+ public void suspend() throws DebugException;
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ITerminate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ITerminate.java
index 3848ffa97..9a60cddb9 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ITerminate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ITerminate.java
@@ -1,40 +1,40 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * Provides the ability to terminate an execution
- * context - for example, a thread, debug target or process.
- * <p>
- * Clients may implement this interface.
- * </p>
- */
-public interface ITerminate {
- /**
- * Returns whether this element can be terminated.
- *
- * @return whether this element can be terminated
- */
- public boolean canTerminate();
- /**
- * Returns whether this element is terminated.
- *
- * @return whether this element is terminated
- */
- public boolean isTerminated();
- /**
- * Causes this element to terminate, generating a <code>TERMINATE</code> event.
- * Implementations may be blocking or non-blocking.
- *
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target
- * <li>NOT_SUPPORTED - The capability is not supported by the target
- * </ul>
- */
- public void terminate() throws DebugException;
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * Provides the ability to terminate an execution
+ * context - for example, a thread, debug target or process.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ */
+public interface ITerminate {
+ /**
+ * Returns whether this element can be terminated.
+ *
+ * @return whether this element can be terminated
+ */
+ public boolean canTerminate();
+ /**
+ * Returns whether this element is terminated.
+ *
+ * @return whether this element is terminated
+ */
+ public boolean isTerminated();
+ /**
+ * Causes this element to terminate, generating a <code>TERMINATE</code> event.
+ * Implementations may be blocking or non-blocking.
+ *
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target
+ * <li>NOT_SUPPORTED - The capability is not supported by the target
+ * </ul>
+ */
+ public void terminate() throws DebugException;
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java
index 615156eb1..e9b0787aa 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IThread.java
@@ -1,105 +1,105 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * A thread is a sequential flow of execution in a debug target.
- * A thread contains stack frames. Stack frames are only available when the
- * thread is suspended, and are returned in top-down order.
- * Minimally, a thread supports the following:
- * <ul>
- * <li>suspend/resume
- * <li>stepping
- * <li>terminate
- * </ul>
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see ISuspendResume
- * @see IStep
- * @see ITerminate
- * @see IStackFrame
- */
-
-public interface IThread extends IDebugElement, ISuspendResume, IStep, ITerminate {
- /**
- * Returns the stack frames contained in this thread. An
- * empty collection is returned if this thread contains
- * no stack frames, or is not currently suspended. Stack frames
- * are returned in top down order.
- *
- * @return a collection of stack frames
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public IStackFrame[] getStackFrames() throws DebugException;
-
- /**
- * Returns whether this thread currently contains any stack
- * frames.
- *
- * @return whether this thread currently contains any stack frames
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public boolean hasStackFrames() throws DebugException;
-
- /**
- * Returns the priority of this thread. The meaning of this
- * number is operating-system dependent.
- *
- * @return thread priority
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public int getPriority() throws DebugException;
- /**
- * Returns the top stack frame or <code>null</code> if there is
- * currently no top stack frame.
- *
- * @return the top stack frame, or <code>null</code> if none
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public IStackFrame getTopStackFrame() throws DebugException;
- /**
- * Returns the name of this thread. Name format is debug model
- * specific, and should be specified by a debug model.
- *
- * @return this thread's name
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public String getName() throws DebugException;
-
- /**
- * Returns the breakpoints that caused this thread to suspend,
- * or an empty collection if this thread is not suspended or
- * was not suspended by a breakpoint. Usually a single breakpoint
- * will be returned, but this collection can contain more than
- * one breakpoint if two breakpoints are at the same location in
- * a program.
- *
- * @return the collection of breakpoints that caused this thread to suspend
- */
- public IBreakpoint[] getBreakpoints();
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * A thread is a sequential flow of execution in a debug target.
+ * A thread contains stack frames. Stack frames are only available when the
+ * thread is suspended, and are returned in top-down order.
+ * Minimally, a thread supports the following:
+ * <ul>
+ * <li>suspend/resume
+ * <li>stepping
+ * <li>terminate
+ * </ul>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see ISuspendResume
+ * @see IStep
+ * @see ITerminate
+ * @see IStackFrame
+ */
+
+public interface IThread extends IDebugElement, ISuspendResume, IStep, ITerminate {
+ /**
+ * Returns the stack frames contained in this thread. An
+ * empty collection is returned if this thread contains
+ * no stack frames, or is not currently suspended. Stack frames
+ * are returned in top down order.
+ *
+ * @return a collection of stack frames
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public IStackFrame[] getStackFrames() throws DebugException;
+
+ /**
+ * Returns whether this thread currently contains any stack
+ * frames.
+ *
+ * @return whether this thread currently contains any stack frames
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public boolean hasStackFrames() throws DebugException;
+
+ /**
+ * Returns the priority of this thread. The meaning of this
+ * number is operating-system dependent.
+ *
+ * @return thread priority
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public int getPriority() throws DebugException;
+ /**
+ * Returns the top stack frame or <code>null</code> if there is
+ * currently no top stack frame.
+ *
+ * @return the top stack frame, or <code>null</code> if none
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public IStackFrame getTopStackFrame() throws DebugException;
+ /**
+ * Returns the name of this thread. Name format is debug model
+ * specific, and should be specified by a debug model.
+ *
+ * @return this thread's name
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public String getName() throws DebugException;
+
+ /**
+ * Returns the breakpoints that caused this thread to suspend,
+ * or an empty collection if this thread is not suspended or
+ * was not suspended by a breakpoint. Usually a single breakpoint
+ * will be returned, but this collection can contain more than
+ * one breakpoint if two breakpoints are at the same location in
+ * a program.
+ *
+ * @return the collection of breakpoints that caused this thread to suspend
+ */
+ public IBreakpoint[] getBreakpoints();
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java
index a78a48b90..323144614 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java
@@ -1,98 +1,98 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * A value represents the value of a variable.
- * A value representing a complex data structure contains variables.
- * <p>
- * An implementation may choose to re-use or discard
- * values on iterative thread suspensions. Clients
- * cannot assume that values are identical or equal across
- * iterative thread suspensions and must check for equality on iterative
- * suspensions if they wish to re-use the objects.
- * </p>
- * <p>
- * An implementation that preserves equality
- * across iterative suspensions may display more desirable behavior in
- * some clients. For example, if variables are preserved
- * while stepping, a UI client would be able to update the UI incrementally,
- * rather than collapse and redraw the entire list or tree.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see IVariable
- */
-
-
-public interface IValue extends IDebugElement {
-
- /**
- * Returns a description of the type of data this value contains
- * or references.
- *
- * @return the name of this value's reference type
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public String getReferenceTypeName() throws DebugException;
-
- /**
- * Returns this value as a <code>String</code>.
- *
- * @return a String representation of this value
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public String getValueString() throws DebugException;
-
- /**
- * Returns whether this value is currently allocated.
- * <p>
- * For example, if this value represents
- * an object that has been garbage collected, <code>false</code> is returned.
- * </p>
- * @return whether this value is currently allocated
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public boolean isAllocated() throws DebugException;
- /**
- * Returns the visible variables in this value. An empty
- * collection is returned if there are no visible variables.
- *
- * @return an array of visible variables
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public IVariable[] getVariables() throws DebugException;
-
- /**
- * Returns whether this value currently contains any visible variables.
- *
- * @return whether this value currently contains any visible variables
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the debug target. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- * </ul>
- * @since 2.0
- */
- public boolean hasVariables() throws DebugException;
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * A value represents the value of a variable.
+ * A value representing a complex data structure contains variables.
+ * <p>
+ * An implementation may choose to re-use or discard
+ * values on iterative thread suspensions. Clients
+ * cannot assume that values are identical or equal across
+ * iterative thread suspensions and must check for equality on iterative
+ * suspensions if they wish to re-use the objects.
+ * </p>
+ * <p>
+ * An implementation that preserves equality
+ * across iterative suspensions may display more desirable behavior in
+ * some clients. For example, if variables are preserved
+ * while stepping, a UI client would be able to update the UI incrementally,
+ * rather than collapse and redraw the entire list or tree.
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see IVariable
+ */
+
+
+public interface IValue extends IDebugElement {
+
+ /**
+ * Returns a description of the type of data this value contains
+ * or references.
+ *
+ * @return the name of this value's reference type
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public String getReferenceTypeName() throws DebugException;
+
+ /**
+ * Returns this value as a <code>String</code>.
+ *
+ * @return a String representation of this value
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public String getValueString() throws DebugException;
+
+ /**
+ * Returns whether this value is currently allocated.
+ * <p>
+ * For example, if this value represents
+ * an object that has been garbage collected, <code>false</code> is returned.
+ * </p>
+ * @return whether this value is currently allocated
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public boolean isAllocated() throws DebugException;
+ /**
+ * Returns the visible variables in this value. An empty
+ * collection is returned if there are no visible variables.
+ *
+ * @return an array of visible variables
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public IVariable[] getVariables() throws DebugException;
+
+ /**
+ * Returns whether this value currently contains any visible variables.
+ *
+ * @return whether this value currently contains any visible variables
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the debug target. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ * </ul>
+ * @since 2.0
+ */
+ public boolean hasVariables() throws DebugException;
} \ No newline at end of file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValueModification.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValueModification.java
index bd08b4e0c..df4d93da6 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValueModification.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValueModification.java
@@ -1,79 +1,79 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * Provides the ability to modify the value of a variable in
- * a target.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see IVariable
- */
-public interface IValueModification {
-
- /**
- * Attempts to set the value of this variable to the
- * value of the given expression.
- *
- * @param expression an expression to generate a new value
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target
- * <li>NOT_SUPPORTED - The capability is not supported by the target
- * </ul>
- */
- public void setValue(String expression) throws DebugException;
-
- /**
- * Sets the value of this variable to the given value.
- *
- * @param value a new value
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target
- * <li>NOT_SUPPORTED - The capability is not supported by the target
- * </ul>
- * @since 2.0
- */
- public void setValue(IValue value) throws DebugException;
-
- /**
- * Returns whether this variable supports value modification.
- *
- * @return whether this variable supports value modification
- */
- public boolean supportsValueModification();
-
- /**
- * Returns whether the given expression is valid to be used in
- * setting a new value for this variable.
- *
- * @param expression an expression to generate a new value
- * @return whether the expression is valid
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target
- * <li>NOT_SUPPORTED - The capability is not supported by the target
- * </ul>
- */
- public boolean verifyValue(String expression) throws DebugException;
-
- /**
- * Returns whether the given value can be used as
- * a new value for this variable.
- *
- * @param value a new value
- * @return whether the value is valid
- * @exception DebugException on failure. Reasons include:<ul>
- * <li>TARGET_REQUEST_FAILED - The request failed in the target
- * <li>NOT_SUPPORTED - The capability is not supported by the target
- * </ul>
- * @since 2.0
- */
- public boolean verifyValue(IValue value) throws DebugException;
-}
-
-
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * Provides the ability to modify the value of a variable in
+ * a target.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see IVariable
+ */
+public interface IValueModification {
+
+ /**
+ * Attempts to set the value of this variable to the
+ * value of the given expression.
+ *
+ * @param expression an expression to generate a new value
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target
+ * <li>NOT_SUPPORTED - The capability is not supported by the target
+ * </ul>
+ */
+ public void setValue(String expression) throws DebugException;
+
+ /**
+ * Sets the value of this variable to the given value.
+ *
+ * @param value a new value
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target
+ * <li>NOT_SUPPORTED - The capability is not supported by the target
+ * </ul>
+ * @since 2.0
+ */
+ public void setValue(IValue value) throws DebugException;
+
+ /**
+ * Returns whether this variable supports value modification.
+ *
+ * @return whether this variable supports value modification
+ */
+ public boolean supportsValueModification();
+
+ /**
+ * Returns whether the given expression is valid to be used in
+ * setting a new value for this variable.
+ *
+ * @param expression an expression to generate a new value
+ * @return whether the expression is valid
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target
+ * <li>NOT_SUPPORTED - The capability is not supported by the target
+ * </ul>
+ */
+ public boolean verifyValue(String expression) throws DebugException;
+
+ /**
+ * Returns whether the given value can be used as
+ * a new value for this variable.
+ *
+ * @param value a new value
+ * @return whether the value is valid
+ * @exception DebugException on failure. Reasons include:<ul>
+ * <li>TARGET_REQUEST_FAILED - The request failed in the target
+ * <li>NOT_SUPPORTED - The capability is not supported by the target
+ * </ul>
+ * @since 2.0
+ */
+ public boolean verifyValue(IValue value) throws DebugException;
+}
+
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java
index 59a3dd607..eec3069e1 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java
@@ -1,89 +1,89 @@
-package org.eclipse.debug.core.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * A variable represents a visible data structure in a stack frame
- * or value.
- * Each variable has a value which may in turn contain more variables.
- * A variable may support value modification.
- * <p>
- * An implementation may choose to re-use or discard
- * variables on iterative thread suspensions. Clients
- * cannot assume that variables are identical or equal across
- * iterative thread suspensions and must check for equality on iterative
- * suspensions if they wish to re-use the objects.
- * </p>
- * <p>
- * An implementation that preserves equality
- * across iterative suspensions may display more desirable behavior in
- * some clients. For example, if variables are preserved
- * while stepping, a UI client would be able to update the UI incrementally,
- * rather than collapse and redraw the entire list or tree.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see IValue
- * @see IStackFrame
- * @see IValueModification
- */
-public interface IVariable extends IDebugElement, IValueModification {
- /**
- * Returns the value of this variable.
- *
- * @return this variable's value
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public IValue getValue() throws DebugException;
- /**
- * Returns the name of this variable. Name format is debug model
- * specific, and should be specified by a debug model.
- *
- * @return this variable's name
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public String getName() throws DebugException;
- /**
- * Returns a description of the type of data this variable is
- * declared to reference. Note that the declared type of a
- * variable and the concrete type of its value are not neccessarily
- * the same.
- *
- * @return the declared type of this variable
- * @exception DebugException if this method fails. Reasons include:
- * <ul><li>Failure communicating with the VM. The DebugException's
- * status code contains the underlying exception responsible for
- * the failure.</li>
- */
- public String getReferenceTypeName() throws DebugException;
-
- /**
- * Returns whether this variable's value has changed since the last suspend event.
- * Implementations may choose whether the last suspend event is the last suspend
- * event in this variable's debug target, or within the thread(s) in which this variable
- * is visible.
- * <p>
- * Implementations that choose not to implement this function should always
- * return <code>false</code>.
- * </p>
- *
- * @return whether this variable's value has changed since the last suspend event
- * @exception DebugException if an exception occurs determining if this variable's
- * value has changed since the last suspend event
- */
- public boolean hasValueChanged() throws DebugException;
-
-
-}
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * A variable represents a visible data structure in a stack frame
+ * or value.
+ * Each variable has a value which may in turn contain more variables.
+ * A variable may support value modification.
+ * <p>
+ * An implementation may choose to re-use or discard
+ * variables on iterative thread suspensions. Clients
+ * cannot assume that variables are identical or equal across
+ * iterative thread suspensions and must check for equality on iterative
+ * suspensions if they wish to re-use the objects.
+ * </p>
+ * <p>
+ * An implementation that preserves equality
+ * across iterative suspensions may display more desirable behavior in
+ * some clients. For example, if variables are preserved
+ * while stepping, a UI client would be able to update the UI incrementally,
+ * rather than collapse and redraw the entire list or tree.
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @see IValue
+ * @see IStackFrame
+ * @see IValueModification
+ */
+public interface IVariable extends IDebugElement, IValueModification {
+ /**
+ * Returns the value of this variable.
+ *
+ * @return this variable's value
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public IValue getValue() throws DebugException;
+ /**
+ * Returns the name of this variable. Name format is debug model
+ * specific, and should be specified by a debug model.
+ *
+ * @return this variable's name
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public String getName() throws DebugException;
+ /**
+ * Returns a description of the type of data this variable is
+ * declared to reference. Note that the declared type of a
+ * variable and the concrete type of its value are not neccessarily
+ * the same.
+ *
+ * @return the declared type of this variable
+ * @exception DebugException if this method fails. Reasons include:
+ * <ul><li>Failure communicating with the VM. The DebugException's
+ * status code contains the underlying exception responsible for
+ * the failure.</li>
+ */
+ public String getReferenceTypeName() throws DebugException;
+
+ /**
+ * Returns whether this variable's value has changed since the last suspend event.
+ * Implementations may choose whether the last suspend event is the last suspend
+ * event in this variable's debug target, or within the thread(s) in which this variable
+ * is visible.
+ * <p>
+ * Implementations that choose not to implement this function should always
+ * return <code>false</code>.
+ * </p>
+ *
+ * @return whether this variable's value has changed since the last suspend event
+ * @exception DebugException if an exception occurs determining if this variable's
+ * value has changed since the last suspend event
+ */
+ public boolean hasValueChanged() throws DebugException;
+
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java
index 88122c0e5..76f365ede 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/LineBreakpoint.java
@@ -1,56 +1,56 @@
-package org.eclipse.debug.core.model;
+package org.eclipse.debug.core.model;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+
+/**
+ * Abstract implementation of a line breakpoint. This class is
+ * intended to be subclassed by debug model specific implementations
+ * of line breakpoints.
+ *
+ * @see ILineBreakpoint
+ */
+
+public abstract class LineBreakpoint extends Breakpoint implements ILineBreakpoint {
+
+
+ /**
+ * @see ILineBreakpoint#getLineNumber()
+ */
+ public int getLineNumber() throws CoreException {
+ IMarker m = getMarker();
+ if (m != null) {
+ return m.getAttribute(IMarker.LINE_NUMBER, -1);
+ }
+ return -1;
+ }
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
+ /**
+ * @see ILineBreakpoint#getCharStart()
+ */
+ public int getCharStart() throws CoreException {
+ IMarker m = getMarker();
+ if (m != null) {
+ return m.getAttribute(IMarker.CHAR_START, -1);
+ }
+ return -1;
+ }
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-
-/**
- * Abstract implementation of a line breakpoint. This class is
- * intended to be subclassed by debug model specific implementations
- * of line breakpoints.
- *
- * @see ILineBreakpoint
- */
-
-public abstract class LineBreakpoint extends Breakpoint implements ILineBreakpoint {
-
-
- /**
- * @see ILineBreakpoint#getLineNumber()
- */
- public int getLineNumber() throws CoreException {
- IMarker m = getMarker();
- if (m != null) {
- return m.getAttribute(IMarker.LINE_NUMBER, -1);
- }
- return -1;
- }
-
- /**
- * @see ILineBreakpoint#getCharStart()
- */
- public int getCharStart() throws CoreException {
- IMarker m = getMarker();
- if (m != null) {
- return m.getAttribute(IMarker.CHAR_START, -1);
- }
- return -1;
+ /**
+ * @see ILineBreakpoint#getCharEnd()
+ */
+ public int getCharEnd() throws CoreException {
+ IMarker m = getMarker();
+ if (m != null) {
+ return m.getAttribute(IMarker.CHAR_END, -1);
+ }
+ return -1;
}
-
- /**
- * @see ILineBreakpoint#getCharEnd()
- */
- public int getCharEnd() throws CoreException {
- IMarker m = getMarker();
- if (m != null) {
- return m.getAttribute(IMarker.CHAR_END, -1);
- }
- return -1;
- }
-}
-
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/package.html b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/package.html
index 9bd3a0ae8..8cf4a5b5b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/package.html
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/package.html
@@ -1,97 +1,97 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Eclipse Debug Platform [org.eclipse.debug.core.model]</title>
-</head>
-
-<body bgcolor="#FFFFFF">
-
-<p>Defines interfaces for a debug model elements, source lookup, and launching.</p>
-
-<h2>Package Specification</h2>
-
-<p>This package defines classes and interfaces known as the &quot;debug model&quot; which support
-an extensible set of debug architectures and languages. The debug model is a set of interfaces
-representing common artifacts in debuggable programs. The debug plug-in itself does not provide
-any implementations of a debug model. It is intended that third parties providing an integrated
-set of development tools for a specific language will also implement a debug model for that language,
-using an underlying debug architecture of their choice. For example, Java Tooling provides an
-implementation of a debug model based on the standard Java Platform Debug Architecture (JPDA).</p>
-
-<h4>The Debug Model</h4>
-
-<p>A client implements a debug model by
-providing an implementation of the interfaces defined in this package. (There is no explicit
-extension point that represents a debug model). Each debug model provides one or more
-launch configuration types capable of initiating a debug session.</p>
-
-<p>The common elements defined by the debug model are:
-
-<ul>
- <li>Debug Target - A debug target represents a debuggable program - for example, a virtual
- machine or a process.</li>
- <li>Thread - A debug target may contain one or more threads.</li>
- <li>Stack Frame - A suspended thread may contain one or more stack frames.</li>
- <li>Variable - A stack frame may contain variables.</li>
- <li>Value - Each variable has an associated value, and a value may contain more variables (to
- represent complex data structures and objects).</li>
- <li>Register Group - A stack frame may (optionally) be associated with one or more register
- groups.</li>
- <li>Register - A register group contains one or more registers.</li>
- <li>Memory Blocks - A debug target may (optionally) support the retrieval of
- arbitrary contiguous segments of memory.</li>
- <li>Breakpoint - Breakpoints suspend the execution of a program.</li>
- <li>Expression - An expression is a snippet of code that can be evaluated to
- produce a value.</li>
-</ul>
-
-<p>A debug model implementation is responsible for firing debug events. A debug event
-corresponds to an event in a program being debugged - for example the creation or
-termination of a thread.</p>
-
-<h4>Breakpoints</h4>
-
-<p>Breakpoints are used to suspend the execution of a program being debugged. There are
-many kinds of breakpoints - line breakpoints, conditional line breakpoints, hit count
-breakpoints, exception breakpoints, etc. The kinds of breakpoints supported by each debug
-architecture, and the information required to create those breakpoints
-is dictated by each debug architecture. The debug platform supports an extensible
-set of breakpoint via the breakpoints extension point.</p>
-
-<p>The debug platform provides a breakpoint manager that maintains the collection of all
-registered breakpoints. Clients add and remove breakpoints via this manager. Breakpoints are
-implemented by instances of IBreakpoint. Each breakpoint object has an associated marker,
-which provides persistence and presentation in editors. The debug platform defines a generic
-breakpoint and line breakpoint, as well as their corresponding marker definitions. Breakpoint
-creation is a client responsibility - that is, defining the attributes of a breakpoint and
-the resource to associate a breakpoint marker with.</p>
-
-<p>Also, the location in which a breakpoint may
-be placed, and the attributes that a debug target requires to install a breakpoint are
-specific to each debug architecture, and thus a client responsibility.</p>
-
-<h5>Persistence</h5>
-
-<p>Breakpoints are persisted via their underlying marker. Breakpoint markers defined
-with the <b>persisted</b> attribute as <b>false</b> will not be persisted. Breakpoints
-are restored at workspace startup time by the breakpoint manager - that is, breakpoint objects
-are created for all persisted markers which are a subtype of the root breakpoint marker
-and are added to the breakpoint manager. To allow for selective persistence
-of breakpoints (of the same kind), the IBreakpoint interface and root breakpoint
-implementation define a &quot;persisted&quot; attribute. If this value is set to false,
-the breakpoint will not be persisted across workspace invocations.</p>
-
-<h5>Change Notification</h5>
-
-<p>As breakpoint markers are modified (created, removed, and changed), resource deltas
-are created by the platform. The breakpoint manager translates pertinent resource deltas
-into breakpoint change notifications (breakpoint added/removed/changed messages). Interested
-listeners may register with the breakpoint manager. The breakpoint manager only fires change
-notifications for registered breakpoints. This simplifies breakpoint processing for clients,
-as resource delta traversal and analysis is not required. Debug targets that support breakpoints
-should register for breakpoint change notifications.</p>
-
-</body>
-</html>
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Eclipse Debug Platform [org.eclipse.debug.core.model]</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<p>Defines interfaces for a debug model elements, source lookup, and launching.</p>
+
+<h2>Package Specification</h2>
+
+<p>This package defines classes and interfaces known as the &quot;debug model&quot; which support
+an extensible set of debug architectures and languages. The debug model is a set of interfaces
+representing common artifacts in debuggable programs. The debug plug-in itself does not provide
+any implementations of a debug model. It is intended that third parties providing an integrated
+set of development tools for a specific language will also implement a debug model for that language,
+using an underlying debug architecture of their choice. For example, Java Tooling provides an
+implementation of a debug model based on the standard Java Platform Debug Architecture (JPDA).</p>
+
+<h4>The Debug Model</h4>
+
+<p>A client implements a debug model by
+providing an implementation of the interfaces defined in this package. (There is no explicit
+extension point that represents a debug model). Each debug model provides one or more
+launch configuration types capable of initiating a debug session.</p>
+
+<p>The common elements defined by the debug model are:
+
+<ul>
+ <li>Debug Target - A debug target represents a debuggable program - for example, a virtual
+ machine or a process.</li>
+ <li>Thread - A debug target may contain one or more threads.</li>
+ <li>Stack Frame - A suspended thread may contain one or more stack frames.</li>
+ <li>Variable - A stack frame may contain variables.</li>
+ <li>Value - Each variable has an associated value, and a value may contain more variables (to
+ represent complex data structures and objects).</li>
+ <li>Register Group - A stack frame may (optionally) be associated with one or more register
+ groups.</li>
+ <li>Register - A register group contains one or more registers.</li>
+ <li>Memory Blocks - A debug target may (optionally) support the retrieval of
+ arbitrary contiguous segments of memory.</li>
+ <li>Breakpoint - Breakpoints suspend the execution of a program.</li>
+ <li>Expression - An expression is a snippet of code that can be evaluated to
+ produce a value.</li>
+</ul>
+
+<p>A debug model implementation is responsible for firing debug events. A debug event
+corresponds to an event in a program being debugged - for example the creation or
+termination of a thread.</p>
+
+<h4>Breakpoints</h4>
+
+<p>Breakpoints are used to suspend the execution of a program being debugged. There are
+many kinds of breakpoints - line breakpoints, conditional line breakpoints, hit count
+breakpoints, exception breakpoints, etc. The kinds of breakpoints supported by each debug
+architecture, and the information required to create those breakpoints
+is dictated by each debug architecture. The debug platform supports an extensible
+set of breakpoint via the breakpoints extension point.</p>
+
+<p>The debug platform provides a breakpoint manager that maintains the collection of all
+registered breakpoints. Clients add and remove breakpoints via this manager. Breakpoints are
+implemented by instances of IBreakpoint. Each breakpoint object has an associated marker,
+which provides persistence and presentation in editors. The debug platform defines a generic
+breakpoint and line breakpoint, as well as their corresponding marker definitions. Breakpoint
+creation is a client responsibility - that is, defining the attributes of a breakpoint and
+the resource to associate a breakpoint marker with.</p>
+
+<p>Also, the location in which a breakpoint may
+be placed, and the attributes that a debug target requires to install a breakpoint are
+specific to each debug architecture, and thus a client responsibility.</p>
+
+<h5>Persistence</h5>
+
+<p>Breakpoints are persisted via their underlying marker. Breakpoint markers defined
+with the <b>persisted</b> attribute as <b>false</b> will not be persisted. Breakpoints
+are restored at workspace startup time by the breakpoint manager - that is, breakpoint objects
+are created for all persisted markers which are a subtype of the root breakpoint marker
+and are added to the breakpoint manager. To allow for selective persistence
+of breakpoints (of the same kind), the IBreakpoint interface and root breakpoint
+implementation define a &quot;persisted&quot; attribute. If this value is set to false,
+the breakpoint will not be persisted across workspace invocations.</p>
+
+<h5>Change Notification</h5>
+
+<p>As breakpoint markers are modified (created, removed, and changed), resource deltas
+are created by the platform. The breakpoint manager translates pertinent resource deltas
+into breakpoint change notifications (breakpoint added/removed/changed messages). Interested
+listeners may register with the breakpoint manager. The breakpoint manager only fires change
+notifications for registered breakpoints. This simplifies breakpoint processing for clients,
+as resource delta traversal and analysis is not required. Debug targets that support breakpoints
+should register for breakpoint change notifications.</p>
+
+</body>
+</html>
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/package.html b/org.eclipse.debug.core/core/org/eclipse/debug/core/package.html
index c8e7d76ca..de9276e03 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/package.html
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/package.html
@@ -1,64 +1,64 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Eclipse Debug Platform</title>
-</head>
-
-<body bgcolor="#FFFFFF">
-
-<p>Provides support for launching programs, breakpoint management, expression management,
-and debug events.</p>
-
-<h2>Package Specification</h2>
-
-<p>This package provides classes and interfaces to support facilities common
-among many debug architectures: launching programs, breakpoint management,
-expression management, and debug events. An extensible
-set of debug architectures and languages are supported by the definition of a &quot;debug
-model&quot; - a set of interfaces representing common artifacts in debuggable programs, which
-are defined in <b>org.eclipse.debug.core.model</b>.
-The debug plug-in itself does not provide any implementations of a debug model. It is
-intended that third parties providing an integrated set of development tools for a
-specific language will also implement a debug model for that language, using an underlying
-debug architecture of their choice. For example, Java Tooling provides an implementation
-of a debug model based on the standard Java Platform Debug Architecture (JPDA).</p>
-
-<h4>The Managers</h4>
-
-<p>The debug platform defines and provides an implementation of the following managers:
-<ul>
- <li>Launch Manager - The launch manager maintains the set of registered launches - that is,
- a collection of programs that have been launched in debuggable or non-debuggable (run) mode.
- Each launch maintains its associated debug targets and system processes. A launch that
- represents a debuggable program may specify an associated source locator used to locate
- source elements associated with stack frames for a particular debug session. Clients must
- provide implementations of source locators, which are generally tied to the manner in which
- a program is launched.</li>
- <li>Breakpoint Manager - The breakpoint manager maintains, persists, and restores the collection
- of all registered breakpoints in the workspace. As well, it provides change notification for
- breakpoints.</li>
- <li>Expression Manager - The expression manager maintains a collection of registered expressions.
- Expressions are not automatically persisted, but a client could persist its own expressions
- if required.</li>
-</ul>
-</p>
-
-<h4>Launch Configurations</h4>
-
-<p>A launch configuration is a persistable description of how to launch an application.
- Each launch configuration is an instance of a type of launch configuration - for example,
- a Java Application. The debug plug-in defines a launch configuration type extension point
- such that clients may define launch configurations specific to their debug architecture.
- A launch configuration is simply a set of attributes describing how to launch a program.
- The actual launching of an application is performed
- by an associated implementation of a launch configuration delegate, which is specifed by each launch configuration
- type extension.</p>
-<p>A launch configuration may be stored as a file in the worksapce (and shared in a repository via
- standard team mechanisms), or may be stored locally, essentially making the launch configuration
- private for a single user.</p>
-
-
-</body>
-</html>
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Eclipse Debug Platform</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<p>Provides support for launching programs, breakpoint management, expression management,
+and debug events.</p>
+
+<h2>Package Specification</h2>
+
+<p>This package provides classes and interfaces to support facilities common
+among many debug architectures: launching programs, breakpoint management,
+expression management, and debug events. An extensible
+set of debug architectures and languages are supported by the definition of a &quot;debug
+model&quot; - a set of interfaces representing common artifacts in debuggable programs, which
+are defined in <b>org.eclipse.debug.core.model</b>.
+The debug plug-in itself does not provide any implementations of a debug model. It is
+intended that third parties providing an integrated set of development tools for a
+specific language will also implement a debug model for that language, using an underlying
+debug architecture of their choice. For example, Java Tooling provides an implementation
+of a debug model based on the standard Java Platform Debug Architecture (JPDA).</p>
+
+<h4>The Managers</h4>
+
+<p>The debug platform defines and provides an implementation of the following managers:
+<ul>
+ <li>Launch Manager - The launch manager maintains the set of registered launches - that is,
+ a collection of programs that have been launched in debuggable or non-debuggable (run) mode.
+ Each launch maintains its associated debug targets and system processes. A launch that
+ represents a debuggable program may specify an associated source locator used to locate
+ source elements associated with stack frames for a particular debug session. Clients must
+ provide implementations of source locators, which are generally tied to the manner in which
+ a program is launched.</li>
+ <li>Breakpoint Manager - The breakpoint manager maintains, persists, and restores the collection
+ of all registered breakpoints in the workspace. As well, it provides change notification for
+ breakpoints.</li>
+ <li>Expression Manager - The expression manager maintains a collection of registered expressions.
+ Expressions are not automatically persisted, but a client could persist its own expressions
+ if required.</li>
+</ul>
+</p>
+
+<h4>Launch Configurations</h4>
+
+<p>A launch configuration is a persistable description of how to launch an application.
+ Each launch configuration is an instance of a type of launch configuration - for example,
+ a Java Application. The debug plug-in defines a launch configuration type extension point
+ such that clients may define launch configurations specific to their debug architecture.
+ A launch configuration is simply a set of attributes describing how to launch a program.
+ The actual launching of an application is performed
+ by an associated implementation of a launch configuration delegate, which is specifed by each launch configuration
+ type extension.</p>
+<p>A launch configuration may be stored as a file in the worksapce (and shared in a repository via
+ standard team mechanisms), or may be stored locally, essentially making the launch configuration
+ private for a single user.</p>
+
+
+</body>
+</html>
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
index b5b7a4dfc..951ba2536 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
@@ -1,582 +1,582 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointListener;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-
-/**
- * The breakpoint manager manages all registered breakpoints
- * for the debug plugin. It is instantiated by the debug plugin at startup.
- *
- * @see IBreakpointManager
- */
-public class BreakpointManager implements IBreakpointManager, IResourceChangeListener {
-
- /**
- * Constants for breakpoint add/remove/change updates
- */
- private final static int ADDED = 0;
- private final static int REMOVED = 1;
- private final static int CHANGED = 2;
-
- /**
- * String constants corresponding to XML extension keys
- */
- private final static String CLASS = "class"; //$NON-NLS-1$
-
- /**
- * Attribute name for the <code>"markerType"</code> attribute of
- * a breakpoint extension.
- */
- private static final String MARKER_TYPE= "markerType"; //$NON-NLS-1$
-
- /**
- * A collection of breakpoints registered with this manager.
- */
- private Vector fBreakpoints= null;
-
- /**
- * A table of breakpoint extension points, keyed by
- * marker type
- * key: a marker type
- * value: the breakpoint extension which corresponds to that marker type
- */
- private HashMap fBreakpointExtensions;
-
- /**
- * Collection of markers that associates markers to breakpoints
- * key: a marker
- * value: the breakpoint which contains that marker
- */
- private HashMap fMarkersToBreakpoints;
-
- /**
- * Collection of breakpoint listeners.
- */
- private ListenerList fBreakpointListeners= new ListenerList(6);
-
- /**
- * Singleton resource delta visitor which handles marker
- * additions, changes, and removals.
- */
- private static BreakpointManagerVisitor fgVisitor;
-
- /**
- * Constructs a new breakpoint manager.
- */
- public BreakpointManager() {
- fMarkersToBreakpoints= new HashMap(10);
- fBreakpointExtensions = new HashMap(15);
- }
-
- /**
- * Registers this manager as a resource change listener and
- * initializes the collection of defined breakpoint extensions.
- *
- * This method should only be called on initial startup of
- * the debug plugin.
- */
- public void startup() throws CoreException {
- getWorkspace().addResourceChangeListener(this);
- }
-
- /**
- * Loads all the breakpoints on the given resource.
- *
- * @param resource the resource which contains the breakpoints
- */
- private void loadBreakpoints(IResource resource) throws CoreException {
- initBreakpointExtensions();
- IMarker[] markers= getPersistedMarkers(resource);
- for (int i = 0; i < markers.length; i++) {
- IMarker marker= markers[i];
- try {
- createBreakpoint(marker);
- } catch (DebugException e) {
- DebugPlugin.log(e);
- }
- }
- }
-
- /**
- * Returns the persisted markers associated with the given resource.
- *
- * Delete any non-persisted/invalid breakpoint markers. This is done
- * at startup rather than shutdown, since the changes made at
- * shutdown are not persisted as the workspace state has already
- * been saved. See bug 7683.
- */
- protected IMarker[] getPersistedMarkers(IResource resource) throws CoreException {
- IMarker[] markers= resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
- final List delete = new ArrayList();
- List persisted= new ArrayList();
- for (int i = 0; i < markers.length; i++) {
- IMarker marker= markers[i];
- // ensure the marker has a valid model identifier attribute
- // and delete the breakpoint if not
- String modelId = marker.getAttribute(IBreakpoint.ID, null);
- if (modelId == null) {
- // marker with old/invalid format - delete
- delete.add(marker);
- } else if (!marker.getAttribute(IBreakpoint.PERSISTED, true)) {
- // the breakpoint is marked as not to be persisted,
- // schedule for deletion
- delete.add(marker);
- } else {
- persisted.add(marker);
- }
- }
- // delete any markers that are not to be restored
- if (!delete.isEmpty()) {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
- public void run(IProgressMonitor pm) throws CoreException {
- ResourcesPlugin.getWorkspace().deleteMarkers((IMarker[])delete.toArray(new IMarker[delete.size()]));
- }
- };
- fork(wr);
- }
- return (IMarker[])persisted.toArray(new IMarker[persisted.size()]);
- }
-
- /**
- * Removes this manager as a resource change listener
- * and removes all breakpoint listeners.
- */
- public void shutdown() {
- getWorkspace().removeResourceChangeListener(this);
- fBreakpointListeners.removeAll();
- }
-
- /**
- * Find the defined breakpoint extensions and cache them for use in recreating
- * breakpoints from markers.
- */
- private void initBreakpointExtensions() {
- IExtensionPoint ep= DebugPlugin.getDefault().getDescriptor().getExtensionPoint(DebugPlugin.EXTENSION_POINT_BREAKPOINTS);
- IConfigurationElement[] elements = ep.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- fBreakpointExtensions.put(elements[i].getAttribute(MARKER_TYPE), elements[i]);
- }
-
- }
-
- /**
- * Convenience method to get the workspace
- */
- private IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * @see IBreakpointManager#getBreakpoint(IMarker)
- */
- public IBreakpoint getBreakpoint(IMarker marker) {
- // ensure that breakpoints are initialized
- getBreakpoints0();
- return (IBreakpoint)fMarkersToBreakpoints.get(marker);
- }
-
- /**
- * @see IBreakpointManager#getBreakpoints()
- */
- public IBreakpoint[] getBreakpoints() {
- Vector breakpoints= getBreakpoints0();
- IBreakpoint[] temp= new IBreakpoint[breakpoints.size()];
- breakpoints.copyInto(temp);
- return temp;
- }
-
- /**
- * The BreakpointManager waits to load the breakpoints
- * of the workspace until a request is made to retrieve the
- * breakpoints.
- */
- private Vector getBreakpoints0() {
- if (fBreakpoints == null) {
- initializeBreakpoints();
- }
- return fBreakpoints;
- }
-
- /**
- * @see IBreakpointManager#getBreakpoints(String)
- */
- public IBreakpoint[] getBreakpoints(String modelIdentifier) {
- Vector allBreakpoints= getBreakpoints0();
- ArrayList temp= new ArrayList(allBreakpoints.size());
- Iterator breakpoints= allBreakpoints.iterator();
- while (breakpoints.hasNext()) {
- IBreakpoint breakpoint= (IBreakpoint) breakpoints.next();
- String id= breakpoint.getModelIdentifier();
- if (id != null && id.equals(modelIdentifier)) {
- temp.add(breakpoint);
- }
- }
- return (IBreakpoint[]) temp.toArray(new IBreakpoint[temp.size()]);
- }
-
- /**
- * Loads the list of breakpoints from the breakpoint markers in the
- * workspace.
- */
- private void initializeBreakpoints() {
- setBreakpoints(new Vector(10));
- try {
- loadBreakpoints(getWorkspace().getRoot());
- } catch (CoreException ce) {
- DebugPlugin.log(ce);
- setBreakpoints(new Vector(0));
- }
- }
-
- /**
- * @see IBreakpointManager#isRegistered(IBreakpoint)
- */
- public boolean isRegistered(IBreakpoint breakpoint) {
- return getBreakpoints0().contains(breakpoint);
- }
-
-
- /**
- * @see IBreakpointManager#removeBreakpoint(IBreakpoint, boolean)
- */
- public void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException {
- if (getBreakpoints0().remove(breakpoint)) {
- fMarkersToBreakpoints.remove(breakpoint.getMarker());
- fireUpdate(breakpoint, null, REMOVED);
- if (delete) {
- breakpoint.delete();
- } else {
- // if the breakpoint is being removed from the manager
- // because the project is closing, the breakpoint should
- // remain as registered, otherwise, the breakpoint should
- // be marked as deregistered
- IMarker marker = breakpoint.getMarker();
- if (marker.exists()) {
- IProject project = breakpoint.getMarker().getResource().getProject();
- if (project == null || project.isOpen()) {
- breakpoint.setRegistered(false);
- }
- }
- }
- }
- }
-
- /**
- * Create a breakpoint for the given marker. The created breakpoint
- * is of the type specified in the breakpoint extension associated
- * with the given marker type.
- *
- * @return a breakpoint on this marker
- * @exception DebugException if breakpoint creation fails. Reasons for
- * failure include:
- * <ol>
- * <li>The breakpoint manager cannot determine what kind of breakpoint
- * to instantiate for the given marker type</li>
- * <li>A lower level exception occurred while accessing the given marker</li>
- * </ol>
- */
- private IBreakpoint createBreakpoint(IMarker marker) throws DebugException {
- IBreakpoint breakpoint= (IBreakpoint) fMarkersToBreakpoints.get(marker);
- if (breakpoint != null) {
- return breakpoint;
- }
- try {
- IConfigurationElement config = (IConfigurationElement)fBreakpointExtensions.get(marker.getType());
- if (config == null) {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.CONFIGURATION_INVALID, MessageFormat.format(DebugCoreMessages.getString("BreakpointManager.Missing_breakpoint_definition"), new String[] {marker.getType()}), null)); //$NON-NLS-1$
- }
- breakpoint = (IBreakpoint)config.createExecutableExtension(CLASS);
- breakpoint.setMarker(marker);
- if (breakpoint.isRegistered()) {
- addBreakpoint(breakpoint);
- }
- return breakpoint;
- } catch (CoreException e) {
- throw new DebugException(e.getStatus());
- }
- }
-
- /**
- * @see IBreakpointManager#addBreakpoint(IBreakpoint)
- */
- public void addBreakpoint(IBreakpoint breakpoint) throws CoreException {
- if (!getBreakpoints0().contains(breakpoint)) {
- verifyBreakpoint(breakpoint);
- // set the registered property before adding to the collection
- // such that a change notification is not fired
- breakpoint.setRegistered(true);
- getBreakpoints0().add(breakpoint);
- fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
- fireUpdate(breakpoint, null, ADDED);
- }
- }
-
- /**
- * @see IBreakpointManager#fireBreakpointChanged(IBreakpoint)
- */
- public void fireBreakpointChanged(IBreakpoint breakpoint) {
- if (getBreakpoints0().contains(breakpoint)) {
- fireUpdate(breakpoint, null, CHANGED);
- }
- }
-
- /**
- * Verifies that the breakpoint marker has the minimal required attributes,
- * and throws a debug exception if not.
- */
- private void verifyBreakpoint(IBreakpoint breakpoint) throws DebugException {
- try {
- String id= breakpoint.getModelIdentifier();
- if (id == null) {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.CONFIGURATION_INVALID, DebugCoreMessages.getString("BreakpointManager.Missing_model_identifier"), null)); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- throw new DebugException(e.getStatus());
- }
- }
-
- /**
- * A resource has changed. Traverses the delta for breakpoint changes.
- */
- public void resourceChanged(IResourceChangeEvent event) {
- if (!isRestored()) {
- // if breakpoints have not been restored, deltas
- // should not be processed (we are unable to restore
- // breakpoints in a resource callback, as that might
- // cause the resource tree to be modififed, which is
- // not allowed during notification).
- // @see bug 9327
- return;
- }
- IResourceDelta delta= event.getDelta();
- if (delta != null) {
- try {
- if (fgVisitor == null) {
- fgVisitor= new BreakpointManagerVisitor();
- }
- delta.accept(fgVisitor);
- } catch (CoreException ce) {
- DebugPlugin.log(ce);
- }
- }
- }
-
- /**
- * Returns whether breakpoints have been restored
- * since the workbench was started.
- *
- * @return whether breakpoints have been restored
- * since the workbench was started
- */
- protected boolean isRestored() {
- return fBreakpoints != null;
- }
-
- /**
- * A project has been opened or closed. Updates the breakpoints for
- * that project
- */
- private void handleProjectResourceOpenStateChange(IResource project) {
- if (!project.isAccessible()) {
- //closed
- Enumeration breakpoints= ((Vector)getBreakpoints0().clone()).elements();
- while (breakpoints.hasMoreElements()) {
- IBreakpoint breakpoint= (IBreakpoint) breakpoints.nextElement();
- IResource markerResource= breakpoint.getMarker().getResource();
- if (project.getFullPath().isPrefixOf(markerResource.getFullPath())) {
- try {
- removeBreakpoint(breakpoint, false);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
- return;
- } else {
- try {
- loadBreakpoints(project);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
-
- /**
- * Visitor for handling resource deltas
- */
- class BreakpointManagerVisitor implements IResourceDeltaVisitor {
- /**
- * @see IResourceDeltaVisitor#visit(IResourceDelta)
- */
- public boolean visit(IResourceDelta delta) {
- if (delta == null) {
- return false;
- }
- if (0 != (delta.getFlags() & IResourceDelta.OPEN)) {
- handleProjectResourceOpenStateChange(delta.getResource());
- return false;
- }
- IMarkerDelta[] markerDeltas= delta.getMarkerDeltas();
- for (int i= 0; i < markerDeltas.length; i++) {
- IMarkerDelta markerDelta= markerDeltas[i];
- if (markerDelta.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
- switch (markerDelta.getKind()) {
- case IResourceDelta.ADDED :
- handleAddBreakpoint(delta, markerDelta.getMarker(), markerDelta);
- break;
- case IResourceDelta.REMOVED :
- handleRemoveBreakpoint(markerDelta.getMarker(), markerDelta);
- break;
- case IResourceDelta.CHANGED :
- handleChangeBreakpoint(markerDelta.getMarker(), markerDelta);
- break;
- }
- }
- }
-
- return true;
- }
-
- /**
- * Wrapper for handling adds
- */
- protected void handleAddBreakpoint(IResourceDelta rDelta, final IMarker marker, IMarkerDelta mDelta) {
- if (0 != (rDelta.getFlags() & IResourceDelta.MOVED_FROM)) {
- // This breakpoint has actually been moved - already removed
- // from the Breakpoint manager during the remove callback
- // Delete the marker associated with the new resource
- IWorkspaceRunnable wRunnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- try {
- marker.delete();
- } catch (CoreException ce) {
- DebugPlugin.log(ce);
- }
- }
- };
- fork(wRunnable);
- } else {
- // do nothing - we do not add until explicitly added
- }
- }
-
- /**
- * Wrapper for handling removes
- */
- protected void handleRemoveBreakpoint(IMarker marker, IMarkerDelta delta) {
- IBreakpoint breakpoint= getBreakpoint(marker);
- if (breakpoint != null) {
- try {
- removeBreakpoint(breakpoint, false);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
-
- /**
- * Wrapper for handling changes
- */
- protected void handleChangeBreakpoint(IMarker marker, IMarkerDelta delta) {
- final IBreakpoint breakpoint= getBreakpoint(marker);
- if (breakpoint != null && isRegistered(breakpoint)) {
- fireUpdate(breakpoint, delta, CHANGED);
- }
- }
- }
-
- /**
- * @see IBreakpointManager#addBreakpointListener(IBreakpointListener)
- */
- public void addBreakpointListener(IBreakpointListener listener) {
- fBreakpointListeners.add(listener);
- }
-
- /**
- * @see IBreakpointManager#removeBreakpointListener(IBreakpointListener)
- */
- public void removeBreakpointListener(IBreakpointListener listener) {
- fBreakpointListeners.remove(listener);
- }
-
- /**
- * Notifies listeners of the add/remove/change
- */
- private void fireUpdate(IBreakpoint breakpoint, IMarkerDelta delta, int update) {
- Object[] copiedListeners= fBreakpointListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- IBreakpointListener listener = (IBreakpointListener)copiedListeners[i];
- switch (update) {
- case ADDED:
- listener.breakpointAdded(breakpoint);
- break;
- case REMOVED:
- listener.breakpointRemoved(breakpoint, delta);
- break;
- case CHANGED:
- listener.breakpointChanged(breakpoint, delta);
- break;
- }
- }
- }
-
- protected void setBreakpoints(Vector breakpoints) {
- fBreakpoints = breakpoints;
- }
-
- protected void fork(final IWorkspaceRunnable wRunnable) {
- Runnable runnable= new Runnable() {
- public void run() {
- try {
- getWorkspace().run(wRunnable, null);
- } catch (CoreException ce) {
- DebugPlugin.log(ce);
- }
- }
- };
- new Thread(runnable).start();
- }
-
- /**
- * @see IBreakpointManager#hasBreakpoints()
- */
- public boolean hasBreakpoints() {
- return !getBreakpoints0().isEmpty();
- }
-}
-
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointListener;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.model.IBreakpoint;
+
+/**
+ * The breakpoint manager manages all registered breakpoints
+ * for the debug plugin. It is instantiated by the debug plugin at startup.
+ *
+ * @see IBreakpointManager
+ */
+public class BreakpointManager implements IBreakpointManager, IResourceChangeListener {
+
+ /**
+ * Constants for breakpoint add/remove/change updates
+ */
+ private final static int ADDED = 0;
+ private final static int REMOVED = 1;
+ private final static int CHANGED = 2;
+
+ /**
+ * String constants corresponding to XML extension keys
+ */
+ private final static String CLASS = "class"; //$NON-NLS-1$
+
+ /**
+ * Attribute name for the <code>"markerType"</code> attribute of
+ * a breakpoint extension.
+ */
+ private static final String MARKER_TYPE= "markerType"; //$NON-NLS-1$
+
+ /**
+ * A collection of breakpoints registered with this manager.
+ */
+ private Vector fBreakpoints= null;
+
+ /**
+ * A table of breakpoint extension points, keyed by
+ * marker type
+ * key: a marker type
+ * value: the breakpoint extension which corresponds to that marker type
+ */
+ private HashMap fBreakpointExtensions;
+
+ /**
+ * Collection of markers that associates markers to breakpoints
+ * key: a marker
+ * value: the breakpoint which contains that marker
+ */
+ private HashMap fMarkersToBreakpoints;
+
+ /**
+ * Collection of breakpoint listeners.
+ */
+ private ListenerList fBreakpointListeners= new ListenerList(6);
+
+ /**
+ * Singleton resource delta visitor which handles marker
+ * additions, changes, and removals.
+ */
+ private static BreakpointManagerVisitor fgVisitor;
+
+ /**
+ * Constructs a new breakpoint manager.
+ */
+ public BreakpointManager() {
+ fMarkersToBreakpoints= new HashMap(10);
+ fBreakpointExtensions = new HashMap(15);
+ }
+
+ /**
+ * Registers this manager as a resource change listener and
+ * initializes the collection of defined breakpoint extensions.
+ *
+ * This method should only be called on initial startup of
+ * the debug plugin.
+ */
+ public void startup() throws CoreException {
+ getWorkspace().addResourceChangeListener(this);
+ }
+
+ /**
+ * Loads all the breakpoints on the given resource.
+ *
+ * @param resource the resource which contains the breakpoints
+ */
+ private void loadBreakpoints(IResource resource) throws CoreException {
+ initBreakpointExtensions();
+ IMarker[] markers= getPersistedMarkers(resource);
+ for (int i = 0; i < markers.length; i++) {
+ IMarker marker= markers[i];
+ try {
+ createBreakpoint(marker);
+ } catch (DebugException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ }
+
+ /**
+ * Returns the persisted markers associated with the given resource.
+ *
+ * Delete any non-persisted/invalid breakpoint markers. This is done
+ * at startup rather than shutdown, since the changes made at
+ * shutdown are not persisted as the workspace state has already
+ * been saved. See bug 7683.
+ */
+ protected IMarker[] getPersistedMarkers(IResource resource) throws CoreException {
+ IMarker[] markers= resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
+ final List delete = new ArrayList();
+ List persisted= new ArrayList();
+ for (int i = 0; i < markers.length; i++) {
+ IMarker marker= markers[i];
+ // ensure the marker has a valid model identifier attribute
+ // and delete the breakpoint if not
+ String modelId = marker.getAttribute(IBreakpoint.ID, null);
+ if (modelId == null) {
+ // marker with old/invalid format - delete
+ delete.add(marker);
+ } else if (!marker.getAttribute(IBreakpoint.PERSISTED, true)) {
+ // the breakpoint is marked as not to be persisted,
+ // schedule for deletion
+ delete.add(marker);
+ } else {
+ persisted.add(marker);
+ }
+ }
+ // delete any markers that are not to be restored
+ if (!delete.isEmpty()) {
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor pm) throws CoreException {
+ ResourcesPlugin.getWorkspace().deleteMarkers((IMarker[])delete.toArray(new IMarker[delete.size()]));
+ }
+ };
+ fork(wr);
+ }
+ return (IMarker[])persisted.toArray(new IMarker[persisted.size()]);
+ }
+
+ /**
+ * Removes this manager as a resource change listener
+ * and removes all breakpoint listeners.
+ */
+ public void shutdown() {
+ getWorkspace().removeResourceChangeListener(this);
+ fBreakpointListeners.removeAll();
+ }
+
+ /**
+ * Find the defined breakpoint extensions and cache them for use in recreating
+ * breakpoints from markers.
+ */
+ private void initBreakpointExtensions() {
+ IExtensionPoint ep= DebugPlugin.getDefault().getDescriptor().getExtensionPoint(DebugPlugin.EXTENSION_POINT_BREAKPOINTS);
+ IConfigurationElement[] elements = ep.getConfigurationElements();
+ for (int i= 0; i < elements.length; i++) {
+ fBreakpointExtensions.put(elements[i].getAttribute(MARKER_TYPE), elements[i]);
+ }
+
+ }
+
+ /**
+ * Convenience method to get the workspace
+ */
+ private IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /**
+ * @see IBreakpointManager#getBreakpoint(IMarker)
+ */
+ public IBreakpoint getBreakpoint(IMarker marker) {
+ // ensure that breakpoints are initialized
+ getBreakpoints0();
+ return (IBreakpoint)fMarkersToBreakpoints.get(marker);
+ }
+
+ /**
+ * @see IBreakpointManager#getBreakpoints()
+ */
+ public IBreakpoint[] getBreakpoints() {
+ Vector breakpoints= getBreakpoints0();
+ IBreakpoint[] temp= new IBreakpoint[breakpoints.size()];
+ breakpoints.copyInto(temp);
+ return temp;
+ }
+
+ /**
+ * The BreakpointManager waits to load the breakpoints
+ * of the workspace until a request is made to retrieve the
+ * breakpoints.
+ */
+ private Vector getBreakpoints0() {
+ if (fBreakpoints == null) {
+ initializeBreakpoints();
+ }
+ return fBreakpoints;
+ }
+
+ /**
+ * @see IBreakpointManager#getBreakpoints(String)
+ */
+ public IBreakpoint[] getBreakpoints(String modelIdentifier) {
+ Vector allBreakpoints= getBreakpoints0();
+ ArrayList temp= new ArrayList(allBreakpoints.size());
+ Iterator breakpoints= allBreakpoints.iterator();
+ while (breakpoints.hasNext()) {
+ IBreakpoint breakpoint= (IBreakpoint) breakpoints.next();
+ String id= breakpoint.getModelIdentifier();
+ if (id != null && id.equals(modelIdentifier)) {
+ temp.add(breakpoint);
+ }
+ }
+ return (IBreakpoint[]) temp.toArray(new IBreakpoint[temp.size()]);
+ }
+
+ /**
+ * Loads the list of breakpoints from the breakpoint markers in the
+ * workspace.
+ */
+ private void initializeBreakpoints() {
+ setBreakpoints(new Vector(10));
+ try {
+ loadBreakpoints(getWorkspace().getRoot());
+ } catch (CoreException ce) {
+ DebugPlugin.log(ce);
+ setBreakpoints(new Vector(0));
+ }
+ }
+
+ /**
+ * @see IBreakpointManager#isRegistered(IBreakpoint)
+ */
+ public boolean isRegistered(IBreakpoint breakpoint) {
+ return getBreakpoints0().contains(breakpoint);
+ }
+
+
+ /**
+ * @see IBreakpointManager#removeBreakpoint(IBreakpoint, boolean)
+ */
+ public void removeBreakpoint(IBreakpoint breakpoint, boolean delete) throws CoreException {
+ if (getBreakpoints0().remove(breakpoint)) {
+ fMarkersToBreakpoints.remove(breakpoint.getMarker());
+ fireUpdate(breakpoint, null, REMOVED);
+ if (delete) {
+ breakpoint.delete();
+ } else {
+ // if the breakpoint is being removed from the manager
+ // because the project is closing, the breakpoint should
+ // remain as registered, otherwise, the breakpoint should
+ // be marked as deregistered
+ IMarker marker = breakpoint.getMarker();
+ if (marker.exists()) {
+ IProject project = breakpoint.getMarker().getResource().getProject();
+ if (project == null || project.isOpen()) {
+ breakpoint.setRegistered(false);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a breakpoint for the given marker. The created breakpoint
+ * is of the type specified in the breakpoint extension associated
+ * with the given marker type.
+ *
+ * @return a breakpoint on this marker
+ * @exception DebugException if breakpoint creation fails. Reasons for
+ * failure include:
+ * <ol>
+ * <li>The breakpoint manager cannot determine what kind of breakpoint
+ * to instantiate for the given marker type</li>
+ * <li>A lower level exception occurred while accessing the given marker</li>
+ * </ol>
+ */
+ private IBreakpoint createBreakpoint(IMarker marker) throws DebugException {
+ IBreakpoint breakpoint= (IBreakpoint) fMarkersToBreakpoints.get(marker);
+ if (breakpoint != null) {
+ return breakpoint;
+ }
+ try {
+ IConfigurationElement config = (IConfigurationElement)fBreakpointExtensions.get(marker.getType());
+ if (config == null) {
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.CONFIGURATION_INVALID, MessageFormat.format(DebugCoreMessages.getString("BreakpointManager.Missing_breakpoint_definition"), new String[] {marker.getType()}), null)); //$NON-NLS-1$
+ }
+ breakpoint = (IBreakpoint)config.createExecutableExtension(CLASS);
+ breakpoint.setMarker(marker);
+ if (breakpoint.isRegistered()) {
+ addBreakpoint(breakpoint);
+ }
+ return breakpoint;
+ } catch (CoreException e) {
+ throw new DebugException(e.getStatus());
+ }
+ }
+
+ /**
+ * @see IBreakpointManager#addBreakpoint(IBreakpoint)
+ */
+ public void addBreakpoint(IBreakpoint breakpoint) throws CoreException {
+ if (!getBreakpoints0().contains(breakpoint)) {
+ verifyBreakpoint(breakpoint);
+ // set the registered property before adding to the collection
+ // such that a change notification is not fired
+ breakpoint.setRegistered(true);
+ getBreakpoints0().add(breakpoint);
+ fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
+ fireUpdate(breakpoint, null, ADDED);
+ }
+ }
+
+ /**
+ * @see IBreakpointManager#fireBreakpointChanged(IBreakpoint)
+ */
+ public void fireBreakpointChanged(IBreakpoint breakpoint) {
+ if (getBreakpoints0().contains(breakpoint)) {
+ fireUpdate(breakpoint, null, CHANGED);
+ }
+ }
+
+ /**
+ * Verifies that the breakpoint marker has the minimal required attributes,
+ * and throws a debug exception if not.
+ */
+ private void verifyBreakpoint(IBreakpoint breakpoint) throws DebugException {
+ try {
+ String id= breakpoint.getModelIdentifier();
+ if (id == null) {
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.CONFIGURATION_INVALID, DebugCoreMessages.getString("BreakpointManager.Missing_model_identifier"), null)); //$NON-NLS-1$
+ }
+ } catch (CoreException e) {
+ throw new DebugException(e.getStatus());
+ }
+ }
+
+ /**
+ * A resource has changed. Traverses the delta for breakpoint changes.
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ if (!isRestored()) {
+ // if breakpoints have not been restored, deltas
+ // should not be processed (we are unable to restore
+ // breakpoints in a resource callback, as that might
+ // cause the resource tree to be modififed, which is
+ // not allowed during notification).
+ // @see bug 9327
+ return;
+ }
+ IResourceDelta delta= event.getDelta();
+ if (delta != null) {
+ try {
+ if (fgVisitor == null) {
+ fgVisitor= new BreakpointManagerVisitor();
+ }
+ delta.accept(fgVisitor);
+ } catch (CoreException ce) {
+ DebugPlugin.log(ce);
+ }
+ }
+ }
+
+ /**
+ * Returns whether breakpoints have been restored
+ * since the workbench was started.
+ *
+ * @return whether breakpoints have been restored
+ * since the workbench was started
+ */
+ protected boolean isRestored() {
+ return fBreakpoints != null;
+ }
+
+ /**
+ * A project has been opened or closed. Updates the breakpoints for
+ * that project
+ */
+ private void handleProjectResourceOpenStateChange(IResource project) {
+ if (!project.isAccessible()) {
+ //closed
+ Enumeration breakpoints= ((Vector)getBreakpoints0().clone()).elements();
+ while (breakpoints.hasMoreElements()) {
+ IBreakpoint breakpoint= (IBreakpoint) breakpoints.nextElement();
+ IResource markerResource= breakpoint.getMarker().getResource();
+ if (project.getFullPath().isPrefixOf(markerResource.getFullPath())) {
+ try {
+ removeBreakpoint(breakpoint, false);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ }
+ return;
+ } else {
+ try {
+ loadBreakpoints(project);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ }
+
+ /**
+ * Visitor for handling resource deltas
+ */
+ class BreakpointManagerVisitor implements IResourceDeltaVisitor {
+ /**
+ * @see IResourceDeltaVisitor#visit(IResourceDelta)
+ */
+ public boolean visit(IResourceDelta delta) {
+ if (delta == null) {
+ return false;
+ }
+ if (0 != (delta.getFlags() & IResourceDelta.OPEN)) {
+ handleProjectResourceOpenStateChange(delta.getResource());
+ return false;
+ }
+ IMarkerDelta[] markerDeltas= delta.getMarkerDeltas();
+ for (int i= 0; i < markerDeltas.length; i++) {
+ IMarkerDelta markerDelta= markerDeltas[i];
+ if (markerDelta.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
+ switch (markerDelta.getKind()) {
+ case IResourceDelta.ADDED :
+ handleAddBreakpoint(delta, markerDelta.getMarker(), markerDelta);
+ break;
+ case IResourceDelta.REMOVED :
+ handleRemoveBreakpoint(markerDelta.getMarker(), markerDelta);
+ break;
+ case IResourceDelta.CHANGED :
+ handleChangeBreakpoint(markerDelta.getMarker(), markerDelta);
+ break;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Wrapper for handling adds
+ */
+ protected void handleAddBreakpoint(IResourceDelta rDelta, final IMarker marker, IMarkerDelta mDelta) {
+ if (0 != (rDelta.getFlags() & IResourceDelta.MOVED_FROM)) {
+ // This breakpoint has actually been moved - already removed
+ // from the Breakpoint manager during the remove callback
+ // Delete the marker associated with the new resource
+ IWorkspaceRunnable wRunnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) {
+ try {
+ marker.delete();
+ } catch (CoreException ce) {
+ DebugPlugin.log(ce);
+ }
+ }
+ };
+ fork(wRunnable);
+ } else {
+ // do nothing - we do not add until explicitly added
+ }
+ }
+
+ /**
+ * Wrapper for handling removes
+ */
+ protected void handleRemoveBreakpoint(IMarker marker, IMarkerDelta delta) {
+ IBreakpoint breakpoint= getBreakpoint(marker);
+ if (breakpoint != null) {
+ try {
+ removeBreakpoint(breakpoint, false);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ }
+
+ /**
+ * Wrapper for handling changes
+ */
+ protected void handleChangeBreakpoint(IMarker marker, IMarkerDelta delta) {
+ final IBreakpoint breakpoint= getBreakpoint(marker);
+ if (breakpoint != null && isRegistered(breakpoint)) {
+ fireUpdate(breakpoint, delta, CHANGED);
+ }
+ }
+ }
+
+ /**
+ * @see IBreakpointManager#addBreakpointListener(IBreakpointListener)
+ */
+ public void addBreakpointListener(IBreakpointListener listener) {
+ fBreakpointListeners.add(listener);
+ }
+
+ /**
+ * @see IBreakpointManager#removeBreakpointListener(IBreakpointListener)
+ */
+ public void removeBreakpointListener(IBreakpointListener listener) {
+ fBreakpointListeners.remove(listener);
+ }
+
+ /**
+ * Notifies listeners of the add/remove/change
+ */
+ private void fireUpdate(IBreakpoint breakpoint, IMarkerDelta delta, int update) {
+ Object[] copiedListeners= fBreakpointListeners.getListeners();
+ for (int i= 0; i < copiedListeners.length; i++) {
+ IBreakpointListener listener = (IBreakpointListener)copiedListeners[i];
+ switch (update) {
+ case ADDED:
+ listener.breakpointAdded(breakpoint);
+ break;
+ case REMOVED:
+ listener.breakpointRemoved(breakpoint, delta);
+ break;
+ case CHANGED:
+ listener.breakpointChanged(breakpoint, delta);
+ break;
+ }
+ }
+ }
+
+ protected void setBreakpoints(Vector breakpoints) {
+ fBreakpoints = breakpoints;
+ }
+
+ protected void fork(final IWorkspaceRunnable wRunnable) {
+ Runnable runnable= new Runnable() {
+ public void run() {
+ try {
+ getWorkspace().run(wRunnable, null);
+ } catch (CoreException ce) {
+ DebugPlugin.log(ce);
+ }
+ }
+ };
+ new Thread(runnable).start();
+ }
+
+ /**
+ * @see IBreakpointManager#hasBreakpoints()
+ */
+ public boolean hasBreakpoints() {
+ return !getBreakpoints0().isEmpty();
+ }
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
index 4953856fc..e9885ccd0 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
@@ -1,26 +1,26 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.debug.internal.core;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class DebugCoreMessages {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.debug.internal.core.DebugCoreMessages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private DebugCoreMessages() {
- }
-
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+package org.eclipse.debug.internal.core;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class DebugCoreMessages {
+
+ private static final String RESOURCE_BUNDLE= "org.eclipse.debug.internal.core.DebugCoreMessages";//$NON-NLS-1$
+
+ private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+
+ private DebugCoreMessages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
index 4e8a8d959..a315f3860 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
@@ -1,56 +1,56 @@
-######################################################################
-# Copyright (c) 2000, 2002 IBM Corp. and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v0.5
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v05.html
-#
-# Contributors:
-# IBM Corporation - Initial implementation
-######################################################################
-
-Breakpoint.no_associated_marker=Breakpoint does not have an associated marker.
-
-BreakpointManager.Missing_breakpoint_definition=Missing breakpoint definition for marker type {0}
-BreakpointManager.Missing_model_identifier=Breakpoint missing debug model identifier
-
-DebugEvent.illegal_detail=detail is not one of the allowed constants, see IDebugEventConstants
-DebugEvent.illegal_kind=kind is not one of the allowed constants, see IDebugEventConstants
-
-DebugPlugin.Invalid_status_handler_extension__{0}_2=Invalid status handler extension: {0}
-
-InputStreamMonitor.label=Input Stream Monitor
-
-Launch.terminate_failed=Terminate failed
-
-LaunchConfiguration.Exception_occurred_creating_launch_configuration_memento_9=Exception occurred creating launch configuration memento
-LaunchConfiguration.Exception_occurred_parsing_memento_5=Exception occurred parsing memento
-LaunchConfiguration.Failed_to_delete_launch_configuration._1=Failed to delete launch configuration.
-LaunchConfiguration.Invalid_launch_configuration_memento__missing_path_attribute_3=Invalid launch configuration memento: missing path attribute
-LaunchConfiguration.Invalid_launch_configuration_memento__missing_local_attribute_4=Invalid launch configuration memento: missing local attribute
-
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_boolean._3=Attribute {0} is not of type boolean.
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_int._2=Attribute {0} is not of type int.
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.lang.String._1=Attribute {0} is not of type java.lang.String.
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.List._1=Attribute {0} is not of type java.util.List.
-LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.Map._1=Attribute {0} is not of type java.util.Map.
-LaunchConfigurationInfo.Invalid_launch_configuration_XML._10=Invalid launch configuration XML.
-LaunchConfigurationInfo.Launch_configuration_type_id___{0}___does_not_exist._nPossible_causes__n_tMissing_specification_of_a_launch_type_(missing_plugin)_n_tIncorrect_launch_configuration_XML_1=Launch configuration type id \"{0}\" does not exist.\nPossible causes:\n\tMissing specification of a launch type (missing plugin)\n\tIncorrect launch configuration XML
-
-LaunchConfigurationWorkingCopy.{0}_occurred_generating_launch_configuration_XML._1={0} occurred generating launch configuration XML.
-LaunchConfigurationWorkingCopy.Specified_container_for_launch_configuration_does_not_exist_2=Specified container for launch configuration does not exist
-
-LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1=Exception occurred while reading launch configuration file: {0}.
-LaunchManager.Invalid_launch_configuration_index._18=Invalid launch configuration index.
-LaunchManager.Invalid_source_locator_extentsion_defined_by_plug-in___{0}______id___not_specified_12=Invalid source locator extension defined by plug-in \"{0}\": \"id\" not specified
-LaunchManager.Launch_configuration_does_not_exist._6=Launch configuration does not exist.
-LaunchManager.Source_locator_does_not_exist__{0}_13=Source locator does not exist: {0}
-LaunchManager.Unable_to_restore_invalid_launch_configuration=Unable to restore invalid launch configuration {0}
-LaunchManager.Invalid_launch_configuration_comparator_extension_defined_by_plug-in_{0}_-_attribute_not_specified_1=Invalid launch configuration comparator extension defined by plug-in {0} - attribute not specified
-
-OutputStreamMonitor.label=Output Stream Monitor
-
-ProcessMonitor.label=Process Monitor
-
-RuntimeProcess.terminate_failed=Terminate failed
+######################################################################
+# Copyright (c) 2000, 2002 IBM Corp. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Common Public License v0.5
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/cpl-v05.html
+#
+# Contributors:
+# IBM Corporation - Initial implementation
+######################################################################
+
+Breakpoint.no_associated_marker=Breakpoint does not have an associated marker.
+
+BreakpointManager.Missing_breakpoint_definition=Missing breakpoint definition for marker type {0}
+BreakpointManager.Missing_model_identifier=Breakpoint missing debug model identifier
+
+DebugEvent.illegal_detail=detail is not one of the allowed constants, see IDebugEventConstants
+DebugEvent.illegal_kind=kind is not one of the allowed constants, see IDebugEventConstants
+
+DebugPlugin.Invalid_status_handler_extension__{0}_2=Invalid status handler extension: {0}
+
+InputStreamMonitor.label=Input Stream Monitor
+
+Launch.terminate_failed=Terminate failed
+
+LaunchConfiguration.Exception_occurred_creating_launch_configuration_memento_9=Exception occurred creating launch configuration memento
+LaunchConfiguration.Exception_occurred_parsing_memento_5=Exception occurred parsing memento
+LaunchConfiguration.Failed_to_delete_launch_configuration._1=Failed to delete launch configuration.
+LaunchConfiguration.Invalid_launch_configuration_memento__missing_path_attribute_3=Invalid launch configuration memento: missing path attribute
+LaunchConfiguration.Invalid_launch_configuration_memento__missing_local_attribute_4=Invalid launch configuration memento: missing local attribute
+
+LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_boolean._3=Attribute {0} is not of type boolean.
+LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_int._2=Attribute {0} is not of type int.
+LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.lang.String._1=Attribute {0} is not of type java.lang.String.
+LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.List._1=Attribute {0} is not of type java.util.List.
+LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.Map._1=Attribute {0} is not of type java.util.Map.
+LaunchConfigurationInfo.Invalid_launch_configuration_XML._10=Invalid launch configuration XML.
+LaunchConfigurationInfo.Launch_configuration_type_id___{0}___does_not_exist._nPossible_causes__n_tMissing_specification_of_a_launch_type_(missing_plugin)_n_tIncorrect_launch_configuration_XML_1=Launch configuration type id \"{0}\" does not exist.\nPossible causes:\n\tMissing specification of a launch type (missing plugin)\n\tIncorrect launch configuration XML
+
+LaunchConfigurationWorkingCopy.{0}_occurred_generating_launch_configuration_XML._1={0} occurred generating launch configuration XML.
+LaunchConfigurationWorkingCopy.Specified_container_for_launch_configuration_does_not_exist_2=Specified container for launch configuration does not exist
+
+LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1=Exception occurred while reading launch configuration file: {0}.
+LaunchManager.Invalid_launch_configuration_index._18=Invalid launch configuration index.
+LaunchManager.Invalid_source_locator_extentsion_defined_by_plug-in___{0}______id___not_specified_12=Invalid source locator extension defined by plug-in \"{0}\": \"id\" not specified
+LaunchManager.Launch_configuration_does_not_exist._6=Launch configuration does not exist.
+LaunchManager.Source_locator_does_not_exist__{0}_13=Source locator does not exist: {0}
+LaunchManager.Unable_to_restore_invalid_launch_configuration=Unable to restore invalid launch configuration {0}
+LaunchManager.Invalid_launch_configuration_comparator_extension_defined_by_plug-in_{0}_-_attribute_not_specified_1=Invalid launch configuration comparator extension defined by plug-in {0} - attribute not specified
+
+OutputStreamMonitor.label=Output Stream Monitor
+
+ProcessMonitor.label=Process Monitor
+
+RuntimeProcess.terminate_failed=Terminate failed
RuntimeProcess.Exit_value_not_available_until_process_terminates._1=Exit value not available until process terminates. \ No newline at end of file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
index 3ffadb7d7..711d65dde 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
@@ -1,189 +1,189 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.IExpressionListener;
-import org.eclipse.debug.core.IExpressionManager;
-import org.eclipse.debug.core.model.IExpression;
-
-/**
- * The expression manager manages all registered expressions
- * for the debug plugin. It is instantiated by the debug plugin
- * at startup.
- *
- * [XXX: expression persistence not yet implemented]
- *
- * @see IExpressionManager
- */
-public class ExpressionManager implements IExpressionManager, IDebugEventSetListener {
-
- /**
- * Collection of registered expressions.
- */
- private Vector fExpressions = new Vector(10);
-
- /**
- * List of expression listeners
- */
- private ListenerList fListeners = new ListenerList(2);
-
- /**
- * @see IExpressionManager#addExpression(IExpression, String)
- */
- public void addExpression(IExpression expression) {
- if (getExpressions0().indexOf(expression) == -1) {
- getExpressions0().add(expression);
- fireExpressionAdded(expression);
- }
- }
-
- /**
- * @see IExpressionManager#getExpressions()
- */
- public IExpression[] getExpressions() {
- Vector expressions = getExpressions0();
- IExpression[] temp= new IExpression[expressions.size()];
- expressions.copyInto(temp);
- return temp;
- }
-
- /**
- * @see IExpressionManager#getExpressions(String)
- */
- public IExpression[] getExpressions(String modelIdentifier) {
- Vector expressions = getExpressions0();
- ArrayList temp= new ArrayList(expressions.size());
- Iterator iter= expressions.iterator();
- while (iter.hasNext()) {
- IExpression expression= (IExpression) iter.next();
- String id= expression.getModelIdentifier();
- if (id != null && id.equals(modelIdentifier)) {
- temp.add(expression);
- }
- }
- return (IExpression[]) temp.toArray(new IExpression[temp.size()]);
- }
-
- /**
- * @see IExpressionManager#removeExpression(IExpression)
- */
- public void removeExpression(IExpression expression) {
- if (getExpressions0().indexOf(expression) >= 0) {
- getExpressions0().remove(expression);
- expression.dispose();
- fireExpressionRemoved(expression);
- }
- }
-
- /**
- * @see IExpressionManager#addExpressionListener(IExpressionListener)
- */
- public void addExpressionListener(IExpressionListener listener) {
- fListeners.add(listener);
- }
-
- /**
- * @see IExpressionManager#removeExpressionListener(IExpressionListener)
- */
- public void removeExpressionListener(IExpressionListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * Called be the debug plug-in when starting up.
- */
- public void startup() {
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
-
- /**
- * Called by the debug plug-in when shutting down.
- */
- public void shutdown() {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
-
- /**
- * Returns the list of registered expressions as
- * a vector.
- *
- * @return vector of registered expressions
- */
- protected Vector getExpressions0() {
- return fExpressions;
- }
-
- /**
- * @see IDebugEventSetListener#handleDebugEvent(DebugEvent)
- */
- public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
- if (event.getSource() instanceof IExpression) {
- switch (event.getKind()) {
- case DebugEvent.CHANGE:
- fireExpressionChanged((IExpression)event.getSource());
- break;
- default:
- break;
- }
- }
- }
- }
-
- /**
- * Notifies listeners that the given expression has been
- * added.
- *
- * @param expression the newly added expression
- */
- protected void fireExpressionAdded(IExpression expression) {
- Object[] listeners = fListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ((IExpressionListener)listeners[i]).expressionAdded(expression);
- }
- }
-
- /**
- * Notifies listeners that the given expression has been
- * removed.
- *
- * @param expression the removed expression
- */
- protected void fireExpressionRemoved(IExpression expression) {
- Object[] listeners = fListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ((IExpressionListener)listeners[i]).expressionRemoved(expression);
- }
- }
-
- /**
- * Notifies listeners that the given expression has changed.
- *
- * @param expression the changed expression
- */
- protected void fireExpressionChanged(IExpression expression) {
- Object[] listeners = fListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ((IExpressionListener)listeners[i]).expressionChanged(expression);
- }
- }
-
- /**
- * @see IExpressionManager#hasExpressions()
- */
- public boolean hasExpressions() {
- return !getExpressions0().isEmpty();
- }
-
-}
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IDebugEventSetListener;
+import org.eclipse.debug.core.IExpressionListener;
+import org.eclipse.debug.core.IExpressionManager;
+import org.eclipse.debug.core.model.IExpression;
+
+/**
+ * The expression manager manages all registered expressions
+ * for the debug plugin. It is instantiated by the debug plugin
+ * at startup.
+ *
+ * [XXX: expression persistence not yet implemented]
+ *
+ * @see IExpressionManager
+ */
+public class ExpressionManager implements IExpressionManager, IDebugEventSetListener {
+
+ /**
+ * Collection of registered expressions.
+ */
+ private Vector fExpressions = new Vector(10);
+
+ /**
+ * List of expression listeners
+ */
+ private ListenerList fListeners = new ListenerList(2);
+
+ /**
+ * @see IExpressionManager#addExpression(IExpression, String)
+ */
+ public void addExpression(IExpression expression) {
+ if (getExpressions0().indexOf(expression) == -1) {
+ getExpressions0().add(expression);
+ fireExpressionAdded(expression);
+ }
+ }
+
+ /**
+ * @see IExpressionManager#getExpressions()
+ */
+ public IExpression[] getExpressions() {
+ Vector expressions = getExpressions0();
+ IExpression[] temp= new IExpression[expressions.size()];
+ expressions.copyInto(temp);
+ return temp;
+ }
+
+ /**
+ * @see IExpressionManager#getExpressions(String)
+ */
+ public IExpression[] getExpressions(String modelIdentifier) {
+ Vector expressions = getExpressions0();
+ ArrayList temp= new ArrayList(expressions.size());
+ Iterator iter= expressions.iterator();
+ while (iter.hasNext()) {
+ IExpression expression= (IExpression) iter.next();
+ String id= expression.getModelIdentifier();
+ if (id != null && id.equals(modelIdentifier)) {
+ temp.add(expression);
+ }
+ }
+ return (IExpression[]) temp.toArray(new IExpression[temp.size()]);
+ }
+
+ /**
+ * @see IExpressionManager#removeExpression(IExpression)
+ */
+ public void removeExpression(IExpression expression) {
+ if (getExpressions0().indexOf(expression) >= 0) {
+ getExpressions0().remove(expression);
+ expression.dispose();
+ fireExpressionRemoved(expression);
+ }
+ }
+
+ /**
+ * @see IExpressionManager#addExpressionListener(IExpressionListener)
+ */
+ public void addExpressionListener(IExpressionListener listener) {
+ fListeners.add(listener);
+ }
+
+ /**
+ * @see IExpressionManager#removeExpressionListener(IExpressionListener)
+ */
+ public void removeExpressionListener(IExpressionListener listener) {
+ fListeners.remove(listener);
+ }
+
+ /**
+ * Called be the debug plug-in when starting up.
+ */
+ public void startup() {
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ }
+
+ /**
+ * Called by the debug plug-in when shutting down.
+ */
+ public void shutdown() {
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ }
+
+ /**
+ * Returns the list of registered expressions as
+ * a vector.
+ *
+ * @return vector of registered expressions
+ */
+ protected Vector getExpressions0() {
+ return fExpressions;
+ }
+
+ /**
+ * @see IDebugEventSetListener#handleDebugEvent(DebugEvent)
+ */
+ public void handleDebugEvents(DebugEvent[] events) {
+ for (int i = 0; i < events.length; i++) {
+ DebugEvent event = events[i];
+ if (event.getSource() instanceof IExpression) {
+ switch (event.getKind()) {
+ case DebugEvent.CHANGE:
+ fireExpressionChanged((IExpression)event.getSource());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Notifies listeners that the given expression has been
+ * added.
+ *
+ * @param expression the newly added expression
+ */
+ protected void fireExpressionAdded(IExpression expression) {
+ Object[] listeners = fListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ((IExpressionListener)listeners[i]).expressionAdded(expression);
+ }
+ }
+
+ /**
+ * Notifies listeners that the given expression has been
+ * removed.
+ *
+ * @param expression the removed expression
+ */
+ protected void fireExpressionRemoved(IExpression expression) {
+ Object[] listeners = fListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ((IExpressionListener)listeners[i]).expressionRemoved(expression);
+ }
+ }
+
+ /**
+ * Notifies listeners that the given expression has changed.
+ *
+ * @param expression the changed expression
+ */
+ protected void fireExpressionChanged(IExpression expression) {
+ Object[] listeners = fListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ((IExpressionListener)listeners[i]).expressionChanged(expression);
+ }
+ }
+
+ /**
+ * @see IExpressionManager#hasExpressions()
+ */
+ public boolean hasExpressions() {
+ return !getExpressions0().isEmpty();
+ }
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
index a3b2be67f..fc0e2f0f8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java
@@ -1,124 +1,124 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Vector;
-
-import org.eclipse.debug.core.DebugPlugin;
-
-/**
- * Writes to the input stream of a system process,
- * queueing output if the stream is blocked.
- *
- * The input stream monitor writes to system in via
- * an output stream.
- */
-public class InputStreamMonitor {
-
- /**
- * The stream which is being written to (connected to system in).
- */
- private OutputStream fStream;
- /**
- * The queue of output.
- */
- private Vector fQueue;
- /**
- * The thread which writes to the stream.
- */
- private Thread fThread;
- /**
- * A lock for ensuring that writes to the queue are contiguous
- */
- private Object fLock;
-
- /**
- * Creates an input stream monitor which writes
- * to system in via the given output stream.
- */
- public InputStreamMonitor(OutputStream stream) {
- fStream= stream;
- fQueue= new Vector();
- fLock= new Object();
- }
-
- /**
- * Appends the given text to the stream, or
- * queues the text to be written at a later time
- * if the stream is blocked.
- */
- public void write(String text) {
- synchronized(fLock) {
- fQueue.add(text);
- fLock.notifyAll();
- }
- }
-
- /**
- * Starts a thread which writes the stream.
- */
- public void startMonitoring() {
- if (fThread == null) {
- fThread= new Thread(new Runnable() {
- public void run() {
- write();
- }
- }, DebugCoreMessages.getString("InputStreamMonitor.label")); //$NON-NLS-1$
- fThread.start();
- }
- }
-
- /**
- * Close all communications between this
- * monitor and the underlying stream.
- */
- public void close() {
- if (fThread != null) {
- Thread thread= fThread;
- fThread= null;
- thread.interrupt();
- }
- }
-
- /**
- * Continuously writes to the stream.
- */
- protected void write() {
- while (fThread != null) {
- writeNext();
- }
- try {
- fStream.close();
- } catch (IOException e) {
- DebugPlugin.log(e);
- }
- }
-
- /**
- * Write the text in the queue to the stream.
- */
- protected void writeNext() {
- while (!fQueue.isEmpty()) {
- String text = (String)fQueue.firstElement();
- fQueue.removeElementAt(0);
- try {
- fStream.write(text.getBytes());
- fStream.flush();
- } catch (IOException e) {
- DebugPlugin.log(e);
- }
- }
- try {
- synchronized(fLock) {
- fLock.wait();
- }
- } catch (InterruptedException e) {
- }
- }
-}
-
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Vector;
+
+import org.eclipse.debug.core.DebugPlugin;
+
+/**
+ * Writes to the input stream of a system process,
+ * queueing output if the stream is blocked.
+ *
+ * The input stream monitor writes to system in via
+ * an output stream.
+ */
+public class InputStreamMonitor {
+
+ /**
+ * The stream which is being written to (connected to system in).
+ */
+ private OutputStream fStream;
+ /**
+ * The queue of output.
+ */
+ private Vector fQueue;
+ /**
+ * The thread which writes to the stream.
+ */
+ private Thread fThread;
+ /**
+ * A lock for ensuring that writes to the queue are contiguous
+ */
+ private Object fLock;
+
+ /**
+ * Creates an input stream monitor which writes
+ * to system in via the given output stream.
+ */
+ public InputStreamMonitor(OutputStream stream) {
+ fStream= stream;
+ fQueue= new Vector();
+ fLock= new Object();
+ }
+
+ /**
+ * Appends the given text to the stream, or
+ * queues the text to be written at a later time
+ * if the stream is blocked.
+ */
+ public void write(String text) {
+ synchronized(fLock) {
+ fQueue.add(text);
+ fLock.notifyAll();
+ }
+ }
+
+ /**
+ * Starts a thread which writes the stream.
+ */
+ public void startMonitoring() {
+ if (fThread == null) {
+ fThread= new Thread(new Runnable() {
+ public void run() {
+ write();
+ }
+ }, DebugCoreMessages.getString("InputStreamMonitor.label")); //$NON-NLS-1$
+ fThread.start();
+ }
+ }
+
+ /**
+ * Close all communications between this
+ * monitor and the underlying stream.
+ */
+ public void close() {
+ if (fThread != null) {
+ Thread thread= fThread;
+ fThread= null;
+ thread.interrupt();
+ }
+ }
+
+ /**
+ * Continuously writes to the stream.
+ */
+ protected void write() {
+ while (fThread != null) {
+ writeNext();
+ }
+ try {
+ fStream.close();
+ } catch (IOException e) {
+ DebugPlugin.log(e);
+ }
+ }
+
+ /**
+ * Write the text in the queue to the stream.
+ */
+ protected void writeNext() {
+ while (!fQueue.isEmpty()) {
+ String text = (String)fQueue.firstElement();
+ fQueue.removeElementAt(0);
+ try {
+ fStream.write(text.getBytes());
+ fStream.flush();
+ } catch (IOException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ try {
+ synchronized(fLock) {
+ fLock.wait();
+ }
+ } catch (InterruptedException e) {
+ }
+ }
+}
+
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 c04282dc8..ab0a15a4c 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
@@ -1,462 +1,462 @@
-package org.eclipse.debug.internal.core;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
-This file is made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-**********************************************************************/
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.xerces.dom.DocumentImpl;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.Launch;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-import org.eclipse.debug.core.model.IPersistableSourceLocator;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Launch configuration handle.
- *
- * @see ILaunchConfiguration
- */
-public class LaunchConfiguration extends PlatformObject implements ILaunchConfiguration {
-
- /**
- * Location this configuration is stored in. This
- * is the key for a launch configuration handle.
- */
- private IPath fLocation;
-
- /**
- * Constructs a launch configuration in the given location.
- *
- * @param location path to where this launch configuration's
- * underlying file is located
- */
- protected LaunchConfiguration(IPath location) {
- setLocation(location);
- }
-
- /**
- * Constructs a launch configuration from the given
- * memento.
- *
- * @param memento launch configuration memento
- * @exception CoreException if the memento is invalid or
- * an exception occurrs reading the memento
- */
- protected LaunchConfiguration(String memento) throws CoreException {
- Exception ex = null;
- try {
- Element root = null;
- DocumentBuilder parser =
- DocumentBuilderFactory.newInstance().newDocumentBuilder();
- StringReader reader = new StringReader(memento);
- InputSource source = new InputSource(reader);
- root = parser.parse(source).getDocumentElement();
-
- String localString = root.getAttribute("local"); //$NON-NLS-1$
- String path = root.getAttribute("path"); //$NON-NLS-1$
-
- String message = null;
- if (path == null) {
- message = DebugCoreMessages.getString("LaunchConfiguration.Invalid_launch_configuration_memento__missing_path_attribute_3"); //$NON-NLS-1$
- } else if (localString == null) {
- message = DebugCoreMessages.getString("LaunchConfiguration.Invalid_launch_configuration_memento__missing_local_attribute_4"); //$NON-NLS-1$
- }
- if (message != null) {
- IStatus s = newStatus(message, DebugException.INTERNAL_ERROR, null);
- throw new CoreException(s);
- }
-
- IPath location = null;
- boolean local = (Boolean.valueOf(localString)).booleanValue();
- if (local) {
- location = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.append(path);
- } else {
- location = new Path(path);
- }
- setLocation(location);
- return;
- } catch (ParserConfigurationException e) {
- ex = e;
- } catch (SAXException e) {
- ex = e;
- } catch (IOException e) {
- ex = e;
- }
- IStatus s = newStatus(DebugCoreMessages.getString("LaunchConfiguration.Exception_occurred_parsing_memento_5"), DebugException.INTERNAL_ERROR, ex); //$NON-NLS-1$
- throw new CoreException(s);
- }
-
- /**
- * Creates and returns a new error status based on
- * the given mesasge, code, and exception.
- *
- * @param message error message
- * @param code error code
- * @param e exception or <code>null</code>
- * @return status
- */
- protected IStatus newStatus(String message, int code, Throwable e) {
- return new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), code, message, e);
- }
-
- /**
- * @see ILaunchConfiguration#launch(String, IProgressMonitor)
- */
- public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException {
- ILaunch launch = new Launch(this, mode, null);
- getLaunchManager().addLaunch(launch);
- try {
- getDelegate().launch(this, mode, launch, monitor);
- } catch (CoreException e) {
- // if there was an exception, and the launch is empty, remove it
- if (!launch.hasChildren()) {
- getLaunchManager().removeLaunch(launch);
- }
- throw e;
- }
- if (monitor != null && monitor.isCanceled()) {
- getLaunchManager().removeLaunch(launch);
- } else {
- initializeSourceLocator(launch);
- }
- return launch;
- }
-
- /**
- * Set the source locator to use with the launch, if specified
- * by this configuration.
- *
- * @param launch the launch on which to set the source locator
- */
- protected void initializeSourceLocator(ILaunch launch) throws CoreException {
- if (launch.getSourceLocator() == null) {
- String type = getAttribute(ATTR_SOURCE_LOCATOR_ID, (String)null);
- if (type != null) {
- IPersistableSourceLocator locator = getLaunchManager().newSourceLocator(type);
- String memento = getAttribute(ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
- if (memento == null) {
- locator.initializeDefaults(this);
- } else {
- locator.initializeFromMemento(memento);
- }
- launch.setSourceLocator(locator);
- }
- }
- }
-
- /**
- * @see ILaunchConfiguration#supportsMode(String)
- */
- public boolean supportsMode(String mode) throws CoreException {
- return getType().supportsMode(mode);
- }
-
- /**
- * A configuration's name is that of the last segment
- * in it's location (subtract the ".launch" extension).
- *
- * @see ILaunchConfiguration#getName()
- */
- public String getName() {
- return getLastLocationSegment();
- }
-
- private String getLastLocationSegment() {
- String name = getLocation().lastSegment();
- name = name.substring(0, name.length() - (LAUNCH_CONFIGURATION_FILE_EXTENSION.length() + 1));
- return name;
- }
-
- /**
- * @see ILaunchConfiguration#getLocation()
- */
- public IPath getLocation() {
- return fLocation;
- }
-
- /**
- * Sets the location of this configuration's underlying
- * file.
- *
- * @param location the location of this configuration's underlying
- * file
- */
- private void setLocation(IPath location) {
- fLocation = location;
- }
-
- /**
- * @see ILaunchConfiguration#exists()
- */
- public boolean exists() {
- return getLocation().toFile().exists();
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, int)
- */
- public int getAttribute(String attributeName, int defaultValue) throws CoreException {
- return getInfo().getIntAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, String)
- */
- public String getAttribute(String attributeName, String defaultValue) throws CoreException {
- return getInfo().getStringAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, boolean)
- */
- public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException {
- return getInfo().getBooleanAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, List)
- */
- public List getAttribute(String attributeName, List defaultValue) throws CoreException {
- return getInfo().getListAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getAttribute(String, Map)
- */
- public Map getAttribute(String attributeName, Map defaultValue) throws CoreException {
- return getInfo().getMapAttribute(attributeName, defaultValue);
- }
-
- /**
- * @see ILaunchConfiguration#getType()
- */
- public ILaunchConfigurationType getType() throws CoreException {
- return getInfo().getType();
- }
-
- /**
- * @see ILaunchConfiguration#isLocal()
- */
- public boolean isLocal() {
- IPath localPath = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
- return localPath.isPrefixOf(getLocation());
- }
-
- /**
- * @see ILaunchConfiguration#getWorkingCopy()
- */
- public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
- return new LaunchConfigurationWorkingCopy(this);
- }
-
- /**
- * @see ILaunchConfiguration#copy(String name)
- */
- public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException {
- ILaunchConfigurationWorkingCopy copy = new LaunchConfigurationWorkingCopy(this, name);
- return copy;
- }
-
- /**
- * @see ILaunchConfiguration#isWorkingCopy()
- */
- public boolean isWorkingCopy() {
- return false;
- }
-
- /**
- * @see ILaunchConfiguration#delete()
- */
- public void delete() throws CoreException {
- if (exists()) {
- if (isLocal()) {
- if (!(getLocation().toFile().delete())) {
- throw new DebugException(
- new Status(Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfiguration.Failed_to_delete_launch_configuration._1"), null) //$NON-NLS-1$
- );
- }
- // manually update the launch manager cache since there
- // will be no resource delta
- getLaunchManager().launchConfigurationDeleted(this);
- } else {
- // delete the resource using IFile API such that
- // resource deltas are fired.
- IResource file = getFile();
- if (file != null) {
- file.delete(true, null);
- } else {
- // Error - the exists test passed, but could not locate file
- }
- }
- }
- }
-
- /**
- * Returns the info object containing the attributes
- * of this configuration
- *
- * @return info for this handle
- * @exception CoreException if unable to retrieve the
- * info object
- */
- protected LaunchConfigurationInfo getInfo() throws CoreException {
- return getLaunchManager().getInfo(this);
- }
-
- /**
- * Returns the launch configuration delegate for this
- * launch configuration.
- *
- * @return launch configuration delegate
- * @exception CoreException if the delegate was unable
- * to be created
- */
- protected ILaunchConfigurationDelegate getDelegate() throws CoreException {
- return ((LaunchConfigurationType)getType()).getDelegate();
- }
-
- /**
- * Returns the launch manager
- *
- * @return launch manager
- */
- protected LaunchManager getLaunchManager() {
- return (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
- }
-
- /**
- * @see ILaunchConfiguration#getMemento()
- */
- public String getMemento() throws CoreException {
- IPath relativePath = null;
- if (isLocal()) {
- IPath rootPath = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
- IPath configPath = getLocation();
- relativePath = configPath.removeFirstSegments(rootPath.segmentCount());
- relativePath = relativePath.setDevice(null);
- } else {
- relativePath = getLocation();
- }
-
- Document doc = new DocumentImpl();
- Element node = doc.createElement("launchConfiguration"); //$NON-NLS-1$
- doc.appendChild(node);
- node.setAttribute("local", (new Boolean(isLocal())).toString()); //$NON-NLS-1$
- node.setAttribute("path", relativePath.toString()); //$NON-NLS-1$
-
- try {
- return LaunchManager.serializeDocument(doc);
- } catch (IOException e) {
- IStatus status = newStatus(DebugCoreMessages.getString("LaunchConfiguration.Exception_occurred_creating_launch_configuration_memento_9"), DebugException.INTERNAL_ERROR, e); //$NON-NLS-1$
- throw new CoreException(status);
- }
- }
-
- /**
- * @see ILaunchConfiguration#getFile()
- */
- public IFile getFile() {
- if (isLocal()) {
- return null;
- }
- return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(getLocation());
- }
-
- /**
- * @see ILaunchConfiguration#contentsEqual(ILaunchConfiguration)
- */
- public boolean contentsEqual(ILaunchConfiguration object) {
- try {
- if (object instanceof LaunchConfiguration) {
- LaunchConfiguration otherConfig = (LaunchConfiguration) object;
- return getName().equals(otherConfig.getName())
- && getType().equals(otherConfig.getType())
- && getLocation().equals(otherConfig.getLocation())
- && getInfo().equals(otherConfig.getInfo());
- }
- return false;
- } catch (CoreException ce) {
- return false;
- }
- }
-
- /**
- * Returns whether this configuration is equal to the
- * given configuration. Two configurations are equal if
- * they are stored in the same location (and neither one
- * is a working copy).
- *
- * @return whether this configuration is equal to the
- * given configuration
- * @see Object#equals(Object)
- */
- public boolean equals(Object object) {
- if (object instanceof ILaunchConfiguration) {
- if (isWorkingCopy()) {
- return this == object;
- }
- ILaunchConfiguration config = (ILaunchConfiguration) object;
- if (!config.isWorkingCopy()) {
- return config.getLocation().equals(getLocation());
- }
- }
- return false;
- }
-
- /**
- * @see Object#hashCode()
- */
- public int hashCode() {
- return getLocation().hashCode();
- }
-
- /**
- * Returns the container this launch configuration is
- * stored in, or <code>null</code> if this launch configuration
- * is stored locally.
- *
- * @return the container this launch configuration is
- * stored in, or <code>null</code> if this launch configuration
- * is stored locally
- */
- protected IContainer getContainer() {
- IFile file = getFile();
- if (file != null) {
- return file.getParent();
- }
- return null;
- }
-}
-
+package org.eclipse.debug.internal.core;
+
+/**********************************************************************
+Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
+This file is made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+**********************************************************************/
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.xerces.dom.DocumentImpl;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.Launch;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.debug.core.model.IPersistableSourceLocator;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Launch configuration handle.
+ *
+ * @see ILaunchConfiguration
+ */
+public class LaunchConfiguration extends PlatformObject implements ILaunchConfiguration {
+
+ /**
+ * Location this configuration is stored in. This
+ * is the key for a launch configuration handle.
+ */
+ private IPath fLocation;
+
+ /**
+ * Constructs a launch configuration in the given location.
+ *
+ * @param location path to where this launch configuration's
+ * underlying file is located
+ */
+ protected LaunchConfiguration(IPath location) {
+ setLocation(location);
+ }
+
+ /**
+ * Constructs a launch configuration from the given
+ * memento.
+ *
+ * @param memento launch configuration memento
+ * @exception CoreException if the memento is invalid or
+ * an exception occurrs reading the memento
+ */
+ protected LaunchConfiguration(String memento) throws CoreException {
+ Exception ex = null;
+ try {
+ Element root = null;
+ DocumentBuilder parser =
+ DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ StringReader reader = new StringReader(memento);
+ InputSource source = new InputSource(reader);
+ root = parser.parse(source).getDocumentElement();
+
+ String localString = root.getAttribute("local"); //$NON-NLS-1$
+ String path = root.getAttribute("path"); //$NON-NLS-1$
+
+ String message = null;
+ if (path == null) {
+ message = DebugCoreMessages.getString("LaunchConfiguration.Invalid_launch_configuration_memento__missing_path_attribute_3"); //$NON-NLS-1$
+ } else if (localString == null) {
+ message = DebugCoreMessages.getString("LaunchConfiguration.Invalid_launch_configuration_memento__missing_local_attribute_4"); //$NON-NLS-1$
+ }
+ if (message != null) {
+ IStatus s = newStatus(message, DebugException.INTERNAL_ERROR, null);
+ throw new CoreException(s);
+ }
+
+ IPath location = null;
+ boolean local = (Boolean.valueOf(localString)).booleanValue();
+ if (local) {
+ location = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.append(path);
+ } else {
+ location = new Path(path);
+ }
+ setLocation(location);
+ return;
+ } catch (ParserConfigurationException e) {
+ ex = e;
+ } catch (SAXException e) {
+ ex = e;
+ } catch (IOException e) {
+ ex = e;
+ }
+ IStatus s = newStatus(DebugCoreMessages.getString("LaunchConfiguration.Exception_occurred_parsing_memento_5"), DebugException.INTERNAL_ERROR, ex); //$NON-NLS-1$
+ throw new CoreException(s);
+ }
+
+ /**
+ * Creates and returns a new error status based on
+ * the given mesasge, code, and exception.
+ *
+ * @param message error message
+ * @param code error code
+ * @param e exception or <code>null</code>
+ * @return status
+ */
+ protected IStatus newStatus(String message, int code, Throwable e) {
+ return new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), code, message, e);
+ }
+
+ /**
+ * @see ILaunchConfiguration#launch(String, IProgressMonitor)
+ */
+ public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException {
+ ILaunch launch = new Launch(this, mode, null);
+ getLaunchManager().addLaunch(launch);
+ try {
+ getDelegate().launch(this, mode, launch, monitor);
+ } catch (CoreException e) {
+ // if there was an exception, and the launch is empty, remove it
+ if (!launch.hasChildren()) {
+ getLaunchManager().removeLaunch(launch);
+ }
+ throw e;
+ }
+ if (monitor != null && monitor.isCanceled()) {
+ getLaunchManager().removeLaunch(launch);
+ } else {
+ initializeSourceLocator(launch);
+ }
+ return launch;
+ }
+
+ /**
+ * Set the source locator to use with the launch, if specified
+ * by this configuration.
+ *
+ * @param launch the launch on which to set the source locator
+ */
+ protected void initializeSourceLocator(ILaunch launch) throws CoreException {
+ if (launch.getSourceLocator() == null) {
+ String type = getAttribute(ATTR_SOURCE_LOCATOR_ID, (String)null);
+ if (type != null) {
+ IPersistableSourceLocator locator = getLaunchManager().newSourceLocator(type);
+ String memento = getAttribute(ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
+ if (memento == null) {
+ locator.initializeDefaults(this);
+ } else {
+ locator.initializeFromMemento(memento);
+ }
+ launch.setSourceLocator(locator);
+ }
+ }
+ }
+
+ /**
+ * @see ILaunchConfiguration#supportsMode(String)
+ */
+ public boolean supportsMode(String mode) throws CoreException {
+ return getType().supportsMode(mode);
+ }
+
+ /**
+ * A configuration's name is that of the last segment
+ * in it's location (subtract the ".launch" extension).
+ *
+ * @see ILaunchConfiguration#getName()
+ */
+ public String getName() {
+ return getLastLocationSegment();
+ }
+
+ private String getLastLocationSegment() {
+ String name = getLocation().lastSegment();
+ name = name.substring(0, name.length() - (LAUNCH_CONFIGURATION_FILE_EXTENSION.length() + 1));
+ return name;
+ }
+
+ /**
+ * @see ILaunchConfiguration#getLocation()
+ */
+ public IPath getLocation() {
+ return fLocation;
+ }
+
+ /**
+ * Sets the location of this configuration's underlying
+ * file.
+ *
+ * @param location the location of this configuration's underlying
+ * file
+ */
+ private void setLocation(IPath location) {
+ fLocation = location;
+ }
+
+ /**
+ * @see ILaunchConfiguration#exists()
+ */
+ public boolean exists() {
+ return getLocation().toFile().exists();
+ }
+
+ /**
+ * @see ILaunchConfiguration#getAttribute(String, int)
+ */
+ public int getAttribute(String attributeName, int defaultValue) throws CoreException {
+ return getInfo().getIntAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * @see ILaunchConfiguration#getAttribute(String, String)
+ */
+ public String getAttribute(String attributeName, String defaultValue) throws CoreException {
+ return getInfo().getStringAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * @see ILaunchConfiguration#getAttribute(String, boolean)
+ */
+ public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException {
+ return getInfo().getBooleanAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * @see ILaunchConfiguration#getAttribute(String, List)
+ */
+ public List getAttribute(String attributeName, List defaultValue) throws CoreException {
+ return getInfo().getListAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * @see ILaunchConfiguration#getAttribute(String, Map)
+ */
+ public Map getAttribute(String attributeName, Map defaultValue) throws CoreException {
+ return getInfo().getMapAttribute(attributeName, defaultValue);
+ }
+
+ /**
+ * @see ILaunchConfiguration#getType()
+ */
+ public ILaunchConfigurationType getType() throws CoreException {
+ return getInfo().getType();
+ }
+
+ /**
+ * @see ILaunchConfiguration#isLocal()
+ */
+ public boolean isLocal() {
+ IPath localPath = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
+ return localPath.isPrefixOf(getLocation());
+ }
+
+ /**
+ * @see ILaunchConfiguration#getWorkingCopy()
+ */
+ public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
+ return new LaunchConfigurationWorkingCopy(this);
+ }
+
+ /**
+ * @see ILaunchConfiguration#copy(String name)
+ */
+ public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException {
+ ILaunchConfigurationWorkingCopy copy = new LaunchConfigurationWorkingCopy(this, name);
+ return copy;
+ }
+
+ /**
+ * @see ILaunchConfiguration#isWorkingCopy()
+ */
+ public boolean isWorkingCopy() {
+ return false;
+ }
+
+ /**
+ * @see ILaunchConfiguration#delete()
+ */
+ public void delete() throws CoreException {
+ if (exists()) {
+ if (isLocal()) {
+ if (!(getLocation().toFile().delete())) {
+ throw new DebugException(
+ new Status(Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfiguration.Failed_to_delete_launch_configuration._1"), null) //$NON-NLS-1$
+ );
+ }
+ // manually update the launch manager cache since there
+ // will be no resource delta
+ getLaunchManager().launchConfigurationDeleted(this);
+ } else {
+ // delete the resource using IFile API such that
+ // resource deltas are fired.
+ IResource file = getFile();
+ if (file != null) {
+ file.delete(true, null);
+ } else {
+ // Error - the exists test passed, but could not locate file
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the info object containing the attributes
+ * of this configuration
+ *
+ * @return info for this handle
+ * @exception CoreException if unable to retrieve the
+ * info object
+ */
+ protected LaunchConfigurationInfo getInfo() throws CoreException {
+ return getLaunchManager().getInfo(this);
+ }
+
+ /**
+ * Returns the launch configuration delegate for this
+ * launch configuration.
+ *
+ * @return launch configuration delegate
+ * @exception CoreException if the delegate was unable
+ * to be created
+ */
+ protected ILaunchConfigurationDelegate getDelegate() throws CoreException {
+ return ((LaunchConfigurationType)getType()).getDelegate();
+ }
+
+ /**
+ * Returns the launch manager
+ *
+ * @return launch manager
+ */
+ protected LaunchManager getLaunchManager() {
+ return (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
+ }
+
+ /**
+ * @see ILaunchConfiguration#getMemento()
+ */
+ public String getMemento() throws CoreException {
+ IPath relativePath = null;
+ if (isLocal()) {
+ IPath rootPath = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
+ IPath configPath = getLocation();
+ relativePath = configPath.removeFirstSegments(rootPath.segmentCount());
+ relativePath = relativePath.setDevice(null);
+ } else {
+ relativePath = getLocation();
+ }
+
+ Document doc = new DocumentImpl();
+ Element node = doc.createElement("launchConfiguration"); //$NON-NLS-1$
+ doc.appendChild(node);
+ node.setAttribute("local", (new Boolean(isLocal())).toString()); //$NON-NLS-1$
+ node.setAttribute("path", relativePath.toString()); //$NON-NLS-1$
+
+ try {
+ return LaunchManager.serializeDocument(doc);
+ } catch (IOException e) {
+ IStatus status = newStatus(DebugCoreMessages.getString("LaunchConfiguration.Exception_occurred_creating_launch_configuration_memento_9"), DebugException.INTERNAL_ERROR, e); //$NON-NLS-1$
+ throw new CoreException(status);
+ }
+ }
+
+ /**
+ * @see ILaunchConfiguration#getFile()
+ */
+ public IFile getFile() {
+ if (isLocal()) {
+ return null;
+ }
+ return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(getLocation());
+ }
+
+ /**
+ * @see ILaunchConfiguration#contentsEqual(ILaunchConfiguration)
+ */
+ public boolean contentsEqual(ILaunchConfiguration object) {
+ try {
+ if (object instanceof LaunchConfiguration) {
+ LaunchConfiguration otherConfig = (LaunchConfiguration) object;
+ return getName().equals(otherConfig.getName())
+ && getType().equals(otherConfig.getType())
+ && getLocation().equals(otherConfig.getLocation())
+ && getInfo().equals(otherConfig.getInfo());
+ }
+ return false;
+ } catch (CoreException ce) {
+ return false;
+ }
+ }
+
+ /**
+ * Returns whether this configuration is equal to the
+ * given configuration. Two configurations are equal if
+ * they are stored in the same location (and neither one
+ * is a working copy).
+ *
+ * @return whether this configuration is equal to the
+ * given configuration
+ * @see Object#equals(Object)
+ */
+ public boolean equals(Object object) {
+ if (object instanceof ILaunchConfiguration) {
+ if (isWorkingCopy()) {
+ return this == object;
+ }
+ ILaunchConfiguration config = (ILaunchConfiguration) object;
+ if (!config.isWorkingCopy()) {
+ return config.getLocation().equals(getLocation());
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode() {
+ return getLocation().hashCode();
+ }
+
+ /**
+ * Returns the container this launch configuration is
+ * stored in, or <code>null</code> if this launch configuration
+ * is stored locally.
+ *
+ * @return the container this launch configuration is
+ * stored in, or <code>null</code> if this launch configuration
+ * is stored locally
+ */
+ protected IContainer getContainer() {
+ IFile file = getFile();
+ if (file != null) {
+ return file.getParent();
+ }
+ return null;
+ }
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
index db8071fd0..90f0a7b78 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
@@ -1,521 +1,521 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.xerces.dom.DocumentImpl;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * The information associated with a launch configuration
- * handle.
- */
-public class LaunchConfigurationInfo {
-
- /**
- * This configurations attribute table.
- * Keys are <code>String</code>s and values
- * are one of <code>String</code>, <code>Integer</code>,
- * or <code>Boolean</code>.
- */
- private HashMap fAttributes;
-
- /**
- * This launch configuration's type
- */
- private ILaunchConfigurationType fType;
-
- /**
- * Constructs a new empty info
- */
- protected LaunchConfigurationInfo() {
- setAttributeTable(new HashMap(10));
- }
-
- /**
- * Returns this configuration's attribute table.
- *
- * @return attribute table
- */
- private HashMap getAttributeTable() {
- return fAttributes;
- }
-
- /**
- * Sets this configuration's attribute table.
- *
- * @param table attribute table
- */
- private void setAttributeTable(HashMap table) {
- fAttributes = table;
- }
-
- /**
- * Returns the <code>String</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @exception if the attribute with the given key exists
- * but is not a <code>String</code>
- */
- protected String getStringAttribute(String key, String defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof String) {
- return (String)attr;
- } else {
- throw new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.lang.String._1"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- }
- return defaultValue;
- }
-
- /**
- * Returns the <code>int</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @exception if the attribute with the given key exists
- * but is not an <code>int</code>
- */
- protected int getIntAttribute(String key, int defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof Integer) {
- return ((Integer)attr).intValue();
- } else {
- throw new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_int._2"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- }
- return defaultValue;
- }
-
- /**
- * Returns the <code>boolean</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @exception if the attribute with the given key exists
- * but is not a <code>boolean</code>
- */
- protected boolean getBooleanAttribute(String key, boolean defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof Boolean) {
- return ((Boolean)attr).booleanValue();
- } else {
- throw new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_boolean._3"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- }
- return defaultValue;
- }
-
- /**
- * Returns the <code>java.util.List</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @exception if the attribute with the given key exists
- * but is not a <code>java.util.List</code>
- */
- protected List getListAttribute(String key, List defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof List) {
- return (List)attr;
- } else {
- throw new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.List._1"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- }
- return defaultValue;
- }
-
- /**
- * Returns the <code>java.util.Map</code> attribute with the
- * given key or the given default value if undefined.
- *
- * @return attribute specified by given key or the defaultValue
- * if undefined
- * @exception if the attribute with the given key exists
- * but is not a <code>java.util.Map</code>
- */
- protected Map getMapAttribute(String key, Map defaultValue) throws CoreException {
- Object attr = getAttributeTable().get(key);
- if (attr != null) {
- if (attr instanceof Map) {
- return (Map)attr;
- } else {
- throw new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.Map._1"), new String[] {key}), null //$NON-NLS-1$
- )
- );
- }
- }
- return defaultValue;
- }
-
- /**
- * Sets this configuration's type.
- *
- * @param type launch configuration type
- */
- protected void setType(ILaunchConfigurationType type) {
- fType = type;
- }
-
- /**
- * Returns this configuration's type.
- *
- * @return launch configuration type
- */
- protected ILaunchConfigurationType getType() {
- return fType;
- }
-
-
- /**
- * Returns a copy of this info object
- *
- * @return copy of this info
- */
- protected LaunchConfigurationInfo getCopy() {
- LaunchConfigurationInfo copy = new LaunchConfigurationInfo();
- copy.setType(getType());
- copy.setAttributeTable((HashMap)getAttributeTable().clone());
- return copy;
- }
-
- /**
- * Sets the given attribute to the given value. Only
- * working copy's should use this API.
- *
- * @param key attribute key
- * @param value attribuet value
- */
- protected void setAttribute(String key, Object value) {
- if (value == null) {
- getAttributeTable().remove(key);
- } else {
- getAttributeTable().put(key, value);
- }
- }
-
- /**
- * Returns the content of this info as XML
- *
- * @return the content of this info as XML
- * @exception IOException if an exception occurs creating the XML
- */
- protected String getAsXML() throws IOException {
-
- Document doc = new DocumentImpl();
- Element configRootElement = doc.createElement("launchConfiguration"); //$NON-NLS-1$
- doc.appendChild(configRootElement);
-
- configRootElement.setAttribute("type", getType().getIdentifier()); //$NON-NLS-1$
-
- Iterator keys = getAttributeTable().keySet().iterator();
- while (keys.hasNext()) {
- String key = (String)keys.next();
- Object value = getAttributeTable().get(key);
- if (value == null) {
- continue;
- }
- Element element = null;
- String valueString = null;
- if (value instanceof String) {
- valueString = (String)value;
- element = createKeyValueElement(doc, "stringAttribute", key, valueString); //$NON-NLS-1$
- } else if (value instanceof Integer) {
- valueString = ((Integer)value).toString();
- element = createKeyValueElement(doc, "intAttribute", key, valueString); //$NON-NLS-1$
- } else if (value instanceof Boolean) {
- valueString = ((Boolean)value).toString();
- element = createKeyValueElement(doc, "booleanAttribute", key, valueString); //$NON-NLS-1$
- } else if (value instanceof List) {
- element = createListElement(doc, "listAttribute", key, (List)value); //$NON-NLS-1$
- } else if (value instanceof Map) {
- element = createMapElement(doc, "mapAttribute", key, (Map)value); //$NON-NLS-1$
- }
- configRootElement.appendChild(element);
- }
-
- return LaunchManager.serializeDocument(doc);
- }
-
- /**
- * Helper method that creates a 'key value' element of the specified type with the
- * specified attribute values.
- */
- protected Element createKeyValueElement(Document doc, String elementType, String key, String value) {
- Element element = doc.createElement(elementType);
- element.setAttribute("key", key); //$NON-NLS-1$
- element.setAttribute("value", value); //$NON-NLS-1$
- return element;
- }
-
- protected Element createListElement(Document doc, String elementType, String listKey, List list) {
- Element listElement = doc.createElement(elementType);
- listElement.setAttribute("key", listKey); //$NON-NLS-1$
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- String value = (String) iterator.next();
- Element element = doc.createElement("listEntry"); //$NON-NLS-1$
- element.setAttribute("value", value); //$NON-NLS-1$
- listElement.appendChild(element);
- }
- return listElement;
- }
-
- protected Element createMapElement(Document doc, String elementType, String mapKey, Map map) {
- Element mapElement = doc.createElement(elementType);
- mapElement.setAttribute("key", mapKey); //$NON-NLS-1$
- Iterator iterator = map.keySet().iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- String value = (String) map.get(key);
- Element element = doc.createElement("mapEntry"); //$NON-NLS-1$
- element.setAttribute("key", key); //$NON-NLS-1$
- element.setAttribute("value", value); //$NON-NLS-1$
- mapElement.appendChild(element);
- }
- return mapElement;
- }
-
- protected void initializeFromXML(Element root) throws CoreException {
- if (!root.getNodeName().equalsIgnoreCase("launchConfiguration")) { //$NON-NLS-1$
- throw getInvalidFormatDebugException();
- }
-
- // read type
- String id = root.getAttribute("type"); //$NON-NLS-1$
- if (id == null) {
- throw getInvalidFormatDebugException();
- } else {
- ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(id);
- if (type == null) {
- String message= MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Launch_configuration_type_id___{0}___does_not_exist._nPossible_causes__n_tMissing_specification_of_a_launch_type_(missing_plugin)_n_tIncorrect_launch_configuration_XML_1"), new Object[]{id}); //$NON-NLS-1$
- throw new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, message, null)
- );
- }
- setType(type);
- }
-
- NodeList list = root.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element element = (Element) node;
- String nodeName = element.getNodeName();
-
- if (nodeName.equalsIgnoreCase("stringAttribute")) { //$NON-NLS-1$
- setStringAttribute(element);
- } else if (nodeName.equalsIgnoreCase("intAttribute")) { //$NON-NLS-1$
- setIntegerAttribute(element);
- } else if (nodeName.equalsIgnoreCase("booleanAttribute")) { //$NON-NLS-1$
- setBooleanAttribute(element);
- } else if (nodeName.equalsIgnoreCase("listAttribute")) { //$NON-NLS-1$
- setListAttribute(element);
- } else if (nodeName.equalsIgnoreCase("mapAttribute")) { //$NON-NLS-1$
- setMapAttribute(element);
- }
- }
- }
- }
-
- protected void setStringAttribute(Element element) throws CoreException {
- String key = getKeyAttribute(element);
- String value = getValueAttribute(element);
- setAttribute(key, value);
- }
-
- protected void setIntegerAttribute(Element element) throws CoreException {
- String key = getKeyAttribute(element);
- String value = getValueAttribute(element);
- setAttribute(key, new Integer(value));
- }
-
- protected void setBooleanAttribute(Element element) throws CoreException {
- String key = getKeyAttribute(element);
- String value = getValueAttribute(element);
- setAttribute(key, new Boolean(value));
- }
-
- protected void setListAttribute(Element element) throws CoreException {
- String listKey = element.getAttribute("key"); //$NON-NLS-1$
- NodeList nodeList = element.getChildNodes();
- int entryCount = nodeList.getLength();
- List list = new ArrayList(entryCount);
- for (int i = 0; i < entryCount; i++) {
- Node node = nodeList.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element subElement = (Element) node;
- String nodeName = subElement.getNodeName();
- if (!nodeName.equalsIgnoreCase("listEntry")) { //$NON-NLS-1$
- throw getInvalidFormatDebugException();
- }
- String value = getValueAttribute(subElement);
- list.add(value);
- }
- }
- setAttribute(listKey, list);
- }
-
- protected void setMapAttribute(Element element) throws CoreException {
- String mapKey = element.getAttribute("key"); //$NON-NLS-1$
- NodeList nodeList = element.getChildNodes();
- int entryCount = nodeList.getLength();
- Map map = new HashMap(entryCount);
- for (int i = 0; i < entryCount; i++) {
- Node node = nodeList.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element subElement = (Element) node;
- String nodeName = subElement.getNodeName();
- if (!nodeName.equalsIgnoreCase("mapEntry")) { //$NON-NLS-1$
- throw getInvalidFormatDebugException();
- }
- String key = getKeyAttribute(subElement);
- String value = getValueAttribute(subElement);
- map.put(key, value);
- }
- }
- setAttribute(mapKey, map);
- }
-
- protected String getKeyAttribute(Element element) throws CoreException {
- String key = element.getAttribute("key"); //$NON-NLS-1$
- if (key == null) {
- throw getInvalidFormatDebugException();
- }
- return key;
- }
-
- protected String getValueAttribute(Element element) throws CoreException {
- String value = element.getAttribute("value"); //$NON-NLS-1$
- if (value == null) {
- throw getInvalidFormatDebugException();
- }
- return value;
- }
-
- protected DebugException getInvalidFormatDebugException() {
- return
- new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfigurationInfo.Invalid_launch_configuration_XML._10"), null //$NON-NLS-1$
- )
- );
- }
-
- /**
- * Two <code>LaunchConfigurationInfo</code> objects are equal if and only if they have the
- * same type and they have the same set of attributes with the same values.
- *
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
-
- // Make sure it's a LaunchConfigurationInfo object
- if (!(obj instanceof LaunchConfigurationInfo)) {
- return false;
- }
-
- // Make sure the types are the same
- LaunchConfigurationInfo other = (LaunchConfigurationInfo) obj;
- if (!fType.getIdentifier().equals(other.getType().getIdentifier())) {
- return false;
- }
-
- // Make sure the attributes are the same
- return compareAttributes(fAttributes, other.getAttributeTable());
- }
-
- /**
- * Returns whether the two attribute maps are equal, consulting
- * registered comparator extensions.
- *
- * @param map1 attribute map
- * @param map2 attribute map
- * @return whether the two attribute maps are equal
- */
- protected boolean compareAttributes(HashMap map1, HashMap map2) {
- LaunchManager manager = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
- if (map1.size() == map2.size()) {
- Iterator attributes = map1.keySet().iterator();
- while (attributes.hasNext()) {
- String key = (String)attributes.next();
- Object attr1 = map1.get(key);
- Object attr2 = map2.get(key);
- if (attr2 == null) {
- return false;
- }
- Comparator comp = manager.getComparator(key);
- if (comp == null) {
- if (!attr1.equals(attr2)) {
- return false;
- }
- } else {
- if (comp.compare(attr1, attr2) != 0) {
- return false;
- }
- }
- }
- return true;
- }
- return false;
- }
-}
-
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.xerces.dom.DocumentImpl;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * The information associated with a launch configuration
+ * handle.
+ */
+public class LaunchConfigurationInfo {
+
+ /**
+ * This configurations attribute table.
+ * Keys are <code>String</code>s and values
+ * are one of <code>String</code>, <code>Integer</code>,
+ * or <code>Boolean</code>.
+ */
+ private HashMap fAttributes;
+
+ /**
+ * This launch configuration's type
+ */
+ private ILaunchConfigurationType fType;
+
+ /**
+ * Constructs a new empty info
+ */
+ protected LaunchConfigurationInfo() {
+ setAttributeTable(new HashMap(10));
+ }
+
+ /**
+ * Returns this configuration's attribute table.
+ *
+ * @return attribute table
+ */
+ private HashMap getAttributeTable() {
+ return fAttributes;
+ }
+
+ /**
+ * Sets this configuration's attribute table.
+ *
+ * @param table attribute table
+ */
+ private void setAttributeTable(HashMap table) {
+ fAttributes = table;
+ }
+
+ /**
+ * Returns the <code>String</code> attribute with the
+ * given key or the given default value if undefined.
+ *
+ * @return attribute specified by given key or the defaultValue
+ * if undefined
+ * @exception if the attribute with the given key exists
+ * but is not a <code>String</code>
+ */
+ protected String getStringAttribute(String key, String defaultValue) throws CoreException {
+ Object attr = getAttributeTable().get(key);
+ if (attr != null) {
+ if (attr instanceof String) {
+ return (String)attr;
+ } else {
+ throw new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.lang.String._1"), new String[] {key}), null //$NON-NLS-1$
+ )
+ );
+ }
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Returns the <code>int</code> attribute with the
+ * given key or the given default value if undefined.
+ *
+ * @return attribute specified by given key or the defaultValue
+ * if undefined
+ * @exception if the attribute with the given key exists
+ * but is not an <code>int</code>
+ */
+ protected int getIntAttribute(String key, int defaultValue) throws CoreException {
+ Object attr = getAttributeTable().get(key);
+ if (attr != null) {
+ if (attr instanceof Integer) {
+ return ((Integer)attr).intValue();
+ } else {
+ throw new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_int._2"), new String[] {key}), null //$NON-NLS-1$
+ )
+ );
+ }
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Returns the <code>boolean</code> attribute with the
+ * given key or the given default value if undefined.
+ *
+ * @return attribute specified by given key or the defaultValue
+ * if undefined
+ * @exception if the attribute with the given key exists
+ * but is not a <code>boolean</code>
+ */
+ protected boolean getBooleanAttribute(String key, boolean defaultValue) throws CoreException {
+ Object attr = getAttributeTable().get(key);
+ if (attr != null) {
+ if (attr instanceof Boolean) {
+ return ((Boolean)attr).booleanValue();
+ } else {
+ throw new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_boolean._3"), new String[] {key}), null //$NON-NLS-1$
+ )
+ );
+ }
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Returns the <code>java.util.List</code> attribute with the
+ * given key or the given default value if undefined.
+ *
+ * @return attribute specified by given key or the defaultValue
+ * if undefined
+ * @exception if the attribute with the given key exists
+ * but is not a <code>java.util.List</code>
+ */
+ protected List getListAttribute(String key, List defaultValue) throws CoreException {
+ Object attr = getAttributeTable().get(key);
+ if (attr != null) {
+ if (attr instanceof List) {
+ return (List)attr;
+ } else {
+ throw new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.List._1"), new String[] {key}), null //$NON-NLS-1$
+ )
+ );
+ }
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Returns the <code>java.util.Map</code> attribute with the
+ * given key or the given default value if undefined.
+ *
+ * @return attribute specified by given key or the defaultValue
+ * if undefined
+ * @exception if the attribute with the given key exists
+ * but is not a <code>java.util.Map</code>
+ */
+ protected Map getMapAttribute(String key, Map defaultValue) throws CoreException {
+ Object attr = getAttributeTable().get(key);
+ if (attr != null) {
+ if (attr instanceof Map) {
+ return (Map)attr;
+ } else {
+ throw new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Attribute_{0}_is_not_of_type_java.util.Map._1"), new String[] {key}), null //$NON-NLS-1$
+ )
+ );
+ }
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Sets this configuration's type.
+ *
+ * @param type launch configuration type
+ */
+ protected void setType(ILaunchConfigurationType type) {
+ fType = type;
+ }
+
+ /**
+ * Returns this configuration's type.
+ *
+ * @return launch configuration type
+ */
+ protected ILaunchConfigurationType getType() {
+ return fType;
+ }
+
+
+ /**
+ * Returns a copy of this info object
+ *
+ * @return copy of this info
+ */
+ protected LaunchConfigurationInfo getCopy() {
+ LaunchConfigurationInfo copy = new LaunchConfigurationInfo();
+ copy.setType(getType());
+ copy.setAttributeTable((HashMap)getAttributeTable().clone());
+ return copy;
+ }
+
+ /**
+ * Sets the given attribute to the given value. Only
+ * working copy's should use this API.
+ *
+ * @param key attribute key
+ * @param value attribuet value
+ */
+ protected void setAttribute(String key, Object value) {
+ if (value == null) {
+ getAttributeTable().remove(key);
+ } else {
+ getAttributeTable().put(key, value);
+ }
+ }
+
+ /**
+ * Returns the content of this info as XML
+ *
+ * @return the content of this info as XML
+ * @exception IOException if an exception occurs creating the XML
+ */
+ protected String getAsXML() throws IOException {
+
+ Document doc = new DocumentImpl();
+ Element configRootElement = doc.createElement("launchConfiguration"); //$NON-NLS-1$
+ doc.appendChild(configRootElement);
+
+ configRootElement.setAttribute("type", getType().getIdentifier()); //$NON-NLS-1$
+
+ Iterator keys = getAttributeTable().keySet().iterator();
+ while (keys.hasNext()) {
+ String key = (String)keys.next();
+ Object value = getAttributeTable().get(key);
+ if (value == null) {
+ continue;
+ }
+ Element element = null;
+ String valueString = null;
+ if (value instanceof String) {
+ valueString = (String)value;
+ element = createKeyValueElement(doc, "stringAttribute", key, valueString); //$NON-NLS-1$
+ } else if (value instanceof Integer) {
+ valueString = ((Integer)value).toString();
+ element = createKeyValueElement(doc, "intAttribute", key, valueString); //$NON-NLS-1$
+ } else if (value instanceof Boolean) {
+ valueString = ((Boolean)value).toString();
+ element = createKeyValueElement(doc, "booleanAttribute", key, valueString); //$NON-NLS-1$
+ } else if (value instanceof List) {
+ element = createListElement(doc, "listAttribute", key, (List)value); //$NON-NLS-1$
+ } else if (value instanceof Map) {
+ element = createMapElement(doc, "mapAttribute", key, (Map)value); //$NON-NLS-1$
+ }
+ configRootElement.appendChild(element);
+ }
+
+ return LaunchManager.serializeDocument(doc);
+ }
+
+ /**
+ * Helper method that creates a 'key value' element of the specified type with the
+ * specified attribute values.
+ */
+ protected Element createKeyValueElement(Document doc, String elementType, String key, String value) {
+ Element element = doc.createElement(elementType);
+ element.setAttribute("key", key); //$NON-NLS-1$
+ element.setAttribute("value", value); //$NON-NLS-1$
+ return element;
+ }
+
+ protected Element createListElement(Document doc, String elementType, String listKey, List list) {
+ Element listElement = doc.createElement(elementType);
+ listElement.setAttribute("key", listKey); //$NON-NLS-1$
+ Iterator iterator = list.iterator();
+ while (iterator.hasNext()) {
+ String value = (String) iterator.next();
+ Element element = doc.createElement("listEntry"); //$NON-NLS-1$
+ element.setAttribute("value", value); //$NON-NLS-1$
+ listElement.appendChild(element);
+ }
+ return listElement;
+ }
+
+ protected Element createMapElement(Document doc, String elementType, String mapKey, Map map) {
+ Element mapElement = doc.createElement(elementType);
+ mapElement.setAttribute("key", mapKey); //$NON-NLS-1$
+ Iterator iterator = map.keySet().iterator();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ String value = (String) map.get(key);
+ Element element = doc.createElement("mapEntry"); //$NON-NLS-1$
+ element.setAttribute("key", key); //$NON-NLS-1$
+ element.setAttribute("value", value); //$NON-NLS-1$
+ mapElement.appendChild(element);
+ }
+ return mapElement;
+ }
+
+ protected void initializeFromXML(Element root) throws CoreException {
+ if (!root.getNodeName().equalsIgnoreCase("launchConfiguration")) { //$NON-NLS-1$
+ throw getInvalidFormatDebugException();
+ }
+
+ // read type
+ String id = root.getAttribute("type"); //$NON-NLS-1$
+ if (id == null) {
+ throw getInvalidFormatDebugException();
+ } else {
+ ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(id);
+ if (type == null) {
+ String message= MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationInfo.Launch_configuration_type_id___{0}___does_not_exist._nPossible_causes__n_tMissing_specification_of_a_launch_type_(missing_plugin)_n_tIncorrect_launch_configuration_XML_1"), new Object[]{id}); //$NON-NLS-1$
+ throw new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, message, null)
+ );
+ }
+ setType(type);
+ }
+
+ NodeList list = root.getChildNodes();
+ int length = list.getLength();
+ for (int i = 0; i < length; ++i) {
+ Node node = list.item(i);
+ short type = node.getNodeType();
+ if (type == Node.ELEMENT_NODE) {
+ Element element = (Element) node;
+ String nodeName = element.getNodeName();
+
+ if (nodeName.equalsIgnoreCase("stringAttribute")) { //$NON-NLS-1$
+ setStringAttribute(element);
+ } else if (nodeName.equalsIgnoreCase("intAttribute")) { //$NON-NLS-1$
+ setIntegerAttribute(element);
+ } else if (nodeName.equalsIgnoreCase("booleanAttribute")) { //$NON-NLS-1$
+ setBooleanAttribute(element);
+ } else if (nodeName.equalsIgnoreCase("listAttribute")) { //$NON-NLS-1$
+ setListAttribute(element);
+ } else if (nodeName.equalsIgnoreCase("mapAttribute")) { //$NON-NLS-1$
+ setMapAttribute(element);
+ }
+ }
+ }
+ }
+
+ protected void setStringAttribute(Element element) throws CoreException {
+ String key = getKeyAttribute(element);
+ String value = getValueAttribute(element);
+ setAttribute(key, value);
+ }
+
+ protected void setIntegerAttribute(Element element) throws CoreException {
+ String key = getKeyAttribute(element);
+ String value = getValueAttribute(element);
+ setAttribute(key, new Integer(value));
+ }
+
+ protected void setBooleanAttribute(Element element) throws CoreException {
+ String key = getKeyAttribute(element);
+ String value = getValueAttribute(element);
+ setAttribute(key, new Boolean(value));
+ }
+
+ protected void setListAttribute(Element element) throws CoreException {
+ String listKey = element.getAttribute("key"); //$NON-NLS-1$
+ NodeList nodeList = element.getChildNodes();
+ int entryCount = nodeList.getLength();
+ List list = new ArrayList(entryCount);
+ for (int i = 0; i < entryCount; i++) {
+ Node node = nodeList.item(i);
+ short type = node.getNodeType();
+ if (type == Node.ELEMENT_NODE) {
+ Element subElement = (Element) node;
+ String nodeName = subElement.getNodeName();
+ if (!nodeName.equalsIgnoreCase("listEntry")) { //$NON-NLS-1$
+ throw getInvalidFormatDebugException();
+ }
+ String value = getValueAttribute(subElement);
+ list.add(value);
+ }
+ }
+ setAttribute(listKey, list);
+ }
+
+ protected void setMapAttribute(Element element) throws CoreException {
+ String mapKey = element.getAttribute("key"); //$NON-NLS-1$
+ NodeList nodeList = element.getChildNodes();
+ int entryCount = nodeList.getLength();
+ Map map = new HashMap(entryCount);
+ for (int i = 0; i < entryCount; i++) {
+ Node node = nodeList.item(i);
+ short type = node.getNodeType();
+ if (type == Node.ELEMENT_NODE) {
+ Element subElement = (Element) node;
+ String nodeName = subElement.getNodeName();
+ if (!nodeName.equalsIgnoreCase("mapEntry")) { //$NON-NLS-1$
+ throw getInvalidFormatDebugException();
+ }
+ String key = getKeyAttribute(subElement);
+ String value = getValueAttribute(subElement);
+ map.put(key, value);
+ }
+ }
+ setAttribute(mapKey, map);
+ }
+
+ protected String getKeyAttribute(Element element) throws CoreException {
+ String key = element.getAttribute("key"); //$NON-NLS-1$
+ if (key == null) {
+ throw getInvalidFormatDebugException();
+ }
+ return key;
+ }
+
+ protected String getValueAttribute(Element element) throws CoreException {
+ String value = element.getAttribute("value"); //$NON-NLS-1$
+ if (value == null) {
+ throw getInvalidFormatDebugException();
+ }
+ return value;
+ }
+
+ protected DebugException getInvalidFormatDebugException() {
+ return
+ new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfigurationInfo.Invalid_launch_configuration_XML._10"), null //$NON-NLS-1$
+ )
+ );
+ }
+
+ /**
+ * Two <code>LaunchConfigurationInfo</code> objects are equal if and only if they have the
+ * same type and they have the same set of attributes with the same values.
+ *
+ * @see Object#equals(Object)
+ */
+ public boolean equals(Object obj) {
+
+ // Make sure it's a LaunchConfigurationInfo object
+ if (!(obj instanceof LaunchConfigurationInfo)) {
+ return false;
+ }
+
+ // Make sure the types are the same
+ LaunchConfigurationInfo other = (LaunchConfigurationInfo) obj;
+ if (!fType.getIdentifier().equals(other.getType().getIdentifier())) {
+ return false;
+ }
+
+ // Make sure the attributes are the same
+ return compareAttributes(fAttributes, other.getAttributeTable());
+ }
+
+ /**
+ * Returns whether the two attribute maps are equal, consulting
+ * registered comparator extensions.
+ *
+ * @param map1 attribute map
+ * @param map2 attribute map
+ * @return whether the two attribute maps are equal
+ */
+ protected boolean compareAttributes(HashMap map1, HashMap map2) {
+ LaunchManager manager = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
+ if (map1.size() == map2.size()) {
+ Iterator attributes = map1.keySet().iterator();
+ while (attributes.hasNext()) {
+ String key = (String)attributes.next();
+ Object attr1 = map1.get(key);
+ Object attr2 = map2.get(key);
+ if (attr2 == null) {
+ return false;
+ }
+ Comparator comp = manager.getComparator(key);
+ if (comp == null) {
+ if (!attr1.equals(attr2)) {
+ return false;
+ }
+ } else {
+ if (comp.compare(attr1, attr2) != 0) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
index 0fcafdefe..9a42b050a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
@@ -1,152 +1,152 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-
-/**
- * A launch configuration type wrappers a configuration
- * element for a <code>launchConfigurationType</code>
- * extension.
- */
-public class LaunchConfigurationType implements ILaunchConfigurationType {
-
- /**
- * The configuration element of the extension.
- */
- private IConfigurationElement fElement;
-
- /**
- * Modes this type supports.
- */
- private Set fModes;
-
- /**
- * The delegate for launch configurations of this type.
- * Delegates are instantiated lazily as required.
- */
- private ILaunchConfigurationDelegate fDelegate;
-
- /**
- * Constructs a new launch configuration type on the
- * given configuration element.
- *
- * @param element configuration element
- */
- protected LaunchConfigurationType(IConfigurationElement element) {
- setConfigurationElement(element);
- }
-
- /**
- * Sets this type's configuration element.
- *
- * @param element this type's configuration element
- */
- private void setConfigurationElement(IConfigurationElement element) {
- fElement = element;
- }
-
- /**
- * Returns this type's configuration element.
- *
- * @return this type's configuration element
- */
- protected IConfigurationElement getConfigurationElement() {
- return fElement;
- }
-
-
- /**
- * @see ILaunchConfigurationType#supportsMode(String)
- */
- public boolean supportsMode(String mode) {
- return getModes().contains(mode);
- }
-
- /**
- * Returns the set of modes specified in the configuration data.
- *
- * @return the set of modes specified in the configuration data
- */
- protected Set getModes() {
- if (fModes == null) {
- String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$
- if (modes == null) {
- return new HashSet(0);
- }
- StringTokenizer tokenizer= new StringTokenizer(modes, ","); //$NON-NLS-1$
- fModes = new HashSet(tokenizer.countTokens());
- while (tokenizer.hasMoreTokens()) {
- fModes.add(tokenizer.nextToken().trim());
- }
- }
- return fModes;
- }
-
- /**
- * @see ILaunchConfigurationType#getName()
- */
- public String getName() {
- return getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
- }
-
- /**
- * @see ILaunchConfigurationType#getIdentifier()
- */
- public String getIdentifier() {
- return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
- }
-
- /**
- * @see ILaunchConfigurationType#isPublic()
- */
- public boolean isPublic() {
- String publicString = getConfigurationElement().getAttribute("public"); //$NON-NLS-1$
- if (publicString != null) {
- if (publicString.equalsIgnoreCase("false")) { //$NON-NLS-1$
- return false;
- }
- }
- return true;
- }
-
- /**
- * @see ILaunchConfigurationType#newInstance(IContainer, String)
- */
- public ILaunchConfigurationWorkingCopy newInstance(
- IContainer container,
- String name)
- throws CoreException {
- return new LaunchConfigurationWorkingCopy(container, name, this);
- }
-
- /**
- * Returns the launch configuration delegate for launch
- * configurations of this type. The first time this method
- * is called, the delegate is instantiated.
- *
- * @return launch configuration delegate
- * @exception CoreException if unable to instantiate the
- * delegate
- */
- public ILaunchConfigurationDelegate getDelegate() throws CoreException {
- if (fDelegate == null) {
- fDelegate = (ILaunchConfigurationDelegate)getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$
- }
- return fDelegate;
- }
-
-}
-
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+
+/**
+ * A launch configuration type wrappers a configuration
+ * element for a <code>launchConfigurationType</code>
+ * extension.
+ */
+public class LaunchConfigurationType implements ILaunchConfigurationType {
+
+ /**
+ * The configuration element of the extension.
+ */
+ private IConfigurationElement fElement;
+
+ /**
+ * Modes this type supports.
+ */
+ private Set fModes;
+
+ /**
+ * The delegate for launch configurations of this type.
+ * Delegates are instantiated lazily as required.
+ */
+ private ILaunchConfigurationDelegate fDelegate;
+
+ /**
+ * Constructs a new launch configuration type on the
+ * given configuration element.
+ *
+ * @param element configuration element
+ */
+ protected LaunchConfigurationType(IConfigurationElement element) {
+ setConfigurationElement(element);
+ }
+
+ /**
+ * Sets this type's configuration element.
+ *
+ * @param element this type's configuration element
+ */
+ private void setConfigurationElement(IConfigurationElement element) {
+ fElement = element;
+ }
+
+ /**
+ * Returns this type's configuration element.
+ *
+ * @return this type's configuration element
+ */
+ protected IConfigurationElement getConfigurationElement() {
+ return fElement;
+ }
+
+
+ /**
+ * @see ILaunchConfigurationType#supportsMode(String)
+ */
+ public boolean supportsMode(String mode) {
+ return getModes().contains(mode);
+ }
+
+ /**
+ * Returns the set of modes specified in the configuration data.
+ *
+ * @return the set of modes specified in the configuration data
+ */
+ protected Set getModes() {
+ if (fModes == null) {
+ String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$
+ if (modes == null) {
+ return new HashSet(0);
+ }
+ StringTokenizer tokenizer= new StringTokenizer(modes, ","); //$NON-NLS-1$
+ fModes = new HashSet(tokenizer.countTokens());
+ while (tokenizer.hasMoreTokens()) {
+ fModes.add(tokenizer.nextToken().trim());
+ }
+ }
+ return fModes;
+ }
+
+ /**
+ * @see ILaunchConfigurationType#getName()
+ */
+ public String getName() {
+ return getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see ILaunchConfigurationType#getIdentifier()
+ */
+ public String getIdentifier() {
+ return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see ILaunchConfigurationType#isPublic()
+ */
+ public boolean isPublic() {
+ String publicString = getConfigurationElement().getAttribute("public"); //$NON-NLS-1$
+ if (publicString != null) {
+ if (publicString.equalsIgnoreCase("false")) { //$NON-NLS-1$
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @see ILaunchConfigurationType#newInstance(IContainer, String)
+ */
+ public ILaunchConfigurationWorkingCopy newInstance(
+ IContainer container,
+ String name)
+ throws CoreException {
+ return new LaunchConfigurationWorkingCopy(container, name, this);
+ }
+
+ /**
+ * Returns the launch configuration delegate for launch
+ * configurations of this type. The first time this method
+ * is called, the delegate is instantiated.
+ *
+ * @return launch configuration delegate
+ * @exception CoreException if unable to instantiate the
+ * delegate
+ */
+ public ILaunchConfigurationDelegate getDelegate() throws CoreException {
+ if (fDelegate == null) {
+ fDelegate = (ILaunchConfigurationDelegate)getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$
+ }
+ return fDelegate;
+ }
+
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
index b2b560bca..1dddac236 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
@@ -1,489 +1,489 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-
-/**
- * A working copy launch configuration
- */
-public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implements ILaunchConfigurationWorkingCopy {
-
- /**
- * Handle of original launch configuration this
- * working copy is based on
- */
- private LaunchConfiguration fOriginal;
-
- /**
- * Working copy of attributes.
- */
- private LaunchConfigurationInfo fInfo;
-
- /**
- * Whether this working copy has been modified since
- * it was created
- */
- private boolean fDirty = false;
-
- /**
- * The name for this configuration.
- */
- private String fName;
-
- /**
- * Indicates whether this working copy has been explicitly renamed.
- */
- private boolean fRenamed = false;
-
- /**
- * Suppress change notification until created
- */
- private boolean fSuppressChange = true;
-
- /**
- * The container this working copy will be
- * stored in when saved.
- */
- private IContainer fContainer;
-
- /**
- * Constructs a working copy of the specified launch
- * configuration.
- *
- * @param original launch configuration to make
- * a working copy of
- * @exception CoreException if unable to initialize this
- * working copy's attributes based on the original configuration
- */
- protected LaunchConfigurationWorkingCopy(LaunchConfiguration original) throws CoreException {
- super(original.getLocation());
- setName(original.getName());
- copyFrom(original);
- setOriginal(original);
- fSuppressChange = false;
- }
-
- /**
- * Constructs a copy of the specified launch
- * configuration, with the given (new) name.
- *
- * @param original launch configuration to make
- * a working copy of
- * @param name the new name for the copy of the launch
- * configuration
- * @exception CoreException if unable to initialize this
- * working copy's attributes based on the original configuration
- */
- protected LaunchConfigurationWorkingCopy(LaunchConfiguration original, String name) throws CoreException {
- super(original.getLocation());
- copyFrom(original);
- setName(name);
- fSuppressChange = false;
- }
-
- /**
- * Constructs a new working copy to be created in the specified
- * location.
- *
- * @param container the container that the configuration will be created in
- * or <code>null</code> if to be local
- * @param name the name of the new launch configuration
- * @param type the type of this working copy
- */
- protected LaunchConfigurationWorkingCopy(IContainer container, String name, ILaunchConfigurationType type) {
- super((IPath)null);
- setName(name);
- setInfo(new LaunchConfigurationInfo());
- getInfo().setType(type);
- setContainer(container);
- fSuppressChange = false;
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#isDirty()
- */
- public boolean isDirty() {
- return fDirty;
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#doSave()
- */
- public ILaunchConfiguration doSave() throws CoreException {
- if (isDirty()) {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
- public void run(IProgressMonitor pm) throws CoreException {
- // write the new file
- LaunchConfigurationWorkingCopy.this.writeNewFile();
- // delete the old file if this is not a new configuration
- // or the file was renamed/moved
- if (!LaunchConfigurationWorkingCopy.this.isNew()) {
- if (LaunchConfigurationWorkingCopy.this.isMoved()) {
- LaunchConfigurationWorkingCopy.this.getOriginal().delete();
- }
- }
- resetDirty();
- }
- };
-
- ResourcesPlugin.getWorkspace().run(wr, null);
- }
-
- return new LaunchConfiguration(getLocation());
- }
-
- /**
- * Writes the new configuration information to a file.
- *
- * @exception CoreException if writing the file fails
- */
- protected void writeNewFile() throws CoreException {
- String xml = null;
- try {
- xml = getInfo().getAsXML();
- } catch (IOException e) {
- throw new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.{0}_occurred_generating_launch_configuration_XML._1"), new String[]{e.toString()}), null //$NON-NLS-1$
- )
- );
- }
-
- if (isLocal()) {
- // use java.io to update configuration file
- try {
- boolean added = false;
- File file = getLocation().toFile();
- File dir = getLocation().removeLastSegments(1).toFile();
- dir.mkdirs();
- if (!file.exists()) {
- added = true;
- file.createNewFile();
- }
- FileOutputStream stream = new FileOutputStream(file);
- stream.write(xml.getBytes("UTF8")); //$NON-NLS-1$
- stream.close();
- if (added) {
- getLaunchManager().launchConfigurationAdded(new LaunchConfiguration(getLocation()));
- } else {
- getLaunchManager().launchConfigurationChanged(new LaunchConfiguration(getLocation()));
- }
- } catch (IOException e) {
- throw new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.{0}_occurred_generating_launch_configuration_XML._1"), new String[]{e.toString()}), null //$NON-NLS-1$
- )
- );
- }
- } else {
- // use resource API to update configuration file
- IFile file = getFile();
- IContainer dir = file.getParent();
- if (!dir.exists()) {
- throw new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.Specified_container_for_launch_configuration_does_not_exist_2"), null //$NON-NLS-1$
- )
- );
- }
- ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes());
- if (!file.exists()) {
- file.create(stream, false, null);
- //getLaunchManager().launchConfigurationAdded(new LaunchConfiguration(getLocation()));
- } else {
- file.setContents(stream, false, false, null);
- //getLaunchManager().launchConfigurationChanged(new LaunchConfiguration(getLocation()));
- }
- }
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, int)
- */
- public void setAttribute(String attributeName, int value) {
- getInfo().setAttribute(attributeName, new Integer(value));
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, String)
- */
- public void setAttribute(String attributeName, String value) {
- getInfo().setAttribute(attributeName, value);
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, boolean)
- */
- public void setAttribute(String attributeName, boolean value) {
- getInfo().setAttribute(attributeName, new Boolean(value));
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, List)
- */
- public void setAttribute(String attributeName, List value) {
- getInfo().setAttribute(attributeName, value);
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setAttribute(String, Map)
- */
- public void setAttribute(String attributeName, Map value) {
- getInfo().setAttribute(attributeName, value);
- setDirty();
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#getOriginal()
- */
- public ILaunchConfiguration getOriginal() {
- return fOriginal;
- }
-
- /**
- * Sets the launch configuration this working copy
- * is based on. Initializes the attributes of this
- * working copy to the current values of the given
- * configuration.
- *
- * @param originl the launch configuration this working
- * copy is based on.
- * @exception CoreException if unable to initialize this
- * working copy based on the original's current attribute
- * set
- */
- private void copyFrom(LaunchConfiguration original) throws CoreException {
- LaunchConfigurationInfo info = original.getInfo();
- setInfo(info.getCopy());
- setContainer(original.getContainer());
- resetDirty();
- }
-
- /**
- * Sets the launch configuration this working copy
- * is based on.
- *
- * @param originl the launch configuration this working
- * copy is based on.
- */
- private void setOriginal(LaunchConfiguration original) {
- fOriginal = original;
- }
-
- /**
- * Sets the working copy info object for this working copy.
- *
- * @param info a copy of attributes from this working copy's
- * original launch configuration
- */
- protected void setInfo(LaunchConfigurationInfo info) {
- fInfo = info;
- }
-
- /**
- * @see ILaunchConfiguration#isWorkingCopy()
- */
- public boolean isWorkingCopy() {
- return true;
- }
-
- /**
- * A working copy keeps a local info object that is not
- * cached with the launch manager.
- *
- * @see LaunchConfiguration#getInfo()
- */
- protected LaunchConfigurationInfo getInfo() {
- return fInfo;
- }
-
- /**
- * Sets this working copy's state to dirty.
- * Notifies listeners that this working copy has
- * changed.
- */
- private void setDirty() {
- fDirty = true;
- if (!suppressChangeNotification()) {
- getLaunchManager().notifyChanged(this);
- }
- }
-
- /**
- * Sets this working copy's state to not dirty.
- */
- private void resetDirty() {
- fDirty = false;
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#rename(String)
- */
- public void rename(String name) {
- if (!getName().equals(name)) {
- setName(name);
- fRenamed = isNew() || !(getOriginal().getName().equals(name));
- }
- }
-
- /**
- * Sets the new name for this configuration.
- *
- * @param name the new name for this configuration
- */
- private void setName(String name) {
- fName = name;
- setDirty();
- }
-
- /**
- * @see ILaunchConfiguration#getName()
- */
- public String getName() {
- return fName;
- }
-
- /**
- * @see ILaunchConfiguration#isLocal()
- */
- public boolean isLocal() {
- return getContainer() == null;
- }
-
- /**
- * Returns the location this launch configuration will reside at
- * when saved.
- *
- * @see ILaunchConfiguration#getLocation()
- */
- public IPath getLocation() {
- if (isMoved()) {
- IPath path = null;
- if (isLocal()) {
- path = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
- } else {
- path = getContainer().getLocation();
- }
- path = path.append(getName() + "." + LAUNCH_CONFIGURATION_FILE_EXTENSION); //$NON-NLS-1$
- return path;
- } else {
- return getOriginal().getLocation();
- }
- }
-
- /**
- * Returns whether this working copy is new, or is a
- * working copy of another launch configuration.
- *
- * @return whether this working copy is new, or is a
- * working copy of another launch configuration
- */
- protected boolean isNew() {
- return getOriginal() == null;
- }
-
- /**
- * Returns whether this working copy is new or if its
- * location has changed from that of its original.
- *
- * @return whether this working copy is new or if its
- * location has changed from that of its original
- */
- protected boolean isMoved() {
- if (isNew() || fRenamed) {
- return true;
- }
- IContainer newContainer = getContainer();
- IContainer originalContainer = ((LaunchConfiguration)getOriginal()).getContainer();
- if (newContainer == originalContainer) {
- return false;
- }
- if (newContainer == null) {
- return !originalContainer.equals(newContainer);
- } else {
- return !newContainer.equals(originalContainer);
- }
- }
-
- /**
- * A working copy cannot generate a memento.
- *
- * @see ILaunchConfiguration#getMemento()
- */
- public String getMemento() {
- return null;
- }
-
- /**
- * Returns whether change notification should be
- * suppressed
- */
- protected boolean suppressChangeNotification() {
- return fSuppressChange;
- }
-
- /**
- * @see ILaunchConfigurationWorkingCopy#setContainer(IContainer)
- */
- public void setContainer(IContainer container) {
- if (container == fContainer) {
- return;
- }
- if (container != null) {
- if (container.equals(fContainer)) {
- return;
- }
- } else {
- if (fContainer.equals(container)) {
- return;
- }
- }
- fContainer = container;
- setDirty();
- }
-
- /**
- * Returns the container this working copy will be
- * stored in when saved, or <code>null</code> if
- * this working copy is local.
- *
- * @return the container this working copy will be
- * stored in when saved, or <code>null</code> if
- * this working copy is local
- */
- protected IContainer getContainer() {
- return fContainer;
- }
-}
-
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+
+/**
+ * A working copy launch configuration
+ */
+public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implements ILaunchConfigurationWorkingCopy {
+
+ /**
+ * Handle of original launch configuration this
+ * working copy is based on
+ */
+ private LaunchConfiguration fOriginal;
+
+ /**
+ * Working copy of attributes.
+ */
+ private LaunchConfigurationInfo fInfo;
+
+ /**
+ * Whether this working copy has been modified since
+ * it was created
+ */
+ private boolean fDirty = false;
+
+ /**
+ * The name for this configuration.
+ */
+ private String fName;
+
+ /**
+ * Indicates whether this working copy has been explicitly renamed.
+ */
+ private boolean fRenamed = false;
+
+ /**
+ * Suppress change notification until created
+ */
+ private boolean fSuppressChange = true;
+
+ /**
+ * The container this working copy will be
+ * stored in when saved.
+ */
+ private IContainer fContainer;
+
+ /**
+ * Constructs a working copy of the specified launch
+ * configuration.
+ *
+ * @param original launch configuration to make
+ * a working copy of
+ * @exception CoreException if unable to initialize this
+ * working copy's attributes based on the original configuration
+ */
+ protected LaunchConfigurationWorkingCopy(LaunchConfiguration original) throws CoreException {
+ super(original.getLocation());
+ setName(original.getName());
+ copyFrom(original);
+ setOriginal(original);
+ fSuppressChange = false;
+ }
+
+ /**
+ * Constructs a copy of the specified launch
+ * configuration, with the given (new) name.
+ *
+ * @param original launch configuration to make
+ * a working copy of
+ * @param name the new name for the copy of the launch
+ * configuration
+ * @exception CoreException if unable to initialize this
+ * working copy's attributes based on the original configuration
+ */
+ protected LaunchConfigurationWorkingCopy(LaunchConfiguration original, String name) throws CoreException {
+ super(original.getLocation());
+ copyFrom(original);
+ setName(name);
+ fSuppressChange = false;
+ }
+
+ /**
+ * Constructs a new working copy to be created in the specified
+ * location.
+ *
+ * @param container the container that the configuration will be created in
+ * or <code>null</code> if to be local
+ * @param name the name of the new launch configuration
+ * @param type the type of this working copy
+ */
+ protected LaunchConfigurationWorkingCopy(IContainer container, String name, ILaunchConfigurationType type) {
+ super((IPath)null);
+ setName(name);
+ setInfo(new LaunchConfigurationInfo());
+ getInfo().setType(type);
+ setContainer(container);
+ fSuppressChange = false;
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#isDirty()
+ */
+ public boolean isDirty() {
+ return fDirty;
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#doSave()
+ */
+ public ILaunchConfiguration doSave() throws CoreException {
+ if (isDirty()) {
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor pm) throws CoreException {
+ // write the new file
+ LaunchConfigurationWorkingCopy.this.writeNewFile();
+ // delete the old file if this is not a new configuration
+ // or the file was renamed/moved
+ if (!LaunchConfigurationWorkingCopy.this.isNew()) {
+ if (LaunchConfigurationWorkingCopy.this.isMoved()) {
+ LaunchConfigurationWorkingCopy.this.getOriginal().delete();
+ }
+ }
+ resetDirty();
+ }
+ };
+
+ ResourcesPlugin.getWorkspace().run(wr, null);
+ }
+
+ return new LaunchConfiguration(getLocation());
+ }
+
+ /**
+ * Writes the new configuration information to a file.
+ *
+ * @exception CoreException if writing the file fails
+ */
+ protected void writeNewFile() throws CoreException {
+ String xml = null;
+ try {
+ xml = getInfo().getAsXML();
+ } catch (IOException e) {
+ throw new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.{0}_occurred_generating_launch_configuration_XML._1"), new String[]{e.toString()}), null //$NON-NLS-1$
+ )
+ );
+ }
+
+ if (isLocal()) {
+ // use java.io to update configuration file
+ try {
+ boolean added = false;
+ File file = getLocation().toFile();
+ File dir = getLocation().removeLastSegments(1).toFile();
+ dir.mkdirs();
+ if (!file.exists()) {
+ added = true;
+ file.createNewFile();
+ }
+ FileOutputStream stream = new FileOutputStream(file);
+ stream.write(xml.getBytes("UTF8")); //$NON-NLS-1$
+ stream.close();
+ if (added) {
+ getLaunchManager().launchConfigurationAdded(new LaunchConfiguration(getLocation()));
+ } else {
+ getLaunchManager().launchConfigurationChanged(new LaunchConfiguration(getLocation()));
+ }
+ } catch (IOException e) {
+ throw new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.{0}_occurred_generating_launch_configuration_XML._1"), new String[]{e.toString()}), null //$NON-NLS-1$
+ )
+ );
+ }
+ } else {
+ // use resource API to update configuration file
+ IFile file = getFile();
+ IContainer dir = file.getParent();
+ if (!dir.exists()) {
+ throw new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchConfigurationWorkingCopy.Specified_container_for_launch_configuration_does_not_exist_2"), null //$NON-NLS-1$
+ )
+ );
+ }
+ ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes());
+ if (!file.exists()) {
+ file.create(stream, false, null);
+ //getLaunchManager().launchConfigurationAdded(new LaunchConfiguration(getLocation()));
+ } else {
+ file.setContents(stream, false, false, null);
+ //getLaunchManager().launchConfigurationChanged(new LaunchConfiguration(getLocation()));
+ }
+ }
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#setAttribute(String, int)
+ */
+ public void setAttribute(String attributeName, int value) {
+ getInfo().setAttribute(attributeName, new Integer(value));
+ setDirty();
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#setAttribute(String, String)
+ */
+ public void setAttribute(String attributeName, String value) {
+ getInfo().setAttribute(attributeName, value);
+ setDirty();
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#setAttribute(String, boolean)
+ */
+ public void setAttribute(String attributeName, boolean value) {
+ getInfo().setAttribute(attributeName, new Boolean(value));
+ setDirty();
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#setAttribute(String, List)
+ */
+ public void setAttribute(String attributeName, List value) {
+ getInfo().setAttribute(attributeName, value);
+ setDirty();
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#setAttribute(String, Map)
+ */
+ public void setAttribute(String attributeName, Map value) {
+ getInfo().setAttribute(attributeName, value);
+ setDirty();
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#getOriginal()
+ */
+ public ILaunchConfiguration getOriginal() {
+ return fOriginal;
+ }
+
+ /**
+ * Sets the launch configuration this working copy
+ * is based on. Initializes the attributes of this
+ * working copy to the current values of the given
+ * configuration.
+ *
+ * @param originl the launch configuration this working
+ * copy is based on.
+ * @exception CoreException if unable to initialize this
+ * working copy based on the original's current attribute
+ * set
+ */
+ private void copyFrom(LaunchConfiguration original) throws CoreException {
+ LaunchConfigurationInfo info = original.getInfo();
+ setInfo(info.getCopy());
+ setContainer(original.getContainer());
+ resetDirty();
+ }
+
+ /**
+ * Sets the launch configuration this working copy
+ * is based on.
+ *
+ * @param originl the launch configuration this working
+ * copy is based on.
+ */
+ private void setOriginal(LaunchConfiguration original) {
+ fOriginal = original;
+ }
+
+ /**
+ * Sets the working copy info object for this working copy.
+ *
+ * @param info a copy of attributes from this working copy's
+ * original launch configuration
+ */
+ protected void setInfo(LaunchConfigurationInfo info) {
+ fInfo = info;
+ }
+
+ /**
+ * @see ILaunchConfiguration#isWorkingCopy()
+ */
+ public boolean isWorkingCopy() {
+ return true;
+ }
+
+ /**
+ * A working copy keeps a local info object that is not
+ * cached with the launch manager.
+ *
+ * @see LaunchConfiguration#getInfo()
+ */
+ protected LaunchConfigurationInfo getInfo() {
+ return fInfo;
+ }
+
+ /**
+ * Sets this working copy's state to dirty.
+ * Notifies listeners that this working copy has
+ * changed.
+ */
+ private void setDirty() {
+ fDirty = true;
+ if (!suppressChangeNotification()) {
+ getLaunchManager().notifyChanged(this);
+ }
+ }
+
+ /**
+ * Sets this working copy's state to not dirty.
+ */
+ private void resetDirty() {
+ fDirty = false;
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#rename(String)
+ */
+ public void rename(String name) {
+ if (!getName().equals(name)) {
+ setName(name);
+ fRenamed = isNew() || !(getOriginal().getName().equals(name));
+ }
+ }
+
+ /**
+ * Sets the new name for this configuration.
+ *
+ * @param name the new name for this configuration
+ */
+ private void setName(String name) {
+ fName = name;
+ setDirty();
+ }
+
+ /**
+ * @see ILaunchConfiguration#getName()
+ */
+ public String getName() {
+ return fName;
+ }
+
+ /**
+ * @see ILaunchConfiguration#isLocal()
+ */
+ public boolean isLocal() {
+ return getContainer() == null;
+ }
+
+ /**
+ * Returns the location this launch configuration will reside at
+ * when saved.
+ *
+ * @see ILaunchConfiguration#getLocation()
+ */
+ public IPath getLocation() {
+ if (isMoved()) {
+ IPath path = null;
+ if (isLocal()) {
+ path = LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
+ } else {
+ path = getContainer().getLocation();
+ }
+ path = path.append(getName() + "." + LAUNCH_CONFIGURATION_FILE_EXTENSION); //$NON-NLS-1$
+ return path;
+ } else {
+ return getOriginal().getLocation();
+ }
+ }
+
+ /**
+ * Returns whether this working copy is new, or is a
+ * working copy of another launch configuration.
+ *
+ * @return whether this working copy is new, or is a
+ * working copy of another launch configuration
+ */
+ protected boolean isNew() {
+ return getOriginal() == null;
+ }
+
+ /**
+ * Returns whether this working copy is new or if its
+ * location has changed from that of its original.
+ *
+ * @return whether this working copy is new or if its
+ * location has changed from that of its original
+ */
+ protected boolean isMoved() {
+ if (isNew() || fRenamed) {
+ return true;
+ }
+ IContainer newContainer = getContainer();
+ IContainer originalContainer = ((LaunchConfiguration)getOriginal()).getContainer();
+ if (newContainer == originalContainer) {
+ return false;
+ }
+ if (newContainer == null) {
+ return !originalContainer.equals(newContainer);
+ } else {
+ return !newContainer.equals(originalContainer);
+ }
+ }
+
+ /**
+ * A working copy cannot generate a memento.
+ *
+ * @see ILaunchConfiguration#getMemento()
+ */
+ public String getMemento() {
+ return null;
+ }
+
+ /**
+ * Returns whether change notification should be
+ * suppressed
+ */
+ protected boolean suppressChangeNotification() {
+ return fSuppressChange;
+ }
+
+ /**
+ * @see ILaunchConfigurationWorkingCopy#setContainer(IContainer)
+ */
+ public void setContainer(IContainer container) {
+ if (container == fContainer) {
+ return;
+ }
+ if (container != null) {
+ if (container.equals(fContainer)) {
+ return;
+ }
+ } else {
+ if (fContainer.equals(container)) {
+ return;
+ }
+ }
+ fContainer = container;
+ setDirty();
+ }
+
+ /**
+ * Returns the container this working copy will be
+ * stored in when saved, or <code>null</code> if
+ * this working copy is local.
+ *
+ * @return the container this working copy will be
+ * stored in when saved, or <code>null</code> if
+ * this working copy is local
+ */
+ protected IContainer getContainer() {
+ return fContainer;
+ }
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index 74ffab9a7..25204e826 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -1,1111 +1,1111 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import org.apache.xml.serialize.Method;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.Serializer;
-import org.apache.xml.serialize.SerializerFactory;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationListener;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchListener;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IPersistableSourceLocator;
-import org.eclipse.debug.core.model.IProcess;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Manages launch configurations, launch configuration types, and registered launches.
- *
- * @see ILaunchManager
- */
-public class LaunchManager implements ILaunchManager, IResourceChangeListener {
-
- /**
- * Collection of defined launch configuration type
- * extensions.
- */
- private List fLaunchConfigurationTypes = null;
-
- /**
- * Launch configuration cache. Keys are <code>LaunchConfiguration</code>,
- * values are <code>LaunchConfigurationInfo</code>.
- */
- private HashMap fLaunchConfigurations = new HashMap(10);
-
- /**
- * A cache of launch configuration names currently in the workspace.
- */
- private String[] fSortedConfigNames = null;
-
- /**
- * Collection of all launch configurations in the workspace.
- * <code>List</code> of <code>ILaunchConfiguration</code>.
- */
- private List fLaunchConfigurationIndex = null;
-
- /**
- * Launch configuration comparator extensions,
- * keyed by attribute name.
- */
- private HashMap fComparators = null;
-
- /**
- * Constant for use as local name part of <code>QualifiedName</code>
- * for persisting the default launch configuration type.
- */
- private static final String DEFAULT_CONFIG_TYPE = "defaultLaunchConfigurationType"; //$NON-NLS-1$
-
- /**
- * Types of notifications
- */
- public static final int ADDED = 0;
- public static final int REMOVED= 1;
- public static final int CHANGED= 2;
-
- /**
- * Collection of launches
- */
- private Vector fLaunches= new Vector(10);
-
- /**
- * Collection of listeners
- */
- private ListenerList fListeners= new ListenerList(5);
-
- /**
- * Visitor used to process resource deltas,
- * to update launch configuration index.
- */
- private IResourceDeltaVisitor fgVisitor;
-
- /**
- * Launch configuration listeners
- */
- private ListenerList fLaunchConfigurationListeners = new ListenerList(5);
-
- /**
- * Table of source locator extensions. Keys
- * are identifiers, and values are associated
- * configuration elements.
- */
- private Map fSourceLocators = null;
-
- /**
- * Path to the local directory where local launch configurations
- * are stored with the workspace.
- */
- protected static final IPath LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH =
- DebugPlugin.getDefault().getStateLocation().append(".launches"); //$NON-NLS-1$
-
- /**
- * Serializes a XML document into a string - encoded in UTF8 format,
- * with platform line separators.
- *
- * @param doc document to serialize
- * @return the document as a string
- */
- public static String serializeDocument(Document doc) throws IOException {
- ByteArrayOutputStream s= new ByteArrayOutputStream();
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
-
- Serializer serializer =
- SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(
- new OutputStreamWriter(s, "UTF8"), //$NON-NLS-1$
- format);
- serializer.asDOMSerializer().serialize(doc);
- return s.toString("UTF8"); //$NON-NLS-1$
- }
-
- /**
- * @see ILaunchManager#addLaunchListener(ILaunchListener)
- */
- public void addLaunchListener(ILaunchListener listener) {
- fListeners.add(listener);
- }
-
- /**
- * Returns a collection of all launch configuration handles in
- * the workspace. This collection is initialized lazily.
- *
- * @return all launch configuration handles
- */
- private List getAllLaunchConfigurations() throws CoreException {
- if (fLaunchConfigurationIndex == null) {
- fLaunchConfigurationIndex = new ArrayList(20);
- List configs = findLocalLaunchConfigurations();
- verifyConfigurations(configs, fLaunchConfigurationIndex);
- configs = findLaunchConfigurations(getWorkspaceRoot());
- verifyConfigurations(configs, fLaunchConfigurationIndex);
- }
- return fLaunchConfigurationIndex;
- }
-
- /**
- * Verify basic integrity of launch configurations in the given list,
- * adding valid configs to the collection of all launch configurations.
- * Excpetions are logged for invalid configs.
- *
- * @param verify the list of configs to verify
- * @param valid the list to place valid configrations in
- */
- protected void verifyConfigurations(List verify, List valid) {
- Iterator configs = verify.iterator();
- while (configs.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration)configs.next();
- if (isValid(config)) {
- valid.add(config);
- }
- }
- }
-
- /**
- * Returns whether the given launch configuration passes a basic
- * integritiy test by retrieving its type.
- *
- * @param config the configuration to verify
- * @return whether the config meets basic integrity constraints
- */
- protected boolean isValid(ILaunchConfiguration config) {
- try {
- config.getType();
- } catch (CoreException e) {
- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
- MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Unable_to_restore_invalid_launch_configuration"),new String[] {config.getLocation().toOSString()} ), e); //$NON-NLS-1$
- DebugPlugin.log(status);
- return false;
- }
- return true;
- }
-
- /**
- * Clears all launch configurations (if any have been accessed)
- */
- private void clearAllLaunchConfigurations() {
- if (fLaunchConfigurationTypes != null) {
- fLaunchConfigurationTypes.clear();
- }
- if (fLaunchConfigurationIndex != null) {
- fLaunchConfigurationIndex.clear();
- }
- }
-
- /**
- * @see ILaunchManager#removeLaunch(ILaunch)
- */
- public void removeLaunch(ILaunch launch) {
- if (launch == null) {
- return;
- }
- if (fLaunches.remove(launch)) {
- fireUpdate(launch, REMOVED);
- }
- }
-
- /**
- * Fires notification to the listeners that a launch has been (de)registered.
- */
- public void fireUpdate(ILaunch launch, int update) {
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- ILaunchListener listener = (ILaunchListener)copiedListeners[i];
- switch (update) {
- case ADDED:
- listener.launchAdded(launch);
- break;
- case REMOVED:
- listener.launchRemoved(launch);
- break;
- case CHANGED:
- if (isRegistered(launch)) {
- listener.launchChanged(launch);
- }
- break;
- }
- }
- }
-
- /**
- * Returns whether the given launch is currently registered.
- *
- * @param launch a launch
- * @return whether the given launch is currently registered
- */
- protected boolean isRegistered(ILaunch launch) {
- return fLaunches.contains(launch);
- }
-
- /**
- * @see ILaunchManager#getDebugTargets()
- */
- public IDebugTarget[] getDebugTargets() {
- List allTargets= new ArrayList(fLaunches.size());
- if (fLaunches.size() > 0) {
- Iterator e= fLaunches.iterator();
- while (e.hasNext()) {
- IDebugTarget[] targets= ((ILaunch) e.next()).getDebugTargets();
- for (int i = 0; i < targets.length; i++) {
- allTargets.add(targets[i]);
- }
- }
- }
- return (IDebugTarget[])allTargets.toArray(new IDebugTarget[allTargets.size()]);
- }
-
- /**
- * @see ILaunchManager#getLaunches()
- */
- public ILaunch[] getLaunches() {
- return (ILaunch[])fLaunches.toArray(new ILaunch[fLaunches.size()]);
- }
-
- /**
- * @see ILaunchManager#getProcesses()
- */
- public IProcess[] getProcesses() {
- List allProcesses= new ArrayList(fLaunches.size());
- Iterator e= fLaunches.iterator();
- while (e.hasNext()) {
- IProcess[] processes= ((ILaunch) e.next()).getProcesses();
- for (int i= 0; i < processes.length; i++) {
- allProcesses.add(processes[i]);
- }
- }
- return (IProcess[])allProcesses.toArray(new IProcess[allProcesses.size()]);
- }
-
- /**
- * @see ILaunchManager#addLaunch(ILaunch)
- */
- public void addLaunch(ILaunch launch) {
- if (fLaunches.contains(launch)) {
- return;
- }
-
- fLaunches.add(launch);
- fireUpdate(launch, ADDED);
- }
-
- /**
- * @see ILaunchManager#removeLaunchListener(ILaunchListener)
- */
- public void removeLaunchListener(ILaunchListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * Return a LaunchConfigurationInfo object initialized from XML contained in
- * the specified stream. Simply pass out any exceptions encountered so that
- * caller can deal with them. This is important since caller may need access to the
- * actual exception.
- */
- protected LaunchConfigurationInfo createInfoFromXML(InputStream stream) throws CoreException,
- ParserConfigurationException,
- IOException,
- SAXException {
- Element root = null;
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- root = parser.parse(new InputSource(stream)).getDocumentElement();
- LaunchConfigurationInfo info = new LaunchConfigurationInfo();
- info.initializeFromXML(root);
- return info;
- }
-
- /**
- * Terminates/Disconnects any active debug targets/processes.
- * Clears launch configuration types.
- */
- public void shutdown() throws CoreException {
- fListeners.removeAll();
- ILaunch[] launches = getLaunches();
- for (int i= 0; i < launches.length; i++) {
- ILaunch launch= launches[i];
- try {
- launch.terminate();
- } catch (DebugException e) {
- DebugPlugin.log(e);
- }
- }
-
- clearAllLaunchConfigurations();
-
- getWorkspace().removeResourceChangeListener(this);
- }
-
- /**
- * Creates launch configuration types for each defined extension.
- *
- * @exception CoreException if an exception occurs processing
- * the extensions
- */
- public void startup() throws CoreException {
- getWorkspace().addResourceChangeListener(this);
- }
-
- /**
- * Returns the info object for the specified launch configuration.
- * If the configuration exists, but is not yet in the cache,
- * an info object is built and added to the cache.
- *
- * @exception CoreException if an exception occurs building
- * the info object
- * @exception DebugException if the config does not exist
- */
- protected LaunchConfigurationInfo getInfo(ILaunchConfiguration config) throws CoreException {
- LaunchConfigurationInfo info = (LaunchConfigurationInfo)fLaunchConfigurations.get(config);
- if (info == null) {
- if (config.exists()) {
- InputStream stream = null;
- try {
- if (config.isLocal()) {
- IPath path = config.getLocation();
- File file = path.toFile();
- stream = new FileInputStream(file);
- } else {
- IFile file = ((LaunchConfiguration) config).getFile();
- stream = file.getContents();
- }
- info = createInfoFromXML(stream);
- fLaunchConfigurations.put(config, info);
- } catch (FileNotFoundException e) {
- throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
- } catch (SAXException e) {
- throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
- } catch (ParserConfigurationException e) {
- throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
- } catch (IOException e) {
- throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
- }
- }
- }
-
- } else {
- throw createDebugException(DebugCoreMessages.getString("LaunchManager.Launch_configuration_does_not_exist._6"), null); //$NON-NLS-1$
- }
- }
- return info;
- }
-
- /**
- * Return an instance of DebugException containing the specified message and Throwable.
- */
- protected DebugException createDebugException(String message, Throwable throwable) {
- return new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, message, throwable
- )
- );
- }
-
- /**
- * Removes the given launch configuration from the cache of configurations.
- * When a local configuration is deleted, this method is called, as there will
- * be no resource delta generated to auto-update the cache.
- *
- * @param configuration the configuration to remove
- */
- private void removeInfo(ILaunchConfiguration configuration) {
- fLaunchConfigurations.remove(configuration);
- }
-
- /**
- * @see ILaunchManager#getLaunchConfigurations()
- */
- public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException {
- List allConfigs = getAllLaunchConfigurations();
- return (ILaunchConfiguration[])allConfigs.toArray(new ILaunchConfiguration[allConfigs.size()]);
- }
-
- /**
- * @see ILaunchManager#getLaunchConfigurations(ILaunchConfigurationType)
- */
- public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException {
- Iterator iter = getAllLaunchConfigurations().iterator();
- List configs = new ArrayList();
- while (iter.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
- if (config.getType().equals(type)) {
- configs.add(config);
- }
- }
- return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
- }
-
- /**
- * Returns all launch configurations that are stored as resources
- * in the given project.
- *
- * @param project a project
- * @return collection of launch configurations that are stored as resources
- * in the given project
- */
- protected List getLaunchConfigurations(IProject project) throws CoreException {
- Iterator iter = getAllLaunchConfigurations().iterator();
- List configs = new ArrayList();
- while (iter.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
- IFile file = config.getFile();
- if (file != null && file.getProject().equals(project)) {
- configs.add(config);
- }
- }
- return configs;
- }
-
- /**
- * Returns all launch configurations that are stored locally.
- *
- * @return collection of launch configurations stored lcoally
- */
- protected List getLocalLaunchConfigurations() throws CoreException {
- Iterator iter = getAllLaunchConfigurations().iterator();
- List configs = new ArrayList();
- while (iter.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
- if (config.isLocal()) {
- configs.add(config);
- }
- }
- return configs;
- }
-
- /**
- * @see ILaunchManager#getLaunchConfiguration(IFile)
- */
- public ILaunchConfiguration getLaunchConfiguration(IFile file) {
- return new LaunchConfiguration(file.getLocation());
- }
-
- /**
- * @see ILaunchManager#getLaunchConfiguration(String)
- */
- public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException {
- return new LaunchConfiguration(memento);
- }
-
- /**
- * @see ILaunchManager#getLaunchConfigurationTypes()
- */
- public ILaunchConfigurationType[] getLaunchConfigurationTypes() {
- List types= getLaunchConfigurationTypeList();
- return (ILaunchConfigurationType[])types.toArray(new ILaunchConfigurationType[types.size()]);
- }
-
- /**
- * @see ILaunchManager#getLaunchConfigurationType(String)
- */
- public ILaunchConfigurationType getLaunchConfigurationType(String id) {
- Iterator iter = getLaunchConfigurationTypeList().iterator();
- while (iter.hasNext()) {
- ILaunchConfigurationType type = (ILaunchConfigurationType)iter.next();
- if (type.getIdentifier().equals(id)) {
- return type;
- }
- }
- return null;
- }
-
- private List getLaunchConfigurationTypeList() {
- if (fLaunchConfigurationTypes == null) {
- initializeLaunchConfigurationTypes();
- }
- return fLaunchConfigurationTypes;
- }
-
- private void initializeLaunchConfigurationTypes() {
- IPluginDescriptor descriptor= DebugPlugin.getDefault().getDescriptor();
- IExtensionPoint extensionPoint= descriptor.getExtensionPoint(DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
- IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
- fLaunchConfigurationTypes= new ArrayList(infos.length);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
- LaunchConfigurationType configType = new LaunchConfigurationType(configurationElement);
- fLaunchConfigurationTypes.add(configType);
- }
- }
-
- /**
- * Notifies the launch manager that a launch configuration
- * has been deleted. The configuration is removed from the
- * cache of info's and from the index of configurations by
- * project, and listeners are notified.
- *
- * @param config the launch configuration that was deleted
- */
- protected void launchConfigurationDeleted(ILaunchConfiguration config) throws CoreException {
- removeInfo(config);
- getAllLaunchConfigurations().remove(config);
- if (fLaunchConfigurationListeners.size() > 0) {
- Object[] listeners = fLaunchConfigurationListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ILaunchConfigurationListener listener = (ILaunchConfigurationListener)listeners[i];
- listener.launchConfigurationRemoved(config);
- }
- }
- clearConfigNameCache();
- }
-
- /**
- * Notifies the launch manager that a launch configuration
- * has been added. The configuration is added to the index of
- * configurations by project, and listeners are notified.
- *
- * @param config the launch configuration that was added
- */
- protected void launchConfigurationAdded(ILaunchConfiguration config) throws CoreException {
- if (isValid(config)) {
- List allConfigs = getAllLaunchConfigurations();
- if (!allConfigs.contains(config)) {
- allConfigs.add(config);
- }
- if (fLaunchConfigurationListeners.size() > 0) {
- Object[] listeners = fLaunchConfigurationListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ILaunchConfigurationListener listener = (ILaunchConfigurationListener)listeners[i];
- listener.launchConfigurationAdded(config);
- }
- }
- clearConfigNameCache();
- } else {
- launchConfigurationDeleted(config);
- }
- }
-
- /**
- * Notifies the launch manager that a launch configuration
- * has been changed. The configuration is removed from the
- * cache of info objects such that the new attributes will
- * be updated on the next access. Listeners are notified of
- * the change.
- *
- * @param config the launch configuration that was changed
- */
- protected void launchConfigurationChanged(ILaunchConfiguration config) {
- removeInfo(config);
- clearConfigNameCache();
- if (isValid(config)) {
- notifyChanged(config);
- } else {
- try {
- launchConfigurationDeleted(config);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
-
- /**
- * Notifies listeners that the given launch configuration
- * has changed.
- *
- * @param configuration the changed launch configuration
- */
- protected void notifyChanged(ILaunchConfiguration configuration) {
- if (fLaunchConfigurationListeners.size() > 0) {
- Object[] listeners = fLaunchConfigurationListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ILaunchConfigurationListener listener = (ILaunchConfigurationListener)listeners[i];
- listener.launchConfigurationChanged(configuration);
- }
- }
- }
-
- /**
- * @see ILaunchManager#isExistingLaunchConfigurationName(String)
- */
- public boolean isExistingLaunchConfigurationName(String name) throws CoreException {
- String[] sortedConfigNames = getAllSortedConfigNames();
- int index = Arrays.binarySearch(sortedConfigNames, name);
- if (index < 0) {
- return false;
- }
- return true;
- }
-
- /**
- * @see org.eclipse.debug.core.ILaunchManager#generateUniqueLaunchConfigurationNameFrom(String)
- */
- public String generateUniqueLaunchConfigurationNameFrom(String baseName) {
- int index = 1;
- int length= baseName.length();
- int copyIndex = baseName.lastIndexOf(" ("); //$NON-NLS-1$
- if (copyIndex > -1 && length > copyIndex + 2 && baseName.charAt(length - 1) == ')') {
- String trailer = baseName.substring(copyIndex + 2, length -1);
- if (isNumber(trailer)) {
- try {
- index = Integer.parseInt(trailer);
- baseName = baseName.substring(0, copyIndex);
- } catch (NumberFormatException nfe) {
- }
- }
- }
- String newName = baseName;
- try {
- StringBuffer buffer= null;
- while (isExistingLaunchConfigurationName(newName)) {
- buffer = new StringBuffer(baseName);
- buffer.append(" ("); //$NON-NLS-1$
- buffer.append(String.valueOf(index));
- index++;
- buffer.append(')');
- newName = buffer.toString();
- }
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- return newName;
- }
-
- /**
- * Returns whether the given String is composed solely of digits
- */
- private boolean isNumber(String string) {
- int numChars= string.length();
- if (numChars == 0) {
- return false;
- }
- for (int i= 0; i < numChars; i++) {
- if (!Character.isDigit(string.charAt(i))) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return a sorted array of the names of all <code>ILaunchConfiguration</code>s in
- * the workspace. These are cached, and cache is cleared when a new config is added,
- * deleted or changed.
- */
- protected String[] getAllSortedConfigNames() throws CoreException {
- if (fSortedConfigNames == null) {
- ILaunchConfiguration[] configs = getLaunchConfigurations();
- fSortedConfigNames = new String[configs.length];
- for (int i = 0; i < configs.length; i++) {
- fSortedConfigNames[i] = configs[i].getName();
- }
- Arrays.sort(fSortedConfigNames);
- }
- return fSortedConfigNames;
- }
-
- /**
- * The launch config name cache is cleared when a config is added, deleted or changed.
- */
- protected void clearConfigNameCache() {
- fSortedConfigNames = null;
- }
-
- /**
- * Finds and returns all local launch configurations.
- *
- * @return all local launch configurations
- * @exception CoreException if there is a lower level
- * IO exception
- */
- protected List findLocalLaunchConfigurations() throws CoreException {
- IPath containerPath = LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
- List configs = new ArrayList(10);
- final File directory = containerPath.toFile();
- if (directory.isDirectory()) {
- FilenameFilter filter = new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return dir.equals(directory) &&
- name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION);
- }
- };
- String[] files = directory.list(filter);
- for (int i = 0; i < files.length; i++) {
- LaunchConfiguration config = new LaunchConfiguration(containerPath.append(files[i]));
- configs.add(config);
- }
- }
- return configs;
- }
-
- /**
- * Finds and returns all launch configurations in the given
- * container (and subcontainers)
- *
- * @param container the container to search
- * @exception CoreException an exception occurs traversing
- * the container.
- * @return all launch configurations in the given container
- */
- protected List findLaunchConfigurations(IContainer container) throws CoreException {
- List list = new ArrayList(10);
- if (container instanceof IProject && !((IProject)container).isOpen()) {
- return list;
- }
- searchForFiles(container, ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION, list);
- Iterator iter = list.iterator();
- List configs = new ArrayList(list.size());
- while (iter.hasNext()) {
- IFile file = (IFile)iter.next();
- configs.add(getLaunchConfiguration(file));
- }
- return configs;
- }
-
- /**
- * Recursively searches the given container for files with the given
- * extension.
- *
- * @param container the container to search in
- * @param extension the file extension being searched for
- * @param list the list to add the matching files to
- * @exception CoreException if an exception occurs traversing
- * the container
- */
- protected void searchForFiles(IContainer container, String extension, List list) throws CoreException {
- IResource[] members = container.members();
- for (int i = 0; i < members.length; i++) {
- if (members[i] instanceof IContainer) {
- if (members[i] instanceof IProject && !((IProject)members[i]) .isOpen()) {
- continue;
- }
- searchForFiles((IContainer)members[i], extension, list);
- } else if (members[i] instanceof IFile) {
- IFile file = (IFile)members[i];
- if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equalsIgnoreCase(file.getFileExtension())) {
- list.add(file);
- }
- }
- }
- }
-
- /**
- * Traverses the delta looking for added/removed/changed launch
- * configuration files.
- *
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta delta= event.getDelta();
- if (delta != null) {
- try {
- if (fgVisitor == null) {
- fgVisitor= new LaunchManagerVisitor();
- }
- delta.accept(fgVisitor);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
-
- /**
- * Returns the launch configurations specified by the given
- * XML document.
- *
- * @param root XML document
- * @return list of launch configurations
- * @exception IOException if an exception occurs reading the XML
- */
- protected List getConfigsFromXML(Element root) throws CoreException {
- DebugException invalidFormat =
- new DebugException(
- new Status(
- Status.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchManager.Invalid_launch_configuration_index._18"), null //$NON-NLS-1$
- )
- );
-
- if (!root.getNodeName().equalsIgnoreCase("launchConfigurations")) { //$NON-NLS-1$
- throw invalidFormat;
- }
-
- // read each launch configuration
- List configs = new ArrayList(4);
- NodeList list = root.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- String nodeName = entry.getNodeName();
- if (!nodeName.equals("launchConfiguration")) { //$NON-NLS-1$
- throw invalidFormat;
- }
- String memento = entry.getAttribute("memento"); //$NON-NLS-1$
- if (memento == null) {
- throw invalidFormat;
- }
- configs.add(getLaunchConfiguration(memento));
- }
- }
- return configs;
- }
-
- /**
- * The specified project has just opened - add all launch
- * configs in the project to the index of all configs.
- *
- * @param project the project that has been opened
- * @exception CoreException if reading the index fails
- */
- protected void projectOpened(IProject project) throws CoreException {
- List configs = findLaunchConfigurations(project);
- if (!configs.isEmpty()) {
- List allList = getAllLaunchConfigurations();
- Iterator iterator = configs.iterator();
- while (iterator.hasNext()) {
- ILaunchConfiguration config = (ILaunchConfiguration) iterator.next();
- if (!allList.contains(config)) {
- allList.add(config);
- }
- }
- }
- }
-
- /**
- * The specified project has just closed - remove its
- * launch configurations from the cached index.
- *
- * @param project the project that has been closed
- * @exception CoreException if writing the index fails
- */
- protected void projectClosed(IProject project) throws CoreException {
- List configs = getLaunchConfigurations(project);
- if (!configs.isEmpty()) {
- getAllLaunchConfigurations().removeAll(configs);
- }
- }
-
- /**
- * Visitor for handling resource deltas.
- */
- class LaunchManagerVisitor implements IResourceDeltaVisitor {
- /**
- * @see IResourceDeltaVisitor#visit(IResourceDelta)
- */
- public boolean visit(IResourceDelta delta) {
- if (delta == null) {
- return false;
- }
- if (0 != (delta.getFlags() & IResourceDelta.OPEN)) {
- if (delta.getResource() instanceof IProject) {
- IProject project = (IProject)delta.getResource();
- try {
- if (project.isOpen()) {
- LaunchManager.this.projectOpened(project);
- } else {
- LaunchManager.this.projectClosed(project);
- }
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- return false;
- }
- IResource resource = delta.getResource();
- if (resource instanceof IFile) {
- IFile file = (IFile)resource;
- if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equals(file.getFileExtension())) {
- IPath configPath = file.getLocation();
- // If the file has already been deleted, reconstruct the full
- // filesystem path
- if (configPath == null) {
- IPath workspaceRelativePath = delta.getFullPath();
- configPath = getWorkspaceRoot().getLocation().append(workspaceRelativePath);
- }
- ILaunchConfiguration handle = new LaunchConfiguration(configPath);
- try {
- switch (delta.getKind()) {
- case IResourceDelta.ADDED :
- LaunchManager.this.launchConfigurationAdded(handle);
- break;
- case IResourceDelta.REMOVED :
- LaunchManager.this.launchConfigurationDeleted(handle);
- break;
- case IResourceDelta.CHANGED :
- LaunchManager.this.launchConfigurationChanged(handle);
- break;
- }
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- return false;
- } else if (resource instanceof IContainer) {
- return true;
- }
- return true;
- }
- }
-
- /**
- * @see ILaunchManager#addLaunchConfigurationListener(ILaunchConfigurationListener)
- */
- public void addLaunchConfigurationListener(ILaunchConfigurationListener listener) {
- fLaunchConfigurationListeners.add(listener);
- }
-
- /**
- * @see ILaunchManager#removeLaunchConfigurationListener(ILaunchConfigurationListener)
- */
- public void removeLaunchConfigurationListener(ILaunchConfigurationListener listener) {
- fLaunchConfigurationListeners.remove(listener);
- }
-
- /**
- * Register source locators.
- *
- * @exception CoreException if an exception occurrs reading
- * the extensions
- */
- private void initializeSourceLocators() throws CoreException {
- IPluginDescriptor descriptor= DebugPlugin.getDefault().getDescriptor();
- IExtensionPoint extensionPoint= descriptor.getExtensionPoint(DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS);
- IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
- fSourceLocators= new HashMap(infos.length);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
- String id = configurationElement.getAttribute("id"); //$NON-NLS-1$
- if (id != null) {
- fSourceLocators.put(id,configurationElement);
- } else {
- // invalid status handler
- IStatus s = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
- MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Invalid_source_locator_extentsion_defined_by_plug-in___{0}______id___not_specified_12"), new String[] {configurationElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier()} ), null); //$NON-NLS-1$
- DebugPlugin.getDefault().log(s);
- }
- }
- }
-
-
- /**
- * Load comparator extensions.
- *
- * @exception CoreException if an exception occurrs reading
- * the extensions
- */
- private void initializeComparators() {
- IPluginDescriptor descriptor= DebugPlugin.getDefault().getDescriptor();
- IExtensionPoint extensionPoint= descriptor.getExtensionPoint(DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS);
- IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
- fComparators = new HashMap(infos.length);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
- String attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$
- if (attr != null) {
- fComparators.put(attr, new LaunchConfigurationComparator(configurationElement));
- } else {
- // invalid status handler
- IStatus s = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
- MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Invalid_launch_configuration_comparator_extension_defined_by_plug-in_{0}_-_attribute_not_specified_1"), new String[] {configurationElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier()}), null); //$NON-NLS-1$
- DebugPlugin.getDefault().log(s);
- }
- }
- }
-
- /**
- * @see ILaunchManager#newSourceLocator(String)
- */
- public IPersistableSourceLocator newSourceLocator(String identifier) throws CoreException {
- if (fSourceLocators == null) {
- initializeSourceLocators();
- }
- IConfigurationElement config = (IConfigurationElement)fSourceLocators.get(identifier);
- if (config == null) {
- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
- MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Source_locator_does_not_exist__{0}_13"), new String[] {identifier} ), null)); //$NON-NLS-1$
- } else {
- return (IPersistableSourceLocator)config.createExecutableExtension("class"); //$NON-NLS-1$
- }
-
- }
-
- /**
- * Returns the comparator registered for the given attribute, or
- * <code>null</code> if none.
- *
- * @param attributeName attribute for which a comparator is required
- * @return comparator, or <code>null</code> if none
- */
- protected Comparator getComparator(String attributeName) {
- HashMap map = getComparators();
- return (Comparator)map.get(attributeName);
- }
-
- /**
- * Returns comparators, loading if required
- */
- protected HashMap getComparators() {
- if (fComparators == null) {
- initializeComparators();
- }
- return fComparators;
- }
-
- private IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- private IWorkspaceRoot getWorkspaceRoot() {
- return getWorkspace().getRoot();
- }
-
-}
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.apache.xml.serialize.Method;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.Serializer;
+import org.apache.xml.serialize.SerializerFactory;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchListener;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IPersistableSourceLocator;
+import org.eclipse.debug.core.model.IProcess;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Manages launch configurations, launch configuration types, and registered launches.
+ *
+ * @see ILaunchManager
+ */
+public class LaunchManager implements ILaunchManager, IResourceChangeListener {
+
+ /**
+ * Collection of defined launch configuration type
+ * extensions.
+ */
+ private List fLaunchConfigurationTypes = null;
+
+ /**
+ * Launch configuration cache. Keys are <code>LaunchConfiguration</code>,
+ * values are <code>LaunchConfigurationInfo</code>.
+ */
+ private HashMap fLaunchConfigurations = new HashMap(10);
+
+ /**
+ * A cache of launch configuration names currently in the workspace.
+ */
+ private String[] fSortedConfigNames = null;
+
+ /**
+ * Collection of all launch configurations in the workspace.
+ * <code>List</code> of <code>ILaunchConfiguration</code>.
+ */
+ private List fLaunchConfigurationIndex = null;
+
+ /**
+ * Launch configuration comparator extensions,
+ * keyed by attribute name.
+ */
+ private HashMap fComparators = null;
+
+ /**
+ * Constant for use as local name part of <code>QualifiedName</code>
+ * for persisting the default launch configuration type.
+ */
+ private static final String DEFAULT_CONFIG_TYPE = "defaultLaunchConfigurationType"; //$NON-NLS-1$
+
+ /**
+ * Types of notifications
+ */
+ public static final int ADDED = 0;
+ public static final int REMOVED= 1;
+ public static final int CHANGED= 2;
+
+ /**
+ * Collection of launches
+ */
+ private Vector fLaunches= new Vector(10);
+
+ /**
+ * Collection of listeners
+ */
+ private ListenerList fListeners= new ListenerList(5);
+
+ /**
+ * Visitor used to process resource deltas,
+ * to update launch configuration index.
+ */
+ private IResourceDeltaVisitor fgVisitor;
+
+ /**
+ * Launch configuration listeners
+ */
+ private ListenerList fLaunchConfigurationListeners = new ListenerList(5);
+
+ /**
+ * Table of source locator extensions. Keys
+ * are identifiers, and values are associated
+ * configuration elements.
+ */
+ private Map fSourceLocators = null;
+
+ /**
+ * Path to the local directory where local launch configurations
+ * are stored with the workspace.
+ */
+ protected static final IPath LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH =
+ DebugPlugin.getDefault().getStateLocation().append(".launches"); //$NON-NLS-1$
+
+ /**
+ * Serializes a XML document into a string - encoded in UTF8 format,
+ * with platform line separators.
+ *
+ * @param doc document to serialize
+ * @return the document as a string
+ */
+ public static String serializeDocument(Document doc) throws IOException {
+ ByteArrayOutputStream s= new ByteArrayOutputStream();
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+ format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
+
+ Serializer serializer =
+ SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(
+ new OutputStreamWriter(s, "UTF8"), //$NON-NLS-1$
+ format);
+ serializer.asDOMSerializer().serialize(doc);
+ return s.toString("UTF8"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see ILaunchManager#addLaunchListener(ILaunchListener)
+ */
+ public void addLaunchListener(ILaunchListener listener) {
+ fListeners.add(listener);
+ }
+
+ /**
+ * Returns a collection of all launch configuration handles in
+ * the workspace. This collection is initialized lazily.
+ *
+ * @return all launch configuration handles
+ */
+ private List getAllLaunchConfigurations() throws CoreException {
+ if (fLaunchConfigurationIndex == null) {
+ fLaunchConfigurationIndex = new ArrayList(20);
+ List configs = findLocalLaunchConfigurations();
+ verifyConfigurations(configs, fLaunchConfigurationIndex);
+ configs = findLaunchConfigurations(getWorkspaceRoot());
+ verifyConfigurations(configs, fLaunchConfigurationIndex);
+ }
+ return fLaunchConfigurationIndex;
+ }
+
+ /**
+ * Verify basic integrity of launch configurations in the given list,
+ * adding valid configs to the collection of all launch configurations.
+ * Excpetions are logged for invalid configs.
+ *
+ * @param verify the list of configs to verify
+ * @param valid the list to place valid configrations in
+ */
+ protected void verifyConfigurations(List verify, List valid) {
+ Iterator configs = verify.iterator();
+ while (configs.hasNext()) {
+ ILaunchConfiguration config = (ILaunchConfiguration)configs.next();
+ if (isValid(config)) {
+ valid.add(config);
+ }
+ }
+ }
+
+ /**
+ * Returns whether the given launch configuration passes a basic
+ * integritiy test by retrieving its type.
+ *
+ * @param config the configuration to verify
+ * @return whether the config meets basic integrity constraints
+ */
+ protected boolean isValid(ILaunchConfiguration config) {
+ try {
+ config.getType();
+ } catch (CoreException e) {
+ IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
+ MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Unable_to_restore_invalid_launch_configuration"),new String[] {config.getLocation().toOSString()} ), e); //$NON-NLS-1$
+ DebugPlugin.log(status);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Clears all launch configurations (if any have been accessed)
+ */
+ private void clearAllLaunchConfigurations() {
+ if (fLaunchConfigurationTypes != null) {
+ fLaunchConfigurationTypes.clear();
+ }
+ if (fLaunchConfigurationIndex != null) {
+ fLaunchConfigurationIndex.clear();
+ }
+ }
+
+ /**
+ * @see ILaunchManager#removeLaunch(ILaunch)
+ */
+ public void removeLaunch(ILaunch launch) {
+ if (launch == null) {
+ return;
+ }
+ if (fLaunches.remove(launch)) {
+ fireUpdate(launch, REMOVED);
+ }
+ }
+
+ /**
+ * Fires notification to the listeners that a launch has been (de)registered.
+ */
+ public void fireUpdate(ILaunch launch, int update) {
+ Object[] copiedListeners= fListeners.getListeners();
+ for (int i= 0; i < copiedListeners.length; i++) {
+ ILaunchListener listener = (ILaunchListener)copiedListeners[i];
+ switch (update) {
+ case ADDED:
+ listener.launchAdded(launch);
+ break;
+ case REMOVED:
+ listener.launchRemoved(launch);
+ break;
+ case CHANGED:
+ if (isRegistered(launch)) {
+ listener.launchChanged(launch);
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * Returns whether the given launch is currently registered.
+ *
+ * @param launch a launch
+ * @return whether the given launch is currently registered
+ */
+ protected boolean isRegistered(ILaunch launch) {
+ return fLaunches.contains(launch);
+ }
+
+ /**
+ * @see ILaunchManager#getDebugTargets()
+ */
+ public IDebugTarget[] getDebugTargets() {
+ List allTargets= new ArrayList(fLaunches.size());
+ if (fLaunches.size() > 0) {
+ Iterator e= fLaunches.iterator();
+ while (e.hasNext()) {
+ IDebugTarget[] targets= ((ILaunch) e.next()).getDebugTargets();
+ for (int i = 0; i < targets.length; i++) {
+ allTargets.add(targets[i]);
+ }
+ }
+ }
+ return (IDebugTarget[])allTargets.toArray(new IDebugTarget[allTargets.size()]);
+ }
+
+ /**
+ * @see ILaunchManager#getLaunches()
+ */
+ public ILaunch[] getLaunches() {
+ return (ILaunch[])fLaunches.toArray(new ILaunch[fLaunches.size()]);
+ }
+
+ /**
+ * @see ILaunchManager#getProcesses()
+ */
+ public IProcess[] getProcesses() {
+ List allProcesses= new ArrayList(fLaunches.size());
+ Iterator e= fLaunches.iterator();
+ while (e.hasNext()) {
+ IProcess[] processes= ((ILaunch) e.next()).getProcesses();
+ for (int i= 0; i < processes.length; i++) {
+ allProcesses.add(processes[i]);
+ }
+ }
+ return (IProcess[])allProcesses.toArray(new IProcess[allProcesses.size()]);
+ }
+
+ /**
+ * @see ILaunchManager#addLaunch(ILaunch)
+ */
+ public void addLaunch(ILaunch launch) {
+ if (fLaunches.contains(launch)) {
+ return;
+ }
+
+ fLaunches.add(launch);
+ fireUpdate(launch, ADDED);
+ }
+
+ /**
+ * @see ILaunchManager#removeLaunchListener(ILaunchListener)
+ */
+ public void removeLaunchListener(ILaunchListener listener) {
+ fListeners.remove(listener);
+ }
+
+ /**
+ * Return a LaunchConfigurationInfo object initialized from XML contained in
+ * the specified stream. Simply pass out any exceptions encountered so that
+ * caller can deal with them. This is important since caller may need access to the
+ * actual exception.
+ */
+ protected LaunchConfigurationInfo createInfoFromXML(InputStream stream) throws CoreException,
+ ParserConfigurationException,
+ IOException,
+ SAXException {
+ Element root = null;
+ DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ root = parser.parse(new InputSource(stream)).getDocumentElement();
+ LaunchConfigurationInfo info = new LaunchConfigurationInfo();
+ info.initializeFromXML(root);
+ return info;
+ }
+
+ /**
+ * Terminates/Disconnects any active debug targets/processes.
+ * Clears launch configuration types.
+ */
+ public void shutdown() throws CoreException {
+ fListeners.removeAll();
+ ILaunch[] launches = getLaunches();
+ for (int i= 0; i < launches.length; i++) {
+ ILaunch launch= launches[i];
+ try {
+ launch.terminate();
+ } catch (DebugException e) {
+ DebugPlugin.log(e);
+ }
+ }
+
+ clearAllLaunchConfigurations();
+
+ getWorkspace().removeResourceChangeListener(this);
+ }
+
+ /**
+ * Creates launch configuration types for each defined extension.
+ *
+ * @exception CoreException if an exception occurs processing
+ * the extensions
+ */
+ public void startup() throws CoreException {
+ getWorkspace().addResourceChangeListener(this);
+ }
+
+ /**
+ * Returns the info object for the specified launch configuration.
+ * If the configuration exists, but is not yet in the cache,
+ * an info object is built and added to the cache.
+ *
+ * @exception CoreException if an exception occurs building
+ * the info object
+ * @exception DebugException if the config does not exist
+ */
+ protected LaunchConfigurationInfo getInfo(ILaunchConfiguration config) throws CoreException {
+ LaunchConfigurationInfo info = (LaunchConfigurationInfo)fLaunchConfigurations.get(config);
+ if (info == null) {
+ if (config.exists()) {
+ InputStream stream = null;
+ try {
+ if (config.isLocal()) {
+ IPath path = config.getLocation();
+ File file = path.toFile();
+ stream = new FileInputStream(file);
+ } else {
+ IFile file = ((LaunchConfiguration) config).getFile();
+ stream = file.getContents();
+ }
+ info = createInfoFromXML(stream);
+ fLaunchConfigurations.put(config, info);
+ } catch (FileNotFoundException e) {
+ throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
+ } catch (SAXException e) {
+ throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
+ } catch (ParserConfigurationException e) {
+ throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
+ } catch (IOException e) {
+ throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ throw createDebugException(MessageFormat.format(DebugCoreMessages.getString("LaunchManager.{0}_occurred_while_reading_launch_configuration_file._1"), new String[]{e.toString()}), e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ } else {
+ throw createDebugException(DebugCoreMessages.getString("LaunchManager.Launch_configuration_does_not_exist._6"), null); //$NON-NLS-1$
+ }
+ }
+ return info;
+ }
+
+ /**
+ * Return an instance of DebugException containing the specified message and Throwable.
+ */
+ protected DebugException createDebugException(String message, Throwable throwable) {
+ return new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, message, throwable
+ )
+ );
+ }
+
+ /**
+ * Removes the given launch configuration from the cache of configurations.
+ * When a local configuration is deleted, this method is called, as there will
+ * be no resource delta generated to auto-update the cache.
+ *
+ * @param configuration the configuration to remove
+ */
+ private void removeInfo(ILaunchConfiguration configuration) {
+ fLaunchConfigurations.remove(configuration);
+ }
+
+ /**
+ * @see ILaunchManager#getLaunchConfigurations()
+ */
+ public ILaunchConfiguration[] getLaunchConfigurations() throws CoreException {
+ List allConfigs = getAllLaunchConfigurations();
+ return (ILaunchConfiguration[])allConfigs.toArray(new ILaunchConfiguration[allConfigs.size()]);
+ }
+
+ /**
+ * @see ILaunchManager#getLaunchConfigurations(ILaunchConfigurationType)
+ */
+ public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException {
+ Iterator iter = getAllLaunchConfigurations().iterator();
+ List configs = new ArrayList();
+ while (iter.hasNext()) {
+ ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
+ if (config.getType().equals(type)) {
+ configs.add(config);
+ }
+ }
+ return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
+ }
+
+ /**
+ * Returns all launch configurations that are stored as resources
+ * in the given project.
+ *
+ * @param project a project
+ * @return collection of launch configurations that are stored as resources
+ * in the given project
+ */
+ protected List getLaunchConfigurations(IProject project) throws CoreException {
+ Iterator iter = getAllLaunchConfigurations().iterator();
+ List configs = new ArrayList();
+ while (iter.hasNext()) {
+ ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
+ IFile file = config.getFile();
+ if (file != null && file.getProject().equals(project)) {
+ configs.add(config);
+ }
+ }
+ return configs;
+ }
+
+ /**
+ * Returns all launch configurations that are stored locally.
+ *
+ * @return collection of launch configurations stored lcoally
+ */
+ protected List getLocalLaunchConfigurations() throws CoreException {
+ Iterator iter = getAllLaunchConfigurations().iterator();
+ List configs = new ArrayList();
+ while (iter.hasNext()) {
+ ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
+ if (config.isLocal()) {
+ configs.add(config);
+ }
+ }
+ return configs;
+ }
+
+ /**
+ * @see ILaunchManager#getLaunchConfiguration(IFile)
+ */
+ public ILaunchConfiguration getLaunchConfiguration(IFile file) {
+ return new LaunchConfiguration(file.getLocation());
+ }
+
+ /**
+ * @see ILaunchManager#getLaunchConfiguration(String)
+ */
+ public ILaunchConfiguration getLaunchConfiguration(String memento) throws CoreException {
+ return new LaunchConfiguration(memento);
+ }
+
+ /**
+ * @see ILaunchManager#getLaunchConfigurationTypes()
+ */
+ public ILaunchConfigurationType[] getLaunchConfigurationTypes() {
+ List types= getLaunchConfigurationTypeList();
+ return (ILaunchConfigurationType[])types.toArray(new ILaunchConfigurationType[types.size()]);
+ }
+
+ /**
+ * @see ILaunchManager#getLaunchConfigurationType(String)
+ */
+ public ILaunchConfigurationType getLaunchConfigurationType(String id) {
+ Iterator iter = getLaunchConfigurationTypeList().iterator();
+ while (iter.hasNext()) {
+ ILaunchConfigurationType type = (ILaunchConfigurationType)iter.next();
+ if (type.getIdentifier().equals(id)) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ private List getLaunchConfigurationTypeList() {
+ if (fLaunchConfigurationTypes == null) {
+ initializeLaunchConfigurationTypes();
+ }
+ return fLaunchConfigurationTypes;
+ }
+
+ private void initializeLaunchConfigurationTypes() {
+ IPluginDescriptor descriptor= DebugPlugin.getDefault().getDescriptor();
+ IExtensionPoint extensionPoint= descriptor.getExtensionPoint(DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
+ IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
+ fLaunchConfigurationTypes= new ArrayList(infos.length);
+ for (int i= 0; i < infos.length; i++) {
+ IConfigurationElement configurationElement = infos[i];
+ LaunchConfigurationType configType = new LaunchConfigurationType(configurationElement);
+ fLaunchConfigurationTypes.add(configType);
+ }
+ }
+
+ /**
+ * Notifies the launch manager that a launch configuration
+ * has been deleted. The configuration is removed from the
+ * cache of info's and from the index of configurations by
+ * project, and listeners are notified.
+ *
+ * @param config the launch configuration that was deleted
+ */
+ protected void launchConfigurationDeleted(ILaunchConfiguration config) throws CoreException {
+ removeInfo(config);
+ getAllLaunchConfigurations().remove(config);
+ if (fLaunchConfigurationListeners.size() > 0) {
+ Object[] listeners = fLaunchConfigurationListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ILaunchConfigurationListener listener = (ILaunchConfigurationListener)listeners[i];
+ listener.launchConfigurationRemoved(config);
+ }
+ }
+ clearConfigNameCache();
+ }
+
+ /**
+ * Notifies the launch manager that a launch configuration
+ * has been added. The configuration is added to the index of
+ * configurations by project, and listeners are notified.
+ *
+ * @param config the launch configuration that was added
+ */
+ protected void launchConfigurationAdded(ILaunchConfiguration config) throws CoreException {
+ if (isValid(config)) {
+ List allConfigs = getAllLaunchConfigurations();
+ if (!allConfigs.contains(config)) {
+ allConfigs.add(config);
+ }
+ if (fLaunchConfigurationListeners.size() > 0) {
+ Object[] listeners = fLaunchConfigurationListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ILaunchConfigurationListener listener = (ILaunchConfigurationListener)listeners[i];
+ listener.launchConfigurationAdded(config);
+ }
+ }
+ clearConfigNameCache();
+ } else {
+ launchConfigurationDeleted(config);
+ }
+ }
+
+ /**
+ * Notifies the launch manager that a launch configuration
+ * has been changed. The configuration is removed from the
+ * cache of info objects such that the new attributes will
+ * be updated on the next access. Listeners are notified of
+ * the change.
+ *
+ * @param config the launch configuration that was changed
+ */
+ protected void launchConfigurationChanged(ILaunchConfiguration config) {
+ removeInfo(config);
+ clearConfigNameCache();
+ if (isValid(config)) {
+ notifyChanged(config);
+ } else {
+ try {
+ launchConfigurationDeleted(config);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ }
+
+ /**
+ * Notifies listeners that the given launch configuration
+ * has changed.
+ *
+ * @param configuration the changed launch configuration
+ */
+ protected void notifyChanged(ILaunchConfiguration configuration) {
+ if (fLaunchConfigurationListeners.size() > 0) {
+ Object[] listeners = fLaunchConfigurationListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ILaunchConfigurationListener listener = (ILaunchConfigurationListener)listeners[i];
+ listener.launchConfigurationChanged(configuration);
+ }
+ }
+ }
+
+ /**
+ * @see ILaunchManager#isExistingLaunchConfigurationName(String)
+ */
+ public boolean isExistingLaunchConfigurationName(String name) throws CoreException {
+ String[] sortedConfigNames = getAllSortedConfigNames();
+ int index = Arrays.binarySearch(sortedConfigNames, name);
+ if (index < 0) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @see org.eclipse.debug.core.ILaunchManager#generateUniqueLaunchConfigurationNameFrom(String)
+ */
+ public String generateUniqueLaunchConfigurationNameFrom(String baseName) {
+ int index = 1;
+ int length= baseName.length();
+ int copyIndex = baseName.lastIndexOf(" ("); //$NON-NLS-1$
+ if (copyIndex > -1 && length > copyIndex + 2 && baseName.charAt(length - 1) == ')') {
+ String trailer = baseName.substring(copyIndex + 2, length -1);
+ if (isNumber(trailer)) {
+ try {
+ index = Integer.parseInt(trailer);
+ baseName = baseName.substring(0, copyIndex);
+ } catch (NumberFormatException nfe) {
+ }
+ }
+ }
+ String newName = baseName;
+ try {
+ StringBuffer buffer= null;
+ while (isExistingLaunchConfigurationName(newName)) {
+ buffer = new StringBuffer(baseName);
+ buffer.append(" ("); //$NON-NLS-1$
+ buffer.append(String.valueOf(index));
+ index++;
+ buffer.append(')');
+ newName = buffer.toString();
+ }
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ return newName;
+ }
+
+ /**
+ * Returns whether the given String is composed solely of digits
+ */
+ private boolean isNumber(String string) {
+ int numChars= string.length();
+ if (numChars == 0) {
+ return false;
+ }
+ for (int i= 0; i < numChars; i++) {
+ if (!Character.isDigit(string.charAt(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Return a sorted array of the names of all <code>ILaunchConfiguration</code>s in
+ * the workspace. These are cached, and cache is cleared when a new config is added,
+ * deleted or changed.
+ */
+ protected String[] getAllSortedConfigNames() throws CoreException {
+ if (fSortedConfigNames == null) {
+ ILaunchConfiguration[] configs = getLaunchConfigurations();
+ fSortedConfigNames = new String[configs.length];
+ for (int i = 0; i < configs.length; i++) {
+ fSortedConfigNames[i] = configs[i].getName();
+ }
+ Arrays.sort(fSortedConfigNames);
+ }
+ return fSortedConfigNames;
+ }
+
+ /**
+ * The launch config name cache is cleared when a config is added, deleted or changed.
+ */
+ protected void clearConfigNameCache() {
+ fSortedConfigNames = null;
+ }
+
+ /**
+ * Finds and returns all local launch configurations.
+ *
+ * @return all local launch configurations
+ * @exception CoreException if there is a lower level
+ * IO exception
+ */
+ protected List findLocalLaunchConfigurations() throws CoreException {
+ IPath containerPath = LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH;
+ List configs = new ArrayList(10);
+ final File directory = containerPath.toFile();
+ if (directory.isDirectory()) {
+ FilenameFilter filter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return dir.equals(directory) &&
+ name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION);
+ }
+ };
+ String[] files = directory.list(filter);
+ for (int i = 0; i < files.length; i++) {
+ LaunchConfiguration config = new LaunchConfiguration(containerPath.append(files[i]));
+ configs.add(config);
+ }
+ }
+ return configs;
+ }
+
+ /**
+ * Finds and returns all launch configurations in the given
+ * container (and subcontainers)
+ *
+ * @param container the container to search
+ * @exception CoreException an exception occurs traversing
+ * the container.
+ * @return all launch configurations in the given container
+ */
+ protected List findLaunchConfigurations(IContainer container) throws CoreException {
+ List list = new ArrayList(10);
+ if (container instanceof IProject && !((IProject)container).isOpen()) {
+ return list;
+ }
+ searchForFiles(container, ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION, list);
+ Iterator iter = list.iterator();
+ List configs = new ArrayList(list.size());
+ while (iter.hasNext()) {
+ IFile file = (IFile)iter.next();
+ configs.add(getLaunchConfiguration(file));
+ }
+ return configs;
+ }
+
+ /**
+ * Recursively searches the given container for files with the given
+ * extension.
+ *
+ * @param container the container to search in
+ * @param extension the file extension being searched for
+ * @param list the list to add the matching files to
+ * @exception CoreException if an exception occurs traversing
+ * the container
+ */
+ protected void searchForFiles(IContainer container, String extension, List list) throws CoreException {
+ IResource[] members = container.members();
+ for (int i = 0; i < members.length; i++) {
+ if (members[i] instanceof IContainer) {
+ if (members[i] instanceof IProject && !((IProject)members[i]) .isOpen()) {
+ continue;
+ }
+ searchForFiles((IContainer)members[i], extension, list);
+ } else if (members[i] instanceof IFile) {
+ IFile file = (IFile)members[i];
+ if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equalsIgnoreCase(file.getFileExtension())) {
+ list.add(file);
+ }
+ }
+ }
+ }
+
+ /**
+ * Traverses the delta looking for added/removed/changed launch
+ * configuration files.
+ *
+ * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta= event.getDelta();
+ if (delta != null) {
+ try {
+ if (fgVisitor == null) {
+ fgVisitor= new LaunchManagerVisitor();
+ }
+ delta.accept(fgVisitor);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ }
+
+ /**
+ * Returns the launch configurations specified by the given
+ * XML document.
+ *
+ * @param root XML document
+ * @return list of launch configurations
+ * @exception IOException if an exception occurs reading the XML
+ */
+ protected List getConfigsFromXML(Element root) throws CoreException {
+ DebugException invalidFormat =
+ new DebugException(
+ new Status(
+ Status.ERROR, DebugPlugin.getUniqueIdentifier(),
+ DebugException.REQUEST_FAILED, DebugCoreMessages.getString("LaunchManager.Invalid_launch_configuration_index._18"), null //$NON-NLS-1$
+ )
+ );
+
+ if (!root.getNodeName().equalsIgnoreCase("launchConfigurations")) { //$NON-NLS-1$
+ throw invalidFormat;
+ }
+
+ // read each launch configuration
+ List configs = new ArrayList(4);
+ NodeList list = root.getChildNodes();
+ int length = list.getLength();
+ for (int i = 0; i < length; ++i) {
+ Node node = list.item(i);
+ short type = node.getNodeType();
+ if (type == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ String nodeName = entry.getNodeName();
+ if (!nodeName.equals("launchConfiguration")) { //$NON-NLS-1$
+ throw invalidFormat;
+ }
+ String memento = entry.getAttribute("memento"); //$NON-NLS-1$
+ if (memento == null) {
+ throw invalidFormat;
+ }
+ configs.add(getLaunchConfiguration(memento));
+ }
+ }
+ return configs;
+ }
+
+ /**
+ * The specified project has just opened - add all launch
+ * configs in the project to the index of all configs.
+ *
+ * @param project the project that has been opened
+ * @exception CoreException if reading the index fails
+ */
+ protected void projectOpened(IProject project) throws CoreException {
+ List configs = findLaunchConfigurations(project);
+ if (!configs.isEmpty()) {
+ List allList = getAllLaunchConfigurations();
+ Iterator iterator = configs.iterator();
+ while (iterator.hasNext()) {
+ ILaunchConfiguration config = (ILaunchConfiguration) iterator.next();
+ if (!allList.contains(config)) {
+ allList.add(config);
+ }
+ }
+ }
+ }
+
+ /**
+ * The specified project has just closed - remove its
+ * launch configurations from the cached index.
+ *
+ * @param project the project that has been closed
+ * @exception CoreException if writing the index fails
+ */
+ protected void projectClosed(IProject project) throws CoreException {
+ List configs = getLaunchConfigurations(project);
+ if (!configs.isEmpty()) {
+ getAllLaunchConfigurations().removeAll(configs);
+ }
+ }
+
+ /**
+ * Visitor for handling resource deltas.
+ */
+ class LaunchManagerVisitor implements IResourceDeltaVisitor {
+ /**
+ * @see IResourceDeltaVisitor#visit(IResourceDelta)
+ */
+ public boolean visit(IResourceDelta delta) {
+ if (delta == null) {
+ return false;
+ }
+ if (0 != (delta.getFlags() & IResourceDelta.OPEN)) {
+ if (delta.getResource() instanceof IProject) {
+ IProject project = (IProject)delta.getResource();
+ try {
+ if (project.isOpen()) {
+ LaunchManager.this.projectOpened(project);
+ } else {
+ LaunchManager.this.projectClosed(project);
+ }
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ return false;
+ }
+ IResource resource = delta.getResource();
+ if (resource instanceof IFile) {
+ IFile file = (IFile)resource;
+ if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equals(file.getFileExtension())) {
+ IPath configPath = file.getLocation();
+ // If the file has already been deleted, reconstruct the full
+ // filesystem path
+ if (configPath == null) {
+ IPath workspaceRelativePath = delta.getFullPath();
+ configPath = getWorkspaceRoot().getLocation().append(workspaceRelativePath);
+ }
+ ILaunchConfiguration handle = new LaunchConfiguration(configPath);
+ try {
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED :
+ LaunchManager.this.launchConfigurationAdded(handle);
+ break;
+ case IResourceDelta.REMOVED :
+ LaunchManager.this.launchConfigurationDeleted(handle);
+ break;
+ case IResourceDelta.CHANGED :
+ LaunchManager.this.launchConfigurationChanged(handle);
+ break;
+ }
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ return false;
+ } else if (resource instanceof IContainer) {
+ return true;
+ }
+ return true;
+ }
+ }
+
+ /**
+ * @see ILaunchManager#addLaunchConfigurationListener(ILaunchConfigurationListener)
+ */
+ public void addLaunchConfigurationListener(ILaunchConfigurationListener listener) {
+ fLaunchConfigurationListeners.add(listener);
+ }
+
+ /**
+ * @see ILaunchManager#removeLaunchConfigurationListener(ILaunchConfigurationListener)
+ */
+ public void removeLaunchConfigurationListener(ILaunchConfigurationListener listener) {
+ fLaunchConfigurationListeners.remove(listener);
+ }
+
+ /**
+ * Register source locators.
+ *
+ * @exception CoreException if an exception occurrs reading
+ * the extensions
+ */
+ private void initializeSourceLocators() throws CoreException {
+ IPluginDescriptor descriptor= DebugPlugin.getDefault().getDescriptor();
+ IExtensionPoint extensionPoint= descriptor.getExtensionPoint(DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS);
+ IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
+ fSourceLocators= new HashMap(infos.length);
+ for (int i= 0; i < infos.length; i++) {
+ IConfigurationElement configurationElement = infos[i];
+ String id = configurationElement.getAttribute("id"); //$NON-NLS-1$
+ if (id != null) {
+ fSourceLocators.put(id,configurationElement);
+ } else {
+ // invalid status handler
+ IStatus s = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
+ MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Invalid_source_locator_extentsion_defined_by_plug-in___{0}______id___not_specified_12"), new String[] {configurationElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier()} ), null); //$NON-NLS-1$
+ DebugPlugin.getDefault().log(s);
+ }
+ }
+ }
+
+
+ /**
+ * Load comparator extensions.
+ *
+ * @exception CoreException if an exception occurrs reading
+ * the extensions
+ */
+ private void initializeComparators() {
+ IPluginDescriptor descriptor= DebugPlugin.getDefault().getDescriptor();
+ IExtensionPoint extensionPoint= descriptor.getExtensionPoint(DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS);
+ IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
+ fComparators = new HashMap(infos.length);
+ for (int i= 0; i < infos.length; i++) {
+ IConfigurationElement configurationElement = infos[i];
+ String attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$
+ if (attr != null) {
+ fComparators.put(attr, new LaunchConfigurationComparator(configurationElement));
+ } else {
+ // invalid status handler
+ IStatus s = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
+ MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Invalid_launch_configuration_comparator_extension_defined_by_plug-in_{0}_-_attribute_not_specified_1"), new String[] {configurationElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier()}), null); //$NON-NLS-1$
+ DebugPlugin.getDefault().log(s);
+ }
+ }
+ }
+
+ /**
+ * @see ILaunchManager#newSourceLocator(String)
+ */
+ public IPersistableSourceLocator newSourceLocator(String identifier) throws CoreException {
+ if (fSourceLocators == null) {
+ initializeSourceLocators();
+ }
+ IConfigurationElement config = (IConfigurationElement)fSourceLocators.get(identifier);
+ if (config == null) {
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.INTERNAL_ERROR,
+ MessageFormat.format(DebugCoreMessages.getString("LaunchManager.Source_locator_does_not_exist__{0}_13"), new String[] {identifier} ), null)); //$NON-NLS-1$
+ } else {
+ return (IPersistableSourceLocator)config.createExecutableExtension("class"); //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * Returns the comparator registered for the given attribute, or
+ * <code>null</code> if none.
+ *
+ * @param attributeName attribute for which a comparator is required
+ * @return comparator, or <code>null</code> if none
+ */
+ protected Comparator getComparator(String attributeName) {
+ HashMap map = getComparators();
+ return (Comparator)map.get(attributeName);
+ }
+
+ /**
+ * Returns comparators, loading if required
+ */
+ protected HashMap getComparators() {
+ if (fComparators == null) {
+ initializeComparators();
+ }
+ return fComparators;
+ }
+
+ private IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ private IWorkspaceRoot getWorkspaceRoot() {
+ return getWorkspace().getRoot();
+ }
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ListenerList.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ListenerList.java
index f664e02f1..9ad6e752d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ListenerList.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ListenerList.java
@@ -1,131 +1,131 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Local version of org.eclipse.jface.util.ListenerList (modified)s
- */
-public class ListenerList {
- /**
- * The current number of listeners.
- * Maintains invariant: 0 <= fSize <= listeners.length.
- */
- private int fSize;
-
- /**
- * The list of listeners. Initially <code>null</code> but initialized
- * to an array of size capacity the first time a listener is added.
- * Maintains invariant: listeners != null if and only if fSize != 0
- */
- private Object[] fListeners= null;
-
- /**
- * The empty array singleton instance, returned by getListeners()
- * when size == 0.
- */
- private static final Object[] EmptyArray= new Object[0];
-
- /**
- * Creates a listener list with the given initial capacity.
- *
- * @param capacity the number of listeners which this list can initially accept
- * without growing its internal representation; must be at least 1
- */
- public ListenerList(int capacity) {
- if (capacity < 1) {
- throw new IllegalArgumentException();
- }
- fListeners= new Object[capacity];
- fSize= 0;
- }
-
- /**
- * Adds a listener to the list.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a listener
- */
- public synchronized void add(Object listener) {
- if (listener == null) {
- throw new IllegalArgumentException();
- }
- // check for duplicates using identity
- for (int i= 0; i < fSize; ++i) {
- if (fListeners[i] == listener) {
- return;
- }
- }
- // grow array if necessary
- if (fSize == fListeners.length) {
- Object[] temp= new Object[(fSize * 2) + 1];
- System.arraycopy(fListeners, 0, temp, 0, fSize);
- fListeners= temp;
- }
- fListeners[fSize++]= listener;
- }
-
- /**
- * Returns an array containing all the registered listeners.
- * The resulting array is unaffected by subsequent adds or removes.
- * If there are no listeners registered, the result is an empty array
- * singleton instance (no garbage is created).
- * Use this method when notifying listeners, so that any modifications
- * to the listener list during the notification will have no effect on the
- * notification itself.
- */
- public synchronized Object[] getListeners() {
- if (fSize == 0) {
- return EmptyArray;
- }
- Object[] result= new Object[fSize];
- System.arraycopy(fListeners, 0, result, 0, fSize);
- return result;
- }
-
- /**
- * Removes a listener from the list.
- * Has no effect if an identical listener was not already registered.
- *
- * @param listener a listener
- */
- public synchronized void remove(Object listener) {
- if (listener == null) {
- throw new IllegalArgumentException();
- }
-
- for (int i= 0; i < fSize; ++i) {
- if (fListeners[i] == listener) {
- if (--fSize == 0) {
- fListeners= new Object[1];
- } else {
- if (i < fSize) {
- fListeners[i]= fListeners[fSize];
- }
- fListeners[fSize]= null;
- }
- return;
- }
- }
- }
-
- /**
- * Removes all the listeners from the list.
- */
- public void removeAll() {
- fListeners= new Object[0];
- fSize= 0;
- }
-
- /**
- * Returns the number of registered listeners
- *
- * @return the number of registered listeners
- */
- public int size() {
- return fSize;
- }
-}
-
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Local version of org.eclipse.jface.util.ListenerList (modified)s
+ */
+public class ListenerList {
+ /**
+ * The current number of listeners.
+ * Maintains invariant: 0 <= fSize <= listeners.length.
+ */
+ private int fSize;
+
+ /**
+ * The list of listeners. Initially <code>null</code> but initialized
+ * to an array of size capacity the first time a listener is added.
+ * Maintains invariant: listeners != null if and only if fSize != 0
+ */
+ private Object[] fListeners= null;
+
+ /**
+ * The empty array singleton instance, returned by getListeners()
+ * when size == 0.
+ */
+ private static final Object[] EmptyArray= new Object[0];
+
+ /**
+ * Creates a listener list with the given initial capacity.
+ *
+ * @param capacity the number of listeners which this list can initially accept
+ * without growing its internal representation; must be at least 1
+ */
+ public ListenerList(int capacity) {
+ if (capacity < 1) {
+ throw new IllegalArgumentException();
+ }
+ fListeners= new Object[capacity];
+ fSize= 0;
+ }
+
+ /**
+ * Adds a listener to the list.
+ * Has no effect if an identical listener is already registered.
+ *
+ * @param listener a listener
+ */
+ public synchronized void add(Object listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException();
+ }
+ // check for duplicates using identity
+ for (int i= 0; i < fSize; ++i) {
+ if (fListeners[i] == listener) {
+ return;
+ }
+ }
+ // grow array if necessary
+ if (fSize == fListeners.length) {
+ Object[] temp= new Object[(fSize * 2) + 1];
+ System.arraycopy(fListeners, 0, temp, 0, fSize);
+ fListeners= temp;
+ }
+ fListeners[fSize++]= listener;
+ }
+
+ /**
+ * Returns an array containing all the registered listeners.
+ * The resulting array is unaffected by subsequent adds or removes.
+ * If there are no listeners registered, the result is an empty array
+ * singleton instance (no garbage is created).
+ * Use this method when notifying listeners, so that any modifications
+ * to the listener list during the notification will have no effect on the
+ * notification itself.
+ */
+ public synchronized Object[] getListeners() {
+ if (fSize == 0) {
+ return EmptyArray;
+ }
+ Object[] result= new Object[fSize];
+ System.arraycopy(fListeners, 0, result, 0, fSize);
+ return result;
+ }
+
+ /**
+ * Removes a listener from the list.
+ * Has no effect if an identical listener was not already registered.
+ *
+ * @param listener a listener
+ */
+ public synchronized void remove(Object listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException();
+ }
+
+ for (int i= 0; i < fSize; ++i) {
+ if (fListeners[i] == listener) {
+ if (--fSize == 0) {
+ fListeners= new Object[1];
+ } else {
+ if (i < fSize) {
+ fListeners[i]= fListeners[fSize];
+ }
+ fListeners[fSize]= null;
+ }
+ return;
+ }
+ }
+ }
+
+ /**
+ * Removes all the listeners from the list.
+ */
+ public void removeAll() {
+ fListeners= new Object[0];
+ fSize= 0;
+ }
+
+ /**
+ * Returns the number of registered listeners
+ *
+ * @return the number of registered listeners
+ */
+ public int size() {
+ return fSize;
+ }
+}
+
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
index 6e7ebb1c1..736e40edb 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
@@ -1,172 +1,172 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IStreamListener;
-import org.eclipse.debug.core.model.IStreamMonitor;
-
-/**
- * Monitors the output stream of a system process and notifies
- * listeners of additions to the stream.
- *
- * The output stream monitor reads system out (or err) via
- * and input stream.
- */
-public class OutputStreamMonitor implements IStreamMonitor {
- /**
- * The stream being monitored (connected system out or err).
- */
- private InputStream fStream;
-
- /**
- * A collection of listeners
- */
- private ListenerList fListeners= new ListenerList(1);
-
- /**
- * The local copy of the stream contents
- */
- private StringBuffer fContents;
-
- /**
- * The thread which reads from the stream
- */
- private Thread fThread;
-
- /**
- * The size of the read buffer
- */
- private static final int BUFFER_SIZE= 8192;
-
- /**
- * Whether or not this monitor has been killed.
- * When the monitor is killed, it stops reading
- * from the stream immediately.
- */
- private boolean fKilled= false;
- /**
- * Creates an output stream monitor on the
- * given stream (connected to system out or err).
- */
- public OutputStreamMonitor(InputStream stream) {
- fStream= stream;
- fContents= new StringBuffer();
- }
-
- /**
- * @see IStreamMonitor#addListener(IStreamListener)
- */
- public void addListener(IStreamListener listener) {
- fListeners.add(listener);
- }
-
- /**
- * Causes the monitor to close all
- * communications between it and the
- * underlying stream by waiting for the thread to terminate.
- */
- protected void close() {
- if (fThread != null) {
- Thread thread= fThread;
- fThread= null;
- try {
- thread.join();
- } catch (InterruptedException ie) {
- }
- fListeners.removeAll();
- }
- }
-
- /**
- * Notifies the listeners that text has
- * been appended to the stream.
- */
- private void fireStreamAppended(String text) {
- if (text == null)
- return;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- ((IStreamListener) copiedListeners[i]).streamAppended(text, this);
- }
- }
-
- /**
- * @see IStreamMonitor#getContents()
- */
- public String getContents() {
- return fContents.toString();
- }
-
- /**
- * Continually reads from the stream.
- * <p>
- * This method, along with the <code>startReading</code>
- * method is used to allow <code>OutputStreamMonitor</code>
- * to implement <code>Runnable</code> without publicly
- * exposing a <code>run</code> method.
- */
- private void read() {
- byte[] bytes= new byte[BUFFER_SIZE];
- int read = 0;
- while (read >= 0) {
- try {
- if (fKilled) {
- break;
- }
- read= fStream.read(bytes);
- if (read > 0) {
- String text= new String(bytes, 0, read);
- fContents.append(text);
- fireStreamAppended(text);
- }
- } catch (IOException ioe) {
- DebugPlugin.log(ioe);
- return;
- } catch (NullPointerException e) {
- // killing the stream monitor while reading can cause an NPE
- // when reading from the stream
- if (!fKilled || fThread != null) {
- DebugPlugin.log(e);
- }
- return;
- }
- }
- try {
- fStream.close();
- } catch (IOException e) {
- DebugPlugin.log(e);
- }
- }
-
- protected void kill() {
- fKilled= true;
- }
-
- /**
- * @see IStreamMonitor#removeListener(IStreamListener)
- */
- public void removeListener(IStreamListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * Starts a thread which reads from the stream
- */
- protected void startMonitoring() {
- if (fThread == null) {
- fThread= new Thread(new Runnable() {
- public void run() {
- read();
- }
- }, DebugCoreMessages.getString("OutputStreamMonitor.label")); //$NON-NLS-1$
- fThread.start();
- }
- }
-}
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IStreamListener;
+import org.eclipse.debug.core.model.IStreamMonitor;
+
+/**
+ * Monitors the output stream of a system process and notifies
+ * listeners of additions to the stream.
+ *
+ * The output stream monitor reads system out (or err) via
+ * and input stream.
+ */
+public class OutputStreamMonitor implements IStreamMonitor {
+ /**
+ * The stream being monitored (connected system out or err).
+ */
+ private InputStream fStream;
+
+ /**
+ * A collection of listeners
+ */
+ private ListenerList fListeners= new ListenerList(1);
+
+ /**
+ * The local copy of the stream contents
+ */
+ private StringBuffer fContents;
+
+ /**
+ * The thread which reads from the stream
+ */
+ private Thread fThread;
+
+ /**
+ * The size of the read buffer
+ */
+ private static final int BUFFER_SIZE= 8192;
+
+ /**
+ * Whether or not this monitor has been killed.
+ * When the monitor is killed, it stops reading
+ * from the stream immediately.
+ */
+ private boolean fKilled= false;
+ /**
+ * Creates an output stream monitor on the
+ * given stream (connected to system out or err).
+ */
+ public OutputStreamMonitor(InputStream stream) {
+ fStream= stream;
+ fContents= new StringBuffer();
+ }
+
+ /**
+ * @see IStreamMonitor#addListener(IStreamListener)
+ */
+ public void addListener(IStreamListener listener) {
+ fListeners.add(listener);
+ }
+
+ /**
+ * Causes the monitor to close all
+ * communications between it and the
+ * underlying stream by waiting for the thread to terminate.
+ */
+ protected void close() {
+ if (fThread != null) {
+ Thread thread= fThread;
+ fThread= null;
+ try {
+ thread.join();
+ } catch (InterruptedException ie) {
+ }
+ fListeners.removeAll();
+ }
+ }
+
+ /**
+ * Notifies the listeners that text has
+ * been appended to the stream.
+ */
+ private void fireStreamAppended(String text) {
+ if (text == null)
+ return;
+ Object[] copiedListeners= fListeners.getListeners();
+ for (int i= 0; i < copiedListeners.length; i++) {
+ ((IStreamListener) copiedListeners[i]).streamAppended(text, this);
+ }
+ }
+
+ /**
+ * @see IStreamMonitor#getContents()
+ */
+ public String getContents() {
+ return fContents.toString();
+ }
+
+ /**
+ * Continually reads from the stream.
+ * <p>
+ * This method, along with the <code>startReading</code>
+ * method is used to allow <code>OutputStreamMonitor</code>
+ * to implement <code>Runnable</code> without publicly
+ * exposing a <code>run</code> method.
+ */
+ private void read() {
+ byte[] bytes= new byte[BUFFER_SIZE];
+ int read = 0;
+ while (read >= 0) {
+ try {
+ if (fKilled) {
+ break;
+ }
+ read= fStream.read(bytes);
+ if (read > 0) {
+ String text= new String(bytes, 0, read);
+ fContents.append(text);
+ fireStreamAppended(text);
+ }
+ } catch (IOException ioe) {
+ DebugPlugin.log(ioe);
+ return;
+ } catch (NullPointerException e) {
+ // killing the stream monitor while reading can cause an NPE
+ // when reading from the stream
+ if (!fKilled || fThread != null) {
+ DebugPlugin.log(e);
+ }
+ return;
+ }
+ }
+ try {
+ fStream.close();
+ } catch (IOException e) {
+ DebugPlugin.log(e);
+ }
+ }
+
+ protected void kill() {
+ fKilled= true;
+ }
+
+ /**
+ * @see IStreamMonitor#removeListener(IStreamListener)
+ */
+ public void removeListener(IStreamListener listener) {
+ fListeners.remove(listener);
+ }
+
+ /**
+ * Starts a thread which reads from the stream
+ */
+ protected void startMonitoring() {
+ if (fThread == null) {
+ fThread= new Thread(new Runnable() {
+ public void run() {
+ read();
+ }
+ }, DebugCoreMessages.getString("OutputStreamMonitor.label")); //$NON-NLS-1$
+ fThread.start();
+ }
+ }
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ProcessMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ProcessMonitor.java
index 81f2f0b22..ad608f373 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ProcessMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ProcessMonitor.java
@@ -1,79 +1,79 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Monitors a system process, wiating for it to terminate, and
- * then notifies the associated runtime process.
- */
-public class ProcessMonitor {
- /**
- * The underlying <code>java.lang.Process</code> being monitored.
- */
- protected Process fOSProcess;
- /**
- * The <code>IProcess</code> which will be informed when this
- * monitor detects that the underlying process has terminated.
- */
- protected RuntimeProcess fProcess;
-
- /**
- * The <code>Thread</code> which is monitoring the underlying process.
- */
- protected Thread fThread;
- /**
- * Creates a new process monitor and starts monitoring the process
- * for termination.
- */
- public ProcessMonitor(RuntimeProcess process) {
- fProcess= process;
- fOSProcess= process.getSystemProcess();
- startMonitoring();
- }
-
- /**
- * Monitors the underlying process for termination. When the underlying
- * process terminates (or if the monitoring thread is interrupted),
- * inform the <code>IProcess</code> that it has terminated.
- */
- private void monitorProcess() {
- while (fOSProcess != null) {
- try {
- fOSProcess.waitFor();
- } catch (InterruptedException ie) {
- } finally {
- fOSProcess = null;
- fProcess.terminated();
- }
- }
- }
-
- /**
- * Starts monitoring the underlying process to determine
- * if it has terminated.
- */
- private void startMonitoring() {
- if (fThread == null) {
- fThread= new Thread(new Runnable() {
- public void run() {
- monitorProcess();
- }
- }, DebugCoreMessages.getString("ProcessMonitor.label")); //$NON-NLS-1$
- fThread.start();
- }
- }
-
- /**
- * Kills the monitoring thread.
- *
- * This method is to be useful for dealing with the error
- * case of an underlying process which has not informed this
- * monitor of its termination.
- */
- protected void killMonitoring() {
- fThread.interrupt();
- }
-}
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Monitors a system process, wiating for it to terminate, and
+ * then notifies the associated runtime process.
+ */
+public class ProcessMonitor {
+ /**
+ * The underlying <code>java.lang.Process</code> being monitored.
+ */
+ protected Process fOSProcess;
+ /**
+ * The <code>IProcess</code> which will be informed when this
+ * monitor detects that the underlying process has terminated.
+ */
+ protected RuntimeProcess fProcess;
+
+ /**
+ * The <code>Thread</code> which is monitoring the underlying process.
+ */
+ protected Thread fThread;
+ /**
+ * Creates a new process monitor and starts monitoring the process
+ * for termination.
+ */
+ public ProcessMonitor(RuntimeProcess process) {
+ fProcess= process;
+ fOSProcess= process.getSystemProcess();
+ startMonitoring();
+ }
+
+ /**
+ * Monitors the underlying process for termination. When the underlying
+ * process terminates (or if the monitoring thread is interrupted),
+ * inform the <code>IProcess</code> that it has terminated.
+ */
+ private void monitorProcess() {
+ while (fOSProcess != null) {
+ try {
+ fOSProcess.waitFor();
+ } catch (InterruptedException ie) {
+ } finally {
+ fOSProcess = null;
+ fProcess.terminated();
+ }
+ }
+ }
+
+ /**
+ * Starts monitoring the underlying process to determine
+ * if it has terminated.
+ */
+ private void startMonitoring() {
+ if (fThread == null) {
+ fThread= new Thread(new Runnable() {
+ public void run() {
+ monitorProcess();
+ }
+ }, DebugCoreMessages.getString("ProcessMonitor.label")); //$NON-NLS-1$
+ fThread.start();
+ }
+ }
+
+ /**
+ * Kills the monitoring thread.
+ *
+ * This method is to be useful for dealing with the error
+ * case of an underlying process which has not informed this
+ * monitor of its termination.
+ */
+ protected void killMonitoring() {
+ fThread.interrupt();
+ }
+}
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 05bb319b1..f7ceb1942 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
@@ -1,291 +1,291 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStreamsProxy;
-
-
-/**
- * A runtime process is a wrapper for a non-debuggable
- * system process. The process will appear in the debug UI with
- * console and termination support. The process creates a streams
- * proxy for itself, and a process monitor that monitors the
- * underlying system process for terminataion.
- */
-public class RuntimeProcess extends PlatformObject implements IProcess {
-
- private static final int MAX_WAIT_FOR_DEATH_ATTEMPTS = 10;
- private static final int TIME_TO_WAIT_FOR_THREAD_DEATH = 500; // ms
-
- /**
- * The launch this process is contained in
- */
- private ILaunch fLaunch;
-
- /**
- * The system process
- */
- private Process fProcess;
-
- /**
- * The exit value
- */
- private int fExitValue;
-
- /**
- * The monitor which listens for this runtime process' system process
- * to terminate.
- */
- private ProcessMonitor fMonitor;
-
- /**
- * The streams proxy for this process
- */
- private StreamsProxy fStreamsProxy;
-
- /**
- * The name of the process
- */
- private String fName;
-
- /**
- * Whether this process has been terminated
- */
- private boolean fTerminated;
-
- /**
- * Table of client defined attributes
- */
- private HashMap fAttributes;
-
- /**
- * Constructs a RuntimeProcess on the given system process
- * with the given name, adding this process to the given
- * launch.
- */
- public RuntimeProcess(ILaunch launch, Process process, String name) {
- setLaunch(launch);
- fProcess= process;
- fName= name;
- fTerminated= true;
- try {
- process.exitValue();
- } catch (IllegalThreadStateException e) {
- fTerminated= false;
- }
- fStreamsProxy = new StreamsProxy(this);
- fMonitor = new ProcessMonitor(this);
- launch.addProcess(this);
- fireCreationEvent();
- }
-
- /**
- * @see ITerminate#canTerminate()
- */
- public boolean canTerminate() {
- return !fTerminated;
- }
-
- /**
- * Returns the error stream of the underlying system process (connected
- * to the standard error of the process).
- */
- protected InputStream getErrorStream() {
- return fProcess.getErrorStream();
- }
-
- /**
- * Returns the input stream of the underlying system process (connected
- * to the standard out of the process).
- */
- protected InputStream getInputStream() {
- return fProcess.getInputStream();
- }
-
- /**
- * Returns the output stream of the underlying system process (connected
- * to the standard in of the process).
- */
- protected OutputStream getOutputStream() {
- return fProcess.getOutputStream();
- }
-
- /**
- * @see IProcess#getLabel()
- */
- public String getLabel() {
- return fName;
- }
-
- /**
- * Sets the launch this process is contained in
- *
- * @param launch the launch this process is contained in
- */
- private void setLaunch(ILaunch launch) {
- fLaunch = launch;
- }
-
- /**
- * @see IProcess#getLaunch()
- */
- public ILaunch getLaunch() {
- return fLaunch;
- }
-
- /**
- * Returns the underlying system process
- */
- protected Process getSystemProcess() {
- return fProcess;
- }
-
- /**
- * @see ITerminate#isTerminated()
- */
- public boolean isTerminated() {
- return fTerminated;
- }
-
- /**
- * @see ITerminate#terminate()
- */
- public void terminate() throws DebugException {
- if (!isTerminated()) {
- fProcess.destroy();
- fStreamsProxy.kill();
- int attempts = 0;
- while (attempts < MAX_WAIT_FOR_DEATH_ATTEMPTS) {
- try {
- if (fProcess != null) {
- fExitValue = fProcess.exitValue(); // throws exception if process not exited
- }
- return;
- } catch (IllegalThreadStateException ie) {
- }
- try {
- Thread.sleep(TIME_TO_WAIT_FOR_THREAD_DEATH);
- } catch (InterruptedException e) {
- }
- attempts++;
- }
- // clean-up
- fMonitor.killMonitoring();
- IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, DebugCoreMessages.getString("RuntimeProcess.terminate_failed"), null); //$NON-NLS-1$
- throw new DebugException(status);
- }
- }
-
- /**
- * Notification that the system process associated with this process
- * has terminated.
- */
- protected void terminated() {
- fStreamsProxy.close();
- fTerminated= true;
- try {
- fExitValue = fProcess.exitValue();
- } catch (IllegalThreadStateException ie) {
- }
- fProcess= null;
- fireTerminateEvent();
- }
-
- /**
- * @see IProcess#getStreamsProxy()
- */
- public IStreamsProxy getStreamsProxy() {
- return fStreamsProxy;
- }
-
- /**
- * Fire a debug event marking the creation of this element.
- */
- private void fireCreationEvent() {
- fireEvent(new DebugEvent(this, DebugEvent.CREATE));
- }
-
- /**
- * Fire a debug event
- */
- private void fireEvent(DebugEvent event) {
- DebugPlugin manager= DebugPlugin.getDefault();
- if (manager != null) {
- manager.fireDebugEventSet(new DebugEvent[]{event});
- }
- }
-
- /**
- * Fire a debug event marking the termination of this process.
- */
- private void fireTerminateEvent() {
- fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
- }
-
- /**
- * @see IProcess#setAttribute(String, String)
- */
- public void setAttribute(String key, String value) {
- if (fAttributes == null) {
- fAttributes = new HashMap(5);
- }
- fAttributes.put(key, value);
- }
-
- /**
- * @see IProcess#getAttribute(String)
- */
- public String getAttribute(String key) {
- if (fAttributes == null) {
- return null;
- }
- return (String)fAttributes.get(key);
- }
-
- /**
- * @see IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter.equals(IProcess.class)) {
- return this;
- }
- if (adapter.equals(IDebugTarget.class)) {
- ILaunch launch = getLaunch();
- 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);
- }
- /**
- * @see IProcess#getExitValue()
- */
- public int getExitValue() throws DebugException {
- if (isTerminated()) {
- return fExitValue;
- } else {
- throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, DebugCoreMessages.getString("RuntimeProcess.Exit_value_not_available_until_process_terminates._1"), null)); //$NON-NLS-1$
- }
- }
-
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStreamsProxy;
+
+
+/**
+ * A runtime process is a wrapper for a non-debuggable
+ * system process. The process will appear in the debug UI with
+ * console and termination support. The process creates a streams
+ * proxy for itself, and a process monitor that monitors the
+ * underlying system process for terminataion.
+ */
+public class RuntimeProcess extends PlatformObject implements IProcess {
+
+ private static final int MAX_WAIT_FOR_DEATH_ATTEMPTS = 10;
+ private static final int TIME_TO_WAIT_FOR_THREAD_DEATH = 500; // ms
+
+ /**
+ * The launch this process is contained in
+ */
+ private ILaunch fLaunch;
+
+ /**
+ * The system process
+ */
+ private Process fProcess;
+
+ /**
+ * The exit value
+ */
+ private int fExitValue;
+
+ /**
+ * The monitor which listens for this runtime process' system process
+ * to terminate.
+ */
+ private ProcessMonitor fMonitor;
+
+ /**
+ * The streams proxy for this process
+ */
+ private StreamsProxy fStreamsProxy;
+
+ /**
+ * The name of the process
+ */
+ private String fName;
+
+ /**
+ * Whether this process has been terminated
+ */
+ private boolean fTerminated;
+
+ /**
+ * Table of client defined attributes
+ */
+ private HashMap fAttributes;
+
+ /**
+ * Constructs a RuntimeProcess on the given system process
+ * with the given name, adding this process to the given
+ * launch.
+ */
+ public RuntimeProcess(ILaunch launch, Process process, String name) {
+ setLaunch(launch);
+ fProcess= process;
+ fName= name;
+ fTerminated= true;
+ try {
+ process.exitValue();
+ } catch (IllegalThreadStateException e) {
+ fTerminated= false;
+ }
+ fStreamsProxy = new StreamsProxy(this);
+ fMonitor = new ProcessMonitor(this);
+ launch.addProcess(this);
+ fireCreationEvent();
+ }
+
+ /**
+ * @see ITerminate#canTerminate()
+ */
+ public boolean canTerminate() {
+ return !fTerminated;
+ }
+
+ /**
+ * Returns the error stream of the underlying system process (connected
+ * to the standard error of the process).
+ */
+ protected InputStream getErrorStream() {
+ return fProcess.getErrorStream();
+ }
+
+ /**
+ * Returns the input stream of the underlying system process (connected
+ * to the standard out of the process).
+ */
+ protected InputStream getInputStream() {
+ return fProcess.getInputStream();
+ }
+
+ /**
+ * Returns the output stream of the underlying system process (connected
+ * to the standard in of the process).
+ */
+ protected OutputStream getOutputStream() {
+ return fProcess.getOutputStream();
+ }
+
+ /**
+ * @see IProcess#getLabel()
+ */
+ public String getLabel() {
+ return fName;
+ }
+
+ /**
+ * Sets the launch this process is contained in
+ *
+ * @param launch the launch this process is contained in
+ */
+ private void setLaunch(ILaunch launch) {
+ fLaunch = launch;
+ }
+
+ /**
+ * @see IProcess#getLaunch()
+ */
+ public ILaunch getLaunch() {
+ return fLaunch;
+ }
+
+ /**
+ * Returns the underlying system process
+ */
+ protected Process getSystemProcess() {
+ return fProcess;
+ }
+
+ /**
+ * @see ITerminate#isTerminated()
+ */
+ public boolean isTerminated() {
+ return fTerminated;
+ }
+
+ /**
+ * @see ITerminate#terminate()
+ */
+ public void terminate() throws DebugException {
+ if (!isTerminated()) {
+ fProcess.destroy();
+ fStreamsProxy.kill();
+ int attempts = 0;
+ while (attempts < MAX_WAIT_FOR_DEATH_ATTEMPTS) {
+ try {
+ if (fProcess != null) {
+ fExitValue = fProcess.exitValue(); // throws exception if process not exited
+ }
+ return;
+ } catch (IllegalThreadStateException ie) {
+ }
+ try {
+ Thread.sleep(TIME_TO_WAIT_FOR_THREAD_DEATH);
+ } catch (InterruptedException e) {
+ }
+ attempts++;
+ }
+ // clean-up
+ fMonitor.killMonitoring();
+ IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, DebugCoreMessages.getString("RuntimeProcess.terminate_failed"), null); //$NON-NLS-1$
+ throw new DebugException(status);
+ }
+ }
+
+ /**
+ * Notification that the system process associated with this process
+ * has terminated.
+ */
+ protected void terminated() {
+ fStreamsProxy.close();
+ fTerminated= true;
+ try {
+ fExitValue = fProcess.exitValue();
+ } catch (IllegalThreadStateException ie) {
+ }
+ fProcess= null;
+ fireTerminateEvent();
+ }
+
+ /**
+ * @see IProcess#getStreamsProxy()
+ */
+ public IStreamsProxy getStreamsProxy() {
+ return fStreamsProxy;
+ }
+
+ /**
+ * Fire a debug event marking the creation of this element.
+ */
+ private void fireCreationEvent() {
+ fireEvent(new DebugEvent(this, DebugEvent.CREATE));
+ }
+
+ /**
+ * Fire a debug event
+ */
+ private void fireEvent(DebugEvent event) {
+ DebugPlugin manager= DebugPlugin.getDefault();
+ if (manager != null) {
+ manager.fireDebugEventSet(new DebugEvent[]{event});
+ }
+ }
+
+ /**
+ * Fire a debug event marking the termination of this process.
+ */
+ private void fireTerminateEvent() {
+ fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
+ }
+
+ /**
+ * @see IProcess#setAttribute(String, String)
+ */
+ public void setAttribute(String key, String value) {
+ if (fAttributes == null) {
+ fAttributes = new HashMap(5);
+ }
+ fAttributes.put(key, value);
+ }
+
+ /**
+ * @see IProcess#getAttribute(String)
+ */
+ public String getAttribute(String key) {
+ if (fAttributes == null) {
+ return null;
+ }
+ return (String)fAttributes.get(key);
+ }
+
+ /**
+ * @see IAdaptable#getAdapter(Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter.equals(IProcess.class)) {
+ return this;
+ }
+ if (adapter.equals(IDebugTarget.class)) {
+ ILaunch launch = getLaunch();
+ 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);
+ }
+ /**
+ * @see IProcess#getExitValue()
+ */
+ public int getExitValue() throws DebugException {
+ if (isTerminated()) {
+ return fExitValue;
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, DebugCoreMessages.getString("RuntimeProcess.Exit_value_not_available_until_process_terminates._1"), null)); //$NON-NLS-1$
+ }
+ }
+
} \ No newline at end of file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
index c9720d547..70ebc00eb 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java
@@ -1,99 +1,99 @@
-package org.eclipse.debug.internal.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.debug.core.model.IStreamMonitor;
-import org.eclipse.debug.core.model.IStreamsProxy;
-import java.io.IOException;
-
-public class StreamsProxy implements IStreamsProxy {
- /**
- * The monitor for the output stream (connected to standard out of the process)
- */
- private OutputStreamMonitor fOutputMonitor;
- /**
- * The monitor for the error stream (connected to standard error of the process)
- */
- private OutputStreamMonitor fErrorMonitor;
- /**
- * The monitor for the input stream (connected to standard in of the process)
- */
- private InputStreamMonitor fInputMonitor;
- /**
- * Records the open/closed state of communications with
- * the underlying streams.
- */
- private boolean fClosed= false;
- /**
- * Creates a <code>StreamsProxy</code> on the streams
- * of the given <code>IProcess</code>.
- */
- public StreamsProxy(RuntimeProcess process) {
- if (process == null) {
- return;
- }
- fOutputMonitor= new OutputStreamMonitor(process.getInputStream());
- fErrorMonitor= new OutputStreamMonitor(process.getErrorStream());
- fInputMonitor= new InputStreamMonitor(process.getOutputStream());
- fOutputMonitor.startMonitoring();
- fErrorMonitor.startMonitoring();
- fInputMonitor.startMonitoring();
- }
-
- /**
- * Causes the proxy to close all
- * communications between it and the
- * underlying streams after all remaining data
- * in the streams is read.
- */
- protected void close() {
- if (!fClosed) {
- fClosed= true;
- fOutputMonitor.close();
- fErrorMonitor.close();
- fInputMonitor.close();
- }
- }
-
- /**
- * Causes the proxy to close all
- * communications between it and the
- * underlying streams immediately.
- * Data remaining in the streams is lost.
- */
- protected void kill() {
- fClosed= true;
- fOutputMonitor.kill();
- fErrorMonitor.kill();
- fInputMonitor.close();
- }
-
- /**
- * @see IStreamsProxy#getErrorStreamMonitor()
- */
- public IStreamMonitor getErrorStreamMonitor() {
- return fErrorMonitor;
- }
-
- /**
- * @see IStreamsProxy#getOutputStreamMonitor()
- */
- public IStreamMonitor getOutputStreamMonitor() {
- return fOutputMonitor;
- }
-
- /**
- * @see IStreamsProxy#write(String)
- */
- public void write(String input) throws IOException {
- if (!fClosed) {
- fInputMonitor.write(input);
- } else {
- throw new IOException();
- }
- }
-
-}
+package org.eclipse.debug.internal.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.debug.core.model.IStreamMonitor;
+import org.eclipse.debug.core.model.IStreamsProxy;
+import java.io.IOException;
+
+public class StreamsProxy implements IStreamsProxy {
+ /**
+ * The monitor for the output stream (connected to standard out of the process)
+ */
+ private OutputStreamMonitor fOutputMonitor;
+ /**
+ * The monitor for the error stream (connected to standard error of the process)
+ */
+ private OutputStreamMonitor fErrorMonitor;
+ /**
+ * The monitor for the input stream (connected to standard in of the process)
+ */
+ private InputStreamMonitor fInputMonitor;
+ /**
+ * Records the open/closed state of communications with
+ * the underlying streams.
+ */
+ private boolean fClosed= false;
+ /**
+ * Creates a <code>StreamsProxy</code> on the streams
+ * of the given <code>IProcess</code>.
+ */
+ public StreamsProxy(RuntimeProcess process) {
+ if (process == null) {
+ return;
+ }
+ fOutputMonitor= new OutputStreamMonitor(process.getInputStream());
+ fErrorMonitor= new OutputStreamMonitor(process.getErrorStream());
+ fInputMonitor= new InputStreamMonitor(process.getOutputStream());
+ fOutputMonitor.startMonitoring();
+ fErrorMonitor.startMonitoring();
+ fInputMonitor.startMonitoring();
+ }
+
+ /**
+ * Causes the proxy to close all
+ * communications between it and the
+ * underlying streams after all remaining data
+ * in the streams is read.
+ */
+ protected void close() {
+ if (!fClosed) {
+ fClosed= true;
+ fOutputMonitor.close();
+ fErrorMonitor.close();
+ fInputMonitor.close();
+ }
+ }
+
+ /**
+ * Causes the proxy to close all
+ * communications between it and the
+ * underlying streams immediately.
+ * Data remaining in the streams is lost.
+ */
+ protected void kill() {
+ fClosed= true;
+ fOutputMonitor.kill();
+ fErrorMonitor.kill();
+ fInputMonitor.close();
+ }
+
+ /**
+ * @see IStreamsProxy#getErrorStreamMonitor()
+ */
+ public IStreamMonitor getErrorStreamMonitor() {
+ return fErrorMonitor;
+ }
+
+ /**
+ * @see IStreamsProxy#getOutputStreamMonitor()
+ */
+ public IStreamMonitor getOutputStreamMonitor() {
+ return fOutputMonitor;
+ }
+
+ /**
+ * @see IStreamsProxy#write(String)
+ */
+ public void write(String input) throws IOException {
+ if (!fClosed) {
+ fInputMonitor.write(input);
+ } else {
+ throw new IOException();
+ }
+ }
+
+}

Back to the top