- Timestamp:
- 04/19/19 09:34:14 (6 years ago)
- Location:
- stable
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
-
stable/HeuristicLab.CodeEditor/3.4/CodeEditor.cs
r15584 r16832 109 109 get { return Doc.GetText(prefix.Length, Doc.TextLength - suffix.Length - prefix.Length); } 110 110 set { 111 if (Doc.Text == value) return; 112 Doc.Replace(prefix.Length, Doc.TextLength - suffix.Length - prefix.Length, value); 111 var curLength = Doc.TextLength - suffix.Length - prefix.Length; 112 var curUserCode = Doc.GetText(prefix.Length, curLength); 113 if (curUserCode == value) return; 114 Doc.Replace(prefix.Length, curLength, value); 113 115 } 114 116 } … … 274 276 #endregion 275 277 278 public override void ClearEditHistory() { 279 Doc.UndoStack.ClearAll(); 280 } 281 276 282 public override void ScrollToPosition(int line, int column) { 277 283 var segment = GetSegmentAtLocation(line, column); -
stable/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs
r15584 r16832 57 57 public virtual void ScrollToPosition(int line, int column) { } 58 58 59 public virtual void ClearEditHistory() { } 60 59 61 public virtual void ShowCompileErrors(CompilerErrorCollection compileErrors) { } 60 62 -
stable/HeuristicLab.Operators.Programmable.Views/3.3/ProgrammableOperatorView.cs
r15584 r16832 83 83 if (ProgrammableOperator == null) { 84 84 codeEditor.UserCode = string.Empty; 85 codeEditor.ClearEditHistory(); 85 86 assembliesTreeView.Nodes.Clear(); 86 87 parameterCollectionView.Content = null; … … 91 92 if (codeEditor.UserCode == string.Empty) 92 93 codeEditor.UserCode = string.Format(" {0}", Environment.NewLine); 94 codeEditor.ClearEditHistory(); 93 95 InitializeAssemblyList(); 94 96 InitializeNamespacesList(); … … 98 100 showCodeButton.Enabled = !string.IsNullOrEmpty(ProgrammableOperator.CompilationUnitCode); 99 101 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"; 111 116 } 112 117 } … … 158 163 } 159 164 InitializeNamespacesList(); 160 codeEditor.Prefix = GetGeneratedPrefix();161 165 } 162 166 private void namespacesTreeView_AfterCheck(object sender, TreeViewEventArgs e) { … … 168 172 ProgrammableOperator.UnselectNamespace(e.Node.FullPath); 169 173 } 170 codeEditor.Prefix = GetGeneratedPrefix();171 174 } 172 175 #endregion … … 190 193 private string GetGeneratedPrefix() { 191 194 StringBuilder prefix = new StringBuilder(); 192 foreach (var ns in ProgrammableOperator.GetSelectedAndValidNamespaces()) {193 prefix.Append("using ").Append(ns).AppendLine(";");194 }195 prefix.AppendLine();196 195 prefix.Append("public class ").Append(ProgrammableOperator.CompiledTypeName).AppendLine(" {"); 197 196 prefix.Append(" ").Append(ProgrammableOperator.Signature).AppendLine(" {"); … … 203 202 try { 204 203 ProgrammableOperator.Compile(); 205 } 206 catch (Exception ex) { 204 } catch (Exception ex) { 207 205 ErrorHandling.ShowErrorDialog(this, ex); 208 206 } 209 OnContentChanged();210 207 this.Enabled = true; 208 UpdateCompilationLabel(); 209 codeEditor.ShowCompileErrors(ProgrammableOperator.CompileErrors); 211 210 } 212 211 -
stable/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperator.cs
r15584 r16832 129 129 public void SelectNamespace(string ns) { 130 130 namespaces.Add(ns); 131 OnSignatureChanged();132 131 } 133 132 134 133 public void UnselectNamespace(string ns) { 135 134 namespaces.Remove(ns); 136 OnSignatureChanged();137 135 } 138 136 -
stable/HeuristicLab.Scripting.Views/3.3/ScriptView.cs
r15584 r16832 82 82 if (Content == null) { 83 83 codeEditor.UserCode = string.Empty; 84 codeEditor.ClearEditHistory(); 84 85 } else { 85 86 codeEditor.UserCode = Content.Code; 87 codeEditor.ClearEditHistory(); 86 88 codeEditor.AddAssembliesAsync(Content.GetAssemblies()); 87 89 if (Content.CompileErrors == null) {
Note: See TracChangeset
for help on using the changeset viewer.