77using ASCompletion . Completion ;
88using ASCompletion . Context ;
99using ASCompletion . Model ;
10+ using JetBrains . Annotations ;
1011using PluginCore ;
1112using PluginCore . Helpers ;
1213using PluginCore . Managers ;
@@ -30,6 +31,7 @@ public class ShortcutId
3031
3132 public class PluginMain : IPlugin
3233 {
34+ const string ProjectManagerGUID = "30018864-fadd-1122-b2a5-779832cbbf23" ;
3335 string settingFilename ;
3436 ControlClickManager controlClickManager ;
3537 ToolStripMenuItem typeExplorerItem ;
@@ -208,10 +210,10 @@ void UpdateMenuItems()
208210
209211 void ShowRecentFiles ( )
210212 {
211- var form = new OpenRecentFilesForm ( ( Settings ) Settings ) ;
213+ var form = new OpenRecentFilesForm ( ( Settings ) Settings ) ;
212214 form . KeyUp += FormOnKeyUp ;
213215 if ( form . ShowDialog ( ) != DialogResult . OK ) return ;
214- var plugin = ( ProjectManager . PluginMain ) PluginBase . MainForm . FindPlugin ( "30018864-fadd-1122-b2a5-779832cbbf23" ) ;
216+ var plugin = ( ProjectManager . PluginMain ) PluginBase . MainForm . FindPlugin ( ProjectManagerGUID ) ;
215217 form . SelectedItems . ForEach ( plugin . OpenFile ) ;
216218 }
217219
@@ -222,8 +224,9 @@ void ShowRecentProjets()
222224 var form = new OpenRecentProjectsForm ( ( Settings ) Settings ) ;
223225 form . KeyUp += FormOnKeyUp ;
224226 if ( form . ShowDialog ( ) != DialogResult . OK ) return ;
225- var plugin = ( ProjectManager . PluginMain ) PluginBase . MainForm . FindPlugin ( "30018864-fadd-1122-b2a5-779832cbbf23" ) ;
226- plugin . OpenFile ( form . SelectedItem ) ;
227+ var plugin = ( ProjectManager . PluginMain ) PluginBase . MainForm . FindPlugin ( ProjectManagerGUID ) ;
228+ if ( form . InNewWindow ) ProcessHelper . StartAsync ( Application . ExecutablePath , form . SelectedItem ) ;
229+ else plugin . OpenFile ( form . SelectedItem ) ;
227230 }
228231
229232 void ShowTypeExplorer ( object sender , EventArgs e ) => ShowTypeExplorer ( ) ;
@@ -276,13 +279,13 @@ void ShowTypeExplorer()
276279
277280 void ShowQuickOutline ( ) => ShowQuickOutline ( ASContext . Context . CurrentModel , ASContext . Context . CurrentClass ) ;
278281
279- void ShowQuickOutline ( Form sender , ClassModel inClass )
282+ void ShowQuickOutline ( [ NotNull ] Form sender , [ NotNull ] ClassModel inClass )
280283 {
281284 sender . Close ( ) ;
282285 ( ( Control ) PluginBase . MainForm ) . BeginInvoke ( ( MethodInvoker ) ( ( ) => ShowQuickOutline ( inClass . InFile , inClass ) ) ) ;
283286 }
284287
285- void ShowQuickOutline ( FileModel inFile , ClassModel inClass )
288+ void ShowQuickOutline ( [ NotNull ] FileModel inFile , [ NotNull ] ClassModel inClass )
286289 {
287290 var form = new QuickOutlineForm ( inFile , inClass , ( Settings ) Settings ) ;
288291 form . ShowInClassHierarchy += ShowClassHierarchy ;
@@ -313,13 +316,13 @@ void ShowClassHierarchy()
313316 ShowClassHierarchy ( ! curClass . IsVoid ( ) ? curClass : context . CurrentModel . GetPublicClass ( ) ) ;
314317 }
315318
316- void ShowClassHierarchy ( Form sender , ClassModel model )
319+ void ShowClassHierarchy ( [ NotNull ] Form sender , [ NotNull ] ClassModel model )
317320 {
318321 sender . Close ( ) ;
319322 ( ( Control ) PluginBase . MainForm ) . BeginInvoke ( ( MethodInvoker ) ( ( ) => ShowClassHierarchy ( model ) ) ) ;
320323 }
321324
322- void ShowClassHierarchy ( ClassModel model )
325+ void ShowClassHierarchy ( [ NotNull ] ClassModel model )
323326 {
324327 var form = new ClassHierarchyForm ( model , ( Settings ) Settings ) ;
325328 form . GotoPositionOrLine += OnGotoPositionOrLine ;
@@ -344,27 +347,27 @@ static bool GetCanShowClassHierarchy()
344347 && ( ! context . CurrentClass . IsVoid ( ) || ! context . CurrentModel . GetPublicClass ( ) . IsVoid ( ) ) ;
345348 }
346349
347- static void OnGotoPositionOrLine ( Form sender , ClassModel model )
350+ static void OnGotoPositionOrLine ( [ NotNull ] Form sender , [ NotNull ] ClassModel model )
348351 {
349352 sender . Close ( ) ;
350- ( ( Control ) PluginBase . MainForm ) . BeginInvoke ( ( MethodInvoker ) delegate
353+ ( ( Control ) PluginBase . MainForm ) . BeginInvoke ( ( MethodInvoker ) ( ( ) =>
351354 {
352355 ModelsExplorer . Instance . OpenFile ( model . InFile . FileName ) ;
353356 PluginBase . MainForm . CallCommand ( "GoTo" , null ) ;
354- } ) ;
357+ } ) ) ;
355358 }
356359
357- static void ShowInProjectManager ( Form sender , ClassModel model )
360+ static void ShowInProjectManager ( [ NotNull ] Form sender , [ NotNull ] ClassModel model )
358361 {
359362 sender . Close ( ) ;
360- ( ( Control ) PluginBase . MainForm ) . BeginInvoke ( ( MethodInvoker ) delegate
363+ ( ( Control ) PluginBase . MainForm ) . BeginInvoke ( ( MethodInvoker ) ( ( ) =>
361364 {
362365 foreach ( var pane in PluginBase . MainForm . DockPanel . Panes )
363366 {
364367 foreach ( var dockContent in pane . Contents )
365368 {
366369 var content = ( DockContent ) dockContent ;
367- if ( content . GetPersistString ( ) != "30018864-fadd-1122-b2a5-779832cbbf23" ) continue ;
370+ if ( content . GetPersistString ( ) != ProjectManagerGUID ) continue ;
368371 foreach ( var ui in content . Controls . OfType < ProjectManager . PluginUI > ( ) )
369372 {
370373 content . Show ( ) ;
@@ -373,13 +376,13 @@ static void ShowInProjectManager(Form sender, ClassModel model)
373376 }
374377 }
375378 }
376- } ) ;
379+ } ) ) ;
377380 }
378381
379- static void ShowInFileExplorer ( Form sender , ClassModel model )
382+ static void ShowInFileExplorer ( [ NotNull ] Form sender , [ NotNull ] ClassModel model )
380383 {
381384 sender . Close ( ) ;
382- ( ( Control ) PluginBase . MainForm ) . BeginInvoke ( ( MethodInvoker ) delegate
385+ ( ( Control ) PluginBase . MainForm ) . BeginInvoke ( ( MethodInvoker ) ( ( ) =>
383386 {
384387 foreach ( var pane in PluginBase . MainForm . DockPanel . Panes )
385388 {
@@ -395,7 +398,7 @@ static void ShowInFileExplorer(Form sender, ClassModel model)
395398 }
396399 }
397400 }
398- } ) ;
401+ } ) ) ;
399402 }
400403
401404 #endregion
0 commit comments