@@ -17,7 +17,7 @@ import { DisposableObject } from "../common/disposable-object";
1717import { MethodsUsagePanel } from "./methods-usage/methods-usage-panel" ;
1818import { Mode } from "./shared/mode" ;
1919import { showResolvableLocation } from "../databases/local-databases/locations" ;
20- import { Usage } from "./external-api-usage" ;
20+ import { ExternalApiUsage , Usage } from "./external-api-usage" ;
2121import { setUpPack } from "./model-editor-queries" ;
2222import { MethodModelingPanel } from "./method-modeling/method-modeling-panel" ;
2323
@@ -26,6 +26,7 @@ const SUPPORTED_LANGUAGES: string[] = ["java", "csharp"];
2626export class ModelEditorModule extends DisposableObject {
2727 private readonly queryStorageDir : string ;
2828 private readonly methodsUsagePanel : MethodsUsagePanel ;
29+ private readonly methodModelingPanel : MethodModelingPanel ;
2930
3031 private mostRecentlyActiveView : ModelEditorView | undefined = undefined ;
3132
@@ -40,7 +41,7 @@ export class ModelEditorModule extends DisposableObject {
4041 super ( ) ;
4142 this . queryStorageDir = join ( baseQueryStorageDir , "model-editor-results" ) ;
4243 this . methodsUsagePanel = this . push ( new MethodsUsagePanel ( cliServer ) ) ;
43- this . push ( new MethodModelingPanel ( ctx ) ) ;
44+ this . methodModelingPanel = this . push ( new MethodModelingPanel ( ctx ) ) ;
4445 }
4546
4647 private handleViewBecameActive ( view : ModelEditorView ) : void {
@@ -149,7 +150,7 @@ export class ModelEditorModule extends DisposableObject {
149150 modelFile ,
150151 Mode . Application ,
151152 this . methodsUsagePanel . setState . bind ( this . methodsUsagePanel ) ,
152- this . methodsUsagePanel . revealItem . bind ( this . methodsUsagePanel ) ,
153+ this . showMethod . bind ( this ) ,
153154 this . handleViewBecameActive . bind ( this ) ,
154155 this . handleViewWasDisposed . bind ( this ) ,
155156 this . isMostRecentlyActiveView . bind ( this ) ,
@@ -173,4 +174,24 @@ export class ModelEditorModule extends DisposableObject {
173174 private async initialize ( ) : Promise < void > {
174175 await ensureDir ( this . queryStorageDir ) ;
175176 }
177+
178+ private async showMethod ( usage : Usage ) : Promise < void > {
179+ await this . methodsUsagePanel . revealItem ( usage ) ;
180+
181+ // For now, just construct a dummy method and show it in the method modeling panel
182+ // because the method isn't easily accessible yet.
183+ const method : ExternalApiUsage = {
184+ library : "sql2o" ,
185+ libraryVersion : "1.6.0" ,
186+ signature : "org.sql2o.Connection#createQuery(String)" ,
187+ packageName : "org.sql2o" ,
188+ typeName : "Connection" ,
189+ methodName : "createQuery" ,
190+ methodParameters : "(String)" ,
191+ supported : true ,
192+ supportedType : "summary" ,
193+ usages : [ ] ,
194+ } ;
195+ await this . methodModelingPanel . setMethod ( method ) ;
196+ }
176197}
0 commit comments