Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/19/19 09:34:14 (5 years ago)
Author:
gkronber
Message:

#2967: merged r16528 from trunk to stable

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Operators.Programmable.Views/3.3/ProgrammableOperatorView.cs

    r15584 r16832  
    8383      if (ProgrammableOperator == null) {
    8484        codeEditor.UserCode = string.Empty;
     85        codeEditor.ClearEditHistory();
    8586        assembliesTreeView.Nodes.Clear();
    8687        parameterCollectionView.Content = null;
     
    9192        if (codeEditor.UserCode == string.Empty)
    9293          codeEditor.UserCode = string.Format("    {0}", Environment.NewLine);
     94        codeEditor.ClearEditHistory();
    9395        InitializeAssemblyList();
    9496        InitializeNamespacesList();
     
    98100        showCodeButton.Enabled = !string.IsNullOrEmpty(ProgrammableOperator.CompilationUnitCode);
    99101        parameterCollectionView.Content = ProgrammableOperator.Parameters;
    100         if (ProgrammableOperator.CompileErrors == null) {
    101           compilationLabel.ForeColor = SystemColors.ControlDarkDark;
    102           compilationLabel.Text = "Not compiled";
    103         } else if (ProgrammableOperator.CompileErrors.HasErrors) {
    104           compilationLabel.ForeColor = Color.DarkRed;
    105           compilationLabel.Text = "Compilation failed";
    106         } else {
    107           compilationLabel.ForeColor = Color.DarkGreen;
    108           compilationLabel.Text = "Compilation successful";
    109         }
    110 
     102      }
     103      UpdateCompilationLabel();
     104    }
     105
     106    private void UpdateCompilationLabel() {
     107      if (ProgrammableOperator == null || ProgrammableOperator.CompileErrors == null) {
     108        compilationLabel.ForeColor = SystemColors.ControlDarkDark;
     109        compilationLabel.Text = "Not compiled";
     110      } else if (ProgrammableOperator.CompileErrors.HasErrors) {
     111        compilationLabel.ForeColor = Color.DarkRed;
     112        compilationLabel.Text = "Compilation failed";
     113      } else {
     114        compilationLabel.ForeColor = Color.DarkGreen;
     115        compilationLabel.Text = "Compilation successful";
    111116      }
    112117    }
     
    158163      }
    159164      InitializeNamespacesList();
    160       codeEditor.Prefix = GetGeneratedPrefix();
    161165    }
    162166    private void namespacesTreeView_AfterCheck(object sender, TreeViewEventArgs e) {
     
    168172        ProgrammableOperator.UnselectNamespace(e.Node.FullPath);
    169173      }
    170       codeEditor.Prefix = GetGeneratedPrefix();
    171174    }
    172175    #endregion
     
    190193    private string GetGeneratedPrefix() {
    191194      StringBuilder prefix = new StringBuilder();
    192       foreach (var ns in ProgrammableOperator.GetSelectedAndValidNamespaces()) {
    193         prefix.Append("using ").Append(ns).AppendLine(";");
    194       }
    195       prefix.AppendLine();
    196195      prefix.Append("public class ").Append(ProgrammableOperator.CompiledTypeName).AppendLine(" {");
    197196      prefix.Append("  ").Append(ProgrammableOperator.Signature).AppendLine(" {");
     
    203202      try {
    204203        ProgrammableOperator.Compile();
    205       }
    206       catch (Exception ex) {
     204      } catch (Exception ex) {
    207205        ErrorHandling.ShowErrorDialog(this, ex);
    208206      }
    209       OnContentChanged();
    210207      this.Enabled = true;
     208      UpdateCompilationLabel();
     209      codeEditor.ShowCompileErrors(ProgrammableOperator.CompileErrors);
    211210    }
    212211
Note: See TracChangeset for help on using the changeset viewer.