Java 类com.intellij.ui.speedSearch.NameFilteringListModel 实例源码

项目:intellij-ce-playground    文件:Switcher.java   
@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);
  }
}
项目:tools-idea    文件:Switcher.java   
@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);
}
项目:consulo    文件:Switcher.java   
@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);
  }
}
项目:intellij-ce-playground    文件:RecentProjectsWelcomeScreenActionBase.java   
@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;
}
项目:intellij-ce-playground    文件:Switcher.java   
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());
  }
}
项目:intellij-ce-playground    文件:ListBackgroundUpdaterTask.java   
@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);
  }
}
项目:tools-idea    文件:Switcher.java   
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());
  }
}
项目:tools-idea    文件:ListBackgroundUpdaterTask.java   
@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);
  }
}
项目:consulo    文件:RecentProjectsWelcomeScreenActionBase.java   
@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;
}
项目:consulo    文件:Switcher.java   
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());
  }
}
项目:consulo    文件:ListBackgroundUpdaterTask.java   
@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);
  }
}