fix grey bg

This commit is contained in:
Konstantin Bulenkov
2012-04-24 15:12:03 +02:00
parent 9ff35c1843
commit e28c177257
4 changed files with 37 additions and 9 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -45,6 +45,7 @@ public abstract class ProjectViewTree extends DnDAwareTree {
cellRenderer.setOpaque(false);
cellRenderer.setIconOpaque(false);
setCellRenderer(cellRenderer);
cellRenderer.setTransparentIconBackground(true);
setOpaque(false);
}
@@ -66,6 +67,8 @@ public abstract class ProjectViewTree extends DnDAwareTree {
@Override
protected void paintComponent(Graphics g) {
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
if (isFileColorsEnabled()) {
paintFileColorGutter(g);
}
@@ -74,7 +77,7 @@ public abstract class ProjectViewTree extends DnDAwareTree {
}
@Override
protected boolean isFileColorsEnabled() {
public boolean isFileColorsEnabled() {
return FileColorManagerImpl._isEnabled() && FileColorManagerImpl._isEnabledForProjectView();
}
@@ -0,0 +1,23 @@
/*
* Copyright 2000-2012 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.ui;
/**
* @author Konstantin Bulenkov
*/
public interface ComponentWithFileColors {
boolean isFileColorsEnabled();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -636,6 +636,10 @@ public class SimpleColoredComponent extends JComponent implements Accessible {
return myTransparentIconBackground;
}
public void setTransparentIconBackground(boolean transparentIconBackground) {
myTransparentIconBackground = transparentIconBackground;
}
private static int getTextBaseLine(FontMetrics metrics, final int height) {
return (height - metrics.getHeight()) / 2 + metrics.getAscent();
}
@@ -21,10 +21,7 @@ import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.wm.impl.content.GraphicsConfig;
import com.intellij.ui.ComponentWithExpandableItems;
import com.intellij.ui.ExpandableItemsHandler;
import com.intellij.ui.ExpandableItemsHandlerFactory;
import com.intellij.ui.LoadingNode;
import com.intellij.ui.*;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.ui.AsyncProcessIcon;
import com.intellij.util.ui.ComponentWithEmptyText;
@@ -48,7 +45,8 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Map;
public class Tree extends JTree implements ComponentWithEmptyText, ComponentWithExpandableItems<Integer>, Autoscroll, Queryable {
public class Tree extends JTree implements ComponentWithEmptyText, ComponentWithExpandableItems<Integer>, Autoscroll, Queryable,
ComponentWithFileColors {
private StatusText myEmptyText;
private ExpandableItemsHandler<Integer> myExpandableItemsHandler;
@@ -132,7 +130,7 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith
return true;
}
protected boolean isFileColorsEnabled() {
public boolean isFileColorsEnabled() {
return false;
}