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


Java IJSwingUtilities.hasFocus方法代码示例

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


在下文中一共展示了IJSwingUtilities.hasFocus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: refreshIntentionHint

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
public void refreshIntentionHint() {
  if(!myComponent.isShowing() || !IJSwingUtilities.hasFocus(myComponent)){
    hideIntentionHint();
    return;
  }
  if (myHint == null || !myHint.isVisible()) {
    updateIntentionHintVisibility();
  }
  else {
    final ErrorInfo[] errorInfos = getErrorInfos();
    final Rectangle bounds = getErrorBounds();
    if (!haveFixes(errorInfos) || bounds == null || !bounds.equals(myLastHintBounds)) {
      hideIntentionHint();
      updateIntentionHintVisibility();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:QuickFixManager.java

示例2: showSelectedColumnProperties

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
private boolean showSelectedColumnProperties() {
  if (myCustomPropertiesPanel != null && myPropertiesPanelContainer != null &&
      IJSwingUtilities.hasFocus(myCustomPropertiesPanel.getComponent())) {
    return true;
  }
  if (myEditor == null) return false;
  GridCaptionPanel panel = myEditor.getFocusedCaptionPanel();
  if (panel == null) return false;
  RadContainer container = panel.getSelectedContainer();
  if (container == null) return false;
  final int[] selection = panel.getSelectedCells(null);
  myPropertiesPanelContainer = container;
  final CustomPropertiesPanel propertiesPanel = container.getGridLayoutManager().getRowColumnPropertiesPanel(container, panel.isRow(), selection);
  if (propertiesPanel == null) return false;
  showCustomPropertiesPanel(propertiesPanel);
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PropertyInspector.java

示例3: positionCaretToDeclaration

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
protected static void positionCaretToDeclaration(@NotNull Project project, @NotNull PsiFile psiFile, @NotNull PsiElement declaration) {
  final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
  if (editor != null && (IJSwingUtilities.hasFocus(editor.getComponent()) || ApplicationManager.getApplication().isUnitTestMode())) {
    final PsiFile openedFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
    if (openedFile == psiFile) {
      editor.getCaretModel().moveToOffset(declaration.getTextOffset());
      editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:BaseConvertToLocalQuickFix.java

示例4: isFocusOwner

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
@Override
public boolean isFocusOwner() {
  if (myEditor != null) {
    return IJSwingUtilities.hasFocus(myEditor.getContentComponent());
  }
  return super.isFocusOwner();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:EditorTextField.java

示例5: showIntentionHint

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
/**
 * Shows intention hint (light bulb) if it's not visible yet.
 */
final void showIntentionHint(){
  if(!myComponent.isShowing() || !IJSwingUtilities.hasFocus(myComponent)){
    hideIntentionHint();
    return;
  }

  // 1. Hide previous hint (if any)
  hideIntentionHint();

  // 2. Found error (if any)
  final ErrorInfo[] errorInfos = getErrorInfos();
  if(!haveFixes(errorInfos)) {
    hideIntentionHint();
    return;
  }

  // 3. Determine position where this hint should be shown
  final Rectangle bounds = getErrorBounds();
  if(bounds == null){
    return;
  }

  // 4. Show light bulb to fix this error
  final LightBulbComponentImpl lightBulbComponent = new LightBulbComponentImpl(this, AllIcons.Actions.IntentionBulb);
  myHint = new LightweightHint(lightBulbComponent);
  myLastHintBounds = bounds;
  myHint.show(myComponent, bounds.x - AllIcons.Actions.IntentionBulb.getIconWidth() - 4, bounds.y, myComponent, new HintHint(myComponent, bounds.getLocation()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:QuickFixManager.java

示例6: update

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
public void update() {
  if (!myComponent.isShowing() || !IJSwingUtilities.hasFocus(myComponent)) {
    hideHint();
  }
  else if (myHint == null || !myHint.isVisible()) {
    updateHintVisibility();
  }
  else {
    Rectangle bounds = getErrorBounds();
    if (!ErrorInfo.haveFixes(getErrorInfos()) || bounds == null || !bounds.equals(myLastHintBounds)) {
      hideHint();
      updateHintVisibility();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:AbstractQuickFixManager.java

示例7: showHint

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
private void showHint() {
  if (!myComponent.isShowing() || !IJSwingUtilities.hasFocus(myComponent)) {
    hideHint();
    return;
  }

  // 1. Hide previous hint (if any)
  hideHint();

  // 2. Found error (if any)
  List<ErrorInfo> infos = getErrorInfos();
  if (!ErrorInfo.haveFixes(infos)) {
    hideHint();
    return;
  }

  boolean error = false;
  for (ErrorInfo errorInfo : infos) {
    if (errorInfo.getLevel() == HighlightDisplayLevel.ERROR) {
      error = true;
      break;
    }
  }

  // 3. Determine position where this hint should be shown
  Rectangle bounds = getErrorBounds();
  if (bounds == null) {
    return;
  }

  // 4. Show light bulb to fix this error
  myHint = new LightweightHint(new InspectionHint(error ? AllIcons.Actions.QuickfixBulb : AllIcons.Actions.IntentionBulb));
  myLastHintBounds = bounds;
  myHint.show(myComponent, bounds.x - AllIcons.Actions.IntentionBulb.getIconWidth() - 4, bounds.y, myComponent, new HintHint(myComponent, bounds.getLocation()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:AbstractQuickFixManager.java

示例8: moveCaretTo

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
private static void moveCaretTo(final PsiElement newCaretPosition) {
  Project project = newCaretPosition.getProject();
  final PsiFile psiFile = newCaretPosition.getContainingFile();
  final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
  if (editor != null && IJSwingUtilities.hasFocus(editor.getComponent())) {
    final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
    if (file == psiFile) {
      editor.getCaretModel().moveToOffset(newCaretPosition.getTextRange().getEndOffset());
      editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:JavaDocLocalInspection.java

示例9: updateCaretCursor

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
void updateCaretCursor() {
  if (!ourIsUnitTestMode && !IJSwingUtilities.hasFocus(getContentComponent())) {
    stopOptimizedScrolling();
  }

  myUpdateCursor = true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:EditorImpl.java

示例10: MyState

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
public MyState() {
  isFocused = IJSwingUtilities.hasFocus(getFocusableComponent());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:DiffSideView.java

示例11: selectElementAtCaretNotLosingFocus

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
private void selectElementAtCaretNotLosingFocus(@NotNull Editor editor) {
  if (IJSwingUtilities.hasFocus(getCurrentProjectViewPane().getComponentToFocus())) return;
  selectElementAtCaret(editor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ProjectViewImpl.java

示例12: selectElementAtCaretNotLosingFocus

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
private void selectElementAtCaretNotLosingFocus() {
  if (IJSwingUtilities.hasFocus(this.getComponentToFocus())) return;
  scrollFromSource();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:MvcProjectViewPane.java

示例13: isPaintSelection

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
public boolean isPaintSelection() {
  return myPaintSelection || !isOneLineMode() || IJSwingUtilities.hasFocus(getContentComponent());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:EditorImpl.java

示例14: paint

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
private void paint(@NotNull Graphics g) {
  if (!isEnabled() || !myIsShown || !IJSwingUtilities.hasFocus(getContentComponent()) || isRendererMode()) return;

  int x = myLocation.x;
  int lineHeight = getLineHeight();
  int y = myLocation.y;

  Rectangle viewRectangle = getScrollingModel().getVisibleArea();
  if (x - viewRectangle.x < 0) {
    return;
  }


  g.setColor(myScheme.getColor(EditorColors.CARET_COLOR));

  if (!paintBlockCaret()) {
    if (UIUtil.isRetina()) {
      g.fillRect(x, y, mySettings.getLineCursorWidth(), lineHeight);
    } else {
      for (int i = 0; i < mySettings.getLineCursorWidth(); i++) {
        UIUtil.drawLine(g, x + i, y, x + i, y + lineHeight - 1);
      }
    }

  }
  else {
    Color caretColor = myScheme.getColor(EditorColors.CARET_COLOR);
    if (caretColor == null) caretColor = new JBColor(Color.BLACK, Color.WHITE);
    g.setColor(caretColor);
    g.fillRect(x, y, myWidth, lineHeight - 1);
    final LogicalPosition startPosition = getCaretModel().getLogicalPosition();
    final int offset = logicalPositionToOffset(startPosition);
    char[] chars = myDocument.getRawChars();
    if (chars.length > offset) {
      FoldRegion folding = myFoldingModel.getCollapsedRegionAtOffset(offset);
      final char ch;
      if (folding == null || folding.isExpanded()) {
        ch = chars[offset];
      }
      else {
        VisualPosition visual = getCaretModel().getVisualPosition();
        VisualPosition foldingPosition = offsetToVisualPosition(folding.getStartOffset());
        if (visual.line == foldingPosition.line) {
          ch = folding.getPlaceholderText().charAt(visual.column - foldingPosition.column);
        }
        else {
          ch = chars[offset];
        }
      }
      IterationState state = null;
      try {
        //don't worry it's cheap. Cache is not required
        state = new IterationState(EditorImpl.this, offset, offset + 1, true);
        TextAttributes attributes = state.getMergedAttributes();
        if (attributes != null) {
          FontInfo info = EditorUtil.fontForChar(ch, attributes.getFontType(), EditorImpl.this);
          if (info != null) {
            g.setFont(info.getFont());
          }
        }
        //todo[kb]
        //in case of italic style we paint out of the cursor block. Painting the symbol to a dedicated buffered image
        //solves the problem, but still looks weird because it leaves colored pixels at right.
        g.setColor(CURSOR_FOREGROUND);
        g.drawChars(new char[]{ch}, 0, 1, x, y + getAscent());
      }
      finally {
        if (state != null) state.dispose();
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:73,代码来源:EditorImpl.java

示例15: selectElementAtCaretNotLosingFocus

import com.intellij.util.IJSwingUtilities; //导入方法依赖的package包/类
private void selectElementAtCaretNotLosingFocus(final Editor editor) {
  if (IJSwingUtilities.hasFocus(getCurrentProjectViewPane().getComponentToFocus())) return;
  selectElementAtCaret(editor);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:ProjectViewImpl.java


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