Revert "Remove redundant data source name tool tips from ad hoc kws"

This reverts commit 57d9022c525d077a2b4443a5f1964e031b206df3.
This commit is contained in:
Richard Cordovano 2018-06-28 16:35:16 -04:00
parent c354181fbf
commit bd202f5fbf
3 changed files with 43 additions and 0 deletions

View File

@ -43,6 +43,7 @@ abstract class AdHocSearchPanel extends javax.swing.JPanel {
private final String keywordSearchErrorDialogHeader = org.openide.util.NbBundle.getMessage(this.getClass(), "AbstractKeywordSearchPerformer.search.dialogErrorHeader");
protected int filesIndexed;
private final Map<Long, String> dataSourceMap = new HashMap<>();
private final List<String> toolTipList = new ArrayList<>();
private List<DataSource> dataSources = new ArrayList<>();
private final DefaultListModel<String> dataSourceListModel = new DefaultListModel<>();
@ -152,12 +153,14 @@ abstract class AdHocSearchPanel extends javax.swing.JPanel {
*/
synchronized List<String> getDataSourceArray() {
List<String> dsList = new ArrayList<>();
toolTipList.clear();
Collections.sort(this.dataSources, (DataSource ds1, DataSource ds2) -> ds1.getName().compareTo(ds2.getName()));
for (DataSource ds : dataSources) {
String dsName = ds.getName();
File dataSourceFullName = new File(dsName);
String displayName = dataSourceFullName.getName();
dataSourceMap.put(ds.getId(), displayName);
toolTipList.add(dsName);
dsList.add(displayName);
}
return dsList;
@ -180,6 +183,14 @@ abstract class AdHocSearchPanel extends javax.swing.JPanel {
Map<Long, String> getDataSourceMap() {
return dataSourceMap;
}
/**
* Get a list of tooltip text for data source
* @return A list of tool tips
*/
List<String> getDataSourceToolTipList() {
return toolTipList;
}
/**
* Get a list of DataSourceListModel

View File

@ -73,6 +73,22 @@ class DropdownListSearchPanel extends AdHocSearchPanel {
dataSourceList.addListSelectionListener((ListSelectionEvent evt) -> {
firePropertyChange(Bundle.DropdownSingleTermSearchPanel_selected(), null, null);
});
dataSourceList.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent evt) {
//Unused by now
}
@Override
public void mouseMoved(MouseEvent evt) {
JList<String> dsList = (JList<String>) evt.getSource();
int index = dsList.locationToIndex(evt.getPoint());
if (index > -1) {
dsList.setToolTipText(getDataSourceToolTipList().get(index));
}
}
});
}
static synchronized DropdownListSearchPanel getDefault() {

View File

@ -88,6 +88,22 @@ public class DropdownSingleTermSearchPanel extends AdHocSearchPanel {
this.dataSourceList.addListSelectionListener((ListSelectionEvent evt) -> {
firePropertyChange(Bundle.DropdownSingleTermSearchPanel_selected(), null, null);
});
this.dataSourceList.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent evt) {
//Unused by now
}
@Override
public void mouseMoved(MouseEvent evt) {
JList<String> DsList = (JList<String>) evt.getSource();
int index = DsList.locationToIndex(evt.getPoint());
if (index > -1) {
DsList.setToolTipText(getDataSourceToolTipList().get(index));
}
}
});
}
/**