Project

General

Profile

« Previous | Next » 

Revision 58e6cb8f

Added by Andreas Müller about 3 years ago

ref #9541 new referencing objects implementation in TaxEditor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerUtilE4.java
21 21

  
22 22
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
23 23
import eu.etaxonomy.taxeditor.model.MessagingUtils;
24
import eu.etaxonomy.taxeditor.store.CdmStore;
25 24

  
26 25
/**
27 26
 * Scans eu.etaxonomy.taxeditor.store.cdmViewer extension point.
......
43 42
            EHandlerService handlerService){
44 43
        Map<Command, String> commandViewerNameMap = new HashMap<>();
45 44

  
45
        Class<?> inputClass = null;
46 46
        if(input!=null){
47 47
            //for generic UuidAndTitleCache objects try to load the object
48 48
            if (input instanceof UuidAndTitleCache){
49
                UuidAndTitleCache uuidAndTitleCache = (UuidAndTitleCache)input;
50
                input = CdmStore.getCommonService().find(uuidAndTitleCache.getType(), uuidAndTitleCache.getUuid());
49
                UuidAndTitleCache<?> uuidAndTitleCache = (UuidAndTitleCache<?>)input;
50
                inputClass = uuidAndTitleCache.getType();
51 51
            }
52 52
            //for tree nodes get the value resp. the object of the node
53 53
            else if (input instanceof TreeNode){
54 54
                TreeNode treeNode = (TreeNode)input;
55
                input = treeNode.getValue();
55
                inputClass = treeNode.getValue() == null? null: treeNode.getValue().getClass();
56 56
            }
57 57
        }
58 58

  
59
        if(input!=null){
59
        if(inputClass!=null){
60 60
            IExtensionRegistry reg = Platform.getExtensionRegistry();
61 61
            IConfigurationElement[] extensions = reg
62 62
                    .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer"); //$NON-NLS-1$
......
69 69
                        if(selectionClass!=null
70 70
                                && commandId!=null
71 71
                                && viewerName!=null
72
                                && selectionClass.isAssignableFrom(input.getClass())){
72
                                && selectionClass.isAssignableFrom(inputClass)){
73 73
                            Command command = commandService.getCommand(commandId);
74 74
                            commandViewerNameMap.put(command, viewerName);
75 75
                        }

Also available in: Unified diff