Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Sennikovsky2007-05-11 16:21:53 +0000
committerMikhail Sennikovsky2007-05-11 16:21:53 +0000
commit20a94ee53c0dd84ca2a45107ae99bcf92dad80b4 (patch)
treeeb18611d0c5d82bc25a191a21657af29c4c3c698
parentd3ac3402c74fea598ba998d0973efe8e0d09eae8 (diff)
downloadorg.eclipse.cdt-20a94ee53c0dd84ca2a45107ae99bcf92dad80b4.tar.gz
org.eclipse.cdt-20a94ee53c0dd84ca2a45107ae99bcf92dad80b4.tar.xz
org.eclipse.cdt-20a94ee53c0dd84ca2a45107ae99bcf92dad80b4.zip
Fix from Bala Toraty with some modifications to [Bug 184452] [Template Engine] It should be possible to externalize strings in template definitions
-rw-r--r--build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCAnsiProject/template.properties29
-rw-r--r--build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCAnsiProject/template.xml31
-rw-r--r--build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCCProject/template.properties29
-rw-r--r--build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCCProject/template.xml26
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCore.java17
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateDescriptor.java8
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngineHelper.java84
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java2
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIAttributes.java33
-rw-r--r--core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java7
10 files changed, 233 insertions, 33 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCAnsiProject/template.properties b/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCAnsiProject/template.properties
new file mode 100644
index 00000000000..17e1a9f6d5f
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCAnsiProject/template.properties
@@ -0,0 +1,29 @@
+###############################################################################
+# Copyright (c) 2007 Symbian Software Private Ltd. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Bala Torati (Symbian) - initial API and implementation
+###############################################################################
+
+#Template Default Values
+HelloWorld.CCtemplate.label=Hello World C++ Example
+HelloWorld.CCtemplate.description=A skeletal Managed C++ Hello World project. Creates a folder for sources and another for include.
+HelloWorld.CAnsitemplate.label=Hello World ANSI C Example
+HelloWorld.CAnsitemplate.description=A skeletal Managed C Hello World project. Creates a folder for sources and another for include.
+HelloWorld.basics.label=Basic Settings
+HelloWorld.basics.description=Basic properties of a project
+HelloWorld.author.label=Author
+HelloWorld.author.description=Name of the author
+HelloWorld.copyright.label=Copyright notice
+HelloWorld.copyright.description=Your copyright notice
+HelloWorld.copyright.default=Your copyright notice
+HelloWorld.message.default=!!!Hello World!!!
+HelloWorld.message.description=Your hello world greeting message
+HelloWorld.message.label=Hello world greeting
+HelloWorld.sourceDir.label=Source
+HelloWorld.sourceDir.description=Directory for hello world project source files
+HelloWorld.sourceDir.default=src
diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCAnsiProject/template.xml b/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCAnsiProject/template.xml
index 8ea901d9bd0..9f7244f3243 100644
--- a/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCAnsiProject/template.xml
+++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCAnsiProject/template.xml
@@ -1,35 +1,44 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)"
copyright="Copyright (c) 2007 Symbian Software Limited and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available athttp://www.eclipse.org/legal/epl-v10.html"
- id="HelloWorldCProject" label="Hello World ANSI C Example" description="A skeletal Managed C Hello World project. Creates a folder for sources and another for include."
+ id="HelloWorldCProject" label="%HelloWorld.CAnsitemplate.label" description="%HelloWorld.CAnsitemplate.description"
help="help.html">
- <property-group id="basics" label="Basic Settings" description="Basic properties of a project" type="PAGES-ONLY" help="help.html">
+
+ <property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
<property id="author"
- label="Author"
- description="Name of the author"
+ label="%HelloWorld.author.label"
+ description="%HelloWorld.author.description"
type="input"
pattern=".*"
default=""
hidden="false"
persist="true"/>
<property id="copyright"
- label="Copyright notice"
- description="Your copyright notice"
+ label="%HelloWorld.copyright.label"
+ description="%HelloWorld.copyright.description"
type="input"
pattern=".*"
- default="Your copyright notice"
+ default="%HelloWorld.copyright.default"
hidden="false"
persist="true"/>
<property id="message"
- label="Hello world greeting"
- description="Your hello world greeting message"
+ label="%HelloWorld.message.label"
+ description="%HelloWorld.message.description"
type="input"
pattern=".*"
- default="Hello World!!!"
+ default="%HelloWorld.message.default"
hidden="false"
persist="true"/>
+ <property id="sourceDir"
+ label="%HelloWorld.sourceDir.label"
+ description="%HelloWorld.sourceDir.description"
+ type="input"
+ default="%HelloWorld.sourceDir.default"
+ pattern="[a-zA-Z0-9]+"
+ mandatory="true"
+ persist="true"/>
</property-group>
-
+
<process type="org.eclipse.cdt.managedbuilder.core.NewManagedProject">
<simple name="name" value="$(projectName)" />
<simple name="artifactExtension" value="exe" />
diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCCProject/template.properties b/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCCProject/template.properties
new file mode 100644
index 00000000000..17e1a9f6d5f
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCCProject/template.properties
@@ -0,0 +1,29 @@
+###############################################################################
+# Copyright (c) 2007 Symbian Software Private Ltd. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Bala Torati (Symbian) - initial API and implementation
+###############################################################################
+
+#Template Default Values
+HelloWorld.CCtemplate.label=Hello World C++ Example
+HelloWorld.CCtemplate.description=A skeletal Managed C++ Hello World project. Creates a folder for sources and another for include.
+HelloWorld.CAnsitemplate.label=Hello World ANSI C Example
+HelloWorld.CAnsitemplate.description=A skeletal Managed C Hello World project. Creates a folder for sources and another for include.
+HelloWorld.basics.label=Basic Settings
+HelloWorld.basics.description=Basic properties of a project
+HelloWorld.author.label=Author
+HelloWorld.author.description=Name of the author
+HelloWorld.copyright.label=Copyright notice
+HelloWorld.copyright.description=Your copyright notice
+HelloWorld.copyright.default=Your copyright notice
+HelloWorld.message.default=!!!Hello World!!!
+HelloWorld.message.description=Your hello world greeting message
+HelloWorld.message.label=Hello world greeting
+HelloWorld.sourceDir.label=Source
+HelloWorld.sourceDir.description=Directory for hello world project source files
+HelloWorld.sourceDir.default=src
diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCCProject/template.xml b/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCCProject/template.xml
index 86ab82bd611..65888acfaf6 100644
--- a/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCCProject/template.xml
+++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/templates/projecttemplates/HelloWorldCCProject/template.xml
@@ -1,38 +1,38 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Bala Torati (Symbian)"
copyright="Copyright (c) 2007 Symbian Software Limited and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available athttp://www.eclipse.org/legal/epl-v10.html"
- id="HelloWorldCCProject" label="Hello World C++ Example" description="A skeletal Managed C++ Hello World project. Creates a folder for sources and another for include."
+ id="HelloWorldCCProject" label="%HelloWorld.CCtemplate.label" description="%HelloWorld.CCtemplate.description"
help="help.html">
- <property-group id="basics" label="Basic Settings" description="Basic properties of a project" type="PAGES-ONLY" help="help.html">
+ <property-group id="basics" label="%HelloWorld.basics.label" description="%HelloWorld.basics.description" type="PAGES-ONLY" help="help.html">
<property id="author"
- label="Author"
- description="Name of the author"
+ label="%HelloWorld.author.label"
+ description="%HelloWorld.author.description"
type="input"
pattern=".*"
default=""
hidden="false"
persist="true"/>
<property id="copyright"
- label="Copyright notice"
- description="Your copyright notice"
+ label="%HelloWorld.copyright.label"
+ description="%HelloWorld.copyright.description"
type="input"
pattern=".*"
- default="Your copyright notice"
+ default="%HelloWorld.copyright.default"
hidden="false"
persist="true"/>
<property id="message"
- label="Hello world greeting"
- description="Your hello world greeting message"
+ label="%HelloWorld.message.label"
+ description="%HelloWorld.message.description"
type="input"
pattern=".*"
- default="Hello World!!!"
+ default="%HelloWorld.message.default"
hidden="false"
persist="true"/>
<property id="sourceDir"
- label="Source"
- description="Directory for hello world project source files"
+ label="%HelloWorld.sourceDir.label"
+ description="%HelloWorld.sourceDir.description"
type="input"
- default="src"
+ default="%HelloWorld.sourceDir.default"
pattern="[a-zA-Z0-9]+"
mandatory="true"
persist="true"/>
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 9de6efd5fce..edab12bc362 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
@@ -11,6 +11,7 @@
package org.eclipse.cdt.core.templateengine;
import java.io.IOException;
+import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
@@ -75,7 +76,7 @@ public class TemplateCore {
protected TemplateCore(TemplateInfo templateInfo) throws IOException, SAXException, ParserConfigurationException {
this.templateInfo = templateInfo;
- templateDescriptor = new TemplateDescriptor(TemplateEngineHelper.getTemplateResourceURL(templateInfo.getPluginId(), templateInfo.getTemplatePath()));
+ templateDescriptor = new TemplateDescriptor(TemplateEngineHelper.getTemplateResourceURL(templateInfo.getPluginId(), templateInfo.getTemplatePath()), templateInfo.getPluginId());
valueStore = new ValueStore/*<String, String>*/(this);
valueStore.putAll(templateDescriptor.getTemplateDefaults(templateDescriptor.getRootElement()));
valueStore.putAll(TemplateEngine.getDefault().getSharedDefaults());
@@ -141,7 +142,7 @@ public class TemplateCore {
if (description == null) {
description = templateDescriptor.getRootElement().getAttribute(DESCRIPTION).trim();
}
- return description;
+ return TemplateEngineHelper.externalizeTemplateString(templateInfo, description);
}
/**
@@ -171,7 +172,7 @@ public class TemplateCore {
if (label == null) {
label = templateDescriptor.getRootElement().getAttribute(LABEL).trim();
}
- return label;
+ return TemplateEngineHelper.externalizeTemplateString(templateInfo, label);
}
/**
@@ -247,13 +248,20 @@ public class TemplateCore {
}
public Object/*V*/ put(Object/*K*/ key, Object/*V*/ value) {
+ value = TemplateEngineHelper.externalizeTemplateString(template.getTemplateInfo(), (String)value);
Object/*V*/ v = super.put(key, value);
template.setDirty();
return v;
}
public void putAll(Map/*<? extends K, ? extends V>*/ map) {
- super.putAll(map);
+ Collection keys = map.keySet();
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+ Object key = iterator.next();
+ Object value = map.get(key);
+ value = TemplateEngineHelper.externalizeTemplateString(template.getTemplateInfo(), (String) value);
+ super.put(key, value);
+ }
template.setDirty();
}
@@ -262,6 +270,5 @@ public class TemplateCore {
template.setDirty();
return v;
}
-
}
}
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateDescriptor.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateDescriptor.java
index 36cfd87d80e..f868b2362a5 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateDescriptor.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateDescriptor.java
@@ -41,6 +41,7 @@ public class TemplateDescriptor {
private Document document;
private Element rootElement;
private List/*<String>*/ persistVector;
+ private String pluginId;
/**
* Constructor which construct the Document based the URL
@@ -49,10 +50,11 @@ public class TemplateDescriptor {
* @throws IOException
* @throws ParserConfigurationException
*/
- public TemplateDescriptor(URL descriptorURL) throws SAXException, IOException, ParserConfigurationException {
+ public TemplateDescriptor(URL descriptorURL, String id) throws SAXException, IOException, ParserConfigurationException {
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(descriptorURL.openStream());
rootElement = document.getDocumentElement();
persistVector = new ArrayList/*<String>*/();
+ pluginId = id;
}
/**
@@ -195,4 +197,8 @@ public class TemplateDescriptor {
public List/*<String>*/ getPersistTrueIDs() {
return persistVector;
}
+
+ public String getPluginId() {
+ return pluginId;
+ }
}
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 2f662c92df2..26d45b44a42 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
@@ -12,7 +12,10 @@ package org.eclipse.cdt.core.templateengine;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
+import java.util.Locale;
+import java.util.Properties;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.core.resources.IWorkspace;
@@ -23,6 +26,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.Bundle;
/**
* Acts as an Helper class for Template Engine
@@ -33,9 +37,11 @@ public class TemplateEngineHelper {
public static final String OPEN_MARKER = "$("; //$NON-NLS-1$
public static final String CLOSE_MARKER = ")"; //$NON-NLS-1$
+ public static final String STRING_EXTERNALIZATION_MARKER = "%"; //$NON-NLS-1$
public static final String LOGGER_FILE_NAME = "Process"; //$NON-NLS-1$
// This is used while getting the Plugin Path.
public static final String PROJRESOURCE = "plugin.xml"; //$NON-NLS-1$
+ public static final String PLUGIN_ID = "pluginId"; //$NON-NLS-1$
public static final String BOOLTRUE = "true"; //$NON-NLS-1$
public static final String ID = "id"; //$NON-NLS-1$
public static final String VALUE = "value"; //$NON-NLS-1$
@@ -218,4 +224,82 @@ public class TemplateEngineHelper {
}
return FileLocator.toFileURL(entry);
}
+
+ public static String externalizeTemplateString(TemplateInfo ti, String key) {
+ if (key.startsWith(STRING_EXTERNALIZATION_MARKER)) {
+ String pluginId = ti.getPluginId();
+ String path = ti.getTemplatePath();
+ IPath p = new Path(path);
+ String propertiesPath = "template.properties";
+ if(p.segmentCount() != 0){
+ p = p.removeLastSegments(1);
+ propertiesPath = p.append(propertiesPath).toString();
+ }
+ return externalizeTemplateString(pluginId, propertiesPath, key);
+ }
+ return key;
+ }
+
+ public static String externalizeTemplateString(String pluginId, String location, String key) {
+ String value = key;
+ if (key.startsWith(STRING_EXTERNALIZATION_MARKER)) {
+ try {
+ value = location != null ? getValueFromProperties(pluginId, location, key.substring(1)) : null;
+ if (value == null) {
+ value = getValueFromProperties(pluginId, "plugin.properties", key.substring(1));
+ }
+ } catch (IOException e) {
+ value = key;
+ e.printStackTrace();
+ }
+
+ if (value == null) {
+ value = key;
+ }
+ }
+ return value;
+ }
+
+ private static String getValueFromProperties(String pluginId, String propertiesFile, String key) throws IOException {
+ String value = null;
+ Bundle b = Platform.getBundle(pluginId);
+// URL url= b.getResource(propertiesFile);
+ URL url= getResourceURL(b, propertiesFile);
+ if (url != null) {
+ InputStream in= url.openStream();
+ Properties p = new Properties();
+ p.load(in);
+ value = (String) p.get(key);
+ }
+ return value;
+
+ }
+
+ private static URL getResourceURL(Bundle bundle, String propertiesFile) {
+ // Get the properties in the following order
+ // propertiesFile_lang_country_variant
+ // propertiesFile_lang_country
+ // propertiesFile_lang
+ // propertiesFile
+
+ URL url = null;
+ Locale locale = Locale.getDefault();
+ String lang = locale.getLanguage();
+ String country = locale.getCountry();
+ String variant = locale.getVariant();
+
+ url = bundle.getResource(propertiesFile + "_" + lang + "_" + country + "_" + variant);
+
+ if (url == null) {
+ url = bundle.getResource(propertiesFile + "_" + lang + "_" + country);
+ }
+ if (url == null) {
+ url = bundle.getResource(propertiesFile + "_" + lang);
+ }
+ if (url == null) {
+ url = bundle.getResource(propertiesFile);
+ }
+
+ return url;
+ }
}
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java
index fb432e55ca1..2af57b16129 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/Template.java
@@ -59,7 +59,7 @@ public class Template extends TemplateCore {
public Template(TemplateInfo templateInfo) throws IOException, ProcessFailureException, SAXException, ParserConfigurationException {
super(templateInfo);
templateDescriptor = getTemplateDescriptor();
- uiElementTreeBuilderManager = new UIElementTreeBuilderManager(new UIElementTreeBuilderHelper(templateDescriptor));
+ uiElementTreeBuilderManager = new UIElementTreeBuilderManager(new UIElementTreeBuilderHelper(templateDescriptor, templateInfo));
uiPagesProvider = new UIPagesProvider();
}
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIAttributes.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIAttributes.java
index 0e7fdc43d2b..ead38f5d4c5 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIAttributes.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIAttributes.java
@@ -10,7 +10,13 @@
*******************************************************************************/
package org.eclipse.cdt.ui.templateengine.uitree;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.cdt.core.templateengine.TemplateEngineHelper;
+import org.eclipse.cdt.core.templateengine.TemplateInfo;
/**
*
@@ -24,4 +30,31 @@ import java.util.HashMap;
public class UIAttributes/*<K, V>*/ extends HashMap/*<String, String>*/ {
private static final long serialVersionUID = 0000000000L;
+ private TemplateInfo templateInfo;
+
+ UIAttributes(TemplateInfo templateInfo) {
+ this.templateInfo = templateInfo;
+ }
+
+ public Object/*V*/ put(Object/*K*/ key, Object/*V*/ value) {
+ value = TemplateEngineHelper.externalizeTemplateString(templateInfo, (String)value);
+ Object/*V*/ v = super.put(key, value);
+ return v;
+ }
+
+ public void putAll(Map/*<? extends K, ? extends V>*/ map) {
+ Collection keys = map.keySet();
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+ Object key = iterator.next();
+ Object value = map.get(key);
+ value = TemplateEngineHelper.externalizeTemplateString(templateInfo, (String) value);
+ super.put(key, value);
+ }
+ }
+
+ public Object/*V*/ remove(Object key) {
+ Object/*V*/ v = super.remove(key);
+ return v;
+ }
+
}
diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java
index 5da6fb1fe5c..fe143e17ec7 100644
--- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java
+++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/UIElementTreeBuilderHelper.java
@@ -20,6 +20,7 @@ import org.w3c.dom.Node;
import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
import org.eclipse.cdt.core.templateengine.TemplateEngine;
import org.eclipse.cdt.core.templateengine.TemplateEngineHelper;
+import org.eclipse.cdt.core.templateengine.TemplateInfo;
import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UIBooleanWidget;
import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UIBrowseWidget;
import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UISelectWidget;
@@ -39,6 +40,7 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
* TemplateDescriptor representing the TemplaeDescriptor XML.
*/
private TemplateDescriptor templateDescriptor = null;
+ private TemplateInfo templateInfo;
private Element element;
@@ -47,8 +49,9 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
*
* @param templateDescriptor
*/
- public UIElementTreeBuilderHelper(TemplateDescriptor templateDescriptor) {
+ public UIElementTreeBuilderHelper(TemplateDescriptor templateDescriptor, TemplateInfo templateInfo) {
this.templateDescriptor = templateDescriptor;
+ this.templateInfo = templateInfo;
}
/**
@@ -72,7 +75,7 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
this.element = element;
UIElement retUIElement = null;
- UIAttributes/*<String, String>*/ uiAttributes = new UIAttributes/*<String, String>*/();
+ UIAttributes/*<String, String>*/ uiAttributes = new UIAttributes/*<String, String>*/(templateInfo);
NamedNodeMap list = element.getAttributes();
for (int i = 0, s = list.getLength(); i < s; i++) {

Back to the top