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


Java IdeFocusManager.requestFocus方法代码示例

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


在下文中一共展示了IdeFocusManager.requestFocus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:WrapReturnValueDialog.java

示例2: setDisplayed

import com.intellij.openapi.wm.IdeFocusManager; //导入方法依赖的package包/类
/**
 * Displays the presentation to the user.
 */
public void setDisplayed(boolean visible){
  createHelpWindow();
  if(myModallyActivated){
    myDialog.setVisible(visible);
    if(visible){
      myDialog.setLocationRelativeTo(myDialog.getOwner());
    }
  } else{
    //myFrame.setLocationRelativeTo(null);
    myFrame.setVisible(visible);
    myFrame.setState(JFrame.NORMAL);
    IdeFocusManager focusManager = IdeFocusManager.findInstance();
    JComponent target = focusManager.getFocusTargetFor(myFrame.getRootPane());
    focusManager.requestFocus(target != null ? target : myFrame, true);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:IdeaHelpBroker.java

示例3: 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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:55,代码来源:IntroduceParameterObjectDialog.java

示例4: 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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:bigFile.java

示例5: 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();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:DiffPanelImpl.java


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