use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.
the class JBRunnerTabs method processDropOver.
@Override
public void processDropOver(TabInfo over, RelativePoint relativePoint) {
final Point point = relativePoint.getPoint(getComponent());
myShowDropLocation = shouldAddToGlobal(point);
super.processDropOver(over, relativePoint);
for (Map.Entry<TabInfo, TabLabel> entry : myInfo2Label.entrySet()) {
final TabLabel label = entry.getValue();
if (label.getBounds().contains(point) && myDropInfo != entry.getKey()) {
select(entry.getKey(), false);
break;
}
}
}
use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.
the class RunnerContentUi method validate.
@Override
public void validate(Content content, final ActiveRunnable toRestore) {
final TabInfo current = myTabs.getSelectedInfo();
myTabs.getPresentation().setPaintBlocked(true, true);
select(content, false).doWhenDone(() -> {
myTabs.getComponent().validate();
toRestore.run().doWhenDone(() -> {
assert current != null;
myTabs.select(current, true);
myTabs.getPresentation().setPaintBlocked(false, true);
});
});
}
use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.
the class RunnerContentUi method updateTabsUI.
private void updateTabsUI(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();
myTabs.getPresentation().setHideTabs(!hasToolbarContent && tabsCount <= 1 && myOriginal == null);
myTabs.updateTabActions(validateNow);
if (validateNow) {
myTabs.sortTabs(myTabsComparator);
}
}
use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.
the class RunnerContentUi method updateTabsIndices.
private static int updateTabsIndices(final JBRunnerTabs 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();
}
use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.
the class RunnerContentUi method getGridFor.
@Nullable
private GridImpl getGridFor(@NotNull Content content, boolean createIfMissing) {
GridImpl grid = (GridImpl) findGridFor(content);
if (grid != null || !createIfMissing)
return grid;
grid = new GridImpl(this, mySessionName);
if (myCurrentOver != null || myOriginal != null) {
Integer forcedDropIndex = content.getUserData(RunnerLayout.DROP_INDEX);
final int index = myTabs.getDropInfoIndex() + (myOriginal != null ? myOriginal.getTabOffsetFor(this) : 0);
final int dropIndex = forcedDropIndex != null ? forcedDropIndex : index;
if (forcedDropIndex == null) {
moveFollowingTabs(dropIndex);
}
final int defaultIndex = content.getUserData(RunnerLayout.DEFAULT_INDEX);
final TabImpl tab = myLayoutSettings.getOrCreateTab(forcedDropIndex != null ? forcedDropIndex : -1);
tab.setDefaultIndex(defaultIndex);
tab.setIndex(dropIndex);
getStateFor(content).assignTab(tab);
content.putUserData(RunnerLayout.DROP_INDEX, null);
content.putUserData(RunnerLayout.DEFAULT_INDEX, null);
}
TabInfo tab = new TabInfo(grid).setObject(getStateFor(content).getTab()).setText("Tab");
Wrapper left = new Wrapper();
myCommonActionsPlaceholder.put(grid, left);
Wrapper minimizedToolbar = new Wrapper();
myMinimizedButtonsPlaceholder.put(grid, minimizedToolbar);
final Wrapper searchComponent = new Wrapper();
if (content.getSearchComponent() != null) {
searchComponent.setContent(content.getSearchComponent());
}
TwoSideComponent right = new TwoSideComponent(searchComponent, minimizedToolbar);
NonOpaquePanel sideComponent = new TwoSideComponent(left, right);
tab.setSideComponent(sideComponent);
tab.setTabLabelActions((ActionGroup) myActionManager.getAction(VIEW_TOOLBAR), TAB_TOOLBAR_PLACE);
myTabs.addTab(tab);
myTabs.sortTabs(myTabsComparator);
return grid;
}
Aggregations