|
|
|
@ -38,6 +38,9 @@ import javax.tools.JavaFileObject;
|
|
|
|
|
|
|
|
|
|
import com.github.weisj.darklaf.annotations.SynthesiseLaf; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @deprecated Auto-Generated class. Use LafManager.installTheme(Theme) instead. |
|
|
|
|
*/ |
|
|
|
|
@SupportedAnnotationTypes("com.github.weisj.darklaf.annotations.SynthesiseLaf") |
|
|
|
|
public class SynthesiseLafProcessor extends AbstractProcessor { |
|
|
|
|
|
|
|
|
@ -57,11 +60,18 @@ public class SynthesiseLafProcessor extends AbstractProcessor {
|
|
|
|
|
String synthesisedName = packageName + "." + synthesisedClassName; |
|
|
|
|
|
|
|
|
|
StringBuilder builder = new StringBuilder(); |
|
|
|
|
builder.append("package ").append(packageName).append(";\n\n").append("import ").append(themePath) |
|
|
|
|
.append(";\n\n").append("public class ").append(synthesisedClassName).append(" extends ") |
|
|
|
|
.append(baseClassName).append(" {\n\n").append(IDENT).append("public ").append(synthesisedClassName) |
|
|
|
|
.append("() {\n").append(IDENT).append(IDENT).append("super(new ").append(themeName) |
|
|
|
|
.append("());\n").append(IDENT).append("}\n").append("}"); |
|
|
|
|
builder.append("package ").append(packageName).append(";\n\n"); |
|
|
|
|
|
|
|
|
|
builder.append("import ").append(themePath).append(";\n\n"); |
|
|
|
|
builder.append("/**\n"); |
|
|
|
|
builder.append(" * @deprecated Auto-Generated class. Use LafManager.installTheme(Theme) instead.\n"); |
|
|
|
|
builder.append(" */\n"); |
|
|
|
|
builder.append("@Deprecated\n"); |
|
|
|
|
builder.append("public class ").append(synthesisedClassName).append(" extends ").append(baseClassName); |
|
|
|
|
builder.append(" {\n\n"); |
|
|
|
|
builder.append(IDENT).append("public ").append(synthesisedClassName).append("() {\n"); |
|
|
|
|
builder.append(IDENT).append(IDENT).append("super(new ").append(themeName).append("());\n"); |
|
|
|
|
builder.append(IDENT).append("}\n").append("}"); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
JavaFileObject javaFileObject = processingEnv.getFiler().createSourceFile(synthesisedName, typeElement); |
|
|
|
|