use of com.intellij.ui.content.Content 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.ui.content.Content 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.ui.content.Content in project freeline by alibaba.
the class FreelineTerminal method createTerminalInContentPanel.
/**
* 创建Terminal panel
*
* @param terminalRunner
* @param toolWindow
* @return
*/
private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, @NotNull final ToolWindow toolWindow) {
SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false);
content.setCloseable(true);
myTerminalWidget = terminalRunner.createTerminalWidget(content);
panel.setContent(myTerminalWidget.getComponent());
panel.addFocusListener(this);
ActionToolbar toolbar = createToolbar(terminalRunner, myTerminalWidget, toolWindow);
toolbar.setTargetComponent(panel);
panel.setToolbar(toolbar.getComponent());
content.setPreferredFocusableComponent(myTerminalWidget.getComponent());
return content;
}
use of com.intellij.ui.content.Content in project intellij-community by JetBrains.
the class DesignerToolWindowManager method initToolWindow.
//////////////////////////////////////////////////////////////////////////////////////////
//
// Impl
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void initToolWindow() {
if (myToolWindowContent == null) {
myToolWindowContent = new DesignerToolWindow(myProject, true);
}
myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(DesignerBundle.message("designer.toolwindow.name"), false, getAnchor(), myProject, true);
myToolWindow.setIcon(UIDesignerNewIcons.ToolWindow);
if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
myToolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
}
((ToolWindowEx) myToolWindow).setTitleActions(myToolWindowContent.createActions());
initGearActions();
ContentManager contentManager = myToolWindow.getContentManager();
Content content = contentManager.getFactory().createContent(myToolWindowContent.getToolWindowPanel(), DesignerBundle.message("designer.toolwindow.title"), false);
content.setCloseable(false);
content.setPreferredFocusableComponent(myToolWindowContent.getComponentTree());
contentManager.addContent(content);
contentManager.setSelectedContent(content, true);
myToolWindow.setAvailable(false, null);
}
use of com.intellij.ui.content.Content in project intellij-community by JetBrains.
the class PythonConsoleToolWindow method setContent.
private static void setContent(ToolWindow toolWindow, RunContentDescriptor contentDescriptor) {
toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
Content content = toolWindow.getContentManager().findContent(contentDescriptor.getDisplayName());
if (content == null) {
content = createContent(contentDescriptor);
toolWindow.getContentManager().addContent(content);
} else {
SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
resetContent(contentDescriptor, panel, content);
}
toolWindow.getContentManager().setSelectedContent(content);
}
Aggregations