Project

General

Profile

Download (1.74 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

    
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
}
(3-3/7)