fix yellow code

This commit is contained in:
Konstantin Bulenkov
2013-10-31 23:35:41 +04:00
parent f16be9c7eb
commit 134b317bc4
@@ -37,7 +37,6 @@ import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.IdRunnable;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.ex.WindowManagerEx;
@@ -80,9 +79,9 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
/**
* This array contains Rectangles which define bounds of the corresponding
* components in the toolbar. This list can be considerer as a cache of the
* components in the toolbar. This list can be consider as a cache of the
* Rectangle objects that are used in calculation of preferred sizes and
* layouting of components.
* components layout.
*/
private final List<Rectangle> myComponentBounds = new ArrayList<Rectangle>();
@@ -123,7 +122,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
private ActionButton mySecondaryActionsButton;
private final KeymapManagerEx myKeymapManager;
private int myFirstOusideIndex = -1;
private int myFirstOutsideIndex = -1;
private JBPopup myPopup;
private JComponent myTargetComponent;
@@ -183,7 +182,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
myTimerListener = new MyTimerListener();
myWeakTimerListener = new WeakTimerListener(actionManager, myTimerListener);
// If the panel doesn't handle mouse event then it will be passed to its parent.
// It means that if the panel is in slidindg mode then the focus goes to the editor
// It means that if the panel is in sliding mode then the focus goes to the editor
// and panel will be automatically hidden.
enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.COMPONENT_EVENT_MASK | AWTEvent.CONTAINER_EVENT_MASK);
setMiniMode(false);
@@ -520,7 +519,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
if (full) {
if (myAutoPopupRec == null) {
myAutoPopupRec = new Rectangle(eachX, eachY, sizeToFit.width - eachX - 1, sizeToFit.height - 1);
myFirstOusideIndex = i;
myFirstOutsideIndex = i;
}
eachBound.x = Integer.MAX_VALUE;
eachBound.y = Integer.MAX_VALUE;
@@ -562,7 +561,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
if (full) {
if (myAutoPopupRec == null) {
myAutoPopupRec = new Rectangle(eachX, eachY, sizeToFit.width - 1, sizeToFit.height - eachY - 1);
myFirstOusideIndex = i;
myFirstOutsideIndex = i;
}
eachBound.x = Integer.MAX_VALUE;
eachBound.y = Integer.MAX_VALUE;
@@ -575,7 +574,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
}
private void calculateBoundsWrapImpl(Dimension sizeToFit, List<Rectangle> bounds) {
// We have to gracefull handle case when toolbar was not layed out yet.
// We have to graceful handle case when toolbar was not laid out yet.
// In this case we calculate bounds as it is a NOWRAP toolbar.
if (getWidth() == 0 || getHeight() == 0) {
try {
@@ -611,7 +610,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
}
final Rectangle each = bounds.get(i);
each.setBounds(xOffset, maxWidth, yOffset, maxHeight);
each.setBounds(xOffset, yOffset, maxWidth, maxHeight);
xOffset += maxWidth;
}
@@ -632,7 +631,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
}
final Rectangle each = bounds.get(i);
each.setBounds(xOffset, maxWidth, yOffset, maxHeight);
each.setBounds(xOffset, yOffset, maxWidth, maxHeight);
yOffset += maxHeight;
}
@@ -642,7 +641,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
if (myOrientation == SwingConstants.HORIZONTAL) {
// Calculate row height
int rowHeight = 0;
final Dimension[] dims = new Dimension[componentCount]; // we will use this dimesions later
final Dimension[] dims = new Dimension[componentCount]; // we will use this dimensions later
for (int i = 0; i < componentCount; i++) {
dims[i] = getChildPreferredSize(i);
final int height = dims[i].height;
@@ -670,7 +669,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
else {
// Calculate row width
int rowWidth = 0;
final Dimension[] dims = new Dimension[componentCount]; // we will use this dimesions later
final Dimension[] dims = new Dimension[componentCount]; // we will use this dimensions later
for (int i = 0; i < componentCount; i++) {
dims[i] = getChildPreferredSize(i);
final int width = dims[i].width;
@@ -717,13 +716,12 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
calculateBoundsAutoImp(size2Fit, bounds);
}
else {
throw new IllegalStateException("unknonw layoutPolicy: " + myLayoutPolicy);
throw new IllegalStateException("unknown layoutPolicy: " + myLayoutPolicy);
}
if (getComponentCount() > 0 && size2Fit.width < Integer.MAX_VALUE) {
final Component component = getComponent(getComponentCount() - 1);
if (component instanceof JComponent && ((JComponent)component).getClientProperty("SEARCH_EVERYWHERE") == Boolean.TRUE) {
final Rectangle rect = bounds.get(bounds.size() - 1);
int max = 0;
for (int i = 0; i < bounds.size() - 2; i++) {
max = Math.max(max, bounds.get(i).height);
@@ -799,7 +797,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
final Insets i = getInsets();
if (UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula()) {
if (getParent() != null) {
final JBColor col = new JBColor(Color.GRAY, Gray._111);
final JBColor col = new JBColor(Gray._128, Gray._111);
final Graphics2D g2 = (Graphics2D)g;
if (myOrientation == SwingConstants.HORIZONTAL) {
UIUtil.drawDoubleSpaceDottedLine(g2, i.top + 2, getParent().getSize().height - 2 - i.top - i.bottom, 3, col, false);
@@ -1029,7 +1027,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
}
else {
final DefaultActionGroup outside = new DefaultActionGroup();
for (int i = myFirstOusideIndex; i < myVisibleActions.size(); i++) {
for (int i = myFirstOutsideIndex; i < myVisibleActions.size(); i++) {
outside.add(myVisibleActions.get(i));
}
group = outside;