com.intellij.ui.components.JBList Java Examples
The following examples show how to use
com.intellij.ui.components.JBList.
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: CourseTabFactory.java From tmc-intellij with MIT License | 6 votes |
private void addRightMouseButtonFunctionality(MouseEvent mouseEvent, final JBList list, JBScrollPane panel) { logger.info("Adding functionality for right mouse button. @CourseTabFactory"); if (!SwingUtilities.isRightMouseButton(mouseEvent)) { return; } int index = list.locationToIndex(mouseEvent.getPoint()); list.setSelectedIndex(index); PopUpMenu menu = new PopUpMenu(); JBMenuItem openInExplorer = new JBMenuItem("Open path"); final Object selectedItem = list.getSelectedValue(); JBMenuItem deleteFolder = new JBMenuItem("Delete folder"); openInExplorer.addActionListener(createOpenInExploreListener(list, selectedItem)); deleteFolder.addActionListener(createDeleteButtonActionListener(list, selectedItem)); menu.add(openInExplorer); menu.add(deleteFolder); menu.show(panel, mouseEvent.getX(), mouseEvent.getY()); menu.setLocation(mouseEvent.getXOnScreen(), mouseEvent.getYOnScreen()); }
Example #2
Source File: CommonProgramParametersPanel.java From consulo with Apache License 2.0 | 6 votes |
@Deprecated // use MacroComboBoxWithBrowseButton instead protected JComponent createComponentWithMacroBrowse(@Nonnull final TextFieldWithBrowseButton textAccessor) { final FixedSizeButton button = new FixedSizeButton(textAccessor); button.setIcon(AllIcons.RunConfigurations.Variables); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //noinspection unchecked final JList list = new JBList(myWorkingDirectoryComboBox.getChildComponent().getModel()); JBPopupFactory.getInstance().createListPopupBuilder(list).setItemChoosenCallback(() -> { final Object value = list.getSelectedValue(); if (value instanceof String) { textAccessor.setText((String)value); } }).setMovable(false).setResizable(false).createPopup().showUnderneathOf(button); } }); JPanel panel = new JPanel(new BorderLayout()); panel.add(textAccessor, BorderLayout.CENTER); panel.add(button, BorderLayout.EAST); return panel; }
Example #3
Source File: GtRepoChooser.java From GitToolBox with Apache License 2.0 | 6 votes |
GtRepoChooser(@NotNull Project project, @Nullable Component parentComponent) { super(project, parentComponent, false, IdeModalityType.PROJECT); this.project = project; repoList = new JBList<>(); repoList.setCellRenderer(new ColoredListCellRenderer<GitRepository>() { @Override protected void customizeCellRenderer(@NotNull JList<? extends GitRepository> list, GitRepository value, int index, boolean selected, boolean hasFocus) { append(GtUtil.name(value)); StringBand url = new StringBand(" ("); url.append(value.getRoot().getPresentableUrl()); url.append(")"); append(url.toString(), SimpleTextAttributes.GRAYED_ATTRIBUTES); } }); JBScrollPane scrollPane = new JBScrollPane(repoList); centerPanel = JBUI.Panels.simplePanel().addToCenter(scrollPane); centerPanel.setPreferredSize(JBUI.size(400, 300)); setTitle(ResBundle.message("configurable.prj.autoFetch.exclusions.add.title")); init(); }
Example #4
Source File: AddSourceToProjectDialog.java From intellij with Apache License 2.0 | 6 votes |
AddSourceToProjectDialog(Project project, List<TargetInfo> targets) { super(project, /* canBeParent= */ true, IdeModalityType.MODELESS); this.project = project; mainPanel = new JPanel(new VerticalLayout(12)); JList<TargetInfo> targetsComponent = new JBList<>(targets); if (targets.size() == 1) { targetsComponent.setSelectedIndex(0); } this.targetsComponent = targetsComponent; setTitle("Add Source File to Project"); setupUi(); init(); }
Example #5
Source File: ApplicationSettingsForm.java From MavenHelper with Apache License 2.0 | 6 votes |
private JBList createJBList(DefaultListModel pluginsModel) { JBList jbList = new JBList(pluginsModel); jbList.setCellRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { final Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Goal goal = (Goal) value; setText(goal.getPresentableName()); return comp; } }); jbList.setDragEnabled(true); jbList.setDropMode(DropMode.INSERT); jbList.setTransferHandler(new MyListDropHandler(jbList)); new MyDragListener(jbList); return jbList; }
Example #6
Source File: OrganizationCard.java From tmc-intellij with MIT License | 6 votes |
public OrganizationCard(Organization organization, JBList parent) { this.initComponents(); this.organization = organization; this.parent = parent; this.organizationName.setText(organization.getName()); String information = organization.getInformation(); if (information.length() > 188) { information = information.substring(0, 187) + "..."; } this.organizationInformation.setText(information); this.organizationSlug.setText("/" + organization.getSlug()); setLogo(); }
Example #7
Source File: ProjectLibraryTabContext.java From consulo with Apache License 2.0 | 6 votes |
public ProjectLibraryTabContext(final ClasspathPanel classpathPanel, StructureConfigurableContext context) { super(classpathPanel, context); StructureLibraryTableModifiableModelProvider projectLibrariesProvider = context.getProjectLibrariesProvider(); Library[] libraries = projectLibrariesProvider.getModifiableModel().getLibraries(); final Condition<Library> condition = LibraryEditingUtil.getNotAddedLibrariesCondition(myClasspathPanel.getRootModel()); myItems = ContainerUtil.filter(libraries, condition); ContainerUtil.sort(myItems, new Comparator<Library>() { @Override public int compare(Library o1, Library o2) { return StringUtil.compare(o1.getName(), o2.getName(), false); } }); myLibraryList = new JBList(myItems); myLibraryList.setCellRenderer(new ColoredListCellRendererWrapper<Library>() { @Override protected void doCustomize(JList list, Library value, int index, boolean selected, boolean hasFocus) { final CellAppearanceEx appearance = OrderEntryAppearanceService.getInstance().forLibrary(classpathPanel.getProject(), value, false); appearance.customize(this); } }); new ListSpeedSearch(myLibraryList); }
Example #8
Source File: RecentLocationsAction.java From consulo with Apache License 2.0 | 6 votes |
private static void removePlaces(@Nonnull Project project, @Nonnull ListWithFilter<RecentLocationItem> listWithFilter, @Nonnull JBList<RecentLocationItem> list, @Nonnull RecentLocationsDataModel data, boolean showChanged) { List<RecentLocationItem> selectedValue = list.getSelectedValuesList(); if (selectedValue.isEmpty()) { return; } int index = list.getSelectedIndex(); IdeDocumentHistory ideDocumentHistory = IdeDocumentHistory.getInstance(project); for (RecentLocationItem item : selectedValue) { if (showChanged) { ContainerUtil.filter(ideDocumentHistory.getChangePlaces(), info -> IdeDocumentHistoryImpl.isSame(info, item.getInfo())).forEach(info -> ideDocumentHistory.removeChangePlace(info)); } else { ContainerUtil.filter(ideDocumentHistory.getBackPlaces(), info -> IdeDocumentHistoryImpl.isSame(info, item.getInfo())).forEach(info -> ideDocumentHistory.removeBackPlace(info)); } } updateModel(listWithFilter, data, showChanged); if (list.getModel().getSize() > 0) ScrollingUtil.selectItem(list, index < list.getModel().getSize() ? index : index - 1); }
Example #9
Source File: RecentChangesPopup.java From consulo with Apache License 2.0 | 6 votes |
public void show() { List<RecentChange> cc = myVcs.getRecentChanges(myGateway.createTransientRootEntry()); if (cc.isEmpty()) { Messages.showInfoMessage(myProject, LocalHistoryBundle.message("recent.changes.to.changes"), getTitle()); return; } final JList list = new JBList(createModel(cc)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setCellRenderer(new RecentChangesListCellRenderer()); Runnable selectAction = new Runnable() { public void run() { RecentChange c = (RecentChange)list.getSelectedValue(); showRecentChangeDialog(c); } }; showList(list, selectAction); }
Example #10
Source File: RecentLocationsAction.java From consulo with Apache License 2.0 | 6 votes |
private static void initSearchActions(@Nonnull Project project, @Nonnull RecentLocationsDataModel data, @Nonnull ListWithFilter<RecentLocationItem> listWithFilter, @Nonnull JBList<RecentLocationItem> list, @Nonnull JBCheckBox checkBox, @Nonnull JBPopup popup, @Nonnull Ref<? super Boolean> navigationRef) { listWithFilter.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent event) { int clickCount = event.getClickCount(); if (clickCount > 1 && clickCount % 2 == 0) { event.consume(); navigateToSelected(project, list, popup, navigationRef); } } }); DumbAwareAction.create(e -> navigateToSelected(project, list, popup, navigationRef)).registerCustomShortcutSet(CustomShortcutSet.fromString("ENTER"), listWithFilter, popup); DumbAwareAction.create(e -> removePlaces(project, listWithFilter, list, data, checkBox.isSelected())) .registerCustomShortcutSet(CustomShortcutSet.fromString("DELETE", "BACK_SPACE"), listWithFilter, popup); }
Example #11
Source File: ProjectListManager.java From tmc-intellij with MIT License | 6 votes |
public void refreshCourse(String course) { logger.info("Refreshing course {}. @ProjectListManager", course); List<JBList> list = currentListElements.get(course); if (list == null) { return; } for (JBList jbList : list) { if (jbList == null || !jbList.getName().equals(course)) { continue; } DefaultListModel model = (DefaultListModel) jbList.getModel(); model.removeAllElements(); addExercisesToList(new ObjectFinder(), course, model, new CourseAndExerciseManager()); jbList.setModel(model); } refreshAllCourses(); }
Example #12
Source File: CustomFoldingRegionsPopup.java From consulo with Apache License 2.0 | 6 votes |
CustomFoldingRegionsPopup(@Nonnull Collection<FoldingDescriptor> descriptors, @Nonnull final Editor editor, @Nonnull final Project project) { myEditor = editor; myRegionsList = new JBList(); //noinspection unchecked myRegionsList.setModel(new MyListModel(orderByPosition(descriptors))); myRegionsList.setSelectedIndex(0); final PopupChooserBuilder popupBuilder = JBPopupFactory.getInstance().createListPopupBuilder(myRegionsList); myPopup = popupBuilder .setTitle(IdeBundle.message("goto.custom.region.command")) .setResizable(false) .setMovable(false) .setItemChoosenCallback(new Runnable() { @Override public void run() { PsiElement navigationElement = getNavigationElement(); if (navigationElement != null) { navigateTo(editor, navigationElement); IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation(); } } }).createPopup(); }
Example #13
Source File: SchemesToImportPopup.java From consulo with Apache License 2.0 | 6 votes |
public void show(Collection<T> schemes) { if (schemes.isEmpty()) { Messages.showMessageDialog("There are no available schemes to import", "Import", Messages.getWarningIcon()); return; } final JList list = new JBList(new CollectionListModel<T>(schemes)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setCellRenderer(new SchemesToImportListCellRenderer()); Runnable selectAction = new Runnable() { @Override public void run() { onSchemeSelected((T)list.getSelectedValue()); } }; showList(list, selectAction); }
Example #14
Source File: FileChooserDialogImpl.java From consulo with Apache License 2.0 | 6 votes |
private void showRecentFilesPopup() { final JBList files = new JBList(getRecentFiles()) { @Override public Dimension getPreferredSize() { return new Dimension(myPathTextField.getField().getWidth(), super.getPreferredSize().height); } }; files.setCellRenderer(new ColoredListCellRenderer() { @Override protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { final String path = value.toString(); append(path); final VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(path)); if (file != null) { setIcon(VfsIconUtil.getIcon(file, Iconable.ICON_FLAG_READ_STATUS, null)); } } }); JBPopupFactory.getInstance().createListPopupBuilder(files).setItemChoosenCallback(new Runnable() { @Override public void run() { myPathTextField.getField().setText(files.getSelectedValue().toString()); } }).createPopup().showUnderneathOf(myPathTextField.getField()); }
Example #15
Source File: CustomActionSettingsForm.java From StringManipulation with Apache License 2.0 | 6 votes |
private JBList createJBList(DefaultListModel pluginsModel) { JBList jbList = new JBList(pluginsModel); jbList.setCellRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { final Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); CustomActionModel goal = (CustomActionModel) value; setText(goal.getName()); return comp; } }); jbList.setDragEnabled(true); jbList.setDropMode(DropMode.INSERT); jbList.setTransferHandler(new MyListDropHandler(jbList)); new MyDragListener(jbList); return jbList; }
Example #16
Source File: HaxeRestoreReferencesDialog.java From intellij-haxe with Apache License 2.0 | 6 votes |
@Override protected JComponent createCenterPanel() { final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP)); myList = new JBList((Object[])myNamedElements); myList.setCellRenderer(new FQNameCellRenderer()); panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER); panel.add(new JBLabel(CodeInsightBundle.message("dialog.paste.on.import.text"), SMALL, BRIGHTER), BorderLayout.NORTH); final JPanel buttonPanel = new JPanel(new VerticalFlowLayout()); final JButton okButton = new JButton(CommonBundle.getOkButtonText()); getRootPane().setDefaultButton(okButton); buttonPanel.add(okButton); final JButton cancelButton = new JButton(CommonBundle.getCancelButtonText()); buttonPanel.add(cancelButton); panel.setPreferredSize(new Dimension(500, 400)); return panel; }
Example #17
Source File: LibraryDialog.java From PackageTemplates with Apache License 2.0 | 6 votes |
private void createBinaryFileList() { ArrayList<Pair<String, BinaryFileLibModel>> libModels = new ArrayList<>(); libModels.add(new Pair<>("key1", new BinaryFileLibModel("C:/foo/bar/path1"))); libModels.add(new Pair<>("key2", new BinaryFileLibModel("C:/foo/bar/path2"))); libModels.add(new Pair<>("key3", new BinaryFileLibModel("C:/foo/bar/path3"))); listBinaryFiles = new JBList<>(libModels); listBinaryFiles.setCellRenderer((list, value, index, isSelected, cellHasFocus) -> { return new JBLabel(value.first); }); listBinaryFiles.addListSelectionListener(arg0 -> { if (!arg0.getValueIsAdjusting()) { presenter.onBinaryFileSelected(listBinaryFiles.getSelectedValue()); } }); }
Example #18
Source File: MacrosDialog.java From consulo with Apache License 2.0 | 5 votes |
public MacrosDialog(Project project) { super(project, true); MacroManager.getInstance().cacheMacrosPreview(SimpleDataContext.getProjectContext(project)); setTitle(IdeBundle.message("title.macros")); setOKButtonText(IdeBundle.message("button.insert")); myMacrosModel = new DefaultListModel(); myMacrosList = new JBList(myMacrosModel); myPreviewTextarea = new JTextArea(); init(); }
Example #19
Source File: Switcher.java From consulo with Apache License 2.0 | 5 votes |
private static void exchangeSelectionState(JBList toClear, JBList toSelect) { if (toSelect.getModel().getSize() > 0) { int index = Math.min(toClear.getSelectedIndex(), toSelect.getModel().getSize() - 1); toSelect.setSelectedIndex(index); toSelect.ensureIndexIsVisible(index); toClear.clearSelection(); } }
Example #20
Source File: Switcher.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static <T> JBList<T> createList(CollectionListModel<T> baseModel, Function<? super T, String> namer, SwitcherSpeedSearch speedSearch, boolean pinned) { ListModel<T> listModel; if (pinned) { listModel = new NameFilteringListModel<>(baseModel, namer, s -> !speedSearch.isPopupActive() || StringUtil.isEmpty(speedSearch.getEnteredPrefix()) || speedSearch.getComparator().matchingFragments(speedSearch.getEnteredPrefix(), s) != null, () -> StringUtil.notNullize(speedSearch.getEnteredPrefix())); } else { listModel = baseModel; } return new JBList<>(listModel); }
Example #21
Source File: Switcher.java From consulo with Apache License 2.0 | 5 votes |
private static void fromListToList(JBList from, JBList to) { AbstractAction action = new AbstractAction() { @Override public void actionPerformed(ActionEvent event) { to.requestFocus(); } }; ActionMap map = from.getActionMap(); map.put(ListActions.Left.ID, action); map.put(ListActions.Right.ID, action); }
Example #22
Source File: ArrangementComboBoxUiComponent.java From consulo with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public ArrangementComboBoxUiComponent(@Nonnull List<ArrangementSettingsToken> tokens) { super(tokens); ArrangementSettingsToken[] tokensArray = tokens.toArray(new ArrangementSettingsToken[tokens.size()]); Arrays.sort(tokensArray, new Comparator<ArrangementSettingsToken>() { @Override public int compare(ArrangementSettingsToken t1, ArrangementSettingsToken t2) { return t1.getRepresentationValue().compareTo(t2.getRepresentationValue()); } }); myComboBox = new JComboBox(tokensArray); myComboBox.setRenderer(new ListCellRendererWrapper() { @Override public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) { setText(((ArrangementSettingsToken)value).getRepresentationValue()); } }); myComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { fireStateChanged(); } } }); int minWidth = 0; ListCellRenderer renderer = myComboBox.getRenderer(); JBList dummyList = new JBList(); for (int i = 0, max = myComboBox.getItemCount(); i < max; i++) { Component rendererComponent = renderer.getListCellRendererComponent(dummyList, myComboBox.getItemAt(i), i, false, true); minWidth = Math.max(minWidth, rendererComponent.getPreferredSize().width); } myComboBox.setPreferredSize(new Dimension(minWidth * 5 / 3, myComboBox.getPreferredSize().height)); }
Example #23
Source File: ContentChooser.java From consulo with Apache License 2.0 | 5 votes |
public ContentChooser(Project project, String title, boolean useIdeaEditor, boolean allowMultipleSelections) { super(project, true); myProject = project; myUseIdeaEditor = useIdeaEditor; myAllowMultipleSelections = allowMultipleSelections; myUpdateAlarm = new Alarm(getDisposable()); mySplitter = new JBSplitter(true, 0.3f); mySplitter.setSplitterProportionKey(getDimensionServiceKey() + ".splitter"); myList = new JBList(new CollectionListModel<Item>()); setOKButtonText(CommonBundle.getOkButtonText()); setTitle(title); init(); }
Example #24
Source File: SearchTextField.java From consulo with Apache License 2.0 | 5 votes |
protected void showPopup() { if (myPopup == null || !myPopup.isVisible()) { final JList list = new JBList(myModel); final Runnable chooseRunnable = createItemChosenCallback(list); myPopup = JBPopupFactory.getInstance().createListPopupBuilder(list) .setMovable(false) .setRequestFocus(true) .setItemChoosenCallback(chooseRunnable).createPopup(); if (isShowing()) { myPopup.showUnderneathOf(getPopupLocationComponent()); } } }
Example #25
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 #26
Source File: ServiceSuggestDialog.java From idea-php-symfony2-plugin with MIT License | 5 votes |
public static void create(final @NotNull Editor editor, @NotNull Collection<String> services, final @NotNull Callback callback) { final JBList<String> list = new JBList<>(services); JBPopupFactory.getInstance().createListPopupBuilder(list) .setTitle("Symfony: Service Suggestion") .setItemChoosenCallback(() -> new WriteCommandAction.Simple(editor.getProject(), "Service Suggestion Insert") { @Override protected void run() { callback.insert((String) list.getSelectedValue()); } }.execute()) .createPopup() .showInBestPositionFor(editor); }
Example #27
Source File: CompoundRunConfigurationSettingsEditor.java From consulo with Apache License 2.0 | 5 votes |
public CompoundRunConfigurationSettingsEditor(@Nonnull Project project) { myRunManager = RunManagerImpl.getInstanceImpl(project); myModel = new SortedListModel<>(CompoundRunConfiguration.COMPARATOR); myList = new JBList(myModel); myList.setCellRenderer(new ColoredListCellRenderer() { @Override protected void customizeCellRenderer(@Nonnull JList list, Object value, int index, boolean selected, boolean hasFocus) { RunConfiguration configuration = myModel.get(index); setIcon(configuration.getType().getIcon()); append(configuration.getType().getDisplayName() + " '" + configuration.getName() + "'"); } }); myList.setVisibleRowCount(15); }
Example #28
Source File: TemplateCreateByNameLocalQuickFix.java From idea-php-symfony2-plugin with MIT License | 5 votes |
private void applyFix(@NotNull Project project) { Collection<String> templatePaths = TwigUtil.getCreateAbleTemplatePaths(project, templateName); if(templatePaths.size() == 0) { Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); // notify error if editor is focused if(editor != null) { HintManager.getInstance().showErrorHint(editor, "Can not find a target dir"); } return; } JBList<String> list = new JBList<>(templatePaths); JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list) .setTitle("Twig: Template Path") .setItemChoosenCallback(() -> { final String selectedValue = list.getSelectedValue(); String commandName = "Create Template: " + (selectedValue.length() > 15 ? selectedValue.substring(selectedValue.length() - 15) : selectedValue); new WriteCommandAction.Simple(project, commandName) { @Override protected void run() { createFile(project, selectedValue); } }.execute(); }) .createPopup(); // show popup in scope Editor selectedTextEditor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if(selectedTextEditor != null) { popup.showInBestPositionFor(selectedTextEditor); } else { popup.showCenteredInCurrentWindow(project); } }
Example #29
Source File: PhpServiceArgumentIntention.java From idea-php-symfony2-plugin with MIT License | 5 votes |
@Override public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement psiElement) throws IncorrectOperationException { PhpClass phpClass = PsiTreeUtil.getParentOfType(psiElement, PhpClass.class); if (phpClass == null) { return; } Set<String> serviceNames = ContainerCollectionResolver.ServiceCollector.create(project).convertClassNameToServices(phpClass.getFQN()); if (serviceNames.isEmpty()) { return; } Collection<PsiElement> psiElements = new ArrayList<>(); for (String serviceName : serviceNames) { psiElements.addAll(ServiceIndexUtil.findServiceDefinitions(project, serviceName)); } if (psiElements.isEmpty()) { return; } Map<String, PsiElement> map = new HashMap<>(); for (PsiElement element : psiElements) { map.put(VfsUtil.getRelativePath(element.getContainingFile().getVirtualFile(), ProjectUtil.getProjectDir(element)), element); } final JBList<String> list = new JBList<>(map.keySet()); JBPopupFactory.getInstance().createListPopupBuilder(list) .setTitle("Symfony: Services Definitions") .setItemChoosenCallback(() -> WriteCommandAction.writeCommandAction(project).withName("Service Update").run(() -> invokeByScope(map.get(list.getSelectedValue()), editor))) .createPopup() .showInBestPositionFor(editor) ; }
Example #30
Source File: UserDefinedLibraryPanel.java From intellij-xquery with Apache License 2.0 | 5 votes |
private JBList preparePathList(DefaultListModel pathListModel) { final JBList pathList = new JBList(pathListModel); pathList.getEmptyText().setText("No classpath entries defined"); pathList.setDragEnabled(false); pathList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); pathList.setName(PATH_LIST_NAME); return pathList; }