Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
290,500
void (@NotNull AnActionEvent e, boolean state) { myOption.select(); }
setSelected
290,501
void (@NotNull AnActionEvent e) { super.update(e); e.getPresentation().setEnabled(myOption.isEnabled()); e.getPresentation().setText(myOption.getDisplayName()); }
update
290,502
boolean () { return myOptions.isHidden(); }
isSelected
290,503
void () { myOptions.onHide(); }
select
290,504
boolean () { return myOptions.isHideOptionVisible(); }
isEnabled
290,505
String () { return IdeBundle.message("run.layout.do.not.show.view.option.message"); }
getDisplayName
290,506
boolean (ViewContext context, Content[] selectedContents, String place) { for (Content content : context.getContentManager().getContents()) { if (content.isPinned()) return super.isEnabled(context, selectedContents, place); } return false; }
isEnabled
290,507
boolean (@NotNull Content c, Content @NotNull [] selectedContents) { return !c.isPinned(); }
isAccepted
290,508
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
290,509
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabledAndVisible( !ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace()) && e.getData(RunnerContentUi.KEY) != null ); super.update(e); }
update
290,510
boolean (@NotNull AnActionEvent e) { var runnerUI = e.getData(RunnerContentUi.KEY); if (runnerUI == null) { return false; } return !runnerUI.getLayoutSettings().isTabLabelsHidden(); }
isSelected
290,511
void (@NotNull AnActionEvent e, boolean state) { var runnerUI = Objects.requireNonNull(e.getData(RunnerContentUi.KEY)); runnerUI.getLayoutSettings().setTabLabelsHidden(!state); runnerUI.updateTabsUI(true); }
setSelected
290,512
RunnerLayoutSettings () { return ApplicationManager.getApplication().getService(RunnerLayoutSettings.class); }
getInstance
290,513
RunnerLayout (@NotNull String id) { if (Strings.areSameInstance(id, NOT_PERSISTENT_ID)) return new RunnerLayout(); RunnerLayout layout = myRunnerId2Settings.get(id); if (layout == null) { layout = new RunnerLayout(); myRunnerId2Settings.put(id, layout); } return layout; }
getLayout
290,514
Element () { final Element runners = new Element("runners"); for (String eachID : myRunnerId2Settings.keySet()) { final RunnerLayout layout = myRunnerId2Settings.get(eachID); final Element runnerElement = new Element("runner"); runnerElement.setAttribute("id", eachID); layout.write(runnerElement); runners.addContent(runnerElement); } return runners; }
getState
290,515
void (final @NotNull Element state) { final List runners = state.getChildren("runner"); for (Object each : runners) { Element eachRunnerElement = (Element)each; final String eachID = eachRunnerElement.getAttributeValue("id"); final RunnerLayout eachLayout = new RunnerLayout(); eachLayout.read(eachRunnerElement); myRunnerId2Settings.put(eachID, eachLayout); } }
loadState
290,516
void (ActionGroup group, String place) { final ActionToolbar tb = myActionManager.createActionToolbar(place, group, false); tb.setTargetComponent(myComponent); myToolbar.setContent(tb.getComponent()); myLeftToolbarActions = group; myComponent.revalidate(); myComponent.repaint(); }
setLeftToolbar
290,517
void () { if (myTabs != null) return; myTabs = new JBRunnerTabs(myProject, this); myTabs.getComponent().setOpaque(false); myTabs.setDataProvider(dataId -> { if (ViewContext.CONTENT_KEY.is(dataId)) { TabInfo info = myTabs.getTargetInfo(); if (info != null) { return getGridFor(info).getData(dataId); } } else if (ViewContext.CONTEXT_KEY.is(dataId)) { return this; } return null; }); myTabs.getPresentation() .setTabLabelActionsAutoHide(false).setInnerInsets(JBInsets.emptyInsets()) .setToDrawBorderIfTabsHidden(false).setTabDraggingEnabled(isMoveToGridActionEnabled()).setUiDecorator(null); rebuildTabPopup(); myTabs.getPresentation().setPaintFocus(false).setRequestFocusOnLastFocusedComponent(true); NonOpaquePanel wrapper = new MyComponent(); wrapper.add(myToolbar, BorderLayout.WEST); wrapper.add(myTabs.getComponent(), BorderLayout.CENTER); myComponent = wrapper; myTabs.addListener(new TabsListener() { @Override public void beforeSelectionChanged(TabInfo oldSelection, TabInfo newSelection) { if (oldSelection != null && !isStateBeingRestored()) { final GridImpl grid = getGridFor(oldSelection); if (grid != null && getTabFor(grid) != null) { grid.saveUiState(); } } } @Override public void tabsMoved() { saveUiState(); } @Override public void selectionChanged(final TabInfo oldSelection, final TabInfo newSelection) { if (!myTabs.getComponent().isShowing()) return; if (newSelection != null) { newSelection.stopAlerting(); getGridFor(newSelection).processAddToUi(false); } if (oldSelection != null) { getGridFor(oldSelection).processRemoveFromUi(); } } }); myTabs.addTabMouseListener(new MouseAdapter() { @Override public void mousePressed(@NotNull MouseEvent e) { if (UIUtil.isCloseClick(e)) { final TabInfo tabInfo = myTabs.findInfo(e); final GridImpl grid = tabInfo == null ? null : getGridFor(tabInfo); final Content[] contents = grid != null ? CONTENT_KEY.getData(grid) : null; if (contents == null) return; // see GridCellImpl.closeOrMinimize as well if (CloseViewAction.isEnabled(contents)) { CloseViewAction.perform(RunnerContentUi.this, contents[0]); } else if (MinimizeViewAction.isEnabled(RunnerContentUi.this, contents, ViewContext.TAB_TOOLBAR_PLACE)) { grid.getCellFor(contents[0]).minimize(contents[0]); } } } }); if (myOriginal != null) { final ContentManager manager = ContentFactory.getInstance().createContentManager(this, false, myProject); Disposer.register((Disposable)myRunnerUi, manager); manager.getComponent(); } else { DockManager dockManager = myProject.isDefault() ? null : DockManager.getInstance(myProject); if (dockManager != null) { dockManager.register(this, this); } } if (UIExperiment.isNewDebuggerUIEnabled()) { MouseAdapter adapter = new MouseAdapter() { private Point myPressPoint = null; @Override public void mousePressed(MouseEvent e) { InternalDecoratorImpl topLevelDecorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent); if (topLevelDecorator != null) { topLevelDecorator.activate(ToolWindowEventSource.ToolWindowHeader); } myPressPoint = e.getPoint(); } @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) { InternalDecoratorImpl topLevelDecorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent); if (topLevelDecorator != null && !topLevelDecorator.isHeaderVisible()) { String id = topLevelDecorator.getToolWindowId(); ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject); ToolWindow window = manager.getToolWindow(id); if (window != null) { manager.setMaximized(window, !manager.isMaximized(window)); } } } } @Override public void mouseDragged(MouseEvent e) { InternalDecoratorImpl decorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent); if (decorator == null || decorator.isHeaderVisible()) return; ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(decorator.getToolWindowId()); ToolWindowAnchor anchor = window != null ? window.getAnchor() : null; if (anchor == ToolWindowAnchor.BOTTOM && SwingUtilities.isLeftMouseButton(e) && myPressPoint != null) { ThreeComponentsSplitter splitter = ComponentUtil.getParentOfType(ThreeComponentsSplitter.class, myComponent); if (splitter != null && splitter.getOrientation() && SwingUtilities.isDescendingFrom(getComponent(), splitter.getLastComponent())) { int size = splitter.getLastSize(); int yDiff = myPressPoint.y - e.getPoint().y; splitter.setLastSize(size + yDiff); } } } @Override public void mouseReleased(MouseEvent e) { myPressPoint = null; } @Override public void mouseEntered(MouseEvent e) { InternalDecoratorImpl decorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent); if (decorator == null || decorator.isHeaderVisible()) { e.getComponent().setCursor(Cursor.getDefaultCursor()); return; } e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR)); } @Override public void mouseExited(MouseEvent e) { e.getComponent().setCursor(Cursor.getDefaultCursor()); } }; wrapper.addMouseListener(adapter); myTabs.getComponent().addMouseListener(adapter); wrapper.addMouseMotionListener(adapter); myTabs.getComponent().addMouseMotionListener(adapter); } updateRestoreLayoutActionVisibility(); }
initUi
290,518
void (TabInfo oldSelection, TabInfo newSelection) { if (oldSelection != null && !isStateBeingRestored()) { final GridImpl grid = getGridFor(oldSelection); if (grid != null && getTabFor(grid) != null) { grid.saveUiState(); } } }
beforeSelectionChanged
290,519
void () { saveUiState(); }
tabsMoved
290,520
void (final TabInfo oldSelection, final TabInfo newSelection) { if (!myTabs.getComponent().isShowing()) return; if (newSelection != null) { newSelection.stopAlerting(); getGridFor(newSelection).processAddToUi(false); } if (oldSelection != null) { getGridFor(oldSelection).processRemoveFromUi(); } }
selectionChanged
290,521
void (@NotNull MouseEvent e) { if (UIUtil.isCloseClick(e)) { final TabInfo tabInfo = myTabs.findInfo(e); final GridImpl grid = tabInfo == null ? null : getGridFor(tabInfo); final Content[] contents = grid != null ? CONTENT_KEY.getData(grid) : null; if (contents == null) return; // see GridCellImpl.closeOrMinimize as well if (CloseViewAction.isEnabled(contents)) { CloseViewAction.perform(RunnerContentUi.this, contents[0]); } else if (MinimizeViewAction.isEnabled(RunnerContentUi.this, contents, ViewContext.TAB_TOOLBAR_PLACE)) { grid.getCellFor(contents[0]).minimize(contents[0]); } } }
mousePressed
290,522
void (MouseEvent e) { InternalDecoratorImpl topLevelDecorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent); if (topLevelDecorator != null) { topLevelDecorator.activate(ToolWindowEventSource.ToolWindowHeader); } myPressPoint = e.getPoint(); }
mousePressed
290,523
void (MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) { InternalDecoratorImpl topLevelDecorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent); if (topLevelDecorator != null && !topLevelDecorator.isHeaderVisible()) { String id = topLevelDecorator.getToolWindowId(); ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject); ToolWindow window = manager.getToolWindow(id); if (window != null) { manager.setMaximized(window, !manager.isMaximized(window)); } } } }
mouseClicked
290,524
void (MouseEvent e) { InternalDecoratorImpl decorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent); if (decorator == null || decorator.isHeaderVisible()) return; ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(decorator.getToolWindowId()); ToolWindowAnchor anchor = window != null ? window.getAnchor() : null; if (anchor == ToolWindowAnchor.BOTTOM && SwingUtilities.isLeftMouseButton(e) && myPressPoint != null) { ThreeComponentsSplitter splitter = ComponentUtil.getParentOfType(ThreeComponentsSplitter.class, myComponent); if (splitter != null && splitter.getOrientation() && SwingUtilities.isDescendingFrom(getComponent(), splitter.getLastComponent())) { int size = splitter.getLastSize(); int yDiff = myPressPoint.y - e.getPoint().y; splitter.setLastSize(size + yDiff); } } }
mouseDragged
290,525
void (MouseEvent e) { myPressPoint = null; }
mouseReleased
290,526
void (MouseEvent e) { InternalDecoratorImpl decorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent); if (decorator == null || decorator.isHeaderVisible()) { e.getComponent().setCursor(Cursor.getDefaultCursor()); return; } e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR)); }
mouseEntered
290,527
void (MouseEvent e) { e.getComponent().setCursor(Cursor.getDefaultCursor()); }
mouseExited
290,528
void () { initUi(); myTabs.setPopupGroup(getCellPopupGroup(TAB_POPUP_PLACE), TAB_POPUP_PLACE, true); getGrids().forEach(GridImpl::rebuildTabPopup); }
rebuildTabPopup
290,529
ActionGroup (final String place) { final ActionGroup original = myTabPopupActions != null ? myTabPopupActions : (ActionGroup)myActionManager.getAction(VIEW_POPUP); final ActionGroup focusPlaceholder = (ActionGroup)myActionManager.getAction("Runner.Focus"); DefaultActionGroup group = new DefaultActionGroup(VIEW_POPUP, original.isPopup()); if (myShowDebugContentAction == null && "Debug".equals(myRunnerId)) { myShowDebugContentAction = new ShowDebugContentAction(this, myTabs.getComponent(), this); } if (myShowDebugContentAction != null) { group.add(myShowDebugContentAction); } AnActionEvent event = new AnActionEvent(null, DataManager.getInstance().getDataContext(), place, new Presentation(), ActionManager.getInstance(), 0); for (AnAction each : original.getChildren(event)) { if (each == focusPlaceholder) { final AnAction[] focusActions = ((ActionGroup)each).getChildren(event); for (AnAction eachFocus : focusActions) { group.add(eachFocus); } if (myAdditionalFocusActions != null) { for (AnAction action : myAdditionalFocusActions.getChildren(event)) { group.add(action); } } } else { group.add(each); } } if (myViewActions.getChildrenCount() > 0) { DefaultActionGroup layoutGroup = new DefaultActionGroup(myViewActions.getChildren(null)); layoutGroup.getTemplatePresentation().setText(ExecutionBundle.messagePointer("action.presentation.RunnerContentUi.text")); layoutGroup.setPopup(true); group.addSeparator(); group.addAction(layoutGroup); } return group; }
getCellPopupGroup
290,530
boolean () { return myOriginal == null; }
isOriginal
290,531
int () { return myWindow; }
getWindow
290,532
JBTabs () { return myTabs; }
getTabs
290,533
void (final @NotNull PropertyChangeEvent evt) { Content content = (Content)evt.getSource(); final GridImpl grid = getGridFor(content, false); if (grid == null) return; final GridCellImpl cell = grid.findCell(content); if (cell == null) return; final String property = evt.getPropertyName(); if (Content.PROP_ALERT.equals(property)) { attract(content, true); } else if (Content.PROP_DISPLAY_NAME.equals(property) || Content.PROP_ICON.equals(property) || Content.PROP_PINNED.equals(property) || Content.PROP_ACTIONS.equals(property) || Content.PROP_DESCRIPTION.equals(property) || Content.PROP_TAB_COLOR.equals(property)) { cell.updateTabPresentation(content); updateTabsUI(false); } }
propertyChange
290,534
ActionCallback (int window, GridCell cell) { if (myOriginal != null) { return myOriginal.detachTo(window, cell); } RunnerContentUi target = null; if (window > 0) { for (RunnerContentUi child : myChildren) { if (child.myWindow == window) { target = child; break; } } } final GridCellImpl gridCell = (GridCellImpl)cell; final Content[] contents = gridCell.getContents(); storeDefaultIndices(contents); for (Content content : contents) { content.putUserData(RunnerLayout.DROP_INDEX, getStateFor(content).getTab().getIndex()); } Dimension size = gridCell.getSize(); if (size == null) { size = JBUI.size(200, 200); } DockableGrid content = new DockableGrid(null, new Presentation(), size, Arrays.asList(contents), window); if (target != null) { target.add(content, null); } else { Point location = gridCell.getLocation(); if (location == null) { location = getComponent().getLocationOnScreen(); } location.translate(size.width / 2, size.height / 2); getDockManager().createNewDockContainerFor(content, new RelativePoint(location)); } return ActionCallback.DONE; }
detachTo
290,535
void (Content @NotNull [] contents) { //int i = 0; for (Content content : contents) { content.putUserData(RunnerLayout.DEFAULT_INDEX, getStateFor(content).getTab().getDefaultIndex()); //content.putUserData(CONTENT_NUMBER, i++); } }
storeDefaultIndices
290,536
RelativeRectangle () { return new RelativeRectangle(myTabs.getComponent()); }
getAcceptArea
290,537
ContentResponse (@NotNull DockableContent content, RelativePoint point) { if (!(content instanceof DockableGrid)) { return ContentResponse.DENY; } final RunnerContentUi ui = ((DockableGrid)content).getOriginalRunnerUi(); return ui.getProject() == myProject && ui.mySessionName.equals(mySessionName) ? ContentResponse.ACCEPT_MOVE : ContentResponse.DENY; }
getContentResponse
290,538
JComponent () { initUi(); return myComponent; }
getComponent
290,539
JComponent () { initUi(); return myManager.getComponent(); }
getContainerComponent
290,540
void (@NotNull DockableContent dockable, RelativePoint dropTarget) { final DockableGrid dockableGrid = (DockableGrid)dockable; final RunnerContentUi prev = dockableGrid.getRunnerUi(); saveUiState(); final List<Content> contents = dockableGrid.getContents(); final boolean wasRestoring = myOriginal != null && myOriginal.isStateBeingRestored(); setStateIsBeingRestored(true, this); try { final Point point = dropTarget != null ? dropTarget.getPoint(myComponent) : null; boolean hadGrid = !myTabs.shouldAddToGlobal(point); for (Content content : contents) { final View view = getStateFor(content); if (view.isMinimizedInGrid()) continue; prev.myManager.removeContent(content, false); myManager.removeContent(content, false); if (hadGrid && !wasRestoring) { view.assignTab(getTabFor(getSelectedGrid())); view.setPlaceInGrid(calcPlaceInGrid(point, myComponent.getSize())); } else if (contents.size() == 1 && !wasRestoring) { view.assignTab(null); view.setPlaceInGrid(myLayoutSettings.getDefaultGridPlace(content)); } view.setWindow(myWindow); myManager.addContent(content); } } finally { setStateIsBeingRestored(false, this); } saveUiState(); updateTabsUI(true); }
add
290,541
void () { final Content[] contents = myManager.getContents(); if (myOriginal != null) { for (Content content : contents) { getStateFor(content).setWindow(0); myOriginal.myManager.addContent(content); GridCell cell = myOriginal.findCellFor(content); if (cell != null) { myOriginal.restore(content); cell.minimize(content); } } } myManager.removeAllContents(false); }
closeAll
290,542
void (@NotNull Listener listener, Disposable parent) { myDockingListeners.add(listener); Disposer.register(parent, () -> myDockingListeners.remove(listener)); }
addListener
290,543
boolean () { return myTabs.isEmptyVisible() || myDisposing; }
isEmpty
290,544
Image (@NotNull DockableContent dockable, RelativePoint dropTarget) { JBTabs current = getTabsAt(dockable, dropTarget); if (myCurrentOver != null && myCurrentOver != current) { resetDropOver(dockable); } if (myCurrentOver == null && current != null) { myCurrentOver = current; Presentation presentation = dockable.getPresentation(); myCurrentOverInfo = new TabInfo(new JLabel("")).setText(presentation.getText()).setIcon(presentation.getIcon()); myCurrentOverImg = myCurrentOver.startDropOver(myCurrentOverInfo, dropTarget); } if (myCurrentOver != null) { myCurrentOver.processDropOver(myCurrentOverInfo, dropTarget); } if (myCurrentPainter == null) { myCurrentPainter = new MyDropAreaPainter(); myGlassPaneListenersDisposable = Disposer.newDisposable("GlassPaneListeners"); Disposer.register(this, myGlassPaneListenersDisposable); IdeGlassPaneUtil.find(myComponent).addPainter(myComponent, myCurrentPainter, myGlassPaneListenersDisposable); } myCurrentPainter.processDropOver(this, dockable, dropTarget); return myCurrentOverImg; }
processDropOver
290,545
void (JBTabs tabs) { if (myOriginal != null) { myOriginal.toggleContentPopup(tabs); return; } List<Content> contents = getPopupContents(); final SelectContentStep step = new SelectContentStep(contents); final Content selectedContent = myManager.getSelectedContent(); if (selectedContent != null) { step.setDefaultOptionIndex(myManager.getIndexOfContent(selectedContent)); } final ListPopup popup = JBPopupFactory.getInstance().createListPopup(step); popup.showUnderneathOf(tabs.getTabLabel(tabs.getSelectedInfo())); if (selectedContent instanceof TabbedContent) { new Alarm(Alarm.ThreadToUse.SWING_THREAD, popup).addRequest(() -> popup.handleSelect(false), 50); } }
toggleContentPopup
290,546
List<Content> () { if (myOriginal != null) return myOriginal.getPopupContents(); List<Content> contents = new ArrayList<>(Arrays.asList(myManager.getContents())); myChildren.stream() .flatMap(child -> Arrays.stream(child.myManager.getContents())) .forEachOrdered(contents::add); RunContentManager contentManager = RunContentManager.getInstance(myProject); RunContentDescriptor selectedDescriptor = contentManager.getSelectedContent(); Content selectedContent; if (selectedDescriptor != null) { selectedContent = selectedDescriptor.getAttachedContent(); } else { selectedContent = null; } ToolWindow debugToolwindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.DEBUG); if (debugToolwindow != null) { for (Content content : debugToolwindow.getContentManager().getContents()) { if (content != selectedContent) { contents.add(content); } } } return contents; }
getPopupContents
290,547
PlaceInGrid (Point point, Dimension size) { // 1/3 (left) | (center/bottom) | 1/3 (right) if (point.x < size.width / 3) return PlaceInGrid.left; if (point.x > size.width * 2 / 3) return PlaceInGrid.right; // 3/4 (center with tab titles) | 1/4 (bottom) if (point.y > size.height * 3 / 4) return PlaceInGrid.bottom; return PlaceInGrid.center; }
calcPlaceInGrid
290,548
void (@NotNull DockableContent content) { if (myCurrentOver != null) { myCurrentOver.resetDropOver(myCurrentOverInfo); myCurrentOver = null; myCurrentOverInfo = null; myCurrentOverImg = null; Disposer.dispose(myGlassPaneListenersDisposable); myGlassPaneListenersDisposable = Disposer.newDisposable(); myCurrentPainter = null; } }
resetDropOver
290,549
boolean () { return myOriginal != null; }
isDisposeWhenEmpty
290,550
void (final @NotNull ContentManager manager) { assert myManager == null; myManager = manager; myManager.addContentManagerListener(new ContentManagerListener() { @Override public void contentAdded(final @NotNull ContentManagerEvent event) { initUi(); if (event.getContent().getUserData(LIGHTWEIGHT_CONTENT_MARKER) == Boolean.TRUE) { myLayoutSettings.setLightWeight(event.getContent()); Disposer.register(event.getContent(), () -> myLayoutSettings.clearStateFor(event.getContent())); } GridImpl grid = getGridFor(event.getContent(), true); if (grid == null) { return; } grid.add(event.getContent()); if (getSelectedGrid() == grid) { grid.processAddToUi(false); } if (myManager.getComponent().isShowing() && !isStateBeingRestored()) { setStateIsBeingRestored(true, RunnerContentUi.this); try { grid.restoreLastUiState(); } finally { setStateIsBeingRestored(false, RunnerContentUi.this); } } updateTabsUI(false); event.getContent().addPropertyChangeListener(RunnerContentUi.this); fireContentOpened(event.getContent()); if (myMinimizeActionEnabled) { AnAction[] actions = myViewActions.getChildren(null); for (AnAction action : actions) { if (action instanceof ViewLayoutModificationAction && ((ViewLayoutModificationAction)action).getContent() == event.getContent()) return; } CustomContentLayoutSettings layoutOptionsCollection = event.getContent().getUserData(CustomContentLayoutSettings.KEY); if (layoutOptionsCollection != null) { for (AnAction action: layoutOptionsCollection.getActions(RunnerContentUi.this)) { myViewActions.addAction(action).setAsSecondary(true); } } else { AnAction viewAction = new RestoreViewAction(RunnerContentUi.this, event.getContent()); myViewActions.addAction(viewAction).setAsSecondary(true); } List<AnAction> toAdd = new ArrayList<>(); for (AnAction anAction : myViewActions.getChildren(null)) { if (!(anAction instanceof ViewLayoutModificationAction)) { myViewActions.remove(anAction); toAdd.add(anAction); } } for (AnAction anAction : toAdd) { myViewActions.addAction(anAction).setAsSecondary(true); } } } @Override public void contentRemoved(final @NotNull ContentManagerEvent event) { final Content content = event.getContent(); content.removePropertyChangeListener(RunnerContentUi.this); GridImpl grid = (GridImpl)findGridFor(content); if (grid != null) { grid.remove(content); if (grid.isEmpty()) { grid.processRemoveFromUi(); } removeGridIfNeeded(grid); } updateTabsUI(false); fireContentClosed(content); ApplicationManager.getApplication().invokeLater(() -> { if (Disposer.isDisposed(content)) { AnAction[] actions = myViewActions.getChildren(null); for (AnAction action : actions) { if (action instanceof ViewLayoutModificationAction && ((ViewLayoutModificationAction)action).getContent() == content) { myViewActions.remove(action); break; } } } }); } @Override public void selectionChanged(final @NotNull ContentManagerEvent event) { if (isStateBeingRestored()) return; if (event.getOperation() == ContentManagerEvent.ContentOperation.add) { select(event.getContent(), false); } } }); }
setManager
290,551
void (final @NotNull ContentManagerEvent event) { initUi(); if (event.getContent().getUserData(LIGHTWEIGHT_CONTENT_MARKER) == Boolean.TRUE) { myLayoutSettings.setLightWeight(event.getContent()); Disposer.register(event.getContent(), () -> myLayoutSettings.clearStateFor(event.getContent())); } GridImpl grid = getGridFor(event.getContent(), true); if (grid == null) { return; } grid.add(event.getContent()); if (getSelectedGrid() == grid) { grid.processAddToUi(false); } if (myManager.getComponent().isShowing() && !isStateBeingRestored()) { setStateIsBeingRestored(true, RunnerContentUi.this); try { grid.restoreLastUiState(); } finally { setStateIsBeingRestored(false, RunnerContentUi.this); } } updateTabsUI(false); event.getContent().addPropertyChangeListener(RunnerContentUi.this); fireContentOpened(event.getContent()); if (myMinimizeActionEnabled) { AnAction[] actions = myViewActions.getChildren(null); for (AnAction action : actions) { if (action instanceof ViewLayoutModificationAction && ((ViewLayoutModificationAction)action).getContent() == event.getContent()) return; } CustomContentLayoutSettings layoutOptionsCollection = event.getContent().getUserData(CustomContentLayoutSettings.KEY); if (layoutOptionsCollection != null) { for (AnAction action: layoutOptionsCollection.getActions(RunnerContentUi.this)) { myViewActions.addAction(action).setAsSecondary(true); } } else { AnAction viewAction = new RestoreViewAction(RunnerContentUi.this, event.getContent()); myViewActions.addAction(viewAction).setAsSecondary(true); } List<AnAction> toAdd = new ArrayList<>(); for (AnAction anAction : myViewActions.getChildren(null)) { if (!(anAction instanceof ViewLayoutModificationAction)) { myViewActions.remove(anAction); toAdd.add(anAction); } } for (AnAction anAction : toAdd) { myViewActions.addAction(anAction).setAsSecondary(true); } } }
contentAdded
290,552
void (final @NotNull ContentManagerEvent event) { final Content content = event.getContent(); content.removePropertyChangeListener(RunnerContentUi.this); GridImpl grid = (GridImpl)findGridFor(content); if (grid != null) { grid.remove(content); if (grid.isEmpty()) { grid.processRemoveFromUi(); } removeGridIfNeeded(grid); } updateTabsUI(false); fireContentClosed(content); ApplicationManager.getApplication().invokeLater(() -> { if (Disposer.isDisposed(content)) { AnAction[] actions = myViewActions.getChildren(null); for (AnAction action : actions) { if (action instanceof ViewLayoutModificationAction && ((ViewLayoutModificationAction)action).getContent() == content) { myViewActions.remove(action); break; } } } }); }
contentRemoved
290,553
void (final @NotNull ContentManagerEvent event) { if (isStateBeingRestored()) return; if (event.getOperation() == ContentManagerEvent.ContentOperation.add) { select(event.getContent(), false); } }
selectionChanged
290,554
void (GridImpl grid) { if (grid.isEmpty()) { myTabs.removeTab(myTabs.findInfo(grid)); myMinimizedButtonsPlaceholder.remove(grid); myCommonActionsPlaceholder.remove(grid); Disposer.dispose(grid); } }
removeGridIfNeeded
290,555
Dimension () { Dimension size = super.getPreferredSize(); if (size.height > 0) { size.height = JBRunnerTabs.getTabLabelPreferredHeight() - ((JBRunnerTabs)myTabs).getBorderThickness(); } return size; }
getPreferredSize
290,556
void (int index) { if (myOriginal != null) { myOriginal.moveFollowingTabs(index); return; } moveFollowingTabs(index, myTabs); for (RunnerContentUi child : myChildren) { moveFollowingTabs(index, child.myTabs); } }
moveFollowingTabs
290,557
ContentManager (Content content) { if (hasContent(myManager, content)) { return myManager; } for (RunnerContentUi child : myChildren) { if (hasContent(child.myManager, content)) { return child.myManager; } } return myManager; }
getContentManager
290,558
boolean (ContentManager manager, Content content) { return ArrayUtil.contains(content, manager.getContents()); }
hasContent
290,559
void (int index, final JBTabs tabs) { for (TabInfo info : tabs.getTabs()) { TabImpl tab = getTabFor(info); if (tab != null) { int tabIndex = tab.getIndex(); if (tabIndex >= index) { tab.setIndex(tabIndex + 1); } } } }
moveFollowingTabs
290,560
int (RunnerContentUi ui) { int offset = myTabs.getTabCount(); for (RunnerContentUi child : myChildren) { if (child == ui) break; offset += child.myTabs.getTabCount(); } return offset; }
getTabOffsetFor
290,561
boolean () { boolean hasToolbarContent = rebuildCommonActions(); hasToolbarContent |= rebuildMinimizedActions(); return hasToolbarContent; }
rebuildToolbar
290,562
boolean () { boolean hasToolbarContent = false; for (Map.Entry<GridImpl, TopToolbarWrappers> entry : myCommonActionsPlaceholder.entrySet()) { Wrapper leftPlaceHolder = entry.getValue().left; Wrapper middlePlaceHolder = entry.getValue().middle; Wrapper rightPlaceHolder = entry.getValue().right; TopToolbarContextActions topToolbarContextActions = myContextActions.get(entry.getKey()); DefaultActionGroup leftGroupToBuild = new DefaultActionGroupWithDelegate(myTopLeftActions); if (myTopLeftActionsVisible) { leftGroupToBuild.addAll(myTopLeftActions); } final AnAction[] leftActions = leftGroupToBuild.getChildren(null); if (topToolbarContextActions == null || !Arrays.equals(leftActions, topToolbarContextActions.left)) { setActions(leftPlaceHolder, myTopLeftActionsPlace, leftGroupToBuild); } DefaultActionGroup middleGroupToBuild = new DefaultActionGroup(); middleGroupToBuild.addAll(myTopMiddleActions); final AnAction[] middleActions = middleGroupToBuild.getChildren(null); if (topToolbarContextActions == null || !Arrays.equals(middleActions, topToolbarContextActions.middle)) { setActions(middlePlaceHolder, myTopMiddleActionsPlace, middleGroupToBuild); } DefaultActionGroup rightGroupToBuild = new DefaultActionGroup(); rightGroupToBuild.addAll(myTopRightActions); final AnAction[] rightActions = rightGroupToBuild.getChildren(null); if (topToolbarContextActions == null || !Arrays.equals(rightActions, topToolbarContextActions.right)) { setActions(rightPlaceHolder, myTopRightActionsPlace, rightGroupToBuild); } myContextActions.put(entry.getKey(), new TopToolbarContextActions(leftActions, middleActions, rightActions)); if (leftGroupToBuild.getChildrenCount() > 0 || rightGroupToBuild.getChildrenCount() > 0) { hasToolbarContent = true; } } return hasToolbarContent; }
rebuildCommonActions
290,563
void (@NotNull Wrapper placeHolder, @NotNull String place, @NotNull DefaultActionGroup group) { ActionToolbar tb = myActionManager.createActionToolbar(place, group, true); tb.setReservePlaceAutoPopupIcon(false); tb.setTargetComponent(myComponent); tb.getComponent().setBorder(null); tb.getComponent().setOpaque(false); placeHolder.setContent(tb.getComponent()); }
setActions
290,564
boolean () { for (Map.Entry<GridImpl, Wrapper> entry : myMinimizedButtonsPlaceholder.entrySet()) { Wrapper eachPlaceholder = entry.getValue(); ActionToolbar tb = myActionManager.createActionToolbar(ActionPlaces.RUNNER_LAYOUT_BUTTON_TOOLBAR, myViewActions, true); tb.setSecondaryActionsIcon(AllIcons.Debugger.RestoreLayout, UIExperiment.isNewDebuggerUIEnabled()); tb.setSecondaryActionsTooltip(ExecutionBundle.message("runner.content.tooltip.layout.settings")); tb.setTargetComponent(myComponent); tb.getComponent().setOpaque(false); tb.getComponent().setBorder(null); tb.setReservePlaceAutoPopupIcon(false); JComponent minimized = tb.getComponent(); eachPlaceholder.setContent(minimized); } myTabs.getComponent().revalidate(); myTabs.getComponent().repaint(); return myViewActions.getChildrenCount() > 0; }
rebuildMinimizedActions
290,565
void (final boolean validateNow) { boolean hasToolbarContent = rebuildToolbar(); Set<String> usedNames = new HashSet<>(); List<TabInfo> tabs = myTabs.getTabs(); for (TabInfo each : tabs) { hasToolbarContent |= updateTabUI(each, usedNames); } int tabsCount = tabs.size() + myChildren.stream().mapToInt(child -> child.myTabs.getTabCount()).sum(); boolean hideTabs = !hasToolbarContent && tabsCount <= 1 && myOriginal == null; myTabs.getPresentation().setHideTabs(hideTabs); myTabs.updateTabActions(validateNow); if (validateNow) { myTabs.sortTabs(myTabsComparator); } }
updateTabsUI
290,566
boolean (TabInfo tab, Set<? super String> usedNames) { TabImpl t = getTabFor(tab); if (t == null) { return false; } Icon icon = t.getIcon(); GridImpl grid = getGridFor(tab); boolean hasToolbarContent = grid.updateGridUI(); List<Content> contents = grid.getContents(); String title = contents.size() > 1 ? t.getDisplayName() : null; if (title == null) { String name = myLayoutSettings.getDefaultDisplayName(t.getDefaultIndex()); if (name != null && contents.size() > 1 && !usedNames.contains(name)) { title = name; } else { title = Strings.join(contents, Content::getTabName, " | "); } } usedNames.add(title); if (!ClientProperty.isTrue(tab.getComponent(), SingleContentSupplier.DRAGGED_OUT_KEY)) { boolean hidden = true; for (Content content : contents) { if (!grid.isMinimized(content)) { hidden = false; break; } } tab.setHidden(hidden); } if (icon == null && contents.size() == 1) { icon = contents.get(0).getIcon(); } tab.setDragOutDelegate(myTabs.getTabs().size() > 1 || !isOriginal() ? myDragOutDelegate : null); Tab gridTab = grid.getTab(); tab.setText(title).setIcon(gridTab != null && gridTab.isDefault() && contents.size() > 1 ? null : icon); return hasToolbarContent; }
updateTabUI
290,567
ActionCallback () { if (isStateBeingRestored()) return ActionCallback.REJECTED; try { setStateIsBeingRestored(true, this); List<TabInfo> tabs = new ArrayList<>(myTabs.getTabs()); final ActionCallback result = new ActionCallback(tabs.size()); for (TabInfo each : tabs) { getGridFor(each).restoreLastUiState().notifyWhenDone(result); } return result; } finally { setStateIsBeingRestored(false, this); } }
restoreLastUiState
290,568
void () { if (isStateBeingRestored()) return; if (myOriginal != null) { myOriginal.saveUiState(); return; } if (!myUiLastStateWasRestored) return; int offset = updateTabsIndices(myTabs, 0); for (RunnerContentUi child : myChildren) { offset = updateTabsIndices(child.myTabs, offset); } doSaveUiState(); }
saveUiState
290,569
int (final JBTabs tabs, int offset) { for (TabInfo each : tabs.getTabs()) { final int index = tabs.getIndexOf(each); final TabImpl tab = getTabFor(each); if (tab != null) tab.setIndex(index >= 0 ? index + offset : index); } return offset + tabs.getTabCount(); }
updateTabsIndices
290,570
void () { if (isStateBeingRestored()) return; for (TabInfo each : myTabs.getTabs()) { GridImpl eachGrid = getGridFor(each); eachGrid.saveUiState(); } for (RunnerContentUi child : myChildren) { child.doSaveUiState(); } }
doSaveUiState
290,571
void () { final Window window = SwingUtilities.getWindowAncestor(myComponent); if (window instanceof IdeFrame.Child) { ((IdeFrame.Child)window).setFrameTitle(mySessionName); } }
showNotify
290,572
GridImpl (TabInfo tab) { return (GridImpl)tab.getComponent(); }
getGridFor
290,573
Stream<GridImpl> () { return myTabs.getTabs().stream().map(RunnerContentUi::getGridFor); }
getGrids
290,574
boolean () { return false; }
isSingleSelection
290,575
boolean () { return false; }
isToSelectAddedContent
290,576
boolean () { return true; }
canBeEmptySelection
290,577
void () { if (myOriginal != null) { myDisposing = true; fireContentClosed(null); } }
beforeDispose
290,578
boolean (@NotNull Content content, boolean implicit) { if (implicit) { GridImpl grid = getGridFor(content, false); if (grid != null) { return !grid.isMinimized(content); } } return true; }
canChangeSelectionTo
290,579
String () { return UIBundle.message("tabbed.pane.close.tab.action.name"); }
getCloseActionName
290,580
String () { return UIBundle.message("tabbed.pane.close.all.tabs.but.this.action.name"); }
getCloseAllButThisActionName
290,581
String () { return ExecutionBundle.message("select.previous.tab"); }
getPreviousContentActionName
290,582
String () { return ExecutionBundle.message("select.next.tab"); }
getNextContentActionName
290,583
void () { if (myOriginal != null) { myOriginal.myChildren.remove(this); } myMinimizedButtonsPlaceholder.clear(); myCommonActionsPlaceholder.clear(); myContextActions.clear(); myOriginal = null; myTopLeftActions = null; myTopRightActions = null; myAdditionalFocusActions = null; myLeftToolbarActions = null; }
dispose
290,584
void () { final RunnerContentUi[] children = myChildren.toArray(new RunnerContentUi[0]); final LinkedHashSet<Content> contents = new LinkedHashSet<>(); Collections.addAll(contents, myManager.getContents()); for (RunnerContentUi child : children) { Collections.addAll(contents, child.myManager.getContents()); } for (AnAction action : myViewActions.getChildren(null)) { if (!(action instanceof ViewLayoutModificationAction)) continue; contents.add(((ViewLayoutModificationAction)action).getContent()); } Content[] all = contents.toArray(new Content[0]); Arrays.sort(all, Comparator.comparingInt(content -> getStateFor(content).getTab().getDefaultIndex())); setStateIsBeingRestored(true, this); try { for (RunnerContentUi child : children) { child.myManager.removeAllContents(false); } myManager.removeAllContents(false); } finally { setStateIsBeingRestored(false, this); } myLayoutSettings.resetToDefault(); for (Content each : all) { myManager.addContent(each); CustomContentLayoutSettings customLayoutOptionsCollection = each.getUserData(CustomContentLayoutSettings.KEY); if (customLayoutOptionsCollection != null) { customLayoutOptionsCollection.restore(); } } updateTabsUI(true); }
restoreLayout
290,585
boolean () { return !myRestoreStateRequestors.isEmpty(); }
isStateBeingRestored
290,586
void (final boolean restoredNow, final Object requestor) { if (restoredNow) { myRestoreStateRequestors.add(requestor); } else { myRestoreStateRequestors.remove(requestor); } }
setStateIsBeingRestored
290,587
void () { Collection<TopToolbarWrappers> values = myCommonActionsPlaceholder.values(); Stream<Wrapper> leftWrappers = values.stream().map(it -> it.left); Stream<Wrapper> rightWrappers = values.stream().map(it -> it.right); StreamEx.of(myToolbar).append(leftWrappers).append(rightWrappers) .map(Wrapper::getTargetComponent) .select(ActionToolbar.class) .distinct() .forEach(ActionToolbar::updateActionsImmediately); }
updateActionsImmediately
290,588
void () { List<AnAction> specialActions = new ArrayList<>(); for (AnAction action : myViewActions.getChildren(null)) { if (!(action instanceof ViewLayoutModificationAction)) specialActions.add(action); } if (myMinimizeActionEnabled) { if (specialActions.isEmpty()) { var separateWatchesInVariables = ActionManager.getInstance().getAction("XDebugger.SwitchWatchesInVariables"); if (separateWatchesInVariables instanceof ToggleAction) { myViewActions.addAction(new Separator()).setAsSecondary(true); myViewActions.addAction(new ToggleSeparateWatches((ToggleAction)separateWatchesInVariables, true)).setAsSecondary(true); } myViewActions.addAction(new Separator()).setAsSecondary(true); myViewActions.addAction(ActionManager.getInstance().getAction("Runner.ToggleTabLabels")).setAsSecondary(true); myViewActions.addAction(ActionManager.getInstance().getAction("Runner.RestoreLayout")).setAsSecondary(true); } } else { for (AnAction action : specialActions) { myViewActions.remove(action); } } }
updateRestoreLayoutActionVisibility
290,589
boolean () { return myMinimizeActionEnabled && myOriginal == null; }
isMinimizeActionEnabled
290,590
boolean () { return myMoveToGridActionEnabled; }
isMoveToGridActionEnabled
290,591
void (String contentId, final LayoutAttractionPolicy policy) { myAttractions.put(Pair.create(contentId, null), policy); }
setPolicy
290,592
LayoutAttractionPolicy (@Nullable String contentId, @Nullable String condition, @NotNull Map<Pair<String, String>, LayoutAttractionPolicy> map, LayoutAttractionPolicy defaultPolicy) { LayoutAttractionPolicy policy = map.putIfAbsent(Pair.create(contentId, condition), defaultPolicy); return policy != null ? policy : defaultPolicy; }
getOrCreatePolicyFor
290,593
boolean () { return myToDisposeRemovedContent; }
isToDisposeRemovedContent
290,594
boolean () { return myBoundingBox != null; }
needsRepaint
290,595
void (Component component, Graphics2D g) { if (myBoundingBox == null) return; GraphicsUtil.setupAAPainting(g); g.setColor(JBUI.CurrentTheme.DragAndDrop.Area.BACKGROUND); g.fill(myBoundingBox); }
executePaint
290,596
void (RunnerContentUi ui, DockableContent dockable, RelativePoint dropTarget) { myBoundingBox = null; setNeedsRepaint(true); if (!(dockable instanceof DockableGrid)) return; JComponent component = ui.myComponent; Point point = dropTarget != null ? dropTarget.getPoint(component) : null; // do not paint anything if adding to the top if (ui.myTabs.shouldAddToGlobal(point)) return; // calc target place-in-grid PlaceInGrid targetPlaceInGrid = null; for (Content c : ((DockableGrid)dockable).getContents()) { View view = ui.getStateFor(c); if (view.isMinimizedInGrid()) continue; PlaceInGrid defaultGridPlace = ui.getLayoutSettings().getDefaultGridPlace(c); targetPlaceInGrid = point == null ? defaultGridPlace : calcPlaceInGrid(point, component.getSize()); break; } if (targetPlaceInGrid == null) return; // calc the default rectangle for the targetPlaceInGrid "area" Dimension size = component.getSize(); Rectangle r = new Rectangle(size); switch (targetPlaceInGrid) { case left -> r.width /= 3; case center -> { r.width /= 3; r.x += r.width; } case right -> { r.width /= 3; r.x += 2 * r.width; } case bottom -> { r.height /= 4; r.y += 3 * r.height; } } // adjust the rectangle if the target grid cell is already present and showing for (Content c : ui.getContentManager().getContents()) { GridCell cellFor = ui.findCellFor(c); PlaceInGrid placeInGrid = cellFor == null ? null : ((GridCellImpl)cellFor).getPlaceInGrid(); if (placeInGrid != targetPlaceInGrid) continue; Wrapper wrapper = ComponentUtil.getParentOfType((Class<? extends Wrapper>)Wrapper.class, (Component)c.getComponent()); JComponent cellWrapper = wrapper == null ? null : (JComponent)wrapper.getParent(); if (cellWrapper == null || !cellWrapper.isShowing()) continue; r = new RelativeRectangle(cellWrapper).getRectangleOn(component); break; } myBoundingBox = new Rectangle2D.Double(r.x, r.y, r.width, r.height); }
processDropOver
290,597
void (Graphics g) { super.paintComponent(g); if (!UIExperiment.isNewDebuggerUIEnabled()) return; InternalDecoratorImpl decorator = ComponentUtil.getParentOfType(InternalDecoratorImpl.class, myComponent); if (decorator != null && myTabs.getTabCount() > 0 && !decorator.isHeaderVisible()) { UIUtil.drawHeader(g, 0, getWidth(), decorator.getHeaderHeight(), decorator.isActive(), true, false, false); } }
paintComponent
290,598
String () { return RunnerContentUi.this.getName(); }
getName
290,599
List<AnAction> (boolean originalProvider) { return RunnerContentUi.this.getActions(originalProvider); }
getActions