InputStreamReader in = new InputStreamReader(new FileInputStream(\r
file), "UTF-8");\r
\r
- jalview.binding.JalviewUserColours jucs = new jalview.binding.JalviewUserColours();\r
- jucs = (jalview.binding.JalviewUserColours) jucs.unmarshal(in);\r
+ jalview.schemabinding.version2.JalviewUserColours jucs\r
+ = new jalview.schemabinding.version2.JalviewUserColours();\r
\r
- newColours = new Color[jucs.getColourCount()];\r
+ org.exolab.castor.xml.Unmarshaller unmar\r
+ = new org.exolab.castor.xml.Unmarshaller(jucs);\r
+ jucs = (jalview.schemabinding.version2.JalviewUserColours) unmar.unmarshal( in );\r
+\r
+ newColours = new Color[jucs.getColourCount()];\r
\r
for (int i = 0; i < 24; i++)\r
{\r
}\r
catch (Exception ex)\r
{\r
- System.out.println("Error loading User ColourFile\n"+ex);\r
- }\r
+ //Could be Archive Jalview format\r
+ try{\r
+ InputStreamReader in = new InputStreamReader(new FileInputStream(\r
+ file), "UTF-8");\r
+\r
+ jalview.binding.JalviewUserColours jucs\r
+ = new jalview.binding.JalviewUserColours();\r
+\r
+ jucs = (jalview.binding.JalviewUserColours) jucs.unmarshal(in);\r
\r
+ newColours = new Color[jucs.getColourCount()];\r
+\r
+ for (int i = 0; i < 24; i++)\r
+ {\r
+ newColours[i] = new Color(Integer.parseInt(\r
+ jucs.getColour(i).getRGB(), 16));\r
+ }\r
+ if (newColours != null)\r
+ {\r
+ ucs = new UserColourScheme(newColours);\r
+ ucs.setName(jucs.getSchemeName());\r
+ }\r
+ }catch(Exception ex2)\r
+ { ex2.printStackTrace(); }\r
+\r
+ if(newColours==null)\r
+ System.out.println("Error loading User ColourFile\n"+ex);\r
+ }\r
\r
return ucs;\r
}\r