Project

General

Profile

Download (2.05 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2014 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
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.
8
 */
9
package eu.etaxonomy.taxeditor.editor.view.checklist.handler;
10

    
11
import java.util.Arrays;
12
import java.util.List;
13

    
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;
23

    
24
import eu.etaxonomy.cdm.model.taxon.Taxon;
25
import eu.etaxonomy.taxeditor.editor.EditorUtil;
26
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
27

    
28
/**
29
 * @author a.oppermann
30
 * @date 15.05.2014
31
 *
32
 */
33
public class OpenDistributionHandler extends AbstractHandler {
34

    
35
    @Override
36
    public Object execute(ExecutionEvent event) throws ExecutionException {
37

    
38
        ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
39
        ChecklistEditor editor = (ChecklistEditor) EditorUtil.getActiveE4Editor();
40

    
41
        if (currentSelection instanceof IStructuredSelection) {
42

    
43
            Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
44
            if (selectedElement instanceof Taxon) {
45
                TableViewer viewer = (TableViewer)editor.getViewer();
46
                final Table table = viewer.getTable();
47

    
48
                TableColumn column2 = table.getColumn(4);
49
                column2.setWidth(100);
50
                viewer.refresh();
51

    
52
            }
53
        }
54
        return null;
55
    }
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$
60
    });
61

    
62

    
63

    
64
}
(3-3/3)