summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément DAVID <clement.david@scilab-enterprises.com>2011-10-19 09:40:36 +0200
committerClément DAVID <clement.david@scilab-enterprises.com>2011-10-19 09:41:18 +0200
commit84a8259be19257c070c99261c55d72cb974d31c9 (patch)
tree761281817703fb5991a74ddbb23d17c1a5929d90
parentf17fa865c82496dda421e8963476d0671989388a (diff)
parentf0f4a349e996927b227052e512d284a166244c13 (diff)
downloadscilab-jgraphx.zip
scilab-jgraphx.tar.gz
Merge remote-tracking branch 'origin/master' into jgraphxjgraphx
Change-Id: I4bd465e99d4bd5b2d1ae85370557fea70054df17
-rw-r--r--scilab/CHANGES_5.4.X5
-rw-r--r--scilab/modules/fileio/sci_gateway/c/sci_mputl.c11
-rw-r--r--scilab/modules/fileio/src/c/mopen.c16
-rw-r--r--scilab/modules/fileio/tests/nonreg_tests/bug_9917.dia.ref22
-rw-r--r--scilab/modules/fileio/tests/nonreg_tests/bug_9917.tst24
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/CompileAction.java69
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/DumpAction.java87
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StartAction.java148
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StopAction.java93
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/workers/ScilabGraphWorker.java273
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/graph/CompilationEngineStatus.java67
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java385
12 files changed, 498 insertions, 702 deletions
diff --git a/scilab/CHANGES_5.4.X b/scilab/CHANGES_5.4.X
index d75dcee..44845b0 100644
--- a/scilab/CHANGES_5.4.X
+++ b/scilab/CHANGES_5.4.X
@@ -98,9 +98,6 @@ Xcos:
98 98
99* Error reporting has been improved to print warnings on blocks into Xcos. 99* Error reporting has been improved to print warnings on blocks into Xcos.
100 100
101* Diagram export / compilation / simulation phase are now visible on the status
102 bar before the operation.
103
104* The style of the block can be changed on the interface function. 101* The style of the block can be changed on the interface function.
105 102
106* BARXY Block added to help 2D Mechanics system visualization. 103* BARXY Block added to help 2D Mechanics system visualization.
@@ -181,6 +178,8 @@ File input/output:
181 178
182* tempname function added (SEP 68). 179* tempname function added (SEP 68).
183 180
181* bug 9917 fixed - 'mputl' function crashed with a wrong second parameter.
182
184 183
185New functions 184New functions
186============= 185=============
diff --git a/scilab/modules/fileio/sci_gateway/c/sci_mputl.c b/scilab/modules/fileio/sci_gateway/c/sci_mputl.c
index bcd7499..d08c745 100644
--- a/scilab/modules/fileio/sci_gateway/c/sci_mputl.c
+++ b/scilab/modules/fileio/sci_gateway/c/sci_mputl.c
@@ -128,8 +128,15 @@ int sci_mputl(char *fname, unsigned long fname_len)
128 break; 128 break;
129 case MOPEN_INVALID_FILENAME: 129 case MOPEN_INVALID_FILENAME:
130 { 130 {
131 Scierror(999, _("%s: invalid filename %s.\n"), fname, filename); 131 if (filename)
132 freeAllocatedSingleString(filename); 132 {
133 Scierror(999, _("%s: invalid filename %s.\n"), fname, filename);
134 }
135 else
136 {
137 freeAllocatedSingleString(filename);
138 Scierror(999, _("%s: invalid filename.\n"), fname);
139 }
133 return 0; 140 return 0;
134 } 141 }
135 break; 142 break;
diff --git a/scilab/modules/fileio/src/c/mopen.c b/scilab/modules/fileio/src/c/mopen.c
index aee5400..6b9ca07 100644
--- a/scilab/modules/fileio/src/c/mopen.c
+++ b/scilab/modules/fileio/src/c/mopen.c
@@ -34,12 +34,19 @@ void C2F(mopen)(int *fd, char *file, char *status, int *f_swap, double *res, int
34 char *endptr; 34 char *endptr;
35 FILE * fa; 35 FILE * fa;
36 36
37 /* bug 4846 */
38 if (file == NULL)
39 {
40 *error = (int)MOPEN_INVALID_FILENAME;
41 return;
42 }
43
37 if ( getWarningMode() && IsAlreadyOpenedInScilab(file) ) 44 if ( getWarningMode() && IsAlreadyOpenedInScilab(file) )
38 { 45 {
39 sciprint(_("Warning: file '%s' already opened in Scilab.\n"),file); 46 sciprint(_("Warning: file '%s' already opened in Scilab.\n"),file);
40 } 47 }
41 48
42 swap =0; 49 swap = 0;
43 *error = (int)MOPEN_NO_ERROR; 50 *error = (int)MOPEN_NO_ERROR;
44 endptr = (char *) &littlendian; 51 endptr = (char *) &littlendian;
45 if ( (!*endptr) ) 52 if ( (!*endptr) )
@@ -56,13 +63,6 @@ void C2F(mopen)(int *fd, char *file, char *status, int *f_swap, double *res, int
56 return; 63 return;
57 } 64 }
58 65
59 /* bug 4846 */
60 if (file == NULL)
61 {
62 *error = (int)MOPEN_INVALID_FILENAME;
63 return;
64 }
65
66 if (strlen(file) == 0) 66 if (strlen(file) == 0)
67 { 67 {
68 *error = (int)MOPEN_INVALID_FILENAME; 68 *error = (int)MOPEN_INVALID_FILENAME;
diff --git a/scilab/modules/fileio/tests/nonreg_tests/bug_9917.dia.ref b/scilab/modules/fileio/tests/nonreg_tests/bug_9917.dia.ref
new file mode 100644
index 0000000..c9a0c82
--- /dev/null
+++ b/scilab/modules/fileio/tests/nonreg_tests/bug_9917.dia.ref
@@ -0,0 +1,22 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2011 - DIGITEO - Allan CORNET
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7//
8// <-- JVM NOT MANDATORY -->
9//
10// <-- Non-regression test for bug 9917 -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/show_bug.cgi?id=9917
14//
15// <-- Short Description -->
16// mputl crashed with a wrong second parameter
17//
18x = "保存";
19p = TMPDIR + '/foo';
20assert_checkequal(mputl(x, p), %T);
21cd(TMPDIR);
22assert_checkequal(mputl(p, x), %T);
diff --git a/scilab/modules/fileio/tests/nonreg_tests/bug_9917.tst b/scilab/modules/fileio/tests/nonreg_tests/bug_9917.tst
new file mode 100644
index 0000000..3a6c307
--- /dev/null
+++ b/scilab/modules/fileio/tests/nonreg_tests/bug_9917.tst
@@ -0,0 +1,24 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2011 - DIGITEO - Allan CORNET
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7//
8// <-- JVM NOT MANDATORY -->
9//
10// <-- Non-regression test for bug 9917 -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/show_bug.cgi?id=9917
14//
15// <-- Short Description -->
16// mputl crashed with a wrong second parameter
17//
18
19x = "保存";
20p = TMPDIR + '/foo';
21assert_checkequal(mputl(x, p), %T);
22
23cd(TMPDIR);
24assert_checkequal(mputl(p, x), %T);
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/CompileAction.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/CompileAction.java
index d5fb23b..fda6863 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/CompileAction.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/CompileAction.java
@@ -13,13 +13,22 @@
13 13
14package org.scilab.modules.xcos.actions; 14package org.scilab.modules.xcos.actions;
15 15
16import static org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.buildCall;
17import static org.scilab.modules.xcos.utils.FileUtils.delete;
18
16import java.awt.event.ActionEvent; 19import java.awt.event.ActionEvent;
20import java.awt.event.ActionListener;
21import java.io.IOException;
22
23import javax.swing.SwingWorker;
17 24
25import org.apache.commons.logging.LogFactory;
26import org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement;
27import org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.InterpreterException;
18import org.scilab.modules.graph.ScilabGraph; 28import org.scilab.modules.graph.ScilabGraph;
19import org.scilab.modules.gui.menuitem.MenuItem; 29import org.scilab.modules.gui.menuitem.MenuItem;
20import org.scilab.modules.xcos.actions.workers.ScilabGraphWorker;
21import org.scilab.modules.xcos.actions.workers.ScilabGraphWorker.Action;
22import org.scilab.modules.xcos.graph.XcosDiagram; 30import org.scilab.modules.xcos.graph.XcosDiagram;
31import org.scilab.modules.xcos.utils.FileUtils;
23import org.scilab.modules.xcos.utils.XcosMessages; 32import org.scilab.modules.xcos.utils.XcosMessages;
24 33
25/** 34/**
@@ -37,9 +46,7 @@ public class CompileAction extends SimulationNotRunningAction {
37 46
38 /** 47 /**
39 * Constructor 48 * Constructor
40 * 49 * @param scilabGraph associated diagram
41 * @param scilabGraph
42 * associated diagram
43 */ 50 */
44 public CompileAction(ScilabGraph scilabGraph) { 51 public CompileAction(ScilabGraph scilabGraph) {
45 super(scilabGraph); 52 super(scilabGraph);
@@ -47,9 +54,7 @@ public class CompileAction extends SimulationNotRunningAction {
47 54
48 /** 55 /**
49 * Create associated menu 56 * Create associated menu
50 * 57 * @param scilabGraph associated diagram
51 * @param scilabGraph
52 * associated diagram
53 * @return the menu 58 * @return the menu
54 */ 59 */
55 public static MenuItem createMenu(ScilabGraph scilabGraph) { 60 public static MenuItem createMenu(ScilabGraph scilabGraph) {
@@ -57,15 +62,53 @@ public class CompileAction extends SimulationNotRunningAction {
57 } 62 }
58 63
59 /** 64 /**
60 * @param e 65 * @param e parameter
61 * parameter
62 * @see org.scilab.modules.graph.actions.base.DefaultAction#actionPerformed(java.awt.event.ActionEvent) 66 * @see org.scilab.modules.graph.actions.base.DefaultAction#actionPerformed(java.awt.event.ActionEvent)
63 */ 67 */
64 @Override 68 @Override
65 public void actionPerformed(ActionEvent e) { 69 public void actionPerformed(ActionEvent e) {
66 final XcosDiagram diagram = ((XcosDiagram) getGraph(e)) 70 ((XcosDiagram) getGraph(null)).info(XcosMessages.EXPORT_IN_PROGRESS);
67 .getRootDiagram(); 71
72 final String temp;
73 try {
74 temp = FileUtils.createTempFile();
75 } catch (IOException e1) {
76 LogFactory.getLog(CompileAction.class).error(e1);
77 return;
78 }
79
80 (new SwingWorker<Void, Void>() {
68 81
69 ScilabGraphWorker.start(diagram, Action.COMPILE); 82 @Override
83 protected Void doInBackground() throws Exception {
84 ((XcosDiagram) getGraph(null)).dumpToHdf5File(temp);
85 ((XcosDiagram) getGraph(null)).setReadOnly(true);
86 return null;
87 }
88
89 @Override
90 protected void done() {
91 ((XcosDiagram) getGraph(null)).info(XcosMessages.COMPILATION_IN_PROGRESS);
92
93 String cmd = buildCall("import_from_hdf5", temp)
94 + "cpr = xcos_compile(scs_m);";
95
96 final ActionListener action = new ActionListener() {
97 @Override
98 public void actionPerformed(ActionEvent e) {
99 delete(temp);
100 ((XcosDiagram) getGraph(null)).setReadOnly(false);
101 ((XcosDiagram) getGraph(null)).info(XcosMessages.EMPTY_INFO);
102 }
103 };
104
105 try {
106 ScilabInterpreterManagement.asynchronousScilabExec(action, cmd);
107 } catch (InterpreterException e) {
108 LogFactory.getLog(CompileAction.class).error(e);
109 }
110 }
111
112 }).execute();
70 } 113 }
71} 114}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/DumpAction.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/DumpAction.java
index edccaae..81d7db1 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/DumpAction.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/DumpAction.java
@@ -14,22 +14,27 @@
14 14
15package org.scilab.modules.xcos.actions; 15package org.scilab.modules.xcos.actions;
16 16
17import static org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.buildCall;
18
17import java.awt.event.ActionEvent; 19import java.awt.event.ActionEvent;
20import java.io.File;
21import java.io.IOException;
18 22
23import org.apache.commons.logging.LogFactory;
24import org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement;
25import org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.InterpreterException;
19import org.scilab.modules.graph.ScilabGraph; 26import org.scilab.modules.graph.ScilabGraph;
20import org.scilab.modules.graph.actions.base.DefaultAction; 27import org.scilab.modules.graph.actions.base.DefaultAction;
21import org.scilab.modules.gui.menuitem.MenuItem; 28import org.scilab.modules.gui.menuitem.MenuItem;
22import org.scilab.modules.gui.pushbutton.PushButton; 29import org.scilab.modules.gui.pushbutton.PushButton;
23import org.scilab.modules.xcos.actions.workers.ScilabGraphWorker;
24import org.scilab.modules.xcos.actions.workers.ScilabGraphWorker.Action;
25import org.scilab.modules.xcos.graph.XcosDiagram; 30import org.scilab.modules.xcos.graph.XcosDiagram;
31import org.scilab.modules.xcos.utils.FileUtils;
26import org.scilab.modules.xcos.utils.XcosMessages; 32import org.scilab.modules.xcos.utils.XcosMessages;
27 33
28/** 34/**
29 * Dump the graph into scilab. 35 * Dump the graph into scilab.
30 * 36 *
31 * This action is only used for debugging purpose but not on any release 37 * This action is only used for debugging purpose but not on any release version.
32 * version.
33 */ 38 */
34public class DumpAction extends DefaultAction { 39public class DumpAction extends DefaultAction {
35 /** Name of the action */ 40 /** Name of the action */
@@ -41,41 +46,49 @@ public class DumpAction extends DefaultAction {
41 /** Accelerator key for the action */ 46 /** Accelerator key for the action */
42 public static final int ACCELERATOR_KEY = 0; 47 public static final int ACCELERATOR_KEY = 0;
43 48
44 /** 49 /**
45 * @param scilabGraph 50 * @param scilabGraph graph
46 * graph 51 */
47 */ 52 public DumpAction(ScilabGraph scilabGraph) {
48 public DumpAction(ScilabGraph scilabGraph) { 53 super(scilabGraph);
49 super(scilabGraph); 54 }
50 }
51 55
52 /** 56 /**
53 * @param scilabGraph 57 * @param scilabGraph graph
54 * graph 58 * @return push button
55 * @return push button 59 */
56 */ 60 public static PushButton dumpButton(ScilabGraph scilabGraph) {
57 public static PushButton dumpButton(ScilabGraph scilabGraph) { 61 return createButton(scilabGraph, DumpAction.class);
58 return createButton(scilabGraph, DumpAction.class); 62 }
59 }
60 63
61 /** 64 /**
62 * @param scilabGraph 65 * @param scilabGraph graph
63 * graph 66 * @return menu item
64 * @return menu item 67 */
65 */ 68 public static MenuItem dumpMenu(ScilabGraph scilabGraph) {
66 public static MenuItem dumpMenu(ScilabGraph scilabGraph) { 69 return createMenu(scilabGraph, DumpAction.class);
67 return createMenu(scilabGraph, DumpAction.class); 70 }
68 }
69 71
70 /** 72 /**
71 * Do action !!! 73 * Do action !!!
72 * 74 * @param e params
73 * @param e 75 * @see org.scilab.modules.gui.events.callback.CallBack#actionPerformed(java.awt.event.ActionEvent)
74 * params 76 */
75 * @see org.scilab.modules.gui.events.callback.CallBack#actionPerformed(java.awt.event.ActionEvent)
76 */
77 @Override 77 @Override
78 public void actionPerformed(ActionEvent e) { 78 public void actionPerformed(ActionEvent e) {
79 ScilabGraphWorker.start((XcosDiagram) getGraph(e), Action.DUMP); 79 try {
80 } 80 String temp = FileUtils.createTempFile();
81 new File(temp).deleteOnExit();
82 ((XcosDiagram) getGraph(e)).dumpToHdf5File(temp);
83 try {
84 String cmd = buildCall("import_from_hdf5", temp);
85 cmd += buildCall("deletefile", temp);
86 ScilabInterpreterManagement.synchronousScilabExec(cmd);
87 } catch (InterpreterException e1) {
88 LogFactory.getLog(DumpAction.class).error(e1);
89 }
90 } catch (IOException e1) {
91 LogFactory.getLog(DumpAction.class).error(e1);
92 }
93 }
81} 94}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StartAction.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StartAction.java
index 13e0657..9659ab2 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StartAction.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StartAction.java
@@ -3,7 +3,6 @@
3 * Copyright (C) 2009 - DIGITEO - Bruno JOFRET 3 * Copyright (C) 2009 - DIGITEO - Bruno JOFRET
4 * Copyright (C) 2009 - DIGITEO - Vincent COUVERT 4 * Copyright (C) 2009 - DIGITEO - Vincent COUVERT
5 * Copyright (C) 2010 - DIGITEO - Clément DAVID 5 * Copyright (C) 2010 - DIGITEO - Clément DAVID
6 * Copyright (C) 2011 - Scilab Enterprises - Clément DAVID
7 * 6 *
8 * This file must be used under the terms of the CeCILL. 7 * This file must be used under the terms of the CeCILL.
9 * This source file is licensed as described in the file COPYING, which 8 * This source file is licensed as described in the file COPYING, which
@@ -15,16 +14,23 @@
15 14
16package org.scilab.modules.xcos.actions; 15package org.scilab.modules.xcos.actions;
17 16
17import static org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.asynchronousScilabExec;
18import static org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.buildCall;
19
18import java.awt.event.ActionEvent; 20import java.awt.event.ActionEvent;
21import java.awt.event.ActionListener;
22import java.io.IOException;
19 23
24import org.apache.commons.logging.Log;
25import org.apache.commons.logging.LogFactory;
26import org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.InterpreterException;
20import org.scilab.modules.graph.ScilabGraph; 27import org.scilab.modules.graph.ScilabGraph;
21import org.scilab.modules.graph.actions.base.GraphActionManager; 28import org.scilab.modules.graph.actions.base.GraphActionManager;
22import org.scilab.modules.graph.actions.base.OneBlockDependantAction; 29import org.scilab.modules.graph.actions.base.OneBlockDependantAction;
23import org.scilab.modules.gui.menuitem.MenuItem; 30import org.scilab.modules.gui.menuitem.MenuItem;
24import org.scilab.modules.gui.pushbutton.PushButton; 31import org.scilab.modules.gui.pushbutton.PushButton;
25import org.scilab.modules.xcos.actions.workers.ScilabGraphWorker;
26import org.scilab.modules.xcos.actions.workers.ScilabGraphWorker.Action;
27import org.scilab.modules.xcos.graph.XcosDiagram; 32import org.scilab.modules.xcos.graph.XcosDiagram;
33import org.scilab.modules.xcos.utils.FileUtils;
28import org.scilab.modules.xcos.utils.XcosMessages; 34import org.scilab.modules.xcos.utils.XcosMessages;
29 35
30/** 36/**
@@ -39,46 +45,118 @@ public class StartAction extends OneBlockDependantAction {
39 public static final int MNEMONIC_KEY = 0; 45 public static final int MNEMONIC_KEY = 0;
40 /** Accelerator key for the action */ 46 /** Accelerator key for the action */
41 public static final int ACCELERATOR_KEY = 0; 47 public static final int ACCELERATOR_KEY = 0;
48
49 /**
50 * @param scilabGraph graph
51 */
52 public StartAction(ScilabGraph scilabGraph) {
53 super(scilabGraph);
54 setEnabled(GraphActionManager.getEnable(StartAction.class));
55 }
42 56
43 /** 57 /**
44 * @param scilabGraph 58 * @param scilabGraph graph
45 * graph 59 * @return push button
46 */ 60 */
47 public StartAction(ScilabGraph scilabGraph) { 61 public static PushButton createButton(ScilabGraph scilabGraph) {
48 super(scilabGraph); 62 return createButton(scilabGraph, StartAction.class);
49 setEnabled(GraphActionManager.getEnable(StartAction.class)); 63 }
50 }
51 64
52 /** 65 /**
53 * @param scilabGraph 66 * @param scilabGraph graph
54 * graph 67 * @return menu item
55 * @return push button 68 */
56 */ 69 public static MenuItem createMenu(ScilabGraph scilabGraph) {
57 public static PushButton createButton(ScilabGraph scilabGraph) { 70 return createMenu(scilabGraph, StartAction.class);
58 return createButton(scilabGraph, StartAction.class); 71 }
59 } 72
73 /**
74 * Action !!!
75 * @param e the source event
76 * @see org.scilab.modules.gui.events.callback.CallBack#actionPerformed(java.awt.event.ActionEvent)
77 */
78 @Override
79 public void actionPerformed(ActionEvent e) {
80 final XcosDiagram diagram = ((XcosDiagram) getGraph(e)).getRootDiagram();
81 String cmd;
82
83 updateUI(true);
84
85 try {
86 cmd = createSimulationCommand(diagram);
87 } catch (IOException ex) {
88 LogFactory.getLog(StartAction.class).error(ex);
89 updateUI(false);
90 return;
91 }
92
93 final ActionListener action = new ActionListener() {
94 @Override
95 public void actionPerformed(ActionEvent e) {
96 updateUI(false);
97 diagram.getEngine().setCompilationNeeded(false);
98 }
99 };
100
101 try {
102 asynchronousScilabExec(action, cmd);
103 } catch (InterpreterException e1) {
104 e1.printStackTrace();
105 updateUI(false);
106 }
107 }
60 108
61 /** 109 /**
62 * @param scilabGraph 110 * Create the command String
63 * graph 111 *
64 * @return menu item 112 * @param diagram
113 * the working diagram
114 * @return the command string
115 * @throws IOException
116 * when temporary files must not be created.
65 */ 117 */
66 public static MenuItem createMenu(ScilabGraph scilabGraph) { 118 private String createSimulationCommand(final XcosDiagram diagram)
67 return createMenu(scilabGraph, StartAction.class); 119 throws IOException {
120 String cmd;
121 final StringBuilder command = new StringBuilder();
122
123 /*
124 * Log compilation info
125 */
126 final Log log = LogFactory.getLog(StartAction.class);
127 log.trace("start simulation");
128
129 /*
130 * Import a valid scs_m structure into Scilab
131 */
132 final String temp = FileUtils.createTempFile();
133 diagram.dumpToHdf5File(temp);
134
135 command.append(buildCall("import_from_hdf5", temp));
136 command.append(buildCall("scicos_debug", diagram.getScicosParameters().getDebugLevel()));
137
138 /*
139 * Simulate
140 */
141 command.append("xcos_simulate(scs_m, 4); ");
142
143 cmd = command.toString();
144 return cmd;
68 } 145 }
69 146
70 /** 147 /**
71 * Action !!! 148 * Update the UI depending on the action selected or not
72 * 149 * @param started the started status
73 * @param e
74 * the source event
75 * @see org.scilab.modules.gui.events.callback.CallBack#actionPerformed(java.awt.event.ActionEvent)
76 */ 150 */
77 @Override 151 public void updateUI(boolean started) {
78 public void actionPerformed(ActionEvent e) { 152 GraphActionManager.setEnable(StartAction.class, !started);
79 final XcosDiagram diagram = ((XcosDiagram) getGraph(e)) 153 GraphActionManager.setEnable(StopAction.class, started);
80 .getRootDiagram(); 154 ((XcosDiagram) getGraph(null)).setReadOnly(started);
81 155
82 ScilabGraphWorker.start(diagram, Action.SIMULATE); 156 if (started) {
157 ((XcosDiagram) getGraph(null)).info(XcosMessages.SIMULATION_IN_PROGRESS);
158 } else {
159 ((XcosDiagram) getGraph(null)).info(XcosMessages.EMPTY_INFO);
160 }
83 } 161 }
84} 162}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StopAction.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StopAction.java
index 22c16c6..a1b826b 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StopAction.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/StopAction.java
@@ -16,65 +16,66 @@ package org.scilab.modules.xcos.actions;
16 16
17import java.awt.event.ActionEvent; 17import java.awt.event.ActionEvent;
18 18
19import org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement;
19import org.scilab.modules.graph.ScilabGraph; 20import org.scilab.modules.graph.ScilabGraph;
20import org.scilab.modules.graph.actions.base.DefaultAction; 21import org.scilab.modules.graph.actions.base.DefaultAction;
21import org.scilab.modules.graph.actions.base.GraphActionManager; 22import org.scilab.modules.graph.actions.base.GraphActionManager;
22import org.scilab.modules.gui.menuitem.MenuItem; 23import org.scilab.modules.gui.menuitem.MenuItem;
23import org.scilab.modules.gui.pushbutton.PushButton; 24import org.scilab.modules.gui.pushbutton.PushButton;
24import org.scilab.modules.xcos.actions.workers.ScilabGraphWorker; 25import org.scilab.modules.xcos.graph.XcosDiagram;
25import org.scilab.modules.xcos.utils.XcosMessages; 26import org.scilab.modules.xcos.utils.XcosMessages;
26 27
27/** 28/**
28 * Stop the simulation 29 * Stop the simulation
29 */ 30 */
30public class StopAction extends DefaultAction { 31public class StopAction extends DefaultAction {
31 /** Name of the action */ 32 /** Name of the action */
32 public static final String NAME = XcosMessages.STOP; 33 public static final String NAME = XcosMessages.STOP;
33 /** Icon name of the action */ 34 /** Icon name of the action */
34 public static final String SMALL_ICON = "process-stop.png"; 35 public static final String SMALL_ICON = "process-stop.png";
35 /** Mnemonic key of the action */ 36 /** Mnemonic key of the action */
36 public static final int MNEMONIC_KEY = 0; 37 public static final int MNEMONIC_KEY = 0;
37 /** Accelerator key for the action */ 38 /** Accelerator key for the action */
38 public static final int ACCELERATOR_KEY = 0; 39 public static final int ACCELERATOR_KEY = 0;
39 40
40 /** 41 /**
41 * @param scilabGraph 42 * @param scilabGraph graph
42 * graph 43 */
43 */ 44 public StopAction(ScilabGraph scilabGraph) {
44 public StopAction(ScilabGraph scilabGraph) { 45 super(scilabGraph);
45 super(scilabGraph); 46 setEnabled(false);
46 setEnabled(false); 47 }
47 }
48 48
49 /** 49 /**
50 * @param scilabGraph 50 * @param scilabGraph graph
51 * graph 51 * @return push button
52 * @return push button 52 */
53 */ 53 public static PushButton createButton(ScilabGraph scilabGraph) {
54 public static PushButton createButton(ScilabGraph scilabGraph) { 54 return createButton(scilabGraph, StopAction.class);
55 return createButton(scilabGraph, StopAction.class); 55 }
56 }
57 56
58 /** 57 /**
59 * @param scilabGraph 58 * @param scilabGraph graph
60 * graph 59 * @return menu item
61 * @return menu item 60 */
62 */ 61 public static MenuItem createMenu(ScilabGraph scilabGraph) {
63 public static MenuItem createMenu(ScilabGraph scilabGraph) { 62 return createMenu(scilabGraph, StopAction.class);
64 return createMenu(scilabGraph, StopAction.class); 63 }
65 }
66 64
67 /** 65 /**
68 * Action !!! 66 * Action !!!
69 * 67 * @param e source event
70 * @param e 68 * @see org.scilab.modules.gui.events.callback.CallBack#actionPerformed(java.awt.event.ActionEvent)
71 * source event 69 */
72 * @see org.scilab.modules.gui.events.callback.CallBack#actionPerformed(java.awt.event.ActionEvent) 70 @Override
73 */ 71 public void actionPerformed(ActionEvent e) {
74 @Override 72 if (!GraphActionManager.getEnable(StartAction.class)) {
75 public void actionPerformed(ActionEvent e) { 73 ScilabInterpreterManagement.requestScilabExec("haltscicos");
76 if (!GraphActionManager.getEnable(StartAction.class)) { 74
77 ScilabGraphWorker.stop(); 75 ((XcosDiagram) getGraph(null)).info(XcosMessages.EMPTY_INFO);
78 } 76 GraphActionManager.setEnable(StartAction.class, true);
79 } 77 GraphActionManager.setEnable(StopAction.class, false);
78 ((XcosDiagram) getGraph(null)).setReadOnly(false);
79 }
80 }
80} 81}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/workers/ScilabGraphWorker.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/workers/ScilabGraphWorker.java
deleted file mode 100644
index 2553bc3..0000000
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/actions/workers/ScilabGraphWorker.java
+++ /dev/null
@@ -1,273 +0,0 @@
1package org.scilab.modules.xcos.actions.workers;
2
3import static org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.buildCall;
4import static org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement.synchronousScilabExec;
5
6import java.beans.PropertyChangeEvent;
7import java.beans.PropertyChangeListener;
8import java.io.IOException;
9import java.util.List;
10import java.util.concurrent.ExecutionException;
11
12import javax.swing.SwingWorker;
13
14import org.apache.commons.logging.Log;
15import org.apache.commons.logging.LogFactory;
16import org.scilab.modules.action_binding.highlevel.ScilabInterpreterManagement;
17import org.scilab.modules.graph.actions.base.GraphActionManager;
18import org.scilab.modules.xcos.actions.StartAction;
19import org.scilab.modules.xcos.actions.StopAction;
20import org.scilab.modules.xcos.graph.XcosDiagram;
21import org.scilab.modules.xcos.utils.FileUtils;
22import org.scilab.modules.xcos.utils.XcosMessages;
23
24public class ScilabGraphWorker extends SwingWorker<Void, String> {
25 private final XcosDiagram graph;
26 private final Action action;
27 private Action state = Action.DUMP;
28
29 private static ScilabGraphWorker currentWorker;
30
31 /**
32 * Available action mode of the worker
33 */
34 public static enum Action {
35 DUMP, COMPILE, SIMULATE
36 }
37
38 public static synchronized void start(final XcosDiagram graph, Action action) {
39 if (currentWorker == null) {
40 currentWorker = new ScilabGraphWorker(graph, action);
41 currentWorker.execute();
42 } else {
43 throw new IllegalStateException();
44 }
45 }
46
47 private static synchronized void clearState() {
48 currentWorker = null;
49 }
50
51 public static synchronized void stop() {
52 if (currentWorker != null) {
53 final ScilabGraphWorker worker = currentWorker;
54
55 // will clear the currentWorker (fire a state=DONE event).
56 worker.cancel(true);
57
58 switch (worker.state) {
59 case DUMP:
60 case COMPILE:
61
62 break;
63 case SIMULATE:
64 ScilabInterpreterManagement.requestScilabExec("haltscicos ();");
65 break;
66 }
67 } else {
68 throw new IllegalStateException();
69 }
70 }
71
72 public ScilabGraphWorker(final XcosDiagram graph, Action action) {
73 super();
74 this.graph = graph;
75 this.action = action;
76
77 addPropertyChangeListener(new PropertyChangeListener() {
78
79 @Override
80 public void propertyChange(PropertyChangeEvent evt) {
81 if ("state".equals(evt.getPropertyName())) {
82 switch (getState()) {
83 case PENDING:
84 case STARTED:
85 if (!graph.isReadonly()) {
86 graph.setReadOnly(true);
87 }
88
89 GraphActionManager.setEnable(StartAction.class, false);
90 GraphActionManager.setEnable(StopAction.class, true);
91 break;
92
93 case DONE:
94 clearState();
95
96 graph.setReadOnly(false);
97 graph.info(XcosMessages.EMPTY_INFO);
98
99 GraphActionManager.setEnable(StartAction.class, true);
100 GraphActionManager.setEnable(StopAction.class, false);
101 break;
102
103 default:
104 break;
105 }
106 }
107
108 }
109 });
110 }
111
112 @Override
113 protected Void doInBackground() throws Exception {
114 String cmd;
115
116 if (isCancelled()) {
117 return null;
118 }
119 publish(XcosMessages.EXPORT_IN_PROGRESS);
120 setProgress(20);
121 cmd = createDumpCommand(graph);
122 if (isCancelled()) {
123 return null;
124 }
125 publish(XcosMessages.IMPORT_IN_PROGRESS);
126 setProgress(40);
127 state = Action.DUMP;
128
129 if (action != Action.DUMP) {
130 synchronousScilabExec(cmd);
131
132 cmd = createCompilationCommand(graph);
133 if (isCancelled()) {
134 return null;
135 }
136 publish(XcosMessages.COMPILATION_IN_PROGRESS);
137 setProgress(60);
138 state = Action.COMPILE;
139 }
140
141 if (action != Action.DUMP && action != Action.COMPILE) {
142 synchronousScilabExec(cmd);
143
144 cmd = createSimulationCommand(graph);
145 if (isCancelled()) {
146 return null;
147 }
148 publish(XcosMessages.SIMULATION_IN_PROGRESS);
149 setProgress(80);
150 state = Action.SIMULATE;
151 }
152
153 synchronousScilabExec(cmd);
154
155 publish(XcosMessages.EMPTY_INFO);
156 setProgress(100);
157 return null;
158 }
159
160 @Override
161 protected void process(List<String> chunks) {
162 final String msg;
163 if (chunks.size() > 0) {
164 msg = chunks.get(chunks.size() - 1);
165 } else {
166 msg = XcosMessages.EMPTY_INFO;
167 }
168
169 graph.info(msg);
170 }
171
172 @Override
173 protected void done() {
174 try {
175 if (!isCancelled()) {
176 get();
177 }
178 } catch (InterruptedException e) {
179 e.printStackTrace();
180 } catch (ExecutionException e) {
181 e.printStackTrace();
182 }
183 }
184
185 /**
186 * Create the dump command String
187 *
188 * @param diagram
189 * the working diagram
190 * @return the command string
191 * @throws IOException
192 * when temporary files must not be created.
193 */
194 private static String createDumpCommand(final XcosDiagram diagram)
195 throws IOException {
196 String cmd;
197 final StringBuilder command = new StringBuilder();
198
199 /*
200 * Log compilation info
201 */
202 final Log log = LogFactory.getLog(StartAction.class);
203 log.trace("start export");
204
205 /*
206 * Import a valid scs_m structure into Scilab
207 */
208 final String temp = FileUtils.createTempFile();
209 diagram.dumpToHdf5File(temp);
210
211 command.append(buildCall("import_from_hdf5", temp));
212
213 cmd = command.toString();
214 return cmd;
215 }
216
217 /**
218 * Create the compilation command String
219 *
220 * @param diagram
221 * the working diagram
222 * @return the command string
223 * @throws IOException
224 * when temporary files must not be created.
225 */
226 private static String createCompilationCommand(final XcosDiagram diagram)
227 throws IOException {
228 String cmd;
229 final StringBuilder command = new StringBuilder();
230
231 /*
232 * Log compilation info
233 */
234 final Log log = LogFactory.getLog(StartAction.class);
235 log.trace("start compilation");
236
237 command.append(buildCall("scicos_debug", diagram.getScicosParameters()
238 .getDebugLevel()));
239 command.append("; %cpr=xcos_compile(scs_m); ");
240
241 cmd = command.toString();
242 return cmd;
243 }
244
245 /**
246 * Create the simulation command String
247 *
248 * @param diagram
249 * the working diagram
250 * @return the command string
251 * @throws IOException
252 * when temporary files must not be created.
253 */
254 private static String createSimulationCommand(final XcosDiagram diagram)
255 throws IOException {
256 String cmd;
257 final StringBuilder command = new StringBuilder();
258
259 /*
260 * Log compilation info
261 */
262 final Log log = LogFactory.getLog(StartAction.class);
263 log.trace("start simulation");
264
265 /*
266 * Simulate
267 */
268 command.append("xcos_simulate(scs_m, 0); ");
269
270 cmd = command.toString();
271 return cmd;
272 }
273}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/graph/CompilationEngineStatus.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/graph/CompilationEngineStatus.java
index aef2be3..4dda95e 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/graph/CompilationEngineStatus.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/graph/CompilationEngineStatus.java
@@ -27,14 +27,12 @@ import com.mxgraph.util.mxEventSource.mxIEventListener;
27/** 27/**
28 * Contains the current Scicos engine status. 28 * Contains the current Scicos engine status.
29 */ 29 */
30public class CompilationEngineStatus implements mxIEventListener, 30public class CompilationEngineStatus implements mxIEventListener, PropertyChangeListener {
31 PropertyChangeListener { 31 private static final Log LOG = LogFactory.getLog(CompilationEngineStatus.class);
32 private static final Log LOG = LogFactory 32
33 .getLog(CompilationEngineStatus.class);
34
35 private boolean compilationNeeded; 33 private boolean compilationNeeded;
36 private File compilationData; 34 private File compilationData;
37 35
38 /** 36 /**
39 * Default constructor. 37 * Default constructor.
40 */ 38 */
@@ -49,7 +47,7 @@ public class CompilationEngineStatus implements mxIEventListener,
49 */ 47 */
50 public void setCompilationNeeded(boolean status) { 48 public void setCompilationNeeded(boolean status) {
51 // compilationNeeded = status; 49 // compilationNeeded = status;
52 50
53 compilationNeeded = true; 51 compilationNeeded = true;
54 } 52 }
55 53
@@ -57,16 +55,15 @@ public class CompilationEngineStatus implements mxIEventListener,
57 * @return always true as we don't use scicos internal modification checking 55 * @return always true as we don't use scicos internal modification checking
58 */ 56 */
59 public boolean isCompilationNeeded() { 57 public boolean isCompilationNeeded() {
60 return true; 58 return compilationNeeded;
61 } 59 }
62 60
63 /** 61 /**
64 * @param compilationData 62 * @param compilationData the source and compiled diagram data
65 * the source and compiled diagram data
66 */ 63 */
67 public void setCompilationData(File compilationData) { 64 public void setCompilationData(File compilationData) {
68 this.compilationData = compilationData; 65 this.compilationData = compilationData;
69 66
70 /* 67 /*
71 * When the compiled data change, we remove the previous stored data. 68 * When the compiled data change, we remove the previous stored data.
72 */ 69 */
@@ -84,15 +81,14 @@ public class CompilationEngineStatus implements mxIEventListener,
84 public File getCompilationData() { 81 public File getCompilationData() {
85 return compilationData; 82 return compilationData;
86 } 83 }
87 84
88 /** 85 /**
89 * Get the command used to store the simulated data out of the stack. 86 * Get the command used to store the simulated data out of the stack.
90 *
91 * @return the scilab command 87 * @return the scilab command
92 */ 88 */
93 public String getStoreSimulationDataCommand() { 89 public String getStoreSimulationDataCommand() {
94 final StringBuilder command = new StringBuilder(); 90 final StringBuilder command = new StringBuilder();
95 91
96 /* 92 /*
97 * Create a data file if needed 93 * Create a data file if needed
98 */ 94 */
@@ -101,67 +97,61 @@ public class CompilationEngineStatus implements mxIEventListener,
101 setCompilationData(new File(FileUtils.createTempFile())); 97 setCompilationData(new File(FileUtils.createTempFile()));
102 } catch (IOException e) { 98 } catch (IOException e) {
103 LOG.warn(e); 99 LOG.warn(e);
104 100
105 /* 101 /*
106 * Restart compilation next time 102 * Restart compilation next time
107 */ 103 */
108 setCompilationNeeded(true); 104 setCompilationNeeded(true);
109 } 105 }
110 } 106 }
111 107
112 /* 108 /*
113 * Create the commands 109 * Create the commands
114 */ 110 */
115 command.append("path='" + getCompilationData().getAbsolutePath() 111 command.append("path='" + getCompilationData().getAbsolutePath() + "'; ");
116 + "'; ");
117 command.append("if and([exists('%cpr') exists('scs_m')]) <> %t then "); 112 command.append("if and([exists('%cpr') exists('scs_m')]) <> %t then ");
118 command.append(" deletefile(path);"); 113 command.append(" deletefile(path);");
119 command.append("else "); 114 command.append("else ");
120 command.append(" export_to_hdf5(path, '%cpr', 'scs_m'); "); 115 command.append(" export_to_hdf5(path, '%cpr', 'scs_m'); ");
121 command.append("end "); 116 command.append("end ");
122 117
123 return command.toString(); 118 return command.toString();
124 } 119 }
125 120
126 /** 121 /**
127 * Get the command used to load the simulated data into the stack. 122 * Get the command used to load the simulated data into the stack.
128 * 123 * @return a Scilab command
129 * @return a Scilab command throws IllegalStateException when the file 124 * throws IllegalStateException when the file cannot be loaded.
130 * cannot be loaded.
131 */ 125 */
132 public String getLoadSimulationDataCommand() { 126 public String getLoadSimulationDataCommand() {
133 final StringBuilder command = new StringBuilder(); 127 final StringBuilder command = new StringBuilder();
134 128
135 /* 129 /*
136 * Check state 130 * Check state
137 */ 131 */
138 if (getCompilationData() == null || !getCompilationData().exists()) { 132 if (getCompilationData() == null || !getCompilationData().exists()) {
139 throw new IllegalStateException("compilation data doesn't exist."); 133 throw new IllegalStateException("compilation data doesn't exist.");
140 } 134 }
141 135
142 /* 136 /*
143 * Create the commands 137 * Create the commands
144 */ 138 */
145 command.append("path = '" + getCompilationData().getAbsolutePath() 139 command.append("path = '" + getCompilationData().getAbsolutePath() + "' ; ");
146 + "' ; ");
147 command.append("import_from_hdf5(path); "); 140 command.append("import_from_hdf5(path); ");
148 141
149 return command.toString(); 142 return command.toString();
150 } 143 }
151 144
152 /* 145 /*
153 * Property change listener 146 * Property change listener
154 */ 147 */
155 148
156 /** 149 /**
157 * Listener used for any interesting diagram change. 150 * Listener used for any interesting diagram change.
158 * 151 *
159 * @param sender 152 * @param sender the associated diagram
160 * the associated diagram 153 * @param evt the current event.
161 * @param evt 154 * @see com.mxgraph.util.mxEventSource.mxIEventListener#invoke(java.lang.Object, com.mxgraph.util.mxEventObject)
162 * the current event.
163 * @see com.mxgraph.util.mxEventSource.mxIEventListener#invoke(java.lang.Object,
164 * com.mxgraph.util.mxEventObject)
165 */ 155 */
166 @Override 156 @Override
167 public void invoke(Object sender, mxEventObject evt) { 157 public void invoke(Object sender, mxEventObject evt) {
@@ -172,15 +162,14 @@ public class CompilationEngineStatus implements mxIEventListener,
172 * Property change listener used to update compilation status when the 162 * Property change listener used to update compilation status when the
173 * context has changed. 163 * context has changed.
174 * 164 *
175 * @param evt 165 * @param evt the current event
176 * the current event
177 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) 166 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
178 */ 167 */
179 @Override 168 @Override
180 public void propertyChange(PropertyChangeEvent evt) { 169 public void propertyChange(PropertyChangeEvent evt) {
181 setCompilationNeeded(true); 170 setCompilationNeeded(true);
182 } 171 }
183 172
184 /** 173 /**
185 * {@inheritDoc} 174 * {@inheritDoc}
186 */ 175 */
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java
index dd204b1..7de33ac 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java
@@ -18,6 +18,7 @@ import javax.swing.SwingUtilities;
18 18
19import org.scilab.modules.localization.Messages; 19import org.scilab.modules.localization.Messages;
20 20
21
21/** 22/**
22 * All localized messages/menus labels used in Xcos 23 * All localized messages/menus labels used in Xcos
23 */ 24 */
@@ -35,16 +36,13 @@ public final class XcosMessages {
35 /* File menu */ 36 /* File menu */
36 public static final String FILE = Messages.gettext("File"); 37 public static final String FILE = Messages.gettext("File");
37 public static final String NEW = Messages.gettext("New"); 38 public static final String NEW = Messages.gettext("New");
38 public static final String NEW_DIAGRAM = Messages.gettext("New diagram") 39 public static final String NEW_DIAGRAM = Messages.gettext("New diagram") + DOTS;
39 + DOTS; 40 public static final String NEW_PALETTE = Messages.gettext("New palette") + DOTS;
40 public static final String NEW_PALETTE = Messages.gettext("New palette")
41 + DOTS;
42 public static final String OPEN = Messages.gettext("Open") + DOTS; 41 public static final String OPEN = Messages.gettext("Open") + DOTS;
43 public static final String SAVE = Messages.gettext("Save"); 42 public static final String SAVE = Messages.gettext("Save");
44 public static final String SAVE_AS = Messages.gettext("Save as") + DOTS; 43 public static final String SAVE_AS = Messages.gettext("Save as") + DOTS;
45 public static final String EXPORT = Messages.gettext("Export") + DOTS; 44 public static final String EXPORT = Messages.gettext("Export") + DOTS;
46 public static final String SAVE_AS_INTERFACE_FUNCTION = Messages 45 public static final String SAVE_AS_INTERFACE_FUNCTION = Messages.gettext("Save as interface function") + DOTS;
47 .gettext("Save as interface function") + DOTS;
48 public static final String PRINT = Messages.gettext("Print") + DOTS; 46 public static final String PRINT = Messages.gettext("Print") + DOTS;
49 public static final String CLOSE = Messages.gettext("Close"); 47 public static final String CLOSE = Messages.gettext("Close");
50 public static final String QUIT = Messages.gettext("Quit Xcos"); 48 public static final String QUIT = Messages.gettext("Quit Xcos");
@@ -52,48 +50,35 @@ public final class XcosMessages {
52 50
53 /* Edit Menu */ 51 /* Edit Menu */
54 public static final String EDIT = Messages.gettext("Edit"); 52 public static final String EDIT = Messages.gettext("Edit");
55 public static final String BLOCK_PARAMETERS = Messages 53 public static final String BLOCK_PARAMETERS = Messages.gettext("Block Parameters") + DOTS;
56 .gettext("Block Parameters") + DOTS; 54 public static final String REGION_TO_SUPERBLOCK = Messages.gettext("Region to superblock");
57 public static final String REGION_TO_SUPERBLOCK = Messages 55 public static final String SUPERBLOCK_MASK = Messages.gettext("Superblock mask");
58 .gettext("Region to superblock");
59 public static final String SUPERBLOCK_MASK = Messages
60 .gettext("Superblock mask");
61 public static final String CREATE = Messages.gettext("Create"); 56 public static final String CREATE = Messages.gettext("Create");
62 public static final String REMOVE = Messages.gettext("Remove"); 57 public static final String REMOVE = Messages.gettext("Remove");
63 public static final String CUSTOMIZE = Messages.gettext("Customize") + DOTS; 58 public static final String CUSTOMIZE = Messages.gettext("Customize") + DOTS;
64 public static final String SAVE_BLOCK_GUI = Messages 59 public static final String SAVE_BLOCK_GUI = Messages.gettext("Save block GUI");
65 .gettext("Save block GUI");
66 60
67 /* Palette menu in palette browser */ 61 /* Palette menu in palette browser*/
68 public static final String LOAD_AS_PAL = Messages 62 public static final String LOAD_AS_PAL = Messages.gettext("Load as palette") + DOTS;
69 .gettext("Load as palette") + DOTS;
70 public static final String USER_DEFINED = Messages.gettext("User-Defined"); 63 public static final String USER_DEFINED = Messages.gettext("User-Defined");
71 public static final String REMOVE_USER_DEFINED = REMOVE; 64 public static final String REMOVE_USER_DEFINED = REMOVE;
72 public static final String CREATE_CATEGORY = Messages 65 public static final String CREATE_CATEGORY = Messages.gettext("Create a category");
73 .gettext("Create a category"); 66 public static final String ADDTO_CATEGORY = Messages.gettext("Add to a new category");
74 public static final String ADDTO_CATEGORY = Messages 67 public static final String DEFAULT_CATEGORY_NAME = Messages.gettext("Category");
75 .gettext("Add to a new category");
76 public static final String DEFAULT_CATEGORY_NAME = Messages
77 .gettext("Category");
78 68
79 public static final String DUMP = Messages.gettext("Dump"); 69 public static final String DUMP = Messages.gettext("Dump");
80 public static final String VIEW_IN_SCICOS = Messages 70 public static final String VIEW_IN_SCICOS = Messages.gettext("View in Scicos");
81 .gettext("View in Scicos"); 71
82
83 /* View Menu */ 72 /* View Menu */
84 public static final String VIEW = Messages.gettext("View"); 73 public static final String VIEW = Messages.gettext("View");
85 public static final String FIT_DIAGRAM_TO_VIEW = Messages 74 public static final String FIT_DIAGRAM_TO_VIEW = Messages.gettext("Fit diagram to view");
86 .gettext("Fit diagram to view");
87 public static final String NORMAL_100 = Messages.gettext("Normal 100%"); 75 public static final String NORMAL_100 = Messages.gettext("Normal 100%");
88 public static final String PALETTE_BROWSER = Messages 76 public static final String PALETTE_BROWSER = Messages.gettext("Palette browser");
89 .gettext("Palette browser"); 77 public static final String DIAGRAM_BROWSER = Messages.gettext("Diagram browser");
90 public static final String DIAGRAM_BROWSER = Messages
91 .gettext("Diagram browser");
92 public static final String VIEWPORT = Messages.gettext("Viewport"); 78 public static final String VIEWPORT = Messages.gettext("Viewport");
93 public static final String GET_INFOS = Messages.gettext("Get infos"); 79 public static final String GET_INFOS = Messages.gettext("Get infos");
94 public static final String DETAILS = Messages.gettext("Details"); 80 public static final String DETAILS = Messages.gettext("Details");
95 public static final String SHOW_PARENT = Messages 81 public static final String SHOW_PARENT = Messages.gettext("Show parent diagram");
96 .gettext("Show parent diagram");
97 82
98 /* Simulation menu */ 83 /* Simulation menu */
99 public static final String SIMULATION = Messages.gettext("Simulation"); 84 public static final String SIMULATION = Messages.gettext("Simulation");
@@ -109,130 +94,90 @@ public final class XcosMessages {
109 public static final String ROTATE = Messages.gettext("Rotate"); 94 public static final String ROTATE = Messages.gettext("Rotate");
110 public static final String FLIP = Messages.gettext("Flip"); 95 public static final String FLIP = Messages.gettext("Flip");
111 public static final String MIRROR = Messages.gettext("Mirror"); 96 public static final String MIRROR = Messages.gettext("Mirror");
112 public static final String SHOWHIDE_SHADOW = Messages 97 public static final String SHOWHIDE_SHADOW = Messages.gettext("Show/Hide shadow");
113 .gettext("Show/Hide shadow");
114 public static final String GRID = Messages.gettext("Grid"); 98 public static final String GRID = Messages.gettext("Grid");
115 public static final String DIAGRAM_BACKGROUND = Messages 99 public static final String DIAGRAM_BACKGROUND = Messages.gettext("Diagram background") + DOTS;
116 .gettext("Diagram background") + DOTS; 100
117
118 /* Format - Edit dialog */ 101 /* Format - Edit dialog */
119 public static final String BOLD = Messages.gettext("Bold"); 102 public static final String BOLD = Messages.gettext("Bold");
120 public static final String ITALIC = Messages.gettext("Italic"); 103 public static final String ITALIC = Messages.gettext("Italic");
121 public static final String FONT_SIZE = Messages.gettext("Font size"); 104 public static final String FONT_SIZE = Messages.gettext("Font size");
122 public static final String FONT_NAME = Messages.gettext("Font name"); 105 public static final String FONT_NAME = Messages.gettext("Font name");
123 public static final String FONT_STYLE = Messages.gettext("Font style"); 106 public static final String FONT_STYLE = Messages.gettext("Font style");
124 public static final String TEXT_SETTINGS = Messages 107 public static final String TEXT_SETTINGS = Messages.gettext("Text settings");
125 .gettext("Text settings");
126 public static final String IMAGE_PATH = Messages.gettext("Image path"); 108 public static final String IMAGE_PATH = Messages.gettext("Image path");
127 109
128 /* Tools menu */ 110 /* Tools menu */
129 public static final String TOOLS = Messages.gettext("Tools"); 111 public static final String TOOLS = Messages.gettext("Tools");
130 public static final String CODE_GENERATION = Messages 112 public static final String CODE_GENERATION = Messages.gettext("Code generation");
131 .gettext("Code generation");
132 113
133 /* Help menu */ 114 /* Help menu */
134 public static final String HELP = Messages.gettext("?"); 115 public static final String HELP = Messages.gettext("?");
135 public static final String XCOS_DOCUMENTATION = Messages 116 public static final String XCOS_DOCUMENTATION = Messages.gettext("Xcos Help");
136 .gettext("Xcos Help"); 117 public static final String BLOCK_DOCUMENTATION = Messages.gettext("Block Help");
137 public static final String BLOCK_DOCUMENTATION = Messages 118 public static final String XCOS_DEMONSTRATIONS = Messages.gettext("Xcos Demos");
138 .gettext("Block Help"); 119 public static final String ABOUT_XCOS = Messages.gettext("About Xcos") + DOTS;
139 public static final String XCOS_DEMONSTRATIONS = Messages
140 .gettext("Xcos Demos");
141 public static final String ABOUT_XCOS = Messages.gettext("About Xcos")
142 + DOTS;
143 120
144 /* PALETTES */ 121 /* PALETTES */
145 public static final String PALETTES = Messages.gettext("Palettes"); 122 public static final String PALETTES = Messages.gettext("Palettes");
146 public static final String SOURCES_PAL = Messages.gettext("Sources"); 123 public static final String SOURCES_PAL = Messages.gettext("Sources");
147 public static final String CONTINUOUS_PAL = Messages 124 public static final String CONTINUOUS_PAL = Messages.gettext("Continuous time systems");
148 .gettext("Continuous time systems");
149 public static final String IMPLICIT_PAL = Messages.gettext("Implicit"); 125 public static final String IMPLICIT_PAL = Messages.gettext("Implicit");
150 public static final String DISCONTINUOUS_PAL = Messages 126 public static final String DISCONTINUOUS_PAL = Messages.gettext("Discontinuities");
151 .gettext("Discontinuities"); 127 public static final String LOOKUPTABLES_PAL = Messages.gettext("Lookup Tables");
152 public static final String LOOKUPTABLES_PAL = Messages 128 public static final String SIGNALPROCESSING_PAL = Messages.gettext("Signal Processing");
153 .gettext("Lookup Tables"); 129 public static final String THRESHOLD_PAL = Messages.gettext("Zero crossing detection");
154 public static final String SIGNALPROCESSING_PAL = Messages 130 public static final String MATHSOPS_PAL = Messages.gettext("Mathematical Operations");
155 .gettext("Signal Processing");
156 public static final String THRESHOLD_PAL = Messages
157 .gettext("Zero crossing detection");
158 public static final String MATHSOPS_PAL = Messages
159 .gettext("Mathematical Operations");
160 public static final String INTEGER_PAL = Messages.gettext("Integer"); 131 public static final String INTEGER_PAL = Messages.gettext("Integer");
161 public static final String MATRIX_PAL = Messages.gettext("Matrix"); 132 public static final String MATRIX_PAL = Messages.gettext("Matrix");
162 public static final String SINKS_PAL = Messages.gettext("Sinks"); 133 public static final String SINKS_PAL = Messages.gettext("Sinks");
163 public static final String PORTACTION_PAL = Messages 134 public static final String PORTACTION_PAL = Messages.gettext("Port & Subsystem");
164 .gettext("Port & Subsystem"); 135 public static final String ANNOTATIONS_PAL = Messages.gettext("Annotations");
165 public static final String ANNOTATIONS_PAL = Messages 136 public static final String DISCRETE_PAL = Messages.gettext("Discrete time systems");
166 .gettext("Annotations");
167 public static final String DISCRETE_PAL = Messages
168 .gettext("Discrete time systems");
169 public static final String EVENTS_PAL = Messages.gettext("Event handling"); 137 public static final String EVENTS_PAL = Messages.gettext("Event handling");
170 public static final String SIGNALROUTING_PAL = Messages 138 public static final String SIGNALROUTING_PAL = Messages.gettext("Signal Routing");
171 .gettext("Signal Routing"); 139 public static final String COMMONUSED_PAL = Messages.gettext("Commonly Used Blocks");
172 public static final String COMMONUSED_PAL = Messages 140 public static final String USERDEFINEDFUNCTIONS_PAL = Messages.gettext("User-Defined Functions");
173 .gettext("Commonly Used Blocks"); 141 public static final String DEMOBLOCKS_PAL = Messages.gettext("Demonstrations Blocks");
174 public static final String USERDEFINEDFUNCTIONS_PAL = Messages
175 .gettext("User-Defined Functions");
176 public static final String DEMOBLOCKS_PAL = Messages
177 .gettext("Demonstrations Blocks");
178 public static final String ELECTRICAL_PAL = Messages.gettext("Electrical"); 142 public static final String ELECTRICAL_PAL = Messages.gettext("Electrical");
179 public static final String THERMOHYDRAULICS_PAL = Messages 143 public static final String THERMOHYDRAULICS_PAL = Messages.gettext("Thermo-Hydraulics");
180 .gettext("Thermo-Hydraulics"); 144
181
182 public static final String ENABLE = Messages.gettext("Enable"); 145 public static final String ENABLE = Messages.gettext("Enable");
183 public static final String PAL_NAME = Messages.gettext("Palette name"); 146 public static final String PAL_NAME = Messages.gettext("Palette name");
184 147
185 public static final String DIAGRAM_MODIFIED = Messages 148 public static final String DIAGRAM_MODIFIED = Messages.gettext("Diagram has been modified since last save.<br/> Do you want to save it?");
186 .gettext("Diagram has been modified since last save.<br/> Do you want to save it?"); 149 public static final String FILE_DOESNT_EXIST = Messages.gettext("The file %s doesn't exist\n Do you want to create it?");
187 public static final String FILE_DOESNT_EXIST = Messages
188 .gettext("The file %s doesn't exist\n Do you want to create it?");
189 150
190 public static final String OK = Messages.gettext("Ok"); 151 public static final String OK = Messages.gettext("Ok");
191 public static final String CANCEL = Messages.gettext("Cancel"); 152 public static final String CANCEL = Messages.gettext("Cancel");
192 public static final String SET_CONTEXT_LABEL_TEXT = "<html>" 153 public static final String SET_CONTEXT_LABEL_TEXT = "<html>" + Messages.gettext("You may enter here scilab instructions to define symbolic parameters used in block definitions using Scilab instructions.<br/>These instructions are evaluated once confirmed (i.e. you click on OK and every time the diagram is loaded).") + "</html>";
193 + Messages
194 .gettext("You may enter here scilab instructions to define symbolic parameters used in block definitions using Scilab instructions.<br/>These instructions are evaluated once confirmed (i.e. you click on OK and every time the diagram is loaded).")
195 + "</html>";
196 154
197 public static final String FAIL_LOADING_DIAGRAM = Messages 155 public static final String FAIL_LOADING_DIAGRAM = Messages.gettext("Failed to load Diagram");
198 .gettext("Failed to load Diagram"); 156 public static final String FAIL_SAVING_DIAGRAM = Messages.gettext("Could not save diagram.");
199 public static final String FAIL_SAVING_DIAGRAM = Messages 157 public static final String OVERWRITE_EXISTING_FILE = Messages.gettext("Do you want to overwrite existing file?");
200 .gettext("Could not save diagram."); 158 public static final String TRANSPARENT_BACKGROUND = Messages.gettext("Do you want a transparent background image?");
201 public static final String OVERWRITE_EXISTING_FILE = Messages 159 public static final String NO_IMAGE_DATA = Messages.gettext("Image contains no data.");
202 .gettext("Do you want to overwrite existing file?"); 160 public static final String UNKNOW_VERSION = Messages.gettext("Unknown Diagram Version : ");
203 public static final String TRANSPARENT_BACKGROUND = Messages 161 public static final String TRY_TO_CONTINUE = Messages.gettext("Will try to continue...");
204 .gettext("Do you want a transparent background image?");
205 public static final String NO_IMAGE_DATA = Messages
206 .gettext("Image contains no data.");
207 public static final String UNKNOW_VERSION = Messages
208 .gettext("Unknown Diagram Version : ");
209 public static final String TRY_TO_CONTINUE = Messages
210 .gettext("Will try to continue...");
211 162
212 public static final String XCOS_ERROR = Messages.gettext("Xcos error"); 163 public static final String XCOS_ERROR = Messages.gettext("Xcos error");
213 public static final String UNABLE_TO_DELETE = Messages 164 public static final String UNABLE_TO_DELETE = Messages.gettext("Unable to delete ");
214 .gettext("Unable to delete "); 165 public static final String NO_BLOCK_SELECTED = Messages.gettext("No block selected");
215 public static final String NO_BLOCK_SELECTED = Messages
216 .gettext("No block selected");
217 166
167 public static final String EXPORT_TO_XML = Messages.gettext("Export to XML") + DOTS;
168 public static final String EXPORT_IN_PROGRESS = Messages.gettext("Export in progress") + DOTS;
169 public static final String IMPORT_FROM_XML = Messages.gettext("Import from XML") + DOTS;
170
218 public static final String ADDTO = Messages.gettext("Add to"); 171 public static final String ADDTO = Messages.gettext("Add to");
219 public static final String ADDTO_NEW_DIAGRAM = Messages 172 public static final String ADDTO_NEW_DIAGRAM = Messages.gettext("Add to new diagram");
220 .gettext("Add to new diagram"); 173
221 174 public static final String LINK_ERROR_EXPLICIT_IN = Messages.gettext("Explicit data input port must be connected to explicit data output port");
222 public static final String LINK_ERROR_EXPLICIT_IN = Messages 175 public static final String LINK_ERROR_IMPLICIT_IN = Messages.gettext("Implicit data input port must be connected to implicit data output port");
223 .gettext("Explicit data input port must be connected to explicit data output port"); 176 public static final String LINK_ERROR_EXPLICIT_OUT = Messages.gettext("Explicit data output port must be connected to explicit data input port");
224 public static final String LINK_ERROR_IMPLICIT_IN = Messages 177 public static final String LINK_ERROR_IMPLICIT_OUT = Messages.gettext("Implicit data output port must be connected to implicit data input port");
225 .gettext("Implicit data input port must be connected to implicit data output port"); 178 public static final String LINK_ERROR_EVENT_IN = Messages.gettext("Command port must be connected to control port");
226 public static final String LINK_ERROR_EXPLICIT_OUT = Messages 179 public static final String LINK_ERROR_EVENT_OUT = Messages.gettext("control port must be connected to command port");
227 .gettext("Explicit data output port must be connected to explicit data input port"); 180 public static final String LINK_ERROR_ALREADY_CONNECTED = Messages.gettext("Port is already connected, please select an unconnected port or a valid link.");
228 public static final String LINK_ERROR_IMPLICIT_OUT = Messages
229 .gettext("Implicit data output port must be connected to implicit data input port");
230 public static final String LINK_ERROR_EVENT_IN = Messages
231 .gettext("Command port must be connected to control port");
232 public static final String LINK_ERROR_EVENT_OUT = Messages
233 .gettext("control port must be connected to command port");
234 public static final String LINK_ERROR_ALREADY_CONNECTED = Messages
235 .gettext("Port is already connected, please select an unconnected port or a valid link.");
236 181
237 public static final String ALIGN_BLOCKS = Messages.gettext("Align Blocks"); 182 public static final String ALIGN_BLOCKS = Messages.gettext("Align Blocks");
238 public static final String ALIGN_LEFT = Messages.gettext("Left"); 183 public static final String ALIGN_LEFT = Messages.gettext("Left");
@@ -241,94 +186,58 @@ public final class XcosMessages {
241 public static final String ALIGN_TOP = Messages.gettext("Top"); 186 public static final String ALIGN_TOP = Messages.gettext("Top");
242 public static final String ALIGN_BOTTOM = Messages.gettext("Bottom"); 187 public static final String ALIGN_BOTTOM = Messages.gettext("Bottom");
243 public static final String ALIGN_MIDDLE = Messages.gettext("Middle"); 188 public static final String ALIGN_MIDDLE = Messages.gettext("Middle");
244 189
245 public static final String BORDER_COLOR = Messages.gettext("Border Color"); 190 public static final String BORDER_COLOR = Messages.gettext("Border Color");
246 public static final String FILL_COLOR = Messages.gettext("Fill Color"); 191 public static final String FILL_COLOR = Messages.gettext("Fill Color");
247 public static final String TEXT_COLOR = Messages.gettext("Text Color"); 192 public static final String TEXT_COLOR = Messages.gettext("Text Color");
248 193
249 public static final String LINK_STYLE = Messages.gettext("Link Style"); 194 public static final String LINK_STYLE = Messages.gettext("Link Style");
250 public static final String LINK_STYLE_STRAIGHT = Messages 195 public static final String LINK_STYLE_STRAIGHT = Messages.gettext("Straight");
251 .gettext("Straight"); 196 public static final String LINK_STYLE_HORIZONTAL = Messages.gettext("Horizontal");
252 public static final String LINK_STYLE_HORIZONTAL = Messages 197 public static final String LINK_STYLE_VERTICAL = Messages.gettext("Vertical");
253 .gettext("Horizontal"); 198
254 public static final String LINK_STYLE_VERTICAL = Messages 199 public static final String DEBUG_LEVEL_LABEL = "<html>" + Messages.gettext("Set debugging level (0,1,2,3) <br/> it performs scicos_debug(n)") + "</html>";
255 .gettext("Vertical"); 200 public static final String SET_DEBUG = Messages.gettext("Execution trace and Debug");
256 201
257 public static final String DEBUG_LEVEL_LABEL = "<html>" 202 /* Setup box*/
258 + Messages 203 public static final String FINAL_INTEGRATION_TIME = Messages.gettext("Final integration time");
259 .gettext("Set debugging level (0,1,2,3) <br/> it performs scicos_debug(n)") 204 public static final String REAL_TIME_SCALING = Messages.gettext("Real time scaling");
260 + "</html>"; 205 public static final String INTEGRATOR_ABSOLUTE_TOLERANCE = Messages.gettext("Integrator absolute tolerance");
261 public static final String SET_DEBUG = Messages 206 public static final String INTEGRATOR_RELATIVE_TOLERANCE = Messages.gettext("Integrator relative tolerance");
262 .gettext("Execution trace and Debug"); 207 public static final String TOLERANCE_ON_TIME = Messages.gettext("Tolerance on time");
263 208 public static final String MAX_INTEGRATION_TIME_INTERVAL = Messages.gettext("Max integration time interval");
264 /* Setup box */ 209 public static final String SOLVER_CHOICE = Messages.gettext("Solver 0 (CVODE) - 100 (IDA)");
265 public static final String FINAL_INTEGRATION_TIME = Messages 210 public static final String CVODE = Messages.gettext("CVODE");
266 .gettext("Final integration time"); 211 public static final String IDA = Messages.gettext("IDA");
267 public static final String REAL_TIME_SCALING = Messages 212 public static final String MAXIMUN_STEP_SIZE = Messages.gettext("maximum step size (0 means no limit)");
268 .gettext("Real time scaling"); 213 public static final String DEFAULT = Messages.gettext("Default");
269 public static final String INTEGRATOR_ABSOLUTE_TOLERANCE = Messages 214 public static final String SETUP_TITLE = Messages.gettext("Set Parameters");
270 .gettext("Integrator absolute tolerance"); 215
271 public static final String INTEGRATOR_RELATIVE_TOLERANCE = Messages
272 .gettext("Integrator relative tolerance");
273 public static final String TOLERANCE_ON_TIME = Messages
274 .gettext("Tolerance on time");
275 public static final String MAX_INTEGRATION_TIME_INTERVAL = Messages
276 .gettext("Max integration time interval");
277 public static final String SOLVER_CHOICE = Messages
278 .gettext("Solver 0 (CVODE) - 100 (IDA)");
279 public static final String CVODE = Messages.gettext("CVODE");
280 public static final String IDA = Messages.gettext("IDA");
281 public static final String MAXIMUN_STEP_SIZE = Messages
282 .gettext("maximum step size (0 means no limit)");
283 public static final String DEFAULT = Messages.gettext("Default");
284 public static final String SETUP_TITLE = Messages.gettext("Set Parameters");
285
286 /* About box */ 216 /* About box */
287 public static final String CONSORTIUM = "The Scilab Consortium (DIGITEO)"; 217 public static final String CONSORTIUM = "The Scilab Consortium (DIGITEO)";
288 public static final String COPYRIGHT_INRIA = "Copyright © 1989-2009 (INRIA)"; 218 public static final String COPYRIGHT_INRIA = "Copyright © 1989-2009 (INRIA)";
289 public static final String SCICOS_BASED = Messages 219 public static final String SCICOS_BASED = Messages.gettext("Based on Scicos");
290 .gettext("Based on Scicos");
291 220
292 /* InfoBar messages */ 221 /* InfoBar messages */
293 public static final String EMPTY_INFO = ""; 222 public static final String EMPTY_INFO = "";
294 public static final String SAVING_DIAGRAM = Messages 223 public static final String SAVING_DIAGRAM = Messages.gettext("Saving diagram") + DOTS;
295 .gettext("Saving diagram") + DOTS; 224 public static final String LOADING_DIAGRAM = Messages.gettext("Loading diagram") + DOTS;
296 public static final String LOADING_DIAGRAM = Messages 225 public static final String LOADING_PALETTES = Messages.gettext("Loading palettes") + DOTS;
297 .gettext("Loading diagram") + DOTS; 226 public static final String LOADING_USER_DEFINE = Messages.gettext("Loading user defined palettes") + DOTS;
298 public static final String LOADING_PALETTES = Messages 227 public static final String GENERATING_C_CODE = Messages.gettext("Generating C Code for SuperBlock") + DOTS;
299 .gettext("Loading palettes") + DOTS; 228 public static final String ERROR_GENERATING_C_CODE = Messages.gettext("A SuperBlock must be selected to generate code");
300 public static final String LOADING_USER_DEFINE = Messages 229 public static final String SIMULATION_IN_PROGRESS = Messages.gettext("Simulation in progress") + DOTS;
301 .gettext("Loading user defined palettes") + DOTS; 230 public static final String COMPILATION_IN_PROGRESS = Messages.gettext("Compilation in progress, results will be stored in the \'scicos_cpr\' variable") + DOTS;
302 public static final String GENERATING_C_CODE = Messages 231 public static final String GENERATE_SUPERBLOCK = Messages.gettext("Generate SuperBlock, please wait") + DOTS;
303 .gettext("Generating C Code for SuperBlock") + DOTS; 232 public static final String DRAW_LINK = Messages.gettext("Click on diagram to add link point or on a compatible target to finish");
304 public static final String ERROR_GENERATING_C_CODE = Messages 233
305 .gettext("A SuperBlock must be selected to generate code"); 234
306 public static final String EXPORT_IN_PROGRESS = Messages 235 /* Debug level messages */
307 .gettext("Export in progress") + DOTS; 236 public static final String DEBUGLEVEL_0 = Messages.gettext("No trace nor debug printing");
308 public static final String IMPORT_IN_PROGRESS = Messages 237 public static final String DEBUGLEVEL_1 = Messages.gettext("Light Simulation trace (Discrete and Continuous part switches)");
309 .gettext("Import in progress, results will be stored through the 'scs_m' variable") 238 public static final String DEBUGLEVEL_2 = Messages.gettext("Per block execution trace and Debug block calls");
310 + DOTS; 239 public static final String DEBUGLEVEL_3 = Messages.gettext("Debug block calls without trace");
311 public static final String COMPILATION_IN_PROGRESS = Messages 240
312 .gettext("Compilation in progress, results will be stored through the '%cpr' variable")
313 + DOTS;
314 public static final String SIMULATION_IN_PROGRESS = Messages
315 .gettext("Simulation in progress") + DOTS;
316
317 public static final String GENERATE_SUPERBLOCK = Messages
318 .gettext("Generate SuperBlock, please wait") + DOTS;
319 public static final String DRAW_LINK = Messages
320 .gettext("Click on diagram to add link point or on a compatible target to finish");
321
322 /* Debug level messages */
323 public static final String DEBUGLEVEL_0 = Messages
324 .gettext("No trace nor debug printing");
325 public static final String DEBUGLEVEL_1 = Messages
326 .gettext("Light Simulation trace (Discrete and Continuous part switches)");
327 public static final String DEBUGLEVEL_2 = Messages
328 .gettext("Per block execution trace and Debug block calls");
329 public static final String DEBUGLEVEL_3 = Messages
330 .gettext("Debug block calls without trace");
331
332 /* File description */ 241 /* File description */
333 public static final String FILE_COSF = Messages.gettext("Scicos file"); 242 public static final String FILE_COSF = Messages.gettext("Scicos file");
334 public static final String FILE_COS = FILE_COSF; 243 public static final String FILE_COS = FILE_COSF;
@@ -336,71 +245,55 @@ public final class XcosMessages {
336 public static final String FILE_HDF5 = Messages.gettext("Scilab file"); 245 public static final String FILE_HDF5 = Messages.gettext("Scilab file");
337 246
338 /* Superblock mask editor */ 247 /* Superblock mask editor */
339 public static final String MASK_TITLE = Messages 248 public static final String MASK_TITLE = Messages.gettext("Masked SuperBlock editor");
340 .gettext("Masked SuperBlock editor");
341 public static final String MASK_INSERT = Messages.gettext("Insert"); 249 public static final String MASK_INSERT = Messages.gettext("Insert");
342 public static final String MASK_DELETE = Messages.gettext("Delete"); 250 public static final String MASK_DELETE = Messages.gettext("Delete");
343 public static final String MASK_MOVEUP = Messages.gettext("Move Up"); 251 public static final String MASK_MOVEUP = Messages.gettext("Move Up");
344 public static final String MASK_MOVEDOWN = Messages.gettext("Move Down"); 252 public static final String MASK_MOVEDOWN = Messages.gettext("Move Down");
345 public static final String MASK_ROWS = Messages.gettext("Rows"); 253 public static final String MASK_ROWS = Messages.gettext("Rows");
346 public static final String MASK_VARSETTINGS = Messages 254 public static final String MASK_VARSETTINGS = Messages.gettext("Variable settings");
347 .gettext("Variable settings"); 255 public static final String MASK_DEFAULTVALUES = Messages.gettext("Default values");
348 public static final String MASK_DEFAULTVALUES = Messages
349 .gettext("Default values");
350 public static final String MASK_WINTITLEVAR = Messages.gettext("WinTitle"); 256 public static final String MASK_WINTITLEVAR = Messages.gettext("WinTitle");
351 public static final String MASK_WINTITLE = Messages.gettext("Window title"); 257 public static final String MASK_WINTITLE = Messages.gettext("Window title");
352 public static final String MASK_VARNAME = Messages 258 public static final String MASK_VARNAME = Messages.gettext("Variable names");
353 .gettext("Variable names"); 259 public static final String MASK_VARDESC = Messages.gettext("Variable descriptions");
354 public static final String MASK_VARDESC = Messages
355 .gettext("Variable descriptions");
356 public static final String MASK_EDITABLE = Messages.gettext("Editable"); 260 public static final String MASK_EDITABLE = Messages.gettext("Editable");
357 public static final String MASK_VARVALUES = Messages.gettext("Values"); 261 public static final String MASK_VARVALUES = Messages.gettext("Values");
358 public static final String MASK_DEFAULTWINDOWNAME = Messages 262 public static final String MASK_DEFAULTWINDOWNAME = Messages.gettext("Set block parameters");
359 .gettext("Set block parameters");
360 263
361 /* Configuration Error */ 264 /* Configuration Error */
362 public static final String ERR_CONFIG_PALETTE_INVALID = Messages 265 public static final String ERR_CONFIG_PALETTE_INVALID = Messages.gettext("The user palette configuration file (palettes.xml) is invalid.<BR> Switching to the default one.");
363 .gettext("The user palette configuration file (palettes.xml) is invalid.<BR> Switching to the default one."); 266 public static final String ERR_CONFIG_INVALID = Messages.gettext("The user configuration file (xcos.xml) is invalid.<BR> Switching to the default one.");
364 public static final String ERR_CONFIG_INVALID = Messages 267
365 .gettext("The user configuration file (xcos.xml) is invalid.<BR> Switching to the default one.");
366
367 /* Modelica Compiler */ 268 /* Modelica Compiler */
368 public static final String INITIALIZING_MODELICA_COMPILER = Messages 269 public static final String INITIALIZING_MODELICA_COMPILER = Messages.gettext("Setting up Modelica Compiler.");
369 .gettext("Setting up Modelica Compiler."); 270 public static final String INIT_MODELICA = Messages.gettext("Modelica initialize");
370 public static final String INIT_MODELICA = Messages 271
371 .gettext("Modelica initialize");
372
373 /* Blocks values */ 272 /* Blocks values */
374 public static final String BLOCK_FROM = "From %s"; 273 public static final String BLOCK_FROM = "From %s";
375 public static final String BLOCK_GOTO = "Goto %s"; 274 public static final String BLOCK_GOTO = "Goto %s";
376 275
377 /* Errors */ 276 /* Errors */
378 public static final String ERROR_UNABLE_TO_COMPILE_THIS_SUPER_BLOCK = Messages 277 public static final String ERROR_UNABLE_TO_COMPILE_THIS_SUPER_BLOCK = Messages.gettext("Error: unable to compile this SuperBlock");
379 .gettext("Error: unable to compile this SuperBlock"); 278 public static final String WRONG_PORT_NUMBER = Messages.gettext("Wrong port number");
380 public static final String WRONG_PORT_NUMBER = Messages 279
381 .gettext("Wrong port number"); 280// CSON: JavadocVariable
382 281// CSON: LineLength
383 // CSON: JavadocVariable 282// CSON: MultipleStringLiterals
384 // CSON: LineLength 283
385 // CSON: MultipleStringLiterals
386
387 /** This class is a static singleton, thus it must not be instantiated */ 284 /** This class is a static singleton, thus it must not be instantiated */
388 private XcosMessages() { 285 private XcosMessages() { }
389 } 286
390
391 /** 287 /**
392 * This function checks for the popup menu activation under MacOS with Java 288 * This function checks for the popup menu activation under MacOS with Java version 1.5
393 * version 1.5
394 * Related to Scilab bug #5190 289 * Related to Scilab bug #5190
395 * 290 * @param e Click event
396 * @param e
397 * Click event
398 * @return true if Java 1.5 and MacOS and mouse clic and ctrl activated 291 * @return true if Java 1.5 and MacOS and mouse clic and ctrl activated
399 */ 292 */
400 public static boolean isMacOsPopupTrigger(MouseEvent e) { 293 public static boolean isMacOsPopupTrigger(MouseEvent e) {
401 return (SwingUtilities.isLeftMouseButton(e) 294 return (SwingUtilities.isLeftMouseButton(e)
402 && e.isControlDown() 295 && e.isControlDown()
403 && (System.getProperty("os.name").toLowerCase().indexOf("mac") != -1) && (System 296 && (System.getProperty("os.name").toLowerCase().indexOf("mac") != -1) && (System
404 .getProperty("java.specification.version").equals("1.5"))); 297 .getProperty("java.specification.version").equals("1.5")));
405 } 298 }
406} 299}