Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/25/14 13:55:01 (10 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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() {
Note: See TracChangeset for help on using the changeset viewer.