use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-leiningen-plugin by derkork.
the class LeiningenProjectNavigator method addPanel.
private void addPanel() {
initTree();
myStructure = new LeiningenProjectStructure(myProject, myProjectsManager, myTree);
JPanel panel = new LeiningenProjectNavigatorPanel(myProject, myTree);
final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject);
myToolWindow = manager.registerToolWindow(TOOL_WINDOW_ID, panel, ToolWindowAnchor.RIGHT, myProject, true);
myToolWindow.setIcon(LeiningenIcons.PROJECT_ICON);
final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {
boolean wasVisible = false;
@Override
public void stateChanged() {
if (myToolWindow.isDisposed())
return;
boolean visible = myToolWindow.isVisible();
if (!visible || visible == wasVisible)
return;
scheduleStructureUpdate();
wasVisible = visible;
}
};
manager.addToolWindowManagerListener(listener);
Disposer.register(myProject, new Disposable() {
public void dispose() {
manager.removeToolWindowManagerListener(listener);
}
});
scheduleStructureUpdate();
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-code-outline by sitano.
the class CodeOutlinePlugin method regForProject.
/**
* Creates a code outline tool window for the given project.
*
* @param project the project to register
*/
private synchronized void regForProject(final Project project) {
final CodeOutlineToolWindow window = new CodeOutlineToolWindow(this, project);
ToolWindowManager twm = ToolWindowManager.getInstance(project);
ToolWindowManagerEx twmEx = (ToolWindowManagerEx) twm;
ToolWindow tw = twm.registerToolWindow(TOOLWINDOW_ID, false, ToolWindowAnchor.RIGHT);
ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
Content content = contentFactory.createContent(window, "", false);
tw.getContentManager().addContent(content);
tw.getContentManager().setSelectedContent(content, false);
twmEx.addToolWindowManagerListener(window.getToolWindowManagerListener());
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project freeline by alibaba.
the class FreelineTerminal method initTerminal.
public void initTerminal(final ToolWindow toolWindow) {
toolWindow.setToHideOnEmptyContent(true);
LocalTerminalDirectRunner terminalRunner = LocalTerminalDirectRunner.createTerminalRunner(myProject);
toolWindow.setStripeTitle("Freeline");
Content content = createTerminalInContentPanel(terminalRunner, toolWindow);
toolWindow.getContentManager().addContent(content);
toolWindow.setShowStripeButton(true);
toolWindow.setTitle("Console");
((ToolWindowManagerEx) ToolWindowManager.getInstance(this.myProject)).addToolWindowManagerListener(new ToolWindowManagerListener() {
@Override
public void toolWindowRegistered(@NotNull String s) {
}
@Override
public void stateChanged() {
ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(FreelineToolWindowFactory.TOOL_WINDOW_ID);
if (window != null) {
boolean visible = window.isVisible();
if (visible && toolWindow.getContentManager().getContentCount() == 0) {
initTerminal(window);
}
}
}
});
toolWindow.show(null);
JBTabbedTerminalWidget terminalWidget = getTerminalWidget(toolWindow);
if (terminalWidget != null && terminalWidget.getCurrentSession() != null) {
Terminal terminal = terminalWidget.getCurrentSession().getTerminal();
if (terminal != null) {
terminal.setCursorVisible(false);
}
}
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class PythonConsoleToolWindow method doInit.
private void doInit(@NotNull final ToolWindow toolWindow) {
myInitialized = true;
toolWindow.setToHideOnEmptyContent(true);
((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerListener() {
@Override
public void toolWindowRegistered(@NotNull String id) {
}
@Override
public void stateChanged() {
ToolWindow window = getToolWindow(myProject);
if (window != null) {
boolean visible = window.isVisible();
if (visible && toolWindow.getContentManager().getContentCount() == 0) {
PydevConsoleRunner runner = PythonConsoleRunnerFactory.getInstance().createConsoleRunner(myProject, null);
runner.run();
}
}
}
});
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class TerminalToolWindowPanel method initTerminal.
public void initTerminal(final ToolWindow toolWindow) {
LocalTerminalDirectRunner terminalRunner = LocalTerminalDirectRunner.createTerminalRunner(myProject);
toolWindow.setToHideOnEmptyContent(true);
Content content = createTerminalInContentPanel(terminalRunner, toolWindow);
toolWindow.getContentManager().addContent(content);
((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerListener() {
@Override
public void toolWindowRegistered(@NotNull String id) {
}
@Override
public void stateChanged() {
ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(TerminalToolWindowFactory.TOOL_WINDOW_ID);
if (window != null) {
boolean visible = window.isVisible();
if (visible && toolWindow.getContentManager().getContentCount() == 0) {
initTerminal(window);
}
}
}
});
Disposer.register(myProject, new Disposable() {
@Override
public void dispose() {
if (myTerminalWidget != null) {
myTerminalWidget.dispose();
myTerminalWidget = null;
}
}
});
if (myDockContainer == null) {
myDockContainer = new TerminalDockContainer(toolWindow);
Disposer.register(myProject, myDockContainer);
DockManager.getInstance(myProject).register(myDockContainer);
}
}
Aggregations