Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
284,400
SimpleTextAttributes () { if (myDefaultAttributes == null) { int style = (myDefaultStyle != -1 ? myDefaultStyle : SimpleTextAttributes.STYLE_PLAIN) | SimpleTextAttributes.STYLE_USE_EFFECT_COLOR; if (editorAttributes != null) { SimpleTextAttributes attr = SimpleTextAttributes.fromTextAttributes(editorAttributes); attr = SimpleTextAttributes.merge(new SimpleTextAttributes(style, myDefaultForeground), attr); myDefaultAttributes = attr; } else { myDefaultAttributes = new SimpleTextAttributes(style, myDefaultForeground); } } return myDefaultAttributes; }
getDefaultAttributes
284,401
TabInfo (final boolean invalidate) { final String old = myText.toString(); myText.clear(); if (invalidate) { myChangeSupport.firePropertyChange(TEXT, old, myText.toString()); } return this; }
clearText
284,402
TabInfo (@NotNull @NlsContexts.Label String fragment, @NotNull SimpleTextAttributes attributes) { final String old = myText.toString(); myText.append(fragment, attributes); myChangeSupport.firePropertyChange(TEXT, old, myText.toString()); return this; }
append
284,403
TabInfo (Icon icon) { Icon old = myIcon; if (!Objects.equals(old, icon)) { myIcon = icon; myChangeSupport.firePropertyChange(ICON, old, icon); } return this; }
setIcon
284,404
TabInfo (Component c) { if (myComponent != c) { JComponent old = myComponent; myComponent = (JComponent)c; myChangeSupport.firePropertyChange(COMPONENT, old, myComponent); } return this; }
setComponent
284,405
ActionGroup () { return myGroup; }
getGroup
284,406
JComponent () { return myComponent; }
getComponent
284,407
boolean () { return ClientProperty.isTrue(getComponent(), JBTabsImpl.PINNED); }
isPinned
284,408
SimpleColoredText () { return myText; }
getColoredText
284,409
Icon () { return myIcon; }
getIcon
284,410
String () { return myPlace; }
getPlace
284,411
TabInfo (JComponent comp) { mySideComponent = comp; return this; }
setSideComponent
284,412
JComponent () { return mySideComponent; }
getSideComponent
284,413
TabInfo (ActionGroup group, @NonNls String place) { ActionGroup old = myGroup; myGroup = group; myPlace = place; myChangeSupport.firePropertyChange(ACTION_GROUP, old, myGroup); return this; }
setActions
284,414
TabInfo (JComponent c) { myActionsContextComponent = c; return this; }
setActionsContextComponent
284,415
JComponent () { return myActionsContextComponent; }
getActionsContextComponent
284,416
TabInfo (final Object object) { myObject = object; return this; }
setObject
284,417
Object () { return myObject; }
getObject
284,418
JComponent () { return myPreferredFocusableComponent != null ? myPreferredFocusableComponent : myComponent; }
getPreferredFocusableComponent
284,419
TabInfo (final JComponent component) { myPreferredFocusableComponent = component; return this; }
setPreferredFocusableComponent
284,420
void (final JComponent owner) { myLastFocusOwner = owner == null ? null : new WeakReference<>(owner); }
setLastFocusOwner
284,421
ActionGroup () { return myTabLabelActions; }
getTabLabelActions
284,422
String () { return myTabActionPlace; }
getTabActionPlace
284,423
TabInfo (final ActionGroup tabActions, @NotNull String place) { ActionGroup old = myTabLabelActions; myTabLabelActions = tabActions; myTabActionPlace = place; myChangeSupport.firePropertyChange(TAB_ACTION_GROUP, old, myTabLabelActions); return this; }
setTabLabelActions
284,424
TabInfo (final @Nullable ActionGroup tabPaneActions) { myTabPaneActions = tabPaneActions; return this; }
setTabPaneActions
284,425
TabInfo (final AlertIcon alertIcon) { AlertIcon old = myAlertIcon; myAlertIcon = alertIcon; myChangeSupport.firePropertyChange(ALERT_ICON, old, myAlertIcon); return this; }
setAlertIcon
284,426
void () { myAlertRequested = true; myChangeSupport.firePropertyChange(ALERT_STATUS, null, true); }
fireAlert
284,427
void () { myAlertRequested = false; myChangeSupport.firePropertyChange(ALERT_STATUS, null, false); }
stopAlerting
284,428
int () { return myBlinkCount; }
getBlinkCount
284,429
void (final int blinkCount) { myBlinkCount = blinkCount; }
setBlinkCount
284,430
String () { return getText(); }
toString
284,431
AlertIcon () { return myAlertIcon == null ? DEFAULT_ALERT_ICON : myAlertIcon; }
getAlertIcon
284,432
void () { myAlertRequested = false; }
resetAlertRequest
284,433
boolean () { return myAlertRequested; }
isAlertRequested
284,434
void (boolean hidden) { boolean old = myHidden; myHidden = hidden; myChangeSupport.firePropertyChange(HIDDEN, old, myHidden); }
setHidden
284,435
boolean () { return myHidden; }
isHidden
284,436
void (boolean enabled) { boolean old = myEnabled; myEnabled = enabled; myChangeSupport.firePropertyChange(ENABLED, old, myEnabled); }
setEnabled
284,437
boolean () { return myEnabled; }
isEnabled
284,438
TabInfo (@SimpleTextAttributes.StyleAttributeConstant int style) { myDefaultStyle = style; myDefaultAttributes = null; update(); return this; }
setDefaultStyle
284,439
TabInfo (final Color fg) { myDefaultForeground = fg; myDefaultAttributes = null; update(); return this; }
setDefaultForeground
284,440
Color () { return myDefaultForeground; }
getDefaultForeground
284,441
TabInfo (@Nullable TextAttributes attributes) { editorAttributes = attributes; myDefaultAttributes = null; update(); return this; }
setDefaultAttributes
284,442
void () { setText(getText()); }
update
284,443
void () { myDefaultAttributes = null; update(); }
revalidate
284,444
TabInfo (@NlsContexts.Tooltip String text) { String old = myTooltipText; if (!Objects.equals(old, text)) { myTooltipText = text; myChangeSupport.firePropertyChange(TEXT, old, myTooltipText); } return this; }
setTooltipText
284,445
TabInfo (Color color) { Color old = myTabColor; if (!Comparing.equal(color, old)) { myTabColor = color; myChangeSupport.firePropertyChange(TAB_COLOR, old, color); } return this; }
setTabColor
284,446
Color () { return myTabColor; }
getTabColor
284,447
TabInfo (Queryable queryable) { myQueryable = queryable; return this; }
setTestableUi
284,448
void (@NotNull Map<? super String, ? super String> info) { if (myQueryable != null) { myQueryable.putInfo(info); } }
putInfo
284,449
TabInfo (DragOutDelegate delegate) { myDragOutDelegate = delegate; return this; }
setDragOutDelegate
284,450
boolean () { return myDragOutDelegate != null; }
canBeDraggedOut
284,451
DragOutDelegate () { return myDragOutDelegate; }
getDragOutDelegate
284,452
void (@Nullable TabInfo previousSelection) { myPreviousSelection = new WeakReference<>(previousSelection); }
setPreviousSelection
284,453
DragDelegate () { return myDragDelegate; }
getDragDelegate
284,454
void (DragDelegate dragDelegate) { myDragDelegate = dragDelegate; }
setDragDelegate
284,455
int () { return getTabsHeight(NEW_TAB_VERTICAL_PADDING); }
getTabsHeight
284,456
int (int verticalPadding) { @SuppressWarnings("HardCodedStringLiteral") JLabel xxx = new JLabel("XXX"); xxx.setFont(getLabelFont()); return xxx.getPreferredSize().height + (verticalPadding * 2); }
getTabsHeight
284,457
Font () { UISettings uiSettings = UISettings.getInstance(); Font font = JBUI.CurrentTheme.ToolWindow.headerFont(); if (uiSettings.getOverrideLafFonts()) { return font.deriveFont(uiSettings.getFontSize2D() + JBUI.CurrentTheme.ToolWindow.overrideHeaderFontSizeOffset()); } return font; }
getLabelFont
284,458
int (Point point, JComponent component) { double r = Math.max(.05, Math.min(.45, Registry.doubleValue("ide.tabbedPane.dragToSplitRatio"))); Rectangle rect = new Rectangle(new Point(0, 0), component.getSize()); double width = rect.getWidth(); double height = rect.getHeight(); GeneralPath topShape = new GeneralPath(); topShape.moveTo(0, 0); topShape.lineTo(width, 0); topShape.lineTo(width * (1 - r), height * r); topShape.lineTo(width * r, height * r); topShape.closePath(); GeneralPath leftShape = new GeneralPath(); leftShape.moveTo(0, 0); leftShape.lineTo(width * r, height * r); leftShape.lineTo(width * r, height * (1 - r)); leftShape.lineTo(0, height); leftShape.closePath(); GeneralPath bottomShape = new GeneralPath(); bottomShape.moveTo(0, height); bottomShape.lineTo(width * r, height * (1 - r)); bottomShape.lineTo(width * (1 - r), height * (1 - r)); bottomShape.lineTo(width, height); bottomShape.closePath(); GeneralPath rightShape = new GeneralPath(); rightShape.moveTo(width, 0); rightShape.lineTo(width * (1 - r), height * r); rightShape.lineTo(width * (1 - r), height * (1 - r)); rightShape.lineTo(width, height); rightShape.closePath(); if (rightShape.contains(point)) return RIGHT; if (leftShape.contains(point)) return LEFT; if (bottomShape.contains(point)) return BOTTOM; if (topShape.contains(point)) return TOP; return rect.contains(point) ? CENTER : -1; }
getDropSideFor
284,459
void (final Component c) { TabLabel tabLabel = (TabLabel) SwingUtilities.getAncestorOfClass(TabLabel.class, c); if (tabLabel != null) { Point point = SwingUtilities.convertPoint(c, new Point(0, 0), tabLabel); Dimension d = c.getSize(); tabLabel.repaint(point.x, point.y, d.width, d.height); } else { super.repaintComponent(c); } }
repaintComponent
284,460
void (Graphics g) { TabLabel label = myTabs.getInfoToLabel().get(myInfo); boolean isHovered = label != null && label.isHovered(); boolean isSelected = myTabs.getSelectedInfo() == myInfo; if (ExperimentalUI.isNewUI() && myTabs instanceof JBEditorTabs && !isSelected && !isHovered && !myMarkModified && !myInfo.isPinned()) { return; } super.paint(g); }
paint
284,461
boolean () { if (getRootPane() == null) return false; boolean changed = false; boolean anyVisible = false; boolean anyModified = false; for (ActionButton each : myButtons) { changed |= each.update(); each.setMouseDeadZone(myTabs.getTabActionsMouseDeadZone$intellij_platform_ide()); anyVisible |= each.getComponent().isVisible(); Boolean markModified = each.getPrevPresentation().getClientProperty(JBEditorTabs.MARK_MODIFIED_KEY); if (markModified != null) { anyModified |= markModified; } } myActionsIsVisible = anyVisible; myMarkModified = anyModified; return changed; }
update
284,462
boolean () { return myAutoHide; }
isAutoHide
284,463
void (final boolean autoHide) { myAutoHide = autoHide; for (ActionButton each : myButtons) { each.setAutoHide(myAutoHide); } }
setAutoHide
284,464
Dimension () { return myActionsIsVisible ? super.getPreferredSize() : new Dimension(0, 0); }
getPreferredSize
284,465
void (final boolean show) { for (ActionButton each : myButtons) { each.toggleShowActions(show); } }
toggleShowActions
284,466
void (final MouseEvent e) { if (UIUtil.isCloseClick(e, MouseEvent.MOUSE_PRESSED)) { return; } if (JBTabsImpl.isSelectionClick(e) && myInfo.isEnabled()) { TabInfo selectedInfo = myTabs.getSelectedInfo(); if (selectedInfo != myInfo) { myInfo.setPreviousSelection(selectedInfo); } Component c = SwingUtilities.getDeepestComponentAt(e.getComponent(), e.getX(), e.getY()); if (c instanceof InplaceButton) { return; } myTabs.select(info, true); JBPopup container = PopupUtil.getPopupContainerFor(TabLabel.this); if (container != null && ClientProperty.isTrue(container.getContent(), MorePopupAware.class)) { container.cancel(); } } else { handlePopup(e); } }
mousePressed
284,467
void (final MouseEvent e) { handlePopup(e); }
mouseClicked
284,468
void (final MouseEvent e) { myInfo.setPreviousSelection(null); handlePopup(e); }
mouseReleased
284,469
void (MouseEvent e) { setHovered(true); }
mouseEntered
284,470
void (MouseEvent e) { setHovered(false); }
mouseExited
284,471
void (KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { int index = myTabs.getIndexOf(myInfo); if (index >= 0) { e.consume(); // Select the previous tab, then set the focus its TabLabel. TabInfo previous = myTabs.findEnabledBackward(index, true); if (previous != null) { myTabs.select(previous, false).doWhenDone(() -> myTabs.getSelectedLabel().requestFocusInWindow()); } } } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { int index = myTabs.getIndexOf(myInfo); if (index >= 0) { e.consume(); // Select the previous tab, then set the focus its TabLabel. TabInfo next = myTabs.findEnabledForward(index, true); if (next != null) { // Select the next tab, then set the focus its TabLabel. myTabs.select(next, false).doWhenDone(() -> myTabs.getSelectedLabel().requestFocusInWindow()); } } } }
keyPressed
284,472
void (FocusEvent e) { repaint(); }
focusGained
284,473
void (FocusEvent e) { repaint(); }
focusLost
284,474
void (boolean value) { if (isHovered() == value) return; if (value) { myTabs.setHovered(this); } else { myTabs.unHover(this); } }
setHovered
284,475
boolean () { return myTabs.isHoveredTab(this); }
isHovered
284,476
boolean () { return myTabs.getSelectedLabel() == this; }
isSelected
284,477
boolean () { // we don't want the focus unless we are the selected tab return myTabs.getSelectedLabel() == this && super.isFocusable(); }
isFocusable
284,478
SimpleColoredComponent () { SimpleColoredComponent label = new SimpleColoredComponent() { @Override public Font getFont() { Font font = super.getFont(); return (isFontSet() || !myTabs.useSmallLabels()) ? font : RelativeFont.NORMAL.fromResource("EditorTabs.fontSizeOffset", -2, JBUIScale.scale(11f)).derive(StartupUiUtil.getLabelFont()); } @Override protected Color getActiveTextColor(Color attributesColor) { TabPainterAdapter painterAdapter = myTabs.tabPainterAdapter; TabTheme theme = painterAdapter.getTabTheme(); Color foreground; if (myTabs.getSelectedInfo() == myInfo && (attributesColor == null || UIUtil.getLabelForeground().equals(attributesColor))) { foreground = myTabs.isActiveTabs(myInfo) ? theme.getUnderlinedTabForeground() : theme.getUnderlinedTabInactiveForeground(); } else { foreground = super.getActiveTextColor(attributesColor); } return editLabelForeground(foreground); } @Override protected void paintIcon(@NotNull Graphics g, @NotNull Icon icon, int offset) { Icon editedIcon = editIcon(icon); super.paintIcon(g, editedIcon, offset); } }; label.setOpaque(false); label.setBorder(null); label.setIconOpaque(false); label.setIpad(JBInsets.emptyInsets()); return label; }
createLabel
284,479
Font () { Font font = super.getFont(); return (isFontSet() || !myTabs.useSmallLabels()) ? font : RelativeFont.NORMAL.fromResource("EditorTabs.fontSizeOffset", -2, JBUIScale.scale(11f)).derive(StartupUiUtil.getLabelFont()); }
getFont
284,480
Color (Color attributesColor) { TabPainterAdapter painterAdapter = myTabs.tabPainterAdapter; TabTheme theme = painterAdapter.getTabTheme(); Color foreground; if (myTabs.getSelectedInfo() == myInfo && (attributesColor == null || UIUtil.getLabelForeground().equals(attributesColor))) { foreground = myTabs.isActiveTabs(myInfo) ? theme.getUnderlinedTabForeground() : theme.getUnderlinedTabInactiveForeground(); } else { foreground = super.getActiveTextColor(attributesColor); } return editLabelForeground(foreground); }
getActiveTextColor
284,481
void (@NotNull Graphics g, @NotNull Icon icon, int offset) { Icon editedIcon = editIcon(icon); super.paintIcon(g, editedIcon, offset); }
paintIcon
284,482
Icon (@NotNull Icon baseIcon) { return baseIcon; }
editIcon
284,483
boolean () { return myInfo != null && myInfo.isPinned(); }
isPinned
284,484
Dimension () { Dimension size = getNotStrictPreferredSize(); if (isPinned()) { size.width = Math.min(TabLayout.getMaxPinnedTabWidth(), size.width); } return size; }
getPreferredSize
284,485
Dimension () { return super.getPreferredSize(); }
getNotStrictPreferredSize
284,486
void (boolean toCenter) { if (myCentered == toCenter && getLabelComponent().getParent() != null) return; setPlaceholderContent(toCenter, getLabelComponent()); }
setAlignmentToCenter
284,487
void (boolean toCenter, JComponent component) { myLabelPlaceholder.removeAll(); JComponent content = toCenter ? new Centerizer(component, Centerizer.TYPE.BOTH) : new Centerizer(component, Centerizer.TYPE.VERTICAL); myLabelPlaceholder.setContent(content); myCentered = toCenter; }
setPlaceholderContent
284,488
void (Graphics g) { synchronized (getTreeLock()) { validateTree(); } doPaint(g); }
paintOffscreen
284,489
void (final Graphics g) { if (myTabs.isDropTarget(myInfo)) { if (myTabs.getDropSide() == -1) { g.setColor(JBUI.CurrentTheme.DragAndDrop.Area.BACKGROUND); g.fillRect(0, 0, getWidth(), getHeight()); } return; } doPaint(g); if (shouldPaintFadeout()) { paintFadeout(g); } }
paint
284,490
boolean () { return !Registry.is("ui.no.bangs.and.whistles", false) && myTabs.isSingleRow(); }
shouldPaintFadeout
284,491
void (final Graphics g) { Graphics2D g2d = (Graphics2D)g.create(); try { Color tabBg = getEffectiveBackground(); Color transparent = ColorUtil.withAlpha(tabBg, 0); int borderThickness = myTabs.getBorderThickness(); int width = JBUI.scale(MathUtil.clamp(Registry.intValue("ide.editor.tabs.fadeout.width", 10), 1, 200)); Rectangle myRect = getBounds(); myRect.height -= borderThickness + (isSelected() ? myTabs.getTabPainter().getTabTheme().getUnderlineHeight() : borderThickness); // Fadeout for left part (needed only in top and bottom placements) if (myRect.x < 0) { Rectangle leftRect = new Rectangle(-myRect.x, borderThickness, width, myRect.height - 2 * borderThickness); paintGradientRect(g2d, leftRect, tabBg, transparent); } Rectangle contentRect = myLabelPlaceholder.getBounds(); // Fadeout for right side before pin/close button (needed only in side placements and in squeezing layout) if (contentRect.width < myLabelPlaceholder.getPreferredSize().width + myTabs.getTabHGap()) { Rectangle rightRect = new Rectangle(contentRect.x + contentRect.width - width, borderThickness, width, myRect.height - 2 * borderThickness); paintGradientRect(g2d, rightRect, transparent, tabBg); } // Fadeout for right side else if (myTabs.getEffectiveLayout$intellij_platform_ide().isScrollable() && myRect.width < getPreferredSize().width + myTabs.getTabHGap()) { Rectangle rightRect = new Rectangle(myRect.width - width, borderThickness, width, myRect.height - 2 * borderThickness); paintGradientRect(g2d, rightRect, transparent, tabBg); } } finally { g2d.dispose(); } }
paintFadeout
284,492
void (Graphics2D g, Rectangle rect, Color fromColor, Color toColor) { g.setPaint(new GradientPaint(rect.x, rect.y, fromColor, rect.x + rect.width, rect.y, toColor)); g.fill(rect); }
paintGradientRect
284,493
void (final Graphics g) { super.paint(g); }
doPaint
284,494
boolean () { if (myInfo.isPinned() && AdvancedSettings.getBoolean("editor.keep.pinned.tabs.on.left")) { @NotNull List<TabInfo> tabs = myTabs.getTabs(); for (int i = 0; i < tabs.size(); i++) { TabInfo cur = tabs.get(i); if (cur == myInfo && i < tabs.size() - 1) { TabInfo next = tabs.get(i + 1); return !next.isPinned() && myTabs.getTabLabel(next).getY() == this.getY(); // check that cur and next are in the same row } } } return false; }
isLastPinned
284,495
boolean () { if (!myInfo.isPinned() && AdvancedSettings.getBoolean("editor.keep.pinned.tabs.on.left")) { @NotNull List<TabInfo> tabs = myTabs.getVisibleInfos(); boolean wasPinned = false; for (TabInfo info : tabs) { if (wasPinned && info == myInfo) return true; wasPinned = info.isPinned(); } } return false; }
isNextToLastPinned
284,496
boolean () { List<TabInfo> infos = myTabs.getVisibleInfos(); for (int ind = 0; ind < infos.size() - 1; ind++) { TabLabel cur = myTabs.getInfoToLabel().get(infos.get(ind)); if (cur == this) { TabLabel next = myTabs.getInfoToLabel().get(infos.get(ind + 1)); return cur.getY() != next.getY(); } } // can be empty in case of dragging tab label return !infos.isEmpty() && infos.get(infos.size() - 1) == myInfo; }
isLastInRow
284,497
void (final MouseEvent e) { if (e.getClickCount() != 1 || !e.isPopupTrigger() || PopupUtil.getPopupContainerFor(this) != null) return; if (e.getX() < 0 || e.getX() >= e.getComponent().getWidth() || e.getY() < 0 || e.getY() >= e.getComponent().getHeight()) return; String place = myTabs.getPopupPlace(); place = place != null ? place : ActionPlaces.UNKNOWN; myTabs.setPopupInfo(myInfo); final DefaultActionGroup toShow = new DefaultActionGroup(); if (myTabs.getPopupGroup() != null) { toShow.addAll(myTabs.getPopupGroup()); toShow.addSeparator(); } JBTabsImpl tabs = (JBTabsImpl)JBTabsEx.NAVIGATION_ACTIONS_KEY.getData(DataManager.getInstance().getDataContext(e.getComponent(), e.getX(), e.getY())); if (tabs == myTabs && myTabs.getAddNavigationGroup()) { toShow.addAll(myTabs.getNavigationActions()); } if (toShow.getChildrenCount() == 0) return; myTabs.setActivePopup(ActionManager.getInstance().createActionPopupMenu(place, toShow).getComponent()); myTabs.getActivePopup().addPopupMenuListener(myTabs.getPopupListener()); myTabs.getActivePopup().addPopupMenuListener(myTabs); JBPopupMenu.showByEvent(e, myTabs.getActivePopup()); }
handlePopup
284,498
void (final SimpleColoredText text) { myLabel.change(() -> { myLabel.clear(); myLabel.setIcon(hasIcons() ? myIcon : null); if (text != null) { text.appendToComponent(myLabel); } }, false); invalidateIfNeeded(); }
setText
284,499
void () { if (getLabelComponent().getRootPane() == null) return; Dimension d = getLabelComponent().getSize(); Dimension pref = getLabelComponent().getPreferredSize(); if (d != null && d.equals(pref)) { return; } getLabelComponent().invalidate(); if (myActionPanel != null) { myActionPanel.invalidate(); } myTabs.revalidateAndRepaint(false); }
invalidateIfNeeded