本文整理汇总了Java中com.intellij.ui.content.Content.getComponent方法的典型用法代码示例。如果您正苦于以下问题:Java Content.getComponent方法的具体用法?Java Content.getComponent怎么用?Java Content.getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.content.Content
的用法示例。
在下文中一共展示了Content.getComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRNConsole
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
/**
* 获取 RN Console实例.
*
* @param displayName - the tab's display name must be unique.
* @param icon - used to set a tab icon, not used for search
* @return
*/
public RNConsoleImpl getRNConsole(String displayName, Icon icon) {
ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(RNToolWindowFactory.TOOL_WINDOW_ID);
if (window != null) {
Content existingContent = createConsoleTabContent(window, false, displayName, icon);
if (existingContent != null) {
final JComponent existingComponent = existingContent.getComponent();
if (existingComponent instanceof SimpleToolWindowPanel) {
JComponent component = ((SimpleToolWindowPanel) existingComponent).getContent();
if (component instanceof RNConsoleImpl) {
RNConsoleImpl rnConsole = (RNConsoleImpl) component;
return rnConsole;
}
}
}
}
return null;
}
示例2: updateTarget
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
private void updateTarget() {
targetPanel.setLayout(new GridLayout(0, 1, 0, 0));
if (IMWindowFactory.getDefault() == null || IMWindowFactory.getDefault().getProject() == null) {
return;
}
ToolWindow window = ToolWindowManager.getInstance(IMWindowFactory.getDefault().getProject()).getToolWindow(IMWindowFactory.TOOL_WINDOW_ID);
if (window != null) {
Content[] contents = window.getContentManager().getContents();
if (contents != null) {
for (Content content : contents) {
if (content.getComponent() != null && content.getComponent() instanceof IMPanel) {
IMPanel panel = (IMPanel) content.getComponent();
List<IMChatConsole> chats = panel.getConsoleList();
if (!chats.isEmpty()) {
consoles.addAll(chats);
targetPanel.add(new GroupPanel(content.getDisplayName(), chats));
}
}
}
}
}
}
示例3: getStudyToolWindow
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
@Nullable
public static StudyToolWindow getStudyToolWindow(@NotNull final Project project) {
if (project.isDisposed()) return null;
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
if (toolWindow != null) {
Content[] contents = toolWindow.getContentManager().getContents();
for (Content content: contents) {
JComponent component = content.getComponent();
if (component != null && component instanceof StudyToolWindow) {
return (StudyToolWindow)component;
}
}
}
return null;
}
示例4: findContentComponent
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
/**
* Searches through all {@link Content simple} and {@link TabbedContent tabbed} contents of the given ContentManager,
* trying to find the first one which matches the given condition.
*/
@Nullable
public static JComponent findContentComponent(@NotNull ContentManager manager, @NotNull Condition<JComponent> condition) {
for (Content content : manager.getContents()) {
if (content instanceof TabbedContentImpl) {
List<Pair<String, JComponent>> tabs = ((TabbedContentImpl)content).getTabs();
for (Pair<String, JComponent> tab : tabs) {
if (condition.value(tab.second)) {
return tab.second;
}
}
}
else if (condition.value(content.getComponent())) {
return content.getComponent();
}
}
return null;
}
示例5: updateToolWindows
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
public static void updateToolWindows() {
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
for (String id : toolWindowManager.getToolWindowIds()) {
final ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
for (Content content : toolWindow.getContentManager().getContents()) {
final JComponent component = content.getComponent();
if (component != null) {
IJSwingUtilities.updateComponentTreeUI(component);
}
}
final JComponent c = toolWindow.getComponent();
if (c != null) {
IJSwingUtilities.updateComponentTreeUI(c);
}
}
}
}
示例6: removeContents
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
protected void removeContents(Content notToRemove, final String tabDisplayName) {
MessageView messageView = MessageView.SERVICE.getInstance(myProject);
Content[] contents = messageView.getContentManager().getContents();
for (Content content : contents) {
LOG.assertTrue(content != null);
if (content.isPinned()) continue;
if (tabDisplayName.equals(content.getDisplayName()) && content != notToRemove) {
ErrorTreeView listErrorView = (ErrorTreeView)content.getComponent();
if (listErrorView != null) {
if (messageView.getContentManager().removeContent(content, true)) {
content.release();
}
}
}
}
}
示例7: getActiveDocComponent
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
@Nullable
public static DocumentationComponent getActiveDocComponent(@NotNull Project project) {
DocumentationManager documentationManager = DocumentationManager.getInstance(project);
DocumentationComponent component;
JBPopup hint = documentationManager.getDocInfoHint();
if (hint != null) {
component = (DocumentationComponent)((AbstractPopup)hint).getComponent();
}
else if (documentationManager.hasActiveDockedDocWindow()) {
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.DOCUMENTATION);
Content selectedContent = toolWindow == null ? null : toolWindow.getContentManager().getSelectedContent();
component = selectedContent == null ? null : (DocumentationComponent)selectedContent.getComponent();
}
else {
component = null;
}
return component;
}
示例8: removeContents
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
private static void removeContents(@Nullable final Content notToRemove,
@NotNull final Project myProject,
@NotNull final String tabDisplayName) {
MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
Content[] contents = messageView.getContentManager().getContents();
for (Content content : contents) {
LOG.assertTrue(content != null);
if (content.isPinned()) continue;
if (tabDisplayName.equals(content.getDisplayName()) && content != notToRemove) {
ErrorTreeView listErrorView = (ErrorTreeView)content.getComponent();
if (listErrorView != null) {
if (messageView.getContentManager().removeContent(content, true)) {
content.release();
}
}
}
}
}
示例9: updateSelectionInActiveProjectView
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
static void updateSelectionInActiveProjectView(PsiElement newElement, Project project, boolean selectInActivePanel) {
String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
if (id != null) {
ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(id);
Content selectedContent = window.getContentManager().getSelectedContent();
if (selectedContent != null) {
JComponent component = selectedContent.getComponent();
if (component instanceof TwoPaneIdeView) {
((TwoPaneIdeView) component).selectElement(newElement, selectInActivePanel);
return;
}
}
}
if (ToolWindowId.PROJECT_VIEW.equals(id)) {
ProjectView.getInstance(project).selectPsiElement(newElement, true);
}
else if (ToolWindowId.STRUCTURE_VIEW.equals(id)) {
VirtualFile virtualFile = newElement.getContainingFile().getVirtualFile();
FileEditor editor = FileEditorManager.getInstance(newElement.getProject()).getSelectedEditor(virtualFile);
StructureViewFactoryEx.getInstanceEx(project).getStructureViewWrapper().selectCurrentElement(editor, virtualFile, true);
}
}
示例10: getBsbConsole
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
private BsConsole getBsbConsole() {
BsConsole console = null;
ToolWindow window = ToolWindowManager.getInstance(m_project).getToolWindow("Bucklescript");
Content windowContent = window.getContentManager().getContent(0);
if (windowContent != null) {
SimpleToolWindowPanel component = (SimpleToolWindowPanel) windowContent.getComponent();
JComponent panelComponent = component.getComponent();
if (panelComponent != null) {
console = (BsConsole) panelComponent.getComponent(0);
}
}
return console;
}
示例11: refreshToolWindows
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
private void refreshToolWindows() {
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(PluginProperties.getValue("toolwindows.id"));
toolWindow.activate(null);
for (Content content : toolWindow.getContentManager().getContents()) {
if (content.getComponent() instanceof ToolWindowPanel) {
ToolWindowPanel toolWindowPanel = (ToolWindowPanel) content.getComponent();
toolWindowPanel.getRefreshAction().actionPerformed(null);
}
}
}
示例12: getNavigator
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
@Nullable
protected OccurenceNavigator getNavigator(DataContext dataContext) {
ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(dataContext, false);
if (contentManager != null) {
Content content = contentManager.getSelectedContent();
if (content == null) return null;
JComponent component = content.getComponent();
return findNavigator(component);
}
return (OccurenceNavigator)getOccurenceNavigatorFromContext(dataContext);
}
示例13: getChildren
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
ContentManager contentManager = myToolWindow.getContentManager();
Content selectedContent = contentManager.getSelectedContent();
JComponent contentComponent = selectedContent != null ? selectedContent.getComponent() : null;
if (contentComponent == null) return EMPTY_ARRAY;
List<AnAction> result = ContainerUtil.newSmartList();
for (final ActionToolbar toolbar : iterateToolbars(contentComponent)) {
JComponent c = toolbar.getComponent();
if (c.isVisible() || !c.isValid()) continue;
if (!result.isEmpty() && !(ContainerUtil.getLastItem(result) instanceof Separator)) {
result.add(Separator.getInstance());
}
List<AnAction> actions = toolbar.getActions(false);
for (AnAction action : actions) {
if (action instanceof ToggleAction && !result.contains(action)) {
result.add(action);
}
else if (action instanceof Separator) {
if (!result.isEmpty() && !(ContainerUtil.getLastItem(result) instanceof Separator)) {
result.add(Separator.getInstance());
}
}
}
}
boolean popup = result.size() > 3;
setPopup(popup);
if (!popup && !result.isEmpty()) result.add(Separator.getInstance());
return result.toArray(new AnAction[result.size()]);
}
示例14: getCurrentEnvironment
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
@Nullable
private static ExecutionEnvironment getCurrentEnvironment(@NotNull Content content) {
JComponent component = content.getComponent();
if (component == null) {
return null;
}
return LangDataKeys.EXECUTION_ENVIRONMENT.getData(DataManager.getInstance().getDataContext(component));
}
示例15: showSettings
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
@Override
public void showSettings() {
Content selectedContent = com.intellij.usageView.UsageViewManager.getInstance(myProject).getSelectedContent(true);
JComponent component = selectedContent == null ? null : selectedContent.getComponent();
ReplaceInProjectManager findInProjectManager = getInstance(myProject);
findInProjectManager.replaceInProject(DataManager.getInstance().getDataContext(component));
}