List of usage examples for com.intellij.openapi.ui.popup ListPopup showUnderneathOf
void showUnderneathOf(@NotNull Component componentUnder);
From source file:com.intellij.debugger.ui.DebuggerEditorImpl.java
License:Apache License
public DebuggerEditorImpl(Project project, PsiElement context, String recentsId, final CodeFragmentFactory factory) { myProject = project;/*from w ww .ja v a 2 s .co m*/ myContext = context; myRecentsId = recentsId; PsiManager.getInstance(project).addPsiTreeChangeListener(myPsiListener); setFactory(factory); myInitialFactory = true; setFocusable(false); myChooseFactory.setToolTipText("Click to change the language"); myChooseFactory.setBorder(new EmptyBorder(0, 3, 0, 3)); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { ListPopup oldPopup = SoftReference.dereference(myPopup); if (oldPopup != null && !oldPopup.isDisposed()) { oldPopup.cancel(); myPopup = null; return true; } if (myContext == null) { return true; } ListPopup popup = createLanguagePopup(); popup.showUnderneathOf(myChooseFactory); myPopup = new WeakReference<ListPopup>(popup); return true; } }.installOn(myChooseFactory); }
From source file:com.intellij.uiDesigner.inspections.FormSpellCheckingInspection.java
License:Apache License
@Override protected void checkStringDescriptor(Module module, final IComponent component, final IProperty prop, final StringDescriptor descriptor, final FormErrorCollector collector) { final String value = descriptor.getResolvedValue(); if (value == null) { return;//from w ww. j a v a 2 s . c om } final SpellCheckerManager manager = SpellCheckerManager.getInstance(module.getProject()); PlainTextSplitter.getInstance().split(value, TextRange.allOf(value), new Consumer<TextRange>() { @Override public void consume(TextRange textRange) { final String word = textRange.substring(value); if (manager.hasProblem(word)) { final List<String> suggestions = manager.getSuggestions(value); if (suggestions.size() > 0 && prop instanceof IntroStringProperty) { EditorQuickFixProvider changeToProvider = new EditorQuickFixProvider() { @Override public QuickFix createQuickFix(final GuiEditor editor, final RadComponent component) { return new PopupQuickFix<String>(editor, "Change to...", component) { @Override public void run() { ListPopup popup = JBPopupFactory.getInstance() .createListPopup(getPopupStep()); popup.showUnderneathOf(component.getDelegee()); } @Override public ListPopupStep<String> getPopupStep() { return new BaseListPopupStep<String>("Select Replacement", suggestions) { @Override public PopupStep onChosen(String selectedValue, boolean finalChoice) { FormInspectionUtil.updateStringPropertyValue(editor, component, (IntroStringProperty) prop, descriptor, selectedValue); return FINAL_CHOICE; } }; } }; } }; EditorQuickFixProvider acceptProvider = new EditorQuickFixProvider() { @Override public QuickFix createQuickFix(final GuiEditor editor, RadComponent component) { return new QuickFix(editor, "Save '" + word + "' to dictionary", component) { @Override public void run() { manager.acceptWordAsCorrect(word, editor.getProject()); } }; } }; collector.addError(getID(), component, prop, "Typo in word '" + word + "'", changeToProvider, acceptProvider); } else { collector.addError(getID(), component, prop, "Typo in word '" + word + "'"); } } } }); }
From source file:com.intellij.uiDesigner.quickFixes.QuickFixManager.java
License:Apache License
final void showIntentionPopup() { LOG.debug("showIntentionPopup()"); if (myHint == null || !myHint.isVisible()) { return;/*from www .j av a 2 s . c o m*/ } 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()); }
From source file:com.intellij.util.xml.ui.actions.AddDomElementAction.java
License:Apache License
protected void showPopup(final ListPopup groupPopup, final AnActionEvent e) { final Component component = e.getInputEvent().getComponent(); if (component instanceof ActionButtonComponent) { groupPopup.showUnderneathOf(component); } else {/* www . j a v a 2s .co m*/ groupPopup.showInBestPositionFor(e.getDataContext()); } }
From source file:com.intellij.vcs.log.ui.filter.FilterPopupComponent.java
License:Apache License
private void showPopupMenu() { ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, createActionGroup(), DataManager.getInstance().getDataContext(this), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);//from w ww .ja v a 2s .com popup.showUnderneathOf(this); }
From source file:com.intellij.xdebugger.impl.ui.XDebuggerEditorBase.java
License:Apache License
protected XDebuggerEditorBase(final Project project, @NotNull XDebuggerEditorsProvider debuggerEditorsProvider, @NotNull EvaluationMode mode, @Nullable @NonNls String historyId, final @Nullable XSourcePosition sourcePosition) { myProject = project;/*from w w w . jav a 2s . c o m*/ myDebuggerEditorsProvider = debuggerEditorsProvider; myMode = mode; myHistoryId = historyId; mySourcePosition = sourcePosition; myChooseFactory.setToolTipText("Click to change the language"); myChooseFactory.setBorder(new EmptyBorder(0, 3, 0, 3)); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { 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<ListPopup>(popup); return true; } }.installOn(myChooseFactory); }
From source file:com.microsoft.alm.plugin.idea.common.ui.controls.FilterDropDown.java
License:Open Source License
/** * Displays the dropdown menu with the latest items *//*w w w . ja v a 2 s .co m*/ private void showDropDownMenu() { final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, populateDropDownMenu(), DataManager.getInstance().getDataContext(this), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true); popup.showUnderneathOf(this); }
From source file:org.cordovastudio.editors.designer.inspection.AbstractQuickFixManager.java
License:Apache License
private void showPopup() { if (myHint == null || !myHint.isVisible()) { return;/*from w w w . j a v a2 s . c o m*/ } List<ErrorInfo> errorInfos = getErrorInfos(); if (!ErrorInfo.haveFixes(errorInfos)) { return; } ListPopup popup = JBPopupFactory.getInstance().createListPopup(new FirstStep(errorInfos)); popup.showUnderneathOf(myHint.getComponent()); }
From source file:org.intellij.xquery.runner.ui.datasources.DataSourceListPanel.java
License:Apache License
protected void showAddDataSourcePopupWithActionExecutor( XQueryDataSourceTypeBasedActionExecutor addDataSourceActionExecutor) { DataSourceTypesListPopup dataSourceTypesListPopup = new DataSourceTypesListPopup( addDataSourceActionExecutor); final ListPopup popup = JBPopupFactory.getInstance().createListPopup(dataSourceTypesListPopup); popup.showUnderneathOf(toolbarDecorator.getActionsPanel()); }
From source file:org.jetbrains.jet.plugin.versions.UnsupportedAbiVersionNotificationPanelProvider.java
License:Apache License
private void createShowPathsActionLabel(EditorNotificationPanel answer, String labelText) { final Ref<Component> label = new Ref<Component>(null); Runnable action = new Runnable() { @Override//from ww w. java 2 s . c o m public void run() { Collection<VirtualFile> badRoots = KotlinRuntimeLibraryUtil .getLibraryRootsWithAbiIncompatibleKotlinClasses(project); assert !badRoots.isEmpty() : "This action should only be called when bad roots are present"; LibraryRootsPopupModel listPopupModel = new LibraryRootsPopupModel("Unsupported format", project, badRoots); ListPopup popup = JBPopupFactory.getInstance().createListPopup(listPopupModel); popup.showUnderneathOf(label.get()); } }; label.set(answer.createActionLabel(labelText, action)); }