Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debug/org.eclipse.cdt.debug.core/ChangeLog19
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java732
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java10
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties1
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger.java21
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDTLaunchConfigurationConstants.java157
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java7
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java4
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IExecFileInfo.java4
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java33
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java110
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java19
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties2
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CCoreFileDebugTarget.java36
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java96
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java11
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java2
-rw-r--r--launch/org.eclipse.cdt.launch/ChangeLog7
-rw-r--r--launch/org.eclipse.cdt.launch/plugin.properties5
-rw-r--r--launch/org.eclipse.cdt.launch/plugin.xml41
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java173
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java44
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java121
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalAttachLaunchDelegate.java197
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java291
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalRunLaunchDelegate.java198
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java133
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFileLaunchConfigurationTabGroup.java (renamed from launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFileCLaunchConfigurationTabGroup.java)2
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java39
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties (renamed from launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPluginResources.properties)42
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java102
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalAttachLaunchConfigurationTabGroup.java35
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalRunLaunchConfigurationTabGroup.java (renamed from launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalCLaunchConfigurationTabGroup.java)4
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java27
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java8
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java212
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CEnvironmentTab.java25
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java55
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CSourceLookupTab.java4
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CoreFileDebuggerTab.java178
40 files changed, 1888 insertions, 1319 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog
index 694bdb17e07..fe464831a05 100644
--- a/debug/org.eclipse.cdt.debug.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.core/ChangeLog
@@ -1,3 +1,20 @@
+2004-10-18 David Inglis
+ Update to new ICDIDebugger interface deprecating old
+
+ * src/org/eclipse/debug/core/CDebugModel.java
+ * src/org/eclipse/debug/core/CDIDebugModel.java
+ * src/org/eclipse/debug/core/ICDebugConfiguration.java
+ * src/org/eclipse/debug/core/ICDebugger.java
+ * src/org/eclipse/debug/core/ICDIDebugger.java
+ * src/org/eclipse/debug/core/ICDILaunchCOnfiguration.java
+ * src/org/eclipse/debug/core/model/IExecFileInfo.java
+ * src/org/eclipse/debug/internal/core/CBreakpointManager.java
+ * src/org/eclipse/debug/internal/core/CDebugAdapter.java
+ * src/org/eclipse/debug/internal/core/DebugConfiguration.java
+ * src/org/eclipse/debug/internal/core/model/CDebugTarget.java
+ * src/org/eclipse/debug/internal/core/model/CVariableFactory.java
+ * src/org/eclipse/debug/internal/core/model/DisassemblyBlock.java
+
2004-10-18 Mikhail Khodjaiants
Use characters instead of strings.
* CDIException.java
@@ -18,7 +35,7 @@
* CBreakpointManager.java
* CDebugTarget.java
-2004-10-14
+2004-10-14 Mikhail Khodjaiants
Partial fix for bug 39936 GDB hits modified conditional breakpoints when condition not satisfied.
Condition has to be set at the mi level.
* CBreakpointManager.java
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
index 8cdf10091d9..eb8cc04278e 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java
@@ -7,21 +7,23 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
-***********************************************************************/
+ ***********************************************************************/
package org.eclipse.cdt.debug.core;
+import java.io.IOException;
import java.text.MessageFormat;
import java.util.HashMap;
+import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.core.IBinaryParser;
+import org.eclipse.cdt.core.ICExtensionReference;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
-import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
-import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
-import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
-import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
@@ -37,12 +39,12 @@ import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
-import org.eclipse.cdt.debug.internal.core.model.CCoreFileDebugTarget;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.cdt.debug.internal.core.model.CExpression;
import org.eclipse.cdt.debug.internal.core.model.CVariableFactory;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -61,333 +63,302 @@ import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IProcess;
/**
- * Provides utility methods for creating debug sessions, targets and
- * breakpoints specific to the CDI debug model.
+ * Provides utility methods for creating debug sessions, targets and breakpoints
+ * specific to the CDI debug model.
*/
public class CDIDebugModel {
+
/**
* Returns the identifier for the CDI debug model plug-in
- *
+ *
* @return plugin identifier
*/
public static String getPluginIdentifier() {
return CDebugCorePlugin.getUniqueIdentifier();
- }
+ }
/**
- * Creates and returns a debug target for the given CDI target,
- * with the specified name, and associates it with the given process for console
- * I/O. The allow terminate flag specifies whether the debug target will support
- * termination (<code>ITerminate</code>). The allow disconnect flag
- * specifies whether the debug target will support disconnection
- * (<code>IDisconnect</code>). The resume flag specifies if the target
- * process should be resumed on startup.
+ * Creates and returns a debug target for the given CDI target, with the
+ * specified name, and associates it with the given process for console I/O.
* The debug target is added to the given launch.
*
- * @param launch the launch the new debug target will be contained in
- * @param cdiTarget the CDI target to create a debug target for
- * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
- * @param debuggeeProcess the process to associate with the debug target, which will be returned from <code>IDebugTarget.getProcess</code>
- * @param debuggerProcess the process to associate with the debugger.
- * @param file the executable to debug.
- * @param allowTerminate whether the target will support termianation
- * @param allowDisconnect whether the target will support disconnection
- * @param stopInMain whether to set a temporary breakpoint in main.
+ * @param launch
+ * the launch the new debug target will be contained in
+ * @param project
+ * the project to use to persist breakpoints.
+ * @param cdiTarget
+ * the CDI target to create a debug target for
+ * @param name
+ * the name to associate with this target, which will be returned
+ * from <code>IDebugTarget.getName</code>.
+ * @param debuggeeProcess
+ * the process to associate with the debug target, which will be
+ * returned from <code>IDebugTarget.getProcess</code>
+ * @param file
+ * the executable to debug.
* @return a debug target
* @throws DebugException
+ *
*/
- public static IDebugTarget newDebugTarget( final ILaunch launch, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IProcess debuggerProcess, final IFile file, final boolean allowTerminate, final boolean allowDisconnect, final boolean stopInMain ) throws DebugException {
+ public static IDebugTarget newDebugTarget(final ILaunch launch, final IProject project, final ICDITarget cdiTarget,
+ final String name, final IProcess debuggeeProcess, final IBinaryExecutable file, final boolean allowTerminate,
+ final boolean allowDisconnect, final boolean stopInMain) throws DebugException {
final IDebugTarget[] target = new IDebugTarget[1];
IWorkspaceRunnable r = new IWorkspaceRunnable() {
- public void run( IProgressMonitor m ) throws CoreException {
- target[0] = new CDebugTarget( launch, cdiTarget, name, debuggeeProcess, debuggerProcess, file, allowTerminate, allowDisconnect );
+ public void run(IProgressMonitor m) throws CoreException {
+ boolean stopInMain = launch.getLaunchConfiguration().getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
+ false);
+ target[0] = new CDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate,
+ allowDisconnect);
ICDIConfiguration config = cdiTarget.getSession().getConfiguration();
- if ( config.supportsBreakpoints() && stopInMain ) {
- stopInMain( (CDebugTarget)target[0] );
+ if (config.supportsBreakpoints() && stopInMain) {
+ stopInMain((CDebugTarget)target[0]);
}
- if ( config.supportsResume() ) {
+ if (config.supportsResume()) {
target[0].resume();
}
}
};
try {
- ResourcesPlugin.getWorkspace().run( r, null );
- }
- catch( CoreException e ) {
- CDebugCorePlugin.log( e );
- throw new DebugException( e.getStatus() );
+ ResourcesPlugin.getWorkspace().run(r, null);
+ } catch (CoreException e) {
+ CDebugCorePlugin.log(e);
+ throw new DebugException(e.getStatus());
}
return target[0];
}
- /**
- * Creates and returns an attached debug target for the given CDI target,
- * with the specified name.
- *
- * @param launch the launch the new debug target will be contained in
- * @param cdiTarget the CDI target to create a debug target for
- * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
- * @param debuggerProcess the process to associate with the debugger.
- * @param file the executable to debug.
- * @return a debug target
- * @throws DebugException
- */
- public static IDebugTarget newAttachDebugTarget( final ILaunch launch, final ICDITarget cdiTarget, final String name, final IProcess debuggerProcess, final IFile file ) throws DebugException {
- final IDebugTarget[] target = new IDebugTarget[1];
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
-
- public void run( IProgressMonitor m ) throws CoreException {
- target[0] = new CDebugTarget( launch, cdiTarget, name, null, debuggerProcess, file, false, true );
- ICDIEvent[] events = new ICDIEvent[]{ new ICDISuspendedEvent() {
-
- public ICDISessionObject getReason() {
- return null;
- }
-
- public ICDIObject getSource() {
- return cdiTarget;
- }
- } };
- ((CDebugTarget)target[0]).handleDebugEvents( events );
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run( r, null );
- }
- catch( CoreException e ) {
- CDebugCorePlugin.log( e );
- throw new DebugException( e.getStatus() );
- }
- return target[0];
+ public static IDebugTarget newDebugTarget(ILaunch launch, IProject project, ICDITarget cdiTarget, final String name,
+ IProcess debuggeeProcess, IBinaryExecutable file, boolean allowTerminate, boolean allowDisconnect)
+ throws DebugException {
+ return newDebugTarget(launch, project, cdiTarget, name, debuggeeProcess, file, allowTerminate, allowDisconnect, false);
}
/**
- * Creates and returns a post-mortem debug target for the given CDI target,
- * with the specified name.
+ * Creates and returns a line breakpoint for the source defined by the given
+ * source handle, at the given line number. The marker associated with the
+ * breakpoint will be created on the specified resource.
*
- * @param launch the launch the new debug target will be contained in
- * @param cdiTarget the CDI target to create a debug target for
- * @param name the name to associate with this target, which will be returned from <code>IDebugTarget.getName</code>.
- * @param debuggerProcess the process to associate with the debugger.
- * @param file the executable to debug.
- * @return a debug target
- * @throws DebugException
- */
- public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch, final ICDITarget cdiTarget, final String name, final IProcess debuggerProcess, final IFile file ) throws DebugException {
- final IDebugTarget[] target = new IDebugTarget[1];
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
-
- public void run( IProgressMonitor m ) throws CoreException {
- target[0] = new CCoreFileDebugTarget( launch, cdiTarget, name, debuggerProcess, file );
- ICDIEvent[] events = new ICDIEvent[]{ new ICDISuspendedEvent() {
-
- public ICDISessionObject getReason() {
- return null;
- }
-
- public ICDIObject getSource() {
- return cdiTarget;
- }
- } };
- ((CDebugTarget)target[0]).handleDebugEvents( events );
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run( r, null );
- }
- catch( CoreException e ) {
- CDebugCorePlugin.log( e );
- throw new DebugException( e.getStatus() );
- }
- return target[0];
- }
-
- /**
- * Creates and returns a line breakpoint for the source defined by
- * the given source handle, at the given line number. The marker associated
- * with the breakpoint will be created on the specified resource.
- *
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param lineNumber the line number on which the breakpoint is set - line
- * numbers are 1 based, associated with the source file in which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param lineNumber
+ * the line number on which the breakpoint is set - line numbers
+ * are 1 based, associated with the source file in which the
+ * breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
* @return a line breakpoint
- * @throws CoreException if this method fails. Reasons include:<ul>
- * <li>Failure creating underlying marker. The exception's status contains
- * the underlying exception responsible for the failure.</li></ul>
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
*/
- public static ICLineBreakpoint createLineBreakpoint( String sourceHandle,
- IResource resource,
- int lineNumber,
- boolean enabled,
- int ignoreCount,
- String condition,
- boolean register ) throws CoreException {
- HashMap attributes = new HashMap( 10 );
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
- attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
- attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
- attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
- attributes.put( ICBreakpoint.CONDITION, condition );
- attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
- return new CLineBreakpoint( resource, attributes, register );
+ public static ICLineBreakpoint createLineBreakpoint(String sourceHandle, IResource resource, int lineNumber, boolean enabled,
+ int ignoreCount, String condition, boolean register) throws CoreException {
+ HashMap attributes = new HashMap(10);
+ attributes.put(IBreakpoint.ID, getPluginIdentifier());
+ attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
+ attributes.put(IBreakpoint.ENABLED, new Boolean(enabled));
+ attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount));
+ attributes.put(ICBreakpoint.CONDITION, condition);
+ attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle);
+ return new CLineBreakpoint(resource, attributes, register);
}
/**
- * Creates and returns an address breakpoint for the source defined by
- * the given source handle, at the given address. The marker associated
- * with the breakpoint will be created on the specified resource.
- *
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param address the address on which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
+ * Creates and returns an address breakpoint for the source defined by the
+ * given source handle, at the given address. The marker associated with the
+ * breakpoint will be created on the specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param address
+ * the address on which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
* @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:<ul>
- * <li>Failure creating underlying marker. The exception's status contains
- * the underlying exception responsible for the failure.</li></ul>
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
*/
- public static ICAddressBreakpoint createAddressBreakpoint( String sourceHandle,
- IResource resource,
- IAddress address,
- boolean enabled,
- int ignoreCount,
- String condition,
- boolean register ) throws CoreException {
- HashMap attributes = new HashMap( 10 );
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
- attributes.put( IMarker.CHAR_START, new Integer( 0 ) );
- attributes.put( IMarker.CHAR_END, new Integer( 0 ) );
- attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
- attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
- attributes.put( ICLineBreakpoint.ADDRESS, address.toHexAddressString() );
- attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
- attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
- attributes.put( ICBreakpoint.CONDITION, condition );
- attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
- return new CAddressBreakpoint( resource, attributes, register );
+ public static ICAddressBreakpoint createAddressBreakpoint(String sourceHandle, IResource resource, IAddress address,
+ boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ HashMap attributes = new HashMap(10);
+ attributes.put(IBreakpoint.ID, getPluginIdentifier());
+ attributes.put(IMarker.CHAR_START, new Integer(0));
+ attributes.put(IMarker.CHAR_END, new Integer(0));
+ attributes.put(IMarker.LINE_NUMBER, new Integer(-1));
+ attributes.put(IMarker.LINE_NUMBER, new Integer(-1));
+ attributes.put(ICLineBreakpoint.ADDRESS, address.toHexAddressString());
+ attributes.put(IBreakpoint.ENABLED, new Boolean(enabled));
+ attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount));
+ attributes.put(ICBreakpoint.CONDITION, condition);
+ attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle);
+ return new CAddressBreakpoint(resource, attributes, register);
}
/**
- * Creates and returns a watchpoint for the source defined by
- * the given source handle, at the given expression. The marker associated
- * with the watchpoint will be created on the specified resource.
+ * Creates and returns a watchpoint for the source defined by the given
+ * source handle, at the given expression. The marker associated with the
+ * watchpoint will be created on the specified resource.
*
- * @param sourceHandle the handle to the watchpoint source
- * @param resource the resource on which to create the associated watchpoint marker
- * @param writeAccess whether this is write watchpoint
- * @param readAccess whether this is read watchpoint
- * @param expression the expression on which the watchpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
+ * @param sourceHandle
+ * the handle to the watchpoint source
+ * @param resource
+ * the resource on which to create the associated watchpoint
+ * marker
+ * @param writeAccess
+ * whether this is write watchpoint
+ * @param readAccess
+ * whether this is read watchpoint
+ * @param expression
+ * the expression on which the watchpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
* @return a watchpoint
- * @throws CoreException if this method fails. Reasons include:<ul>
- * <li>Failure creating underlying marker. The exception's status contains
- * the underlying exception responsible for the failure.</li></ul>
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
*/
- public static ICWatchpoint createWatchpoint( String sourceHandle,
- IResource resource,
- boolean writeAccess,
- boolean readAccess,
- String expression,
- boolean enabled,
- int ignoreCount,
- String condition,
- boolean register ) throws CoreException {
- HashMap attributes = new HashMap( 10 );
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
- attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
- attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
- attributes.put( ICBreakpoint.CONDITION, condition );
- attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
- attributes.put( ICWatchpoint.EXPRESSION, expression );
- attributes.put( ICWatchpoint.READ, new Boolean( readAccess ) );
- attributes.put( ICWatchpoint.WRITE, new Boolean( writeAccess ) );
- return new CWatchpoint( resource, attributes, register );
+ public static ICWatchpoint createWatchpoint(String sourceHandle, IResource resource, boolean writeAccess, boolean readAccess,
+ String expression, boolean enabled, int ignoreCount, String condition, boolean register) throws CoreException {
+ HashMap attributes = new HashMap(10);
+ attributes.put(IBreakpoint.ID, getPluginIdentifier());
+ attributes.put(IBreakpoint.ENABLED, new Boolean(enabled));
+ attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount));
+ attributes.put(ICBreakpoint.CONDITION, condition);
+ attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle);
+ attributes.put(ICWatchpoint.EXPRESSION, expression);
+ attributes.put(ICWatchpoint.READ, new Boolean(readAccess));
+ attributes.put(ICWatchpoint.WRITE, new Boolean(writeAccess));
+ return new CWatchpoint(resource, attributes, register);
}
/**
- * Creates and returns a breakpoint for the function defined by
- * the given name. The marker associated with the breakpoint will
- * be created on the specified resource.
- *
- * @param sourceHandle the handle to the breakpoint source
- * @param resource the resource on which to create the associated breakpoint marker
- * @param function the name of the function this breakpoint suspends execution in
- * @param charStart the first character index associated with the breakpoint,
- * or -1 if unspecified, in the source file in which the breakpoint is set
- * @param charEnd the last character index associated with the breakpoint,
- * or -1 if unspecified, in the source file in which the breakpoint is set
- * @param lineNumber the lineNumber on which the breakpoint is set, or -1 if
- * unspecified - line numbers are 1 based, associated with the source file
- * in which the breakpoint is set
- * @param enabled whether to enable or disable this breakpoint
- * @param ignoreCount the number of times this breakpoint will be ignored
- * @param condition the breakpoint condition
- * @param register whether to add this breakpoint to the breakpoint manager
+ * Creates and returns a breakpoint for the function defined by the given
+ * name. The marker associated with the breakpoint will be created on the
+ * specified resource.
+ *
+ * @param sourceHandle
+ * the handle to the breakpoint source
+ * @param resource
+ * the resource on which to create the associated breakpoint
+ * marker
+ * @param function
+ * the name of the function this breakpoint suspends execution in
+ * @param charStart
+ * the first character index associated with the breakpoint, or
+ * -1 if unspecified, in the source file in which the breakpoint
+ * is set
+ * @param charEnd
+ * the last character index associated with the breakpoint, or -1
+ * if unspecified, in the source file in which the breakpoint is
+ * set
+ * @param lineNumber
+ * the lineNumber on which the breakpoint is set, or -1 if
+ * unspecified - line numbers are 1 based, associated with the
+ * source file in which the breakpoint is set
+ * @param enabled
+ * whether to enable or disable this breakpoint
+ * @param ignoreCount
+ * the number of times this breakpoint will be ignored
+ * @param condition
+ * the breakpoint condition
+ * @param register
+ * whether to add this breakpoint to the breakpoint manager
* @return an address breakpoint
- * @throws CoreException if this method fails. Reasons include:<ul>
- * <li>Failure creating underlying marker. The exception's status contains
- * the underlying exception responsible for the failure.</li></ul>
+ * @throws CoreException
+ * if this method fails. Reasons include:
+ * <ul>
+ * <li>Failure creating underlying marker. The exception's
+ * status contains the underlying exception responsible for the
+ * failure.</li>
+ * </ul>
*/
- public static ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle,
- IResource resource,
- String function,
- int charStart,
- int charEnd,
- int lineNumber,
- boolean enabled,
- int ignoreCount,
- String condition,
- boolean register ) throws CoreException {
- HashMap attributes = new HashMap( 10 );
- attributes.put( IBreakpoint.ID, getPluginIdentifier() );
- attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
- attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
- attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
- attributes.put( ICLineBreakpoint.FUNCTION, function );
- attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
- attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
- attributes.put( ICBreakpoint.CONDITION, condition );
- attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
- return new CFunctionBreakpoint( resource, attributes, register );
+ public static ICFunctionBreakpoint createFunctionBreakpoint(String sourceHandle, IResource resource, String function,
+ int charStart, int charEnd, int lineNumber, boolean enabled, int ignoreCount, String condition, boolean register)
+ throws CoreException {
+ HashMap attributes = new HashMap(10);
+ attributes.put(IBreakpoint.ID, getPluginIdentifier());
+ attributes.put(IMarker.CHAR_START, new Integer(charStart));
+ attributes.put(IMarker.CHAR_END, new Integer(charEnd));
+ attributes.put(IMarker.LINE_NUMBER, new Integer(lineNumber));
+ attributes.put(ICLineBreakpoint.FUNCTION, function);
+ attributes.put(IBreakpoint.ENABLED, new Boolean(enabled));
+ attributes.put(ICBreakpoint.IGNORE_COUNT, new Integer(ignoreCount));
+ attributes.put(ICBreakpoint.CONDITION, condition);
+ attributes.put(ICBreakpoint.SOURCE_HANDLE, sourceHandle);
+ return new CFunctionBreakpoint(resource, attributes, register);
}
/**
- * Returns the line breakpoint that is already registered with the breakpoint
- * manager for a source with the given handle and the given resource at the
- * given line number.
+ * Returns the line breakpoint that is already registered with the
+ * breakpoint manager for a source with the given handle and the given
+ * resource at the given line number.
*
- * @param sourceHandle the source handle
- * @param resource the breakpoint resource
- * @param lineNumber the line number
- * @return the line breakpoint that is already registered with the breakpoint
- * manager or <code>null</code> if no such breakpoint is registered
- * @exception CoreException if unable to retrieve the associated marker
- * attributes (line number).
+ * @param sourceHandle
+ * the source handle
+ * @param resource
+ * the breakpoint resource
+ * @param lineNumber
+ * the line number
+ * @return the line breakpoint that is already registered with the
+ * breakpoint manager or <code>null</code> if no such breakpoint
+ * is registered
+ * @exception CoreException
+ * if unable to retrieve the associated marker attributes
+ * (line number).
*/
- public static ICLineBreakpoint lineBreakpointExists( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
+ public static ICLineBreakpoint lineBreakpointExists(String sourceHandle, IResource resource, int lineNumber)
+ throws CoreException {
String modelId = getPluginIdentifier();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
- for( int i = 0; i < breakpoints.length; i++ ) {
- if ( !(breakpoints[i] instanceof ICLineBreakpoint) ) {
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (! (breakpoints[i] instanceof ICLineBreakpoint)) {
continue;
}
ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i];
- if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
- if ( breakpoint.getMarker().getResource().equals( resource ) ) {
- if ( breakpoint.getLineNumber() == lineNumber ) {
+ if (sourceHandle != null && sourceHandle.equals(breakpoint.getSourceHandle())) {
+ if (breakpoint.getMarker().getResource().equals(resource)) {
+ if (breakpoint.getLineNumber() == lineNumber) {
return breakpoint;
}
}
@@ -398,31 +369,36 @@ public class CDIDebugModel {
/**
* Returns the watchpoint that is already registered with the breakpoint
- * manager for a source with the given handle and the given resource at the
+ * manager for a source with the given handle and the given resource at the
* given expression.
- *
- * @param sourceHandle the source handle
- * @param resource the breakpoint resource
- * @param expression the expression
+ *
+ * @param sourceHandle
+ * the source handle
+ * @param resource
+ * the breakpoint resource
+ * @param expression
+ * the expression
* @return the watchpoint that is already registered with the breakpoint
- * manager or <code>null</code> if no such watchpoint is registered
- * @exception CoreException if unable to retrieve the associated marker
- * attributes (line number).
+ * manager or <code>null</code> if no such watchpoint is
+ * registered
+ * @exception CoreException
+ * if unable to retrieve the associated marker attributes
+ * (line number).
*/
- public static ICWatchpoint watchpointExists( String sourceHandle, IResource resource, String expression ) throws CoreException {
+ public static ICWatchpoint watchpointExists(String sourceHandle, IResource resource, String expression) throws CoreException {
String modelId = getPluginIdentifier();
String markerType = CWatchpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
- for( int i = 0; i < breakpoints.length; i++ ) {
- if ( !(breakpoints[i] instanceof ICWatchpoint) ) {
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (! (breakpoints[i] instanceof ICWatchpoint)) {
continue;
}
ICWatchpoint breakpoint = (ICWatchpoint)breakpoints[i];
- if ( breakpoint.getMarker().getType().equals( markerType ) ) {
- if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
- if ( breakpoint.getMarker().getResource().equals( resource ) ) {
- if ( breakpoint.getExpression().equals( expression ) ) {
+ if (breakpoint.getMarker().getType().equals(markerType)) {
+ if (sourceHandle != null && sourceHandle.equals(breakpoint.getSourceHandle())) {
+ if (breakpoint.getMarker().getResource().equals(resource)) {
+ if (breakpoint.getExpression().equals(expression)) {
return breakpoint;
}
}
@@ -433,32 +409,38 @@ public class CDIDebugModel {
}
/**
- * Returns the function breakpoint that is already registered with the breakpoint
- * manager for a source with the given handle and the given resource with the
- * given function name.
- *
- * @param sourceHandle the source handle
- * @param resource the breakpoint resource
- * @param function the fully qualified function name
+ * Returns the function breakpoint that is already registered with the
+ * breakpoint manager for a source with the given handle and the given
+ * resource with the given function name.
+ *
+ * @param sourceHandle
+ * the source handle
+ * @param resource
+ * the breakpoint resource
+ * @param function
+ * the fully qualified function name
* @return the breakpoint that is already registered with the breakpoint
- * manager or <code>null</code> if no such breakpoint is registered
- * @exception CoreException if unable to retrieve the associated marker
- * attributes (line number).
+ * manager or <code>null</code> if no such breakpoint is
+ * registered
+ * @exception CoreException
+ * if unable to retrieve the associated marker attributes
+ * (line number).
*/
- public static ICFunctionBreakpoint functionBreakpointExists( String sourceHandle, IResource resource, String function ) throws CoreException {
+ public static ICFunctionBreakpoint functionBreakpointExists(String sourceHandle, IResource resource, String function)
+ throws CoreException {
String modelId = getPluginIdentifier();
String markerType = CFunctionBreakpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
- for( int i = 0; i < breakpoints.length; i++ ) {
- if ( !(breakpoints[i] instanceof ICFunctionBreakpoint) ) {
+ IBreakpoint[] breakpoints = manager.getBreakpoints(modelId);
+ for (int i = 0; i < breakpoints.length; i++) {
+ if (! (breakpoints[i] instanceof ICFunctionBreakpoint)) {
continue;
}
ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i];
- if ( breakpoint.getMarker().getType().equals( markerType ) ) {
- if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
- if ( breakpoint.getMarker().getResource().equals( resource ) ) {
- if ( breakpoint.getFunction() != null && breakpoint.getFunction().equals( function ) ) {
+ if (breakpoint.getMarker().getType().equals(markerType)) {
+ if (sourceHandle != null && sourceHandle.equals(breakpoint.getSourceHandle())) {
+ if (breakpoint.getMarker().getResource().equals(resource)) {
+ if (breakpoint.getFunction() != null && breakpoint.getFunction().equals(function)) {
return breakpoint;
}
}
@@ -468,60 +450,134 @@ public class CDIDebugModel {
return null;
}
- public static IExpression createExpression( IDebugTarget target, String text ) throws DebugException {
- if ( target != null && target instanceof CDebugTarget ) {
+ public static IExpression createExpression(IDebugTarget target, String text) throws DebugException {
+ if (target != null && target instanceof CDebugTarget) {
try {
- ICDIExpression cdiExpression = ((CDebugTarget)target).getCDISession().getExpressionManager().createExpression( text );
- return new CExpression( (CDebugTarget)target, cdiExpression );
- }
- catch( CDIException e ) {
- throw new DebugException( new Status( IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, e.getMessage(), null ) );
+ ICDIExpression cdiExpression = ((CDebugTarget)target).getCDISession().getExpressionManager().createExpression(text);
+ return new CExpression((CDebugTarget)target, cdiExpression);
+ } catch (CDIException e) {
+ throw new DebugException(new Status(IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED,
+ e.getMessage(), null));
}
}
return null;
}
- public static IExpression createExpressionForGlobalVariable( IDebugTarget target, IPath fileName, String name ) throws DebugException {
- if ( target != null && target instanceof CDebugTarget ) {
+ public static IExpression createExpressionForGlobalVariable(IDebugTarget target, IPath fileName, String name)
+ throws DebugException {
+ if (target != null && target instanceof CDebugTarget) {
ICDIVariableObject vo = null;
try {
- vo = ((CDebugTarget)target).getCDISession().getVariableManager().getGlobalVariableObject( fileName.lastSegment(), null, name );
- ICDIVariable cdiVariable = ((CDebugTarget)target).getCDISession().getVariableManager().createVariable( vo );
- return new CExpression( (CDebugTarget)target, cdiVariable );
- }
- catch( CDIException e ) {
- throw new DebugException( new Status( IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null ) ); //$NON-NLS-1$
+ vo = ((CDebugTarget)target).getCDISession().getVariableManager().getGlobalVariableObject(fileName.lastSegment(),
+ null, name);
+ ICDIVariable cdiVariable = ((CDebugTarget)target).getCDISession().getVariableManager().createVariable(vo);
+ return new CExpression((CDebugTarget)target, cdiVariable);
+ } catch (CDIException e) {
+ throw new DebugException(new Status(IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED,
+ (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null)); //$NON-NLS-1$
}
}
return null;
}
- public static ICGlobalVariable createGlobalVariable( IDebugTarget target, IGlobalVariableDescriptor info ) throws DebugException {
- if ( target != null && target instanceof CDebugTarget ) {
+ public static ICGlobalVariable createGlobalVariable(IDebugTarget target, IGlobalVariableDescriptor info) throws DebugException {
+ if (target != null && target instanceof CDebugTarget) {
ICDIVariableObject vo = null;
try {
- vo = ((CDebugTarget)target).getCDISession().getVariableManager().getGlobalVariableObject( info.getPath().lastSegment(), null, info.getName() );
- return CVariableFactory.createGlobalVariable( (CDebugTarget)target, info, vo );
- }
- catch( CDIException e ) {
- throw new DebugException( new Status( IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null ) ); //$NON-NLS-1$
+ vo = ((CDebugTarget)target).getCDISession().getVariableManager().getGlobalVariableObject(
+ info.getPath().lastSegment(),
+ null, info.getName());
+ return CVariableFactory.createGlobalVariable((CDebugTarget)target, info, vo);
+ } catch (CDIException e) {
+ throw new DebugException(new Status(IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED,
+ (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null)); //$NON-NLS-1$
}
}
return null;
}
- protected static void stopInMain( CDebugTarget target ) throws DebugException {
- ICDILocation location = target.getCDITarget().createLocation( "", "main", 0 ); //$NON-NLS-1$ //$NON-NLS-2$
+ protected static void stopInMain(CDebugTarget target) throws DebugException {
+ ICDILocation location = target.getCDITarget().createLocation("", "main", 0); //$NON-NLS-1$ //$NON-NLS-2$
try {
- target.setInternalTemporaryBreakpoint( location );
- }
- catch( DebugException e ) {
- String message = MessageFormat.format( DebugCoreMessages.getString( "CDebugModel.0" ), new String[]{ e.getStatus().getMessage() } ); //$NON-NLS-1$
- IStatus newStatus = new Status( IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null );
- if ( !CDebugUtils.question( newStatus, target ) ) {
+ target.setInternalTemporaryBreakpoint(location);
+ } catch (DebugException e) {
+ String message = MessageFormat.format(
+ DebugCoreMessages.getString("CDebugModel.0"), new String[]{e.getStatus().getMessage()}); //$NON-NLS-1$
+ IStatus newStatus = new Status(IStatus.WARNING, e.getStatus().getPlugin(),
+ ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null);
+ if (!CDebugUtils.question(newStatus, target)) {
target.terminate();
- throw new DebugException( new Status( IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(), e.getStatus().getMessage(), null ) );
+ throw new DebugException(new Status(IStatus.OK, e.getStatus().getPlugin(), e.getStatus().getCode(),
+ e.getStatus().getMessage(), null));
+ }
+ }
+ }
+
+ /**
+ * @param launch
+ * @param target
+ * @param string
+ * @param iprocess
+ * @param debuggerProcess
+ * @param exeFile
+ * @param b
+ * @param c
+ * @param stopInMain
+ * @throws CoreException
+ * @deprecated
+ */
+ public static IDebugTarget newDebugTarget(ILaunch launch, ICDITarget target, String name, IProcess iprocess,
+ IProcess debuggerProcess, IFile file, boolean allowTerminate, boolean allowDisconnect, boolean stopInMain)
+ throws CoreException {
+ IBinaryExecutable exeFile = getBinary(file);
+ return newDebugTarget(launch, file.getProject(), target, name, iprocess, exeFile, allowTerminate, allowDisconnect,
+ stopInMain);
+ }
+
+ /**
+ * @param launch
+ * @param target
+ * @param name
+ * @param debuggerProcess
+ * @param exeFile
+ * @throws CoreException
+ * @deprecated
+ */
+ public static IDebugTarget newAttachDebugTarget(ILaunch launch, ICDITarget target, String name, IProcess debuggerProcess,
+ IFile file) throws CoreException {
+ IBinaryExecutable exeFile = getBinary(file);
+ return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, false, true);
+ }
+
+ /**
+ * @param launch
+ * @param currentTarget
+ * @param string
+ * @param iprocess
+ * @param exeFile
+ * @throws CoreException
+ * @deprecated
+ */
+ public static IDebugTarget newCoreFileDebugTarget(final ILaunch launch, final ICDITarget target, final String name,
+ final IProcess debuggerProcess, final IFile file) throws CoreException {
+ IBinaryExecutable exeFile = getBinary(file);
+ return newDebugTarget(launch, file.getProject(), target, name, null, exeFile, false, false);
+ }
+
+ private static IBinaryExecutable getBinary(IFile file) throws CoreException {
+ IProject project = file.getProject();
+ ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions(project);
+ for (int i = 0; i < binaryParsersExt.length; i++) {
+ IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension();
+ try {
+ IBinaryFile exe = parser.getBinary(file.getLocation());
+ if (exe instanceof IBinaryExecutable) {
+ return (IBinaryExecutable)exe;
+ }
+ } catch (IOException e) {
}
}
+ throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1,
+ DebugCoreMessages.getString("CDIDebugModel.0"), null)); //$NON-NLS-1$
}
-}
+} \ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java
index 67e89d8ca6d..06873a76b41 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugModel.java
@@ -18,6 +18,7 @@ import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.cdt.debug.internal.core.model.CFormattedMemoryBlock;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -50,26 +51,29 @@ public class CDebugModel {
}
/**
+ * @throws CoreException
* @deprecated
* Use {@link CDIDebugModel#newDebugTarget(ILaunch, ICDITarget, String, IProcess, IProcess, IFile, boolean, boolean, boolean)}.
*/
- public static IDebugTarget newDebugTarget( final ILaunch launch, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IProcess debuggerProcess, final IFile file, final boolean allowTerminate, final boolean allowDisconnect, final boolean stopInMain ) throws DebugException {
+ public static IDebugTarget newDebugTarget( final ILaunch launch, final ICDITarget cdiTarget, final String name, final IProcess debuggeeProcess, final IProcess debuggerProcess, final IFile file, final boolean allowTerminate, final boolean allowDisconnect, final boolean stopInMain ) throws CoreException {
return CDIDebugModel.newDebugTarget( launch, cdiTarget, name, debuggeeProcess, debuggerProcess, file, allowTerminate, allowDisconnect, stopInMain );
}
/**
+ * @throws CoreException
* @deprecated
* Use {@link CDIDebugModel#newAttachDebugTarget(ILaunch, ICDITarget, String, IProcess, IFile)}.
*/
- public static IDebugTarget newAttachDebugTarget( final ILaunch launch, final ICDITarget cdiTarget, final String name, final IProcess debuggerProcess, final IFile file ) throws DebugException {
+ public static IDebugTarget newAttachDebugTarget( final ILaunch launch, final ICDITarget cdiTarget, final String name, final IProcess debuggerProcess, final IFile file ) throws CoreException {
return CDIDebugModel.newAttachDebugTarget( launch, cdiTarget, name, debuggerProcess, file );
}
/**
+ * @throws CoreException
* @deprecated
* Use {@link CDIDebugModel#newCoreFileDebugTarget(ILaunch, ICDITarget, String, IProcess, IFile)}.
*/
- public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch, final ICDITarget cdiTarget, final String name, final IProcess debuggerProcess, final IFile file ) throws DebugException {
+ public static IDebugTarget newCoreFileDebugTarget( final ILaunch launch, final ICDITarget cdiTarget, final String name, final IProcess debuggerProcess, final IFile file ) throws CoreException {
return CDIDebugModel.newCoreFileDebugTarget( launch, cdiTarget, name, debuggerProcess, file );
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties
index a8a25eb588f..ae315256910 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/DebugCoreMessages.properties
@@ -10,3 +10,4 @@
###############################################################################
CDebugCorePlugin.0=No such debugger
CDebugModel.0=Unable to set temporary breakpoint in main.\nReason: {0}\nContinue?
+CDIDebugModel.0=Unable to parser binary information from file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger.java
new file mode 100644
index 00000000000..6e27fec264a
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDIDebugger.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
+ * program and the accompanying materials are 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
+ *
+ * Contributors: QNX Software Systems - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.cdt.debug.core;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+
+
+public interface ICDIDebugger {
+ public ICDISession createDebuggerSession(ILaunch launch, IBinaryExecutable exe, IProgressMonitor monitor) throws CoreException;
+
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDTLaunchConfigurationConstants.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDTLaunchConfigurationConstants.java
index 1b8301e6e47..886d1061f08 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDTLaunchConfigurationConstants.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDTLaunchConfigurationConstants.java
@@ -1,29 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
+ * Copyright (c) 2000, 2004 QNX Software Systems and others. All rights
+ * reserved. This program and the accompanying materials are 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
*
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
+ * Contributors: QNX Software Systems - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.cdt.debug.core;
-
-
public interface ICDTLaunchConfigurationConstants {
public static final String CDT_LAUNCH_ID = "org.eclipse.cdt.launch"; //$NON-NLS-1$
-
+
/**
* This is the launch type id.
*/
public static final String ID_LAUNCH_C_APP = "org.eclipse.cdt.launch.localCLaunch"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute key. The value is a name of
- * a C/C++ project associated with a C/C++ launch configuration.
+ * Launch configuration attribute key. The value is a name of a C/C++
+ * project associated with a C/C++ launch configuration.
*/
public static final String ATTR_PROJECT_NAME = CDT_LAUNCH_ID + ".PROJECT_ATTR"; //$NON-NLS-1$
@@ -35,156 +31,173 @@ public interface ICDTLaunchConfigurationConstants {
/**
* Launch configuration attribute key. The value is a string specifying
- * application arguments for a C/C++ launch configuration, as they should appear
- * on the command line.
+ * application arguments for a C/C++ launch configuration, as they should
+ * appear on the command line.
*/
public static final String ATTR_PROGRAM_ARGUMENTS = CDT_LAUNCH_ID + ".PROGRAM_ARGUMENTS"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a string specifying a
* path to the working directory to use when launching a the application.
- * When unspecified, the working directory is inherited from the current process.
- * When specified as an absolute path, the path represents a path in the local
- * file system. When specified as a full path, the path represents a workspace
- * relative path.
+ * When unspecified, the working directory is inherited from the current
+ * process. When specified as an absolute path, the path represents a path
+ * in the local file system. When specified as a full path, the path
+ * represents a workspace relative path.
*/
public static final String ATTR_WORKING_DIRECTORY = CDT_LAUNCH_ID + ".WORKING_DIRECTORY"; //$NON-NLS-1$
/**
- * Launch configuration attribute key. The value is a boolean specifying
+ * Launch configuration attribute key. The value is a boolean specifying
* whether the current enviroment should be inherited when the application
- * is launched.
+ * is launched.
*/
public static final String ATTR_PROGRAM_ENVIROMENT_INHERIT = CDT_LAUNCH_ID + ".ENVIRONMENT_INHERIT"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a Map specifying the
- * environment to use when launching a C/C++ application.
+ * environment to use when launching a C/C++ application.
*/
public static final String ATTR_PROGRAM_ENVIROMENT_MAP = CDT_LAUNCH_ID + ".ENVIRONMENT_MAP"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute key. The value is the platform string of the launch configuration
+ * Launch configuration attribute key. The value is the platform string of
+ * the launch configuration
*/
public static final String ATTR_PLATFORM = CDT_LAUNCH_ID + ".PLATFFORM"; //$NON-NLS-1$
/**
- * Launch configuration attribute key. The value is the debugger id
- * used when launching a C/C++ application for debug.
+ * Launch configuration attribute key. The value is the debugger id used
+ * when launching a C/C++ application for debug.
*/
public static final String ATTR_DEBUGGER_ID = CDT_LAUNCH_ID + ".DEBUGGER_ID"; //$NON-NLS-1$
/**
- * Launch configuration attribute key. The value is the platform string of the launch configuration
+ * Launch configuration attribute key. The value is the platform string of
+ * the launch configuration
*/
public static final String ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP = CDT_LAUNCH_ID + ".DEBUGGER_SPECIFIC_ATTRS_MAP"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute key. The value is a boolean specifying whether to stop at main().
+ * Launch configuration attribute key. The value is a boolean specifying
+ * whether to stop at main().
*/
public static final String ATTR_DEBUGGER_STOP_AT_MAIN = CDT_LAUNCH_ID + ".DEBUGGER_STOP_AT_MAIN"; //$NON-NLS-1$
/**
- * Launch configuration attribute key. The value is an int specifying the process id to attach to
- * if the ATTR_DEBUGGER_START_MODE is DEBUGGER_MODE_ATTACH. A non existant value or -1 for this
- * entry indicates that the user should be asked to supply this value. This value is primarily
- * designed to be used by programatic users of the debug interface.
+ * Launch configuration attribute key. The value is an int specifying the
+ * process id to attach to if the ATTR_DEBUGGER_START_MODE is
+ * DEBUGGER_MODE_ATTACH. A non existant value or -1 for this entry indicates
+ * that the user should be asked to supply this value by the launch
+ * delegate. This value is primarily designed to be used by programatic
+ * users of the debug interface.
*/
public static final String ATTR_ATTACH_PROCESS_ID = CDT_LAUNCH_ID + ".ATTACH_PROCESS_ID"; //$NON-NLS-1$
/**
- * Launch configuration attribute key. The value is the startup mode for the debugger.
+ * Launch configuration attribute key. The value is a String specifying the
+ * corefile path if the ATTR_DEBUGGER_START_MODE is DEBUGGER_MODE_COREFILE.
+ * A non existant value or null for this entry indicates that the user
+ * should be asked to supply this value by the launch delegate. This value
+ * is primarily designed to be used by programatic users of the debug
+ * interface.
+ */
+ public static final String ATTR_COREFILE_PATH = CDT_LAUNCH_ID + ".COREFILE_PATH"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The value is the startup mode for the
+ * debugger.
*/
public static final String ATTR_DEBUGGER_START_MODE = CDT_LAUNCH_ID + ".DEBUGGER_START_MODE"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute key. The value is a boolean specifying whether to enable variable bookkeeping.
+ * Launch configuration attribute key. The value is a boolean specifying
+ * whether to enable variable bookkeeping.
*/
public static final String ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING = CDT_LAUNCH_ID + ".ENABLE_VARIABLE_BOOKKEEPING"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute key. The value is a boolean specifying whether to enable register bookkeeping.
+ * Launch configuration attribute key. The value is a boolean specifying
+ * whether to enable register bookkeeping.
*/
public static final String ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING = CDT_LAUNCH_ID + ".ENABLE_REGISTER_BOOKKEEPING"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute key. The value is a global variables' memento.
+ * Launch configuration attribute key. The value is a global variables'
+ * memento.
*/
public static final String ATTR_DEBUGGER_GLOBAL_VARIABLES = CDT_LAUNCH_ID + ".GLOBAL_VARIABLES"; //$NON-NLS-1$
-
+
/**
- * Launch configuration attribute value. The key is ATTR_DEBUGGER_STOP_AT_MAIN.
+ * Launch configuration attribute value. The key is
+ * ATTR_DEBUGGER_STOP_AT_MAIN.
*/
public static boolean DEBUGGER_STOP_AT_MAIN_DEFAULT = true;
/**
- * Launch configuration attribute value. The key is ATTR_DEBUGGER_START_MODE.
- * Startup debugger running the program.
+ * Launch configuration attribute value. The key is
+ * ATTR_DEBUGGER_START_MODE. Startup debugger running the program.
*/
public static String DEBUGGER_MODE_RUN = "run"; //$NON-NLS-1$
/**
- * Launch configuration attribute value. The key is ATTR_DEBUGGER_START_MODE.
- * Startup debugger and attach to running process.
+ * Launch configuration attribute value. The key is
+ * ATTR_DEBUGGER_START_MODE. Startup debugger and attach to running process.
*/
public static String DEBUGGER_MODE_ATTACH = "attach"; //$NON-NLS-1$
-
/**
- * Launch configuration attribute value. The key is ATTR_DEBUGGER_START_MODE.
- * Startup debugger to view a core file.
+ * Launch configuration attribute value. The key is
+ * ATTR_DEBUGGER_START_MODE. Startup debugger to view a core file.
*/
public static String DEBUGGER_MODE_CORE = "core"; //$NON-NLS-1$
-
/**
* Status code indicating that the Eclipse runtime does not support
* launching a program with a working directory. This feature is only
* available if Eclipse is run on a 1.3 runtime or higher.
* <p>
- * A status handler may be registered for this error condition,
- * and should return a Boolean indicating whether the program
- * should be relaunched with the default working directory.
+ * A status handler may be registered for this error condition, and should
+ * return a Boolean indicating whether the program should be relaunched with
+ * the default working directory.
* </p>
*/
public static final int ERR_WORKING_DIRECTORY_NOT_SUPPORTED = 100;
/**
- * Status code indicating the specified working directory
- * does not exist.
+ * Status code indicating the specified working directory does not exist.
*/
- public static final int ERR_WORKING_DIRECTORY_DOES_NOT_EXIST = 101;
+ public static final int ERR_WORKING_DIRECTORY_DOES_NOT_EXIST = 101;
/**
- * Status code indicating a launch configuration does not
- * specify a project when a project is required.
+ * Status code indicating a launch configuration does not specify a project
+ * when a project is required.
*/
- public static final int ERR_UNSPECIFIED_PROJECT = 102;
+ public static final int ERR_UNSPECIFIED_PROJECT = 102;
/**
- * Status code indicating a launch configuration does not
- * specify a vaild project.
+ * Status code indicating a launch configuration does not specify a vaild
+ * project.
*/
public static final int ERR_NOT_A_C_PROJECT = 103;
/**
- * Status code indicating a launch configuration does not
- * specify a vaild program.
+ * Status code indicating a launch configuration does not specify a vaild
+ * program.
*/
public static final int ERR_PROGRAM_NOT_EXIST = 104;
/**
- * Status code indicating a launch configuration does not
- * specify a program name.
+ * Status code indicating a launch configuration does not specify a program
+ * name.
*/
-
+
public static final int ERR_UNSPECIFIED_PROGRAM = 105;
/**
* Status code indicating that the CDT debugger is missing
* <p>
- * A status handler may be registered for this error condition,
- * and should return a String indicating which debugger to use.
+ * A status handler may be registered for this error condition, and should
+ * return a String indicating which debugger to use.
* </p>
*/
public static final int ERR_DEBUGGER_NOT_INSTALLED = 106;
@@ -198,9 +211,9 @@ public interface ICDTLaunchConfigurationConstants {
* Status code indicating a the user did not specify a path to a corefile
*/
public static final int ERR_NO_COREFILE = 108;
-
+
/**
* Status code indicating an unexpected internal error.
*/
- public static final int ERR_INTERNAL_ERROR = 150;
-}
+ public static final int ERR_INTERNAL_ERROR = 150;
+} \ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java
index dbaa52bf564..2e674e330c3 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java
@@ -15,7 +15,14 @@ import org.eclipse.core.runtime.CoreException;
public interface ICDebugConfiguration {
final static String CPU_NATIVE = "native"; //$NON-NLS-1$
+ /**
+ * @return
+ * @throws CoreException
+ * @deprecated
+ */
ICDebugger getDebugger() throws CoreException;
+
+ ICDIDebugger createDebugger() throws CoreException;
String getName();
String getID();
String getPlatform();
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java
index 93a4d75120b..70e6d9ceb77 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java
@@ -16,6 +16,10 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.ILaunchConfiguration;
+/**
+ *
+ * @deprecated - see ICDIDebugger
+ */
public interface ICDebugger {
public ICDISession createLaunchSession(ILaunchConfiguration config, IFile exe) throws CDIException ;
public ICDISession createAttachSession(ILaunchConfiguration config, IFile exe, int pid) throws CDIException;
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IExecFileInfo.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IExecFileInfo.java
index b258694f09f..420be5fd678 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IExecFileInfo.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IExecFileInfo.java
@@ -10,7 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.debug.core.model;
-import org.eclipse.core.resources.IFile;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
import org.eclipse.debug.core.DebugException;
/**
@@ -18,7 +18,7 @@ import org.eclipse.debug.core.DebugException;
*/
public interface IExecFileInfo {
- public IFile getExecFile();
+ public IBinaryExecutable getExecFile();
public boolean isLittleEndian();
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
index 006ae168056..422a76b524a 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
@@ -50,6 +50,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
@@ -225,9 +226,9 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
ICSourceLocator sl = getSourceLocator();
if ( sl != null )
return sl.contains( project );
- if ( project.equals( getExecFile().getProject() ) )
+ if ( project.equals( getProject() ) )
return true;
- return CDebugUtils.isReferencedProject( getExecFile().getProject(), project );
+ return CDebugUtils.isReferencedProject( getProject(), project );
}
}
return true;
@@ -239,7 +240,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
public boolean supportsAddressBreakpoint( ICAddressBreakpoint breakpoint ) {
try {
- return ( getExecFile() != null && getExecFile().getLocation().toOSString().equals( breakpoint.getSourceHandle() ) );
+ return ( getExecFilePath().toOSString().equals( breakpoint.getSourceHandle() ) );
}
catch( CoreException e ) {
}
@@ -606,10 +607,10 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
}
private ICFunctionBreakpoint createFunctionBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
- IFile execFile = getExecFile();
- String sourceHandle = execFile.getFullPath().toOSString();
+ IPath execFile = getExecFilePath();
+ String sourceHandle = execFile.toOSString();
ICFunctionBreakpoint breakpoint = CDIDebugModel.createFunctionBreakpoint( sourceHandle,
- execFile,
+ getProject(),
cdiBreakpoint.getLocation().getFunction(),
-1,
-1,
@@ -624,11 +625,11 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
}
private ICAddressBreakpoint createAddressBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
- IFile execFile = getExecFile();
- String sourceHandle = execFile.getFullPath().toOSString();
+ IPath execFile = getExecFilePath();
+ String sourceHandle = execFile.toOSString();
IAddress address = getDebugTarget().getAddressFactory().createAddress( cdiBreakpoint.getLocation().getAddress() );
ICAddressBreakpoint breakpoint = CDIDebugModel.createAddressBreakpoint( sourceHandle,
- execFile,
+ getProject(),
address,
cdiBreakpoint.isEnabled(),
cdiBreakpoint.getCondition().getIgnoreCount(),
@@ -640,10 +641,10 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
}
private ICWatchpoint createWatchpoint( ICDIWatchpoint cdiWatchpoint ) throws CDIException, CoreException {
- IFile execFile = getExecFile();
- String sourceHandle = execFile.getFullPath().toOSString();
+ IPath execFile = getExecFilePath();
+ String sourceHandle = execFile.toOSString();
ICWatchpoint watchpoint = CDIDebugModel.createWatchpoint( sourceHandle,
- execFile.getProject(),
+ getProject(),
cdiWatchpoint.isWriteType(),
cdiWatchpoint.isReadType(),
cdiWatchpoint.getWatchExpression(),
@@ -661,8 +662,12 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
return (locator instanceof IAdaptable) ? (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class ) : null;
}
- private IFile getExecFile() {
- return getDebugTarget().getExecFile();
+ private IProject getProject() {
+ return getDebugTarget().getProject();
+ }
+
+ private IPath getExecFilePath() {
+ return getDebugTarget().getExecFile().getPath();
}
private CBreakpointNotifier getBreakpointNotifier() {
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java
new file mode 100644
index 00000000000..00533232d7d
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
+ * program and the accompanying materials are 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
+ *
+ * Contributors: QNX Software Systems - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.cdt.debug.internal.core;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.cdt.debug.core.ICDIDebugger;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.ICDebugger;
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+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.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+public class CDebugAdapter implements ICDIDebugger {
+
+ final ICDebugger fDebugger;
+ /**
+ * @param debugger
+ */
+ public CDebugAdapter(ICDebugger debugger) {
+ fDebugger = debugger;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.debug.core.ICDIDebugger#createDebuggerSession(org.eclipse.debug.core.ILaunch,
+ * org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable,
+ * org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public ICDISession createDebuggerSession(ILaunch launch, IBinaryExecutable exe, IProgressMonitor monitor) throws CoreException {
+ ILaunchConfiguration config = launch.getLaunchConfiguration();
+ IFile[] exeFile = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(exe.getPath());
+ if (exeFile.length == 0) {
+ abort(InternalDebugCoreMessages.getString("CDebugAdapter.0"), null, -1); //$NON-NLS-1$
+ }
+ int pid = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1);
+ String coreFile = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null);
+ ICDISession session;
+ try {
+ if (pid == -1 && coreFile == null) {
+ return fDebugger.createLaunchSession(config, exeFile[0]);
+ } else if (pid != -1) {
+ return fDebugger.createAttachSession(config, exeFile[0], pid);
+ }
+ return fDebugger.createCoreSession(config, exeFile[0], new Path(coreFile));
+ } catch (CDIException e) {
+ abort(e.getLocalizedMessage(), e, -1);
+ }
+ throw new IllegalStateException(); // should never happen
+ }
+
+ protected void abort(String message, Throwable exception, int code) throws CoreException {
+ MultiStatus status = new MultiStatus(CDebugCorePlugin.getUniqueIdentifier(), code, message, exception);
+ status.add(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
+ exception));
+ throw new CoreException(status);
+ }
+
+ public static ICProject getCProject(ILaunchConfiguration configuration) throws CoreException {
+ String projectName = getProjectName(configuration);
+ if (projectName != null) {
+ projectName = projectName.trim();
+ if (projectName.length() > 0) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project);
+ if (cProject != null && cProject.exists()) {
+ return cProject;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static String getProjectName(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
+ }
+
+ public static String getProgramName(ILaunchConfiguration configuration) throws CoreException {
+ return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
+ }
+
+ public static IPath getProgramPath(ILaunchConfiguration configuration) throws CoreException {
+ String path = getProgramName(configuration);
+ if (path == null) {
+ return null;
+ }
+ return new Path(path);
+ }
+
+} \ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java
index ef2392876ce..083b95f1254 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java
@@ -13,11 +13,16 @@ package org.eclipse.cdt.debug.internal.core;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
+
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.cdt.debug.core.ICDIDebugger;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.cdt.debug.core.ICDebugger;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
public class DebugConfiguration implements ICDebugConfiguration {
/**
@@ -36,7 +41,19 @@ public class DebugConfiguration implements ICDebugConfiguration {
}
public ICDebugger getDebugger() throws CoreException {
- return (ICDebugger) getConfigurationElement().createExecutableExtension("class"); //$NON-NLS-1$
+ Object debugger = getConfigurationElement().createExecutableExtension("class"); //$NON-NLS-1$
+ if (debugger instanceof ICDebugger) {
+ return (ICDebugger)debugger;
+ }
+ throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1, InternalDebugCoreMessages.getString("DebugConfiguration.0"), null)); //$NON-NLS-1$
+ }
+
+ public ICDIDebugger createDebugger() throws CoreException {
+ Object debugger = getConfigurationElement().createExecutableExtension("class"); //$NON-NLS-1$
+ if (debugger instanceof ICDIDebugger) {
+ return (ICDIDebugger)debugger;
+ }
+ return new CDebugAdapter((ICDebugger)debugger);
}
public String getName() {
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties
index b901054a668..8d2a19e46d1 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties
@@ -16,3 +16,5 @@ CBreakpointManager.4=Change breakpoint properties failed. Reason: {0}.
CBreakpointManager.5=Change breakpoint properties failed. Reason: {0}.
CGlobalVariableManager.0=Invalid global variables data.
CExtendedMemoryBlockRetrieval.0=Expression ''{0}'' evaluated to invalid address value: {1}.
+DebugConfiguration.0=This debugger no longer supports this operation
+CDebugAdapter.0=This debugger does not support debugging external files
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CCoreFileDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CCoreFileDebugTarget.java
index 9d5c5a41930..41fc21f24a4 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CCoreFileDebugTarget.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CCoreFileDebugTarget.java
@@ -10,39 +10,33 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.model.CDebugElementState;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.debug.core.DebugException;
+import org.eclipse.core.resources.IProject;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IProcess;
/**
* A debug target for the postmortem debugging.
+ * @deprecated
*/
public class CCoreFileDebugTarget extends CDebugTarget {
- public CCoreFileDebugTarget( ILaunch launch, ICDITarget cdiTarget, String name, IProcess debuggerProcess, IFile file ) {
- super( launch, cdiTarget, name, null, debuggerProcess, file, true, false );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
- */
- public boolean canTerminate() {
- return !isTerminated() || !isTerminating();
- }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.model.ITerminate#terminate()
+ /**
+ * @param launch
+ * @param project
+ * @param cdiTarget
+ * @param name
+ * @param debuggeeProcess
+ * @param file
+ * @param allowsTerminate
+ * @param allowsDisconnect
*/
- public void terminate() throws DebugException {
- setState( CDebugElementState.TERMINATING );
- terminated();
+ public CCoreFileDebugTarget(ILaunch launch, IProject project, ICDITarget cdiTarget, String name, IProcess debuggeeProcess, IBinaryExecutable file) {
+ super(launch, project, cdiTarget, name, debuggeeProcess, file, false, false);
+ setState(CDebugElementState.TERMINATED);
}
/* (non-Javadoc)
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
index b0ac0bc3071..c1990969e66 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
@@ -20,12 +20,9 @@ import java.util.StringTokenizer;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
-import org.eclipse.cdt.core.IBinaryParser;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.IBinary;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.IParent;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
@@ -93,6 +90,7 @@ import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
@@ -196,12 +194,17 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* The global variable manager for this target.
*/
private CGlobalVariableManager fGlobalVariableManager;
-
+
/**
- * The executable file associated with this target.
+ * The executable binary file associated with this target.
*/
- private IFile fExecFile;
+ private IBinaryExecutable fBinaryFile;
+ /**
+ * The project associated with this target.
+ */
+ private IProject fProject;
+
/**
* Whether the target is little endian.
*/
@@ -222,12 +225,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/**
* Constructor for CDebugTarget.
*/
- public CDebugTarget( ILaunch launch, ICDITarget cdiTarget, String name, IProcess debuggeeProcess, IProcess debuggerProcess, IFile file, boolean allowsTerminate, boolean allowsDisconnect ) {
+ public CDebugTarget( ILaunch launch, IProject project, ICDITarget cdiTarget, String name, IProcess debuggeeProcess, IBinaryExecutable file, boolean allowsTerminate, boolean allowsDisconnect) {
super( null );
setLaunch( launch );
setDebugTarget( this );
setName( name );
setProcess( debuggeeProcess );
+ setProject(project);
setExecFile( file );
setCDITarget( cdiTarget );
setState( CDebugElementState.SUSPENDED );
@@ -1401,54 +1405,59 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
public boolean isLittleEndian() {
if ( fIsLittleEndian == null ) {
fIsLittleEndian = Boolean.TRUE;
- if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) ) {
- ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
- if ( cFile instanceof IBinary ) {
- fIsLittleEndian = new Boolean( ((IBinary)cFile).isLittleEndian() );
- }
+ IBinaryObject file;
+ file = getBinaryFile();
+ if (file != null) {
+ return file.isLittleEndian();
}
}
return fIsLittleEndian.booleanValue();
}
- public IFile getExecFile() {
- return fExecFile;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.IExecFileInfo#getExecFile()
+ */
+ public IBinaryExecutable getExecFile() {
+ return getBinaryFile();
}
-
- private void setExecFile( IFile file ) {
- fExecFile = file;
+
+ public IBinaryExecutable getBinaryFile() {
+ return fBinaryFile;
}
+ private void setExecFile( IBinaryExecutable file ) {
+ fBinaryFile = file;
+ }
+
+ private void setProject(IProject project) {
+ fProject = project;
+ }
+
+ public IProject getProject() {
+ return fProject;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IExecFileInfo#getGlobals()
*/
public IGlobalVariableDescriptor[] getGlobals() throws DebugException {
ArrayList list = new ArrayList();
- if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) ) {
- ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
- if ( cFile instanceof IParent ) {
- list.addAll( getCFileGlobals( (IParent)cFile ) );
- }
+ IBinaryObject file = getBinaryFile();
+ if (file != null) {
+ list.addAll( getCFileGlobals( file ) );
}
return (IGlobalVariableDescriptor[])list.toArray( new IGlobalVariableDescriptor[list.size()] );
}
- private List getCFileGlobals( IParent file ) throws DebugException {
+ private List getCFileGlobals( IBinaryObject file ) throws DebugException {
ArrayList list = new ArrayList();
- try {
- ICElement[] elements = file.getChildren();
- for( int i = 0; i < elements.length; ++i ) {
- if ( elements[i] instanceof org.eclipse.cdt.core.model.IVariable ) {
- list.add( CVariableFactory.createGlobalVariableDescriptor( (org.eclipse.cdt.core.model.IVariable)elements[i] ) );
- }
- else if ( elements[i] instanceof org.eclipse.cdt.core.model.IParent ) {
- list.addAll( getCFileGlobals( (org.eclipse.cdt.core.model.IParent)elements[i] ) );
- }
+ ISymbol[] symbols = file.getSymbols();
+ for( int i = 0; i < symbols.length; ++i ) {
+ if (symbols[i].getType() == ISymbol.VARIABLE) {
+ list.add( CVariableFactory.createGlobalVariableDescriptor( symbols[i] ) );
}
}
- catch( CModelException e ) {
- requestFailed( CoreModelMessages.getString( "CDebugTarget.Unable_to_get_globals_1" ) + e.getMessage(), e ); //$NON-NLS-1$
- }
return list;
}
@@ -1834,12 +1843,11 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
public IAddressFactory getAddressFactory() {
if ( fAddressFactory == null ) {
- if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) ) {
- ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
- if ( cFile instanceof IBinary ) {
- IBinaryParser.IBinaryObject obj;
- obj = (IBinaryParser.IBinaryObject)cFile.getAdapter(IBinaryParser.IBinaryObject.class);
- fAddressFactory = obj.getAddressFactory();
+ if ( getExecFile() != null && getProject() != null ) {
+ IBinaryObject file;
+ file = getBinaryFile();
+ if (file != null) {
+ fAddressFactory = file.getAddressFactory();
}
}
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java
index b15b9638cc3..f472cf08403 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java
@@ -11,6 +11,9 @@
package org.eclipse.cdt.debug.internal.core.model;
import java.text.MessageFormat;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.core.model.IBinaryModule;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
@@ -58,6 +61,14 @@ public class CVariableFactory {
return createGlobalVariableDescriptor( var.getElementName(), path );
}
+ public static IGlobalVariableDescriptor createGlobalVariableDescriptor(ISymbol symbol) {
+ IPath path = new Path( "" ); //$NON-NLS-1$
+ IBinaryObject parent = symbol.getBinarObject();
+ path = parent.getPath();
+ return createGlobalVariableDescriptor( symbol.getName(), path );
+
+ }
+
public static CGlobalVariable createGlobalVariable( CDebugElement parent, IGlobalVariableDescriptor descriptor, ICDIVariableObject cdiVariableObject ) {
return new CGlobalVariable( parent, descriptor, cdiVariableObject );
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java
index 89044b9e727..811c9d0f36b 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java
@@ -92,7 +92,7 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
if ( d != null ) {
IExecFileInfo info = (IExecFileInfo)d.getAdapter( IExecFileInfo.class );
if ( info != null && info.getExecFile() != null ) {
- return info.getExecFile().getLocation().toOSString();
+ return info.getExecFile().getPath().toOSString();
}
}
return ""; //$NON-NLS-1$
diff --git a/launch/org.eclipse.cdt.launch/ChangeLog b/launch/org.eclipse.cdt.launch/ChangeLog
index 5feba40be14..47f411bf81e 100644
--- a/launch/org.eclipse.cdt.launch/ChangeLog
+++ b/launch/org.eclipse.cdt.launch/ChangeLog
@@ -1,3 +1,10 @@
+2004-10-18 David Inglis
+
+ Update to new ICDIDebugger interface deprecating old
+ Added seperate launch configuration for attaching to pid
+
+ * lots of files changed
+
2004-10-17 Alain Magloire
Remove deprecated method in CDI adjust the implementation.
* src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java
diff --git a/launch/org.eclipse.cdt.launch/plugin.properties b/launch/org.eclipse.cdt.launch/plugin.properties
index 24aba4dc1f3..bbc700cb5c9 100644
--- a/launch/org.eclipse.cdt.launch/plugin.properties
+++ b/launch/org.eclipse.cdt.launch/plugin.properties
@@ -11,8 +11,9 @@
pluginName=C/C++ Development Tools Launching Support
providerName=Eclipse.org
-LocalCDTLaunch.name= C/C++ Local
-CoreFileCDTLaunch.name= C/C++ Postmortem debugger
+LocalCDTLaunch.name=C/C++ Local Application
+LocalAttachCDTLaunch.name=C/C++ Attach to Local Application
+CoreFileCDTLaunch.name=C/C++ Postmortem debugger
CApplicationShortcut.label=Local C/C++ Application
ContextualRunCApplication.label=Run Local C/C++ Application
diff --git a/launch/org.eclipse.cdt.launch/plugin.xml b/launch/org.eclipse.cdt.launch/plugin.xml
index e55977af88c..52f087748fa 100644
--- a/launch/org.eclipse.cdt.launch/plugin.xml
+++ b/launch/org.eclipse.cdt.launch/plugin.xml
@@ -32,42 +32,59 @@
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
name="%LocalCDTLaunch.name"
- delegate="org.eclipse.cdt.launch.internal.LocalCLaunchConfigurationDelegate"
+ delegate="org.eclipse.cdt.launch.internal.LocalRunLaunchDelegate"
modes="run,debug"
public="true"
- id="org.eclipse.cdt.launch.localCLaunch">
+ id="org.eclipse.cdt.launch.localRunLaunch">
+ </launchConfigurationType>
+ <launchConfigurationType
+ name="%LocalAttachCDTLaunch.name"
+ delegate="org.eclipse.cdt.launch.internal.LocalAttachLaunchDelegate"
+ modes="debug"
+ public="true"
+ id="org.eclipse.cdt.launch.localAttachLaunch">
</launchConfigurationType>
<launchConfigurationType
name="%CoreFileCDTLaunch.name"
delegate="org.eclipse.cdt.launch.internal.CoreFileLaunchDelegate"
modes="debug"
public="true"
- id="org.eclipse.cdt.launch.coreFileCLaunch">
+ id="org.eclipse.cdt.launch.coreFileLaunch">
</launchConfigurationType>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTypeImages">
<launchConfigurationTypeImage
icon="icons/c_app.gif"
- configTypeID="org.eclipse.cdt.launch.localCLaunch"
- id="org.eclipse.cdt.launch.localCLaunchImage">
+ configTypeID="org.eclipse.cdt.launch.localRunLaunch"
+ id="org.eclipse.cdt.launch.localRunLaunchImage">
</launchConfigurationTypeImage>
<launchConfigurationTypeImage
icon="icons/c_app.gif"
- configTypeID="org.eclipse.cdt.launch.coreFileCLaunch"
- id="org.eclipse.cdt.launch.coreFileCLaunchImage">
+ configTypeID="org.eclipse.cdt.launch.localAttachLaunch"
+ id="org.eclipse.cdt.launch.localAttachLaunchImage">
+ </launchConfigurationTypeImage>
+ <launchConfigurationTypeImage
+ icon="icons/c_app.gif"
+ configTypeID="org.eclipse.cdt.launch.coreFileLaunch"
+ id="org.eclipse.cdt.launch.coreFileLaunchImage">
</launchConfigurationTypeImage>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
- type="org.eclipse.cdt.launch.localCLaunch"
- class="org.eclipse.cdt.launch.internal.ui.LocalCLaunchConfigurationTabGroup"
- id="org.eclipse.cdt.launch.localClaunchConfigurationTabGroup">
+ type="org.eclipse.cdt.launch.localRunLaunch"
+ class="org.eclipse.cdt.launch.internal.ui.LocalRunLaunchConfigurationTabGroup"
+ id="org.eclipse.cdt.launch.localRunLaunchTabGroup">
+ </launchConfigurationTabGroup>
+ <launchConfigurationTabGroup
+ type="org.eclipse.cdt.launch.localAttachLaunch"
+ class="org.eclipse.cdt.launch.internal.ui.LocalAttachLaunchConfigurationTabGroup"
+ id="org.eclipse.cdt.launch.localAttachLaunchTabGroup">
</launchConfigurationTabGroup>
<launchConfigurationTabGroup
- type="org.eclipse.cdt.launch.coreFileCLaunch"
- class="org.eclipse.cdt.launch.internal.ui.CoreFileCLaunchConfigurationTabGroup"
+ type="org.eclipse.cdt.launch.coreFileLaunch"
+ class="org.eclipse.cdt.launch.internal.ui.CoreFileLaunchConfigurationTabGroup"
id="org.eclipse.cdt.launch.voreFileCLaunchTabGroup">
</launchConfigurationTabGroup>
</extension>
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
index c57d93881c6..6fdeb7787d8 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java
@@ -1,17 +1,16 @@
-/**********************************************************************
- * Copyright (c) 2002 - 2004 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
+/*******************************************************************************
+ * Copyright (c) 2002 - 2004 QNX Software Systems and others. All rights
+ * reserved. This program and the accompanying materials are 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
*
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
+ * Contributors: QNX Software Systems - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.cdt.launch;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -26,12 +25,16 @@ import java.util.Properties;
import java.util.Map.Entry;
import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.IBinaryParser;
+import org.eclipse.cdt.core.ICExtensionReference;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.utils.spawner.EnvironmentReader;
import org.eclipse.core.resources.IContainer;
@@ -306,6 +309,24 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
return configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, (String)null);
}
+ public static IPath getProgramPath(ILaunchConfiguration configuration) throws CoreException {
+ String path = getProgramName(configuration);
+ if (path == null) {
+ return null;
+ }
+ return new Path(path);
+ }
+
+ /**
+ * @param launch
+ * @param config
+ * @throws CoreException
+ * @deprecated
+ */
+ protected void setSourceLocator(ILaunch launch, ILaunchConfiguration config) throws CoreException {
+ setDefaultSourceLocator(launch, config);
+ }
+
/**
* Assigns a default source locator to the given launch if a source locator
* has not yet been assigned to it, and the associated launch configuration
@@ -318,7 +339,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
* @exception CoreException
* if unable to set the source locator
*/
- protected void setSourceLocator(ILaunch launch, ILaunchConfiguration configuration) throws CoreException {
+ protected void setDefaultSourceLocator(ILaunch launch, ILaunchConfiguration configuration) throws CoreException {
// set default source locator if none specified
if (launch.getSourceLocator() == null) {
IPersistableSourceLocator sourceLocator;
@@ -326,7 +347,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
if (id == null) {
ICProject cProject = getCProject(configuration);
if (cProject == null) {
- abort(LaunchUIPlugin.getResourceString("Launch.common.Project_does_not_exist"), null, //$NON-NLS-1$
+ abort(LaunchMessages.getString("Launch.common.Project_does_not_exist"), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
}
sourceLocator = CDebugUIPlugin.createDefaultSourceLocator();
@@ -375,11 +396,13 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
ICDebugConfiguration dbgCfg = null;
try {
dbgCfg = CDebugCorePlugin.getDefault().getDebugConfiguration(
- config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, "")); //$NON-NLS-1$
+ config.getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID,
+ "")); //$NON-NLS-1$
} catch (CoreException e) {
IStatus status = new Status(IStatus.ERROR, LaunchUIPlugin.getUniqueIdentifier(),
ICDTLaunchConfigurationConstants.ERR_DEBUGGER_NOT_INSTALLED,
- LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Debugger_not_installed"), //$NON-NLS-1$
+ LaunchMessages.getString("AbstractCLaunchDelegate.Debugger_not_installed"), //$NON-NLS-1$
e);
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(status);
@@ -411,45 +434,78 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
String format = "{0} ({1})"; //$NON-NLS-1$
String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
return MessageFormat.format(format, new String[]{
- LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Debugger_Process"), timestamp}); //$NON-NLS-1$
+ LaunchMessages.getString("AbstractCLaunchDelegate.Debugger_Process"), timestamp}); //$NON-NLS-1$
+ }
+
+
+ /**
+ * @param config
+ * @return
+ * @throws CoreException
+ * @deprecated
+ */
+ protected IFile getProgramFile(ILaunchConfiguration config) throws CoreException {
+ ICProject cproject = verifyCProject(config);
+ String fileName = getProgramName(config);
+ if (fileName == null) {
+ abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM);
+ }
+
+ IFile programPath = ((IProject)cproject.getResource()).getFile(fileName);
+ if (programPath == null || !programPath.exists() || !programPath.getLocation().toFile().exists()) {
+ abort(
+ LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), //$NON-NLS-1$
+ new FileNotFoundException(
+ LaunchMessages.getFormattedString(
+ "AbstractCLaunchDelegate.PROGRAM_PATH_not_found", programPath.getLocation().toOSString())), //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
+ }
+ return programPath;
}
protected ICProject verifyCProject(ILaunchConfiguration config) throws CoreException {
String name = getProjectName(config);
if (name == null) {
- abort(LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.C_Project_not_specified"), null, //$NON-NLS-1$
+ abort(LaunchMessages.getString("AbstractCLaunchDelegate.C_Project_not_specified"), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROJECT);
}
ICProject cproject = getCProject(config);
if (cproject == null) {
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
if (!proj.exists()) {
- abort(LaunchUIPlugin.getFormattedResourceString("AbstractCLaunchDelegate.Project_NAME_does_not_exist", name), null, //$NON-NLS-1$
+ abort(
+ LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_does_not_exist", name), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
} else if (!proj.isOpen()) {
- abort(LaunchUIPlugin.getFormattedResourceString("AbstractCLaunchDelegate.Project_NAME_is_closed", name), null, //$NON-NLS-1$
+ abort(LaunchMessages.getFormattedString("AbstractCLaunchDelegate.Project_NAME_is_closed", name), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
}
- abort(LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Not_a_C_CPP_project"), null, //$NON-NLS-1$
+ abort(LaunchMessages.getString("AbstractCLaunchDelegate.Not_a_C_CPP_project"), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
}
return cproject;
}
- protected IFile getProgramFile(ILaunchConfiguration config) throws CoreException {
+ protected IPath verifyProgramPath(ILaunchConfiguration config) throws CoreException {
ICProject cproject = verifyCProject(config);
- String fileName = getProgramName(config);
- if (fileName == null) {
- abort(LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
+ IPath programPath = getProgramPath(config);
+ if (programPath == null) {
+ abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM);
}
-
- IFile programPath = ((IProject)cproject.getResource()).getFile(fileName);
- if (programPath == null || !programPath.exists() || !programPath.getLocation().toFile().exists()) {
- abort(LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Program_file_does_not_exist"), //$NON-NLS-1$
- new FileNotFoundException(LaunchUIPlugin.getFormattedResourceString(
- "AbstractCLaunchDelegate.PROGRAM_PATH_not_found", programPath.getLocation().toOSString())), //$NON-NLS-1$
+ if (!programPath.isAbsolute()) {
+ IFile wsProgramPath = cproject.getProject().getFile(programPath);
+ programPath = wsProgramPath.getLocation();
+ }
+ if (!programPath.toFile().exists()) {
+ abort(
+ LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), //$NON-NLS-1$
+ new FileNotFoundException(
+ LaunchMessages.getFormattedString(
+ "AbstractCLaunchDelegate.PROGRAM_PATH_not_found", programPath.toOSString())), //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
+
}
return programPath;
}
@@ -485,18 +541,22 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
if (dir.isDirectory()) {
return dir;
}
- abort(LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Working_directory_does_not_exist"), //$NON-NLS-1$
- new FileNotFoundException(LaunchUIPlugin.getFormattedResourceString(
- "AbstractCLaunchDelegate.PROGRAM_PATH_not_found", path.toOSString())), //$NON-NLS-1$
+ abort(
+ LaunchMessages.getString("AbstractCLaunchDelegate.Working_directory_does_not_exist"), //$NON-NLS-1$
+ new FileNotFoundException(
+ LaunchMessages.getFormattedString(
+ "AbstractCLaunchDelegate.PROGRAM_PATH_not_found", path.toOSString())), //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
} else {
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if (res instanceof IContainer && res.exists()) {
return res.getLocation().toFile();
}
- abort(LaunchUIPlugin.getResourceString("AbstractCLaunchDelegate.Working_directory_does_not_exist"), //$NON-NLS-1$
- new FileNotFoundException(LaunchUIPlugin.getFormattedResourceString(
- "AbstractCLaunchDelegate.PROGRAM_PATH_does_not_exist", path.toOSString())), //$NON-NLS-1$
+ abort(
+ LaunchMessages.getString("AbstractCLaunchDelegate.Working_directory_does_not_exist"), //$NON-NLS-1$
+ new FileNotFoundException(
+ LaunchMessages.getFormattedString(
+ "AbstractCLaunchDelegate.PROGRAM_PATH_does_not_exist", path.toOSString())), //$NON-NLS-1$
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
}
}
@@ -669,16 +729,16 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
if (orderedProjects != null) {
- monitor.beginTask(LaunchUIPlugin.getResourceString("AbstractCLaunchConfigurationDelegate.building_projects"), //$NON-NLS-1$
- orderedProjects.size() + 1);
+ monitor.beginTask(LaunchMessages.getString("AbstractCLaunchDelegate.building_projects"), //$NON-NLS-1$
+ orderedProjects.size() + 1);
for (Iterator i = orderedProjects.iterator(); i.hasNext();) {
IProject proj = (IProject)i.next();
- monitor.subTask(LaunchUIPlugin.getResourceString("AbstractCLaunchConfigurationDelegate.building") + proj.getName()); //$NON-NLS-1$
+ monitor.subTask(LaunchMessages.getString("AbstractCLaunchDelegate.building") + proj.getName()); //$NON-NLS-1$
proj.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
}
- monitor.subTask(LaunchUIPlugin.getResourceString("AbstractLaunchConfigurationDelegate.building") + project.getName()); //$NON-NLS-1$
+ monitor.subTask(LaunchMessages.getString("AbstractCLaunchDelegate.building") + project.getName()); //$NON-NLS-1$
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
}
monitor.done();
@@ -701,15 +761,15 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
try {
boolean continueLaunch = true;
if (orderedProjects != null) {
- monitor.beginTask(LaunchUIPlugin.getResourceString("AbstractCLaunchConfigurationDelegate.searching_for_errors"), //$NON-NLS-1$
- orderedProjects.size() + 1);
+ monitor.beginTask(LaunchMessages.getString("AbstractCLaunchDelegate.searching_for_errors"), //$NON-NLS-1$
+ orderedProjects.size() + 1);
boolean compileErrorsInProjs = false;
//check prerequisite projects for compile errors.
for (Iterator i = orderedProjects.iterator(); i.hasNext();) {
IProject proj = (IProject)i.next();
- monitor.subTask(LaunchUIPlugin.getResourceString("AbstractCLaunchConfigurationDelegate.searching_for_errors_in") //$NON-NLS-1$
+ monitor.subTask(LaunchMessages.getString("AbstractCLaunchDelegate.searching_for_errors_in") //$NON-NLS-1$
+ proj.getName());
compileErrorsInProjs = existsErrors(proj);
if (compileErrorsInProjs) {
@@ -719,7 +779,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
//check current project, if prerequite projects were ok
if (!compileErrorsInProjs) {
- monitor.subTask(LaunchUIPlugin.getResourceString("AbstractCLaunchConfigurationDelegate.searching_for_errors_in") //$NON-NLS-1$
+ monitor.subTask(LaunchMessages.getString("AbstractCLaunchDelegate.searching_for_errors_in") //$NON-NLS-1$
+ project.getName());
compileErrorsInProjs = existsErrors(project);
}
@@ -768,7 +828,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
// build project list
if (monitor != null) {
- monitor.subTask(LaunchUIPlugin.getResourceString("AbstractCLaunchConfigurationDelegate.20")); //$NON-NLS-1$
+ monitor.subTask(LaunchMessages.getString("AbstractCLaunchDelegate.20")); //$NON-NLS-1$
}
orderedProjects = null;
ICProject cProject = getCProject(configuration);
@@ -782,4 +842,31 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
return super.preLaunchCheck(configuration, mode, monitor);
}
+ /**
+ * @param project
+ * @param exePath
+ * @return
+ * @throws CoreException
+ */
+ protected IBinaryExecutable createBinary(ICProject project, IPath exePath) throws CoreException {
+ ICExtensionReference[] parserRef = CCorePlugin.getDefault().getBinaryParserExtensions(project.getProject());
+ for (int i = 0; i < parserRef.length; i++) {
+ try {
+ IBinaryParser parser = (IBinaryParser)parserRef[i].createExtension();
+ IBinaryExecutable exe = (IBinaryExecutable)parser.getBinary(exePath);
+ if (exe != null) {
+ return exe;
+ }
+ } catch (ClassCastException e) {
+ } catch (IOException e) {
+ }
+ }
+ IBinaryParser parser = CCorePlugin.getDefault().getDefaultBinaryParser();
+ try {
+ return (IBinaryExecutable)parser.getBinary(exePath);
+ } catch (IOException e) {
+ }
+ return null;
+ }
+
} \ No newline at end of file
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
index c1e8e813c43..5ed40a2ee36 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CApplicationLaunchShortcut.java
@@ -24,11 +24,13 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.ui.CElementLabelProvider;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
@@ -73,7 +75,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
config.launch(mode, null);
}
} catch (CoreException e) {
- LaunchUIPlugin.errorDialog(LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.LaunchFailed"), e.getStatus()); //$NON-NLS-1$
+ LaunchUIPlugin.errorDialog(LaunchMessages.getString("CApplicationLaunchShortcut.LaunchFailed"), e.getStatus()); //$NON-NLS-1$
}
}
@@ -91,10 +93,10 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
candidateConfigs = new ArrayList(configs.length);
for (int i = 0; i < configs.length; i++) {
ILaunchConfiguration config = configs[i];
- String programName = AbstractCLaunchDelegate.getProgramName(config);
+ IPath programPath = AbstractCLaunchDelegate.getProgramPath(config);
String projectName = AbstractCLaunchDelegate.getProjectName(config);
- String name = bin.getResource().getProjectRelativePath().toString();
- if (programName != null && programName.equals(name)) {
+ IPath name = bin.getResource().getProjectRelativePath();
+ if (programPath != null && programPath.equals(name)) {
if (projectName != null && projectName.equals(bin.getCProject().getProject().getName())) {
candidateConfigs.add(config);
}
@@ -228,16 +230,16 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
}
protected String getDebugConfigDialogTitleString(ICDebugConfiguration [] configList, String mode) {
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.LaunchDebugConfigSelection"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.LaunchDebugConfigSelection"); //$NON-NLS-1$
}
protected String getDebugConfigDialogMessageString(ICDebugConfiguration [] configList, String mode) {
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.ChooseConfigToDebug"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.ChooseConfigToDebug"); //$NON-NLS-1$
} else if (mode.equals(ILaunchManager.RUN_MODE)) {
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.ChooseConfigToRun"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.ChooseConfigToRun"); //$NON-NLS-1$
}
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.Invalid_launch_mode_1"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.Invalid_launch_mode_1"); //$NON-NLS-1$
}
@@ -262,16 +264,16 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
}
protected String getLaunchSelectionDialogTitleString(List configList, String mode) {
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.LaunchConfigSelection"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.LaunchConfigSelection"); //$NON-NLS-1$
}
protected String getLaunchSelectionDialogMessageString(List binList, String mode) {
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.ChooseLaunchConfigToDebug"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.ChooseLaunchConfigToDebug"); //$NON-NLS-1$
} else if (mode.equals(ILaunchManager.RUN_MODE)) {
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.ChooseLaunchConfigToRun"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.ChooseLaunchConfigToRun"); //$NON-NLS-1$
}
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.Invalid_launch_mode_2"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.Invalid_launch_mode_2"); //$NON-NLS-1$
}
/**
@@ -310,8 +312,8 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
dialog.setElements(binList.toArray());
dialog.setTitle(getBinarySelectionDialogTitleString(binList, mode)); //$NON-NLS-1$
dialog.setMessage(getBinarySelectionDialogMessageString(binList, mode)); //$NON-NLS-1$
- dialog.setUpperListLabel(LaunchUIPlugin.getResourceString("Launch.common.BinariesColon")); //$NON-NLS-1$
- dialog.setLowerListLabel(LaunchUIPlugin.getResourceString("Launch.common.QualifierColon")); //$NON-NLS-1$
+ dialog.setUpperListLabel(LaunchMessages.getString("Launch.common.BinariesColon")); //$NON-NLS-1$
+ dialog.setLowerListLabel(LaunchMessages.getString("Launch.common.QualifierColon")); //$NON-NLS-1$
dialog.setMultipleSelection(false);
if (dialog.open() == Window.OK) {
return (IBinary) dialog.getFirstResult();
@@ -321,16 +323,16 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
}
protected String getBinarySelectionDialogTitleString(List binList, String mode) {
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.CLocalApplication"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.CLocalApplication"); //$NON-NLS-1$
}
protected String getBinarySelectionDialogMessageString(List binList, String mode) {
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.ChooseLocalAppToDebug"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.ChooseLocalAppToDebug"); //$NON-NLS-1$
} else if (mode.equals(ILaunchManager.RUN_MODE)) {
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.ChooseLocalAppToRun"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.ChooseLocalAppToRun"); //$NON-NLS-1$
}
- return LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.Invalid_launch_mode_3"); //$NON-NLS-1$
+ return LaunchMessages.getString("CApplicationLaunchShortcut.Invalid_launch_mode_3"); //$NON-NLS-1$
}
/**
@@ -386,12 +388,12 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
} catch (InterruptedException e) {
return;
} catch (InvocationTargetException e) {
- MessageDialog.openError(getShell(), LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.Application_Launcher"), e.getMessage()); //$NON-NLS-1$
+ MessageDialog.openError(getShell(), LaunchMessages.getString("CApplicationLaunchShortcut.Application_Launcher"), e.getMessage()); //$NON-NLS-1$
return;
}
int count = results.size();
if (count == 0) {
- MessageDialog.openError(getShell(), LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.Application_Launcher"), LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.Launch_failed_no_binaries")); //$NON-NLS-1$ //$NON-NLS-2$
+ MessageDialog.openError(getShell(), LaunchMessages.getString("CApplicationLaunchShortcut.Application_Launcher"), LaunchMessages.getString("CApplicationLaunchShortcut.Launch_failed_no_binaries")); //$NON-NLS-1$ //$NON-NLS-2$
} else if (count > 1) {
bin = chooseBinary(results, mode);
} else {
@@ -402,7 +404,7 @@ public class CApplicationLaunchShortcut implements ILaunchShortcut {
launch(bin, mode);
}
} else {
- MessageDialog.openError(getShell(), LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.Application_Launcher"), LaunchUIPlugin.getResourceString("CApplicationLaunchShortcut.Launch_failed_no_project_selected")); //$NON-NLS-1$ //$NON-NLS-2$
+ MessageDialog.openError(getShell(), LaunchMessages.getString("CApplicationLaunchShortcut.Application_Launcher"), LaunchMessages.getString("CApplicationLaunchShortcut.Launch_failed_no_project_selected")); //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java
index ba6ed607f6d..43d490a5d90 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/CoreFileLaunchDelegate.java
@@ -1,15 +1,14 @@
-/**********************************************************************
- * Copyright (c) 2002 - 2004 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
+/*******************************************************************************
+ * Copyright (c) 2002 - 2004 QNX Software Systems and others. All rights
+ * reserved. This program and the accompanying materials are 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
*
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
+ * Contributors: QNX Software Systems - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.cdt.launch.internal;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
@@ -18,8 +17,8 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -27,9 +26,11 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
@@ -42,65 +43,75 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
-
- monitor.beginTask(LaunchUIPlugin.getResourceString("CoreFileLaunchDelegate.Launching_postmortem_debugger"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
+ monitor.beginTask(LaunchMessages.getString("CoreFileLaunchDelegate.Launching_postmortem_debugger"), 10); //$NON-NLS-1$
// check for cancellation
if (monitor.isCanceled()) {
return;
}
- IFile exeFile = getProgramFile(config);
+ try {
+ monitor.worked(1);
+ IPath exePath = verifyProgramPath(config);
+ ICProject project = verifyCProject(config);
+ IBinaryExecutable exeFile = createBinary(project, exePath);
- ICDebugConfiguration debugConfig = getDebugConfig(config);
- ICDISession dsession = null;
- ICProject cproject = getCProject(config);
+ ICDebugConfiguration debugConfig = getDebugConfig(config);
+ ICDISession dsession = null;
+ ICProject cproject = getCProject(config);
- IPath corefile = getCoreFilePath((IProject) cproject.getResource());
- if (corefile == null) {
- cancel(LaunchUIPlugin.getResourceString("CoreFileLaunchDelegate.No_Corefile_selected"), ICDTLaunchConfigurationConstants.ERR_NO_COREFILE); //$NON-NLS-1$
- }
- Process debugger = null;
- IProcess debuggerProcess = null;
- try {
- dsession = debugConfig.getDebugger().createCoreSession(config, exeFile, corefile);
- debugger = dsession.getSessionProcess();
- } catch (CDIException e) {
- if (dsession != null) {
+ String path = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null);
+ IPath corefile;
+ if (path == null) {
+ corefile = promptForCoreFilePath((IProject)cproject.getResource());
+ if (corefile == null) {
+ cancel(LaunchMessages.getString("CoreFileLaunchDelegate.No_Corefile_selected"), //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_NO_COREFILE);
+ }
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, corefile.toString());
+ launch(wc, mode, launch, new SubProgressMonitor(monitor, 9));
+ return;
+ }
+ corefile = new Path(path);
+ dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile, new SubProgressMonitor(monitor, 8));
+ try {
+ // set the source locator
+ setDefaultSourceLocator(launch, config);
+ ICDITarget[] targets = dsession.getTargets();
+ for (int i = 0; i < targets.length; i++) {
+ Process process = targets[i].getProcess();
+ IProcess iprocess = null;
+ if (process != null) {
+ iprocess = DebugPlugin.newProcess(launch, process, renderProcessLabel(exePath.toOSString()));
+ }
+ CDIDebugModel.newDebugTarget(launch, project.getProject(), targets[i], renderTargetLabel(debugConfig), iprocess,
+ exeFile, false, false, false);
+ }
+ } catch (CoreException e) {
try {
dsession.terminate();
- } catch (CDIException ex) {
- // ignore
+ } catch (CDIException cdi) {
}
+ throw e;
}
- abort(LaunchUIPlugin.getResourceString("CoreFileLaunchDelegate.Failed_Launching_CDI_Debugger"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
- }
- if ( debugger != null ) {
- debuggerProcess = DebugPlugin.newProcess(launch, debugger, renderDebuggerProcessLabel());
- }
- // set the source locator
- setSourceLocator(launch, config);
- ICDITarget[] dTargets = dsession.getTargets();
- for (int i = 0; i < dTargets.length; ++i) {
- CDIDebugModel.newCoreFileDebugTarget(
- launch,
- dTargets[i],
- renderTargetLabel(debugConfig),
- debuggerProcess,
- exeFile);
+ } finally {
+ monitor.done();
}
- monitor.done();
+
}
- protected IPath getCoreFilePath(final IProject project) throws CoreException {
+ protected IPath promptForCoreFilePath(final IProject project) throws CoreException {
final Shell shell = LaunchUIPlugin.getShell();
- final String res[] = { null };
+ final String res[] = {null};
if (shell == null) {
- abort(LaunchUIPlugin.getResourceString("CoreFileLaunchDelegate.No_Shell_available_in_Launch"), null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
+ abort(LaunchMessages.getString("CoreFileLaunchDelegate.No_Shell_available_in_Launch"), null, //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
Display display = shell.getDisplay();
display.syncExec(new Runnable() {
+
public void run() {
FileDialog dialog = new FileDialog(shell);
- dialog.setText(LaunchUIPlugin.getResourceString("CoreFileLaunchDelegate.Select_Corefile")); //$NON-NLS-1$
+ dialog.setText(LaunchMessages.getString("CoreFileLaunchDelegate.Select_Corefile")); //$NON-NLS-1$
String initPath = null;
try {
@@ -123,4 +134,14 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
public String getPluginID() {
return LaunchUIPlugin.getUniqueIdentifier();
}
-}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.launch.AbstractCLaunchConfigurationDelegate#preLaunchCheck(org.eclipse.debug.core.ILaunchConfiguration,
+ * java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
+ return true; // no pre launch check for core file
+ }
+} \ No newline at end of file
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalAttachLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalAttachLaunchDelegate.java
new file mode 100644
index 00000000000..c3f2fd2620e
--- /dev/null
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalAttachLaunchDelegate.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
+ * program and the accompanying materials are 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
+ *
+ * Contributors: QNX Software Systems - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.cdt.launch.internal;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.IProcessInfo;
+import org.eclipse.cdt.core.IProcessList;
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.ICDebugConfiguration;
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.cdt.launch.internal.ui.LaunchImages;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
+import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.TwoPaneElementSelector;
+
+public class LocalAttachLaunchDelegate extends AbstractCLaunchDelegate {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration,
+ * java.lang.String, org.eclipse.debug.core.ILaunch,
+ * org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
+ monitor.beginTask(LaunchMessages.getString("LocalAttachLaunchDelegate.Attaching_to_Local_C_Application"), 10); //$NON-NLS-1$
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+ try {
+ monitor.worked(1);
+ IPath exePath = verifyProgramPath(config);
+ ICProject project = verifyCProject(config);
+ IBinaryExecutable exeFile = createBinary(project, exePath);
+
+ if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+ ICDebugConfiguration debugConfig = getDebugConfig(config);
+ ICDISession dsession = null;
+ String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
+ if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
+ //It may be that we have already been provided with a
+ // process id
+ if (config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1) == -1) {
+ int pid = promptForProcessID(config);
+ if (pid == -1) {
+ cancel(LaunchMessages.getString("LocalAttachLaunchDelegate.No_Process_ID_selected"), //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID);
+ }
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, pid);
+ wc.launch(mode, new SubProgressMonitor(monitor, 9));
+ } else {
+ dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile,
+ new SubProgressMonitor(monitor, 8));
+ try {
+ // set the default source locator if required
+ setDefaultSourceLocator(launch, config);
+ ICDITarget[] targets = dsession.getTargets();
+ for (int i = 0; i < targets.length; i++) {
+ CDIDebugModel.newDebugTarget(launch, project.getProject(), targets[i],
+ renderTargetLabel(debugConfig), null, exeFile, true, true);
+ }
+ } catch (CoreException e) {
+ try {
+ dsession.terminate();
+ } catch (CDIException ex) {
+ // ignore
+ }
+ throw e;
+ }
+ }
+ }
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+
+ protected int promptForProcessID(ILaunchConfiguration config) throws CoreException {
+ final Shell shell = LaunchUIPlugin.getShell();
+ final int pidResult[] = {-1};
+ if (shell == null) {
+ abort(LaunchMessages.getString("LocalAttachLaunchDelegate.No_Shell_available_in_Launch"), null, //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+ Display display = shell.getDisplay();
+ display.syncExec(new Runnable() {
+
+ public void run() {
+ ILabelProvider provider = new LabelProvider() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ IProcessInfo info = (IProcessInfo)element;
+ IPath path = new Path(info.getName());
+ return path.lastSegment() + " - " + info.getPid(); //$NON-NLS-1$
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element) {
+ return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
+ }
+ };
+ ILabelProvider qprovider = new LabelProvider() {
+
+ public String getText(Object element) {
+ IProcessInfo info = (IProcessInfo)element;
+ return info.getName();
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element) {
+ return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
+ }
+ };
+ TwoPaneElementSelector dialog = new TwoPaneElementSelector(shell, provider, qprovider);
+ dialog.setTitle(LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process")); //$NON-NLS-1$
+ dialog.setMessage(LaunchMessages.getString("LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to")); //$NON-NLS-1$
+ IProcessList plist = null;
+ try {
+ plist = CCorePlugin.getDefault().getProcessList();
+ } catch (CoreException e) {
+ LaunchUIPlugin.errorDialog(
+ LaunchMessages.getString("LocalAttachLaunchDelegate.CDT_Launch_Error"), e.getStatus()); //$NON-NLS-1$
+ }
+ if (plist == null) {
+ MessageDialog.openError(
+ shell,
+ LaunchMessages.getString("LocalAttachLaunchDelegate.CDT_Launch_Error"), LaunchMessages.getString("LocalAttachLaunchDelegate.Platform_cannot_list_processes")); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
+ dialog.setElements(plist.getProcessList());
+ if (dialog.open() == Window.OK) {
+ IProcessInfo info = (IProcessInfo)dialog.getFirstResult();
+ if (info != null) {
+ pidResult[0] = info.getPid();
+ }
+ }
+ }
+ });
+ return pidResult[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.launch.AbstractCLaunchConfigurationDelegate#getPluginID()
+ */
+ protected String getPluginID() {
+ return LaunchUIPlugin.getUniqueIdentifier();
+ }
+} \ No newline at end of file
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java
deleted file mode 100644
index ca54c5eca5e..00000000000
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalCLaunchConfigurationDelegate.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002 - 2004 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.launch.internal;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.Properties;
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.IProcessInfo;
-import org.eclipse.cdt.core.IProcessList;
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
-import org.eclipse.cdt.debug.core.ICDebugConfiguration;
-import org.eclipse.cdt.debug.core.cdi.CDIException;
-import org.eclipse.cdt.debug.core.cdi.ICDIRuntimeOptions;
-import org.eclipse.cdt.debug.core.cdi.ICDISession;
-import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
-import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
-import org.eclipse.cdt.launch.internal.ui.LaunchImages;
-import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
-import org.eclipse.cdt.utils.spawner.ProcessFactory;
-import org.eclipse.core.resources.IFile;
-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.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.IStatusHandler;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.TwoPaneElementSelector;
-
-public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
-
- public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
-
- monitor.beginTask(LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.Launching_Local_C_Application"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- // check for cancellation
- if (monitor.isCanceled()) {
- return;
- }
- IFile exeFile = getProgramFile(config);
- String arguments[] = getProgramArgumentsArray(config);
- ArrayList command = new ArrayList(1 + arguments.length);
- command.add(exeFile.getLocation().toOSString());
- command.addAll(Arrays.asList(arguments));
- String[] commandArray = (String[]) command.toArray(new String[command.size()]);
-
- // set the default source locator if required
- setSourceLocator(launch, config);
-
- if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- IProcess debuggerProcess = null;
- Process debugger;
- ICDebugConfiguration debugConfig = getDebugConfig(config);
- ICDISession dsession = null;
- try {
- String debugMode =
- config.getAttribute(
- ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
- ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
- if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
- dsession = debugConfig.getDebugger().createLaunchSession(config, exeFile);
- ICDIRuntimeOptions opt = dsession.getRuntimeOptions();
- opt.setArguments(getProgramArgumentsArray(config));
- File wd = getWorkingDirectory(config);
- if (wd != null) {
- opt.setWorkingDirectory(wd.getAbsolutePath());
- }
- opt.setEnvironment(expandEnvironment(config));
- debugger = dsession.getSessionProcess();
- if ( debugger != null ) {
- debuggerProcess = DebugPlugin.newProcess(launch, debugger, renderDebuggerProcessLabel());
- }
- ICDITarget[] dtargets = dsession.getTargets();
- for (int i = 0; i < dtargets.length; ++i) {
- ICDITarget dtarget = dtargets[i];
- Process process = dtarget.getProcess();
- IProcess iprocess = DebugPlugin.newProcess(launch, process, renderProcessLabel(commandArray[0]));
- boolean stopInMain = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
- CDIDebugModel.newDebugTarget(
- launch,
- dtarget,
- renderTargetLabel(debugConfig),
- iprocess,
- debuggerProcess,
- exeFile,
- true,
- false,
- stopInMain);
- }
-
- } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
- int pid = getProcessID();
- if (pid == -1) {
- cancel(LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.No_Process_ID_selected"), ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID); //$NON-NLS-1$
- }
- dsession = debugConfig.getDebugger().createAttachSession(config, exeFile, pid);
- debugger = dsession.getSessionProcess();
- if ( debugger != null ) {
- debuggerProcess = DebugPlugin.newProcess(launch, debugger, renderDebuggerProcessLabel());
- launch.removeProcess(debuggerProcess);
- }
- ICDITarget[] dTargets = dsession.getTargets();
- for (int i = 0; i < dTargets.length; ++i) {
- CDIDebugModel.newAttachDebugTarget(
- launch,
- dTargets[i],
- renderTargetLabel(debugConfig),
- debuggerProcess,
- exeFile);
- }
- }
- } catch (CDIException e) {
- if (dsession != null) {
- try {
- dsession.terminate();
- } catch (CDIException ex) {
- // ignore
- }
- }
- abort(LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.Failed_Launching_CDI_Debugger"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
- }
- } else {
- File wd = getWorkingDirectory(config);
- if (wd == null) {
- wd = new File(System.getProperty("user.home", ".")); //NON-NLS-1; //$NON-NLS-1$//$NON-NLS-2$
- }
- Process process = exec(commandArray, getEnvironmentProperty(config), wd);
- DebugPlugin.newProcess(launch, process, renderProcessLabel(commandArray[0]));
- }
-
- monitor.done();
-
- }
-
- private int getProcessID() throws CoreException {
- final Shell shell = LaunchUIPlugin.getShell();
- final int pid[] = { -1 };
- if (shell == null) {
- abort(LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.No_Shell_available_in_Launch"), null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
- }
- Display display = shell.getDisplay();
- display.syncExec(new Runnable() {
- public void run() {
- ILabelProvider provider = new LabelProvider() {
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- IProcessInfo info = (IProcessInfo)element;
- IPath path = new Path(info.getName());
- return path.lastSegment() + " - " + info.getPid(); //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
- }
- };
- ILabelProvider qprovider = new LabelProvider() {
- public String getText(Object element) {
- IProcessInfo info = (IProcessInfo) element;
- return info.getName();
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
- }
- };
- TwoPaneElementSelector dialog = new TwoPaneElementSelector(shell, provider, qprovider);
- dialog.setTitle(LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.Select_Process")); //$NON-NLS-1$
- dialog.setMessage(LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.Select_Process_to_attach_debugger_to")); //$NON-NLS-1$
- IProcessList plist = null;
- try {
- plist = CCorePlugin.getDefault().getProcessList();
- } catch (CoreException e) {
- LaunchUIPlugin.errorDialog(LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.CDT_Launch_Error"), e.getStatus()); //$NON-NLS-1$
- }
- if (plist == null) {
- MessageDialog.openError(shell, LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.CDT_Launch_Error"), LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.Platform_cannot_list_processes")); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- dialog.setElements(plist.getProcessList());
- if (dialog.open() == Window.OK) {
- IProcessInfo info = (IProcessInfo) dialog.getFirstResult();
- if ( info != null ) {
- pid[0] = info.getPid();
- }
- }
- }
- });
- return pid[0];
- }
-
- /**
- * Performs a runtime exec on the given command line in the context
- * of the specified working directory, and returns
- * the resulting process. If the current runtime does not support the
- * specification of a working directory, the status handler for error code
- * <code>ERR_WORKING_DIRECTORY_NOT_SUPPORTED</code> is queried to see if the
- * exec should be re-executed without specifying a working directory.
- *
- * @param cmdLine the command line
- * @param workingDirectory the working directory, or <code>null</code>
- * @return the resulting process or <code>null</code> if the exec is
- * cancelled
- * @see Runtime
- */
- protected Process exec(String[] cmdLine, Properties environ, File workingDirectory) throws CoreException {
- Process p = null;
- Properties props = getDefaultEnvironment();
- props.putAll(expandEnvironment(environ));
- String[] envp = null;
- ArrayList envList = new ArrayList();
- Enumeration names = props.propertyNames();
- if (names != null) {
- while (names.hasMoreElements()) {
- String key = (String) names.nextElement();
- envList.add(key + "=" + props.getProperty(key)); //$NON-NLS-1$
- }
- envp = (String[]) envList.toArray(new String[envList.size()]);
- }
- try {
-
- if (workingDirectory == null) {
- p = ProcessFactory.getFactory().exec(cmdLine, envp);
- } else {
- p = ProcessFactory.getFactory().exec(cmdLine, envp, workingDirectory);
- }
- } catch (IOException e) {
- if (p != null) {
- p.destroy();
- }
- abort(LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.Error_starting_process"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
- } catch (NoSuchMethodError e) {
- //attempting launches on 1.2.* - no ability to set working directory
-
- IStatus status =
- new Status(
- IStatus.ERROR,
- LaunchUIPlugin.getUniqueIdentifier(),
- ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_NOT_SUPPORTED,
- LaunchUIPlugin.getResourceString("LocalCLaunchConfigurationDelegate.Does_not_support_working_dir"), //$NON-NLS-1$
- e);
- IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(status);
-
- if (handler != null) {
- Object result = handler.handleStatus(status, this);
- if (result instanceof Boolean && ((Boolean) result).booleanValue()) {
- p = exec(cmdLine, environ, null);
- }
- }
- }
- return p;
- }
-
- protected String getPluginID() {
- return LaunchUIPlugin.getUniqueIdentifier();
- }
-
-}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalRunLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalRunLaunchDelegate.java
new file mode 100644
index 00000000000..4c48ba7516d
--- /dev/null
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/LocalRunLaunchDelegate.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2002 - 2004 QNX Software Systems and others. All rights
+ * reserved. This program and the accompanying materials are 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
+ *
+ * Contributors: QNX Software Systems - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.cdt.launch.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.ICDebugConfiguration;
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+import org.eclipse.cdt.debug.core.cdi.ICDIRuntimeOptions;
+import org.eclipse.cdt.debug.core.cdi.ICDISession;
+import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
+import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.cdt.utils.spawner.ProcessFactory;
+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.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.debug.core.model.IProcess;
+
+public class LocalRunLaunchDelegate extends AbstractCLaunchDelegate {
+
+ public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+ monitor.beginTask(LaunchMessages.getString("LocalRunLaunchDelegate.Launching_Local_C_Application"), 10); //$NON-NLS-1$
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+ try {
+ monitor.worked(1);
+ IPath exePath = verifyProgramPath(config);
+ ICProject project = verifyCProject(config);
+ IBinaryExecutable exeFile = createBinary(project, exePath);
+ String arguments[] = getProgramArgumentsArray(config);
+
+ // set the default source locator if required
+ setDefaultSourceLocator(launch, config);
+
+ if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+ ICDebugConfiguration debugConfig = getDebugConfig(config);
+ ICDISession dsession = null;
+ String debugMode = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
+ if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
+ dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile, new SubProgressMonitor(monitor, 8));
+ try {
+ ICDIRuntimeOptions opt = dsession.getRuntimeOptions();
+ opt.setArguments(arguments);
+ File wd = getWorkingDirectory(config);
+ if (wd != null) {
+ opt.setWorkingDirectory(wd.getAbsolutePath());
+ }
+ opt.setEnvironment(expandEnvironment(config));
+ } catch (CDIException e) {
+ try {
+ dsession.terminate();
+ } catch (CDIException ex) {
+ // ignore
+ }
+ abort(LaunchMessages.getString("LocalRunLaunchDelegate.Failed_setting_runtime_option_though_debugger"), e, //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+ monitor.worked(1);
+ try {
+ boolean stopInMain = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
+
+ ICDITarget[] targets = dsession.getTargets();
+ for (int i = 0; i < targets.length; i++) {
+ Process process = targets[i].getProcess();
+ IProcess iprocess = null;
+ if (process != null) {
+ iprocess = DebugPlugin.newProcess(launch, process, renderProcessLabel(exePath.toOSString()));
+ }
+ CDIDebugModel.newDebugTarget(launch, project.getProject(), targets[i], renderTargetLabel(debugConfig),
+ iprocess, exeFile, true, false, stopInMain);
+ }
+ } catch (CoreException e) {
+ try {
+ dsession.terminate();
+ } catch (CDIException e1) {
+ // ignore
+ }
+ throw e;
+ }
+ }
+ } else {
+ File wd = getWorkingDirectory(config);
+ if (wd == null) {
+ wd = new File(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ ArrayList command = new ArrayList(1 + arguments.length);
+ command.add(exePath.toOSString());
+ command.addAll(Arrays.asList(arguments));
+ String[] commandArray = (String[])command.toArray(new String[command.size()]);
+ monitor.worked(5);
+ Process process = exec(commandArray, getEnvironmentProperty(config), wd);
+ monitor.worked(3);
+ DebugPlugin.newProcess(launch, process, renderProcessLabel(commandArray[0]));
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /**
+ * Performs a runtime exec on the given command line in the context of the
+ * specified working directory, and returns the resulting process. If the
+ * current runtime does not support the specification of a working
+ * directory, the status handler for error code
+ * <code>ERR_WORKING_DIRECTORY_NOT_SUPPORTED</code> is queried to see if
+ * the exec should be re-executed without specifying a working directory.
+ *
+ * @param cmdLine
+ * the command line
+ * @param workingDirectory
+ * the working directory, or <code>null</code>
+ * @return the resulting process or <code>null</code> if the exec is
+ * cancelled
+ * @see Runtime
+ */
+ protected Process exec(String[] cmdLine, Properties environ, File workingDirectory) throws CoreException {
+ Process p = null;
+ Properties props = getDefaultEnvironment();
+ props.putAll(expandEnvironment(environ));
+ String[] envp = null;
+ ArrayList envList = new ArrayList();
+ Enumeration names = props.propertyNames();
+ if (names != null) {
+ while (names.hasMoreElements()) {
+ String key = (String)names.nextElement();
+ envList.add(key + "=" + props.getProperty(key)); //$NON-NLS-1$
+ }
+ envp = (String[])envList.toArray(new String[envList.size()]);
+ }
+ try {
+
+ if (workingDirectory == null) {
+ p = ProcessFactory.getFactory().exec(cmdLine, envp);
+ } else {
+ p = ProcessFactory.getFactory().exec(cmdLine, envp, workingDirectory);
+ }
+ } catch (IOException e) {
+ if (p != null) {
+ p.destroy();
+ }
+ abort(LaunchMessages.getString("LocalRunLaunchDelegate.Error_starting_process"), e, //$NON-NLS-1$
+ ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ } catch (NoSuchMethodError e) {
+ //attempting launches on 1.2.* - no ability to set working
+ // directory
+
+ IStatus status = new Status(IStatus.ERROR, LaunchUIPlugin.getUniqueIdentifier(),
+ ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_NOT_SUPPORTED,
+ LaunchMessages.getString("LocalRunLaunchDelegate.Does_not_support_working_dir"), //$NON-NLS-1$
+ e);
+ IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(status);
+
+ if (handler != null) {
+ Object result = handler.handleStatus(status, this);
+ if (result instanceof Boolean && ((Boolean)result).booleanValue()) {
+ p = exec(cmdLine, environ, null);
+ }
+ }
+ }
+ return p;
+ }
+
+ protected String getPluginID() {
+ return LaunchUIPlugin.getUniqueIdentifier();
+ }
+} \ No newline at end of file
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java
index 655d191fbb7..004275d5927 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/AbstractCDebuggerTab.java
@@ -1,13 +1,11 @@
-/**********************************************************************
- * Copyright (c) 2002 - 2004 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
+/*******************************************************************************
+ * Copyright (c) 2002 - 2004 QNX Software Systems and others. All rights
+ * reserved. This program and the accompanying materials are 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
*
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
+ * Contributors: QNX Software Systems - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.cdt.launch.internal.ui;
import java.util.Map;
@@ -20,9 +18,17 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
@@ -34,6 +40,9 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
protected ILaunchConfigurationTab fDynamicTab;
protected Composite fDynamicTabHolder;
private boolean fInitDefaults;
+ private Combo fDCombo;
+ private boolean fIsInitializing = false;
+ private boolean fPageUpdated;
protected void setDebugConfig(ICDebugConfiguration config) {
fCurrentDebugConfig = config;
@@ -65,7 +74,7 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
protected void setLaunchConfiguration(ILaunchConfiguration launchConfiguration) {
fLaunchConfiguration = launchConfiguration;
- setLaunchConfigurationWorkingCopy( null );
+ setLaunchConfigurationWorkingCopy(null);
}
protected ILaunchConfiguration getLaunchConfiguration() {
@@ -77,13 +86,14 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
}
/**
- * Overridden here so that any error message in the dynamic UI gets returned.
+ * Overridden here so that any error message in the dynamic UI gets
+ * returned.
*
* @see ILaunchConfigurationTab#getErrorMessage()
*/
public String getErrorMessage() {
ILaunchConfigurationTab tab = getDynamicTab();
- if ((super.getErrorMessage() != null) || (tab == null)) {
+ if ( (super.getErrorMessage() != null) || (tab == null)) {
return super.getErrorMessage();
}
return tab.getErrorMessage();
@@ -101,11 +111,11 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
// remove any debug specfic args from the config
if (wc == null) {
if (getLaunchConfiguration().isWorkingCopy()) {
- wc = (ILaunchConfigurationWorkingCopy) getLaunchConfiguration();
+ wc = (ILaunchConfigurationWorkingCopy)getLaunchConfiguration();
}
}
if (wc != null) {
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map) null);
+ wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map)null);
}
} else {
if (wc == null) {
@@ -150,7 +160,7 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
try {
tab = CDebugUIPlugin.getDefault().getDebuggerPage(debugConfig.getID());
} catch (CoreException e) {
- LaunchUIPlugin.errorDialog(LaunchUIPlugin.getResourceString("AbstractCDebuggerTab.ErrorLoadingDebuggerPage"), e.getStatus()); //$NON-NLS-1$
+ LaunchUIPlugin.errorDialog(LaunchMessages.getString("AbstractCDebuggerTab.ErrorLoadingDebuggerPage"), e.getStatus()); //$NON-NLS-1$
}
setDynamicTab(tab);
}
@@ -165,17 +175,15 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
getDynamicTabHolder().layout(true);
}
- abstract protected ICDebugConfiguration getConfigForCurrentDebugger();
abstract public void createControl(Composite parent);
-
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
ILaunchConfigurationTab dynamicTab = getDynamicTab();
if (dynamicTab != null) {
dynamicTab.activated(workingCopy);
}
}
-
+
public void initializeFrom(ILaunchConfiguration config) {
setLaunchConfiguration(config);
ILaunchConfigurationTab dynamicTab = getDynamicTab();
@@ -189,7 +197,7 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebugConfig().getID());
ILaunchConfigurationTab dynamicTab = getDynamicTab();
if (dynamicTab == null) {
- config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map) null);
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map)null);
} else {
dynamicTab.performApply(config);
}
@@ -209,7 +217,7 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
setErrorMessage(null);
setMessage(null);
if (getDebugConfig() == null) {
- setErrorMessage(LaunchUIPlugin.getResourceString("AbstractCDebuggerTab.No_debugger_available")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("AbstractCDebuggerTab.No_debugger_available")); //$NON-NLS-1$
return false;
}
@@ -233,7 +241,88 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
}
public String getName() {
- return LaunchUIPlugin.getResourceString("AbstractCDebuggerTab.Debugger"); //$NON-NLS-1$
+ return LaunchMessages.getString("AbstractCDebuggerTab.Debugger"); //$NON-NLS-1$
+ }
+
+ protected void createDebuggerCombo(Composite parent, int colspan) {
+ Composite comboComp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ comboComp.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = colspan;
+ comboComp.setLayoutData(gd);
+ Label dlabel = new Label(comboComp, SWT.NONE);
+ dlabel.setText(LaunchMessages.getString("Launch.common.DebuggerColon")); //$NON-NLS-1$
+ fDCombo = new Combo(comboComp, SWT.READ_ONLY | SWT.DROP_DOWN);
+ fDCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fDCombo.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ if (!isInitializing()) {
+ setInitializeDefault(true);
+ updateComboFromSelection();
+ }
+ }
+ });
+ }
+
+ protected void loadDebuggerCombo(ICDebugConfiguration[] debugConfigs, String current) {
+ fDCombo.removeAll();
+
+ for (int i = 0; i < debugConfigs.length; i++) {
+ fDCombo.add(debugConfigs[i].getName());
+ fDCombo.setData(Integer.toString(i), debugConfigs[i]);
+ }
+
+ fPageUpdated = false;
+ fDCombo.setText(current);
+ //The behaviour is undefined for if the callbacks should be triggered
+ // for this,
+ //so force page update if needed.
+ if (!fPageUpdated) {
+ updateComboFromSelection();
+ }
+ fPageUpdated = false;
+ getControl().getParent().layout(true);
+
+ }
+
+ protected void createDebuggerGroup(Composite parent, int colspan) {
+ Group debuggerGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ debuggerGroup.setText(LaunchMessages.getString("CDebuggerTab.Debugger_Options")); //$NON-NLS-1$
+ setDynamicTabHolder(debuggerGroup);
+ GridLayout tabHolderLayout = new GridLayout();
+ tabHolderLayout.marginHeight = 0;
+ tabHolderLayout.marginWidth = 0;
+ tabHolderLayout.numColumns = 1;
+ getDynamicTabHolder().setLayout(tabHolderLayout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = colspan;
+ getDynamicTabHolder().setLayoutData(gd);
+ }
+
+ protected void updateComboFromSelection() {
+ fPageUpdated = true;
+ handleDebuggerChanged();
+ updateLaunchConfigurationDialog();
+ }
+
+ protected boolean isInitializing() {
+ return fIsInitializing;
+ }
+
+ protected void setInitializing(boolean isInitializing) {
+ fIsInitializing = isInitializing;
+ }
+
+ /**
+ * Return the class that implements <code>ILaunchConfigurationTab</code>
+ * that is registered against the debugger id of the currently selected
+ * debugger.
+ */
+ protected ICDebugConfiguration getConfigForCurrentDebugger() {
+ int selectedIndex = fDCombo.getSelectionIndex();
+ return (ICDebugConfiguration)fDCombo.getData(Integer.toString(selectedIndex));
}
-}
+} \ No newline at end of file
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFileCLaunchConfigurationTabGroup.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFileLaunchConfigurationTabGroup.java
index 90f44e3bfca..f0c6759c0af 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFileCLaunchConfigurationTabGroup.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/CoreFileLaunchConfigurationTabGroup.java
@@ -20,7 +20,7 @@ import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
-public class CoreFileCLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
+public class CoreFileLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java
new file mode 100644
index 00000000000..3e095289b81
--- /dev/null
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
+ * program and the accompanying materials are 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
+ *
+ * Contributors: QNX Software Systems - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.cdt.launch.internal.ui;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class LaunchMessages {
+
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.launch.internal.ui.LaunchMessages";//$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private LaunchMessages() {
+ }
+
+ public static String getFormattedString(String key, String arg) {
+ return MessageFormat.format(getString(key), new String[]{arg});
+ }
+
+ public static String getFormattedString(String key, String[] args) {
+ return MessageFormat.format(getString(key), args);
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+} \ No newline at end of file
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPluginResources.properties b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
index fad346d7564..ee804842102 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPluginResources.properties
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchMessages.properties
@@ -20,25 +20,27 @@ AbstractCLaunchDelegate.Project_NAME_is_closed=Project {0} is closed
AbstractCLaunchDelegate.PROGRAM_PATH_not_found={0} not found
AbstractCLaunchDelegate.PROGRAM_PATH_does_not_exist={0} Does not exist.
AbstractCLaunchDelegate.Debugger_Process=Debugger Process
-AbstractCLaunchConfigurationDelegate.building_projects=Building prerequisite project list
-AbstractCLaunchConfigurationDelegate.building=Building
-AbstractCLaunchConfigurationDelegate.searching_for_errors=Searching for compile errors
-AbstractCLaunchConfigurationDelegate.searching_for_errors_in=Searching for compile errors in
+AbstractCLaunchDelegate.building_projects=Building prerequisite project list
+AbstractCLaunchDelegate.building=Building
+AbstractCLaunchDelegate.searching_for_errors=Searching for compile errors
+AbstractCLaunchDelegate.searching_for_errors_in=Searching for compile errors in
+AbstractCLaunchDelegate.20=Building prerequisite project list
-LocalCLaunchConfigurationDelegate.Launching_Local_C_Application=Launching Local C Application
-LocalCLaunchConfigurationDelegate.No_Process_ID_selected=No Process ID selected
-LocalCLaunchConfigurationDelegate.Failed_Launching_CDI_Debugger=Failed Launching CDI Debugger
-LocalCLaunchConfigurationDelegate.No_Shell_available_in_Launch=No Shell available in Launch
-LocalCLaunchConfigurationDelegate.Select_Process=Select Process
-LocalCLaunchConfigurationDelegate.CDT_Launch_Error=CDT Launch Error
-LocalCLaunchConfigurationDelegate.Platform_cannot_list_processes=Current platform does not support listing processes
-LocalCLaunchConfigurationDelegate.Error_starting_process=Error starting process
-LocalCLaunchConfigurationDelegate.Does_not_support_working_dir=Eclipse runtime does not support working directory
-LocalCLaunchConfigurationDelegate.Select_Process_to_attach_debugger_to=Select a Process to attach debugger to:
+LocalRunLaunchDelegate.Launching_Local_C_Application=Launching Local C/C++ Application
+LocalRunLaunchDelegate.Failed_setting_runtime_option_though_debugger=Failed to set program arguments, environemt or working directory.
+LocalRunLaunchDelegate.Error_starting_process=Error starting process
+LocalRunLaunchDelegate.Does_not_support_working_dir=Eclipse runtime does not support working directory
+
+LocalAttachLaunchDelegate.Attaching_to_Local_C_Application=Attaching to Local C/C++ Application
+LocalAttachLaunchDelegate.No_Process_ID_selected=No Process ID selected
+LocalAttachLaunchDelegate.No_Shell_available_in_Launch=No Shell available in Launch
+LocalAttachLaunchDelegate.Select_Process=Select Process
+LocalAttachLaunchDelegate.Platform_cannot_list_processes=Current platform does not support listing processes
+LocalAttachLaunchDelegate.Select_Process_to_attach_debugger_to=Select a Process to attach debugger to:
+LocalAttachLaunchDelegate.CDT_Launch_Error=CDT Launch Error
CoreFileLaunchDelegate.Launching_postmortem_debugger=Launching postmortem debugger
CoreFileLaunchDelegate.No_Corefile_selected=No Corefile selected
-CoreFileLaunchDelegate.Failed_Launching_CDI_Debugger=Failed Launching CDI Debugger
CoreFileLaunchDelegate.No_Shell_available_in_Launch=No Shell available in Launch
CoreFileLaunchDelegate.Select_Corefile=Select Corefile
@@ -67,9 +69,6 @@ LaunchUIPlugin.Error=Error
CSourceLookupTab.Source=Source
-CorefileDebuggerTab.Debugger_Options=Debugger Options
-CorefileDebuggerTab.No_debugger_available=No debugger available
-
CMainTab.Project_required=Project required
CMainTab.Enter_project_before_searching_for_program=Project must first be entered before searching for a program
CMainTab.Program_Selection=Program Selection
@@ -90,7 +89,6 @@ CMainTab.Search...=Searc&h...
CMainTab.Choose_program_to_run=Choose a &program to run:
CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
-CDebuggerTab.Attach_to_running_process=Attach to running process
CDebuggerTab.Advanced_Options_Dialog_Title=Advanced Options
CDebuggerTab.Stop_at_main_on_startup=Stop at main() on startup
CDebuggerTab.Automatically_track_values_of=Automatically track the values of
@@ -101,6 +99,10 @@ CDebuggerTab.Variables=Variables
CDebuggerTab.Registers=Registers
CDebuggerTab.No_debugger_available=No debugger available
CDebuggerTab.CPU_is_not_supported=The CPU is not supported by selected debugger.
+CDebuggerTab.Platform_is_not_supported=The project platform is not supported by the selected debugger.
+
+CoreFileDebuggerTab.No_debugger_available=No debugger available
+CoreFileDebuggerTab.platform_is_not_supported=The project platform is not supported by the selected debugger.
CEnvironmentTab.Edit_Variable=Edit Variable
CEnvironmentTab.New_Variable=New Variable
@@ -136,4 +138,4 @@ Launch.common.BinariesColon=Binaries:
Launch.common.QualifierColon=Qualifier:
Launch.common.Browse_1=&Browse
Launch.common.Browse_2=B&rowse
-Launch.common.Project_does_not_exist=Project does not exist \ No newline at end of file
+Launch.common.Project_does_not_exist=Project does not exist
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java
index 297a7ae6b9b..d78abc000d4 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LaunchUIPlugin.java
@@ -1,19 +1,13 @@
-/**********************************************************************
- * Copyright (c) 2002 - 2004 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
+/*******************************************************************************
+ * Copyright (c) 2002 - 2004 QNX Software Systems and others. All rights
+ * reserved. This program and the accompanying materials are 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
*
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
+ * Contributors: QNX Software Systems - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.cdt.launch.internal.ui;
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
import org.eclipse.core.resources.IResource;
@@ -31,27 +25,12 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
-public class LaunchUIPlugin extends AbstractUIPlugin
- implements
- IDebugEventSetListener {
- public static final String PLUGIN_ID = "org.eclipse.cdt.launch"; //$NON-NLS-1$
+public class LaunchUIPlugin extends AbstractUIPlugin implements IDebugEventSetListener {
- private static final String BUNDLE_NAME = "org.eclipse.cdt.launch.internal.ui.LaunchUIPluginResources";//$NON-NLS-1$
- private static ResourceBundle resourceBundle = null;
+ public static final String PLUGIN_ID = "org.eclipse.cdt.launch"; //$NON-NLS-1$
// -------- static methods --------
- static {
- if (resourceBundle == null) {
- // Acquire a reference to the .properties file for this plug-in
- try {
- resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
- } catch (MissingResourceException e) {
- resourceBundle = null;
- }
- }
- }
-
/**
* Launch UI plug-in instance
*/
@@ -133,8 +112,7 @@ public class LaunchUIPlugin extends AbstractUIPlugin
* the error message to log
*/
public static void logErrorMessage(String message) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR,
- message, null));
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
}
/**
@@ -144,8 +122,7 @@ public class LaunchUIPlugin extends AbstractUIPlugin
* the exception to be logged
*/
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e
- .getMessage(), e)); //$NON-NLS-1$
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, e.getMessage(), e)); //$NON-NLS-1$
}
/**
@@ -182,11 +159,7 @@ public class LaunchUIPlugin extends AbstractUIPlugin
log(status);
Shell shell = getActiveWorkbenchShell();
if (shell != null) {
- ErrorDialog
- .openError(
- shell,
- LaunchUIPlugin
- .getResourceString("LaunchUIPlugin.Error"), message, status); //$NON-NLS-1$
+ ErrorDialog.openError(shell, LaunchMessages.getString("LaunchUIPlugin.Error"), message, status); //$NON-NLS-1$
}
}
@@ -194,13 +167,8 @@ public class LaunchUIPlugin extends AbstractUIPlugin
log(t);
Shell shell = getActiveWorkbenchShell();
if (shell != null) {
- IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(),
- 1, t.getMessage(), null); //$NON-NLS-1$
- ErrorDialog
- .openError(
- shell,
- LaunchUIPlugin
- .getResourceString("LaunchUIPlugin.Error"), message, status); //$NON-NLS-1$
+ IStatus status = new Status(IStatus.ERROR, getUniqueIdentifier(), 1, t.getMessage(), null); //$NON-NLS-1$
+ ErrorDialog.openError(shell, LaunchMessages.getString("LaunchUIPlugin.Error"), message, status); //$NON-NLS-1$
}
}
@@ -237,17 +205,15 @@ public class LaunchUIPlugin extends AbstractUIPlugin
if (events[i].getKind() == DebugEvent.TERMINATE) {
Object o = events[i].getSource();
if (o instanceof IProcess) {
- IProcess proc = (IProcess) o;
+ IProcess proc = (IProcess)o;
ICProject cproject = null;
try {
- cproject = AbstractCLaunchDelegate.getCProject(proc
- .getLaunch().getLaunchConfiguration());
+ cproject = AbstractCLaunchDelegate.getCProject(proc.getLaunch().getLaunchConfiguration());
} catch (CoreException e) {
}
if (cproject != null) {
try {
- cproject.getProject().refreshLocal(
- IResource.DEPTH_INFINITE, null);
+ cproject.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
}
}
@@ -255,38 +221,4 @@ public class LaunchUIPlugin extends AbstractUIPlugin
}
}
}
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- public static String getResourceString(String key) {
- ResourceBundle bundle = LaunchUIPlugin.getDefault().getResourceBundle();
-
- // No point trying if bundle is null as exceptions are costly
- if (bundle != null) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- } catch (NullPointerException e) {
- return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- // If we get here, then bundle is null.
- return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public static String getFormattedResourceString(String key, String arg) {
- return MessageFormat.format(getResourceString(key), new String[]{arg});
- }
-
- public static String getFormattedResourceString(String key, String[] args) {
- return MessageFormat.format(getResourceString(key), args);
- }
-
} \ No newline at end of file
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalAttachLaunchConfigurationTabGroup.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalAttachLaunchConfigurationTabGroup.java
new file mode 100644
index 00000000000..ec8b9d75ebd
--- /dev/null
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalAttachLaunchConfigurationTabGroup.java
@@ -0,0 +1,35 @@
+/**********************************************************************
+ * Copyright (c) 2002 - 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.launch.internal.ui;
+
+import org.eclipse.cdt.launch.ui.CDebuggerTab;
+import org.eclipse.cdt.launch.ui.CMainTab;
+import org.eclipse.cdt.launch.ui.CSourceLookupTab;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+
+public class LocalAttachLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new CMainTab(),
+ new CDebuggerTab(true),
+ new CSourceLookupTab(),
+ new CommonTab()
+ };
+ setTabs(tabs);
+ }
+}
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalCLaunchConfigurationTabGroup.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalRunLaunchConfigurationTabGroup.java
index a70f4d18d0d..154aa25287d 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalCLaunchConfigurationTabGroup.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/LocalRunLaunchConfigurationTabGroup.java
@@ -20,7 +20,7 @@ import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
-public class LocalCLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
+public class LocalRunLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
@@ -30,7 +30,7 @@ public class LocalCLaunchConfigurationTabGroup extends AbstractLaunchConfigurati
new CMainTab(),
new CArgumentsTab(),
new CEnvironmentTab(),
- new CDebuggerTab(),
+ new CDebuggerTab(false),
new CSourceLookupTab(),
new CommonTab()
};
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java
index 3e038fe8cad..3eaf00c44ff 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/WorkingDirectoryBlock.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -85,13 +86,13 @@ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab {
setControl(workingDirComp);
fWorkingDirLabel = new Label(workingDirComp, SWT.NONE);
- fWorkingDirLabel.setText(LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.Wor&king_directory")); //$NON-NLS-1$
+ fWorkingDirLabel.setText(LaunchMessages.getString("WorkingDirectoryBlock.Wor&king_directory")); //$NON-NLS-1$
gd = new GridData();
gd.horizontalSpan = 3;
fWorkingDirLabel.setLayoutData(gd);
fUseDefaultWorkingDirButton = new Button(workingDirComp,SWT.CHECK);
- fUseDefaultWorkingDirButton.setText(LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.Use_de&fault_working_directory")); //$NON-NLS-1$
+ fUseDefaultWorkingDirButton.setText(LaunchMessages.getString("WorkingDirectoryBlock.Use_de&fault_working_directory")); //$NON-NLS-1$
gd = new GridData();
gd.horizontalSpan = 3;
fUseDefaultWorkingDirButton.setLayoutData(gd);
@@ -101,7 +102,7 @@ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab {
}
});
- fLocalDirButton = createRadioButton(workingDirComp, LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.&Local_directory")); //$NON-NLS-1$
+ fLocalDirButton = createRadioButton(workingDirComp, LaunchMessages.getString("WorkingDirectoryBlock.&Local_directory")); //$NON-NLS-1$
fLocalDirButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleLocationButtonSelected();
@@ -117,14 +118,14 @@ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab {
}
});
- fWorkingDirBrowseButton = createPushButton(workingDirComp, LaunchUIPlugin.getResourceString("Launch.common.Browse_1"), null); //$NON-NLS-1$
+ fWorkingDirBrowseButton = createPushButton(workingDirComp, LaunchMessages.getString("Launch.common.Browse_1"), null); //$NON-NLS-1$
fWorkingDirBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleWorkingDirBrowseButtonSelected();
}
});
- fWorkspaceDirButton = createRadioButton(workingDirComp, LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.Works&pace")); //$NON-NLS-1$
+ fWorkspaceDirButton = createRadioButton(workingDirComp, LaunchMessages.getString("WorkingDirectoryBlock.Works&pace")); //$NON-NLS-1$
fWorkspaceDirButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleLocationButtonSelected();
@@ -140,7 +141,7 @@ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab {
}
});
- fWorkspaceDirBrowseButton = createPushButton(workingDirComp, LaunchUIPlugin.getResourceString("Launch.common.Browse_2"), null); //$NON-NLS-1$
+ fWorkspaceDirBrowseButton = createPushButton(workingDirComp, LaunchMessages.getString("Launch.common.Browse_2"), null); //$NON-NLS-1$
fWorkspaceDirBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
handleWorkspaceDirBrowseButtonSelected();
@@ -160,7 +161,7 @@ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab {
*/
protected void handleWorkingDirBrowseButtonSelected() {
DirectoryDialog dialog = new DirectoryDialog(getShell());
- dialog.setMessage(LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.Select_&working_directory_for_launch_configuration")); //$NON-NLS-1$
+ dialog.setMessage(LaunchMessages.getString("WorkingDirectoryBlock.Select_&working_directory_for_launch_configuration")); //$NON-NLS-1$
String currentWorkingDir = fWorkingDirText.getText();
if (!currentWorkingDir.trim().equals(EMPTY_STRING)) {
File path = new File(currentWorkingDir);
@@ -183,7 +184,7 @@ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
ResourcesPlugin.getWorkspace().getRoot(),
false,
- LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.Select_&workspace_relative_working_directory")); //$NON-NLS-1$
+ LaunchMessages.getString("WorkingDirectoryBlock.Select_&workspace_relative_working_directory")); //$NON-NLS-1$
IContainer currentContainer = getContainer();
if (currentContainer != null) {
@@ -291,17 +292,17 @@ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab {
if (workingDirPath.length() > 0) {
File dir = new File(workingDirPath);
if (!dir.exists()) {
- setErrorMessage(LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.Working_directory_does_not_exist")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("WorkingDirectoryBlock.Working_directory_does_not_exist")); //$NON-NLS-1$
return false;
}
if (!dir.isDirectory()) {
- setErrorMessage(LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.Working_directory_is_not_a_directory")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("WorkingDirectoryBlock.Working_directory_is_not_a_directory")); //$NON-NLS-1$
return false;
}
}
} else {
if (getContainer() == null) {
- setErrorMessage(LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.Project_or_folder_does_not_exist")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("WorkingDirectoryBlock.Project_or_folder_does_not_exist")); //$NON-NLS-1$
return false;
}
}
@@ -345,7 +346,7 @@ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab {
}
handleUseDefaultWorkingDirButtonSelected();
} catch (CoreException e) {
- setErrorMessage(LaunchUIPlugin.getFormattedResourceString("Launch.common.Exception_occurred_reading_configuration_EXCEPTION", e.getStatus().getMessage())); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getFormattedString("Launch.common.Exception_occurred_reading_configuration_EXCEPTION", e.getStatus().getMessage())); //$NON-NLS-1$
LaunchUIPlugin.log(e);
}
}
@@ -384,7 +385,7 @@ public class WorkingDirectoryBlock extends AbstractLaunchConfigurationTab {
* @see ILaunchConfigurationTab#getName()
*/
public String getName() {
- return LaunchUIPlugin.getResourceString("WorkingDirectoryBlock.Working_Directory"); //$NON-NLS-1$
+ return LaunchMessages.getString("WorkingDirectoryBlock.Working_Directory"); //$NON-NLS-1$
}
/**
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java
index 484f7f4adfb..c489ed2dd7d 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CArgumentsTab.java
@@ -12,12 +12,14 @@ package org.eclipse.cdt.launch.ui;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.launch.internal.ui.WorkingDirectoryBlock;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -63,7 +65,7 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
createVerticalSpacer(comp, 1);
fPrgmArgumentsLabel = new Label(comp, SWT.NONE);
- fPrgmArgumentsLabel.setText(LaunchUIPlugin.getResourceString("CArgumentsTab.C/C++_Program_Arguments")); //$NON-NLS-1$
+ fPrgmArgumentsLabel.setText(LaunchMessages.getString("CArgumentsTab.C/C++_Program_Arguments")); //$NON-NLS-1$
fPrgmArgumentsText = new Text(comp, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 40;
@@ -111,7 +113,7 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
fWorkingDirectoryBlock.initializeFrom(configuration);
}
catch (CoreException e) {
- setErrorMessage(LaunchUIPlugin.getFormattedResourceString("Launch.common.Exception_occurred_reading_configuration_EXCEPTION", e.getStatus().getMessage())); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getFormattedString("Launch.common.Exception_occurred_reading_configuration_EXCEPTION", e.getStatus().getMessage())); //$NON-NLS-1$
LaunchUIPlugin.log(e);
}
}
@@ -143,7 +145,7 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
* @see ILaunchConfigurationTab#getName()
*/
public String getName() {
- return LaunchUIPlugin.getResourceString("CArgumentsTab.Arguments"); //$NON-NLS-1$
+ return LaunchMessages.getString("CArgumentsTab.Arguments"); //$NON-NLS-1$
}
/**
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
index 2e05eedd040..43ecf617cfc 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CDebuggerTab.java
@@ -11,10 +11,13 @@
package org.eclipse.cdt.launch.ui;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
@@ -22,25 +25,21 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
import org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab;
-import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.help.WorkbenchHelp;
@@ -65,14 +64,14 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
protected Control createDialogArea( Composite parent ) {
Composite composite = (Composite)super.createDialogArea( parent );
Group group = new Group( composite, SWT.NONE );
- group.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Automatically_track_values_of" ) ); //$NON-NLS-1$
+ group.setText( LaunchMessages.getString( "CDebuggerTab.Automatically_track_values_of" ) ); //$NON-NLS-1$
GridLayout layout = new GridLayout();
group.setLayout( layout );
group.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
fVarBookKeeping = new Button( group, SWT.CHECK );
- fVarBookKeeping.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Variables" ) ); //$NON-NLS-1$
+ fVarBookKeeping.setText( LaunchMessages.getString( "CDebuggerTab.Variables" ) ); //$NON-NLS-1$
fRegBookKeeping = new Button( group, SWT.CHECK );
- fRegBookKeeping.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Registers" ) ); //$NON-NLS-1$
+ fRegBookKeeping.setText( LaunchMessages.getString( "CDebuggerTab.Registers" ) ); //$NON-NLS-1$
initialize();
return composite;
}
@@ -104,21 +103,23 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
*/
protected void configureShell( Shell newShell ) {
super.configureShell( newShell );
- newShell.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Advanced_Options_Dialog_Title" ) ); //$NON-NLS-1$
+ newShell.setText( LaunchMessages.getString( "CDebuggerTab.Advanced_Options_Dialog_Title" ) ); //$NON-NLS-1$
}
}
- protected Combo fDCombo;
+ final protected boolean fAttachMode;
+
protected Button fAdvancedButton;
protected Button fStopInMain;
protected Button fAttachButton;
private Map fAdvancedAttributes = new HashMap( 5 );
- private boolean fPageUpdated;
-
- private boolean fIsInitializing = false;
-
+ public CDebuggerTab(boolean attachMode) {
+ fAttachMode = attachMode;
+ }
+
+
public void createControl( Composite parent ) {
Composite comp = new Composite( parent, SWT.NONE );
setControl( comp );
@@ -130,16 +131,14 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
gd.grabExcessHorizontalSpace = true;
comp.setLayoutData( gd );
- createDebuggerCombo( comp );
- createAttachButton( comp );
+ createDebuggerCombo( comp, 1 );
createOptionsComposite( comp );
- createDebuggerGroup( comp );
+ createDebuggerGroup( comp, 2 );
}
protected void loadDebuggerComboBox( ILaunchConfiguration config, String selection ) {
ICDebugConfiguration[] debugConfigs;
String configPlatform = getPlatform( config );
- fDCombo.removeAll();
debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
Arrays.sort( debugConfigs, new Comparator() {
@@ -149,48 +148,46 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
return ic1.getName().compareTo( ic2.getName() );
}
} );
- int selndx = -1;
- int x = 0;
+ List list = new ArrayList();
+ String mode;
+ if (fAttachMode) {
+ mode = ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH;
+ } else {
+ mode = ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN;
+ }
+ String defaultSelection = selection;
for( int i = 0; i < debugConfigs.length; i++ ) {
- if ( debugConfigs[i].supportsMode( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ) || debugConfigs[i].supportsMode( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH ) ) {
+ if ( debugConfigs[i].supportsMode( mode )) {
String debuggerPlatform = debugConfigs[i].getPlatform();
if ( validatePlatform( config, debugConfigs[i] ) ) {
- fDCombo.add( debugConfigs[i].getName() );
- fDCombo.setData( Integer.toString( x ), debugConfigs[i] );
+ list.add( debugConfigs[i] );
// select first exact matching debugger for platform or requested selection
- if ( (selndx == -1 && debuggerPlatform.equalsIgnoreCase( configPlatform )) || selection.equals( debugConfigs[i].getID() ) ) {
- selndx = x;
+ if ( (defaultSelection.equals("") && debuggerPlatform.equalsIgnoreCase( configPlatform ))) { //$NON-NLS-1$
+ defaultSelection = debugConfigs[i].getName();
}
- x++;
}
}
}
// if no selection meaning nothing in config the force initdefault on tab
setInitializeDefault( selection.equals( "" ) ? true : false ); //$NON-NLS-1$
- fPageUpdated = false;
- fDCombo.select( selndx == -1 ? 0 : selndx );
- //The behaviour is undefined for if the callbacks should be triggered for this,
- //so force page update if needed.
- if ( !fPageUpdated ) {
- updateComboFromSelection();
- }
- fPageUpdated = false;
- getControl().getParent().layout( true );
+ loadDebuggerCombo((ICDebugConfiguration[])list.toArray(new ICDebugConfiguration[list.size()]), defaultSelection);
}
protected void updateComboFromSelection() {
- fPageUpdated = true;
- handleDebuggerChanged();
- initializeCommonControls( getLaunchConfigurationWorkingCopy() );
- updateLaunchConfigurationDialog();
+ super.updateComboFromSelection();
+ initializeCommonControls( getLaunchConfiguration() );
}
public void setDefaults( ILaunchConfigurationWorkingCopy config ) {
super.setDefaults( config );
- config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT );
+ if (fAttachMode) {
+ config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH );
+ } else {
+ config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
+ config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT );
+ }
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false );
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, false );
- config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
}
public void initializeFrom( ILaunchConfiguration config ) {
@@ -208,7 +205,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
public void performApply( ILaunchConfigurationWorkingCopy config ) {
super.performApply( config );
- if ( fAttachButton.getSelection() ) {
+ if ( fAttachMode ) {
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH );
}
else {
@@ -223,23 +220,17 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
return false;
}
ICDebugConfiguration debugConfig = getDebugConfig();
- if ( debugConfig == null ) {
- setErrorMessage( LaunchUIPlugin.getResourceString( "CDebuggerTab.No_debugger_available" ) ); //$NON-NLS-1$
+ String mode = fAttachMode ? ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH : ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN;
+ if ( !debugConfig.supportsMode( mode ) ) {
+ setErrorMessage( MessageFormat.format( LaunchMessages.getString( "CDebuggerTab.Mode_not_supported" ), new String[] { mode } ) ); //$NON-NLS-1$
return false;
}
- if ( fAttachButton != null ) {
- String mode = ( fAttachButton.getSelection() ) ? ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH : ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN;
- if ( !debugConfig.supportsMode( mode ) ) {
- setErrorMessage( MessageFormat.format( LaunchUIPlugin.getResourceString( "CDebuggerTab.Mode_not_supported" ), new String[] { mode } ) ); //$NON-NLS-1$
- return false;
- }
- }
if ( super.isValid( config ) == false ) {
return false;
}
return true;
}
-
+
protected boolean validatePlatform( ILaunchConfiguration config, ICDebugConfiguration debugConfig ) {
String configPlatform = getPlatform( config );
String debuggerPlatform = debugConfig.getPlatform();
@@ -261,85 +252,47 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
protected boolean validateDebuggerConfig( ILaunchConfiguration config ) {
ICDebugConfiguration debugConfig = getDebugConfig();
if ( debugConfig == null ) {
- setErrorMessage( LaunchUIPlugin.getResourceString( "CDebuggerTab.No_debugger_available" ) ); //$NON-NLS-1$
+ setErrorMessage( LaunchMessages.getString( "CDebuggerTab.No_debugger_available" ) ); //$NON-NLS-1$
+ return false;
+ }
+ if ( !validatePlatform( config, debugConfig ) ) {
+ setErrorMessage( LaunchMessages.getString( "CDebuggerTab.Platform_is_not_supported" ) ); //$NON-NLS-1$
return false;
}
- if ( !validatePlatform( config, debugConfig ) || !validateCPU( config, debugConfig ) ) {
- setErrorMessage( LaunchUIPlugin.getResourceString( "CDebuggerTab.CPU_is_not_supported" ) ); //$NON-NLS-1$
+ if (!validateCPU( config, debugConfig ) ) {
+ setErrorMessage( LaunchMessages.getString( "CDebuggerTab.CPU_is_not_supported" ) ); //$NON-NLS-1$
return false;
}
return true;
}
/**
- * Return the class that implements <code>ILaunchConfigurationTab</code> that is registered against the debugger id of the currently selected debugger.
- */
- protected ICDebugConfiguration getConfigForCurrentDebugger() {
- int selectedIndex = fDCombo.getSelectionIndex();
- return (ICDebugConfiguration)fDCombo.getData( Integer.toString( selectedIndex ) );
- }
-
- /**
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
*/
protected void updateLaunchConfigurationDialog() {
super.updateLaunchConfigurationDialog();
}
- protected void createDebuggerCombo( Composite parent ) {
- Composite comboComp = new Composite( parent, SWT.NONE );
- GridLayout layout = new GridLayout( 2, false );
- comboComp.setLayout( layout );
- Label dlabel = new Label( comboComp, SWT.NONE );
- dlabel.setText( LaunchUIPlugin.getResourceString( "Launch.common.DebuggerColon" ) ); //$NON-NLS-1$
- fDCombo = new Combo( comboComp, SWT.DROP_DOWN | SWT.READ_ONLY );
- fDCombo.addModifyListener( new ModifyListener() {
-
- public void modifyText( ModifyEvent e ) {
- if ( !isInitializing() ) {
- setInitializeDefault( true );
- updateComboFromSelection();
- }
- }
- } );
- }
-
- protected void createAttachButton( Composite parent ) {
- Composite attachComp = new Composite( parent, SWT.NONE );
- GridLayout attachLayout = new GridLayout();
- attachLayout.marginHeight = 0;
- attachLayout.marginWidth = 0;
- attachComp.setLayout( attachLayout );
- fAttachButton = createCheckButton( attachComp, LaunchUIPlugin.getResourceString( "CDebuggerTab.Attach_to_running_process" ) ); //$NON-NLS-1$
- fAttachButton.addSelectionListener( new SelectionAdapter() {
-
- public void widgetSelected( SelectionEvent e ) {
- if ( !isInitializing() ) {
- fStopInMain.setSelection( !fAttachButton.getSelection() );
- fStopInMain.setEnabled( !fAttachButton.getSelection() );
- updateLaunchConfigurationDialog();
- }
- }
- } );
- }
-
protected void createOptionsComposite( Composite parent ) {
Composite optionsComp = new Composite( parent, SWT.NONE );
GridLayout layout = new GridLayout( 2, true );
optionsComp.setLayout( layout );
- optionsComp.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 2, 1 ) );
-
- fStopInMain = createCheckButton( optionsComp, LaunchUIPlugin.getResourceString( "CDebuggerTab.Stop_at_main_on_startup" ) ); //$NON-NLS-1$
- fStopInMain.addSelectionListener( new SelectionAdapter() {
-
- public void widgetSelected( SelectionEvent e ) {
- if ( !isInitializing() ) {
- updateLaunchConfigurationDialog();
+ optionsComp.setLayoutData( new GridData( GridData.FILL, GridData.CENTER, true, false, 1, 1 ) );
+
+ if (fAttachMode == true) {
+ createVerticalSpacer(optionsComp, 1);
+ } else {
+ fStopInMain = createCheckButton( optionsComp, LaunchMessages.getString( "CDebuggerTab.Stop_at_main_on_startup" ) ); //$NON-NLS-1$
+ fStopInMain.addSelectionListener( new SelectionAdapter() {
+
+ public void widgetSelected( SelectionEvent e ) {
+ if ( !isInitializing() ) {
+ updateLaunchConfigurationDialog();
+ }
}
- }
- } );
-
- fAdvancedButton = createPushButton( optionsComp, LaunchUIPlugin.getResourceString( "CDebuggerTab.Advanced" ), null ); //$NON-NLS-1$
+ } );
+ }
+ fAdvancedButton = createPushButton( optionsComp, LaunchMessages.getString( "CDebuggerTab.Advanced" ), null ); //$NON-NLS-1$
GridData data = new GridData();
data.horizontalAlignment = GridData.END;
PixelConverter pc = new PixelConverter( parent );
@@ -354,20 +307,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
} );
}
- protected void createDebuggerGroup( Composite parent ) {
- Group debuggerGroup = new Group( parent, SWT.SHADOW_ETCHED_IN );
- debuggerGroup.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Debugger_Options" ) ); //$NON-NLS-1$
- setDynamicTabHolder( debuggerGroup );
- GridLayout tabHolderLayout = new GridLayout();
- tabHolderLayout.marginHeight = 0;
- tabHolderLayout.marginWidth = 0;
- tabHolderLayout.numColumns = 1;
- getDynamicTabHolder().setLayout( tabHolderLayout );
- GridData gd = new GridData( GridData.FILL_BOTH );
- gd.horizontalSpan = 2;
- getDynamicTabHolder().setLayoutData( gd );
- }
-
protected Map getAdvancedAttributes() {
return fAdvancedAttributes;
}
@@ -411,29 +350,16 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
}
protected void initializeCommonControls( ILaunchConfiguration config ) {
- ICDebugConfiguration debugConfig = getConfigForCurrentDebugger();
try {
- String mode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
- fAttachButton.setEnabled( debugConfig != null && debugConfig.supportsMode( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH ) );
- if ( fAttachButton.isEnabled() )
- fAttachButton.setSelection( mode.equals( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH ) );
- fStopInMain.setEnabled( debugConfig != null && !fAttachButton.getSelection() );
- if ( fStopInMain.isEnabled() )
- fStopInMain.setSelection( ( fAttachButton.getSelection() ) ? false : config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT ) );
+ if (!fAttachMode) {
+ fStopInMain.setSelection( config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT ) );
+ }
initializeAdvancedAttributes( config );
}
catch( CoreException e ) {
}
}
-
- protected boolean isInitializing() {
- return fIsInitializing;
- }
-
- private void setInitializing( boolean isInitializing ) {
- fIsInitializing = isInitializing;
- }
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab#setInitializeDefault(boolean)
*/
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CEnvironmentTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CEnvironmentTab.java
index 9a983cf41c4..2407b786909 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CEnvironmentTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CEnvironmentTab.java
@@ -20,10 +20,11 @@ import java.util.Properties;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
-import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -131,7 +132,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
protected void configureShell(Shell shell) {
super.configureShell(shell);
- String title = (fEdit) ? LaunchUIPlugin.getResourceString("CEnvironmentTab.Edit_Variable") : LaunchUIPlugin.getResourceString("CEnvironmentTab.New_Variable"); //$NON-NLS-1$ //$NON-NLS-2$
+ String title = (fEdit) ? LaunchMessages.getString("CEnvironmentTab.Edit_Variable") : LaunchMessages.getString("CEnvironmentTab.New_Variable"); //$NON-NLS-1$ //$NON-NLS-2$
shell.setText(title);
}
@@ -149,14 +150,14 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
int fieldWidthHint = convertWidthInCharsToPixels(metrics, 50);
Label label = new Label(composite, SWT.NONE);
- label.setText(LaunchUIPlugin.getResourceString("CEnvironmentTab.NameColon")); //$NON-NLS-1$
+ label.setText(LaunchMessages.getString("CEnvironmentTab.NameColon")); //$NON-NLS-1$
fTextName = new Text(composite, SWT.SINGLE | SWT.BORDER);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.grabExcessHorizontalSpace = true;
gd.widthHint = fieldWidthHint;
fTextName.setLayoutData(gd);
label = new Label(composite, SWT.NONE);
- label.setText(LaunchUIPlugin.getResourceString("CEnvironmentTab.ValueColon")); //$NON-NLS-1$
+ label.setText(LaunchMessages.getString("CEnvironmentTab.ValueColon")); //$NON-NLS-1$
fTextValue = new Text(composite, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_BOTH);
gd.grabExcessHorizontalSpace = true;
@@ -272,11 +273,11 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
table.setLinesVisible(true);
TableColumn column1 = new TableColumn(table, SWT.NULL);
- column1.setText(LaunchUIPlugin.getResourceString("CEnvironmentTab.Name")); //$NON-NLS-1$
+ column1.setText(LaunchMessages.getString("CEnvironmentTab.Name")); //$NON-NLS-1$
tableLayout.addColumnData(new ColumnWeightData(30));
TableColumn column2 = new TableColumn(table, SWT.NULL);
- column2.setText(LaunchUIPlugin.getResourceString("CEnvironmentTab.Value")); //$NON-NLS-1$
+ column2.setText(LaunchMessages.getString("CEnvironmentTab.Value")); //$NON-NLS-1$
tableLayout.addColumnData(new ColumnWeightData(30));
fVariableList.addDoubleClickListener(new IDoubleClickListener() {
@@ -296,7 +297,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
composite.setLayout(new GridLayout(1, true));
fBtnNew = new Button(composite, SWT.NONE);
- fBtnNew.setText(LaunchUIPlugin.getResourceString("CEnvironmentTab.New...")); //$NON-NLS-1$
+ fBtnNew.setText(LaunchMessages.getString("CEnvironmentTab.New...")); //$NON-NLS-1$
fBtnNew.setLayoutData(new GridData(GridData.FILL_BOTH));
fBtnNew.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -304,7 +305,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
}
});
fBtnImport = new Button(composite, SWT.NONE);
- fBtnImport.setText(LaunchUIPlugin.getResourceString("CEnvironmentTab.Import...")); //$NON-NLS-1$
+ fBtnImport.setText(LaunchMessages.getString("CEnvironmentTab.Import...")); //$NON-NLS-1$
fBtnImport.setLayoutData(new GridData(GridData.FILL_BOTH));
fBtnImport.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -312,7 +313,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
}
});
fBtnEdit = new Button(composite, SWT.NONE);
- fBtnEdit.setText(LaunchUIPlugin.getResourceString("CEnvironmentTab.Edit...")); //$NON-NLS-1$
+ fBtnEdit.setText(LaunchMessages.getString("CEnvironmentTab.Edit...")); //$NON-NLS-1$
fBtnEdit.setLayoutData(new GridData(GridData.FILL_BOTH));
fBtnEdit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -320,7 +321,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
}
});
fBtnRemove = new Button(composite, SWT.NONE);
- fBtnRemove.setText(LaunchUIPlugin.getResourceString("CEnvironmentTab.Remove")); //$NON-NLS-1$
+ fBtnRemove.setText(LaunchMessages.getString("CEnvironmentTab.Remove")); //$NON-NLS-1$
fBtnRemove.setLayoutData(new GridData(GridData.FILL_BOTH));
fBtnRemove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -392,7 +393,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
if(fElements.getProperty(key) != null) {
boolean overwrite;
- overwrite = MessageDialog.openQuestion(getShell(), LaunchUIPlugin.getResourceString("CEnvironmentTab.Existing_Environment_Variable"), LaunchUIPlugin.getFormattedResourceString("CEnvironmentTab.Environment_variable_NAME_exists", key)); //$NON-NLS-1$ //$NON-NLS-2$
+ overwrite = MessageDialog.openQuestion(getShell(), LaunchMessages.getString("CEnvironmentTab.Existing_Environment_Variable"), LaunchMessages.getFormattedString("CEnvironmentTab.Environment_variable_NAME_exists", key)); //$NON-NLS-1$ //$NON-NLS-2$
if(!overwrite) {
continue;
}
@@ -461,7 +462,7 @@ public class CEnvironmentTab extends CLaunchConfigurationTab {
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
public String getName() {
- return LaunchUIPlugin.getResourceString("CEnvironmentTab.Environment"); //$NON-NLS-1$
+ return LaunchMessages.getString("CEnvironmentTab.Environment"); //$NON-NLS-1$
}
/**
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
index 6f88d06182f..c23af760e14 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
@@ -23,6 +23,7 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
import org.eclipse.cdt.ui.CElementImageDescriptor;
import org.eclipse.cdt.ui.CElementLabelProvider;
@@ -113,7 +114,7 @@ public class CMainTab extends CLaunchConfigurationTab {
projComp.setLayoutData(gd);
fProjLabel = new Label(projComp, SWT.NONE);
- fProjLabel.setText(LaunchUIPlugin.getResourceString("CMainTab.&ProjectColon")); //$NON-NLS-1$
+ fProjLabel.setText(LaunchMessages.getString("CMainTab.&ProjectColon")); //$NON-NLS-1$
gd = new GridData();
gd.horizontalSpan = 2;
fProjLabel.setLayoutData(gd);
@@ -128,7 +129,7 @@ public class CMainTab extends CLaunchConfigurationTab {
}
});
- fProjButton = createPushButton(projComp, LaunchUIPlugin.getResourceString("Launch.common.Browse_1"), null); //$NON-NLS-1$
+ fProjButton = createPushButton(projComp, LaunchMessages.getString("Launch.common.Browse_1"), null); //$NON-NLS-1$
fProjButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
@@ -148,7 +149,7 @@ public class CMainTab extends CLaunchConfigurationTab {
gd = new GridData(GridData.FILL_HORIZONTAL);
mainComp.setLayoutData(gd);
fProgLabel = new Label(mainComp, SWT.NONE);
- fProgLabel.setText(LaunchUIPlugin.getResourceString("CMainTab.C/C++_Application")); //$NON-NLS-1$
+ fProgLabel.setText(LaunchMessages.getString("CMainTab.C/C++_Application")); //$NON-NLS-1$
gd = new GridData();
gd.horizontalSpan = 3;
fProgLabel.setLayoutData(gd);
@@ -162,7 +163,7 @@ public class CMainTab extends CLaunchConfigurationTab {
}
});
- fSearchButton = createPushButton(mainComp, LaunchUIPlugin.getResourceString("CMainTab.Search..."), null); //$NON-NLS-1$
+ fSearchButton = createPushButton(mainComp, LaunchMessages.getString("CMainTab.Search..."), null); //$NON-NLS-1$
fSearchButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
@@ -172,7 +173,7 @@ public class CMainTab extends CLaunchConfigurationTab {
});
Button fBrowseForBinaryButton;
- fBrowseForBinaryButton = createPushButton(mainComp, LaunchUIPlugin.getResourceString("Launch.common.Browse_2"), null); //$NON-NLS-1$
+ fBrowseForBinaryButton = createPushButton(mainComp, LaunchMessages.getString("Launch.common.Browse_2"), null); //$NON-NLS-1$
fBrowseForBinaryButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
@@ -228,8 +229,8 @@ public class CMainTab extends CLaunchConfigurationTab {
protected void handleSearchButtonSelected() {
if (getCProject() == null) {
- MessageDialog.openInformation(getShell(), LaunchUIPlugin.getResourceString("CMainTab.Project_required"), //$NON-NLS-1$
- LaunchUIPlugin.getResourceString("CMainTab.Enter_project_before_searching_for_program")); //$NON-NLS-1$
+ MessageDialog.openInformation(getShell(), LaunchMessages.getString("CMainTab.Project_required"), //$NON-NLS-1$
+ LaunchMessages.getString("CMainTab.Enter_project_before_searching_for_program")); //$NON-NLS-1$
return;
}
@@ -284,10 +285,10 @@ public class CMainTab extends CLaunchConfigurationTab {
TwoPaneElementSelector dialog = new TwoPaneElementSelector(getShell(), programLabelProvider, qualifierLabelProvider);
dialog.setElements(getBinaryFiles(getCProject()));
- dialog.setMessage(LaunchUIPlugin.getResourceString("CMainTab.Choose_program_to_run")); //$NON-NLS-1$
- dialog.setTitle(LaunchUIPlugin.getResourceString("CMainTab.Program_Selection")); //$NON-NLS-1$
- dialog.setUpperListLabel(LaunchUIPlugin.getResourceString("Launch.common.BinariesColon")); //$NON-NLS-1$
- dialog.setLowerListLabel(LaunchUIPlugin.getResourceString("Launch.common.QualifierColon")); //$NON-NLS-1$
+ dialog.setMessage(LaunchMessages.getString("CMainTab.Choose_program_to_run")); //$NON-NLS-1$
+ dialog.setTitle(LaunchMessages.getString("CMainTab.Program_Selection")); //$NON-NLS-1$
+ dialog.setUpperListLabel(LaunchMessages.getString("Launch.common.BinariesColon")); //$NON-NLS-1$
+ dialog.setLowerListLabel(LaunchMessages.getString("Launch.common.QualifierColon")); //$NON-NLS-1$
dialog.setMultipleSelection(false);
//dialog.set
if (dialog.open() == Window.OK) {
@@ -305,8 +306,8 @@ public class CMainTab extends CLaunchConfigurationTab {
protected void handleBinaryBrowseButtonSelected() {
final ICProject cproject = getCProject();
if (cproject == null) {
- MessageDialog.openInformation(getShell(), LaunchUIPlugin.getResourceString("CMainTab.Project_required"), //$NON-NLS-1$
- LaunchUIPlugin.getResourceString("CMainTab.Enter_project_before_browsing_for_program")); //$NON-NLS-1$
+ MessageDialog.openInformation(getShell(), LaunchMessages.getString("CMainTab.Project_required"), //$NON-NLS-1$
+ LaunchMessages.getString("CMainTab.Enter_project_before_browsing_for_program")); //$NON-NLS-1$
return;
}
@@ -314,8 +315,8 @@ public class CMainTab extends CLaunchConfigurationTab {
WorkbenchLabelProvider labelProvider = new WorkbenchLabelProvider();
WorkbenchContentProvider contentProvider = new WorkbenchContentProvider();
dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
- dialog.setTitle(LaunchUIPlugin.getResourceString("CMainTab.Program_selection")); //$NON-NLS-1$
- dialog.setMessage(LaunchUIPlugin.getFormattedResourceString(
+ dialog.setTitle(LaunchMessages.getString("CMainTab.Program_selection")); //$NON-NLS-1$
+ dialog.setMessage(LaunchMessages.getFormattedString(
"CMainTab.Choose_program_to_run_from_NAME", cproject.getResource().getName())); //$NON-NLS-1$
dialog.setBlockOnOpen(true);
dialog.setAllowMultiple(false);
@@ -325,21 +326,21 @@ public class CMainTab extends CLaunchConfigurationTab {
public IStatus validate(Object[] selection) {
if (selection.length == 0 || ! (selection[0] instanceof IFile)) {
return new Status(IStatus.ERROR, LaunchUIPlugin.getUniqueIdentifier(), 1,
- LaunchUIPlugin.getResourceString("CMainTab.Selection_must_be_file"), null); //$NON-NLS-1$
+ LaunchMessages.getString("CMainTab.Selection_must_be_file"), null); //$NON-NLS-1$
}
try {
ICElement celement = cproject.findElement( ((IFile)selection[0]).getProjectRelativePath());
if (celement == null
|| (celement.getElementType() != ICElement.C_BINARY && celement.getElementType() != ICElement.C_ARCHIVE)) {
return new Status(IStatus.ERROR, LaunchUIPlugin.getUniqueIdentifier(), 1,
- LaunchUIPlugin.getResourceString("CMainTab.Selection_must_be_binary_file"), null); //$NON-NLS-1$
+ LaunchMessages.getString("CMainTab.Selection_must_be_binary_file"), null); //$NON-NLS-1$
}
return new Status(IStatus.OK, LaunchUIPlugin.getUniqueIdentifier(), IStatus.OK,
celement.getResource().getName(), null);
} catch (Exception ex) {
return new Status(IStatus.ERROR, LaunchUIPlugin.PLUGIN_ID, 1,
- LaunchUIPlugin.getResourceString("CMainTab.Selection_must_be_binary_file"), null); //$NON-NLS-1$
+ LaunchMessages.getString("CMainTab.Selection_must_be_binary_file"), null); //$NON-NLS-1$
}
}
});
@@ -411,8 +412,8 @@ public class CMainTab extends CLaunchConfigurationTab {
ILabelProvider labelProvider = new CElementLabelProvider();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
- dialog.setTitle(LaunchUIPlugin.getResourceString("CMainTab.Project_Selection")); //$NON-NLS-1$
- dialog.setMessage(LaunchUIPlugin.getResourceString("CMainTab.Choose_project_to_constrain_search_for_program")); //$NON-NLS-1$
+ dialog.setTitle(LaunchMessages.getString("CMainTab.Project_Selection")); //$NON-NLS-1$
+ dialog.setMessage(LaunchMessages.getString("CMainTab.Choose_project_to_constrain_search_for_program")); //$NON-NLS-1$
dialog.setElements(projects);
ICProject cProject = getCProject();
@@ -478,30 +479,30 @@ public class CMainTab extends CLaunchConfigurationTab {
String name = fProjText.getText().trim();
if (name.length() == 0) {
- setErrorMessage(LaunchUIPlugin.getResourceString("CMainTab.Project_not_specified")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("CMainTab.Project_not_specified")); //$NON-NLS-1$
return false;
}
if (!ResourcesPlugin.getWorkspace().getRoot().getProject(name).exists()) {
- setErrorMessage(LaunchUIPlugin.getResourceString("Launch.common.Project_does_not_exist")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("Launch.common.Project_does_not_exist")); //$NON-NLS-1$
return false;
}
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
name = fProgText.getText().trim();
if (name.length() == 0) {
- setErrorMessage(LaunchUIPlugin.getResourceString("CMainTab.Program_not_specified")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("CMainTab.Program_not_specified")); //$NON-NLS-1$
return false;
}
if (name.equals(".") || name.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
- setErrorMessage(LaunchUIPlugin.getResourceString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
return false;
}
if (!project.isOpen()) {
- setErrorMessage(LaunchUIPlugin.getResourceString("CMainTab.Project_must_be_opened")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("CMainTab.Project_must_be_opened")); //$NON-NLS-1$
return false;
}
if (!project.getFile(name).exists()) {
- setErrorMessage(LaunchUIPlugin.getResourceString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
+ setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
return false;
}
return true;
@@ -563,7 +564,7 @@ public class CMainTab extends CLaunchConfigurationTab {
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
public String getName() {
- return LaunchUIPlugin.getResourceString("CMainTab.Main"); //$NON-NLS-1$
+ return LaunchMessages.getString("CMainTab.Main"); //$NON-NLS-1$
}
/* (non-Javadoc)
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CSourceLookupTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CSourceLookupTab.java
index 05f377dff7f..cc376005347 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CSourceLookupTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CSourceLookupTab.java
@@ -14,7 +14,7 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.sourcelookup.SourceLookupBlock;
import org.eclipse.cdt.launch.internal.ui.LaunchImages;
-import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -83,7 +83,7 @@ public class CSourceLookupTab extends CLaunchConfigurationTab
*/
public String getName()
{
- return LaunchUIPlugin.getResourceString("CSourceLookupTab.Source"); //$NON-NLS-1$
+ return LaunchMessages.getString("CSourceLookupTab.Source"); //$NON-NLS-1$
}
/* (non-Javadoc)
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CoreFileDebuggerTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CoreFileDebuggerTab.java
index 0a0028e115a..b5b3509c093 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CoreFileDebuggerTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CoreFileDebuggerTab.java
@@ -1,22 +1,26 @@
-/**********************************************************************
- * Copyright (c) 2004 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- ***********************************************************************/
-package org.eclipse.cdt.launch.ui;
+/*******************************************************************************
+ * Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
+ * program and the accompanying materials are 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
+ *
+ * Contributors: QNX Software Systems - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.cdt.launch.ui;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
+
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
+import org.eclipse.cdt.launch.internal.ui.AbstractCDebuggerTab;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
@@ -25,100 +29,128 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.help.WorkbenchHelp;
-public class CoreFileDebuggerTab extends CDebuggerTab {
+public class CoreFileDebuggerTab extends AbstractCDebuggerTab {
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
- public void createControl( Composite parent ) {
- Composite comp = new Composite( parent, SWT.NONE );
- setControl( comp );
- WorkbenchHelp.setHelp( getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB );
- GridLayout topLayout = new GridLayout( 2, false );
- comp.setLayout( topLayout );
- createDebuggerCombo( comp );
- createDebuggerGroup( comp );
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ setControl(comp);
+ WorkbenchHelp.setHelp(getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_DEBBUGER_TAB);
+ GridLayout topLayout = new GridLayout(1, false);
+ comp.setLayout(topLayout);
+ createDebuggerCombo(comp, 1);
+ createDebuggerGroup(comp, 1);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
- public void setDefaults( ILaunchConfigurationWorkingCopy config ) {
- super.setDefaults( config );
- config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE );
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
+ ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.launch.ui.CDebuggerTab#initializeCommonControls(org.eclipse.debug.core.ILaunchConfiguration)
- */
- protected void initializeCommonControls( ILaunchConfiguration config ) {
- // no common controls for this tab
- }
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
- public void performApply( ILaunchConfigurationWorkingCopy config ) {
- if ( getDebugConfig() != null ) {
- config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebugConfig().getID() );
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+ if (getDebugConfig() != null) {
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebugConfig().getID());
ILaunchConfigurationTab dynamicTab = getDynamicTab();
- if ( dynamicTab == null ) {
- config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map)null );
- }
- else {
- dynamicTab.performApply( config );
+ if (dynamicTab == null) {
+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map)null);
+ } else {
+ dynamicTab.performApply(config);
}
}
}
- protected void loadDebuggerComboBox( ILaunchConfiguration config, String selection ) {
- fDCombo.removeAll();
+ public void initializeFrom(ILaunchConfiguration config) {
+ setInitializing(true);
+ super.initializeFrom(config);
+ try {
+ String id = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, ""); //$NON-NLS-1$
+ loadDebuggerComboBox(config, id);
+ } catch (CoreException e) {
+ }
+ setInitializing(false);
+ }
+
+ public boolean isValid(ILaunchConfiguration config) {
+ if (!validateDebuggerConfig(config)) {
+ return false;
+ }
+ if (super.isValid(config) == false) {
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean validateDebuggerConfig(ILaunchConfiguration config) {
+ ICDebugConfiguration debugConfig = getDebugConfig();
+ if (debugConfig == null) {
+ setErrorMessage(LaunchMessages.getString("CoreFileDebuggerTab.No_debugger_available")); //$NON-NLS-1$
+ return false;
+ }
+ if (!validatePlatform(config, debugConfig)) {
+ setErrorMessage(LaunchMessages.getString("CoreFileDebuggerTab.platform_is_not_supported")); //$NON-NLS-1$
+ return false;
+ }
+ return true;
+ }
+ protected void loadDebuggerComboBox(ILaunchConfiguration config, String selection) {
ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getDebugConfigurations();
- String projectPlatform = getProjectPlatform( config );
- int x = 0;
- int selndx = -1;
- for( int i = 0; i < debugConfigs.length; i++ ) {
- if ( debugConfigs[i].supportsMode( ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE ) ) {
- if ( validatePlatform( config, debugConfigs[i] ) ) {
- fDCombo.add( debugConfigs[i].getName() );
- fDCombo.setData( Integer.toString( x ), debugConfigs[i] );
- // select first exact matching debugger for platform or requested selection
+ String projectPlatform = getProjectPlatform(config);
+ String defaultSelection = null;
+ List list = new ArrayList();
+ for (int i = 0; i < debugConfigs.length; i++) {
+ if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) {
+ if (validatePlatform(config, debugConfigs[i])) {
+ list.add(debugConfigs[i]);
+ // select first exact matching debugger for platform or
+ // requested selection
String debuggerPlatform = debugConfigs[i].getPlatform();
- if ( (selndx == -1 && debuggerPlatform.equalsIgnoreCase( projectPlatform )) || selection.equals( debugConfigs[i].getID() ) ) {
- selndx = x;
+ if (defaultSelection == null && debuggerPlatform.equalsIgnoreCase(projectPlatform)) { //$NON-NLS-1$
+ defaultSelection = debugConfigs[i].getName();
}
- x++;
+ }
+ if (selection.equals(debugConfigs[i].getID())) {
+ defaultSelection = debugConfigs[i].getName();
}
}
}
- // if no selection meaning nothing in config the force initdefault on tab
- setInitializeDefault( selection.equals( "" ) ? true : false ); //$NON-NLS-1$
- fDCombo.select( selndx == -1 ? 0 : selndx );
- //The behaviour is undefined for if the callbacks should be triggered for this,
- //so to avoid unnecessary confusion, we force an update.
- handleDebuggerChanged();
- getControl().getParent().layout( true );
+ // if no selection meaning nothing in config the force initdefault on
+ // tab
+ setInitializeDefault(selection.equals("") ? true : false); //$NON-NLS-1$
+ loadDebuggerCombo((ICDebugConfiguration[])list.toArray(new ICDebugConfiguration[list.size()]), defaultSelection);
}
- protected boolean validatePlatform( ILaunchConfiguration config, ICDebugConfiguration debugConfig ) {
- String projectPlatform = getProjectPlatform( config );
+ protected boolean validatePlatform(ILaunchConfiguration config, ICDebugConfiguration debugConfig) {
+ String projectPlatform = getProjectPlatform(config);
String debuggerPlatform = debugConfig.getPlatform();
- return ( debuggerPlatform.equals( "*" ) || debuggerPlatform.equalsIgnoreCase( projectPlatform ) ); //$NON-NLS-1$
+ return (projectPlatform.equals("*") || debuggerPlatform.equals("*") || debuggerPlatform.equalsIgnoreCase(projectPlatform)); //$NON-NLS-1$ //$NON-NLS-2$
}
- private String getProjectPlatform( ILaunchConfiguration config ) {
- ICElement ce = getContext( config, null );
+ private String getProjectPlatform(ILaunchConfiguration config) {
+ ICElement ce = getContext(config, null);
String projectPlatform = "*"; //$NON-NLS-1$
- if ( ce != null ) {
+ if (ce != null) {
try {
- ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription( ce.getCProject().getProject(), false );
- if ( descriptor != null ) {
+ ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(ce.getCProject().getProject(), false);
+ if (descriptor != null) {
projectPlatform = descriptor.getPlatform();
}
- }
- catch( Exception e ) {
+ } catch (Exception e) {
}
}
return projectPlatform;
}
-}
+} \ No newline at end of file

Back to the top