Search in sources :

Example 1 with DockableContent

use of com.intellij.ui.docking.DockableContent in project intellij-community by JetBrains.

the class RunnerContentUi method add.

@Override
public void add(@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);
}
Also used : DockableContent(com.intellij.ui.docking.DockableContent) RelativePoint(com.intellij.ui.awt.RelativePoint)

Aggregations

RelativePoint (com.intellij.ui.awt.RelativePoint)1 DockableContent (com.intellij.ui.docking.DockableContent)1