public CreateGradleLibraryFromFilesDialog(@NotNull Project project, @NotNull List<OrderRoot> roots) { super(project, true); setTitle(COMMAND_TITLE); myProject = project; myRoots = roots; mySettingsFile = GradleSettingsFile.get(myProject); final FormBuilder builder = LibraryNameAndLevelPanel.createFormBuilder(); myModulesComboBox = new ModulesComboBox(); myModulesComboBox.fillModules(myProject); myModulesComboBox.setSelectedModule(findModule(roots)); for (Iterator iter = ((SortedListModel)myModulesComboBox.getModel()).iterator(); iter.hasNext(); ) { Module module = (Module)iter.next(); String path = GradleSettingsFile.getModuleGradlePath(module); if (path == null || !mySettingsFile.hasBuildFile(path)) { iter.remove(); } } builder.addLabeledComponent("&Add to module:", myModulesComboBox); myPanel = builder.getPanel(); init(); }
public GroupList(PsiClass[] classes) { super(new BorderLayout()); SortedListModel<String> model = new SortedListModel<String>(new Comparator<String>() { public int compare(String s1, String s2) { return s1.compareTo(s2); } }); list = new JBList(model); Set<String> groups = TestNGUtil.getAnnotationValues("groups", classes); String[] array = ArrayUtil.toStringArray(groups); Arrays.sort(array); model.addAll(array); add(ScrollPaneFactory.createScrollPane(list)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ScrollingUtil.ensureSelectionExists(list); }
public SearchSupport(EditorTextField textField) { myTextField = textField; myTextField.getDocument().addDocumentListener(new DocumentAdapter() { @Override public void documentChanged(DocumentEvent event) { onTextChanged(); } }); //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { myTextField.addKeyListener(new KeyAdapter() { public void keyPressed(final KeyEvent e) { processListSelection(e); } }); } }); myList.setVisibleRowCount(10); myListModel = new SortedListModel<T>(null); myList.setModel(myListModel); }
public GroupList(PsiClass[] classes) { super(new BorderLayout()); SortedListModel<String> model = new SortedListModel<String>(new Comparator<String>() { public int compare(String s1, String s2) { return s1.compareTo(s2); } }); list = new JBList(model); Set<String> groups = TestNGUtil.getAnnotationValues("groups", classes); String[] array = ArrayUtil.toStringArray(groups); Arrays.sort(array); model.addAll(array); add(ScrollPaneFactory.createScrollPane(list)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ListScrollingUtil.ensureSelectionExists(list); }
public void run(SortedListModel<MMUserStatus> listModel, String username, String password, String url) throws IOException, URISyntaxException, CertificateException, InterruptedException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { MM_URL = url; login(username, password); users(); teams(); userStatus(); ws = websocket(listModel); java.util.Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { try { if (ws == null || ws.isClosed()) { Notifications.Bus.notify(new Notification("team", "mattermost websocket", "websocket reconnecting...", NotificationType.INFORMATION)); ws = websocket(listModel); } ws.send("{\"action\":\"get_statuses\",\"seq\":" + (++seq) + "}"); statusSeq = seq; } catch (Throwable t) { t.printStackTrace(); Notifications.Bus.notify(new Notification("team", "mattermost Error", t.getMessage(), NotificationType.ERROR)); } } }, 5000, 60000); this.listModel = listModel; fillListModel(); }
public SortedListBinding(JList list, ListProperty<T> property, Comparator<T> comparator) { super(property, list); list.setModel(new SortedListModel<T>(comparator)); }
private SortedListModel<T> getModel() { return ((SortedListModel<T>)getList().getModel()); }