use of com.intellij.ui.content.Content 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.Content in project android by JetBrains.
the class ToolWindowFixture method getContent.
@Nullable
protected Content getContent(@NotNull final String displayName) {
activateAndWaitUntilIsVisible();
final Ref<Content> contentRef = new Ref<>();
Wait.seconds(SECONDS_TO_WAIT).expecting("content '" + displayName + "' to be found").until(() -> {
Content[] contents = getContents();
for (Content content : contents) {
if (displayName.equals(content.getDisplayName())) {
contentRef.set(content);
return true;
}
}
return false;
});
return contentRef.get();
}
use of com.intellij.ui.content.Content in project android by JetBrains.
the class AndroidModelView method createToolWindowContent.
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
JPanel toolWindowPanel = ToolWindowAlikePanel.createTreePanel(myProject.getName(), myTree);
Content content = contentFactory.createContent(toolWindowPanel, "", false);
toolWindow.getContentManager().addContent(content);
updateContents();
}
use of com.intellij.ui.content.Content in project android by JetBrains.
the class InternalAndroidModelView method createToolWindowContent.
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
JPanel toolWindowPanel = ToolWindowAlikePanel.createTreePanel(myProject.getName(), myTree);
Content content = contentFactory.createContent(toolWindowPanel, "", false);
toolWindow.getContentManager().addContent(content);
updateContents();
}
use of com.intellij.ui.content.Content in project android by JetBrains.
the class ShowLogcatTask method showLogcatConsole.
private static void showLogcatConsole(@NotNull final Project project, @NotNull final IDevice device, @Nullable final Client client) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
final ToolWindow androidToolWindow = ToolWindowManager.getInstance(project).getToolWindow(AndroidToolWindowFactory.TOOL_WINDOW_ID);
// Activate the tool window, and once activated, make sure the right device is selected
androidToolWindow.activate(new Runnable() {
@Override
public void run() {
int count = androidToolWindow.getContentManager().getContentCount();
for (int i = 0; i < count; i++) {
Content content = androidToolWindow.getContentManager().getContent(i);
DevicePanel devicePanel = content == null ? null : content.getUserData(AndroidToolWindowFactory.DEVICES_PANEL_KEY);
if (devicePanel != null) {
devicePanel.selectDevice(device);
devicePanel.selectClient(client);
break;
}
}
}
}, false);
}
});
}
Aggregations