Code Search for Developers
 
 
  

CheckAsFitProjectDialog.java from MASE: Agile Software Engineering at Krugle


Show CheckAsFitProjectDialog.java syntax highlighted

package ca.ucalgary.cpsc.ebe.fitClipse.dialogs;

import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

import ca.ucalgary.cpsc.ebe.fitClipse.connector.ServerConfiguration;
import ca.ucalgary.cpsc.ebe.fitClipse.connector.ServletConnector;
import ca.ucalgary.cpsc.ebe.fitClipse.runner.FITTestConfiguration;
import ca.ucalgary.cpsc.ebe.fitClipse.runner.FitManager;
import ca.ucalgary.cpsc.ebe.fitClipse.ui.properties.LoginPropertiesController;

public class CheckAsFitProjectDialog extends Dialog {

	IProject project = null;

	private Composite container = null;

	private CheckAsFitProjectController pageController = null;

	private ServerConfiguration config = null;

	private FITTestConfiguration FTconfig = null;
	
	//Server configuration

	private Group serverWidgetGroup = null;

	private Label lblHost = null;

	private Label lblWebPort = null;

	private Text txtHost = null;

	private Text txtWebPort = null;

	private Label lblBeanPort = null;

	private Text txtBeanPort = null;

	private Label lblUsername = null;

	private Text txtUsername = null;

	private Label lblPassword = null;

	private Text txtPassword = null;

	//class path & file directory
	private Group fitSettingsGroup = null;

	private Group classPathGroup = null;

	private List classPathList = null;

	private Button btnAddPath = null;

	private Button btnRemovePath = null;

	private Button btnBrowseClassPath = null;

	private Button btnBrowseTestLocation = null;

	private Button btnBrowseResultLocation = null;

	private Combo comboProjectPath = null;

	private Label lblTestLocation = null;

	private Label lblResultLocation = null;

	private Text txtTestLocation = null;

	private Text txtResultLocation = null;

	String selectedSrcDir = null;

	String SelectedResultDir = null;

	String selectedClassPathDir = null;

	private String filterPath = "C:\\";

	//FitClipse project

	private Group FITreferenceGroup = null;
	
	private Label label = null;

	private Text txtNameSpace = null;

	private Label lblWelcome = null;

	public CheckAsFitProjectDialog(Shell parentShell, IProject project) {
		super(parentShell);
		this.project = project;

		config = new ServerConfiguration();
		FTconfig = new FITTestConfiguration(project);
		//		System.out.println("dialog constructor + project: "+project.toString());
	}

	protected Control createDialogArea(Composite parent) {
		container = (Composite) super.createDialogArea(parent);
		pageController = new CheckAsFitProjectController(project);
		this.addChildControls(parent);
		return container;
	}

	private void addChildControls(Composite parent) {
		
		//create overall layout
		createFitClipseProjectGroup();
		createServerWidgetGroup();
		createClassPathGroup();
		createFitSettingsGroup();
		
		pageController.loadClassPath(classPathList, true);
		pageController.loadTestSourcePath(txtTestLocation, true);
		pageController.loadTestResultPath(txtResultLocation, true);
	}

	@Override
	protected void okPressed() {
		// TODO Auto-generated method stub
		config.setUsername(txtUsername.getText().trim());
		config.setPassword(txtPassword.getText().trim());
		config.setBeanPort(txtBeanPort.getText().trim());
		config.setHost(txtHost.getText().trim());
		config.setWebPort(txtWebPort.getText().trim());
		FTconfig.setClassPath(classPathList.getItems());
		FTconfig.setTestResultLoc(txtResultLocation.getText().trim());
		FTconfig.setTestSourceLoc(txtTestLocation.getText().trim());

		System.out.println("inside OK!");
		try {
			pageController.performOK(config, FTconfig, this.getShell(), txtNameSpace);
		} catch (Exception e) {
			e.printStackTrace();
		}
		super.okPressed();
	}

	private void createFitClipseProjectGroup() {
		
		GridData gridData1 = new org.eclipse.swt.layout.GridData();
		gridData1.grabExcessHorizontalSpace = false;
		gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
        
        FITreferenceGroup = new Group(container, SWT.NONE);
        FITreferenceGroup.setText("Wiki Namespace");
		
        label = new Label(FITreferenceGroup, SWT.NONE);
        label.setBounds(new org.eclipse.swt.graphics.Rectangle(45, 29, 230,
				13));
        label.setText("Wiki Namespace for this Project: ");
        txtNameSpace = new Text(FITreferenceGroup, SWT.BORDER);
        txtNameSpace.setBounds(new org.eclipse.swt.graphics.Rectangle(45,59,
				286, 19));
        
        pageController.loadNamespace(txtNameSpace);
		
	}
	
	private void createServerWidgetGroup() {
		ServletConnector servlet = ServletConnector.getServletConnector();
		GridData gridData1 = new org.eclipse.swt.layout.GridData();
		gridData1.grabExcessHorizontalSpace = false;
		gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
		serverWidgetGroup = new Group(container, SWT.NONE);
		serverWidgetGroup.setText("Server Connection");
		serverWidgetGroup.setLayoutData(gridData1);
		lblHost = new Label(serverWidgetGroup, SWT.NONE);
		lblHost
				.setBounds(new org.eclipse.swt.graphics.Rectangle(45, 29, 65,
						13));
		lblHost.setText("Host:");
		lblWebPort = new Label(serverWidgetGroup, SWT.NONE);
		lblWebPort.setBounds(new org.eclipse.swt.graphics.Rectangle(45, 59, 61,
				16));
		lblWebPort.setText("Web Port:");
		txtHost = new Text(serverWidgetGroup, SWT.BORDER);
		txtHost.setBounds(new org.eclipse.swt.graphics.Rectangle(120, 30, 211,
				19));
		txtWebPort = new Text(serverWidgetGroup, SWT.BORDER);
		txtWebPort.setBounds(new org.eclipse.swt.graphics.Rectangle(120, 59,
				66, 19));
		lblBeanPort = new Label(serverWidgetGroup, SWT.NONE);
		lblBeanPort.setBounds(new org.eclipse.swt.graphics.Rectangle(195, 59,
				59, 16));
		lblBeanPort.setText("Bean Port:");
		txtBeanPort = new Text(serverWidgetGroup, SWT.BORDER);
		txtBeanPort.setBounds(new org.eclipse.swt.graphics.Rectangle(255, 59,
				76, 19));
		lblUsername = new Label(serverWidgetGroup, SWT.NONE);
		lblUsername.setBounds(new org.eclipse.swt.graphics.Rectangle(45, 89,
				61, 13));
		lblUsername.setText("Username:");
		txtUsername = new Text(serverWidgetGroup, SWT.BORDER);
		txtUsername.setBounds(new org.eclipse.swt.graphics.Rectangle(119, 91,
				212, 19));
		lblPassword = new Label(serverWidgetGroup, SWT.NONE);
		lblPassword.setBounds(new org.eclipse.swt.graphics.Rectangle(47, 118,
				59, 13));
		lblPassword.setText("Password:");
		txtPassword = new Text(serverWidgetGroup, SWT.BORDER);
		txtPassword.setBounds(new org.eclipse.swt.graphics.Rectangle(120, 119,
				212, 19));

		pageController.loadHostValue(txtHost, false);
		pageController.loadBeanPortValue(txtBeanPort, false);
		pageController.loadWebPortValue(txtWebPort, false);
		pageController.loadUsernameValue(txtUsername, false);
		pageController.loadPasswordValue(txtPassword, false);
	}

	private void createClassPathGroup() {
		// TODO Auto-generated method stub

		GridData gridData = new org.eclipse.swt.layout.GridData();
		gridData.heightHint = -1;
		gridData.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
		gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
		classPathGroup = new Group(container, SWT.NONE);
		classPathGroup.setText("Class Path");
		classPathGroup.setLayoutData(gridData);
		classPathList = new List(classPathGroup, SWT.MULTI | SWT.FILL);
		classPathList.setBounds(new org.eclipse.swt.graphics.Rectangle(15, 15,
				288, 187));

		btnBrowseClassPath = new Button(classPathGroup, SWT.NONE);
		btnBrowseClassPath.setBounds(new org.eclipse.swt.graphics.Rectangle(
				315, 210, 80, 19));
		btnBrowseClassPath.setText("Browse");
		btnBrowseClassPath.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				DirectoryDialog directoryDialog = new DirectoryDialog(container
						.getShell());
				directoryDialog.setFilterPath(filterPath);
				directoryDialog
						.setMessage("Please select the location for Test Results and click OK");
				String dir = directoryDialog.open();
				if (dir != null) {
					selectedClassPathDir = dir;
					filterPath = dir;
					comboProjectPath.setText(selectedClassPathDir);
				}
			}

		});

		btnAddPath = new Button(classPathGroup, SWT.NONE);
		btnAddPath.setBounds(new org.eclipse.swt.graphics.Rectangle(400, 210,
				80, 19));
		btnAddPath.setText("Add Path");
		btnAddPath.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				String classPath = comboProjectPath.getText().trim();
				classPathList.add(classPath);
			}
		});

		btnRemovePath = new Button(classPathGroup, SWT.NONE);
		btnRemovePath.setBounds(new org.eclipse.swt.graphics.Rectangle(315, 15,
				91, 23));
		btnRemovePath.setText("Remove Path");
		btnRemovePath.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				String[] paths = classPathList.getSelection();
				FitManager Fit = FitManager.getFitManager();
				for (String s : paths) {
					classPathList.remove(s);
					Fit.removeClassPath(s);

				}
			}
		});

		createComboProjectPath();
	}

	private void createComboProjectPath() {
		comboProjectPath = new Combo(classPathGroup, SWT.NONE);
		comboProjectPath.setBounds(new org.eclipse.swt.graphics.Rectangle(15,
				210, 286, 16));
	}

	private void createFitSettingsGroup() {

		fitSettingsGroup = new Group(container, SWT.NONE);
		fitSettingsGroup.setText("Fit Resources Location");
		lblTestLocation = new Label(fitSettingsGroup, SWT.NONE);
		lblTestLocation.setBounds(new org.eclipse.swt.graphics.Rectangle(9, 16,
				67, 13));
		lblTestLocation.setText("Test Location");
		txtTestLocation = new Text(fitSettingsGroup, SWT.BORDER);
		txtTestLocation.setBounds(new org.eclipse.swt.graphics.Rectangle(105,
				15, 196, 19));
		btnBrowseTestLocation = new Button(fitSettingsGroup, SWT.NONE);
		btnBrowseTestLocation.setBounds(new org.eclipse.swt.graphics.Rectangle(
				315, 15, 91, 19));
		btnBrowseTestLocation.setText("Browse");
		btnBrowseTestLocation.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				DirectoryDialog directoryDialog = new DirectoryDialog(container
						.getShell());
				directoryDialog.setFilterPath(filterPath);
				directoryDialog
						.setMessage("Please select the location for Fit Tests and click OK");
				String dir = directoryDialog.open();
				if (dir != null) {
					selectedSrcDir = dir;
					filterPath = dir;
					txtTestLocation.setText(selectedSrcDir);
				}
			}

		});
		lblResultLocation = new Label(fitSettingsGroup, SWT.NONE);
		lblResultLocation.setBounds(new org.eclipse.swt.graphics.Rectangle(9,
				38, 82, 16));
		lblResultLocation.setText("Result Location");
		txtResultLocation = new Text(fitSettingsGroup, SWT.BORDER);
		txtResultLocation.setBounds(new org.eclipse.swt.graphics.Rectangle(105,
				38, 196, 19));
		btnBrowseResultLocation = new Button(fitSettingsGroup, SWT.NONE);
		btnBrowseResultLocation
				.setBounds(new org.eclipse.swt.graphics.Rectangle(315, 38, 91,
						19));
		btnBrowseResultLocation.setText("Browse");
		btnBrowseResultLocation.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				DirectoryDialog directoryDialog = new DirectoryDialog(container
						.getShell());
				directoryDialog.setFilterPath(filterPath);
				directoryDialog
						.setMessage("Please select the location for Test Results and click OK");
				String dir = directoryDialog.open();
				if (dir != null) {
					SelectedResultDir = dir;
					filterPath = dir;
					txtResultLocation.setText(SelectedResultDir);
				}
			}

		});
	}

}




See more files for this project here

MASE: Agile Software Engineering

The MASE project investigates methods to support the coordination and executable acceptance testing of software projects. Keywords: Agile methods, distributed teams, Extreme Programming. See http://ebe.cpsc.ucalgary.ca/ebe for more information.

Project homepage: http://sourceforge.net/projects/mase
Programming language(s): Java,XML
License: other

  CheckAsFitProjectController.java
  CheckAsFitProjectDialog.java