use of com.intellij.ui.content.ContentManager in project android by JetBrains.
the class CaptureEditorLightToolWindowManager method initToolWindow.
@Override
protected void initToolWindow() {
myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(getManagerName(), false, getAnchor(), myProject, true);
myToolWindow.setIcon(getIcon());
if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
myToolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
}
((ToolWindowEx) myToolWindow).setTitleActions(createActions());
initGearActions();
ContentManager contentManager = myToolWindow.getContentManager();
Content content = contentManager.getFactory().createContent(getContent(), getToolWindowTitleBarText(), false);
content.setCloseable(false);
content.setPreferredFocusableComponent(getFocusedComponent());
contentManager.addContent(content);
contentManager.setSelectedContent(content, true);
myToolWindow.setAvailable(false, null);
}
use of com.intellij.ui.content.ContentManager in project android by JetBrains.
the class NlPreviewManager method initToolWindow.
protected void initToolWindow() {
myToolWindowForm = new NlPreviewForm(this);
final String toolWindowId = getToolWindowId();
myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(toolWindowId, false, ToolWindowAnchor.RIGHT, myProject, true);
myToolWindow.setIcon(AndroidIcons.AndroidPreview);
((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {
@Override
public void stateChanged() {
if (myProject.isDisposed()) {
return;
}
final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(toolWindowId);
if (window != null && window.isAvailable()) {
final boolean visible = window.isVisible();
AndroidEditorSettings.getInstance().getGlobalState().setVisible(visible);
if (myToolWindowForm != null) {
if (visible) {
myToolWindowForm.activate();
} else {
myToolWindowForm.deactivate();
}
}
}
}
});
final JComponent contentPanel = myToolWindowForm.getComponent();
final ContentManager contentManager = myToolWindow.getContentManager();
@SuppressWarnings("ConstantConditions") final Content content = contentManager.getFactory().createContent(contentPanel, null, false);
content.setDisposer(myToolWindowForm);
content.setCloseable(false);
content.setPreferredFocusableComponent(contentPanel);
contentManager.addContent(content);
contentManager.setSelectedContent(content, true);
myToolWindow.setAvailable(false, null);
myToolWindowForm.setUseInteractiveSelector(isUseInteractiveSelector());
}
use of com.intellij.ui.content.ContentManager in project intellij-plugins by JetBrains.
the class DartPubActionBase method showPubOutputConsole.
private static void showPubOutputConsole(@NotNull final Module module, @NotNull final GeneralCommandLine command, @NotNull final OSProcessHandler processHandler, @NotNull final VirtualFile pubspecYamlFile, @NotNull final String actionTitle) {
final ConsoleView console;
PubToolWindowContentInfo info = findExistingInfoForCommand(module.getProject(), command);
if (info != null) {
// rerunning the same pub command in the same tool window tab (corresponding tool window action invoked)
console = info.console;
console.clear();
} else {
console = createConsole(module.getProject(), pubspecYamlFile);
info = new PubToolWindowContentInfo(module, pubspecYamlFile, command, actionTitle, console);
final ActionToolbar actionToolbar = createToolWindowActionsBar(info);
final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
toolWindowPanel.setContent(console.getComponent());
toolWindowPanel.setToolbar(actionToolbar.getComponent());
final Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel.getComponent(), actionTitle, true);
content.putUserData(PUB_TOOL_WINDOW_CONTENT_INFO_KEY, info);
Disposer.register(content, console);
final ContentManager contentManager = MessageView.SERVICE.getInstance(module.getProject()).getContentManager();
removeOldTabs(contentManager);
contentManager.addContent(content);
contentManager.setSelectedContent(content);
final ToolWindow toolWindow = ToolWindowManager.getInstance(module.getProject()).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
toolWindow.activate(null, true);
}
info.rerunPubCommandAction.setProcessHandler(processHandler);
info.stopProcessAction.setProcessHandler(processHandler);
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(final ProcessEvent event) {
console.print(IdeBundle.message("finished.with.exit.code.text.message", event.getExitCode()), ConsoleViewContentType.SYSTEM_OUTPUT);
}
});
console.print(DartBundle.message("working.dir.0", FileUtil.toSystemDependentName(pubspecYamlFile.getParent().getPath())) + "\n", ConsoleViewContentType.SYSTEM_OUTPUT);
console.attachToProcess(processHandler);
processHandler.startNotify();
}
use of com.intellij.ui.content.ContentManager 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.content.ContentManager in project intellij-community by JetBrains.
the class GridCellImpl method updateSelection.
public void updateSelection(final boolean isShowing) {
ContentManager contentManager = myContext.getContentManager();
if (contentManager.isDisposed())
return;
for (Content each : myContents.getKeys()) {
final TabInfo eachTab = getTabFor(each);
boolean isSelected = eachTab != null && myTabs.getSelectedInfo() == eachTab;
if (isSelected && isShowing) {
contentManager.addSelectedContent(each);
} else {
contentManager.removeFromSelection(each);
}
}
for (Content each : myMinimizedContents) {
contentManager.removeFromSelection(each);
}
}
Aggregations