package edu.oregonstate.cope.eclipse.ui.handlers;

import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class ProjectSelectionPage extends Dialog {

	private List<String> projects;

	public ProjectSelectionPage(Shell parentShell, List<String> projects) {
		super(parentShell);
		this.projects = projects;
	}

	@Override
	protected Control createContents(Composite parent) {
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setLayout(new GridLayout(1, true));
		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		composite.setSize(400, 600);
		Label label = new Label(composite, SWT.BORDER);	
		label.setText("Please select the project you would like us to record");
		
		Composite buttonsParent = new Composite(composite, SWT.NONE);
		buttonsParent.setLayout(new GridLayout(2, false));
		buttonsParent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		Button selectAll = new Button(buttonsParent, SWT.NONE);
		selectAll.setText("Select all");
		Button selectNone = new Button(buttonsParent, SWT.NONE);
		selectNone.setText("Select none");
		return composite;
	}
}

@@ -65,14 +65,43 @@
 til.
+Array
 List;%0A
+import java.util.List;%0A%0A
 impo
@@ -443,16 +443,140 @@
 s.Shell;
+%0Aimport org.eclipse.swt.widgets.Table;%0Aimport org.eclipse.swt.widgets.TableColumn;%0Aimport org.eclipse.swt.widgets.TableItem;
 %0A%0Apublic
@@ -1566,16 +1566,16 @@
 none%22);%0A
-
 %09%09return
@@ -1586,13 +1586,807 @@
 posite;%0A
+%09%09%0A%09%09Composite projectList = new Composite(composite, SWT.BORDER);%0A%09%09projectList.setLayout(new GridLayout(1, true));%0A%09%09projectList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));%0A%09%09%0A%09%09Table table = new Table(projectList, SWT.CHECK %7C SWT.BORDER %7C SWT.V_SCROLL);%0A%09%09table.setLayout(new GridLayout(1,true));%0A%09%09table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));%0A%09%09table.setHeaderVisible(false);%0A%09%09TableColumn tableColumn = new TableColumn(table, SWT.NONE);%0A%09%09tableColumn.setText(%22Project%22);%0A%09%09%0A%09%09List%3CTableItem%3E tableItems = new ArrayList%3CTableItem%3E();%0A%09%09for (String project : projects) %7B%0A%09%09%09TableItem tableItem = new TableItem(table, SWT.NONE);%0A%09%09%09tableItem.setText(project);%0A%09%09%09tableItem.setChecked(true);%0A%09%09%09tableItems.add(tableItem);%0A%09%09%7D%0A%09%09%0A%09%09tableColumn.pack();%0A%09%09%0A
 %09%7D%0A%7D%0A

Building the table of projects