private JMenu createSearchSubMenu(LibraryPlaylistsTableDataLine dl) { JMenu menu = new SkinMenu(I18n.tr("Search")); if (dl != null) { File f = dl.getFile(); String keywords = QueryUtils.createQueryString(f.getName()); if (keywords.length() > 0) menu.add(new SkinMenuItem(new SearchAction(keywords))); } if (menu.getItemCount() == 0) menu.setEnabled(false); return menu; }
/** Returns a menu with a 'repeat search' and 'repeat search no clear' action. */ protected final JMenu createSearchAgainMenu(SearchResultDataLine line) { JMenu menu = new SkinMenu(I18n.tr("Search More")); menu.add(new SkinMenuItem(new RepeatSearchAction())); if (line == null) { menu.setEnabled(isRepeatSearchEnabled()); return menu; } menu.addSeparator(); String keywords = QueryUtils.createQueryString(line.getFilename()); SearchInformation info = SearchInformation.createKeywordSearch(keywords, null, MediaType.getAnyTypeMediaType()); if (SearchMediator.validateInfo(info) == SearchMediator.QUERY_VALID) { menu.add( new SkinMenuItem(new SearchAction(info, I18nMarker.marktr("Search for Keywords: {0}")))); } return menu; }