case NEXT: {
return new ContextMenuCreator() {
@Override
public Menu createMenu(Control parent) {
Menu menu = new Menu(parent);
NavigationActionType defaultAction = NavigationActionType.values()[fPreferences.getInteger(DefaultPreferences.DEFAULT_NEXT_ACTION)];
MenuItem item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.NEXT_NEWS.getCommandId(), NavigationActionType.NEXT_NEWS.getName()));
item.setData(NavigationActionType.NEXT_NEWS);
item.addSelectionListener(new NavigationSelectionListener(true));
if (item.getData().equals(defaultAction))
item.setSelection(true);
item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.NEXT_UNREAD_NEWS.getCommandId(), NavigationActionType.NEXT_UNREAD_NEWS.getName()));
item.setData(NavigationActionType.NEXT_UNREAD_NEWS);
item.addSelectionListener(new NavigationSelectionListener(true));
if (item.getData().equals(defaultAction))
item.setSelection(true);
new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.NEXT_FEED.getCommandId(), NavigationActionType.NEXT_FEED.getName()));
item.setData(NavigationActionType.NEXT_FEED);
item.addSelectionListener(new NavigationSelectionListener(true));
if (item.getData().equals(defaultAction))
item.setSelection(true);
item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.NEXT_UNREAD_FEED.getCommandId(), NavigationActionType.NEXT_UNREAD_FEED.getName()));
item.setData(NavigationActionType.NEXT_UNREAD_FEED);
item.addSelectionListener(new NavigationSelectionListener(true));
if (item.getData().equals(defaultAction))
item.setSelection(true);
new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.NEXT_TAB.getCommandId(), NavigationActionType.NEXT_TAB.getName()));
item.setData(NavigationActionType.NEXT_TAB);
item.addSelectionListener(new NavigationSelectionListener(true));
if (item.getData().equals(defaultAction))
item.setSelection(true);
return menu;
}
};
}
/* Previous News | Previous Unread News || Previous Feed | Previous Unread Feed || Previous Tab */
case PREVIOUS: {
return new ContextMenuCreator() {
@Override
public Menu createMenu(Control parent) {
Menu menu = new Menu(parent);
NavigationActionType defaultAction = NavigationActionType.values()[fPreferences.getInteger(DefaultPreferences.DEFAULT_PREVIOUS_ACTION)];
MenuItem item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_NEWS.getCommandId(), NavigationActionType.PREVIOUS_NEWS.getName()));
item.setData(NavigationActionType.PREVIOUS_NEWS);
item.addSelectionListener(new NavigationSelectionListener(false));
if (item.getData().equals(defaultAction))
item.setSelection(true);
item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_UNREAD_NEWS.getCommandId(), NavigationActionType.PREVIOUS_UNREAD_NEWS.getName()));
item.setData(NavigationActionType.PREVIOUS_UNREAD_NEWS);
item.addSelectionListener(new NavigationSelectionListener(false));
if (item.getData().equals(defaultAction))
item.setSelection(true);
new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_FEED.getCommandId(), NavigationActionType.PREVIOUS_FEED.getName()));
item.setData(NavigationActionType.PREVIOUS_FEED);
item.addSelectionListener(new NavigationSelectionListener(false));
if (item.getData().equals(defaultAction))
item.setSelection(true);
item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_UNREAD_FEED.getCommandId(), NavigationActionType.PREVIOUS_UNREAD_FEED.getName()));
item.setData(NavigationActionType.PREVIOUS_UNREAD_FEED);
item.addSelectionListener(new NavigationSelectionListener(false));
if (item.getData().equals(defaultAction))
item.setSelection(true);
new MenuItem(menu, SWT.SEPARATOR);
item = new MenuItem(menu, SWT.RADIO);
item.setText(getLabelWithBinding(NavigationActionType.PREVIOUS_TAB.getCommandId(), NavigationActionType.PREVIOUS_TAB.getName()));
item.setData(NavigationActionType.PREVIOUS_TAB);
item.addSelectionListener(new NavigationSelectionListener(false));
if (item.getData().equals(defaultAction))
item.setSelection(true);
return menu;
}
};
}
/* History */
case HISTORY:
return new ContextMenuCreator() {
@Override
public Menu createMenu(Control parent) {
Menu menu = new Menu(parent);
ContributionItemFactory.REOPEN_EDITORS.create(fWindow).fill(menu, 0);
MenuItem[] items = menu.getItems();
if (items.length > 0 && (items[0].getStyle() & SWT.SEPARATOR) != 0)
items[0].dispose();
return menu;
}
};