本文整理匯總了Java中com.intellij.ui.content.Content.setPreferredFocusableComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java Content.setPreferredFocusableComponent方法的具體用法?Java Content.setPreferredFocusableComponent怎麽用?Java Content.setPreferredFocusableComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.ui.content.Content
的用法示例。
在下文中一共展示了Content.setPreferredFocusableComponent方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createTerminalInContentPanel
import com.intellij.ui.content.Content; //導入方法依賴的package包/類
/**
* Create a terminal panel
*
* @param terminalRunner
* @param toolWindow
* @return
*/
private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, @NotNull final ToolWindow toolWindow) {
SimpleToolWindowPanel panel = new SimpleToolWindowPanel(true);
Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false);
content.setCloseable(true);
myTerminalWidget = terminalRunner.createTerminalWidget(content);
panel.setContent(myTerminalWidget.getComponent());
panel.addFocusListener(this);
createToolbar(terminalRunner, myTerminalWidget, toolWindow, panel);// west toolbar
ActionToolbar toolbar = createTopToolbar(terminalRunner, myTerminalWidget, toolWindow);
toolbar.setTargetComponent(panel);
panel.setToolbar(toolbar.getComponent(), false);
content.setPreferredFocusableComponent(myTerminalWidget.getComponent());
return content;
}
示例2: createContent
import com.intellij.ui.content.Content; //導入方法依賴的package包/類
@Override
@NotNull
public Content createContent(@NotNull final String contentId, @NotNull final ComponentWithActions withActions, @NotNull final String displayName,
@Nullable final Icon icon,
@Nullable final JComponent toFocus) {
final Content content = getContentFactory().createContent(withActions.getComponent(), displayName, false);
content.putUserData(CONTENT_TYPE, contentId);
content.putUserData(ViewImpl.ID, contentId);
content.setIcon(icon);
if (toFocus != null) {
content.setPreferredFocusableComponent(toFocus);
}
if (!withActions.isContentBuiltIn()) {
content.setSearchComponent(withActions.getSearchComponent());
content.setActions(withActions.getToolbarActions(), withActions.getToolbarPlace(), withActions.getToolbarContextComponent());
}
return content;
}
示例3: initToolWindow
import com.intellij.ui.content.Content; //導入方法依賴的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);
}
示例4: getToolWindow
import com.intellij.ui.content.Content; //導入方法依賴的package包/類
public ToolWindow getToolWindow() {
if (myToolWindow == null) {
myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(GroovyBundle.message("dynamic.tool.window.id"), true, ToolWindowAnchor.RIGHT);
myToolWindow.setIcon(JetgroovyIcons.Groovy.DynamicProperty_13);
myToolWindow.setTitle(GroovyBundle.message("dynamic.window"));
myToolWindow.setToHideOnEmptyContent(true);
final JPanel panel = buildBigPanel();
final ContentManager contentManager = myToolWindow.getContentManager();
final Content content = contentManager.getFactory().createContent(panel, "", false);
content.setPreferredFocusableComponent(myTreeTable);
contentManager.addContent(content);
}
return myToolWindow;
}
示例5: initToolWindow
import com.intellij.ui.content.Content; //導入方法依賴的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: initToolWindow
import com.intellij.ui.content.Content; //導入方法依賴的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);
}
示例7: createTerminalInContentPanel
import com.intellij.ui.content.Content; //導入方法依賴的package包/類
/**
* 創建Terminal panel
*
* @param terminalRunner
* @param toolWindow
* @return
*/
private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, @NotNull final ToolWindow toolWindow) {
SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false);
content.setCloseable(true);
myTerminalWidget = terminalRunner.createTerminalWidget(content);
panel.setContent(myTerminalWidget.getComponent());
panel.addFocusListener(this);
ActionToolbar toolbar = createToolbar(terminalRunner, myTerminalWidget, toolWindow);
toolbar.setTargetComponent(panel);
panel.setToolbar(toolbar.getComponent());
content.setPreferredFocusableComponent(myTerminalWidget.getComponent());
return content;
}
示例8: resetContent
import com.intellij.ui.content.Content; //導入方法依賴的package包/類
private static void resetContent(RunContentDescriptor contentDescriptor, SimpleToolWindowPanel panel, Content content) {
RunContentDescriptor oldDescriptor = content.getDisposer() instanceof RunContentDescriptor ? (RunContentDescriptor)content.getDisposer() : null;
if (oldDescriptor != null) Disposer.dispose(oldDescriptor);
panel.setContent(contentDescriptor.getComponent());
content.setComponent(panel);
content.setDisposer(contentDescriptor);
content.setPreferredFocusableComponent(contentDescriptor.getComponent());
content.putUserData(CONTENT_DESCRIPTOR, contentDescriptor);
}
示例9: initToolWindow
import com.intellij.ui.content.Content; //導入方法依賴的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);
}
示例10: setup
import com.intellij.ui.content.Content; //導入方法依賴的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});
}
示例11: createTerminalInContentPanel
import com.intellij.ui.content.Content; //導入方法依賴的package包/類
private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner,
final @NotNull ToolWindow toolWindow) {
SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
final Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false);
content.setCloseable(true);
myTerminalWidget = terminalRunner.createTerminalWidget(content);
myTerminalWidget.addTabListener(new TabbedTerminalWidget.TabListener() {
@Override
public void tabClosed(JediTermWidget terminal) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (myTerminalWidget != null) {
hideIfNoActiveSessions(toolWindow, myTerminalWidget);
}
}
});
}
});
panel.setContent(myTerminalWidget.getComponent());
panel.addFocusListener(createFocusListener());
ActionToolbar toolbar = createToolbar(terminalRunner, myTerminalWidget, toolWindow);
toolbar.getComponent().addFocusListener(createFocusListener());
toolbar.setTargetComponent(panel);
panel.setToolbar(toolbar.getComponent());
content.setPreferredFocusableComponent(myTerminalWidget.getComponent());
return content;
}
示例12: initToolWindow
import com.intellij.ui.content.Content; //導入方法依賴的package包/類
@Override
protected void initToolWindow() {
myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow("Palette\t", 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);
}
示例13: createTerminalInContentPanel
import com.intellij.ui.content.Content; //導入方法依賴的package包/類
/**
* Create a terminal panel
*
* @param terminalRunner
* @param toolWindow
* @return
*/
private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, @NotNull final ToolWindow toolWindow) {
SimpleToolWindowPanel panel = new SimpleToolWindowPanel(true);
Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "TestTerminal", false);
content.setCloseable(true);
JBTabbedTerminalWidget myTerminalWidget = terminalRunner.createTerminalWidget(content);
panel.setContent(myTerminalWidget.getComponent());
panel.addFocusListener(this);
new Thread(() -> {
try {
// Wait 0.5 second for the terminal to show up, no wait works ok on WebStorm but not on Android Studio
Thread.currentThread().sleep(500L);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Below code without ApplicationManager.getApplication().invokeLater() will throw exception
// : IDEA Access is allowed from event dispatch thread only.
ApplicationManager.getApplication().invokeLater(() -> {
if (myTerminalWidget.getCurrentSession() != null) {
myTerminalWidget.getCurrentSession().getTerminalStarter().sendString("ls\n");
}
});
}).start();
// ApplicationManager.getApplication().invokeLater(() -> {
// if (myTerminalWidget.getCurrentSession() != null) {
// myTerminalWidget.getCurrentSession().getTerminalStarter().sendString("ls\n");
// }
// });
// createToolbar(terminalRunner, myTerminalWidget, toolWindow, panel);// west toolbar
// ActionToolbar toolbar = createTopToolbar(terminalRunner, myTerminalWidget, toolWindow);
// toolbar.setTargetComponent(panel);
// panel.setToolbar(toolbar.getComponent(), false);
content.setPreferredFocusableComponent(myTerminalWidget.getComponent());
return content;
}
示例14: initToolWindow
import com.intellij.ui.content.Content; //導入方法依賴的package包/類
protected void initToolWindow() {
myToolWindowForm = new AndroidLayoutPreviewToolWindowForm(this, getCustomRefreshRenderAction());
final String toolWindowId = getToolWindowId();
myToolWindow =
ToolWindowManager.getInstance(myProject).registerToolWindow(toolWindowId, false, ToolWindowAnchor.RIGHT, myProject, true);
myToolWindow.setIcon(AndroidIcons.AndroidPreview);
((ToolWindowManagerEx)ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {
private boolean myVisible = false;
@Override
public void stateChanged() {
if (myProject.isDisposed()) {
return;
}
final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(toolWindowId);
if (window != null && window.isAvailable()) {
final boolean visible = window.isVisible();
AndroidEditorSettings.getInstance().getGlobalState().setVisible(visible);
if (visible && !myVisible && isRenderAutomatically()) {
render();
}
myVisible = visible;
}
}
});
final JPanel contentPanel = myToolWindowForm.getContentPanel();
final ContentManager contentManager = myToolWindow.getContentManager();
@SuppressWarnings("ConstantConditions")
final Content content = contentManager.getFactory().createContent(contentPanel, null, false);
content.setDisposer(myToolWindowForm);
content.setCloseable(false);
content.setPreferredFocusableComponent(contentPanel);
contentManager.addContent(content);
contentManager.setSelectedContent(content, true);
myToolWindow.setAvailable(false, null);
myToolWindowForm.setUseInteractiveSelector(isUseInteractiveSelector());
}