private JBList createList(RefGroup group) { JBList list = new JBList(createListModel(group)); list.setCellRenderer(myCellRenderer); ListUtil.installAutoSelectOnMouseMove(list); list.setSelectedIndex(0); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jumpOnMouseClick(list); jumpOnEnter(list); return list; }
@Override public void mouseReleased(MouseEvent e) { final Point point = e.getPoint(); final MyList list = MyList.this; final int index = list.locationToIndex(point); if (index != -1) { if (getCloseIconRect(index).contains(point)) { e.consume(); final Object element = getModel().getElementAt(index); removeRecentProjectElement(element); ListUtil.removeSelectedItems(MyList.this); } } }
@Override public void actionPerformed(AnActionEvent e) { List<Bookmark> bookmarks = BookmarksAction.getSelectedBookmarks(myList); ListUtil.removeSelectedItems(myList); for (Bookmark bookmark : bookmarks) { BookmarkManager.getInstance(myProject).removeBookmark(bookmark); } }
@Override protected void doRemoveItems(int[] idxs, JList list) { List<Pair<VirtualFile, Integer>> removed = Lists.newArrayList(); for (int i : idxs) { removed.add(Pair.create((VirtualFile)getListModel().get(i), i)); } ListUtil.removeIndices(list, myPathListModel.remove(removed)); list.updateUI(); setModified(true); }
public Form() { myClasspathList.setCellRenderer(new AntUIUtil.ClasspathRenderer()); myUpdatables.add(ListUtil.addRemoveListener(myRemoveButton, myClasspathList)); myUpdatables.add(ListUtil.addMoveUpListener(myMoveUpButton, myClasspathList)); myUpdatables.add(ListUtil.addMoveDownListener(myMoveDownButton, myClasspathList)); }
private MyListWrapper(final JList list) { super(UIUtil.isUnderAquaLookAndFeel() ? 0 : -1); list.setVisibleRowCount(15); setViewportView(list); if (myAutoselectOnMouseMove) { ListUtil.installAutoSelectOnMouseMove(list); } ScrollingUtil.installActions(list); setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); myList = list; }
private static boolean isSelectedByMouse(@NotNull JComponent c) { return Boolean.TRUE.equals(c.getClientProperty(ListUtil.SELECTED_BY_MOUSE_EVENT)); }
@Override public void actionPerformed(AnActionEvent e) { ListUtil.moveSelectedItemsUp(myRightList); }
@Override public void actionPerformed(AnActionEvent e) { ListUtil.moveSelectedItemsDown(myRightList); }
@Override public void actionPerformed(AnActionEvent e) { ListUtil.moveSelectedItemsDown(myList); BookmarkManager.getInstance(myProject).moveBookmarkDown(BookmarksAction.getSelectedBookmarks(myList).get(0)); }
@Override public void actionPerformed(AnActionEvent e) { ListUtil.moveSelectedItemsUp(myList); BookmarkManager.getInstance(myProject).moveBookmarkUp(BookmarksAction.getSelectedBookmarks(myList).get(0)); }
public void enableButtons(boolean enable) { for (Iterator<ListUtil.Updatable> iterator = myUpdatables.iterator(); iterator.hasNext();) { ListUtil.Updatable updatable = iterator.next(); updatable.enable(enable); } }
private static boolean isSelectedByMouse(@Nonnull JComponent c) { return Boolean.TRUE.equals(c.getClientProperty(ListUtil.SELECTED_BY_MOUSE_EVENT)); }