IDEA-155345 Show live port for Spring Boot apps in Run Dashboard

This commit is contained in:
Konstantin Aleev
2017-02-08 13:21:34 +03:00
parent 07002f6478
commit 0c72506ba5
7 changed files with 54 additions and 2 deletions
@@ -0,0 +1,23 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.execution.dashboard;
/**
* @author konstantin.aleev
*/
public interface DashboardListener {
void contentChanged(boolean withStructure);
}
@@ -30,6 +30,8 @@ public class DashboardRunConfigurationStatus {
ExecutionBundle.message("runtime.dashboard.stopped.group.name"), AllIcons.Actions.Suspend);
public static final DashboardRunConfigurationStatus FAILED = new DashboardRunConfigurationStatus(
ExecutionBundle.message("runtime.dashboard.failed.group.name"), AllIcons.General.Error);
public static final DashboardRunConfigurationStatus STARTING = new DashboardRunConfigurationStatus(
ExecutionBundle.message("runtime.dashboard.starting.group.name"), AllIcons.Process.Step_4);
private final String myName;
private final Icon myIcon;
@@ -18,6 +18,7 @@ package com.intellij.execution.dashboard;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.ui.content.ContentManager;
import com.intellij.util.messages.Topic;
import javax.swing.*;
@@ -25,6 +26,9 @@ import javax.swing.*;
* @author konstantin.aleev
*/
public interface RuntimeDashboardManager {
Topic<DashboardListener> DASHBOARD_TOPIC =
Topic.create("runtime dashboard", DashboardListener.class, Topic.BroadcastDirection.TO_PARENT);
static RuntimeDashboardManager getInstance(Project project) {
return ServiceManager.getService(project, RuntimeDashboardManager.class);
}
@@ -30,6 +30,7 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.util.Comparing;
@@ -39,6 +40,7 @@ import com.intellij.ui.components.JBPanelWithEmptyText;
import com.intellij.ui.content.*;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.ObjectUtils;
import com.intellij.util.messages.MessageBusConnection;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -241,7 +243,8 @@ public class RuntimeDashboardContent extends JPanel implements TreeContent, Disp
updateTreeIfNeeded(settings);
}
});
myProject.getMessageBus().connect(myProject).subscribe(ExecutionManager.EXECUTION_TOPIC, new ExecutionListener() {
MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
connection.subscribe(ExecutionManager.EXECUTION_TOPIC, new ExecutionListener() {
@Override
public void processStarted(@NotNull String executorId, @NotNull ExecutionEnvironment env, final @NotNull ProcessHandler handler) {
updateTreeIfNeeded(env.getRunnerAndConfigurationSettings());
@@ -255,6 +258,22 @@ public class RuntimeDashboardContent extends JPanel implements TreeContent, Disp
updateTreeIfNeeded(env.getRunnerAndConfigurationSettings());
}
});
connection.subscribe(RuntimeDashboardManager.DASHBOARD_TOPIC, new DashboardListener() {
@Override
public void contentChanged(boolean withStructure) {
updateTree(withStructure);
}
});
connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
@Override
public void enteredDumbMode() {
}
@Override
public void exitDumbMode() {
updateTree(false);
}
});
}
private void updateTreeIfNeeded(@Nullable RunnerAndConfigurationSettings settings) {
@@ -27,6 +27,7 @@ import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.RowIcon;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.content.Content;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -62,7 +63,7 @@ class RunConfigurationNode extends AbstractTreeNode<Pair<RunnerAndConfiguration
@Override
protected void update(PresentationData presentation) {
RunnerAndConfigurationSettings configurationSettings = getConfigurationSettings();
presentation.setPresentableText(configurationSettings.getName());
presentation.addText(configurationSettings.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
Icon icon = RunManagerEx.getInstanceEx(getProject()).getConfigurationIcon(configurationSettings);
Icon decorator = getIconDecorator();
if (decorator != null) {
@@ -390,3 +390,4 @@ runtime.dashboard.remove.configuration.dialog.message=Are you sure to remove sel
runtime.dashboard.started.group.name=Started
runtime.dashboard.stopped.group.name=Stopped
runtime.dashboard.failed.group.name=Failed
runtime.dashboard.starting.group.name=Starting
@@ -926,6 +926,8 @@ select.run.configuration.from.context.description=Select run configuration when
ide.runtime.dashboard=false
ide.runtime.dashboard.description=Enable Runtime Dashboard tool window
ide.runtime.dashboard.spring.boot.jmx=true
ide.runtime.dashboard.spring.boot.jmx.description=Enable JMX Remote with disabled security for Spring Boot applications to access runtime information
focus.follows.mouse.workarounds=false
focus.follows.mouse.workarounds.description=Enables some workarounds for Focus-follows-mouse issues, like IDEA-112015