Search in sources :

Example 1 with ScoreObjectEditorPlugin

use of blue.plugin.ScoreObjectEditorPlugin in project blue by kunstmusik.

the class ScoreObjectEditorPluginProcessor method handleProcess.

@Override
protected boolean handleProcess(Set<? extends TypeElement> set, RoundEnvironment env) throws LayerGenerationException {
    Elements elements = processingEnv.getElementUtils();
    for (Element e : env.getElementsAnnotatedWith(ScoreObjectEditorPlugin.class)) {
        TypeElement clazz = (TypeElement) e;
        String teName = elements.getBinaryName(clazz).toString();
        ScoreObjectEditorPlugin instrumentEditorPlugin = clazz.getAnnotation(ScoreObjectEditorPlugin.class);
        File f = layer(e).file("blue/score/objectEditors/" + teName.replace('.', '-') + ".instance");
        TypeMirror tm = null;
        try {
            instrumentEditorPlugin.scoreObjectType();
        } catch (MirroredTypeException mte) {
            tm = mte.getTypeMirror();
        }
        f.stringvalue("scoreObjectType", tm.toString());
        f.write();
    }
    return true;
}
Also used : MirroredTypeException(javax.lang.model.type.MirroredTypeException) TypeMirror(javax.lang.model.type.TypeMirror) TypeElement(javax.lang.model.element.TypeElement) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement) Elements(javax.lang.model.util.Elements) ScoreObjectEditorPlugin(blue.plugin.ScoreObjectEditorPlugin) File(org.openide.filesystems.annotations.LayerBuilder.File)

Aggregations

ScoreObjectEditorPlugin (blue.plugin.ScoreObjectEditorPlugin)1 Element (javax.lang.model.element.Element)1 TypeElement (javax.lang.model.element.TypeElement)1 MirroredTypeException (javax.lang.model.type.MirroredTypeException)1 TypeMirror (javax.lang.model.type.TypeMirror)1 Elements (javax.lang.model.util.Elements)1 File (org.openide.filesystems.annotations.LayerBuilder.File)1