2 * Copyright (C) 2014 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.handler
;
11 import java
.util
.Arrays
;
12 import java
.util
.List
;
14 import org
.eclipse
.core
.commands
.AbstractHandler
;
15 import org
.eclipse
.core
.commands
.ExecutionEvent
;
16 import org
.eclipse
.core
.commands
.ExecutionException
;
17 import org
.eclipse
.jface
.viewers
.ISelection
;
18 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
19 import org
.eclipse
.jface
.viewers
.TableViewer
;
20 import org
.eclipse
.swt
.widgets
.Table
;
21 import org
.eclipse
.swt
.widgets
.TableColumn
;
22 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
25 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
26 import eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.ChecklistEditor
;
33 public class OpenDistributionHandler
extends AbstractHandler
{
36 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
38 ISelection currentSelection
= HandlerUtil
.getCurrentSelection(event
);
39 ChecklistEditor editor
= (ChecklistEditor
) EditorUtil
.getActiveE4Editor();
41 if (currentSelection
instanceof IStructuredSelection
) {
43 Object selectedElement
= ((IStructuredSelection
) currentSelection
).getFirstElement();
44 if (selectedElement
instanceof Taxon
) {
45 TableViewer viewer
= (TableViewer
)editor
.getViewer();
46 final Table table
= viewer
.getTable();
48 TableColumn column2
= table
.getColumn(4);
49 column2
.setWidth(100);
56 private static final List
<String
> DESC_INIT_STRATEGY
= Arrays
.asList(new String
[]{
57 "descriptions", //$NON-NLS-1$
58 "descriptions.*", //$NON-NLS-1$
59 "description.state" //$NON-NLS-1$