--- a/web.el/manifest.mf
+++ a/web.el/manifest.mf
@@ -3,4 +3,4 @@
OpenIDE-Module: org.netbeans.modules.web.el
OpenIDE-Module-Layer: org/netbeans/modules/web/el/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/el/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.50
+OpenIDE-Module-Specification-Version: 1.51
--- a/web.el/src/org/netbeans/modules/web/el/ELTypeUtilities.java
+++ a/web.el/src/org/netbeans/modules/web/el/ELTypeUtilities.java
@@ -618,6 +618,9 @@
for (ELVariableResolver.VariableInfo vi : vis) {
if (identifier.getImage().equals(vi.name)) {
try {
+ if (vi.expression == null) {
+ continue;
+ }
ELPreprocessor elp = new ELPreprocessor(vi.expression, ELPreprocessor.XML_ENTITY_REFS_CONVERSION_TABLE);
Node expressionNode = ELParser.parse(elp);
if (expressionNode != null) {
--- a/web.el/src/org/netbeans/modules/web/el/completion/ELCodeCompletionHandler.java
+++ a/web.el/src/org/netbeans/modules/web/el/completion/ELCodeCompletionHandler.java
@@ -209,6 +209,9 @@
proposeImpicitObjects(ccontext, context, prefixMatcher, proposals);
proposeKeywords(context, prefixMatcher, proposals);
proposeAssignements(context, prefixMatcher, assignments, proposals);
+ } else {
+ // issue #244237 - no autocomplete for varStatus
+ proposeVarStatusItems(ccontext, context, prefixMatcher, element, proposals);
}
if (ELStreamCompletionItem.STREAM_METHOD.equals(node.getImage())) {
proposeOperators(ccontext, context, prefixMatcher, element, proposals, rootToNode, isBracketProperty(target, rootToNode));
@@ -576,7 +579,7 @@
if (!prefix.matches(bean.name)) {
continue;
}
- if(bean.clazz == null) {
+ if (bean.clazz == null) {
//probably a refered (w/o type) variable, just show it in the completion w/o type
ELVariableCompletionItem item = new ELVariableCompletionItem(bean.name, bean.expression);
item.setAnchorOffset(context.getCaretOffset() - prefix.length());
@@ -584,15 +587,22 @@
proposals.add(item);
} else {
- //resolved variable
- Element element = ELTypeUtilities.getElementForType(info, bean.clazz);
- if (element == null) {
- continue;
+ if (bean.clazz.equals(VariableInfo.VAR_STATUS_VAR)) {
+ ELRawObjectPropertyCompletionItem item = new ELRawObjectPropertyCompletionItem(bean.name);
+ item.setAnchorOffset(context.getCaretOffset() - prefix.length());
+ item.setSmart(true);
+ proposals.add(item);
+ } else {
+ //resolved variable
+ Element element = ELTypeUtilities.getElementForType(info, bean.clazz);
+ if (element == null) {
+ continue;
+ }
+ ELJavaCompletionItem item = new ELJavaCompletionItem(info, element, elElement);
+ item.setAnchorOffset(context.getCaretOffset() - prefix.length());
+ item.setSmart(true);
+ proposals.add(item);
}
- ELJavaCompletionItem item = new ELJavaCompletionItem(info, element, elElement);
- item.setAnchorOffset(context.getCaretOffset() - prefix.length());
- item.setSmart(true);
- proposals.add(item);
}
}
}
--- a/web.el/src/org/netbeans/modules/web/el/spi/ELVariableResolver.java
+++ a/web.el/src/org/netbeans/modules/web/el/spi/ELVariableResolver.java
@@ -146,6 +146,8 @@
public static final class VariableInfo {
+ public static final String VAR_STATUS_VAR = "--VAR_STATUS_VAR--";
+
public final String name;
public final String clazz;
public final String expression;
--- a/web.jsf.editor/manifest.mf
+++ a/web.jsf.editor/manifest.mf
@@ -2,5 +2,5 @@
OpenIDE-Module: org.netbeans.modules.web.jsf.editor
OpenIDE-Module-Layer: org/netbeans/modules/web/jsf/editor/resources/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/jsf/editor/resources/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.48
+OpenIDE-Module-Specification-Version: 1.49
AutoUpdate-Show-In-Client: false
--- a/web.jsf.editor/nbproject/project.xml
+++ a/web.jsf.editor/nbproject/project.xml
@@ -298,7 +298,7 @@
- 1.45
+ 1.51
--- a/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/el/JsfELVariableResolver.java
+++ a/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/el/JsfELVariableResolver.java
@@ -161,6 +161,10 @@
List allJsfVariables = getAllJsfVariables(snapshot, offset);
List result = new ArrayList<>(allJsfVariables.size());
for (JsfVariableContext jsfVariable : allJsfVariables) {
+ String varStatusVariable = jsfVariable.getVarStatusVariable();
+ if (jsfVariable.getVarStatusVariable() != null) {
+ result.add(VariableInfo.createResolvedVariable(varStatusVariable, VariableInfo.VAR_STATUS_VAR));
+ }
//gets the generated expression from the el variables chain, see the JsfVariablesModel for more info
String expression = jsfVariable.getResolvedExpression();
if (expression == null) {
--- a/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/el/JsfVariableContext.java
+++ a/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/el/JsfVariableContext.java
@@ -54,12 +54,14 @@
protected String variableName;
protected String variableValue;
protected String resolvedType;
+ protected String varStatusVariable;
- JsfVariableContext(int from, int to, String variableName, String variableType) {
+ JsfVariableContext(int from, int to, String variableName, String variableType, String varStatusVariable) {
this.from = from;
this.to = to;
this.variableName = variableName;
this.variableValue = variableType;
+ this.varStatusVariable = varStatusVariable;
}
public String getVariableValue() {
@@ -70,6 +72,10 @@
return variableName;
}
+ public String getVarStatusVariable() {
+ return varStatusVariable;
+ }
+
/** @return end offset of the variable context. The offset is the html parser result embedded offset. */
public int getTo() {
return to;
--- a/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/el/JsfVariablesModel.java
+++ a/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/el/JsfVariablesModel.java
@@ -55,6 +55,7 @@
import org.netbeans.modules.html.editor.lib.api.elements.*;
import org.netbeans.modules.parsing.api.Snapshot;
import org.netbeans.modules.web.jsf.editor.JsfSupportImpl;
+import org.netbeans.modules.web.jsfapi.api.DefaultLibraryInfo;
import org.netbeans.modules.web.jsfapi.api.Library;
import org.netbeans.modules.web.jsfapi.api.LibraryComponent;
import org.netbeans.modules.web.jsfapi.api.NamespaceUtils;
@@ -195,24 +196,43 @@
continue;
}
+ // #244237 - no autocomplete for varStatus
+ String varStatusVariable = null;
+ if (DefaultLibraryInfo.FACELETS.getNamespace().equals(library.getNamespace())
+ && "repeat".equals(tagName)) { //NOI18N
+ varStatusVariable = getVarStatusVariable(openTag);
+ }
+
String documentValueContent = topLevelSnapshot.getText().subSequence(doc_from, doc_to).toString();
JsfVariableContext context = new JsfVariableContext(
openTag.from(),
openTag.semanticEnd(),
openTag.getAttribute(variableAttributeName).unquotedValue().toString(),
- unquotedValue(documentValueContent));
+ unquotedValue(documentValueContent),
+ varStatusVariable);
contextsList.add(context);
}
}
}
-
+
}
}
}
}
+ private String getVarStatusVariable(OpenTag openTag) {
+ Attribute itemsAttribute = openTag.getAttribute("varStatus"); //NOI18N
+ int doc_from = result.getSnapshot().getOriginalOffset(itemsAttribute.valueOffset());
+ int doc_to = result.getSnapshot().getOriginalOffset(itemsAttribute.valueOffset() + itemsAttribute.value().length());
+ if (doc_from == -1 || doc_to == -1) {
+ return null;
+ }
+
+ return unquotedValue(topLevelSnapshot.getText().subSequence(doc_from, doc_to).toString());
+ }
+
private String unquotedValue(String value) {
return isValueQuoted(value) ? value.substring(1, value.length() - 1) : value;
}
@@ -386,7 +406,7 @@
}
/* test */ static class Expression {
-
+
private String base, postfix, expression;
/** expression can contain the EL delimiters */