- if(firstElement instanceof IConfigurationElement){
- IConfigurationElement configElement = (IConfigurationElement)firstElement;
- String viewerClass = configElement.getAttribute("class");
- try {
- //get the grand parent (this is the cdmViewer)
- Object o = ((IConfigurationElement)((IConfigurationElement)configElement.getParent()).getParent()).createExecutableExtension("class");
- if(o instanceof ICdmViewer){
- ((ICdmViewer) o).show(input, viewerClass);
- this.close();
- }
- } catch (InvalidRegistryObjectException e) {
- MessagingUtils.error(CdmViewerChooser.class, "Could not load cdmViewer extension", e);
- } catch (CoreException e) {
- MessagingUtils.error(CdmViewerChooser.class, "Could not load cdmViewer extension", e);
- }
+ if(nameViewerMap.containsKey(firstElement)){
+ Entry<Class<?>, String> entry = (Entry<Class<?>, String>)firstElement;
+ ICdmViewer cdmViewer = nameViewerMap.get(entry);
+ cdmViewer.show(input, entry.getKey());
+ this.close();