mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix cyclic construction problem exposed by improved error handling
This commit is contained in:
parent
99b9358833
commit
30ac9eb2c8
4 changed files with 8 additions and 9 deletions
|
@ -50,7 +50,7 @@ public class TestTemplateEngine extends BaseTestCase {
|
|||
*
|
||||
*/
|
||||
public void testSharedDefaults(){
|
||||
assertNotNull(templateEngine.getSharedDefaults());
|
||||
assertNotNull(TemplateEngine.getSharedDefaults());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,7 +80,7 @@ public class TemplateCore {
|
|||
templateDescriptor = new TemplateDescriptor(descriptorURL, templateInfo.getPluginId());
|
||||
valueStore = new ValueStore/*<String, String>*/(this);
|
||||
valueStore.putAll(templateDescriptor.getTemplateDefaults(templateDescriptor.getRootElement()));
|
||||
valueStore.putAll(TemplateEngine.getDefault().getSharedDefaults());
|
||||
valueStore.putAll(TemplateEngine.getSharedDefaults());
|
||||
valueStore.put("projectType", templateInfo.getProjectType()); //$NON-NLS-1$
|
||||
|
||||
processHandler = new TemplateProcessHandler(this);
|
||||
|
|
|
@ -48,11 +48,6 @@ public class TemplateEngine {
|
|||
*/
|
||||
private static TemplateEngine TEMPLATE_ENGINE;
|
||||
|
||||
static {
|
||||
TEMPLATE_ENGINE = new TemplateEngine();
|
||||
TEMPLATE_ENGINE.initializeTemplateInfoMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a Map <WizardID, TemplateInfo>.
|
||||
*/
|
||||
|
@ -63,6 +58,7 @@ public class TemplateEngine {
|
|||
*/
|
||||
private TemplateEngine() {
|
||||
templateInfoMap = new HashMap/*<String, List<TemplateInfo>>*/();
|
||||
initializeTemplateInfoMap();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,7 +155,7 @@ public class TemplateEngine {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
public Map/*<String, String>*/ getSharedDefaults() {
|
||||
public static Map/*<String, String>*/ getSharedDefaults() {
|
||||
return SharedDefaults.getInstance().getSharedDefaultsMap();
|
||||
}
|
||||
|
||||
|
@ -196,6 +192,9 @@ public class TemplateEngine {
|
|||
* @since 4.0
|
||||
*/
|
||||
public static TemplateEngine getDefault() {
|
||||
if(TEMPLATE_ENGINE==null) {
|
||||
TEMPLATE_ENGINE = new TemplateEngine();
|
||||
}
|
||||
return TEMPLATE_ENGINE;
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ public class TemplateEngineHelper {
|
|||
} else {
|
||||
path = path.substring(0, slash + 1) + resourcePath;
|
||||
}
|
||||
URL entry = FileLocator.find(Platform.getBundle(templateInfo.getPluginId()), new Path(path), null);;
|
||||
URL entry = FileLocator.find(Platform.getBundle(templateInfo.getPluginId()), new Path(path), null);
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue