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


Java ContentManagerUtil类代码示例

本文整理汇总了Java中com.intellij.ui.content.ContentManagerUtil的典型用法代码示例。如果您正苦于以下问题:Java ContentManagerUtil类的具体用法?Java ContentManagerUtil怎么用?Java ContentManagerUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContentManagerUtil类属于com.intellij.ui.content包,在下文中一共展示了ContentManagerUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.ui.content.ContentManagerUtil; //导入依赖的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

示例2: actionPerformed

import com.intellij.ui.content.ContentManagerUtil; //导入依赖的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

示例3: update

import com.intellij.ui.content.ContentManagerUtil; //导入依赖的package包/类
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  ContentManager contentManager=ContentManagerUtil.getContentManagerFromContext(event.getDataContext(), true);
  presentation.setEnabled(contentManager != null && contentManager.canCloseContents());

  if (!presentation.isEnabled() && contentManager != null) {
    final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
    presentation.setEnabled(PlatformDataKeys.TOOL_WINDOW.getData(context) != null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CloseActiveTabAction.java

示例4: getNavigator

import com.intellij.ui.content.ContentManagerUtil; //导入依赖的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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:OccurenceNavigatorActionBase.java

示例5: getContent

import com.intellij.ui.content.ContentManagerUtil; //导入依赖的package包/类
/**
 * @return selected content or <code>null</code>
 */
@Nullable
private static Content getContent(final DataContext context){
  Content[] contents = ViewContext.CONTENT_KEY.getData(context);
  if (contents != null && contents.length == 1) return contents[0];
  
  ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(context, true);
  if (contentManager == null){
    return null;
  }
  return contentManager.getSelectedContent();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PinActiveTabAction.java

示例6: update

import com.intellij.ui.content.ContentManagerUtil; //导入依赖的package包/类
public void update(AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(event.getDataContext(), true);
  presentation.setEnabled(contentManager != null && contentManager.canCloseContents());

  if (!presentation.isEnabled() && contentManager != null) {
    final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
    presentation.setEnabled(context.getData(PlatformDataKeys.TOOL_WINDOW) != null);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:CloseActiveTabAction.java

示例7: getNonToolWindowContent

import com.intellij.ui.content.ContentManagerUtil; //导入依赖的package包/类
@Nullable
private static Content getNonToolWindowContent(@Nonnull AnActionEvent e) {
  Content result = null;
  Content[] contents = e.getData(ViewContext.CONTENT_KEY);
  if (contents != null && contents.length == 1) result = contents[0];
  if (result != null && result.isPinnable()) return result;

  ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true);
  result = contentManager != null? contentManager.getSelectedContent() : null;
  if (result != null && result.isPinnable()) return result;
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:PinActiveTabAction.java


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