mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extend JBPanelWithEmptyText to support all its features
This commit is contained in:
@@ -4,6 +4,7 @@ package com.intellij.openapi.ui;
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.ui.components.JBPanelWithEmptyText;
|
||||
import com.intellij.ui.switcher.QuickActionProvider;
|
||||
import com.intellij.util.containers.JBIterable;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -18,7 +19,7 @@ import java.awt.event.ContainerEvent;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SimpleToolWindowPanel extends JPanel implements QuickActionProvider, DataProvider {
|
||||
public class SimpleToolWindowPanel extends JBPanelWithEmptyText implements QuickActionProvider, DataProvider {
|
||||
|
||||
private JComponent myToolbar;
|
||||
private JComponent myContent;
|
||||
@@ -74,7 +75,8 @@ public class SimpleToolWindowPanel extends JPanel implements QuickActionProvider
|
||||
if (c != null) {
|
||||
if (myVertical) {
|
||||
add(c, BorderLayout.NORTH);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
add(c, BorderLayout.WEST);
|
||||
}
|
||||
}
|
||||
@@ -124,15 +126,16 @@ public class SimpleToolWindowPanel extends JPanel implements QuickActionProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(final Graphics g) {
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
|
||||
if (myToolbar != null && myToolbar.getParent() == this && myContent != null && myContent.getParent() == this) {
|
||||
g.setColor(UIUtil.getBorderColor());
|
||||
if (myVertical) {
|
||||
final int y = (int)myToolbar.getBounds().getMaxY();
|
||||
int y = (int)myToolbar.getBounds().getMaxY();
|
||||
UIUtil.drawLine(g, 0, y, getWidth(), y);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
int x = (int)myToolbar.getBounds().getMaxX();
|
||||
UIUtil.drawLine(g, x, 0, x, getHeight());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user