Revision 939829bc
Added by Patrick Plitzner about 7 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java | ||
---|---|---|
52 | 52 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
53 | 53 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
54 | 54 |
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; |
55 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
|
55 | 56 |
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; |
56 | 57 |
import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard; |
57 | 58 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
65 | 66 |
* @version 1.0 |
66 | 67 |
*/ |
67 | 68 |
public class NavigationUtil extends AbstractUtility{ |
68 |
private static IUndoContext defaultUndoContext; |
|
69 |
|
|
70 |
private static final String NOT_IMPLEMENTED_YET = Messages.NavigationUtil_NOT_IMPLEMENTED; |
|
71 |
private static final String ERROR_OPENING_THE_EDITOR = Messages.NavigationUtil_OPEN_ERROR; |
|
72 |
private static IUndoContext defaultUndoContext; |
|
69 | 73 |
|
70 | 74 |
/** |
71 | 75 |
* <p>openEditor</p> |
... | ... | |
88 | 92 |
cdmBase = CdmStore.getService(INameService.class).load(uuidAndTitleCache.getUuid()); |
89 | 93 |
} |
90 | 94 |
else{ |
91 |
MessagingUtils.warningDialog("Unknown type", NavigationUtil.class, "There is no editor available to open this object.");
|
|
95 |
MessagingUtils.warningDialog(Messages.NavigationUtil_UNKNOWN_TYPE, NavigationUtil.class, Messages.NavigationUtil_UNKNOWN_TYPE_MESSAGE);
|
|
92 | 96 |
} |
93 | 97 |
if(cdmBase!=null){ |
94 | 98 |
openEditor(cdmBase); |
95 | 99 |
} |
96 | 100 |
else{ |
97 |
MessagingUtils.warningDialog("Cdm entity not found", NavigationUtil.class, "CDM entity could not be found in the database.");
|
|
101 |
MessagingUtils.warningDialog(Messages.NavigationUtil_NOT_FOUND, NavigationUtil.class, Messages.NavigationUtil_NOT_FOUND_MESSAGE);
|
|
98 | 102 |
} |
99 | 103 |
} |
100 | 104 |
|
... | ... | |
123 | 127 |
}else if(selectedObject instanceof PolytomousKey){ |
124 | 128 |
EditorUtil.openPolytomousKey(entityUuid); |
125 | 129 |
}else{ |
126 |
MessagingUtils.warningDialog("Unsupported Type", NavigationUtil.class, "No editor exists for the current selection: " + selectedObject);
|
|
130 |
MessagingUtils.warningDialog(Messages.NavigationUtil_UNSUPPORTED_TYPE, NavigationUtil.class, Messages.NavigationUtil_UNSUPPORTED_TYPE_MESSAGE + selectedObject);
|
|
127 | 131 |
} |
128 | 132 |
} catch (PartInitException e) { |
129 |
MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e);
|
|
133 |
MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e);
|
|
130 | 134 |
} catch (Exception e) { |
131 |
MessagingUtils.errorDialog("Could not create Taxon",
|
|
135 |
MessagingUtils.errorDialog(Messages.NavigationUtil_CREATE_FAILED,
|
|
132 | 136 |
NavigationUtil.class, |
133 | 137 |
e.getMessage(), TaxeditorStorePlugin.PLUGIN_ID, |
134 | 138 |
e, |
... | ... | |
140 | 144 |
private static void openInBulkEditor(ICdmBase selectedObject) { |
141 | 145 |
ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class); |
142 | 146 |
IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); |
143 |
String openInBulkEditorCommand = "eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"; |
|
147 |
String openInBulkEditorCommand = "eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"; //$NON-NLS-1$
|
|
144 | 148 |
Command command = commandService.getCommand(openInBulkEditorCommand); |
145 | 149 |
if(command.isDefined()){ |
146 | 150 |
Map<String, UUID> params = new HashMap<String, UUID>(); |
147 |
params.put(openInBulkEditorCommand+".uuid", ((ICdmBase) selectedObject).getUuid()); //$NON-NLS-1$
|
|
151 |
params.put(openInBulkEditorCommand+".uuid", selectedObject.getUuid()); //$NON-NLS-1$
|
|
148 | 152 |
ParameterizedCommand parameterizedCommand = ParameterizedCommand.generateCommand(command, params); |
149 | 153 |
try { |
150 | 154 |
if(parameterizedCommand!=null){ |
... | ... | |
172 | 176 |
try { |
173 | 177 |
EditorUtil.openEmpty(parentNodeUuid); |
174 | 178 |
} catch (PartInitException e) { |
175 |
MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e);
|
|
179 |
MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e);
|
|
176 | 180 |
} |
177 | 181 |
} |
178 | 182 |
|
... | ... | |
297 | 301 |
handleOpeningOfMultipleTaxa(accTaxa); |
298 | 302 |
|
299 | 303 |
}else{ |
300 |
MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment.");
|
|
304 |
MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_ORPHAN_NAME_MESSAGE);
|
|
301 | 305 |
} |
302 | 306 |
|
303 | 307 |
} |
... | ... | |
307 | 311 |
openEditor(acceptedTaxa.iterator().next()); |
308 | 312 |
}else if(acceptedTaxa.size() > 1){ |
309 | 313 |
// FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open. |
310 |
MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open." + |
|
311 |
" This case is not handled yet by the software."); |
|
314 |
MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_MULTI_TREE); |
|
312 | 315 |
}else if(acceptedTaxa.size() == 0){ |
313 | 316 |
// this is an undesired state |
314 |
MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "This taxon is not connected to a classification. Currently editing of such taxa is not supported yet.");
|
|
317 |
MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_ORPHAN_TAXON);
|
|
315 | 318 |
} |
316 | 319 |
} |
317 | 320 |
|
... | ... | |
325 | 328 |
openEditor(taxonNodes.iterator().next()); |
326 | 329 |
}else if(taxonNodes.size() > 1){ |
327 | 330 |
// FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open. |
328 |
MessagingUtils.warningDialog("Not implemented yet", NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open." + |
|
329 |
" This case is not handled yet by the software."); |
|
331 |
MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open. This case is not handled yet by the software."); |
|
330 | 332 |
}else if(taxonNodes.size() == 0){ |
331 | 333 |
// this is an undesired state |
332 |
MessagingUtils.warningDialog("Incorrect state", NavigationUtil.class, "The accepted taxon is not in a taxonomic view. This should not have happened.");
|
|
334 |
MessagingUtils.warningDialog(Messages.NavigationUtil_INCORRECT_STATE, NavigationUtil.class, Messages.NavigationUtil_INCORRECT_STATE_MESSAGE);
|
|
333 | 335 |
} |
334 | 336 |
} |
335 | 337 |
|
Also available in: Unified diff
ref #4611 i18n for taxeditor.navigator plugin