Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/18/15 10:54:32 (9 years ago)
Author:
bburlacu
Message:

#2276: Merged trunk changes.

Location:
branches/HeuristicLab.DatasetRefactor/sources
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DatasetRefactor/sources

  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Scripting.Views/3.3/CSharpScriptView.Designer.cs

    r10731 r12031  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Scripting.Views/3.3/CSharpScriptView.cs

    r11171 r12031  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using System;
     23using System.Drawing;
     24using System.Threading;
    2325using System.Windows.Forms;
    2426using HeuristicLab.Common;
     
    3133  [Content(typeof(CSharpScript), true)]
    3234  public partial class CSharpScriptView : ScriptView {
     35    private const string ScriptExecutionStartedMessage = "Script execution started";
     36    private const string ScriptExecutionCanceledMessage = "Script execution canceled";
     37    private const string ScriptExecutionSuccessfulMessage = "Script execution successful";
     38    private const string ScriptExecutionFailedMessage = "Script execution failed";
     39
    3340    protected bool Running { get; set; }
    3441
     
    6572        startStopButton.Image = VSImageLibrary.Stop;
    6673        toolTip.SetToolTip(startStopButton, "Stop (Shift+F5)");
     74        UpdateInfoTextLabel(ScriptExecutionStartedMessage, SystemColors.ControlText);
    6775        infoTabControl.SelectedTab = outputTabPage;
    6876      }
     
    7684        startStopButton.Image = VSImageLibrary.Play;
    7785        toolTip.SetToolTip(startStopButton, "Run (F5)");
     86
     87        var ex = e.Value;
     88        if (ex == null) {
     89          UpdateInfoTextLabel(ScriptExecutionSuccessfulMessage, Color.DarkGreen);
     90        } else if (ex is ThreadAbortException) {
     91          // the execution was canceled by the user
     92          UpdateInfoTextLabel(ScriptExecutionCanceledMessage, Color.DarkOrange);
     93        } else {
     94          UpdateInfoTextLabel(ScriptExecutionFailedMessage, Color.DarkRed);
     95          PluginInfrastructure.ErrorHandling.ShowErrorDialog(this, ex);
     96        }
     97
    7898        Running = false;
    79         var ex = e.Value;
    80         if (ex != null)
    81           PluginInfrastructure.ErrorHandling.ShowErrorDialog(this, ex);
    8299      }
    83100    }
     
    111128        if (Compile()) {
    112129          outputTextBox.Clear();
    113           Content.Execute();
    114130          Running = true;
     131          Content.ExecuteAsync();
    115132        }
    116133    }
     
    123140            if (Compile()) {
    124141              outputTextBox.Clear();
    125               Content.Execute();
     142              Content.ExecuteAsync();
    126143              Running = true;
    127144            }
     
    132149          return true;
    133150        case Keys.F6:
    134           if (!Running) Compile();
     151          if (!Running) base.ProcessCmdKey(ref msg, keyData);
    135152          return true;
    136153      }
    137       return base.ProcessCmdKey(ref msg, keyData); ;
     154      return base.ProcessCmdKey(ref msg, keyData);
    138155    }
    139156    #endregion
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Scripting.Views/3.3/HeuristicLab.Scripting.Views-3.3.csproj

    r11078 r12031  
    1010    <RootNamespace>HeuristicLab.Scripting.Views</RootNamespace>
    1111    <AssemblyName>HeuristicLab.Scripting.Views-3.3</AssemblyName>
    12     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     12    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    1313    <FileAlignment>512</FileAlignment>
    1414    <TargetFrameworkProfile />
     
    2323    <WarningLevel>4</WarningLevel>
    2424    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     25    <Prefer32Bit>false</Prefer32Bit>
    2526  </PropertyGroup>
    2627  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     
    3132    <ErrorReport>prompt</ErrorReport>
    3233    <WarningLevel>4</WarningLevel>
     34    <Prefer32Bit>false</Prefer32Bit>
    3335  </PropertyGroup>
    3436  <PropertyGroup>
     
    4648    <ErrorReport>prompt</ErrorReport>
    4749    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     50    <Prefer32Bit>false</Prefer32Bit>
    4851  </PropertyGroup>
    4952  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
     
    5558    <ErrorReport>prompt</ErrorReport>
    5659    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     60    <Prefer32Bit>false</Prefer32Bit>
    5761  </PropertyGroup>
    5862  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
     
    6468    <ErrorReport>prompt</ErrorReport>
    6569    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     70    <Prefer32Bit>false</Prefer32Bit>
    6671  </PropertyGroup>
    6772  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
     
    7378    <ErrorReport>prompt</ErrorReport>
    7479    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     80    <Prefer32Bit>false</Prefer32Bit>
    7581  </PropertyGroup>
    7682  <ItemGroup>
     
    112118  </ItemGroup>
    113119  <ItemGroup>
    114     <ProjectReference Include="..\..\HeuristicLab.CodeEditor\3.3\HeuristicLab.CodeEditor-3.3.csproj">
    115       <Project>{489cfe09-fdf7-4c89-bab5-bd09cadd61ad}</Project>
    116       <Name>HeuristicLab.CodeEditor-3.3</Name>
    117       <Private>False</Private>
     120    <ProjectReference Include="..\..\HeuristicLab.CodeEditor\3.4\HeuristicLab.CodeEditor-3.4.csproj">
     121      <Project>{c38691ae-ecb4-489a-a05d-b035554e0168}</Project>
     122      <Name>HeuristicLab.CodeEditor-3.4</Name>
    118123    </ProjectReference>
    119124    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
     
    169174  </ItemGroup>
    170175  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    171    <PropertyGroup>
     176  <PropertyGroup>
    172177    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    173178set ProjectDir=$(ProjectDir)
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Scripting.Views/3.3/Plugin.cs.frame

    r11174 r12031  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2323
    2424namespace HeuristicLab.Scripting.Views {
    25   [Plugin("HeuristicLab.Scripting.Views", "3.3.10.$WCREV$")]
     25  [Plugin("HeuristicLab.Scripting.Views", "3.3.11.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Scripting.Views-3.3.dll", PluginFileType.Assembly)]
    27   [PluginDependency("HeuristicLab.CodeEditor", "3.3")]
     27  [PluginDependency("HeuristicLab.CodeEditor", "3.4")]
    2828  [PluginDependency("HeuristicLab.Collections", "3.3")]
    2929  [PluginDependency("HeuristicLab.Common", "3.3")]
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Scripting.Views/3.3/Properties/AssemblyInfo.cs.frame

    r11174 r12031  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3232[assembly: AssemblyCompany("")]
    3333[assembly: AssemblyProduct("HeuristicLab")]
    34 [assembly: AssemblyCopyright("(c) 2002-2014 HEAL")]
     34[assembly: AssemblyCopyright("(c) 2002-2015 HEAL")]
    3535[assembly: AssemblyTrademark("")]
    3636[assembly: AssemblyCulture("")]
     
    5555// [assembly: AssemblyVersion("1.0.*")]
    5656[assembly: AssemblyVersion("3.3.0.0")]
    57 [assembly: AssemblyFileVersion("3.3.10.$WCREV$")]
     57[assembly: AssemblyFileVersion("3.3.11.$WCREV$")]
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Scripting.Views/3.3/ScriptView.Designer.cs

    r10747 r12031  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    1919 */
    2020#endregion
     21
     22using System.Collections.Generic;
     23using System.Reflection;
     24using HeuristicLab.Common;
    2125
    2226namespace HeuristicLab.Scripting.Views {
     
    4650    private void InitializeComponent() {
    4751      this.components = new System.ComponentModel.Container();
    48       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScriptView));
    49       this.compilationLabel = new System.Windows.Forms.Label();
     52      this.infoTextLabel = new System.Windows.Forms.Label();
    5053      this.imageList = new System.Windows.Forms.ImageList(this.components);
    5154      this.compileButton = new System.Windows.Forms.Button();
     
    8487      this.infoLabel.Location = new System.Drawing.Point(816, 4);
    8588      //
    86       // compilationLabel
    87       //
    88       this.compilationLabel.AutoSize = true;
    89       this.compilationLabel.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
    90       this.compilationLabel.Location = new System.Drawing.Point(66, 32);
    91       this.compilationLabel.Name = "compilationLabel";
    92       this.compilationLabel.Size = new System.Drawing.Size(69, 13);
    93       this.compilationLabel.TabIndex = 3;
    94       this.compilationLabel.Text = "Not compiled";
     89      // infoTextLabel
     90      //
     91      this.infoTextLabel.AutoSize = true;
     92      this.infoTextLabel.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
     93      this.infoTextLabel.Location = new System.Drawing.Point(66, 32);
     94      this.infoTextLabel.Name = "infoTextLabel";
     95      this.infoTextLabel.Size = new System.Drawing.Size(69, 13);
     96      this.infoTextLabel.TabIndex = 3;
     97      this.infoTextLabel.Text = "Not compiled";
    9598      //
    9699      // imageList
     
    110113      this.toolTip.SetToolTip(this.compileButton, "Compile (F6)");
    111114      this.compileButton.UseVisualStyleBackColor = true;
    112       this.compileButton.Click += new System.EventHandler(this.CompileButtonOnClick);
     115      this.compileButton.Click += new System.EventHandler(this.compileButton_Click);
    113116      //
    114117      // infoTabControl
     
    178181      this.errorListView.UseCompatibleStateImageBehavior = false;
    179182      this.errorListView.View = System.Windows.Forms.View.Details;
     183      this.errorListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.errorListView_MouseDoubleClick);
    180184      //
    181185      // iconColumnHeader
     
    213217      this.codeEditor.TabIndex = 0;
    214218      this.codeEditor.UserCode = "";
    215       this.codeEditor.TextEditorTextChanged += new System.EventHandler(this.CodeEditorOnTextEditorTextChanged);
     219      this.codeEditor.TextEditorTextChanged += new System.EventHandler(this.codeEditor_TextEditorTextChanged);
     220      this.codeEditor.AssembliesLoading += new System.EventHandler<HeuristicLab.Common.EventArgs<System.Collections.Generic.IEnumerable<System.Reflection.Assembly>>>(this.codeEditor_AssembliesLoading);
     221      this.codeEditor.AssembliesLoaded += new System.EventHandler<HeuristicLab.Common.EventArgs<System.Collections.Generic.IEnumerable<System.Reflection.Assembly>>>(this.codeEditor_AssembliesLoaded);
     222      this.codeEditor.AssembliesUnloading += new System.EventHandler<HeuristicLab.Common.EventArgs<System.Collections.Generic.IEnumerable<System.Reflection.Assembly>>>(this.codeEditor_AssembliesUnloading);
     223      this.codeEditor.AssembliesUnloaded += new System.EventHandler<HeuristicLab.Common.EventArgs<System.Collections.Generic.IEnumerable<System.Reflection.Assembly>>>(this.codeEditor_AssembliesUnloaded);
    216224      //
    217225      // splitContainer1
    218226      //
    219       this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    220             | System.Windows.Forms.AnchorStyles.Left)
     227      this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     228            | System.Windows.Forms.AnchorStyles.Left) 
    221229            | System.Windows.Forms.AnchorStyles.Right)));
    222230      this.splitContainer1.Location = new System.Drawing.Point(0, 56);
     
    240248      this.Controls.Add(this.splitContainer1);
    241249      this.Controls.Add(this.compileButton);
    242       this.Controls.Add(this.compilationLabel);
     250      this.Controls.Add(this.infoTextLabel);
    243251      this.Name = "ScriptView";
    244252      this.Size = new System.Drawing.Size(835, 602);
    245       this.Controls.SetChildIndex(this.compilationLabel, 0);
     253      this.Controls.SetChildIndex(this.infoTextLabel, 0);
    246254      this.Controls.SetChildIndex(this.compileButton, 0);
    247255      this.Controls.SetChildIndex(this.splitContainer1, 0);
     
    265273    #endregion
    266274
    267     protected System.Windows.Forms.Label compilationLabel;
     275    protected System.Windows.Forms.Label infoTextLabel;
    268276    protected System.Windows.Forms.Button compileButton;
    269277    protected System.Windows.Forms.ImageList imageList;
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Scripting.Views/3.3/ScriptView.cs

    r11480 r12031  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using System;
    2323using System.CodeDom.Compiler;
     24using System.Collections.Generic;
    2425using System.Drawing;
    2526using System.Globalization;
    2627using System.Linq;
     28using System.Reflection;
    2729using System.Windows.Forms;
     30using HeuristicLab.Common;
    2831using HeuristicLab.Common.Resources;
    2932using HeuristicLab.Core.Views;
     
    3538  [Content(typeof(Script), true)]
    3639  public partial class ScriptView : NamedItemView {
     40    private const string NotCompiledMessage = "Not compiled";
     41    private const string CompilationSucceededMessage = "Compilation succeeded";
     42    private const string CompilationFailedMessage = "Compilation failed";
     43    private const string AssembliesLoadingMessage = "Loading Assemblies";
     44    private const string AssembliesUnloadingMessage = "Unloading Assemblies";
     45    private const int SilentAssemblyLoadingOperationLimit = 10;
     46
     47    #region Properties
    3748    public new Script Content {
    3849      get { return (Script)base.Content; }
     
    4051    }
    4152
     53    public override bool ReadOnly {
     54      get { return codeEditor.ReadOnly || base.ReadOnly; }
     55      set { base.ReadOnly = codeEditor.ReadOnly = value; }
     56    }
     57
     58    public override bool Locked {
     59      get { return codeEditor.ReadOnly || base.Locked; }
     60      set { base.Locked = codeEditor.ReadOnly = value; }
     61    }
     62    #endregion
     63
    4264    public ScriptView() {
    4365      InitializeComponent();
     
    4567    }
    4668
    47     public override bool ReadOnly {
    48       get { return codeEditor.ReadOnly || base.ReadOnly; }
    49       set { base.ReadOnly = codeEditor.ReadOnly = value; }
    50     }
    51 
    52     public override bool Locked {
    53       get { return codeEditor.ReadOnly || base.Locked; }
    54       set { base.Locked = codeEditor.ReadOnly = value; }
    55     }
    56 
    5769    protected override void RegisterContentEvents() {
    5870      base.RegisterContentEvents();
    59       Content.CodeChanged += ContentOnCodeChanged;
     71      Content.CodeChanged += Content_CodeChanged;
    6072    }
    6173
    6274    protected override void DeregisterContentEvents() {
    63       Content.CodeChanged -= ContentOnCodeChanged;
     75      Content.CodeChanged -= Content_CodeChanged;
    6476      base.DeregisterContentEvents();
    6577    }
    6678
    67     protected virtual void ContentOnCodeChanged(object sender, EventArgs e) {
    68       codeEditor.UserCode = Content.Code;
    69     }
    70 
     79    #region Overrides
    7180    protected override void OnContentChanged() {
    7281      base.OnContentChanged();
     
    7584      } else {
    7685        codeEditor.UserCode = Content.Code;
    77         foreach (var asm in Content.GetAssemblies())
    78           codeEditor.AddAssembly(asm);
     86        codeEditor.AddAssembliesAsync(Content.GetAssemblies());
    7987        if (Content.CompileErrors == null) {
    80           compilationLabel.ForeColor = SystemColors.ControlDarkDark;
    81           compilationLabel.Text = "Not compiled";
    82         } else if (Content.CompileErrors.HasErrors) {
    83           compilationLabel.ForeColor = Color.DarkRed;
    84           compilationLabel.Text = "Compilation failed";
    85         } else {
    86           compilationLabel.ForeColor = Color.DarkGreen;
    87           compilationLabel.Text = "Compilation successful";
     88          UpdateInfoTextLabel(NotCompiledMessage, SystemColors.ControlText);
    8889        }
    8990      }
     
    9697    }
    9798
    98     protected virtual void CompileButtonOnClick(object sender, EventArgs e) {
    99       Compile();
    100     }
    101 
    102     protected virtual void CodeEditorOnTextEditorTextChanged(object sender, EventArgs e) {
    103       if (Content == null) return;
    104       Content.Code = codeEditor.UserCode;
    105     }
    10699    protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
    107100      switch (keyData) {
     
    113106      return base.ProcessCmdKey(ref msg, keyData);
    114107    }
     108    #endregion
    115109
    116110    public virtual bool Compile() {
     
    121115      try {
    122116        Content.Compile();
    123         outputTextBox.AppendText("Compilation succeeded.");
     117        outputTextBox.AppendText(CompilationSucceededMessage);
     118        UpdateInfoTextLabel(CompilationSucceededMessage, Color.DarkGreen);
    124119        return true;
    125       } catch {
     120      } catch (CompilationException) {
    126121        if (Content.CompileErrors.HasErrors) {
    127           outputTextBox.AppendText("Compilation failed.");
     122          outputTextBox.AppendText(CompilationFailedMessage);
     123          UpdateInfoTextLabel(CompilationFailedMessage, Color.DarkRed);
    128124          return false;
    129125        } else {
    130           outputTextBox.AppendText("Compilation succeeded.");
     126          outputTextBox.AppendText(CompilationSucceededMessage);
     127          UpdateInfoTextLabel(CompilationSucceededMessage, Color.DarkGreen);
    131128          return true;
    132129        }
     
    137134        ReadOnly = false;
    138135        Locked = false;
    139         OnContentChanged();
    140       }
    141     }
    142 
     136        codeEditor.Focus();
     137      }
     138    }
     139
     140    #region Helpers
    143141    protected virtual void ShowCompilationResults() {
    144       if (Content.CompileErrors.Count == 0) return;
    145       var msgs = Content.CompileErrors.OfType<CompilerError>()
     142      var messages = Content.CompileErrors.OfType<CompilerError>()
    146143                                      .OrderBy(x => x.IsWarning)
    147144                                      .ThenBy(x => x.Line)
    148145                                      .ThenBy(x => x.Column);
    149       foreach (var m in msgs) {
    150         var item = new ListViewItem();
     146
     147      foreach (var m in messages) {
     148        var item = new ListViewItem { Tag = m };
    151149        item.SubItems.AddRange(new[] {
    152150          m.IsWarning ? "Warning" : "Error",
     
    159157        errorListView.Items.Add(item);
    160158      }
     159
     160      codeEditor.ShowCompileErrors(Content.CompileErrors);
     161
    161162      AdjustErrorListViewColumnSizes();
     163    }
     164
     165    protected virtual void UpdateInfoTextLabel(string message, Color color) {
     166      infoTextLabel.Text = message;
     167      infoTextLabel.ForeColor = color;
    162168    }
    163169
     
    167173        ch.Width = -2;
    168174    }
     175
     176    #region ProgressView
     177    private bool progressViewCreated;
     178
     179    private void AddProgressView(string progressMessage) {
     180      var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     181      mainForm.AddOperationProgressToView(this, progressMessage);
     182      progressViewCreated = true;
     183    }
     184
     185    private void RemoveProgressView() {
     186      if (!progressViewCreated) return;
     187      var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
     188      mainForm.RemoveOperationProgressFromView(this);
     189      progressViewCreated = false;
     190    }
     191    #endregion
     192    #endregion
     193
     194    #region Event Handlers
     195    protected virtual void Content_CodeChanged(object sender, EventArgs e) {
     196      if (InvokeRequired) Invoke((Action<object, EventArgs>)Content_CodeChanged, sender, e);
     197      else {
     198        codeEditor.UserCode = Content.Code;
     199      }
     200    }
     201
     202    private void compileButton_Click(object sender, EventArgs e) {
     203      Compile();
     204    }
     205
     206    private void codeEditor_TextEditorTextChanged(object sender, EventArgs e) {
     207      if (Content == null) return;
     208      Content.Code = codeEditor.UserCode;
     209    }
     210
     211    private void errorListView_MouseDoubleClick(object sender, MouseEventArgs e) {
     212      if (e.Button == MouseButtons.Left) {
     213        var item = errorListView.SelectedItems[0];
     214        var message = (CompilerError)item.Tag;
     215        codeEditor.ScrollToPosition(message.Line, message.Column);
     216        codeEditor.Focus();
     217      }
     218    }
     219    #endregion
     220
     221    private void codeEditor_AssembliesLoading(object sender, EventArgs<IEnumerable<Assembly>> e) {
     222      if (InvokeRequired) Invoke((Action<object, EventArgs<IEnumerable<Assembly>>>)codeEditor_AssembliesLoading, sender, e);
     223      else {
     224        int nrOfAssemblies = e.Value.Count();
     225        if (nrOfAssemblies > SilentAssemblyLoadingOperationLimit)
     226          AddProgressView(AssembliesLoadingMessage);
     227      }
     228    }
     229
     230    private void codeEditor_AssembliesLoaded(object sender, EventArgs<IEnumerable<Assembly>> e) {
     231      if (InvokeRequired) Invoke((Action<object, EventArgs<IEnumerable<Assembly>>>)codeEditor_AssembliesLoaded, sender, e);
     232      else {
     233        RemoveProgressView();
     234      }
     235    }
     236
     237    private void codeEditor_AssembliesUnloading(object sender, EventArgs<IEnumerable<Assembly>> e) {
     238      if (InvokeRequired) Invoke((Action<object, EventArgs<IEnumerable<Assembly>>>)codeEditor_AssembliesUnloading, sender, e);
     239      else {
     240        int nrOfAssemblies = e.Value.Count();
     241        if (nrOfAssemblies > SilentAssemblyLoadingOperationLimit)
     242          AddProgressView(AssembliesUnloadingMessage);
     243      }
     244    }
     245
     246    private void codeEditor_AssembliesUnloaded(object sender, EventArgs<IEnumerable<Assembly>> e) {
     247      if (InvokeRequired) Invoke((Action<object, EventArgs<IEnumerable<Assembly>>>)codeEditor_AssembliesUnloaded, sender, e);
     248      else {
     249        RemoveProgressView();
     250      }
     251    }
    169252  }
    170253}
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Scripting.Views/3.3/VariableStoreView.Designer.cs

    r11436 r12031  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Scripting.Views/3.3/VariableStoreView.cs

    r11480 r12031  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    4747    #endregion
    4848
     49    private readonly Regex SafeVariableNameRegex = new Regex("^[@]?[_a-zA-Z][_a-zA-Z0-9]*$");
     50    private const string DefaultVariableName = "enter_name";
    4951    protected readonly Dictionary<string, ListViewItem> itemListViewItemMapping;
    5052    protected readonly Dictionary<Type, bool> serializableLookup;
     
    117119        sortDescendingButton.Enabled = false;
    118120        removeButton.Enabled = false;
    119         variableListView.Enabled = false;
     121        variableListView.LabelEdit = false;
    120122      } else {
    121123        bool enabled = !Locked && !ReadOnly;
     
    124126        sortDescendingButton.Enabled = variableListView.Items.Count > 1;
    125127        removeButton.Enabled = enabled && variableListView.SelectedItems.Count > 0;
    126         variableListView.Enabled = enabled;
    127128        variableListView.LabelEdit = enabled;
    128129      }
     
    242243    }
    243244    protected virtual void variableListView_DragEnter(object sender, DragEventArgs e) {
    244       validDragOperation = !Locked && !ReadOnly && e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null;
     245      validDragOperation = !Locked && !ReadOnly;
     246
     247      object item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     248      if (item is KeyValuePair<string, object>) {
     249        var variable = (KeyValuePair<string, object>)item;
     250        validDragOperation &= variable.Value is IDeepCloneable;
     251      } else {
     252        validDragOperation &= item is IDeepCloneable;
     253      }
    245254    }
    246255    protected virtual void variableListView_DragOver(object sender, DragEventArgs e) {
    247256      e.Effect = DragDropEffects.None;
    248257      if (validDragOperation) {
    249         if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     258        if (e.AllowedEffect.HasFlag(DragDropEffects.Copy))
     259          e.Effect = DragDropEffects.Copy;
    250260      }
    251261    }
     
    270280
    271281      var cloneable = item as IDeepCloneable;
    272       if (cloneable != null) item = cloneable.Clone();
    273 
    274       Content.Add(variableName, item);
     282      if (cloneable == null) return;
     283
     284      var clonedItem = cloneable.Clone();
     285      Content.Add(variableName, clonedItem);
    275286
    276287      var listViewItem = variableListView.FindItemWithText(variableName);
     
    278289      if (editLabel) listViewItem.BeginEdit();
    279290    }
    280 
    281     private readonly Regex SafeVariableNameRegex = new Regex("^[@]?[_a-zA-Z][_a-zA-Z0-9]*$");
    282     private const string DefaultVariableName = "enter_name";
    283291
    284292    private void variableListView_AfterLabelEdit(object sender, LabelEditEventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.