GPL + CeCILL Header change
[scilab.git] / scilab / modules / xcos / src / java / org / scilab / modules / xcos / utils / XcosDialogs.java
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2009 - DIGITEO - Vincent COUVERT
4  * Copyright (C) 2011-2015 - Scilab Enterprises - Clement DAVID
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  * === LICENSE_END ===
15  *
16  */
17
18 package org.scilab.modules.xcos.utils;
19
20 import org.scilab.modules.gui.messagebox.ScilabModalDialog;
21 import org.scilab.modules.gui.messagebox.ScilabModalDialog.IconType;
22 import org.scilab.modules.xcos.XcosTab;
23 import org.scilab.modules.xcos.graph.XcosDiagram;
24
25 /**
26  * Xcos standard dialogs
27  */
28 public final class XcosDialogs {
29
30     /**
31      * Constructor
32      */
33     private XcosDialogs() {
34
35     }
36
37     /**
38      * Dialog displayed when no block is selected and one is needed for action
39      *
40      * @param diagram
41      *            The associated diagram
42      */
43     public static void noBlockSelected(XcosDiagram diagram) {
44         ScilabModalDialog.show(XcosTab.get(diagram),
45                                XcosMessages.NO_BLOCK_SELECTED, XcosMessages.XCOS_ERROR,
46                                IconType.ERROR_ICON);
47     }
48
49     /**
50      * Dialog displayed when saving failed
51      *
52      * @param diagram
53      *            The associated diagram
54      */
55     public static void couldNotSaveFile(XcosDiagram diagram) {
56         ScilabModalDialog.show(XcosTab.get(diagram),
57                                new String[] { XcosMessages.FAIL_SAVING_DIAGRAM },
58                                XcosMessages.XCOS_ERROR, IconType.ERROR_ICON);
59     }
60
61     /**
62      * Dialog displayed when loading failed
63      *
64      * @param diagram
65      *            The associated diagram
66      */
67     public static void couldNotLoadFile(XcosDiagram diagram) {
68         ScilabModalDialog.show(XcosTab.get(diagram),
69                                new String[] { XcosMessages.FAIL_LOADING_DIAGRAM },
70                                XcosMessages.XCOS_ERROR, IconType.ERROR_ICON);
71     }
72 }