Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10506


Ignore:
Timestamp:
02/25/14 13:55:01 (11 years ago)
Author:
jkarder
Message:

#2136: applied some of the changes suggested in comment:11:ticket:2136

  • change namespaces to HeuristicLab.Scripting.*
  • added extra compile button and registered F6 as a shortcut
  • changed the order of the output window and the error list
  • tabs (output window and error list) are selected automatically
  • thrown exceptions are shown using the PluginInfrastructure
  • removed namespace declaration in the script
  • names in the VariableStore are now conform to C# property names
Location:
trunk/sources
Files:
12 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab 3.3.sln

    r10391 r10506  
    384384Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Trading.Views-3.4", "HeuristicLab.Problems.DataAnalysis.Trading.Views\3.4\HeuristicLab.Problems.DataAnalysis.Trading.Views-3.4.csproj", "{CB3D0A1E-1BE8-476B-A53C-2B189E30064F}"
    385385EndProject
    386 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.HLScript-3.3", "HeuristicLab.HLScript\3.3\HeuristicLab.HLScript-3.3.csproj", "{21977CC3-1757-4B3B-87BD-FF817AAA900F}"
    387 EndProject
    388 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.HLScript.Views-3.3", "HeuristicLab.HLScript.Views\3.3\HeuristicLab.HLScript.Views-3.3.csproj", "{0C2917C8-7AA8-4E18-800A-C4D064F992ED}"
     386Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Scripting-3.3", "HeuristicLab.HLScript\3.3\HeuristicLab.Scripting-3.3.csproj", "{21977CC3-1757-4B3B-87BD-FF817AAA900F}"
     387EndProject
     388Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Scripting.Views-3.3", "HeuristicLab.HLScript.Views\3.3\HeuristicLab.Scripting.Views-3.3.csproj", "{0C2917C8-7AA8-4E18-800A-C4D064F992ED}"
    389389EndProject
    390390Global
  • trunk/sources/HeuristicLab.HLScript.Views/3.3/HeuristicLab.Scripting.Views-3.3.csproj

    r10501 r10506  
    88    <OutputType>Library</OutputType>
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    10     <RootNamespace>HeuristicLab.HLScript.Views</RootNamespace>
    11     <AssemblyName>HeuristicLab.HLScript.Views-3.3</AssemblyName>
     10    <RootNamespace>HeuristicLab.Scripting.Views</RootNamespace>
     11    <AssemblyName>HeuristicLab.Scripting.Views-3.3</AssemblyName>
    1212    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    1313    <FileAlignment>512</FileAlignment>
     
    136136      <Private>False</Private>
    137137    </ProjectReference>
    138     <ProjectReference Include="..\..\HeuristicLab.HLScript\3.3\HeuristicLab.HLScript-3.3.csproj">
     138    <ProjectReference Include="..\..\HeuristicLab.HLScript\3.3\HeuristicLab.Scripting-3.3.csproj">
    139139      <Project>{21977cc3-1757-4b3b-87bd-ff817aaa900f}</Project>
    140       <Name>HeuristicLab.HLScript-3.3</Name>
     140      <Name>HeuristicLab.Scripting-3.3</Name>
    141141      <Private>False</Private>
    142142    </ProjectReference>
  • trunk/sources/HeuristicLab.HLScript.Views/3.3/Plugin.cs.frame

    r10358 r10506  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using HeuristicLab.PluginInfrastructure;
    2323
    24 namespace HeuristicLab.HLScript.Views {
    25   [Plugin("HeuristicLab.HLScript.Views", "3.3.9.$WCREV$")]
    26   [PluginFile("HeuristicLab.HLScript.Views-3.3.dll", PluginFileType.Assembly)]
     24namespace HeuristicLab.Scripting.Views {
     25  [Plugin("HeuristicLab.Scripting.Views", "3.3.9.$WCREV$")]
     26  [PluginFile("HeuristicLab.Scripting.Views-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.CodeEditor", "3.3")]
    2828  [PluginDependency("HeuristicLab.Collections", "3.3")]
     
    3131  [PluginDependency("HeuristicLab.Core", "3.3")]
    3232  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
    33   [PluginDependency("HeuristicLab.HLScript", "3.3")]
     33  [PluginDependency("HeuristicLab.Scripting", "3.3")]
    3434  [PluginDependency("HeuristicLab.MainForm", "3.3")]
    3535  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    3636  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    37   public class HeuristicLabHLScriptViewsPlugin : PluginBase {
     37  public class HeuristicLabScriptingViewsPlugin : PluginBase {
    3838  }
    3939}
  • trunk/sources/HeuristicLab.HLScript.Views/3.3/Properties/AssemblyInfo.cs.frame

    r10332 r10506  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2727// set of attributes. Change these attribute values to modify the information
    2828// associated with an assembly.
    29 [assembly: AssemblyTitle("HeuristicLab.HLScript.Views")]
     29[assembly: AssemblyTitle("HeuristicLab.Scripting.Views")]
    3030[assembly: AssemblyDescription("")]
    3131[assembly: AssemblyConfiguration("")]
    3232[assembly: AssemblyCompany("")]
    3333[assembly: AssemblyProduct("HeuristicLab")]
    34 [assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
     34[assembly: AssemblyCopyright("(c) 2002-2014 HEAL")]
    3535[assembly: AssemblyTrademark("")]
    3636[assembly: AssemblyCulture("")]
  • trunk/sources/HeuristicLab.HLScript.Views/3.3/ScriptView.Designer.cs

    r10401 r10506  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
    22 namespace HeuristicLab.HLScript.Views {
     22namespace HeuristicLab.Scripting.Views {
    2323  partial class ScriptView {
    2424    /// <summary>
     
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.components = new System.ComponentModel.Container();
    4748      this.compilationLabel = new System.Windows.Forms.Label();
    4849      this.startStopButton = new System.Windows.Forms.Button();
    4950      this.errorListView = new System.Windows.Forms.ListView();
     51      this.iconColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    5052      this.categoryColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    5153      this.errorNumberColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     
    5355      this.columnColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
    5456      this.descriptionColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     57      this.imageList = new System.Windows.Forms.ImageList(this.components);
    5558      this.codeEditor = new HeuristicLab.CodeEditor.CodeEditor();
    5659      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
    5760      this.splitContainer2 = new System.Windows.Forms.SplitContainer();
    58       this.tabControl1 = new System.Windows.Forms.TabControl();
    59       this.errorListTabPage = new System.Windows.Forms.TabPage();
     61      this.infoTabControl = new System.Windows.Forms.TabControl();
    6062      this.outputTabPage = new System.Windows.Forms.TabPage();
    6163      this.outputTextBox = new System.Windows.Forms.TextBox();
    62       this.variableStoreView = new HeuristicLab.HLScript.Views.VariableStoreView();
     64      this.errorListTabPage = new System.Windows.Forms.TabPage();
     65      this.variableStoreView = new HeuristicLab.Scripting.Views.VariableStoreView();
    6366      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     67      this.compileButton = new System.Windows.Forms.Button();
    6468      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6569      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     
    7175      this.splitContainer2.Panel2.SuspendLayout();
    7276      this.splitContainer2.SuspendLayout();
    73       this.tabControl1.SuspendLayout();
     77      this.infoTabControl.SuspendLayout();
     78      this.outputTabPage.SuspendLayout();
    7479      this.errorListTabPage.SuspendLayout();
    75       this.outputTabPage.SuspendLayout();
    7680      this.SuspendLayout();
    7781      //
     
    9195      this.compilationLabel.AutoSize = true;
    9296      this.compilationLabel.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
    93       this.compilationLabel.Location = new System.Drawing.Point(33, 32);
     97      this.compilationLabel.Location = new System.Drawing.Point(66, 32);
    9498      this.compilationLabel.Name = "compilationLabel";
    9599      this.compilationLabel.Size = new System.Drawing.Size(69, 13);
     
    100104      //
    101105      this.startStopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;
    102       this.startStopButton.Location = new System.Drawing.Point(3, 26);
     106      this.startStopButton.Location = new System.Drawing.Point(36, 26);
    103107      this.startStopButton.Name = "startStopButton";
    104108      this.startStopButton.Size = new System.Drawing.Size(24, 24);
     
    112116      //
    113117      this.errorListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     118            this.iconColumnHeader,
    114119            this.categoryColumnHeader,
    115120            this.errorNumberColumnHeader,
     
    124129      this.errorListView.Name = "errorListView";
    125130      this.errorListView.Size = new System.Drawing.Size(623, 79);
     131      this.errorListView.SmallImageList = this.imageList;
    126132      this.errorListView.TabIndex = 0;
    127133      this.errorListView.UseCompatibleStateImageBehavior = false;
    128134      this.errorListView.View = System.Windows.Forms.View.Details;
    129135      //
     136      // iconColumnHeader
     137      //
     138      this.iconColumnHeader.Text = "";
     139      //
    130140      // categoryColumnHeader
    131141      //
     
    135145      //
    136146      this.errorNumberColumnHeader.Text = "Error Number";
    137       this.errorNumberColumnHeader.Width = 78;
    138147      //
    139148      // lineColumnHeader
    140149      //
    141150      this.lineColumnHeader.Text = "Line";
    142       this.lineColumnHeader.Width = 50;
    143151      //
    144152      // columnColumnHeader
    145153      //
    146154      this.columnColumnHeader.Text = "Column";
    147       this.columnColumnHeader.Width = 50;
    148155      //
    149156      // descriptionColumnHeader
    150157      //
    151158      this.descriptionColumnHeader.Text = "Description";
    152       this.descriptionColumnHeader.Width = 600;
     159      //
     160      // imageList
     161      //
     162      this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     163      this.imageList.ImageSize = new System.Drawing.Size(16, 16);
     164      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
    153165      //
    154166      // codeEditor
     
    197209      // splitContainer2.Panel2
    198210      //
    199       this.splitContainer2.Panel2.Controls.Add(this.tabControl1);
     211      this.splitContainer2.Panel2.Controls.Add(this.infoTabControl);
    200212      this.splitContainer2.Size = new System.Drawing.Size(637, 543);
    201213      this.splitContainer2.SplitterDistance = 428;
    202214      this.splitContainer2.TabIndex = 5;
    203215      //
    204       // tabControl1
    205       //
    206       this.tabControl1.Controls.Add(this.errorListTabPage);
    207       this.tabControl1.Controls.Add(this.outputTabPage);
    208       this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
    209       this.tabControl1.Location = new System.Drawing.Point(0, 0);
    210       this.tabControl1.Name = "tabControl1";
    211       this.tabControl1.SelectedIndex = 0;
    212       this.tabControl1.Size = new System.Drawing.Size(637, 111);
    213       this.tabControl1.TabIndex = 1;
    214       //
    215       // errorListTabPage
    216       //
    217       this.errorListTabPage.Controls.Add(this.errorListView);
    218       this.errorListTabPage.Location = new System.Drawing.Point(4, 22);
    219       this.errorListTabPage.Name = "errorListTabPage";
    220       this.errorListTabPage.Padding = new System.Windows.Forms.Padding(3);
    221       this.errorListTabPage.Size = new System.Drawing.Size(629, 85);
    222       this.errorListTabPage.TabIndex = 0;
    223       this.errorListTabPage.Text = "Error List";
    224       this.errorListTabPage.UseVisualStyleBackColor = true;
     216      // infoTabControl
     217      //
     218      this.infoTabControl.Controls.Add(this.outputTabPage);
     219      this.infoTabControl.Controls.Add(this.errorListTabPage);
     220      this.infoTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
     221      this.infoTabControl.Location = new System.Drawing.Point(0, 0);
     222      this.infoTabControl.Name = "infoTabControl";
     223      this.infoTabControl.SelectedIndex = 0;
     224      this.infoTabControl.Size = new System.Drawing.Size(637, 111);
     225      this.infoTabControl.TabIndex = 1;
    225226      //
    226227      // outputTabPage
     
    247248      this.outputTextBox.TabIndex = 0;
    248249      this.outputTextBox.WordWrap = false;
     250      //
     251      // errorListTabPage
     252      //
     253      this.errorListTabPage.Controls.Add(this.errorListView);
     254      this.errorListTabPage.Location = new System.Drawing.Point(4, 22);
     255      this.errorListTabPage.Name = "errorListTabPage";
     256      this.errorListTabPage.Padding = new System.Windows.Forms.Padding(3);
     257      this.errorListTabPage.Size = new System.Drawing.Size(629, 85);
     258      this.errorListTabPage.TabIndex = 0;
     259      this.errorListTabPage.Text = "Error List";
     260      this.errorListTabPage.UseVisualStyleBackColor = true;
    249261      //
    250262      // variableStoreView
     
    273285      this.viewHost.ViewType = null;
    274286      //
     287      // compileButton
     288      //
     289      this.compileButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Script;
     290      this.compileButton.Location = new System.Drawing.Point(6, 26);
     291      this.compileButton.Name = "compileButton";
     292      this.compileButton.Size = new System.Drawing.Size(24, 24);
     293      this.compileButton.TabIndex = 8;
     294      this.compileButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     295      this.toolTip.SetToolTip(this.compileButton, "Compile (F6)");
     296      this.compileButton.UseVisualStyleBackColor = true;
     297      this.compileButton.Click += new System.EventHandler(this.compileButton_Click);
     298      //
    275299      // ScriptView
    276300      //
    277301      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     302      this.Controls.Add(this.compileButton);
    278303      this.Controls.Add(this.splitContainer1);
    279304      this.Controls.Add(this.startStopButton);
     
    287312      this.Controls.SetChildIndex(this.nameTextBox, 0);
    288313      this.Controls.SetChildIndex(this.infoLabel, 0);
     314      this.Controls.SetChildIndex(this.compileButton, 0);
    289315      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    290316      this.splitContainer1.Panel1.ResumeLayout(false);
     
    296322      ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
    297323      this.splitContainer2.ResumeLayout(false);
    298       this.tabControl1.ResumeLayout(false);
    299       this.errorListTabPage.ResumeLayout(false);
     324      this.infoTabControl.ResumeLayout(false);
    300325      this.outputTabPage.ResumeLayout(false);
    301326      this.outputTabPage.PerformLayout();
     327      this.errorListTabPage.ResumeLayout(false);
    302328      this.ResumeLayout(false);
    303329      this.PerformLayout();
     
    320346    private System.Windows.Forms.ColumnHeader errorNumberColumnHeader;
    321347    private System.Windows.Forms.ColumnHeader categoryColumnHeader;
    322     private System.Windows.Forms.TabControl tabControl1;
     348    private System.Windows.Forms.TabControl infoTabControl;
    323349    private System.Windows.Forms.TabPage errorListTabPage;
    324350    private System.Windows.Forms.TabPage outputTabPage;
    325351    private System.Windows.Forms.TextBox outputTextBox;
     352    private System.Windows.Forms.Button compileButton;
     353    private System.Windows.Forms.ColumnHeader iconColumnHeader;
     354    private System.Windows.Forms.ImageList imageList;
    326355  }
    327356}
  • trunk/sources/HeuristicLab.HLScript.Views/3.3/ScriptView.cs

    r10401 r10506  
    2222using System;
    2323using System.CodeDom.Compiler;
    24 using System.Collections.Generic;
    2524using System.Drawing;
     25using System.Globalization;
    2626using System.Linq;
    2727using System.Windows.Forms;
     
    3131using HeuristicLab.MainForm;
    3232
    33 namespace HeuristicLab.HLScript.Views {
     33namespace HeuristicLab.Scripting.Views {
    3434
    3535  [View("Script View")]
     
    4545    public ScriptView() {
    4646      InitializeComponent();
     47      errorListView.SmallImageList.Images.AddRange(new Image[] { VSImageLibrary.Warning, VSImageLibrary.Error });
     48      AdjustErrorListViewColumnSizes();
    4749    }
    4850
     
    6870    }
    6971    private void Content_ScriptExecutionStarted(object sender, EventArgs e) {
    70       Locked = true;
    71       ReadOnly = true;
    72       startStopButton.Image = VSImageLibrary.Stop;
    73     }
    74     private void Content_ScriptExecutionFinished(object sender, EventArgs e) {
    75       Locked = false;
    76       ReadOnly = false;
    77       startStopButton.Image = VSImageLibrary.Play;
    78       running = false;
     72      if (InvokeRequired)
     73        Invoke((Action<object, EventArgs>)Content_ScriptExecutionStarted, sender, e);
     74      else {
     75        Locked = true;
     76        ReadOnly = true;
     77        startStopButton.Image = VSImageLibrary.Stop;
     78        infoTabControl.SelectedTab = outputTabPage;
     79      }
     80    }
     81    private void Content_ScriptExecutionFinished(object sender, EventArgs<Exception> e) {
     82      if (InvokeRequired)
     83        Invoke((Action<object, EventArgs<Exception>>)Content_ScriptExecutionFinished, sender, e);
     84      else {
     85        Locked = false;
     86        ReadOnly = false;
     87        startStopButton.Image = VSImageLibrary.Play;
     88        running = false;
     89        var ex = e.Value;
     90        if (ex != null)
     91          PluginInfrastructure.ErrorHandling.ShowErrorDialog(this, ex);
     92      }
    7993    }
    8094    private void Content_ConsoleOutputChanged(object sender, EventArgs<string> e) {
    81       if (InvokeRequired) Invoke((Action<object, EventArgs<string>>)Content_ConsoleOutputChanged, sender, e);
     95      if (InvokeRequired)
     96        Invoke((Action<object, EventArgs<string>>)Content_ConsoleOutputChanged, sender, e);
    8297      else {
    8398        outputTextBox.AppendText(e.Value);
     
    111126    protected override void SetEnabledStateOfControls() {
    112127      base.SetEnabledStateOfControls();
     128      compileButton.Enabled = Content != null && !Locked && !ReadOnly;
    113129      startStopButton.Enabled = Content != null && (!Locked || running);
    114130      codeEditor.Enabled = Content != null && !Locked && !ReadOnly;
     
    116132
    117133    #region Child Control event handlers
     134    private void compileButton_Click(object sender, EventArgs e) {
     135      Compile();
     136    }
     137
    118138    private void startStopButton_Click(object sender, EventArgs e) {
    119139      if (running) {
     
    134154    #region global HotKeys
    135155    protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
    136       if (keyData == Keys.F5) {
    137         if (Content == null || Locked)
    138           return base.ProcessCmdKey(ref msg, keyData);
    139         outputTextBox.Clear();
    140         bool result = Compile();
    141         if (result) {
    142           outputTextBox.Clear();
    143           Content.Execute();
    144           running = true;
    145         }
    146         return true;
    147       } else if (keyData == (Keys.F5 | Keys.Shift)) {
    148         Content.Kill();
     156      switch (keyData) {
     157        case Keys.F5:
     158          if (Content != null && !Locked) {
     159            if (Compile()) {
     160              outputTextBox.Clear();
     161              Content.Execute();
     162              running = true;
     163            } else
     164              infoTabControl.SelectedTab = errorListTabPage;
     165          }
     166          break;
     167        case Keys.F5 | Keys.Shift:
     168          if (running) Content.Kill();
     169          break;
     170        case Keys.F6:
     171          if (!Compile() || Content.CompileErrors.HasWarnings)
     172            infoTabControl.SelectedTab = errorListTabPage;
     173          break;
    149174      }
    150175      return base.ProcessCmdKey(ref msg, keyData);
     
    157182      Locked = true;
    158183      errorListView.Items.Clear();
    159       outputTextBox.Clear();
    160       outputTextBox.AppendText("Compiling ... ");
     184      outputTextBox.Text = "Compiling ... ";
    161185      try {
    162186        Content.Compile();
     
    165189      } catch {
    166190        outputTextBox.AppendText("Compilation failed.");
    167         ShowCompilationErrors();
    168191        return false;
    169192      } finally {
    170         OnContentChanged();
     193        ShowCompilationResults();
    171194        ReadOnly = false;
    172195        Locked = false;
    173       }
    174     }
    175     #endregion
    176 
    177     private void ShowCompilationErrors() {
     196        OnContentChanged();
     197      }
     198    }
     199    #endregion
     200
     201    private void ShowCompilationResults() {
    178202      if (Content.CompileErrors.Count == 0) return;
    179       var warnings = new List<CompilerError>();
    180       var errors = new List<CompilerError>();
    181       foreach (CompilerError ce in Content.CompileErrors) {
    182         if (ce.IsWarning) warnings.Add(ce);
    183         else errors.Add(ce);
    184       }
    185       var msgs = warnings.OrderBy(x => x.Line)
    186                          .ThenBy(x => x.Column)
    187                    .Concat(errors.OrderBy(x => x.Line)
    188                                  .ThenBy(x => x.Column));
    189       outputTextBox.AppendText(Environment.NewLine);
    190       outputTextBox.AppendText("---");
    191       outputTextBox.AppendText(Environment.NewLine);
     203      var msgs = Content.CompileErrors.OfType<CompilerError>()
     204                                      .OrderBy(x => x.IsWarning)
     205                                      .ThenBy(x => x.Line)
     206                                      .ThenBy(x => x.Column);
    192207      foreach (var m in msgs) {
    193         var item = new ListViewItem(new[] {
     208        var item = new ListViewItem();
     209        item.SubItems.AddRange(new[] {
    194210          m.IsWarning ? "Warning" : "Error",
    195211          m.ErrorNumber,
    196           m.Line.ToString(),
    197           m.Column.ToString(),
     212          m.Line.ToString(CultureInfo.InvariantCulture),
     213          m.Column.ToString(CultureInfo.InvariantCulture),
    198214          m.ErrorText
    199215        });
     216        item.ImageIndex = m.IsWarning ? 0 : 1;
    200217        errorListView.Items.Add(item);
    201         outputTextBox.AppendText(string.Format("{0} {1} ({2}:{3}): {4}",
    202                                  item.SubItems[0].Text,
    203                                  item.SubItems[1].Text,
    204                                  item.SubItems[2].Text,
    205                                  item.SubItems[3].Text,
    206                                  item.SubItems[4].Text));
    207         outputTextBox.AppendText(Environment.NewLine);
    208       }
     218      }
     219      AdjustErrorListViewColumnSizes();
     220    }
     221
     222    private void AdjustErrorListViewColumnSizes() {
     223      foreach (ColumnHeader ch in errorListView.Columns)
     224        // adjusts the column width to the width of the column
     225        // header or the column content, whichever is greater
     226        ch.Width = -2;
    209227    }
    210228  }
  • trunk/sources/HeuristicLab.HLScript.Views/3.3/VariableStoreView.Designer.cs

    r10358 r10506  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using System.Windows.Forms;
    2323
    24 namespace HeuristicLab.HLScript.Views {
     24namespace HeuristicLab.Scripting.Views {
    2525  partial class VariableStoreView {
    2626    /// <summary>
  • trunk/sources/HeuristicLab.HLScript.Views/3.3/VariableStoreView.cs

    r10401 r10506  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2525using System.Drawing;
    2626using System.Linq;
     27using System.Text.RegularExpressions;
    2728using System.Windows.Forms;
    2829using HeuristicLab.Collections;
     
    3637using HeuristicLab.PluginInfrastructure;
    3738
    38 namespace HeuristicLab.HLScript.Views {
     39namespace HeuristicLab.Scripting.Views {
    3940  [View("ItemCollection View")]
    4041  [Content(typeof(VariableStore), true)]
     
    288289    }
    289290
     291    private readonly Regex SafeVariableNameRegex = new Regex("^[@]?[_a-zA-Z][_a-zA-Z0-9]*$");
    290292    private void variableListView_AfterLabelEdit(object sender, LabelEditEventArgs e) {
    291       if (!string.IsNullOrEmpty(e.Label)) {
     293      string name = e.Label;
     294      if (!string.IsNullOrEmpty(name) && SafeVariableNameRegex.IsMatch(name)) {
    292295        var variable = (KeyValuePair<string, object>)variableListView.Items[e.Item].Tag;
    293         if (!Content.ContainsKey(e.Label)) {
     296        if (!Content.ContainsKey(name)) {
    294297          Content.Remove(variable.Key);
    295           Content.Add(e.Label, variable.Value);
     298          Content.Add(name, variable.Value);
    296299        }
    297300      }
     
    390393    }
    391394    protected virtual void AdjustListViewColumnSizes() {
    392       if (variableListView.Items.Count > 0) {
    393         for (int i = 0; i < variableListView.Columns.Count; i++)
    394           variableListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    395       }
     395      foreach (ColumnHeader ch in variableListView.Columns)
     396        ch.Width = -2;
    396397    }
    397398    protected virtual void RebuildImageList() {
  • trunk/sources/HeuristicLab.HLScript/3.3/HeuristicLab.Scripting-3.3.csproj

    r10501 r10506  
    88    <OutputType>Library</OutputType>
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    10     <RootNamespace>HeuristicLab.HLScript</RootNamespace>
    11     <AssemblyName>HeuristicLab.HLScript-3.3</AssemblyName>
     10    <RootNamespace>HeuristicLab.Scripting</RootNamespace>
     11    <AssemblyName>HeuristicLab.Scripting-3.3</AssemblyName>
    1212    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    1313    <FileAlignment>512</FileAlignment>
  • trunk/sources/HeuristicLab.HLScript/3.3/Plugin.cs.frame

    r10332 r10506  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using HeuristicLab.PluginInfrastructure;
    2323
    24 namespace HeuristicLab.HLScript {
    25   [Plugin("HeuristicLab.HLScript", "3.3.9.$WCREV$")]
    26   [PluginFile("HeuristicLab.HLScript-3.3.dll", PluginFileType.Assembly)]
     24namespace HeuristicLab.Scripting {
     25  [Plugin("HeuristicLab.Scripting", "3.3.9.$WCREV$")]
     26  [PluginFile("HeuristicLab.Scripting-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
    2828  [PluginDependency("HeuristicLab.Common", "3.3")]
     
    3030  [PluginDependency("HeuristicLab.Core", "3.3")]
    3131  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    32   public class HeuristicLabHLScriptPlugin : PluginBase {
     32  public class HeuristicLabScriptingPlugin : PluginBase {
    3333  }
    3434}
  • trunk/sources/HeuristicLab.HLScript/3.3/Properties/AssemblyInfo.cs.frame

    r10332 r10506  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2727// set of attributes. Change these attribute values to modify the information
    2828// associated with an assembly.
    29 [assembly: AssemblyTitle("HeuristicLab.HLScript")]
     29[assembly: AssemblyTitle("HeuristicLab.Scripting")]
    3030[assembly: AssemblyDescription("")]
    3131[assembly: AssemblyConfiguration("")]
    3232[assembly: AssemblyCompany("")]
    3333[assembly: AssemblyProduct("HeuristicLab")]
    34 [assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
     34[assembly: AssemblyCopyright("(c) 2002-2014 HEAL")]
    3535[assembly: AssemblyTrademark("")]
    3636[assembly: AssemblyCulture("")]
  • trunk/sources/HeuristicLab.HLScript/3.3/Script.cs

    r10401 r10506  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.CodeDom;
    324using System.CodeDom.Compiler;
     
    1637using Microsoft.CSharp;
    1738
    18 namespace HeuristicLab.HLScript {
    19   [Item("Script", "A HeuristicLab script.")]
     39namespace HeuristicLab.Scripting {
     40  [Item("Script", "An empty C# script.")]
    2041  [Creatable("Scripts")]
    2142  [StorableClass]
     
    2748
    2849using System;
    29 
    30 namespace UserScripts {
    31   public class UserScript : HeuristicLab.HLScript.UserScriptBase {
    32     public override void Main() {
    33       // type your code here
    34     }
    35 
    36     // further classes and methods
    37 
     50using System.Linq;
     51using System.Collections.Generic;
     52using HeuristicLab.Common;
     53using HeuristicLab.Core;
     54using HeuristicLab.Data;
     55
     56public class UserScript : HeuristicLab.Scripting.UserScriptBase {
     57  public override void Main() {
     58    // type your code here
    3859  }
     60
     61  // further classes and methods
     62
    3963}";
    4064    #endregion
     
    126150        GenerateExecutable = false,
    127151        GenerateInMemory = true,
    128         IncludeDebugInformation = false
     152        IncludeDebugInformation = true,
     153        WarningLevel = 4
    129154      };
    130155      parameters.ReferencedAssemblies.AddRange(
     
    212237      if (executeMethod != null) {
    213238        scriptThread = new Thread(() => {
     239          Exception ex = null;
    214240          try {
    215241            OnScriptExecutionStarted();
    216242            executeMethod.Invoke(compiledScript, new[] { VariableStore });
     243          } catch (ThreadAbortException) {
     244            // the execution was cancelled by the user
     245          } catch (TargetInvocationException e) {
     246            ex = e.InnerException;
    217247          } finally {
    218             OnScriptExecutionFinished();
     248            OnScriptExecutionFinished(ex);
    219249          }
    220250        });
     
    250280    }
    251281
    252     public event EventHandler ScriptExecutionFinished;
    253     private void OnScriptExecutionFinished() {
     282    public event EventHandler<EventArgs<Exception>> ScriptExecutionFinished;
     283    private void OnScriptExecutionFinished(Exception e) {
    254284      var handler = ScriptExecutionFinished;
    255       if (handler != null) handler(this, EventArgs.Empty);
     285      if (handler != null) handler(this, new EventArgs<Exception>(e));
    256286    }
    257287
  • trunk/sources/HeuristicLab.HLScript/3.3/UserScriptBase.cs

    r10401 r10506  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Dynamic;
    324using System.IO;
    425using System.Text;
    5 using System.Threading;
    626using HeuristicLab.Common;
    727
    8 namespace HeuristicLab.HLScript {
     28namespace HeuristicLab.Scripting {
    929  public abstract class UserScriptBase {
    1030    protected dynamic vars;
     
    2343    private void Execute(VariableStore variableStore) {
    2444      vars = new Variables(variableStore);
    25       try {
    26         Main();
    27       } catch (ThreadAbortException) {
    28       } catch (Exception e) {
    29         Console.WriteLine("---");
    30         Console.WriteLine(e);
    31       }
     45      Main();
    3246    }
    3347
  • trunk/sources/HeuristicLab.HLScript/3.3/VariableStore.cs

    r10332 r10506  
    1 using HeuristicLab.Collections;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Collections;
    223using HeuristicLab.Common;
    324using HeuristicLab.Core;
    425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    526
    6 namespace HeuristicLab.HLScript {
     27namespace HeuristicLab.Scripting {
    728  [Item("VariableStore", "Represents a variable store.")]
    829  [StorableClass]
Note: See TracChangeset for help on using the changeset viewer.