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