Java Code Examples for com.intellij.openapi.ui.popup.JBPopupFactory#getInstance()
The following examples show how to use
com.intellij.openapi.ui.popup.JBPopupFactory#getInstance() .
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: GotoTestDataAction.java From reasonml-idea-plugin with MIT License | 6 votes |
@Override public void actionPerformed(@NotNull AnActionEvent e) { Project project = e.getProject(); if (project != null) { DataContext dataContext = e.getDataContext(); List<String> fileNames = findRelatedFiles(project, dataContext); if (fileNames.isEmpty()) { Notifications.Bus.notify(new ORNotification("testdata", "Found no testdata files", "Cannot find related files", INFORMATION, null), project); return; } Editor editor = e.getData(CommonDataKeys.EDITOR); JBPopupFactory popupFactory = JBPopupFactory.getInstance(); RelativePoint point = editor == null ? popupFactory.guessBestPopupLocation(dataContext) : popupFactory.guessBestPopupLocation(editor); TestDataNavigationHandler.navigate(point, fileNames, project); } }
Example 2
Source File: MessageUtils.java From leetcode-editor with Apache License 2.0 | 5 votes |
public static void showMsg(JComponent component, MessageType messageType, String title, String body) { JBPopupFactory factory = JBPopupFactory.getInstance(); BalloonBuilder builder = factory.createHtmlTextBalloonBuilder(body, messageType, null); builder.setTitle(title); builder.setFillColor(JBColor.background()); Balloon b = builder.createBalloon(); Rectangle r = component.getBounds(); RelativePoint p = new RelativePoint(component, new Point(r.x + r.width, r.y + 30)); b.show(p, Balloon.Position.atRight); }
Example 3
Source File: GLSLDeduceExpressionTypeAction.java From glsl4idea with GNU Lesser General Public License v3.0 | 5 votes |
private void showBalloon(AnActionEvent e, String html) { final Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE); if(editor == null) return; final JBPopupFactory factory = JBPopupFactory.getInstance(); final BalloonBuilder builder = factory.createBalloonBuilder(new JLabel(html)); Balloon balloon = builder.createBalloon(); RelativePoint position = factory.guessBestPopupLocation(editor); balloon.show(position, Balloon.Position.below); }
Example 4
Source File: ShowAmbigTreesDialog.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static JBPopup createAmbigTreesPopup(final PreviewState previewState, final AmbiguityInfo ambigInfo) { final JBList list = new JBList("Show all phrase interpretations"); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JBPopupFactory factory = JBPopupFactory.getInstance(); PopupChooserBuilder builder = factory.createListPopupBuilder(list); builder.setItemChoosenCallback(() -> popupAmbigTreesDialog(previewState, ambigInfo)); return builder.createPopup(); }
Example 5
Source File: ShowAmbigTreesDialog.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static JBPopup createLookaheadTreesPopup(final PreviewState previewState, final LookaheadEventInfo lookaheadInfo) { final JBList list = new JBList("Show all lookahead interpretations"); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JBPopupFactory factory = JBPopupFactory.getInstance(); PopupChooserBuilder builder = factory.createListPopupBuilder(list); builder.setItemChoosenCallback(() -> popupLookaheadTreesDialog(previewState, lookaheadInfo)); return builder.createPopup(); }
Example 6
Source File: MasterDetailsComponent.java From consulo with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(AnActionEvent e) { final JBPopupFactory popupFactory = JBPopupFactory.getInstance(); final ListPopupStep step = popupFactory.createActionsStep(myActionGroup, e.getDataContext(), false, false, myActionGroup.getTemplatePresentation().getText(), myTree, true, myPreselection != null ? myPreselection.getDefaultIndex() : 0, true); final ListPopup listPopup = popupFactory.createListPopup(step); listPopup.setHandleAutoSelectionBeforeShow(true); listPopup.showUnderneathOf(myNorthPanel); }
Example 7
Source File: GotoCustomRegionAction.java From consulo with Apache License 2.0 | 5 votes |
private static void notifyCustomRegionsUnavailable(@Nonnull Editor editor, @Nonnull Project project) { final JBPopupFactory popupFactory = JBPopupFactory.getInstance(); Balloon balloon = popupFactory.createHtmlTextBalloonBuilder(IdeBundle.message("goto.custom.region.message.unavailable"), MessageType.INFO, null).setFadeoutTime(2000) .setHideOnClickOutside(true).setHideOnKeyOutside(true).createBalloon(); Disposer.register(project, balloon); balloon.show(popupFactory.guessBestPopupLocation(editor), Balloon.Position.below); }
Example 8
Source File: BeforeRunStepsPanel.java From consulo with Apache License 2.0 | 4 votes |
void doAddAction(AnActionButton button) { if (isUnknown()) { return; } final JBPopupFactory popupFactory = JBPopupFactory.getInstance(); final List<BeforeRunTaskProvider<BeforeRunTask>> providers = BeforeRunTaskProvider.EP_NAME.getExtensionList(myRunConfiguration.getProject()); Set<Key> activeProviderKeys = getActiveProviderKeys(); DefaultActionGroup actionGroup = new DefaultActionGroup(null, false); for (final BeforeRunTaskProvider<BeforeRunTask> provider : providers) { if (provider.createTask(myRunConfiguration) == null) continue; if (activeProviderKeys.contains(provider.getId()) && provider.isSingleton()) continue; AnAction providerAction = new AnAction(provider.getName(), null, provider.getIcon()) { @RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { BeforeRunTask task = provider.createTask(myRunConfiguration); if (task == null) { return; } provider.configureTask(myRunConfiguration, task).doWhenProcessed(() -> { if (!provider.canExecuteTask(myRunConfiguration, task)) return; task.setEnabled(true); Set<RunConfiguration> configurationSet = new HashSet<>(); getAllRunBeforeRuns(task, configurationSet); if (configurationSet.contains(myRunConfiguration)) { JOptionPane.showMessageDialog(BeforeRunStepsPanel.this, ExecutionBundle.message("before.launch.panel.cyclic_dependency_warning", myRunConfiguration.getName(), provider.getDescription(task)), ExecutionBundle.message("warning.common.title"), JOptionPane.WARNING_MESSAGE); return; } addTask(task); myListener.fireStepsBeforeRunChanged(); }); } }; actionGroup.add(providerAction); } final ListPopup popup = popupFactory .createActionGroupPopup(ExecutionBundle.message("add.new.run.configuration.acrtion.name"), actionGroup, SimpleDataContext.getProjectContext(myRunConfiguration.getProject()), false, false, false, null, -1, Condition.TRUE); popup.show(button.getPreferredPopupPoint()); }