summaryrefslogtreecommitdiff
path: root/platform/platform-api/src/com/intellij/ui
diff options
context:
space:
mode:
Diffstat (limited to 'platform/platform-api/src/com/intellij/ui')
-rw-r--r--platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java11
-rw-r--r--platform/platform-api/src/com/intellij/ui/EditorNotifications.java8
-rw-r--r--platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java51
-rw-r--r--platform/platform-api/src/com/intellij/ui/SeparatorWithText.java13
-rw-r--r--platform/platform-api/src/com/intellij/ui/TableScrollingUtil.java14
-rw-r--r--platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java11
-rw-r--r--platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java203
-rw-r--r--platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java2
-rw-r--r--platform/platform-api/src/com/intellij/ui/table/JBTable.java40
-rw-r--r--platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java3
-rw-r--r--platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java1
11 files changed, 180 insertions, 177 deletions
diff --git a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java
index deb1f0545b74..2872a4592c01 100644
--- a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java
+++ b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java
@@ -36,11 +36,12 @@ import java.awt.*;
*/
public class EditorNotificationPanel extends JPanel {
protected final JLabel myLabel = new JLabel();
+ protected final JLabel myGearLabel = new JLabel();
protected final JPanel myLinksPanel;
public EditorNotificationPanel() {
super(new BorderLayout());
- setBorder(BorderFactory.createEmptyBorder(1, 15, 1, 15));
+ setBorder(BorderFactory.createEmptyBorder(1, 10, 1, 10));
setPreferredSize(new Dimension(-1, 24));
@@ -48,7 +49,13 @@ public class EditorNotificationPanel extends JPanel {
myLinksPanel = new JPanel(new FlowLayout());
myLinksPanel.setBackground(getBackground());
- add(myLinksPanel, BorderLayout.EAST);
+
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBackground(getBackground());
+ myGearLabel.setBorder(IdeBorderFactory.createEmptyBorder(0, 3, 0, 0));
+ panel.add(myLinksPanel, BorderLayout.WEST);
+ panel.add(myGearLabel, BorderLayout.EAST);
+ add(panel, BorderLayout.EAST);
}
public void setText(String text) {
diff --git a/platform/platform-api/src/com/intellij/ui/EditorNotifications.java b/platform/platform-api/src/com/intellij/ui/EditorNotifications.java
index 4db32d94dd30..6805266e57ad 100644
--- a/platform/platform-api/src/com/intellij/ui/EditorNotifications.java
+++ b/platform/platform-api/src/com/intellij/ui/EditorNotifications.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -31,10 +32,11 @@ import javax.swing.*;
public abstract class EditorNotifications extends AbstractProjectComponent {
public abstract static class Provider<T extends JComponent> {
+ @NotNull
public abstract Key<T> getKey();
@Nullable
- public abstract T createNotificationPanel(VirtualFile file, FileEditor fileEditor);
+ public abstract T createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor);
}
public static EditorNotifications getInstance(Project project) {
@@ -45,7 +47,7 @@ public abstract class EditorNotifications extends AbstractProjectComponent {
super(project);
}
- public abstract void updateNotifications(final VirtualFile file);
+ public abstract void updateNotifications(@NotNull VirtualFile file);
public abstract void updateAllNotifications();
diff --git a/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java b/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java
index 2293d45bf329..3ddbf47028f4 100644
--- a/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java
+++ b/platform/platform-api/src/com/intellij/ui/GroupedElementsRenderer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,7 +15,9 @@
*/
package com.intellij.ui;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.components.panels.OpaquePanel;
+import com.intellij.util.ui.GraphicsUtil;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
@@ -24,16 +26,43 @@ import javax.swing.border.EmptyBorder;
import javax.swing.tree.TreeCellRenderer;
import java.awt.*;
+import static javax.swing.SwingConstants.CENTER;
+import static javax.swing.SwingConstants.LEFT;
+
public abstract class GroupedElementsRenderer {
public static final Color POPUP_SEPARATOR_FOREGROUND = new JBColor(Color.gray.brighter(), Gray._43);
public static final Color POPUP_SEPARATOR_TEXT_FOREGROUND = Color.gray;
public static final Color SELECTED_FRAME_FOREGROUND = Color.black;
- protected SeparatorWithText mySeparatorComponent = new SeparatorWithText();
+ protected SeparatorWithText mySeparatorComponent = new SeparatorWithText() {
+ @Override
+ protected void paintComponent(Graphics g) {
+ if (Registry.is("ide.new.project.settings")) {
+ g.setColor(POPUP_SEPARATOR_FOREGROUND);
+ Rectangle viewR = new Rectangle(0, getVgap(), getWidth() - 1, getHeight() - getVgap() - 1);
+ Rectangle iconR = new Rectangle();
+ Rectangle textR = new Rectangle();
+ String s = SwingUtilities
+ .layoutCompoundLabel(g.getFontMetrics(), getCaption(), null, CENTER,
+ LEFT,
+ CENTER,
+ LEFT,
+ viewR, iconR, textR, 0);
+ GraphicsUtil.setupAAPainting(g);
+ g.setColor(Gray._255.withAlpha(80));
+ g.drawString(s, textR.x + 10, textR.y + 1 + g.getFontMetrics().getAscent());
+ g.setColor(new Color(0x5F6D7B));
+ g.drawString(s, textR.x + 10, textR.y + g.getFontMetrics().getAscent());
+ } else {
+ super.paintComponent(g);
+ }
+ }
+ };
+
protected JComponent myComponent;
protected MyComponent myRendererComponent;
- protected ErrorLabel myTextLabel;
+ protected JLabel myTextLabel;
public GroupedElementsRenderer() {
@@ -58,14 +87,16 @@ public abstract class GroupedElementsRenderer {
myTextLabel.setIcon(icon);
myTextLabel.setDisabledIcon(disabledIcon);
+ if (myTextLabel instanceof EngravedLabel) {
+ ((EngravedLabel)myTextLabel).setShadowColor(isSelected ? UIUtil.getTreeSelectionBackground() : null);
+ }
if (isSelected) {
- myComponent.setBorder(getSelectedBorder());
+ //myComponent.setBorder(getSelectedBorder());
setSelected(myComponent);
setSelected(myTextLabel);
- }
- else {
- myComponent.setBorder(getBorder());
+ } else {
+ //myComponent.setBorder(getBorder());
setDeselected(myComponent);
setDeselected(myTextLabel);
}
@@ -98,7 +129,7 @@ public abstract class GroupedElementsRenderer {
protected final void setDeselected(JComponent aComponent) {
aComponent.setBackground(getBackground());
- aComponent.setForeground(getForeground());
+ aComponent.setForeground(Registry.is("ide.new.project.settings") ? Gray._60 : getForeground());
}
protected abstract Color getSelectionBackground();
@@ -139,12 +170,12 @@ public abstract class GroupedElementsRenderer {
}
@Override
- protected final Color getBackground() {
+ protected Color getBackground() {
return UIUtil.getListBackground();
}
@Override
- protected final Color getForeground() {
+ protected Color getForeground() {
return UIUtil.getListForeground();
}
}
diff --git a/platform/platform-api/src/com/intellij/ui/SeparatorWithText.java b/platform/platform-api/src/com/intellij/ui/SeparatorWithText.java
index 059875a4acfc..2633ef31c9f3 100644
--- a/platform/platform-api/src/com/intellij/ui/SeparatorWithText.java
+++ b/platform/platform-api/src/com/intellij/ui/SeparatorWithText.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -20,7 +20,8 @@ import com.intellij.util.ui.UIUtil;
import javax.swing.*;
import java.awt.*;
-import static javax.swing.SwingConstants.*;
+import static javax.swing.SwingConstants.CENTER;
+import static javax.swing.SwingConstants.LEFT;
public class SeparatorWithText extends JComponent {
@@ -34,11 +35,11 @@ public class SeparatorWithText extends JComponent {
setFont(getFont().deriveFont(Font.BOLD));
}
- private static int getVgap() {
+ protected static int getVgap() {
return UIUtil.isUnderNativeMacLookAndFeel() ? 1 : 3;
}
- private static int getHgap() {
+ protected static int getHgap() {
return 3;
}
@@ -109,6 +110,10 @@ public class SeparatorWithText extends JComponent {
}
}
+ protected String getCaption() {
+ return myCaption;
+ }
+
public void setCaption(String captionAboveOf) {
myCaption = captionAboveOf;
}
diff --git a/platform/platform-api/src/com/intellij/ui/TableScrollingUtil.java b/platform/platform-api/src/com/intellij/ui/TableScrollingUtil.java
index 3d816000de70..695bad005135 100644
--- a/platform/platform-api/src/com/intellij/ui/TableScrollingUtil.java
+++ b/platform/platform-api/src/com/intellij/ui/TableScrollingUtil.java
@@ -123,14 +123,13 @@ public class TableScrollingUtil {
}
- public static void moveDown(JTable list, @JdkConstants.InputEventMask int modifiers) {
+ public static void moveDown(JTable list, @JdkConstants.InputEventMask int modifiers, boolean cycleScrolling) {
int size = list.getModel().getRowCount();
if (size == 0) {
return;
}
final ListSelectionModel selectionModel = list.getSelectionModel();
int index = selectionModel.getLeadSelectionIndex();
- boolean cycleScrolling = UISettings.getInstance().CYCLE_SCROLLING;
final int indexToSelect;
if (index < size - 1) {
indexToSelect = index + 1;
@@ -153,11 +152,10 @@ public class TableScrollingUtil {
}
}
- public static void moveUp(JTable list, @JdkConstants.InputEventMask int modifiers) {
+ public static void moveUp(JTable list, @JdkConstants.InputEventMask int modifiers, boolean cycleScrolling) {
int size = list.getModel().getRowCount();
final ListSelectionModel selectionModel = list.getSelectionModel();
int index = selectionModel.getMinSelectionIndex();
- boolean cycleScrolling = UISettings.getInstance().CYCLE_SCROLLING;
int indexToSelect;
if (index > 0) {
indexToSelect = index - 1;
@@ -249,6 +247,10 @@ public class TableScrollingUtil {
}
public static void installActions(final JTable list) {
+ installActions(list, UISettings.getInstance().CYCLE_SCROLLING);
+ }
+
+ public static void installActions(final JTable list, final boolean cycleScrolling) {
ActionMap actionMap = list.getActionMap();
actionMap.put(ListScrollingUtil.SCROLLUP_ACTION_ID, new AbstractAction() {
public void actionPerformed(ActionEvent e) {
@@ -262,12 +264,12 @@ public class TableScrollingUtil {
});
actionMap.put(ListScrollingUtil.SELECT_PREVIOUS_ROW_ACTION_ID, new AbstractAction() {
public void actionPerformed(ActionEvent e) {
- moveUp(list, e.getModifiers());
+ moveUp(list, e.getModifiers(), cycleScrolling);
}
});
actionMap.put(ListScrollingUtil.SELECT_NEXT_ROW_ACTION_ID, new AbstractAction() {
public void actionPerformed(ActionEvent e) {
- moveDown(list, e.getModifiers());
+ moveDown(list, e.getModifiers(), cycleScrolling);
}
});
actionMap.put(ListScrollingUtil.SELECT_LAST_ROW_ACTION_ID, new AbstractAction() {
diff --git a/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java b/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java
index 24cb28001fed..80e3d1eec7fb 100644
--- a/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java
+++ b/platform/platform-api/src/com/intellij/ui/ToolbarDecorator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,10 +15,7 @@
*/
package com.intellij.ui;
-import com.intellij.openapi.actionSystem.ActionGroup;
-import com.intellij.openapi.actionSystem.ActionToolbar;
-import com.intellij.openapi.actionSystem.ActionToolbarPosition;
-import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
@@ -296,7 +293,9 @@ public abstract class ToolbarDecorator implements CommonActionsPanel.ListenerFac
public ToolbarDecorator setActionGroup(@NotNull ActionGroup actionGroup) {
AnAction[] actions = actionGroup.getChildren(null);
for (AnAction action : actions) {
- addExtraAction(AnActionButton.fromAction(action));
+ if (!(action instanceof Separator)) {
+ addExtraAction(AnActionButton.fromAction(action));
+ }
}
return this;
}
diff --git a/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java b/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java
index e0c326ad1edb..83944a51755d 100644
--- a/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java
+++ b/platform/platform-api/src/com/intellij/ui/components/JBScrollPane.java
@@ -33,7 +33,10 @@ import java.lang.reflect.Method;
public class JBScrollPane extends JScrollPane {
private int myViewportBorderWidth = -1;
- private JLayeredPane myLayeredPane;
+ private boolean myHasOverlayScrollbars;
+
+ private int myOverriddenVPolicy = -1;
+ private int myOverriddenHPolicy = -1;
public JBScrollPane(int viewportWidth) {
init(false);
@@ -64,89 +67,14 @@ public class JBScrollPane extends JScrollPane {
if (c == null) return null;
if (!(c instanceof JViewport)) {
- // if asked for a viewport child, take a viewport.
- // If not (e.g asked for a scrollbar), go straight to JLayeredPane
Container vp = c.getParent();
if (vp instanceof JViewport) c = vp;
}
c = c.getParent();
- if (c instanceof JLayeredPane) {
- c = c.getParent();
- }
- if (!(c instanceof JBScrollPane)) return null;
-
- return (JBScrollPane)c;
- }
-
- @Override
- public void setVerticalScrollBar(JScrollBar c) {
- JScrollBar old = getVerticalScrollBar();
- super.setVerticalScrollBar(c);
- transferToLayeredPane(old, c, ScrollPaneConstants.VERTICAL_SCROLLBAR);
- }
-
- @Override
- public void setHorizontalScrollBar(JScrollBar c) {
- JScrollBar old = getHorizontalScrollBar();
- super.setHorizontalScrollBar(c);
- transferToLayeredPane(old, c, ScrollPaneConstants.HORIZONTAL_SCROLLBAR);
- }
-
- @Override
- public void setColumnHeader(JViewport c) {
- JViewport old = getColumnHeader();
- super.setColumnHeader(c);
- transferToLayeredPane(old, c, ScrollPaneConstants.COLUMN_HEADER);
- }
+ if (!(c instanceof JScrollPane)) return null;
- @Override
- public void setRowHeader(JViewport c) {
- JViewport old = getRowHeader();
- super.setRowHeader(c);
- transferToLayeredPane(old, c, ScrollPaneConstants.ROW_HEADER);
- }
-
- @Override
- public void setViewport(JViewport c) {
- JViewport old = getViewport();
- super.setViewport(c);
- transferToLayeredPane(old, c, ScrollPaneConstants.VIEWPORT);
- }
-
- @Override
- public void setCorner(String key, Component c) {
- Component old = getCorner(key);
- super.setCorner(key, c);
- transferToLayeredPane(old, c, key);
- }
-
- private void transferToLayeredPane(Component old, Component c, String key) {
- if (!ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) return;
-
- JLayeredPane pane = getLayoutPane();
- LayoutManager layout = getLayout();
-
- if (old != null && old != c) {
- pane.remove(old);
- layout.removeLayoutComponent(old);
- }
-
- if (c != null) {
- if (ScrollPaneConstants.VERTICAL_SCROLLBAR.equals(key) || ScrollPaneConstants.HORIZONTAL_SCROLLBAR.equals(key)) {
- pane.setLayer(c, JLayeredPane.PALETTE_LAYER);
- }
- pane.add(c);
- layout.addLayoutComponent(key, c);
- }
- }
-
- @NotNull
- private JLayeredPane getLayoutPane() {
- if (myLayeredPane == null) {
- myLayeredPane = new JLayeredPane();
- }
- return myLayeredPane;
+ return (JScrollPane)c;
}
private void init() {
@@ -154,9 +82,6 @@ public class JBScrollPane extends JScrollPane {
}
private void init(boolean setupCorners) {
- if (ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) {
- add(getLayoutPane());
- }
setLayout(new ScrollPaneLayout());
if (setupCorners) {
@@ -178,6 +103,11 @@ public class JBScrollPane extends JScrollPane {
updateViewportBorder();
}
+ @Override
+ public boolean isOptimizedDrawingEnabled() {
+ return !myHasOverlayScrollbars;
+ }
+
private void updateViewportBorder() {
setViewportBorder(new ViewportBorder(myViewportBorderWidth >= 0 ? myViewportBorderWidth : 1));
}
@@ -201,24 +131,75 @@ public class JBScrollPane extends JScrollPane {
return new JBViewport();
}
+ @Override
+ public int getHorizontalScrollBarPolicy() {
+ // See layout() for explanation
+ //noinspection MagicConstant
+ return myOverriddenHPolicy != -1 ? myOverriddenHPolicy : super.getHorizontalScrollBarPolicy();
+ }
+
+ @Override
+ public int getVerticalScrollBarPolicy() {
+ // See layout() for explanation
+ //noinspection MagicConstant
+ return myOverriddenVPolicy != -1 ? myOverriddenVPolicy : super.getVerticalScrollBarPolicy();
+ }
+
@SuppressWarnings("deprecation")
@Override
public void layout() {
+ LayoutManager layout = getLayout();
+ ScrollPaneLayout scrollLayout = layout instanceof ScrollPaneLayout ? (ScrollPaneLayout)layout : null;
+
+ // Logic here is a workaround necessary to support OS X overlaid scrollbars.
+
+ int oldHPolicy = -1;
+ int oldVPolicy = -1;
+ if (scrollLayout != null) {
+ // First, we override scrollbar policy to HORIZONTAL_SCROLLBAR_AS_NEEDED so JScrollPane could correctly lay them out.
+ // We do so only when policy is ALWAYS so they could be hidden by JScrollPane when necessary.
+ // Also, we only override when scrollbar is an overlay scrollbar.
+ // (The related problem is IDEA-123688)
+ if (isOverlaidScrollbar(getHorizontalScrollBar())) {
+ oldHPolicy = scrollLayout.getHorizontalScrollBarPolicy();
+ if (oldHPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
+ scrollLayout.setHorizontalScrollBarPolicy(myOverriddenHPolicy = HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ }
+ }
+
+ if (isOverlaidScrollbar(getVerticalScrollBar())) {
+ oldVPolicy = scrollLayout.getVerticalScrollBarPolicy();
+ if (oldVPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
+ scrollLayout.setVerticalScrollBarPolicy(myOverriddenVPolicy = VERTICAL_SCROLLBAR_AS_NEEDED);
+ }
+ }
+ }
+
+ // Now we let JScrollPane layout everything as necessary
super.layout();
- if (!ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) return;
-
- LayoutManager layout = getLayout();
- if (layout instanceof ScrollPaneLayout && myLayeredPane != null) {
- relayoutScrollbars(this, (ScrollPaneLayout)layout, myLayeredPane);
+ if (scrollLayout != null) {
+ // Now it's time to jump in and expand the viewport so it fits the whole area
+ // (taking into consideration corners, headers and other stuff).
+ myHasOverlayScrollbars = relayoutScrollbars(
+ this, scrollLayout,
+ myHasOverlayScrollbars // If last time we did relayouting, we should restore it back.
+ );
+
+ // Now we restore overridden policies as though nothing happened at all.
+ if (oldHPolicy != -1) scrollLayout.setHorizontalScrollBarPolicy(oldHPolicy);
+ if (oldVPolicy != -1) scrollLayout.setVerticalScrollBarPolicy(oldVPolicy);
+ myOverriddenHPolicy = -1;
+ myOverriddenVPolicy = -1;
+ }
+ else {
+ myHasOverlayScrollbars = false;
}
}
- private static void relayoutScrollbars(@NotNull JComponent container,
- @NotNull ScrollPaneLayout layout,
- @NotNull JLayeredPane layeredPane) {
+ private static boolean relayoutScrollbars(@NotNull JComponent container, @NotNull ScrollPaneLayout layout, boolean forceRelayout) {
JViewport viewport = layout.getViewport();
- if (viewport == null) return;
+ if (viewport == null) return false;
JScrollBar vsb = layout.getVerticalScrollBar();
JScrollBar hsb = layout.getHorizontalScrollBar();
@@ -227,22 +208,29 @@ public class JBScrollPane extends JScrollPane {
Rectangle viewportBounds = viewport.getBounds();
- boolean extendsViewportUnderVScrollbar = vsb != null && shouldExtendViewportUnderScrollbar(vsb);
- boolean extendsViewportUnderHScrollbar = hsb != null && shouldExtendViewportUnderScrollbar(hsb);
-
- if (extendsViewportUnderVScrollbar) {
+ boolean extendViewportUnderVScrollbar = vsb != null && shouldExtendViewportUnderScrollbar(vsb);
+ boolean extendViewportUnderHScrollbar = hsb != null && shouldExtendViewportUnderScrollbar(hsb);
+ boolean hasOverlayScrollbars = extendViewportUnderVScrollbar || extendViewportUnderHScrollbar;
+
+ if (!hasOverlayScrollbars && !forceRelayout) return false;
+
+ container.setComponentZOrder(viewport, container.getComponentCount() - 1);
+ if (vsb != null) container.setComponentZOrder(vsb, 0);
+ if (hsb != null) container.setComponentZOrder(hsb, 0);
+
+ if (extendViewportUnderVScrollbar) {
viewportBounds.x = Math.min(viewportBounds.x, vsb.getX());
- viewportBounds.width = Math.max(viewportBounds.width, vsb.getX() + vsb.getWidth());
+ viewportBounds.width = vsb.getX() + vsb.getWidth() - viewportBounds.x;
}
- if (extendsViewportUnderHScrollbar) {
+ if (extendViewportUnderHScrollbar) {
viewportBounds.y = Math.min(viewportBounds.y, hsb.getY());
- viewportBounds.height = Math.max(viewportBounds.height, hsb.getY() + hsb.getHeight());
+ viewportBounds.height = hsb.getY() + hsb.getHeight() - viewportBounds.y;
}
- if (extendsViewportUnderVScrollbar) {
+ if (extendViewportUnderVScrollbar) {
if (hsb != null) {
Rectangle scrollbarBounds = hsb.getBounds();
- scrollbarBounds.width = viewportBounds.width - scrollbarBounds.x;
+ scrollbarBounds.width = viewportBounds.x + viewportBounds.width - scrollbarBounds.x;
hsb.setBounds(scrollbarBounds);
}
if (colHead != null) {
@@ -253,10 +241,10 @@ public class JBScrollPane extends JScrollPane {
hideFromView(layout.getCorner(UPPER_RIGHT_CORNER));
hideFromView(layout.getCorner(LOWER_RIGHT_CORNER));
}
- if (extendsViewportUnderHScrollbar) {
+ if (extendViewportUnderHScrollbar) {
if (vsb != null) {
Rectangle scrollbarBounds = vsb.getBounds();
- scrollbarBounds.height = viewportBounds.height - scrollbarBounds.y;
+ scrollbarBounds.height = viewportBounds.y + viewportBounds.height - scrollbarBounds.y;
vsb.setBounds(scrollbarBounds);
}
if (rowHead != null) {
@@ -270,14 +258,19 @@ public class JBScrollPane extends JScrollPane {
}
viewport.setBounds(viewportBounds);
- Insets insets = container.getInsets();
- if (insets == null) insets = new Insets(0, 0, 0, 0);
- layeredPane.setBounds(0, 0, container.getWidth() - insets.right, container.getHeight() - insets.bottom);
+
+ return hasOverlayScrollbars;
}
private static boolean shouldExtendViewportUnderScrollbar(@Nullable JScrollBar scrollbar) {
if (scrollbar == null || !scrollbar.isVisible()) return false;
- ScrollBarUI vsbUI = scrollbar.getUI();
+ return isOverlaidScrollbar(scrollbar);
+ }
+
+ private static boolean isOverlaidScrollbar(@Nullable JScrollBar scrollbar) {
+ if (!ButtonlessScrollBarUI.isMacOverlayScrollbarSupported()) return false;
+
+ ScrollBarUI vsbUI = scrollbar == null ? null : scrollbar.getUI();
return vsbUI instanceof ButtonlessScrollBarUI && !((ButtonlessScrollBarUI)vsbUI).alwaysShowTrack();
}
diff --git a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java
index 1c4cd484ac61..51fb54a5baa1 100644
--- a/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java
+++ b/platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java
@@ -57,7 +57,7 @@ public class SpeedSearch {
}
else {
final char ch = e.getKeyChar();
- if (Character.isLetterOrDigit(ch) || ch == ' ' || ch == '*' || ch == '_' || ch == '-' || ch == '"' || ch == '\'') {
+ if (Character.isLetterOrDigit(ch) || ch == ' ' || ch == '*' || ch == '_' || ch == '-' || ch == '"' || ch == '\'' || ch == '/' || ch == '.') {
type(Character.toString(ch));
e.consume();
}
diff --git a/platform/platform-api/src/com/intellij/ui/table/JBTable.java b/platform/platform-api/src/com/intellij/ui/table/JBTable.java
index f8e91cb5cebf..d8736f6fc08e 100644
--- a/platform/platform-api/src/com/intellij/ui/table/JBTable.java
+++ b/platform/platform-api/src/com/intellij/ui/table/JBTable.java
@@ -19,7 +19,6 @@ import com.intellij.Patches;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.ui.*;
-import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.components.JBViewport;
import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.util.ui.*;
@@ -135,45 +134,6 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component
}
@Override
- protected void configureEnclosingScrollPane() {
- super.configureEnclosingScrollPane();
-
- // base class' method doesn't expect layered pane between the viewport and the scrollpane (required for mac scrollbars)
- JBScrollPane sp = getJBScrollPane();
- if (sp == null) return;
-
- JViewport viewport = sp.getViewport();
- if (viewport == null || viewport.getView() != this) return;
- sp.setColumnHeaderView(getTableHeader());
- }
-
- @Override
- protected void unconfigureEnclosingScrollPane() {
- super.unconfigureEnclosingScrollPane();
-
- JBScrollPane sp = getJBScrollPane();
- if (sp == null) return;
-
- JViewport viewport = sp.getViewport();
- if (viewport == null || viewport.getView() != this) return;
- sp.setColumnHeaderView(null);
- }
-
- private JBScrollPane getJBScrollPane() {
- Container p = getParent();
- if (p instanceof JViewport) {
- Container gp = p.getParent();
- if (gp instanceof JLayeredPane) {
- Container ggp = gp.getParent();
- if (ggp instanceof JBScrollPane) {
- return (JBScrollPane)ggp;
- }
- }
- }
- return null;
- }
-
- @Override
public int getRowHeight() {
if (myRowHeightIsComputing) {
return super.getRowHeight();
diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java
index 1cb59a862179..532c95a52a17 100644
--- a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java
+++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java
@@ -957,6 +957,9 @@ public class JBTabsImpl extends JComponent
@NotNull
private ActionCallback removeDeferred() {
+ if (myDeferredToRemove.isEmpty()) {
+ return ActionCallback.DONE;
+ }
final ActionCallback callback = new ActionCallback();
final long executionRequest = ++myRemoveDeferredRequest;
diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java b/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java
index 0f62f53dab8c..169b5d57479b 100644
--- a/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java
+++ b/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java
@@ -753,6 +753,7 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith
UIUtil.setLineStyleAngled(this);
}
+ @NotNull
public <T> T[] getSelectedNodes(Class<T> nodeType, @Nullable NodeFilter<T> filter) {
TreePath[] paths = getSelectionPaths();
if (paths == null) return (T[])Array.newInstance(nodeType, 0);