Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e1854576b3bea4f808437d48e5052a9d6633bd8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
/*******************************************************************************
 * Copyright (c) 2004, 2013 Intel Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 * Intel Corporation - Initial API and implementation
 * IBM Corporation
 *******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
import org.eclipse.cdt.managedbuilder.buildproperties.IOptionalBuildProperties;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IBuildObjectProperties;
import org.eclipse.cdt.managedbuilder.core.IBuildPropertiesRestriction;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.osgi.framework.Version;

public class ManagedProject extends BuildObject implements IManagedProject, IBuildPropertiesRestriction, IBuildPropertyChangeListener {

	//  Parent and children
	private IProjectType projectType;
	private String projectTypeId;
	private IResource owner;
//	private List configList;	//  Configurations of this project type
	private Map<String, Configuration> configMap = Collections.synchronizedMap(new LinkedHashMap<String, Configuration>());
	//  Miscellaneous
	private boolean isDirty = false;
	private boolean isValid = true;
	private boolean resolved = true;
	//holds the user-defined macros
//	private StorableMacros userDefinedMacros;
	//holds user-defined environment
//	private StorableEnvironment userDefinedEnvironment;

	private BuildObjectProperties buildProperties;
	private OptionalBuildProperties optionalBuildProperties;

	/*
	 *  C O N S T R U C T O R S
	 */

	/* (non-Javadoc)
	 * Sets the Eclipse project that owns the Managed Project
	 *
	 * @param owner
	 */
	protected ManagedProject(IResource owner) {
		this.owner = owner;
	}

	/**
	 * Create a project instance from the project-type specified in the argument,
	 * that is owned by the specified Eclipse project.
	 *
	 * @param owner  the Eclipse project that owns the Managed Project
	 */
	public ManagedProject(IResource owner, IProjectType projectType) {
		// Make the owner of the ProjectType the project resource
		this(owner);

		// Copy the parent's identity
		this.projectType = projectType;
		int id = ManagedBuildManager.getRandomNumber();
		setId(owner.getName() + "." + projectType.getId() + "." + id);		 //$NON-NLS-1$ //$NON-NLS-2$
		setName(projectType.getName());

		setManagedBuildRevision(projectType.getManagedBuildRevision());

		// Hook me up
		IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner);
		buildInfo.setManagedProject(this);
		setDirty(true);
	}

	public ManagedProject(ICProjectDescription des) {
		// Make the owner of the ProjectType the project resource
		this(des.getProject());

		// Copy the parent's identity
//		this.projectType = projectType;
		int id = ManagedBuildManager.getRandomNumber();
		setId(owner.getName() + "." + des.getId() + "." + id);		 //$NON-NLS-1$ //$NON-NLS-2$
		setName(des.getName());

//		setManagedBuildRevision(projectType.getManagedBuildRevision());

		// Hook me up
//		IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner);
//		buildInfo.setManagedProject(this);
//		setDirty(true);
	}

	/**
	 * Create the project instance from project file.
	 *
	 * @param managedBuildRevision the fileVersion of Managed Build System
	 */
	public ManagedProject(ManagedBuildInfo buildInfo, ICStorageElement element, boolean loadConfigs, String managedBuildRevision) {
		this(buildInfo.getOwner());

		setManagedBuildRevision(managedBuildRevision);

		// Initialize from the XML attributes
		if (loadFromProject(element)) {

			// check for migration support.
			boolean isSupportAvailable = projectType != null ? projectType.checkForMigrationSupport() : true;
			if (isSupportAvailable == false) {
				setValid(false);
			}

			if(loadConfigs){
				// Load children
				StorableCdtVariables vars = null;
				ICStorageElement configElements[] = element.getChildren();
				for (ICStorageElement configElement : configElements) {
					if (configElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
						Configuration config = new Configuration(this, configElement, managedBuildRevision, false);
					} else if (configElement.getName().equals("macros")) {	//$NON-NLS-1$
						vars = new StorableCdtVariables(configElement, false);
					}

				}

				if(vars != null){
					for (Configuration cfg : getConfigurationCollection()) {
						((ToolChain)cfg.getToolChain()).addProjectVariables(vars);
					}
				}
			}
		} else {
			setValid(false);
		}

		// hook me up
		buildInfo.setManagedProject(this);
	}

	/*
	 *  E L E M E N T   A T T R I B U T E   R E A D E R S   A N D   W R I T E R S
	 */

	/* (non-Javadoc)
	 * Initialize the project information from the XML element
	 * specified in the argument
	 *
	 * @param element An XML element containing the project information
	 */
	protected boolean loadFromProject(ICStorageElement element) {
		// note: id and name are unique, so don't intern them
		// id
		setId(element.getAttribute(IBuildObject.ID));

		// name
		if (element.getAttribute(IBuildObject.NAME) != null) {
			setName(element.getAttribute(IBuildObject.NAME));
		}

		// projectType
		projectTypeId = element.getAttribute(PROJECTTYPE);
		if (projectTypeId != null && projectTypeId.length() > 0) {
			projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
			if (projectType == null) {
				return false;
			}
		}

		String props = element.getAttribute(BUILD_PROPERTIES);
		if(props != null && props.length() != 0)
			buildProperties = new BuildObjectProperties(props, this, this);
		
		String optionalProps = element.getAttribute(OPTIONAL_BUILD_PROPERTIES);
		if (optionalProps != null && optionalProps.length() != 0)
			optionalBuildProperties = new OptionalBuildProperties(optionalProps);

		String artType = element.getAttribute(BUILD_ARTEFACT_TYPE);
		if(artType != null){
			if(buildProperties == null)
				buildProperties = new BuildObjectProperties(this, this);

			try {
				buildProperties.setProperty(ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, artType, true);
			} catch (CoreException e) {
				ManagedBuilderCorePlugin.log(e);
			}
		}

		return true;
	}

	public void serializeProjectInfo(ICStorageElement element) {
		element.setAttribute(IBuildObject.ID, id);

		if (name != null) {
			element.setAttribute(IBuildObject.NAME, name);
		}

		if (projectType != null) {
			element.setAttribute(PROJECTTYPE, projectType.getId());
		}

		// I am clean now
		isDirty = false;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#serialize()
	 */
	public void serialize(ICStorageElement element, boolean saveChildren) {
		serializeProjectInfo(element);

		if(saveChildren){
			for (Configuration cfg : getConfigurationCollection()) {
				ICStorageElement configElement = element.createChild(IConfiguration.CONFIGURATION_ELEMENT_NAME);
				cfg.serialize(configElement);
			}
		}
		// Serialize my children

//		//serialize user-defined macros
//		if(userDefinedMacros != null){
//			Element macrosElement = doc.createElement(StorableMacros.MACROS_ELEMENT_NAME);
//			element.appendChild(macrosElement);
//			userDefinedMacros.serialize(doc,macrosElement);
//		}
//
//		if(userDefinedEnvironment != null){
//			EnvironmentVariableProvider.fUserSupplier.storeEnvironment(this,true);
//		}

		// I am clean now
		isDirty = false;
	}

	/*
	 *  P A R E N T   A N D   C H I L D   H A N D L I N G
	 */

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#getOwner()
	 */
	@Override
	public IResource getOwner() {
		return owner;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#updateOwner(org.eclipse.core.resources.IResource)
	 */
	@Override
	public void updateOwner(IResource resource) {
		if (!resource.equals(owner)) {
			// Set the owner correctly
			owner = resource;
		}
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#getProjectType()
	 */
	@Override
	public IProjectType getProjectType() {
		return projectType;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.core.build.managed.IManagedProject#createConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
	 */
	@Override
	public IConfiguration createConfiguration(IConfiguration parent, String id) {
		Configuration config = new Configuration(this, (Configuration)parent, id, false, false, false);
		ManagedBuildManager.performValueHandlerEvent(config, IManagedOptionValueHandler.EVENT_OPEN);
		return config;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.core.build.managed.IManagedProject#createConfigurationClone(org.eclipse.cdt.core.build.managed.IConfiguration)
	 */
	@Override
	public IConfiguration createConfigurationClone(IConfiguration parent, String id) {
		Configuration config = new Configuration(this, (Configuration)parent, id, true, false, false);
		// Inform all options in the configuration and all its resource configurations
		ManagedBuildManager.performValueHandlerEvent(config, IManagedOptionValueHandler.EVENT_OPEN);
		return config;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.core.build.managed.IManagedProject#getConfiguration()
	 */
	@Override
	public IConfiguration getConfiguration(String id) {
		return configMap.get(id);
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#getConfigurations()
	 */
	@Override
	public IConfiguration[] getConfigurations() {
		synchronized (configMap) {
			return configMap.values().toArray(new IConfiguration[configMap.size()]);
		}
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#removeConfiguration(java.lang.String)
	 */
	@Override
	public void removeConfiguration(String id) {
		final String removeId = id;

		//handle the case of temporary configuration
		if(!configMap.containsKey(id))
			return;

		configMap.remove(removeId);
//
//		IWorkspaceRunnable remover = new IWorkspaceRunnable() {
//			public void run(IProgressMonitor monitor) throws CoreException {
//				// Remove the specified configuration from the list and map
//				Iterator iter = getConfigurationCollection().iterator();
//				while (iter.hasNext()) {
//					 IConfiguration config = (IConfiguration)iter.next();
//					 if (config.getId().equals(removeId)) {
//						// TODO:  For now we clean the entire project.  This may be overkill, but
//						//        it avoids a problem with leaving the configuration output directory
//					 	//        around and having the outputs try to be used by the makefile generator code.
//					 	IResource proj = config.getOwner();
//						IManagedBuildInfo info = null;
//					 	if (proj instanceof IProject) {
//							info = ManagedBuildManager.getBuildInfo(proj);
//					 	}
//						IConfiguration currentConfig = null;
//						boolean isCurrent = true;
//			 			if (info != null) {
//			 				currentConfig = info.getDefaultConfiguration();
//			 				if (!currentConfig.getId().equals(removeId)) {
//			 					info.setDefaultConfiguration(config);
//			 					isCurrent = false;
//			 				}
//			 			}
//			 			((IProject)proj).build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
//
//			 			ManagedBuildManager.performValueHandlerEvent(config,
//			 					IManagedOptionValueHandler.EVENT_CLOSE);
//						PropertyManager.getInstance().clearProperties(config);
////					 	getConfigurationList().remove(config);
//						getConfigurationMap().remove(removeId);
//
//						if (info != null) {
//							if (!isCurrent) {
//			 					info.setDefaultConfiguration(currentConfig);
//							} else {
//								// If the current default config is the one being removed, reset the default config
//								String[] configs = info.getConfigurationNames();
//								if (configs.length > 0) {
//									info.setDefaultConfiguration(configs[0]);
//								}
//							}
//			 			}
//						break;
//					}
//				}
//			}
//		};
//		try {
//			ResourcesPlugin.getWorkspace().run( remover, null );
//		}
//		catch( CoreException e ) {}
		setDirty(true);
	}

	/* (non-Javadoc)
	 * Adds the Configuration to the Configuration list and map
	 *
	 * @param Tool
	 */
	public void addConfiguration(Configuration configuration) {
		if(!configuration.isTemporary())
			configMap.put(configuration.getId(), configuration);
	}

	/** (non-Javadoc)
	 * Safe accessor for the list of configurations.
	 *
	 * @return List containing the configurations
	 */
	private Collection<Configuration> getConfigurationCollection() {
		synchronized (configMap) {
			return new ArrayList<Configuration>(configMap.values());
		}
	}

	/*
	 *  M O D E L   A T T R I B U T E   A C C E S S O R S
	 */

	/*
	 *  O B J E C T   S T A T E   M A I N T E N A N C E
	 */

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#(getDefaultArtifactName)
	 */
	@Override
	public String getDefaultArtifactName(){
		return CdtVariableResolver.createVariableReference(CdtVariableResolver.VAR_PROJ_NAME);
	}

	/* (non-Javadoc)
	 *  Resolve the element IDs to interface references
	 */
	public boolean resolveReferences() {
		if (!resolved) {
			resolved = true;
			// Resolve project-type
			if (projectTypeId != null && projectTypeId.length() > 0) {
				projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
				if (projectType == null) {
					return false;
				}
			}

			// call resolve references on any children
			for (Configuration cfg : getConfigurationCollection())
				cfg.resolveReferences();
		}
		return true;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#isDirty()
	 */
	@Override
	public boolean isDirty() {
		// If I need saving, just say yes
		if (isDirty) return true;

		//check whether the project - specific macros are dirty
//		if(userDefinedMacros != null && userDefinedMacros.isDirty())
//			return true;

		//check whether the project - specific environment is dirty
//		if(userDefinedEnvironment != null && userDefinedEnvironment.isDirty())
//			return true;


		// Otherwise see if any configurations need saving
		for (IConfiguration cfg : getConfigurationCollection())
			if (cfg.isDirty())
				return true;

		return isDirty;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#setDirty(boolean)
	 */
	@Override
	public void setDirty(boolean isDirty) {
		this.isDirty = isDirty;
		// Propagate "false" to the children
		if (!isDirty)
			for (IConfiguration cfg : getConfigurationCollection())
				cfg.setDirty(false);
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#isValid()
	 */
	@Override
	public boolean isValid() {
		//  TODO:  In the future, children could also have a "valid" state that should be checked
		return isValid;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#setValid(boolean)
	 */
	@Override
	public void setValid(boolean isValid) {
		//  TODO:  In the future, children could also have a "valid" state...
		this.isValid = isValid;
	}

	/**
	 * @return Returns the version.
	 */
	@Override
	public Version getVersion() {
			if (version == null) {
				if ( getProjectType() != null) {
					return getProjectType().getVersion();
				}
			}
			return version;
	}

	@Override
	public void setVersion(Version version) {
		// Do nothing
	}

	/*
	 * this method is called by the UserDefinedMacroSupplier to obtain user-defined
	 * macros available for this managed project
	 */
/*	public StorableMacros getUserDefinedMacros(){
		if(userDefinedMacros == null)
			userDefinedMacros = new StorableMacros();
		return userDefinedMacros;
	}
*/
//	public StorableEnvironment getUserDefinedEnvironmet(){
//		return userDefinedEnvironment;
//	}
//
//	public void setUserDefinedEnvironmet(StorableEnvironment env){
//		userDefinedEnvironment = env;
//	}

	/* (non-Javadoc)
	 * @see org.eclipse.cdt.managedbuilder.internal.core.BuildObject#updateManagedBuildRevision(java.lang.String)
	 */
	@Override
	public void updateManagedBuildRevision(String revision){
		super.updateManagedBuildRevision(revision);
		for (Configuration cfg : getConfigurationCollection()) {
			cfg.updateManagedBuildRevision(revision);
		}
	}

	public void setProjectType(IProjectType projectType) {
		if ( this.projectType != projectType ) {
			this.projectType = projectType;
			if ( this.projectType == null) {
				projectTypeId = null;
			} else {
				projectTypeId = this.projectType.getId();
			}
		}
	}

	public void applyConfiguration(Configuration cfg){
		cfg.applyToManagedProject(this);
	}

	@Override
	public IBuildObjectProperties getBuildProperties() {
		if(buildProperties == null){
			BuildObjectProperties parentProps = findBuildProperties();
			if(parentProps != null)
				buildProperties = new BuildObjectProperties(parentProps, this, this);
			else
				buildProperties = new BuildObjectProperties(this, this);
		}
		return buildProperties;
	}

	@Override
	public IOptionalBuildProperties getOptionalBuildProperties() {
		if(optionalBuildProperties == null){
			OptionalBuildProperties parentProps = findOptionalBuildProperties();
			if(parentProps != null)
				optionalBuildProperties = new OptionalBuildProperties(parentProps);
			else
				optionalBuildProperties = new OptionalBuildProperties();
		}
		return optionalBuildProperties;
	}

	private BuildObjectProperties findBuildProperties(){
		if(buildProperties == null){
			if(projectType != null){
				return ((ProjectType)projectType).findBuildProperties();
			}
			return null;
		}
		return buildProperties;
	}

	private OptionalBuildProperties findOptionalBuildProperties(){
		if(optionalBuildProperties == null){
			if(projectType != null){
				return ((ProjectType)projectType).findOptionalBuildProperties();
			}
			return null;
		}
		return optionalBuildProperties;
	}

	@Override
	public void propertiesChanged() {
		IConfiguration cfgs[] = getConfigurations();
		for (IConfiguration cfg : cfgs) {
			((Configuration)cfg).propertiesChanged();
		}
	}

	public boolean supportsType(IBuildPropertyType type) {
		return supportsType(type.getId());
	}

	public boolean supportsValue(IBuildPropertyType type,
			IBuildPropertyValue value) {
		return supportsValue(type.getId(), value.getId());
	}

	@Override
	public boolean supportsType(String typeId) {
		IConfiguration cfgs[] = getConfigurations();
		for (IConfiguration cfg : cfgs) {
			if(((Configuration)cfg).supportsType(typeId))
				return true;
		}
		return false;
	}

	@Override
	public boolean supportsValue(String typeId, String valueId) {
		IConfiguration cfgs[] = getConfigurations();
		for (IConfiguration cfg : cfgs) {
			if(((Configuration)cfg).supportsValue(typeId, valueId))
				return true;
		}
		return false;
	}

	@Override
	public String[] getRequiredTypeIds() {
		List<String> result = new ArrayList<String>();
		IConfiguration cfgs[] = getConfigurations();
		for (IConfiguration cfg : cfgs) {
			result.addAll(Arrays.asList(((Configuration)cfg).getRequiredTypeIds()));
		}
		return result.toArray(new String[result.size()]);
	}

	@Override
	public String[] getSupportedTypeIds() {
		List<String> result = new ArrayList<String>();
		IConfiguration cfgs[] = getConfigurations();
		for (IConfiguration cfg : cfgs) {
			result.addAll(Arrays.asList(((Configuration)cfg).getSupportedTypeIds()));
		}
		return result.toArray(new String[result.size()]);
	}

	@Override
	public String[] getSupportedValueIds(String typeId) {
		List<String> result = new ArrayList<String>();
		IConfiguration cfgs[] = getConfigurations();
		for (IConfiguration cfg : cfgs) {
			result.addAll(Arrays.asList(((Configuration)cfg).getSupportedValueIds(typeId)));
		}
		return result.toArray(new String[result.size()]);
	}

	@Override
	public boolean requiresType(String typeId) {
		IConfiguration cfgs[] = getConfigurations();
		for (IConfiguration cfg : cfgs) {
			if(((Configuration)cfg).requiresType(typeId))
				return true;
		}
		return false;
	}
}

Back to the top