Author: mareshkau
Date: 2011-02-07 08:04:02 -0500 (Mon, 07 Feb 2011)
New Revision: 29043
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFAbstractValidationComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ValidatorUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSFValidationComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ValidatorConstants.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSF2ValidationComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AbstractValidationComponent.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
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/JSF2ComponentsValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2XMLValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeAttrsProposal.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeComponentProposal.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2QuickFixProcessor.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ResourcesFolderProposal.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AttrTempComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2ComponentFactory.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2CompositeTempComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2URITempComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentRecognizer.java
Log:
https://issues.jboss.org/browse/JBIDE-7005, refactoring our jsf 2 validators.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2011-02-07 13:01:01 UTC
(rev 29042)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2011-02-07 13:04:02 UTC
(rev 29043)
@@ -65,3 +65,4 @@
Bundle-Version: 3.2.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.jboss.tools.jst.jsp.bundle
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFAbstractValidationComponent.java
(from rev 28999,
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AbstractValidationComponent.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFAbstractValidationComponent.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFAbstractValidationComponent.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -0,0 +1,52 @@
+package org.jboss.tools.jsf.web.validation;
+
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSFValidationComponent;
+
+public abstract class JSFAbstractValidationComponent implements
+ IJSFValidationComponent {
+
+ private int length;
+ private int startOffSet;
+ private int line;
+ private Object[] messageParams;
+
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ public void setLine(int lineNumber) {
+ this.line = lineNumber;
+ }
+
+ public int getStartOffSet() {
+ return startOffSet;
+ }
+
+ public void setStartOffSet(int startOffSet) {
+ this.startOffSet = startOffSet;
+ }
+
+ public Object[] getMessageParams() {
+ return messageParams;
+ }
+
+ public int getSeverity() {
+ return IMessage.NORMAL_SEVERITY;
+ }
+
+ public abstract void createValidationMessage();
+
+ public void createMessageParams() {
+ this.messageParams = new Object[] { this };
+ }
+
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ValidatorUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ValidatorUtil.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ValidatorUtil.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.web.validation;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+
+/**
+ * @author mareshkau
+ *
+ */
+public class ValidatorUtil {
+ public static void reportProblems(IReporter reporter,
+ IMessage message,IResource resource) {
+ }
+}
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-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/i18n/I18nValidator.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -22,6 +22,7 @@
import org.eclipse.wst.validation.internal.provisional.core.IValidator;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.jboss.tools.jsf.jsf2.model.JSF2ComponentModelManager;
+import org.jboss.tools.jst.jsp.bundle.BundleMapUtil;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
@@ -56,20 +57,34 @@
public void validate(IValidationContext helper, IReporter reporter)
throws ValidationException {
- List<Node> stringNodes = new ArrayList<Node>();
- lookForStrings(document, stringNodes);
+ List<Node> notValidNodes = new ArrayList<Node>();
+ validateDOM(document, notValidNodes);
+
}
- private void lookForStrings(Node node, List<Node> nonExtStings){
+ private void validateDOM(Node node, List<Node> nonExtStings){
NodeList childNodes = node.getChildNodes();
for(int i=0;i<childNodes.getLength();i++) {
Node childNode = childNodes.item(i);
if(childNode instanceof Text){
- nonExtStings.add(childNode);
- } else {
- lookForStrings(childNode, nonExtStings);
- }
+ if(!validateTextNode(((Text)childNode).getNodeValue())){
+ nonExtStings.add(childNode);
+ }
+ }else {
+ validateDOM(childNode, nonExtStings);
+ }
}
}
+ /**
+ * Return false if not not valid
+ * @param String to validate
+ * @return true is string ext and valid, false otherwise
+ *
+ */
+ private boolean validateTextNode(String stringToValidate){
+ if(stringToValidate==null) return true;
+ if(stringToValidate.trim().length()<1) return true;
+ return BundleMapUtil.isContainsEl(stringToValidate);
+ }
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ComponentsValidator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ComponentsValidator.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ComponentsValidator.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -13,6 +13,7 @@
import java.io.InputStream;
import java.util.Scanner;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -27,10 +28,10 @@
import org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
-import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2AttrTempComponent;
import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2CompositeTempComponent;
import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2URITempComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.jst.web.kb.KbProjectFactory;
@@ -108,7 +109,7 @@
}
if (args[0] instanceof JSF2CompositeTempComponent) {
JSF2CompositeTempComponent component = (JSF2CompositeTempComponent) args[0];
- message.setAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY,
+ message.setAttribute(JSF2ValidatorConstants.JSF2_TYPE_KEY,
component.getType());
message.setAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY,
component.getComponentResourceLocation());
@@ -117,7 +118,7 @@
if (attrNames != null) {
for (int i = 0; i < attrNames.length; i++) {
message.setAttribute(
- IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY
+ JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY
+ String.valueOf(i), attrNames[i]);
}
}
@@ -125,9 +126,9 @@
}
if (args[0] instanceof JSF2AttrTempComponent) {
JSF2AttrTempComponent component = (JSF2AttrTempComponent) args[0];
- message.setAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY,
+ message.setAttribute(JSF2ValidatorConstants.JSF2_TYPE_KEY,
component.getType());
- message.setAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY,
+ message.setAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY,
component.getName());
message.setAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY,
component.getComponentResourceLocation());
@@ -136,9 +137,9 @@
}
if (args[0] instanceof JSF2URITempComponent) {
JSF2URITempComponent component = (JSF2URITempComponent) args[0];
- message.setAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY,
- IJSF2ValidationComponent.JSF2_URI_TYPE);
- message.setAttribute(IJSF2ValidationComponent.JSF2_URI_NAME_KEY,
+ message.setAttribute(JSF2ValidatorConstants.JSF2_TYPE_KEY,
+ JSF2ValidatorConstants.JSF2_URI_TYPE);
+ message.setAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY,
component.getURI());
message.setAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY,
component.getResourcesFolder());
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -32,10 +32,11 @@
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.jsf2.model.JSF2ComponentModelManager;
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
-import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSFValidationComponent;
import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2AttrTempComponent;
import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2CompositeTempComponent;
import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2URITempComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
* Validates when we change smth in file
@@ -99,7 +100,7 @@
}
private void reportProblems(IReporter reporter,
- IJSF2ValidationComponent[] validationComponents,IResource resource) {
+ IJSFValidationComponent[] validationComponents,IResource resource) {
try {
resource.deleteMarkers(JSF2XMLValidator.JSF2_PROBLEM_ID, false,
IResource.DEPTH_INFINITE);
for (int i = 0; i < validationComponents.length; i++) {
@@ -116,13 +117,13 @@
private static class LocalizedMessage extends Message {
- private IJSF2ValidationComponent component;
+ private IJSFValidationComponent component;
- public LocalizedMessage(IJSF2ValidationComponent component,
+ public LocalizedMessage(IJSFValidationComponent component,
IFile validateFile) {
this.component = component;
setAttribute("problemType", JSF2XMLValidator.JSF2_PROBLEM_ID);
//$NON-NLS-1$
- setAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY, component
+ setAttribute(JSF2ValidatorConstants.JSF2_TYPE_KEY, component
.getType());
setAttribute(
"validateResourcePath", validateFile == null ? "" :
validateFile.getFullPath().toString()); //$NON-NLS-1$//$NON-NLS-2$
@@ -132,10 +133,10 @@
setAttribute(IMarker.SEVERITY, 1);
setAttribute(ValidatorMessage.ValidationId,
"org.jboss.tools.jsf.jsf2.source"); //$NON-NLS-1$
if (component instanceof JSF2URITempComponent) {
- setAttribute(IJSF2ValidationComponent.JSF2_URI_NAME_KEY,
+ setAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY,
((JSF2URITempComponent) component).getURI());
} else if (component instanceof JSF2AttrTempComponent) {
- setAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY,
+ setAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY,
((JSF2AttrTempComponent) component).getName());
setAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME, ((JSF2AttrTempComponent)
component).getElementName());
} else if (component instanceof JSF2CompositeTempComponent) {
@@ -144,7 +145,7 @@
if (attrNames != null) {
for (int i = 0; i < attrNames.length; i++) {
setAttribute(
- IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY
+ JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY
+ String.valueOf(i), attrNames[i]);
}
setAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME, ((JSF2CompositeTempComponent)
component).getElement().getLocalName());
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2XMLValidator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2XMLValidator.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2XMLValidator.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -26,7 +26,7 @@
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.jsf2.model.JSF2ComponentModelManager;
import org.jboss.tools.jsf.jsf2.util.JSF2ComponentUtil;
-import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSFValidationComponent;
import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ComponentRecognizer;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.PageContextFactory;
@@ -78,7 +78,7 @@
private void validateAsDOM(IFile file) {
IDOMDocument document = JSF2ComponentModelManager
.getReadableDOMDocument(file);
- IJSF2ValidationComponent[] components = getValidationComponents(
+ IJSFValidationComponent[] components = getValidationComponents(
document, file);
if (components != null) {
for (int i = 0; i < components.length; i++) {
@@ -88,16 +88,16 @@
}
private void createMarkerForComponent(
- IJSF2ValidationComponent jsf2ValidationComponent) {
+ IJSFValidationComponent jsf2ValidationComponent) {
validationInfo.addWarning(jsf2ValidationComponent
.getValidationMessage(), jsf2ValidationComponent.getLine(), 0,
validationInfo.getFileURI(), null, jsf2ValidationComponent
.getMessageParams());
}
- public static IJSF2ValidationComponent[] getValidationComponents(Node node,
+ public static IJSFValidationComponent[] getValidationComponents(Node node,
IFile file) {
- List<IJSF2ValidationComponent> components = new
ArrayList<IJSF2ValidationComponent>(
+ List<IJSFValidationComponent> components = new
ArrayList<IJSFValidationComponent>(
0);
Map<String, List<Element>> compositeComponentsMap = JSF2ComponentUtil
.findCompositeComponents(node);
@@ -106,7 +106,7 @@
for (Entry<String, List<Element>> entry : entries) {
List<Element> elements = entry.getValue();
for (Element element : elements) {
- IJSF2ValidationComponent[] validationComponents = JSF2ComponentRecognizer
+ IJSFValidationComponent[] validationComponents = JSF2ComponentRecognizer
.recognizeCompositeValidationComponents(file,
(IDOMElement) element);
for (int i = 0; i < validationComponents.length; i++) {
@@ -119,7 +119,7 @@
for (int i = 0; i < attrs.length; i++) {
if (!attrValuesSet.contains(attrs[i].getValue())) {
attrValuesSet.add(attrs[i].getValue());
- IJSF2ValidationComponent validationComponent = JSF2ComponentRecognizer
+ IJSFValidationComponent validationComponent = JSF2ComponentRecognizer
.recognizeURIValidationComponent(file.getProject(),
attrs[i]);
if (validationComponent != null) {
@@ -127,6 +127,6 @@
}
}
}
- return components.toArray(new IJSF2ValidationComponent[0]);
+ return components.toArray(new IJSFValidationComponent[0]);
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -15,11 +15,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
-import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -38,14 +36,14 @@
return new IMarkerResolution[0];
}
String fixType = (String) marker
- .getAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY);
- if (IJSF2ValidationComponent.JSF2_COMPOSITE_COMPONENT_TYPE.equals(fixType)) {
+ .getAttribute(JSF2ValidatorConstants.JSF2_TYPE_KEY);
+ if (JSF2ValidatorConstants.JSF2_COMPOSITE_COMPONENT_TYPE.equals(fixType)) {
return new IMarkerResolution[] { new JSF2CompositeComponentProposal(marker) };
}
- if (IJSF2ValidationComponent.JSF2_FIXABLE_ATTR_TYPE.equals(fixType)) {
+ if (JSF2ValidatorConstants.JSF2_FIXABLE_ATTR_TYPE.equals(fixType)) {
return new IMarkerResolution[] { new JSF2CompositeAttrsProposal(marker) };
}
- if (IJSF2ValidationComponent.JSF2_URI_TYPE.equals(fixType)) {
+ if (JSF2ValidatorConstants.JSF2_URI_TYPE.equals(fixType)) {
return new IMarkerResolution[] { new JSF2ResourcesFolderProposal(marker) };
}
} catch (CoreException e) {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeAttrsProposal.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeAttrsProposal.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeAttrsProposal.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -13,6 +13,7 @@
import java.text.MessageFormat;
import java.util.Map;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -24,7 +25,7 @@
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jsf.messages.JSFUIMessages;
import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
-import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -44,7 +45,7 @@
try {
this.elementName=(String) marker.getAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME);
this.componentPath=(String)
marker.getAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
- this.attrName=(String)marker.getAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY);
+ this.attrName=(String)marker.getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY);
} catch (CoreException e) {
JSFModelPlugin.getPluginLog().logError(e);
}
@@ -72,7 +73,7 @@
.get(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
componentPath = (String) object;
attrs = new String[] { (String) marker
- .getAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY) };
+ .getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY) };
}
final IFile createdFile = JSF2ResourceUtil
.createCompositeComponentFile(validateResource.getProject(),
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeComponentProposal.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeComponentProposal.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeComponentProposal.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -16,6 +16,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -27,7 +28,7 @@
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jsf.messages.JSFUIMessages;
import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
-import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -67,7 +68,7 @@
Set<Entry> entries = attrsMap.entrySet();
for (Entry entry : entries) {
String key = (String) entry.getKey();
- if (key.startsWith(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY)) {
+ if (key.startsWith(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY)) {
set.add((String) entry.getValue());
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2QuickFixProcessor.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2QuickFixProcessor.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2QuickFixProcessor.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -22,7 +22,7 @@
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.wst.sse.ui.StructuredTextInvocationContext;
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
-import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -45,7 +45,7 @@
if (invocationContext instanceof StructuredTextInvocationContext) {
StructuredTextInvocationContext context = (StructuredTextInvocationContext)
invocationContext;
String type = (String) context
- .getAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY);
+ .getAttribute(JSF2ValidatorConstants.JSF2_TYPE_KEY);
IResource resource = ResourcesPlugin.getWorkspace().getRoot()
.findMember(
(String) context
@@ -53,23 +53,23 @@
String compPath = (String) context
.getAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
- if (type.equals(IJSF2ValidationComponent.JSF2_FIXABLE_ATTR_TYPE)) {
+ if (type.equals(JSF2ValidatorConstants.JSF2_FIXABLE_ATTR_TYPE)) {
String[] attrs = new String[] { (String) context
- .getAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY) };
+ .getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY) };
ICompletionProposal proposal = new JSF2CompositeAttrsProposal(
- resource, compPath,
attrs,(String)context.getAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY),
+ resource, compPath,
attrs,(String)context.getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY),
(String)context.getAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME));
return new ICompletionProposal[] { proposal };
} else if (type
- .equals(IJSF2ValidationComponent.JSF2_COMPOSITE_COMPONENT_TYPE)) {
+ .equals(JSF2ValidatorConstants.JSF2_COMPOSITE_COMPONENT_TYPE)) {
ICompletionProposal proposal = new JSF2CompositeComponentProposal(
resource, compPath,
retriveAttrsFromContext(context),(String)context.getAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME));
return new ICompletionProposal[] { proposal };
- } else if (type.equals(IJSF2ValidationComponent.JSF2_URI_TYPE)) {
+ } else if (type.equals(JSF2ValidatorConstants.JSF2_URI_TYPE)) {
String uriPath = (String) context
- .getAttribute(IJSF2ValidationComponent.JSF2_URI_NAME_KEY);
+ .getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY);
ICompletionProposal proposal = new JSF2ResourcesFolderProposal(
- resource,
uriPath,(String)context.getAttribute(IJSF2ValidationComponent.JSF2_URI_NAME_KEY));
+ resource,
uriPath,(String)context.getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY));
return new ICompletionProposal[] { proposal };
}
}
@@ -81,10 +81,10 @@
List<String> attrsList = new ArrayList<String>();
int i = 0;
while (!(context
- .getAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY
+ .getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY
+ String.valueOf(i)) == null)) {
attrsList.add((String) context
- .getAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY
+ .getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY
+ String.valueOf(i)));
i++;
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ResourcesFolderProposal.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ResourcesFolderProposal.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ResourcesFolderProposal.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -20,7 +20,7 @@
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jsf.messages.JSFUIMessages;
import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
-import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -37,7 +37,7 @@
super(marker.getResource());
try {
this.componentPath=(String)
marker.getAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
- this.URL = (String) marker.getAttribute(IJSF2ValidationComponent.JSF2_URI_NAME_KEY);
+ this.URL = (String) marker.getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY);
} catch (CoreException e) {
JSFModelPlugin.getPluginLog().logError(e);
}
@@ -62,7 +62,7 @@
protected void runWithMarker(IMarker marker) throws CoreException {
if (marker != null) {
componentPath = (String) marker
- .getAttribute(IJSF2ValidationComponent.JSF2_URI_NAME_KEY);
+ .getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY);
validateResource = marker.getResource();
}
JSF2ResourceUtil.createResourcesFolderByNameSpace(validateResource
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSF2ValidationComponent.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSF2ValidationComponent.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSF2ValidationComponent.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jsf.web.validation.jsf2.components;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-public interface IJSF2ValidationComponent {
-
- String JSF2_TYPE_KEY = "JSF2_TYPE_KEY"; //$NON-NLS-1$
-
- String JSF2_COMPONENT_NAME_KEY = "AJSF2_COMPONENT_NAME_KEY"; //$NON-NLS-1$
-
- String JSF2_ATTR_NAME_KEY = "ATTR_NAME_KEY"; //$NON-NLS-1$
-
- String JSF2_URI_NAME_KEY = "JSF2_URI_NAME_KEY"; //$NON-NLS-1$
-
- String JSF2_URI_TYPE_KEY = "JSF2_URI_TYPE_KEY"; //$NON-NLS-1$
-
- String JSF2_COMPOSITE_COMPONENT_TYPE = "JSF2_COMPOSITE_COMPONENT_TYPE";
//$NON-NLS-1$
-
- String JSF2_UNFIXABLE_ATTR_TYPE = "JSF2_UNFIXABLE_ATTR_TYPE"; //$NON-NLS-1$
-
- String JSF2_FIXABLE_ATTR_TYPE = "JSF2_FIXABLE_ATTR_TYPE"; //$NON-NLS-1$
-
- String JSF2_URI_TYPE = "JSF2_URI_TYPE"; //$NON-NLS-1$
-
- int getLine();
-
- int getStartOffSet();
-
- int getLength();
-
- String getValidationMessage();
-
- Object[] getMessageParams();
-
- String getType();
-
- String getComponentResourceLocation();
-
- int getSeverity();
-
-}
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSFValidationComponent.java
(from rev 28999,
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSF2ValidationComponent.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSFValidationComponent.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSFValidationComponent.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.web.validation.jsf2.components;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public interface IJSFValidationComponent {
+
+ int getLine();
+
+ int getStartOffSet();
+
+ int getLength();
+
+ String getValidationMessage();
+
+ Object[] getMessageParams();
+
+ String getType();
+
+ String getComponentResourceLocation();
+
+ int getSeverity();
+
+}
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AbstractValidationComponent.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AbstractValidationComponent.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AbstractValidationComponent.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -1,51 +0,0 @@
-package org.jboss.tools.jsf.web.validation.jsf2.components;
-
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class JSF2AbstractValidationComponent implements
- IJSF2ValidationComponent {
-
- private int length;
- private int startOffSet;
- private int line;
- private Object[] messageParams;
-
- public int getLength() {
- return length;
- }
-
- public void setLength(int length) {
- this.length = length;
- }
-
- public int getLine() {
- return line;
- }
-
- public void setLine(int lineNumber) {
- this.line = lineNumber;
- }
-
- public int getStartOffSet() {
- return startOffSet;
- }
-
- public void setStartOffSet(int startOffSet) {
- this.startOffSet = startOffSet;
- }
-
- public Object[] getMessageParams() {
- return messageParams;
- }
-
- public int getSeverity() {
- return IMessage.NORMAL_SEVERITY;
- }
-
- public abstract void createValidationMessage();
-
- public void createMessageParams() {
- this.messageParams = new Object[] { this };
- }
-
-}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AttrTempComponent.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AttrTempComponent.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AttrTempComponent.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -16,6 +16,8 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.JSFAbstractValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -24,10 +26,10 @@
*/
@SuppressWarnings("restriction")
-public class JSF2AttrTempComponent extends JSF2AbstractValidationComponent {
+public class JSF2AttrTempComponent extends JSFAbstractValidationComponent {
private String validationMessage = ""; //$NON-NLS-1$
- private String type = JSF2_UNFIXABLE_ATTR_TYPE;
+ private String type = JSF2ValidatorConstants.JSF2_UNFIXABLE_ATTR_TYPE;
private ElementImpl parentEl;
private IDOMAttr attr;
private String componentResLocation;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2ComponentFactory.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2ComponentFactory.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2ComponentFactory.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -22,6 +22,7 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.jsf.jsf2.model.JSF2ComponentModelManager;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -40,7 +41,7 @@
uncheckedAttrs.add("id"); //$NON-NLS-1$
}
- public static IJSF2ValidationComponent createCompositeTempComponent(
+ public static IJSFValidationComponent createCompositeTempComponent(
IDOMElement element) {
JSF2CompositeTempComponent component = new JSF2CompositeTempComponent(
(ElementImpl) element);
@@ -54,9 +55,9 @@
return component;
}
- public static IJSF2ValidationComponent[] createUnfixableAttrTempComponents(
+ public static IJSFValidationComponent[] createUnfixableAttrTempComponents(
JarEntryFile container, IDOMElement elementWithAttrs) {
- List<IJSF2ValidationComponent> validationComponents = new
ArrayList<IJSF2ValidationComponent>(
+ List<IJSFValidationComponent> validationComponents = new
ArrayList<IJSFValidationComponent>(
0);
IDOMDocument containerDocument = JSF2ComponentModelManager
.getReadableDOMDocument(container);
@@ -72,7 +73,7 @@
JSF2AttrTempComponent component = new JSF2AttrTempComponent(
attr, (ElementImpl) elementWithAttrs);
component
- .setType(IJSF2ValidationComponent.JSF2_UNFIXABLE_ATTR_TYPE);
+ .setType(JSF2ValidatorConstants.JSF2_UNFIXABLE_ATTR_TYPE);
component.setStartOffSet(attr.getStartOffset());
component.setLine(attr.getStructuredDocument().getLineOfOffset(
component.getStartOffSet()) + 1);
@@ -82,12 +83,12 @@
validationComponents.add(component);
}
}
- return validationComponents.toArray(new IJSF2ValidationComponent[0]);
+ return validationComponents.toArray(new IJSFValidationComponent[0]);
}
- public static IJSF2ValidationComponent[] createFixableAttrTempComponents(
+ public static IJSFValidationComponent[] createFixableAttrTempComponents(
IFile compContainerFile, IDOMElement elementWithAttrs) {
- List<IJSF2ValidationComponent> components = new
ArrayList<IJSF2ValidationComponent>(
+ List<IJSFValidationComponent> components = new
ArrayList<IJSFValidationComponent>(
0);
IDOMDocument document = JSF2ComponentModelManager
.getReadableDOMDocument(compContainerFile);
@@ -103,7 +104,7 @@
JSF2AttrTempComponent component = new JSF2AttrTempComponent(
attr, (ElementImpl) elementWithAttrs);
component
- .setType(IJSF2ValidationComponent.JSF2_FIXABLE_ATTR_TYPE);
+ .setType(JSF2ValidatorConstants.JSF2_FIXABLE_ATTR_TYPE);
component.setStartOffSet(attr.getStartOffset());
component.setLine(attr.getStructuredDocument().getLineOfOffset(
component.getStartOffSet()) + 1);
@@ -113,10 +114,10 @@
components.add(component);
}
}
- return components.toArray(new IJSF2ValidationComponent[0]);
+ return components.toArray(new IJSFValidationComponent[0]);
}
- public static IJSF2ValidationComponent createURITempComponent(
+ public static IJSFValidationComponent createURITempComponent(
IDOMAttr attrContainer) {
JSF2URITempComponent component = new JSF2URITempComponent(attrContainer
.getValue());
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2CompositeTempComponent.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2CompositeTempComponent.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2CompositeTempComponent.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -18,6 +18,8 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.JSFAbstractValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
import org.w3c.dom.NamedNodeMap;
/**
@@ -27,7 +29,7 @@
*/
@SuppressWarnings("restriction")
-public class JSF2CompositeTempComponent extends JSF2AbstractValidationComponent {
+public class JSF2CompositeTempComponent extends JSFAbstractValidationComponent {
private String validationMessage = ""; //$NON-NLS-1$
private List<String> attrNames = new ArrayList<String>(0);
@@ -65,7 +67,7 @@
}
public String getType() {
- return JSF2_COMPOSITE_COMPONENT_TYPE;
+ return JSF2ValidatorConstants.JSF2_COMPOSITE_COMPONENT_TYPE;
}
public String getComponentResourceLocation() {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2URITempComponent.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2URITempComponent.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2URITempComponent.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -15,6 +15,8 @@
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.JSFAbstractValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -22,7 +24,7 @@
*
*/
-public class JSF2URITempComponent extends JSF2AbstractValidationComponent {
+public class JSF2URITempComponent extends JSFAbstractValidationComponent {
private String validationMessage = ""; //$NON-NLS-1$
private String URI;
@@ -45,7 +47,7 @@
}
public String getType() {
- return JSF2_URI_TYPE;
+ return JSF2ValidatorConstants.JSF2_URI_TYPE;
}
public String getComponentResourceLocation() {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentRecognizer.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentRecognizer.java 2011-02-07
13:01:01 UTC (rev 29042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentRecognizer.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -18,7 +18,7 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
-import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSFValidationComponent;
import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2ComponentFactory;
/**
@@ -30,34 +30,34 @@
@SuppressWarnings("restriction")
public class JSF2ComponentRecognizer {
- public static IJSF2ValidationComponent[] recognizeCompositeValidationComponents(
+ public static IJSFValidationComponent[] recognizeCompositeValidationComponents(
IFile file, IDOMElement element) {
- List<IJSF2ValidationComponent> validationComponents = new
ArrayList<IJSF2ValidationComponent>(
+ List<IJSFValidationComponent> validationComponents = new
ArrayList<IJSFValidationComponent>(
0);
Object container = JSF2ResourceUtil.findCompositeComponentContainer(
file.getProject(), element);
if (container == null) {
- IJSF2ValidationComponent component = JSF2ComponentFactory
+ IJSFValidationComponent component = JSF2ComponentFactory
.createCompositeTempComponent(element);
validationComponents.add(component);
} else if (container instanceof IFile) {
- IJSF2ValidationComponent[] components = JSF2ComponentFactory
+ IJSFValidationComponent[] components = JSF2ComponentFactory
.createFixableAttrTempComponents((IFile) container, element);
for (int i = 0; i < components.length; i++) {
validationComponents.add(components[i]);
}
} else if (container instanceof JarEntryFile) {
- IJSF2ValidationComponent[] components = JSF2ComponentFactory
+ IJSFValidationComponent[] components = JSF2ComponentFactory
.createUnfixableAttrTempComponents(
(JarEntryFile) container, element);
for (int i = 0; i < components.length; i++) {
validationComponents.add(components[i]);
}
}
- return validationComponents.toArray(new IJSF2ValidationComponent[0]);
+ return validationComponents.toArray(new IJSFValidationComponent[0]);
}
- public static IJSF2ValidationComponent recognizeURIValidationComponent(
+ public static IJSFValidationComponent recognizeURIValidationComponent(
IProject project, IDOMAttr attrContainer) {
if (!JSF2ResourceUtil.isResourcesFolderExists(project, attrContainer
.getValue())) {
Added:
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
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ValidatorConstants.java 2011-02-07
13:04:02 UTC (rev 29043)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.web.validation.jsf2.util;
+
+/**
+ * Class for storing constants
+ *
+ * @author mareshkau
+ *
+ */
+public final class JSF2ValidatorConstants {
+ public static final String JSF2_TYPE_KEY = "JSF2_TYPE_KEY"; //$NON-NLS-1$
+
+ public static final String JSF2_COMPONENT_NAME_KEY =
"AJSF2_COMPONENT_NAME_KEY"; //$NON-NLS-1$
+
+ public static final String JSF2_ATTR_NAME_KEY = "ATTR_NAME_KEY";
//$NON-NLS-1$
+
+ public static final String JSF2_URI_NAME_KEY = "JSF2_URI_NAME_KEY";
//$NON-NLS-1$
+
+ public static final String JSF2_URI_TYPE_KEY = "JSF2_URI_TYPE_KEY";
//$NON-NLS-1$
+
+ public static final String JSF2_COMPOSITE_COMPONENT_TYPE =
"JSF2_COMPOSITE_COMPONENT_TYPE"; //$NON-NLS-1$
+
+ public static final String JSF2_UNFIXABLE_ATTR_TYPE =
"JSF2_UNFIXABLE_ATTR_TYPE"; //$NON-NLS-1$
+
+ 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$
+}