Search in sources :

Example 1 with GetServerPortConsumer

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);
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) GetServerPortConsumer(com.google.dart.server.GetServerPortConsumer) RequestError(org.dartlang.analysis.server.protocol.RequestError) DartAnalysisServerService(com.jetbrains.lang.dart.analyzer.DartAnalysisServerService) Notification(com.intellij.notification.Notification)

Aggregations

GetServerPortConsumer (com.google.dart.server.GetServerPortConsumer)1 Notification (com.intellij.notification.Notification)1 Project (com.intellij.openapi.project.Project)1 DartAnalysisServerService (com.jetbrains.lang.dart.analyzer.DartAnalysisServerService)1 RequestError (org.dartlang.analysis.server.protocol.RequestError)1