Lines 64-69
Link Here
|
64 |
import org.openide.filesystems.annotations.LayerBuilder; |
64 |
import org.openide.filesystems.annotations.LayerBuilder; |
65 |
import org.openide.filesystems.annotations.LayerGeneratingProcessor; |
65 |
import org.openide.filesystems.annotations.LayerGeneratingProcessor; |
66 |
import org.openide.filesystems.annotations.LayerGenerationException; |
66 |
import org.openide.filesystems.annotations.LayerGenerationException; |
|
|
67 |
import org.openide.nodes.BeanInfoSearchPath; |
67 |
import org.openide.nodes.PropertyEditorRegistration; |
68 |
import org.openide.nodes.PropertyEditorRegistration; |
68 |
import org.openide.nodes.PropertyEditorSearchPath; |
69 |
import org.openide.nodes.PropertyEditorSearchPath; |
69 |
import org.openide.util.lookup.ServiceProvider; |
70 |
import org.openide.util.lookup.ServiceProvider; |
Lines 76-84
Link Here
|
76 |
*/ |
77 |
*/ |
77 |
@ServiceProvider(service=Processor.class) |
78 |
@ServiceProvider(service=Processor.class) |
78 |
@SupportedSourceVersion(SourceVersion.RELEASE_6) |
79 |
@SupportedSourceVersion(SourceVersion.RELEASE_6) |
79 |
public class PEAnnotationProcessor extends LayerGeneratingProcessor { |
80 |
public class NodesAnnotationProcessor extends LayerGeneratingProcessor { |
80 |
|
81 |
|
81 |
public PEAnnotationProcessor() { |
82 |
public NodesAnnotationProcessor() { |
82 |
} |
83 |
} |
83 |
|
84 |
|
84 |
@Override |
85 |
@Override |
Lines 86-91
Link Here
|
86 |
Set<String> set = new HashSet<String>(); |
87 |
Set<String> set = new HashSet<String>(); |
87 |
set.add(PropertyEditorSearchPath.class.getName()); |
88 |
set.add(PropertyEditorSearchPath.class.getName()); |
88 |
set.add(PropertyEditorRegistration.class.getName()); |
89 |
set.add(PropertyEditorRegistration.class.getName()); |
|
|
90 |
set.add(BeanInfoSearchPath.class.getName()); |
89 |
return set; |
91 |
return set; |
90 |
} |
92 |
} |
91 |
|
93 |
|
Lines 93-111
Link Here
|
93 |
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) |
95 |
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) |
94 |
throws LayerGenerationException { |
96 |
throws LayerGenerationException { |
95 |
Messager messager = processingEnv.getMessager(); |
97 |
Messager messager = processingEnv.getMessager(); |
|
|
98 |
|
99 |
// handle @PropertyEditorSearchPath |
96 |
for (Element e : roundEnv.getElementsAnnotatedWith(PropertyEditorSearchPath.class)) { |
100 |
for (Element e : roundEnv.getElementsAnnotatedWith(PropertyEditorSearchPath.class)) { |
97 |
String pkg = findPackage(e); |
101 |
String pkg = findPackage(e); |
98 |
String pkgFilename = pkg.replace(".", "-"); //NOI18N |
102 |
String pkgFilename = pkg.replace(".", "-"); //NOI18N |
99 |
LayerBuilder builder = layer(e); |
103 |
LayerBuilder builder = layer(e); |
100 |
LayerBuilder.File file = builder.file(PERegistrationSupport.LOOKUP_PATH |
104 |
LayerBuilder.File file = builder.file(NodesRegistrationSupport.PE_LOOKUP_PATH |
101 |
+ "/Package-" + pkgFilename + ".instance"); //NOI18N |
105 |
+ "/Package-" + pkgFilename + ".instance"); //NOI18N |
102 |
file.methodvalue("instanceCreate", PERegistrationSupport.class.getName(), |
106 |
file.methodvalue("instanceCreate", NodesRegistrationSupport.class.getName(), |
103 |
"createPackageRegistration"); //NOI18N |
107 |
"createPackageRegistration"); //NOI18N |
104 |
file.stringvalue(PERegistrationSupport.PACKAGE, pkg); |
108 |
file.stringvalue(NodesRegistrationSupport.PACKAGE, pkg); |
105 |
file.stringvalue("instanceOf", PERegistrationSupport.PEPackageRegistration.class.getName()); |
109 |
file.stringvalue("instanceOf", NodesRegistrationSupport.PEPackageRegistration.class.getName()); |
106 |
file.write(); |
110 |
file.write(); |
107 |
} |
111 |
} |
108 |
|
112 |
|
|
|
113 |
// handle @PropertyEditorRegistration |
109 |
for (Element e : roundEnv.getElementsAnnotatedWith(PropertyEditorRegistration.class)) { |
114 |
for (Element e : roundEnv.getElementsAnnotatedWith(PropertyEditorRegistration.class)) { |
110 |
if (e.getKind() == ElementKind.CLASS) { |
115 |
if (e.getKind() == ElementKind.CLASS) { |
111 |
String className = ((TypeElement) e).getQualifiedName().toString(); |
116 |
String className = ((TypeElement) e).getQualifiedName().toString(); |
Lines 130-139
Link Here
|
130 |
|
135 |
|
131 |
LayerBuilder builder = layer(e); |
136 |
LayerBuilder builder = layer(e); |
132 |
String clsFileName = className.replace(".", "-"); //NOI18N |
137 |
String clsFileName = className.replace(".", "-"); //NOI18N |
133 |
LayerBuilder.File file = builder.instanceFile(PERegistrationSupport.LOOKUP_PATH, "Class-" + clsFileName); //NOI18N |
138 |
LayerBuilder.File file = builder.instanceFile(NodesRegistrationSupport.PE_LOOKUP_PATH, "Class-" + clsFileName); //NOI18N |
134 |
file.methodvalue("instanceCreate", PERegistrationSupport.class.getName(), "createClassRegistration"); //NOI18N |
139 |
file.methodvalue("instanceCreate", NodesRegistrationSupport.class.getName(), "createClassRegistration"); //NOI18N |
135 |
file.stringvalue(PERegistrationSupport.EDITOR_CLASS, className); //NOI18N |
140 |
file.stringvalue(NodesRegistrationSupport.EDITOR_CLASS, className); //NOI18N |
136 |
file.stringvalue("instanceOf", PERegistrationSupport.PEClassRegistration.class.getName()); |
141 |
file.stringvalue("instanceOf", NodesRegistrationSupport.PEClassRegistration.class.getName()); |
137 |
int i = 1; |
142 |
int i = 1; |
138 |
for (AnnotationValue type : targetTypes) { |
143 |
for (AnnotationValue type : targetTypes) { |
139 |
String clsName = type.accept(new SimpleAnnotationValueVisitor6<String, Object>() { |
144 |
String clsName = type.accept(new SimpleAnnotationValueVisitor6<String, Object>() { |
Lines 149-154
Link Here
|
149 |
file.write(); |
154 |
file.write(); |
150 |
} |
155 |
} |
151 |
} |
156 |
} |
|
|
157 |
|
158 |
// handle @BeanInfoSearchPath |
159 |
for (Element e : roundEnv.getElementsAnnotatedWith(BeanInfoSearchPath.class)) { |
160 |
String pkg = findPackage(e); |
161 |
String pkgFilename = pkg.replace(".", "-"); //NOI18N |
162 |
LayerBuilder builder = layer(e); |
163 |
LayerBuilder.File file = builder.file(NodesRegistrationSupport.BEANINFO_LOOKUP_PATH |
164 |
+ "/BeanInfo-" + pkgFilename + ".instance"); //NOI18N |
165 |
file.methodvalue("instanceCreate", NodesRegistrationSupport.class.getName(), |
166 |
"createBeanInfoRegistration"); //NOI18N |
167 |
file.stringvalue(NodesRegistrationSupport.PACKAGE, pkg); |
168 |
file.stringvalue("instanceOf", NodesRegistrationSupport.BeanInfoRegistration.class.getName()); |
169 |
file.write(); |
170 |
} |
152 |
return true; |
171 |
return true; |
153 |
} |
172 |
} |
154 |
|
173 |
|