* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@SuppressWarnings("restriction")
@Override
protected Control createContents(Composite parent) {
final IWorkbenchPreferenceContainer preferences = (IWorkbenchPreferenceContainer) getContainer();
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginHeight = 0;
container.setLayout(layout);
container.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
container.setFont(parent.getFont());
Label titleLabel = new Label(container, SWT.None);
titleLabel.setText(Messages.OverviewPreferencesPage_OVERVIEW_INFO);
titleLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
List<String> ids = new ArrayList<String>();
List<Image> images = new ArrayList<Image>();
List<String> labels = new ArrayList<String>();
Composite linkContainer = new Composite(container, SWT.NONE);
linkContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
linkContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0, 15, 8, false));
((GridLayout) linkContainer.getLayout()).marginTop = 10;
/* Feeds */
ids.add(FeedsPreferencePage.ID);
images.add(OwlUI.getImage(fResources, OwlUI.BOOKMARK));
labels.add(Messages.OverviewPreferencesPage_FEED_OPTIONS);
/* Browser */
ids.add(BrowserPreferencePage.ID);
images.add(OwlUI.getImage(fResources, "icons/elcl16/browser.gif")); //$NON-NLS-1$
labels.add(Messages.OverviewPreferencesPage_BROWSER_OPTIONS);
/* Sharing */
ids.add(SharingPreferencesPage.ID);
images.add(OwlUI.getImage(fResources, "icons/elcl16/share.gif")); //$NON-NLS-1$
labels.add(Messages.OverviewPreferencesPage_SHARE_OPTIONS);
/* Key Bindings */
ids.add("org.rssowl.ui.preferences.Keys"); //$NON-NLS-1$
images.add(OwlUI.getImage(fResources, "icons/elcl16/keyspref.gif")); //$NON-NLS-1$
labels.add(Messages.OverviewPreferencesPage_KEYS_OPTIONS);
/* View */
ids.add(MiscPreferencePage.ID);
images.add(OwlUI.getImage(fResources, "icons/elcl16/view.gif")); //$NON-NLS-1$
labels.add(Messages.OverviewPreferencesPage_VIEW_OPTIONS);
/* Colors and Fonts */
ids.add("org.rssowl.ui.preferences.ColorsAndFonts"); //$NON-NLS-1$
images.add(OwlUI.getImage(fResources, "icons/elcl16/colors.gif")); //$NON-NLS-1$
labels.add(Messages.OverviewPreferencesPage_COLOR_FONT_OPTIONS);
/* Network */
ids.add("org.eclipse.ui.net.NetPreferences"); //$NON-NLS-1$
images.add(OwlUI.getImage(fResources, "icons/elcl16/network.gif")); //$NON-NLS-1$
labels.add(Messages.OverviewPreferencesPage_CONNECTION_OPTIONS);
/* Notifier */
ids.add(NotifierPreferencesPage.ID);
images.add(OwlUI.getImage(fResources, "icons/elcl16/notification.gif")); //$NON-NLS-1$
labels.add(Messages.OverviewPreferencesPage_NOTIFIER_OPTIONS);
/* Labels */
ids.add(ManageLabelsPreferencePage.ID);
images.add(OwlUI.getImage(fResources, "icons/elcl16/labels.gif")); //$NON-NLS-1$
labels.add(Messages.OverviewPreferencesPage_LABEL_OPTIONS);
/* Passwords */
ids.add(CredentialsPreferencesPage.ID);
images.add(OwlUI.getImage(fResources, "icons/elcl16/passwords.gif")); //$NON-NLS-1$
labels.add(Messages.OverviewPreferencesPage_PASSWORD_OPTIONS);
/* Create */
for (int i = 0; i < ids.size(); i++) {
final String id = ids.get(i);
Label imgLabel = new Label(linkContainer, SWT.None);
imgLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true));
imgLabel.setImage(images.get(i));
Link link = new Link(linkContainer, SWT.None);
link.setText("<a>" + labels.get(i) + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
link.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
preferences.openPage(id, null);
}
});
}
/* Search Info Container */