Skip to content

Commit

Permalink
Move Java package label to the left of input text in Maven project wi…
Browse files Browse the repository at this point in the history
…zard (#1147)
  • Loading branch information
chanseokoh authored Dec 19, 2016
1 parent 90b9a17 commit 28f32d8
Showing 1 changed file with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
Expand All @@ -58,7 +57,7 @@
import org.eclipse.ui.PlatformUI;

/**
* UI to collect all information necessary to create a new Maven-based App Engine Standard
* UI to collect all information necessary to create a new Maven-based App Engine Standard
* environment Java project.
*/
public class MavenAppEngineStandardWizardPage extends WizardPage {
Expand Down Expand Up @@ -114,9 +113,10 @@ public void createControl(Composite parent) {
PlatformUI.getWorkbench().getHelpSystem().setHelp(container,
"com.google.cloud.tools.eclipse.appengine.newproject.maven.NewMavenProjectContext"); //$NON-NLS-1$

createLocationArea(container);
createMavenCoordinatesArea(container);
createAppEngineProjectDetailsArea(container);
ModifyListener pageValidator = new PageValidator();
createLocationArea(container, pageValidator);
createMavenCoordinatesArea(container, pageValidator);
createAppEngineProjectDetailsArea(container, pageValidator);
appEngineLibrariesSelectorGroup = new AppEngineLibrariesSelectorGroup(container);
appEngineLibrariesSelectorGroup.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
Expand All @@ -129,20 +129,19 @@ public void selectionChanged(SelectionChangedEvent event) {
}

/** Create UI for specifying the generated location area */
private void createLocationArea(Composite container) {
ModifyListener pageValidator = new PageValidator();
private void createLocationArea(Composite container, ModifyListener pageValidator) {

Group locationGroup = new Group(container, SWT.NONE);
locationGroup.setText(Messages.getString("LOCATION_GROUP_TEXT")); //$NON-NLS-1$
GridDataFactory.fillDefaults().span(2, 1).applyTo(locationGroup);
GridLayoutFactory.swtDefaults().numColumns(3).applyTo(locationGroup);

useDefaults = new Button(locationGroup, SWT.CHECK);
useDefaults = new Button(locationGroup, SWT.CHECK | SWT.LEAD);
GridDataFactory.defaultsFor(useDefaults).span(3, 1).applyTo(useDefaults);
useDefaults.setText(Messages.getString("CREATE_PROJECT_IN_WORKSPACE")); //$NON-NLS-1$
useDefaults.setSelection(true);

Label locationLabel = new Label(locationGroup, SWT.NONE);
Label locationLabel = new Label(locationGroup, SWT.LEAD);
locationLabel.setText(Messages.getString("LOCATION_LABEL")); //$NON-NLS-1$
locationLabel.setToolTipText(Messages.getString("LOCATION_TOOL_TIP")); //$NON-NLS-1$

Expand Down Expand Up @@ -182,15 +181,13 @@ public void widgetSelected(SelectionEvent event) {
}

/** Create UI for specifying desired Maven Coordinates */
private void createMavenCoordinatesArea(Composite container) {
ModifyListener pageValidator = new PageValidator();

private void createMavenCoordinatesArea(Composite container, ModifyListener pageValidator) {
Group mavenCoordinatesGroup = new Group(container, SWT.NONE);
mavenCoordinatesGroup.setText(Messages.getString("MAVEN_PROJECT_COORDINATES")); //$NON-NLS-1$
GridDataFactory.defaultsFor(mavenCoordinatesGroup).span(2, 1).applyTo(mavenCoordinatesGroup);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(mavenCoordinatesGroup);

Label groupIdLabel = new Label(mavenCoordinatesGroup, SWT.NONE);
Label groupIdLabel = new Label(mavenCoordinatesGroup, SWT.LEAD);
groupIdLabel.setText(Messages.getString("GROUP_ID")); //$NON-NLS-1$
groupIdField = new Text(mavenCoordinatesGroup, SWT.BORDER);
groupIdField.setToolTipText(Messages.getString("GROUP_ID_TOOLTIP")); //$NON-NLS-1$
Expand All @@ -199,16 +196,16 @@ private void createMavenCoordinatesArea(Composite container) {
groupIdField.addModifyListener(pageValidator);
groupIdField.addModifyListener(new AutoPackageNameSetterOnGroupIdChange());

Label artifactIdLabel = new Label(mavenCoordinatesGroup, SWT.NONE);
Label artifactIdLabel = new Label(mavenCoordinatesGroup, SWT.LEAD);
artifactIdLabel.setText(Messages.getString("ARTIFACT_ID")); //$NON-NLS-1$
artifactIdField = new Text(mavenCoordinatesGroup, SWT.BORDER);
artifactIdField.setToolTipText(Messages.getString("ARTIFACT_ID_TOOLTIP")); //$NON-NLS-1$

GridDataFactory.defaultsFor(artifactIdField).align(SWT.FILL, SWT.CENTER)
.applyTo(artifactIdField);
artifactIdField.addModifyListener(pageValidator);

Label versionLabel = new Label(mavenCoordinatesGroup, SWT.NONE);
Label versionLabel = new Label(mavenCoordinatesGroup, SWT.LEAD);
versionLabel.setText(Messages.getString("ARTIFACT_VERSION")); //$NON-NLS-1$
versionField = new Text(mavenCoordinatesGroup, SWT.BORDER);
versionField.setText(defaultVersion);
Expand All @@ -217,16 +214,16 @@ private void createMavenCoordinatesArea(Composite container) {
}

/** Create UI for specifying App Engine project details */
private void createAppEngineProjectDetailsArea(Composite container) {
ModifyListener pageValidator = new PageValidator();
private void createAppEngineProjectDetailsArea(Composite container,
ModifyListener pageValidator) {
Composite composite = new Composite(container, SWT.NONE);
// assumed that container has a two-column GridLayout
GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(composite);

// Java package name
Label packageNameLabel = new Label(container, SWT.NONE);
Label packageNameLabel = new Label(composite, SWT.LEAD);
packageNameLabel.setText(Messages.getString("JAVA_PACKAGE_LABEL")); //$NON-NLS-1$
javaPackageField = new Text(container, SWT.BORDER);
GridData javaPackagePosition = new GridData(GridData.FILL_HORIZONTAL);
javaPackagePosition.horizontalSpan = 2;
javaPackageField.setLayoutData(javaPackagePosition);
javaPackageField = new Text(composite, SWT.BORDER);
javaPackageField.addModifyListener(pageValidator);
javaPackageField.addVerifyListener(new VerifyListener() {

Expand All @@ -238,6 +235,9 @@ public void verifyText(VerifyEvent event) {
}
}
});

GridDataFactory.fillDefaults().grab(true, false).applyTo(javaPackageField);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(composite);
}

private void openLocationDialog() {
Expand Down

0 comments on commit 28f32d8

Please sign in to comment.