1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
- import { commands , ExtensionContext } from "vscode" ;
4
+ import { commands , Extension , ExtensionContext , extensions } from "vscode" ;
5
5
import { dispose as disposeTelemetryWrapper , initializeFromJsonFile , instrumentOperation } from "vscode-extension-telemetry-wrapper" ;
6
6
import { Commands } from "./commands" ;
7
7
import { LibraryController } from "./controllers/libraryController" ;
@@ -21,11 +21,21 @@ function activateExtension(operationId: string, context: ExtensionContext) {
21
21
Services . initialize ( context ) ;
22
22
Settings . initialize ( context ) ;
23
23
24
+ setMavenEnabledContext ( ) ;
25
+
24
26
context . subscriptions . push ( new ProjectController ( context ) ) ;
25
27
context . subscriptions . push ( new LibraryController ( context ) ) ;
26
28
context . subscriptions . push ( new DependencyExplorer ( context ) ) ;
27
29
}
28
30
31
+ // determine if the add dependency shortcut will show or not
32
+ function setMavenEnabledContext ( ) {
33
+ const mavenExt : Extension < any > | undefined = extensions . getExtension ( "vscjava.vscode-maven" ) ;
34
+ if ( mavenExt ) {
35
+ commands . executeCommand ( "setContext" , "mavenEnabled" , true ) ;
36
+ }
37
+ }
38
+
29
39
// this method is called when your extension is deactivated
30
40
export async function deactivate ( ) {
31
41
await disposeTelemetryWrapper ( ) ;
0 commit comments