From cc96d7764d9913825bddc4c68de9e6234b9b7119 Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Fri, 27 Aug 2010 13:58:03 +0400 Subject: [PATCH 1/6] balloon refactoring - 1 --- .../src/com/intellij/ui/BalloonImpl.java | 198 ++++++++++++++---- 1 file changed, 155 insertions(+), 43 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java index f803b390a926..49dc3fa7a961 100644 --- a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java @@ -30,18 +30,20 @@ import com.intellij.ui.components.panels.NonOpaquePanel; import com.intellij.ui.components.panels.Wrapper; import com.intellij.util.Alarm; import com.intellij.util.Range; +import com.intellij.util.containers.HashSet; import com.intellij.util.ui.*; import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; -import javax.swing.text.html.HTMLEditorKit; import java.awt.*; import java.awt.event.*; import java.awt.geom.GeneralPath; +import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; import java.awt.image.BufferedImage; +import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; public class BalloonImpl implements Disposable, Balloon, LightweightWindow, PositionTracker.Client { @@ -55,7 +57,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi private final Color myBorderColor; private final Color myFillColor; - private final Insets myContainerInsets = new Insets(4, 4, 4, 4); + private final Insets myContainerInsets = new Insets(2, 2, 2, 2); private boolean myLastMoveWasInsideBalloon; @@ -252,19 +254,49 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi myLayeredPane.addComponentListener(myComponentListener); + myTargetPoint = myTracker.recalculateLocation(this).getPoint(myLayeredPane); + + + if (myShowPointer) { + Rectangle rec = getRecForPosition(myPosition, true); + + if (!myPosition.isOkToHavePointer(myTargetPoint, rec, getPointerLength(), getPointerWidth(), getArc(), getNormalInset())) { + rec = getRecForPosition(myPosition, false); + + Rectangle lp = new Rectangle(new Point(0, 0), myLayeredPane.getSize()); + + if (!lp.contains(rec)) { + Rectangle2D currentSquare = lp.createIntersection(rec); + + double maxSquare = currentSquare.getWidth() * currentSquare.getHeight(); + Position targetPosition = myPosition; + + for (Position eachPosition : myPosition.getOtherPositions()) { + Rectangle2D eachIntersection = lp.createIntersection(getRecForPosition(eachPosition, false)); + double eachSquare = eachIntersection.getWidth() * eachIntersection.getHeight(); + if (maxSquare < eachSquare) { + maxSquare = eachSquare; + targetPosition = eachPosition; + } + } + + myPosition = targetPosition; + } + } + } + createComponent(); myComp.validate(); - Rectangle compBounds = myComp.getBounds(); - Rectangle contentRec = SwingUtilities.convertRectangle(myContent.getParent(), myContent.getBounds(), myLayeredPane); + Rectangle rec = myComp.getBounds(); - if (myShowPointer && !myPosition.isOkToHavePointer(myTargetPoint, contentRec, this)) { + if (myShowPointer && !myPosition.isOkToHavePointer(myTargetPoint, rec, getPointerLength(), getPointerWidth(), getArc(), getNormalInset())) { myShowPointer = false; myComp.removeAll(); myLayeredPane.remove(myComp); - myForcedBounds = myPosition.getPointlessContentRec(compBounds, this); + myForcedBounds = rec; createComponent(); } @@ -283,19 +315,46 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi KeyEvent.KEY_EVENT_MASK); } + private Rectangle getRecForPosition(Position position, boolean adjust) { + Dimension size = getContentSizeFor(position); + + Rectangle rec = new Rectangle(new Point(0, 0), size); + + position.setRecToRelativePosition(rec, myTargetPoint); + + if (adjust) { + rec = myPosition + .getUpdatedBounds(myLayeredPane.getSize(), myForcedBounds, rec.getSize(), myShowPointer, myTargetPoint, myContainerInsets); + } + + return rec; + } + + private Dimension getContentSizeFor(Position position) { + Insets insets = position.createBorder(this).getBorderInsets(); + if (insets == null) { + insets = new Insets(0, 0, 0, 0); + } + + Dimension size = myContent.getPreferredSize(); + size.width += insets.left + insets.right; + size.height += insets.top + insets.bottom; + + return size; + } + private void createComponent() { myComp = new MyComponent(myContent, this, myShowPointer ? myPosition.createBorder(this) : getPointlessBorder()); - myTargetPoint = myTracker.recalculateLocation(this).getPoint(myLayeredPane); myComp.clear(); myComp.myAlpha = 0f; myLayeredPane.add(myComp, JLayeredPane.POPUP_LAYER); - myPosition.updateLocation(this); + myPosition.updateBounds(this); } @@ -308,7 +367,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi if (newPosition != null) { myTargetPoint = newPosition.getPoint(myLayeredPane); - myPosition.updateLocation(this); + myPosition.updateBounds(this); } } @@ -447,7 +506,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi public void setBounds(Rectangle bounds) { myForcedBounds = bounds; if (myPosition != null) { - myPosition.updateLocation(this); + myPosition.updateBounds(this); } } @@ -469,22 +528,36 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi abstract EmptyBorder createBorder(final BalloonImpl balloon); - public void updateLocation(final BalloonImpl balloon) { - Rectangle bounds = balloon.myForcedBounds; + abstract void setRecToRelativePosition(Rectangle rec, Point targetPoint); + + + public void updateBounds(final BalloonImpl balloon) { + balloon.myComp._setBounds(getUpdatedBounds(balloon.myLayeredPane.getSize(), + balloon.myForcedBounds, + balloon.myComp.getPreferredSize(), + balloon.myShowPointer, + balloon.myTargetPoint, + balloon.myContainerInsets)); + } + + public Rectangle getUpdatedBounds(Dimension layeredPaneSize, + Rectangle forcedBounds, + Dimension preferredSize, + boolean showPointer, + Point targetPoint, Insets containerInsets) { + + Rectangle bounds = forcedBounds; if (bounds == null) { - final Dimension size = balloon.myComp.getPreferredSize(); - balloon.myComp.setSize(size); - final Dimension layeredPaneSize = balloon.myLayeredPane.getSize(); - Point location = balloon.myShowPointer - ? getLocation(layeredPaneSize, balloon.myTargetPoint, size) - : new Point(balloon.myTargetPoint.x - size.width / 2, balloon.myTargetPoint.y - size.height / 2); - bounds = new Rectangle(location.x, location.y, size.width, size.height); + Point location = showPointer + ? getLocation(layeredPaneSize, targetPoint, preferredSize) + : new Point(targetPoint.x - preferredSize.width / 2, targetPoint.y - preferredSize.height / 2); + bounds = new Rectangle(location.x, location.y, preferredSize.width, preferredSize.height); - ScreenUtil.moveToFit(bounds, new Rectangle(0, 0, layeredPaneSize.width, layeredPaneSize.height), balloon.myContainerInsets); + ScreenUtil.moveToFit(bounds, new Rectangle(0, 0, layeredPaneSize.width, layeredPaneSize.height), containerInsets); } - balloon.myComp._setBounds(bounds); + return bounds; } abstract Point getLocation(final Dimension containerSize, final Point targetPoint, final Dimension balloonSize); @@ -513,23 +586,21 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi final Point pointTarget, final BalloonImpl balloon); - public boolean isOkToHavePointer(Point targetPoint, Rectangle bounds, BalloonImpl balloon) { + public boolean isOkToHavePointer(Point targetPoint, Rectangle bounds, int pointerLength, int pointerWidth, int arc, int normalInset) { if (bounds.contains(targetPoint)) { return false; } - Rectangle pointless = getPointlessContentRec(bounds, balloon); + Rectangle pointless = getPointlessContentRec(bounds, pointerLength); - pointless.x += (balloon.getArc() + 1); - pointless.width -= (balloon.getArc() * 2 + 2); - pointless.y += (balloon.getArc() + 1); - pointless.height -= (balloon.getArc() * 2 + 2); + pointless.x += (arc + 1); + pointless.width -= (arc * 2 + 2); + pointless.y += (arc + 1); + pointless.height -= (arc * 2 + 2); - int size = getDistanceToTarget(bounds, targetPoint); - if (size < balloon.getPointerLength() + balloon.getNormalInset()) return false; - - int pointerWidth = balloon.getPointerWidth(); + int size = getDistanceToTarget(pointless, targetPoint); + if (size < pointerLength) return false; Range balloonRange; Range pointerRange; @@ -550,8 +621,19 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi return this instanceof Below || this instanceof Above; } - protected abstract Rectangle getPointlessContentRec(Rectangle bounds, BalloonImpl balloon); + protected abstract Rectangle getPointlessContentRec(Rectangle bounds, int pointerLength); + public Set getOtherPositions() { + HashSet all = new HashSet(); + all.add(BELOW); + all.add(ABOVE); + all.add(AT_RIGHT); + all.add(AT_LEFT); + + all.remove(this); + + return all; + } } public static final Position BELOW = new Below(); @@ -569,14 +651,19 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } @Override - protected Rectangle getPointlessContentRec(Rectangle bounds, BalloonImpl balloon) { - return new Rectangle(bounds.x, bounds.y + balloon.getPointerLength(), bounds.width, bounds.height - balloon.getPointerLength()); + protected Rectangle getPointlessContentRec(Rectangle bounds, int pointerLength) { + return new Rectangle(bounds.x, bounds.y + pointerLength, bounds.width, bounds.height - pointerLength); } EmptyBorder createBorder(final BalloonImpl balloon) { return new EmptyBorder(balloon.getPointerLength() + balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset()); } + @Override + void setRecToRelativePosition(Rectangle rec, Point targetPoint) { + rec.setLocation(new Point(targetPoint.x - rec.width / 2, targetPoint.y)); + } + Point getLocation(final Dimension containerSize, final Point targetPoint, final Dimension balloonSize) { final Point center = UIUtil.getCenterPoint(new Rectangle(targetPoint, new Dimension(0, 0)), balloonSize); return new Point(center.x, targetPoint.y); @@ -613,12 +700,20 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } @Override - protected Rectangle getPointlessContentRec(Rectangle bounds, BalloonImpl balloon) { - return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height - balloon.getPointerLength()); + protected Rectangle getPointlessContentRec(Rectangle bounds, int pointerLength) { + return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height - pointerLength); } EmptyBorder createBorder(final BalloonImpl balloon) { - return new EmptyBorder(balloon.getNormalInset(), balloon.getNormalInset(), balloon.getPointerLength() + balloon.getNormalInset(), balloon.getNormalInset()); + return new EmptyBorder(balloon.getNormalInset(), + balloon.getNormalInset(), + balloon.getPointerLength(), + balloon.getNormalInset()); + } + + @Override + void setRecToRelativePosition(Rectangle rec, Point targetPoint) { + rec.setLocation(targetPoint.x - rec.width / 2, targetPoint.y - rec.height); } Point getLocation(final Dimension containerSize, final Point targetPoint, final Dimension balloonSize) { @@ -657,14 +752,19 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } @Override - protected Rectangle getPointlessContentRec(Rectangle bounds, BalloonImpl balloon) { - return new Rectangle(bounds.x + balloon.getPointerLength(), bounds.y, bounds.width - balloon.getPointerLength(), bounds.height); + protected Rectangle getPointlessContentRec(Rectangle bounds, int pointerLength) { + return new Rectangle(bounds.x + pointerLength, bounds.y, bounds.width - pointerLength, bounds.height); } EmptyBorder createBorder(final BalloonImpl balloon) { return new EmptyBorder(balloon.getNormalInset(), balloon.getPointerLength() + balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset()); } + @Override + void setRecToRelativePosition(Rectangle rec, Point targetPoint) { + rec.setLocation(targetPoint.x, targetPoint.y - rec.height / 2); + } + Point getLocation(final Dimension containerSize, final Point targetPoint, final Dimension balloonSize) { final Point center = UIUtil.getCenterPoint(new Rectangle(targetPoint, new Dimension(0, 0)), balloonSize); return new Point(targetPoint.x, center.y); @@ -700,14 +800,19 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } @Override - protected Rectangle getPointlessContentRec(Rectangle bounds, BalloonImpl balloon) { - return new Rectangle(bounds.x, bounds.y, bounds.width - balloon.getPointerLength(), bounds.height); + protected Rectangle getPointlessContentRec(Rectangle bounds, int pointerLength) { + return new Rectangle(bounds.x, bounds.y, bounds.width - pointerLength, bounds.height); } EmptyBorder createBorder(final BalloonImpl balloon) { return new EmptyBorder(balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset(), balloon.getPointerLength() + balloon.getNormalInset()); } + @Override + void setRecToRelativePosition(Rectangle rec, Point targetPoint) { + rec.setLocation(targetPoint.x - rec.width, targetPoint.y - rec.height / 2); + } + Point getLocation(final Dimension containerSize, final Point targetPoint, final Dimension balloonSize) { final Point center = UIUtil.getCenterPoint(new Rectangle(targetPoint, new Dimension(0, 0)), balloonSize); return new Point(targetPoint.x - balloonSize.width, center.y); @@ -864,7 +969,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi if (isVisible() && myCloseRec.isVisible()) { Rectangle lpBounds = SwingUtilities.convertRectangle(getParent(), bounds, myLayeredPane); - lpBounds = myPosition.getPointlessContentRec(lpBounds, myBalloon); + lpBounds = myPosition.getPointlessContentRec(lpBounds, myBalloon.getPointerLength()); int iconWidth = myBalloon.myCloseButton.getIconWidth(); int iconHeight = myBalloon.myCloseButton.getIconHeight(); @@ -1001,7 +1106,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi pane.setBorder(new LineBorder(Color.blue)); - balloon.set(new BalloonImpl(pane, Color.black, MessageType.ERROR.getPopupBackground(), true, true, true, true, 0, true, null, false, 500)); + balloon.set(new BalloonImpl(pane, Color.black, MessageType.ERROR.getPopupBackground(), true, true, true, false, 0, true, null, false, 500)); balloon.get().setShowPointer(true); if (e.isShiftDown()) { @@ -1020,6 +1125,13 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } }); + tree.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseMoved(MouseEvent e) { + System.out.println(e.getPoint()); + } + }); + frame.setBounds(300, 300, 300, 300); frame.show(); } From e877a3ad4100f49c36cd2dd0111c5a4d873b6dfa Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Fri, 27 Aug 2010 16:04:43 +0400 Subject: [PATCH 2/6] balloon positioning fixes + option to use system colors --- .../com/intellij/ide/IdeTooltipManager.java | 24 +++++++--- .../src/com/intellij/ui/BalloonImpl.java | 47 +++++++++---------- .../src/misc/registry.properties | 1 + 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java index f275e2a428b5..f743d828fa9e 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java @@ -20,6 +20,7 @@ import com.intellij.openapi.components.ApplicationComponent; import com.intellij.openapi.ui.popup.Balloon; import com.intellij.openapi.ui.popup.BalloonBuilder; import com.intellij.openapi.ui.popup.JBPopupFactory; +import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.registry.RegistryValue; import com.intellij.openapi.util.registry.RegistryValueListener; @@ -99,6 +100,12 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener if (me.getComponent() == myCurrentComponent) { myX = me.getX(); myY = me.getY(); + } else if (myCurrentComponent == null) { + maybeShowFor(c, me); + } + } else if (me.getID() == MouseEvent.MOUSE_PRESSED) { + if (me.getComponent() == myCurrentComponent) { + hideCurrent(); } } } @@ -130,7 +137,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener public void run() { show(c, e, tooltipText, toCenter); } - }, myShowDelay ? 750 : 250); + }, myShowDelay ? 1200 : 750); } private void show(Component c, MouseEvent e, String tooltipText, boolean toCenter) { @@ -138,15 +145,20 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener myTipLabel.setText(tooltipText); - Color bg = new Color(100, 100, 100, 230); + boolean useSystem = Registry.is("ide.tooltip.useSystemColors") || (!UIUtil.isUnderAquaLookAndFeel()); + + Color bg = useSystem ? UIManager.getColor("ToolTip.background") : new Color(100, 100, 100, 230); + Color fg = useSystem ? UIManager.getColor("ToolTip.foreground") : Color.white; + Color border = useSystem ? Color.darkGray : bg; + BalloonBuilder builder = myPopupFactory.createBalloonBuilder(myTipLabel) .setPreferredPosition(Balloon.Position.above) .setFillColor(bg) - .setBorderColor(bg) + .setBorderColor(border) .setAnimationCycle(150) .setShowCallout(true); - myTipLabel.setForeground(Color.white); - myTipLabel.setBorder(new EmptyBorder(0, 2, 0, 2)); + myTipLabel.setForeground(fg); + myTipLabel.setBorder(new EmptyBorder(1, 3, 2, 3)); Font font = UIManager.getFont("Label.font"); myTipLabel.setFont(font.deriveFont(Font.PLAIN, font.getSize() - 2)); myCurrentTip = builder.createBalloon(); @@ -168,7 +180,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener if (toCenter) { Rectangle bounds = e.getComponent().getBounds(); point.x = toCenterX ? bounds.width / 2 : point.x; - point.y = toCenterY ? (bounds.height / 2 - (bounds.height / 5)) : point.y; + point.y = toCenterY ? (bounds.height / 2) : point.y; } myCurrentTip.show(new RelativePoint(c, point), Balloon.Position.above); diff --git a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java index 49dc3fa7a961..0133d0dc5688 100644 --- a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java @@ -29,6 +29,7 @@ import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.components.panels.NonOpaquePanel; import com.intellij.ui.components.panels.Wrapper; import com.intellij.util.Alarm; +import com.intellij.util.IJSwingUtilities; import com.intellij.util.Range; import com.intellij.util.containers.HashSet; import com.intellij.util.ui.*; @@ -234,17 +235,17 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi myTracker = tracker; myTracker.init(this); - final Window window = SwingUtilities.getWindowAncestor(tracker.getComponent()); - JRootPane root = null; - if (window instanceof JFrame) { - root = ((JFrame)window).getRootPane(); - } - else if (window instanceof JDialog) { - root = ((JDialog)window).getRootPane(); - } - else { - assert false : window; + JDialog dialog = IJSwingUtilities.findParentOfType(tracker.getComponent(), JDialog.class); + if (dialog != null) { + root = dialog.getRootPane(); + } else { + JFrame frame = IJSwingUtilities.findParentOfType(tracker.getComponent(), JFrame.class); + if (frame != null) { + root = frame.getRootPane(); + } else { + assert false; + } } myVisible = true; @@ -263,7 +264,9 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi if (!myPosition.isOkToHavePointer(myTargetPoint, rec, getPointerLength(), getPointerWidth(), getArc(), getNormalInset())) { rec = getRecForPosition(myPosition, false); - Rectangle lp = new Rectangle(new Point(0, 0), myLayeredPane.getSize()); + Rectangle lp = new Rectangle(new Point(myContainerInsets.left, myContainerInsets.top), myLayeredPane.getSize()); + lp.width -= myContainerInsets.right; + lp.height -= myContainerInsets.bottom; if (!lp.contains(rec)) { Rectangle2D currentSquare = lp.createIntersection(rec); @@ -435,15 +438,15 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi int getArc() { - return 6; + return 3; } int getPointerWidth() { - return 12; + return 11; } int getNormalInset() { - return 4; + return 3; } int getShadowShift() { @@ -451,7 +454,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } int getPointerLength() { - return 12; + return 8; } public void hide() { @@ -587,28 +590,20 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi final BalloonImpl balloon); public boolean isOkToHavePointer(Point targetPoint, Rectangle bounds, int pointerLength, int pointerWidth, int arc, int normalInset) { - if (bounds.contains(targetPoint)) { - return false; - } + if (bounds.x < targetPoint.x && bounds.x + bounds.width > targetPoint.x && bounds.y < targetPoint.y && bounds.y + bounds.height < targetPoint.y) return false; Rectangle pointless = getPointlessContentRec(bounds, pointerLength); - pointless.x += (arc + 1); - pointless.width -= (arc * 2 + 2); - pointless.y += (arc + 1); - pointless.height -= (arc * 2 + 2); - - int size = getDistanceToTarget(pointless, targetPoint); if (size < pointerLength) return false; Range balloonRange; Range pointerRange; if (isTopBottomPointer()) { - balloonRange = new Range(bounds.x, bounds.x + bounds.width); + balloonRange = new Range(bounds.x + arc, bounds.x + bounds.width - arc * 2); pointerRange = new Range(targetPoint.x - pointerWidth / 2, targetPoint.x + pointerWidth / 2); } else { - balloonRange = new Range(bounds.y, bounds.y + bounds.height); + balloonRange = new Range(bounds.y + arc, bounds.y + bounds.height - arc * 2); pointerRange = new Range(targetPoint.y - pointerWidth / 2, targetPoint.y + pointerWidth / 2); } diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index 80fa32009718..c5ae81445801 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -60,6 +60,7 @@ ide.tree.uiLockAttempt=250 ide.splitter.mouseZone=6 ide.tooltip.callout=true +ide.tooltip.useSystemColors=false ide.tabbedPane.bufferedPaint=true From a095b6b9bcba87648218b766d2ae305e8649f104 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 27 Aug 2010 16:48:15 +0400 Subject: [PATCH 3/6] tests for introduce variable functionality --- .../JavaIntroduceVariableTest.java | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 java/java-tests/testSrc/com/intellij/refactoring/JavaIntroduceVariableTest.java diff --git a/java/java-tests/testSrc/com/intellij/refactoring/JavaIntroduceVariableTest.java b/java/java-tests/testSrc/com/intellij/refactoring/JavaIntroduceVariableTest.java new file mode 100644 index 000000000000..4138987e82bc --- /dev/null +++ b/java/java-tests/testSrc/com/intellij/refactoring/JavaIntroduceVariableTest.java @@ -0,0 +1,76 @@ +/* + * Copyright 2000-2010 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.refactoring; + +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.JavaPsiFacade; +import com.intellij.psi.PsiElementFactory; +import com.intellij.psi.PsiExpression; +import com.intellij.psi.PsiType; +import com.intellij.psi.codeStyle.JavaCodeStyleManager; +import com.intellij.psi.codeStyle.SuggestedNameInfo; +import com.intellij.psi.codeStyle.VariableKind; +import com.intellij.psi.search.GlobalSearchScope; +import com.intellij.testFramework.LightCodeInsightTestCase; + +/** + * @author Konstantin Bulenkov + */ +public class JavaIntroduceVariableTest extends LightCodeInsightTestCase { + @Override + public void setUp() throws Exception { + super.setUp(); + } + + protected static void doTest(String expression, VariableKind kind, PsiType type, String...results) throws Exception { + final PsiElementFactory factory = JavaPsiFacade.getElementFactory(getProject()); + final PsiExpression expr = factory.createExpressionFromText(expression, null); + final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(getProject()); + final SuggestedNameInfo info = codeStyleManager.suggestVariableName(kind, null, expr, type); + assert info.names.length >= results.length : msg("Not found some variants", info.names, results); + for (int i = 0; i < results.length; i++) { + if (!results[i].equals(info.names[i])) { + throw new Exception(msg("", info.names, results)); + } + } + } + + private static String msg(String s, String[] names, String[] results) { + return s + ". Expected at first positions: [" + StringUtil.join(results, ",") + "] Found: [" + StringUtil.join(names, ",") + "]"; + } + + protected static void doTest(String expression, String...results) throws Exception { + doTest(expression, VariableKind.LOCAL_VARIABLE, results); + } + + protected static void doTest(String expression, VariableKind kind, String...results) throws Exception { + doTest(expression, kind, PsiType.getJavaLangString(getPsiManager(), GlobalSearchScope.allScope(getProject())), results); + } + + public void testIntroduceBasedOnLiterals() throws Exception { + doTest("getA(\"simple\")", "simple"); + doTest("getA(\"SimpleName\")", "simpleName", "name"); + doTest("getA(\"simpleName\")", "simpleName", "name"); + doTest("getA(\"simpleClass\")", "simpleClass", "aClass"); + doTest("getA(\"short\")", "aShort"); + doTest("getA(\"boolean\")", "aBoolean"); + doTest("getA().getB(1, \"name\")", "name"); + doTest("getA(\"NAME\")", "name"); + doTest("getA(\"name\")", VariableKind.STATIC_FINAL_FIELD, "NAME"); + doTest("getA(\"SimpleName\")", VariableKind.STATIC_FINAL_FIELD, "SIMPLE_NAME"); + doTest("get(getB().getA(\"SimpleName\").getC())", "simpleName", "name"); + } +} From 3430fa769efe4806bbefe92797f426e45941178a Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 27 Aug 2010 16:50:09 +0400 Subject: [PATCH 4/6] spelling --- .../com/intellij/refactoring/JavaIntroduceVariableTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/java-tests/testSrc/com/intellij/refactoring/JavaIntroduceVariableTest.java b/java/java-tests/testSrc/com/intellij/refactoring/JavaIntroduceVariableTest.java index 4138987e82bc..6e3806ed5550 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/JavaIntroduceVariableTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/JavaIntroduceVariableTest.java @@ -40,7 +40,7 @@ public class JavaIntroduceVariableTest extends LightCodeInsightTestCase { final PsiExpression expr = factory.createExpressionFromText(expression, null); final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(getProject()); final SuggestedNameInfo info = codeStyleManager.suggestVariableName(kind, null, expr, type); - assert info.names.length >= results.length : msg("Not found some variants", info.names, results); + assert info.names.length >= results.length : msg("Can't find some variants", info.names, results); for (int i = 0; i < results.length; i++) { if (!results[i].equals(info.names[i])) { throw new Exception(msg("", info.names, results)); From 39dda61358b14d475f431807ceed180ac2822218 Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Fri, 27 Aug 2010 16:55:26 +0400 Subject: [PATCH 5/6] tooltips: timing and sizing fixes --- .../intellij/openapi/ui/popup/Balloon.java | 3 + .../com/intellij/ide/IdeTooltipManager.java | 26 ++++-- .../src/com/intellij/ui/BalloonImpl.java | 86 +++++++++++-------- .../src/misc/registry.properties | 3 +- 4 files changed, 75 insertions(+), 43 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/Balloon.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/Balloon.java index 555766e1a0dd..872da477975b 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/popup/Balloon.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/Balloon.java @@ -38,6 +38,9 @@ public interface Balloon extends Disposable { void hide(); + boolean wasFadedIn(); + boolean wasFadedOut(); + enum Position { below, above, atLeft, atRight } diff --git a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java index f743d828fa9e..e8e95ea9b8e1 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java @@ -20,7 +20,6 @@ import com.intellij.openapi.components.ApplicationComponent; import com.intellij.openapi.ui.popup.Balloon; import com.intellij.openapi.ui.popup.BalloonBuilder; import com.intellij.openapi.ui.popup.JBPopupFactory; -import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.registry.RegistryValue; import com.intellij.openapi.util.registry.RegistryValueListener; @@ -52,6 +51,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener private int myX; private int myY; + private RegistryValue myMode; @NotNull @Override @@ -65,6 +65,8 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener @Override public void initComponent() { + myMode = Registry.get("ide.tooltip.mode"); + myIsEnabled = Registry.get("ide.tooltip.callout"); myIsEnabled.addListener(new RegistryValueListener.Adapter() { @Override @@ -98,8 +100,12 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener } } else if (me.getID() == MouseEvent.MOUSE_MOVED) { if (me.getComponent() == myCurrentComponent) { - myX = me.getX(); - myY = me.getY(); + if (myCurrentTip != null && myCurrentTip.wasFadedIn()) { + hideCurrent(); + } else { + myX = me.getX(); + myY = me.getY(); + } } else if (myCurrentComponent == null) { maybeShowFor(c, me); } @@ -137,7 +143,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener public void run() { show(c, e, tooltipText, toCenter); } - }, myShowDelay ? 1200 : 750); + }, myShowDelay ? 1500 : 900); } private void show(Component c, MouseEvent e, String tooltipText, boolean toCenter) { @@ -145,7 +151,17 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener myTipLabel.setText(tooltipText); - boolean useSystem = Registry.is("ide.tooltip.useSystemColors") || (!UIUtil.isUnderAquaLookAndFeel()); + boolean useSystem; + + if ("default".equalsIgnoreCase(myMode.asString())) { + useSystem = false; + } else if ("system".equalsIgnoreCase(myMode.asString())) { + useSystem = true; + } else if ("graphite".equalsIgnoreCase(myMode.asString())) { + useSystem = false; + } else { + useSystem = false; + } Color bg = useSystem ? UIManager.getColor("ToolTip.background") : new Color(100, 100, 100, 230); Color fg = useSystem ? UIManager.getColor("ToolTip.foreground") : Color.white; diff --git a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java index 0133d0dc5688..a29037b42655 100644 --- a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java @@ -122,6 +122,9 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi private PositionTracker myTracker; private int myAnimationCycle = 500; + private boolean myFadedIn; + private boolean myFadedOut; + private boolean isInsideBalloon(MouseEvent me) { if (!me.getComponent().isShowing()) return true; if (SwingUtilities.isDescendingFrom(me.getComponent(), myComp) || me.getComponent() == myComp) return true; @@ -261,7 +264,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi if (myShowPointer) { Rectangle rec = getRecForPosition(myPosition, true); - if (!myPosition.isOkToHavePointer(myTargetPoint, rec, getPointerLength(), getPointerWidth(), getArc(), getNormalInset())) { + if (!myPosition.isOkToHavePointer(myTargetPoint, rec, getPointerLength(myPosition), getPointerWidth(myPosition), getArc(), getNormalInset())) { rec = getRecForPosition(myPosition, false); Rectangle lp = new Rectangle(new Point(myContainerInsets.left, myContainerInsets.top), myLayeredPane.getSize()); @@ -294,7 +297,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi Rectangle rec = myComp.getBounds(); - if (myShowPointer && !myPosition.isOkToHavePointer(myTargetPoint, rec, getPointerLength(), getPointerWidth(), getArc(), getNormalInset())) { + if (myShowPointer && !myPosition.isOkToHavePointer(myTargetPoint, rec, getPointerLength(myPosition), getPointerWidth(myPosition), getArc(), getNormalInset())) { myShowPointer = false; myComp.removeAll(); myLayeredPane.remove(myComp); @@ -404,6 +407,8 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi myComp.clear(); myComp.repaint(); + myFadedIn = true; + startFadeoutTimer(); } else { @@ -441,20 +446,16 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi return 3; } - int getPointerWidth() { - return 11; + int getPointerWidth(Position position) { + return position.isTopBottomPointer() ? 14 : 11; } int getNormalInset() { return 3; } - int getShadowShift() { - return 10; - } - - int getPointerLength() { - return 8; + int getPointerLength(Position position) { + return position.isTopBottomPointer() ? 10 : 8; } public void hide() { @@ -464,6 +465,8 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi for (JBPopupListener each : myListeners) { each.onClosed(new LightweightWindowEvent(this)); } + + myFadedOut = true; } public void addListener(JBPopupListener listener) { @@ -651,7 +654,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } EmptyBorder createBorder(final BalloonImpl balloon) { - return new EmptyBorder(balloon.getPointerLength() + balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset()); + return new EmptyBorder(balloon.getPointerLength(this) + balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset()); } @Override @@ -665,23 +668,23 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } protected void convertBoundsToContent(final Rectangle bounds, final BalloonImpl balloon) { - bounds.y += balloon.getPointerLength(); - bounds.height -= balloon.getPointerLength() - 1; + bounds.y += balloon.getPointerLength(this); + bounds.height -= balloon.getPointerLength(this) - 1; } protected Shape getPointingShape(final Rectangle bounds, final Graphics2D g, final Point pointTarget, final BalloonImpl balloon) { final Shaper shaper = new Shaper(balloon, bounds, pointTarget, SwingUtilities.TOP); - shaper.line(balloon.getPointerWidth() / 2, balloon.getPointerLength()).toRightCurve().roundRightDown().toBottomCurve().roundLeftDown() + shaper.line(balloon.getPointerWidth(this) / 2, balloon.getPointerLength(this)).toRightCurve().roundRightDown().toBottomCurve().roundLeftDown() .toLeftCurve().roundLeftUp().toTopCurve().roundUpRight() - .lineTo(pointTarget.x - balloon.getPointerWidth() / 2, shaper.getCurrent().y).lineTo(pointTarget.x, pointTarget.y); + .lineTo(pointTarget.x - balloon.getPointerWidth(this) / 2, shaper.getCurrent().y).lineTo(pointTarget.x, pointTarget.y); shaper.close(); return shaper.getShape(); } protected Shape getShape(final Rectangle bounds, final Graphics2D g, final Point pointTarget, final BalloonImpl balloon) { - bounds.y += balloon.getPointerLength(); - bounds.height += balloon.getPointerLength(); + bounds.y += balloon.getPointerLength(this); + bounds.height += balloon.getPointerLength(this); return new RoundRectangle2D.Double(bounds.x, bounds.y, bounds.width, bounds.height, balloon.getArc(), balloon.getArc()); } @@ -702,7 +705,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi EmptyBorder createBorder(final BalloonImpl balloon) { return new EmptyBorder(balloon.getNormalInset(), balloon.getNormalInset(), - balloon.getPointerLength(), + balloon.getPointerLength(this), balloon.getNormalInset()); } @@ -717,21 +720,21 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } protected void convertBoundsToContent(final Rectangle bounds, final BalloonImpl balloon) { - bounds.height -= balloon.getPointerLength() - 1; + bounds.height -= balloon.getPointerLength(this) - 1; } protected Shape getShape(final Rectangle bounds, final Graphics2D g, final Point pointTarget, final BalloonImpl balloon) { - bounds.y -= balloon.getPointerLength(); - bounds.height -= balloon.getPointerLength(); + bounds.y -= balloon.getPointerLength(this); + bounds.height -= balloon.getPointerLength(this); return new RoundRectangle2D.Double(bounds.x, bounds.y, bounds.width, bounds.height, balloon.getArc(), balloon.getArc()); } @Override protected Shape getPointingShape(final Rectangle bounds, final Graphics2D g, final Point pointTarget, final BalloonImpl balloon) { final Shaper shaper = new Shaper(balloon, bounds, pointTarget, SwingUtilities.BOTTOM); - shaper.line(-balloon.getPointerWidth() / 2, -balloon.getPointerLength() + 1); + shaper.line(-balloon.getPointerWidth(this) / 2, -balloon.getPointerLength(this) + 1); shaper.toLeftCurve().roundLeftUp().toTopCurve().roundUpRight().toRightCurve().roundRightDown().toBottomCurve().line(0, 2) - .roundLeftDown().lineTo(pointTarget.x + balloon.getPointerWidth() / 2, shaper.getCurrent().y).lineTo(pointTarget.x, pointTarget.y) + .roundLeftDown().lineTo(pointTarget.x + balloon.getPointerWidth(this) / 2, shaper.getCurrent().y).lineTo(pointTarget.x, pointTarget.y) .close(); @@ -752,7 +755,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } EmptyBorder createBorder(final BalloonImpl balloon) { - return new EmptyBorder(balloon.getNormalInset(), balloon.getPointerLength() + balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset()); + return new EmptyBorder(balloon.getNormalInset(), balloon.getPointerLength(this) + balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset()); } @Override @@ -768,21 +771,21 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi @Override protected Shape getPointingShape(final Rectangle bounds, final Graphics2D g, final Point pointTarget, final BalloonImpl balloon) { final Shaper shaper = new Shaper(balloon, bounds, pointTarget, SwingUtilities.LEFT); - shaper.line(balloon.getPointerLength(), -balloon.getPointerWidth() / 2).toTopCurve().roundUpRight().toRightCurve().roundRightDown() + shaper.line(balloon.getPointerLength(this), -balloon.getPointerWidth(this) / 2).toTopCurve().roundUpRight().toRightCurve().roundRightDown() .toBottomCurve().roundLeftDown().toLeftCurve().roundLeftUp() - .lineTo(shaper.getCurrent().x, pointTarget.y + balloon.getPointerWidth() / 2).lineTo(pointTarget.x, pointTarget.y).close(); + .lineTo(shaper.getCurrent().x, pointTarget.y + balloon.getPointerWidth(this) / 2).lineTo(pointTarget.x, pointTarget.y).close(); return shaper.getShape(); } protected void convertBoundsToContent(final Rectangle bounds, final BalloonImpl balloon) { - bounds.x += balloon.getPointerLength(); - bounds.width -= balloon.getPointerLength(); + bounds.x += balloon.getPointerLength(this); + bounds.width -= balloon.getPointerLength(this); } protected Shape getShape(final Rectangle bounds, final Graphics2D g, final Point pointTarget, final BalloonImpl balloon) { - bounds.x += balloon.getPointerLength(); - bounds.width -= balloon.getPointerLength(); + bounds.x += balloon.getPointerLength(this); + bounds.width -= balloon.getPointerLength(this); return new RoundRectangle2D.Double(bounds.x, bounds.y, bounds.width, bounds.height, balloon.getArc(), balloon.getArc()); } } @@ -800,7 +803,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } EmptyBorder createBorder(final BalloonImpl balloon) { - return new EmptyBorder(balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset(), balloon.getPointerLength() + balloon.getNormalInset()); + return new EmptyBorder(balloon.getNormalInset(), balloon.getNormalInset(), balloon.getNormalInset(), balloon.getPointerLength(this) + balloon.getNormalInset()); } @Override @@ -814,20 +817,20 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi } protected void convertBoundsToContent(final Rectangle bounds, final BalloonImpl balloon) { - bounds.width -= balloon.getPointerLength(); + bounds.width -= balloon.getPointerLength(this); } @Override protected Shape getPointingShape(final Rectangle bounds, final Graphics2D g, final Point pointTarget, final BalloonImpl balloon) { final Shaper shaper = new Shaper(balloon, bounds, pointTarget, SwingUtilities.RIGHT); - shaper.line(-balloon.getPointerLength(), balloon.getPointerWidth() / 2); + shaper.line(-balloon.getPointerLength(this), balloon.getPointerWidth(this) / 2); shaper.toBottomCurve().roundLeftDown().toLeftCurve().roundLeftUp().toTopCurve().roundUpRight().toRightCurve().roundRightDown() - .lineTo(shaper.getCurrent().x, pointTarget.y - balloon.getPointerWidth() / 2).lineTo(pointTarget.x, pointTarget.y).close(); + .lineTo(shaper.getCurrent().x, pointTarget.y - balloon.getPointerWidth(this) / 2).lineTo(pointTarget.x, pointTarget.y).close(); return shaper.getShape(); } protected Shape getShape(final Rectangle bounds, final Graphics2D g, final Point pointTarget, final BalloonImpl balloon) { - bounds.width -= balloon.getPointerLength(); + bounds.width -= balloon.getPointerLength(this); return new RoundRectangle2D.Double(bounds.x, bounds.y, bounds.width, bounds.height, balloon.getArc(), balloon.getArc()); } } @@ -964,7 +967,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi if (isVisible() && myCloseRec.isVisible()) { Rectangle lpBounds = SwingUtilities.convertRectangle(getParent(), bounds, myLayeredPane); - lpBounds = myPosition.getPointlessContentRec(lpBounds, myBalloon.getPointerLength()); + lpBounds = myPosition.getPointlessContentRec(lpBounds, myBalloon.getPointerLength(myPosition)); int iconWidth = myBalloon.myCloseButton.getIconWidth(); int iconHeight = myBalloon.myCloseButton.getIconHeight(); @@ -1039,7 +1042,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi private int getTargetDelta(int effectiveSide) { - return effectiveSide == myTargetSide ? myBalloon.getPointerLength() : 0; + return effectiveSide == myTargetSide ? myBalloon.getPointerLength(myBalloon.myPosition) : 0; } public Shaper toRightCurve() { @@ -1131,4 +1134,13 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi frame.show(); } + @Override + public boolean wasFadedIn() { + return myFadedIn; + } + + @Override + public boolean wasFadedOut() { + return myFadedOut; + } } diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index c5ae81445801..c67c10f7dd20 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -60,7 +60,8 @@ ide.tree.uiLockAttempt=250 ide.splitter.mouseZone=6 ide.tooltip.callout=true -ide.tooltip.useSystemColors=false +ide.tooltip.mode=default +ide.tooltip.description=Available options are: default,system,graphite ide.tabbedPane.bufferedPaint=true From fdf2456fa37c8caf24b24a6f9ca0a9bf79a33ce3 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Fri, 27 Aug 2010 16:55:16 +0400 Subject: [PATCH 6/6] CodeStyle settings: javadoc --- .../psi/codeStyle/CodeStyleSettings.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java index af3a34464158..3ea548e59ce0 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java @@ -757,10 +757,29 @@ public class CodeStyleSettings implements Cloneable, JDOMExternalizable { */ public boolean SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE = false; - + /** + * "} else", "if()foo(); else" + * or + * "}else","if()foo();else" + */ public boolean SPACE_BEFORE_ELSE_KEYWORD = true; + /** + * "} while", "do foo(); while" + * or + * "}while","do foo();while" + */ public boolean SPACE_BEFORE_WHILE_KEYWORD = true; + /** + * "} catch" + * or + * "}catch" + */ public boolean SPACE_BEFORE_CATCH_KEYWORD = true; + /** + * "} finally" + * or + * "}finally" + */ public boolean SPACE_BEFORE_FINALLY_KEYWORD = true; public boolean SPACE_BEFORE_QUEST = true;