Changeset 2897
- Timestamp:
- 03/01/10 14:38:53 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Operators.Programmable/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators.Programmable/3.3/HeuristicLab.Operators.Programmable-3.3.csproj
r2799 r2897 72 72 </PropertyGroup> 73 73 <ItemGroup> 74 <Reference Include="HeuristicLab.Common-3.2, Version=3.2.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 75 <SpecificVersion>False</SpecificVersion> 76 <HintPath>..\..\HeuristicLab.Common\3.2\bin\Debug\HeuristicLab.Common-3.2.dll</HintPath> 77 </Reference> 78 <Reference Include="HeuristicLab.Common.Resources-3.2, Version=3.2.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 79 <SpecificVersion>False</SpecificVersion> 80 <HintPath>..\..\HeuristicLab.Common.Resources\3.2\bin\Debug\HeuristicLab.Common.Resources-3.2.dll</HintPath> 81 </Reference> 82 <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 83 <SpecificVersion>False</SpecificVersion> 84 <HintPath>..\..\HeuristicLab.Parameters\3.3\bin\Debug\HeuristicLab.Parameters-3.3.dll</HintPath> 85 </Reference> 74 86 <Reference Include="System" /> 75 87 <Reference Include="System.Core"> … … 129 141 <Name>HeuristicLab.MainForm-3.2</Name> 130 142 </ProjectReference> 143 <ProjectReference Include="..\..\HeuristicLab.Operators.Views\3.3\HeuristicLab.Operators.Views-3.3.csproj"> 144 <Project>{C49CB749-8B24-4628-8003-E86475749410}</Project> 145 <Name>HeuristicLab.Operators.Views-3.3</Name> 146 </ProjectReference> 131 147 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 132 148 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 133 149 <Name>HeuristicLab.Operators-3.3</Name> 150 </ProjectReference> 151 <ProjectReference Include="..\..\HeuristicLab.Parameters.Views\3.3\HeuristicLab.Parameters.Views-3.3.csproj"> 152 <Project>{AE5B1CE5-9862-4D6F-A700-D72CD9AEA295}</Project> 153 <Name>HeuristicLab.Parameters.Views-3.3</Name> 134 154 </ProjectReference> 135 155 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> -
trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperator.cs
r2877 r2897 43 43 [Creatable("Test")] 44 44 [EmptyStorableClass] 45 public class ProgrammableOperator : SingleSuccessorOperator {45 public class ProgrammableOperator : Operator { 46 46 47 47 #region Fields & Properties … … 50 50 public CompilerErrorCollection CompileErrors { get; private set; } 51 51 public string CompilationUnitCode { get; private set; } 52 52 53 53 [Storable] 54 54 private string code; … … 75 75 76 76 [Storable] 77 private IEnumerable<string> _persistedAssemblyNames { 78 get { 77 private IEnumerable<string> _persistedAssemblyNames { 78 get { 79 79 return Assemblies.Keys.Select(a => a.FullName); 80 80 } 81 81 set { 82 var selectedAssemblyNames = new HashSet<string>(value); 82 var selectedAssemblyNames = new HashSet<string>(value); 83 83 foreach (var a in Assemblies.Keys.ToList()) { 84 84 Assemblies[a] = selectedAssemblyNames.Contains(a.FullName); 85 } 85 } 86 86 } 87 87 } … … 131 131 public void SetDescription(string description) { 132 132 if (description == null) 133 throw new NullReferenceException("description must not be null"); 134 Description = description; 133 throw new NullReferenceException("description must not be null"); 134 Description = description; 135 135 } 136 136 … … 161 161 #region Construction & Initialization 162 162 163 public ProgrammableOperator() { 164 code = ""; 163 public ProgrammableOperator() { 164 code = ""; 165 165 executeMethod = null; 166 166 ProgrammableOperator.StaticInitialize(); … … 168 168 Plugins = defaultPluginDict; 169 169 namespaces = new HashSet<string>(DiscoverNamespaces()); 170 Parameters.Changed += (s, a) => OnSignatureChanged(s, a); 171 } 172 173 protected void OnSignatureChanged(object sender, EventArgs args) { 174 if (SignatureChanged != null) 175 SignatureChanged(sender, args); 170 176 } 171 177 … … 199 205 } 200 206 201 protected static List<Assembly> defaultAssemblies = new List<Assembly>() { 207 protected static List<Assembly> defaultAssemblies = new List<Assembly>() { 202 208 typeof(System.Linq.Enumerable).Assembly, // add reference to version 3.5 of System.dll 203 209 typeof(System.Collections.Generic.List<>).Assembly, 204 typeof(System.Text.StringBuilder).Assembly, 210 typeof(System.Text.StringBuilder).Assembly, 205 211 typeof(System.Data.Linq.DataContext).Assembly, 206 typeof(HeuristicLab.Core.Item).Assembly, 207 typeof(HeuristicLab.Data.IntData).Assembly, 212 typeof(HeuristicLab.Core.Item).Assembly, 213 typeof(HeuristicLab.Data.IntData).Assembly, 208 214 }; 209 215 … … 215 221 assemblies.Add(a, false); 216 222 } 217 } 218 catch (NotSupportedException) { 223 } catch (NotSupportedException) { 219 224 // NotSupportedException is thrown while accessing 220 225 // the Location property of the anonymously hosted … … 342 347 get { 343 348 var sb = new StringBuilder() 344 .Append("public static IOperation Execute(IOperator op, I Scope scope");349 .Append("public static IOperation Execute(IOperator op, IExecutionContext context"); 345 350 foreach (IParameter param in Parameters) { 346 351 sb.Append(String.Format(", {0} {1}", param.DataType.Name, param.Name)); 347 } 352 } 348 353 return sb.Append(")").ToString(); 349 354 } 350 355 } 356 357 public event EventHandler SignatureChanged; 351 358 352 359 private static Regex lineSplitter = new Regex(@"\r\n|\r|\n"); … … 355 362 CodeMemberMethod method = new CodeMemberMethod(); 356 363 method.Name = "Execute"; 357 method.ReturnType = new CodeTypeReference(typeof( HeuristicLab.Core.IOperation));364 method.ReturnType = new CodeTypeReference(typeof(IOperation)); 358 365 method.Attributes = MemberAttributes.Public | MemberAttributes.Static; 359 method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(IOperator), "op")); 366 method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(IOperator), "op")); 367 method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(IExecutionContext), "context")); 360 368 foreach (var param in Parameters) 361 369 method.Parameters.Add(new CodeParameterDeclarationExpression(param.DataType, param.Name)); … … 381 389 } 382 390 383 var parameters = new List<object>() { this };391 var parameters = new List<object>() { this, ExecutionContext }; 384 392 parameters.AddRange(Parameters.Select(p => (object)p.ActualValue)); 385 393 return (IOperation)executeMethod.Invoke(null, parameters.ToArray()); 386 394 } 387 395 388 396 public event EventHandler CodeChanged; 389 397 protected virtual void OnCodeChanged() { … … 394 402 #endregion 395 403 396 #region Cloning 404 #region Cloning 397 405 398 406 public override IDeepCloneable Clone(Cloner cloner) { … … 407 415 return clone; 408 416 } 409 410 #endregion 411 417 418 #endregion 419 412 420 } 413 421 } -
trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperatorView.Designer.cs
r2799 r2897 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 System.Windows.Forms.SplitContainer splitContainer1; 48 System.Windows.Forms.SplitContainer splitContainer2; 49 System.Windows.Forms.GroupBox groupBox1; 50 System.Windows.Forms.GroupBox groupBox2; 47 System.Windows.Forms.TabPage tabPage2; 48 this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 49 this.splitContainer2 = new System.Windows.Forms.SplitContainer(); 51 50 this.assembliesTreeView = new System.Windows.Forms.TreeView(); 52 this. groupBox3 = new System.Windows.Forms.GroupBox();51 this.namespacesTreeView = new System.Windows.Forms.TreeView(); 53 52 this.showCodeButton = new System.Windows.Forms.Button(); 53 this.compileButton = new System.Windows.Forms.Button(); 54 54 this.codeEditor = new HeuristicLab.CodeEditor.CodeEditor(); 55 this.compileButton = new System.Windows.Forms.Button(); 56 this.tabControl = new System.Windows.Forms.TabControl(); 57 this.codeTabPage = new System.Windows.Forms.TabPage(); 58 this.variableInfosTabPage = new System.Windows.Forms.TabPage(); 59 this.removeVariableInfoButton = new System.Windows.Forms.Button(); 60 this.addVariableInfoButton = new System.Windows.Forms.Button(); 61 //this.operatorBaseVariableInfosView = new HeuristicLab.Core.OperatorBaseVariableInfosView(); 62 this.variablesTabPage = new System.Windows.Forms.TabPage(); 63 //this.operatorBaseVariablesView = new HeuristicLab.Core.OperatorBaseVariablesView(); 64 this.constraintsTabPage = new System.Windows.Forms.TabPage(); 65 //this.constrainedItemBaseView = new HeuristicLab.Core.ConstrainedItemBaseView(); 66 this.descriptionTabPage = new System.Windows.Forms.TabPage(); 67 //this.descriptionTextBox = new System.Windows.Forms.TextBox(); 68 this.namespacesTreeView = new System.Windows.Forms.TreeView(); 69 splitContainer1 = new System.Windows.Forms.SplitContainer(); 70 splitContainer2 = new System.Windows.Forms.SplitContainer(); 71 groupBox1 = new System.Windows.Forms.GroupBox(); 72 groupBox2 = new System.Windows.Forms.GroupBox(); 73 splitContainer1.Panel1.SuspendLayout(); 74 splitContainer1.Panel2.SuspendLayout(); 75 splitContainer1.SuspendLayout(); 76 splitContainer2.Panel1.SuspendLayout(); 77 splitContainer2.Panel2.SuspendLayout(); 78 splitContainer2.SuspendLayout(); 79 groupBox1.SuspendLayout(); 80 groupBox2.SuspendLayout(); 81 this.groupBox3.SuspendLayout(); 82 this.tabControl.SuspendLayout(); 83 this.codeTabPage.SuspendLayout(); 84 this.variableInfosTabPage.SuspendLayout(); 85 this.variablesTabPage.SuspendLayout(); 86 this.constraintsTabPage.SuspendLayout(); 87 this.descriptionTabPage.SuspendLayout(); 55 this.tabControl1 = new System.Windows.Forms.TabControl(); 56 this.tabPage1 = new System.Windows.Forms.TabPage(); 57 this.parameterCollectionView1 = new HeuristicLab.Core.Views.ParameterCollectionView(); 58 tabPage2 = new System.Windows.Forms.TabPage(); 59 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 60 tabPage2.SuspendLayout(); 61 this.splitContainer1.Panel1.SuspendLayout(); 62 this.splitContainer1.Panel2.SuspendLayout(); 63 this.splitContainer1.SuspendLayout(); 64 this.splitContainer2.Panel1.SuspendLayout(); 65 this.splitContainer2.Panel2.SuspendLayout(); 66 this.splitContainer2.SuspendLayout(); 67 this.tabControl1.SuspendLayout(); 68 this.tabPage1.SuspendLayout(); 88 69 this.SuspendLayout(); 89 70 // 71 // nameTextBox 72 // 73 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 74 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 75 this.nameTextBox.Size = new System.Drawing.Size(913, 20); 76 // 77 // descriptionTextBox 78 // 79 this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 80 | System.Windows.Forms.AnchorStyles.Right))); 81 this.descriptionTextBox.Size = new System.Drawing.Size(913, 48); 82 this.descriptionTextBox.TextChanged += new System.EventHandler(this.descriptionTextBox_TextChanged); 83 // 84 // tabPage2 85 // 86 tabPage2.Controls.Add(this.splitContainer1); 87 tabPage2.Location = new System.Drawing.Point(4, 22); 88 tabPage2.Name = "tabPage2"; 89 tabPage2.Padding = new System.Windows.Forms.Padding(3); 90 tabPage2.Size = new System.Drawing.Size(977, 593); 91 tabPage2.TabIndex = 1; 92 tabPage2.Text = "Code"; 93 tabPage2.UseVisualStyleBackColor = true; 94 // 90 95 // splitContainer1 91 96 // 92 splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; 93 splitContainer1.Location = new System.Drawing.Point(3, 3); 94 splitContainer1.Name = "splitContainer1"; 95 splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; 97 this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; 98 this.splitContainer1.Location = new System.Drawing.Point(3, 3); 99 this.splitContainer1.Name = "splitContainer1"; 96 100 // 97 101 // splitContainer1.Panel1 98 102 // 99 splitContainer1.Panel1.Controls.Add(splitContainer2); 103 this.splitContainer1.Panel1.Controls.Add(this.splitContainer2); 104 this.splitContainer1.Panel1.Controls.Add(this.showCodeButton); 105 this.splitContainer1.Panel1.Controls.Add(this.compileButton); 100 106 // 101 107 // splitContainer1.Panel2 102 108 // 103 splitContainer1.Panel2.Controls.Add(this.groupBox3);104 splitContainer1.Size = new System.Drawing.Size(693, 457);105 splitContainer1.SplitterDistance = 85;106 splitContainer1.TabIndex = 6;109 this.splitContainer1.Panel2.Controls.Add(this.codeEditor); 110 this.splitContainer1.Size = new System.Drawing.Size(971, 587); 111 this.splitContainer1.SplitterDistance = 254; 112 this.splitContainer1.TabIndex = 0; 107 113 // 108 114 // splitContainer2 109 115 // 110 splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; 111 splitContainer2.Location = new System.Drawing.Point(0, 0); 112 splitContainer2.Name = "splitContainer2"; 116 this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 117 | System.Windows.Forms.AnchorStyles.Left) 118 | System.Windows.Forms.AnchorStyles.Right))); 119 this.splitContainer2.Location = new System.Drawing.Point(3, 3); 120 this.splitContainer2.Name = "splitContainer2"; 121 this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; 113 122 // 114 123 // splitContainer2.Panel1 115 124 // 116 splitContainer2.Panel1.Controls.Add(groupBox1);125 this.splitContainer2.Panel1.Controls.Add(this.assembliesTreeView); 117 126 // 118 127 // splitContainer2.Panel2 119 128 // 120 splitContainer2.Panel2.Controls.Add(groupBox2); 121 splitContainer2.Size = new System.Drawing.Size(693, 85); 122 splitContainer2.SplitterDistance = 340; 123 splitContainer2.TabIndex = 2; 124 // 125 // groupBox1 126 // 127 groupBox1.Controls.Add(this.assembliesTreeView); 128 groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; 129 groupBox1.Location = new System.Drawing.Point(0, 0); 130 groupBox1.Name = "groupBox1"; 131 groupBox1.Size = new System.Drawing.Size(340, 85); 132 groupBox1.TabIndex = 0; 133 groupBox1.TabStop = false; 134 groupBox1.Text = "Assemblies"; 129 this.splitContainer2.Panel2.Controls.Add(this.namespacesTreeView); 130 this.splitContainer2.Size = new System.Drawing.Size(248, 552); 131 this.splitContainer2.SplitterDistance = 276; 132 this.splitContainer2.TabIndex = 2; 135 133 // 136 134 // assembliesTreeView … … 138 136 this.assembliesTreeView.CheckBoxes = true; 139 137 this.assembliesTreeView.Dock = System.Windows.Forms.DockStyle.Fill; 140 this.assembliesTreeView.Location = new System.Drawing.Point( 3, 16);138 this.assembliesTreeView.Location = new System.Drawing.Point(0, 0); 141 139 this.assembliesTreeView.Name = "assembliesTreeView"; 142 this.assembliesTreeView.Size = new System.Drawing.Size( 334, 66);143 this.assembliesTreeView.TabIndex = 1;140 this.assembliesTreeView.Size = new System.Drawing.Size(248, 276); 141 this.assembliesTreeView.TabIndex = 0; 144 142 this.assembliesTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.assembliesTreeView_AfterCheck); 145 //146 // groupBox2147 //148 groupBox2.Controls.Add(this.namespacesTreeView);149 groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;150 groupBox2.Location = new System.Drawing.Point(0, 0);151 groupBox2.Name = "groupBox2";152 groupBox2.Size = new System.Drawing.Size(349, 85);153 groupBox2.TabIndex = 0;154 groupBox2.TabStop = false;155 groupBox2.Text = "Namespaces";156 143 // 157 144 // namespacesTreeView … … 159 146 this.namespacesTreeView.CheckBoxes = true; 160 147 this.namespacesTreeView.Dock = System.Windows.Forms.DockStyle.Fill; 161 this.namespacesTreeView.Location = new System.Drawing.Point( 3, 16);148 this.namespacesTreeView.Location = new System.Drawing.Point(0, 0); 162 149 this.namespacesTreeView.Name = "namespacesTreeView"; 163 150 this.namespacesTreeView.PathSeparator = "."; 164 this.namespacesTreeView.Size = new System.Drawing.Size( 343, 66);165 this.namespacesTreeView.TabIndex = 2;151 this.namespacesTreeView.Size = new System.Drawing.Size(248, 272); 152 this.namespacesTreeView.TabIndex = 0; 166 153 this.namespacesTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.namespacesTreeView_AfterCheck); 167 154 // 168 // groupBox3169 //170 this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)171 | System.Windows.Forms.AnchorStyles.Left)172 | System.Windows.Forms.AnchorStyles.Right)));173 this.groupBox3.Controls.Add(this.showCodeButton);174 this.groupBox3.Controls.Add(this.codeEditor);175 this.groupBox3.Controls.Add(this.compileButton);176 this.groupBox3.Location = new System.Drawing.Point(3, 2);177 this.groupBox3.Name = "groupBox3";178 this.groupBox3.Size = new System.Drawing.Size(687, 363);179 this.groupBox3.TabIndex = 7;180 this.groupBox3.TabStop = false;181 this.groupBox3.Text = "Code";182 //183 155 // showCodeButton 184 156 // 185 this.showCodeButton.Anchor = ((System.Windows.Forms.AnchorStyles)(( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));186 this.showCodeButton.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));187 this.showCodeButton. FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.ControlDark;188 this.showCodeButton. FlatAppearance.MouseOverBackColor = System.Drawing.SystemColors.GradientActiveCaption;157 this.showCodeButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 158 | System.Windows.Forms.AnchorStyles.Right))); 159 this.showCodeButton.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; 160 this.showCodeButton.Cursor = System.Windows.Forms.Cursors.Hand; 189 161 this.showCodeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 190 this.showCodeButton.Location = new System.Drawing.Point( 467, 333);162 this.showCodeButton.Location = new System.Drawing.Point(65, 561); 191 163 this.showCodeButton.Name = "showCodeButton"; 192 this.showCodeButton.Size = new System.Drawing.Size(1 33, 23);193 this.showCodeButton.TabIndex = 4;194 this.showCodeButton.Text = " Show Generated Code";195 this.showCodeButton.UseVisualStyleBackColor = true;164 this.showCodeButton.Size = new System.Drawing.Size(186, 23); 165 this.showCodeButton.TabIndex = 0; 166 this.showCodeButton.Text = "&Show Generated Code"; 167 this.showCodeButton.UseVisualStyleBackColor = false; 196 168 this.showCodeButton.Click += new System.EventHandler(this.showCodeButton_Click); 197 169 // 198 170 // compileButton 199 171 // 200 this.compileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles. Right)));201 this.compileButton.Location = new System.Drawing.Point( 606, 334);172 this.compileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 173 this.compileButton.Location = new System.Drawing.Point(3, 561); 202 174 this.compileButton.Name = "compileButton"; 203 this.compileButton.Size = new System.Drawing.Size( 75, 23);204 this.compileButton.TabIndex = 3;175 this.compileButton.Size = new System.Drawing.Size(56, 23); 176 this.compileButton.TabIndex = 1; 205 177 this.compileButton.Text = "&Compile"; 206 178 this.compileButton.UseVisualStyleBackColor = true; 207 179 this.compileButton.Click += new System.EventHandler(this.compileButton_Click); 208 180 // 209 // tabControl 210 // 211 this.tabControl.Controls.Add(this.codeTabPage); 212 this.tabControl.Controls.Add(this.variableInfosTabPage); 213 this.tabControl.Controls.Add(this.variablesTabPage); 214 this.tabControl.Controls.Add(this.constraintsTabPage); 215 this.tabControl.Controls.Add(this.descriptionTabPage); 216 this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill; 217 this.tabControl.Location = new System.Drawing.Point(0, 0); 218 this.tabControl.Name = "tabControl"; 219 this.tabControl.SelectedIndex = 0; 220 this.tabControl.Size = new System.Drawing.Size(707, 489); 221 this.tabControl.TabIndex = 0; 222 // 223 // codeTabPage 224 // 225 this.codeTabPage.Controls.Add(splitContainer1); 226 this.codeTabPage.Location = new System.Drawing.Point(4, 22); 227 this.codeTabPage.Name = "codeTabPage"; 228 this.codeTabPage.Padding = new System.Windows.Forms.Padding(3); 229 this.codeTabPage.Size = new System.Drawing.Size(699, 463); 230 this.codeTabPage.TabIndex = 5; 231 this.codeTabPage.Text = "Code"; 232 this.codeTabPage.UseVisualStyleBackColor = true; 233 // 234 // variableInfosTabPage 235 // 236 this.variableInfosTabPage.Controls.Add(this.removeVariableInfoButton); 237 this.variableInfosTabPage.Controls.Add(this.addVariableInfoButton); 238 //this.variableInfosTabPage.Controls.Add(this.operatorBaseVariableInfosView); 239 this.variableInfosTabPage.Location = new System.Drawing.Point(4, 22); 240 this.variableInfosTabPage.Name = "variableInfosTabPage"; 241 this.variableInfosTabPage.Padding = new System.Windows.Forms.Padding(3); 242 this.variableInfosTabPage.Size = new System.Drawing.Size(699, 463); 243 this.variableInfosTabPage.TabIndex = 1; 244 this.variableInfosTabPage.Text = "Variable Infos"; 245 this.variableInfosTabPage.UseVisualStyleBackColor = true; 246 // 247 // removeVariableInfoButton 248 // 249 this.removeVariableInfoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 250 this.removeVariableInfoButton.Enabled = false; 251 this.removeVariableInfoButton.Location = new System.Drawing.Point(87, 434); 252 this.removeVariableInfoButton.Name = "removeVariableInfoButton"; 253 this.removeVariableInfoButton.Size = new System.Drawing.Size(75, 23); 254 this.removeVariableInfoButton.TabIndex = 2; 255 this.removeVariableInfoButton.Text = "&Remove"; 256 this.removeVariableInfoButton.UseVisualStyleBackColor = true; 257 //this.removeVariableInfoButton.Click += new System.EventHandler(this.removeVariableInfoButton_Click); 258 // 259 // addVariableInfoButton 260 // 261 this.addVariableInfoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 262 this.addVariableInfoButton.Location = new System.Drawing.Point(6, 434); 263 this.addVariableInfoButton.Name = "addVariableInfoButton"; 264 this.addVariableInfoButton.Size = new System.Drawing.Size(75, 23); 265 this.addVariableInfoButton.TabIndex = 1; 266 this.addVariableInfoButton.Text = "&Add..."; 267 this.addVariableInfoButton.UseVisualStyleBackColor = true; 268 ///this.addVariableInfoButton.Click += new System.EventHandler(this.addVariableInfoButton_Click); 269 // 270 // operatorBaseVariableInfosView 271 // 272 /*this.operatorBaseVariableInfosView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 181 // codeEditor 182 // 183 this.codeEditor.Dock = System.Windows.Forms.DockStyle.Fill; 184 this.codeEditor.Location = new System.Drawing.Point(0, 0); 185 this.codeEditor.Name = "codeEditor"; 186 this.codeEditor.Prefix = ""; 187 this.codeEditor.Size = new System.Drawing.Size(713, 587); 188 this.codeEditor.Suffix = ""; 189 this.codeEditor.TabIndex = 0; 190 this.codeEditor.UserCode = ""; 191 this.codeEditor.Validated += new System.EventHandler(this.codeEditor_Validated); 192 // 193 // tabControl1 194 // 195 this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 273 196 | System.Windows.Forms.AnchorStyles.Left) 274 197 | System.Windows.Forms.AnchorStyles.Right))); 275 this.operatorBaseVariableInfosView.Caption = "Operator"; 276 this.operatorBaseVariableInfosView.Location = new System.Drawing.Point(3, 3); 277 this.operatorBaseVariableInfosView.Name = "operatorBaseVariableInfosView"; 278 this.operatorBaseVariableInfosView.Operator = null; 279 this.operatorBaseVariableInfosView.Size = new System.Drawing.Size(690, 425); 280 this.operatorBaseVariableInfosView.TabIndex = 0; 281 this.operatorBaseVariableInfosView.SelectedVariableInfosChanged += new System.EventHandler(this.operatorBaseVariableInfosView_SelectedVariableInfosChanged); 282 */ 283 // 284 // variablesTabPage 285 // 286 //this.variablesTabPage.Controls.Add(this.operatorBaseVariablesView); 287 this.variablesTabPage.Location = new System.Drawing.Point(4, 22); 288 this.variablesTabPage.Name = "variablesTabPage"; 289 this.variablesTabPage.Padding = new System.Windows.Forms.Padding(3); 290 this.variablesTabPage.Size = new System.Drawing.Size(699, 463); 291 this.variablesTabPage.TabIndex = 2; 292 this.variablesTabPage.Text = "Local Variables"; 293 this.variablesTabPage.UseVisualStyleBackColor = true; 294 // 295 // operatorBaseVariablesView 296 // 297 /*this.operatorBaseVariablesView.Caption = "Operator"; 298 this.operatorBaseVariablesView.Dock = System.Windows.Forms.DockStyle.Fill; 299 this.operatorBaseVariablesView.Location = new System.Drawing.Point(3, 3); 300 this.operatorBaseVariablesView.Name = "operatorBaseVariablesView"; 301 this.operatorBaseVariablesView.Operator = null; 302 this.operatorBaseVariablesView.Size = new System.Drawing.Size(693, 457); 303 this.operatorBaseVariablesView.TabIndex = 0; */ 304 // 305 // constraintsTabPage 306 // 307 //this.constraintsTabPage.Controls.Add(this.constrainedItemBaseView); 308 this.constraintsTabPage.Location = new System.Drawing.Point(4, 22); 309 this.constraintsTabPage.Name = "constraintsTabPage"; 310 this.constraintsTabPage.Padding = new System.Windows.Forms.Padding(3); 311 this.constraintsTabPage.Size = new System.Drawing.Size(699, 463); 312 this.constraintsTabPage.TabIndex = 3; 313 this.constraintsTabPage.Text = "Constraints"; 314 this.constraintsTabPage.UseVisualStyleBackColor = true; 315 // 316 // constrainedItemBaseView 317 // 318 /*this.constrainedItemBaseView.Caption = "Constrained Item"; 319 this.constrainedItemBaseView.ConstrainedItem = null; 320 this.constrainedItemBaseView.Dock = System.Windows.Forms.DockStyle.Fill; 321 this.constrainedItemBaseView.Location = new System.Drawing.Point(3, 3); 322 this.constrainedItemBaseView.Name = "constrainedItemBaseView"; 323 this.constrainedItemBaseView.Size = new System.Drawing.Size(693, 457); 324 this.constrainedItemBaseView.TabIndex = 0; */ 325 // 326 // descriptionTabPage 327 // 328 this.descriptionTabPage.Controls.Add(this.descriptionTextBox); 329 this.descriptionTabPage.Location = new System.Drawing.Point(4, 22); 330 this.descriptionTabPage.Name = "descriptionTabPage"; 331 this.descriptionTabPage.Padding = new System.Windows.Forms.Padding(3); 332 this.descriptionTabPage.Size = new System.Drawing.Size(699, 463); 333 this.descriptionTabPage.TabIndex = 4; 334 this.descriptionTabPage.Text = "Description"; 335 this.descriptionTabPage.UseVisualStyleBackColor = true; 336 // 337 // descriptionTextBox 338 // 339 /*this.descriptionTextBox.Dock = System.Windows.Forms.DockStyle.Fill; 340 this.descriptionTextBox.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 341 this.descriptionTextBox.Location = new System.Drawing.Point(3, 3); 342 this.descriptionTextBox.Multiline = true; 343 this.descriptionTextBox.Name = "descriptionTextBox"; 344 this.descriptionTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 345 this.descriptionTextBox.Size = new System.Drawing.Size(693, 457); 346 this.descriptionTextBox.TabIndex = 0; 347 this.descriptionTextBox.Validated += new System.EventHandler(this.descriptionTextBox_Validated); */ 348 // 349 // codeEditor 350 // 351 this.codeEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 352 | System.Windows.Forms.AnchorStyles.Left) 353 | System.Windows.Forms.AnchorStyles.Right))); 354 this.codeEditor.Location = new System.Drawing.Point(6, 19); 355 this.codeEditor.Name = "codeEditor"; 356 this.codeEditor.Prefix = "using System;\r\nusing HeuristicLab.Common.Resources;\r\n\r\npublic class Operator {\r\n " + 357 " public static void Apply(int arg) {"; 358 this.codeEditor.Size = new System.Drawing.Size(675, 309); 359 this.codeEditor.Suffix = "\n return null;\n }\n}"; 360 this.codeEditor.TabIndex = 0; 361 this.codeEditor.UserCode = "\n\n\n"; 362 this.codeEditor.TextEditorValidated += new System.EventHandler(this.codeEditor_Validated); 198 this.tabControl1.Controls.Add(this.tabPage1); 199 this.tabControl1.Controls.Add(tabPage2); 200 this.tabControl1.Location = new System.Drawing.Point(0, 78); 201 this.tabControl1.Name = "tabControl1"; 202 this.tabControl1.SelectedIndex = 0; 203 this.tabControl1.Size = new System.Drawing.Size(985, 619); 204 this.tabControl1.TabIndex = 7; 205 // 206 // tabPage1 207 // 208 this.tabPage1.Controls.Add(this.parameterCollectionView1); 209 this.tabPage1.Location = new System.Drawing.Point(4, 22); 210 this.tabPage1.Name = "tabPage1"; 211 this.tabPage1.Padding = new System.Windows.Forms.Padding(3); 212 this.tabPage1.Size = new System.Drawing.Size(898, 439); 213 this.tabPage1.TabIndex = 0; 214 this.tabPage1.Text = "Parameters"; 215 this.tabPage1.UseVisualStyleBackColor = true; 216 // 217 // parameterCollectionView1 218 // 219 this.parameterCollectionView1.Caption = "ParameterCollection"; 220 this.parameterCollectionView1.Content = null; 221 this.parameterCollectionView1.Dock = System.Windows.Forms.DockStyle.Fill; 222 this.parameterCollectionView1.Location = new System.Drawing.Point(3, 3); 223 this.parameterCollectionView1.Name = "parameterCollectionView1"; 224 this.parameterCollectionView1.Size = new System.Drawing.Size(892, 433); 225 this.parameterCollectionView1.TabIndex = 0; 363 226 // 364 227 // ProgrammableOperatorView … … 366 229 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 367 230 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 368 this.Controls.Add(this.tabControl );231 this.Controls.Add(this.tabControl1); 369 232 this.Name = "ProgrammableOperatorView"; 370 this.Size = new System.Drawing.Size(707, 489); 371 splitContainer1.Panel1.ResumeLayout(false); 372 splitContainer1.Panel2.ResumeLayout(false); 373 splitContainer1.ResumeLayout(false); 374 splitContainer2.Panel1.ResumeLayout(false); 375 splitContainer2.Panel2.ResumeLayout(false); 376 splitContainer2.ResumeLayout(false); 377 groupBox1.ResumeLayout(false); 378 groupBox2.ResumeLayout(false); 379 this.groupBox3.ResumeLayout(false); 380 this.tabControl.ResumeLayout(false); 381 this.codeTabPage.ResumeLayout(false); 382 this.variableInfosTabPage.ResumeLayout(false); 383 this.variablesTabPage.ResumeLayout(false); 384 this.constraintsTabPage.ResumeLayout(false); 385 this.descriptionTabPage.ResumeLayout(false); 386 this.descriptionTabPage.PerformLayout(); 233 this.Size = new System.Drawing.Size(985, 697); 234 this.Controls.SetChildIndex(this.tabControl1, 0); 235 this.Controls.SetChildIndex(this.nameTextBox, 0); 236 this.Controls.SetChildIndex(this.nameLabel, 0); 237 this.Controls.SetChildIndex(this.descriptionLabel, 0); 238 this.Controls.SetChildIndex(this.descriptionTextBox, 0); 239 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 240 tabPage2.ResumeLayout(false); 241 this.splitContainer1.Panel1.ResumeLayout(false); 242 this.splitContainer1.Panel2.ResumeLayout(false); 243 this.splitContainer1.ResumeLayout(false); 244 this.splitContainer2.Panel1.ResumeLayout(false); 245 this.splitContainer2.Panel2.ResumeLayout(false); 246 this.splitContainer2.ResumeLayout(false); 247 this.tabControl1.ResumeLayout(false); 248 this.tabPage1.ResumeLayout(false); 387 249 this.ResumeLayout(false); 250 this.PerformLayout(); 388 251 389 252 } … … 391 254 #endregion 392 255 393 private System.Windows.Forms.TabControl tabControl; 394 private System.Windows.Forms.TabPage codeTabPage; 395 private System.Windows.Forms.TabPage variableInfosTabPage; 396 //private HeuristicLab.Core.OperatorBaseVariableInfosView operatorBaseVariableInfosView; 397 private System.Windows.Forms.TabPage variablesTabPage; 398 //private HeuristicLab.Core.OperatorBaseVariablesView operatorBaseVariablesView; 399 private System.Windows.Forms.TabPage constraintsTabPage; 400 //private HeuristicLab.Core.ConstrainedItemBaseView constrainedItemBaseView; 401 private System.Windows.Forms.TabPage descriptionTabPage; 402 private System.Windows.Forms.TextBox descriptionTextBox; 403 private System.Windows.Forms.Button removeVariableInfoButton; 404 private System.Windows.Forms.Button addVariableInfoButton; 405 private System.Windows.Forms.TreeView assembliesTreeView; 406 private System.Windows.Forms.TreeView namespacesTreeView; 407 private System.Windows.Forms.GroupBox groupBox3; 256 private System.Windows.Forms.TabControl tabControl1; 257 private System.Windows.Forms.TabPage tabPage1; 258 private HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView1; 259 private System.Windows.Forms.SplitContainer splitContainer1; 408 260 private HeuristicLab.CodeEditor.CodeEditor codeEditor; 409 261 private System.Windows.Forms.Button compileButton; 410 262 private System.Windows.Forms.Button showCodeButton; 411 412 263 private System.Windows.Forms.SplitContainer splitContainer2; 264 private System.Windows.Forms.TreeView assembliesTreeView; 265 private System.Windows.Forms.TreeView namespacesTreeView; 413 266 } 414 267 } -
trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperatorView.cs
r2799 r2897 34 34 using HeuristicLab.CodeEditor; 35 35 using HeuristicLab.Core.Views; 36 using HeuristicLab.Operators.Views; 37 using HeuristicLab.MainForm; 36 38 37 39 namespace HeuristicLab.Operators.Programmable { 38 40 41 [Content(typeof(ProgrammableOperator), true)] 39 42 public partial class ProgrammableOperatorView : NamedItemView { 40 43 41 44 public ProgrammableOperator ProgrammableOperator { 42 45 get { return (ProgrammableOperator)base.Content; } 43 set { base.Content = ( NamedItem)value; }46 set { base.Content = (ProgrammableOperator)value; } 44 47 } 45 48 … … 53 56 } 54 57 55 protected override void DeregisterContentEvents() {56 //operatorBaseVariableInfosView.Operator = null;57 //operatorBaseVariablesView.Operator = null;58 //constrainedItemBaseView.ConstrainedItem = null;59 ProgrammableOperator.CodeChanged -= new EventHandler(ProgrammableOperator_CodeChanged);60 ProgrammableOperator.DescriptionChanged -= new EventHandler(ProgrammableOperator_DescriptionChanged);61 base.DeregisterContentEvents();62 }63 64 65 58 protected override void RegisterContentEvents() { 66 59 base.RegisterContentEvents(); 67 //operatorBaseVariableInfosView.Operator = ProgrammableOperator; 68 //operatorBaseVariablesView.Operator = ProgrammableOperator; 69 //constrainedItemBaseView.ConstrainedItem = ProgrammableOperator; 70 ProgrammableOperator.CodeChanged += new EventHandler(ProgrammableOperator_CodeChanged); 71 ProgrammableOperator.DescriptionChanged += new EventHandler(ProgrammableOperator_DescriptionChanged); 72 } 73 60 ProgrammableOperator.CodeChanged += ProgrammableOperator_CodeChanged; 61 ProgrammableOperator.DescriptionChanged += ProgrammableOperator_DescriptionChanged; 62 ProgrammableOperator.SignatureChanged += ProgrammableOperator_SignatureChanged; 63 } 64 65 protected override void DeregisterContentEvents() { 66 ProgrammableOperator.CodeChanged -= ProgrammableOperator_CodeChanged; 67 ProgrammableOperator.DescriptionChanged -= ProgrammableOperator_DescriptionChanged; 68 ProgrammableOperator.SignatureChanged -= ProgrammableOperator_SignatureChanged; 69 base.DeregisterContentEvents(); 70 } 74 71 75 72 protected override void OnContentChanged() { 76 base.OnContentChanged(); 73 base.OnContentChanged(); 77 74 if (ProgrammableOperator == null) { 78 75 codeEditor.Text = ""; 79 76 codeEditor.Enabled = false; 80 addVariableInfoButton.Enabled = false;81 removeVariableInfoButton.Enabled = false;82 77 descriptionTextBox.Text = ""; 83 78 descriptionTextBox.Enabled = false; 84 codeEditor.Prefix = @"using System85 86 public class Operator {87 public static IOperation Execute(IOperator op, IScope scope, parameters ...) {88 ";89 codeEditor.Suffix = @"90 return null;91 }92 }";93 79 assembliesTreeView.Nodes.Clear(); 94 80 } else { 95 81 codeEditor.Enabled = true; 96 addVariableInfoButton.Enabled = true;97 //removeVariableInfoButton.Enabled = operatorBaseVariableInfosView.SelectedVariableInfos.Count > 0;98 82 descriptionTextBox.Text = ProgrammableOperator.Description; 99 83 descriptionTextBox.Enabled = true; … … 112 96 } 113 97 codeEditor.ScrollAfterPrefix(); 98 codeEditor.ShowCompileErrors(ProgrammableOperator.CompileErrors, "ProgrammableOperator"); 114 99 } 115 100 } … … 130 115 ProgrammableOperator.Code = codeEditor.UserCode; 131 116 } 132 133 /*134 private void operatorBaseVariableInfosView_SelectedVariableInfosChanged(object sender, EventArgs e) {135 removeVariableInfoButton.Enabled = operatorBaseVariableInfosView.SelectedVariableInfos.Count > 0;136 }137 138 private void descriptionTextBox_Validated(object sender, EventArgs e) {139 ProgrammableOperator.SetDescription(descriptionTextBox.Text);140 }141 142 private void addVariableInfoButton_Click(object sender, EventArgs e) {143 AddVariableInfoDialog dialog = new AddVariableInfoDialog();144 if (dialog.ShowDialog(this) == DialogResult.OK) {145 if (ProgrammableOperator.GetVariableInfo(dialog.VariableInfo.FormalName) != null) {146 Auxiliary.ShowErrorMessageBox("A variable info with the same formal name already exists.");147 } else {148 ProgrammableOperator.AddVariableInfo(dialog.VariableInfo);149 Recompile();150 }151 }152 dialog.Dispose();153 }154 155 private void removeVariableInfoButton_Click(object sender, EventArgs e) {156 IVariableInfo[] selected = new IVariableInfo[operatorBaseVariableInfosView.SelectedVariableInfos.Count];157 operatorBaseVariableInfosView.SelectedVariableInfos.CopyTo(selected, 0);158 for (int i = 0; i < selected.Length; i++)159 ProgrammableOperator.RemoveVariableInfo(selected[i].FormalName);160 Recompile();161 } */162 117 163 118 private void Recompile() { … … 170 125 } 171 126 OnContentChanged(); 172 codeEditor.ShowCompileErrors(ProgrammableOperator.CompileErrors, "ProgrammableOperator");173 127 this.Enabled = true; 174 128 } … … 184 138 private void ProgrammableOperator_DescriptionChanged(object sender, EventArgs e) { 185 139 descriptionTextBox.Text = ProgrammableOperator.Description; 140 } 141 private void ProgrammableOperator_SignatureChanged(object sender, EventArgs args) { 142 codeEditor.Prefix = GetGeneratedPrefix(); 186 143 } 187 144 #endregion … … 317 274 } 318 275 276 private void descriptionTextBox_TextChanged(object sender, EventArgs e) { 277 ProgrammableOperator.SetDescription(descriptionTextBox.Text); 278 } 279 319 280 320 281 } -
trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperatorView.resx
r2799 r2897 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name=" splitContainer1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">121 <value> False</value>120 <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 122 </metadata> 123 <metadata name="splitContainer2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 124 <value>False</value> 125 </metadata> 126 <metadata name="groupBox1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 127 <value>False</value> 128 </metadata> 129 <metadata name="groupBox2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 123 <metadata name="tabPage2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 130 124 <value>False</value> 131 125 </metadata>
Note: See TracChangeset
for help on using the changeset viewer.