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

The following examples show how to use com.intellij.openapi.ui.popup.JBPopup#isDisposed() . 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: PopupPositionManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private static PositionAdjuster createPositionAdjuster(JBPopup hint) {
  final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
  if (focusOwner == null) return null;

  JBPopup popup = PopupUtil.getPopupContainerFor(focusOwner);
  if (popup != null && popup != hint && !popup.isDisposed()) {
    return new PositionAdjuster(popup.getContent());
  }

  final Component existing = discoverPopup(LangDataKeys.POSITION_ADJUSTER_POPUP, focusOwner);
  if (existing != null) {
    return new PositionAdjuster2(existing, discoverPopup(LangDataKeys.PARENT_POPUP, focusOwner));
  }

  return null;
}
 
Example 2
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 3
Source File: DocumentationComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
private Component getPopupAnchor() {
  LookupEx lookup = myManager == null ? null : LookupManager.getActiveLookup(myManager.getEditor());

  if (lookup != null && lookup.getCurrentItem() != null && lookup.getComponent().isShowing()) {
    return lookup.getComponent();
  }
  Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
  JBPopup popup = PopupUtil.getPopupContainerFor(focusOwner);
  if (popup != null && popup != myHint && !popup.isDisposed()) {
    return popup.getContent();
  }
  return null;
}
 
Example 4
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 5
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 6
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;
  }
}