Lines 26-31
Link Here
|
26 |
private IAboutInfo fAboutInfo; |
26 |
private IAboutInfo fAboutInfo; |
27 |
|
27 |
|
28 |
private TreeMap fPlugins = new TreeMap(); |
28 |
private TreeMap fPlugins = new TreeMap(); |
|
|
29 |
private TreeMap fPluginConfigurations = new TreeMap(); |
29 |
private List fFeatures = new ArrayList(); |
30 |
private List fFeatures = new ArrayList(); |
30 |
private IConfigurationFileInfo fConfigIniInfo; |
31 |
private IConfigurationFileInfo fConfigIniInfo; |
31 |
private IJREInfo fJVMInfo; |
32 |
private IJREInfo fJVMInfo; |
Lines 201-206
Link Here
|
201 |
writer.println(indent + " </features>"); //$NON-NLS-1$ |
202 |
writer.println(indent + " </features>"); //$NON-NLS-1$ |
202 |
} |
203 |
} |
203 |
|
204 |
|
|
|
205 |
writer.println(indent + " <configurations>"); //$NON-NLS-1$ |
206 |
iter = fPluginConfigurations.values().iterator(); |
207 |
while (iter.hasNext()) { |
208 |
IProductPlugin plugin = (IProductPlugin) iter.next(); |
209 |
plugin.write(indent + " ", writer); //$NON-NLS-1$ |
210 |
} |
211 |
writer.println(indent + " </configurations>"); //$NON-NLS-1$ |
212 |
|
204 |
writer.println(); |
213 |
writer.println(); |
205 |
writer.println("</product>"); //$NON-NLS-1$ |
214 |
writer.println("</product>"); //$NON-NLS-1$ |
206 |
} |
215 |
} |
Lines 222-227
Link Here
|
222 |
fUseFeatures = false; |
231 |
fUseFeatures = false; |
223 |
fAboutInfo = null; |
232 |
fAboutInfo = null; |
224 |
fPlugins.clear(); |
233 |
fPlugins.clear(); |
|
|
234 |
fPluginConfigurations.clear(); |
225 |
fFeatures.clear(); |
235 |
fFeatures.clear(); |
226 |
fConfigIniInfo = null; |
236 |
fConfigIniInfo = null; |
227 |
fWindowImages = null; |
237 |
fWindowImages = null; |
Lines 256-261
Link Here
|
256 |
parsePlugins(child.getChildNodes()); |
266 |
parsePlugins(child.getChildNodes()); |
257 |
} else if (name.equals("features")) { //$NON-NLS-1$ |
267 |
} else if (name.equals("features")) { //$NON-NLS-1$ |
258 |
parseFeatures(child.getChildNodes()); |
268 |
parseFeatures(child.getChildNodes()); |
|
|
269 |
} else if (name.equals("configurations")) { //$NON-NLS-1$ |
270 |
parsePluginConfigurations(children); |
259 |
} else if (name.equals("configIni")) { //$NON-NLS-1$ |
271 |
} else if (name.equals("configIni")) { //$NON-NLS-1$ |
260 |
fConfigIniInfo = factory.createConfigFileInfo(); |
272 |
fConfigIniInfo = factory.createConfigFileInfo(); |
261 |
fConfigIniInfo.parse(child); |
273 |
fConfigIniInfo.parse(child); |
Lines 296-301
Link Here
|
296 |
} |
308 |
} |
297 |
} |
309 |
} |
298 |
|
310 |
|
|
|
311 |
private void parsePluginConfigurations(NodeList children) { |
312 |
for (int i = 0; i < children.getLength(); i++) { |
313 |
Node child = children.item(i); |
314 |
if (child.getNodeType() == Node.ELEMENT_NODE) { |
315 |
if (child.getNodeName().equals("pluginConfiguration")) { //$NON-NLS-1$ |
316 |
IProductPluginConfiguration configuration = getModel().getFactory().createPluginConfiguration(); |
317 |
configuration.parse(child); |
318 |
fPluginConfigurations.put(configuration.getId(), configuration); |
319 |
} |
320 |
} |
321 |
} |
322 |
} |
323 |
|
299 |
private void parseFeatures(NodeList children) { |
324 |
private void parseFeatures(NodeList children) { |
300 |
for (int i = 0; i < children.getLength(); i++) { |
325 |
for (int i = 0; i < children.getLength(); i++) { |
301 |
Node child = children.item(i); |
326 |
Node child = children.item(i); |
Lines 332-347
Link Here
|
332 |
} |
357 |
} |
333 |
|
358 |
|
334 |
/* (non-Javadoc) |
359 |
/* (non-Javadoc) |
|
|
360 |
* @see org.eclipse.pde.internal.core.iproduct.IProduct#addPluginConfigurations(org.eclipse.pde.internal.core.iproduct.IPluginConfiguration[]) |
361 |
*/ |
362 |
public void addPluginConfigurations(IProductPluginConfiguration[] configuration) { |
363 |
boolean modified = false; |
364 |
for (int i = 0; i < configuration.length; i++) { |
365 |
if (configuration[i] == null) |
366 |
continue; |
367 |
String id = configuration[i].getId(); |
368 |
if (id == null || fPluginConfigurations.containsKey(id)) { |
369 |
configuration[i] = null; |
370 |
continue; |
371 |
} |
372 |
|
373 |
configuration[i].setModel(getModel()); |
374 |
fPluginConfigurations.put(id, configuration[i]); |
375 |
modified = true; |
376 |
} |
377 |
if (modified && isEditable()) |
378 |
fireStructureChanged(configuration, IModelChangedEvent.INSERT); |
379 |
} |
380 |
|
381 |
/* (non-Javadoc) |
335 |
* @see org.eclipse.pde.internal.core.iproduct.IProduct#removePlugins(org.eclipse.pde.internal.core.iproduct.IProductPlugin[]) |
382 |
* @see org.eclipse.pde.internal.core.iproduct.IProduct#removePlugins(org.eclipse.pde.internal.core.iproduct.IProductPlugin[]) |
336 |
*/ |
383 |
*/ |
337 |
public void removePlugins(IProductPlugin[] plugins) { |
384 |
public void removePlugins(IProductPlugin[] plugins) { |
338 |
boolean modified = false; |
385 |
boolean modified = false; |
|
|
386 |
LinkedList removedConfigurations = new LinkedList(); |
339 |
for (int i = 0; i < plugins.length; i++) { |
387 |
for (int i = 0; i < plugins.length; i++) { |
340 |
if (fPlugins.remove(plugins[i].getId()) != null) |
388 |
final String id = plugins[i].getId(); |
|
|
389 |
if (fPlugins.remove(id) != null) { |
341 |
modified = true; |
390 |
modified = true; |
|
|
391 |
Object configuration = fPluginConfigurations.remove(id); |
392 |
if (configuration != null) |
393 |
removedConfigurations.add(configuration); |
394 |
} |
342 |
} |
395 |
} |
343 |
if (modified && isEditable()) |
396 |
if (isEditable()) { |
344 |
fireStructureChanged(plugins, IModelChangedEvent.REMOVE); |
397 |
if (modified) |
|
|
398 |
fireStructureChanged(plugins, IModelChangedEvent.REMOVE); |
399 |
if (!removedConfigurations.isEmpty()) { |
400 |
fireStructureChanged((IProductObject[]) removedConfigurations.toArray(new IProductObject[removedConfigurations.size()]), IModelChangedEvent.REMOVE); |
401 |
} |
402 |
} |
403 |
} |
404 |
|
405 |
/* (non-Javadoc) |
406 |
* @see org.eclipse.pde.internal.core.iproduct.IProduct#removePluginConfigurations(org.eclipse.pde.internal.core.iproduct.IProductPluginConfiguration[]) |
407 |
*/ |
408 |
public void removePluginConfigurations(IProductPluginConfiguration[] configurations) { |
409 |
boolean modified = false; |
410 |
for (int i = 0; i < configurations.length; i++) { |
411 |
if (fPluginConfigurations.remove(configurations[i].getId()) != null) { |
412 |
modified = true; |
413 |
} |
414 |
} |
415 |
if (isEditable() && modified) |
416 |
fireStructureChanged(configurations, IModelChangedEvent.REMOVE); |
345 |
} |
417 |
} |
346 |
|
418 |
|
347 |
/* (non-Javadoc) |
419 |
/* (non-Javadoc) |
Lines 352-357
Link Here
|
352 |
} |
424 |
} |
353 |
|
425 |
|
354 |
/* (non-Javadoc) |
426 |
/* (non-Javadoc) |
|
|
427 |
* @see org.eclipse.pde.internal.core.iproduct.IProduct#getPluginConfigurations() |
428 |
*/ |
429 |
public IProductPluginConfiguration[] getPluginConfigurations() { |
430 |
return (IProductPluginConfiguration[]) fPluginConfigurations.values().toArray(new IProductPluginConfiguration[fPluginConfigurations.size()]); |
431 |
} |
432 |
|
433 |
/* (non-Javadoc) |
355 |
* @see org.eclipse.pde.internal.core.iproduct.IProduct#getConfigurationFileInfo() |
434 |
* @see org.eclipse.pde.internal.core.iproduct.IProduct#getConfigurationFileInfo() |
356 |
*/ |
435 |
*/ |
357 |
public IConfigurationFileInfo getConfigurationFileInfo() { |
436 |
public IConfigurationFileInfo getConfigurationFileInfo() { |