Project

General

Profile

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

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

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