当前位置: 首页>>代码示例>>Java>>正文


Java ContentManager.removeContent方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ContentsUtil.java

示例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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:CloseActiveTabAction.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PyEduDebugRunner.java

示例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);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:CloseActiveTabAction.java

示例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);
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:8,代码来源:ToolWindowController.java

示例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));
        }
    });
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:31,代码来源:ToolWindowController.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:TabbedContentImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:SliceManager.java

示例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());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CloseViewsActionBase.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:CvsTabbedWindow.java

示例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());
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:CloseOtherViewsAction.java

示例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());
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:CloseAllViewsAction.java

示例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);
  }
}
 
开发者ID:ktisha,项目名称:Crucible4IDEA,代码行数:15,代码来源:CompleteReviewAction.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:ContentsUtil.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:47,代码来源:SliceManager.java


注:本文中的com.intellij.ui.content.ContentManager.removeContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。