1 | //------------------------------------------------------------------------------
|
---|
2 | // <auto-generated>
|
---|
3 | // This code was generated by a tool.
|
---|
4 | //
|
---|
5 | // Changes to this file may cause incorrect behavior and will be lost if
|
---|
6 | // the code is regenerated.
|
---|
7 | // </auto-generated>
|
---|
8 | //------------------------------------------------------------------------------
|
---|
9 |
|
---|
10 | using DslShell = global::Microsoft.VisualStudio.Modeling.Shell;
|
---|
11 | using VSShell = global::Microsoft.VisualStudio.Shell;
|
---|
12 | using DslModeling = global::Microsoft.VisualStudio.Modeling;
|
---|
13 | using DslDiagrams = global::Microsoft.VisualStudio.Modeling.Diagrams;
|
---|
14 | using DslValidation = global::Microsoft.VisualStudio.Modeling.Validation;
|
---|
15 |
|
---|
16 | namespace HeuristicLab.SimulationCore
|
---|
17 | {
|
---|
18 | /// <summary>
|
---|
19 | /// Double-derived class to allow easier code customization.
|
---|
20 | /// </summary>
|
---|
21 | internal partial class HLSimCommandSet : HLSimCommandSetBase
|
---|
22 | {
|
---|
23 | /// <summary>
|
---|
24 | /// Constructs a new HLSimCommandSet.
|
---|
25 | /// </summary>
|
---|
26 | public HLSimCommandSet(global::System.IServiceProvider serviceProvider)
|
---|
27 | : base(serviceProvider)
|
---|
28 | {
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
32 | /// <summary>
|
---|
33 | /// Class containing handlers for commands supported by this DSL.
|
---|
34 | /// </summary>
|
---|
35 | internal abstract class HLSimCommandSetBase : DslShell::CommandSet
|
---|
36 | {
|
---|
37 | /// <summary>
|
---|
38 | /// Constructs a new HLSimCommandSetBase.
|
---|
39 | /// </summary>
|
---|
40 | protected HLSimCommandSetBase(global::System.IServiceProvider serviceProvider) : base(serviceProvider)
|
---|
41 | {
|
---|
42 | }
|
---|
43 |
|
---|
44 | /// <summary>
|
---|
45 | /// Provide the menu commands that this command set handles
|
---|
46 | /// </summary>
|
---|
47 | protected override global::System.Collections.Generic.IList<global::System.ComponentModel.Design.MenuCommand> GetMenuCommands()
|
---|
48 | {
|
---|
49 | // Get the standard commands
|
---|
50 | global::System.Collections.Generic.IList<global::System.ComponentModel.Design.MenuCommand> commands = base.GetMenuCommands();
|
---|
51 |
|
---|
52 | global::System.ComponentModel.Design.MenuCommand menuCommand;
|
---|
53 |
|
---|
54 | // Add command handler for the "view explorer" command in the top-level menu.
|
---|
55 | // We use a ContextBoundMenuCommand because the visibility of this command is
|
---|
56 | // based on whether or not the command context of our DSL editor is active.
|
---|
57 | menuCommand = new DslShell::CommandContextBoundMenuCommand(this.ServiceProvider,
|
---|
58 | new global::System.EventHandler(OnMenuViewModelExplorer),
|
---|
59 | Constants.ViewHLSimExplorerCommand,
|
---|
60 | typeof(HLSimEditorFactory).GUID);
|
---|
61 |
|
---|
62 | commands.Add(menuCommand);
|
---|
63 |
|
---|
64 | return commands;
|
---|
65 | }
|
---|
66 | /// <summary>
|
---|
67 | /// Command handler that shows the explorer tool window.
|
---|
68 | /// </summary>
|
---|
69 | internal virtual void OnMenuViewModelExplorer(object sender, global::System.EventArgs e)
|
---|
70 | {
|
---|
71 | HLSimExplorerToolWindow explorer = this.HLSimExplorerToolWindow;
|
---|
72 | if (explorer != null)
|
---|
73 | {
|
---|
74 | explorer.Show();
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|
78 |
|
---|
79 | /// <summary>
|
---|
80 | /// Returns the currently focused document.
|
---|
81 | /// </summary>
|
---|
82 | [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
---|
83 | protected HLSimDocData CurrentHLSimDocData
|
---|
84 | {
|
---|
85 | get
|
---|
86 | {
|
---|
87 | return this.MonitorSelection.CurrentDocument as HLSimDocData;
|
---|
88 | }
|
---|
89 | }
|
---|
90 |
|
---|
91 | /// <summary>
|
---|
92 | /// Returns the currently focused document view.
|
---|
93 | /// </summary>
|
---|
94 | [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
---|
95 | protected HLSimDocView CurrentHLSimDocView
|
---|
96 | {
|
---|
97 | get
|
---|
98 | {
|
---|
99 | return this.MonitorSelection.CurrentDocumentView as HLSimDocView;
|
---|
100 | }
|
---|
101 | }
|
---|
102 |
|
---|
103 | /// <summary>
|
---|
104 | /// Returns the explorer tool window.
|
---|
105 | /// </summary>
|
---|
106 | protected HLSimExplorerToolWindow HLSimExplorerToolWindow
|
---|
107 | {
|
---|
108 | get
|
---|
109 | {
|
---|
110 | HLSimExplorerToolWindow explorerWindow = null;
|
---|
111 | DslShell::ModelingPackage package = this.ServiceProvider.GetService(typeof(VSShell::Package)) as DslShell::ModelingPackage;
|
---|
112 |
|
---|
113 | if (package != null)
|
---|
114 | {
|
---|
115 | explorerWindow = package.GetToolWindow(typeof(HLSimExplorerToolWindow), true) as HLSimExplorerToolWindow;
|
---|
116 | }
|
---|
117 |
|
---|
118 | return explorerWindow;
|
---|
119 | }
|
---|
120 | }
|
---|
121 |
|
---|
122 | /// <summary>
|
---|
123 | /// Returns the currently selected object in the model explorer.
|
---|
124 | /// </summary>
|
---|
125 | [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
---|
126 | protected object ExplorerSelection
|
---|
127 | {
|
---|
128 | get
|
---|
129 | {
|
---|
130 | object selection = null;
|
---|
131 | HLSimExplorerToolWindow explorerWindow = this.HLSimExplorerToolWindow;
|
---|
132 |
|
---|
133 | if(explorerWindow != null)
|
---|
134 | {
|
---|
135 | foreach (object o in explorerWindow.GetSelectedComponents())
|
---|
136 | {
|
---|
137 | selection = o;
|
---|
138 | break;
|
---|
139 | }
|
---|
140 | }
|
---|
141 |
|
---|
142 | return selection;
|
---|
143 | }
|
---|
144 | }
|
---|
145 | }
|
---|
146 | /// <summary>
|
---|
147 | /// Double-derived class to allow easier code customization.
|
---|
148 | /// </summary>
|
---|
149 | internal partial class HLSimClipboardCommandSet : HLSimClipboardCommandSetBase
|
---|
150 | {
|
---|
151 | /// <summary>
|
---|
152 | /// Constructs a new HLSimClipboardCommandSet.
|
---|
153 | /// </summary>
|
---|
154 | public HLSimClipboardCommandSet(global::System.IServiceProvider serviceProvider)
|
---|
155 | : base(serviceProvider)
|
---|
156 | {
|
---|
157 | }
|
---|
158 | }
|
---|
159 |
|
---|
160 | /// <summary>
|
---|
161 | /// Class containing handlers for cut/copy/paste commands supported by this DSL.
|
---|
162 | /// </summary>
|
---|
163 | internal abstract partial class HLSimClipboardCommandSetBase : DslShell::ClipboardCommandSet
|
---|
164 | {
|
---|
165 | /// <summary>
|
---|
166 | /// Constructs a new HLSimClipboardCommandSetBase.
|
---|
167 | /// </summary>
|
---|
168 | protected HLSimClipboardCommandSetBase(global::System.IServiceProvider serviceProvider)
|
---|
169 | : base(serviceProvider)
|
---|
170 | {
|
---|
171 | }
|
---|
172 |
|
---|
173 | /// <summary>
|
---|
174 | /// Provide the menu commands that this command set handles
|
---|
175 | /// </summary>
|
---|
176 | protected override global::System.Collections.Generic.IList<global::System.ComponentModel.Design.MenuCommand> GetMenuCommands()
|
---|
177 | {
|
---|
178 | // Get the standard commands
|
---|
179 | var commands = new global::System.Collections.Generic.List<global::System.ComponentModel.Design.MenuCommand>(3);
|
---|
180 |
|
---|
181 | global::System.ComponentModel.Design.MenuCommand menuCommand;
|
---|
182 |
|
---|
183 | menuCommand = new DslShell::DynamicStatusMenuCommand(
|
---|
184 | new global::System.EventHandler(this.OnStatusCut),
|
---|
185 | new global::System.EventHandler(this.OnMenuCut),
|
---|
186 | global::System.ComponentModel.Design.StandardCommands.Cut);
|
---|
187 | commands.Add(menuCommand);
|
---|
188 |
|
---|
189 | menuCommand = new DslShell::DynamicStatusMenuCommand(
|
---|
190 | new global::System.EventHandler(this.OnStatusCopy),
|
---|
191 | new global::System.EventHandler(this.OnMenuCopy),
|
---|
192 | global::System.ComponentModel.Design.StandardCommands.Copy);
|
---|
193 | commands.Add(menuCommand);
|
---|
194 |
|
---|
195 | menuCommand = new DslShell::DynamicStatusMenuCommand(
|
---|
196 | new global::System.EventHandler(this.OnStatusPaste),
|
---|
197 | new global::System.EventHandler(this.OnMenuPaste),
|
---|
198 | global::System.ComponentModel.Design.StandardCommands.Paste);
|
---|
199 | commands.Add(menuCommand);
|
---|
200 |
|
---|
201 | return commands;
|
---|
202 | }
|
---|
203 |
|
---|
204 | /// <summary>
|
---|
205 | /// Determines whether Cut menu item should be visible and if so, enabled.
|
---|
206 | /// </summary>
|
---|
207 | /// <param name="sender">The sender of the message</param>
|
---|
208 | /// <param name="args">empty</param>
|
---|
209 | private void OnStatusCut(object sender, global::System.EventArgs args)
|
---|
210 | {
|
---|
211 | System.ComponentModel.Design.MenuCommand cmd = sender as System.ComponentModel.Design.MenuCommand;
|
---|
212 | this.ProcessOnStatusCutCommand(cmd);
|
---|
213 | }
|
---|
214 |
|
---|
215 | /// <summary>
|
---|
216 | /// Determines whether Copy menu item should be visible and if so, enabled.
|
---|
217 | /// </summary>
|
---|
218 | /// <param name="sender">The sender of the message</param>
|
---|
219 | /// <param name="args">empty</param>
|
---|
220 | private void OnStatusCopy(object sender, global::System.EventArgs args)
|
---|
221 | {
|
---|
222 | System.ComponentModel.Design.MenuCommand cmd = sender as System.ComponentModel.Design.MenuCommand;
|
---|
223 | this.ProcessOnStatusCopyCommand(cmd);
|
---|
224 | }
|
---|
225 |
|
---|
226 | /// <summary>
|
---|
227 | /// Updates the UI for the Paste command
|
---|
228 | /// </summary>
|
---|
229 | /// <param name="sender">The sender of the message</param>
|
---|
230 | /// <param name="args">Message parameters</param>
|
---|
231 | private void OnStatusPaste(object sender, global::System.EventArgs args)
|
---|
232 | {
|
---|
233 | System.ComponentModel.Design.MenuCommand cmd = sender as System.ComponentModel.Design.MenuCommand;
|
---|
234 | this.ProcessOnStatusPasteCommand(cmd);
|
---|
235 | }
|
---|
236 |
|
---|
237 | /// <summary>
|
---|
238 | /// Event handler to cut the selected objects to the clipboard then delete the original.
|
---|
239 | /// </summary>
|
---|
240 | /// <param name="sender">The MenuCommand selected.</param>
|
---|
241 | /// <param name="args">not used</param>
|
---|
242 | private void OnMenuCut(object sender, global::System.EventArgs args)
|
---|
243 | {
|
---|
244 | this.ProcessOnMenuCutCommand();
|
---|
245 | }
|
---|
246 |
|
---|
247 | /// <summary>
|
---|
248 | /// Event handler to copy the selected objects to the clipboard.
|
---|
249 | /// </summary>
|
---|
250 | /// <param name="sender">The MenuCommand selected.</param>
|
---|
251 | /// <param name="args">not used</param>
|
---|
252 | private void OnMenuCopy(object sender, global::System.EventArgs args)
|
---|
253 | {
|
---|
254 | this.ProcessOnMenuCopyCommand();
|
---|
255 | }
|
---|
256 |
|
---|
257 | /// <summary>
|
---|
258 | /// Event handler to paste a copy of the object on the clipboard.
|
---|
259 | /// </summary>
|
---|
260 | /// <param name="sender">The MenuCommand selected.</param>
|
---|
261 | /// <param name="args">not used</param>
|
---|
262 | private void OnMenuPaste(object sender, global::System.EventArgs args)
|
---|
263 | {
|
---|
264 | this.ProcessOnMenuPasteCommand();
|
---|
265 | }
|
---|
266 | }
|
---|
267 | }
|
---|
268 |
|
---|