本文整理汇总了Java中com.intellij.ui.content.Content.setDisposer方法的典型用法代码示例。如果您正苦于以下问题:Java Content.setDisposer方法的具体用法?Java Content.setDisposer怎么用?Java Content.setDisposer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.content.Content
的用法示例。
在下文中一共展示了Content.setDisposer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setup
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
public void setup(ToolWindowEx toolWindow) {
JPanel p = new JPanel(new BorderLayout());
p.add(myComponent, BorderLayout.CENTER);
ContentManager contentManager = toolWindow.getContentManager();
Content content = contentManager.getFactory().createContent(p, null, false);
content.setDisposer(this);
content.setCloseable(false);
content.setPreferredFocusableComponent(createComponent());
contentManager.addContent(content);
contentManager.setSelectedContent(content, true);
DefaultActionGroup group = new DefaultActionGroup();
group.add(new HideEmptyMiddlePackagesAction());
group.add(myAutoScrollToSourceHandler.createToggleAction());
group.add(myAutoScrollFromSourceHandler.createToggleAction());
toolWindow.setAdditionalGearActions(group);
TreeExpander expander = new DefaultTreeExpander(myTree);
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
AnAction collapseAction = actionsManager.createCollapseAllAction(expander, myTree);
collapseAction.getTemplatePresentation().setIcon(AllIcons.General.CollapseAll);
toolWindow.setTitleActions(new AnAction[]{new ScrollFromSourceAction(), collapseAction});
}
示例4: setContent
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
void setContent(@NotNull Content content) {
myContent = content;
content.setDisposer(this);
}
示例5: initToolWindow
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
protected void initToolWindow() {
myToolWindowForm = new AndroidLayoutPreviewToolWindowForm(this, getCustomRefreshRenderAction());
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() {
private boolean myVisible = false;
@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 (visible && !myVisible && isRenderAutomatically()) {
render();
}
myVisible = visible;
}
}
});
final JPanel contentPanel = myToolWindowForm.getContentPanel();
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());
}
示例6: actionPerformed
import com.intellij.ui.content.Content; //导入方法依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
final GitVcs vcs = ObjectUtils.assertNotNull(GitVcs.getInstance(project));
final List<VirtualFile> roots = getGitRootsFromUser(project);
if (roots.isEmpty()) {
return;
}
if (project.isDefault() || !ProjectLevelVcsManager.getInstance(project).hasActiveVcss()) {
ProgressManager.getInstance().run(new ShowLogInDialogTask(project, roots, vcs));
return;
}
final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
final Runnable showContent = new Runnable() {
@Override
public void run() {
ContentManager cm = window.getContentManager();
if (checkIfProjectLogMatches(project, vcs, cm, roots) || checkIfAlreadyOpened(cm, roots)) {
return;
}
String tabName = calcTabName(cm, roots);
MyContentComponent component = createManagerAndContent(project, vcs, roots, tabName);
Content content = ContentFactory.SERVICE.getInstance().createContent(component, tabName, false);
content.setDisposer(component.myDisposable);
content.setDescription("Log for " + StringUtil.join(roots, new Function<VirtualFile, String>() {
@Override
public String fun(VirtualFile file) {
return file.getPath();
}
}, "\n"));
content.setCloseable(true);
cm.addContent(content);
cm.setSelectedContent(content);
}
};
if (!window.isVisible()) {
window.activate(showContent, true);
}
else {
showContent.run();
}
}