|
Lines 148-154
Link Here
|
| 148 |
* @since 3.2 |
148 |
* @since 3.2 |
| 149 |
*/ |
149 |
*/ |
| 150 |
protected static final IStatus deleteAssociatedLaunchConfigs = new Status(IStatus.INFO, DEBUG_CORE, 225, EMPTY_STRING, null); |
150 |
protected static final IStatus deleteAssociatedLaunchConfigs = new Status(IStatus.INFO, DEBUG_CORE, 225, EMPTY_STRING, null); |
| 151 |
|
|
|
| 152 |
|
151 |
|
| 153 |
|
152 |
|
| 154 |
/** |
153 |
/** |
|
Lines 507-523
Link Here
|
| 507 |
* @throws IOException if the encoding attempted to be used is not supported |
506 |
* @throws IOException if the encoding attempted to be used is not supported |
| 508 |
*/ |
507 |
*/ |
| 509 |
public static String serializeDocument(Document doc) throws TransformerException, IOException { |
508 |
public static String serializeDocument(Document doc) throws TransformerException, IOException { |
| 510 |
ByteArrayOutputStream s= new ByteArrayOutputStream(); |
509 |
ByteArrayOutputStream s = new ByteArrayOutputStream(); |
| 511 |
|
510 |
TransformerFactory factory = TransformerFactory.newInstance(); |
| 512 |
TransformerFactory factory= TransformerFactory.newInstance(); |
511 |
Transformer transformer = factory.newTransformer(); |
| 513 |
Transformer transformer= factory.newTransformer(); |
|
|
| 514 |
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ |
512 |
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ |
| 515 |
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ |
513 |
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ |
| 516 |
|
514 |
DOMSource source = new DOMSource(doc); |
| 517 |
DOMSource source= new DOMSource(doc); |
515 |
StreamResult outputTarget = new StreamResult(s); |
| 518 |
StreamResult outputTarget= new StreamResult(s); |
|
|
| 519 |
transformer.transform(source, outputTarget); |
516 |
transformer.transform(source, outputTarget); |
| 520 |
|
|
|
| 521 |
return s.toString("UTF8"); //$NON-NLS-1$ |
517 |
return s.toString("UTF8"); //$NON-NLS-1$ |
| 522 |
} |
518 |
} |
| 523 |
|
519 |
|
|
Lines 564-573
Link Here
|
| 564 |
private HashMap fLaunchOptions = null; |
560 |
private HashMap fLaunchOptions = null; |
| 565 |
|
561 |
|
| 566 |
/** |
562 |
/** |
| 567 |
* List of contributed launch delegates (delegates contributed for existing |
563 |
* A map of LaunchDelegate objects stored by id of delegate, or launch config type |
| 568 |
* launch configuration types). |
|
|
| 569 |
*/ |
564 |
*/ |
| 570 |
private List fContributedDelegates = null; |
565 |
private HashMap fLaunchDelegates = null; |
|
|
566 |
|
| 567 |
/** |
| 568 |
* A map of duplicate delegates arranged by config type id |
| 569 |
*/ |
| 570 |
private HashMap fDuplicateDelegates = null; |
| 571 |
|
571 |
|
| 572 |
/** |
572 |
/** |
| 573 |
* Collection of launches |
573 |
* Collection of launches |
|
Lines 581-587
Link Here
|
| 581 |
/** |
581 |
/** |
| 582 |
* Collection of listeners |
582 |
* Collection of listeners |
| 583 |
*/ |
583 |
*/ |
| 584 |
private ListenerList fListeners= new ListenerList(); |
584 |
private ListenerList fListeners = new ListenerList(); |
| 585 |
|
585 |
|
| 586 |
/** |
586 |
/** |
| 587 |
* Collection of "plural" listeners. |
587 |
* Collection of "plural" listeners. |
|
Lines 630-636
Link Here
|
| 630 |
* and values are associated configuration elements. |
630 |
* and values are associated configuration elements. |
| 631 |
*/ |
631 |
*/ |
| 632 |
private Map sourcePathComputers; |
632 |
private Map sourcePathComputers; |
| 633 |
|
633 |
|
| 634 |
/** |
634 |
/** |
| 635 |
* @see ILaunchManager#addLaunch(ILaunch) |
635 |
* @see ILaunchManager#addLaunch(ILaunch) |
| 636 |
*/ |
636 |
*/ |
|
Lines 830-837
Link Here
|
| 830 |
} |
830 |
} |
| 831 |
Iterator iter = list.iterator(); |
831 |
Iterator iter = list.iterator(); |
| 832 |
List configs = new ArrayList(list.size()); |
832 |
List configs = new ArrayList(list.size()); |
|
|
833 |
IFile file = null; |
| 833 |
while (iter.hasNext()) { |
834 |
while (iter.hasNext()) { |
| 834 |
IFile file = (IFile)iter.next(); |
835 |
file = (IFile)iter.next(); |
| 835 |
configs.add(getLaunchConfiguration(file)); |
836 |
configs.add(getLaunchConfiguration(file)); |
| 836 |
} |
837 |
} |
| 837 |
return configs; |
838 |
return configs; |
|
Lines 856-863
Link Here
|
| 856 |
} |
857 |
} |
| 857 |
}; |
858 |
}; |
| 858 |
String[] files = directory.list(filter); |
859 |
String[] files = directory.list(filter); |
|
|
860 |
LaunchConfiguration config = null; |
| 859 |
for (int i = 0; i < files.length; i++) { |
861 |
for (int i = 0; i < files.length; i++) { |
| 860 |
LaunchConfiguration config = new LaunchConfiguration(containerPath.append(files[i])); |
862 |
config = new LaunchConfiguration(containerPath.append(files[i])); |
| 861 |
configs.add(config); |
863 |
configs.add(config); |
| 862 |
} |
864 |
} |
| 863 |
} |
865 |
} |
|
Lines 893-905
Link Here
|
| 893 |
try { |
895 |
try { |
| 894 |
index = Integer.parseInt(trailer); |
896 |
index = Integer.parseInt(trailer); |
| 895 |
baseName = baseName.substring(0, copyIndex); |
897 |
baseName = baseName.substring(0, copyIndex); |
| 896 |
} catch (NumberFormatException nfe) { |
898 |
} |
| 897 |
} |
899 |
catch (NumberFormatException nfe) {} |
| 898 |
} |
900 |
} |
| 899 |
} |
901 |
} |
| 900 |
String newName = baseName; |
902 |
String newName = baseName; |
| 901 |
|
903 |
|
| 902 |
StringBuffer buffer= null; |
904 |
StringBuffer buffer = null; |
| 903 |
while (isExistingLaunchConfigurationName(newName)) { |
905 |
while (isExistingLaunchConfigurationName(newName)) { |
| 904 |
buffer = new StringBuffer(baseName); |
906 |
buffer = new StringBuffer(baseName); |
| 905 |
buffer.append(" ("); //$NON-NLS-1$ |
907 |
buffer.append(" ("); //$NON-NLS-1$ |
|
Lines 995-1010
Link Here
|
| 995 |
List configs = new ArrayList(4); |
997 |
List configs = new ArrayList(4); |
| 996 |
NodeList list = root.getChildNodes(); |
998 |
NodeList list = root.getChildNodes(); |
| 997 |
int length = list.getLength(); |
999 |
int length = list.getLength(); |
|
|
1000 |
Node node = null; |
| 1001 |
Element entry = null; |
| 1002 |
String memento = null; |
| 998 |
for (int i = 0; i < length; ++i) { |
1003 |
for (int i = 0; i < length; ++i) { |
| 999 |
Node node = list.item(i); |
1004 |
node = list.item(i); |
| 1000 |
short type = node.getNodeType(); |
1005 |
short type = node.getNodeType(); |
| 1001 |
if (type == Node.ELEMENT_NODE) { |
1006 |
if (type == Node.ELEMENT_NODE) { |
| 1002 |
Element entry = (Element) node; |
1007 |
entry = (Element) node; |
| 1003 |
String nodeName = entry.getNodeName(); |
1008 |
if (!entry.getNodeName().equals("launchConfiguration")) { //$NON-NLS-1$ |
| 1004 |
if (!nodeName.equals("launchConfiguration")) { //$NON-NLS-1$ |
|
|
| 1005 |
throw invalidFormat; |
1009 |
throw invalidFormat; |
| 1006 |
} |
1010 |
} |
| 1007 |
String memento = entry.getAttribute("memento"); //$NON-NLS-1$ |
1011 |
memento = entry.getAttribute("memento"); //$NON-NLS-1$ |
| 1008 |
if (memento == null) { |
1012 |
if (memento == null) { |
| 1009 |
throw invalidFormat; |
1013 |
throw invalidFormat; |
| 1010 |
} |
1014 |
} |
|
Lines 1016-1033
Link Here
|
| 1016 |
|
1020 |
|
| 1017 |
protected ConfigurationNotifier getConfigurationNotifier() { |
1021 |
protected ConfigurationNotifier getConfigurationNotifier() { |
| 1018 |
return new ConfigurationNotifier(); |
1022 |
return new ConfigurationNotifier(); |
| 1019 |
} |
1023 |
} |
| 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 |
|
1024 |
|
| 1032 |
/** |
1025 |
/** |
| 1033 |
* @see ILaunchManager#getDebugTargets() |
1026 |
* @see ILaunchManager#getDebugTargets() |
|
Lines 1036-1044
Link Here
|
| 1036 |
synchronized (fLaunches) { |
1029 |
synchronized (fLaunches) { |
| 1037 |
List allTargets= new ArrayList(fLaunches.size()); |
1030 |
List allTargets= new ArrayList(fLaunches.size()); |
| 1038 |
if (fLaunches.size() > 0) { |
1031 |
if (fLaunches.size() > 0) { |
| 1039 |
Iterator e= fLaunches.iterator(); |
1032 |
Iterator e = fLaunches.iterator(); |
|
|
1033 |
IDebugTarget[] targets = null; |
| 1040 |
while (e.hasNext()) { |
1034 |
while (e.hasNext()) { |
| 1041 |
IDebugTarget[] targets= ((ILaunch) e.next()).getDebugTargets(); |
1035 |
targets = ((ILaunch) e.next()).getDebugTargets(); |
| 1042 |
for (int i = 0; i < targets.length; i++) { |
1036 |
for (int i = 0; i < targets.length; i++) { |
| 1043 |
allTargets.add(targets[i]); |
1037 |
allTargets.add(targets[i]); |
| 1044 |
} |
1038 |
} |
|
Lines 1073-1082
Link Here
|
| 1073 |
if (configEnv == null) { |
1067 |
if (configEnv == null) { |
| 1074 |
return null; |
1068 |
return null; |
| 1075 |
} |
1069 |
} |
| 1076 |
Map env = null; |
1070 |
Map env = new HashMap(); |
| 1077 |
// build base environment |
1071 |
// build base environment |
| 1078 |
env= new HashMap(); |
1072 |
boolean append = configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true); |
| 1079 |
boolean append= configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true); |
|
|
| 1080 |
if (append) { |
1073 |
if (append) { |
| 1081 |
env.putAll(getNativeEnvironmentCasePreserved()); |
1074 |
env.putAll(getNativeEnvironmentCasePreserved()); |
| 1082 |
} |
1075 |
} |
|
Lines 1084-1093
Link Here
|
| 1084 |
// Add variables from config |
1077 |
// Add variables from config |
| 1085 |
Iterator iter= configEnv.entrySet().iterator(); |
1078 |
Iterator iter= configEnv.entrySet().iterator(); |
| 1086 |
boolean win32= Platform.getOS().equals(Constants.OS_WIN32); |
1079 |
boolean win32= Platform.getOS().equals(Constants.OS_WIN32); |
|
|
1080 |
Map.Entry entry = null; |
| 1081 |
String key = null; |
| 1082 |
String value = null; |
| 1083 |
Object nativeValue = null; |
| 1084 |
Iterator envIter = null; |
| 1085 |
Map.Entry nativeEntry = null; |
| 1086 |
String nativeKey = null; |
| 1087 |
while (iter.hasNext()) { |
1087 |
while (iter.hasNext()) { |
| 1088 |
Map.Entry entry= (Map.Entry) iter.next(); |
1088 |
entry = (Map.Entry) iter.next(); |
| 1089 |
String key= (String) entry.getKey(); |
1089 |
key = (String) entry.getKey(); |
| 1090 |
String value = (String) entry.getValue(); |
1090 |
value = (String) entry.getValue(); |
| 1091 |
// translate any string substitution variables |
1091 |
// translate any string substitution variables |
| 1092 |
if (value != null) { |
1092 |
if (value != null) { |
| 1093 |
value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value); |
1093 |
value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value); |
|
Lines 1095-1101
Link Here
|
| 1095 |
boolean added= false; |
1095 |
boolean added= false; |
| 1096 |
if (win32) { |
1096 |
if (win32) { |
| 1097 |
// First, check if the key is an exact match for an existing key. |
1097 |
// First, check if the key is an exact match for an existing key. |
| 1098 |
Object nativeValue= env.get(key); |
1098 |
nativeValue = env.get(key); |
| 1099 |
if (nativeValue != null) { |
1099 |
if (nativeValue != null) { |
| 1100 |
// If an exact match is found, just replace the value |
1100 |
// If an exact match is found, just replace the value |
| 1101 |
env.put(key, value); |
1101 |
env.put(key, value); |
|
Lines 1103-1115
Link Here
|
| 1103 |
// Win32 vars are case-insensitive. If an exact match isn't found, iterate to |
1103 |
// 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), |
1104 |
// 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"). |
1105 |
// but do a case-insensitive comparison (for example, "pAtH" will still override "PATH"). |
| 1106 |
Iterator envIter= env.entrySet().iterator(); |
1106 |
envIter = env.entrySet().iterator(); |
| 1107 |
while (envIter.hasNext()) { |
1107 |
while (envIter.hasNext()) { |
| 1108 |
Map.Entry nativeEntry = (Map.Entry) envIter.next(); |
1108 |
nativeEntry = (Map.Entry) envIter.next(); |
| 1109 |
String nativeKey= (String) (nativeEntry).getKey(); |
1109 |
nativeKey = (String) (nativeEntry).getKey(); |
| 1110 |
if (nativeKey.equalsIgnoreCase(key)) { |
1110 |
if (nativeKey.equalsIgnoreCase(key)) { |
| 1111 |
nativeEntry.setValue(value); |
1111 |
nativeEntry.setValue(value); |
| 1112 |
added= true; |
1112 |
added = true; |
| 1113 |
break; |
1113 |
break; |
| 1114 |
} |
1114 |
} |
| 1115 |
} |
1115 |
} |
|
Lines 1120-1130
Link Here
|
| 1120 |
} |
1120 |
} |
| 1121 |
} |
1121 |
} |
| 1122 |
|
1122 |
|
| 1123 |
iter= env.entrySet().iterator(); |
1123 |
iter = env.entrySet().iterator(); |
| 1124 |
List strings= new ArrayList(env.size()); |
1124 |
List strings = new ArrayList(env.size()); |
|
|
1125 |
StringBuffer buffer = null; |
| 1125 |
while (iter.hasNext()) { |
1126 |
while (iter.hasNext()) { |
| 1126 |
Map.Entry entry = (Map.Entry) iter.next(); |
1127 |
entry = (Map.Entry) iter.next(); |
| 1127 |
StringBuffer buffer= new StringBuffer((String) entry.getKey()); |
1128 |
buffer = new StringBuffer((String) entry.getKey()); |
| 1128 |
buffer.append('=').append((String) entry.getValue()); |
1129 |
buffer.append('=').append((String) entry.getValue()); |
| 1129 |
strings.add(buffer.toString()); |
1130 |
strings.add(buffer.toString()); |
| 1130 |
} |
1131 |
} |
|
Lines 1215-1222
Link Here
|
| 1215 |
public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException { |
1216 |
public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException { |
| 1216 |
Iterator iter = getAllLaunchConfigurations().iterator(); |
1217 |
Iterator iter = getAllLaunchConfigurations().iterator(); |
| 1217 |
List configs = new ArrayList(); |
1218 |
List configs = new ArrayList(); |
|
|
1219 |
ILaunchConfiguration config = null; |
| 1218 |
while (iter.hasNext()) { |
1220 |
while (iter.hasNext()) { |
| 1219 |
ILaunchConfiguration config = (ILaunchConfiguration)iter.next(); |
1221 |
config = (ILaunchConfiguration)iter.next(); |
| 1220 |
if (config.getType().equals(type)) { |
1222 |
if (config.getType().equals(type)) { |
| 1221 |
configs.add(config); |
1223 |
configs.add(config); |
| 1222 |
} |
1224 |
} |
|
Lines 1224-1230
Link Here
|
| 1224 |
return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]); |
1226 |
return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]); |
| 1225 |
} |
1227 |
} |
| 1226 |
|
1228 |
|
| 1227 |
|
|
|
| 1228 |
/** |
1229 |
/** |
| 1229 |
* Returns all launch configurations that are stored as resources |
1230 |
* Returns all launch configurations that are stored as resources |
| 1230 |
* in the given project. |
1231 |
* in the given project. |
|
Lines 1236-1244
Link Here
|
| 1236 |
protected List getLaunchConfigurations(IProject project) { |
1237 |
protected List getLaunchConfigurations(IProject project) { |
| 1237 |
Iterator iter = getAllLaunchConfigurations().iterator(); |
1238 |
Iterator iter = getAllLaunchConfigurations().iterator(); |
| 1238 |
List configs = new ArrayList(); |
1239 |
List configs = new ArrayList(); |
|
|
1240 |
ILaunchConfiguration config = null; |
| 1241 |
IFile file = null; |
| 1239 |
while (iter.hasNext()) { |
1242 |
while (iter.hasNext()) { |
| 1240 |
ILaunchConfiguration config = (ILaunchConfiguration)iter.next(); |
1243 |
config = (ILaunchConfiguration)iter.next(); |
| 1241 |
IFile file = config.getFile(); |
1244 |
file = config.getFile(); |
| 1242 |
if (file != null && file.getProject().equals(project)) { |
1245 |
if (file != null && file.getProject().equals(project)) { |
| 1243 |
configs.add(config); |
1246 |
configs.add(config); |
| 1244 |
} |
1247 |
} |
|
Lines 1276-1282
Link Here
|
| 1276 |
} |
1279 |
} |
| 1277 |
} |
1280 |
} |
| 1278 |
|
1281 |
|
| 1279 |
/* (non-Javadoc) |
1282 |
/**) |
| 1280 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String) |
1283 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String) |
| 1281 |
*/ |
1284 |
*/ |
| 1282 |
public ILaunchMode getLaunchMode(String mode) { |
1285 |
public ILaunchMode getLaunchMode(String mode) { |
|
Lines 1284-1290
Link Here
|
| 1284 |
return (ILaunchMode) fLaunchModes.get(mode); |
1287 |
return (ILaunchMode) fLaunchModes.get(mode); |
| 1285 |
} |
1288 |
} |
| 1286 |
|
1289 |
|
| 1287 |
/* (non-Javadoc) |
1290 |
/** |
| 1288 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchModes() |
1291 |
* @see org.eclipse.debug.core.ILaunchManager#getLaunchModes() |
| 1289 |
*/ |
1292 |
*/ |
| 1290 |
public ILaunchMode[] getLaunchModes() { |
1293 |
public ILaunchMode[] getLaunchModes() { |
|
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 |
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_OPTIONS); |
| 1330 |
IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); |
| 1331 |
fLaunchOptions = new HashMap(); |
| 1332 |
ILaunchOption option = null; |
| 1333 |
for(int i = 0; i < infos.length; i++) { |
| 1334 |
option = new LaunchOption(infos[i]); |
| 1335 |
fLaunchOptions.put(option.getIdentifier(), option); |
| 1336 |
} |
| 1337 |
} |
| 1338 |
} |
| 1339 |
|
| 1340 |
/** |
| 1341 |
* Returns all of the launch delegates. The rturned listing of delegates cannot be directly used to launch, |
| 1342 |
* instead the method <code>IlaunchDelegate.getDelegate</code> must be used to acquire an executable form of |
| 1343 |
* the delegate, allowing us to maintain lazy loading of the delegates themselves. |
| 1344 |
* @return all of the launch delegates |
| 1345 |
* @since 3.3 |
| 1346 |
* <p> |
| 1347 |
* <strong>EXPERIMENTAL</strong>. This method has been added as |
| 1348 |
* part of a work in progress. There is no guarantee that this API will |
| 1349 |
* remain unchanged during the 3.3 release cycle. Please do not use this API |
| 1350 |
* without consulting with the Platform/Debug team. |
| 1351 |
* </p> |
| 1352 |
*/ |
| 1353 |
public LaunchDelegate[] getLaunchDelegates() { |
| 1354 |
initializeLaunchDelegates(); |
| 1355 |
Collection col = fLaunchDelegates.values(); |
| 1356 |
return (LaunchDelegate[]) col.toArray(new LaunchDelegate[col.size()]); |
| 1357 |
} |
| 1358 |
|
| 1359 |
/** Returns the launch delegates that applies to the specified options for the specified mode and type id |
| 1360 |
* @param typeid the <code>ILaunchConfigurationType</code> id |
| 1361 |
* @param the mode id |
| 1362 |
* @param options the array of options to find the delegate for |
| 1363 |
* @return the delegates that apply to the specified launch options for the specified mode and type id |
| 1364 |
* |
| 1365 |
* <p> |
| 1366 |
* <strong>EXPERIMENTAL</strong>. This method has been added as |
| 1367 |
* part of a work in progress. There is no guarantee that this API will |
| 1368 |
* remain unchanged during the 3.3 release cycle. Please do not use this API |
| 1369 |
* without consulting with the Platform/Debug team. |
| 1370 |
* </p> |
| 1371 |
* @since 3.3 |
| 1372 |
*/ |
| 1373 |
public LaunchDelegate[] getLaunchDelegates(String typeid, String mode, String[] options) { |
| 1374 |
initializeLaunchDelegates(); |
| 1375 |
LaunchDelegate ld = null; |
| 1376 |
boolean applies = true; |
| 1377 |
ArrayList list = new ArrayList(); |
| 1378 |
Set doptions = null; |
| 1379 |
for(Iterator iter = fLaunchDelegates.keySet().iterator(); iter.hasNext();) { |
| 1380 |
ld = (LaunchDelegate) fLaunchDelegates.get(iter.next()); |
| 1381 |
doptions = ld.getOptions(); |
| 1382 |
if(ld.appliesTo(typeid, mode)) { |
| 1383 |
if(options != null) { |
| 1384 |
if(doptions.size() > 0 & options.length == 0) { |
| 1385 |
applies = false; |
| 1386 |
} |
| 1387 |
for(int i = 0; i < options.length; i++) { |
| 1388 |
applies &= doptions.contains(options[i]); |
| 1389 |
} |
| 1390 |
} |
| 1391 |
else if(doptions.size() > 0) { |
| 1392 |
applies = false; |
| 1393 |
} |
| 1394 |
if(applies) { |
| 1395 |
list.add(ld); |
| 1396 |
} |
| 1397 |
applies = true; |
| 1398 |
} |
| 1399 |
} |
| 1400 |
return (LaunchDelegate[]) list.toArray(new LaunchDelegate[list.size()]); |
| 1401 |
} |
| 1402 |
|
| 1403 |
/** |
| 1404 |
* Returns the listing of launch delegates that apply to the specified |
| 1405 |
* <code>ILaunchConfigurationType</code> id |
| 1406 |
* @param typeid the id of the launch configuration type to get delegates for |
| 1407 |
* @return An array of <code>LaunchDelegate</code>s that apply to the specified launch configuration |
| 1408 |
* type, or an empty array, never <code>null</code> |
| 1409 |
* |
| 1410 |
* @since 3.3 |
| 1411 |
* |
| 1412 |
* EXPERIMENTAL |
| 1413 |
*/ |
| 1414 |
public LaunchDelegate[] getLaunchDelegates(String typeid) { |
| 1415 |
initializeLaunchDelegates(); |
| 1416 |
ArrayList list = new ArrayList(); |
| 1417 |
LaunchDelegate ld = null; |
| 1418 |
for(Iterator iter = fLaunchDelegates.keySet().iterator(); iter.hasNext();) { |
| 1419 |
ld = (LaunchDelegate) fLaunchDelegates.get(iter.next()); |
| 1420 |
if(ld.appliesTo(typeid)) { |
| 1421 |
list.add(ld); |
| 1422 |
} |
| 1423 |
} |
| 1424 |
return (LaunchDelegate[]) list.toArray(new LaunchDelegate[list.size()]); |
| 1425 |
} |
| 1426 |
|
| 1427 |
/** |
| 1428 |
* Returns the listing of duplicate launch delegates in the form of a <code>HashMap</code>, with the |
| 1429 |
* object arrangement: |
| 1430 |
* <p> |
| 1431 |
* <pre> |
| 1432 |
* HashMap<ILaunchConfigurationType, HashMap<string, LaunchDelegate[]>> |
| 1433 |
* </pre> |
| 1434 |
* </p> |
| 1435 |
* <p> |
| 1436 |
* Where the first map is keyed based on <code>ILaunchConfigurationType</code> ids and the inner map |
| 1437 |
* is keyed by mode. |
| 1438 |
* </p> |
| 1439 |
* @return the map of <code>LaunchDelegate</code>s that are in conflict for type, mode and options |
| 1440 |
* |
| 1441 |
* @since 3.3 |
| 1442 |
* |
| 1443 |
* EXPERIMENTAL |
| 1444 |
*/ |
| 1445 |
public HashMap getDuplicateLaunchDelegates() { |
| 1446 |
initializeDuplicateLaunchDelegates(); |
| 1447 |
return fDuplicateDelegates; |
| 1448 |
} |
| 1449 |
|
| 1450 |
/** |
| 1451 |
* Lazily initializes the listing of duplicate launch delegates |
| 1452 |
* |
| 1453 |
* @since 3.3 |
| 1454 |
* |
| 1455 |
* EXPERIMENTAL |
| 1456 |
*/ |
| 1457 |
private synchronized void initializeDuplicateLaunchDelegates() { |
| 1458 |
if(fDuplicateDelegates == null) { |
| 1459 |
fDuplicateDelegates = new HashMap(); |
| 1460 |
//for each delegate get the delegates[] |
| 1461 |
LaunchDelegate[] delegates = getLaunchDelegates(); |
| 1462 |
LaunchDelegate[] dupes = null; |
| 1463 |
ILaunchConfigurationType type = null; |
| 1464 |
Set modes = null; |
| 1465 |
Iterator iter = null; |
| 1466 |
Set options = null; |
| 1467 |
HashMap tmp = null; |
| 1468 |
String mode = null; |
| 1469 |
for(int i = 0; i < delegates.length; i++) { |
| 1470 |
type = getLaunchConfigurationType(delegates[i].getLaunchConfigurationType()); |
| 1471 |
options = delegates[i].getOptions(); |
| 1472 |
modes = type.getSupportedModes(); |
| 1473 |
for(iter = modes.iterator(); iter.hasNext();) { |
| 1474 |
mode = (String) iter.next(); |
| 1475 |
dupes = getLaunchDelegates(type.getIdentifier(), mode, (String[])options.toArray(new String[options.size()])); |
| 1476 |
if(dupes.length > 1) { |
| 1477 |
tmp = (HashMap) fDuplicateDelegates.get(type); |
| 1478 |
if(tmp == null) { |
| 1479 |
tmp = new HashMap(dupes.length); |
| 1480 |
} |
| 1481 |
tmp.put(mode, dupes); |
| 1482 |
fDuplicateDelegates.put(type, tmp); |
| 1483 |
} |
| 1484 |
} |
| 1485 |
} |
| 1486 |
} |
| 1487 |
} |
| 1488 |
|
| 1489 |
/** |
| 1490 |
* Initializes the listing of delegates available to the launching framework |
| 1491 |
* |
| 1492 |
* <p> |
| 1493 |
* <strong>EXPERIMENTAL</strong>. This method has been added as |
| 1494 |
* part of a work in progress. There is no guarantee that this API will |
| 1495 |
* remain unchanged during the 3.3 release cycle. Please do not use this API |
| 1496 |
* without consulting with the Platform/Debug team. |
| 1497 |
* </p> |
| 1498 |
* @since 3.3 |
| 1499 |
*/ |
| 1500 |
private synchronized void initializeLaunchDelegates() { |
| 1501 |
if(fLaunchDelegates == null) { |
| 1502 |
fLaunchDelegates = new HashMap(); |
| 1503 |
//get all launch delegate contributions |
| 1504 |
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES); |
| 1505 |
IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); |
| 1506 |
LaunchDelegate delegate = null; |
| 1507 |
for(int i = 0; i < infos.length; i++) { |
| 1508 |
delegate = new LaunchDelegate(infos[i]); |
| 1509 |
fLaunchDelegates.put(delegate.getIdentifier(), delegate); |
| 1510 |
} |
| 1511 |
//get all delegates from launch configuration type contributions |
| 1512 |
extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); |
| 1513 |
infos = extensionPoint.getConfigurationElements(); |
| 1514 |
for(int i = 0; i < infos.length; i++) { |
| 1515 |
//must check to see if delegate is provided in contribution |
| 1516 |
if(infos[i].getAttribute(IConfigurationElementConstants.DELEGATE) != null) { |
| 1517 |
delegate = new LaunchDelegate(infos[i]); |
| 1518 |
fLaunchDelegates.put(delegate.getIdentifier(), delegate); |
| 1519 |
} |
| 1520 |
} |
| 1521 |
} |
| 1522 |
} |
| 1523 |
|
| 1313 |
/** |
1524 |
/** |
| 1314 |
* Returns all launch configurations that are stored locally. |
1525 |
* Returns all launch configurations that are stored locally. |
| 1315 |
* |
1526 |
* |
|
Lines 1397-1405
Link Here
|
| 1397 |
if (Platform.getOS().equals(Constants.OS_WIN32)) { |
1608 |
if (Platform.getOS().equals(Constants.OS_WIN32)) { |
| 1398 |
fgNativeEnv= new HashMap(); |
1609 |
fgNativeEnv= new HashMap(); |
| 1399 |
Iterator entries = casePreserved.entrySet().iterator(); |
1610 |
Iterator entries = casePreserved.entrySet().iterator(); |
|
|
1611 |
Map.Entry entry = null; |
| 1612 |
String key = null; |
| 1400 |
while (entries.hasNext()) { |
1613 |
while (entries.hasNext()) { |
| 1401 |
Map.Entry entry = (Entry) entries.next(); |
1614 |
entry = (Entry) entries.next(); |
| 1402 |
String key = ((String)entry.getKey()).toUpperCase(); |
1615 |
key = ((String)entry.getKey()).toUpperCase(); |
| 1403 |
fgNativeEnv.put(key, entry.getValue()); |
1616 |
fgNativeEnv.put(key, entry.getValue()); |
| 1404 |
} |
1617 |
} |
| 1405 |
} else { |
1618 |
} else { |
|
Lines 1425-1434
Link Here
|
| 1425 |
*/ |
1638 |
*/ |
| 1426 |
public IProcess[] getProcesses() { |
1639 |
public IProcess[] getProcesses() { |
| 1427 |
synchronized (fLaunches) { |
1640 |
synchronized (fLaunches) { |
| 1428 |
List allProcesses= new ArrayList(fLaunches.size()); |
1641 |
List allProcesses = new ArrayList(fLaunches.size()); |
| 1429 |
Iterator e= fLaunches.iterator(); |
1642 |
Iterator e = fLaunches.iterator(); |
|
|
1643 |
IProcess[] processes = null; |
| 1430 |
while (e.hasNext()) { |
1644 |
while (e.hasNext()) { |
| 1431 |
IProcess[] processes= ((ILaunch) e.next()).getProcesses(); |
1645 |
processes = ((ILaunch) e.next()).getProcesses(); |
| 1432 |
for (int i= 0; i < processes.length; i++) { |
1646 |
for (int i= 0; i < processes.length; i++) { |
| 1433 |
allProcesses.add(processes[i]); |
1647 |
allProcesses.add(processes[i]); |
| 1434 |
} |
1648 |
} |
|
Lines 1494-1502
Link Here
|
| 1494 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS); |
1708 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS); |
| 1495 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
1709 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
| 1496 |
fComparators = new HashMap(infos.length); |
1710 |
fComparators = new HashMap(infos.length); |
|
|
1711 |
IConfigurationElement configurationElement = null; |
| 1712 |
String attr = null; |
| 1497 |
for (int i= 0; i < infos.length; i++) { |
1713 |
for (int i= 0; i < infos.length; i++) { |
| 1498 |
IConfigurationElement configurationElement = infos[i]; |
1714 |
configurationElement = infos[i]; |
| 1499 |
String attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$ |
1715 |
attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$ |
| 1500 |
if (attr != null) { |
1716 |
if (attr != null) { |
| 1501 |
fComparators.put(attr, new LaunchConfigurationComparator(configurationElement)); |
1717 |
fComparators.put(attr, new LaunchConfigurationComparator(configurationElement)); |
| 1502 |
} else { |
1718 |
} else { |
|
Lines 1508-1539
Link Here
|
| 1508 |
} |
1724 |
} |
| 1509 |
} |
1725 |
} |
| 1510 |
} |
1726 |
} |
| 1511 |
|
1727 |
|
| 1512 |
/** |
1728 |
/** |
| 1513 |
* Initializes contributed launch delegates (i.e. delegates contributed |
1729 |
* Initializes the listing of <code>LaunchConfigurationType</code>s. |
| 1514 |
* to an existing launch configuration type). |
|
|
| 1515 |
*/ |
1730 |
*/ |
| 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() { |
1731 |
private synchronized void initializeLaunchConfigurationTypes() { |
| 1528 |
if (fLaunchConfigurationTypes == null) { |
1732 |
if (fLaunchConfigurationTypes == null) { |
| 1529 |
hookResourceChangeListener(); |
1733 |
hookResourceChangeListener(); |
| 1530 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); |
1734 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); |
| 1531 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
1735 |
IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); |
| 1532 |
fLaunchConfigurationTypes= new ArrayList(infos.length); |
1736 |
fLaunchConfigurationTypes = new ArrayList(infos.length); |
| 1533 |
for (int i= 0; i < infos.length; i++) { |
1737 |
for (int i= 0; i < infos.length; i++) { |
| 1534 |
IConfigurationElement configurationElement = infos[i]; |
1738 |
fLaunchConfigurationTypes.add(new LaunchConfigurationType(infos[i])); |
| 1535 |
LaunchConfigurationType configType = new LaunchConfigurationType(configurationElement); |
|
|
| 1536 |
fLaunchConfigurationTypes.add(configType); |
| 1537 |
} |
1739 |
} |
| 1538 |
} |
1740 |
} |
| 1539 |
} |
1741 |
} |
|
Lines 1543-1548
Link Here
|
| 1543 |
* |
1745 |
* |
| 1544 |
* @exception CoreException if an exception occurs reading |
1746 |
* @exception CoreException if an exception occurs reading |
| 1545 |
* the extensions |
1747 |
* the extensions |
|
|
1748 |
* |
| 1546 |
*/ |
1749 |
*/ |
| 1547 |
private synchronized void initializeLaunchModes() { |
1750 |
private synchronized void initializeLaunchModes() { |
| 1548 |
if (fLaunchModes == null) { |
1751 |
if (fLaunchModes == null) { |
|
Lines 1559-1584
Link Here
|
| 1559 |
catch (CoreException e) {DebugPlugin.log(e);} |
1762 |
catch (CoreException e) {DebugPlugin.log(e);} |
| 1560 |
} |
1763 |
} |
| 1561 |
} |
1764 |
} |
| 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 |
|
1765 |
|
| 1583 |
/** |
1766 |
/** |
| 1584 |
* Initializes source container type and source path computer extensions. |
1767 |
* 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); |
1798 |
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS); |
| 1616 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
1799 |
IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); |
| 1617 |
fSourceLocators= new HashMap(infos.length); |
1800 |
fSourceLocators= new HashMap(infos.length); |
|
|
1801 |
IConfigurationElement configurationElement = null; |
| 1802 |
String id = null; |
| 1618 |
for (int i= 0; i < infos.length; i++) { |
1803 |
for (int i= 0; i < infos.length; i++) { |
| 1619 |
IConfigurationElement configurationElement = infos[i]; |
1804 |
configurationElement = infos[i]; |
| 1620 |
String id = configurationElement.getAttribute("id"); //$NON-NLS-1$ |
1805 |
id = configurationElement.getAttribute("id"); //$NON-NLS-1$ |
| 1621 |
if (id != null) { |
1806 |
if (id != null) { |
| 1622 |
fSourceLocators.put(id,configurationElement); |
1807 |
fSourceLocators.put(id,configurationElement); |
| 1623 |
} else { |
1808 |
} else { |
|
Lines 1812-1819
Link Here
|
| 1812 |
if (!configs.isEmpty()) { |
1997 |
if (!configs.isEmpty()) { |
| 1813 |
Iterator iterator = configs.iterator(); |
1998 |
Iterator iterator = configs.iterator(); |
| 1814 |
while (iterator.hasNext()) { |
1999 |
while (iterator.hasNext()) { |
| 1815 |
ILaunchConfiguration configuration = (ILaunchConfiguration)iterator.next(); |
2000 |
launchConfigurationDeleted((ILaunchConfiguration)iterator.next()); |
| 1816 |
launchConfigurationDeleted(configuration); |
|
|
| 1817 |
} |
2001 |
} |
| 1818 |
} |
2002 |
} |
| 1819 |
//bug 12134 |
2003 |
//bug 12134 |
|
Lines 1832-1839
Link Here
|
| 1832 |
if (!configs.isEmpty()) { |
2016 |
if (!configs.isEmpty()) { |
| 1833 |
Iterator iterator = configs.iterator(); |
2017 |
Iterator iterator = configs.iterator(); |
| 1834 |
while (iterator.hasNext()) { |
2018 |
while (iterator.hasNext()) { |
| 1835 |
ILaunchConfiguration config = (ILaunchConfiguration) iterator.next(); |
2019 |
launchConfigurationAdded((ILaunchConfiguration) iterator.next()); |
| 1836 |
launchConfigurationAdded(config); |
|
|
| 1837 |
} |
2020 |
} |
| 1838 |
} |
2021 |
} |
| 1839 |
} |
2022 |
} |
|
Lines 1953-1960
Link Here
|
| 1953 |
fLaunchesListeners = new ListenerList(); |
2136 |
fLaunchesListeners = new ListenerList(); |
| 1954 |
fLaunchConfigurationListeners = new ListenerList(); |
2137 |
fLaunchConfigurationListeners = new ListenerList(); |
| 1955 |
ILaunch[] launches = getLaunches(); |
2138 |
ILaunch[] launches = getLaunches(); |
|
|
2139 |
ILaunch launch = null; |
| 1956 |
for (int i= 0; i < launches.length; i++) { |
2140 |
for (int i= 0; i < launches.length; i++) { |
| 1957 |
ILaunch launch= launches[i]; |
2141 |
launch = launches[i]; |
| 1958 |
try { |
2142 |
try { |
| 1959 |
if (launch instanceof IDisconnect) { |
2143 |
if (launch instanceof IDisconnect) { |
| 1960 |
IDisconnect disconnect = (IDisconnect)launch; |
2144 |
IDisconnect disconnect = (IDisconnect)launch; |
|
Lines 2014-2021
Link Here
|
| 2014 |
*/ |
2198 |
*/ |
| 2015 |
protected void verifyConfigurations(List verify, List valid) { |
2199 |
protected void verifyConfigurations(List verify, List valid) { |
| 2016 |
Iterator configs = verify.iterator(); |
2200 |
Iterator configs = verify.iterator(); |
|
|
2201 |
ILaunchConfiguration config = null; |
| 2017 |
while (configs.hasNext()) { |
2202 |
while (configs.hasNext()) { |
| 2018 |
ILaunchConfiguration config = (ILaunchConfiguration)configs.next(); |
2203 |
config = (ILaunchConfiguration)configs.next(); |
| 2019 |
if (isValid(config)) { |
2204 |
if (isValid(config)) { |
| 2020 |
valid.add(config); |
2205 |
valid.add(config); |
| 2021 |
} |
2206 |
} |