Changeset 11836
- Timestamp:
- 01/28/15 14:32:00 (10 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CodeEditor/3.4/CodeEditor.cs
r11835 r11836 248 248 if (marker.Length != (int)marker.Tag) 249 249 marker.Delete(); 250 else { 251 int caretOffset = TextEditor.CaretOffset; 252 var line = Doc.GetLineByOffset(marker.StartOffset); 253 int lineEndOffset = line.EndOffset; 254 if (caretOffset == lineEndOffset) // special case for markers beyond line length 255 marker.Delete(); 256 } 250 257 } 251 258 OnTextEditorTextChanged(); -
trunk/sources/HeuristicLab.Scripting.Views/3.3/CSharpScriptView.cs
r11834 r11836 21 21 22 22 using System; 23 using System.Drawing; 24 using System.Threading; 23 25 using System.Windows.Forms; 24 26 using HeuristicLab.Common; … … 31 33 [Content(typeof(CSharpScript), true)] 32 34 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 33 40 protected bool Running { get; set; } 34 41 … … 65 72 startStopButton.Image = VSImageLibrary.Stop; 66 73 toolTip.SetToolTip(startStopButton, "Stop (Shift+F5)"); 74 UpdateInfoTextLabel(ScriptExecutionStartedMessage, SystemColors.ControlText); 67 75 infoTabControl.SelectedTab = outputTabPage; 68 76 } … … 76 84 startStopButton.Image = VSImageLibrary.Play; 77 85 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 78 98 Running = false; 79 var ex = e.Value;80 if (ex != null)81 PluginInfrastructure.ErrorHandling.ShowErrorDialog(this, ex);82 99 } 83 100 } -
trunk/sources/HeuristicLab.Scripting.Views/3.3/ScriptView.Designer.cs
r11807 r11836 50 50 private void InitializeComponent() { 51 51 this.components = new System.ComponentModel.Container(); 52 this. compilationLabel = new System.Windows.Forms.Label();52 this.infoTextLabel = new System.Windows.Forms.Label(); 53 53 this.imageList = new System.Windows.Forms.ImageList(this.components); 54 54 this.compileButton = new System.Windows.Forms.Button(); … … 87 87 this.infoLabel.Location = new System.Drawing.Point(816, 4); 88 88 // 89 // compilationLabel90 // 91 this. compilationLabel.AutoSize = true;92 this. compilationLabel.ForeColor = System.Drawing.SystemColors.ControlDarkDark;93 this. compilationLabel.Location = new System.Drawing.Point(66, 32);94 this. compilationLabel.Name = "compilationLabel";95 this. compilationLabel.Size = new System.Drawing.Size(69, 13);96 this. compilationLabel.TabIndex = 3;97 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"; 98 98 // 99 99 // imageList … … 217 217 this.codeEditor.TabIndex = 0; 218 218 this.codeEditor.UserCode = ""; 219 this.codeEditor.AssembliesLoaded += new System.EventHandler<EventArgs<IEnumerable<Assembly>>>(this.codeEditor_AssembliesLoaded);220 this.codeEditor.AssembliesLoading += new System.EventHandler<EventArgs<IEnumerable<Assembly>>>(this.codeEditor_AssembliesLoading);221 this.codeEditor.AssembliesUnloaded += new System.EventHandler<EventArgs<IEnumerable<Assembly>>>(this.codeEditor_AssembliesUnloaded);222 this.codeEditor.AssembliesUnloading += new System.EventHandler<EventArgs<IEnumerable<Assembly>>>(this.codeEditor_AssembliesUnloading);223 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); 224 224 // 225 225 // splitContainer1 226 226 // 227 this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 228 | 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) 229 229 | System.Windows.Forms.AnchorStyles.Right))); 230 230 this.splitContainer1.Location = new System.Drawing.Point(0, 56); … … 248 248 this.Controls.Add(this.splitContainer1); 249 249 this.Controls.Add(this.compileButton); 250 this.Controls.Add(this. compilationLabel);250 this.Controls.Add(this.infoTextLabel); 251 251 this.Name = "ScriptView"; 252 252 this.Size = new System.Drawing.Size(835, 602); 253 this.Controls.SetChildIndex(this. compilationLabel, 0);253 this.Controls.SetChildIndex(this.infoTextLabel, 0); 254 254 this.Controls.SetChildIndex(this.compileButton, 0); 255 255 this.Controls.SetChildIndex(this.splitContainer1, 0); … … 273 273 #endregion 274 274 275 protected System.Windows.Forms.Label compilationLabel;275 protected System.Windows.Forms.Label infoTextLabel; 276 276 protected System.Windows.Forms.Button compileButton; 277 277 protected System.Windows.Forms.ImageList imageList; -
trunk/sources/HeuristicLab.Scripting.Views/3.3/ScriptView.cs
r11819 r11836 86 86 codeEditor.AddAssembliesAsync(Content.GetAssemblies()); 87 87 if (Content.CompileErrors == null) { 88 compilationLabel.ForeColor = SystemColors.ControlDarkDark; 89 compilationLabel.Text = NotCompiledMessage; 88 UpdateInfoTextLabel(NotCompiledMessage, SystemColors.ControlText); 90 89 } 91 90 } … … 117 116 Content.Compile(); 118 117 outputTextBox.AppendText(CompilationSucceededMessage); 119 compilationLabel.ForeColor = Color.DarkGreen; 120 compilationLabel.Text = CompilationSucceededMessage; 118 UpdateInfoTextLabel(CompilationSucceededMessage, Color.DarkGreen); 121 119 return true; 122 120 } catch (InvalidOperationException) { 123 121 if (Content.CompileErrors.HasErrors) { 124 122 outputTextBox.AppendText(CompilationFailedMessage); 125 compilationLabel.ForeColor = Color.DarkRed; 126 compilationLabel.Text = CompilationFailedMessage; 123 UpdateInfoTextLabel(CompilationFailedMessage, Color.DarkRed); 127 124 return false; 128 125 } else { 129 126 outputTextBox.AppendText(CompilationSucceededMessage); 130 compilationLabel.ForeColor = Color.DarkGreen; 131 compilationLabel.Text = CompilationSucceededMessage; 127 UpdateInfoTextLabel(CompilationSucceededMessage, Color.DarkGreen); 132 128 return true; 133 129 } … … 144 140 #region Helpers 145 141 protected virtual void ShowCompilationResults() { 146 if (Content.CompileErrors.Count == 0) return;147 148 142 var messages = Content.CompileErrors.OfType<CompilerError>() 149 143 .OrderBy(x => x.IsWarning) … … 169 163 } 170 164 165 protected virtual void UpdateInfoTextLabel(string message, Color color) { 166 infoTextLabel.Text = message; 167 infoTextLabel.ForeColor = color; 168 } 169 171 170 protected virtual void AdjustErrorListViewColumnSizes() { 172 171 foreach (ColumnHeader ch in errorListView.Columns) -
trunk/sources/HeuristicLab.Scripting/3.3/Scripts/CSharp/CSharpScript.cs
r11834 r11836 102 102 OnScriptExecutionStarted(); 103 103 compiledScript.Execute(VariableStore); 104 } catch (ThreadAbortException) {105 // the execution was cancelled by the user106 104 } catch (Exception e) { 107 105 ex = e;
Note: See TracChangeset
for help on using the changeset viewer.