本文整理汇总了Java中com.intellij.openapi.ui.popup.ListPopup类的典型用法代码示例。如果您正苦于以下问题:Java ListPopup类的具体用法?Java ListPopup怎么用?Java ListPopup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListPopup类属于com.intellij.openapi.ui.popup包,在下文中一共展示了ListPopup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLanguagePopup
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
private ListPopup createLanguagePopup() {
DefaultActionGroup actions = new DefaultActionGroup();
for (final CodeFragmentFactory fragmentFactory : DebuggerUtilsEx.getCodeFragmentFactories(myContext)) {
actions.add(new AnAction(fragmentFactory.getFileType().getLanguage().getDisplayName(), null, fragmentFactory.getFileType().getIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
setFactory(fragmentFactory);
setText(getText());
IdeFocusManager.getInstance(getProject()).requestFocus(DebuggerEditorImpl.this, true);
}
});
}
DataContext dataContext = DataManager.getInstance().getDataContext(this);
return JBPopupFactory.getInstance().createActionGroupPopup("Choose Language", actions, dataContext,
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
false);
}
示例2: chooseTypeAndCreate
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
public static void chooseTypeAndCreate(final ClasspathPanel classpathPanel,
final StructureConfigurableContext context,
final JButton contextButton, @NotNull final LibraryCreatedCallback callback) {
if (LibraryEditingUtil.hasSuitableTypes(classpathPanel)) {
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(LibraryEditingUtil.createChooseTypeStep(classpathPanel, new ParameterizedRunnable<LibraryType>() {
@Override
public void run(LibraryType libraryType) {
doCreateLibrary(classpathPanel, context, callback, contextButton, libraryType);
}
}));
popup.showUnderneathOf(contextButton);
}
else {
doCreateLibrary(classpathPanel, context, callback, contextButton, null);
}
}
示例3: actionPerformed
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getRequiredData(CommonDataKeys.PROJECT);
VcsLogUi logUi = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
VcsLogSettings settings = ServiceManager.getService(project, VcsLogSettings.class);
ListPopup popup = JBPopupFactory.getInstance()
.createActionGroupPopup(null, new MySettingsActionGroup(settings, logUi), 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);
}
}
示例4: actionPerformed
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final VcsLogUi logUI = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
ActionGroup settingsGroup =
new DefaultActionGroup(ContainerUtil.map(PermanentGraph.SortType.values(), new Function<PermanentGraph.SortType, AnAction>() {
@Override
public AnAction fun(PermanentGraph.SortType sortType) {
return new SelectIntelliSortTypeAction(logUI, 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);
}
}
示例5: showPopup
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) {
Component focusedComponent = contextComponent != null ? contextComponent : PlatformDataKeys.CONTEXT_COMPONENT.getData(context);
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);
}
}
示例6: MultipleTextValuesPresentationWrapper
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
private MultipleTextValuesPresentationWrapper(@NotNull final StatusBarWidget.MultipleTextValuesPresentation presentation) {
super();
myPresentation = presentation;
putClientProperty(UIUtil.CENTER_TOOLTIP_DEFAULT, Boolean.TRUE);
setToolTipText(presentation.getTooltipText());
new ClickListener() {
@Override
public boolean onClick(@NotNull 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);
setOpaque(false);
}
示例7: 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
}
示例8: createPopup
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
@Nullable
public ListPopup createPopup(@NotNull DataContext dataContext) {
final VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
if (virtualFile == null) return null;
boolean enabled = checkEnabled(virtualFile);
if (!enabled) return null;
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
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 : virtualFile.contentsToByteArray();
}
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);
}
示例9: actionPerformed
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
show(getFile(e), new ShowAction() {
@Override
public void show(final ListPopup popup) {
DataManager dataManager = DataManager.getInstance();
if (dataManager != null) {
dataManager.getDataContextFromFocus().doWhenDone(new Consumer<DataContext>() {
@Override
public void consume(DataContext context) {
popup.showInBestPositionFor(context);
}
});
}
}
});
}
示例10: createPopup
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
private static ListPopup createPopup(final ArrayList<VirtualFile> files, final ArrayList<Icon> icons) {
final BaseListPopupStep<VirtualFile> step = new BaseListPopupStep<VirtualFile>("File Path", files, icons) {
@NotNull
@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()) {
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
openFile(selectedFile);
}
});
}
return FINAL_CHOICE;
}
};
return JBPopupFactory.getInstance().createListPopup(step);
}
示例11: createLanguagePopup
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
private ListPopup createLanguagePopup() {
DefaultActionGroup actions = new DefaultActionGroup();
for (final Language language : getEditorsProvider().getSupportedLanguages(myProject, mySourcePosition)) {
//noinspection ConstantConditions
actions.add(new AnAction(language.getDisplayName(), null, language.getAssociatedFileType().getIcon()) {
@Override
public void actionPerformed(@NotNull 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);
}
示例12: 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());
}
}
示例13: actionPerformed
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final AnAction[] actions = getChildren(e);
if (actions.length > 1) {
final DefaultActionGroup group = new DefaultActionGroup();
for (final AnAction action : actions) {
group.add(action);
}
final DataContext dataContext = e.getDataContext();
final ListPopup groupPopup =
JBPopupFactory.getInstance().createActionGroupPopup(null,
group, dataContext, JBPopupFactory.ActionSelectionAid.NUMBERING, true);
showPopup(groupPopup, e);
}
else if (actions.length == 1) {
actions[0].actionPerformed(e);
}
}
示例14: createComboBoxButton
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
@Override
protected FlatComboButton createComboBoxButton(Presentation presentation) {
if (myShowDisabledActions) {
return new FlatComboButton(presentation) {
@Override
protected JBPopup createPopup(Runnable onDispose) {
ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
null, createPopupActionGroup(this), getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true, onDispose,
getMaxRows());
popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
return popup;
}
};
}
return super.createComboBoxButton(presentation);
}
示例15: showIntentionPopup
import com.intellij.openapi.ui.popup.ListPopup; //导入依赖的package包/类
final void showIntentionPopup(){
LOG.debug("showIntentionPopup()");
if(myHint == null || !myHint.isVisible()){
return;
}
final ErrorInfo[] errorInfos = getErrorInfos();
if(!haveFixes(errorInfos)){
return;
}
final ArrayList<ErrorWithFix> fixList = new ArrayList<ErrorWithFix>();
for(ErrorInfo errorInfo: errorInfos) {
final QuickFix[] quickFixes = errorInfo.myFixes;
if (quickFixes.length > 0) {
for (QuickFix fix: quickFixes) {
fixList.add(new ErrorWithFix(errorInfo, fix));
}
}
else if (errorInfo.getInspectionId() != null) {
buildSuppressFixes(errorInfo, fixList, true);
}
}
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(new QuickFixPopupStep(fixList, true));
popup.showUnderneathOf(myHint.getComponent());
}