[mapguide-commits] r8509 - in trunk/Tools/Maestro: Maestro.Editors Maestro.Editors/Common Maestro.Editors/Common/Expression OSGeo.MapGuide.MaestroAPI.Expressions
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Jan 20 03:34:52 PST 2015
Author: jng
Date: 2015-01-20 03:34:52 -0800 (Tue, 20 Jan 2015)
New Revision: 8509
Added:
trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.cs
trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.resx
trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.cs
trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.resx
Modified:
trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionDisplayDialog.resx
trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs
trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs
trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoExpression.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoFilter.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoParseException.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/Strings.Designer.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/Strings.resx
Log:
#2525: Enhance the Expression Editor with the ability to pin-point the source of the parse error which is the cursor position of a malformed string, or highlighting for an unsupported token based on FDO capabilities.
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionDisplayDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionDisplayDialog.resx 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionDisplayDialog.resx 2015-01-20 11:34:52 UTC (rev 8509)
@@ -180,6 +180,9 @@
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>284, 348</value>
</data>
+ <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
+ <value>CenterParent</value>
+ </data>
<data name="$this.Text" xml:space="preserve">
<value>Expression/Filter</value>
</data>
Added: trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.Designer.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -0,0 +1,85 @@
+namespace Maestro.Editors.Common.Expression
+{
+ partial class ExpressionParseErrorDialog
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExpressionParseErrorDialog));
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtErrorDetails = new System.Windows.Forms.TextBox();
+ this.btnGotoError = new System.Windows.Forms.Button();
+ this.btnClose = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ resources.ApplyResources(this.label1, "label1");
+ this.label1.Name = "label1";
+ //
+ // txtErrorDetails
+ //
+ resources.ApplyResources(this.txtErrorDetails, "txtErrorDetails");
+ this.txtErrorDetails.Name = "txtErrorDetails";
+ this.txtErrorDetails.ReadOnly = true;
+ //
+ // btnGotoError
+ //
+ resources.ApplyResources(this.btnGotoError, "btnGotoError");
+ this.btnGotoError.Name = "btnGotoError";
+ this.btnGotoError.UseVisualStyleBackColor = true;
+ this.btnGotoError.Click += new System.EventHandler(this.btnGotoError_Click);
+ //
+ // btnClose
+ //
+ resources.ApplyResources(this.btnClose, "btnClose");
+ this.btnClose.Name = "btnClose";
+ this.btnClose.UseVisualStyleBackColor = true;
+ this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
+ //
+ // ExpressionParseErrorDialog
+ //
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ControlBox = false;
+ this.Controls.Add(this.btnClose);
+ this.Controls.Add(this.btnGotoError);
+ this.Controls.Add(this.txtErrorDetails);
+ this.Controls.Add(this.label1);
+ this.Name = "ExpressionParseErrorDialog";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtErrorDetails;
+ private System.Windows.Forms.Button btnGotoError;
+ private System.Windows.Forms.Button btnClose;
+ }
+}
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -0,0 +1,64 @@
+#region Disclaimer / License
+
+// Copyright (C) 2015, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#endregion Disclaimer / License
+using OSGeo.MapGuide.MaestroAPI.Expressions;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Maestro.Editors.Common.Expression
+{
+ internal partial class ExpressionParseErrorDialog : Form
+ {
+ private ExpressionParseErrorDialog()
+ {
+ InitializeComponent();
+ }
+
+ private FdoExpressionValidationException _ex;
+ private IExpressionErrorSource _source;
+
+ public ExpressionParseErrorDialog(FdoExpressionValidationException ex, IExpressionErrorSource source)
+ : this()
+ {
+ _ex = ex;
+ _source = source;
+ txtErrorDetails.Text = _ex.Message;
+ }
+
+ private void btnClose_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = System.Windows.Forms.DialogResult.OK;
+ }
+
+ private void btnGotoError_Click(object sender, EventArgs e)
+ {
+ _source.HighlightToken(_ex.Token);
+ this.DialogResult = System.Windows.Forms.DialogResult.OK;
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/Expression/ExpressionParseErrorDialog.resx 2015-01-20 11:34:52 UTC (rev 8509)
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="label1.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 18</value>
+ </data>
+ <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>186, 13</value>
+ </data>
+ <data name="label1.TabIndex" type="System.Int32, mscorlib">
+ <value>0</value>
+ </data>
+ <data name="label1.Text" xml:space="preserve">
+ <value>Error occurred parsing the given string</value>
+ </data>
+ <data name=">>label1.Name" xml:space="preserve">
+ <value>label1</value>
+ </data>
+ <data name=">>label1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label1.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>label1.ZOrder" xml:space="preserve">
+ <value>3</value>
+ </data>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="txtErrorDetails.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Bottom, Left, Right</value>
+ </data>
+ <data name="txtErrorDetails.Font" type="System.Drawing.Font, System.Drawing">
+ <value>Courier New, 11.25pt</value>
+ </data>
+ <data name="txtErrorDetails.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 46</value>
+ </data>
+ <data name="txtErrorDetails.Multiline" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="txtErrorDetails.Size" type="System.Drawing.Size, System.Drawing">
+ <value>284, 93</value>
+ </data>
+ <data name="txtErrorDetails.TabIndex" type="System.Int32, mscorlib">
+ <value>3</value>
+ </data>
+ <data name=">>txtErrorDetails.Name" xml:space="preserve">
+ <value>txtErrorDetails</value>
+ </data>
+ <data name=">>txtErrorDetails.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtErrorDetails.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>txtErrorDetails.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
+ <data name="btnGotoError.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Left</value>
+ </data>
+ <data name="btnGotoError.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 156</value>
+ </data>
+ <data name="btnGotoError.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnGotoError.TabIndex" type="System.Int32, mscorlib">
+ <value>2</value>
+ </data>
+ <data name="btnGotoError.Text" xml:space="preserve">
+ <value>Goto Error</value>
+ </data>
+ <data name=">>btnGotoError.Name" xml:space="preserve">
+ <value>btnGotoError</value>
+ </data>
+ <data name=">>btnGotoError.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnGotoError.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnGotoError.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="btnClose.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Right</value>
+ </data>
+ <data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
+ <value>221, 156</value>
+ </data>
+ <data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnClose.TabIndex" type="System.Int32, mscorlib">
+ <value>1</value>
+ </data>
+ <data name="btnClose.Text" xml:space="preserve">
+ <value>Close</value>
+ </data>
+ <data name=">>btnClose.Name" xml:space="preserve">
+ <value>btnClose</value>
+ </data>
+ <data name=">>btnClose.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnClose.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnClose.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+ <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
+ <value>6, 13</value>
+ </data>
+ <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
+ <value>308, 191</value>
+ </data>
+ <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
+ <value>CenterParent</value>
+ </data>
+ <data name="$this.Text" xml:space="preserve">
+ <value>Parse Error</value>
+ </data>
+ <data name=">>$this.Name" xml:space="preserve">
+ <value>ExpressionParseErrorDialog</value>
+ </data>
+ <data name=">>$this.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+</root>
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.Designer.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.Designer.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -0,0 +1,85 @@
+namespace Maestro.Editors.Common.Expression
+{
+ partial class MalformedExpressionDialog
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MalformedExpressionDialog));
+ this.btnGotoError = new System.Windows.Forms.Button();
+ this.btnClose = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtErrorDetails = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // btnGotoError
+ //
+ resources.ApplyResources(this.btnGotoError, "btnGotoError");
+ this.btnGotoError.Name = "btnGotoError";
+ this.btnGotoError.UseVisualStyleBackColor = true;
+ this.btnGotoError.Click += new System.EventHandler(this.btnGotoError_Click);
+ //
+ // btnClose
+ //
+ resources.ApplyResources(this.btnClose, "btnClose");
+ this.btnClose.Name = "btnClose";
+ this.btnClose.UseVisualStyleBackColor = true;
+ this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
+ //
+ // label1
+ //
+ resources.ApplyResources(this.label1, "label1");
+ this.label1.Name = "label1";
+ //
+ // txtErrorDetails
+ //
+ resources.ApplyResources(this.txtErrorDetails, "txtErrorDetails");
+ this.txtErrorDetails.Name = "txtErrorDetails";
+ this.txtErrorDetails.ReadOnly = true;
+ //
+ // MalformedExpressionDialog
+ //
+ resources.ApplyResources(this, "$this");
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ControlBox = false;
+ this.Controls.Add(this.txtErrorDetails);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.btnClose);
+ this.Controls.Add(this.btnGotoError);
+ this.Name = "MalformedExpressionDialog";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnGotoError;
+ private System.Windows.Forms.Button btnClose;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtErrorDetails;
+ }
+}
\ No newline at end of file
Added: trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.cs (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -0,0 +1,72 @@
+#region Disclaimer / License
+
+// Copyright (C) 2015, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#endregion Disclaimer / License
+using OSGeo.MapGuide.MaestroAPI.Expressions;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Maestro.Editors.Common.Expression
+{
+ internal interface IExpressionErrorSource
+ {
+ void SetCursor(int line, int col);
+
+ void HighlightToken(string token);
+ }
+
+ internal partial class MalformedExpressionDialog : Form
+ {
+ private MalformedExpressionDialog()
+ {
+ InitializeComponent();
+ }
+
+ private FdoMalformedExpressionException _ex;
+ private IExpressionErrorSource _source;
+
+ public MalformedExpressionDialog(FdoMalformedExpressionException ex, IExpressionErrorSource source)
+ : this()
+ {
+ _ex = ex;
+ _source = source;
+ txtErrorDetails.Text = _ex.Messages[0].Message;
+ }
+
+ private void btnClose_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = System.Windows.Forms.DialogResult.OK;
+ }
+
+ private void btnGotoError_Click(object sender, EventArgs e)
+ {
+ var msg = _ex.Messages.First();
+ _source.SetCursor(msg.LineNumber, msg.Column - 1);
+ this.DialogResult = System.Windows.Forms.DialogResult.OK;
+ }
+ }
+}
Added: trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.resx (rev 0)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/Expression/MalformedExpressionDialog.resx 2015-01-20 11:34:52 UTC (rev 8509)
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="btnGotoError.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Bottom, Left</value>
+ </data>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="btnGotoError.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 211</value>
+ </data>
+ <data name="btnGotoError.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="btnGotoError.TabIndex" type="System.Int32, mscorlib">
+ <value>2</value>
+ </data>
+ <data name="btnGotoError.Text" xml:space="preserve">
+ <value>Go to Error</value>
+ </data>
+ <data name=">>btnGotoError.Name" xml:space="preserve">
+ <value>btnGotoError</value>
+ </data>
+ <data name=">>btnGotoError.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnGotoError.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnGotoError.ZOrder" xml:space="preserve">
+ <value>3</value>
+ </data>
+ <data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
+ <value>372, 211</value>
+ </data>
+ <data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
+ <value>75, 23</value>
+ </data>
+ <data name="btnClose.TabIndex" type="System.Int32, mscorlib">
+ <value>1</value>
+ </data>
+ <data name="btnClose.Text" xml:space="preserve">
+ <value>Close</value>
+ </data>
+ <data name=">>btnClose.Name" xml:space="preserve">
+ <value>btnClose</value>
+ </data>
+ <data name=">>btnClose.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>btnClose.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>btnClose.ZOrder" xml:space="preserve">
+ <value>2</value>
+ </data>
+ <data name="label1.AutoSize" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 13</value>
+ </data>
+ <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
+ <value>118, 13</value>
+ </data>
+ <data name="label1.TabIndex" type="System.Int32, mscorlib">
+ <value>0</value>
+ </data>
+ <data name="label1.Text" xml:space="preserve">
+ <value>A parser error occurred </value>
+ </data>
+ <data name=">>label1.Name" xml:space="preserve">
+ <value>label1</value>
+ </data>
+ <data name=">>label1.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>label1.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>label1.ZOrder" xml:space="preserve">
+ <value>1</value>
+ </data>
+ <data name="txtErrorDetails.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+ <value>Top, Bottom, Left, Right</value>
+ </data>
+ <data name="txtErrorDetails.Font" type="System.Drawing.Font, System.Drawing">
+ <value>Courier New, 11.25pt</value>
+ </data>
+ <data name="txtErrorDetails.Location" type="System.Drawing.Point, System.Drawing">
+ <value>12, 41</value>
+ </data>
+ <data name="txtErrorDetails.Multiline" type="System.Boolean, mscorlib">
+ <value>True</value>
+ </data>
+ <data name="txtErrorDetails.Size" type="System.Drawing.Size, System.Drawing">
+ <value>435, 164</value>
+ </data>
+ <data name="txtErrorDetails.TabIndex" type="System.Int32, mscorlib">
+ <value>3</value>
+ </data>
+ <data name=">>txtErrorDetails.Name" xml:space="preserve">
+ <value>txtErrorDetails</value>
+ </data>
+ <data name=">>txtErrorDetails.Type" xml:space="preserve">
+ <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+ <data name=">>txtErrorDetails.Parent" xml:space="preserve">
+ <value>$this</value>
+ </data>
+ <data name=">>txtErrorDetails.ZOrder" xml:space="preserve">
+ <value>0</value>
+ </data>
+ <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>True</value>
+ </metadata>
+ <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
+ <value>6, 13</value>
+ </data>
+ <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
+ <value>459, 246</value>
+ </data>
+ <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
+ <value>CenterParent</value>
+ </data>
+ <data name="$this.Text" xml:space="preserve">
+ <value>Malformed Expression/Fiilter</value>
+ </data>
+ <data name=">>$this.Name" xml:space="preserve">
+ <value>MalformedExpressionDialog</value>
+ </data>
+ <data name=">>$this.Type" xml:space="preserve">
+ <value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </data>
+</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -20,7 +20,9 @@
#endregion Disclaimer / License
+using ICSharpCode.TextEditor;
using Maestro.Editors.Common.Expression;
+using Maestro.Editors.Generic.XmlEditor;
using Maestro.Editors.LayerDefinition.Vector.Thematics;
using Maestro.Shared.UI;
using OSGeo.MapGuide.MaestroAPI;
@@ -39,7 +41,7 @@
/// <summary>
/// An expression editor dialog
/// </summary>
- public partial class ExpressionEditor : Form, IExpressionEditor, ITextInserter
+ public partial class ExpressionEditor : Form, IExpressionEditor, ITextInserter, IExpressionErrorSource
{
private ClassDefinition _cls;
private IEditorService _edSvc;
@@ -533,6 +535,47 @@
}
}
+ void IExpressionErrorSource.SetCursor(int line, int col)
+ {
+ ExpressionText.ActiveTextAreaControl.Caret.Line = line;
+ ExpressionText.ActiveTextAreaControl.Caret.Column = col;
+ }
+
+ void IExpressionErrorSource.HighlightToken(string token)
+ {
+ bool silent = false;
+ if (string.IsNullOrEmpty(token))
+ {
+ if (!silent)
+ MessageBox.Show(Strings.TextNoStringSpecifiedToLookFor);
+ return;
+ }
+ var search = new TextEditorSearcher();
+ search.Document = ExpressionText.Document;
+ search.LookFor = token; // txtLookFor.Text;
+ search.MatchCase = false;
+ search.MatchWholeWordOnly = true;
+
+ bool bLoopedAround;
+ TextRange range = search.FindNext(0, false, out bLoopedAround);
+ if (range != null)
+ SelectResult(range);
+ else if (!silent)
+ MessageBox.Show(Strings.TextNoStringSpecifiedToLookFor);
+ }
+
+ private void SelectResult(TextRange range)
+ {
+ TextLocation p1 = ExpressionText.Document.OffsetToPosition(range.Offset);
+ TextLocation p2 = ExpressionText.Document.OffsetToPosition(range.Offset + range.Length);
+ ExpressionText.ActiveTextAreaControl.SelectionManager.SetSelection(p1, p2);
+ ExpressionText.ActiveTextAreaControl.ScrollTo(p1.Line, p1.Column);
+ // Also move the caret to the end of the selection, because when the user
+ // presses F3, the caret is where we start searching next time.
+ ExpressionText.ActiveTextAreaControl.Caret.Position =
+ ExpressionText.Document.OffsetToPosition(range.Offset + range.Length);
+ }
+
private FdoExpressionValidator _validator = new FdoExpressionValidator();
private void btnValidate_Click(object sender, EventArgs e)
@@ -552,10 +595,14 @@
MessageBox.Show(Strings.ExprIsValid);
}
}
- catch (FdoParseException ex)
+ catch (FdoExpressionValidationException ex)
{
- MessageBox.Show(ex.Message);
+ new ExpressionParseErrorDialog(ex, this).ShowDialog();
}
+ catch (FdoMalformedExpressionException ex)
+ {
+ new MalformedExpressionDialog(ex, this).ShowDialog();
+ }
}
private void viewParsedExpressionFilterToolStripMenuItem_Click(object sender, EventArgs e)
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/IExpressionEditor.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -72,7 +72,7 @@
/// <summary>
/// An interface for inserting text
/// </summary>
- public interface ITextInserter
+ internal interface ITextInserter
{
/// <summary>
/// Inserts the specified text. The implementation determines the position/cursor where the
@@ -86,7 +86,8 @@
{
public static IExpressionEditor Create()
{
- if (Platform.IsRunningOnMono)
+ //if (Platform.IsRunningOnMono)
+ if (true)
return new MonoCompatibleExpressionEditor();
else
return new ExpressionEditor();
Modified: trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/MonoCompatibleExpressionEditor.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -78,7 +78,7 @@
/// <summary>
/// An expression editor dialog
/// </summary>
- public partial class MonoCompatibleExpressionEditor : Form, IExpressionEditor, ITextInserter
+ public partial class MonoCompatibleExpressionEditor : Form, IExpressionEditor, ITextInserter, IExpressionErrorSource
{
private ClassDefinition _cls;
@@ -1035,6 +1035,27 @@
}
}
+ void IExpressionErrorSource.SetCursor(int line, int col)
+ {
+ string text = ExpressionText.Text;
+ int start = -1;
+ for (int i = 0; i <= line; i++)
+ {
+ start++;
+ start = text.IndexOf(Environment.NewLine, start);
+ }
+
+ ExpressionText.SelectionStart = start + col + 2; //1 to offset col, 1 to offset start
+ ExpressionText.SelectionLength = 0;
+ }
+
+ void IExpressionErrorSource.HighlightToken(string token)
+ {
+ int idx = ExpressionText.Text.IndexOf(token, StringComparison.InvariantCultureIgnoreCase);
+ ExpressionText.SelectionStart = idx;
+ ExpressionText.SelectionLength = token.Length;
+ }
+
private FdoExpressionValidator _validator = new FdoExpressionValidator();
private void btnValidate_Click(object sender, EventArgs e)
@@ -1054,10 +1075,14 @@
MessageBox.Show(Strings.ExprIsValid);
}
}
- catch (FdoParseException ex)
+ catch (FdoExpressionValidationException ex)
{
- MessageBox.Show(ex.Message);
+ new ExpressionParseErrorDialog(ex, this).ShowDialog();
}
+ catch (FdoMalformedExpressionException ex)
+ {
+ new MalformedExpressionDialog(ex, this).ShowDialog();
+ }
}
private void viewParsedExpressionFilterToolStripMenuItem_Click(object sender, EventArgs e)
Modified: trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/Maestro.Editors/Maestro.Editors.csproj 2015-01-20 11:34:52 UTC (rev 8509)
@@ -128,6 +128,12 @@
<Compile Include="Common\Expression\ExpressionDisplayDialog.Designer.cs">
<DependentUpon>ExpressionDisplayDialog.cs</DependentUpon>
</Compile>
+ <Compile Include="Common\Expression\ExpressionParseErrorDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Common\Expression\ExpressionParseErrorDialog.Designer.cs">
+ <DependentUpon>ExpressionParseErrorDialog.cs</DependentUpon>
+ </Compile>
<Compile Include="Common\Expression\FdoExpressionValidator.cs" />
<Compile Include="Common\Expression\LookupExpressionBuilder.cs">
<SubType>Form</SubType>
@@ -136,6 +142,12 @@
<DependentUpon>LookupExpressionBuilder.cs</DependentUpon>
</Compile>
<Compile Include="Common\Expression\FdoExpressionCompletionDataProvider.cs" />
+ <Compile Include="Common\Expression\MalformedExpressionDialog.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Common\Expression\MalformedExpressionDialog.Designer.cs">
+ <DependentUpon>MalformedExpressionDialog.cs</DependentUpon>
+ </Compile>
<Compile Include="Common\Expression\RangeExpressionBuilder.cs">
<SubType>Form</SubType>
</Compile>
@@ -1362,9 +1374,15 @@
<EmbeddedResource Include="Common\Expression\ExpressionDisplayDialog.resx">
<DependentUpon>ExpressionDisplayDialog.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Common\Expression\ExpressionParseErrorDialog.resx">
+ <DependentUpon>ExpressionParseErrorDialog.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Common\Expression\LookupExpressionBuilder.resx">
<DependentUpon>LookupExpressionBuilder.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="Common\Expression\MalformedExpressionDialog.resx">
+ <DependentUpon>MalformedExpressionDialog.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="Common\Expression\RangeExpressionBuilder.resx">
<DependentUpon>RangeExpressionBuilder.cs</DependentUpon>
</EmbeddedResource>
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoExpression.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoExpression.cs 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoExpression.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -67,15 +67,15 @@
{
if (tree.HasErrors())
{
- List<string> errors = new List<string>();
- foreach(var msg in tree.ParserMessages)
+ List<FdoParseErrorMessage> errors = new List<FdoParseErrorMessage>();
+ foreach (var msg in tree.ParserMessages)
{
if (msg.Level == Irony.ErrorLevel.Error)
{
- errors.Add(string.Format(Strings.ParserErrorMessage, msg.Location.ToUiString(), msg.Message));
+ errors.Add(new FdoParseErrorMessage(msg.Message, msg.Location.Line, msg.Location.Column));
}
}
- throw new FdoParseException(string.Format(Strings.ExpressionParseError, Environment.NewLine, string.Join(Environment.NewLine, errors.ToArray())));
+ throw new FdoMalformedExpressionException(Strings.ParserErrorMessage, errors);
}
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoFilter.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoFilter.cs 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoFilter.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -63,15 +63,15 @@
{
if (tree.HasErrors())
{
- List<string> errors = new List<string>();
+ List<FdoParseErrorMessage> errors = new List<FdoParseErrorMessage>();
foreach (var msg in tree.ParserMessages)
{
if (msg.Level == Irony.ErrorLevel.Error)
{
- errors.Add(string.Format(Strings.ParserErrorMessage, msg.Location.ToUiString(), msg.Message));
+ errors.Add(new FdoParseErrorMessage(msg.Message, msg.Location.Line, msg.Location.Column));
}
}
- throw new FdoParseException(string.Format(Strings.FilterParseError, Environment.NewLine, string.Join(Environment.NewLine, errors.ToArray())));
+ throw new FdoMalformedExpressionException(Strings.ParserErrorMessage, errors);
}
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoParseException.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoParseException.cs 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/FdoParseException.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -38,4 +38,39 @@
System.Runtime.Serialization.StreamingContext context)
: base(info, context) { }
}
+
+ public class FdoParseErrorMessage
+ {
+ public int LineNumber { get; private set; }
+
+ public int Column { get; private set; }
+
+ public string Message { get; private set; }
+
+ public FdoParseErrorMessage(string message, int line, int column)
+ {
+ this.Message = message;
+ this.LineNumber = line;
+ this.Column = column;
+ }
+ }
+
+ [Serializable]
+ public class FdoMalformedExpressionException : FdoParseException
+ {
+ public List<FdoParseErrorMessage> Messages { get; private set; }
+
+ public FdoMalformedExpressionException(string message, List<FdoParseErrorMessage> parserErrorMessages)
+ : this(message)
+ {
+ this.Messages = parserErrorMessages;
+ }
+
+ private FdoMalformedExpressionException(string message) : base(message) { }
+ private FdoMalformedExpressionException(string message, Exception inner) : base(message, inner) { }
+ protected FdoMalformedExpressionException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context) { }
+ }
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/Strings.Designer.cs 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/Strings.Designer.cs 2015-01-20 11:34:52 UTC (rev 8509)
@@ -79,7 +79,7 @@
}
/// <summary>
- /// Looks up a localized string similar to ({0}) - {1}.
+ /// Looks up a localized string similar to Parser Error.
/// </summary>
internal static string ParserErrorMessage {
get {
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/Strings.resx
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/Strings.resx 2015-01-19 14:17:44 UTC (rev 8508)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Expressions/Strings.resx 2015-01-20 11:34:52 UTC (rev 8509)
@@ -124,6 +124,6 @@
<value>Error Parsing Filter: {0}{1}</value>
</data>
<data name="ParserErrorMessage" xml:space="preserve">
- <value> ({0}) - {1}</value>
+ <value>Parser Error</value>
</data>
</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list