Author: akazakov
Date: 2009-11-27 21:32:29 -0500 (Fri, 27 Nov 2009)
New Revision: 18896
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/KbELReference.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/messagesValidation.jsp
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/Messages.properties
Removed:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/ELReference.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/Var.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IXmlContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/XmlContextImpl.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContext.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/org/domain/SeamWebWarTestProject/entity/TestComponentForVarAttributes.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5089
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -0,0 +1,309 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.common.el.core;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.parser.SyntaxError;
+import org.jboss.tools.common.text.ITextSourceReference;
+import org.jboss.tools.common.util.FileUtil;
+import org.w3c.dom.Element;
+
+/**
+ * Represents a reference to EL in a resource
+ * @author Alexey Kazakov
+ */
+public abstract class ELReference implements ITextSourceReference {
+
+ private IFile resource;
+ private IPath path;
+ private int length;
+ private int startPosition;
+ private ELExpression[] el;
+ private Set<IMarker> markers;
+ private IMarker[] markerArray;
+ private boolean needToInitMarkers = false;
+ private List<SyntaxError> syntaxErrors;
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamTextSourceReference#getLength()
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamTextSourceReference#getStartPosition()
+ */
+ public int getStartPosition() {
+ return startPosition;
+ }
+
+ /**
+ * @param length
+ */
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ /**
+ * @param startPosition
+ */
+ public void setStartPosition(int startPosition) {
+ this.startPosition = startPosition;
+ }
+
+ /**
+ * @return the resource
+ */
+ public IFile getResource() {
+ if(resource==null) {
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ resource = wsRoot.getFile(path);
+ }
+ return resource;
+ }
+
+ /**
+ * @param resource the resource to set
+ */
+ public void setResource(IFile resource) {
+ this.resource = resource;
+ if(resource!=null) {
+ this.path = resource.getFullPath();
+ }
+ }
+
+ /**
+ * @return the path
+ */
+ public IPath getPath() {
+ return path;
+ }
+
+ /**
+ * @param path the path to set
+ */
+ public void setPath(IPath path) {
+ this.path = path;
+ }
+
+ /**
+ * @return the el
+ */
+ public ELExpression[] getEl() {
+ if(el==null) {
+ Set<ELExpression> exps = new HashSet<ELExpression>();
+ String content = null;
+ try {
+ content = FileUtil.readStream(getResource());
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+ String elText = content.substring(startPosition, startPosition + length);
+ int startEl = elText.indexOf("#{"); //$NON-NLS-1$
+ if(startEl>-1) {
+ ELParser parser = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = parser.parse(elText);
+ List<SyntaxError> errors = model.getSyntaxErrors();
+ if(!errors.isEmpty()) {
+ ELCorePlugin.getDefault().logWarning("ELObject hold incorrect information.
Maybe resource " + getResource() + " has been changed.");
+ return null;
+ }
+ List<ELInstance> is = model.getInstances();
+ for (ELInstance i : is) {
+ if(!i.getErrors().isEmpty()) {
+ ELCorePlugin.getDefault().logWarning("ELObject hold incorrect information.
Maybe resource " + getResource() + " has been changed.");
+ continue;
+ }
+ exps.add(i.getExpression());
+ }
+ }
+ el = exps.toArray(new ELExpression[0]);
+ }
+ return el;
+ }
+
+ /**
+ * @param el the el to set
+ */
+ public void setEl(ELExpression[] el) {
+ this.el = el;
+ }
+
+ /**
+ * @param insts
+ */
+ public void setEl(List<ELInstance> insts) {
+ Set<ELExpression> exps = new HashSet<ELExpression>();
+ for (ELInstance el : insts) {
+ exps.add(el.getExpression());
+ }
+ el = exps.toArray(new ELExpression[0]);
+ }
+
+ private IMarker[] EMPTY_MARKER_ARRAY = new IMarker[0];
+
+ private void initMarkers() {
+ if(markers==null) {
+ markers = new HashSet<IMarker>();
+ if(needToInitMarkers) {
+ IFile file = getResource();
+ if(file!=null) {
+ IMarker[] markers = null;
+ try {
+ markers = file.findMarkers(null, true, IResource.DEPTH_INFINITE);
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+ for(int i=0; i<markers.length; i++){
+ String groupName = markers[i].getAttribute("groupName", null);
//$NON-NLS-1$
+ if(groupName!=null && (groupName.equals(getMarkerGroupId()))) {
+ int start = markers[i].getAttribute(IMarker.CHAR_START, -1);
+ int end = markers[i].getAttribute(IMarker.CHAR_END, -1);
+ if(start>=startPosition && end<=startPosition+length) {
+ addMarker(markers[i]);
+ }
+ }
+ }
+ }
+ }
+ needToInitMarkers = false;
+ }
+ }
+
+ /**
+ * @return the syntaxErrors
+ */
+ public List<SyntaxError> getSyntaxErrors() {
+ return syntaxErrors;
+ }
+
+ /**
+ * @param syntaxErrors the syntaxErrors to set
+ */
+ public void setSyntaxErrors(List<SyntaxError> syntaxErrors) {
+ this.syntaxErrors = syntaxErrors;
+ }
+
+ protected abstract String getMarkerGroupId();
+
+ /**
+ * @param needToInitMarkers the needToInitMarkers to set
+ */
+ public synchronized void setNeedToInitMarkers(boolean needToInitMarkers) {
+ this.needToInitMarkers = needToInitMarkers;
+ }
+
+ public synchronized void setMarkers(Set<IMarker> markers) {
+ this.markers = markers;
+ }
+
+ /**
+ * @return the markers
+ */
+ public synchronized IMarker[] getMarkers() {
+ initMarkers();
+ if(markerArray==null) {
+ if(markers.isEmpty()) {
+ markerArray = EMPTY_MARKER_ARRAY;
+ } else {
+ markerArray = markers.toArray(new IMarker[0]);
+ }
+ }
+ return markerArray;
+ }
+
+ /**
+ * @param markers the markers to set
+ */
+ public synchronized void addMarker(IMarker marker) {
+ if(marker==null) {
+ return;
+ }
+ markerArray = null;
+ if(markers==null) {
+ markers = new HashSet<IMarker>();
+ }
+ markers.add(marker);
+ }
+
+ /**
+ * Removes all markers from this EL.
+ */
+ public synchronized void deleteMarkers() {
+ initMarkers();
+ for (IMarker marker : markers) {
+ try {
+ marker.delete();
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+ }
+ markers.clear();
+ markerArray = null;
+ }
+
+ /**
+ * Store this EL into XML element.
+ * @param element
+ */
+ public synchronized void store(Element element) {
+ element.setAttribute("path", path.toString()); //$NON-NLS-1$
+ element.setAttribute("offset", "" + startPosition); //$NON-NLS-1$
//$NON-NLS-2$
+ element.setAttribute("length", "" + length); //$NON-NLS-1$
//$NON-NLS-2$
+ }
+
+ /**
+ * Load this EL from XML element.
+ * @param element
+ */
+ public synchronized void load(Element element) {
+ path = new Path(element.getAttribute("path")); //$NON-NLS-1$
+ startPosition = new Integer(element.getAttribute("offset")); //$NON-NLS-1$
+ length = new Integer(element.getAttribute("length")); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj) {
+ return true;
+ }
+ ELReference el = (ELReference)obj;
+ return this.path.equals(el.path) && this.startPosition == el.startPosition;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return path.hashCode() + startPosition;
+ }
+}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -447,7 +447,7 @@
context.setVars(vars);
- ELResolution resolution = resolver.resolve(context, operand);
+ ELResolution resolution = resolver.resolve(context, operand, offset);
List<ELSegment> segments = resolution.findSegmentsByJavaElement(javaElement);
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -13,6 +13,7 @@
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.jboss.tools.common.el.core.ELReference;
/**
* @author Alexey Kazakov
@@ -26,12 +27,21 @@
IFile getResource();
/**
- * Returns "var" attributes
+ * Returns "var" attributes which are available in particular offset or the
all "var"s if offset == -1
+ *
+ * @param offset
* @return
*/
- Var[] getVars();
+ Var[] getVars(int offset);
/**
+ * Returns all EL references of the file of this context.
+ *
+ * @return
+ */
+ ELReference[] getELReferences();
+
+ /**
* Returns EL Resolvers which are declared for this resource
* @return
*/
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -11,11 +11,10 @@
package org.jboss.tools.common.el.core.resolver;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.eclipse.jface.text.Region;
+import org.jboss.tools.common.el.core.ELReference;
/**
* EL context
@@ -23,8 +22,9 @@
*/
public class ELContextImpl extends SimpleELContext {
- protected Map<Region, List<Var>> vars = new HashMap<Region,
List<Var>>();
protected List<Var> allVars = new ArrayList<Var>();
+ protected ELReference[] elReferences;
+ protected List<ELReference> elReferenceSet;
/*
* (non-Javadoc)
@@ -40,10 +40,63 @@
* @param vars
*/
public void addVar(Region region, Var var) {
- if (this.vars.get(region) == null) {
- this.vars.put(region, new ArrayList<Var>());
- }
- this.vars.get(region).add(var);
+ var.setRegion(region);
allVars.add(var);
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELContext#getVars(int)
+ */
+ public Var[] getVars(int offset) {
+ if(offset<0) {
+ return getVars();
+ }
+ List<Var> result = new ArrayList<Var>();
+ for (Var var : allVars) {
+ Region region = var.getRegion();
+ if(offset>=region.getOffset() && offset<=region.getOffset() +
region.getLength()) {
+ result.add(var);
+ }
+ }
+ return result.toArray(new Var[result.size()]);
+ }
+
+ /**
+ * @return the allVars
+ */
+ public List<Var> getAllVars() {
+ return allVars;
+ }
+
+ /**
+ * @param allVars the allVars to set
+ */
+ public void setAllVars(List<Var> allVars) {
+ this.allVars = allVars;
+ }
+
+ private static final ELReference[] EMPTY_ARRAY = new ELReference[0];
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.IXmlContext#getELReferences()
+ */
+ public ELReference[] getELReferences() {
+ if(elReferences==null) {
+ if(elReferenceSet==null || elReferenceSet.isEmpty()) {
+ return EMPTY_ARRAY;
+ }
+ elReferences = elReferenceSet.toArray(new ELReference[0]);
+ }
+ return elReferences;
+ }
+
+ public void addELReference(ELReference reference) {
+ if(elReferenceSet==null) {
+ elReferenceSet = new ArrayList<ELReference>();
+ }
+ elReferenceSet.add(reference);
+ elReferences = null;
+ }
}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolver.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -27,7 +27,7 @@
* @param el
* @return proposal list
*/
- List<TextProposal> getProposals(ELContext context, String el);
+ List<TextProposal> getProposals(ELContext context, String el, int offset);
/**
* Resolves EL operand.
@@ -35,7 +35,7 @@
* @param operand
* @return
*/
- ELResolution resolve(ELContext context, ELExpression operand);
+ ELResolution resolve(ELContext context, ELExpression operand, int offset);
/**
* @return EL parser factory
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -14,6 +14,7 @@
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.jboss.tools.common.el.core.ELReference;
/**
* @author Alexey Kazakov
@@ -70,4 +71,13 @@
public void addVar(Var var) {
vars.add(var);
}
-}
+
+ public ELReference[] getELReferences() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Var[] getVars(int offset) {
+ return getVars();
+ }
+}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/Var.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/Var.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/Var.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -12,6 +12,7 @@
import java.util.List;
+import org.eclipse.jface.text.Region;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInstance;
import org.jboss.tools.common.el.core.model.ELModel;
@@ -31,6 +32,7 @@
int declOffset;
int declLength;
ELParserFactory factory;
+ Region region;
/**
* Constructor
@@ -144,4 +146,18 @@
}
return false;
}
+
+ /**
+ * @return the region
+ */
+ public Region getRegion() {
+ return region;
+ }
+
+ /**
+ * @param region the region to set
+ */
+ public void setRegion(Region region) {
+ this.region = region;
+ }
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -69,7 +69,7 @@
* (non-Javadoc)
* @see
org.jboss.tools.common.el.core.resolver.ELResolver2#getProposals(org.jboss.tools.common.el.core.resolver.ELContext,
java.lang.String)
*/
- public List<TextProposal> getProposals(ELContext context, String el) {
+ public List<TextProposal> getProposals(ELContext context, String el, int offset)
{
return getCompletions(el, false, 0, context);
}
@@ -98,7 +98,7 @@
* (non-Javadoc)
* @see
org.jboss.tools.common.el.core.resolver.ELResolver2#resolve(org.jboss.tools.common.el.core.resolver.ELContext,
org.jboss.tools.common.el.core.model.ELExpression)
*/
- public ELResolution resolve(ELContext context, ELExpression operand) {
+ public ELResolution resolve(ELContext context, ELExpression operand, int offset) {
ELResolutionImpl resolution = resolveELOperand(operand, context, true);
resolution.setContext(context);
return resolution;
@@ -176,6 +176,12 @@
if (resolvedVars != null && !resolvedVars.isEmpty()) {
resolvedVariables = resolvedVars;
resolution.setLastResolvedToken(left);
+
+ ELSegmentImpl segment = new ELSegmentImpl();
+ segment.setToken(left.getFirstToken());
+ segment.setResolved(true);
+ resolution.addSegment(segment);
+
break;
}
left = (ELInvocationExpression)left.getLeft();
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -10,10 +10,10 @@
******************************************************************************/
package org.jboss.tools.jsf.web.validation;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
@@ -31,6 +31,7 @@
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
@@ -39,18 +40,9 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInstance;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
@@ -62,11 +54,11 @@
import org.jboss.tools.common.el.core.parser.LexicalToken;
import org.jboss.tools.common.el.core.parser.SyntaxError;
import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.common.el.core.resolver.ELResolution;
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
import org.jboss.tools.common.el.core.resolver.ELSegment;
-import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
import org.jboss.tools.common.el.core.resolver.IVariable;
import org.jboss.tools.common.el.core.resolver.JavaMemberELSegmentImpl;
import org.jboss.tools.common.el.core.resolver.SimpleELContext;
@@ -78,18 +70,18 @@
import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
import org.jboss.tools.jsf.project.JSFNature;
import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.IXmlContext;
import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.el.KbELReference;
import org.jboss.tools.jst.web.kb.internal.KbProject;
import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
import org.jboss.tools.jst.web.kb.internal.validation.ValidatingProjectSet;
import org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager;
import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
-import org.jboss.tools.jst.web.kb.validation.ELReference;
import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
import org.jboss.tools.jst.web.kb.validation.IValidationContext;
import org.jboss.tools.jst.web.kb.validation.IValidator;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* EL Validator
@@ -107,6 +99,7 @@
private IResource[] currentSources;
private IContainer webRootFolder;
private boolean revalidateUnresolvedELs = false;
+ private boolean validateVars = true;
public ELValidator() {
}
@@ -124,6 +117,7 @@
super.init(project, validationHelper, manager, reporter);
resolvers = ELResolverFactoryManager.getInstance().getResolvers(project);
mainFactory = ELParserUtil.getDefaultFactory();
+ validateVars =
JSFSeverityPreferences.ENABLE.equals(JSFSeverityPreferences.getInstance().getProjectPreference(rootProject,
JSFSeverityPreferences.CHECK_VARS));
}
/*
@@ -313,70 +307,25 @@
}
private void validateDom(IFile file, String content) {
- varListForCurentValidatedNode.clear();
- IModelManager manager = StructuredModelManager.getModelManager();
- if(manager == null) {
- // this can happen if plugin org.eclipse.wst.sse.core
- // is stopping or uninstalled, that is Eclipse is shutting down.
- // there is no need to report it, just stop validation.
+ ELContext context = PageContextFactory.createPageContext(file);
+ if(context==null) {
return;
}
- IStructuredModel model = null;
- try {
- model = manager.getModelForRead(file);
- if (model instanceof IDOMModel) {
- IDOMModel domModel = (IDOMModel) model;
- IDOMDocument document = domModel.getDocument();
- validateChildNodes(file, document);
- }
- } catch (CoreException e) {
- JSFModelPlugin.getDefault().logError(JSFValidationMessages.EL_VALIDATOR_ERROR_VALIDATING,
e);
- } catch (IOException e) {
-
JSFModelPlugin.getDefault().logError(JSFValidationMessages.EL_VALIDATOR_ERROR_VALIDATING,
e);
- } finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- return;
- }
-
- private void validateChildNodes(IFile file, Node parent) {
- String preferenceValue =
JSFSeverityPreferences.getInstance().getProjectPreference(rootProject,
JSFSeverityPreferences.CHECK_VARS);
- NodeList children = parent.getChildNodes();
- for(int i=0; i<children.getLength() && !reporter.isCancelled(); i++) {
- Node curentValidatedNode = children.item(i);
- Var var = null;
- if(Node.ELEMENT_NODE == curentValidatedNode.getNodeType()) {
- if (JSFSeverityPreferences.ENABLE.equals(preferenceValue)) {
- var = ElVarSearcher.findVar(curentValidatedNode, mainFactory);
+ if(context instanceof IXmlContext) {
+ IXmlContext xmlContext = (IXmlContext)context;
+ ELReference[] references = xmlContext.getELReferences();
+ for (int i = 0; i < references.length; i++) {
+ if(!references[i].getSyntaxErrors().isEmpty()) {
+ for (SyntaxError error: references[i].getSyntaxErrors()) {
+ IMarker marker = addError(JSFValidationMessages.EL_SYNTAX_ERROR,
JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()},
1, references[i].getStartPosition() + error.getPosition(), file);
+ references[i].addMarker(marker);
+ }
}
- if(var!=null) {
- varListForCurentValidatedNode.add(var);
- }
- validateNodeContent(file,
((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(),
DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE);
- } else if(Node.TEXT_NODE == curentValidatedNode.getNodeType()) {
- validateNodeContent(file,
((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(),
DOMRegionContext.XML_CONTENT);
- }
- validateChildNodes(file, curentValidatedNode);
- if(var!=null) {
- varListForCurentValidatedNode.remove(var);
- }
- }
- }
- private void validateNodeContent(IFile file, IStructuredDocumentRegion node, String
regionType) {
- ITextRegionList regions = node.getRegions();
- for(int i=0; i<regions.size(); i++) {
- ITextRegion region = regions.get(i);
- if(region.getType() == regionType) {
- String text = node.getFullText(region);
- if(text.indexOf("{")>-1) { //$NON-NLS-1$
- int offset = node.getStartOffset() + region.getStart();
- validateString(file, text, offset);
- }
+ validateEL(references[i]);
}
}
+ return;
}
/**
@@ -393,7 +342,7 @@
ELModel model = parser.parse(string);
List<ELInstance> is = model.getInstances();
- ELReference elReference = new ELReference();
+ ELReference elReference = new KbELReference();
elReference.setResource(file);
elReference.setEl(is);
elReference.setLength(string.length());
@@ -430,7 +379,7 @@
private void validateElOperand(ELReference elReference, ELInvocationExpression
operandToken) {
IFile file = elReference.getResource();
- int documnetOffset = elReference.getStartPosition();
+ int documnetOffset = elReference.getStartPosition();
String operand = operandToken.getText();
if(operand.trim().length()==0) {
return;
@@ -441,13 +390,24 @@
boolean unresolvedTokenIsVariable = false;
if (!operand.endsWith(".")) { //$NON-NLS-1$
ELResolution resolution = null;
- ELContext context = new SimpleELContext();
- context.setVars(varListForCurentValidatedNode);
- context.setElResolvers(resolvers);
- context.setResource(file);
+ ELContext context = PageContextFactory.createPageContext(file);
+ if(context==null) {
+ context = new SimpleELContext();
+ context.setResource(file);
+ context.setElResolvers(resolvers);
+ }
int maxNumberOfResolvedSegments = -1;
+ List<Var> vars = null;
+ Map<Region, List<Var>> varMap = null;
+ ELContextImpl c = null;
+ if(!validateVars && context instanceof ELContextImpl) {
+ c = (ELContextImpl)context;
+ vars = c.getAllVars();
+ c.setAllVars(new ArrayList<Var>());
+ }
+
for (int i = 0; i < resolvers.length; i++) {
- ELResolution elResolution = resolvers[i].resolve(context, operandToken);
+ ELResolution elResolution = resolvers[i].resolve(context, operandToken,
documnetOffset);
if(elResolution.isResolved()) {
resolution = elResolution;
break;
@@ -459,6 +419,10 @@
}
}
+ if(c!=null) {
+ c.setAllVars(vars);
+ }
+
if(!resolution.isResolved()) {
Set<String> names = findVariableNames(operandToken);
for (String name : names) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -206,11 +206,11 @@
return ELParserUtil.getJbossFactory();
}
- public List<TextProposal> getProposals(ELContext context, String el) {
+ public List<TextProposal> getProposals(ELContext context, String el, int offset)
{
return Collections.emptyList();
}
- public ELResolution resolve(ELContext context, ELExpression operand) {
+ public ELResolution resolve(ELContext context, ELExpression operand, int offset) {
return new ELResolutionImpl(operand);
}
};
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IXmlContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IXmlContext.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IXmlContext.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -7,25 +7,33 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jst.web.kb;
+import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.Var;
/**
*
* @author Victor Rubezhny
- *
+ *
*/
public interface IXmlContext extends ELContext {
/**
* Returns "var" attributes which are available in particular offset.
+ *
* @param offset
* @return
*/
Var[] getVars(int offset);
-}
+ /**
+ * Returns all EL references of the file of this context.
+ *
+ * @return
+ */
+ ELReference[] getELReferences();
+}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -35,7 +35,6 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
@@ -57,20 +56,28 @@
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.el.core.GlobalELReferenceList;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.parser.ELParser;
import org.jboss.tools.common.el.core.parser.ELParserUtil;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
-import org.jboss.tools.common.el.core.resolver.SimpleELContext;
import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.common.resref.core.ResourceReference;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.jst.web.kb.el.KbELReference;
import org.jboss.tools.jst.web.kb.include.IncludeContextBuilder;
import org.jboss.tools.jst.web.kb.internal.FaceletPageContextImpl;
import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
@@ -305,16 +312,12 @@
private ELContext createPageContextInstance(String contentType) {
String contextType = IncludeContextBuilder.getContextType(contentType);
- if (XML_PAGE_CONTEXT_TYPE.equals(contextType)) {
- return new XmlContextImpl();
- } else if (JSP_PAGE_CONTEXT_TYPE.equals(contextType)) {
+ if (JSP_PAGE_CONTEXT_TYPE.equals(contextType)) {
return new JspContextImpl();
} else if (FACELETS_PAGE_CONTEXT_TYPE.equals(contextType)) {
return new FaceletPageContextImpl();
- } else {
- WebKbPlugin.getDefault().logError(Messages.format(KbMessages.ILLEGAL_CONTENTTYPE,
contentType));
}
- return new SimpleELContext();
+ return new XmlContextImpl();
}
/**
@@ -356,15 +359,19 @@
}
private void fillContextForNode(IDOMNode node, ELContext context, List<String>
parents) {
- if (context instanceof JspContextImpl && !(node instanceof IDOMElement)) {
+ if (!(context instanceof FaceletPageContextImpl) && !(node instanceof
IDOMElement)) {
// There is no any useful info for JSP in text nodes
return;
}
- if (context instanceof XmlContextImpl && node instanceof IDOMElement) {
- fillXMLNamespacesForNode((IDOMElement)node, (XmlContextImpl)context);
+ if (context instanceof XmlContextImpl) {
+ XmlContextImpl xmlContext = (XmlContextImpl)context;
+ fillElReferencesForNode(node, xmlContext);
+ if (node instanceof IDOMElement) {
+ fillXMLNamespacesForNode((IDOMElement)node, xmlContext);
+ }
}
-
+
if ((context instanceof JspContextImpl ||
context instanceof FaceletPageContextImpl) &&
node instanceof IDOMElement) {
@@ -374,14 +381,14 @@
if (context instanceof FaceletPageContextImpl) {
// Insert here the initialization code for FaceletPage context elements which may
exist in Text nodes
}
-
+
if (context instanceof JspContextImpl && node instanceof IDOMElement) {
fillResourceBundlesForNode((IDOMElement)node, (JspContextImpl)context);
}
// There could be some context type to be initialized somehow that is different from
JSP or FaceletPage context
// Insert its on-node initialization code here
-
+
// The only Elements may have include/CSS Stylesheet links and other additional info
if (context instanceof IPageContext && node instanceof IDOMElement) {
fillAdditionalInfoForNode((IDOMElement)node, (IPageContext)context, parents);
@@ -403,7 +410,41 @@
}
}
-
+ private void fillElReferencesForNode(IDOMNode node, XmlContextImpl context) {
+ if(Node.ELEMENT_NODE == node.getNodeType() || Node.TEXT_NODE == node.getNodeType()) {
+ IStructuredDocumentRegion regionNode = node.getFirstStructuredDocumentRegion();
+ ITextRegionList regions = regionNode.getRegions();
+ for(int i=0; i<regions.size(); i++) {
+ ITextRegion region = regions.get(i);
+ if(region.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE || region.getType()
== DOMRegionContext.XML_CONTENT) {
+ String text = regionNode.getFullText(region);
+ if(text.indexOf("{")>-1) { //$NON-NLS-1$
+ int offset = regionNode.getStartOffset() + region.getStart();
+ int startEl = text.indexOf("#{"); //$NON-NLS-1$
+ if(startEl==-1) {
+ startEl = text.indexOf("${"); //$NON-NLS-1$
+ }
+ if(startEl>-1) {
+ ELParser parser = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = parser.parse(text);
+ List<ELInstance> is = model.getInstances();
+
+ ELReference elReference = new KbELReference();
+ elReference.setResource(context.getResource());
+ elReference.setEl(is);
+ elReference.setLength(text.length());
+ elReference.setStartPosition(offset);
+
+ elReference.setSyntaxErrors(model.getSyntaxErrors());
+
+ context.addELReference(elReference);
+ }
+ }
+ }
+ }
+ }
+ }
+
private void fillAdditionalInfoForNode(IDOMElement node, IPageContext context,
List<String> parents) {
String prefix = node.getPrefix() == null ? "" : node.getPrefix();
//$NON-NLS-1$
String tagName = node.getLocalName();
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -102,7 +102,7 @@
String elString = value;
ELResolver[] resolvers = context.getElResolvers();
for (int i = 0; resolvers != null && i < resolvers.length; i++) {
- proposals.addAll(resolvers[i].getProposals(context, elString));
+ proposals.addAll(resolvers[i].getProposals(context, elString, query.getOffset()));
}
}
return proposals.toArray(new TextProposal[proposals.size()]);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -67,11 +67,11 @@
* (non-Javadoc)
* @see
org.jboss.tools.common.el.core.resolver.ELResolver2#getProposals(org.jboss.tools.common.el.core.resolver.ELContext,
java.lang.String)
*/
- public List<TextProposal> getProposals(ELContext context, String el) {
+ public List<TextProposal> getProposals(ELContext context, String el, int offset)
{
List<TextProposal> completions = new ArrayList<TextProposal>();
List<Var> vars = new ArrayList<Var>();
- Var[] array = context.getVars();
+ Var[] array = context.getVars(offset);
for (int i = 0; i < array.length; i++) {
vars.add(array[i]);
}
@@ -93,9 +93,9 @@
* (non-Javadoc)
* @see
org.jboss.tools.common.el.core.resolver.ELResolver#resolve(org.jboss.tools.common.el.core.resolver.ELContext,
org.jboss.tools.common.el.core.model.ELExpression)
*/
- public ELResolution resolve(ELContext context, ELExpression operand) {
+ public ELResolution resolve(ELContext context, ELExpression operand, int offset) {
List<Var> vars = new ArrayList<Var>();
- Var[] array = context.getVars();
+ Var[] array = context.getVars(offset);
for (int i = 0; i < array.length; i++) {
vars.add(array[i]);
}
@@ -119,9 +119,9 @@
* @param returnEqualedVariablesOnly
* @return
*/
- public ELResolution resolveELOperand(ELExpression operand, ELContext context, boolean
returnEqualedVariablesOnly) {
+ public ELResolution resolveELOperand(ELExpression operand, ELContext context, boolean
returnEqualedVariablesOnly, int offset) {
List<Var> vars = new ArrayList<Var>();
- Var[] array = context.getVars();
+ Var[] array = context.getVars(offset);
for (int i = 0; i < array.length; i++) {
vars.add(array[i]);
}
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/KbELReference.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/KbELReference.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/KbELReference.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jst.web.kb.el;
+
+import org.jboss.tools.common.el.core.ELReference;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class KbELReference extends ELReference {
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.ELReference#getMarkerGroupId()
+ */
+ @Override
+ protected String getMarkerGroupId() {
+ return IValidator.MARKED_RESOURCE_MESSAGE_GROUP;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/KbELReference.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -59,36 +59,7 @@
return superNameSpaces;
}
-
@Override
- public Var[] getVars() {
- Var[] thisVars = super.getVars();
-
- List<Var> includedVars = new ArrayList<Var>();
- List<ELContext> includedContexts = getIncludedContexts();
- if (includedContexts != null) {
- for (ELContext includedContext : includedContexts) {
- Var[] vars = includedContext.getVars();
- if (vars != null) {
- for (Var b : vars) {
- includedVars.add(b);
- }
- }
- }
- }
-
- Var[] result = new Var[thisVars == null ? 0 : thisVars.length + includedVars.size()];
- if (thisVars != null && thisVars.length > 0) {
- System.arraycopy(thisVars, 0, result, 0, thisVars.length);
- }
- if (!includedVars.isEmpty()) {
- System.arraycopy(includedVars.toArray(new ITagLibrary[includedVars.size()]), 0,
- result, thisVars == null ? 0 : thisVars.length, includedVars.size());
- }
- return result;
- }
-
- @Override
public Var[] getVars(int offset) {
Var[] thisVars = super.getVars(offset);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/XmlContextImpl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/XmlContextImpl.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/XmlContextImpl.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -10,13 +10,11 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.DocumentProviderRegistry;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
-import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.jst.web.kb.IXmlContext;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
@@ -24,7 +22,7 @@
public class XmlContextImpl extends ELContextImpl implements IXmlContext {
protected IDocument document;
private FileEditorInput editorInput;
-
+
// Fix for JBIDE-5097: It must be a map of <IRegion to Map of <NS-Prefix to
NS>>
protected Map<IRegion, Map<String, INameSpace>> nameSpaces = new
HashMap<IRegion, Map<String, INameSpace>>();
@@ -54,21 +52,6 @@
return document;
}
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.IXmlContext#getVars(int)
- */
- public Var[] getVars(int offset) {
- List<Var> result = new ArrayList<Var>();
- for (Region region : vars.keySet()) {
- if(offset>=region.getOffset() && offset<=region.getOffset() +
region.getLength()) {
- result.addAll(vars.get(region));
- }
- }
- return result.toArray(new Var[result.size()]);
- }
-
-
/*
* TODO: the visibility must differ between 'include'-like and
'template'-like inclusion
*
@@ -163,4 +146,4 @@
IDocumentProvider provider=
DocumentProviderRegistry.getDefault().getDocumentProvider(input);
provider.disconnect(input);
}
-}
+}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -17,8 +17,9 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.xml.XMLUtilities;
-import org.jboss.tools.jst.web.kb.validation.ELReference;
+import org.jboss.tools.jst.web.kb.el.KbELReference;
import org.w3c.dom.Element;
/**
@@ -182,7 +183,7 @@
if(name == null || name.trim().length() == 0) {
continue;
}
- ELReference el = new ELReference();
+ ELReference el = new KbELReference();
el.load(linkedEls[i]);
el.setNeedToInitMarkers(true);
addLinkedEl(name, el);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -18,8 +18,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.xml.XMLUtilities;
-import org.jboss.tools.jst.web.kb.validation.ELReference;
import org.jboss.tools.jst.web.kb.validation.IValidationContext;
import org.jboss.tools.jst.web.kb.validation.IValidator;
import org.w3c.dom.Element;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -26,8 +26,8 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
-import org.jboss.tools.jst.web.kb.validation.ELReference;
import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
import org.jboss.tools.jst.web.kb.validation.IValidationContext;
import org.jboss.tools.jst.web.kb.validation.IValidator;
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/ELReference.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/ELReference.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/ELReference.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.jst.web.kb.validation;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.jboss.tools.common.el.core.model.ELExpression;
-import org.jboss.tools.common.el.core.model.ELInstance;
-import org.jboss.tools.common.el.core.model.ELModel;
-import org.jboss.tools.common.el.core.parser.ELParser;
-import org.jboss.tools.common.el.core.parser.ELParserUtil;
-import org.jboss.tools.common.el.core.parser.SyntaxError;
-import org.jboss.tools.common.text.ITextSourceReference;
-import org.jboss.tools.common.util.FileUtil;
-import org.jboss.tools.jst.web.kb.WebKbPlugin;
-import org.w3c.dom.Element;
-
-/**
- * Represents a reference to EL in a resource
- * @author Alexey Kazakov
- */
-public class ELReference implements ITextSourceReference {
-
- private IFile resource;
- private IPath path;
- private int length;
- private int startPosition;
- private ELExpression[] el;
- private Set<IMarker> markers;
- private IMarker[] markerArray;
- private boolean needToInitMarkers = false;
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.core.ISeamTextSourceReference#getLength()
- */
- public int getLength() {
- return length;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.core.ISeamTextSourceReference#getStartPosition()
- */
- public int getStartPosition() {
- return startPosition;
- }
-
- /**
- * @param length
- */
- public void setLength(int length) {
- this.length = length;
- }
-
- /**
- * @param startPosition
- */
- public void setStartPosition(int startPosition) {
- this.startPosition = startPosition;
- }
-
- /**
- * @return the resource
- */
- public IFile getResource() {
- if(resource==null) {
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
- resource = wsRoot.getFile(path);
- }
- return resource;
- }
-
- /**
- * @param resource the resource to set
- */
- public void setResource(IFile resource) {
- this.resource = resource;
- if(resource!=null) {
- this.path = resource.getFullPath();
- }
- }
-
- /**
- * @return the path
- */
- public IPath getPath() {
- return path;
- }
-
- /**
- * @param path the path to set
- */
- public void setPath(IPath path) {
- this.path = path;
- }
-
- /**
- * @return the el
- */
- public ELExpression[] getEl() {
- if(el==null) {
- Set<ELExpression> exps = new HashSet<ELExpression>();
- String content = null;
- try {
- content = FileUtil.readStream(getResource());
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
- String elText = content.substring(startPosition, startPosition + length);
- int startEl = elText.indexOf("#{"); //$NON-NLS-1$
- if(startEl>-1) {
- ELParser parser = ELParserUtil.getJbossFactory().createParser();
- ELModel model = parser.parse(elText);
- List<SyntaxError> errors = model.getSyntaxErrors();
- if(!errors.isEmpty()) {
- WebKbPlugin.getDefault().logWarning("ELObject hold incorrect information. Maybe
resource " + getResource() + " has been changed.");
- return null;
- }
- List<ELInstance> is = model.getInstances();
- for (ELInstance i : is) {
- if(!i.getErrors().isEmpty()) {
- WebKbPlugin.getDefault().logWarning("ELObject hold incorrect information.
Maybe resource " + getResource() + " has been changed.");
- continue;
- }
- exps.add(i.getExpression());
- }
- }
- el = exps.toArray(new ELExpression[0]);
- }
- return el;
- }
-
- /**
- * @param el the el to set
- */
- public void setEl(ELExpression[] el) {
- this.el = el;
- }
-
- /**
- * @param insts
- */
- public void setEl(List<ELInstance> insts) {
- Set<ELExpression> exps = new HashSet<ELExpression>();
- for (ELInstance el : insts) {
- exps.add(el.getExpression());
- }
- el = exps.toArray(new ELExpression[0]);
- }
-
- private IMarker[] EMPTY_MARKER_ARRAY = new IMarker[0];
-
- private void initMarkers() {
- if(markers==null) {
- markers = new HashSet<IMarker>();
- if(needToInitMarkers) {
- IFile file = getResource();
- if(file!=null) {
- IMarker[] markers = null;
- try {
- markers = file.findMarkers(null, true, IResource.DEPTH_INFINITE);
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
- for(int i=0; i<markers.length; i++){
- String groupName = markers[i].getAttribute("groupName", null);
//$NON-NLS-1$
- if(groupName!=null &&
(groupName.equals(groupName.equals(IValidator.MARKED_RESOURCE_MESSAGE_GROUP)))) {
- int start = markers[i].getAttribute(IMarker.CHAR_START, -1);
- int end = markers[i].getAttribute(IMarker.CHAR_END, -1);
- if(start>=startPosition && end<=startPosition+length) {
- addMarker(markers[i]);
- }
- }
- }
- }
- }
- needToInitMarkers = false;
- }
- }
-
- /**
- * @param needToInitMarkers the needToInitMarkers to set
- */
- public synchronized void setNeedToInitMarkers(boolean needToInitMarkers) {
- this.needToInitMarkers = needToInitMarkers;
- }
-
- public synchronized void setMarkers(Set<IMarker> markers) {
- this.markers = markers;
- }
-
- /**
- * @return the markers
- */
- public synchronized IMarker[] getMarkers() {
- initMarkers();
- if(markerArray==null) {
- if(markers.isEmpty()) {
- markerArray = EMPTY_MARKER_ARRAY;
- } else {
- markerArray = markers.toArray(new IMarker[0]);
- }
- }
- return markerArray;
- }
-
- /**
- * @param markers the markers to set
- */
- public synchronized void addMarker(IMarker marker) {
- if(marker==null) {
- return;
- }
- markerArray = null;
- if(markers==null) {
- markers = new HashSet<IMarker>();
- }
- markers.add(marker);
- }
-
- /**
- * Removes all markers from this EL.
- */
- public synchronized void deleteMarkers() {
- initMarkers();
- for (IMarker marker : markers) {
- try {
- marker.delete();
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
- }
- markers.clear();
- markerArray = null;
- }
-
- /**
- * Store this EL into XML element.
- * @param element
- */
- public synchronized void store(Element element) {
- element.setAttribute("path", path.toString()); //$NON-NLS-1$
- element.setAttribute("offset", "" + startPosition); //$NON-NLS-1$
//$NON-NLS-2$
- element.setAttribute("length", "" + length); //$NON-NLS-1$
//$NON-NLS-2$
- }
-
- /**
- * Load this EL from XML element.
- * @param element
- */
- public synchronized void load(Element element) {
- path = new Path(element.getAttribute("path")); //$NON-NLS-1$
- startPosition = new Integer(element.getAttribute("offset")); //$NON-NLS-1$
- length = new Integer(element.getAttribute("length")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if(this == obj) {
- return true;
- }
- ELReference el = (ELReference)obj;
- return this.path.equals(el.path) && this.startPosition == el.startPosition;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return path.hashCode() + startPosition;
- }
-}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContext.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContext.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -16,6 +16,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.common.el.core.ELReference;
import org.w3c.dom.Element;
/**
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamPromptingProvider.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -59,7 +59,7 @@
} else if(MEMBERS.equals(id)) {
SimpleELContext context = new SimpleELContext();
context.setResource(f);
- List<TextProposal> proposals = engine.getProposals(context, prefix);
+ List<TextProposal> proposals = engine.getProposals(context, prefix, -1);
List<String> suggestions = new ArrayList<String>();
if(proposals != null) for (TextProposal proposal: proposals) {
suggestions.add(proposal.getReplacementString());
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -138,7 +138,7 @@
context.setVars(vars);
- ELResolution resolution = resolver.resolve(context, operand);
+ ELResolution resolution = resolver.resolve(context, operand, offset);
List<ELSegment> segments = resolution.findSegmentsByVariable(seamComponent);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -440,7 +440,7 @@
SimpleELContext elContext = new SimpleELContext();
elContext.setResource(file);
elContext.setVars(vars);
- List<TextProposal> suggestions = fEngine.getProposals(elContext, prefix);
+ List<TextProposal> suggestions = fEngine.getProposals(elContext, prefix,
offset);
List<TextProposal> uniqueSuggestions = fEngine.makeKbUnique(suggestions);
List<ICompletionProposal> result= new ArrayList<ICompletionProposal>();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -112,7 +112,7 @@
List<TextProposal> suggestions = null;
SimpleELContext context = new SimpleELContext();
context.setResource(file);
- suggestions = engine.getProposals(context, prefix);
+ suggestions = engine.getProposals(context, prefix, -1);
if(suggestions == null) {
return EMPTY;
}
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/messagesValidation.jsp
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/messagesValidation.jsp
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/messagesValidation.jsp 2009-11-28
02:32:29 UTC (rev 18896)
@@ -0,0 +1,6 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+
+<f:loadBundle var="Message" basename="Messages"/>
+
+<h:outputText value="#{Message.header}"/>
\ No newline at end of file
Property changes on:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/messagesValidation.jsp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/Messages.properties
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/Messages.properties
(rev 0)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/Messages.properties 2009-11-28
02:32:29 UTC (rev 18896)
@@ -0,0 +1,3 @@
+header=Hello Demo Application
+prompt_message=Name:
+hello_message=Hello
\ No newline at end of file
Property changes on:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/Messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/org/domain/SeamWebWarTestProject/entity/TestComponentForVarAttributes.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/org/domain/SeamWebWarTestProject/entity/TestComponentForVarAttributes.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/src/action/org/domain/SeamWebWarTestProject/entity/TestComponentForVarAttributes.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -4,6 +4,7 @@
import java.util.Map;
import java.util.Set;
+import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.datamodel.DataModel;
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2009-11-27
21:34:25 UTC (rev 18895)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2009-11-28
02:32:29 UTC (rev 18896)
@@ -184,9 +184,16 @@
assertEquals("Problem marker was found in varAttributes.xhtml file. Validator did
not recognize 'var' attribute.", 0, number);
}
+ public void testMessageBundles() throws CoreException {
+ // Test for
https://jira.jboss.org/jira/browse/JBIDE-5089
+ IFile file = project.getFile("WebContent/messagesValidation.jsp");
+ int number = getMarkersNumber(file);
+ assertEquals("Problem marker was found in messagesValidation.jsp file. Validator
did not recognize a message bundle.", 0, number);
+ }
+
public void testJiraJbide1696() throws CoreException {
//getSeamProject(project);
-
+
// Test for
http://jira.jboss.com/jira/browse/JBIDE-1696
IFile subclassComponentFile =
project.getFile("src/action/org/domain/SeamWebWarTestProject/session/SubclassTestComponent.java");
assertMarkerIsCreated(subclassComponentFile, MARKER_TYPE, "Stateful component
\"testComponentJBIDE1696\" must have a method marked @Remove", 25);