Project

General

Profile

Download (2.61 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2015 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.ui.dialog;
11

    
12
import org.eclipse.jface.dialogs.IDialogConstants;
13
import org.eclipse.jface.dialogs.MessageDialog;
14
import org.eclipse.swt.graphics.Image;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Control;
17
import org.eclipse.swt.widgets.Shell;
18

    
19
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
20

    
21
/**
22
 * Abstract subclass of MessageDialog providing the functionality to configure
23
 * a {@link DeleteConfiguratorBase}
24
 * @author pplitzner
25
 * @date Jan 28, 2015
26
 *
27
 */
28
public abstract class DeleteConfiguratorDialog extends MessageDialog{
29

    
30
    public DeleteConfiguratorDialog(Shell parentShell, String dialogTitle,
31
            Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
32
        super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
33
    }
34

    
35
    /* (non-Javadoc)
36
     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
37
     */
38
    @Override
39
    protected Control createDialogArea(Composite parent) {
40
        Composite composite = (Composite) super.createDialogArea(parent);
41

    
42
        return composite;
43
    }
44

    
45
    /**
46
     * @param kind
47
     * @return
48
     */
49
    static String[] getButtonLabels(int kind) {
50
        String[] dialogButtonLabels;
51
        switch (kind) {
52
        case ERROR:
53
        case INFORMATION:
54
        case WARNING: {
55
            dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
56
            break;
57
        }
58
        case CONFIRM: {
59
            dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL,
60
                    IDialogConstants.CANCEL_LABEL };
61
            break;
62
        }
63
        case QUESTION: {
64
            dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL,
65
                    IDialogConstants.NO_LABEL };
66
            break;
67
        }
68
        case QUESTION_WITH_CANCEL: {
69
            dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL,
70
                    IDialogConstants.NO_LABEL,
71
                    IDialogConstants.CANCEL_LABEL };
72
            break;
73
        }
74
        default: {
75
            throw new IllegalArgumentException(
76
                    "Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$
77
        }
78
        }
79
        return dialogButtonLabels;
80
    }
81
}
(3-3/7)