Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTran Le2013-03-06 23:19:13 +0000
committerTran Le2013-03-06 23:29:30 +0000
commit54b74a6f48c19808879388633d08b5ff8ce3dd25 (patch)
treeca8993c5f5ad0bfbacacdf9afd2fe108e4d6df64
parent54ed13ee86fffccc71de69a3bac12bc6a91e6261 (diff)
downloadwebtools.dali-54b74a6f48c19808879388633d08b5ff8ce3dd25.tar.gz
webtools.dali-54b74a6f48c19808879388633d08b5ff8ce3dd25.tar.xz
webtools.dali-54b74a6f48c19808879388633d08b5ff8ce3dd25.zip
Added the UI for Generic Schema Generation 2.1v201303070011
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_jpa_ui_persistence2_1.properties51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/DataLoadingComposite.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceUnitSchemaGeneration2_1EditorPage.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceUnitSchemaGeneration2_1EditorPageDefinition.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceXml2_1UiDefinition.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/SchemaGenerationComposite.java560
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/jpa2_1/persistence/JptJpaUiPersistenceMessages2_1.java71
7 files changed, 912 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_jpa_ui_persistence2_1.properties b/jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_jpa_ui_persistence2_1.properties
new file mode 100644
index 0000000000..4a6b61eb18
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_jpa_ui_persistence2_1.properties
@@ -0,0 +1,51 @@
+################################################################################
+# Copyright (c) 2013 Oracle. All rights reserved.
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0, which accompanies this distribution
+# and is available at http://www.eclipse.org/legal/epl-v10.html.
+#
+# Contributors:
+# Oracle - initial API and implementation
+################################################################################
+
+# JptJpaUiPersistenceMessages2_1
+
+
+
+PersistenceUnitSchemaGeneration2_1EditorPage_title=Persistence Unit Schema Generation
+PersistenceUnitSchemaGeneration2_1EditorPage_description=Configure Schema Generation.
+
+SchemaGenerationComposite_schemaGenerationTabTitle=Schema Generation
+
+SchemaGenerationComposite_schemaGenerationGroupTitle=Schema generation
+
+SchemaGenerationComposite_databaseAction=Database action:
+SchemaGenerationComposite_scriptsGeneration=Scripts generation:
+SchemaGenerationComposite_metadataAndScriptCreation=Metadata and script creation:
+SchemaGenerationComposite_metadataAndScriptDropping=Metadata and script dropping:
+
+SchemaGenerationComposite_scriptsCreateTarget=Scripts create target:
+SchemaGenerationComposite_scriptsDropTarget=Scripts drop target:
+SchemaGenerationComposite_databaseProductName=Database product name:
+SchemaGenerationComposite_databaseMajorVersion=Database major version:
+SchemaGenerationComposite_databaseMinorVersion=Database minor version:
+SchemaGenerationComposite_createScriptSource=Create script source:
+SchemaGenerationComposite_dropScriptSource=Drop script source:
+SchemaGenerationComposite_connection=Connection:
+
+SchemaGenerationComposite_createDatabaseSchemasLabel=Create database schemas
+SchemaGenerationComposite_defaultCreateDatabaseSchemasLabel=Create database schemas ({0})
+
+SchemaGenerationAction_none=None
+SchemaGenerationAction_create=Create
+SchemaGenerationAction_drop_and_create=Drop and Create
+SchemaGenerationAction_drop=Drop
+
+SchemaGenerationTarget_metadata=Metadata
+SchemaGenerationTarget_script=Script
+SchemaGenerationTarget_metadata_then_script=Metadata then Script
+SchemaGenerationTarget_script_then_metadata=Script then Metadata
+
+SchemaGenerationComposite_dataLoadingGroupTitle=Data loading
+
+SchemaGenerationComposite_sqlLoadScriptSourceLabel=SQL load script source: \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/DataLoadingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/DataLoadingComposite.java
new file mode 100644
index 0000000000..89dfb778c7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/DataLoadingComposite.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.ui.internal.jpa2_1.persistence;
+
+import org.eclipse.jpt.common.ui.internal.widgets.Pane;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen.SchemaGeneration2_1;
+import org.eclipse.jpt.jpa.ui.jpa2_1.persistence.JptJpaUiPersistenceMessages2_1;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * DataLoadingComposite
+ */
+public class DataLoadingComposite<T extends SchemaGeneration2_1> extends Pane<T>
+{
+ public DataLoadingComposite(Pane<T> subjectHolder, Composite container) {
+
+ super(subjectHolder, container);
+ }
+
+ @Override
+ protected Composite addComposite(Composite parent) {
+ return this.addTitledGroup(
+ parent,
+ JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_dataLoadingGroupTitle,
+ 2,
+ null
+ );
+ }
+
+ @Override
+ protected void initializeLayout(Composite parentComposite) {
+
+ // SqlLoadScriptSource
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_sqlLoadScriptSourceLabel);
+ this.addText(parentComposite, this.buildSqlLoadScriptSourceHolder());
+
+ }
+
+ // ********** SqlLoadScriptSource **********
+
+ private ModifiablePropertyValueModel<String> buildSqlLoadScriptSourceHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, String>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.SQL_LOAD_SCRIPT_SOURCE_PROPERTY)
+ {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getSqlLoadScriptSource();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setSqlLoadScriptSource(value);
+ }
+ };
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceUnitSchemaGeneration2_1EditorPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceUnitSchemaGeneration2_1EditorPage.java
new file mode 100644
index 0000000000..90715f769d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceUnitSchemaGeneration2_1EditorPage.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.ui.internal.jpa2_1.persistence;
+
+import org.eclipse.jface.resource.ResourceManager;
+import org.eclipse.jpt.common.ui.WidgetFactory;
+import org.eclipse.jpt.common.ui.internal.widgets.Pane;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen.SchemaGeneration2_1;
+import org.eclipse.jpt.jpa.ui.jpa2_1.persistence.JptJpaUiPersistenceMessages2_1;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * PersistenceUnitSchemaGeneration2_1EditorPage
+ */
+public class PersistenceUnitSchemaGeneration2_1EditorPage
+ extends Pane<SchemaGeneration2_1>
+{
+ public PersistenceUnitSchemaGeneration2_1EditorPage(
+ PropertyValueModel<SchemaGeneration2_1> subjectModel,
+ Composite parent,
+ WidgetFactory widgetFactory,
+ ResourceManager resourceManager) {
+ super(subjectModel, parent, widgetFactory, resourceManager);
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+ Section section = this.getWidgetFactory().createSection(container, ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ section.setText(JptJpaUiPersistenceMessages2_1.PersistenceUnitSchemaGeneration2_1EditorPage_title);
+ section.setDescription(JptJpaUiPersistenceMessages2_1.PersistenceUnitSchemaGeneration2_1EditorPage_description);
+
+ Composite client = this.getWidgetFactory().createComposite(section);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginTop = 0;
+ layout.marginLeft = 0;
+ layout.marginBottom = 0;
+ layout.marginRight = 0;
+ client.setLayout(layout);
+ client.setLayoutData(new GridData(GridData.FILL_BOTH));
+ section.setClient(client);
+
+ // ********** Schema Generation properties **********
+
+ SchemaGenerationComposite<SchemaGeneration2_1> schemaGenerationComposite = new SchemaGenerationComposite<SchemaGeneration2_1>(this, client);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 2;
+ schemaGenerationComposite.getControl().setLayoutData(gridData);
+
+ // ********** Data Loading **********
+
+ DataLoadingComposite<SchemaGeneration2_1> dataLoadingComposite = new DataLoadingComposite<SchemaGeneration2_1>(this, client);
+ gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 2;
+ dataLoadingComposite.getControl().setLayoutData(gridData);
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceUnitSchemaGeneration2_1EditorPageDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceUnitSchemaGeneration2_1EditorPageDefinition.java
new file mode 100644
index 0000000000..13d802c6f0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceUnitSchemaGeneration2_1EditorPageDefinition.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.ui.internal.jpa2_1.persistence;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ResourceManager;
+import org.eclipse.jpt.common.ui.WidgetFactory;
+import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.transformer.AbstractTransformer;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.common.utility.transformer.Transformer;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.PersistenceUnit2_1;
+import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen.SchemaGeneration2_1;
+import org.eclipse.jpt.jpa.ui.editors.JpaEditorPageDefinition;
+import org.eclipse.jpt.jpa.ui.internal.jpa2.persistence.PersistenceUnitEditorPageDefinition;
+import org.eclipse.jpt.jpa.ui.jpa2_1.persistence.JptJpaUiPersistenceMessages2_1;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * PersistenceUnitSchemaGeneration2_1EditorPageDefinition
+ */
+public class PersistenceUnitSchemaGeneration2_1EditorPageDefinition
+ extends PersistenceUnitEditorPageDefinition
+{
+ // singleton
+ private static final JpaEditorPageDefinition INSTANCE =
+ new PersistenceUnitSchemaGeneration2_1EditorPageDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static JpaEditorPageDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Ensure single instance.
+ */
+ private PersistenceUnitSchemaGeneration2_1EditorPageDefinition() {
+ super();
+ }
+
+
+ public ImageDescriptor getTitleImageDescriptor() {
+ return null;
+ }
+
+ public String getTitleText() {
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_schemaGenerationTabTitle;
+ }
+
+ public String getHelpID() {
+ // TODO
+ return null;
+ }
+
+ @Override
+ protected void buildEditorPageContent(Composite parent, WidgetFactory widgetFactory, ResourceManager resourceManager, PropertyValueModel<PersistenceUnit> persistenceUnitModel) {
+ new PersistenceUnitSchemaGeneration2_1EditorPage(buildSchemaGenerationModel(persistenceUnitModel), parent, widgetFactory, resourceManager);
+ }
+
+ public static PropertyValueModel<SchemaGeneration2_1> buildSchemaGenerationModel(PropertyValueModel<PersistenceUnit> persistenceUnitModel) {
+ return new TransformationPropertyValueModel<PersistenceUnit, SchemaGeneration2_1>(persistenceUnitModel, SCHEMAGEN_TRANSFORMER);
+ }
+
+ public static final Transformer<PersistenceUnit, SchemaGeneration2_1> SCHEMAGEN_TRANSFORMER = new SchemaGenerationTransformer();
+
+ public static class SchemaGenerationTransformer
+ extends AbstractTransformer<PersistenceUnit, SchemaGeneration2_1>
+ {
+ @Override
+ protected SchemaGeneration2_1 transform_(PersistenceUnit persistenceUnit) {
+ return (SchemaGeneration2_1) ((PersistenceUnit2_1) persistenceUnit).getSchemaGeneration();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceXml2_1UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceXml2_1UiDefinition.java
index b69cfdb6bd..c5dad2e2c5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceXml2_1UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/PersistenceXml2_1UiDefinition.java
@@ -48,6 +48,7 @@ public class PersistenceXml2_1UiDefinition
definitions.add(PersistenceUnitGeneralEditorPageDefinition.instance());
definitions.add(PersistenceUnitConnection2_0EditorPageDefinition.instance());
definitions.add(PersistenceUnitOptions2_0EditorPageDefinition.instance());
+ definitions.add(PersistenceUnitSchemaGeneration2_1EditorPageDefinition.instance());
definitions.add(PersistenceUnitPropertiesEditorPageDefinition.instance());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/SchemaGenerationComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/SchemaGenerationComposite.java
new file mode 100644
index 0000000000..796ee4f213
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2_1/persistence/SchemaGenerationComposite.java
@@ -0,0 +1,560 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.ui.internal.jpa2_1.persistence;
+
+import java.util.Collection;
+import org.eclipse.jpt.common.ui.JptCommonUiMessages;
+import org.eclipse.jpt.common.ui.internal.widgets.EnumFormComboViewer;
+import org.eclipse.jpt.common.ui.internal.widgets.Pane;
+import org.eclipse.jpt.common.ui.internal.widgets.TriStateCheckBox;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationAction;
+import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.SchemaGenerationTarget;
+import org.eclipse.jpt.jpa.core.jpa2_1.context.persistence.schemagen.SchemaGeneration2_1;
+import org.eclipse.jpt.jpa.ui.jpa2_1.persistence.JptJpaUiPersistenceMessages2_1;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * SchemaGenerationComposite
+ */
+public class SchemaGenerationComposite<T extends SchemaGeneration2_1> extends Pane<T>
+{
+ public SchemaGenerationComposite(Pane<T> subjectHolder, Composite container) {
+
+ super(subjectHolder, container);
+ }
+
+ @Override
+ protected Composite addComposite(Composite parent) {
+ return this.addTitledGroup(
+ parent,
+ JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_schemaGenerationGroupTitle,
+ 2,
+ null
+ );
+ }
+
+ @Override
+ protected void initializeLayout(Composite parentComposite) {
+ // DatabaseAction
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_databaseAction);
+ this.buildDatabaseActionCombo(parentComposite);
+ // ScriptsAction
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_scriptsGeneration);
+ this.buildScriptsActionCombo(parentComposite);
+ // CreateSource
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_metadataAndScriptCreation);
+ this.buildCreateSourceCombo(parentComposite);
+ // DropSource
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_metadataAndScriptDropping);
+ this.buildDropSourceCombo(parentComposite);
+
+ // Create Database Schemas
+ TriStateCheckBox createDatabaseSchemasCheckBox = this.buildCreateDatabaseSchemasCheckBox(parentComposite);
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 2;
+ createDatabaseSchemasCheckBox.getCheckBox().setLayoutData(gridData);
+
+ // ScriptsCreateTarget
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_scriptsCreateTarget);
+ this.addText(parentComposite, this.buildScriptsCreateTargetHolder());
+
+ // ScriptsDropTarget
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_scriptsDropTarget);
+ this.addText(parentComposite, this.buildScriptsDropTargetHolder());
+
+ // DatabaseProductName
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_databaseProductName);
+ this.addText(parentComposite, this.buildDatabaseProductNameHolder());
+
+ // DatabaseMajorVersion
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_databaseMajorVersion);
+ this.addText(parentComposite, this.buildDatabaseMajorVersionHolder());
+
+ // DatabaseMinorVersion
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_databaseMinorVersion);
+ this.addText(parentComposite, this.buildDatabaseMinorVersionHolder());
+
+ // CreateScriptSource
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_createScriptSource);
+ this.addText(parentComposite, this.buildCreateScriptSourceHolder());
+
+ // DropScriptSource
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_dropScriptSource);
+ this.addText(parentComposite, this.buildDropScriptSourceHolder());
+
+ // Connection
+ this.addLabel(parentComposite, JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_connection);
+ this.addText(parentComposite, this.buildConnectionHolder());
+
+ }
+
+ // ********** ScriptsCreateTarget **********
+
+ private ModifiablePropertyValueModel<String> buildScriptsCreateTargetHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, String>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.SCRIPTS_CREATE_TARGET_PROPERTY)
+ {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getScriptsCreateTarget();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setScriptsCreateTarget(value);
+ }
+ };
+ }
+
+ // ********** ScriptsDropTarget **********
+
+ private ModifiablePropertyValueModel<String> buildScriptsDropTargetHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, String>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.SCRIPTS_DROP_TARGET_PROPERTY)
+ {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getScriptsDropTarget();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setScriptsDropTarget(value);
+ }
+ };
+ }
+
+ // ********** DatabaseProductName **********
+
+ private ModifiablePropertyValueModel<String> buildDatabaseProductNameHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, String>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.DATABASE_PRODUCT_NAME_PROPERTY)
+ {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getDatabaseProductName();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setDatabaseProductName(value);
+ }
+ };
+ }
+
+ // ********** DatabaseMajorVersion **********
+
+ private ModifiablePropertyValueModel<String> buildDatabaseMajorVersionHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, String>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.DATABASE_MAJOR_VERSION_PROPERTY)
+ {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getDatabaseMajorVersion();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setDatabaseMajorVersion(value);
+ }
+ };
+ }
+
+ // ********** DatabaseMinorVersion **********
+
+ private ModifiablePropertyValueModel<String> buildDatabaseMinorVersionHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, String>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.DATABASE_MINOR_VERSION_PROPERTY)
+ {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getDatabaseMinorVersion();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setDatabaseMinorVersion(value);
+ }
+ };
+ }
+
+ // ********** CreateScriptSource **********
+
+ private ModifiablePropertyValueModel<String> buildCreateScriptSourceHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, String>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.CREATE_SCRIPT_SOURCE_PROPERTY)
+ {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getCreateScriptSource();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setCreateScriptSource(value);
+ }
+ };
+ }
+
+ // ********** DropScriptSource **********
+
+ private ModifiablePropertyValueModel<String> buildDropScriptSourceHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, String>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.DROP_SCRIPT_SOURCE_PROPERTY)
+ {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getDropScriptSource();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setDropScriptSource(value);
+ }
+ };
+ }
+
+ // ********** Connection **********
+
+ private ModifiablePropertyValueModel<String> buildConnectionHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, String>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.CONNECTION_PROPERTY)
+ {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getConnection();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setConnection(value);
+ }
+ };
+ }
+
+
+ // ********* Create Database Schemas **********
+
+ private TriStateCheckBox buildCreateDatabaseSchemasCheckBox(Composite container) {
+ return this.addTriStateCheckBoxWithDefault(
+ container,
+ JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_createDatabaseSchemasLabel,
+ this.buildCreateDatabaseSchemasHolder(),
+ this.buildCreateDatabaseSchemasStringHolder(),
+ null // TODO HelpContextIds
+ );
+ }
+
+ private ModifiablePropertyValueModel<Boolean> buildCreateDatabaseSchemasHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, Boolean>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.CREATE_DATABASE_SCHEMAS_PROPERTY)
+ {
+ @Override
+ protected Boolean buildValue_() {
+ return this.subject.getCreateDatabaseSchemas();
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ this.subject.setCreateDatabaseSchemas(value);
+ }
+ };
+ }
+
+ private PropertyValueModel<String> buildCreateDatabaseSchemasStringHolder() {
+ return new TransformationPropertyValueModel<Boolean, String>(
+ this.buildDefaultCreateDatabaseSchemasHolder())
+ {
+ @Override
+ protected String transform(Boolean value) {
+ if (value != null) {
+ String defaultStringValue = value.booleanValue() ? JptCommonUiMessages.BOOLEAN_TRUE : JptCommonUiMessages.BOOLEAN_FALSE;
+ return NLS.bind(JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_defaultCreateDatabaseSchemasLabel, defaultStringValue);
+ }
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationComposite_createDatabaseSchemasLabel;
+ }
+ };
+ }
+
+ private PropertyValueModel<Boolean> buildDefaultCreateDatabaseSchemasHolder() {
+ return new PropertyAspectAdapter<SchemaGeneration2_1, Boolean>(
+ this.getSubjectHolder(),
+ SchemaGeneration2_1.CREATE_DATABASE_SCHEMAS_PROPERTY)
+ {
+ @Override
+ protected Boolean buildValue_() {
+ if (this.subject.getCreateDatabaseSchemas() != null) {
+ return null;
+ }
+ return this.subject.getDefaultCreateDatabaseSchemas();
+ }
+ };
+ }
+
+ // ********** DatabaseAction **********
+ private EnumFormComboViewer<SchemaGeneration2_1, SchemaGenerationAction> buildDatabaseActionCombo(Composite container) {
+
+ return new EnumFormComboViewer<SchemaGeneration2_1, SchemaGenerationAction>(this,
+ this.getSubjectHolder(),
+ container) {
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(SchemaGeneration2_1.SCHEMAGEN_DATABASE_ACTION_PROPERTY);
+ }
+
+ @Override
+ protected SchemaGenerationAction[] getChoices() {
+ return SchemaGenerationAction.values();
+ }
+
+ @Override
+ protected SchemaGenerationAction getDefaultValue() {
+ return this.getSubject().getDefaultSchemaGenDatabaseAction();
+ }
+
+ @Override
+ protected String displayString(SchemaGenerationAction value) {
+ switch (value) {
+ case none :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationAction_none;
+ case create :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationAction_create;
+ case drop_and_create :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationAction_drop_and_create;
+ case drop :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationAction_drop;
+ default :
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ protected SchemaGenerationAction getValue() {
+ return this.getSubject().getSchemaGenDatabaseAction();
+ }
+
+ @Override
+ protected void setValue(SchemaGenerationAction value) {
+ this.getSubject().setSchemaGenDatabaseAction(value);
+ }
+
+// @Override
+// protected String getHelpId() {
+// return // TODO -
+// }
+ };
+ }
+
+ // ********** ScriptsAction **********
+ private EnumFormComboViewer<SchemaGeneration2_1, SchemaGenerationAction> buildScriptsActionCombo(Composite container) {
+
+ return new EnumFormComboViewer<SchemaGeneration2_1, SchemaGenerationAction>(this,
+ this.getSubjectHolder(),
+ container) {
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(SchemaGeneration2_1.SCHEMAGEN_SCRIPTS_ACTION_PROPERTY);
+ }
+
+ @Override
+ protected SchemaGenerationAction[] getChoices() {
+ return SchemaGenerationAction.values();
+ }
+
+ @Override
+ protected SchemaGenerationAction getDefaultValue() {
+ return this.getSubject().getDefaultSchemaGenScriptsAction();
+ }
+
+ @Override
+ protected String displayString(SchemaGenerationAction value) {
+ switch (value) {
+ case none :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationAction_none;
+ case create :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationAction_create;
+ case drop_and_create :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationAction_drop_and_create;
+ case drop :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationAction_drop;
+ default :
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ protected SchemaGenerationAction getValue() {
+ return this.getSubject().getSchemaGenScriptsAction();
+ }
+
+ @Override
+ protected void setValue(SchemaGenerationAction value) {
+ this.getSubject().setSchemaGenScriptsAction(value);
+ }
+
+ // @Override
+ // protected String getHelpId() {
+ // return // TODO -
+ // }
+ };
+ }
+
+ // ********** CreateSource **********
+ private EnumFormComboViewer<SchemaGeneration2_1, SchemaGenerationTarget> buildCreateSourceCombo(Composite container) {
+
+ return new EnumFormComboViewer<SchemaGeneration2_1, SchemaGenerationTarget>(this,
+ this.getSubjectHolder(),
+ container) {
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(SchemaGeneration2_1.SCHEMAGEN_CREATE_SOURCE_PROPERTY);
+ }
+
+ @Override
+ protected SchemaGenerationTarget[] getChoices() {
+ return SchemaGenerationTarget.values();
+ }
+
+ @Override
+ protected SchemaGenerationTarget getDefaultValue() {
+ return this.getSubject().getDefaultSchemaGenCreateSource();
+ }
+
+ @Override
+ protected String displayString(SchemaGenerationTarget value) {
+ switch (value) {
+ case metadata :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationTarget_metadata;
+ case script :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationTarget_script;
+ case metadata_then_script :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationTarget_metadata_then_script;
+ case script_then_metadata :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationTarget_script_then_metadata;
+ default :
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ protected SchemaGenerationTarget getValue() {
+ return this.getSubject().getSchemaGenCreateSource();
+ }
+
+ @Override
+ protected void setValue(SchemaGenerationTarget value) {
+ this.getSubject().setSchemaGenCreateSource(value);
+ }
+
+ // @Override
+ // protected String getHelpId() {
+ // return // TODO -
+ // }
+ };
+ }
+
+ // ********** DropSource **********
+ private EnumFormComboViewer<SchemaGeneration2_1, SchemaGenerationTarget> buildDropSourceCombo(Composite container) {
+
+ return new EnumFormComboViewer<SchemaGeneration2_1, SchemaGenerationTarget>(this,
+ this.getSubjectHolder(),
+ container) {
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(SchemaGeneration2_1.SCHEMAGEN_DROP_SOURCE_PROPERTY);
+ }
+
+ @Override
+ protected SchemaGenerationTarget[] getChoices() {
+ return SchemaGenerationTarget.values();
+ }
+
+ @Override
+ protected SchemaGenerationTarget getDefaultValue() {
+ return this.getSubject().getDefaultSchemaGenDropSource();
+ }
+
+ @Override
+ protected String displayString(SchemaGenerationTarget value) {
+ switch (value) {
+ case metadata :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationTarget_metadata;
+ case script :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationTarget_script;
+ case metadata_then_script :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationTarget_metadata_then_script;
+ case script_then_metadata :
+ return JptJpaUiPersistenceMessages2_1.SchemaGenerationTarget_script_then_metadata;
+ default :
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ protected SchemaGenerationTarget getValue() {
+ return this.getSubject().getSchemaGenDropSource();
+ }
+
+ @Override
+ protected void setValue(SchemaGenerationTarget value) {
+ this.getSubject().setSchemaGenDropSource(value);
+ }
+
+ // @Override
+ // protected String getHelpId() {
+ // return // TODO -
+ // }
+ };
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/jpa2_1/persistence/JptJpaUiPersistenceMessages2_1.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/jpa2_1/persistence/JptJpaUiPersistenceMessages2_1.java
new file mode 100644
index 0000000000..e9d1a70cdb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/jpa2_1/persistence/JptJpaUiPersistenceMessages2_1.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.ui.jpa2_1.persistence;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * JptJpaUiPersistenceMessages2_1
+ */
+public class JptJpaUiPersistenceMessages2_1 {
+
+ private static final String BUNDLE_NAME = "jpt_jpa_ui_persistence2_1"; //$NON-NLS-1$
+ private static final Class<?> BUNDLE_CLASS = JptJpaUiPersistenceMessages2_1.class;
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
+ }
+
+ // Schema Generation tab
+ public static String SchemaGenerationComposite_schemaGenerationTabTitle;
+
+ public static String PersistenceUnitSchemaGeneration2_1EditorPage_title;
+ public static String PersistenceUnitSchemaGeneration2_1EditorPage_description;
+
+ // Schema Generation properties
+ public static String SchemaGenerationComposite_schemaGenerationGroupTitle;
+
+ public static String SchemaGenerationComposite_databaseAction;
+ public static String SchemaGenerationComposite_scriptsGeneration;
+ public static String SchemaGenerationComposite_metadataAndScriptCreation;
+ public static String SchemaGenerationComposite_metadataAndScriptDropping;
+
+ public static String SchemaGenerationComposite_scriptsCreateTarget;
+ public static String SchemaGenerationComposite_scriptsDropTarget;
+ public static String SchemaGenerationComposite_databaseProductName;
+ public static String SchemaGenerationComposite_databaseMajorVersion;
+ public static String SchemaGenerationComposite_databaseMinorVersion;
+ public static String SchemaGenerationComposite_createScriptSource;
+ public static String SchemaGenerationComposite_dropScriptSource;
+ public static String SchemaGenerationComposite_connection;
+
+ public static String SchemaGenerationAction_none;
+ public static String SchemaGenerationAction_create;
+ public static String SchemaGenerationAction_drop_and_create;
+ public static String SchemaGenerationAction_drop;
+
+ public static String SchemaGenerationTarget_metadata;
+ public static String SchemaGenerationTarget_script;
+ public static String SchemaGenerationTarget_metadata_then_script;
+ public static String SchemaGenerationTarget_script_then_metadata;
+
+ public static String SchemaGenerationComposite_createDatabaseSchemasLabel;
+ public static String SchemaGenerationComposite_defaultCreateDatabaseSchemasLabel;
+
+
+ // Data Loading
+ public static String SchemaGenerationComposite_dataLoadingGroupTitle;
+
+ public static String SchemaGenerationComposite_sqlLoadScriptSourceLabel;
+
+
+ private JptJpaUiPersistenceMessages2_1() {
+ throw new UnsupportedOperationException();
+ }
+}

Back to the top