Skip to content

Commit

Permalink
Pass the projects manager to the telemetry manager in a safer manner.
Browse files Browse the repository at this point in the history
Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Sep 15, 2023
1 parent 81d5ef7 commit a418e46
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public IStatus runInWorkspace(IProgressMonitor monitor) {
projectsManager.configureFilters(monitor);
JavaLanguageServerPlugin.logInfo("Workspace initialized in " + (System.currentTimeMillis() - start) + "ms");
connection.sendStatus(ServiceStatus.Started, "Ready");
telemetryManager.onProjectsInitialized(projectsManager, System.currentTimeMillis());
telemetryManager.onProjectsInitialized(System.currentTimeMillis());
} catch (OperationCanceledException e) {
connection.sendStatus(ServiceStatus.Error, "Initialization has been cancelled.");
return Status.CANCEL_STATUS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ public void connectClient(JavaLanguageClient client) {
this.workspaceEventHandler = new WorkspaceEventsHandler(pm, this.client, this.documentLifeCycleHandler);
this.telemetryManager.setLanguageClient(client);
this.telemetryManager.setPreferenceManager(preferenceManager);
this.telemetryManager.setProjectseManager(pm);
}

// For testing purpose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ public void setPreferenceManager(PreferenceManager prefs) {
this.prefs = prefs;
}

public void setProjectseManager(ProjectsManager projectsManager) {
this.projectsManager = projectsManager;
}

public void onLanguageServerStart(long timeMillis, boolean firstTimeInitialization) {
this.languageServerStartTime = timeMillis;
this.firstTimeInitialization = firstTimeInitialization;
}

public void onProjectsInitialized(ProjectsManager projectsManager, long timeMillis) {
this.projectsManager = projectsManager;
public void onProjectsInitialized(long timeMillis) {
this.projectsInitializedTime = timeMillis;
}

Expand Down Expand Up @@ -133,7 +136,7 @@ public void onBuildFinished(long buildFinishedTime) {
} catch (CoreException e) {
// ignore
}

}
}
}
Expand Down

0 comments on commit a418e46

Please sign in to comment.