/* Search on: Subject */
final MenuItem searchHeadline = new MenuItem(menu, SWT.RADIO);
searchHeadline.setText(NewsFilter.SearchTarget.HEADLINE.getName());
searchHeadline.setSelection(NewsFilter.SearchTarget.HEADLINE == filter.getSearchTarget());
searchHeadline.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (searchHeadline.getSelection() && filter.getSearchTarget() != NewsFilter.SearchTarget.HEADLINE)
doSearch(NewsFilter.SearchTarget.HEADLINE);
}
});
/* Search on: Entire News */
final MenuItem searchEntireNews = new MenuItem(menu, SWT.RADIO);
searchEntireNews.setText(NewsFilter.SearchTarget.ALL.getName());
searchEntireNews.setSelection(NewsFilter.SearchTarget.ALL == filter.getSearchTarget());
searchEntireNews.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (searchEntireNews.getSelection() && filter.getSearchTarget() != NewsFilter.SearchTarget.ALL)
doSearch(NewsFilter.SearchTarget.ALL);
}
});
new MenuItem(menu, SWT.SEPARATOR);
/* Search on: Author */
final MenuItem searchAuthor = new MenuItem(menu, SWT.RADIO);
searchAuthor.setText(NewsFilter.SearchTarget.AUTHOR.getName());
searchAuthor.setSelection(NewsFilter.SearchTarget.AUTHOR == filter.getSearchTarget());
searchAuthor.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (searchAuthor.getSelection() && filter.getSearchTarget() != NewsFilter.SearchTarget.AUTHOR)
doSearch(NewsFilter.SearchTarget.AUTHOR);
}
});
/* Search on: Category */
final MenuItem searchCategory = new MenuItem(menu, SWT.RADIO);
searchCategory.setText(NewsFilter.SearchTarget.CATEGORY.getName());
searchCategory.setSelection(NewsFilter.SearchTarget.CATEGORY == filter.getSearchTarget());
searchCategory.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (searchCategory.getSelection() && filter.getSearchTarget() != NewsFilter.SearchTarget.CATEGORY)
doSearch(NewsFilter.SearchTarget.CATEGORY);
}
});
/* Search on: Source */
final MenuItem searchSource = new MenuItem(menu, SWT.RADIO);
searchSource.setText(NewsFilter.SearchTarget.SOURCE.getName());
searchSource.setSelection(NewsFilter.SearchTarget.SOURCE == filter.getSearchTarget());
searchSource.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (searchSource.getSelection() && filter.getSearchTarget() != NewsFilter.SearchTarget.SOURCE)
doSearch(NewsFilter.SearchTarget.SOURCE);
}
});
/* Search on: Attachments */
final MenuItem searchAttachments = new MenuItem(menu, SWT.RADIO);
searchAttachments.setText(NewsFilter.SearchTarget.ATTACHMENTS.getName());
searchAttachments.setSelection(NewsFilter.SearchTarget.ATTACHMENTS == filter.getSearchTarget());
searchAttachments.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (searchAttachments.getSelection() && filter.getSearchTarget() != NewsFilter.SearchTarget.ATTACHMENTS)
doSearch(NewsFilter.SearchTarget.ATTACHMENTS);
}
});
/* Search on: Labels */
final MenuItem searchLabels = new MenuItem(menu, SWT.RADIO);
searchLabels.setText(NewsFilter.SearchTarget.LABELS.getName());
searchLabels.setSelection(NewsFilter.SearchTarget.LABELS == filter.getSearchTarget());
searchLabels.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (searchLabels.getSelection() && filter.getSearchTarget() != NewsFilter.SearchTarget.LABELS)
doSearch(NewsFilter.SearchTarget.LABELS);
}
});
/* Offer to Save as Search */
INewsMark inputMark = ((FeedViewInput) fFeedView.getEditorInput()).getMark();
if (inputMark instanceof IBookMark || inputMark instanceof INewsBin || inputMark instanceof FolderNewsMark) {
/* Separator */
new MenuItem(menu, SWT.SEPARATOR);
/* Convert Filter to Saved Search */
final MenuItem createSavedSearch = new MenuItem(menu, SWT.RADIO);
createSavedSearch.setText(Messages.FilterBar_SAVE_SEARCH);
createSavedSearch.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onCreateSavedSearch(true);
}
});