3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.section
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.swt
.events
.SelectionAdapter
;
15 import org
.eclipse
.swt
.events
.SelectionEvent
;
16 import org
.eclipse
.ui
.PartInitException
;
18 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
19 import eu
.etaxonomy
.taxeditor
.bulkeditor
.BulkEditorUtil
;
20 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
23 * <p>BulkEditorOpeningSelectionListener class.</p>
26 * @created Apr 26, 2010
29 public class BulkEditorOpeningSelectionListener
extends SelectionAdapter
{
31 private static final Logger logger
= Logger
32 .getLogger(BulkEditorOpeningSelectionListener
.class);
34 private IdentifiableEntity entity
;
37 * <p>Constructor for BulkEditorOpeningSelectionListener.</p>
39 * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
41 public BulkEditorOpeningSelectionListener(IdentifiableEntity entity
){
47 public void widgetSelected(SelectionEvent e
) {
50 logger
.error("Trying to open bulk editor for null entity");
52 if(entity
.getId() == 0){
53 EditorUtil
.warningDialog(entity
.getClass().getSimpleName() + " not persisted yet", this,
54 "Please save the currently open editor to edit details of the selected entity.");
55 logger
.warn("Object not persisted yet");
57 BulkEditorUtil
.openEditor(entity
);
59 } catch (PartInitException ex
) {
60 // logger.error("Could not open BulkEditor", ex);
61 throw new RuntimeException("Could not open BulkEditor", ex
);