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


Java ContentManager.setSelectedContent方法代码示例

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


在下文中一共展示了ContentManager.setSelectedContent方法的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: ContentTabLabel

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public ContentTabLabel(final Content content, TabContentLayout layout) {
  super(layout.myUi, true);
  myLayout = layout;
  myContent = content;
  update();

  myBehavior = new BaseButtonBehavior(this) {
    protected void execute(final MouseEvent e) {
      final ContentManager mgr = contentManager();
      if (mgr.getIndexOfContent(myContent) >= 0) {
        mgr.setSelectedContent(myContent, true);
      }
    }
  };
  myBehavior.setActionTrigger(MouseEvent.MOUSE_PRESSED);
  myBehavior.setMouseDeadzone(TimedDeadzone.NULL);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ContentTabLabel.java

示例3: selectContent

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
/**
 * Searches through all {@link Content simple} and {@link TabbedContent tabbed} contents of the given ContentManager,
 * and selects the one which holds the specified {@code contentComponent}.
 *
 * @return true if the necessary content was found (and thus selected) among content components of the given ContentManager.
 */
public static boolean selectContent(@NotNull ContentManager manager, @NotNull final JComponent contentComponent, boolean requestFocus) {
  for (Content content : manager.getContents()) {
    if (content instanceof TabbedContentImpl) {
      boolean found = ((TabbedContentImpl)content).findAndSelectContent(contentComponent);
      if (found) {
        manager.setSelectedContent(content, requestFocus);
        return true;
      }
    }
    else if (Comparing.equal(content.getComponent(), contentComponent)) {
      manager.setSelectedContent(content, requestFocus);
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ContentUtilEx.java

示例4: initToolWindow

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
protected void initToolWindow() {
  myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(UIDesignerBundle.message("toolwindow.ui.designer.name"),
                                                                             false, getAnchor(), myProject, true);
  myToolWindow.setIcon(UIDesignerIcons.ToolWindowUIDesigner);

  if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
    myToolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
  }

  initGearActions();

  ContentManager contentManager = myToolWindow.getContentManager();
  Content content =
    contentManager.getFactory()
      .createContent(myToolWindowPanel.getToolWindowPanel(), UIDesignerBundle.message("toolwindow.ui.designer.title"), false);
  content.setCloseable(false);
  content.setPreferredFocusableComponent(myToolWindowPanel.getComponentTree());
  contentManager.addContent(content);
  contentManager.setSelectedContent(content, true);
  myToolWindow.setAvailable(false, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DesignerToolWindowManager.java

示例5: initToolWindow

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
protected void initToolWindow() {
  myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(DesignerBundle.message("designer.toolwindow.name"),
                                                                             false, getAnchor(), myProject, true);
  myToolWindow.setIcon(UIDesignerNewIcons.ToolWindow);

  if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
    myToolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
  }

  ((ToolWindowEx)myToolWindow).setTitleActions(myToolWindowContent.createActions());
  initGearActions();

  ContentManager contentManager = myToolWindow.getContentManager();
  Content content =
    contentManager.getFactory()
      .createContent(myToolWindowContent.getToolWindowPanel(), DesignerBundle.message("designer.toolwindow.title"), false);
  content.setCloseable(false);
  content.setPreferredFocusableComponent(myToolWindowContent.getComponentTree());
  contentManager.addContent(content);
  contentManager.setSelectedContent(content, true);
  myToolWindow.setAvailable(false, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DesignerToolWindowManager.java

示例6: actionPerformed

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  if (! isEnabled(e)) return;
  final DataContext dc = e.getDataContext();
  final Project project = PlatformDataKeys.PROJECT.getData(dc);
  if (project == null) return;
  final ToolWindowManager manager = ToolWindowManager.getInstance(project);
  if (manager != null) {
    final ToolWindow window = manager.getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
    if (window != null) {
      window.show(null);
      final ContentManager cm = window.getContentManager();
      final Content content = cm.findContent(SvnBundle.message("dialog.show.svn.map.title"));
      if (content != null) {
        cm.setSelectedContent(content, true);
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:MergeFromAction.java

示例7: initToolWindow

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
protected void initToolWindow() {
  myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(CordovaDesignerBundle.message("designer.toolwindow.name"),
                                                                             false, getAnchor(), myProject, true);
  myToolWindow.setIcon(CordovaIcons.Designer.ToolWindow);

  if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
    myToolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
  }

  ((ToolWindowEx)myToolWindow).setTitleActions(myToolWindowContent.createActions());
  initGearActions();

  ContentManager contentManager = myToolWindow.getContentManager();
  Content content =
    contentManager.getFactory()
      .createContent(myToolWindowContent.getToolWindowPanel(), CordovaDesignerBundle.message("designer.toolwindow.title"), false);
  content.setCloseable(false);
  content.setPreferredFocusableComponent(myToolWindowContent.getComponentTree());
  contentManager.addContent(content);
  contentManager.setSelectedContent(content, true);
  myToolWindow.setAvailable(false, null);
}
 
开发者ID:chrimm,项目名称:cordovastudio,代码行数:24,代码来源:CordovaDesignerToolWindowManager.java

示例8: addDevMotiveContent

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
public static DevMotivePanel addDevMotiveContent(Project project, VirtualFile file, List<VcsFileRevision> revisions, String vcsName, ContentManagerListener listener, boolean select) {
    ApplicationManager.getApplication().assertIsDispatchThread();

    ToolWindowManager toolWindowManager = project.getComponent(ToolWindowManager.class);
    ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_MAIN);
    ContentManager contentManager = toolWindow.getContentManager();

    Content content = findDevMotiveContent(toolWindow, file);
    if (content == null) {
        contentManager = toolWindow.getContentManager();
        int idx = contentManager.getContentCount();
        DevMotivePanel devMotivePanel = new DevMotivePanel(project, file, revisions, vcsName);
        content = ContentFactory.SERVICE.getInstance().createContent(devMotivePanel, devMotivePanel.getName(), false);
        contentManager.addContent(content, idx);
    } else if (revisions != null) {
        ((DevMotive) content.getComponent()).load(revisions);
    }
    if (select) {
        contentManager.setSelectedContent(content);
    }
    if (listener != null) {
        contentManager.addContentManagerListener(listener);
    }
    return (DevMotivePanel) content.getComponent();
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:26,代码来源:AliContentFactory.java

示例9: initToolWindow

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
protected void initToolWindow()
{
	myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(UIDesignerBundle.message("toolwindow.ui.designer.name"), false, getAnchor(), myProject, true);
	myToolWindow.setIcon(UIDesignerIcons.ToolWindowUIDesigner);

	if(!ApplicationManager.getApplication().isHeadlessEnvironment())
	{
		myToolWindow.getComponent().putClientProperty(ToolWindowContentUI.HIDE_ID_LABEL, "true");
	}

	initGearActions();

	ContentManager contentManager = myToolWindow.getContentManager();
	Content content = contentManager.getFactory().createContent(myToolWindowPanel.getToolWindowPanel(), UIDesignerBundle.message("toolwindow.ui.designer.title"), false);
	content.setCloseable(false);
	content.setPreferredFocusableComponent(myToolWindowPanel.getComponentTree());
	contentManager.addContent(content);
	contentManager.setSelectedContent(content, true);
	myToolWindow.setAvailable(false, null);
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:22,代码来源:DesignerToolWindowManager.java

示例10: initToolWindow

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@Override
protected void initToolWindow()
{
	myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(IdeBundle.message("toolwindow.palette"), false, getAnchor(),
			myProject, true);
	myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowPalette);
	initGearActions();

	ContentManager contentManager = myToolWindow.getContentManager();
	Content content = contentManager.getFactory().createContent(myToolWindowPanel, null, false);
	content.setCloseable(false);
	content.setPreferredFocusableComponent(myToolWindowPanel);
	contentManager.addContent(content);
	contentManager.setSelectedContent(content, true);
	myToolWindow.setAvailable(false, null);
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:17,代码来源:PaletteToolWindowManager.java

示例11: selectContent

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
/**
 * Searches through all {@link Content simple} and {@link TabbedContent tabbed} contents of the given ContentManager,
 * and selects the one which holds the specified {@code contentComponent}.
 *
 * @return true if the necessary content was found (and thus selected) among content components of the given ContentManager.
 */
public static boolean selectContent(@Nonnull ContentManager manager, @Nonnull final JComponent contentComponent, boolean requestFocus) {
  for (Content content : manager.getContents()) {
    if (content instanceof TabbedContentImpl) {
      boolean found = ((TabbedContentImpl)content).findAndSelectContent(contentComponent);
      if (found) {
        manager.setSelectedContent(content, requestFocus);
        return true;
      }
    }
    else if (Comparing.equal(content.getComponent(), contentComponent)) {
      manager.setSelectedContent(content, requestFocus);
      return true;
    }
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ContentUtilEx.java

示例12: init

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
@RequiredUIAccess
@Override
protected void init(boolean canCloseContent, @Nullable Object component) {
  final ContentFactory contentFactory = ContentFactory.getInstance();
  myContentUI = new DesktopToolWindowContentUi(this);
  ContentManager contentManager = myContentManager = contentFactory.createContentManager(myContentUI, canCloseContent, myToolWindowManager.getProject());

  if (component != null) {
    final Content content = contentFactory.createContent((JComponent)component, "", false);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, false);
  }

  myComponent = contentManager.getComponent();

  installToolwindowFocusPolicy();

  UiNotifyConnector notifyConnector = new UiNotifyConnector(myComponent, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      myShowing.onReady();
    }
  });
  Disposer.register(contentManager, notifyConnector);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:DesktopToolWindowImpl.java

示例13: initToolWindow

import com.intellij.ui.content.ContentManager; //导入方法依赖的package包/类
protected void initToolWindow() {
    toolWindow = ToolWindowManager.getInstance(myProject)
            .registerToolWindow("BPMN Palette", false, ToolWindowAnchor.RIGHT, myProject, true);
    toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowPalette);

    ContentManager contentManager = toolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(palette, null, false);
    content.setCloseable(false);
    content.setPreferredFocusableComponent(palette);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, true);
    toolWindow.setAvailable(false, null);
}
 
开发者ID:Blenta,项目名称:intellij-bpmn-editor,代码行数:14,代码来源:BPMNPaletteToolWindowManager.java

示例14: initToolWindow

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

示例15: 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


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