Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferguson2007-06-20 16:59:31 +0000
committerAndrew Ferguson2007-06-20 16:59:31 +0000
commit30ac9eb2c8846f71226cf63bd6d1be381641f680 (patch)
treeb583bae53509af168ff74c239fa54a5b30bf6f0e /core/org.eclipse.cdt.core/templateengine
parent99b93588334c27c50aeac0fff72c084093508a50 (diff)
downloadorg.eclipse.cdt-30ac9eb2c8846f71226cf63bd6d1be381641f680.tar.gz
org.eclipse.cdt-30ac9eb2c8846f71226cf63bd6d1be381641f680.tar.xz
org.eclipse.cdt-30ac9eb2c8846f71226cf63bd6d1be381641f680.zip
fix cyclic construction problem exposed by improved error handling
Diffstat (limited to 'core/org.eclipse.cdt.core/templateengine')
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCore.java2
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java11
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java2
3 files changed, 7 insertions, 8 deletions
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCore.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCore.java
index 96f289ed3ce..6b95af1df96 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCore.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCore.java
@@ -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);
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java
index 8e5c70c90f7..f73a9af070a 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine.java
@@ -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;
}
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java
index 767125872ce..a5cca0df054 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java
@@ -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;
}

Back to the top