import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
if (!(input instanceof AbstractBulkEditorInput)) {
throw new PartInitException("Invalid Input: Must be BulkEditorInput");
}
-
+ else{
+ AbstractBulkEditorInput<?> bulkEditorInput = (AbstractBulkEditorInput<?>)input;
+ if(bulkEditorInput.getEntityUuid()!=null){
+ bulkEditorInput.performSearch(new BulkEditorQuery(bulkEditorInput.getEntityUuid().toString(), null));
+ }
+ }
super.init(site, input);
}
private void displayWarningDialog() {
IPreferenceStore prefs = PreferencesUtil.getPreferenceStore();
- if (!prefs.getBoolean(PreferencesUtil.HIDE_BULKEDITOR_INFO)) {
+ if (!prefs.getBoolean(IPreferenceKeys.HIDE_BULKEDITOR_INFO)) {
String msg = "The Bulk Editor allows you to edit objects used to reference other objects, such as names, references, and authors.\n\n" +
"Any changes you make to an object in the Bulk Editor will be displayed wherever the object is used.\n\n" +
"For instance, a reference may be displayed with both a name and a descriptive element. If the reference name is changed here, the display of both the name and the descriptive element will be affected.";
MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm
(getSite().getShell(), "Bulk Editor", msg, "Do not show this message again",
- false, null, PreferencesUtil.HIDE_BULKEDITOR_INFO);
+ false, null, IPreferenceKeys.HIDE_BULKEDITOR_INFO);
if (dialog.getReturnCode() == Window.OK) {
- prefs.setValue(PreferencesUtil.HIDE_BULKEDITOR_INFO, dialog.getToggleState());
+ prefs.setValue(IPreferenceKeys.HIDE_BULKEDITOR_INFO, dialog.getToggleState());
}
}
}
package eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler;
-import org.eclipse.core.commands.AbstractHandler;
+import java.util.UUID;
+
import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBase<TaxonNode> {
-public class OpenBulkEditorForTaxonNodeHandler extends AbstractHandler {
+ @Override
+ protected TaxonNode getEntity(UUID uuid) {
+ return CdmStore.getService(ITaxonNodeService.class).load(uuid);
+ }
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- System.out.println("event");
- return null;
- }
+ @Override
+ protected void open(ExecutionEvent event, TaxonNode entity) {
+ try {
+ BulkEditorUtil.openEditor(entity.getTaxon());
+ } catch (PartInitException e) {
+ MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+entity, e);
+ }
+ }
}