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

The following examples show how to use com.intellij.openapi.ui.popup.ListPopup. 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: PickAction.java    From otto-intellij-plugin with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: IdeStatusBarImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private MultipleTextValuesPresentationWrapper(@Nonnull final StatusBarWidget.MultipleTextValuesPresentation presentation) {
  myPresentation = presentation;
  setVisible(StringUtil.isNotEmpty(myPresentation.getSelectedValue()));
  setTextAlignment(Component.CENTER_ALIGNMENT);
  new ClickListener() {
    @Override
    public boolean onClick(@Nonnull MouseEvent e, int clickCount) {
      final ListPopup popup = myPresentation.getPopupStep();
      if (popup == null) return false;
      final Dimension dimension = popup.getContent().getPreferredSize();
      final Point at = new Point(0, -dimension.height);
      popup.show(new RelativePoint(e.getComponent(), at));
      return true;
    }
  }.installOn(this);
}
 
Example #3
Source File: IntelliSortChooserPopupAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  VcsLogUi logUI = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
  VcsLogUiProperties properties = e.getRequiredData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);

  ActionGroup settingsGroup = new DefaultActionGroup(
          ContainerUtil.map(PermanentGraph.SortType.values(), (Function<PermanentGraph.SortType, AnAction>)sortType -> new SelectIntelliSortTypeAction(logUI, properties, sortType)));


  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, settingsGroup, e.getDataContext(), JBPopupFactory.ActionSelectionAid.MNEMONICS, true, ToolWindowContentUI.POPUP_PLACE);
  Component component = e.getInputEvent().getComponent();
  if (component instanceof ActionButtonComponent) {
    popup.showUnderneathOf(component);
  }
  else {
    popup.showInCenterOf(component);
  }
}
 
Example #4
Source File: WelcomePopupAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) {
  Component focusedComponent = contextComponent != null ? contextComponent : context.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (focusedComponent != null) {
    if (popup instanceof PopupFactoryImpl.ActionGroupPopup && focusedComponent instanceof JLabel) {
      ((PopupFactoryImpl.ActionGroupPopup)popup).showUnderneathOfLabel((JLabel)focusedComponent);
    } else {
      popup.showUnderneathOf(focusedComponent);
    }
  }
  else {
    Rectangle r;
    int x;
    int y;
    focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent((Project)null);
    r = WindowManagerEx.getInstanceEx().getScreenBounds();
    x = r.x + r.width / 2;
    y = r.y + r.height / 2;
    Point point = new Point(x, y);
    SwingUtilities.convertPointToScreen(point, focusedComponent.getParent());

    popup.showInScreenCoordinates(focusedComponent.getParent(), point);
  }
}
 
Example #5
Source File: LSPServerStatusWidget.java    From lsp4intellij with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public Consumer<MouseEvent> getClickConsumer() {
    return (MouseEvent t) -> {
        JBPopupFactory.ActionSelectionAid mnemonics = JBPopupFactory.ActionSelectionAid.MNEMONICS;
        Component component = t.getComponent();
        List<AnAction> actions = new ArrayList<>();
        if (wrapper.getStatus() == ServerStatus.INITIALIZED) {
            actions.add(new ShowConnectedFiles());
        }
        actions.add(new ShowTimeouts());
        if (wrapper.isRestartable()) {
            actions.add(new Restart());
        }

        String title = "Server actions";
        DataContext context = DataManager.getInstance().getDataContext(component);
        DefaultActionGroup group = new DefaultActionGroup(actions);
        ListPopup popup = JBPopupFactory.getInstance()
                .createActionGroupPopup(title, group, context, mnemonics, true);
        Dimension dimension = popup.getContent().getPreferredSize();
        Point at = new Point(0, -dimension.height);
        popup.show(new RelativePoint(t.getComponent(), at));
    };
}
 
Example #6
Source File: ChangeFileEncodingAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
public ListPopup createPopup(@Nonnull DataContext dataContext) {
  final VirtualFile virtualFile = dataContext.getData(CommonDataKeys.VIRTUAL_FILE);
  if (virtualFile == null) return null;
  boolean enabled = checkEnabled(virtualFile);
  if (!enabled) return null;
  Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
  FileDocumentManager documentManager = FileDocumentManager.getInstance();
  final Document document = documentManager.getDocument(virtualFile);
  if (!allowDirectories && virtualFile.isDirectory() || document == null && !virtualFile.isDirectory()) return null;

  final byte[] bytes;
  try {
    bytes = virtualFile.isDirectory() ? null : VfsUtilCore.loadBytes(virtualFile);
  }
  catch (IOException e) {
    return null;
  }
  DefaultActionGroup group = createActionGroup(virtualFile, editor, document, bytes, null);

  return JBPopupFactory.getInstance().createActionGroupPopup(getTemplatePresentation().getText(), group, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
}
 
Example #7
Source File: ShowFilePathAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static ListPopup createPopup(List<VirtualFile> files, List<Image> icons) {
  final BaseListPopupStep<VirtualFile> step = new BaseListPopupStep<VirtualFile>("File Path", files, icons.stream().map(TargetAWT::to).collect(Collectors.toList())) {
    @Nonnull
    @Override
    public String getTextFor(final VirtualFile value) {
      return value.getPresentableName();
    }

    @Override
    public PopupStep onChosen(final VirtualFile selectedValue, final boolean finalChoice) {
      final File selectedFile = new File(getPresentableUrl(selectedValue));
      if (selectedFile.exists()) {
        Application.get().executeOnPooledThread((Runnable)() -> openFile(selectedFile));
      }
      return FINAL_CHOICE;
    }
  };

  return JBPopupFactory.getInstance().createListPopup(step);
}
 
Example #8
Source File: XDebuggerEditorBase.java    From consulo with Apache License 2.0 6 votes vote down vote up
private ListPopup createLanguagePopup() {
  DefaultActionGroup actions = new DefaultActionGroup();
  for (Language language : getSupportedLanguages()) {
    //noinspection ConstantConditions
    actions.add(new AnAction(language.getDisplayName(), null, language.getAssociatedFileType().getIcon()) {
      @RequiredUIAccess
      @Override
      public void actionPerformed(@Nonnull AnActionEvent e) {
        XExpression currentExpression = getExpression();
        setExpression(new XExpressionImpl(currentExpression.getExpression(), language, currentExpression.getCustomInfo()));
        requestFocusInEditor();
      }
    });
  }

  DataContext dataContext = DataManager.getInstance().getDataContext(getComponent());
  return JBPopupFactory.getInstance().createActionGroupPopup("Choose Language", actions, dataContext,
                                                             JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                                                             false);
}
 
Example #9
Source File: GenerateAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
@Override
public void actionPerformed(@Nonnull final AnActionEvent e) {
  DataContext dataContext = e.getDataContext();

  Project project = e.getRequiredData(CommonDataKeys.PROJECT);
  final ListPopup popup =
          JBPopupFactory.getInstance().createActionGroupPopup(
                  CodeInsightBundle.message("generate.list.popup.title"),
                  wrapGroup(getGroup(), dataContext, project),
                  dataContext,
                  JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                  false);

  popup.showInBestPositionFor(dataContext);
}
 
Example #10
Source File: LookupImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void showElementActions(@Nullable InputEvent event) {
  if (!isVisible()) return;

  LookupElement element = getCurrentItem();
  if (element == null) {
    return;
  }

  Collection<LookupElementAction> actions = getActionsFor(element);
  if (actions.isEmpty()) {
    return;
  }

  //UIEventLogger.logUIEvent(UIEventId.LookupShowElementActions);

  Rectangle itemBounds = getCurrentItemBounds();
  Rectangle visibleRect = SwingUtilities.convertRectangle(myList, myList.getVisibleRect(), getComponent());
  ListPopup listPopup = JBPopupFactory.getInstance().createListPopup(new LookupActionsStep(actions, this, element));
  Point p = (itemBounds.intersects(visibleRect) || event == null)
            ? new Point(itemBounds.x + itemBounds.width, itemBounds.y)
            : SwingUtilities.convertPoint(event.getComponent(), new Point(0, event.getComponent().getHeight() + JBUIScale.scale(2)), getComponent());

  listPopup.show(new RelativePoint(getComponent(), p));
}
 
Example #11
Source File: RefactoringQuickListPopupAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void showPopup(AnActionEvent e, ListPopup popup) {
  final Editor editor = e.getData(PlatformDataKeys.EDITOR);
  if (editor != null) {
    popup.showInBestPositionFor(editor);
  } else {
    super.showPopup(e, popup);
  }
}
 
Example #12
Source File: ScopesAndSeveritiesTable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void addRow() {
  final List<Descriptor> descriptors = ContainerUtil.map(myTableSettings.getNodes(), new Function<InspectionConfigTreeNode, Descriptor>() {
    @Override
    public Descriptor fun(InspectionConfigTreeNode inspectionConfigTreeNode) {
      return inspectionConfigTreeNode.getDefaultDescriptor();
    }
  });
  final ScopesChooser scopesChooser = new ScopesChooser(descriptors, myInspectionProfile, myProject, myScopeNames) {
    @Override
    protected void onScopeAdded() {
      myTableSettings.onScopeAdded();
      refreshAggregatedScopes();
    }

    @Override
    protected void onScopesOrderChanged() {
      myTableSettings.onScopesOrderChanged();
    }
  };
  DataContext dataContext = DataManager.getInstance().getDataContext(myTable);
  final ListPopup popup = JBPopupFactory.getInstance()
          .createActionGroupPopup(ScopesChooser.TITLE, scopesChooser.createPopupActionGroup(myTable), dataContext,
                                  JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
  final RelativePoint point = new RelativePoint(myTable, new Point(myTable.getWidth() - popup.getContent().getPreferredSize().width, 0));
  popup.show(point);
}
 
Example #13
Source File: GotoActionAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void performAction(Object element, @Nullable Component component, @Nullable AnActionEvent e, @JdkConstants.InputEventMask int modifiers, @Nullable Runnable callback) {
  // element could be AnAction (SearchEverywhere)
  if (component == null) return;
  AnAction action = element instanceof AnAction ? (AnAction)element : ((GotoActionModel.ActionWrapper)element).getAction();
  TransactionGuard.getInstance().submitTransactionLater(ApplicationManager.getApplication(), () -> {
    DataManager instance = DataManager.getInstance();
    DataContext context = instance != null ? instance.getDataContext(component) : DataContext.EMPTY_CONTEXT;
    InputEvent inputEvent = e != null ? e.getInputEvent() : null;
    AnActionEvent event = AnActionEvent.createFromAnAction(action, inputEvent, ActionPlaces.ACTION_SEARCH, context);
    if (inputEvent == null && modifiers != 0) {
      event = new AnActionEvent(null, event.getDataContext(), event.getPlace(), event.getPresentation(), event.getActionManager(), modifiers);
    }

    if (ActionUtil.lastUpdateAndCheckDumb(action, event, false)) {
      if (action instanceof ActionGroup && !((ActionGroup)action).canBePerformed(context)) {
        ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(event.getPresentation().getText(), (ActionGroup)action, context, false, callback, -1);
        Window window = SwingUtilities.getWindowAncestor(component);
        if (window != null) {
          popup.showInCenterOf(window);
        }
        else {
          popup.showInFocusCenter();
        }
      }
      else {
        ActionManagerEx manager = ActionManagerEx.getInstanceEx();
        manager.fireBeforeActionPerformed(action, context, event);
        ActionUtil.performActionDumbAware(action, event);
        if (callback != null) callback.run();
        manager.fireAfterActionPerformed(action, context, event);
      }
    }
  });
}
 
Example #14
Source File: NewElementAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected ListPopup createPopup(DataContext dataContext) {
  return JBPopupFactory.getInstance()
    .createActionGroupPopup(getPopupTitle(),
                            getGroup(dataContext),
                            dataContext,
                            isShowNumbers(),
                            isShowDisabledActions(),
                            isHonorActionMnemonics(),
                            getDisposeCallback(),
                            getMaxRowCount(),
                            getPreselectActionCondition(dataContext));
}
 
Example #15
Source File: FindPopupPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  if (e.getData(PlatformDataKeys.CONTEXT_COMPONENT) == null) return;

  ListPopup listPopup = JBPopupFactory.getInstance().createActionGroupPopup(null, mySwitchContextGroup, e.getDataContext(), false, null, 10);
  listPopup.showUnderneathOf(myFilterContextButton);
}
 
Example #16
Source File: SelectInAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void invoke(DataContext dataContext, SelectInContext context) {
  final List<SelectInTarget> targetVector = Arrays.asList(getSelectInManager(context.getProject()).getTargets());
  ListPopup popup;
  if (targetVector.isEmpty()) {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new NoTargetsAction());
    popup = JBPopupFactory.getInstance().createActionGroupPopup(IdeBundle.message("title.popup.select.target"), group, dataContext,
                                                                JBPopupFactory.ActionSelectionAid.MNEMONICS, true);
  }
  else {
    popup = JBPopupFactory.getInstance().createListPopup(new SelectInActionsStep(targetVector, context));
  }

  popup.showInBestPositionFor(dataContext);
}
 
Example #17
Source File: LossyEncodingInspection.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void applyFix(@Nonnull Project project, @Nonnull ProblemDescriptor descriptor) {
  PsiFile psiFile = descriptor.getPsiElement().getContainingFile();
  VirtualFile virtualFile = psiFile.getVirtualFile();

  Editor editor = PsiUtilBase.findEditor(psiFile);
  DataContext dataContext = createDataContext(editor, editor == null ? null : editor.getComponent(), virtualFile, project);
  ListPopup popup = new ChangeFileEncodingAction().createPopup(dataContext);
  if (popup != null) {
    popup.showInBestPositionFor(dataContext);
  }
}
 
Example #18
Source File: ToolbarComboBoxAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
  Project project = e.getProject();
  if (project == null) return;

  JFrame frame = WindowManager.getInstance().getFrame(project);
  if (!(frame instanceof IdeFrame)) return;

  ListPopup popup = createActionPopup(e.getDataContext(), ((IdeFrame)frame).getComponent(), null);
  popup.showCenteredInCurrentWindow(project);
}
 
Example #19
Source File: XDebuggerEditorBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected XDebuggerEditorBase(final Project project,
                              @Nonnull XDebuggerEditorsProvider debuggerEditorsProvider,
                              @Nonnull EvaluationMode mode,
                              @Nullable @NonNls String historyId,
                              final @Nullable XSourcePosition sourcePosition) {
  myProject = project;
  myDebuggerEditorsProvider = debuggerEditorsProvider;
  myMode = mode;
  myHistoryId = historyId;
  mySourcePosition = sourcePosition;

  myChooseFactory.setToolTipText(XDebuggerBundle.message("xdebugger.evaluate.language.hint"));
  myChooseFactory.setBorder(JBUI.Borders.empty(0, 3, 0, 3));
  new ClickListener() {
    @Override
    public boolean onClick(@Nonnull MouseEvent e, int clickCount) {
      if (myChooseFactory.isEnabled()) {
        ListPopup oldPopup = SoftReference.dereference(myPopup);
        if (oldPopup != null && !oldPopup.isDisposed()) {
          oldPopup.cancel();
          myPopup = null;
          return true;
        }
        ListPopup popup = createLanguagePopup();
        popup.showUnderneathOf(myChooseFactory);
        myPopup = new WeakReference<>(popup);
        return true;
      }
      return false;
    }
  }.installOn(myChooseFactory);
}
 
Example #20
Source File: XDebuggerSmartStepIntoHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static <V extends XSmartStepIntoVariant> void doSmartStepInto(final XSmartStepIntoHandler<V> handler,
                                                                      XSourcePosition position,
                                                                      final XDebugSession session,
                                                                      Editor editor) {
  List<V> variants = handler.computeSmartStepVariants(position);
  if (variants.isEmpty()) {
    session.stepInto();
    return;
  }
  else if (variants.size() == 1) {
    session.smartStepInto(handler, variants.get(0));
    return;
  }

  ListPopup popup = JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<V>(handler.getPopupTitle(position), variants) {
    @Override
    public Icon getIconFor(V aValue) {
      return TargetAWT.to(aValue.getIcon());
    }

    @Nonnull
    @Override
    public String getTextFor(V value) {
      return value.getText();
    }

    @Override
    public PopupStep onChosen(V selectedValue, boolean finalChoice) {
      session.smartStepInto(handler, selectedValue);
      return FINAL_CHOICE;
    }
  });
  DebuggerUIUtil.showPopupForEditorLine(popup, editor, position.getLine());
}
 
Example #21
Source File: DvcsStatusWidget.java    From consulo with Apache License 2.0 5 votes vote down vote up
@javax.annotation.Nullable
@Override
public ListPopup getPopupStep() {
  Project project = getProject();
  if (project == null || project.isDisposed()) return null;
  T repository = guessCurrentRepository(project);
  if (repository == null) return null;

  return getPopup(project, repository);
}
 
Example #22
Source File: PlaySavedMacros.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(final AnActionEvent e) {
  final ListPopup popup = JBPopupFactory.getInstance()
    .createActionGroupPopup("Play Saved Macros", new MacrosGroup(), e.getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                            false);
  final Project project = e.getProject();
  if (project != null ) {
    popup.showCenteredInCurrentWindow(project);
  } else {
    popup.showInFocusCenter();
  }
}
 
Example #23
Source File: ToolbarComboBoxAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NotNull
private ListPopup createActionPopup(@NotNull DataContext context, @NotNull JComponent component, @Nullable Runnable disposeCallback) {
  DefaultActionGroup group = createPopupActionGroup(component, context);
  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
    myPopupTitle, group, context, false, shouldShowDisabledActions(), false, disposeCallback, getMaxRows(), getPreselectCondition());
  popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
  return popup;
}
 
Example #24
Source File: ShowFilePathAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void show(final VirtualFile file, final Consumer<ListPopup> action) {
  if (!isSupported()) return;

  List<VirtualFile> files = new ArrayList<>();
  List<String> fileUrls = new ArrayList<>();
  VirtualFile eachParent = file;
  while (eachParent != null) {
    int index = files.size();
    files.add(index, eachParent);
    fileUrls.add(index, getPresentableUrl(eachParent));
    if (eachParent.getParent() == null && eachParent.getFileSystem() instanceof ArchiveFileSystem) {
      eachParent = ArchiveVfsUtil.getVirtualFileForArchive(eachParent);
      if (eachParent == null) break;
    }
    eachParent = eachParent.getParent();
  }

  Platform.FileSystem fs = Platform.current().fs();
  Application.get().executeOnPooledThread(() -> {
    List<Image> icons = new ArrayList<>();
    for (String url : fileUrls) {
      File ioFile = new File(url);
      icons.add(ioFile.exists() ? fs.getImage(ioFile) : Image.empty(16));
    }

    Application.get().invokeLater(() -> action.accept(createPopup(files, icons)));
  });
}
 
Example #25
Source File: ComboBoxAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public JBPopup createPopup(@Nonnull JComponent component, @Nonnull DataContext context, @Nonnull Runnable onDispose) {
  DefaultActionGroup group = createPopupActionGroup(component, context);

  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(getPopupTitle(), group, context, false, shouldShowDisabledActions(), false, onDispose, getMaxRows(), getPreselectCondition());
  popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
  return popup;
}
 
Example #26
Source File: ExecuteAllAction.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
    Project project = getEventProject(e);
    if (project == null) {
        Notifier.error("Query execution error", "No project present.");
        return;
    }
    MessageBus messageBus = project.getMessageBus();
    ParametersService parameterService = ServiceManager.getService(project, ParametersService.class);
    PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);

    StatementCollector statementCollector = new StatementCollector(messageBus, parameterService);

    // This should never happen
    if (psiFile == null) {
        Notifier.error("Internal error", "No PsiFile present.");
    }
    psiFile.acceptChildren(statementCollector);
    if (!statementCollector.hasErrors()) {
        ExecuteQueryPayload executeQueryPayload =
            new ExecuteQueryPayload(statementCollector.getQueries(), statementCollector.getParameters(), psiFile.getName());
        ConsoleToolWindow.ensureOpen(project);

        DataSourcesComponent dataSourcesComponent = project.getComponent(DataSourcesComponent.class);
        ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
            "Choose Data Source",
            new ChooseDataSourceActionGroup(messageBus, dataSourcesComponent, executeQueryPayload),
            e.getDataContext(),
            JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
            false
        );
        popup.showInBestPositionFor(e.getDataContext());
    } else {
        Notifier.error("Query execution error", "File contains errors");
    }
}
 
Example #27
Source File: ChangeFileEncodingAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public final void actionPerformed(@Nonnull final AnActionEvent e) {
  DataContext dataContext = e.getDataContext();

  ListPopup popup = createPopup(dataContext);
  if (popup != null) {
    popup.showInBestPositionFor(dataContext);
  }
}
 
Example #28
Source File: EncodingPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected ListPopup createPopup(DataContext context) {
  ChangeFileEncodingAction action = new ChangeFileEncodingAction();
  action.getTemplatePresentation().setText("File Encoding");
  return action.createPopup(context);
}
 
Example #29
Source File: LineSeparatorPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected ListPopup createPopup(DataContext context) {
  AnAction group = ActionManager.getInstance().getAction("ChangeLineSeparators");
  if (!(group instanceof ActionGroup)) {
    return null;
  }

  return JBPopupFactory.getInstance().createActionGroupPopup("Line Separator", (ActionGroup)group, context, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
}
 
Example #30
Source File: ExportHTMLAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  final ListPopup popup = JBPopupFactory.getInstance().createListPopup(
    new BaseListPopupStep<String>(InspectionsBundle.message("inspection.action.export.popup.title"), new String[]{HTML, XML}) {
      @Override
      public PopupStep onChosen(final String selectedValue, final boolean finalChoice) {
        return doFinalStep(() -> exportHTML(Comparing.strEqual(selectedValue, HTML)));
      }
    });
  InspectionResultsView.showPopup(e, popup);
}