- public static SortedMap<String, UserColourScheme> getUserColourSchemes()
- {
- return userColourSchemes;
- }
-
- public static void initUserColourSchemes(String files)
- {
- userColourSchemes = new TreeMap<String, UserColourScheme>();
-
- if (files == null || files.length() == 0)
- {
- return;
- }
-
- // In case colours can't be loaded, we'll remove them
- // from the default list here.
- StringBuffer coloursFound = new StringBuffer();
- StringTokenizer st = new StringTokenizer(files, "|");
- while (st.hasMoreElements())
- {
- String file = st.nextToken();
- try
- {
- UserColourScheme ucs = loadColours(file);
- if (ucs != null)
- {
- if (coloursFound.length() > 0)
- {
- coloursFound.append("|");
- }
- coloursFound.append(file);
- String name = ucs.getName();
- userColourSchemes.put(name, ucs);
- ColourSchemes.getInstance().registerColourScheme(ucs);
- }
- } catch (Exception ex)
- {
- System.out.println("Error loading User ColourFile\n" + ex);
- }
- }
- if (!files.equals(coloursFound.toString()))
- {
- if (coloursFound.toString().length() > 1)
- {
- Cache.setProperty(USER_DEFINED_COLOURS, coloursFound.toString());
- }
- else
- {
- Cache.applicationProperties.remove(USER_DEFINED_COLOURS);
- }
- }
- }
-
- public static void removeColourFromDefaults(String target)
- {
- // The only way to find colours by name is to load them in
- // In case colours can't be loaded, we'll remove them
- // from the default list here.
-
- userColourSchemes = new TreeMap<String, UserColourScheme>();
-
- StringBuffer coloursFound = new StringBuffer();
- StringTokenizer st = new StringTokenizer(
- Cache.getProperty(USER_DEFINED_COLOURS), "|");
-
- while (st.hasMoreElements())
- {
- String file = st.nextToken();
- try
- {
- UserColourScheme ucs = loadColours(file);
- if (ucs != null && !ucs.getSchemeName().equals(target))
- {
- if (coloursFound.length() > 0)
- {
- coloursFound.append("|");
- }
- coloursFound.append(file);
- userColourSchemes.put(ucs.getSchemeName(), ucs);
- }
- } catch (Exception ex)
- {
- System.out.println("Error loading User ColourFile\n" + ex);
- }
- }
-
- if (coloursFound.toString().length() > 1)
- {
- Cache.setProperty(USER_DEFINED_COLOURS, coloursFound.toString());
- }
- else
- {
- Cache.applicationProperties.remove(USER_DEFINED_COLOURS);
- }
-
- }
-
- @Override
- public void caseSensitive_actionPerformed(ActionEvent e)
- {
- resetButtonPanel(caseSensitive.isSelected());
- lcaseColour.setEnabled(caseSensitive.isSelected());
- }
-