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(){
|
public void testSharedDefaults(){
|
||||||
assertNotNull(templateEngine.getSharedDefaults());
|
assertNotNull(TemplateEngine.getSharedDefaults());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class TemplateCore {
|
||||||
templateDescriptor = new TemplateDescriptor(descriptorURL, templateInfo.getPluginId());
|
templateDescriptor = new TemplateDescriptor(descriptorURL, templateInfo.getPluginId());
|
||||||
valueStore = new ValueStore/*<String, String>*/(this);
|
valueStore = new ValueStore/*<String, String>*/(this);
|
||||||
valueStore.putAll(templateDescriptor.getTemplateDefaults(templateDescriptor.getRootElement()));
|
valueStore.putAll(templateDescriptor.getTemplateDefaults(templateDescriptor.getRootElement()));
|
||||||
valueStore.putAll(TemplateEngine.getDefault().getSharedDefaults());
|
valueStore.putAll(TemplateEngine.getSharedDefaults());
|
||||||
valueStore.put("projectType", templateInfo.getProjectType()); //$NON-NLS-1$
|
valueStore.put("projectType", templateInfo.getProjectType()); //$NON-NLS-1$
|
||||||
|
|
||||||
processHandler = new TemplateProcessHandler(this);
|
processHandler = new TemplateProcessHandler(this);
|
||||||
|
|
|
@ -48,11 +48,6 @@ public class TemplateEngine {
|
||||||
*/
|
*/
|
||||||
private static TemplateEngine TEMPLATE_ENGINE;
|
private static TemplateEngine TEMPLATE_ENGINE;
|
||||||
|
|
||||||
static {
|
|
||||||
TEMPLATE_ENGINE = new TemplateEngine();
|
|
||||||
TEMPLATE_ENGINE.initializeTemplateInfoMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a Map <WizardID, TemplateInfo>.
|
* This is a Map <WizardID, TemplateInfo>.
|
||||||
*/
|
*/
|
||||||
|
@ -63,6 +58,7 @@ public class TemplateEngine {
|
||||||
*/
|
*/
|
||||||
private TemplateEngine() {
|
private TemplateEngine() {
|
||||||
templateInfoMap = new HashMap/*<String, List<TemplateInfo>>*/();
|
templateInfoMap = new HashMap/*<String, List<TemplateInfo>>*/();
|
||||||
|
initializeTemplateInfoMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +155,7 @@ public class TemplateEngine {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Map/*<String, String>*/ getSharedDefaults() {
|
public static Map/*<String, String>*/ getSharedDefaults() {
|
||||||
return SharedDefaults.getInstance().getSharedDefaultsMap();
|
return SharedDefaults.getInstance().getSharedDefaultsMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,6 +192,9 @@ public class TemplateEngine {
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public static TemplateEngine getDefault() {
|
public static TemplateEngine getDefault() {
|
||||||
|
if(TEMPLATE_ENGINE==null) {
|
||||||
|
TEMPLATE_ENGINE = new TemplateEngine();
|
||||||
|
}
|
||||||
return TEMPLATE_ENGINE;
|
return TEMPLATE_ENGINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class TemplateEngineHelper {
|
||||||
} else {
|
} else {
|
||||||
path = path.substring(0, slash + 1) + resourcePath;
|
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) {
|
if (entry == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue