本文整理汇总了Java中com.intellij.ui.content.Content.setComponent方法的典型用法代码示例。如果您正苦于以下问题:Java Content.setComponent方法的具体用法?Java Content.setComponent怎么用?Java Content.setComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.content.Content
的用法示例。
在下文中一共展示了Content.setComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCustomTodoView
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
public void addCustomTodoView(final TodoTreeBuilderFactory factory, final String title, final TodoPanelSettings settings) {
Content content = ContentFactory.SERVICE.getInstance().createContent(null, title, true);
final ChangeListTodosPanel panel = new ChangeListTodosPanel(myProject, settings, content) {
@Override
protected TodoTreeBuilder createTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
TodoTreeBuilder todoTreeBuilder = factory.createTreeBuilder(tree, treeModel, project);
todoTreeBuilder.init();
return todoTreeBuilder;
}
};
content.setComponent(panel);
Disposer.register(this, panel);
if (myContentManager == null) {
myNotAddedContent.add(content);
}
else {
myContentManager.addContent(content);
}
myPanels.add(panel);
content.setCloseable(true);
content.setDisposer(new Disposable() {
@Override
public void dispose() {
myPanels.remove(panel);
}
});
}
示例2: resetContent
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
private static void resetContent(RunContentDescriptor contentDescriptor, SimpleToolWindowPanel panel, Content content) {
RunContentDescriptor oldDescriptor = content.getDisposer() instanceof RunContentDescriptor ? (RunContentDescriptor)content.getDisposer() : null;
if (oldDescriptor != null) Disposer.dispose(oldDescriptor);
panel.setContent(contentDescriptor.getComponent());
content.setComponent(panel);
content.setDisposer(contentDescriptor);
content.setPreferredFocusableComponent(contentDescriptor.getComponent());
content.putUserData(CONTENT_DESCRIPTOR, contentDescriptor);
}
示例3: actionPerformed
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
@Override
public final void actionPerformed(final AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
final Project project = e.getProject();
if (project == null) return;
PsiDocumentManager.getInstance(project).commitAllDocuments(); // prevents problems with smart pointers creation
final HierarchyProvider provider = getProvider(e);
if (provider == null) return;
final PsiElement target = provider.getTarget(dataContext);
if (target == null) return;
final HierarchyBrowser hierarchyBrowser = provider.createHierarchyBrowser(target);
final Content content;
final HierarchyBrowserManager hierarchyBrowserManager = HierarchyBrowserManager.getInstance(project);
final ContentManager contentManager = hierarchyBrowserManager.getContentManager();
final Content selectedContent = contentManager.getSelectedContent();
if (selectedContent != null && !selectedContent.isPinned()) {
content = selectedContent;
final Component component = content.getComponent();
if (component instanceof Disposable) {
Disposer.dispose((Disposable)component);
}
content.setComponent(hierarchyBrowser.getComponent());
}
else {
content = ContentFactory.SERVICE.getInstance().createContent(hierarchyBrowser.getComponent(), null, true);
contentManager.addContent(content);
}
contentManager.setSelectedContent(content);
hierarchyBrowser.setContent(content);
final Runnable runnable = new Runnable() {
@Override
public void run() {
provider.browserActivated(hierarchyBrowser);
}
};
ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.HIERARCHY).activate(runnable);
}