Skip to content

Commit

Permalink
send telemetry for manual refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
CsCherrYY committed Apr 17, 2023
1 parent 0135073 commit dcdc8ae
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
13 changes: 11 additions & 2 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@
{
"command": "gradle.refresh",
"category": "Gradle",
"title": "Refresh Gradle Projects View"
},
{
"command": "gradle.refresh.external",
"category": "Gradle",
"title": "Refresh Gradle Projects View",
"icon": {
"light": "resources/light/refresh.svg",
Expand Down Expand Up @@ -466,9 +471,13 @@
"when": "false"
},
{
"command": "gradle.refresh",
"command": "gradle.refresh.external",
"when": "gradle:extensionActivated"
},
{
"command": "gradle.refresh",
"when": "false"
},
{
"command": "gradle.runBuild",
"when": "gradle:extensionActivated"
Expand Down Expand Up @@ -520,7 +529,7 @@
"group": "navigation@2"
},
{
"command": "gradle.refresh",
"command": "gradle.refresh.external",
"when": "view == gradleTasksView || view == gradleDefaultProjectsView",
"group": "overflow@3"
},
Expand Down
16 changes: 8 additions & 8 deletions extension/src/commands/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import { COMMAND_CREATE_PROJECT, COMMAND_CREATE_PROJECT_ADVANCED, CreateProjectC
import { HideStoppedDaemonsCommand, HIDE_STOPPED_DAEMONS } from "./HideStoppedDaemonsCommand";
import { COMMAND_RELOAD_JAVA_PROJECT, ReloadJavaProjectsCommand } from "./ReloadJavaProjectsCommand";
import { COMMAND_RUN_TASKS, RunTasksCommand } from "./RunTasksCommand";
import { COMMAND_REFRESH_EXTERNAL, RefreshExternalCommand } from "./RefreshExternalCommand";
import { ShowStoppedDaemonsCommand, SHOW_STOPPED_DAEMONS } from "./ShowStoppedDaemonsCommand";

export class Commands {
Expand Down Expand Up @@ -134,15 +135,14 @@ export class Commands {
);
this.registerCommand(COMMAND_CANCEL_BUILD, new CancelBuildCommand(this.client));
this.registerCommand(COMMAND_CANCEL_TREE_ITEM_TASK, new CancelTreeItemTaskCommand());
this.registerCommandWithoutInstrument(
COMMAND_REFRESH,
new RefreshCommand(
this.gradleTaskProvider,
this.gradleBuildContentProvider,
this.gradleTasksTreeDataProvider,
this.recentTasksTreeDataProvider
)
const refreshCommand = new RefreshCommand(
this.gradleTaskProvider,
this.gradleBuildContentProvider,
this.gradleTasksTreeDataProvider,
this.recentTasksTreeDataProvider
);
this.registerCommandWithoutInstrument(COMMAND_REFRESH, refreshCommand);
this.registerCommand(COMMAND_REFRESH_EXTERNAL, new RefreshExternalCommand(refreshCommand));
this.registerCommand(COMMAND_LOAD_TASKS, new LoadTasksCommand(this.gradleTaskProvider));
this.registerCommandWithoutInstrument(
COMMAND_REFRESH_DAEMON_STATUS,
Expand Down
19 changes: 19 additions & 0 deletions extension/src/commands/RefreshExternalCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

import { Command } from "./Command";
import { RefreshCommand } from "./RefreshCommand";

export const COMMAND_REFRESH_EXTERNAL = "gradle.refresh.external";

/**
* Used for collecting telemetry of refresh command from external UI.
*/
export class RefreshExternalCommand extends Command {
constructor(private refreshCommand: RefreshCommand) {
super();
}
async run(): Promise<void> {
this.refreshCommand.run();
}
}

0 comments on commit dcdc8ae

Please sign in to comment.