Naming fixed where needed

master
Wizard Atman 11 years ago
parent a3cb7fc4ac
commit af75aa5783

@ -1,7 +1,7 @@
/* /* Copyright (C) Edward M. Kagan - All Rights Reserved
* To change this license header, choose License Headers in Project Properties. * Unauthorized copying of this file, via any medium is strictly prohibited
* To change this template file, choose Tools | Templates * Proprietary and confidential
* and open the template in the editor. * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
@ -9,8 +9,7 @@ import java.awt.Color;
import java.util.List; import java.util.List;
/** /**
* * @author Edward M. Kagan <atman@idp-crew.com>
* @author Clochard Pagan <pagan@idp-crew.com>
*/ */
public class AttributeSetConfigured { public class AttributeSetConfigured {

@ -1,7 +1,7 @@
/* Copyright (C) Edward M. Kagan - All Rights Reserved /* Copyright (C) Edward M. Kagan - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited * Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential * Proprietary and confidential
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015 * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
@ -11,7 +11,7 @@ import static org.idp.laf.Color.ColorClass.AT;
import static org.idp.laf.Color.ColorClass.SF; import static org.idp.laf.Color.ColorClass.SF;
/** /**
* @author Edward M. Kagan <pagan@idp-crew.com> * @author Edward M. Kagan <atman@idp-crew.com>
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public class Color implements Serializable{ public class Color implements Serializable{

@ -1,7 +1,7 @@
/* /* Copyright (C) Edward M. Kagan - All Rights Reserved
* To change this license header, choose License Headers in Project Properties. * Unauthorized copying of this file, via any medium is strictly prohibited
* To change this template file, choose Tools | Templates * Proprietary and confidential
* and open the template in the editor. * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
@ -9,8 +9,7 @@ import java.awt.Color;
import java.util.HashMap; import java.util.HashMap;
/** /**
* * @author Edward M. Kagan <atman@idp-crew.com>
* @author Clochard Pagan <pagan@idp-crew.com>
*/ */
public class ColorTheme { public class ColorTheme {
@ -204,7 +203,7 @@ private static final AttributeSetConfigured [] lang_Java = {
new AttributeSetConfigured ("string-escape-invalid", null, null, null, null, null, null, null, null, null, null, null), new AttributeSetConfigured ("string-escape-invalid", null, null, null, null, null, null, null, null, null, null, null),
new AttributeSetConfigured ("keyword", null, new Color (234, 82, 128, 255), null, null, null, null, null, null, null, null, null), new AttributeSetConfigured ("keyword", null, new Color (234, 82, 128, 255), null, null, null, null, null, null, null, null, null),
new AttributeSetConfigured ("mod-local-variable", null, null, null, null, null, null, null, null, null, null, null), new AttributeSetConfigured ("mod-local-variable", null, null, null, null, null, null, null, null, null, null, null),
new AttributeSetConfigured ("identifier", null, new Color (0, 255, 255, 255), 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 ("mod-field", null, new Color (255, 255, 255, 255), null, null, null, null, null, null, null, null, null), new AttributeSetConfigured ("mod-field", null, new Color (255, 255, 255, 255), null, null, null, null, null, null, null, null, null),
new AttributeSetConfigured ("javadoc-tag", null, new Color (255, 0, 102, 255), null, null, null, null, null, null, null, null, null), new AttributeSetConfigured ("javadoc-tag", null, new Color (255, 0, 102, 255), null, null, null, null, null, null, null, null, null),
new AttributeSetConfigured ("mod-method", null, new Color (141, 141, 222, 255), null, null, null, null, null, null, null, null, null), new AttributeSetConfigured ("mod-method", null, new Color (141, 141, 222, 255), null, null, null, null, null, null, null, null, null),

@ -1,7 +1,7 @@
/* Copyright (C) Edward M. Kagan - All Rights Reserved /* Copyright (C) Edward M. Kagan - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited * Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential * Proprietary and confidential
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015 * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
@ -9,7 +9,7 @@ import java.util.ArrayList;
import static org.idp.laf.Kernel.color_scheme_loaded; import static org.idp.laf.Kernel.color_scheme_loaded;
/** /**
* @author Edward M. Kagan <pagan@idp-crew.com> * @author Edward M. Kagan <atman@idp-crew.com>
* @author Helen A. Kukhar <carpenter@idp-crew.com> * @author Helen A. Kukhar <carpenter@idp-crew.com>
*/ */
public class Defaults { public class Defaults {

@ -1,20 +1,18 @@
/* Copyright (C) Edward M. Kagan - All Rights Reserved /* Copyright (C) Edward M. Kagan - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited * Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential * Proprietary and confidential
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015 * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import org.openide.modules.ModuleInstall; import org.openide.modules.ModuleInstall;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences; import org.openide.util.NbPreferences;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
/** /**
* @author Edward M. Kagan <pagan@idp-crew.com> * @author Edward M. Kagan <atman@idp-crew.com>
*/ */
public class Installer extends ModuleInstall public class Installer extends ModuleInstall
{ {
@ -32,30 +30,28 @@ public class Installer extends ModuleInstall
} }
}); });
// System.out.println(">>>>>>>>>>>>>>> L&F = " + UIManager.getLookAndFeel().getName()); Preferences prefs = NbPreferences.root().node( "laf" ); //NOI18N
// if( !prefs.getBoolean("idp.titan.installed", false) ) //NOI18N
//// if (UIManager.getLookAndFeel().getName().equals(NbBundle.getMessage(TitanLookAndFeel.class, "LBL_TITAN")))
//// {
//
// //}
//
//
final Preferences prefs = NbPreferences.root().node( "laf" ); //NOI18N
if( !prefs.getBoolean("idp.titan_editor.installed", false) ) //NOI18N
{ {
prefs.putBoolean("idp.titan.installed", true ); //NOI18N
WindowManager.getDefault().invokeWhenUIReady( new Runnable() WindowManager.getDefault().invokeWhenUIReady( new Runnable()
{ {
@Override @Override
public void run() { public void run() {
TitanEditor.load_editor(); TitanEditor.load_editor(true);
prefs.putBoolean("idp.titan_editor.installed", true ); //NOI18N }
});
}
else
{
WindowManager.getDefault().invokeWhenUIReady( new Runnable()
{
@Override
public void run() {
TitanEditor.load_editor(false);
} }
}); });
} }
@ -69,7 +65,7 @@ public class Installer extends ModuleInstall
if (TitanLookAndFeel.self_install()) if (TitanLookAndFeel.self_install())
{ {
System.out.print("Setting up anti-aliasing hints to conf file..."); System.out.print("Setting up anti-aliasing hints to conf file...");
if (Kernel.setup_font_antialiaing_hints()) if (!Kernel.setup_font_antialiaing_hints())
{ {
System.err.println("FAIL"); System.err.println("FAIL");
return; return;

@ -1,7 +1,7 @@
/* Copyright (C) Edward M. Kagan - All Rights Reserved /* Copyright (C) Edward M. Kagan - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited * Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential * Proprietary and confidential
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015 * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
@ -14,7 +14,6 @@ import java.io.IOException;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystems; import java.nio.file.FileSystems;
@ -36,20 +35,16 @@ import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet; import javax.swing.text.html.StyleSheet;
import org.idp.laf.tools.Scheme2Java; import org.idp.laf.tools.Scheme2Java;
import org.openide.util.Exceptions; import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
/** /**
* @author Edward M. Kagan <pagan@idp-crew.com> * @author Edward M. Kagan <atman@idp-crew.com>
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public class Kernel { public class Kernel {
private static final boolean w_init = false; private static final boolean w_init = false;
public static Color[] color_scheme_loaded; public static Color[] color_scheme_loaded;
private static final String scheme_file_name = "netbeans.idp_scheme"; private static final String scheme_file_name = "netbeans.idp_scheme";
public static void load_kernel () public static void load_kernel ()
@ -76,13 +71,6 @@ public class Kernel {
} }
} }
// private static boolean prepare_titan_laf ()
// {
// // UIManager.put("nb.forceui", true);
// // UIManager.put("netbeans.plaf.disable.ui.customizations", false);
// return ;
// }
public static boolean setup_font_antialiaing_hints () public static boolean setup_font_antialiaing_hints ()
{ {
try try
@ -138,23 +126,15 @@ public class Kernel {
private static void apply_border_managment_hints () private static void apply_border_managment_hints ()
{ {
// UIManager.put("ComboBoxUI", "javax.swing.plaf.basic.BasicComboBoxUI");
// UIManager.put("SliderUI", "javax.swing.plaf.basic.BasicSliderUI");
// UIManager.put("TreeUI", "javax.swing.plaf.basic.BasicTreeUI");
javax.swing.border.EmptyBorder invisable_border = new EmptyBorder(0,0,0,0); javax.swing.border.EmptyBorder invisable_border = new EmptyBorder(0,0,0,0);
UIManager.put ("EditorPane.border", invisable_border); // Editor FUCKING LINE! UIManager.put ("EditorPane.border", invisable_border); // Editor FUCKING LINE!
UIManager.put ("ComboBox.border", invisable_border); // Editor FUCKING LINE! UIManager.put ("ComboBox.border", invisable_border); // Editor FUCKING LINE!
javax.swing.border.EmptyBorder spinner_border = new EmptyBorder(1,1,1,1); javax.swing.border.EmptyBorder spinner_border = new EmptyBorder(1,1,1,1);
UIManager.put("Spinner.border", spinner_border); UIManager.put("Spinner.border", spinner_border);
UIManager.put("Spinner.arrowButtonBorder", spinner_border); UIManager.put("Spinner.arrowButtonBorder", spinner_border);
UIManager.put ("TabbedContainer.editor.outerBorder", UIManager.put ("TabbedContainer.editor.outerBorder",
new LineBorder(new java.awt.Color(24, 24, 24, 255), 1)); // Editor border new LineBorder(new java.awt.Color(24, 24, 24, 255), 1)); // Editor border
@ -255,9 +235,6 @@ public class Kernel {
UIManager.put(o, status_border); UIManager.put(o, status_border);
} }
// </editor-fold> // </editor-fold>
// UIManager.put("nb.forceui", true);
// UIManager.put("netbeans.plaf.disable.ui.customizations", false);
} }

@ -1,12 +1,12 @@
/* Copyright (C) Edward M. Kagan - All Rights Reserved /* Copyright (C) Edward M. Kagan - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited * Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential * Proprietary and confidential
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015 * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
/** /**
* @author Edward M. Kagan <pagan@idp-crew.com> * @author Edward M. Kagan <atman@idp-crew.com>
*/ */
public class Keys { public class Keys {

@ -1,20 +1,16 @@
/* /* Copyright (C) Edward M. Kagan - All Rights Reserved
* To change this license header, choose License Headers in Project Properties. * Unauthorized copying of this file, via any medium is strictly prohibited
* To change this template file, choose Tools | Templates * Proprietary and confidential
* and open the template in the editor. * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.prefs.BackingStoreException; import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
@ -24,43 +20,37 @@ import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants; import javax.swing.text.StyleConstants;
import org.openide.util.Exceptions; import org.openide.util.Exceptions;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences; import org.openide.util.NbPreferences;
/** /**
*
* @author Edward M. Kagan <atman@idp-crew.com> * @author Edward M. Kagan <atman@idp-crew.com>
*/ */
@SuppressWarnings ({"rawtypes","unchecked"}) @SuppressWarnings ({"rawtypes","unchecked"})
public class TitanEditor { public class TitanEditor {
private static final String COLOR_MODEL_CLASS_NAME = "org.netbeans.modules.options.colors.ColorModel"; //NOI18N 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 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 String ANNOTATION_TYPE_CLASS_NAME = "org.netbeans.editor.AnnotationType"; //NOI18N
private static final String PROVIDER_CLASS_NAME = "org.netbeans.modules.versioning.util.OptionsPanelColorProvider"; //NOI18N private static final String PROVIDER_CLASS_NAME = "org.netbeans.modules.versioning.util.OptionsPanelColorProvider"; //NOI18N
// private static final String PROVIDER_GIT_CLASS_NAME = "org.netbeans.modules.git.options.AnnotationColorProvider"; //NOI18N private static final String PROVIDER_GIT_CLASS_NAME = "org.netbeans.modules.git.GitModuleConfig"; //NOI18N
// private static final String PROVIDER_SVN_CLASS_NAME = "org.netbeans.modules.subversion.options.AnnotationColorProvider"; //NOI18N private static final String PROVIDER_SVN_CLASS_NAME = "org.netbeans.modules.subversion.SvnModuleConfig"; //NOI18N
// private static final String PROVIDER_HG_CLASS_NAME = "org.netbeans.modules.mercurial.options.AnnotationColorProvider"; //NOI18N private static final String PROVIDER_HG_CLASS_NAME = "org.netbeans.modules.mercurial.HgModuleConfig"; //NOI18N
private static final String PROVIDER_GIT_CLASS_NAME = "org.netbeans.modules.git.GitModuleConfig"; //NOI18N
private static final String PROVIDER_SVN_CLASS_NAME = "org.netbeans.modules.subversion.SvnModuleConfig"; //NOI18N
private static final String PROVIDER_HG_CLASS_NAME = "org.netbeans.modules.mercurial.HgModuleConfig"; //NOI18N
private static final String PROVIDER_DIFF_CLASS_NAME = "org.netbeans.modules.diff.DiffModuleConfig"; //NOI18N private static final String PROVIDER_DIFF_CLASS_NAME = "org.netbeans.modules.diff.DiffModuleConfig"; //NOI18N
private static final boolean no_load = false; private static final boolean no_load = false;
private static final String DEFAULT_THEME_NAME = "NetBeans 5.5"; //NOI18N
private static ClassLoader working_classLoader = null;
private static Class COLOR_MODEL; private static Class COLOR_MODEL;
private static Class EDITOR_SETTINGS; private static Class EDITOR_SETTINGS;
private static Class ANNOTATION_TYPE; private static Class ANNOTATION_TYPE;
private static Class GIT_CONFIG;
private static Field DisplayName;
private static Field WaveUnderlineColor; private static Field WaveUnderlineColor;
private static Method getName; private static Method getName;
private static Method getProfiles;
private static Method getCurrentProfile; private static Method getCurrentProfile;
private static Method setCurrentProfile; private static Method setCurrentProfile;
@ -87,35 +77,22 @@ public class TitanEditor {
private static Method getLanguages; private static Method getLanguages;
private static Object const_DisplayName;
private static Object const_WaveUnderlineColor; private static Object const_WaveUnderlineColor;
private static Object colorModel; private static Object colorModel;
private static final String DEFAULT_THEME_NAME = "NetBeans 5.5"; //NOI18N
//private static final String TITAN_THEME_NAME = NbBundle.getMessage(TitanLookAndFeel.class, "LBL_TITAN");
private static Class provider_GIT = null; private static Class provider_GIT = null;
private static Class provider_SVN = null; private static Class provider_SVN = null;
private static Class provider_HG = null; private static Class provider_HG = null;
private static Class provider_CLASS = null; private static Class provider_CLASS = null;
private static Class provider_DIFF = null; private static Class provider_DIFF = null;
//private static Method provider_getInstance;
// private static Method provider_getColors;
// private static Method provider_colorsChanged;
private static Method provider_getDefault; private static Method provider_getDefault;
private static Method provider_getPreferences; private static Method provider_getPreferences;
private static ClassLoader working_classLoader = null;
private static void extractDiffModule () throws IllegalAccessException private static void extractDiffModule () throws IllegalAccessException
{ {
if (provider_DIFF != null) if (provider_DIFF != null)
{ {
HashMap <String, Integer> linkMap = new HashMap<String, Integer>(); HashMap <String, Integer> linkMap = new HashMap<String, Integer>();
java.awt.Color nb_diff_added_color = (java.awt.Color) UIManager.get ("nb.diff.added.color"); java.awt.Color nb_diff_added_color = (java.awt.Color) UIManager.get ("nb.diff.added.color");
@ -175,17 +152,13 @@ public class TitanEditor {
res += "\n"; res += "\n";
} }
} }
} catch (InvocationTargetException ex) {
Exceptions.printStackTrace(ex);
} }
catch (InvocationTargetException ex) {}
res += "};\n"; res += "};\n";
res += "// </editor-fold>\n"; res += "// </editor-fold>\n";
System.out.println(res); System.out.println(res);
} }
} }
private static void applyColorForDiffModule () throws IllegalAccessException, IllegalArgumentException, InvocationTargetException private static void applyColorForDiffModule () throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
@ -212,10 +185,8 @@ public class TitanEditor {
getName = ANNOTATION_TYPE.getDeclaredMethod("getName", new Class[0]); getName = ANNOTATION_TYPE.getDeclaredMethod("getName", new Class[0]);
DisplayName = EDITOR_SETTINGS.getField("DisplayName"); //NOI18N
WaveUnderlineColor = EDITOR_SETTINGS.getField("WaveUnderlineColor"); //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 getCurrentProfile = COLOR_MODEL.getDeclaredMethod( "getCurrentProfile", new Class[0] ); //NOI18N
setCurrentProfile = COLOR_MODEL.getDeclaredMethod( "setCurrentProfile", String.class ); //NOI18N setCurrentProfile = COLOR_MODEL.getDeclaredMethod( "setCurrentProfile", String.class ); //NOI18N
@ -241,7 +212,6 @@ public class TitanEditor {
getLanguages = COLOR_MODEL.getDeclaredMethod( "getLanguages", new Class[0] ); //NOI18N getLanguages = COLOR_MODEL.getDeclaredMethod( "getLanguages", new Class[0] ); //NOI18N
const_DisplayName = DisplayName.get(EDITOR_SETTINGS);
const_WaveUnderlineColor = WaveUnderlineColor.get(EDITOR_SETTINGS); const_WaveUnderlineColor = WaveUnderlineColor.get(EDITOR_SETTINGS);
colorModel = COLOR_MODEL.newInstance(); colorModel = COLOR_MODEL.newInstance();
@ -256,22 +226,23 @@ public class TitanEditor {
if (provider_CLASS != null) if (provider_CLASS != null)
{ {
try
try { {
provider_HG = working_classLoader.loadClass(PROVIDER_HG_CLASS_NAME); provider_HG = working_classLoader.loadClass(PROVIDER_HG_CLASS_NAME);
} catch (ClassNotFoundException ex) {} }
catch (ClassNotFoundException ex) {}
try { try
{
provider_SVN = working_classLoader.loadClass(PROVIDER_SVN_CLASS_NAME); provider_SVN = working_classLoader.loadClass(PROVIDER_SVN_CLASS_NAME);
} catch (ClassNotFoundException ex) {} }
catch (ClassNotFoundException ex) {}
try { try
{
provider_GIT = working_classLoader.loadClass(PROVIDER_GIT_CLASS_NAME); provider_GIT = working_classLoader.loadClass(PROVIDER_GIT_CLASS_NAME);
} catch (ClassNotFoundException ex) {} }
catch (ClassNotFoundException ex) {}
// provider_getColors = provider_CLASS.getDeclaredMethod( "getColors", new Class[0] ); //NOI18N
// provider_colorsChanged = provider_CLASS.getDeclaredMethod( "colorsChanged", Map.class ); //NOI18N
} }
return true; return true;
@ -294,115 +265,55 @@ public class TitanEditor {
return false; return false;
} }
// private static String setup_theme () throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
// {
// // String current_profile
////
//// Set<String> profile_set = (Set<String>) 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, TITAN_THEME_NAME);
// //}
// return current_profile;
// }
// public static void remove_editor () throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
// {
// Set<String> profile_set = (Set<String>) getProfiles.invoke( colorModel, new Object[0] );
// boolean contain_target_theme = false;
// for (String str : profile_set)
// {
// if (str.equals(TITAN_THEME_NAME)) contain_target_theme = true;
// }
//
// if (contain_target_theme)
// {
// setCurrentProfile.invoke(colorModel, TITAN_THEME_NAME);
//
//
// setCurrentProfile.invoke(colorModel, DEFAULT_THEME_NAME);
// }
//
//
//
//
// }
private static void extractColorsForModule (String name, Class provider) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException private static void extractColorsForModule (String name, Class provider) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{ {
String res = "// <editor-fold desc=\"" +name + "\" defaultstate=\"collapsed\">" + String res = "// <editor-fold desc=\"" +name + "\" defaultstate=\"collapsed\">" +
"\npublic static final org.idp.laf.Color[] " + name + " = {\n"; "\npublic static final org.idp.laf.Color[] " + name + " = {\n";
if (provider != null) if (provider != null)
{ {
Preferences forModule = NbPreferences.forModule(provider); Preferences forModule = NbPreferences.forModule(provider);
try { try
{
for (String key : forModule.keys()) for (String key : forModule.keys())
{ {
java.awt.Color cc = new java.awt.Color(Integer.parseInt(forModule.get(key, null))); java.awt.Color cc = new java.awt.Color(Integer.parseInt(forModule.get(key, null)));
res += " " + (new Color(key, Color.ColorClass.AT, res += " " + (new Color(key, Color.ColorClass.AT,
cc.getRed(), cc.getRed(),
cc.getGreen(), cc.getGreen(),
cc.getBlue(), cc.getBlue(),
cc.getAlpha(), "")).getString() + ",\n"; cc.getAlpha(), "")).getString() + ",\n";
} }
} catch (BackingStoreException ex) {
Exceptions.printStackTrace(ex);
} }
catch (BackingStoreException ex) {}
} }
res += "};\n"; res += "};\n";
res += "// </editor-fold>\n"; res += "// </editor-fold>\n";
System.out.println(res); System.out.println(res);
} }
private static void applyColorForModule (Class provider, org.idp.laf.Color[] colors_theme) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException private static void applyColorForModule (Class provider, org.idp.laf.Color[] colors_theme) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{ {
if (provider != null) if (provider != null)
{ {
Preferences forModule = NbPreferences.forModule(provider); Preferences forModule = NbPreferences.forModule(provider);
try { for (org.idp.laf.Color cc : colors_theme)
for (String key : forModule.keys()) {
{ java.awt.Color toSet = (java.awt.Color) cc.getObject();
for (org.idp.laf.Color cc : colors_theme) forModule.put(cc.getPname(), String.valueOf(toSet.getRGB()));
{
if (cc.getName().equals(key))
{
java.awt.Color toSet = (java.awt.Color) cc.getObject();
forModule.put(key, String.valueOf(toSet.getRGB()));
break;
}
}
}
} catch (BackingStoreException ex) {
Exceptions.printStackTrace(ex);
} }
} }
} }
public static void load_editor () public static void load_editor (boolean first_run)
{ {
if (!pre_load()) return; if (!pre_load()) return;
try { try {
// String swith_back = (String) getCurrentProfile.invoke( colorModel, new Object[0] ); String swith_back = (String) getCurrentProfile.invoke( colorModel, new Object[0] );
if (no_load) if (no_load)
{ {
@ -432,54 +343,49 @@ public class TitanEditor {
extractColorsForModule ("SVN", provider_SVN); extractColorsForModule ("SVN", provider_SVN);
extractColorsForModule ("HG", provider_HG); extractColorsForModule ("HG", provider_HG);
extractDiffModule(); extractDiffModule();
} }
else else
{ {
setCurrentProfile.invoke(colorModel, DEFAULT_THEME_NAME);
Collection<AttributeSet> annotations = (Collection<AttributeSet>) getAnnotations.invoke(colorModel, DEFAULT_THEME_NAME);
Collection<AttributeSet> annotations_upd = apply_set ("annotations", annotations, true);
setAnnotations.invoke(colorModel, DEFAULT_THEME_NAME, annotations_upd);
Collection<AttributeSet> highlightings = (Collection<AttributeSet>) getHighlightings.invoke(colorModel, DEFAULT_THEME_NAME);
Collection<AttributeSet> highlightings_upd = apply_set ("highlightings", highlightings, false);
setHighlightings.invoke(colorModel, DEFAULT_THEME_NAME, highlightings_upd);
Object languages = getLanguages.invoke( colorModel, new Object[0] );
Set<String> languages_set = (Set<String>) languages;
setCurrentProfile.invoke(colorModel, DEFAULT_THEME_NAME); for (String str : languages_set)
Collection<AttributeSet> annotations = (Collection<AttributeSet>) getAnnotations.invoke(colorModel, DEFAULT_THEME_NAME); {
Collection<AttributeSet> annotations_upd = apply_set ("annotations", annotations, true); if (str.equals("All Languages") ||
setAnnotations.invoke(colorModel, DEFAULT_THEME_NAME, annotations_upd); str.equals("Java") ||
str.equals("C++") ||
Collection<AttributeSet> highlightings = (Collection<AttributeSet>) getHighlightings.invoke(colorModel, DEFAULT_THEME_NAME); str.equals("C"))
Collection<AttributeSet> highlightings_upd = apply_set ("highlightings", highlightings, false);
setHighlightings.invoke(colorModel, DEFAULT_THEME_NAME, highlightings_upd);
Object languages = getLanguages.invoke( colorModel, new Object[0] );
Set<String> languages_set = (Set<String>) languages;
for (String str : languages_set)
{ {
if (str.equals("All Languages") || Collection<AttributeSet> category = (Collection<AttributeSet>) getCategories.invoke(colorModel, DEFAULT_THEME_NAME, str);
str.equals("Java") || Collection<AttributeSet> category_upd = apply_set (str, category, false);
str.equals("C++") || setCategories.invoke(colorModel, DEFAULT_THEME_NAME, str, category_upd);
str.equals("C"))
{
Collection<AttributeSet> category = (Collection<AttributeSet>) getCategories.invoke(colorModel, DEFAULT_THEME_NAME, str);
Collection<AttributeSet> category_upd = apply_set (str, category, false);
setCategories.invoke(colorModel, DEFAULT_THEME_NAME, str, category_upd);
}
} }
}
if (!first_run)
{
setCurrentProfile.invoke(colorModel, swith_back);
}
else
{
applyColorForModule (provider_GIT, ColorTheme.GIT); applyColorForModule (provider_GIT, ColorTheme.GIT);
applyColorForModule (provider_SVN, ColorTheme.SVN); applyColorForModule (provider_SVN, ColorTheme.SVN);
applyColorForModule (provider_HG, ColorTheme.HG); applyColorForModule (provider_HG, ColorTheme.HG);
applyColorForDiffModule (); applyColorForDiffModule ();
}
// if (!first_run)
// {
// setCurrentProfile.invoke(colorModel, swith_back);
// }
} }
} catch (IllegalAccessException ex) { } catch (IllegalAccessException ex) {
Exceptions.printStackTrace(ex); Exceptions.printStackTrace(ex);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
@ -538,7 +444,6 @@ public class TitanEditor {
private static SimpleAttributeSet apply_colors (AttributeSetConfigured asc, AttributeSet at, boolean annotation) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException private static SimpleAttributeSet apply_colors (AttributeSetConfigured asc, AttributeSet at, boolean annotation) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{ {
SimpleAttributeSet sas = new SimpleAttributeSet(at); SimpleAttributeSet sas = new SimpleAttributeSet(at);
if (sas.isDefined(StyleConstants.Background)) sas.removeAttribute(StyleConstants.Background); if (sas.isDefined(StyleConstants.Background)) sas.removeAttribute(StyleConstants.Background);
@ -560,19 +465,14 @@ public class TitanEditor {
if (asc.underColor != null) sas.addAttribute(const_WaveUnderlineColor, asc.underColor); if (asc.underColor != null) sas.addAttribute(const_WaveUnderlineColor, asc.underColor);
} }
Object annotationType = at.getAttribute("annotationType"); Object annotationType = at.getAttribute("annotationType");
if (annotationType != null) if (annotationType != null)
{ {
Boolean v_isUseHighlightColor = null;
Boolean v_isInheritForegroundColor = null;
Boolean v_isUseWaveUnderlineColor = null;
if (annotation) if (annotation)
{ {
v_isUseHighlightColor = (Boolean) isUseHighlightColor.invoke(annotationType, new Object[0]); Boolean v_isUseHighlightColor = (Boolean) isUseHighlightColor.invoke(annotationType, new Object[0]);
v_isInheritForegroundColor = (Boolean) isInheritForegroundColor.invoke(annotationType, new Object[0]); Boolean v_isInheritForegroundColor = (Boolean) isInheritForegroundColor.invoke(annotationType, new Object[0]);
v_isUseWaveUnderlineColor = (Boolean) isUseWaveUnderlineColor.invoke(annotationType, new Object[0]); Boolean v_isUseWaveUnderlineColor = (Boolean) isUseWaveUnderlineColor.invoke(annotationType, new Object[0]);
if (v_isUseHighlightColor) if (v_isUseHighlightColor)
{ {
@ -586,8 +486,6 @@ public class TitanEditor {
if (v_isUseWaveUnderlineColor) if (v_isUseWaveUnderlineColor)
{ {
setWaveUnderlineColor.invoke(annotationType, asc.a_getWaveUnderlineColor); setWaveUnderlineColor.invoke(annotationType, asc.a_getWaveUnderlineColor);
} }
} }
@ -598,14 +496,11 @@ public class TitanEditor {
private static void process_set(String set_name, Collection<AttributeSet> data, boolean annotation) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException private static void process_set(String set_name, Collection<AttributeSet> data, boolean annotation) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{ {
System.out.println("\n// <editor-fold desc=\"" +set_name + "\" defaultstate=\"collapsed\">"); System.out.println("\n// <editor-fold desc=\"" +set_name + "\" defaultstate=\"collapsed\">");
LinkedList<AttributeSetConfigured> conf_annotations = new LinkedList<AttributeSetConfigured>(); LinkedList<AttributeSetConfigured> conf_annotations = new LinkedList<AttributeSetConfigured>();
for (AttributeSet at : data) for (AttributeSet at : data)
{ {
//String description; //String description;
String name = "BAD ASS"; String name = "BAD ASS";
Boolean v_isUseHighlightColor = null; Boolean v_isUseHighlightColor = null;
@ -615,12 +510,9 @@ public class TitanEditor {
java.awt.Color a_getForegroundColor = null; java.awt.Color a_getForegroundColor = null;
java.awt.Color a_getWaveUnderlineColor = null; java.awt.Color a_getWaveUnderlineColor = null;
if (annotation) if (annotation)
{ {
Object annotationType = at.getAttribute("annotationType"); Object annotationType = at.getAttribute("annotationType");
//System.out.println(">>> " + description + " | " + annotationType);
//String name = "BAD ASS";
if (annotationType != null) if (annotationType != null)
{ {
name = (String) getName.invoke(annotationType, new Object[0]); name = (String) getName.invoke(annotationType, new Object[0]);
@ -640,25 +532,14 @@ public class TitanEditor {
{ {
name = (String) at.getAttribute(javax.swing.text.StyleConstants.NameAttribute); name = (String) at.getAttribute(javax.swing.text.StyleConstants.NameAttribute);
} }
// else if (type == 2)
// {
// name = (String) at.getAttribute(javax.swing.text.StyleConstants.NameAttribute);
// }
//System.out.println(type + " : " + name );
java.awt.Color bgColor = (java.awt.Color) at.getAttribute(StyleConstants.Background); 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 fgColor = (java.awt.Color) at.getAttribute(StyleConstants.Foreground);
java.awt.Color underColor = (java.awt.Color) at.getAttribute(const_WaveUnderlineColor); java.awt.Color underColor = (java.awt.Color) at.getAttribute(const_WaveUnderlineColor);
Boolean bold = (Boolean) at.getAttribute(javax.swing.text.StyleConstants.FontConstants.Bold); Boolean bold = (Boolean) at.getAttribute(javax.swing.text.StyleConstants.FontConstants.Bold);
Boolean italic = (Boolean) at.getAttribute(javax.swing.text.StyleConstants.FontConstants.Italic); Boolean italic = (Boolean) at.getAttribute(javax.swing.text.StyleConstants.FontConstants.Italic);
conf_annotations.add(new AttributeSetConfigured(name, conf_annotations.add(new AttributeSetConfigured(name,
bgColor, bgColor,
fgColor, fgColor,
@ -671,7 +552,6 @@ public class TitanEditor {
a_getWaveUnderlineColor, a_getWaveUnderlineColor,
bold, bold,
italic)); italic));
} }
AttributeSetConfigured.compileSet(set_name, conf_annotations); AttributeSetConfigured.compileSet(set_name, conf_annotations);

@ -1,7 +1,7 @@
/* Copyright (C) Edward M. Kagan - All Rights Reserved /* Copyright (C) Edward M. Kagan - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited * Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential * Proprietary and confidential
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015 * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
@ -11,11 +11,10 @@ import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.metal.MetalLookAndFeel;
import static javax.swing.plaf.metal.MetalLookAndFeel.getCurrentTheme; import static javax.swing.plaf.metal.MetalLookAndFeel.getCurrentTheme;
import static javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme; import static javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences; import org.openide.util.NbPreferences;
/** /**
* @author Edward M. Kagan <pagan@idp-crew.com> * @author Edward M. Kagan <atman@idp-crew.com>
*/ */
public class TitanLookAndFeel extends MetalLookAndFeel { public class TitanLookAndFeel extends MetalLookAndFeel {
@ -42,44 +41,7 @@ public class TitanLookAndFeel extends MetalLookAndFeel {
return true; return true;
} }
// public static void self_remove () @Override
// {
// UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
//
// for (UIManager.LookAndFeelInfo lafi : installedLookAndFeels)
// {
// System.out.println(">>>> " + lafi.getName());
// String laf_name = NbBundle.getMessage(TitanLookAndFeel.class, "LBL_TITAN");
// if (lafi.getName().equals(laf_name))
// {
// System.out.print("LAF Persist - removing...");
// int i = 0;
// UIManager.LookAndFeelInfo[] toSet = new UIManager.LookAndFeelInfo[installedLookAndFeels.length - 1];
// for (UIManager.LookAndFeelInfo copy : installedLookAndFeels)
// {
// if (!copy.getName().equals(laf_name))
// {
// toSet[i] = copy;
// i++;
// }
// }
// UIManager.setInstalledLookAndFeels(toSet);
// System.out.println("OK");
// System.out.print("Setting Metal theme by default...");
// try {
// UIManager.setLookAndFeel(MetalLookAndFeel.class.getName());
// System.out.print("OK");
// } catch (Exception ex) {
// System.out.print("FAIL");
// }
// return;
// }
// }
//
// System.out.println("NO LAF - nothing to remove.");
// }
@Override
public String getName() { public String getName() {
return "[idP!] Titan"; //NOI18N return "[idP!] Titan"; //NOI18N
} }

@ -1,7 +1,7 @@
/* Copyright (C) Edward M. Kagan - All Rights Reserved /* Copyright (C) Edward M. Kagan - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited * Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential * Proprietary and confidential
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015 * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf; package org.idp.laf;
@ -10,10 +10,9 @@ import javax.swing.UIDefaults;
import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource; import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.metal.MetalTheme; import javax.swing.plaf.metal.MetalTheme;
import org.openide.util.NbBundle;
/** /**
* @author Edward M. Kagan <pagan@idp-crew.com> * @author Edward M. Kagan <atman@idp-crew.com>
*/ */
public class TitanTheme extends MetalTheme { public class TitanTheme extends MetalTheme {

@ -1,14 +1,14 @@
/* Copyright (C) Edward M. Kagan - All Rights Reserved /* Copyright (C) Edward M. Kagan - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited * Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential * Proprietary and confidential
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015 * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
*/ */
package org.idp.laf.tools; package org.idp.laf.tools;
import org.idp.laf.Color; import org.idp.laf.Color;
/** /**
* @author Edward M. Kagan <pagan@idp-crew.com> * @author Edward M. Kagan <atman@idp-crew.com>
*/ */
public class Scheme2Java { public class Scheme2Java {

Loading…
Cancel
Save