Package com.intellij.openapi.ui.popup

Examples of com.intellij.openapi.ui.popup.ListPopup


  public void startPickTypes(RelativePoint relativePoint, PsiParameter[] psiParameters,
      final Callback callback) {
    if (psiParameters.length == 0) return;

    ListPopup listPopup = JBPopupFactory.getInstance()
        .createListPopup(new BaseListPopupStep<PsiParameter>("Select Type", psiParameters) {
          @NotNull @Override public String getTextFor(PsiParameter value) {
            StringBuilder builder = new StringBuilder();

            Set<String> annotations = PsiConsultantImpl.getQualifierAnnotations(value);
            for (String annotation : annotations) {
              String trimmed = annotation.substring(annotation.lastIndexOf(".") + 1);
              builder.append("@").append(trimmed).append(" ");
            }

            PsiClass notLazyOrProvider = PsiConsultantImpl.checkForLazyOrProvider(value);
            return builder.append(notLazyOrProvider.getName()).toString();
          }

          @Override public PopupStep onChosen(PsiParameter selectedValue, boolean finalChoice) {
            callback.onParameterChosen(selectedValue);
            return super.onChosen(selectedValue, finalChoice);
          }
        });

    listPopup.show(relativePoint);
  }
View Full Code Here


        label.setCursor(Cursor.getDefaultCursor());
        DefaultActionGroup actionGroup = new DefaultActionGroup();
        for (T value : getValues()) {
            actionGroup.add(new SelectValueAction(value));
        }
        ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
                null,
                actionGroup,
                DataManager.getInstance().getDataContext(this),
                false,
                false,
                false,
                new Runnable() {
                    @Override
                    public void run() {
                        isShowingPopup = false;
                        innerPanel.setBorder(defaultBorder);
                        innerPanel.setBackground(isComboBox ? COMBO_BOX_BACKGROUND : UIUtil.getPanelBackground());
                        innerPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                        label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                        updateUI();
                    }
                }, 10, new Condition<AnAction>() {
                    @Override
                    public boolean value(AnAction anAction) {
                        if (anAction instanceof ValueSelector.SelectValueAction) {
                            SelectValueAction action = (SelectValueAction) anAction;
                            return action.value.equals(selectedValue);
                        }
                        return false;
                    }
                });

        Point locationOnScreen = getLocationOnScreen();
        Point location = new Point(
                (int) (locationOnScreen.getX()),
                (int) locationOnScreen.getY() + getHeight() + 1);
        popup.showInScreenCoordinates(this, location);
        isActive = true;
    }
View Full Code Here

        }

        actionGroup.addSeparator();
        actionGroup.add(new SetupConnectionAction());

        ListPopup popupBuilder = JBPopupFactory.getInstance().createActionGroupPopup(
                "Select connection",
                actionGroup,
                DataManager.getInstance().getDataContext(editor.getComponent()),
                JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                true);

        popupBuilder.showCenteredInCurrentWindow(project);


        /*
        // old dialog approach
        DBLanguageFile file = (DBLanguageFile) psiFile;
View Full Code Here

                SelectSchemaAction schemaAction = new SelectSchemaAction(schema, dbLanguageFile);
                actionGroup.add(schemaAction);
            }
        }

        ListPopup popupBuilder = JBPopupFactory.getInstance().createActionGroupPopup(
                "Select schema",
                actionGroup,
                DataManager.getInstance().getDataContext(editor.getComponent()),
                JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                true);

        popupBuilder.showCenteredInCurrentWindow(project);


        /*
        // old dialog approach
        DBLanguageFile file = (DBLanguageFile) psiFile;
View Full Code Here

        actionGroup.add(new CreateBasicFilterAction(filterList));
        actionGroup.add(new CreateCustomFilterAction(filterList));
    }

    public void actionPerformed(AnActionEvent e) {
        ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
                "Create filter",
                actionGroup,
                e.getDataContext(),
                JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                true, null, 10);
View Full Code Here

            openRecordViewer(filterInput);
        } else if (navigationTarget == RecordNavigationTarget.ASK) {
            ActionGroup actionGroup = new RecordNavigationActionGroup(filterInput);
            Component component = (Component) inputEvent.getSource();

            ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
                    "Select navigation target",
                    actionGroup,
                    DataManager.getInstance().getDataContext(component),
                    JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                    true, null, 10);

            if (inputEvent instanceof MouseEvent) {
                MouseEvent mouseEvent = (MouseEvent) inputEvent;
                popup.showInScreenCoordinates(component, mouseEvent.getLocationOnScreen());
                       
            } else {
                popup.show(component);
            }

           
        }
    }
View Full Code Here

  }

  public static void startPicker(Type[] displayedTypes, RelativePoint relativePoint,
                                 final Callback callback) {

    ListPopup listPopup = JBPopupFactory.getInstance()
        .createListPopup(new BaseListPopupStep<Type>("Select Type", displayedTypes) {
          @NotNull @Override public String getTextFor(Type value) {
            return value.toString();
          }

          @Override public PopupStep onChosen(Type selectedValue, boolean finalChoice) {
            callback.onTypeChose(selectedValue);
            return super.onChosen(selectedValue, finalChoice);
          }
        });

    listPopup.show(relativePoint);
  }
View Full Code Here

  }


  protected void showCloudChooser(final List<CloudPlugin> plugins, final List<String> descriptions) {
    final JBPopupFactory factory = JBPopupFactory.getInstance();
    final ListPopup popup = factory.createListPopup(new BaseListPopupStep<String>("Store comments in:", descriptions) {
      @Override
      public PopupStep<?> onChosen(final String selectedValue, final boolean finalChoice) {
        if (selectedValue != null) {
          final int index = descriptions.indexOf(selectedValue);
          if (index == -1) {
            LOGGER.error("Error - not found - '" + selectedValue + "' among " + descriptions);
          } else {
            final CloudPlugin newPlugin = plugins.get(index);
            final String newCloudId = newPlugin.getId();
            changeCloud(newCloudId);
          }
        }
        return super.onChosen(selectedValue, finalChoice);
      }


      @Override
      public void canceled() {
        super.canceled();
      }
    });
    popup.showInCenterOf(signInOutLink);
  }
View Full Code Here

  @Override
  public void actionPerformed(AnActionEvent e)
  {
    DefaultActionGroup actionGroup = createActionGroup(e);

    ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
      RevuBundle.message("projectSettings.review.addReview.title"), actionGroup, e.getDataContext(),
      JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);

    Point location;

    Component component = (Component) e.getInputEvent().getSource();
    if (component.isShowing())
    {
      Point locationOnScreen = component.getLocationOnScreen();
      location = new Point(
        (int) (locationOnScreen.getX()),
        (int) locationOnScreen.getY() + component.getHeight());
    }
    else
    {
      try
      {
        location = MouseInfo.getPointerInfo().getLocation();
      }
      catch (InternalError ignored)
      {
        // http://www.jetbrains.net/jira/browse/IDEADEV-21390
        // may happen under Mac OSX 10.5
        location = null;
      }
    }

    if (location != null)
    {
      popup.showInScreenCoordinates(component, location);
    }
    else
    {
      popup.showInBestPositionFor(e.getDataContext());
    }
  }
View Full Code Here

    public void actionPerformed(AnActionEvent e) {
        ObjectNavigationListActionGroup navigationListActionGroup =
                new ObjectNavigationListActionGroup(parentObject, navigationList, true);

        ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
                "Dependencies",
                navigationListActionGroup,
                e.getDataContext(),
                JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                true, null, 10);

        Project project = e.getData(PlatformDataKeys.PROJECT);
        DatabaseBrowserManager browserManager = DatabaseBrowserManager.getInstance(project);
        DatabaseBrowserTree activeBrowserTree = browserManager.getActiveBrowserTree();
        if (activeBrowserTree != null) {
            popup.showInCenterOf(activeBrowserTree);
        }
        //popup.show(DatabaseBrowserComponent.getInstance(project).getBrowserPanel().getTree());
    }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.ui.popup.ListPopup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.