diff --git a/manifest.mf b/manifest.mf index 1103a17..a9adfd1 100644 --- a/manifest.mf +++ b/manifest.mf @@ -1,7 +1,7 @@ Manifest-Version: 1.0 AutoUpdate-Show-In-Client: true OpenIDE-Module: org.idp.laf/1 -OpenIDE-Module-Implementation-Version: 12 +OpenIDE-Module-Implementation-Version: 0 OpenIDE-Module-Localizing-Bundle: org/idp/laf/Bundle.properties OpenIDE-Module-Install: org/idp/laf/Installer.class OpenIDE-Module-Requires: org.openide.windows.WindowManager diff --git a/nbproject/project.properties b/nbproject/project.properties index 03bf977..c70d54f 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -5,4 +5,4 @@ javadoc.arch=${basedir}/arch.xml nbm.homepage=http://idp-crew.com/index.php/projects/laf/ nbm.module.author=Clochard Pagan nbm.needs.restart=true -spec.version.base=1.2 +spec.version.base=1.3 diff --git a/src/org/idp/laf/AttributeSetConfigured.java b/src/org/idp/laf/AttributeSetConfigured.java new file mode 100644 index 0000000..58eeb0a --- /dev/null +++ b/src/org/idp/laf/AttributeSetConfigured.java @@ -0,0 +1,140 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.idp.laf; + +import java.awt.Color; +import java.util.List; + +/** + * + * @author Clochard Pagan + */ +public class AttributeSetConfigured { + + String name; + Color bgColor; + Color fgColor; + Color underColor; + + Boolean v_isUseHighlightColor; + Boolean v_isInheritForegroundColor; + Boolean v_isUseWaveUnderlineColor; + + Color a_getHighlight; + Color a_getForegroundColor; + Color a_getWaveUnderlineColor; + + + Boolean bold; + Boolean italic; + + public AttributeSetConfigured (String name, + Color bgColor, + Color fgColor, + Color underColor, + + Boolean v_isUseHighlightColor, + Boolean v_isInheritForegroundColor, + Boolean v_isUseWaveUnderlineColor, + + Color a_getHighlight, + Color a_getForegroundColor, + Color a_getWaveUnderlineColor, + + Boolean bold, + Boolean italic + ) + { + this.name = name; + this.bgColor = bgColor; + this.fgColor = fgColor; + this.underColor = underColor; + this.v_isInheritForegroundColor = v_isInheritForegroundColor; + this.v_isUseHighlightColor = v_isUseHighlightColor; + this.v_isUseWaveUnderlineColor = v_isUseWaveUnderlineColor; + this.bold = bold; + this.italic = italic; + this.a_getForegroundColor = a_getForegroundColor; + this.a_getHighlight = a_getHighlight; + this.a_getWaveUnderlineColor = a_getWaveUnderlineColor; + } + + public String produceConfLine () + { + String res = "new AttributeSetConfigured (" ; + res +="\"" + this.name + "\", "; + res += wrapColor(bgColor) + ", "; + res += wrapColor(fgColor) + ", "; + res += wrapColor(underColor) + ", "; + res += wrapBoolean (v_isUseHighlightColor) + ", "; + res += wrapBoolean (v_isInheritForegroundColor) + ", "; + res += wrapBoolean (v_isUseWaveUnderlineColor) + ", "; + res += wrapColor(a_getForegroundColor) + ", "; + res += wrapColor(a_getHighlight) + ", "; + res += wrapColor(a_getWaveUnderlineColor) + ", "; + res += wrapBoolean (bold) + ", "; + res += wrapBoolean (italic); + res += ")"; + return res; + } + + private String wrapColor(Color c) + { + if (c != null) + { + String res = "new Color (" + c.getRed() + ", " + + c.getGreen() + ", " + + c.getBlue() + ", " + + c.getAlpha() + ")"; + return res; + } + else + { + return "null"; + } + } + + private String wrapBoolean(Boolean b) + { + if (b != null) + { + if (b) + { + return "true"; + } + else + { + return "false"; + } + } + else + { + return "null"; + } + } + + public static void compileSet (String setName, List conf) + { + String res = "private static final AttributeSetConfigured [] " + setName + " = {\n"; + + for (int i = 0; i < conf.size(); i ++) + { + if (i != conf.size() - 1) + { + res += " " + conf.get(i).produceConfLine() + ", \n"; + } + else + { + res += " " + conf.get(i).produceConfLine() + "\n"; + } + } + + res += "};"; + System.out.println(res); + } + + +} diff --git a/src/org/idp/laf/ColorTheme.java b/src/org/idp/laf/ColorTheme.java new file mode 100644 index 0000000..de400f2 --- /dev/null +++ b/src/org/idp/laf/ColorTheme.java @@ -0,0 +1,376 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.idp.laf; + +import java.awt.Color; +import java.util.HashMap; + +/** + * + * @author Clochard Pagan + */ +public class ColorTheme { + +// +private static final AttributeSetConfigured [] annotations = { + new AttributeSetConfigured ("Multiple Enabled and Disabled Breakpoints", new Color (255, 0, 255, 255), null, null, true, true, false, null, new Color (255, 0, 255, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Program Counter of threads with a Disabled Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Stopwatch Profiling Point", new Color (180, 228, 252, 255), null, null, true, true, false, null, new Color (180, 228, 252, 255), null, null, null), + new AttributeSetConfigured ("Current Program Counter and other thread", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Deactivated Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Current Ant Target + Disabled Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Field Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Deactivated Class Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Disabled Method Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Warning", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Mercurial Annotation", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Reset Results Profiling Point", new Color (180, 228, 252, 255), null, null, true, true, false, null, new Color (180, 228, 252, 255), null, null, null), + new AttributeSetConfigured ("Fixable Hint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Program Counter and a Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Current Program Counter", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Has Implementations", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Deactivated Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Conditional Breakpoint", new Color (255, 200, 0, 255), null, null, true, true, false, null, new Color (255, 200, 0, 255), null, null, null), + new AttributeSetConfigured ("Method Breakpoint", new Color (255, 200, 0, 255), null, null, true, true, false, null, new Color (255, 200, 0, 255), null, null, null), + new AttributeSetConfigured ("Program Counter of threads with a Broken Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Deactivated Method Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Program Counter of threads with a Breakpoint", new Color (255, 0, 255, 255), null, null, true, true, false, null, new Color (255, 0, 255, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and Multiple Disabled Breakpoints", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Current Program Counter In Expression + Breakpoint", new Color (233, 255, 230, 255), null, null, true, true, false, null, new Color (233, 255, 230, 255), null, null, null), + new AttributeSetConfigured ("Disabled Take Snapshot Profiling Point", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Overrides and is overridden", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Disabled Class Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Specializes Template Annotation of Overrides and/or is overridden", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Breakpoint", new Color (252, 157, 159, 255), null, null, true, true, false, null, new Color (252, 157, 159, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and Multiple Breakpoints", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Fixable Hint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Disabled Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Broken Conditional Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and Multiple Broken Breakpoints", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Ant Targets", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and Multiple Enabled and Disabled Broken Breakpoints", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Bookmark", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Disabled Stopwatch Profiling Point", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Current Ant Target", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Disabled Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Disabled Conditional Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Set Current Thread to", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Program Counter and a Disabled Conditional Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Deactivated Field Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Multiple Disabled Breakpoints", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Breakpoint", new Color (136, 0, 41, 255), null, null, true, true, false, null, new Color (136, 0, 41, 255), null, null, null), + new AttributeSetConfigured ("Breakpoint", new Color (252, 157, 159, 255), null, null, true, true, false, null, new Color (252, 157, 159, 255), null, null, null), + new AttributeSetConfigured ("Implements and is overridden", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("XML Syntax Error", new Color (255, 0, 255, 255), null, null, true, true, false, null, new Color (255, 0, 255, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Call Site", new Color (231, 225, 239, 255), null, null, true, true, false, null, new Color (231, 225, 239, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Broken Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Disabled Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Breakpoint", new Color (252, 157, 159, 255), null, null, true, true, false, null, new Color (252, 157, 159, 255), null, null, null), + new AttributeSetConfigured ("Program Counter of a thread with a Broken Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Current Program Counter and other threads with a Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Broken Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and Multiple Enabled and Disabled Breakpoints", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Overrides and is overridden", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Disabled Field Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Program Counter of a thread with a Disabled Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Disabled Field Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Overrides", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Breakpoint", new Color (252, 157, 159, 255), null, null, true, true, false, null, new Color (252, 157, 159, 255), null, null, null), + new AttributeSetConfigured ("Load Generator Profiling Point", new Color (180, 228, 252, 255), null, null, true, true, false, null, new Color (180, 228, 252, 255), null, null, null), + new AttributeSetConfigured ("Current Program Counter In Expression + Conditional Breakpoint", new Color (233, 255, 230, 255), null, null, true, true, false, null, new Color (233, 255, 230, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Conditional Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Disabled Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Disabled Load Generator Profiling Point", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Fixable TODO", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Set Current Threads to", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Fixable Warning", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Fixable Error", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Versioning Annotation", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Verifier Warning", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Multiple Enabled and Disabled Broken Breakpoints", new Color (0, 0, 255, 255), null, null, true, true, false, null, new Color (0, 0, 255, 255), null, null, null), + new AttributeSetConfigured ("Subversion Annotation", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Specializes Template Annotation", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Implements", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Disabled Method Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Current Program Counter", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Multiple Enabled and Disabled Breakpoints", new Color (252, 157, 159, 255), null, null, true, true, false, null, new Color (252, 157, 159, 255), null, null, null), + new AttributeSetConfigured ("Overrides and is overridden", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Program Counter of a thread with a Breakpoint", new Color (255, 0, 255, 255), null, null, true, true, false, null, new Color (255, 0, 255, 255), null, null, null), + new AttributeSetConfigured ("Is Overridden", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Is Overridden", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Multiple Breakpoints", new Color (0, 0, 255, 255), null, null, true, true, false, null, new Color (0, 0, 255, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Disabled Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Disabled Reset Results Profiling Point", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Current Program Counter In Expression + Disabled Conditional Breakpoint", new Color (233, 255, 230, 255), null, null, true, true, false, null, new Color (233, 255, 230, 255), null, null, null), + new AttributeSetConfigured ("Git Annotation", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Is Specialized Annotation of Overrides and/or is overridden", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Current Program Counter In Expression + Disabled Breakpoint", new Color (233, 255, 230, 255), null, null, true, true, false, null, new Color (233, 255, 230, 255), null, null, null), + new AttributeSetConfigured ("C/C++ parser errors", null, null, new Color (255, 0, 0, 255), false, true, true, null, null, new Color (255, 0, 0, 255), null, null), + new AttributeSetConfigured ("Overrides", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Take Snapshot Profiling Point", new Color (180, 228, 252, 255), null, null, true, true, false, null, new Color (180, 228, 252, 255), null, null, null), + new AttributeSetConfigured ("TODO", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Overrides", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Program Counter and Multiple Enabled and Disabled Breakpoints", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Fixable Verifier Warning", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Program Counter and a Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Error", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Broken Conditional Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Implements and has implementations", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Current Expression", new Color (209, 255, 188, 255), null, null, true, true, false, null, new Color (209, 255, 188, 255), null, null, null), + new AttributeSetConfigured ("Current Ant Target + Breakpoint", new Color (255, 0, 255, 255), null, null, true, true, false, null, new Color (255, 0, 255, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Deactivated Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Is Specialized Annotation", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Multiple Broken Breakpoints", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Disabled Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Program Counter and a Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Deactivated Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Mark Occurrences for C/C++ editor", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Class Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Current Program Counter and other thread with a Breakpoint", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Disabled Class Breakpoint", null, null, null, false, true, false, null, null, null, null, null), + new AttributeSetConfigured ("Current Program Counter In Expression", new Color (233, 255, 230, 255), null, null, true, true, false, null, new Color (233, 255, 230, 255), null, null, null), + new AttributeSetConfigured ("Breakpoint", new Color (220, 220, 216, 255), null, null, true, true, false, null, new Color (220, 220, 216, 255), null, null, null), + new AttributeSetConfigured ("Next Ant Target", new Color (189, 230, 170, 255), null, null, true, true, false, null, new Color (189, 230, 170, 255), null, null, null), + new AttributeSetConfigured ("Is Overridden", null, null, null, false, true, false, null, null, null, null, null) +}; +// + +// +private static final AttributeSetConfigured [] highlightings = { + new AttributeSetConfigured ("Braces matching (match, single character)", new Color (110, 110, 110, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Text Limit Line", null, new Color (110, 110, 110, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Code Folding", null, new Color (148, 148, 148, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Text Boxes (Editable)", null, new Color (204, 0, 153, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Braces matching (mismatch, single character)", new Color (186, 2, 58, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Highlight Caret Row", new Color (32, 32, 32, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Caret Color (Overwrite mode)", new Color (228, 228, 228, 255), new Color (208, 208, 208, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Status Bar", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Guarded Block", new Color (64, 64, 64, 255), new Color (255, 0, 255, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Trailing Whitespace", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Braces matching (mismatch, multiple characters)", new Color (186, 2, 58, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Status Bar (highlighted)", null, new Color (255, 0, 0, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Braces outline sidebar", null, new Color (187, 187, 187, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Readonly Files", new Color (64, 64, 64, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Line Number", null, new Color (110, 110, 110, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Highlight Search", new Color (110, 110, 110, 255), new Color (255, 135, 35, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Code Folding Bar", null, new Color (110, 110, 110, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Text Boxes (Synchronized)", null, new Color (153, 102, 0, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Indent Guide Lines", null, new Color (48, 48, 48, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Indentation Whitespace", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Search Block", new Color (32, 32, 32, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Selected Text", new Color (110, 110, 110, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Incremental Search", new Color (255, 153, 0, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Braces matching (match, multiple characters)", new Color (110, 110, 110, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Caret Color", new Color (228, 228, 228, 255), new Color (208, 208, 208, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Hyperlinks", null, new Color (0, 0, 255, 255), null, null, null, null, null, null, null, null, null) +}; +// + +// +private static final AttributeSetConfigured [] lang_Java = { + new AttributeSetConfigured ("Mark Occurrences", new Color (73, 72, 66, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Abstract Element", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("String", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Javadoc Identifier", null, new Color (0, 0, 0, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Public Element", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Class Use", null, new Color (187, 129, 219, 255), null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Unused Element", null, null, new Color (153, 153, 153, 255), null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Method Declaration", null, new Color (88, 88, 196, 255), null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Interface Declaration", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Operator", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Literal", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Keyword Directive", null, new Color (230, 31, 91, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Number", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Character", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Parameter Use", null, new Color (251, 152, 32, 255), null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Deprecated Element", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Annotation Use", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Javadoc First Sentence", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("String Escape Sequence", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("String Escape Sequence (invalid)", null, null, new Color (206, 123, 0, 255), null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Keyword", null, new Color (234, 82, 128, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Local Variable Use", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Identifier", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Field Use", null, new Color (255, 255, 255, 255), null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Javadoc Tag", null, new Color (255, 0, 102, 255), null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Method Use", null, new Color (141, 141, 222, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Annotation Declaration", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Interface Use", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Protected Element", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Separator", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Constructor Declaration", null, new Color (62, 176, 176, 255), null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Character Escape Sequence (invalid)", null, null, null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Javadoc HTML tag", null, new Color (153, 153, 255, 255), null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Enum Use", null, new Color (187, 129, 219, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Local Variable Declaration", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Parameter Declaration", null, new Color (251, 151, 31, 255), null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Private Element", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Enum Declaration", null, new Color (148, 73, 189, 255), null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Static Element", null, null, null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Character Escape Sequence", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Class Declaration", null, new Color (148, 73, 189, 255), null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Package Private Element", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Comment", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Whitespace", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Constructor Use", null, new Color (120, 212, 212, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Field Declaration", null, new Color (255, 255, 255, 255), null, null, null, null, null, null, null, false, true) +}; +// + +// +private static final AttributeSetConfigured [] lang_CPP = { + new AttributeSetConfigured ("String", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("OpenMP Keyword Directive", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Preprocessor Symbol", null, new Color (0, 155, 0, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Functions Declaration", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Operator", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Literal", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Keyword Directive", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Typedefs", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Number", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Character", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("User Include", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Macro Defined in Code", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, false, false), + new AttributeSetConfigured ("String Escape Sequence", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("String Escape Sequence (invalid)", null, null, new Color (206, 123, 0, 255), null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Keyword", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Doxygen Tag", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Identifier", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Unused Variables", null, null, new Color (153, 153, 153, 255), null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Fields", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Preprocessor Keyword", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Macro Defined in Project", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, false, false), + new AttributeSetConfigured ("Separator", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Doxygen HTML tag", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Mark Occurrences", new Color (0, 0, 255, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Inactive Preprocessor Block", null, new Color (150, 150, 150, 255), null, null, null, null, null, null, null, false, false), + new AttributeSetConfigured ("Predefined Macros", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, false, false), + new AttributeSetConfigured ("System Include", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Functions Usage", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Preprocessor Identifier", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Comment", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Whitespace", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Preprocessor Keyword Directive", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("OpenMP Symbol", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Error", null, null, null, null, null, null, null, null, null, null, null) +}; +// + +// +private static final AttributeSetConfigured [] lang_C = { + new AttributeSetConfigured ("String", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("OpenMP Keyword Directive", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Preprocessor Symbol", null, new Color (85, 186, 2, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Functions Declaration", null, new Color (88, 88, 196, 255), null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Operator", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Literal", null, new Color (234, 82, 128, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Keyword Directive", null, new Color (230, 31, 91, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Typedefs", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Number", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Character", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("User Include", null, new Color (150, 233, 82, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Macro Defined in Code", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, false, false), + new AttributeSetConfigured ("String Escape Sequence", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("String Escape Sequence (invalid)", null, null, new Color (206, 123, 0, 255), null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Keyword", null, new Color (234, 82, 128, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Doxygen Tag", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Identifier", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Unused Variables", null, null, new Color (153, 153, 153, 255), null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Fields", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Preprocessor Keyword", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Macro Defined in Project", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, false, false), + new AttributeSetConfigured ("Separator", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Doxygen HTML tag", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Mark Occurrences", new Color (65, 65, 65, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Inactive Preprocessor Block", null, new Color (150, 150, 150, 255), null, null, null, null, null, null, null, false, false), + new AttributeSetConfigured ("Predefined Macros", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, false, false), + new AttributeSetConfigured ("System Include", null, new Color (186, 243, 138, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Functions Usage", null, new Color (141, 141, 222, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Preprocessor Identifier", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Comment", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Whitespace", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Preprocessor Keyword Directive", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("OpenMP Symbol", null, new Color (46, 146, 199, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Error", null, null, null, null, null, null, null, null, null, null, null) +}; +// + +// +private static final AttributeSetConfigured [] lang_All_Languages = { + new AttributeSetConfigured ("Markup Attribute", null, new Color (0, 124, 0, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Private Element", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("String", null, new Color (255, 255, 90, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Deprecated Element", new Color (255, 0, 0, 255), null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Error", new Color (255, 0, 0, 255), new Color (255, 255, 255, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Interface", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Entity Reference", null, new Color (255, 175, 175, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Operator", null, new Color (187, 187, 187, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Number", null, new Color (150, 233, 82, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Default", new Color (16, 16, 16, 255), new Color (228, 228, 228, 255), null, null, null, null, null, null, null, false, false), + new AttributeSetConfigured ("Protected Element", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Public Element", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Method Parameter", null, new Color (253, 165, 90, 255), null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Warning", null, null, new Color (255, 255, 0, 255), null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Keyword", null, new Color (230, 31, 91, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Class", null, null, null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Local Variable", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Identifier", null, new Color (255, 255, 255, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Static Element", null, null, null, null, null, null, null, null, null, false, true), + new AttributeSetConfigured ("Method", null, null, null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Markup Element (Tag)", null, new Color (255, 200, 0, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Constructor", null, new Color (62, 176, 176, 255), null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Markup Attribute Value", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Abstract Class or Method", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Separator", null, new Color (187, 187, 187, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("URL", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Enum", null, null, null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Field", null, new Color (9, 134, 24, 255), null, null, null, null, null, null, null, true, false), + new AttributeSetConfigured ("Character", null, new Color (255, 255, 145, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Comment", null, new Color (117, 113, 94, 255), null, null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Unused Element", null, new Color (128, 128, 128, 255), new Color (255, 175, 175, 255), null, null, null, null, null, null, null, null), + new AttributeSetConfigured ("Whitespace", null, null, null, null, null, null, null, null, null, null, null) +}; +// + +public static final HashMap > color_map; + +static +{ + + color_map = new HashMap>(); + + color_map.put("annotations", wrap(annotations)); + color_map.put("highlightings", wrap(highlightings)); + color_map.put("Java", wrap(lang_Java)); + color_map.put("C++", wrap(lang_CPP)); + color_map.put("C", wrap(lang_C)); + color_map.put("All Languages", wrap(lang_All_Languages)); + +} + + + +private static HashMap wrap (AttributeSetConfigured [] data) +{ + HashMap data_map = new HashMap(); + for (AttributeSetConfigured asc : data) + { + data_map.put(asc.name, asc); + } + return data_map; +} + + +} diff --git a/src/org/idp/laf/Installer.java b/src/org/idp/laf/Installer.java index 4b9602e..967fe92 100644 --- a/src/org/idp/laf/Installer.java +++ b/src/org/idp/laf/Installer.java @@ -38,7 +38,7 @@ public class Installer extends ModuleInstall { @Override public void run() { - Kernel.load_companion (); + TitanEditor.load_editor(); } }); @@ -58,6 +58,4 @@ public class Installer extends ModuleInstall TitanLookAndFeel.self_install(); } - - } diff --git a/src/org/idp/laf/Kernel.java b/src/org/idp/laf/Kernel.java index 6cb3a00..23bde81 100644 --- a/src/org/idp/laf/Kernel.java +++ b/src/org/idp/laf/Kernel.java @@ -525,48 +525,4 @@ public class Kernel { } } - - private static final String COLOR_MODEL = "org.netbeans.modules.options.colors.ColorModel"; //NOI18N - private static final String TITAN_THEME_NAME = NbBundle.getMessage(Kernel.class, "LBL_TITAN_EDITOR"); - - @SuppressWarnings("unchecked") - static void load_companion() { - - ClassLoader cl = Lookup.getDefault().lookup( ClassLoader.class ); - if( null == cl ) - { - cl = Installer.class.getClassLoader(); - } - - try - { - - Class clazz = cl.loadClass( COLOR_MODEL ); - Object colorModel = clazz.newInstance(); - Method get_profile_method = clazz.getDeclaredMethod( "getCurrentProfile", new Class[0] ); //NOI18N - Object res = get_profile_method.invoke( colorModel, new Object[0] ); - - if (res != null && !TITAN_THEME_NAME.equals(res)) - { - - Method set_profile = clazz.getDeclaredMethod( "setCurrentProfile", String.class ); //NOI18N - set_profile.invoke( colorModel, TITAN_THEME_NAME ); - } - else - { -// String message = "\"Titan\" Editor Theme is not available - please, download it from:" -// + "http://idp-crew.com/index.php/projects/laf/"; -// JOptionPane.showMessageDialog(new JFrame(), message, "Titan Editor Theme is not available!", -// JOptionPane.ERROR_MESSAGE); - System.err.println("\"Titan\" Editor Theme is not available - please, download it from:" - + "http://idp-crew.com/index.php/projects/laf/"); - } - } catch( Exception ex ) {} - - - } - - - - } diff --git a/src/org/idp/laf/TitanEditor.java b/src/org/idp/laf/TitanEditor.java new file mode 100644 index 0000000..2bc3174 --- /dev/null +++ b/src/org/idp/laf/TitanEditor.java @@ -0,0 +1,369 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.idp.laf; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Set; +import javax.swing.text.AttributeSet; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.StyleConstants; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; + +/** + * + * @author Edward M. Kagan + */ +public class TitanEditor { + + private static final String COLOR_MODEL_CLASS_NAME = "org.netbeans.modules.options.colors.ColorModel"; //NOI18N + private static final String EDITOR_SETTINGS_CLASS_NAME = "org.netbeans.api.editor.settings.EditorStyleConstants"; //NOI18N + private static final String ANNOTATION_TYPE_CLASS_NAME = "org.netbeans.editor.AnnotationType"; //NOI18N + + private static final boolean no_load = false; + + private static Class COLOR_MODEL; + private static Class EDITOR_SETTINGS; + private static Class ANNOTATION_TYPE; + + private static Field DisplayName; + private static Field WaveUnderlineColor; + + private static Method getProfiles; + private static Method getCurrentProfile; + private static Method setCurrentProfile; + + private static Method isUseHighlightColor; + private static Method isInheritForegroundColor; + private static Method isUseWaveUnderlineColor; + + private static Method getHighlight; + private static Method getForegroundColor; + private static Method getWaveUnderlineColor; + + private static Method setHighlight; + private static Method setForegroundColor; + private static Method setWaveUnderlineColor; + + + private static Method getAnnotations; + private static Method getHighlightings; + private static Method getCategories; + + private static Method setAnnotations; + private static Method setHighlightings; + private static Method setCategories; + + private static Method getLanguages; + + private static Object const_DisplayName; + private static Object const_WaveUnderlineColor; + private static Object colorModel; + + private static final String DEFAULT_THEME_NAME = "NetBeans"; //NOI18N + private static final String TITAN_THEME_NAME = "[idP!] Titan"; //NOI18N + + + private static boolean pre_load () + { + ClassLoader cl = Lookup.getDefault().lookup( ClassLoader.class ); + if( null != cl ) + { + try { + COLOR_MODEL = cl.loadClass( COLOR_MODEL_CLASS_NAME ); + EDITOR_SETTINGS = cl.loadClass(EDITOR_SETTINGS_CLASS_NAME); + ANNOTATION_TYPE = cl.loadClass(ANNOTATION_TYPE_CLASS_NAME); + + DisplayName = EDITOR_SETTINGS.getField("DisplayName"); //NOI18N + WaveUnderlineColor = EDITOR_SETTINGS.getField("WaveUnderlineColor"); //NOI18N + + getProfiles = COLOR_MODEL.getDeclaredMethod( "getProfiles", new Class[0] ); //NOI18N + getCurrentProfile = COLOR_MODEL.getDeclaredMethod( "getCurrentProfile", new Class[0] ); //NOI18N + setCurrentProfile = COLOR_MODEL.getDeclaredMethod( "setCurrentProfile", String.class ); //NOI18N + + + //public java.net.URL getGlyph() + + getHighlight = ANNOTATION_TYPE.getDeclaredMethod( "getHighlight", new Class[0] ); //NOI18N + getForegroundColor = ANNOTATION_TYPE.getDeclaredMethod( "getForegroundColor", new Class[0] ); //NOI18N + getWaveUnderlineColor = ANNOTATION_TYPE.getDeclaredMethod( "getWaveUnderlineColor", new Class[0] ); //NOI18N + + setHighlight = ANNOTATION_TYPE.getDeclaredMethod( "setHighlight", java.awt.Color.class ); //NOI18N + setForegroundColor = ANNOTATION_TYPE.getDeclaredMethod( "setForegroundColor", java.awt.Color.class ); //NOI18N + setWaveUnderlineColor = ANNOTATION_TYPE.getDeclaredMethod( "setWaveUnderlineColor", java.awt.Color.class ); //NOI18N + + + + + + isUseHighlightColor = ANNOTATION_TYPE.getDeclaredMethod( "isUseHighlightColor", new Class[0] ); //NOI18N + isInheritForegroundColor = ANNOTATION_TYPE.getDeclaredMethod( "isInheritForegroundColor", new Class[0] ); //NOI18N + isUseWaveUnderlineColor = ANNOTATION_TYPE.getDeclaredMethod( "isUseWaveUnderlineColor", new Class[0] ); //NOI18N + + + getAnnotations = COLOR_MODEL.getDeclaredMethod( "getAnnotations", String.class ); //NOI18N + getHighlightings = COLOR_MODEL.getDeclaredMethod( "getHighlightings", String.class ); //NOI18N + getCategories = COLOR_MODEL.getDeclaredMethod( "getCategories",String.class, String.class ); //NOI18N + + setAnnotations = COLOR_MODEL.getDeclaredMethod( "setAnnotations", String.class, Collection.class ); //NOI18N + setHighlightings = COLOR_MODEL.getDeclaredMethod( "setHighlightings", String.class, Collection.class ); //NOI18N + setCategories = COLOR_MODEL.getDeclaredMethod( "setCategories",String.class, String.class, Collection.class ); //NOI18N + + getLanguages = COLOR_MODEL.getDeclaredMethod( "getLanguages", new Class[0] ); //NOI18N + + const_DisplayName = DisplayName.get(EDITOR_SETTINGS); + const_WaveUnderlineColor = WaveUnderlineColor.get(EDITOR_SETTINGS); + colorModel = COLOR_MODEL.newInstance(); + return true; + } catch (ClassNotFoundException ex) { + Exceptions.printStackTrace(ex); + } catch (NoSuchFieldException ex) { + Exceptions.printStackTrace(ex); + } catch (SecurityException ex) { + Exceptions.printStackTrace(ex); + } catch (NoSuchMethodException ex) { + Exceptions.printStackTrace(ex); + } catch (IllegalArgumentException ex) { + Exceptions.printStackTrace(ex); + } catch (IllegalAccessException ex) { + Exceptions.printStackTrace(ex); + } catch (InstantiationException ex) { + Exceptions.printStackTrace(ex); + } + } + return false; + } + + private static void setup_theme () throws IllegalAccessException, IllegalArgumentException, InvocationTargetException + { + String current_profile = (String) getCurrentProfile.invoke( colorModel, new Object[0] ); + // System.out.println("Current profile = " + current_profile); +// if (!current_profile.equals(TITAN_THEME_NAME)) +// { + Set profile_set = (Set) getProfiles.invoke( colorModel, new Object[0] ); + boolean contain_target_theme = false; + for (String str : profile_set) + { + // System.out.println("> " + str); + if (str.equals(TITAN_THEME_NAME)) contain_target_theme = true; + } + + if (!contain_target_theme) + { + // Ugly dublication routine, sorry NB developers... + setCurrentProfile.invoke(colorModel, DEFAULT_THEME_NAME); + } + + setCurrentProfile.invoke(colorModel, TITAN_THEME_NAME); + //} + } + + public static void load_editor () + { + if (!pre_load()) return; + + try { + setup_theme (); + + if (no_load) + { + Collection annotations = (Collection) getAnnotations.invoke(colorModel, TITAN_THEME_NAME); + process_set ("annotations", annotations, true); + + + Collection highlightings = (Collection) getHighlightings.invoke(colorModel, TITAN_THEME_NAME); + process_set ("highlightings", highlightings, false); + + Object languages = getLanguages.invoke( colorModel, new Object[0] ); + Set languages_set = (Set) languages; + + for (String str : languages_set) + { + if (str.equals("All Languages") || + str.equals("Java") || + str.equals("C++") || + str.equals("C")) + { + Collection category = (Collection) getCategories.invoke(colorModel, TITAN_THEME_NAME, str); + process_set (str, category, false); + } + } + } + else + { + Collection annotations = (Collection) getAnnotations.invoke(colorModel, TITAN_THEME_NAME); + Collection annotations_upd = apply_set ("annotations", annotations, true); + setAnnotations.invoke(colorModel, TITAN_THEME_NAME, annotations_upd); + + Collection highlightings = (Collection) getHighlightings.invoke(colorModel, TITAN_THEME_NAME); + Collection highlightings_upd = apply_set ("highlightings", highlightings, false); + setHighlightings.invoke(colorModel, TITAN_THEME_NAME, highlightings_upd); + + Object languages = getLanguages.invoke( colorModel, new Object[0] ); + Set languages_set = (Set) languages; + + for (String str : languages_set) + { + if (str.equals("All Languages") || + str.equals("Java") || + str.equals("C++") || + str.equals("C")) + { + Collection category = (Collection) getCategories.invoke(colorModel, TITAN_THEME_NAME, str); + Collection category_upd = apply_set (str, category, false); + setCategories.invoke(colorModel, TITAN_THEME_NAME, str, category_upd); + + } + } + + } + } catch (IllegalAccessException ex) { + Exceptions.printStackTrace(ex); + } catch (IllegalArgumentException ex) { + Exceptions.printStackTrace(ex); + } catch (InvocationTargetException ex) { + Exceptions.printStackTrace(ex); + } + } + + private static Collection apply_set(String set_name, Collection data, boolean annotation) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException + { + LinkedList res = new LinkedList(); + + for (AttributeSet at : data) + { + HashMap cluster = ColorTheme.color_map.get(set_name); + if (cluster != null) + { + AttributeSetConfigured asc = cluster.get((String) at.getAttribute(const_DisplayName)); + if (asc != null) + { + res.add(apply_colors(asc, at, annotation)); + } + } + } + return res; + } + + private static AttributeSet apply_colors (AttributeSetConfigured asc, AttributeSet at, boolean annotation) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException + { + + SimpleAttributeSet sas = new SimpleAttributeSet(at); + + if (sas.isDefined(StyleConstants.Background)) sas.removeAttribute(StyleConstants.Background); + if (sas.isDefined(StyleConstants.Foreground)) sas.removeAttribute(StyleConstants.Foreground); + if (sas.isDefined(const_WaveUnderlineColor)) sas.removeAttribute(const_WaveUnderlineColor); + + if (sas.isDefined(javax.swing.text.StyleConstants.FontConstants.Bold)) + sas.removeAttribute(javax.swing.text.StyleConstants.FontConstants.Bold); + + if (sas.isDefined(javax.swing.text.StyleConstants.FontConstants.Italic)) + sas.removeAttribute(javax.swing.text.StyleConstants.FontConstants.Italic); + + if (asc.bgColor != null) sas.addAttribute(StyleConstants.Background, asc.bgColor); + if (asc.fgColor != null) sas.addAttribute(StyleConstants.Foreground, asc.fgColor); + + if (sas.isDefined(const_WaveUnderlineColor)) + { + sas.removeAttribute(const_WaveUnderlineColor); + if (asc.underColor != null) sas.addAttribute(const_WaveUnderlineColor, asc.underColor); + } + + + Object annotationType = at.getAttribute("annotationType"); + if (annotationType != null) + { + Boolean v_isUseHighlightColor = null; + Boolean v_isInheritForegroundColor = null; + Boolean v_isUseWaveUnderlineColor = null; + + if (annotation) + { + v_isUseHighlightColor = (Boolean) isUseHighlightColor.invoke(annotationType, new Object[0]); + v_isInheritForegroundColor = (Boolean) isInheritForegroundColor.invoke(annotationType, new Object[0]); + v_isUseWaveUnderlineColor = (Boolean) isUseWaveUnderlineColor.invoke(annotationType, new Object[0]); + + if (v_isUseHighlightColor) + { + setHighlight.invoke(annotationType, asc.a_getHighlight); + } + + if (v_isInheritForegroundColor) + { + setForegroundColor.invoke(annotationType, asc.a_getForegroundColor); + } + + if (v_isUseWaveUnderlineColor) + { + + + setWaveUnderlineColor.invoke(annotationType, asc.a_getWaveUnderlineColor); + } + } + } + + return sas; + } + + private static void process_set(String set_name, Collection data, boolean annotation) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException + { + + + System.out.println("\n// "); + LinkedList conf_annotations = new LinkedList(); + + for (AttributeSet at : data) + { + String name = (String) at.getAttribute(const_DisplayName); + java.awt.Color bgColor = (java.awt.Color) at.getAttribute(StyleConstants.Background); + java.awt.Color fgColor = (java.awt.Color) at.getAttribute(StyleConstants.Foreground); + java.awt.Color underColor = (java.awt.Color) at.getAttribute(const_WaveUnderlineColor); + Object annotationType = at.getAttribute("annotationType"); + Boolean v_isUseHighlightColor = null; + Boolean v_isInheritForegroundColor = null; + Boolean v_isUseWaveUnderlineColor = null; + java.awt.Color a_getHighlight = null; + java.awt.Color a_getForegroundColor = null; + java.awt.Color a_getWaveUnderlineColor = null; + Boolean bold = (Boolean) at.getAttribute(javax.swing.text.StyleConstants.FontConstants.Bold); + Boolean italic = (Boolean) at.getAttribute(javax.swing.text.StyleConstants.FontConstants.Italic); + + if (annotation) + { + v_isUseHighlightColor = (Boolean) isUseHighlightColor.invoke(annotationType, new Object[0]); + v_isInheritForegroundColor = (Boolean) isInheritForegroundColor.invoke(annotationType, new Object[0]); + v_isUseWaveUnderlineColor = (Boolean) isUseWaveUnderlineColor.invoke(annotationType, new Object[0]); + a_getHighlight = (java.awt.Color) getHighlight.invoke(annotationType, new Object[0]); + a_getForegroundColor = (java.awt.Color) getForegroundColor.invoke(annotationType, new Object[0]); + a_getWaveUnderlineColor = (java.awt.Color) getWaveUnderlineColor.invoke(annotationType, new Object[0]); + } + + conf_annotations.add(new AttributeSetConfigured(name, + bgColor, + fgColor, + underColor, + v_isUseHighlightColor, + v_isInheritForegroundColor, + v_isUseWaveUnderlineColor, + a_getHighlight, + a_getForegroundColor, + a_getWaveUnderlineColor, + bold, + italic)); + + } + + AttributeSetConfigured.compileSet(set_name, conf_annotations); + System.out.println("// "); + } + + +}