本文整理汇总了Java中com.intellij.ui.content.ContentManager.removeContent方法的典型用法代码示例。如果您正苦于以下问题:Java ContentManager.removeContent方法的具体用法?Java ContentManager.removeContent怎么用?Java ContentManager.removeContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.content.ContentManager
的用法示例。
在下文中一共展示了ContentManager.removeContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addOrReplaceContent
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public static void addOrReplaceContent(ContentManager manager, Content content, boolean select) {
final String contentName = content.getDisplayName();
Content[] contents = manager.getContents();
Content oldContentFound = null;
for(Content oldContent: contents) {
if (!oldContent.isPinned() && oldContent.getDisplayName().equals(contentName)) {
oldContentFound = oldContent;
break;
}
}
manager.addContent(content);
if (oldContentFound != null) {
manager.removeContent(oldContentFound, true);
}
if (select) {
manager.setSelectedContent(content);
}
}
示例2: actionPerformed
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true);
boolean processed = false;
if (contentManager != null && contentManager.canCloseContents()) {
final Content selectedContent = contentManager.getSelectedContent();
if (selectedContent != null && selectedContent.isCloseable()) {
contentManager.removeContent(selectedContent, true);
processed = true;
}
}
if (!processed && contentManager != null) {
final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
final ToolWindow tw = PlatformDataKeys.TOOL_WINDOW.getData(context);
if (tw != null) {
tw.hide(null);
}
}
}
示例3: initSession
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
protected void initSession(XDebugSession session, RunProfileState state, Executor executor) {
XDebugSessionTab tab = ((XDebugSessionImpl)session).getSessionTab();
if (tab != null) {
RunnerLayoutUi ui = tab.getUi();
ContentManager contentManager = ui.getContentManager();
Content content = findContent(contentManager, XDebuggerBundle.message("debugger.session.tab.watches.title"));
if (content != null) {
contentManager.removeContent(content, true);
}
content = findContent(contentManager, XDebuggerBundle.message("debugger.session.tab.console.content.name"));
if (content != null) {
contentManager.removeContent(content, true);
}
initEduConsole(session, ui);
}
}
示例4: actionPerformed
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true);
boolean processed = false;
if (contentManager != null && contentManager.canCloseContents()) {
final Content selectedContent = contentManager.getSelectedContent();
if (selectedContent != null && selectedContent.isCloseable()) {
contentManager.removeContent(selectedContent, true);
processed = true;
}
}
if (!processed && contentManager != null) {
final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
final ToolWindow tw = context.getData(PlatformDataKeys.TOOL_WINDOW);
if (tw != null) {
tw.hide(null);
}
}
}
示例5: closeTab
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public void closeTab(@NotNull final BaseFrameController frame) {
final ToolWindow toolWindow = getToolWindow();
final ContentManager toolwindowCM = toolWindow.getContentManager();
// NOTE the dispose: true parameter here will only dispose the content (the JPanel) but not the controller!
toolwindowCM.removeContent(toolwindowCM.getContent(frame.getControlPanel()), true);
Disposer.dispose(frame);
}
示例6: openTab
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
private void openTab(final BaseFrameController controller, String tabTitle) {
ApplicationManager.getApplication().assertIsDispatchThread();
final ToolWindow toolWindow = getToolWindow();
final ContentManager toolwindowCM = toolWindow.getContentManager();
final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
// clean up previous tab
boolean toolWindowOpen = currentFrame == null;
if (currentFrame != null) {
toolwindowCM.removeContent(toolwindowCM.getContent(currentFrame.getControlPanel()), true);
Disposer.dispose(currentFrame);
}
// add new content
currentFrame = controller;
Content newToolWindowTab = contentFactory.createContent(currentFrame.getControlPanel(), tabTitle, false);
toolwindowCM.addContent(newToolWindowTab);
toolwindowCM.setSelectedContent(newToolWindowTab);
// make sure the toolwindow is visible
toolWindow.show(new Runnable() {
@Override
public void run() {
JComponent view = (JComponent) currentFrame.view;
view.revalidate();
view.repaint();
TrackingService.trace(IdeaRawEvent.toolWindowShowContent(project, controller));
}
});
}
示例7: split
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
public void split() {
List<Pair<String, JComponent>> copy = new ArrayList<Pair<String, JComponent>>(myTabs);
int selectedTab = ContentUtilEx.getSelectedTab(this);
ContentManager manager = getManager();
String prefix = getTitlePrefix();
manager.removeContent(this, true);
PropertiesComponent.getInstance().setValue(SPLIT_PROPERTY_PREFIX + prefix, Boolean.TRUE.toString());
for (int i = 0; i < copy.size(); i++) {
final boolean select = i == selectedTab;
final JComponent component = copy.get(i).second;
final String tabName = copy.get(i).first;
ContentUtilEx.addTabbedContent(manager, component, prefix, tabName, select);
}
}
示例8: createToolWindow
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public void createToolWindow(boolean dataFlowToThis, @NotNull SliceRootNode rootNode, boolean splitByLeafExpressions, @NotNull String displayName) {
final SliceToolwindowSettings sliceToolwindowSettings = SliceToolwindowSettings.getInstance(myProject);
final ContentManager contentManager = getContentManager(dataFlowToThis);
final Content[] myContent = new Content[1];
ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(dataFlowToThis ? BACK_TOOLWINDOW_ID : FORTH_TOOLWINDOW_ID);
final SlicePanel slicePanel = new SlicePanel(myProject, dataFlowToThis, rootNode, splitByLeafExpressions, toolWindow) {
@Override
protected void close() {
super.close();
contentManager.removeContent(myContent[0], true);
}
@Override
public boolean isAutoScroll() {
return sliceToolwindowSettings.isAutoScroll();
}
@Override
public void setAutoScroll(boolean autoScroll) {
sliceToolwindowSettings.setAutoScroll(autoScroll);
}
@Override
public boolean isPreview() {
return sliceToolwindowSettings.isPreview();
}
@Override
public void setPreview(boolean preview) {
sliceToolwindowSettings.setPreview(preview);
}
};
myContent[0] = contentManager.getFactory().createContent(slicePanel, displayName, true);
contentManager.addContent(myContent[0]);
contentManager.setSelectedContent(myContent[0]);
toolWindow.activate(null);
}
示例9: actionPerformed
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
protected void actionPerformed(AnActionEvent e, ViewContext context, Content[] content) {
ContentManager manager = context.getContentManager();
for (Content c : manager.getContents()) {
if (c.isCloseable() && isAccepted(c, content)) {
manager.removeContent(c, context.isToDisposeRemovedContent());
}
}
}
示例10: addTab
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public void addTab(String title,
JComponent component,
boolean selectTab,
boolean replaceContent,
boolean lockable,
boolean addDefaultToolbar,
@Nullable final ActionGroup toolbarActions,
@NonNls String helpId) {
final ContentManager contentManager = getToolWindow().getContentManager();
final Content existingContent = contentManager.findContent(title);
if (existingContent != null) {
final JComponent existingComponent = existingContent.getComponent();
if (existingComponent instanceof DeactivateListener) {
((DeactivateListener) existingComponent).deactivated();
}
if (!replaceContent) {
contentManager.setSelectedContent(existingContent);
return;
}
else if (!existingContent.isPinned()) {
contentManager.removeContent(existingContent, true);
existingContent.release();
}
}
final CvsTabbedWindowComponent newComponent =
new CvsTabbedWindowComponent(component, addDefaultToolbar, toolbarActions, contentManager, helpId);
final Content content = contentManager.getFactory().createContent(newComponent.getShownComponent(), title, lockable);
newComponent.setContent(content);
contentManager.addContent(content);
if (selectTab) {
getToolWindow().activate(null, false);
}
}
示例11: actionPerformed
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
protected void actionPerformed(final AnActionEvent e, final ViewContext context, final Content[] content) {
final ContentManager manager = context.getContentManager();
for (Content c : manager.getContents()) {
if (c != content[0] && c.isCloseable()) {
manager.removeContent(c, context.isToDisposeRemovedContent());
}
}
}
示例12: actionPerformed
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
protected void actionPerformed(final AnActionEvent e, final ViewContext context, final Content[] content) {
final ContentManager manager = context.getContentManager();
for (Content c : manager.getContents()) {
if (c.isCloseable()) {
manager.removeContent(c, context.isToDisposeRemovedContent());
}
}
}
示例13: actionPerformed
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(PlatformDataKeys.PROJECT);
if (project == null) return;
CrucibleManager.getInstance(project).completeReview(myReview.getPermaId());
final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(CrucibleBundle.message("crucible.toolwindow.id"));
final ContentManager contentManager = toolWindow.getContentManager();
final Content foundContent = contentManager.findContent("Details for " + myReview.getPermaId());
contentManager.removeContent(foundContent, true);
final Content dash = contentManager.findContent("Dashboard");
if (dash.getComponent() instanceof CruciblePanel) {
((CruciblePanel)dash.getComponent()).getReviewModel().updateModel(CrucibleFilter.ToReview);
}
}
示例14: closeContentTab
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public static void closeContentTab(@Nonnull ContentManager contentManager, @Nonnull Content content) {
if (content instanceof TabbedContent) {
TabbedContent tabbedContent = (TabbedContent)content;
if (tabbedContent.getTabs().size() > 1) {
JComponent component = tabbedContent.getComponent();
tabbedContent.removeContent(component);
contentManager.setSelectedContent(tabbedContent, true, true);
dispose(component);
return;
}
}
contentManager.removeContent(content, true);
}
示例15: createToolWindow
import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public void createToolWindow(boolean dataFlowToThis, @NotNull SliceRootNode rootNode, boolean splitByLeafExpressions, @NotNull String displayName)
{
final SliceToolwindowSettings sliceToolwindowSettings = SliceToolwindowSettings.getInstance(myProject);
final ContentManager contentManager = getContentManager(dataFlowToThis);
final Content[] myContent = new Content[1];
ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(dataFlowToThis ? BACK_TOOLWINDOW_ID : FORTH_TOOLWINDOW_ID);
final SlicePanel slicePanel = new SlicePanel(myProject, dataFlowToThis, rootNode, splitByLeafExpressions, toolWindow)
{
@Override
protected void close()
{
super.close();
contentManager.removeContent(myContent[0], true);
}
@Override
public boolean isAutoScroll()
{
return sliceToolwindowSettings.isAutoScroll();
}
@Override
public void setAutoScroll(boolean autoScroll)
{
sliceToolwindowSettings.setAutoScroll(autoScroll);
}
@Override
public boolean isPreview()
{
return sliceToolwindowSettings.isPreview();
}
@Override
public void setPreview(boolean preview)
{
sliceToolwindowSettings.setPreview(preview);
}
};
myContent[0] = contentManager.getFactory().createContent(slicePanel, displayName, true);
contentManager.addContent(myContent[0]);
contentManager.setSelectedContent(myContent[0]);
toolWindow.activate(null);
}