This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 244237
Collapse All | Expand All

(-)a/web.el/manifest.mf (-1 / +1 lines)
Lines 3-6 Link Here
3
OpenIDE-Module: org.netbeans.modules.web.el
3
OpenIDE-Module: org.netbeans.modules.web.el
4
OpenIDE-Module-Layer: org/netbeans/modules/web/el/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/web/el/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/el/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/el/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.50
6
OpenIDE-Module-Specification-Version: 1.51
(-)a/web.el/src/org/netbeans/modules/web/el/ELTypeUtilities.java (+3 lines)
Lines 618-623 Link Here
618
        for (ELVariableResolver.VariableInfo vi : vis) {
618
        for (ELVariableResolver.VariableInfo vi : vis) {
619
            if (identifier.getImage().equals(vi.name)) {
619
            if (identifier.getImage().equals(vi.name)) {
620
                try {
620
                try {
621
                    if (vi.expression == null) {
622
                        continue;
623
                    }
621
                    ELPreprocessor elp = new ELPreprocessor(vi.expression, ELPreprocessor.XML_ENTITY_REFS_CONVERSION_TABLE);
624
                    ELPreprocessor elp = new ELPreprocessor(vi.expression, ELPreprocessor.XML_ENTITY_REFS_CONVERSION_TABLE);
622
                    Node expressionNode = ELParser.parse(elp);
625
                    Node expressionNode = ELParser.parse(elp);
623
                    if (expressionNode != null) {
626
                    if (expressionNode != null) {
(-)a/web.el/src/org/netbeans/modules/web/el/completion/ELCodeCompletionHandler.java (-9 / +19 lines)
Lines 209-214 Link Here
209
                            proposeImpicitObjects(ccontext, context, prefixMatcher, proposals);
209
                            proposeImpicitObjects(ccontext, context, prefixMatcher, proposals);
210
                            proposeKeywords(context, prefixMatcher, proposals);
210
                            proposeKeywords(context, prefixMatcher, proposals);
211
                            proposeAssignements(context, prefixMatcher, assignments, proposals);
211
                            proposeAssignements(context, prefixMatcher, assignments, proposals);
212
                        } else {
213
                            // issue #244237 - no autocomplete for varStatus
214
                            proposeVarStatusItems(ccontext, context, prefixMatcher, element, proposals);
212
                        }
215
                        }
213
                        if (ELStreamCompletionItem.STREAM_METHOD.equals(node.getImage())) {
216
                        if (ELStreamCompletionItem.STREAM_METHOD.equals(node.getImage())) {
214
                            proposeOperators(ccontext, context, prefixMatcher, element, proposals, rootToNode, isBracketProperty(target, rootToNode));
217
                            proposeOperators(ccontext, context, prefixMatcher, element, proposals, rootToNode, isBracketProperty(target, rootToNode));
Lines 576-582 Link Here
576
            if (!prefix.matches(bean.name)) {
579
            if (!prefix.matches(bean.name)) {
577
                continue;
580
                continue;
578
            }
581
            }
579
            if(bean.clazz == null) {
582
            if (bean.clazz == null) {
580
                //probably a refered (w/o type) variable, just show it in the completion w/o type
583
                //probably a refered (w/o type) variable, just show it in the completion w/o type
581
                ELVariableCompletionItem item = new ELVariableCompletionItem(bean.name, bean.expression);
584
                ELVariableCompletionItem item = new ELVariableCompletionItem(bean.name, bean.expression);
582
                item.setAnchorOffset(context.getCaretOffset() - prefix.length());
585
                item.setAnchorOffset(context.getCaretOffset() - prefix.length());
Lines 584-598 Link Here
584
                proposals.add(item);
587
                proposals.add(item);
585
588
586
            } else {
589
            } else {
587
                //resolved variable
590
                if (bean.clazz.equals(VariableInfo.VAR_STATUS_VAR)) {
588
                Element element = ELTypeUtilities.getElementForType(info, bean.clazz);
591
                    ELRawObjectPropertyCompletionItem item = new ELRawObjectPropertyCompletionItem(bean.name);
589
                if (element == null) {
592
                    item.setAnchorOffset(context.getCaretOffset() - prefix.length());
590
                    continue;
593
                    item.setSmart(true);
594
                    proposals.add(item);
595
                } else {
596
                    //resolved variable
597
                    Element element = ELTypeUtilities.getElementForType(info, bean.clazz);
598
                    if (element == null) {
599
                        continue;
600
                    }
601
                    ELJavaCompletionItem item = new ELJavaCompletionItem(info, element, elElement);
602
                    item.setAnchorOffset(context.getCaretOffset() - prefix.length());
603
                    item.setSmart(true);
604
                    proposals.add(item);
591
                }
605
                }
592
                ELJavaCompletionItem item = new ELJavaCompletionItem(info, element, elElement);
593
                item.setAnchorOffset(context.getCaretOffset() - prefix.length());
594
                item.setSmart(true);
595
                proposals.add(item);
596
            }
606
            }
597
        }
607
        }
598
    }
608
    }
(-)a/web.el/src/org/netbeans/modules/web/el/spi/ELVariableResolver.java (+2 lines)
Lines 146-151 Link Here
146
146
147
    public static final class VariableInfo {
147
    public static final class VariableInfo {
148
148
149
        public static final String VAR_STATUS_VAR = "--VAR_STATUS_VAR--";
150
149
        public final String name;
151
        public final String name;
150
        public final String clazz;
152
        public final String clazz;
151
        public final String expression;
153
        public final String expression;
(-)a/web.jsf.editor/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.netbeans.modules.web.jsf.editor
2
OpenIDE-Module: org.netbeans.modules.web.jsf.editor
3
OpenIDE-Module-Layer: org/netbeans/modules/web/jsf/editor/resources/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/web/jsf/editor/resources/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/jsf/editor/resources/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/jsf/editor/resources/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.48
5
OpenIDE-Module-Specification-Version: 1.49
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
(-)a/web.jsf.editor/nbproject/project.xml (-1 / +1 lines)
Lines 298-304 Link Here
298
                    <build-prerequisite/>
298
                    <build-prerequisite/>
299
                    <compile-dependency/>
299
                    <compile-dependency/>
300
                    <run-dependency>
300
                    <run-dependency>
301
                        <specification-version>1.45</specification-version>
301
                        <specification-version>1.51</specification-version>
302
                    </run-dependency>
302
                    </run-dependency>
303
                </dependency>
303
                </dependency>
304
                <dependency>
304
                <dependency>
(-)a/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/el/JsfELVariableResolver.java (+4 lines)
Lines 161-166 Link Here
161
        List<JsfVariableContext> allJsfVariables = getAllJsfVariables(snapshot, offset);
161
        List<JsfVariableContext> allJsfVariables = getAllJsfVariables(snapshot, offset);
162
        List<VariableInfo> result = new ArrayList<>(allJsfVariables.size());
162
        List<VariableInfo> result = new ArrayList<>(allJsfVariables.size());
163
        for (JsfVariableContext jsfVariable : allJsfVariables) {
163
        for (JsfVariableContext jsfVariable : allJsfVariables) {
164
            String varStatusVariable = jsfVariable.getVarStatusVariable();
165
            if (jsfVariable.getVarStatusVariable() != null) {
166
                result.add(VariableInfo.createResolvedVariable(varStatusVariable, VariableInfo.VAR_STATUS_VAR));
167
            }
164
            //gets the generated expression from the el variables chain, see the JsfVariablesModel for more info
168
            //gets the generated expression from the el variables chain, see the JsfVariablesModel for more info
165
            String expression = jsfVariable.getResolvedExpression();
169
            String expression = jsfVariable.getResolvedExpression();
166
            if (expression == null) {
170
            if (expression == null) {
(-)a/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/el/JsfVariableContext.java (-1 / +7 lines)
Lines 54-65 Link Here
54
    protected String variableName;
54
    protected String variableName;
55
    protected String variableValue;
55
    protected String variableValue;
56
    protected String resolvedType;
56
    protected String resolvedType;
57
    protected String varStatusVariable;
57
58
58
    JsfVariableContext(int from, int to, String variableName, String variableType) {
59
    JsfVariableContext(int from, int to, String variableName, String variableType, String varStatusVariable) {
59
        this.from = from;
60
        this.from = from;
60
        this.to = to;
61
        this.to = to;
61
        this.variableName = variableName;
62
        this.variableName = variableName;
62
        this.variableValue = variableType;
63
        this.variableValue = variableType;
64
        this.varStatusVariable = varStatusVariable;
63
    }
65
    }
64
66
65
    public String getVariableValue() {
67
    public String getVariableValue() {
Lines 70-75 Link Here
70
        return variableName;
72
        return variableName;
71
    }
73
    }
72
74
75
    public String getVarStatusVariable() {
76
        return varStatusVariable;
77
    }
78
73
    /** @return end offset of the variable context. The offset is the html parser result embedded offset. */
79
    /** @return end offset of the variable context. The offset is the html parser result embedded offset. */
74
    public int getTo() {
80
    public int getTo() {
75
        return to;
81
        return to;
(-)a/web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/el/JsfVariablesModel.java (-3 / +23 lines)
Lines 55-60 Link Here
55
import org.netbeans.modules.html.editor.lib.api.elements.*;
55
import org.netbeans.modules.html.editor.lib.api.elements.*;
56
import org.netbeans.modules.parsing.api.Snapshot;
56
import org.netbeans.modules.parsing.api.Snapshot;
57
import org.netbeans.modules.web.jsf.editor.JsfSupportImpl;
57
import org.netbeans.modules.web.jsf.editor.JsfSupportImpl;
58
import org.netbeans.modules.web.jsfapi.api.DefaultLibraryInfo;
58
import org.netbeans.modules.web.jsfapi.api.Library;
59
import org.netbeans.modules.web.jsfapi.api.Library;
59
import org.netbeans.modules.web.jsfapi.api.LibraryComponent;
60
import org.netbeans.modules.web.jsfapi.api.LibraryComponent;
60
import org.netbeans.modules.web.jsfapi.api.NamespaceUtils;
61
import org.netbeans.modules.web.jsfapi.api.NamespaceUtils;
Lines 195-218 Link Here
195
                                    continue;
196
                                    continue;
196
                                }
197
                                }
197
198
199
                                // #244237 - no autocomplete for varStatus
200
                                String varStatusVariable = null;
201
                                if (DefaultLibraryInfo.FACELETS.getNamespace().equals(library.getNamespace())
202
                                        && "repeat".equals(tagName)) { //NOI18N
203
                                    varStatusVariable = getVarStatusVariable(openTag);
204
                                }
205
198
                                String documentValueContent = topLevelSnapshot.getText().subSequence(doc_from, doc_to).toString();
206
                                String documentValueContent = topLevelSnapshot.getText().subSequence(doc_from, doc_to).toString();
199
207
200
                                JsfVariableContext context = new JsfVariableContext(
208
                                JsfVariableContext context = new JsfVariableContext(
201
                                        openTag.from(),
209
                                        openTag.from(),
202
                                        openTag.semanticEnd(),
210
                                        openTag.semanticEnd(),
203
                                        openTag.getAttribute(variableAttributeName).unquotedValue().toString(),
211
                                        openTag.getAttribute(variableAttributeName).unquotedValue().toString(),
204
                                        unquotedValue(documentValueContent));
212
                                        unquotedValue(documentValueContent),
213
                                        varStatusVariable);
205
214
206
                                contextsList.add(context);
215
                                contextsList.add(context);
207
                            }
216
                            }
208
                        }
217
                        }
209
                    }
218
                    }
210
                    
219
211
                }
220
                }
212
            }
221
            }
213
        }
222
        }
214
    }
223
    }
215
224
225
    private String getVarStatusVariable(OpenTag openTag) {
226
        Attribute itemsAttribute = openTag.getAttribute("varStatus"); //NOI18N
227
        int doc_from = result.getSnapshot().getOriginalOffset(itemsAttribute.valueOffset());
228
        int doc_to = result.getSnapshot().getOriginalOffset(itemsAttribute.valueOffset() + itemsAttribute.value().length());
229
        if (doc_from == -1 || doc_to == -1) {
230
            return null;
231
        }
232
233
        return unquotedValue(topLevelSnapshot.getText().subSequence(doc_from, doc_to).toString());
234
    }
235
216
    private String unquotedValue(String value) {
236
    private String unquotedValue(String value) {
217
        return isValueQuoted(value) ? value.substring(1, value.length() - 1) : value;
237
        return isValueQuoted(value) ? value.substring(1, value.length() - 1) : value;
218
    }
238
    }
Lines 386-392 Link Here
386
    }
406
    }
387
407
388
    /* test */ static class Expression {
408
    /* test */ static class Expression {
389
        
409
390
        private String base, postfix, expression;
410
        private String base, postfix, expression;
391
411
392
        /** expression can contain the EL delimiters */
412
        /** expression can contain the EL delimiters */

Return to bug 244237