IDEA-80053 Consider removing the window name Project from the title bar of the Project tool window

This commit is contained in:
Dennis Ushakov
2012-01-25 16:01:36 +04:00
parent df0312a8b6
commit 8642b86a76
3 changed files with 17 additions and 11 deletions
@@ -25,7 +25,6 @@ import java.awt.image.BufferedImage;
class ComboContentLayout extends ContentLayout {
BaseLabel myIdLabel;
ContentComboLabel myComboLabel;
private BufferedImage myImage;
@@ -112,7 +111,6 @@ class ComboContentLayout extends ContentLayout {
@Override
public void update() {
updateIdLabel(myIdLabel);
myIdLabel.setVisible(!"true".equals(myUi.myWindow.getComponent().getClientProperty(ToolWindowContentUi.HIDE_ID_LABEL)));
myComboLabel.update();
}
@@ -131,10 +129,6 @@ class ComboContentLayout extends ContentLayout {
return myUi.myManager.getContentCount() > 1;
}
boolean isIdVisible() {
return myIdLabel.isVisible();
}
@Override
public void contentAdded(ContentManagerEvent event) {
}
@@ -21,6 +21,7 @@ import com.intellij.ui.awt.RelativeRectangle;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentManagerEvent;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
@@ -40,6 +41,7 @@ abstract class ContentLayout {
static final int TAB_SHIFT = 2;
ToolWindowContentUi myUi;
BaseLabel myIdLabel;
ContentLayout(ToolWindowContentUi ui) {
myUi = ui;
@@ -76,6 +78,8 @@ abstract class ContentLayout {
label.setBorder(new EmptyBorder(0, 2, 0, 0));
}
}
label.setVisible(shouldShowId());
}
protected void fillTabShape(Graphics2D g2d, Shape shape, boolean isSelected, Rectangle bounds) {
@@ -106,4 +110,12 @@ abstract class ContentLayout {
public abstract String getPreviousContentActionName();
public abstract String getNextContentActionName();
protected boolean shouldShowId() {
final JComponent component = myUi.myWindow.getComponent();
return component != null && !"true".equals(component.getClientProperty(ToolWindowContentUi.HIDE_ID_LABEL));
}
boolean isIdVisible() {
return myIdLabel.isVisible();
}
}
@@ -50,8 +50,6 @@ class TabContentLayout extends ContentLayout {
private Map<String, BufferedImage> myCached = new com.intellij.util.containers.HashMap<String, BufferedImage>();
BaseLabel myIdLabel;
private final MoreIcon myMoreIcon = new MoreIcon() {
protected Rectangle getIconRec() {
return myLastLayout.moreRect;
@@ -153,8 +151,10 @@ class TabContentLayout extends ContentLayout {
data.eachX = 2;
data.eachY = 0;
myIdLabel.setBounds(data.eachX, data.eachY, myIdLabel.getPreferredSize().width, bounds.height);
data.eachX += myIdLabel.getPreferredSize().width;
if (isIdVisible()) {
myIdLabel.setBounds(data.eachX, data.eachY, myIdLabel.getPreferredSize().width, bounds.height);
data.eachX += myIdLabel.getPreferredSize().width;
}
int tabsStart = data.eachX;
if (manager.getContentCount() == 0) return;
@@ -310,7 +310,7 @@ class TabContentLayout extends ContentLayout {
}
if (image != null) {
g.drawImage(image, r.x, r.y, null);
g.drawImage(image, isIdVisible() ? r.x : r.x - 2, r.y, null);
}
prevSelected = each.isSelected();