Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 111292 | Differences between
and this patch

Collapse All | Expand All

(-)java.source/apichanges.xml (+15 lines)
 Lines 105-110    Link Here 
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
106
106
107
    <changes>
107
    <changes>
108
        <change id="SourceUtils.getAttributeValueCompletions">
109
             <api name="general"/>
110
             <summary>Added SourceUtils.getAttributeValueCompletions method.</summary>
111
             <version major="0" minor="56"/>
112
             <date day="24" month="2" year="2010"/>
113
             <author login="dbalek"/>
114
             <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible"/>
115
             <description>
116
                 Added <code>SourceUtils.getAttributeValueCompletions</code> method, which
117
                 returns a list of completions for an annotation attribute value suggested by
118
                 annotation processors.
119
             </description>
120
             <class package="org.netbeans.api.java.source" name="SourceUtils"/>
121
             <issue number="111292"/>
122
        </change>
108
        <change id="GeneratorUtilities.copyComments">
123
        <change id="GeneratorUtilities.copyComments">
109
             <api name="general"/>
124
             <api name="general"/>
110
             <summary>Added GeneratorUtilities.copyComments method.</summary>
125
             <summary>Added GeneratorUtilities.copyComments method.</summary>
(-)java.source/nbproject/project.properties (-1 / +1 lines)
 Lines 43-49    Link Here 
43
javadoc.title=Java Source
43
javadoc.title=Java Source
44
javadoc.arch=${basedir}/arch.xml
44
javadoc.arch=${basedir}/arch.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
46
spec.version.base=0.55.0
46
spec.version.base=0.56.0
47
test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/javac-api-nb-7.0-b07.jar
47
test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/javac-api-nb-7.0-b07.jar
48
test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\
48
test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\
49
    ${o.n.core.dir}/lib/boot.jar:\
49
    ${o.n.core.dir}/lib/boot.jar:\
(-)java.source/src/org/netbeans/api/java/source/SourceUtils.java (-1 / +51 lines)
 Lines 49-54    Link Here 
49
import java.net.URL;
49
import java.net.URL;
50
import java.util.*;
50
import java.util.*;
51
51
52
import javax.annotation.processing.Completion;
53
import javax.annotation.processing.Processor;
52
import javax.lang.model.element.*;
54
import javax.lang.model.element.*;
53
import javax.lang.model.element.VariableElement;
55
import javax.lang.model.element.VariableElement;
54
import javax.lang.model.type.ArrayType;
56
import javax.lang.model.type.ArrayType;
 Lines 94-99    Link Here 
94
import org.netbeans.api.lexer.TokenHierarchy;
96
import org.netbeans.api.lexer.TokenHierarchy;
95
import org.netbeans.api.lexer.TokenSequence;
97
import org.netbeans.api.lexer.TokenSequence;
96
import org.netbeans.modules.java.JavaDataLoader;
98
import org.netbeans.modules.java.JavaDataLoader;
99
import org.netbeans.modules.java.source.indexing.APTUtils;
97
import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
100
import org.netbeans.modules.java.source.indexing.JavaCustomIndexer;
98
import org.netbeans.modules.java.source.indexing.JavaIndex;
101
import org.netbeans.modules.java.source.indexing.JavaIndex;
99
import org.netbeans.modules.java.source.parsing.ClasspathInfoProvider;
102
import org.netbeans.modules.java.source.parsing.ClasspathInfoProvider;
 Lines 167-173    Link Here 
167
        Type.TypeVar bound = ((Type.WildcardType)wildcardType).bound;
170
        Type.TypeVar bound = ((Type.WildcardType)wildcardType).bound;
168
        return bound != null ? bound.bound : null;
171
        return bound != null ? bound.bound : null;
169
    }
172
    }
170
    
173
174
    /**
175
     * Returns a list of completions for an annotation attribute value suggested by
176
     * annotation processors.
177
     * 
178
     * @param info the CompilationInfo used to resolve annotation processors
179
     * @param element the element being annotated
180
     * @param annotation the (perhaps partial) annotation being applied to the element
181
     * @param member the annotation member to return possible completions for
182
     * @param userText source code text to be completed
183
     * @return suggested completions to the annotation member
184
     * 
185
     * @since 0.56
186
     */
187
    public static List<? extends Completion> getAttributeValueCompletions(CompilationInfo info, Element element, AnnotationMirror annotation, ExecutableElement member, String userText) {
188
        List<Completion> completions = new LinkedList<Completion>();
189
        if (info.getPhase().compareTo(Phase.ELEMENTS_RESOLVED) >= 0) {
190
            String fqn = ((TypeElement) annotation.getAnnotationType().asElement()).getQualifiedName().toString();
191
            Iterable<? extends Processor> processors = info.impl.getJavacTask().getProcessors();
192
            if (processors != null) {
193
                for (Processor processor : processors) {
194
                    boolean match = false;
195
                    for (String sat : processor.getSupportedAnnotationTypes()) {
196
                        if ("*".equals(sat)) { //NOI18N
197
                            match = true;
198
                            break;
199
                        } else if (sat.endsWith(".*")) { //NOI18N
200
                            sat = sat.substring(0, sat.length() - 1);
201
                            if (fqn.startsWith(sat)) {
202
                                match = true;
203
                                break;
204
                            }
205
                        } else if (fqn.equals(sat)) {
206
                            match = true;
207
                            break;
208
                        }
209
                    }
210
                    if (match) {
211
                        for (Completion c : processor.getCompletions(element, annotation, member, userText)) {
212
                            completions.add(c);
213
                        }
214
                    }
215
                }
216
            }
217
        }
218
        return completions;
219
    }
220
171
    /**
221
    /**
172
     * Returns the type element within which this member or constructor
222
     * Returns the type element within which this member or constructor
173
     * is declared. Does not accept packages
223
     * is declared. Does not accept packages

Return to bug 111292
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo