// apply configuration (too long!!)
IPreferenceStore store = HTMLPlugin.getDefault().getPreferenceStore();
String xml = store.getString(HTMLPlugin.PREF_PALETTE_ITEMS);
if(xml!=null){
FuzzyXMLDocument doc = new FuzzyXMLParser().parse(xml);
// apply visible
FuzzyXMLNode[] groups = HTMLUtil.selectXPathNodes(doc.getDocumentElement(),"/palette/groups/group");
for(int i=0;i<groups.length;i++){
FuzzyXMLElement group = (FuzzyXMLElement)groups[i];
String name = group.getAttributeNode("name").getValue();
boolean visible = new Boolean(group.getAttributeNode("visible").getValue()).booleanValue();
List entries = viewer.getPaletteRoot().getChildren();
PaletteDrawer drawer = null;
for(int j=0;j<entries.size();j++){
drawer = (PaletteDrawer)entries.get(j);
if(drawer.getLabel().equals(name)){
drawer.setVisible(visible);
break;
} else {
drawer =null;
}
}
if(drawer==null){
drawer = new PaletteDrawer(name);
drawer.setVisible(visible);
viewer.getPaletteRoot().add(drawer);
}
}
// add user items
FuzzyXMLNode[] items = HTMLUtil.selectXPathNodes(doc.getDocumentElement(),"/palette/items/item");
String[] categories = getCategories();
for(int i=0;i<items.length;i++){
FuzzyXMLElement item = (FuzzyXMLElement)items[i];
String name = item.getAttributeNode("name").getValue();
String group = item.getAttributeNode("group").getValue();