diff --git a/platform/lang-api/src/com/intellij/execution/services/ServiceViewDescriptor.java b/platform/lang-api/src/com/intellij/execution/services/ServiceViewDescriptor.java index d2518d26bd52..6169876651d6 100644 --- a/platform/lang-api/src/com/intellij/execution/services/ServiceViewDescriptor.java +++ b/platform/lang-api/src/com/intellij/execution/services/ServiceViewDescriptor.java @@ -10,7 +10,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.awt.*; import java.awt.event.MouseEvent; @ApiStatus.Experimental @@ -73,11 +72,6 @@ public interface ServiceViewDescriptor { return null; } - @Nullable - default Color getItemBackgroundColor() { - return null; - } - @Nullable default Runnable getRemover() { return null; diff --git a/platform/lang-impl/src/com/intellij/execution/services/ServiceModel.java b/platform/lang-impl/src/com/intellij/execution/services/ServiceModel.java index db9882625334..21013ebf3399 100644 --- a/platform/lang-impl/src/com/intellij/execution/services/ServiceModel.java +++ b/platform/lang-impl/src/com/intellij/execution/services/ServiceModel.java @@ -6,6 +6,7 @@ import com.intellij.ide.util.treeView.NodeDescriptor; import com.intellij.openapi.Disposable; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.ColoredItem; import com.intellij.openapi.util.registry.Registry; import com.intellij.ui.AppUIUtil; import com.intellij.util.Function; @@ -18,7 +19,9 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.concurrency.CancellablePromise; +import java.awt.*; import java.util.*; +import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -425,7 +428,7 @@ class ServiceModel implements Disposable, InvokerSupplier { groupChildren.add(child); } - abstract static class ServiceViewItem { + abstract static class ServiceViewItem implements ColoredItem { private final Object myValue; private final ServiceViewItem myParent; private final ServiceViewContributor myContributor; @@ -490,6 +493,13 @@ class ServiceModel implements Disposable, InvokerSupplier { @NotNull protected abstract List doGetChildren(); + @Nullable + @Override + public Color getColor() { + ServiceViewDescriptor descriptor = getViewDescriptor(); + return descriptor instanceof ColoredItem ? ((ColoredItem)descriptor).getColor() : null; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/platform/lang-impl/src/com/intellij/execution/services/ServiceViewTree.java b/platform/lang-impl/src/com/intellij/execution/services/ServiceViewTree.java index 433d09a22603..9d33c7aba067 100644 --- a/platform/lang-impl/src/com/intellij/execution/services/ServiceViewTree.java +++ b/platform/lang-impl/src/com/intellij/execution/services/ServiceViewTree.java @@ -16,7 +16,6 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; -import java.awt.*; import java.awt.event.MouseEvent; import static com.intellij.ui.AnimatedIcon.ANIMATION_IN_RENDERER_ALLOWED; @@ -60,20 +59,6 @@ class ServiceViewTree extends Tree { setDragEnabled(true); } - @Override - public boolean isFileColorsEnabled() { - return true; - } - - @Nullable - @Override - public Color getFileColorForPath(@NotNull TreePath path) { - Object node = path.getLastPathComponent(); - if (!(node instanceof ServiceViewItem)) return null; - - return ((ServiceViewItem)node).getViewDescriptor().getItemBackgroundColor(); - } - private static class ServiceViewTreeCellRenderer extends ServiceViewTreeCellRendererBase { private ServiceViewDescriptor myDescriptor;