当前位置: 首页>>代码示例>>Java>>正文


Java ListPopup.showInBestPositionFor方法代码示例

本文整理汇总了Java中com.intellij.openapi.ui.popup.ListPopup.showInBestPositionFor方法的典型用法代码示例。如果您正苦于以下问题:Java ListPopup.showInBestPositionFor方法的具体用法?Java ListPopup.showInBestPositionFor怎么用?Java ListPopup.showInBestPositionFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.ui.popup.ListPopup的用法示例。


在下文中一共展示了ListPopup.showInBestPositionFor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final DefaultActionGroup dag = new DefaultActionGroup();
  dag.add(myUsual);
  dag.add(myNumbered);
  dag.add(new Separator());
  dag.add(mySoftWrapsAction);
  final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, dag, e.getDataContext(),
                                                                                   JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                                                                                   false);
  if (e.getInputEvent() instanceof MouseEvent) {
    popup.show(new RelativePoint((MouseEvent)e.getInputEvent()));
  } else {
    // todo correct
    /*final Dimension dimension = popup.getContent().getPreferredSize();
    final Point at = new Point(-dimension.width / 2, 0);
    popup.show(new RelativePoint(myParent, at));*/
    popup.showInBestPositionFor(e.getDataContext());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ChangesFragmentedDiffPanel.java

示例2: selectBranchAndPerformAction

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
private static void selectBranchAndPerformAction(@NotNull VcsLogDataPack dataPack,
                                                 @NotNull AnActionEvent event,
                                                 @NotNull final Consumer<String> consumer,
                                                 @NotNull Collection<VirtualFile> visibleRoots) {
  ActionGroup actionGroup = BranchFilterPopupComponent.constructActionGroup(dataPack, null, new Function<String, AnAction>() {
    @Override
    public AnAction fun(final String s) {
      return new DumbAwareAction(s) {
        @Override
        public void actionPerformed(AnActionEvent e) {
          consumer.consume(s);
        }
      };
    }
  }, visibleRoots);
  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Select branch to compare", actionGroup, event.getDataContext(),
                                                                        false, false, false, null, -1, null);
  InputEvent inputEvent = event.getInputEvent();
  if (inputEvent instanceof MouseEvent) {
    popup.show(new RelativePoint((MouseEvent)inputEvent));
  }
  else {
    popup.showInBestPositionFor(event.getDataContext());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DeepCompareAction.java

示例3: actionPerformed

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@RequiredDispatchThread
@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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:GenerateAction.java

示例4: actionPerformed

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final DefaultActionGroup group = new DefaultActionGroup();
  for (PackagingElementType type : PackagingElementFactory.getInstance().getAllElementTypes()) {
    group.add(new AddNewPackagingElementAction((PackagingElementType<?>)type, myArtifactEditor));
  }
  final DataContext dataContext = e.getDataContext();
  final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Add", group, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
  popup.showInBestPositionFor(dataContext);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ShowAddPackagingElementPopupAction.java

示例5: showPopup

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
protected void showPopup(AnActionEvent e, ListPopup popup) {
  Project project = e.getProject();
  if (project != null) {
    popup.showCenteredInCurrentWindow(project);
  }
  else {
    popup.showInBestPositionFor(e.getDataContext());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:QuickSwitchSchemeAction.java

示例6: editSelection

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
private void editSelection(InputEvent e) {
  String actionId = myActionsTree.getSelectedActionId();
  if (actionId == null) {
    return;
  }

  DefaultActionGroup group = createEditActionGroup(actionId);
  if (e instanceof MouseEvent && ((MouseEvent)e).isPopupTrigger()) {
    ActionManager.getInstance()
      .createActionPopupMenu(ActionPlaces.UNKNOWN, group)
      .getComponent()
      .show(e.getComponent(), ((MouseEvent)e).getX(), ((MouseEvent)e).getY());
  }
  else {
    DataContext dataContext = DataManager.getInstance().getDataContext(this);
    ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Edit Shortcuts",
                                                                          group,
                                                                          dataContext,
                                                                          JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                                                                          true);

    if (e instanceof MouseEvent) {
      popup.show(new RelativePoint((MouseEvent)e));
    }
    else {
      popup.showInBestPositionFor(dataContext);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:KeymapPanel.java

示例7: actionPerformed

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@Override
public final void actionPerformed(final AnActionEvent e) {
  DataContext dataContext = e.getDataContext();

  ListPopup popup = createPopup(dataContext);
  if (popup != null) {
    popup.showInBestPositionFor(dataContext);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ChangeFileEncodingAction.java

示例8: applyFix

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull 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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:LossyEncodingInspection.java

示例9: actionPerformed

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
  DataContext dataContext = e.getDataContext();

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

  popup.showInBestPositionFor(dataContext);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GenerateAction.java

示例10: invoke

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@Override
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) {
  if (!CodeInsightUtilBase.prepareEditorForWrite(editor)) return;
  DefaultActionGroup group = createActionGroup(project, editor, file);
  if (group == null) return;

  final ListPopup popup = JBPopupFactory.getInstance()
    .createActionGroupPopup(CodeInsightBundle.message("templates.select.template.chooser.title"), group,
                            DataManager.getInstance().getDataContext(editor.getContentComponent()),
                            JBPopupFactory.ActionSelectionAid.MNEMONICS, false);

  popup.showInBestPositionFor(editor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:SurroundWithTemplateHandler.java

示例11: showPopup

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
protected void showPopup(DataContext context) {
  ListPopup popup = createPopup(context);
  Project project = CommonDataKeys.PROJECT.getData(context);
  if (project != null) {
    popup.showCenteredInCurrentWindow(project);
  }
  else {
    popup.showInBestPositionFor(context);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:NewElementSamePlaceAction.java

示例12: invoke

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
private static void invoke(@NotNull DataContext dataContext, @NotNull 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:SelectInAction.java

示例13: showPopup

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@Override
protected void showPopup(AnActionEvent e, ListPopup popup) {
  final Editor editor = e.getData(CommonDataKeys.EDITOR);
  if (editor != null) {
    popup.showInBestPositionFor(editor);
  } else {
    super.showPopup(e, popup);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:RefactoringQuickListPopupAction.java

示例14: showPopup

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@Override
protected void showPopup(final ListPopup groupPopup, final AnActionEvent e) {
  if (myTreeView == null) {
    if (e.getPlace().equals(DomModelTreeView.DOM_MODEL_TREE_VIEW_POPUP)) {
      groupPopup.showInCenterOf(getTreeView(e).getTree());
    }
    else {
      groupPopup.showInBestPositionFor(e.getDataContext());
    }
  }
  else {
    super.showPopup(groupPopup, e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AddElementInCollectionAction.java

示例15: showPopup

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
protected void showPopup(final ListPopup groupPopup, final AnActionEvent e) {
  final Component component = e.getInputEvent().getComponent();

  if (component instanceof ActionButtonComponent) {
    groupPopup.showUnderneathOf(component);
  } else {
    groupPopup.showInBestPositionFor(e.getDataContext());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AddDomElementAction.java


注:本文中的com.intellij.openapi.ui.popup.ListPopup.showInBestPositionFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。