- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
- * ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- boolean isChecklistEditorActivated = PreferencesUtil.getPreferenceStore().getBoolean(
- IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE);
- if (isChecklistEditorActivated) {
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- if (currentSelection instanceof IStructuredSelection) {
- Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
- if (selectedElement instanceof Classification) {
- ChecklistEditorInput input = new ChecklistEditorInput(((Classification) selectedElement));
- try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
- } catch (NullPointerException npe) {
- MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
- "Could not open ChecklistView. The hierarchy is corrupted!", npe);
- }
- } else if (selectedElement instanceof TaxonNode) {
- ChecklistEditorInput input = new ChecklistEditorInput(((TaxonNode) selectedElement));
- try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
- } catch (NullPointerException npe) {
- MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
- "Could not open ChecklistView. The hierarchy is corrupted!", npe);
- }
- }
- }
- }
- return null;
- }
+ @Override
+ protected void open(ExecutionEvent event, ITaxonTreeNode entity) {
+ if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE)) {
+ if (entity instanceof Classification) {
+ ChecklistEditorInput input = new ChecklistEditorInput(((Classification) entity));
+ try {
+ EditorUtil.open(input);
+ } catch (PartInitException e) {
+ MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
+ } catch (NullPointerException npe) {
+ MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
+ "Could not open ChecklistView. The hierarchy is corrupted!", npe);
+ }
+ } else if (entity instanceof TaxonNode) {
+ ChecklistEditorInput input = new ChecklistEditorInput((TaxonNode) entity);
+ try {
+ EditorUtil.open(input);
+ } catch (PartInitException e) {
+ MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
+ } catch (NullPointerException npe) {
+ MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
+ "Could not open ChecklistView. The hierarchy is corrupted!", npe);
+ }
+ }
+ }
+ }