Java 类com.intellij.util.IJSwingUtilities 实例源码

项目:intellij-ce-playground    文件:TabbedPaneWrapper.java   
public final synchronized void removeTabAt(final int index) {
  assertIsDispatchThread();

  final boolean hadFocus = IJSwingUtilities.hasFocus2(myTabbedPaneHolder);
  final TabWrapper wrapper = getWrapperAt(index);
  try {
    myTabbedPane.removeTabAt(index);
    if (myTabbedPane.getTabCount() == 0) {
      // to clear BasicTabbedPaneUI.visibleComponent field
      myTabbedPane.revalidate();
    }
    if (hadFocus) {
      myTabbedPaneHolder.requestFocus();
    }
  }
  finally {
    wrapper.dispose();
  }
}
项目:intellij-ce-playground    文件:IdeTooltipManager.java   
private void queueShow(final JComponent c, final MouseEvent me, final boolean toCenter, int shift, int posChangeX, int posChangeY) {
  String aText = String.valueOf(c.getToolTipText(me));
  final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null, /*new Object()*/c, aText) {
    @Override
    protected boolean beforeShow() {
      myCurrentEvent = me;

      if (!c.isShowing()) return false;

      String text = c.getToolTipText(myCurrentEvent);
      if (text == null || text.trim().isEmpty()) return false;

      JLayeredPane layeredPane = IJSwingUtilities.findParentOfType(c, JLayeredPane.class);

      final JEditorPane pane = initPane(text, new HintHint(me).setAwtTooltip(true), layeredPane);
      final Wrapper wrapper = new Wrapper(pane);
      setTipComponent(wrapper);
      return true;
    }
  }.setToCenter(toCenter).setCalloutShift(shift).setPositionChangeShift(posChangeX, posChangeY).setLayer(Balloon.Layer.top);

  show(tooltip, false);
}
项目:intellij-ce-playground    文件:LafManagerImpl.java   
public static void updateToolWindows() {
  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    for (String id : toolWindowManager.getToolWindowIds()) {
      final ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
      for (Content content : toolWindow.getContentManager().getContents()) {
        final JComponent component = content.getComponent();
        if (component != null) {
          IJSwingUtilities.updateComponentTreeUI(component);
        }
      }
      final JComponent c = toolWindow.getComponent();
      if (c != null) {
        IJSwingUtilities.updateComponentTreeUI(c);
      }
    }
  }
}
项目:intellij-ce-playground    文件:QuickFixManager.java   
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();
    }
  }
}
项目:intellij-ce-playground    文件:PropertyInspector.java   
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;
}
项目:tools-idea    文件:TabbedPaneWrapper.java   
public final synchronized void removeTabAt(final int index) {
  assertIsDispatchThread();

  final boolean hadFocus = IJSwingUtilities.hasFocus2(myTabbedPaneHolder);
  final TabWrapper wrapper = getWrapperAt(index);
  try {
    myTabbedPane.removeTabAt(index);
    if (myTabbedPane.getTabCount() == 0) {
      // to clear BasicTabbedPaneUI.visibleComponent field
      myTabbedPane.revalidate();
    }
    if (hadFocus) {
      myTabbedPaneHolder.requestFocus();
    }
  }
  finally {
    wrapper.dispose();
  }
}
项目:tools-idea    文件:IdeTooltipManager.java   
private void queueShow(final JComponent c, final MouseEvent me, final boolean toCenter, int shift, int posChangeX, int posChangeY) {
  final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null, new Object()) {
    @Override
    protected boolean beforeShow() {
      myCurrentEvent = me;

      if (!c.isShowing()) return false;

      String text = c.getToolTipText(myCurrentEvent);
      if (text == null || text.trim().isEmpty()) return false;

      JLayeredPane layeredPane = IJSwingUtilities.findParentOfType(c, JLayeredPane.class);

      final JEditorPane pane = initPane(text, new HintHint(me).setAwtTooltip(true), layeredPane);
      final Wrapper wrapper = new Wrapper(pane);
      setTipComponent(wrapper);
      return true;
    }
  }.setToCenter(toCenter).setCalloutShift(shift).setPositionChangeShift(posChangeX, posChangeY).setLayer(Balloon.Layer.top);

  show(tooltip, false);
}
项目:tools-idea    文件:QuickFixManager.java   
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();
    }
  }
}
项目:tools-idea    文件:PropertyInspector.java   
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;
}
项目:consulo-ui-designer    文件:QuickFixManager.java   
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();
    }
  }
}
项目:consulo-ui-designer    文件:PropertyInspector.java   
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;
}
项目:consulo    文件:TabbedPaneWrapper.java   
public final synchronized void removeTabAt(final int index) {
  assertIsDispatchThread();

  final boolean hadFocus = IJSwingUtilities.hasFocus2(myTabbedPaneHolder);
  final TabWrapper wrapper = getWrapperAt(index);
  try {
    myTabbedPane.removeTabAt(index);
    if (myTabbedPane.getTabCount() == 0) {
      // to clear BasicTabbedPaneUI.visibleComponent field
      myTabbedPane.revalidate();
    }
    if (hadFocus) {
      IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(myTabbedPaneHolder);
    }
  }
  finally {
    wrapper.dispose();
  }
}
项目:consulo    文件:IdeTooltipManager.java   
private void queueShow(final JComponent c, final MouseEvent me, final boolean toCenter, int shift, int posChangeX, int posChangeY) {
  String aText = String.valueOf(c.getToolTipText(me));
  final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null, /*new Object()*/c, aText) {
    @Override
    protected boolean beforeShow() {
      myCurrentEvent = me;

      if (!c.isShowing()) return false;

      String text = c.getToolTipText(myCurrentEvent);
      if (text == null || text.trim().isEmpty()) return false;

      JLayeredPane layeredPane = IJSwingUtilities.findParentOfType(c, JLayeredPane.class);

      final JEditorPane pane = initPane(text, new HintHint(me).setAwtTooltip(true), layeredPane);
      final Wrapper wrapper = new Wrapper(pane);
      setTipComponent(wrapper);
      return true;
    }
  }.setToCenter(toCenter).setCalloutShift(shift).setPositionChangeShift(posChangeX, posChangeY).setLayer(Balloon.Layer.top);

  show(tooltip, false);
}
项目:consulo    文件:LafManagerImpl.java   
public static void updateToolWindows() {
  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    for (String id : toolWindowManager.getToolWindowIds()) {
      final ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
      for (Content content : toolWindow.getContentManager().getContents()) {
        final JComponent component = content.getComponent();
        if (component != null) {
          IJSwingUtilities.updateComponentTreeUI(component);
        }
      }
      final JComponent c = toolWindow.getComponent();
      if (c != null) {
        IJSwingUtilities.updateComponentTreeUI(c);
      }
    }
  }
}
项目:intellij-ce-playground    文件:ExecutionWithDebuggerToolsTestCase.java   
protected void invokeRatherLater(final DebuggerCommandImpl command) {
  IJSwingUtilities.invoke(new Runnable() {
    @Override
    public void run() {
      InvokeRatherLaterRequest request = new InvokeRatherLaterRequest(command, getDebugProcess());
      myRatherLaterRequests.add(request);

      if (myRatherLaterRequests.size() == 1) pumpSwingThread();
    }
  });
}
项目:intellij-ce-playground    文件:BaseConvertToLocalQuickFix.java   
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);
    }
  }
}
项目:intellij-ce-playground    文件:ProcessPopup.java   
private void updateContentUI() {
  if (myActiveContentComponent == null || myActiveFocusedContent == null) return;
  IJSwingUtilities.updateComponentTreeUI(myActiveContentComponent);
  if (myActiveContentComponent instanceof JScrollPane) {
    ((JScrollPane)myActiveContentComponent).getViewport().setBackground(myActiveFocusedContent.getBackground());
  }
  myActiveContentComponent.setBorder(null);

}
项目:intellij-ce-playground    文件:EditorTextField.java   
@Override
public boolean isFocusOwner() {
  if (myEditor != null) {
    return IJSwingUtilities.hasFocus(myEditor.getContentComponent());
  }
  return super.isFocusOwner();
}
项目:intellij-ce-playground    文件:TabbedPaneWrapper.java   
public final void setSelectedIndex(final int index, boolean requestFocus) {
  assertIsDispatchThread();

  final boolean hadFocus = IJSwingUtilities.hasFocus2(myTabbedPaneHolder);
  myTabbedPane.setSelectedIndex(index);
  if (hadFocus && requestFocus) {
    myTabbedPaneHolder.requestFocus();
  }
}
项目:intellij-ce-playground    文件:JBTableRowEditor.java   
public static JPanel createLabeledPanel(String labelText, JComponent component) {
  final JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 4, 2, true, false));
  final JBLabel label = new JBLabel(labelText, UIUtil.ComponentStyle.SMALL);
  IJSwingUtilities.adjustComponentsOnMac(label, component);
  panel.add(label);
  panel.add(component);
  return panel;
}
项目:intellij-ce-playground    文件:LafManagerImpl.java   
private static void updateUI(Window window) {
  if (!window.isDisplayable()) {
    return;
  }
  IJSwingUtilities.updateComponentTreeUI(window);
  Window[] children = window.getOwnedWindows();
  for (Window aChildren : children) {
    updateUI(aChildren);
  }
}
项目:intellij-ce-playground    文件:EventLog.java   
@Override
public void navigate(Project project) {
  NotificationListener listener = myNotification.getListener();
  if (listener != null) {
    EventLogConsole console = ObjectUtils.assertNotNull(getProjectComponent(project).getConsole(myNotification));
    JComponent component = console.getConsoleEditor().getContentComponent();
    listener.hyperlinkUpdate(myNotification, IJSwingUtilities.createHyperlinkEvent(myHref, component));
  }
}
项目:intellij-ce-playground    文件:FirstRunWizardStep.java   
@Override
public void onEnterStep() {
  super.onEnterStep();
  if (!myComponentUpdated) {
    // Update the UI after a potential color theme change.
    // If this is missing and a user selects the darcula color theme, the colors
    // in all subsequent pages will be wrong (a mix of darcula and default).
    IJSwingUtilities.updateComponentTreeUI(myComponent);
    myComponentUpdated = true;
  }
}
项目:intellij-ce-playground    文件:QuickFixManager.java   
/**
 * 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()));
}
项目:intellij-ce-playground    文件:AbstractQuickFixManager.java   
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();
    }
  }
}
项目:intellij-ce-playground    文件:AbstractQuickFixManager.java   
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()));
}
项目:aem-ide-tooling-4-intellij    文件:ConsoleLog.java   
@Override
public void navigate(Project project) {
    NotificationListener listener = myNotification.getListener();
    if(listener != null) {
        ConsoleLogConsole console = ObjectUtils.assertNotNull(getProjectComponent(project).getConsole(myNotification));
        JComponent component = console.getConsoleEditor().getContentComponent();
        listener.hyperlinkUpdate(myNotification, IJSwingUtilities.createHyperlinkEvent(myHref, component));
    }
}
项目:tools-idea    文件:BreakpointManager.java   
public void setInitialBreakpointsState() {
  myAllowMulticasting = false;
  for (final EnableBreakpointRule myBreakpointRule : myBreakpointRules) {
    myBreakpointRule.init();
  }
  myAllowMulticasting = true;
  if (!myBreakpointRules.isEmpty()) {
    IJSwingUtilities.invoke(new Runnable() {
      @Override
      public void run() {
        myDispatcher.getMulticaster().breakpointsChanged();
      }
    });
  }
}
项目:tools-idea    文件:ExecutionWithDebuggerToolsTestCase.java   
protected void invokeRatherLater(final DebuggerCommandImpl command) {
  IJSwingUtilities.invoke(new Runnable() {
    @Override
    public void run() {
      InvokeRatherLaterRequest request = new InvokeRatherLaterRequest(command, getDebugProcess());
      myRatherLaterRequests.add(request);

      if (myRatherLaterRequests.size() == 1) pumpSwingThread();
    }
  });
}
项目:tools-idea    文件:JavaDocLocalInspection.java   
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);
    }
  }
}
项目:tools-idea    文件:BaseConvertToLocalQuickFix.java   
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);
    }
  }
}
项目:tools-idea    文件:EditorImpl.java   
void updateCaretCursor() {
  if (!ourIsUnitTestMode && !IJSwingUtilities.hasFocus(getContentComponent())) {
    stopOptimizedScrolling();
  }

  myUpdateCursor = true;
}
项目:tools-idea    文件:EditorTextField.java   
@Override
public boolean isFocusOwner() {
  if (myEditor != null) {
    return IJSwingUtilities.hasFocus(myEditor.getContentComponent());
  }
  return super.isFocusOwner();
}
项目:tools-idea    文件:TabbedPaneWrapper.java   
public final void setSelectedIndex(final int index, boolean requestFocus) {
  assertIsDispatchThread();

  final boolean hadFocus = IJSwingUtilities.hasFocus2(myTabbedPaneHolder);
  myTabbedPane.setSelectedIndex(index);
  if (hadFocus && requestFocus) {
    myTabbedPaneHolder.requestFocus();
  }
}
项目:tools-idea    文件:JBTableRowEditor.java   
public static JPanel createLabeledPanel(String labelText, JComponent component) {
  final JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 4, 2, true, false));
  final JBLabel label = new JBLabel(labelText, UIUtil.ComponentStyle.SMALL);
  IJSwingUtilities.adjustComponentsOnMac(label, component);
  panel.add(label);
  panel.add(component);
  return panel;
}
项目:tools-idea    文件:EventLog.java   
@Override
public void navigate(Project project) {
  NotificationListener listener = myNotification.getListener();
  if (listener != null) {
    JComponent component = getProjectComponent(project).myConsole.getConsoleEditor().getContentComponent();
    listener.hyperlinkUpdate(myNotification, IJSwingUtilities.createHyperlinkEvent(myHref, component));
  }
}
项目:tools-idea    文件:QuickFixManager.java   
/**
 * 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()));
}
项目:tools-idea    文件:AbstractQuickFixManager.java   
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();
    }
  }
}
项目:tools-idea    文件:AbstractQuickFixManager.java   
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()));
}
项目:cordovastudio    文件:AbstractQuickFixManager.java   
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();
    }
  }
}