* @param domain The domain (ie MapEditor or MapPart) for which we are tacking tools
* @return PaletteRoot suitable for use with a PaletteView
*/
public static PaletteRoot createPalette() {
PaletteRoot root = new PaletteRoot();
IToolManager toolManager = ApplicationGIS.getToolManager();
List<PaletteContainer> categories = new ArrayList<PaletteContainer>();
// Normal GEF Tools (SelectionTool etc...)
// PaletteContainer controlGroup = createControlGroup(root);
// categories.add(controlGroup);
PaletteToolbar navigation = new PaletteToolbar("Navigation");
// navigation.setInitialState(PaletteDrawer.INITIAL_STATE_OPEN);
// navigation.setDrawerType(ToolEntry.PALETTE_TYPE_TOOL);
navigation.setUserModificationPermission(PaletteContainer.PERMISSION_NO_MODIFICATION);
// navigation.setShowDefaultIcon(false);
for( ModalToolCategory category : toolManager.getModalToolCategories() ) {
// 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);
}