@SuppressWarnings("unchecked") private static DefaultListModel buildModel(Project project) { DefaultListModel model = new DefaultListModel(); for (Bookmark bookmark : BookmarkManager.getInstance(project).getValidBookmarks()) { model.addElement(new BookmarkItem(bookmark)); } return model; }
private void createNewConfiguration() { if (!saveSelectedConfiguration()) return; myList.setSelectedValue(null, false); CvsRootConfiguration newConfig = CvsApplicationLevelConfiguration.createNewConfiguration( CvsApplicationLevelConfiguration.getInstance()); myModel.addElement(newConfig); myList.setSelectedValue(newConfig, true); }
private void removeSelectedConfiguration() { int oldSelection = myList.getSelectedIndex(); myModel.removeElement(mySelection); int size = myList.getModel().getSize(); int newSelection = oldSelection < size ? oldSelection : size - 1; if (newSelection >= 0 && newSelection < size) { myList.setSelectedIndex(newSelection); } }
public JComponent getPreferredFocusedComponent() { if (myModel.isEmpty()) return null; return myCvs2SettingsEditPanel.getPreferredFocusedComponent(); }
public ArrayList<CvsRootConfiguration> getConfigurations() { ArrayList<CvsRootConfiguration> result = new ArrayList<CvsRootConfiguration>(); Enumeration each = myModel.elements(); while (each.hasMoreElements()) result.add((CvsRootConfiguration) each.nextElement()); return result; }
private void copySelectedConfiguration() { if (!saveSelectedConfiguration()) return; CvsRootConfiguration newConfig = mySelection.getMyCopy(); myModel.addElement(newConfig); myList.setSelectedValue(newConfig, true); }
private void fillModel(List<CvsRootConfiguration> configurations) { for (final CvsRootConfiguration configuration : configurations) { myModel.addElement(configuration.getMyCopy()); } }