@@ -21,24 +21,21 @@ import { AwsExplorer } from './awsExplorer'
21
21
import { copyTextCommand } from './commands/copyText'
22
22
import { loadMoreChildrenCommand } from './commands/loadMoreChildren'
23
23
import { checkExplorerForDefaultRegion } from './defaultRegion'
24
- import { createToolView , ToolView } from './toolView'
24
+ import { ToolView } from './toolView'
25
25
import { telemetry } from '../shared/telemetry/telemetry'
26
- import { cdkNode , CdkRootNode , refreshCdkExplorer } from '../cdk/explorer/rootNode'
27
- import {
28
- CodeWhispererNode ,
29
- getCodewhispererNode ,
30
- refreshCodeWhisperer ,
31
- refreshCodeWhispererRootNode ,
32
- } from '../codewhisperer/explorer/codewhispererNode'
33
- import { once } from '../shared/utilities/functionUtils'
26
+ import { cdkNode , refreshCdkExplorer } from '../cdk/explorer/rootNode'
34
27
import { CodeCatalystRootNode } from '../codecatalyst/explorer'
35
28
import { CodeCatalystAuthenticationProvider } from '../codecatalyst/auth'
36
29
import { S3FolderNode } from '../s3/explorer/s3FolderNode'
37
30
import { amazonQNode , refreshAmazonQ , refreshAmazonQRootNode } from '../amazonq/explorer/amazonQNode'
38
31
import { GlobalState } from '../shared/globalState'
32
+ import { activateViewsShared , registerToolView } from './activationShared'
39
33
40
34
/**
41
35
* Activates the AWS Explorer UI and related functionality.
36
+ *
37
+ * IMPORTANT: Views that should work in all vscode environments (node or browser)
38
+ * should be setup in {@link activateViewsShared}.
42
39
*/
43
40
export async function activate ( args : {
44
41
context : ExtContext
@@ -119,30 +116,9 @@ export async function activate(args: {
119
116
...amazonQViewNode ,
120
117
...codecatalystViewNode ,
121
118
{ nodes : [ cdkNode ] , view : 'aws.cdk' , refreshCommands : [ refreshCdkExplorer ] } ,
122
- {
123
- nodes : [ getCodewhispererNode ( ) ] ,
124
- view : 'aws.codewhisperer' ,
125
- refreshCommands : [ refreshCodeWhisperer , refreshCodeWhispererRootNode ] ,
126
- } ,
127
119
]
128
120
for ( const viewNode of viewNodes ) {
129
- const toolView = createToolView ( viewNode )
130
- args . context . extensionContext . subscriptions . push ( toolView )
131
- if ( viewNode . view === 'aws.cdk' ) {
132
- // Legacy CDK behavior. Mostly useful for C9 as they do not have inline buttons.
133
- toolView . onDidChangeVisibility ( ( { visible } ) => visible && cdkNode . refresh ( ) )
134
- }
135
-
136
- toolView . onDidExpandElement ( e => {
137
- if ( e . element . resource instanceof CdkRootNode ) {
138
- // Legacy CDK metric, remove this when we add something generic
139
- const recordExpandCdkOnce = once ( ( ) => telemetry . cdk_appExpanded . emit ( ) )
140
- recordExpandCdkOnce ( )
141
- } else if ( e . element . resource instanceof CodeWhispererNode ) {
142
- const onDidExpandCodeWhisperer = once ( ( ) => telemetry . ui_click . emit ( { elementId : 'cw_parentNode' } ) )
143
- onDidExpandCodeWhisperer ( )
144
- }
145
- } )
121
+ registerToolView ( viewNode , args . context . extensionContext )
146
122
}
147
123
}
148
124
0 commit comments