From 35b929b8943f63813dcec692821d4e6a917ef377 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Mon, 7 Sep 2009 21:00:08 +0000 Subject: [PATCH] bug 288775: [Template Engine] Mappings between labels and values in not reversible for with id="functional_area" --- .../cdt/ui/templateengine/messages.properties | 5 +++-- .../uitree/UIElementTreeBuilderHelper.java | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/messages.properties b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/messages.properties index 4cca2d124bf..88f811953a7 100644 --- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/messages.properties +++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/messages.properties @@ -36,10 +36,11 @@ ProjectSelectionPage.8=The project does not exist ProjectSelectionPage.9=Please select a CDT project ProjectSelectionPage.10=Project Selection ProjectSelectionPage.11=Choose a Project -UIElementTreeBuilderHelper.InvalidEmptyLabel=Invalid item element in with id="{0}": attributes ''label'' and ''value'' must be present. -UIElementTreeBuilderHelper.InvalidNonUniqueValue=Mappings between labels and values in not reversible for with id="{0}" +UIElementTreeBuilderHelper.InvalidEmptyLabel=Invalid item element in : attributes "label" and "value" must be present. +UIElementTreeBuilderHelper.InvalidNonUniqueValue=Duplicate item value="{0}" in combo box . UIElementTreeBuilderHelper.UnknownWidgetType0=Unknown widget type: {0} UISelectWidget_ErrorNoneSelected0=Please choose a value for {0} UITextWidget.0=\ Project already exists in workspace. SimpleElementException.0=This Operation not supported on InputUIElement +TemplateEngineMessage.Error=CDT New Project Wizard Template Engine Error 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 7a35b154c96..b36915b2abf 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 @@ -11,15 +11,19 @@ *******************************************************************************/ package org.eclipse.cdt.ui.templateengine.uitree; -import com.ibm.icu.text.MessageFormat; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; +import com.ibm.icu.text.MessageFormat; + import org.eclipse.cdt.core.templateengine.TemplateDescriptor; import org.eclipse.cdt.core.templateengine.TemplateEngine; import org.eclipse.cdt.core.templateengine.TemplateInfo; @@ -37,6 +41,7 @@ import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UITextWidget; * UIElement. The UIElement can be a simple UI Widget or a group. */ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper { + private static final String TEMPLATE_ENGINE_ERROR = Messages.getString("TemplateEngineMessage.Error"); //$NON-NLS-1$ /** * TemplateDescriptor representing the TemplaeDescriptor XML. */ @@ -118,12 +123,14 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper { value= item.getAttribute(InputUIElement.COMBOITEM_VALUE); } if(label==null || value==null) { - String msg= Messages.getString("UIElementTreeBuilderHelper.InvalidEmptyLabel"); //$NON-NLS-1$ - CUIPlugin.log(MessageFormat.format(msg, new Object[] {id}), null); + String msg = MessageFormat.format(Messages.getString("UIElementTreeBuilderHelper.InvalidEmptyLabel"), //$NON-NLS-1$ + new Object[] {id}); + CUIPlugin.log(TEMPLATE_ENGINE_ERROR, new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, msg))); } else { if(value2name.put(value, label)!=null) { - String msg= Messages.getString("UIElementTreeBuilderHelper.InvalidNonUniqueValue"); //$NON-NLS-1$ - CUIPlugin.log(MessageFormat.format(msg, new Object[] {id}), null); + String msg = MessageFormat.format(Messages.getString("UIElementTreeBuilderHelper.InvalidNonUniqueValue"), //$NON-NLS-1$ + new Object[] {value, id}); + CUIPlugin.log(TEMPLATE_ENGINE_ERROR, new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, msg))); } } } @@ -148,7 +155,7 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper { // for generating UI pages as TABS in a single page. } else { String msg= MessageFormat.format(Messages.getString("UIElementTreeBuilderHelper.UnknownWidgetType0"), new Object[] {type}); //$NON-NLS-1$ - CUIPlugin.log(msg, null); + CUIPlugin.log(TEMPLATE_ENGINE_ERROR, new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, msg))); } return widgetElement;