Project

General

Profile

« Previous | Next » 

Revision c0a29cdd

Added by Patrick Plitzner over 8 years ago

Fix double click on taxa in taxon navigator and search results

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerUtil.java
12 12
import java.util.HashMap;
13 13
import java.util.Map;
14 14

  
15
import org.eclipse.core.commands.Command;
15 16
import org.eclipse.core.runtime.IConfigurationElement;
16 17
import org.eclipse.core.runtime.IExtensionRegistry;
17 18
import org.eclipse.core.runtime.Platform;
19
import org.eclipse.ui.PlatformUI;
20
import org.eclipse.ui.commands.ICommandService;
18 21

  
19 22
import eu.etaxonomy.taxeditor.model.MessagingUtils;
20 23

  
......
49 52
                        String viewerName = configElement.getAttribute("viewerName"); //$NON-NLS-1$
50 53
                        Class<?> selectionClass = Class.forName(configElement.getAttribute("selection")); //$NON-NLS-1$
51 54
                        if(selectionClass.isAssignableFrom(input.getClass())){
52
                            commandViewerNameMap.put(commandId, viewerName);
55
                            ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
56
                            Command command = commandService.getCommand(commandId);
57
                            //TODO: maybe pass the command directly instead of just the command id
58
                            if(command.isEnabled()){
59
                                commandViewerNameMap.put(commandId, viewerName);
60
                            }
53 61
                        }
54 62
                    } catch (ClassNotFoundException e) {
55 63
                        MessagingUtils.error(CdmViewerChooser.class, "Could not initalize selection class element of cdmViewer extension", e); //$NON-NLS-1$

Also available in: Unified diff