Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2010-04-23 15:23:16 +0000
committerkmoore2010-04-23 15:23:16 +0000
commit2df056658f423af9ff0e23b45472019b5fe3aa45 (patch)
tree596e96ba14cee3951f10e4ff435525945d3fd8f0
parent54a780b5941c54324a12250e1f48c174662c5b62 (diff)
downloadwebtools.dali-2df056658f423af9ff0e23b45472019b5fe3aa45.tar.gz
webtools.dali-2df056658f423af9ff0e23b45472019b5fe3aa45.tar.xz
webtools.dali-2df056658f423af9ff0e23b45472019b5fe3aa45.zip
cleaned up jaxb schema and class gen wizards
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/ProjectWizardPage.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java69
5 files changed, 98 insertions, 98 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties b/jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties
index 49d0199ef4..e034e5ae0a 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties
@@ -14,12 +14,11 @@ ClassesGeneratorWizard_title = JAXB Class Generation
ClassesGeneratorWizard_errorDialogTitle = Generate Classes Failed
ClassesGeneratorWizard_couldNotCreate = Could not create {0}
-ClassesGeneratorWizardPage_title = Generate Classes From: {0}
+ClassesGeneratorWizardPage_title = Generate Classes from Schema: {0}
ClassesGeneratorWizardPage_desc = Configure JAXB class generation.
ClassesGeneratorWizardPage_usesMoxyImplementation = Use EclipseLink MOXy as the JAXB implementation
-ClassesGeneratorWizardPage_settingsGroupTitle = JAXB settings
ClassesGeneratorWizardPage_catalog = Catalog:
ClassesGeneratorWizardPage_bindingsFiles = Bindings files:
ClassesGeneratorWizardPage_addButton = Add...
@@ -39,21 +38,20 @@ SchemaGeneratorWizard_title = JAXB Schema Generation
SchemaGeneratorWizard_generatingSchema = Generating Schema
-ProjectWizardPage_desc = Select which Project the classes come from.
+ProjectWizardPage_desc = Select a Java project.
ProjectWizardPage_project = Project:
-SchemaGeneratorWizardPage_title = Generate Schema From Classes
-SchemaGeneratorWizardPage_desc = Select which classes should be included in the schema.
+SchemaGeneratorWizardPage_title = Generate Schema from Classes
+SchemaGeneratorWizardPage_desc = Select schema location and included classes.
-SchemaGeneratorWizardPage_settingsGoupTitle = JAXB settings
SchemaGeneratorWizardPage_shemaLocation = Schema location:
SchemaGeneratorWizardPage_shema = Schema name:
-SchemaGeneratorWizardPage_packages = Select the packages to be included in the schema:
+SchemaGeneratorWizardPage_packages = Select the classes to include in the schema:
SchemaGeneratorWizardPage_browse = Browse...
SchemaGeneratorWizardPage_directoryDialogTitle = Schema Location
SchemaGeneratorWizardPage_directoryDialogDesc = Choose a folder for the generated schema.
SchemaGeneratorWizardPage_errorNoSchema = Schema name cannot be empty
-SchemaGeneratorWizardPage_errorNoPackage = No package checked
+SchemaGeneratorWizardPage_errorNoPackage = No classes included
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java
index bb5901cb53..60de25f533 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java
@@ -28,7 +28,6 @@ public class JptJaxbUiMessages {
public static String ClassesGeneratorWizardPage_usesMoxyImplementation;
- public static String ClassesGeneratorWizardPage_settingsGroupTitle;
public static String ClassesGeneratorWizardPage_catalog;
public static String ClassesGeneratorWizardPage_bindingsFiles;
public static String ClassesGeneratorWizardPage_addButton;
@@ -49,7 +48,6 @@ public class JptJaxbUiMessages {
public static String SchemaGeneratorWizardPage_title;
public static String SchemaGeneratorWizardPage_desc;
- public static String SchemaGeneratorWizardPage_settingsGoupTitle;
public static String SchemaGeneratorWizardPage_shemaLocation;
public static String SchemaGeneratorWizardPage_shema;
public static String SchemaGeneratorWizardPage_packages;
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java
index 9b178dc1ed..e2ed31bd3a 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java
@@ -49,7 +49,6 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
@@ -114,7 +113,10 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
private Button buildUsesMoxyCheckBox(Composite parent) {
- Button checkBox = new Button(parent, SWT.CHECK);
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 10;
+ checkBox.setLayoutData(gridData);
checkBox.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_usesMoxyImplementation);
checkBox.setSelection(this.usesMoxy());
checkBox.addSelectionListener(this.buildUsesMoxySelectionListener());
@@ -286,28 +288,41 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
// ********** constructor **********
- private SettingsGroup(Composite composite) {
+ private SettingsGroup(Composite parent) {
super();
- Group group = new Group(composite, SWT.NONE);
- group.setLayout(new GridLayout(4, false)); // false = do not make columns equal width
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- group.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_settingsGroupTitle);
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(4, false); //must be 4 for the package controls
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, JpaHelpContextIds.XXX);
// Source folder
- createContainerControls(group, 4);
+ createContainerControls(composite, 4);
// Package
- createPackageControls(group, 4);
+ createPackageControls(composite, 4);
+
+ Label label = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 4, 1);
+ gridData.verticalIndent = 5;
+ label.setLayoutData(gridData);
// Catalog
- this.buildLabel(group, 1, JptJaxbUiMessages.ClassesGeneratorWizardPage_catalog);
- this.catalogText = this.buildText(group);
+ Label catalogLabel = new Label(composite, SWT.NONE);
+ catalogLabel.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_catalog);
+ gridData = new GridData();
+ gridData.verticalIndent = 5;
+ catalogLabel.setLayoutData(gridData);
+ this.catalogText = this.buildCatalogText(composite);
// Bindings files
this.bindingsFileNames = new ArrayList<String>();
- this.buildLabel(group, 1, JptJaxbUiMessages.ClassesGeneratorWizardPage_bindingsFiles);
- this.buildBindingsFileTable(group);
+ Label bindingsFileLabel = new Label(composite, SWT.NONE);
+ bindingsFileLabel.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_bindingsFiles);
+ bindingsFileLabel.setLayoutData(new GridData());
+ this.buildBindingsFileTable(composite);
}
// ********** intra-wizard methods **********
@@ -322,22 +337,15 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
// ********** UI components **********
- private Label buildLabel(Composite parent, int span, String text) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(text);
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- label.setLayoutData(gd);
- return label;
- }
-
- private Text buildText(Composite parent) {
-
+ private Text buildCatalogText(Composite parent) {
Text text = new Text(parent, SWT.BORDER);
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- //Filler columns
- new Label(parent, SWT.NONE);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 2;
+ gridData.verticalIndent = 5;
+ text.setLayoutData(gridData);
+ //Filler column
new Label(parent, SWT.NONE);
+
return text;
}
@@ -361,8 +369,8 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
column.setResizable(true);
GridData gridData= new GridData(GridData.FILL_BOTH);
+ gridData.horizontalSpan = 2;
gridData.heightHint= SWTUtil.getTableHeightHint(table, 3);
- gridData.widthHint = 300;
tableLayout.setLayoutData(gridData);
TableViewer tableViewer = new TableViewer(table);
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/ProjectWizardPage.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/ProjectWizardPage.java
index e0aff13603..292342d188 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/ProjectWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/ProjectWizardPage.java
@@ -29,6 +29,7 @@ import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
@@ -60,7 +61,7 @@ public class ProjectWizardPage extends WizardPage
private Control buildTopLevelControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
+ composite.setLayout(new FillLayout());
this.projectGroup = new ProjectGroup(composite);
Dialog.applyDialogFont(parent);
// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID);
@@ -102,15 +103,12 @@ public class ProjectWizardPage extends WizardPage
private ProjectGroup(Composite parent) {
super();
-
Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout(3, false));
- composite.setLayoutData(
- new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
+ composite.setLayout(new GridLayout(2, false));
+
// Project
- this.buildLabel(composite, 1, JptJaxbUiMessages.ProjectWizardPage_project);
- this.projectCombo = this.buildProjectCombo(composite, 2, this.buildProjectComboSelectionListener());
+ this.buildLabel(composite, JptJaxbUiMessages.ProjectWizardPage_project);
+ this.projectCombo = this.buildProjectCombo(composite, this.buildProjectComboSelectionListener());
this.updateProjectCombo();
setPageComplete(false);
@@ -170,9 +168,10 @@ public class ProjectWizardPage extends WizardPage
private Iterable<IProject> getJavaProjects() {
return new FilteringIterable<IProject>(CollectionTools.collection(this.getProjects())) {
+ @Override
protected boolean accept(IProject next) {
try {
- return ((IProject)next).hasNature(JavaCore.NATURE_ID);
+ return next.hasNature(JavaCore.NATURE_ID);
}
catch (CoreException e) {
return false;
@@ -182,10 +181,10 @@ public class ProjectWizardPage extends WizardPage
}
private Iterator<IProject> getProjects() {
- return new ArrayIterator<IProject>(this.sortedProject());
+ return new ArrayIterator<IProject>(this.sortedProjects());
}
- private IProject[] sortedProject() {
+ private IProject[] sortedProjects() {
return ArrayTools.sort(ResourcesPlugin.getWorkspace().getRoot().getProjects(), this.projectNameComparator());
}
@@ -200,31 +199,21 @@ public class ProjectWizardPage extends WizardPage
// ********** UI components **********
- private Label buildLabel(Composite parent, int horizontalSpan, String text) {
+ private Label buildLabel(Composite parent, String text) {
Label label = new Label(parent, SWT.LEFT);
+ label.setLayoutData(new GridData());
label.setText(text);
- GridData gridData = new GridData();
- gridData.horizontalSpan = horizontalSpan;
- label.setLayoutData(gridData);
return label;
}
- private Combo buildProjectCombo(Composite parent, int horizontalSpan, SelectionListener listener) {
-
- Combo projectCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- projectCombo.addSelectionListener(listener);
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = horizontalSpan;
- gridData.widthHint = 300;
+ private Combo buildProjectCombo(Composite parent, SelectionListener listener) {
+ Combo projectCombo = new Combo(parent, SWT.READ_ONLY);
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = SWT.FILL;
+ gridData.grabExcessHorizontalSpace = true;
projectCombo.setLayoutData(gridData);
-
- this.buildFillerColumn(parent);
+ projectCombo.addSelectionListener(listener);
return projectCombo;
}
-
- private Label buildFillerColumn(Composite parent) {
- return new Label(parent, SWT.NONE);
- }
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java
index 3541ff41dd..93c1a63966 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java
@@ -58,7 +58,6 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeItem;
@@ -122,6 +121,7 @@ public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage
return complete;
}
+ @Override
public void setPreviousPage(IWizardPage page) {
super.setPreviousPage(page);
if(this.getControl() != null)
@@ -156,12 +156,9 @@ public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage
// ********** validation **********
@Override
+ @SuppressWarnings("restriction")
protected void updatePageCompletion() {
- boolean pageComplete = this.isPageComplete();
- this.setPageComplete(pageComplete);
- if(pageComplete) {
- this.setErrorMessage(null);
- }
+ super.updatePageCompletion();
}
@Override
@@ -350,7 +347,7 @@ public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage
@Override
protected void initializeJarPackage() {
// do nothing
- };
+ }
@Override
protected void giveFocusToDestination() {
@@ -361,7 +358,10 @@ public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage
private Button buildUsesMoxyCheckBox(Composite parent) {
- Button checkBox = new Button(parent, SWT.CHECK);
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 10;
+ checkBox.setLayoutData(gridData);
checkBox.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_usesMoxyImplementation);
checkBox.setSelection(this.usesMoxy());
checkBox.addSelectionListener(this.buildUsesMoxySelectionListener());
@@ -396,25 +396,14 @@ public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage
initializeDialogUnits(parent);
Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(
- new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Group group = new Group(composite, SWT.NONE);
- group.setLayout(new GridLayout(4, false)); // false = do not make columns equal width
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- group.setText(JptJaxbUiMessages.SchemaGeneratorWizardPage_settingsGoupTitle);
+ buildSchemaComposite(composite);
- // Schema Location
- this.buildLabel(group, 1, JptJaxbUiMessages.SchemaGeneratorWizardPage_shemaLocation);
- this.schemaLocationText = this.buildTargetSchemaText(group, 2);
- this.buildBrowseButton(group, 1);
-
- // Target Schema
- this.buildLabel(group, 1, JptJaxbUiMessages.SchemaGeneratorWizardPage_shema);
- this.targetSchemaText = this.buildTargetSchemaText(group, 2);
-
- new Label(composite, SWT.NONE); // vertical spacer
// Input Tree
createPlainLabel(composite, JptJaxbUiMessages.SchemaGeneratorWizardPage_packages);
@@ -427,7 +416,26 @@ public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage
}
});
}
+
+ protected void buildSchemaComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout(3, false); // false = do not make columns equal width
+ layout.marginWidth = 0;
+ layout.marginTop = 0;
+ layout.marginBottom = 10;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Schema Location
+ this.buildLabel(composite, JptJaxbUiMessages.SchemaGeneratorWizardPage_shemaLocation);
+ this.schemaLocationText = this.buildTargetSchemaText(composite);
+ this.buildBrowseButton(composite, 1);
+
+ // Target Schema
+ this.buildLabel(composite, JptJaxbUiMessages.SchemaGeneratorWizardPage_shema);
+ this.targetSchemaText = this.buildTargetSchemaText(composite);
+ }
// ********** intra-wizard methods **********
protected String getTargetSchema() {
@@ -447,20 +455,18 @@ public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage
// ********** UI components **********
- private Label buildLabel(Composite parent, int horizontalSpan, String text) {
+ private Label buildLabel(Composite parent, String text) {
Label label = new Label(parent, SWT.LEFT);
label.setText(text);
- GridData gridData = new GridData();
- gridData.horizontalSpan = horizontalSpan;
- label.setLayoutData(gridData);
+ label.setLayoutData(new GridData());
return label;
}
- private Text buildTargetSchemaText(Composite parent, int horizontalSpan) {
+ private Text buildTargetSchemaText(Composite parent) {
Text text = new Text(parent, SWT.BORDER);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = horizontalSpan;
+ gridData.grabExcessHorizontalSpace = true;
text.setLayoutData(gridData);
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -521,6 +527,7 @@ public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage
| JavaElementLabelProvider.SHOW_SMALL_ICONS;
ITreeContentProvider treeContentProvider=
new StandardJavaElementContentProvider() {
+ @Override
public boolean hasChildren(Object element) {
// prevent the + from being shown in front of packages
return !(element instanceof IPackageFragment) && super.hasChildren(element);

Back to the top