use of com.intellij.ui.content.Content in project android by JetBrains.
the class FloatingToolWindow method setToolWindowContent.
private void setToolWindowContent(@NotNull ToolWindowEx toolWindow) {
ContentManager contentManager = toolWindow.getContentManager();
Content content = contentManager.getSelectedContent();
if (content == null) {
content = contentManager.getFactory().createContent(myContent.getComponent(), null, false);
content.setCloseable(false);
content.setComponent(myContent.getComponent());
content.setPreferredFocusableComponent(myContent.getFocusedComponent());
content.setShouldDisposeContent(true);
contentManager.addContent(content);
contentManager.setSelectedContent(content, true);
}
}
use of com.intellij.ui.content.Content in project android by JetBrains.
the class AndroidToolWindowFactory method createLogcatContent.
private static Content createLogcatContent(RunnerLayoutUi layoutUi, final Project project, DeviceContext deviceContext) {
final AndroidLogcatView logcatView = new AndroidLogcatView(project, deviceContext) {
@Override
protected boolean isActive() {
ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(TOOL_WINDOW_ID);
return window.isVisible();
}
};
ToolWindowManagerEx.getInstanceEx(project).addToolWindowManagerListener(new ToolWindowManagerAdapter() {
boolean myToolWindowVisible;
@Override
public void stateChanged() {
ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(TOOL_WINDOW_ID);
if (window != null) {
boolean visible = window.isVisible();
if (visible != myToolWindowVisible) {
myToolWindowVisible = visible;
logcatView.activate();
if (visible) {
ConsoleView console = logcatView.getLogConsole().getConsole();
if (console != null) {
checkFacetAndSdk(project, console);
}
}
}
}
}
});
final MessageBusConnection connection = project.getMessageBus().connect(project);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyAndroidPlatformListener(logcatView));
JPanel logcatContentPanel = logcatView.getContentPanel();
final Content logcatContent = layoutUi.createContent(ANDROID_LOGCAT_CONTENT_ID, logcatContentPanel, "logcat", AndroidIcons.Ddms.Logcat, null);
logcatContent.putUserData(AndroidLogcatView.ANDROID_LOGCAT_VIEW_KEY, logcatView);
logcatContent.setDisposer(logcatView);
logcatContent.setCloseable(false);
logcatContent.setPreferredFocusableComponent(logcatContentPanel);
return logcatContent;
}
use of com.intellij.ui.content.Content in project android by JetBrains.
the class MonitorContentFactory method createMonitorContent.
public static void createMonitorContent(@NotNull final Project project, @NotNull DeviceContext deviceContext, @NotNull RunnerLayoutUi layoutUi) {
BaseMonitorView[] monitors = new BaseMonitorView[] { new CpuMonitorView(project, deviceContext), new MemoryMonitorView(project, deviceContext), new NetworkMonitorView(project, deviceContext), new GpuMonitorView(project, deviceContext) };
MonitorPanel monitorPanel = new MonitorPanel(monitors);
JBScrollPane monitorScrollPane = new JBScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
monitorScrollPane.setViewportView(monitorPanel);
monitorScrollPane.getVerticalScrollBar().setUnitIncrement(10);
monitorScrollPane.getHorizontalScrollBar().setUnitIncrement(10);
Content monitorContent = layoutUi.createContent("Monitors", monitorScrollPane, "Monitors", null, null);
monitorContent.setCloseable(false);
layoutUi.addContent(monitorContent);
}
use of com.intellij.ui.content.Content in project android by JetBrains.
the class GradleToolWindowFixture method runTask.
public void runTask(@NotNull final String taskName) {
Content content = getContent("projects");
final Tree tasksTree = findComponentOfType(content.getComponent(), Tree.class);
Wait.seconds(1).expecting("tree to be populated").until(() -> !tasksTree.isEmpty() && !field("myBusy").ofType(boolean.class).in(tasksTree).get());
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
expandAll(tasksTree);
}
});
Object root = tasksTree.getModel().getRoot();
final TreePath treePath = findTaskPath((DefaultMutableTreeNode) root, taskName);
Point clickLocation = GuiQuery.getNonNull(() -> {
// We store screen location here because it shows weird (negative) values after 'scrollPathToVisible()' is called.
Point locationOnScreen = tasksTree.getLocationOnScreen();
tasksTree.expandPath(treePath.getParentPath());
tasksTree.scrollPathToVisible(treePath);
Rectangle bounds = tasksTree.getPathBounds(treePath);
// Make sure we are not under the horizontal scroll bar
bounds.translate(0, bounds.height / 2);
tasksTree.scrollRectToVisible(bounds);
Rectangle visibleRect = tasksTree.getVisibleRect();
return new Point(locationOnScreen.x + bounds.x + bounds.width / 2 - visibleRect.x, locationOnScreen.y + bounds.y - visibleRect.y);
});
myRobot.click(clickLocation, LEFT_BUTTON, 2);
}
use of com.intellij.ui.content.Content in project android by JetBrains.
the class NlAbstractWindowManager method createWindowContent.
protected void createWindowContent(@NotNull JComponent contentPane, @NotNull JComponent focusedComponent, @Nullable AnAction[] actions) {
ContentManager contentManager = myToolWindow.getContentManager();
Content content = contentManager.getFactory().createContent(contentPane, null, false);
content.setCloseable(false);
content.setPreferredFocusableComponent(focusedComponent);
if (actions != null) {
ToolWindowEx toolWindow = (ToolWindowEx) myToolWindow;
toolWindow.setTitleActions(actions);
}
contentManager.addContent(content);
contentManager.setSelectedContent(content, true);
}
Aggregations