本文整理汇总了Java中com.intellij.openapi.wm.IdeFocusManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java IdeFocusManager.getInstance方法的具体用法?Java IdeFocusManager.getInstance怎么用?Java IdeFocusManager.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.wm.IdeFocusManager
的用法示例。
在下文中一共展示了IdeFocusManager.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toggleRadioEnablement
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
private void toggleRadioEnablement() {
UIUtil.setEnabled(myExistingClassPanel, useExistingClassButton.isSelected(), true);
UIUtil.setEnabled(myNewClassPanel, createNewClassButton.isSelected(), true);
UIUtil.setEnabled(myCreateInnerPanel, myCreateInnerClassButton.isSelected(), true);
final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
if (useExistingClassButton.isSelected()) {
focusManager.requestFocus(existingClassField, true);
}
else if (myCreateInnerClassButton.isSelected()) {
focusManager.requestFocus(myInnerClassNameTextField, true);
}
else {
focusManager.requestFocus(classNameField, true);
}
validateButtons();
}
示例2: notifyPublisher
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
@NotNull
@Override
public ActionCallback notifyPublisher(@NotNull final Runnable runnable) {
final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
final ActionCallback done = new ActionCallback();
return myBusyObject.execute(new ActiveRunnable() {
@NotNull
@Override
public ActionCallback run() {
focusManager.doWhenFocusSettlesDown(new ExpirableRunnable.ForProject(myProject) {
@Override
public void run() {
runnable.run();
done.setDone();
}
});
return done;
}
});
}
示例3: updateActions
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
private void updateActions(boolean now, final boolean transparentOnly, final boolean forced) {
final Runnable updateRunnable = new MyUpdateRunnable(this, transparentOnly, forced);
final Application app = ApplicationManager.getApplication();
if (now || app.isUnitTestMode()) {
updateRunnable.run();
}
else {
final IdeFocusManager fm = IdeFocusManager.getInstance(null);
if (!app.isHeadlessEnvironment()) {
if (app.isDispatchThread() && myComponent.isShowing()) {
fm.doWhenFocusSettlesDown(updateRunnable);
}
else {
UiNotifyConnector.doWhenFirstShown(myComponent, new Runnable() {
@Override
public void run() {
fm.doWhenFocusSettlesDown(updateRunnable);
}
});
}
}
}
}
示例4: RunnerLayoutUiImpl
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public RunnerLayoutUiImpl(@NotNull Project project,
@NotNull Disposable parent,
@NotNull String runnerId,
@NotNull String runnerTitle,
@NotNull String sessionName) {
myLayout = RunnerLayoutSettings.getInstance().getLayout(runnerId);
Disposer.register(parent, this);
myContentUI = new RunnerContentUi(project, this, ActionManager.getInstance(), IdeFocusManager.getInstance(project), myLayout,
runnerTitle + " - " + sessionName);
Disposer.register(this, myContentUI);
myViewsContentManager = getContentFactory().createContentManager(myContentUI.getContentUI(), false, project);
myViewsContentManager.addDataProvider(this);
Disposer.register(this, myViewsContentManager);
}
示例5: focus
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public void focus() {
final Project project = myConfiguration.getModule().getProject();
final IdeFocusManager focusManager = project.isDefault() ? IdeFocusManager.getGlobalInstance() : IdeFocusManager.getInstance(project);
focusManager.doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
focusManager.requestFocus(myThemeList, true);
}
});
}
示例6: focusTable
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public void focusTable() {
final Project project = myModel.getProject();
final IdeFocusManager focusManager = project == null || project.isDefault()
? IdeFocusManager.getGlobalInstance() : IdeFocusManager.getInstance(project);
focusManager.doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
focusManager.requestFocus(myTable, true);
}
});
}
示例7: getFocusManager
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
@Override
public IdeFocusManager getFocusManager() {
Project project = getProject();
if (project != null && !project.isDisposed()) {
return IdeFocusManager.getInstance(project);
}
else {
return IdeFocusManager.findInstance();
}
}
示例8: JBTabsPaneImpl
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public JBTabsPaneImpl(@Nullable Project project, int tabPlacement, @NotNull Disposable parent) {
myTabs = new JBEditorTabs(project, ActionManager.getInstance(), project == null ? null : IdeFocusManager.getInstance(project), parent) {
@Override
public boolean isAlphabeticalMode() {
return false;
}
@Override
public boolean supportsCompression() {
return false;
}
@Override
protected Color getEmptySpaceColor() {
return UIUtil.getBgFillColor(getParent());
}
@Override
protected void paintSelectionAndBorder(Graphics2D g2d) {
super.paintSelectionAndBorder(g2d);
}
};
myTabs.setFirstTabOffset(10);
myTabs.addListener(new TabsListener.Adapter() {
@Override
public void selectionChanged(TabInfo oldSelection, TabInfo newSelection) {
fireChanged(new ChangeEvent(myTabs));
}
}).getPresentation()
.setPaintBorder(1, 1, 1, 1)
.setTabSidePaintBorder(2)
.setPaintFocus(UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())
.setAlwaysPaintSelectedTab(UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF())
.setGhostsAlwaysVisible(true);
setTabPlacement(tabPlacement);
}
示例9: keyPressed
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
@Override
public void keyPressed(final KeyEvent e) {
if (!(e.isAltDown() || e.isMetaDown() || e.isControlDown() || myPanel.isNodePopupActive())) {
if (!Character.isLetter(e.getKeyChar())) {
return;
}
final IdeFocusManager focusManager = IdeFocusManager.getInstance(myPanel.getProject());
final ActionCallback firstCharTyped = new ActionCallback();
focusManager.typeAheadUntil(firstCharTyped);
myPanel.moveDown();
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
final Robot robot = new Robot();
final boolean shiftOn = e.isShiftDown();
final int code = e.getKeyCode();
if (shiftOn) {
robot.keyPress(KeyEvent.VK_SHIFT);
}
robot.keyPress(code);
robot.keyRelease(code);
//don't release Shift
firstCharTyped.setDone();
}
catch (AWTException ignored) {
}
}
});
}
}
示例10: DebuggerTabsIml
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public DebuggerTabsIml(Project project, Disposable parent) {
mTabs = new JBEditorTabs(project, ActionManager.getInstance(), IdeFocusManager.getInstance(project), parent);
mTabs.addListener(createListener());
mTabs.setTabDraggingEnabled(true);
}
示例11: IntroduceParameterObjectDialog
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public IntroduceParameterObjectDialog(PsiMethod sourceMethod) {
super(sourceMethod.getProject(), true);
this.sourceMethod = sourceMethod;
setTitle(RefactorJBundle.message("introduce.parameter.object.title"));
final DocumentListener docListener = new DocumentAdapter() {
protected void textChanged(final DocumentEvent e) {
validateButtons();
}
};
final PsiClass containingClass = sourceMethod.getContainingClass();
keepMethodAsDelegate.setVisible(containingClass != null && !containingClass.isInterface());
classNameField.getDocument().addDocumentListener(docListener);
myInnerClassNameTextField.getDocument().addDocumentListener(docListener);
final PsiParameterList parameterList = sourceMethod.getParameterList();
final PsiParameter[] parameters = parameterList.getParameters();
parameterInfo = new VariableData[parameters.length];
for (int i = 0; i < parameterInfo.length; i++) {
parameterInfo[i] = new VariableData(parameters[i]);
parameterInfo[i].name = parameters[i].getName();
parameterInfo[i].passAsParameter = true;
}
sourceMethodTextField.setText(PsiFormatUtil.formatMethod(sourceMethod, PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_CONTAINING_CLASS | PsiFormatUtil.SHOW_NAME, 0));
final ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(useExistingClassButton);
buttonGroup.add(createNewClassButton);
buttonGroup.add(myCreateInnerClassRadioButton);
createNewClassButton.setSelected(true);
if (containingClass != null && containingClass.getQualifiedName() == null) {
myCreateInnerClassRadioButton.setEnabled(false);
}
init();
final ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
toggleRadioEnablement();
final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
if (useExistingClass()) {
focusManager.requestFocus(existingClassField, true);
} else if (myCreateInnerClassRadioButton.isSelected()) {
focusManager.requestFocus(myInnerClassNameTextField, true);
} else {
focusManager.requestFocus(classNameField, true);
}
}
};
useExistingClassButton.addActionListener(listener);
createNewClassButton.addActionListener(listener);
myCreateInnerClassRadioButton.addActionListener(listener);
myGenerateAccessorsCheckBox.setSelected(true);
myEscalateVisibilityCheckBox.setSelected(true);
toggleRadioEnablement();
}
示例12: requestFocus
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
private void requestFocus() {
final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
if (focusManager.getFocusOwner() != myEditorComponent) { //IDEA-64501
focusManager.requestFocus(myEditorComponent, true);
}
}
示例13: getActiveSplitters
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
@NotNull
private AsyncResult<EditorsSplitters> getActiveSplitters(boolean syncUsage) {
final boolean async = Registry.is("ide.windowSystem.asyncSplitters") && !syncUsage;
final AsyncResult<EditorsSplitters> result = new AsyncResult<EditorsSplitters>();
final IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
Runnable run = new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) {
result.setRejected();
return;
}
Component focusOwner = fm.getFocusOwner();
if (focusOwner == null && !async) {
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
}
if (focusOwner == null && !async) {
focusOwner = fm.getLastFocusedFor(fm.getLastFocusedFrame());
}
DockContainer container = myDockManager.getContainerFor(focusOwner);
if (container == null && !async) {
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
container = myDockManager.getContainerFor(focusOwner);
}
if (container instanceof DockableEditorTabbedContainer) {
result.setDone(((DockableEditorTabbedContainer)container).getSplitters());
}
else {
result.setDone(getMainSplitters());
}
}
};
if (async) {
fm.doWhenFocusSettlesDown(run);
}
else {
UIUtil.invokeLaterIfNeeded(run);
}
return result;
}
示例14: setDiffRequest
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
public void setDiffRequest(DiffRequest data) {
myDiffRequest = data;
if (data.getHints().contains(DiffTool.HINT_DO_NOT_IGNORE_WHITESPACES)) {
setComparisonPolicy(ComparisonPolicy.DEFAULT, false);
}
myDataProvider.putData(myDiffRequest.getGenericData());
DiffContent content1 = data.getContents()[0];
DiffContent content2 = data.getContents()[1];
setContents(content1, content2);
setTitles(data);
setWindowTitle(myOwnerWindow, data.getWindowTitle());
myPanel.setToolbarActions(createToolbar());
data.customizeToolbar(myPanel.resetToolbar());
myPanel.registerToolbarActions();
initEditorSettings(getEditor1());
initEditorSettings(getEditor2());
final JComponent oldBottomComponent = myPanel.getBottomComponent();
if (oldBottomComponent instanceof Disposable) {
Disposer.dispose((Disposable)oldBottomComponent);
}
final JComponent newBottomComponent = data.getBottomComponent();
myPanel.setBottomComponent(newBottomComponent);
if (myIsRequestFocus) {
IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
boolean isEditor1Focused = getEditor1() != null
&& fm.getFocusedDescendantFor(getEditor1().getComponent()) != null;
boolean isEditor2Focused = myData.getContent2() != null
&& getEditor2() != null
&& fm.getFocusedDescendantFor(getEditor2().getComponent()) != null;
if (isEditor1Focused || isEditor2Focused) {
Editor e = isEditor2Focused ? getEditor2() : getEditor1();
if (e != null) {
fm.requestFocus(e.getContentComponent(), true);
}
}
myPanel.requestScrollEditors();
}
}
示例15: getFocusManager
import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
IdeFocusManager getFocusManager() {
return IdeFocusManager.getInstance(myProject);
}