Skip to content
Snippets Groups Projects
Commit 75fadfc0 authored by Alvaro Fides's avatar Alvaro Fides
Browse files

added comments

parent 15fa9d97
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,9 @@ import org.eclipse.ui.wizards.IWizardDescriptor;
public class NewProjectCommandHandler extends AbstractHandler {
//Executed when command is called
public Object execute(ExecutionEvent event) throws ExecutionException {
//Get the wizard by its name
IWizardDescriptor descriptor = PlatformUI
.getWorkbench()
.getNewWizardRegistry()
......@@ -22,6 +24,7 @@ public class NewProjectCommandHandler extends AbstractHandler {
"org.universaal.tools.newwizard.plugin.wizards.NewProjectWizard");
try {
//Get the current (the main) window and start the wizard
IWorkbenchWindow window = HandlerUtil
.getActiveWorkbenchWindowChecked(event);
if (descriptor != null) {
......@@ -30,7 +33,6 @@ public class NewProjectCommandHandler extends AbstractHandler {
wd.setTitle(wizard.getWindowTitle());
wd.open();
} else {
MessageDialog.openInformation(window.getShell(), "New Project",
"Could not find the New Project Wizard");
}
......
......@@ -12,9 +12,9 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
* The "New" wizard page allows setting the container for the new file as well
* as the file name. The page will only accept file name without the extension
* OR with the extension that matches the expected one (mpe).
* The first wizard page allows setting the details for the project, represented
* by the basic data for the maven POM, the name of the project and the
* description.
*/
public class NewProjectWizardPage1 extends WizardPage {
......@@ -26,7 +26,7 @@ public class NewProjectWizardPage1 extends WizardPage {
private Text description;
/**
* Constructor for SampleNewWizardPage.
* Constructor for NewProjectWizardPage1.
*
* @param pageName
*/
......@@ -45,7 +45,7 @@ public class NewProjectWizardPage1 extends WizardPage {
container.setLayout(layout);
layout.numColumns = 2;
layout.verticalSpacing = 9;
//Group Id
Label label1 = new Label(container, SWT.NULL);
label1.setText(Messages.getString("Page1.1")); //$NON-NLS-1$
groupId = new Text(container, SWT.BORDER | SWT.SINGLE);
......@@ -56,7 +56,7 @@ public class NewProjectWizardPage1 extends WizardPage {
validate();
}
});
//Artifact Id
Label label2 = new Label(container, SWT.NULL);
label2.setText(Messages.getString("Page1.2")); //$NON-NLS-1$
artifactId = new Text(container, SWT.BORDER | SWT.SINGLE);
......@@ -67,7 +67,7 @@ public class NewProjectWizardPage1 extends WizardPage {
validate();
}
});
//Version
Label label3 = new Label(container, SWT.NULL);
label3.setText(Messages.getString("Page1.3")); //$NON-NLS-1$
version = new Text(container, SWT.BORDER | SWT.SINGLE);
......@@ -78,7 +78,7 @@ public class NewProjectWizardPage1 extends WizardPage {
validate();
}
});
//Name
Label label4 = new Label(container, SWT.NULL);
label4.setText(Messages.getString("Page1.4")); //$NON-NLS-1$
name = new Text(container, SWT.BORDER | SWT.SINGLE);
......@@ -86,10 +86,10 @@ public class NewProjectWizardPage1 extends WizardPage {
name.setLayoutData(gd4);
name.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
//TODO
//TODO: Need to validate the name?
}
});
//Description
Label label5 = new Label(container, SWT.NULL);
label5.setText(Messages.getString("Page1.5")); //$NON-NLS-1$
description = new Text(container, SWT.V_SCROLL | SWT.BORDER | SWT.WRAP );
......@@ -98,7 +98,7 @@ public class NewProjectWizardPage1 extends WizardPage {
description.setLayoutData(gd5);
description.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
//TODO
//TODO: Need to validate description?
}
});
......@@ -107,6 +107,7 @@ public class NewProjectWizardPage1 extends WizardPage {
}
void validate() {
//These must not be empty
if(groupId.getText().trim().length() == 0) {
setErrorMessage(Messages.getString("Page1.6")); //$NON-NLS-1$
setPageComplete(false);
......
......@@ -18,9 +18,9 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.jdt.core.JavaConventions;
/**
* The "New" wizard page allows setting the container for the new file as well
* as the file name. The page will only accept file name without the extension
* OR with the extension that matches the expected one (mpe).
* The second wizard page allows setting the name of the root package, where
* all wrapper classes will be created. The wrapper classes can be selected in
* this page, depending on what buses do you want the project to connect to.
*/
public class NewProjectWizardPage2 extends WizardPage {
......@@ -34,7 +34,7 @@ public class NewProjectWizardPage2 extends WizardPage {
private Text packaging;
/**
* Constructor for SampleNewWizardPage.
* Constructor for NewProjectWizardPage2.
*
* @param pageName
*/
......@@ -53,14 +53,14 @@ public class NewProjectWizardPage2 extends WizardPage {
containerP.setLayout(layoutP);
layoutP.numColumns = 1;
layoutP.verticalSpacing = 9;
//First layout with the name of the package
Composite container2 = new Composite(containerP, SWT.NULL);
GridLayout layout2 = new GridLayout();
container2.setLayout(layout2);
container2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
layout2.numColumns = 2;
layout2.verticalSpacing = 9;
//Name of the package
Label label4 = new Label(container2, SWT.NULL);
label4.setText(Messages.getString("Page2.2")); //$NON-NLS-1$
packaging = new Text(container2, SWT.BORDER | SWT.SINGLE);
......@@ -71,7 +71,7 @@ public class NewProjectWizardPage2 extends WizardPage {
validateInput();
}
});
//Second layout with the checkboxes of classes
Group container = new Group(containerP, SWT.NONE);
container.setText(Messages.getString("Page2.3")); //$NON-NLS-1$
GridLayout layout = new GridLayout();
......@@ -79,67 +79,65 @@ public class NewProjectWizardPage2 extends WizardPage {
container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_CENTER));
layout.numColumns = 2;
layout.verticalSpacing = 9;
//CSubscriber
csubscriber = new Button(container, SWT.CHECK);
GridData gd1 = new GridData(GridData.FILL_HORIZONTAL);
csubscriber.setLayoutData(gd1);
csubscriber.setText(Messages.getString("Page2.4")); //$NON-NLS-1$
csubscriber.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//TODO
//TODO: Do we really need to do something here?
}
});
//CPublisher
cpublisher = new Button(container, SWT.CHECK);
GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
cpublisher.setLayoutData(gd2);
cpublisher.setText(Messages.getString("Page2.5")); //$NON-NLS-1$
cpublisher.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//TODO
//TODO: Do we really need to do something here?
}
});
//SCallee
scallee = new Button(container, SWT.CHECK);
GridData gd3 = new GridData(GridData.FILL_HORIZONTAL);
scallee.setLayoutData(gd3);
scallee.setText(Messages.getString("Page2.7")); //$NON-NLS-1$
scallee.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//TODO
//TODO: Do we really need to do something here?
}
});
//SCaller
scaller = new Button(container, SWT.CHECK);
GridData gd4 = new GridData(GridData.FILL_HORIZONTAL);
scaller.setLayoutData(gd4);
scaller.setText(Messages.getString("Page2.6")); //$NON-NLS-1$
scaller.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//TODO
//TODO: Do we really need to do something here?
}
});
//ISubscriber
isubscriber = new Button(container, SWT.CHECK);
GridData gd5 = new GridData(GridData.FILL_HORIZONTAL);
isubscriber.setLayoutData(gd5);
isubscriber.setText(Messages.getString("Page2.9")); //$NON-NLS-1$
isubscriber.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//TODO
//TODO: Do we really need to do something here?
}
});
//OPublisher
opublisher = new Button(container, SWT.CHECK);
GridData gd6 = new GridData(GridData.FILL_HORIZONTAL);
opublisher.setLayoutData(gd6);
opublisher.setText(Messages.getString("Page2.8")); //$NON-NLS-1$
opublisher.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//TODO
//TODO: Do we really need to do something here?
}
});
......@@ -148,7 +146,9 @@ public class NewProjectWizardPage2 extends WizardPage {
}
/**
* Ensures that text fields are set.
* Ensures that package field is set and compliant with Java.
* Uses deprecated validatePackageName method.
* Didnt find the new alternative.
*/
private void validateInput() {
......@@ -156,6 +156,7 @@ public class NewProjectWizardPage2 extends WizardPage {
if(packageName.trim().length() != 0) {
// @SuppressWarnings("deprecation")
IStatus status = JavaConventions.validatePackageName(packageName);
//TODO: Use new method to check package naming.
if(!status.isOK()) {
setErrorMessage(status.getMessage());
setPageComplete(false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment