public static Map<String, String> getAvailableViewers(Object input){
Map<String, String> commandViewerNameMap = new HashMap<String, String>();
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IConfigurationElement[] extensions = reg
- .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer");
- for (IConfigurationElement configElement : extensions) {
- if(configElement.getName().equals("viewCommandMapping")){
- String commandId = configElement.getAttribute("commandId");
- String viewerName = configElement.getAttribute("viewerName");
- try {
- Object selectionObject = configElement.createExecutableExtension("selection");
- System.out.println(selectionObject);
- Class<? extends Object> selectionClass = selectionObject.getClass();
- if(input.getClass().isAssignableFrom(selectionClass)){
- commandViewerNameMap.put(commandId, viewerName);
+ if(input!=null){
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer");
+ for (IConfigurationElement configElement : extensions) {
+ if(configElement.getName().equals("viewCommandMapping")){
+ String commandId = configElement.getAttribute("commandId");
+ String viewerName = configElement.getAttribute("viewerName");
+ try {
+ Object selectionObject = configElement.createExecutableExtension("selection");
+ Class<? extends Object> selectionClass = selectionObject.getClass();
+ if(input.getClass().isAssignableFrom(selectionClass)){
+ commandViewerNameMap.put(commandId, viewerName);
+ }
+ } catch (CoreException e) {
+ MessagingUtils.error(CdmViewerChooser.class, "Could not initalize selection class element of cdmViewer extension", e);
}
- } catch (CoreException e) {
- MessagingUtils.error(CdmViewerChooser.class, "Could not initalize selection class element of cdmViewer extension", e);
}
}
}