3 * Copyright (C) 2014 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.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.handler
;
12 import java
.util
.Arrays
;
13 import java
.util
.List
;
15 import org
.eclipse
.core
.commands
.AbstractHandler
;
16 import org
.eclipse
.core
.commands
.ExecutionEvent
;
17 import org
.eclipse
.core
.commands
.ExecutionException
;
18 import org
.eclipse
.jface
.viewers
.ISelection
;
19 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
20 import org
.eclipse
.jface
.viewers
.TableViewer
;
21 import org
.eclipse
.swt
.widgets
.Table
;
22 import org
.eclipse
.swt
.widgets
.TableColumn
;
23 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
26 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
27 import eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.ChecklistEditor
;
34 public class OpenDistributionHandler
extends AbstractHandler
{
37 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
39 ISelection currentSelection
= HandlerUtil
.getCurrentSelection(event
);
40 ChecklistEditor editor
= (ChecklistEditor
) EditorUtil
.getActiveEditor();
42 if (currentSelection
instanceof IStructuredSelection
) {
44 Object selectedElement
= ((IStructuredSelection
) currentSelection
).getFirstElement();
45 if (selectedElement
instanceof Taxon
) {
46 TableViewer viewer
= (TableViewer
)editor
.getViewer();
47 final Table table
= viewer
.getTable();
49 TableColumn column2
= table
.getColumn(4);
50 column2
.setWidth(100);
57 private static final List
<String
> DESC_INIT_STRATEGY
= Arrays
.asList(new String
[]{