@Override public void propertyChange(@NotNull PropertyChangeEvent evt) { if (project.isDisposed()) { myPopup.cancel(); return; } ((NameFilteringListModel)files.getModel()).refilter(); ((NameFilteringListModel)toolWindows.getModel()).refilter(); if (files.getModel().getSize() + toolWindows.getModel().getSize() == 0) { toolWindows.getEmptyText().setText(""); files.getEmptyText().setText("Press 'Enter' to search in Project"); } else { files.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); toolWindows.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); } }
@Override public void propertyChange(PropertyChangeEvent evt) { final MyList list = getSelectedList(); final Object value = list.getSelectedValue(); ((NameFilteringListModel)files.getModel()).refilter(); ((NameFilteringListModel)toolWindows.getModel()).refilter(); if (files.getModel().getSize() + toolWindows.getModel().getSize() == 0) { toolWindows.getEmptyText().setText(""); files.getEmptyText().setText("Press 'Enter' to search in Project"); } else { files.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); toolWindows.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); } files.repaint(); toolWindows.repaint(); getSelectedList(list).setSelectedValue(value, true); }
@Override public void propertyChange(@Nonnull PropertyChangeEvent evt) { if (project.isDisposed()) { myPopup.cancel(); return; } ((NameFilteringListModel)files.getModel()).refilter(); ((NameFilteringListModel)toolWindows.getModel()).refilter(); if (files.getModel().getSize() + toolWindows.getModel().getSize() == 0) { toolWindows.getEmptyText().setText(""); files.getEmptyText().setText("Press 'Enter' to search in Project"); } else { files.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); toolWindows.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); } }
@Nullable public static DefaultListModel getDataModel(AnActionEvent e) { final JList list = getList(e); if (list != null) { ListModel model = list.getModel(); if (model instanceof NameFilteringListModel) { model = ((NameFilteringListModel)model).getOriginalModel(); if (model instanceof DefaultListModel) { return (DefaultListModel)model; } } } return null; }
private static void removeElementAt(@NotNull JList jList, int index) { final ListModel model = jList.getModel(); if (model instanceof DefaultListModel) { ((DefaultListModel)model).removeElementAt(index); } else if (model instanceof NameFilteringListModel) { ((NameFilteringListModel)model).remove(index); } else { throw new IllegalArgumentException("Wrong list model " + model.getClass()); } }
@Override protected void replaceModel(@NotNull List<PsiElement> data) { final Object selectedValue = myComponent.getSelectedValue(); final int index = myComponent.getSelectedIndex(); ((NameFilteringListModel)myComponent.getModel()).replaceAll(data); if (index == 0) { myComponent.setSelectedIndex(0); } else { myComponent.setSelectedValue(selectedValue, true); } }
private static void removeElementAt(JList jList, int index) { final ListModel model = jList.getModel(); if (model instanceof DefaultListModel) { ((DefaultListModel)model).removeElementAt(index); } else if (model instanceof NameFilteringListModel) { ((NameFilteringListModel)model).remove(index); } else { throw new IllegalArgumentException("Wrong list model " + model.getClass()); } }
private static void removeElementAt(@Nonnull JList jList, int index) { final ListModel model = jList.getModel(); if (model instanceof DefaultListModel) { ((DefaultListModel)model).removeElementAt(index); } else if (model instanceof NameFilteringListModel) { ((NameFilteringListModel)model).remove(index); } else { throw new IllegalArgumentException("Wrong list model " + model.getClass()); } }
@Override protected void replaceModel(@Nonnull List<PsiElement> data) { final Object selectedValue = myComponent.getSelectedValue(); final int index = myComponent.getSelectedIndex(); ((NameFilteringListModel)myComponent.getModel()).replaceAll(data); if (index == 0) { myComponent.setSelectedIndex(0); } else { myComponent.setSelectedValue(selectedValue, true); } }