package com.googlecode.jslint4java.eclipse.ui.preferences;

import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import com.googlecode.jslint4java.eclipse.ui.JSLintUIPlugin;

/**
 * This class represents a preference page that is contributed to the Preferences dialog. By
 * subclassing <samp>FieldEditorPreferencePage</samp>, we can use the field support built into JFace
 * that allows us to create a page that is small and knows how to save, restore and apply itself.
 * <p>
 * This page is used to modify preferences only. They are stored in the preference store that
 * belongs to the main plug-in class. That way, preferences can be accessed directly via the
 * preference store.
 * <p>
 * TODO: trigger a rebuild on change.
 */
public class OptionsPreferencePage extends PreferencePage implements
        IWorkbenchPreferencePage {

    public OptionsPreferencePage() {
        super("jslint4java");
        setPreferenceStore(JSLintUIPlugin.getDefault().getPreferenceStore());
    }

    public void init(IWorkbench workbench) {
    }

    @Override
    protected Control createContents(Composite parent) {
        Font font = parent.getFont();

        Composite main = new Composite(parent, SWT.NULL);
        main.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        GridLayout layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        main.setLayout(layout);
        main.setFont(font);

        Label info = new Label(main, SWT.NONE);
        info.setText("nothing to see here");
        info.setFont(font);
        return main;
    }

}
@@ -64,51 +64,311 @@
 ort 
-org.eclipse.jface.preference.PreferencePage
+java.util.Arrays;%0Aimport java.util.Collections;%0A%0Aimport org.eclipse.jface.preference.PreferencePage;%0Aimport org.eclipse.jface.viewers.CheckboxTableViewer;%0Aimport org.eclipse.jface.viewers.IStructuredContentProvider;%0Aimport org.eclipse.jface.viewers.LabelProvider;%0Aimport org.eclipse.jface.viewers.Viewer
 ;%0Aim
@@ -716,16 +716,58 @@
 ePage;%0A%0A
+import com.googlecode.jslint4java.Option;%0A
 import c
@@ -1448,24 +1448,16 @@
 plements
-%0A       
  IWorkbe
@@ -1477,16 +1477,65 @@
 Page %7B%0A%0A
+    private CheckboxTableViewer checkboxViewer;%0A%0A
     publ
@@ -2294,28 +2294,1967 @@
 t);%0A
-        return main;
+%0A        createBooleansArea(main);%0A%0A        return main;%0A    %7D%0A%0A    private void createBooleansArea(Composite main) %7B%0A        Font mainFont = main.getFont();%0A        Composite booleansParent = new Composite(main, SWT.NONE);%0A        booleansParent.setLayoutData(new GridData(GridData.FILL_BOTH));%0A        GridLayout decoratorsLayout = new GridLayout();%0A        decoratorsLayout.marginWidth = 0;%0A        decoratorsLayout.marginHeight = 0;%0A        booleansParent.setLayout(decoratorsLayout);%0A        booleansParent.setFont(mainFont);%0A%0A        Label decoratorsLabel = new Label(booleansParent, SWT.NONE);%0A        decoratorsLabel.setText(%22Toggleable options:%22);%0A        decoratorsLabel.setFont(mainFont);%0A%0A        checkboxViewer = CheckboxTableViewer.newCheckList(booleansParent, SWT.SINGLE %7C SWT.TOP%0A                %7C SWT.BORDER);%0A        checkboxViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));%0A        checkboxViewer.getTable().setFont(booleansParent.getFont());%0A        checkboxViewer.setLabelProvider(new LabelProvider() %7B%0A            @Override%0A            public String getText(Object element) %7B%0A                return ((Option) element).getDescription();%0A            %7D%0A        %7D);%0A        checkboxViewer.getTable().setFont(mainFont);%0A%0A        checkboxViewer.setContentProvider(new IStructuredContentProvider() %7B%0A            public void dispose() %7B%0A                // Nothing to do on dispose%0A            %7D%0A%0A            public void inputChanged(Viewer viewer, Object oldInput, Object newInput) %7B%0A            %7D%0A%0A            public Object%5B%5D getElements(Object inputElement) %7B%0A                // Make an entry for each option%0A                Option%5B%5D elements = (Option%5B%5D) inputElement;%0A                Option%5B%5D results = new Option%5Belements.length%5D;%0A                System.arraycopy(elements, 0, results, 0, elements.length);%0A                Collections.sort(Arrays.asList(results));%0A                return results;%0A            %7D%0A        %7D);%0A
 %0A   

Create the Booleans table.