Project

General

Profile

« Previous | Next » 

Revision a2e68e75

Added by Patrick Plitzner almost 8 years ago

Implement "Open in " bulk editor for taxon navigator #5609

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java
48 48
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
49 49
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
50 50
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
51
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
51 52
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
52 53
import eu.etaxonomy.taxeditor.store.CdmStore;
53 54

  
......
110 111
		if (!(input instanceof AbstractBulkEditorInput)) {
111 112
			throw new PartInitException("Invalid Input: Must be BulkEditorInput");
112 113
		}
113

  
114
		else{
115
		    AbstractBulkEditorInput<?> bulkEditorInput = (AbstractBulkEditorInput<?>)input;
116
		    if(bulkEditorInput.getEntityUuid()!=null){
117
		        bulkEditorInput.performSearch(new BulkEditorQuery(bulkEditorInput.getEntityUuid().toString(), null));
118
		    }
119
		}
114 120
		super.init(site, input);
115 121
	}
116 122

  
......
176 182

  
177 183
	private void displayWarningDialog() {
178 184
		IPreferenceStore prefs = PreferencesUtil.getPreferenceStore();
179
		if (!prefs.getBoolean(PreferencesUtil.HIDE_BULKEDITOR_INFO)) {
185
		if (!prefs.getBoolean(IPreferenceKeys.HIDE_BULKEDITOR_INFO)) {
180 186
			String msg = "The Bulk Editor allows you to edit objects used to reference other objects, such as names, references, and authors.\n\n" +
181 187
							"Any changes you make to an object in the Bulk Editor will be displayed wherever the object is used.\n\n" +
182 188
							"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.";
183 189
			MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm
184 190
												(getSite().getShell(), "Bulk Editor", msg, "Do not show this message again",
185
														false, null, PreferencesUtil.HIDE_BULKEDITOR_INFO);
191
														false, null, IPreferenceKeys.HIDE_BULKEDITOR_INFO);
186 192
			if (dialog.getReturnCode() == Window.OK) {
187
				prefs.setValue(PreferencesUtil.HIDE_BULKEDITOR_INFO, dialog.getToggleState());
193
				prefs.setValue(IPreferenceKeys.HIDE_BULKEDITOR_INFO, dialog.getToggleState());
188 194
			}
189 195
		}
190 196
	}
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/defaultHandler/OpenBulkEditorForTaxonNodeHandler.java
1 1
package eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler;
2 2

  
3
import org.eclipse.core.commands.AbstractHandler;
3
import java.util.UUID;
4

  
4 5
import org.eclipse.core.commands.ExecutionEvent;
5
import org.eclipse.core.commands.ExecutionException;
6
import org.eclipse.ui.PartInitException;
7

  
8
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
9
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
10
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
11
import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
12
import eu.etaxonomy.taxeditor.model.MessagingUtils;
13
import eu.etaxonomy.taxeditor.store.CdmStore;
14

  
15
public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBase<TaxonNode> {
6 16

  
7
public class OpenBulkEditorForTaxonNodeHandler extends AbstractHandler {
17
    @Override
18
    protected TaxonNode getEntity(UUID uuid) {
19
        return CdmStore.getService(ITaxonNodeService.class).load(uuid);
20
    }
8 21

  
9
	@Override
10
	public Object execute(ExecutionEvent event) throws ExecutionException {
11
		System.out.println("event");
12
		return null;
13
	}
22
    @Override
23
    protected void open(ExecutionEvent event, TaxonNode entity) {
24
        try {
25
            BulkEditorUtil.openEditor(entity.getTaxon());
26
        } catch (PartInitException e) {
27
            MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+entity, e);
28
        }
29
    }
14 30

  
15 31
}

Also available in: Unified diff