|
Lines 76-81
Link Here
|
| 76 |
import org.eclipse.debug.core.ILaunchConfiguration; |
76 |
import org.eclipse.debug.core.ILaunchConfiguration; |
| 77 |
import org.eclipse.debug.core.ILaunchConfigurationListener; |
77 |
import org.eclipse.debug.core.ILaunchConfigurationListener; |
| 78 |
import org.eclipse.debug.core.ILaunchConfigurationType; |
78 |
import org.eclipse.debug.core.ILaunchConfigurationType; |
|
|
79 |
import org.eclipse.debug.core.ILaunchDelegate; |
| 79 |
import org.eclipse.debug.core.ILaunchListener; |
80 |
import org.eclipse.debug.core.ILaunchListener; |
| 80 |
import org.eclipse.debug.core.ILaunchManager; |
81 |
import org.eclipse.debug.core.ILaunchManager; |
| 81 |
import org.eclipse.debug.core.ILaunchMode; |
82 |
import org.eclipse.debug.core.ILaunchMode; |
|
Lines 85-90
Link Here
|
| 85 |
import org.eclipse.debug.core.IStatusHandler; |
86 |
import org.eclipse.debug.core.IStatusHandler; |
| 86 |
import org.eclipse.debug.core.model.IDebugTarget; |
87 |
import org.eclipse.debug.core.model.IDebugTarget; |
| 87 |
import org.eclipse.debug.core.model.IDisconnect; |
88 |
import org.eclipse.debug.core.model.IDisconnect; |
|
|
89 |
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; |
| 88 |
import org.eclipse.debug.core.model.IPersistableSourceLocator; |
90 |
import org.eclipse.debug.core.model.IPersistableSourceLocator; |
| 89 |
import org.eclipse.debug.core.model.IProcess; |
91 |
import org.eclipse.debug.core.model.IProcess; |
| 90 |
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; |
92 |
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; |
|
Lines 507-523
Link Here
|
| 507 |
* @throws IOException if the encoding attempted to be used is not supported |
509 |
* @throws IOException if the encoding attempted to be used is not supported |
| 508 |
*/ |
510 |
*/ |
| 509 |
public static String serializeDocument(Document doc) throws TransformerException, IOException { |
511 |
public static String serializeDocument(Document doc) throws TransformerException, IOException { |
| 510 |
ByteArrayOutputStream s= new ByteArrayOutputStream(); |
512 |
ByteArrayOutputStream s = new ByteArrayOutputStream(); |
| 511 |
|
513 |
TransformerFactory factory = TransformerFactory.newInstance(); |
| 512 |
TransformerFactory factory= TransformerFactory.newInstance(); |
514 |
Transformer transformer = factory.newTransformer(); |
| 513 |
Transformer transformer= factory.newTransformer(); |
|
|
| 514 |
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ |
515 |
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ |
| 515 |
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ |
516 |
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ |
| 516 |
|
517 |
DOMSource source = new DOMSource(doc); |
| 517 |
DOMSource source= new DOMSource(doc); |
518 |
StreamResult outputTarget = new StreamResult(s); |
| 518 |
StreamResult outputTarget= new StreamResult(s); |
|
|
| 519 |
transformer.transform(source, outputTarget); |
519 |
transformer.transform(source, outputTarget); |
| 520 |
|
|
|
| 521 |
return s.toString("UTF8"); //$NON-NLS-1$ |
520 |
return s.toString("UTF8"); //$NON-NLS-1$ |
| 522 |
} |
521 |
} |
| 523 |
|
522 |
|
|
Lines 564-573
Link Here
|
| 564 |
private HashMap fLaunchOptions = null; |
563 |
private HashMap fLaunchOptions = null; |
| 565 |
|
564 |
|
| 566 |
/** |
565 |
/** |
| 567 |
* List of contributed launch delegates (delegates contributed for existing |
566 |
* A map of ILaunchDelegate objects stored by id of delegate, or launch config type |
| 568 |
* launch configuration types). |
|
|
| 569 |
*/ |
567 |
*/ |
| 570 |
private List fContributedDelegates = null; |
568 |
private HashMap fLaunchDelegates = null; |
| 571 |
|
569 |
|
| 572 |
/** |
570 |
/** |
| 573 |
* Collection of launches |
571 |
* Collection of launches |
|
Lines 830-837
Link Here
|
| 830 |
} |
828 |
} |
| 831 |
Iterator iter = list.iterator(); |
829 |
Iterator iter = list.iterator(); |
| 832 |
List configs = new ArrayList(list.size()); |
830 |
List configs = new ArrayList(list.size()); |
|
|
831 |
IFile file = null; |
| 833 |
while (iter.hasNext()) { |
832 |
while (iter.hasNext()) { |
| 834 |
IFile file = (IFile)iter.next(); |
833 |
file = (IFile)iter.next(); |
| 835 |
configs.add(getLaunchConfiguration(file)); |
834 |
configs.add(getLaunchConfiguration(file)); |
| 836 |
} |
835 |
} |
| 837 |
return configs; |
836 |
return configs; |
|
Lines 856-863
Link Here
|
| 856 |
} |
855 |
} |
| 857 |
}; |
856 |
}; |
| 858 |
String[] files = directory.list(filter); |
857 |
String[] files = directory.list(filter); |
|
|
858 |
LaunchConfiguration config = null; |
| 859 |
for (int i = 0; i < files.length; i++) { |
859 |
for (int i = 0; i < files.length; i++) { |
| 860 |
LaunchConfiguration config = new LaunchConfiguration(containerPath.append(files[i])); |
860 |
config = new LaunchConfiguration(containerPath.append(files[i])); |
| 861 |
configs.add(config); |
861 |
configs.add(config); |
| 862 |
} |
862 |
} |
| 863 |
} |
863 |
} |
|
Lines 893-905
Link Here
|
| 893 |
try { |
893 |
try { |
| 894 |
index = Integer.parseInt(trailer); |
894 |
index = Integer.parseInt(trailer); |
| 895 |
baseName = baseName.substring(0, copyIndex); |
895 |
baseName = baseName.substring(0, copyIndex); |
| 896 |
} catch (NumberFormatException nfe) { |
896 |
} |
| 897 |
} |
897 |
catch (NumberFormatException nfe) {} |
| 898 |
} |
898 |
} |
| 899 |
} |
899 |
} |
| 900 |
String newName = baseName; |
900 |
String newName = baseName; |
| 901 |
|
901 |
|
| 902 |
StringBuffer buffer= null; |
902 |
StringBuffer buffer = null; |
| 903 |
while (isExistingLaunchConfigurationName(newName)) { |
903 |
while (isExistingLaunchConfigurationName(newName)) { |
| 904 |
buffer = new StringBuffer(baseName); |
904 |
buffer = new StringBuffer(baseName); |
| 905 |
buffer.append(" ("); //$NON-NLS-1$ |
905 |
buffer.append(" ("); //$NON-NLS-1$ |
|
Lines 995-1010
Link Here
|
| 995 |
List configs = new ArrayList(4); |
995 |
List configs = new ArrayList(4); |
| 996 |
NodeList list = root.getChildNodes(); |
996 |
NodeList list = root.getChildNodes(); |
| 997 |
int length = list.getLength(); |
997 |
int length = list.getLength(); |
|
|
998 |
Node node = null; |
| 999 |
Element entry = null; |
| 1000 |
String memento = null; |
| 998 |
for (int i = 0; i < length; ++i) { |
1001 |
for (int i = 0; i < length; ++i) { |
| 999 |
Node node = list.item(i); |
1002 |
node = list.item(i); |
| 1000 |
short type = node.getNodeType(); |
1003 |
short type = node.getNodeType(); |
| 1001 |
if (type == Node.ELEMENT_NODE) { |
1004 |
if (type == Node.ELEMENT_NODE) { |
| 1002 |
Element entry = (Element) node; |
1005 |
entry = (Element) node; |
| 1003 |
String nodeName = entry.getNodeName(); |
1006 |
if (!entry.getNodeName().equals("launchConfiguration")) { //$NON-NLS-1$ |
| 1004 |
if (!nodeName.equals("launchConfiguration")) { //$NON-NLS-1$ |
|
|
| 1005 |
throw invalidFormat; |
1007 |
throw invalidFormat; |
| 1006 |
} |
1008 |
} |
| 1007 |
String memento = entry.getAttribute("memento"); //$NON-NLS-1$ |
1009 |
memento = entry.getAttribute("memento"); //$NON-NLS-1$ |
| 1008 |
if (memento == null) { |
1010 |
if (memento == null) { |
| 1009 |
throw invalidFormat; |
1011 |
throw invalidFormat; |
| 1010 |
} |
1012 |
} |
|
Lines 1016-1033
Link Here
|
| 1016 |
|
1018 |
|
| 1017 |
protected ConfigurationNotifier getConfigurationNotifier() { |
1019 |
protected ConfigurationNotifier getConfigurationNotifier() { |
| 1018 |
return new ConfigurationNotifier(); |
1020 |
return new ConfigurationNotifier(); |
| 1019 |
} |
1021 |
} |
| 1020 |
|
|
|
| 1021 |
/** |
| 1022 |
* Returns a list of launch delegates contributed for existing launch configuration |
| 1023 |
* types. |
| 1024 |
* |
| 1025 |
* @return list of ContributedDelegate |
| 1026 |
*/ |
| 1027 |
protected List getContributedDelegates() { |
| 1028 |
initializeContributedDelegates(); |
| 1029 |
return fContributedDelegates; |
| 1030 |
} |
| 1031 |
|
1022 |
|
| 1032 |
/** |
1023 |
/** |
| 1033 |
* @see ILaunchManager#getDebugTargets() |
1024 |
* @see ILaunchManager#getDebugTargets() |
|
Lines 1036-1044
Link Here
|
| 1036 |
synchronized (fLaunches) { |
1027 |
synchronized (fLaunches) { |
| 1037 |
List allTargets= new ArrayList(fLaunches.size()); |
1028 |
List allTargets= new ArrayList(fLaunches.size()); |
| 1038 |
if (fLaunches.size() > 0) { |
1029 |
if (fLaunches.size() > 0) { |
| 1039 |
Iterator e= fLaunches.iterator(); |
1030 |
Iterator e = fLaunches.iterator(); |
|
|
1031 |
IDebugTarget[] targets = null; |
| 1040 |
while (e.hasNext()) { |
1032 |
while (e.hasNext()) { |
| 1041 |
IDebugTarget[] targets= ((ILaunch) e.next()).getDebugTargets(); |
1033 |
targets = ((ILaunch) e.next()).getDebugTargets(); |
| 1042 |
for (int i = 0; i < targets.length; i++) { |
1034 |
for (int i = 0; i < targets.length; i++) { |
| 1043 |
allTargets.add(targets[i]); |
1035 |
allTargets.add(targets[i]); |
| 1044 |
} |
1036 |
} |
|
Lines 1073-1082
Link Here
|
| 1073 |
if (configEnv == null) { |
1065 |
if (configEnv == null) { |
| 1074 |
return null; |
1066 |
return null; |
| 1075 |
} |
1067 |
} |
| 1076 |
Map env = null; |
1068 |
Map env = new HashMap(); |
| 1077 |
// build base environment |
1069 |
// build base environment |
| 1078 |
env= new HashMap(); |
1070 |
boolean append = configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true); |
| 1079 |
boolean append= configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true); |
|
|
| 1080 |
if (append) { |
1071 |
if (append) { |
| 1081 |
env.putAll(getNativeEnvironmentCasePreserved()); |
1072 |
env.putAll(getNativeEnvironmentCasePreserved()); |
| 1082 |
} |
1073 |
} |
|
Lines 1084-1093
Link Here
|
| 1084 |
// Add variables from config |
1075 |
// Add variables from config |
| 1085 |
Iterator iter= configEnv.entrySet().iterator(); |
1076 |
Iterator iter= configEnv.entrySet().iterator(); |
| 1086 |
boolean win32= Platform.getOS().equals(Constants.OS_WIN32); |
1077 |
boolean win32= Platform.getOS().equals(Constants.OS_WIN32); |
|
|
1078 |
Map.Entry entry = null; |
| 1079 |
String key = null; |
| 1080 |
String value = null; |
| 1081 |
Object nativeValue = null; |
| 1082 |
Iterator envIter = null; |
| 1083 |
Map.Entry nativeEntry = null; |
| 1084 |
String nativeKey = null; |
| 1087 |
while (iter.hasNext()) { |
1085 |
while (iter.hasNext()) { |
| 1088 |
Map.Entry entry= (Map.Entry) iter.next(); |
1086 |
entry = (Map.Entry) iter.next(); |
| 1089 |
String key= (String) entry.getKey(); |
1087 |
key = (String) entry.getKey(); |
| 1090 |
String value = (String) entry.getValue(); |
1088 |
value = (String) entry.getValue(); |
| 1091 |
// translate any string substitution variables |
1089 |
// translate any string substitution variables |
| 1092 |
if (value != null) { |
1090 |
if (value != null) { |
| 1093 |
value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value); |
1091 |
value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value); |
|
Lines 1095-1101
Link Here
|
| 1095 |
boolean added= false; |
1093 |
boolean added= false; |
| 1096 |
if (win32) { |
1094 |
if (win32) { |
| 1097 |
// First, check if the key is an exact match for an existing key. |
1095 |
// First, check if the key is an exact match for an existing key. |
| 1098 |
Object nativeValue= env.get(key); |
1096 |
nativeValue = env.get(key); |
| 1099 |
if (nativeValue != null) { |
1097 |
if (nativeValue != null) { |
| 1100 |
// If an exact match is found, just replace the value |
1098 |
// If an exact match is found, just replace the value |
| 1101 |
env.put(key, value); |
1099 |
env.put(key, value); |
|
Lines 1103-1115
Link Here
|
| 1103 |
// Win32 vars are case-insensitive. If an exact match isn't found, iterate to |
1101 |
// Win32 vars are case-insensitive. If an exact match isn't found, iterate to |
| 1104 |
// check for a case-insensitive match. We maintain the key's case (see bug 86725), |
1102 |
// check for a case-insensitive match. We maintain the key's case (see bug 86725), |
| 1105 |
// but do a case-insensitive comparison (for example, "pAtH" will still override "PATH"). |
1103 |
// but do a case-insensitive comparison (for example, "pAtH" will still override "PATH"). |
| 1106 |
Iterator envIter= env.entrySet().iterator(); |
1104 |
envIter = env.entrySet().iterator(); |
| 1107 |
while (envIter.hasNext()) { |
1105 |
while (envIter.hasNext()) { |
| 1108 |
Map.Entry nativeEntry = (Map.Entry) envIter.next(); |
1106 |
nativeEntry = (Map.Entry) envIter.next(); |
| 1109 |
String nativeKey= (String) (nativeEntry).getKey(); |
1107 |
nativeKey = (String) (nativeEntry).getKey(); |
| 1110 |
if (nativeKey.equalsIgnoreCase(key)) { |
1108 |
if (nativeKey.equalsIgnoreCase(key)) { |
| 1111 |
nativeEntry.setValue(value); |
1109 |
nativeEntry.setValue(value); |
| 1112 |
added= true; |
1110 |
added = true; |
| 1113 |
break; |
1111 |
break; |
| 1114 |
} |
1112 |
} |
| 1115 |
} |
1113 |
} |
|
Lines 1120-1130
Link Here
|
| 1120 |
} |
1118 |
} |
| 1121 |
} |
1119 |
} |
| 1122 |
|
1120 |
|
| 1123 |
iter= env.entrySet().iterator(); |
1121 |
iter = env.entrySet().iterator(); |
| 1124 |
List strings= new ArrayList(env.size()); |
1122 |
List strings = new ArrayList(env.size()); |
|
|
1123 |
StringBuffer buffer = null; |
| 1125 |
while (iter.hasNext()) { |
1124 |
while (iter.hasNext()) { |
| 1126 |
Map.Entry entry = (Map.Entry) iter.next(); |
1125 |
entry = (Map.Entry) iter.next(); |
| 1127 |
StringBuffer buffer= new StringBuffer((String) entry.getKey()); |
1126 |
buffer = new StringBuffer((String) entry.getKey()); |
| 1128 |
buffer.append('=').append((String) entry.getValue()); |
1127 |
buffer.append('=').append((String) entry.getValue()); |
| 1129 |
strings.add(buffer.toString()); |
1128 |
strings.add(buffer.toString()); |
| 1130 |
} |
1129 |
} |
|
Lines 1215-1222
Link Here
|
| 1215 |
public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException { |
1214 |
public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException { |
| 1216 |
Iterator iter = getAllLaunchConfigurations().iterator(); |
1215 |
Iterator iter = getAllLaunchConfigurations().iterator(); |
| 1217 |
List configs = new ArrayList(); |
1216 |
List configs = new ArrayList(); |
|
|
1217 |
ILaunchConfiguration config = null; |
| 1218 |
while (iter.hasNext()) { |
1218 |
while (iter.hasNext()) { |
| 1219 |
ILaunchConfiguration config = (ILaunchConfiguration)iter.next(); |
1219 |
config = (ILaunchConfiguration)iter.next(); |
| 1220 |
if (config.getType().equals(type)) { |
1220 |
if (config.getType().equals(type)) { |
| 1221 |
configs.add(config); |
1221 |
configs.add(config); |
| 1222 |
} |
1222 |
} |
|
Lines 1224-1230
Link Here
|
| 1224 |
return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]); |
1224 |
return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]); |
| 1225 |
} |
1225 |
} |
| 1226 |
|
1226 |
|
| 1227 |
|
|
|
| 1228 |
/** |
1227 |
/** |
| 1229 |
* Returns all launch configurations that are stored as resources |
1228 |
* Returns all launch configurations that are stored as resources |
| 1230 |
* in the given project. |
1229 |
* in the given project. |
|
Lines 1236-1244
Link Here
|
| 1236 |
protected List getLaunchConfigurations(IProject project) { |
1235 |
protected List getLaunchConfigurations(IProject project) { |
| 1237 |
Iterator iter = getAllLaunchConfigurations().iterator(); |
1236 |
Iterator iter = getAllLaunchConfigurations().iterator(); |
| 1238 |
List configs = new ArrayList(); |
1237 |
List configs = new ArrayList(); |
|
|
1238 |
ILaunchConfiguration config = null; |
| 1239 |
IFile file = null; |
| 1239 |
while (iter.hasNext()) { |
1240 |
while (iter.hasNext()) { |
| 1240 |
ILaunchConfiguration config = (ILaunchConfiguration)iter.next(); |
1241 |
config = (ILaunchConfiguration)iter.next(); |
| 1241 |
IFile file = config.getFile(); |
1242 |
file = config.getFile(); |
| 1242 |
if (file != null && file.getProject().equals(project)) { |
1243 |
if (file != null && file.getProject().equals(project)) { |
| 1243 |
configs.add(config); |
1244 |
configs.add(config); |
| 1244 |
} |
1245 |
} |
|
Lines 1276-1291
Link Here
|
| 1276 |
} |
1277 |
} |
| 1277 |
} |
1278 |
} |
| 1278 |
|
1279 |
|
| 1279 |
/* (non-Javadoc) |
1280 |
/**) |
| 1280 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String) |
1281 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String) |
|
|
1282 |
* @deprecated launch modes are removed for 3.3M3 in favour of launching with options |
| 1281 |
*/ |
1283 |
*/ |
| 1282 |
public ILaunchMode getLaunchMode(String mode) { |
1284 |
public ILaunchMode getLaunchMode(String mode) { |
| 1283 |
initializeLaunchModes(); |
1285 |
initializeLaunchModes(); |
| 1284 |
return (ILaunchMode) fLaunchModes.get(mode); |
1286 |
return (ILaunchMode) fLaunchModes.get(mode); |
| 1285 |
} |
1287 |
} |
| 1286 |
|
1288 |
|
| 1287 |
/* (non-Javadoc) |
1289 |
/** |
| 1288 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchModes() |
1290 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchModes() |
|
|
1291 |
* @deprecated launch modes are removed for 3.3M3 in favour of launching with options |
| 1289 |
*/ |
1292 |
*/ |
| 1290 |
public ILaunchMode[] getLaunchModes() { |
1293 |
public ILaunchMode[] getLaunchModes() { |
| 1291 |
initializeLaunchModes(); |
1294 |
initializeLaunchModes(); |
|
Lines 1309-1315
Link Here
|
| 1309 |
Collection col = fLaunchOptions.values(); |
1312 |
Collection col = fLaunchOptions.values(); |
| 1310 |
return (ILaunchOption[])col.toArray(new ILaunchOption[col.size()]); |
1313 |
return (ILaunchOption[])col.toArray(new ILaunchOption[col.size()]); |
| 1311 |
} |
1314 |
} |
| 1312 |
|
1315 |
|
|
|
1316 |
/** |
| 1317 |
* Initializes the listing of registered launch options. Does no work if the mapping is already populated. |
| 1318 |
* |
| 1319 |
* <p> |
| 1320 |
* <strong>EXPERIMENTAL</strong>. This method has been added as |
| 1321 |
* part of a work in progress. There is no guarantee that this API will |
| 1322 |
* remain unchanged during the 3.3 release cycle. Please do not use this API |
| 1323 |
* without consulting with the Platform/Debug team. |
| 1324 |
* </p> |
| 1325 |
* @since 3.3 |
| 1326 |
*/ |
| 1327 |
private synchronized void initializeLaunchOptions() { |
| 1328 |
if(fLaunchOptions == null) { |
| 1329 |
try { |
| 1330 |
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_OPTIONS); |
| 1331 |
IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); |
| 1332 |
fLaunchOptions = new HashMap(); |
| 1333 |
ILaunchOption option = null; |
| 1334 |
for(int i = 0; i < infos.length; i++) { |
| 1335 |
option = new LaunchOption(infos[i]); |
| 1336 |
fLaunchOptions.put(option.getIdentifier(), option); |
| 1337 |
} |
| 1338 |
} |
| 1339 |
catch(CoreException ce) {DebugPlugin.log(ce);} |
| 1340 |
} |
| 1341 |
} |
| 1342 |
|
| 1343 |
/** |
| 1344 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchDelegates() |
| 1345 |
*/ |
| 1346 |
public ILaunchDelegate[] getLaunchDelegates() { |
| 1347 |
initializeLaunchDelegates(); |
| 1348 |
Collection col = fLaunchDelegates.values(); |
| 1349 |
return (ILaunchDelegate[]) col.toArray(new ILaunchDelegate[col.size()]); |
| 1350 |
} |
| 1351 |
|
| 1352 |
/** |
| 1353 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchDelegate(java.lang.String, java.lang.String, java.lang.String[]) |
| 1354 |
*/ |
| 1355 |
public ILaunchConfigurationDelegate[] getLaunchDelegates(String typeid, String mode, String[] options) { |
| 1356 |
try { |
| 1357 |
initializeLaunchDelegates(); |
| 1358 |
ILaunchDelegate ld = null; |
| 1359 |
boolean applies = true; |
| 1360 |
ArrayList list = new ArrayList(); |
| 1361 |
Set doptions = null; |
| 1362 |
for(Iterator iter = fLaunchDelegates.keySet().iterator(); iter.hasNext();) { |
| 1363 |
ld = (ILaunchDelegate) fLaunchDelegates.get(iter.next()); |
| 1364 |
doptions = ld.getOptions(); |
| 1365 |
if(ld.appliesTo(typeid, mode)) { |
| 1366 |
if(options != null) { |
| 1367 |
if(doptions.size() > 0 & options.length == 0) { |
| 1368 |
applies = false; |
| 1369 |
} |
| 1370 |
for(int i = 0; i < options.length; i++) { |
| 1371 |
applies &= doptions.contains(options[i]); |
| 1372 |
} |
| 1373 |
} |
| 1374 |
else if(doptions.size() > 0) { |
| 1375 |
applies = false; |
| 1376 |
} |
| 1377 |
if(applies) { |
| 1378 |
list.add(ld.getDelegate()); |
| 1379 |
} |
| 1380 |
applies = true; |
| 1381 |
} |
| 1382 |
} |
| 1383 |
return (ILaunchConfigurationDelegate[]) list.toArray(new ILaunchConfigurationDelegate[list.size()]); |
| 1384 |
} |
| 1385 |
catch(CoreException ce) {} |
| 1386 |
return null; |
| 1387 |
} |
| 1388 |
|
| 1389 |
/** |
| 1390 |
* Initializes the listing of delegates available to the launching framework |
| 1391 |
* |
| 1392 |
* <p> |
| 1393 |
* <strong>EXPERIMENTAL</strong>. This method has been added as |
| 1394 |
* part of a work in progress. There is no guarantee that this API will |
| 1395 |
* remain unchanged during the 3.3 release cycle. Please do not use this API |
| 1396 |
* without consulting with the Platform/Debug team. |
| 1397 |
* </p> |
| 1398 |
* @since 3.3 |
| 1399 |
*/ |
| 1400 |
private synchronized void initializeLaunchDelegates() { |
| 1401 |
if(fLaunchDelegates == null) { |
| 1402 |
fLaunchDelegates = new HashMap(); |
| 1403 |
//get all launch delegate contributions |
| 1404 |
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES); |
| 1405 |
IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); |
| 1406 |
ILaunchDelegate delegate = null; |
| 1407 |
for(int i = 0; i < infos.length; i++) { |
| 1408 |
delegate = new LaunchDelegate(infos[i]); |
| 1409 |
fLaunchDelegates.put(delegate.getIdentifier(), delegate); |
| 1410 |
} |
| 1411 |
//get all delegates from launch configuration type contributions |
| 1412 |
extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); |
| 1413 |
infos = extensionPoint.getConfigurationElements(); |
| 1414 |
for(int i = 0; i < infos.length; i++) { |
| 1415 |
//must check to see if delegate is provided in contribution |
| 1416 |
if(infos[i].getAttribute("delegate") != null) { //$NON-NLS-1$ |
| 1417 |
delegate = new LaunchDelegate(infos[i]); |
| 1418 |
fLaunchDelegates.put(delegate.getIdentifier(), delegate); |
| 1419 |
} |
| 1420 |
} |
| 1421 |
} |
| 1422 |
} |
| 1423 |
|
| 1313 |
/** |
1424 |
/** |
| 1314 |
* Returns all launch configurations that are stored locally. |
1425 |
* Returns all launch configurations that are stored locally. |
| 1315 |
* |
1426 |
* |
|
Lines 1397-1405
Link Here
|
| 1397 |
if (Platform.getOS().equals(Constants.OS_WIN32)) { |
1508 |
if (Platform.getOS().equals(Constants.OS_WIN32)) { |
| 1398 |
fgNativeEnv= new HashMap(); |
1509 |
fgNativeEnv= new HashMap(); |
| 1399 |
Iterator entries = casePreserved.entrySet().iterator(); |
1510 |
Iterator entries = casePreserved.entrySet().iterator(); |
|
|
1511 |
Map.Entry entry = null; |
| 1512 |
String key = null; |
| 1400 |
while (entries.hasNext()) { |
1513 |
while (entries.hasNext()) { |
| 1401 |
Map.Entry entry = (Entry) entries.next(); |
1514 |
entry = (Entry) entries.next(); |
| 1402 |
String key = ((String)entry.getKey()).toUpperCase(); |
1515 |
key = ((String)entry.getKey()).toUpperCase(); |
| 1403 |
fgNativeEnv.put(key, entry.getValue()); |
1516 |
fgNativeEnv.put(key, entry.getValue()); |
| 1404 |
} |
1517 |
} |
| 1405 |
} else { |
1518 |
} else { |
|
Lines 1425-1434
Link Here
|
| 1425 |
*/ |
1538 |
*/ |
| 1426 |
public IProcess[] getProcesses() { |
1539 |
public IProcess[] getProcesses() { |
| 1427 |
synchronized (fLaunches) { |
1540 |
synchronized (fLaunches) { |
| 1428 |
List allProcesses= new ArrayList(fLaunches.size()); |
1541 |
List allProcesses = new ArrayList(fLaunches.size()); |
| 1429 |
Iterator e= fLaunches.iterator(); |
1542 |
Iterator e = fLaunches.iterator(); |
|
|
1543 |
IProcess[] processes = null; |
| 1430 |
while (e.hasNext()) { |
1544 |
while (e.hasNext()) { |
| 1431 |
IProcess[] processes= ((ILaunch) e.next()).getProcesses(); |
1545 |
processes = ((ILaunch) e.next()).getProcesses(); |
| 1432 |
for (int i= 0; i < processes.length; i++) { |
1546 |
for (int i= 0; i < processes.length; i++) { |
| 1433 |
allProcesses.add(processes[i]); |
1547 |
allProcesses.add(processes[i]); |
| 1434 |
} |
1548 |
} |
|
Lines 1494-1502
Link Here
|
| 1494 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS); |
1608 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS); |
| 1495 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
1609 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
| 1496 |
fComparators = new HashMap(infos.length); |
1610 |
fComparators = new HashMap(infos.length); |
|
|
1611 |
IConfigurationElement configurationElement = null; |
| 1612 |
String attr = null; |
| 1497 |
for (int i= 0; i < infos.length; i++) { |
1613 |
for (int i= 0; i < infos.length; i++) { |
| 1498 |
IConfigurationElement configurationElement = infos[i]; |
1614 |
configurationElement = infos[i]; |
| 1499 |
String attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$ |
1615 |
attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$ |
| 1500 |
if (attr != null) { |
1616 |
if (attr != null) { |
| 1501 |
fComparators.put(attr, new LaunchConfigurationComparator(configurationElement)); |
1617 |
fComparators.put(attr, new LaunchConfigurationComparator(configurationElement)); |
| 1502 |
} else { |
1618 |
} else { |
|
Lines 1508-1539
Link Here
|
| 1508 |
} |
1624 |
} |
| 1509 |
} |
1625 |
} |
| 1510 |
} |
1626 |
} |
| 1511 |
|
1627 |
|
| 1512 |
/** |
1628 |
/** |
| 1513 |
* Initializes contributed launch delegates (i.e. delegates contributed |
1629 |
* Initializes the listing of <code>LaunchConfigurationType</code>s. |
| 1514 |
* to an existing launch configuration type). |
|
|
| 1515 |
*/ |
1630 |
*/ |
| 1516 |
private synchronized void initializeContributedDelegates() { |
|
|
| 1517 |
if (fContributedDelegates == null) { |
| 1518 |
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES); |
| 1519 |
IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); |
| 1520 |
fContributedDelegates = new ArrayList(infos.length); |
| 1521 |
for (int i= 0; i < infos.length; i++) { |
| 1522 |
fContributedDelegates.add(new ContributedDelegate(infos[i])); |
| 1523 |
} |
| 1524 |
} |
| 1525 |
} |
| 1526 |
|
| 1527 |
private synchronized void initializeLaunchConfigurationTypes() { |
1631 |
private synchronized void initializeLaunchConfigurationTypes() { |
| 1528 |
if (fLaunchConfigurationTypes == null) { |
1632 |
if (fLaunchConfigurationTypes == null) { |
| 1529 |
hookResourceChangeListener(); |
1633 |
hookResourceChangeListener(); |
| 1530 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); |
1634 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); |
| 1531 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
1635 |
IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); |
| 1532 |
fLaunchConfigurationTypes= new ArrayList(infos.length); |
1636 |
fLaunchConfigurationTypes = new ArrayList(infos.length); |
| 1533 |
for (int i= 0; i < infos.length; i++) { |
1637 |
for (int i= 0; i < infos.length; i++) { |
| 1534 |
IConfigurationElement configurationElement = infos[i]; |
1638 |
fLaunchConfigurationTypes.add(new LaunchConfigurationType(infos[i])); |
| 1535 |
LaunchConfigurationType configType = new LaunchConfigurationType(configurationElement); |
|
|
| 1536 |
fLaunchConfigurationTypes.add(configType); |
| 1537 |
} |
1639 |
} |
| 1538 |
} |
1640 |
} |
| 1539 |
} |
1641 |
} |
|
Lines 1543-1548
Link Here
|
| 1543 |
* |
1645 |
* |
| 1544 |
* @exception CoreException if an exception occurs reading |
1646 |
* @exception CoreException if an exception occurs reading |
| 1545 |
* the extensions |
1647 |
* the extensions |
|
|
1648 |
* |
| 1546 |
*/ |
1649 |
*/ |
| 1547 |
private synchronized void initializeLaunchModes() { |
1650 |
private synchronized void initializeLaunchModes() { |
| 1548 |
if (fLaunchModes == null) { |
1651 |
if (fLaunchModes == null) { |
|
Lines 1559-1584
Link Here
|
| 1559 |
catch (CoreException e) {DebugPlugin.log(e);} |
1662 |
catch (CoreException e) {DebugPlugin.log(e);} |
| 1560 |
} |
1663 |
} |
| 1561 |
} |
1664 |
} |
| 1562 |
|
|
|
| 1563 |
/** |
| 1564 |
* Initializes the listing of registered launch options. Does no work if the mapping is already populated. |
| 1565 |
* @since 3.3 |
| 1566 |
*/ |
| 1567 |
private synchronized void initializeLaunchOptions() { |
| 1568 |
if(fLaunchOptions == null) { |
| 1569 |
try { |
| 1570 |
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_OPTIONS); |
| 1571 |
IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); |
| 1572 |
fLaunchOptions = new HashMap(); |
| 1573 |
ILaunchOption option = null; |
| 1574 |
for(int i = 0; i < infos.length; i++) { |
| 1575 |
option = new LaunchOption(infos[i]); |
| 1576 |
fLaunchOptions.put(option.getIdentifier(), option); |
| 1577 |
} |
| 1578 |
} |
| 1579 |
catch(CoreException ce) {DebugPlugin.log(ce);} |
| 1580 |
} |
| 1581 |
} |
| 1582 |
|
1665 |
|
| 1583 |
/** |
1666 |
/** |
| 1584 |
* Initializes source container type and source path computer extensions. |
1667 |
* Initializes source container type and source path computer extensions. |
|
Lines 1615-1623
Link Here
|
| 1615 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS); |
1698 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS); |
| 1616 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
1699 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
| 1617 |
fSourceLocators= new HashMap(infos.length); |
1700 |
fSourceLocators= new HashMap(infos.length); |
|
|
1701 |
IConfigurationElement configurationElement = null; |
| 1702 |
String id = null; |
| 1618 |
for (int i= 0; i < infos.length; i++) { |
1703 |
for (int i= 0; i < infos.length; i++) { |
| 1619 |
IConfigurationElement configurationElement = infos[i]; |
1704 |
configurationElement = infos[i]; |
| 1620 |
String id = configurationElement.getAttribute("id"); //$NON-NLS-1$ |
1705 |
id = configurationElement.getAttribute("id"); //$NON-NLS-1$ |
| 1621 |
if (id != null) { |
1706 |
if (id != null) { |
| 1622 |
fSourceLocators.put(id,configurationElement); |
1707 |
fSourceLocators.put(id,configurationElement); |
| 1623 |
} else { |
1708 |
} else { |
|
Lines 1812-1819
Link Here
|
| 1812 |
if (!configs.isEmpty()) { |
1897 |
if (!configs.isEmpty()) { |
| 1813 |
Iterator iterator = configs.iterator(); |
1898 |
Iterator iterator = configs.iterator(); |
| 1814 |
while (iterator.hasNext()) { |
1899 |
while (iterator.hasNext()) { |
| 1815 |
ILaunchConfiguration configuration = (ILaunchConfiguration)iterator.next(); |
1900 |
launchConfigurationDeleted((ILaunchConfiguration)iterator.next()); |
| 1816 |
launchConfigurationDeleted(configuration); |
|
|
| 1817 |
} |
1901 |
} |
| 1818 |
} |
1902 |
} |
| 1819 |
//bug 12134 |
1903 |
//bug 12134 |
|
Lines 1832-1839
Link Here
|
| 1832 |
if (!configs.isEmpty()) { |
1916 |
if (!configs.isEmpty()) { |
| 1833 |
Iterator iterator = configs.iterator(); |
1917 |
Iterator iterator = configs.iterator(); |
| 1834 |
while (iterator.hasNext()) { |
1918 |
while (iterator.hasNext()) { |
| 1835 |
ILaunchConfiguration config = (ILaunchConfiguration) iterator.next(); |
1919 |
launchConfigurationAdded((ILaunchConfiguration) iterator.next()); |
| 1836 |
launchConfigurationAdded(config); |
|
|
| 1837 |
} |
1920 |
} |
| 1838 |
} |
1921 |
} |
| 1839 |
} |
1922 |
} |
|
Lines 1953-1960
Link Here
|
| 1953 |
fLaunchesListeners = new ListenerList(); |
2036 |
fLaunchesListeners = new ListenerList(); |
| 1954 |
fLaunchConfigurationListeners = new ListenerList(); |
2037 |
fLaunchConfigurationListeners = new ListenerList(); |
| 1955 |
ILaunch[] launches = getLaunches(); |
2038 |
ILaunch[] launches = getLaunches(); |
|
|
2039 |
ILaunch launch = null; |
| 1956 |
for (int i= 0; i < launches.length; i++) { |
2040 |
for (int i= 0; i < launches.length; i++) { |
| 1957 |
ILaunch launch= launches[i]; |
2041 |
launch = launches[i]; |
| 1958 |
try { |
2042 |
try { |
| 1959 |
if (launch instanceof IDisconnect) { |
2043 |
if (launch instanceof IDisconnect) { |
| 1960 |
IDisconnect disconnect = (IDisconnect)launch; |
2044 |
IDisconnect disconnect = (IDisconnect)launch; |
|
Lines 2014-2021
Link Here
|
| 2014 |
*/ |
2098 |
*/ |
| 2015 |
protected void verifyConfigurations(List verify, List valid) { |
2099 |
protected void verifyConfigurations(List verify, List valid) { |
| 2016 |
Iterator configs = verify.iterator(); |
2100 |
Iterator configs = verify.iterator(); |
|
|
2101 |
ILaunchConfiguration config = null; |
| 2017 |
while (configs.hasNext()) { |
2102 |
while (configs.hasNext()) { |
| 2018 |
ILaunchConfiguration config = (ILaunchConfiguration)configs.next(); |
2103 |
config = (ILaunchConfiguration)configs.next(); |
| 2019 |
if (isValid(config)) { |
2104 |
if (isValid(config)) { |
| 2020 |
valid.add(config); |
2105 |
valid.add(config); |
| 2021 |
} |
2106 |
} |