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


Java ListPopup.show方法代码示例

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


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

示例1: showPopup

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
private void showPopup(MouseEvent e) {
  if (!myActionEnabled) {
    return;
  }
  DataContext dataContext = getContext();
  AnAction group = ActionManager.getInstance().getAction("ChangeLineSeparators");
  if (!(group instanceof ActionGroup)) {
    return;
  }

  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
    "Line separator",
    (ActionGroup)group,
    dataContext,
    JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
    false
  );
  Dimension dimension = popup.getContent().getPreferredSize();
  Point at = new Point(0, -dimension.height);
  popup.show(new RelativePoint(e.getComponent(), at));
  Disposer.register(this, popup); // destroy popup on unexpected project close
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LineSeparatorPanel.java

示例2: 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

示例3: 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

示例4: doSmartStep

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
/**
 * Override this if you haven't PsiMethod, like in Kotlin.
 * @param position
 * @param session
 * @param fileEditor
 * @return false to continue for another handler or for default action (step into)
 */
public boolean doSmartStep(SourcePosition position, final DebuggerSession session, TextEditor fileEditor) {
  final List<PsiMethod> methods = findReferencedMethods(position);
  if (methods.size() > 0) {
    if (methods.size() == 1) {
      session.stepInto(true, getSmartStepFilter(methods.get(0)));
    }
    else {
      final PsiMethodListPopupStep popupStep = new PsiMethodListPopupStep(methods, new PsiMethodListPopupStep.OnChooseRunnable() {
        public void execute(PsiMethod chosenMethod) {
          session.stepInto(true, getSmartStepFilter(chosenMethod));
        }
      });
      final ListPopup popup = JBPopupFactory.getInstance().createListPopup(popupStep);
      final RelativePoint point = DebuggerUIUtil.calcPopupLocation(((TextEditor)fileEditor).getEditor(), position.getLine());
      popup.show(point);
    }
    return true;
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:JvmSmartStepIntoHandler.java

示例5: showPopup

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
private void showPopup(MouseEvent e) {
    if (!myActionEnabled) {
        return;
    }
    DataContext dataContext = getContext();
    AnAction group = ActionManager.getInstance().getAction("ChangeFileLanguage");
    if (!(group instanceof ActionGroup)) {
        return;
    }

    ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
            "Language",
            (ActionGroup) group,
            dataContext,
            JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
            false
    );
    Dimension dimension = popup.getContent().getPreferredSize();
    Point at = new Point(0, -dimension.height);
    popup.show(new RelativePoint(e.getComponent(), at));
    Disposer.register(this, popup); // destroy popup on unexpected project close
}
 
开发者ID:mfedko,项目名称:idea-file-language,代码行数:23,代码来源:FileLanguagePanel.java

示例6: showPopup

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
private void showPopup(MouseEvent e) {
  if (!myActionEnabled) {
    return;
  }
  DataContext dataContext = getContext();
  AnAction group = ActionManager.getInstance().getAction("ChangeLineSeparators");
  if (!(group instanceof ActionGroup)) {
    return;
  }

  ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Line separator", (ActionGroup)group, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
  Dimension dimension = popup.getContent().getPreferredSize();
  Point at = new Point(0, -dimension.height);
  popup.show(new RelativePoint(e.getComponent(), at));
  Disposer.register(this, popup); // destroy popup on unexpected project close
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:LineSeparatorPanel.java

示例7: startPicker

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

示例8: showPopup

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
private void showPopup(@NotNull MouseEvent e) {
  if (!actionEnabled) {
    return;
  }
  DataContext dataContext = getContext();
  ListPopup popup = new ChangeFileEncodingAction().createPopup(dataContext);

  if (popup != null) {
    Dimension dimension = popup.getContent().getPreferredSize();
    Point at = new Point(0, -dimension.height);
    popup.show(new RelativePoint(e.getComponent(), at));
    Disposer.register(this, popup); // destroy popup on unexpected project close
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:EncodingPanel.java

示例9: 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

示例10: addRow

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

示例11: actionPerformed

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
  final ListPopup groupPopup = JBPopupFactory.getInstance()
    .createActionGroupPopup(UIDesignerBundle.message("surround.with.popup.title"), myActionGroup, e.getDataContext(),
                            JBPopupFactory.ActionSelectionAid.ALPHA_NUMBERING, true);

  final JComponent component = (JComponent)e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (component instanceof ComponentTree) {
    groupPopup.show(JBPopupFactory.getInstance().guessBestPopupLocation(component));
  }
  else {
    RadComponent selComponent = selection.get(0);
    FormEditingUtil.showPopupUnderComponent(groupPopup, selComponent);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:SurroundPopupAction.java

示例12: showRemoteSelector

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
private void showRemoteSelector(@NotNull Component component, @NotNull Point point) {
  final List<String> remotes = getRemotes();
  if (remotes.size() <= 1) {
    return;
  }
  ListPopup popup = new ListPopupImpl(new BaseListPopupStep<String>(null, remotes) {
    @Override
    public PopupStep onChosen(String selectedValue, boolean finalChoice) {
      myRemoteRenderer.updateLinkText(selectedValue);
      if (myFireOnChangeAction != null && !myTargetEditor.isShowing()) {
        //fireOnChange only when editing completed
        myFireOnChangeAction.run();
      }
      return super.onChosen(selectedValue, finalChoice);
    }
  }) {
    @Override
    public void cancel(InputEvent e) {
      super.cancel(e);
      if (myTargetEditor.isShowing()) {
        //repaint and force move focus to target editor component
        GitPushTargetPanel.this.repaint();
        IdeFocusManager.getInstance(myProject).requestFocus(myTargetEditor, true);
      }
    }
  };
  popup.show(new RelativePoint(component, point));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GitPushTargetPanel.java

示例13: showPopupInBestPosition

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
private static void showPopupInBestPosition(@NotNull ListPopup popup, @NotNull AnActionEvent event, @NotNull DataContext dataContext) {
  if (event.getInputEvent() instanceof MouseEvent) {
    if (!event.getPlace().equals(ActionPlaces.UPDATE_POPUP)) {
      popup.show(new RelativePoint((MouseEvent)event.getInputEvent()));
    }
    else { // quick fix for invoking from the context menu: coordinates are calculated incorrectly there.
      popup.showInBestPositionFor(dataContext);
    }
  }
  else {
    popup.showInBestPositionFor(dataContext);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GitDiffFromHistoryHandler.java

示例14: getPanelTestingFrame

import com.intellij.openapi.ui.popup.ListPopup; //导入方法依赖的package包/类
@Override
protected PanelTestingFrame getPanelTestingFrame() {
    executor = mock(XQueryDataSourceTypeBasedActionExecutor.class);
    popup = new DataSourceTypesListPopup(executor);
    final ListPopup listPopup = JBPopupFactory.getInstance().createListPopup(popup);

    mainPanel = (JPanel) listPopup.getContent();
    listPopup.show((Component) null);
    return new PanelTestingFrame(mainPanel);
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:11,代码来源:DataSourceTypesListPopupGuiTest.java

示例15: startPickTypes

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


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