use of com.google.dart.server.GetServerPortConsumer in project intellij-plugins by JetBrains.
the class AnalysisServerDiagnosticsAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
if (project == null)
return;
// Get the current analysis server.
DartAnalysisServerService server = DartAnalysisServerService.getInstance(project);
// Ask it for the diagnostics port.
server.diagnostic_getServerPort(new GetServerPortConsumer() {
@Override
public void computedServerPort(int port) {
// Open a new browser page.
final String url = "http://localhost:" + port + "/status";
OpenDartObservatoryUrlAction.openUrlInChromeFamilyBrowser(url);
}
@Override
public void onError(RequestError requestError) {
Notification notification = new Notification(GROUP_DISPLAY_ID, DartBundle.message("analysis.server.show.diagnostics.error"), requestError.getMessage(), NotificationType.ERROR);
Notifications.Bus.notify(notification);
}
});
}
Aggregations