source: branches/2839_HiveProjectManagement/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs @ 16057

Last change on this file since 16057 was 16057, checked in by jkarder, 16 months ago

#2839:

File size: 4.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.CodeDom.Compiler;
24using System.Collections.Generic;
25using System.Reflection;
26using System.Threading.Tasks;
27using System.Windows.Forms;
28using HeuristicLab.Common;
29using ICSharpCode.NRefactory.TypeSystem;
30
31namespace HeuristicLab.CodeEditor {
32  public class CodeEditorBase : UserControl {
33    public virtual string UserCode { get; set; }
34
35    public virtual string Prefix { get; set; }
36
37    public virtual string Suffix { get; set; }
38
39    public virtual bool ReadOnly { get; set; }
40
41    public virtual bool Locked { get; set; }
42
43    public virtual void AddAssemblies(IEnumerable<Assembly> assemblies) { }
44
45    public virtual Task AddAssembliesAsync(IEnumerable<Assembly> assemblies) {
46      return null;
47    }
48
49    public virtual void AddAssembly(Assembly assembly) { }
50
51    public virtual void RemoveAssembly(Assembly assembly) { }
52
53    public virtual void RemoveAssemblies(IEnumerable<Assembly> assemblies) { }
54
55    public virtual void ScrollAfterPrefix() { }
56
57    public virtual void ScrollToPosition(int line, int column) { }
58
59    public virtual void ShowCompileErrors(CompilerErrorCollection compileErrors) { }
60
61    #region Events
62    public event EventHandler TextEditorTextChanged;
63    protected virtual void OnTextEditorTextChanged() {
64      var handler = TextEditorTextChanged;
65      if (handler != null) handler(this, EventArgs.Empty);
66    }
67
68    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoading;
69    protected virtual void OnAssembliesLoading(IEnumerable<Assembly> args) {
70      var handler = AssembliesLoading;
71      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
72    }
73
74    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoaded;
75    protected virtual void OnAssembliesLoaded(IEnumerable<Assembly> args) {
76      var handler = AssembliesLoaded;
77      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
78    }
79
80    public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesLoaded;
81    protected virtual void OnInternalAssembliesLoaded(IEnumerable<IUnresolvedAssembly> args) {
82      var handler = InternalAssembliesLoaded;
83      if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));
84    }
85
86    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloading;
87    protected virtual void OnAssembliesUnloading(IEnumerable<Assembly> args) {
88      var handler = AssembliesUnloading;
89      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
90    }
91
92    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloaded;
93    protected virtual void OnAssembliesUnloaded(IEnumerable<Assembly> args) {
94      var handler = AssembliesUnloaded;
95      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
96    }
97
98    public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesUnloaded;
99    protected virtual void OnInternalAssembliesUnloaded(IEnumerable<IUnresolvedAssembly> args) {
100      var handler = InternalAssembliesUnloaded;
101      if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));
102    }
103    #endregion
104  }
105}
Note: See TracBrowser for help on using the repository browser.