Project

General

Profile

Download (1.78 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.bulkeditor.handler;
10
import org.apache.log4j.Logger;
11
import org.eclipse.core.commands.AbstractHandler;
12
import org.eclipse.core.commands.ExecutionEvent;
13
import org.eclipse.core.commands.ExecutionException;
14
import org.eclipse.ui.PartInitException;
15
import org.eclipse.ui.handlers.HandlerUtil;
16

    
17
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
18
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
19
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
20
import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

    
23
/**
24
 * <p>OpenBulkEditorHandler class.</p>
25
 *
26
 * @author p.ciardelli
27
 * @created 25.06.2009
28
 * @version 1.0
29
 */
30
public class OpenBulkEditorHandler extends AbstractHandler {
31
	private static final Logger logger = Logger.getLogger(OpenBulkEditorHandler.class);	
32
	
33
	/* (non-Javadoc)
34
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
35
	 */
36
	/** {@inheritDoc} */
37
	public Object execute(ExecutionEvent event) throws ExecutionException {
38
		String inputTypeId = event.getParameter(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID);
39
		BulkEditorInputType inputType = BulkEditorInputType.getById(inputTypeId);
40
		try {
41
			HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().
42
					openEditor(AbstractBulkEditorInput.NewInstance(inputType), BulkEditor.ID);
43
		} catch (PartInitException e) {
44
			new RuntimeException(e);
45
			logger.error("Error opening bulk editor", e);
46
		}
47
		return null;
48
	}
49
}
(5-5/9)