Java Code Examples for com.intellij.openapi.ui.popup.JBPopup#isVisible()

The following examples show how to use com.intellij.openapi.ui.popup.JBPopup#isVisible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShowUsagesAction.java    From dagger-intellij-plugin with Apache License 2.0 5 votes vote down vote up
private static boolean showPopupIfNeedTo(@NotNull JBPopup popup,
    @NotNull RelativePoint popupPosition) {
  if (!popup.isDisposed() && !popup.isVisible()) {
    popup.show(popupPosition);
    return true;
  } else {
    return false;
  }
}
 
Example 2
Source File: HelpTooltip.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Sets master popup for the current {@code HelpTooltip}. Master popup takes over the help tooltip,
 * so when the master popup is about to be shown help tooltip hides.
 *
 * @param owner  possible owner
 * @param master master popup
 */
public static void setMasterPopup(@Nonnull Component owner, JBPopup master) {
  if (owner instanceof JComponent) {
    HelpTooltip instance = (HelpTooltip)((JComponent)owner).getClientProperty(TOOLTIP_PROPERTY);
    if (instance != null && instance.myPopup != master) {
      instance.masterPopupOpenCondition = () -> master == null || !master.isVisible();
    }
  }
}
 
Example 3
Source File: SearchUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static boolean cancelPopups(final JBPopup[] activePopup) {
  for (JBPopup popup : activePopup) {
    if (popup != null && popup.isVisible()) {
      popup.cancel();
      return true;
    }
  }
  return false;
}
 
Example 4
Source File: DocumentationManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public JBPopup getDocInfoHint() {
  if (myDocInfoHintRef == null) return null;
  JBPopup hint = myDocInfoHintRef.get();
  if (hint == null || !hint.isVisible() && !ApplicationManager.getApplication().isUnitTestMode()) {
    if (hint != null) {
      // hint's window might've been hidden by AWT without notifying us
      // dispose to remove the popup from IDE hierarchy and avoid leaking components
      hint.cancel();
    }
    myDocInfoHintRef = null;
    return null;
  }
  return hint;
}
 
Example 5
Source File: DocumentationComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  super.actionPerformed(e);
  JBPopup hint = myHint;
  if (hint != null && hint.isVisible()) {
    hint.cancel();
  }
}
 
Example 6
Source File: HectorComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private JBPopup getOldHector() {
  if (myHectorRef == null) return null;
  final JBPopup hector = myHectorRef.get();
  if (hector == null || !hector.isVisible()) {
    myHectorRef = null;
    return null;
  }
  return hector;
}
 
Example 7
Source File: PopupPositionManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static Component discoverPopup(final Key<JBPopup> datakey, Component focusOwner) {
  if (focusOwner == null) {
    focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
  }

  if (focusOwner == null) return null;

  final DataContext dataContext = DataManager.getInstance().getDataContext(focusOwner);
  final JBPopup popup = dataContext.getData(datakey);
  if (popup != null && popup.isVisible() && !popup.isDisposed()) {
    return popup.getContent();
  }

  return null;
}
 
Example 8
Source File: ShowUsagesAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static boolean showPopupIfNeedTo(@Nonnull JBPopup popup, @Nonnull RelativePoint popupPosition) {
  if (!popup.isDisposed() && !popup.isVisible()) {
    popup.show(popupPosition);
    return true;
  }
  else {
    return false;
  }
}
 
Example 9
Source File: ShowUsagesAction.java    From otto-intellij-plugin with Apache License 2.0 5 votes vote down vote up
private static boolean showPopupIfNeedTo(@NotNull JBPopup popup, @NotNull RelativePoint popupPosition) {
  if (!popup.isDisposed() && !popup.isVisible()) {
    popup.show(popupPosition);
    return true;
  }
  else {
    return false;
  }
}
 
Example 10
Source File: HintUpdateSupply.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Contract("!null->true")
private static boolean isHintVisible(JBPopup hint) {
  return hint != null && hint.isVisible();
}