44using System . Drawing ;
55using System . Globalization ;
66using System . IO ;
7+ using System . Reflection ;
78using System . Text ;
89using System . Threading . Tasks ;
910using System . Windows . Forms ;
@@ -18,13 +19,17 @@ public partial class TestRunnerWindow : Form
1819 private const int Steps = 1000 ;
1920
2021 private readonly RealTimeTestRunner testRunner ;
22+ private readonly object pluginIntegration ;
2123 private readonly BindingList < TestResult > testResults = new BindingList < TestResult > ( ) ;
24+
2225 private int totalNumberOfTests ;
2326 private int rowIndexOnRightClick ;
2427
25- public TestRunnerWindow ( RealTimeTestRunner testRunner )
28+ public TestRunnerWindow ( RealTimeTestRunner testRunner , object pluginIntegration )
2629 {
2730 this . testRunner = testRunner ;
31+ this . pluginIntegration = pluginIntegration ;
32+
2833 InitializeComponent ( ) ;
2934
3035 var bindingSource = new BindingSource { DataSource = testResults } ;
@@ -497,18 +502,29 @@ private void gridResults_SelectionChanged(object sender, EventArgs e)
497502
498503 private void gridResults_CellDoubleClick ( object sender , DataGridViewCellEventArgs e )
499504 {
500- var testResult = testResults [ e . RowIndex ] ;
501- //PlsqlDeveloperUtPlsqlPlugin.OpenPackageBody(testResult.Owner, testResult.Package);
505+ if ( pluginIntegration != null )
506+ {
507+ invokeOpenPackageBody ( e ) ;
508+ }
502509 }
503510
504511 private void gridTestFailures_CellDoubleClick ( object sender , DataGridViewCellEventArgs e )
512+ {
513+ if ( pluginIntegration != null )
514+ {
515+ invokeOpenPackageBody ( e ) ;
516+ }
517+ }
518+
519+ private void invokeOpenPackageBody ( DataGridViewCellEventArgs e )
505520 {
506521 var testResult = testResults [ e . RowIndex ] ;
507- //PlsqlDeveloperUtPlsqlPlugin.OpenPackageBody(testResult.Owner, testResult.Package);
522+
523+ MethodInfo methodInfo = pluginIntegration . GetType ( ) . GetMethod ( "OpenPackageBody" ) ;
524+ methodInfo . Invoke ( pluginIntegration , new object [ ] { testResult . Owner , testResult . Package } ) ;
508525 }
509526
510- private void gridResults_CellContextMenuStripNeeded ( object sender ,
511- DataGridViewCellContextMenuStripNeededEventArgs e )
527+ private void gridResults_CellContextMenuStripNeeded ( object sender , DataGridViewCellContextMenuStripNeededEventArgs e )
512528 {
513529 rowIndexOnRightClick = e . RowIndex ;
514530 }
@@ -517,7 +533,7 @@ private void menuItemRunTests_Click(object sender, EventArgs e)
517533 {
518534 var testResult = testResults [ rowIndexOnRightClick ] ;
519535
520- var testResultWindow = new TestRunnerWindow ( testRunner ) ;
536+ var testResultWindow = new TestRunnerWindow ( testRunner , pluginIntegration ) ;
521537 testResultWindow . RunTestsAsync ( RealTimeTestRunner . Procedure , testResult . Owner , testResult . Package ,
522538 testResult . Procedure , false ) ;
523539 }
@@ -526,7 +542,7 @@ private void menuItemCoverage_Click(object sender, EventArgs e)
526542 {
527543 var testResult = testResults [ rowIndexOnRightClick ] ;
528544
529- var testResultWindow = new TestRunnerWindow ( testRunner ) ;
545+ var testResultWindow = new TestRunnerWindow ( testRunner , pluginIntegration ) ;
530546 testResultWindow . RunTestsAsync ( RealTimeTestRunner . Procedure , testResult . Owner , testResult . Package ,
531547 testResult . Procedure , true ) ;
532548 }
0 commit comments