Permalink
Browse files

Implements the new minimalist editor toolbar/menu (see gama-dev list)

Provides a possible fix for #2055 (please comment)
Correctly passes the scope to create delegates (necessary for the
https://github.com/ANRGenstar/genstar project)

Signed-off-by: AlexisDrogoul <alexis.drogoul@gmail.com>
  • Loading branch information...
1 parent 096ad19 commit a44d57031e481dfe17263bc523e560d300cd62db @AlexisDrogoul AlexisDrogoul committed Dec 5, 2016
Showing with 2,125 additions and 2,269 deletions.
  1. +116 −101 irit.gaml.extensions.database/src/irit/gaml/extensions/database/species/AgentDB.java
  2. +2 −0 msi.gama.core/src/msi/gama/common/interfaces/IGui.java
  3. +6 −0 msi.gama.core/src/msi/gama/runtime/HeadlessListener.java
  4. +1 −1 msi.gama.core/src/msi/gama/util/file/GamaXMLFile.java
  5. +172 −83 msi.gama.core/src/msi/gaml/statements/CreateStatement.java
  6. +0 −6 msi.gama.models/models/Syntax/Syntax models/models/Preferences.gaml
  7. +2 −1 ummisco.gama.ui.experiment/META-INF/MANIFEST.MF
  8. +15 −0 ummisco.gama.ui.experiment/plugin.xml
  9. +26 −0 ummisco.gama.ui.experiment/src/ummisco/gama/ui/commands/ShowInteractiveConsole.java
  10. +4 −4 ummisco.gama.ui.experiment/src/ummisco/gama/ui/controls/StatusControlContribution.java
  11. +10 −16 ummisco.gama.ui.experiment/src/ummisco/gama/ui/menus/AgentsMenu.java
  12. +15 −38 ummisco.gama.ui.experiment/src/ummisco/gama/ui/views/inspectors/ExpandableItemsView.java
  13. +4 −22 ummisco.gama.ui.experiment/src/ummisco/gama/ui/views/inspectors/ExperimentParametersView.java
  14. +8 −0 ummisco.gama.ui.modeling/plugin.xml
  15. +33 −68 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/AutoStartup.java
  16. +16 −5 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/GamaSourceViewer.java
  17. +161 −133 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/GamlEditor.java
  18. +60 −0 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/GamlEditorBindings.java
  19. +2 −8 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/GamlMarkOccurrenceActionContributor.java
  20. +3 −5 ....gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/CreateExperimentSelectionListener.java
  21. +0 −456 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/EditToolbar.java
  22. +0 −99 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/EditToolbarColorMenu.java
  23. +0 −148 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/EditToolbarMenu.java
  24. +0 −79 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/EditToolbarMenuFactory.java
  25. +39 −179 ...c/msi/gama/lang/gaml/ui/editor/toolbar/{EditToolbarFindControls.java → EditorSearchControls.java}
  26. +172 −0 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/EditorToolbar.java
  27. +21 −19 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/GamlQuickOutlinePopup.java
  28. +0 −143 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/ImportedInButton.java
  29. +5 −9 ...co.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/OpenExperimentSelectionListener.java
  30. +0 −225 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/editor/toolbar/OtherExperimentsButton.java
  31. +22 −6 ...a/lang/gaml/ui/{editor/toolbar/EditToolbarBuiltinMenu.java → reference/BuiltinReferenceMenu.java}
  32. +91 −0 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/reference/ColorReferenceMenu.java
  33. +154 −0 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/reference/GamlReferenceMenu.java
  34. +63 −0 ummisco.gama.ui.modeling/src/msi/gama/lang/gaml/ui/reference/GamlReferenceSearch.java
  35. +46 −30 ...ng/gaml/ui/{editor/toolbar/EditToolbarOperatorsMenu.java → reference/OperatorsReferenceMenu.java}
  36. +27 −15 ...lang/gaml/ui/{editor/toolbar/EditToolbarTemplateMenu.java → reference/TemplateReferenceMenu.java}
  37. +511 −0 ummisco.gama.ui.modeling/src/ummisco/gama/ui/modeling/EditorMenu.java
  38. +3 −5 ummisco.gama.ui.modeling/src/ummisco/gama/ui/views/SyntaxErrorsView.java
  39. BIN ummisco.gama.ui.shared/icons/build.warnings.png
  40. BIN ummisco.gama.ui.shared/icons/editor.comment2.png
  41. BIN ummisco.gama.ui.shared/icons/editor.format.png
  42. BIN ummisco.gama.ui.shared/icons/imported.in.png
  43. BIN ummisco.gama.ui.shared/icons/other.experiments.png
  44. BIN ummisco.gama.ui.shared/icons/reference.builtin.png
  45. BIN ummisco.gama.ui.shared/icons/reference.colors.png
  46. BIN ummisco.gama.ui.shared/icons/reference.operators.png
  47. BIN ummisco.gama.ui.shared/icons/reference.templates.png
  48. BIN ummisco.gama.ui.shared/icons/toggle.box.png
  49. BIN ummisco.gama.ui.shared/icons/toggle.folding.png
  50. BIN ummisco.gama.ui.shared/icons/toggle.mark.png
  51. BIN ummisco.gama.ui.shared/icons/toggle.numbers.png
  52. BIN ummisco.gama.ui.shared/icons/toggle.overview.png
  53. BIN ummisco.gama.ui.shared/icons/view.interactive.png
  54. +85 −21 ummisco.gama.ui.shared/src/ummisco/gama/ui/access/GamlSearchField.java
  55. +50 −18 ummisco.gama.ui.shared/src/ummisco/gama/ui/bindings/GamaKeyBindings.java
  56. +38 −86 ummisco.gama.ui.shared/src/ummisco/gama/ui/controls/FlatButton.java
  57. +31 −64 ummisco.gama.ui.shared/src/ummisco/gama/ui/controls/ParameterExpandItem.java
  58. +20 −32 ummisco.gama.ui.shared/src/ummisco/gama/ui/menus/GamaColorMenu.java
  59. +21 −23 ummisco.gama.ui.shared/src/ummisco/gama/ui/menus/GamaMenu.java
  60. +0 −65 ummisco.gama.ui.shared/src/ummisco/gama/ui/menus/GamaMenuItem.java
  61. +3 −5 ummisco.gama.ui.shared/src/ummisco/gama/ui/parameters/ColorEditor.java
  62. +8 −3 ummisco.gama.ui.shared/src/ummisco/gama/ui/resources/GamaFonts.java
  63. +4 −5 ummisco.gama.ui.shared/src/ummisco/gama/ui/resources/IGamaColors.java
  64. +3 −3 ummisco.gama.ui.shared/src/ummisco/gama/ui/utils/PreferencesHelper.java
  65. +6 −0 ummisco.gama.ui.shared/src/ummisco/gama/ui/utils/SwtGui.java
  66. +17 −0 ummisco.gama.ui.shared/src/ummisco/gama/ui/views/IGamlEditor.java
  67. +4 −14 ummisco.gama.ui.shared/src/ummisco/gama/ui/views/toolbar/BackgroundChooser.java
  68. +15 −19 ummisco.gama.ui.shared/src/ummisco/gama/ui/views/toolbar/GamaToolbar2.java
  69. +10 −7 ummisco.gama.ui.shared/src/ummisco/gama/ui/views/toolbar/GamaToolbarSimple.java
@@ -1,9 +1,8 @@
/*********************************************************************************************
*
*
- * 'AgentDB.java', in plugin 'irit.gaml.extensions.database', is part of the source code of the
- * GAMA modeling and simulation platform.
- * (c) 2007-2014 UMI 209 UMMISCO IRD/UPMC & Partners
+ * 'AgentDB.java', in plugin 'irit.gaml.extensions.database', is part of the source code of the GAMA modeling and
+ * simulation platform. (c) 2007-2014 UMI 209 UMMISCO IRD/UPMC & Partners
*
* Visit https://code.google.com/p/gama-platform/ for license information and developers contact.
*
@@ -32,49 +31,27 @@
/*
* @Author TRUONG Minh Thai
*
- * @Supervisors:
- * Christophe Sibertin-BLANC
- * Fredric AMBLARD
- * Benoit GAUDOU
+ * @Supervisors: Christophe Sibertin-BLANC Fredric AMBLARD Benoit GAUDOU
*
- * species: The AgentDB is defined in this class. AgentDB supports the action
- * - isConnected: returns true/false
- * - testConnection: tests the connection
- * - close: closes the current connection
- * - connect: makes a connection to DBMS.
- * - select: executeQuery to select data from DBMS via current connection.
- * - executeUpdate: runs executeUpdate to update/insert/delete/drop/create data on DBMS via current
- * connection.
+ * species: The AgentDB is defined in this class. AgentDB supports the action - isConnected: returns true/false -
+ * testConnection: tests the connection - close: closes the current connection - connect: makes a connection to DBMS. -
+ * select: executeQuery to select data from DBMS via current connection. - executeUpdate: runs executeUpdate to
+ * update/insert/delete/drop/create data on DBMS via current connection.
*
- * created date: 22-Feb-2012
- * Modified:
- * 24-Sep-2012:
- * Add methods:
- * - boolean isconnected()
- * - select(String select)
- * - executeUpdate(String updateComm)
- * - getParameter: return connection Parameter;
- * Delete method: selectDB, executeUpdateDB
- * 25-Sep-2012: Add methods: timeStamp, helloWorld
- * 18-Feb-2013:
- * Add public int insert(final IScope scope) throws GamaRuntimeException
- * 21-Feb-2013:
- * Modify public GamaList<Object> select(final IScope scope) throws GamaRuntimeException
- * Modify public int executeUpdate(final IScope scope) throws GamaRuntimeException
- * Modify public int insert(final IScope scope) throws GamaRuntimeException
- * 10-Mar-2013:
- * Modify select method: Add transform parameter
- * Modify insert method: Add transform parameter
- * 29-Apr-2013:
- * Remove import msi.gama.database.SqlConnection;
- * Add import msi.gama.database.sql.SqlConnection;
- * Change all method appropriately
- * 07-Jan-2014:
- * Move arg "transform" of select and insert action to key of arg "Params"
- * Last Modified: 07-Jan-2014
+ * created date: 22-Feb-2012 Modified: 24-Sep-2012: Add methods: - boolean isconnected() - select(String select) -
+ * executeUpdate(String updateComm) - getParameter: return connection Parameter; Delete method: selectDB,
+ * executeUpdateDB 25-Sep-2012: Add methods: timeStamp, helloWorld 18-Feb-2013: Add public int insert(final IScope
+ * scope) throws GamaRuntimeException 21-Feb-2013: Modify public GamaList<Object> select(final IScope scope) throws
+ * GamaRuntimeException Modify public int executeUpdate(final IScope scope) throws GamaRuntimeException Modify public
+ * int insert(final IScope scope) throws GamaRuntimeException 10-Mar-2013: Modify select method: Add transform parameter
+ * Modify insert method: Add transform parameter 29-Apr-2013: Remove import msi.gama.database.SqlConnection; Add import
+ * msi.gama.database.sql.SqlConnection; Change all method appropriately 07-Jan-2014: Move arg "transform" of select and
+ * insert action to key of arg "Params" Last Modified: 07-Jan-2014
*/
-@species(name = "AgentDB")
-@SuppressWarnings({ "unchecked", "rawtypes" })
+@species (
+ name = "AgentDB",
+ doc = @doc ("An abstract species that can be extended to provide agents with capabilities to access databases"))
+@SuppressWarnings ({ "unchecked", "rawtypes" })
public class AgentDB extends GamlAgent {
private Connection conn = null;
@@ -88,12 +65,14 @@ public AgentDB(final IPopulation s) throws GamaRuntimeException {
super(s);
}
- @action(name = "isConnected")
+ @action (
+ name = "isConnected")
public boolean isConnected(final IScope scope) throws GamaRuntimeException {
return isConnection;
}
- @action(name = "close")
+ @action (
+ name = "close")
public Object close(final IScope scope) throws GamaRuntimeException {
try {
conn.close();
@@ -115,7 +94,8 @@ public Object close(final IScope scope) throws GamaRuntimeException {
// Get current time of system
// added from MaeliaSkill
- @action(name = "timeStamp")
+ @action (
+ name = "timeStamp")
public Long timeStamp(final IScope scope) throws GamaRuntimeException {
final Long timeStamp = System.currentTimeMillis();
return timeStamp;
@@ -124,27 +104,28 @@ public Long timeStamp(final IScope scope) throws GamaRuntimeException {
/*
* Make a connection to BDMS
*
- * @syntax: do action: connectDB { arg params value:[ "dbtype":"SQLSERVER",
- * "url":"host address", "port":"port number", "database":"database name",
- * "user": "user name", "passwd": "password" ]; }
+ * @syntax: do action: connectDB { arg params value:[ "dbtype":"SQLSERVER", "url":"host address", "port":
+ * "port number", "database":"database name", "user": "user name", "passwd": "password" ]; }
*/
- @action(name = "connect", args = {
- @arg(name = "params", type = IType.MAP, optional = false, doc = @doc("Connection parameters")) })
+ @action (
+ name = "connect",
+ args = { @arg (
+ name = "params",
+ type = IType.MAP,
+ optional = false,
+ doc = @doc ("Connection parameters")) })
public Object connectDB(final IScope scope) throws GamaRuntimeException {
params = (java.util.Map<String, String>) scope.getArg("params", IType.MAP);
final String dbtype = params.get("dbtype");
// SqlConnection sqlConn;
- if (dbtype.equalsIgnoreCase(SqlConnection.SQLITE)) {
- throw GamaRuntimeException.error(
- "AgentDB.connection to SQLite error: an AgentDB agent cannot connect to SQLite DBMS (cf. documentation for further info).",
- scope);
- }
- if (isConnection) {
- throw GamaRuntimeException.error("AgentDB.connection error: a connection is already opened", scope);
- }
+ if (dbtype.equalsIgnoreCase(SqlConnection.SQLITE)) { throw GamaRuntimeException.error(
+ "AgentDB.connection to SQLite error: an AgentDB agent cannot connect to SQLite DBMS (cf. documentation for further info).",
+ scope); }
+ if (isConnection) { throw GamaRuntimeException.error("AgentDB.connection error: a connection is already opened",
+ scope); }
try {
sqlConn = SqlUtils.createConnectionObject(scope);
conn = sqlConn.connectDB();
@@ -159,12 +140,16 @@ public Object connectDB(final IScope scope) throws GamaRuntimeException {
/*
* Make a connection to BDMS
*
- * @syntax: do action: connectDB { arg params value:[ "dbtype":"SQLSERVER",
- * "url":"host address", "port":"port number", "database":"database name",
- * "user": "user name", "passwd": "password", ]; }
+ * @syntax: do action: connectDB { arg params value:[ "dbtype":"SQLSERVER", "url":"host address", "port":
+ * "port number", "database":"database name", "user": "user name", "passwd": "password", ]; }
*/
- @action(name = "testConnection", args = {
- @arg(name = "params", type = IType.MAP, optional = false, doc = @doc("Connection parameters")) })
+ @action (
+ name = "testConnection",
+ args = { @arg (
+ name = "params",
+ type = IType.MAP,
+ optional = false,
+ doc = @doc ("Connection parameters")) })
public boolean testConnection(final IScope scope) throws GamaRuntimeException {
try {
SqlConnection sqlConn;
@@ -181,26 +166,33 @@ public boolean testConnection(final IScope scope) throws GamaRuntimeException {
/*
* Make a connection to BDMS and execute the select statement
*
- * @syntax do action: select { arg select value:
- * "select string with question marks"; arg values value [List of values
- * that are used to replace question marks] }
+ * @syntax do action: select { arg select value: "select string with question marks"; arg values value [List of
+ * values that are used to replace question marks] }
*
* @return GamaList<GamaList<Object>>
*/
- @action(name = "select", args = {
- @arg(name = "select", type = IType.STRING, optional = false, doc = @doc("select string")),
- @arg(name = "values", type = IType.LIST, optional = true, doc = @doc("List of values that are used to replace question marks"))
+ @action (
+ name = "select",
+ args = { @arg (
+ name = "select",
+ type = IType.STRING,
+ optional = false,
+ doc = @doc ("select string")),
+ @arg (
+ name = "values",
+ type = IType.LIST,
+ optional = true,
+ doc = @doc ("List of values that are used to replace question marks"))
// , @arg(name = "transform", type = IType.BOOL, optional = true,
// doc =
// @doc("if transform = true then geometry will be tranformed from
// absolute to gis otherways it will be not transformed. Default
// value is false "))
- })
+ })
public IList select(final IScope scope) throws GamaRuntimeException {
- if (!isConnection) {
- throw GamaRuntimeException.error("AgentDB.select: Connection was not established ", scope);
- }
+ if (!isConnection) { throw GamaRuntimeException.error("AgentDB.select: Connection was not established ",
+ scope); }
final String selectComm = (String) scope.getArg("select", IType.STRING);
final IList<Object> values = (IList<Object>) scope.getArg("values", IType.LIST);
// Boolean transform = scope.hasArg("transform") ? (Boolean)
@@ -226,29 +218,34 @@ public IList select(final IScope scope) throws GamaRuntimeException {
}
/*
- * - Make a connection to BDMS - Executes the SQL statement in this
- * PreparedStatement object, which must be an SQL INSERT, UPDATE or DELETE
- * statement; or an SQL statement that returns nothing, such as a DDL
- * statement.
+ * - Make a connection to BDMS - Executes the SQL statement in this PreparedStatement object, which must be an SQL
+ * INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement.
*
- * @syntax: do action: executeUpdate { arg updateComm value:
- * " SQL statement string with question marks" arg values value [List of
- * values that are used to replace question marks] }
+ * @syntax: do action: executeUpdate { arg updateComm value: " SQL statement string with question marks" arg values
+ * value [List of values that are used to replace question marks] }
*/
- @action(name = "executeUpdate", args = {
- @arg(name = "updateComm", type = IType.STRING, optional = false, doc = @doc("SQL commands such as Create, Update, Delete, Drop with question mark")),
- @arg(name = "values", type = IType.LIST, optional = true, doc = @doc("List of values that are used to replace question mark"))
+ @action (
+ name = "executeUpdate",
+ args = { @arg (
+ name = "updateComm",
+ type = IType.STRING,
+ optional = false,
+ doc = @doc ("SQL commands such as Create, Update, Delete, Drop with question mark")),
+ @arg (
+ name = "values",
+ type = IType.LIST,
+ optional = true,
+ doc = @doc ("List of values that are used to replace question mark"))
// , @arg(name = "transform", type = IType.BOOL, optional = true,
// doc =
// @doc("if transform = true then geometry will be tranformed from
// absolute to gis otherways it will be not transformed. Default
// value is false "))
- })
+ })
public int executeUpdate(final IScope scope) throws GamaRuntimeException {
- if (!isConnection) {
- throw GamaRuntimeException.error("AgentDB.select: Connection was not established ", scope);
- }
+ if (!isConnection) { throw GamaRuntimeException.error("AgentDB.select: Connection was not established ",
+ scope); }
final String updateComm = (String) scope.getArg("updateComm", IType.STRING);
final GamaList<Object> values = (GamaList<Object>) scope.getArg("values", IType.LIST);
@@ -274,13 +271,20 @@ public int executeUpdate(final IScope scope) throws GamaRuntimeException {
// ----------------------------------------------------------------------------------------------------
}
- @action(name = "getParameter", args = {})
+ @action (
+ name = "getParameter",
+ args = {})
public Object getParamater(final IScope scope) throws GamaRuntimeException {
return params;
}
- @action(name = "setParameter", args = {
- @arg(name = "params", type = IType.MAP, optional = false, doc = @doc("Connection parameters")) })
+ @action (
+ name = "setParameter",
+ args = { @arg (
+ name = "params",
+ type = IType.MAP,
+ optional = false,
+ doc = @doc ("Connection parameters")) })
public Object setParameter(final IScope scope) throws GamaRuntimeException {
params = (java.util.Map<String, String>) scope.getArg("params", IType.MAP);
@@ -299,26 +303,37 @@ public Object setParameter(final IScope scope) throws GamaRuntimeException {
/*
* Make a connection to BDMS and execute the insert statement
*
- * @syntax do insert with: [into:: table_name, columns:column_list,
- * values:value_list];
+ * @syntax do insert with: [into:: table_name, columns:column_list, values:value_list];
*
* @return an integer
*/
- @action(name = "insert", args = {
- @arg(name = "into", type = IType.STRING, optional = false, doc = @doc("Table name")),
- @arg(name = "columns", type = IType.LIST, optional = true, doc = @doc("List of column name of table")),
- @arg(name = "values", type = IType.LIST, optional = false, doc = @doc("List of values that are used to insert into table. Columns and values must have same size"))
+ @action (
+ name = "insert",
+ args = { @arg (
+ name = "into",
+ type = IType.STRING,
+ optional = false,
+ doc = @doc ("Table name")),
+ @arg (
+ name = "columns",
+ type = IType.LIST,
+ optional = true,
+ doc = @doc ("List of column name of table")),
+ @arg (
+ name = "values",
+ type = IType.LIST,
+ optional = false,
+ doc = @doc ("List of values that are used to insert into table. Columns and values must have same size"))
// ,@arg(name = "transform", type = IType.BOOL, optional = true, doc
// =
// @doc("if transform = true then geometry will be tranformed from
// absolute to gis otherways it will be not transformed. Default
// value is false "))
- })
+ })
public int insert(final IScope scope) throws GamaRuntimeException {
- if (!isConnection) {
- throw GamaRuntimeException.error("AgentDB.select: Connection was not established ", scope);
- }
+ if (!isConnection) { throw GamaRuntimeException.error("AgentDB.select: Connection was not established ",
+ scope); }
final String table_name = (String) scope.getArg("into", IType.STRING);
final GamaList<Object> cols = (GamaList<Object>) scope.getArg("columns", IType.LIST);
final GamaList<Object> values = (GamaList<Object>) scope.getArg("values", IType.LIST);
@@ -154,4 +154,6 @@
void exit();
+ void openInteractiveConsole();
+
}
@@ -413,4 +413,10 @@ public void exit() {
System.exit(0);
}
+ @Override
+ public void openInteractiveConsole() {
+ // TODO Auto-generated method stub
+
+ }
+
}
@@ -64,7 +64,7 @@ public String getRootTag(final IScope scope) {
DocumentBuilder db;
try {
db = factory.newDocumentBuilder();
- final Document doc = db.parse(new File(getPath(scope)));
+ final Document doc = db.parse(new File(this.getPath(scope)));
return doc.getFirstChild().getNodeName();
} catch (final ParserConfigurationException | SAXException | IOException e1) {
e1.printStackTrace();
Oops, something went wrong.

0 comments on commit a44d570

Please sign in to comment.