mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-208727 added test tasks color identification in toolwindow
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.externalSystem.view
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.search.scope.TestsScope
|
||||
import com.intellij.ui.FileColorManager
|
||||
import com.intellij.ui.treeStructure.SimpleTree
|
||||
import com.intellij.util.ui.tree.TreeUtil
|
||||
import java.awt.Color
|
||||
|
||||
class ExternalProjectTree(project: Project) : SimpleTree() {
|
||||
private val colorManager = FileColorManager.getInstance(project)
|
||||
|
||||
override fun isFileColorsEnabled() = true
|
||||
|
||||
override fun getFileColorFor(value: Any?): Color? {
|
||||
val node = TreeUtil.getUserObject(value)
|
||||
if (node is TaskNode && node.isTest) {
|
||||
return colorManager.getScopeColor(TestsScope.NAME)
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -298,7 +298,7 @@ public class ExternalProjectsViewImpl extends SimpleToolWindowPanel implements D
|
||||
}
|
||||
|
||||
private void initTree() {
|
||||
myTree = new SimpleTree();
|
||||
myTree = new ExternalProjectTree(myProject);
|
||||
myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
|
||||
|
||||
final ActionManager actionManager = ActionManager.getInstance();
|
||||
|
||||
+4
@@ -76,6 +76,10 @@ public class TaskNode extends ExternalSystemNode<TaskData> {
|
||||
return !myTaskData.isInherited() || getExternalProjectsView().showInheritedTasks();
|
||||
}
|
||||
|
||||
public boolean isTest() {
|
||||
return myTaskData.isTest();
|
||||
}
|
||||
|
||||
public String getModuleOwnerName() {
|
||||
return moduleOwnerName;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class SimpleTree extends Tree implements CellEditorListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isFileColorsEnabled() {
|
||||
public boolean isFileColorsEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user