本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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();
}
示例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);
}
}
示例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;
}