Search in sources :

Example 1 with ContentManagerWatcher

use of com.intellij.ide.impl.ContentManagerWatcher in project intellij-community by JetBrains.

the class RunContentManagerImpl method registerToolWindow.

private void registerToolWindow(@NotNull final Executor executor, @NotNull ToolWindowManagerEx toolWindowManager) {
    final String toolWindowId = executor.getToolWindowId();
    if (toolWindowManager.getToolWindow(toolWindowId) != null) {
        return;
    }
    final ToolWindow toolWindow = toolWindowManager.registerToolWindow(toolWindowId, true, ToolWindowAnchor.BOTTOM, this, true);
    final ContentManager contentManager = toolWindow.getContentManager();
    contentManager.addDataProvider(new DataProvider() {

        private int myInsideGetData = 0;

        @Override
        public Object getData(String dataId) {
            myInsideGetData++;
            try {
                if (PlatformDataKeys.HELP_ID.is(dataId)) {
                    return executor.getHelpId();
                } else {
                    return myInsideGetData == 1 ? DataManager.getInstance().getDataContext(contentManager.getComponent()).getData(dataId) : null;
                }
            } finally {
                myInsideGetData--;
            }
        }
    });
    toolWindow.setIcon(executor.getToolWindowIcon());
    new ContentManagerWatcher(toolWindow, contentManager);
    initToolWindow(executor, toolWindowId, executor.getToolWindowIcon(), contentManager);
}
Also used : DataProvider(com.intellij.openapi.actionSystem.DataProvider) ToolWindow(com.intellij.openapi.wm.ToolWindow) ContentManagerWatcher(com.intellij.ide.impl.ContentManagerWatcher)

Example 2 with ContentManagerWatcher

use of com.intellij.ide.impl.ContentManagerWatcher in project intellij-community by JetBrains.

the class SliceManager method getContentManager.

private ContentManager getContentManager(boolean dataFlowToThis) {
    if (dataFlowToThis) {
        if (myBackContentManager == null) {
            ToolWindow backToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(BACK_TOOLWINDOW_ID, true, ToolWindowAnchor.BOTTOM, myProject);
            myBackContentManager = backToolWindow.getContentManager();
            new ContentManagerWatcher(backToolWindow, myBackContentManager);
        }
        return myBackContentManager;
    }
    if (myForthContentManager == null) {
        ToolWindow forthToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(FORTH_TOOLWINDOW_ID, true, ToolWindowAnchor.BOTTOM, myProject);
        myForthContentManager = forthToolWindow.getContentManager();
        new ContentManagerWatcher(forthToolWindow, myForthContentManager);
    }
    return myForthContentManager;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ContentManagerWatcher(com.intellij.ide.impl.ContentManagerWatcher)

Aggregations

ContentManagerWatcher (com.intellij.ide.impl.ContentManagerWatcher)2 ToolWindow (com.intellij.openapi.wm.ToolWindow)2 DataProvider (com.intellij.openapi.actionSystem.DataProvider)1