Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorMikhail Khodjaiants2006-02-06 20:48:26 +0000
committerMikhail Khodjaiants2006-02-06 20:48:26 +0000
commit71d38ceea2348eedb19abfbe76ac69b42d341e61 (patch)
treebf56c390e3ecb964f00838266c6bbd5f6bb7e6f5 /debug
parentad1a1771a9486e6b2b228e1f9324411f93f63c09 (diff)
downloadorg.eclipse.cdt-71d38ceea2348eedb19abfbe76ac69b42d341e61.tar.gz
org.eclipse.cdt-71d38ceea2348eedb19abfbe76ac69b42d341e61.tar.xz
org.eclipse.cdt-71d38ceea2348eedb19abfbe76ac69b42d341e61.zip
Bug 114793: Add an extension point to contribute command factories.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/ChangeLog32
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF1
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java7
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.java33
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.properties11
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryDescriptor.java136
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryManager.java85
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/StandardCommandFactory.java33
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinCommandFactory.java39
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentCD.java52
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentDirectory.java (renamed from debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIEnvironmentDirectory.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java49
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibrary.java37
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibraryInfo.java50
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIEnvironmentCD.java50
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSharedLibraryInfo.java2
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/plugin.properties5
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/plugin.xml40
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/schema/commandFactories.exsd161
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinCommandFactory.java37
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger.java1
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger2.java1
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java1
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIEnvironmentCD.java90
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger2.java8
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java5
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java31
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/ChangeLog6
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/plugin.xml4
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties15
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java402
31 files changed, 1291 insertions, 135 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
index bc6300dfb85..258ad9c0345 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
@@ -1,3 +1,35 @@
+2006-02-06 Mikhail Khodjaiants
+ Bug 114793: Add an extension point to contribute command factories.
+ * MANIFEST.MF
+ * CommandFactory.java
+ + mi/org/eclipse/cdt/debug/mi/core/command/factories (package)
+ + CommandFactoriesMessages.java
+ + CommandFactoriesMessages.properties
+ + CommandFactoryDescriptor.java
+ + CommandFactoryManager.java
+ + StandardCommandFactory.java
+ + mi/org/eclipse/cdt/debug/mi/core/command/factories/win32 (package)
+ + CygwinCommandFactory.java
+ + CygwinMIEnvironmentCD.java
+ + CygwinMIEnvironmentDirectory.java
+ + StandardWinCommandFactory.java
+ + WinCLIInfoSharedLibrary.java
+ + WinCLIInfoSharedLibraryInfo.java
+ + WinMIEnvironmentCD.java
+ * CLIInfoSharedLibraryInfo.java
+ + commandFactories.exsd
+ - CygwinCommandFactory.java
+ * CygwinGDBCDIDebugger.java
+ * CygwinGDBCDIDebugger2.java
+ * CygwinGDBDebugger.java
+ - CygwinMIEnvironmentCD.java
+ - CygwinMIEnvironmentDirectory.java
+ * GDBCDIDebugger2.java
+ * IMILaunchConfigurationConstants.java
+ * MIPlugin.java
+ * plugin.xml
+ * plugin.properties
+
2006-01-31 Mikhail Khodjaiants
Bug 124966: GDBTypeParser.parse(String) parses incorrectly.
Applied patch from Matthias Spycher (matthias@coware.com).
diff --git a/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF
index f349eb70705..8031ac7f142 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@ Export-Package: org.eclipse.cdt.debug.mi.core,
org.eclipse.cdt.debug.mi.core.cdi.model,
org.eclipse.cdt.debug.mi.core.cdi.model.type,
org.eclipse.cdt.debug.mi.core.command,
+ org.eclipse.cdt.debug.mi.core.command.factories,
org.eclipse.cdt.debug.mi.core.event,
org.eclipse.cdt.debug.mi.core.output
Require-Bundle: org.eclipse.cdt.debug.core,
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
index 2e4568712d3..12870d5b9fc 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
@@ -19,10 +19,17 @@ public class CommandFactory {
String fMIVersion;
+ protected CommandFactory() {
+ }
+
public CommandFactory(String miVersion) {
fMIVersion = miVersion;
}
+ public void setMIVersion(String miVersion) {
+ fMIVersion = miVersion;
+ }
+
public String getMIVersion() {
return fMIVersion;
}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.java
new file mode 100644
index 00000000000..4255d3a6322
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class CommandFactoriesMessages {
+
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoriesMessages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+ private CommandFactoriesMessages() {
+ }
+
+ public static String getString( String key ) {
+ try {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch( MissingResourceException e ) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.properties b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.properties
new file mode 100644
index 00000000000..51b73c66f9b
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoriesMessages.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# Copyright (c) 2006 QNX Software Systems and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# QNX Software Systems - initial API and implementation
+###############################################################################
+CommandFactoryDescriptor.0=Error instantiating command factory.
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryDescriptor.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryDescriptor.java
new file mode 100644
index 00000000000..b8912002a00
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryDescriptor.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+import org.eclipse.cdt.debug.mi.core.MIPlugin;
+import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * A command factory descriptor wrappers a configuration
+ * element for a <code>commandFactory</code> extension.
+ */
+public class CommandFactoryDescriptor {
+
+ private final static String IDENTIFIER = "id"; //$NON-NLS-1$
+ private final static String CLASS = "class"; //$NON-NLS-1$
+ private final static String NAME = "name"; //$NON-NLS-1$
+ private final static String DEBUGGER_ID = "debuggerID"; //$NON-NLS-1$
+ private final static String MI_VERSIONS = "miVersions"; //$NON-NLS-1$
+ private final static String DESCRIPTION = "description"; //$NON-NLS-1$
+ private final static String PLATFORMS = "platforms"; //$NON-NLS-1$
+
+ /**
+ * The configuration element of the extension.
+ */
+ private IConfigurationElement fElement;
+
+ /**
+ * The set of the platforms supported by this command factory.
+ */
+ private Set fPlatforms;
+
+ /**
+ * The mi levels supported by this command factory.
+ */
+ private String[] fMIVersions = new String[0];
+
+ /**
+ * Constructor for CommandFactoryDescriptor.
+ */
+ protected CommandFactoryDescriptor( IConfigurationElement element ) {
+ fElement = element;
+ }
+
+ protected IConfigurationElement getConfigurationElement() {
+ return fElement;
+ }
+
+ public String getIdentifier() {
+ return getConfigurationElement().getAttribute( IDENTIFIER );
+ }
+
+ public String getName() {
+ return getConfigurationElement().getAttribute( NAME );
+ }
+
+ public String getDebuggerIdentifier() {
+ return getConfigurationElement().getAttribute( DEBUGGER_ID );
+ }
+
+ public String[] getMIVersions() {
+ if ( fMIVersions.length == 0 ) {
+ String miVersions = getConfigurationElement().getAttribute( MI_VERSIONS );
+ if ( miVersions == null || miVersions.trim().length() == 0 )
+ miVersions = "mi"; //$NON-NLS-1$
+ StringTokenizer tokenizer = new StringTokenizer( miVersions, "," ); //$NON-NLS-1$
+ List list = new ArrayList( tokenizer.countTokens() );
+ while( tokenizer.hasMoreTokens() ) {
+ list.add( tokenizer.nextToken().trim() );
+ }
+ fMIVersions = (String[])list.toArray( new String[list.size()] );
+ }
+ return fMIVersions;
+ }
+
+ public String getDescription() {
+ String desc = getConfigurationElement().getAttribute( DESCRIPTION );
+ if ( isEmpty( desc ) ) {
+ desc =""; //$NON-NLS-1$
+ }
+ return desc;
+ }
+
+ protected Set getSupportedPlatforms() {
+ if ( fPlatforms == null ) {
+ String platforms = getConfigurationElement().getAttribute( PLATFORMS );
+ if ( platforms == null ) {
+ return new HashSet( 0 );
+ }
+ StringTokenizer tokenizer = new StringTokenizer( platforms, "," ); //$NON-NLS-1$
+ fPlatforms = new HashSet( tokenizer.countTokens() );
+ while( tokenizer.hasMoreTokens() ) {
+ fPlatforms.add( tokenizer.nextToken().trim() );
+ }
+ }
+ return fPlatforms;
+ }
+
+ public boolean supportsPlatform( String platform ) {
+ Set all = getSupportedPlatforms();
+ return all.isEmpty() || all.contains( platform );
+ }
+
+ public String[] getSupportedPlatformList() {
+ Set platforms = getSupportedPlatforms();
+ return (String[])platforms.toArray( new String[platforms.size()] );
+ }
+
+ public CommandFactory getCommandFactory() throws CoreException {
+ Object clazz = getConfigurationElement().createExecutableExtension( CLASS );
+ if ( clazz instanceof CommandFactory ) {
+ return (CommandFactory)clazz;
+ }
+ throw new CoreException( new Status( IStatus.ERROR, MIPlugin.getUniqueIdentifier(), -1, CommandFactoriesMessages.getString( "CommandFactoryDescriptor.0" ), null ) ); //$NON-NLS-1$
+ }
+
+ private boolean isEmpty( String str ) {
+ return ( str == null || str.trim().length() == 0 );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryManager.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryManager.java
new file mode 100644
index 00000000000..e27ce063588
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/CommandFactoryManager.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.cdt.debug.mi.core.MIPlugin;
+import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Manages command factories.
+ */
+public class CommandFactoryManager {
+
+ private List fDescriptors = null;
+
+ public CommandFactoryDescriptor[] getDescriptors() {
+ List factories = getDescriptorList();
+ return (CommandFactoryDescriptor[])factories.toArray( new CommandFactoryDescriptor[factories.size()] );
+ }
+
+ public CommandFactoryDescriptor getDefaultDescriptor( String debuggerID ) {
+ // TODO: temporary
+ CommandFactoryDescriptor[] descriptors = getDescriptors( debuggerID );
+ return descriptors[0];
+ }
+
+ public CommandFactoryDescriptor[] getDescriptors( String debuggerID ) {
+ String platform = Platform.getOS();
+ List all = getDescriptorList();
+ ArrayList list = new ArrayList( all.size() );
+ Iterator it = all.iterator();
+ while( it.hasNext() ) {
+ CommandFactoryDescriptor desc = (CommandFactoryDescriptor)it.next();
+ if ( desc.getDebuggerIdentifier().equals( debuggerID ) && desc.supportsPlatform( platform ) ) {
+ list.add( desc );
+ }
+ }
+ return (CommandFactoryDescriptor[])list.toArray( new CommandFactoryDescriptor[list.size()] );
+ }
+
+ public CommandFactory getCommandFactory( String factoryID ) throws CoreException {
+ List all = getDescriptorList();
+ Iterator it = all.iterator();
+ while( it.hasNext() ) {
+ CommandFactoryDescriptor desc = (CommandFactoryDescriptor)it.next();
+ if ( desc.getIdentifier().equals( factoryID ) ) {
+ return desc.getCommandFactory();
+ }
+ }
+ return null;
+ }
+
+ private List getDescriptorList() {
+ if ( fDescriptors == null )
+ initializeDescriptorList();
+ return fDescriptors;
+ }
+
+ private synchronized void initializeDescriptorList() {
+ if ( fDescriptors == null ) {
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( MIPlugin.getUniqueIdentifier(), MIPlugin.EXTENSION_POINT_COMMAND_FACTORIES );
+ IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
+ fDescriptors = new ArrayList( infos.length );
+ for( int i = 0; i < infos.length; i++ ) {
+ IConfigurationElement configurationElement = infos[i];
+ CommandFactoryDescriptor factory = new CommandFactoryDescriptor( configurationElement );
+ fDescriptors.add( factory );
+ }
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/StandardCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/StandardCommandFactory.java
new file mode 100644
index 00000000000..7d0164d3120
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/StandardCommandFactory.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories;
+
+import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
+
+/**
+ * The "standard" command factory.
+ */
+public class StandardCommandFactory extends CommandFactory {
+
+ /**
+ * Constructor for StandardCommandFactory.
+ */
+ public StandardCommandFactory() {
+ super();
+ }
+
+ /**
+ * Constructor for StandardCommandFactory.
+ */
+ public StandardCommandFactory( String miVersion ) {
+ super( miVersion );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinCommandFactory.java
new file mode 100644
index 00000000000..85b2f2cbb12
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinCommandFactory.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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories.win32;
+
+import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentDirectory;
+
+/**
+ * Comment for .
+ */
+public class CygwinCommandFactory extends StandardWinCommandFactory {
+
+ /**
+ * Constructor for CygwinCommandFactory.
+ */
+ public CygwinCommandFactory() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * Constructor for CygwinCommandFactory.
+ */
+ public CygwinCommandFactory( String miVersion ) {
+ super( miVersion );
+ // TODO Auto-generated constructor stub
+ }
+
+ public MIEnvironmentDirectory createMIEnvironmentDirectory(boolean reset, String[] pathdirs) {
+ return new CygwinMIEnvironmentDirectory( getMIVersion(), reset, pathdirs );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentCD.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentCD.java
new file mode 100644
index 00000000000..a0ba4f14b28
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentCD.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.mi.core.command.factories.win32;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import org.eclipse.cdt.core.CommandLauncher;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * CygwinMIEnvironmentCD
+ */
+public class CygwinMIEnvironmentCD extends WinMIEnvironmentCD {
+
+ CygwinMIEnvironmentCD( String miVersion, String path ) {
+ super( miVersion, path );
+ // Use the cygpath utility to convert the path
+ CommandLauncher launcher = new CommandLauncher();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+ String newPath = null;
+ launcher.execute( new Path( "cygpath" ), //$NON-NLS-1$
+ new String[]{ "-u", path }, //$NON-NLS-1$
+ new String[0], new Path( "." ) ); //$NON-NLS-1$
+ if ( launcher.waitAndRead( out, err ) == CommandLauncher.OK ) {
+ newPath = out.toString();
+ if ( newPath != null ) {
+ newPath = newPath.trim();
+ if ( newPath.length() > 0 ) {
+ path = newPath;
+ }
+ }
+ }
+ try {
+ out.close();
+ err.close();
+ }
+ catch( IOException e ) {
+ // ignore.
+ }
+ setParameters( new String[]{ path } );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIEnvironmentDirectory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentDirectory.java
index f184ae81b73..5c319fa82ad 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIEnvironmentDirectory.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/CygwinMIEnvironmentDirectory.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.mi.core;
+package org.eclipse.cdt.debug.mi.core.command.factories.win32;
import java.io.ByteArrayOutputStream;
import java.util.StringTokenizer;
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java
new file mode 100644
index 00000000000..5f08d1d8cc0
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/StandardWinCommandFactory.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories.win32;
+
+import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary;
+import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD;
+import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory;
+
+/**
+ * Command factory for the standard gdb/mi protocol for Windows.
+ */
+public class StandardWinCommandFactory extends StandardCommandFactory {
+
+ /**
+ * Constructor for StandardWinCommandFactory.
+ */
+ public StandardWinCommandFactory() {
+ super();
+ }
+
+ /**
+ * Constructor for StandardWinCommandFactory.
+ */
+ public StandardWinCommandFactory( String miVersion ) {
+ super( miVersion );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#createMIEnvironmentCD(java.lang.String)
+ */
+ public MIEnvironmentCD createMIEnvironmentCD( String pathdir ) {
+ return new WinMIEnvironmentCD( getMIVersion(), pathdir );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#createCLIInfoSharedLibrary()
+ */
+ public CLIInfoSharedLibrary createCLIInfoSharedLibrary() {
+ return new WinCLIInfoSharedLibrary();
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibrary.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibrary.java
new file mode 100644
index 00000000000..3eab60e29f2
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibrary.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories.win32;
+
+import org.eclipse.cdt.debug.mi.core.MIException;
+import org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary;
+import org.eclipse.cdt.debug.mi.core.output.MIInfo;
+import org.eclipse.cdt.debug.mi.core.output.MIOutput;
+
+/**
+ * Windows version of "info shared library".
+ */
+public class WinCLIInfoSharedLibrary extends CLIInfoSharedLibrary {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.command.CLIInfoSharedLibrary#getMIInfo()
+ */
+ public MIInfo getMIInfo() throws MIException {
+ MIInfo info = null;
+ MIOutput out = getMIOutput();
+ if ( out != null ) {
+ info = new WinCLIInfoSharedLibraryInfo( out );
+ if ( info.isError() ) {
+ throwMIException( info, out );
+ }
+ }
+ return info;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibraryInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibraryInfo.java
new file mode 100644
index 00000000000..121720ff7e9
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinCLIInfoSharedLibraryInfo.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories.win32;
+
+import java.util.List;
+import org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo;
+import org.eclipse.cdt.debug.mi.core.output.MIOutput;
+import org.eclipse.cdt.debug.mi.core.output.MIShared;
+
+/**
+ * Comment for .
+ */
+public class WinCLIInfoSharedLibraryInfo extends CLIInfoSharedLibraryInfo {
+
+ public WinCLIInfoSharedLibraryInfo( MIOutput out ) {
+ super( out );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.output.CLIInfoSharedLibraryInfo#parseShared(java.lang.String, java.util.List)
+ */
+ protected void parseShared( String str, List aList ) {
+ // skip the header (DLL Name)
+ if ( !str.startsWith( "DLL" ) ) { //$NON-NLS-1$
+ String from = ""; //$NON-NLS-1$
+ String to = ""; //$NON-NLS-1$
+ boolean syms = true;
+ int index = str.lastIndexOf( ' ' );
+ if ( index > 0 ) {
+ String sub = str.substring( index ).trim();
+ // Go figure they do not print the "0x" to indicate hexadecimal!!
+ if ( !sub.startsWith( "0x" ) ) { //$NON-NLS-1$
+ sub = "0x" + sub; //$NON-NLS-1$
+ }
+ from = sub;
+ str = str.substring( 0, index ).trim();
+ }
+ MIShared s = new MIShared( from, to, syms, str.trim() );
+ aList.add( s );
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIEnvironmentCD.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIEnvironmentCD.java
new file mode 100644
index 00000000000..f0ee90b1849
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/win32/WinMIEnvironmentCD.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories.win32;
+
+import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD;
+
+/**
+ * Comment for .
+ */
+public class WinMIEnvironmentCD extends MIEnvironmentCD {
+
+ public WinMIEnvironmentCD( String miVersion, String path ) {
+ super( miVersion, path );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.mi.core.command.MICommand#parametersToString()
+ */
+ protected String parametersToString() {
+ String[] params = getParameters();
+ if ( params != null && params.length == 1 ) {
+ StringBuffer sb = new StringBuffer();
+ // We need to escape the double quotes and the backslash.
+ String param = params[0];
+ for( int j = 0; j < param.length(); j++ ) {
+ char c = param.charAt( j );
+ if ( c == '"' || c == '\\' ) {
+ sb.append( '\\' );
+ }
+ sb.append( c );
+ }
+ // If the string contains spaces instead of escaping
+ // surround the parameter with double quotes.
+ if ( containsWhitespace( param ) ) {
+ sb.insert( 0, '"' );
+ sb.append( '"' );
+ }
+ return sb.toString().trim();
+ }
+ return super.parametersToString();
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSharedLibraryInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSharedLibraryInfo.java
index 6eaa6c14b30..22ae3b39062 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSharedLibraryInfo.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/CLIInfoSharedLibraryInfo.java
@@ -55,7 +55,7 @@ public class CLIInfoSharedLibraryInfo extends MIInfo {
}
}
- void parseShared(String str, List aList) {
+ protected void parseShared(String str, List aList) {
if (!hasProcessHeader) {
// Process the header and choose a type.
if (str.startsWith("DLL")) { //$NON-NLS-1$
diff --git a/debug/org.eclipse.cdt.debug.mi.core/plugin.properties b/debug/org.eclipse.cdt.debug.mi.core/plugin.properties
index 9272aeb70dc..b715e5cca4c 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.mi.core/plugin.properties
@@ -14,3 +14,8 @@ providerName=Eclipse.org
GDBDebugger.name=gdb Debugger
CygwinGDBDebugger.name=Cygwin gdb Debugger
GDBServer.name=gdbserver Debugger
+GDBMIDebugger.name=gdb/mi
+
+StandardLinuxCommandFactory.name=Standard
+StandardWindowsCommandFactory.name=Standard
+CygWinCommandFactory.name=CygWin
diff --git a/debug/org.eclipse.cdt.debug.mi.core/plugin.xml b/debug/org.eclipse.cdt.debug.mi.core/plugin.xml
index 00276b71e8f..57b6d54a5fe 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.mi.core/plugin.xml
@@ -1,16 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
+ <extension-point id="commandFactories" name="gdb/mi Command Factories" schema="schema/commandFactories.exsd"/>
<extension
point="org.eclipse.cdt.debug.core.CDebugger">
<debugger
- platform="*"
- name="%GDBDebugger.name"
+ platform="win32"
+ name="%GDBMIDebugger.name"
modes="run,core,attach"
cpu="native"
- class="org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2"
- id="org.eclipse.cdt.debug.mi.core.CDebugger">
+ class="org.eclipse.cdt.debug.mi.core.CygwinGDBCDIDebugger2"
+ id="org.eclipse.cdt.debug.mi.core.CDebuggerNew">
</debugger>
<debugger
platform="win32"
@@ -28,10 +29,41 @@
class="org.eclipse.cdt.debug.mi.core.GDBServerCDIDebugger2"
id="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger">
</debugger>
+ <debugger
+ class="org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2"
+ cpu="native"
+ id="org.eclipse.cdt.debug.mi.core.CDebugger"
+ modes="run,core,attach"
+ name="%GDBDebugger.name"
+ platform="*"/>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer class="org.eclipse.cdt.debug.mi.core.MIPreferenceInitializer"/>
</extension>
+ <extension
+ point="org.eclipse.cdt.debug.mi.core.commandFactories">
+ <commandFactory
+ class="org.eclipse.cdt.debug.mi.core.command.factories.win32.StandardWinCommandFactory"
+ debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew"
+ id="org.eclipse.cdt.debug.mi.core.standardWinCommandFactory"
+ miVersions="mi,mi1,mi2"
+ name="%StandardWindowsCommandFactory.name"
+ platforms="win32"/>
+ <commandFactory
+ class="org.eclipse.cdt.debug.mi.core.command.factories.win32.CygwinCommandFactory"
+ debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew"
+ id="org.eclipse.cdt.debug.mi.core.cygwinCommandFactory"
+ miVersions="mi,mi1,mi2"
+ name="%CygWinCommandFactory.name"
+ platforms="win32"/>
+ <commandFactory
+ class="org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory"
+ debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew"
+ id="org.eclipse.cdt.debug.mi.core.standardLinuxCommandFactory1"
+ miVersions="mi,mi1,mi2"
+ name="%StandardLinuxCommandFactory.name"
+ platforms="linux"/>
+ </extension>
</plugin>
diff --git a/debug/org.eclipse.cdt.debug.mi.core/schema/commandFactories.exsd b/debug/org.eclipse.cdt.debug.mi.core/schema/commandFactories.exsd
new file mode 100644
index 00000000000..d2c47830bbf
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/schema/commandFactories.exsd
@@ -0,0 +1,161 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.debug.mi.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.cdt.debug.mi.core" id="commandFactories" name="gdb/mi Command Factories"/>
+ </appInfo>
+ <documentation>
+ Allows the contributions of modified/extended gdb/mi command sets.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="commandFactory" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="commandFactory">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a unique identifier for this command factory.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a fully qualified name of a Java class that extends &amp;lt;code&amp;gt;CommandFactory&amp;lt;/code&amp;gt;
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.debug.mi.core.command.CommandFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="debuggerID" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies the identifier of the debugger this command factory is contributed to.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies the name of this command factory that will appear in the launch dialog.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ specifies the description of this command factory.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="platforms" type="string">
+ <annotation>
+ <documentation>
+ specifies a comma separated list of supported platforms.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="miVersions" type="string">
+ <annotation>
+ <documentation>
+ specifies a comma separated list of mi levels supported by this command factory.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;extension point=&quot;org.eclipse.cdt.debug.mi.core.commandFactories&quot;&gt;
+ &lt;commandFactory
+ class=&quot;org.eclipse.cdt.debug.mi.core.command.factories.win32.CygwinCommandFactory&quot;
+ debuggerID=&quot;org.eclipse.cdt.debug.mi.core.CDebuggerNew&quot;
+ id=&quot;org.eclipse.cdt.debug.mi.core.cygwinCommandFactory&quot;
+ miVersions=&quot;mi,mi1,mi2&quot;
+ name=&quot;CygWin&quot;
+ platforms=&quot;win32&quot;/&gt;
+&lt;/extension&gt;
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2004, 2005 QNX Software Systems and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinCommandFactory.java
deleted file mode 100644
index cd1e78d43e3..00000000000
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinCommandFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.mi.core;
-
-import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
-import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD;
-import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentDirectory;
-
-/**
- * Cygwin Command Factory overrides the regular Command Factory to allow for
- * commands to take into account the cygwin environment.
- */
-public class CygwinCommandFactory extends CommandFactory {
-
- public CygwinCommandFactory(String miVersion) {
- super(miVersion);
- }
-
- public MIEnvironmentDirectory createMIEnvironmentDirectory(boolean reset, String[] pathdirs) {
- return new CygwinMIEnvironmentDirectory(getMIVersion(), reset, pathdirs);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.mi.core.command.CommandFactory#createMIEnvironmentCD(java.lang.String)
- */
- public MIEnvironmentCD createMIEnvironmentCD(String pathdir) {
- return new CygwinMIEnvironmentCD(getMIVersion(), pathdir);
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger.java
index 1a6e9bbaf77..4f5b03b5409 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger.java
@@ -17,6 +17,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIGDBSet;
+import org.eclipse.cdt.debug.mi.core.command.factories.win32.CygwinCommandFactory;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger2.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger2.java
index 9453d036df4..52efc4b11c2 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger2.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBCDIDebugger2.java
@@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.mi.core;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIGDBSet;
+import org.eclipse.cdt.debug.mi.core.command.factories.win32.CygwinCommandFactory;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java
index a9bc06b14e8..2f967fb3c6c 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinGDBDebugger.java
@@ -17,6 +17,7 @@ import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIGDBSet;
+import org.eclipse.cdt.debug.mi.core.command.factories.win32.CygwinCommandFactory;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIEnvironmentCD.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIEnvironmentCD.java
deleted file mode 100644
index 9940a305906..00000000000
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/CygwinMIEnvironmentCD.java
+++ /dev/null
@@ -1,90 +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 Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.mi.core;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import org.eclipse.cdt.core.CommandLauncher;
-import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD;
-import org.eclipse.core.runtime.Path;
-
-/**
- * CygwinMIEnvironmentCD
- */
-public class CygwinMIEnvironmentCD extends MIEnvironmentCD {
-
- /**
- * @param path
- */
- public CygwinMIEnvironmentCD(String miVersion, String path) {
- super(miVersion, path);
-
- // Use the cygpath utility to convert the path
- CommandLauncher launcher = new CommandLauncher();
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ByteArrayOutputStream err = new ByteArrayOutputStream();
-
- String newPath = null;
- launcher.execute(
- new Path("cygpath"), //$NON-NLS-1$
- new String[] { "-u", path }, //$NON-NLS-1$
- new String[0],
- new Path(".")); //$NON-NLS-1$
- if (launcher.waitAndRead(out, err) == CommandLauncher.OK) {
- newPath = out.toString();
- if (newPath != null) {
- newPath = newPath.trim();
- if (newPath.length() > 0) {
- path = newPath;
- }
- }
- }
- try {
- out.close();
- err.close();
- } catch (IOException e) {
- // ignore.
- }
-
- setParameters(new String[]{path});
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.mi.core.command.MICommand#parametersToString()
- */
- protected String parametersToString() {
- String[] params = getParameters();
- if (params != null && params.length == 1) {
- StringBuffer sb = new StringBuffer();
- // We need to escape the double quotes and the backslash.
- String param = params[0];
- for (int j = 0; j < param.length(); j++) {
- char c = param.charAt(j);
- if (c == '"' || c == '\\') {
- sb.append('\\');
- }
- sb.append(c);
- }
-
- // If the string contains spaces instead of escaping
- // surround the parameter with double quotes.
- if (containsWhitespace(param)) {
- sb.insert(0, '"');
- sb.append('"');
- }
- return sb.toString().trim();
- }
- return super.parametersToString();
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger2.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger2.java
index 6ce073a76fd..22c87911a6d 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger2.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBCDIDebugger2.java
@@ -62,7 +62,13 @@ public class GDBCDIDebugger2 extends AbstractGDBCDIDebugger {
}
protected CommandFactory getCommandFactory( ILaunchConfiguration config ) throws CoreException {
- return new CommandFactory( getMIVersion( config ) );
+ String factoryID = MIPlugin.getCommandFactory( config );
+ CommandFactory factory = MIPlugin.getDefault().getCommandFactoryManager().getCommandFactory( factoryID );
+ String miVersion = getMIVersion( config );
+ if ( factory != null ) {
+ factory.setMIVersion( miVersion );
+ }
+ return ( factory != null ) ? factory : new CommandFactory( miVersion );
}
public static IPath getProjectPath( ILaunchConfiguration configuration ) throws CoreException {
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java
index 7f07205d5ab..3007a4d1f2f 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java
@@ -56,6 +56,11 @@ public interface IMILaunchConfigurationConstants {
public static final boolean DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT = false;
/**
+ * Launch configuration attribute key. The value is a string specifying the identifier of the command factory to use.
+ */
+ public static final String ATTR_DEBUGGER_COMMAND_FACTORY = MIPlugin.getUniqueIdentifier() + ".commandFactory"; //$NON-NLS-1$
+
+ /**
* launch configuration attribute key. The value is a string specifying the protocol to
* use. For now only "mi", "mi1", "m2", "mi3" are supported.
*/
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java
index 88678425ee8..059d72e2b4d 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java
@@ -25,6 +25,7 @@ import org.eclipse.cdt.debug.mi.core.command.CLITargetAttach;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames;
import org.eclipse.cdt.debug.mi.core.command.MITargetSelect;
+import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryManager;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.core.runtime.CoreException;
@@ -46,12 +47,25 @@ public class MIPlugin extends Plugin {
*/
public static final String PLUGIN_ID = "org.eclipse.cdt.debug.mi.core" ; //$NON-NLS-1$
+ /**
+ * Simple identifier constant (value <code>"commandFactories"</code>)
+ * for the "gdb/mi command factories" extension point.
+ *
+ * @since 3.1
+ */
+ public static final String EXTENSION_POINT_COMMAND_FACTORIES = "commandFactories"; //$NON-NLS-1$
+
//The shared instance.
private static MIPlugin plugin;
// GDB command
private static final String GDB = "gdb"; //$NON-NLS-1$
+ /**
+ * The singleton command factory manager.
+ */
+ private CommandFactoryManager fCommandFactoryManager;
+
private static ResourceBundle fgResourceBundle;
static {
try {
@@ -529,4 +543,21 @@ public class MIPlugin extends Plugin {
}
return miVersion;
}
+
+ public static String getCommandFactory( ILaunchConfiguration config ) {
+ String commandFactory = ""; //$NON-NLS-1$
+ try {
+ commandFactory = config.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, "" ); //$NON-NLS-1$
+ }
+ catch( CoreException e ) {
+ }
+ return commandFactory;
+ }
+
+ public CommandFactoryManager getCommandFactoryManager() {
+ if ( fCommandFactoryManager == null ) {
+ fCommandFactoryManager = new CommandFactoryManager();
+ }
+ return fCommandFactoryManager;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog b/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog
index e2251603837..c48178086d8 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.mi.ui/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-06 Mikhail Khodjaiants
+ Bug 114793: Add an extension point to contribute command factories.
+ * MIUIMessages.properties
+ + StandardGDBDebuggerPage.java
+ * plugin.xml
+
2006-02-03 Mikhail Khodjaiants
The "ICDebuggerPage" interface and "AbstractCDebuggerPage" class are added.
All extensions of the "CDebuggerPage" extension point must implement "ICDebuggerPage".
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml
index 2f6655dd467..ba289e7b092 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml
@@ -19,6 +19,10 @@
debuggerID="org.eclipse.cdt.debug.mi.core.GDBServerCDebugger"
id="org.eclipse.cdt.debug.mi.GDBServerDebuggerPage">
</debuggerPage>
+ <debuggerPage
+ class="org.eclipse.cdt.debug.mi.internal.ui.StandardGDBDebuggerPage"
+ debuggerID="org.eclipse.cdt.debug.mi.core.CDebuggerNew"
+ id="org.eclipse.cdt.debug.mi.GDBDebuggerPageNew"/>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties
index 2871db97bc2..73bcd634a48 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/MIUIMessages.properties
@@ -21,8 +21,21 @@ GDBDebuggerPage.7=B&rowse...
GDBDebuggerPage.8=GDB Command File
GDBDebuggerPage.9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
GDBDebuggerPage.10=Shared Libraries
-GDBDebuggerPage.11=MI Protocol:
+GDBDebuggerPage.11=Protocol:
GDBDebuggerPage.12=Default
+StandardGDBDebuggerPage.0=Debugger executable must be specified.
+StandardGDBDebuggerPage.1=GDB Debugger Options
+StandardGDBDebuggerPage.2=Main
+StandardGDBDebuggerPage.3=GDB debugger:
+StandardGDBDebuggerPage.4=&Browse...
+StandardGDBDebuggerPage.5=GDB Debugger
+StandardGDBDebuggerPage.6=GDB command file:
+StandardGDBDebuggerPage.7=B&rowse...
+StandardGDBDebuggerPage.8=GDB Command File
+StandardGDBDebuggerPage.9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
+StandardGDBDebuggerPage.10=Shared Libraries
+StandardGDBDebuggerPage.11=Protocol:
+StandardGDBDebuggerPage.12=GDB command set:
GDBServerDebuggerPage.0=TCP
GDBServerDebuggerPage.1=Serial
GDBServerDebuggerPage.10=Connection
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java
new file mode 100644
index 00000000000..a66e70501b3
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/StandardGDBDebuggerPage.java
@@ -0,0 +1,402 @@
+/*******************************************************************************
+ * 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 Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.internal.ui;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Observable;
+import java.util.Observer;
+import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
+import org.eclipse.cdt.debug.mi.core.MIPlugin;
+import org.eclipse.cdt.debug.mi.core.command.factories.CommandFactoryDescriptor;
+import org.eclipse.cdt.debug.mi.ui.IMILaunchConfigurationComponent;
+import org.eclipse.cdt.debug.mi.ui.MIUIUtils;
+import org.eclipse.cdt.debug.ui.AbstractCDebuggerPage;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+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.events.SelectionListener;
+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.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * The dynamic tab for gdb-based debugger implementations.
+ */
+public class StandardGDBDebuggerPage extends AbstractCDebuggerPage implements Observer {
+
+ private final static String DEFAULT_MI_VERSION = "mi"; //$NON-NLS-1$
+
+ protected TabFolder fTabFolder;
+
+ protected Text fGDBCommandText;
+
+ protected Text fGDBInitText;
+
+ protected Combo fCommandFactoryCombo;
+
+ protected Combo fProtocolCombo;
+
+ private IMILaunchConfigurationComponent fSolibBlock;
+
+ private CommandFactoryDescriptor[] fCommandFactoryDescriptors;
+
+ private boolean fIsInitializing = false;
+
+ public void createControl( Composite parent ) {
+ Composite comp = new Composite( parent, SWT.NONE );
+ comp.setLayout( new GridLayout() );
+ comp.setLayoutData( new GridData( GridData.FILL_BOTH ) );
+ fTabFolder = new TabFolder( comp, SWT.NONE );
+ fTabFolder.setLayoutData( new GridData( GridData.FILL_BOTH | GridData.GRAB_VERTICAL ) );
+ createTabs( fTabFolder );
+ fTabFolder.setSelection( 0 );
+ setControl( parent );
+ }
+
+ public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
+ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
+ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT );
+ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, MIPlugin.getDefault().getCommandFactoryManager().getDefaultDescriptor( getDebuggerIdentifier() ).getIdentifier() );
+ if ( fSolibBlock != null )
+ fSolibBlock.setDefaults( configuration );
+ }
+
+ public boolean isValid( ILaunchConfiguration launchConfig ) {
+ boolean valid = fGDBCommandText.getText().length() != 0;
+ if ( valid ) {
+ setErrorMessage( null );
+ setMessage( null );
+ }
+ else {
+ setErrorMessage( MIUIMessages.getString( "StandardGDBDebuggerPage.0" ) ); //$NON-NLS-1$
+ setMessage( null );
+ }
+ return valid;
+ }
+
+ public void initializeFrom( ILaunchConfiguration configuration ) {
+ setInitializing( true );
+ String gdbCommand = "gdb"; //$NON-NLS-1$
+ String gdbInit = IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT;
+ try {
+ gdbCommand = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
+ }
+ catch( CoreException e ) {
+ }
+ try {
+ gdbInit = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT );
+ }
+ catch( CoreException e ) {
+ }
+ if ( fSolibBlock != null )
+ fSolibBlock.initializeFrom( configuration );
+ fGDBCommandText.setText( gdbCommand );
+ fGDBInitText.setText( gdbInit );
+
+ String debuggerID = getDebuggerIdentifier();
+ fCommandFactoryDescriptors = MIPlugin.getDefault().getCommandFactoryManager().getDescriptors( debuggerID );
+ Arrays.sort( fCommandFactoryDescriptors,
+ new Comparator() {
+ public int compare( Object arg0, Object arg1 ) {
+ return ((CommandFactoryDescriptor)arg0).getName().compareTo( ((CommandFactoryDescriptor)arg1).getName() );
+ }
+ } );
+ String[] descLabels = new String[fCommandFactoryDescriptors.length];
+ String commandFactoryId = MIPlugin.getCommandFactory( configuration );
+ int index = -1;
+ for( int i = 0; i < fCommandFactoryDescriptors.length; ++i ) {
+ descLabels[i] = fCommandFactoryDescriptors[i].getName();
+ if ( fCommandFactoryDescriptors[i].getIdentifier().equals( commandFactoryId ) )
+ index = i;
+ }
+ fCommandFactoryCombo.setItems( descLabels );
+ if ( index >= 0 ) {
+ fCommandFactoryCombo.select( index );
+ String[] miVersions = fCommandFactoryDescriptors[index].getMIVersions();
+ fProtocolCombo.setItems( miVersions );
+ if ( miVersions.length == 0 ) {
+ miVersions = new String[] { DEFAULT_MI_VERSION };
+ }
+ String mi = DEFAULT_MI_VERSION;
+ try {
+ mi = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, DEFAULT_MI_VERSION );
+ }
+ catch( CoreException e ) {
+ // use default
+ }
+ int miIndex = 0;
+ for ( int i = 0; i < miVersions.length; ++i ) {
+ if ( miVersions.equals( mi ) ) {
+ miIndex = i;
+ break;
+ }
+ }
+ fProtocolCombo.select( miIndex );
+ }
+
+ setInitializing( false );
+ }
+
+ public void performApply( ILaunchConfigurationWorkingCopy configuration ) {
+ String str = fGDBCommandText.getText();
+ str.trim();
+ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, str );
+ str = fGDBInitText.getText();
+ str.trim();
+ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, str );
+ str = fCommandFactoryCombo.getText();
+ int index = fCommandFactoryCombo.indexOf( str );
+ str = fCommandFactoryDescriptors[index].getIdentifier();
+ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, str );
+ str = fProtocolCombo.getText();
+ configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, str );
+ if ( fSolibBlock != null )
+ fSolibBlock.performApply( configuration );
+ }
+
+ public String getName() {
+ return MIUIMessages.getString( "StandardGDBDebuggerPage.1" ); //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell()
+ */
+ protected Shell getShell() {
+ return super.getShell();
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
+ */
+ protected void updateLaunchConfigurationDialog() {
+ super.updateLaunchConfigurationDialog();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
+ */
+ public void update( Observable o, Object arg ) {
+ if ( !isInitializing() )
+ updateLaunchConfigurationDialog();
+ }
+
+ public IMILaunchConfigurationComponent createSolibBlock( Composite parent ) {
+ IMILaunchConfigurationComponent block = MIUIUtils.createGDBSolibBlock( MIUIUtils.createSolibSearchPathBlock( null ), true, true );
+ block.createControl( parent );
+ return block;
+ }
+
+ public void createTabs( TabFolder tabFolder ) {
+ createMainTab( tabFolder );
+ createSolibTab( tabFolder );
+ }
+
+ public void createMainTab( TabFolder tabFolder ) {
+ TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
+ tabItem.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.2" ) ); //$NON-NLS-1$
+ Composite comp = ControlFactory.createCompositeEx( tabFolder, 1, GridData.FILL_BOTH );
+ ((GridLayout)comp.getLayout()).makeColumnsEqualWidth = false;
+ comp.setFont( tabFolder.getFont() );
+ tabItem.setControl( comp );
+ Composite subComp = ControlFactory.createCompositeEx( comp, 3, GridData.FILL_HORIZONTAL );
+ ((GridLayout)subComp.getLayout()).makeColumnsEqualWidth = false;
+ subComp.setFont( tabFolder.getFont() );
+ Label label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.3" ) ); //$NON-NLS-1$
+ GridData gd = new GridData();
+// gd.horizontalSpan = 2;
+ label.setLayoutData( gd );
+ fGDBCommandText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER );
+ fGDBCommandText.addModifyListener( new ModifyListener() {
+
+ public void modifyText( ModifyEvent evt ) {
+ if ( !isInitializing() )
+ updateLaunchConfigurationDialog();
+ }
+ } );
+ Button button = createPushButton( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.4" ), null ); //$NON-NLS-1$
+ button.addSelectionListener( new SelectionAdapter() {
+
+ public void widgetSelected( SelectionEvent evt ) {
+ handleGDBButtonSelected();
+ updateLaunchConfigurationDialog();
+ }
+
+ private void handleGDBButtonSelected() {
+ FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
+ dialog.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.5" ) ); //$NON-NLS-1$
+ String gdbCommand = fGDBCommandText.getText().trim();
+ int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator );
+ if ( lastSeparatorIndex != -1 ) {
+ dialog.setFilterPath( gdbCommand.substring( 0, lastSeparatorIndex ) );
+ }
+ String res = dialog.open();
+ if ( res == null ) {
+ return;
+ }
+ fGDBCommandText.setText( res );
+ }
+ } );
+ label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.6" ) ); //$NON-NLS-1$
+ gd = new GridData();
+// gd.horizontalSpan = 2;
+ label.setLayoutData( gd );
+ fGDBInitText = ControlFactory.createTextField( subComp, SWT.SINGLE | SWT.BORDER );
+ gd = new GridData( GridData.FILL_HORIZONTAL );
+ fGDBInitText.setLayoutData( gd );
+ fGDBInitText.addModifyListener( new ModifyListener() {
+
+ public void modifyText( ModifyEvent evt ) {
+ if ( !isInitializing() )
+ updateLaunchConfigurationDialog();
+ }
+ } );
+ button = createPushButton( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.7" ), null ); //$NON-NLS-1$
+ button.addSelectionListener( new SelectionAdapter() {
+
+ public void widgetSelected( SelectionEvent evt ) {
+ handleGDBInitButtonSelected();
+ updateLaunchConfigurationDialog();
+ }
+
+ private void handleGDBInitButtonSelected() {
+ FileDialog dialog = new FileDialog( getShell(), SWT.NONE );
+ dialog.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.8" ) ); //$NON-NLS-1$
+ String gdbCommand = fGDBInitText.getText().trim();
+ int lastSeparatorIndex = gdbCommand.lastIndexOf( File.separator );
+ if ( lastSeparatorIndex != -1 ) {
+ dialog.setFilterPath( gdbCommand.substring( 0, lastSeparatorIndex ) );
+ }
+ String res = dialog.open();
+ if ( res == null ) {
+ return;
+ }
+ fGDBInitText.setText( res );
+ }
+ } );
+ label = ControlFactory.createLabel( subComp, MIUIMessages.getString( "StandardGDBDebuggerPage.9" ), //$NON-NLS-1$
+ 200, SWT.DEFAULT, SWT.WRAP );
+ gd = new GridData( GridData.FILL_HORIZONTAL );
+ gd.horizontalSpan = 3;
+ gd.widthHint = 200;
+ label.setLayoutData( gd );
+
+ Composite options = ControlFactory.createCompositeEx( subComp, 2, GridData.FILL_HORIZONTAL );
+ gd = new GridData( GridData.FILL_HORIZONTAL );
+ gd.horizontalSpan = 3;
+ options.setLayoutData( gd );
+ createCommandFactoryCombo( options );
+ createProtocolCombo( options );
+ }
+
+ public void createSolibTab( TabFolder tabFolder ) {
+ TabItem tabItem = new TabItem( tabFolder, SWT.NONE );
+ tabItem.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.10" ) ); //$NON-NLS-1$
+ Composite comp = ControlFactory.createCompositeEx( fTabFolder, 1, GridData.FILL_BOTH );
+ comp.setFont( tabFolder.getFont() );
+ tabItem.setControl( comp );
+ fSolibBlock = createSolibBlock( comp );
+ if ( fSolibBlock instanceof Observable )
+ ((Observable)fSolibBlock).addObserver( this );
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
+ */
+ public void dispose() {
+ if ( fSolibBlock != null ) {
+ if ( fSolibBlock instanceof Observable )
+ ((Observable)fSolibBlock).deleteObserver( this );
+ fSolibBlock.dispose();
+ }
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void activated( ILaunchConfigurationWorkingCopy workingCopy ) {
+ // Override the default behavior
+ }
+
+ protected boolean isInitializing() {
+ return fIsInitializing;
+ }
+
+ private void setInitializing( boolean isInitializing ) {
+ fIsInitializing = isInitializing;
+ }
+
+ protected void createCommandFactoryCombo( Composite parent ) {
+ Label label = new Label( parent, SWT.NONE );
+ label.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.12" ) ); //$NON-NLS-1$
+ fCommandFactoryCombo = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN );
+ fCommandFactoryCombo.addSelectionListener( new SelectionListener() {
+
+ public void widgetDefaultSelected( SelectionEvent e ) {
+ if ( !isInitializing() )
+ updateLaunchConfigurationDialog();
+ }
+
+ public void widgetSelected( SelectionEvent e ) {
+ if ( !isInitializing() )
+ updateLaunchConfigurationDialog();
+ }
+ } );
+ }
+
+ protected void createProtocolCombo( Composite parent ) {
+ Label label = new Label( parent, SWT.NONE );
+ label.setText( MIUIMessages.getString( "StandardGDBDebuggerPage.11" ) ); //$NON-NLS-1$
+ fProtocolCombo = new Combo( parent, SWT.READ_ONLY | SWT.DROP_DOWN );
+ fProtocolCombo.addSelectionListener( new SelectionListener() {
+
+ public void widgetDefaultSelected( SelectionEvent e ) {
+ if ( !isInitializing() )
+ updateLaunchConfigurationDialog();
+ }
+
+ public void widgetSelected( SelectionEvent e ) {
+ if ( !isInitializing() )
+ updateLaunchConfigurationDialog();
+ }
+ } );
+ }
+
+ protected String getCurrentCommandFactoryID() {
+ String name = fCommandFactoryCombo.getText();
+ for ( int i = 0; i < fCommandFactoryDescriptors.length; ++i ) {
+ if ( fCommandFactoryDescriptors[i].getName().equals( name ) ) {
+ return fCommandFactoryDescriptors[i].getIdentifier();
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+}

Back to the top