use of com.intellij.ui.tabs.impl.JBTabsImpl in project intellij-community by JetBrains.
the class TableLayout method getDropIndexFor.
@Override
public int getDropIndexFor(Point point) {
if (myLastTableLayout == null)
return -1;
int result = -1;
Component c = myTabs.getComponentAt(point);
if (c instanceof JBTabsImpl) {
for (int i = 0; i < myLastTableLayout.myVisibleInfos.size() - 1; i++) {
TabLabel first = myTabs.myInfo2Label.get(myLastTableLayout.myVisibleInfos.get(i));
TabLabel second = myTabs.myInfo2Label.get(myLastTableLayout.myVisibleInfos.get(i + 1));
Rectangle firstBounds = first.getBounds();
Rectangle secondBounds = second.getBounds();
final boolean between = firstBounds.getMaxX() < point.x && secondBounds.getX() > point.x && firstBounds.y < point.y && secondBounds.getMaxY() > point.y;
if (between) {
c = first;
break;
}
}
}
if (c instanceof TabLabel) {
TabInfo info = ((TabLabel) c).getInfo();
int index = myLastTableLayout.myVisibleInfos.indexOf(info);
boolean isDropTarget = myTabs.isDropTarget(info);
if (!isDropTarget) {
for (int i = 0; i <= index; i++) {
if (myTabs.isDropTarget(myLastTableLayout.myVisibleInfos.get(i))) {
index -= 1;
break;
}
}
result = index;
} else if (index < myLastTableLayout.myVisibleInfos.size()) {
result = index;
}
}
return result;
}
use of com.intellij.ui.tabs.impl.JBTabsImpl in project intellij-community by JetBrains.
the class DockableEditorTabbedContainer method add.
@Override
public void add(@NotNull DockableContent content, RelativePoint dropTarget) {
EditorWindow window = null;
if (myCurrentOver != null) {
final DataProvider provider = myCurrentOver.getDataProvider();
if (provider != null) {
window = EditorWindow.DATA_KEY.getData(provider);
}
}
final EditorTabbedContainer.DockableEditor dockableEditor = (EditorTabbedContainer.DockableEditor) content;
VirtualFile file = dockableEditor.getFile();
if (window == null || window.isDisposed()) {
window = mySplitters.getOrCreateCurrentWindow(file);
}
if (myCurrentOver != null) {
int index = ((JBTabsImpl) myCurrentOver).getDropInfoIndex();
file.putUserData(EditorWindow.INITIAL_INDEX_KEY, index);
}
((FileEditorManagerImpl) FileEditorManagerEx.getInstanceEx(myProject)).openFileImpl2(window, file, true);
window.setFilePinned(file, dockableEditor.isPinned());
}
use of com.intellij.ui.tabs.impl.JBTabsImpl in project buck by facebook.
the class BuckToolWindowFactory method createToolWindowContent.
@Override
public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
toolWindow.setAvailable(true, null);
toolWindow.setToHideOnEmptyContent(true);
toolWindow.setIcon(BuckIcons.BUCK_TOOL_WINDOW_ICON);
RunnerLayoutUi runnerLayoutUi = BuckUIManager.getInstance(project).getLayoutUi(project);
BuckSettingsProvider.State state = BuckSettingsProvider.getInstance().getState();
JBTabs myTabs = new JBTabsImpl(project);
// Debug Console
if (state.showDebug) {
Content consoleContent = createConsoleContent(runnerLayoutUi, project);
myTabs.addTab(new TabInfo(consoleContent.getComponent())).setText("Debug");
}
// Build Tree Events
Content treeViewContent = runnerLayoutUi.createContent(BUILD_OUTPUT_PANEL, createBuildInfoPanel(project), "Build Output", null, null);
myTabs.addTab(new TabInfo(treeViewContent.getComponent()).setText("Build"));
Content tabsContent = runnerLayoutUi.createContent(TABS_CONTENT_ID, myTabs.getComponent(), "Buck Tool Tabs", null, null);
runnerLayoutUi.addContent(tabsContent, 0, PlaceInGrid.center, false);
runnerLayoutUi.getOptions().setLeftToolbar(getLeftToolbarActions(project), ActionPlaces.UNKNOWN);
runnerLayoutUi.updateActionsNow();
final ContentManager contentManager = toolWindow.getContentManager();
Content content = contentManager.getFactory().createContent(runnerLayoutUi.getComponent(), "", true);
contentManager.addContent(content);
updateBuckToolWindowTitle(project);
}
use of com.intellij.ui.tabs.impl.JBTabsImpl in project intellij-community by JetBrains.
the class DisposerDebugger method initUi.
private void initUi() {
myComponent = new JPanel();
myTreeTabs = new JBTabsImpl(null, null, this);
final Splitter splitter = new Splitter(true);
final JBTabsImpl bottom = new JBTabsImpl(null, null, this);
final AllocationPanel allocations = new AllocationPanel(myTreeTabs);
bottom.addTab(new TabInfo(allocations).setText("Allocation")).setActions(allocations.getActions(), ActionPlaces.UNKNOWN);
splitter.setFirstComponent(myTreeTabs);
splitter.setSecondComponent(bottom);
myComponent.setLayout(new BorderLayout());
myComponent.add(splitter, BorderLayout.CENTER);
JLabel countLabel = new JLabel("Total disposable count: " + Disposer.getTree().size());
myComponent.add(countLabel, BorderLayout.SOUTH);
addTree(new DisposerTree(this), "All", false);
addTree(new DisposerTree(this), "Watch", true);
}
Aggregations