Revision ae137b34
Added by Patrick Plitzner about 7 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java | ||
---|---|---|
12 | 12 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
13 | 13 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
14 | 14 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
15 |
import eu.etaxonomy.taxeditor.editor.Messages; |
|
15 | 16 |
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput; |
16 | 17 |
import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase; |
17 | 18 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
... | ... | |
21 | 22 |
|
22 | 23 |
public class OpenChecklistEditorHandler extends DefaultOpenHandlerBase<ITaxonTreeNode> { |
23 | 24 |
|
24 |
@Override |
|
25 |
private static final String FAILED_TO_OPEN_EDITOR = Messages.OpenChecklistEditorHandler_FAILED_TO_OPEN; |
|
26 |
private static final String COULD_NOT_OPEN_DISTRIBUTION_EDITOR_THE_HIERARCHY_IS_CORRUPTED = Messages.OpenChecklistEditorHandler_COULD_NOT_OPEN_MESSAGE; |
|
27 |
private static final String COULD_NOT_OPEN_DISTRIBUTION_EDITOR = Messages.OpenChecklistEditorHandler_COULD_NOT_OPEN_TITLE; |
|
28 |
|
|
29 |
@Override |
|
25 | 30 |
protected ITaxonTreeNode getEntity(UUID uuid) { |
26 | 31 |
ITaxonTreeNode taxonTreeNode = CdmStore.getService(ITaxonNodeService.class).load(uuid); |
27 | 32 |
if(taxonTreeNode==null){ |
... | ... | |
34 | 39 |
protected void open(ExecutionEvent event, ITaxonTreeNode entity) { |
35 | 40 |
if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE)) { |
36 | 41 |
if (StringUtils.isBlank(PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.DISTRIBUTION_AREA_OCCURENCE_STATUS) )){ |
37 |
MessagingUtils.informationDialog("No Areas to display", "Please choose the areas you want to display. "
|
|
38 |
+ "For this go to the preferences, choose the Checklist Editor and choose the areas in the Distribution Selection Wizard.");
|
|
42 |
MessagingUtils.informationDialog(Messages.OpenChecklistEditorHandler_NO_AREAS, Messages.OpenChecklistEditorHandler_CHOOSE_AREA
|
|
43 |
+ Messages.OpenChecklistEditorHandler_GOTO_PREFERENCES);
|
|
39 | 44 |
this.dispose(); |
40 | 45 |
return; |
41 | 46 |
} |
... | ... | |
44 | 49 |
try { |
45 | 50 |
EditorUtil.open(input); |
46 | 51 |
} catch (PartInitException e) { |
47 |
MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open Distribution Editor", e);
|
|
52 |
MessagingUtils.error(OpenChecklistEditorHandler.class, COULD_NOT_OPEN_DISTRIBUTION_EDITOR, e);
|
|
48 | 53 |
} catch (NullPointerException npe) { |
49 |
MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
|
|
50 |
"Could not open Distribution Editor. The hierarchy is corrupted!", npe);
|
|
54 |
MessagingUtils.messageDialog(FAILED_TO_OPEN_EDITOR, OpenChecklistEditorHandler.class,
|
|
55 |
COULD_NOT_OPEN_DISTRIBUTION_EDITOR_THE_HIERARCHY_IS_CORRUPTED, npe);
|
|
51 | 56 |
} |
52 | 57 |
} else if (entity instanceof TaxonNode) { |
53 | 58 |
ChecklistEditorInput input = new ChecklistEditorInput((TaxonNode) entity); |
54 | 59 |
try { |
55 | 60 |
EditorUtil.open(input); |
56 | 61 |
} catch (PartInitException e) { |
57 |
MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open Distribution Editor", e);
|
|
62 |
MessagingUtils.error(OpenChecklistEditorHandler.class, COULD_NOT_OPEN_DISTRIBUTION_EDITOR, e);
|
|
58 | 63 |
} catch (NullPointerException npe) { |
59 |
MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
|
|
60 |
"Could not open Distribution Editor. The hierarchy is corrupted!", npe);
|
|
64 |
MessagingUtils.messageDialog(FAILED_TO_OPEN_EDITOR, OpenChecklistEditorHandler.class,
|
|
65 |
COULD_NOT_OPEN_DISTRIBUTION_EDITOR_THE_HIERARCHY_IS_CORRUPTED, npe);
|
|
61 | 66 |
} |
62 | 67 |
} |
63 |
}
|
|
68 |
} |
|
64 | 69 |
} |
65 | 70 |
} |
Also available in: Unified diff
ref #4611 some l10n for taxeditor and taxeditor.editor plugin