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


Java ToolWindowEx.getContentManager方法代码示例

本文整理汇总了Java中com.intellij.openapi.wm.ex.ToolWindowEx.getContentManager方法的典型用法代码示例。如果您正苦于以下问题:Java ToolWindowEx.getContentManager方法的具体用法?Java ToolWindowEx.getContentManager怎么用?Java ToolWindowEx.getContentManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.wm.ex.ToolWindowEx的用法示例。


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

示例1: getContentManagerFromContext

import com.intellij.openapi.wm.ex.ToolWindowEx; //导入方法依赖的package包/类
/**
 * This is utility method. It returns <code>ContentManager</code> from the current context.
 */
public static ContentManager getContentManagerFromContext(DataContext dataContext, boolean requiresVisibleToolWindow){
  Project project = CommonDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    return null;
  }

  ToolWindowManagerEx mgr=ToolWindowManagerEx.getInstanceEx(project);

  String id = mgr.getActiveToolWindowId();
  if (id == null) {
    if(mgr.isEditorComponentActive()){
      id = mgr.getLastActiveToolWindowId();
    }
  }

  ToolWindowEx toolWindow = id != null ? (ToolWindowEx)mgr.getToolWindow(id) : null;
  if (requiresVisibleToolWindow && (toolWindow == null || !toolWindow.isVisible())) {
    return null;
  }

  ContentManager fromToolWindow = toolWindow != null ? toolWindow.getContentManager() : null;
  ContentManager fromContext = PlatformDataKeys.CONTENT_MANAGER.getData(dataContext);
  return ObjectUtils.chooseNotNull(fromContext, fromToolWindow);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ContentManagerUtil.java

示例2: initToolWindow

import com.intellij.openapi.wm.ex.ToolWindowEx; //导入方法依赖的package包/类
private void initToolWindow() {
    initTree();
    JPanel panel = new SeedStackNavigatorPanel(myProject, tree);

    final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject);
    toolWindow = (ToolWindowEx) manager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.LEFT, myProject, true);
    toolWindow.setIcon(SeedStackIcons.LOGO);
    final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
    final Content content = contentFactory.createContent(panel, "", false);
    ContentManager contentManager = toolWindow.getContentManager();
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, false);

    final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {
        boolean wasVisible = false;

        @Override
        public void stateChanged() {
            if (toolWindow.isDisposed()) return;
            boolean visible = toolWindow.isVisible();
            if (!visible) {
                return;
            }
            scheduleStructureUpdate(null);
        }
    };
    manager.addToolWindowManagerListener(listener, myProject);

    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup group = new DefaultActionGroup();
    toolWindow.setAdditionalGearActions(group);
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:33,代码来源:SeedStackNavigator.java

示例3: setup

import com.intellij.openapi.wm.ex.ToolWindowEx; //导入方法依赖的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});
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:MvcProjectViewPane.java

示例4: getContentManagerFromContext

import com.intellij.openapi.wm.ex.ToolWindowEx; //导入方法依赖的package包/类
/**
 * This is utility method. It returns <code>ContentManager</code> from the current context.
 */
public static ContentManager getContentManagerFromContext(DataContext dataContext, boolean requiresVisibleToolWindow){
  Project project = PlatformDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    return null;
  }

  ToolWindowManagerEx mgr=ToolWindowManagerEx.getInstanceEx(project);

  String id = mgr.getActiveToolWindowId();
  if (id == null) {
    if(mgr.isEditorComponentActive()){
      id = mgr.getLastActiveToolWindowId();
    }
  }
  if(id == null){
    return null;
  }

  ToolWindowEx toolWindow = (ToolWindowEx)mgr.getToolWindow(id);
  if (requiresVisibleToolWindow && !toolWindow.isVisible()) {
    return null;
  }

  final ContentManager fromContext = PlatformDataKeys.CONTENT_MANAGER.getData(dataContext);
  if (fromContext != null) return fromContext;

  return toolWindow != null ? toolWindow.getContentManager() : null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:ContentManagerUtil.java

示例5: getContentManagerFromContext

import com.intellij.openapi.wm.ex.ToolWindowEx; //导入方法依赖的package包/类
/**
 * This is utility method. It returns <code>ContentManager</code> from the current context.
 */
public static ContentManager getContentManagerFromContext(DataContext dataContext, boolean requiresVisibleToolWindow){
  Project project = dataContext.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return null;
  }

  ToolWindowManagerEx mgr=ToolWindowManagerEx.getInstanceEx(project);

  String id = mgr.getActiveToolWindowId();
  if (id == null) {
    if(mgr.isEditorComponentActive()){
      id = mgr.getLastActiveToolWindowId();
    }
  }
  if(id == null){
    return null;
  }

  ToolWindowEx toolWindow = (ToolWindowEx)mgr.getToolWindow(id);
  if (requiresVisibleToolWindow && !toolWindow.isVisible()) {
    return null;
  }

  final ContentManager fromContext = dataContext.getData(PlatformDataKeys.CONTENT_MANAGER);
  if (fromContext != null) return fromContext;

  return toolWindow != null ? toolWindow.getContentManager() : null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:32,代码来源:ContentManagerUtil.java

示例6: initToolWindow

import com.intellij.openapi.wm.ex.ToolWindowEx; //导入方法依赖的package包/类
private void initToolWindow() {
  initTree();
  JPanel panel = new MavenProjectsNavigatorPanel(myProject, myTree);

  AnAction removeAction = ActionManager.getInstance().getAction("Maven.RemoveRunConfiguration");
  removeAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), myTree, myProject);
  AnAction editSource = ActionManager.getInstance().getAction("Maven.EditRunConfiguration");
  editSource.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myTree, myProject);

  final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject);
  myToolWindow = (ToolWindowEx)manager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.RIGHT, myProject, true);
  myToolWindow.setIcon(MavenIcons.ToolWindowMaven);
  final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
  final Content content = contentFactory.createContent(panel, "", false);
  ContentManager contentManager = myToolWindow.getContentManager();
  contentManager.addContent(content);
  contentManager.setSelectedContent(content, false);

  final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {
    boolean wasVisible = false;

    @Override
    public void stateChanged() {
      if (myToolWindow.isDisposed()) return;
      boolean visible = myToolWindow.isVisible();
      if (!visible || wasVisible) {
        return;
      }
      scheduleStructureUpdate();
      wasVisible = true;
    }
  };
  manager.addToolWindowManagerListener(listener, myProject);

  ActionManager actionManager = ActionManager.getInstance();

  DefaultActionGroup group = new DefaultActionGroup();
  group.add(actionManager.getAction("Maven.GroupProjects"));
  group.add(actionManager.getAction("Maven.ShowIgnored"));
  group.add(actionManager.getAction("Maven.ShowBasicPhasesOnly"));
  group.add(actionManager.getAction("Maven.AlwaysShowArtifactId"));
  group.add(actionManager.getAction("Maven.ShowVersions"));

  myToolWindow.setAdditionalGearActions(group);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:46,代码来源:MavenProjectsNavigator.java

示例7: setup

import com.intellij.openapi.wm.ex.ToolWindowEx; //导入方法依赖的package包/类
public void setup(ToolWindowEx toolWindow) {
    ContentManager contentManager = toolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(new Symfony2WebProfilerForm(this.project).createComponent(), null, true);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, true);
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:7,代码来源:SymfonyWebProfilerPane.java


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