Author: mareshkau
Date: 2011-02-15 09:57:53 -0500 (Tue, 15 Feb 2011)
New Revision: 29157
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/LocalizedMessage.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nMarkerResolution.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nValidationComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ValidatorConstants.java
Log:
https://issues.jboss.org/browse/JBIDE-7003, quick fix message adjustment.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java 2011-02-15
14:14:35 UTC (rev 29156)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java 2011-02-15
14:57:53 UTC (rev 29157)
@@ -148,7 +148,10 @@
public static String Refactoring_JSF_2_Changes_Rename_Composite_Component;
public static String Refactoring_JSF_2_Rename_Composite_Component;
public static String Refactoring_JSF_2_Rename_Attr_Ref_Decl;
+ public static String NonExternalizedStringLiteral;
+ public static String NonExternalizedStringMarkerLabel;
+
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, JSFUIMessages.class);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties 2011-02-15
14:14:35 UTC (rev 29156)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties 2011-02-15
14:57:53 UTC (rev 29157)
@@ -125,3 +125,5 @@
Refactoring_JSF_2_Changes_Rename_Composite_Component=Changes to rename composite
component
Refactoring_JSF_2_Rename_Composite_Component=Rename composite component
Refactoring_JSF_2_Rename_Attr_Ref_Decl=Rename composite attribute reference in
declaration
+NonExternalizedStringLiteral=Non externalized String literal; It should be moved to
resource bundles.
+NonExternalizedStringMarkerLabel=Move String "{0}" to resource bundle.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/LocalizedMessage.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/LocalizedMessage.java 2011-02-15
14:14:35 UTC (rev 29156)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/LocalizedMessage.java 2011-02-15
14:57:53 UTC (rev 29157)
@@ -78,8 +78,12 @@
i18nLocMessage.setAttribute("problemType",
I18nValidationComponent.PROBLEM_ID); //$NON-NLS-1$
i18nLocMessage.setAttribute(IMarker.LINE_NUMBER, i18nLocMessage.getLineNumber());
i18nLocMessage.setAttribute(IMarker.SEVERITY, 1);
- i18nLocMessage.setAttribute(ValidatorMessage.ValidationId,
"org.jboss.tools.jsf.i18n.source");
+ i18nLocMessage.setAttribute(ValidatorMessage.ValidationId,
"org.jboss.tools.jsf.i18n.source"); //$NON-NLS-1$
i18nLocMessage.setAttribute(IMarker.MESSAGE,i18nLocMessage.getText());
+ if(ijsfValidationComponent instanceof I18nValidationComponent){
+ i18nLocMessage.setAttribute(JSF2ValidatorConstants.INVALID_STRING_KEY,
+ ((I18nValidationComponent)ijsfValidationComponent).getInValidString());
+ }
return i18nLocMessage;
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nMarkerResolution.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nMarkerResolution.java 2011-02-15
14:14:35 UTC (rev 29156)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nMarkerResolution.java 2011-02-15
14:57:53 UTC (rev 29157)
@@ -10,8 +10,14 @@
******************************************************************************/
package org.jboss.tools.jsf.web.validation.i18n;
+import java.text.MessageFormat;
+
import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IMarkerResolution;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -19,19 +25,22 @@
*
*/
public class I18nMarkerResolution implements IMarkerResolution {
-
+
+ private String invalidString="";
+
public I18nMarkerResolution(IMarker marker) {
- // TODO Auto-generated constructor stub
+ try {
+ invalidString = (String)
marker.getAttribute(JSF2ValidatorConstants.INVALID_STRING_KEY);
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ }
}
public String getLabel() {
- // TODO Auto-generated method stub
- return "";
+ return
MessageFormat.format(JSFUIMessages.NonExternalizedStringMarkerLabel,invalidString);
}
public void run(IMarker marker) {
- // TODO Auto-generated method stub
-
+
}
-
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nValidationComponent.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nValidationComponent.java 2011-02-15
14:14:35 UTC (rev 29156)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nValidationComponent.java 2011-02-15
14:57:53 UTC (rev 29157)
@@ -12,7 +12,9 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
import org.jboss.tools.jsf.web.validation.JSFAbstractValidationComponent;
+import org.w3c.dom.Node;
/**
* @author mareshkau
@@ -22,6 +24,8 @@
public static String PROBLEM_ID = JSFModelPlugin.PLUGIN_ID
+ ".i18nproblemmarker"; //$NON-NLS-1$
+ private String inValidString;
+
//component creating usung factory method
private I18nValidationComponent(){}
@@ -33,6 +37,7 @@
component.getStartOffSet()) + 1);
component.createValidationMessage();
component.createMessageParams();
+ component.setInValidString(element.getNodeValue());
return component;
}
@@ -51,7 +56,21 @@
public void createValidationMessage() {
- setValidationMessage("Non externalized String literal; It should be moved to
resource bundles.");
+ setValidationMessage(JSFUIMessages.NonExternalizedStringLiteral);
}
+ /**
+ * @param inValidString the inValidString to set
+ */
+ public void setInValidString(String inValidString) {
+ this.inValidString = inValidString;
+ }
+
+ /**
+ * @return the inValidString
+ */
+ public String getInValidString() {
+ return inValidString;
+ }
+
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nValidator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nValidator.java 2011-02-15
14:14:35 UTC (rev 29156)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nValidator.java 2011-02-15
14:57:53 UTC (rev 29157)
@@ -67,13 +67,9 @@
public void validate(IValidationContext helper, IReporter reporter)
throws ValidationException {
- List<Node> notValidNodes = new ArrayList<Node>();
- validateDOM(document, notValidNodes);
- List<IJSFValidationComponent> jsfValComponents = new
ArrayList<IJSFValidationComponent>();
- for (Node node : notValidNodes) {
- jsfValComponents.add(I18nValidationComponent.createI18nValidationComponent((IDOMText)node));
- }
- reportProblems(helper, reporter, jsfValComponents);
+ List<IJSFValidationComponent> jsfnonValComponents = new
ArrayList<IJSFValidationComponent>();
+ validateDOM(document, jsfnonValComponents);
+ reportProblems(helper, reporter, jsfnonValComponents);
}
private void reportProblems(IValidationContext helper, IReporter reporter,
@@ -95,16 +91,16 @@
- private void validateDOM(Node node, List<Node> nonExtStings){
+ private void validateDOM(Node node, List<IJSFValidationComponent>
jsfnonValComponents){
NodeList childNodes = node.getChildNodes();
for(int i=0;i<childNodes.getLength();i++) {
Node childNode = childNodes.item(i);
if(childNode instanceof Text){
if(!validateTextNode(((Text)childNode).getNodeValue())){
- nonExtStings.add(childNode);
+ jsfnonValComponents.add(I18nValidationComponent.createI18nValidationComponent((IDOMText)childNode));
}
}else {
- validateDOM(childNode, nonExtStings);
+ validateDOM(childNode, jsfnonValComponents);
}
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ValidatorConstants.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ValidatorConstants.java 2011-02-15
14:14:35 UTC (rev 29156)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ValidatorConstants.java 2011-02-15
14:57:53 UTC (rev 29157)
@@ -34,4 +34,6 @@
public static final String JSF2_FIXABLE_ATTR_TYPE = "JSF2_FIXABLE_ATTR_TYPE";
//$NON-NLS-1$
public static final String JSF2_URI_TYPE = "JSF2_URI_TYPE"; //$NON-NLS-1$
+
+ public static final String INVALID_STRING_KEY = "INVALID_STRING_KEY";
//$NON-NLS-1$
}