MapPart currentEditor = tools.currentEditor;
if (currentEditor != null) {
if (currentEditor instanceof MapEditorWithPalette) {
MapEditorWithPalette editor2 = (MapEditorWithPalette) currentEditor;
MapEditDomain editDomain = editor2.getEditDomain();
PaletteViewer paletteViewer = editDomain.getPaletteViewer();
if( paletteViewer != null ){
for( MapToolEntry entry : this.mapToolEntries ) {
if (paletteViewer.getEditPartRegistry().get(entry) != null) {
paletteViewer.setActiveTool(entry);