// Simple PaletteDrawer (no icon for the tool category at this time)
String shortcut = shortcut(category.getName());
String name = fixLabel(category.getName());
PaletteContainer container;
if( category.getId().equals("org.locationtech.udig.tool.category.zoom") ||
category.getId().equals("org.locationtech.udig.tool.category.pan")){
container = navigation;
}
else {
PaletteDrawer drawer = new PaletteDrawer(name);
drawer.setId( category.getId() );
if( category == toolManager.getActiveCategory()){
drawer.setInitialState(PaletteDrawer.INITIAL_STATE_OPEN);
}
else {
drawer.setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
}
drawer.setDrawerType(ToolEntry.PALETTE_TYPE_TOOL);
drawer.setUserModificationPermission(PaletteContainer.PERMISSION_NO_MODIFICATION);
drawer.setShowDefaultIcon(false);
if( shortcut != null ){
drawer.setDescription( "("+shortcut+")" );
}
container = drawer;
}
category.container( container ); // hook up so container can cycle tools on keypress
for( ModalItem modalItem : category ) {
String label = fixLabel(modalItem.getName());
String keypress = shortcut(modalItem.getName());
ToolEntry tool = new MapToolEntry(label, modalItem, keypress, category.getId());
//set the default tool
if(modalItem.getId().equals(DEFAULT_ID)){
root.setDefaultEntry(tool);
}
container.add(tool);
}
if( container == navigation){
continue; // don't add navigation container multiple times
}
categories.add(container);