Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2008-10-29 21:42:54 +0000
committerkmoore2008-10-29 21:42:54 +0000
commit293d0a52f69c42643f4998bad630be94993490e9 (patch)
treea665cb7532820f155082022d7679b9690013dd5d
parent858a4f29238ac56018801c7d2ae8130e2af11a15 (diff)
downloadwebtools.dali-293d0a52f69c42643f4998bad630be94993490e9.tar.gz
webtools.dali-293d0a52f69c42643f4998bad630be94993490e9.tar.xz
webtools.dali-293d0a52f69c42643f4998bad630be94993490e9.zip
added UI support for converters on entity-mappings
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/META-INF/MANIFEST.MF2
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui_mappings.properties11
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/ConvertersComposite.java405
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterDialog.java195
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkStateObject.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EntityMappingsDetailsPage.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmDetailsProvider.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceDetailsProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUI.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/JpaDetailsProvider.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/EntityMappingsDetailsPage.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmDetailsProvider.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java2
15 files changed, 996 insertions, 19 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/META-INF/MANIFEST.MF
index 3c8ff54103..51ed9b425a 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Bundle-ClassPath: .
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.emf.ecore.xmi;bundle-version="2.4.1",
org.eclipse.emf.edit.ui;bundle-version="[2.4.0,3.0.0)",
org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jdt.ui;bundle-version="[3.4.0,4.0.0)",
@@ -22,6 +23,7 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.3.100,4.0.0)",
org.eclipse.ui.views.properties.tabbed;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.wst.common.emf;bundle-version="1.1.202",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.frameworks.ui;bundle-version="[1.1.200,2.0.0)"
Export-Package: org.eclipse.jpt.eclipselink.ui,
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui_mappings.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui_mappings.properties
index f79d291d64..761b352cfe 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui_mappings.properties
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui_mappings.properties
@@ -126,4 +126,13 @@ TypeConverterComposite_objectTypeLabel = Object type:
DefaultOneToOneMappingUiProvider_label=Default (One to One)
DefaultOneToManyMappingUiProvider_label=Default (One to Many)
DefaultOneToOneMappingUiProvider_linkLabel=default (one to one)
-DefaultOneToManyMappingUiProvider_linkLabel=default (one to many) \ No newline at end of file
+DefaultOneToManyMappingUiProvider_linkLabel=default (one to many)
+
+ConvertersComposite_Label=Converters
+
+EclipseLinkConverterDialog_name=Name:
+EclipseLinkConverterDialog_converterType=Type:
+EclipseLinkConverterDialog_addConverter=Add Converter
+EclipseLinkConverterDialog_addConverterDescriptionTitle=Create new converter
+EclipseLinkConverterDialog_addConverterDescription=Create a new converter setting both the 'name' and the 'type'
+
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java
index 730784a5c9..089bfadb7d 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java
@@ -137,6 +137,13 @@ public class EclipseLinkUiMappingsMessages extends NLS {
public static String DefaultOneToOneMappingUiProvider_linkLabel;
public static String DefaultOneToManyMappingUiProvider_linkLabel;
+ public static String ConvertersComposite_Label;
+ public static String EclipseLinkConverterDialog_name;
+ public static String EclipseLinkConverterDialog_converterType;
+ public static String EclipseLinkConverterDialog_addConverter;
+ public static String EclipseLinkConverterDialog_addConverterDescriptionTitle;
+ public static String EclipseLinkConverterDialog_addConverterDescription;
+
static {
NLS.initializeMessages("eclipselink_ui_mappings", EclipseLinkUiMappingsMessages.class);
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/ConvertersComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/ConvertersComposite.java
new file mode 100644
index 0000000000..808733507b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/ConvertersComposite.java
@@ -0,0 +1,405 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.eclipselink.ui.internal.orm.details;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jpt.eclipselink.core.context.CustomConverter;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter;
+import org.eclipse.jpt.eclipselink.core.context.StructConverter;
+import org.eclipse.jpt.eclipselink.core.context.TypeConverter;
+import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
+import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.CustomConverterComposite;
+import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.ObjectTypeConverterComposite;
+import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.StructConverterComposite;
+import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.TypeConverterComposite;
+import org.eclipse.jpt.ui.internal.util.ControlSwitcher;
+import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.ui.internal.widgets.FormPane;
+import org.eclipse.jpt.ui.internal.widgets.Pane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemovePane.Adapter;
+import org.eclipse.jpt.utility.internal.Transformer;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
+import org.eclipse.jpt.utility.model.value.ListValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.PageBook;
+
+/**
+ * This pane shows the list of named queries and named native queries.
+ * <p>
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | AddRemoveListPane | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | ConverterComposite or ObjectTypeConverterComposite | |
+ * | | or StructConverterComposite or TypeConverterComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see Entity
+ * @see Query
+ * @see NamedNativeQuery
+ * @see NamedQuery
+ * @see AbstractEntityComposite - The parent container
+ * @see NamedNativeQueryPropertyComposite
+ * @see NamedQueryPropertyComposite
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public class ConvertersComposite extends Pane<ConverterHolder>
+{
+ private AddRemoveListPane<ConverterHolder> listPane;
+ private CustomConverterComposite converterComposite;
+ private ObjectTypeConverterComposite objectTypeConverterComposite;
+ private StructConverterComposite structConverterComposite;
+ private TypeConverterComposite typeConverterComposite;
+ private WritablePropertyValueModel<EclipseLinkConverter> selectedConverterHolder;
+
+ public ConvertersComposite(
+ FormPane<?> parentPane,
+ PropertyValueModel<? extends ConverterHolder> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ this.selectedConverterHolder = buildSelectedConverterHolder();
+ }
+
+ private WritablePropertyValueModel<EclipseLinkConverter> buildSelectedConverterHolder() {
+ return new SimplePropertyValueModel<EclipseLinkConverter>();
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // List pane
+ this.listPane = addListPane(container);
+
+ // Property pane
+ PageBook pageBook = new PageBook(container, SWT.NULL);
+ pageBook.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ this.converterComposite = new CustomConverterComposite(
+ buildCustomConverterHolder(),
+ pageBook,
+ getWidgetFactory()
+ );
+
+ this.objectTypeConverterComposite = new ObjectTypeConverterComposite(
+ buildObjectTypeConverterHolder(),
+ pageBook,
+ getWidgetFactory()
+ );
+
+ this.structConverterComposite = new StructConverterComposite(
+ buildStructConverterHolder(),
+ pageBook,
+ getWidgetFactory()
+ );
+
+ this.typeConverterComposite = new TypeConverterComposite(
+ buildTypeConverterHolder(),
+ pageBook,
+ getWidgetFactory()
+ );
+
+ installPaneSwitcher(pageBook);
+ }
+
+ private AddRemoveListPane<ConverterHolder> addListPane(Composite container) {
+
+ return new AddRemoveListPane<ConverterHolder>(
+ this,
+ container,
+ buildConvertersAdapter(),
+ buildDisplayableConvertersListHolder(),
+ this.selectedConverterHolder,
+ buildConvertersListLabelProvider(),
+ null//JpaHelpContextIds.MAPPING_NAMED_QUERIES
+ ) {
+ //TODO yeah, this is weird, but i don't want this to be disabled just
+ //because the subject is null. i have no need for that and that is
+ //currently how AddRemovePane works. See OrmQueriesComposite where
+ //the work around there is yet another pane enabler. I want to change
+ //how this works in 2.2
+ @Override
+ public void enableWidgets(boolean enabled) {
+ super.enableWidgets(true);
+ }
+ };
+ }
+
+ private void installPaneSwitcher(PageBook pageBook) {
+ new ControlSwitcher(this.selectedConverterHolder, buildPaneTransformer(), pageBook);
+ }
+
+ private Adapter buildConvertersAdapter() {
+
+ return new AddRemoveListPane.AbstractAdapter() {
+
+ public void addNewItem(ObjectListSelectionModel listSelectionModel) {
+ addConverter(listSelectionModel);
+ }
+
+ public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
+ for (Object item : listSelectionModel.selectedValues()) {
+ if (((EclipseLinkConverter) item).getType() == EclipseLinkConverter.CUSTOM_CONVERTER) {
+ getSubject().removeCustomConverter((CustomConverter) item);
+ }
+ else if (((EclipseLinkConverter) item).getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
+ getSubject().removeObjectTypeConverter((ObjectTypeConverter) item);
+ }
+ else if (((EclipseLinkConverter) item).getType() == EclipseLinkConverter.STRUCT_CONVERTER) {
+ getSubject().removeStructConverter((StructConverter) item);
+ }
+ else if (((EclipseLinkConverter) item).getType() == EclipseLinkConverter.TYPE_CONVERTER) {
+ getSubject().removeTypeConverter((TypeConverter) item);
+ }
+ }
+ }
+ };
+ }
+
+ private void addConverter(ObjectListSelectionModel listSelectionModel) {
+ EclipseLinkConverterDialog dialog = buildEclipseLinkConverterDialog();
+ addEclipseLinkConverterFromDialog(dialog, listSelectionModel);
+ }
+
+ protected EclipseLinkConverterDialog buildEclipseLinkConverterDialog() {
+ return new EclipseLinkConverterDialog(getControl().getShell());
+ }
+
+ protected void addEclipseLinkConverterFromDialog(EclipseLinkConverterDialog dialog, ObjectListSelectionModel listSelectionModel) {
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+ String converterType = dialog.getConverterType();
+ EclipseLinkConverter converter;
+ if (converterType == EclipseLinkConverter.CUSTOM_CONVERTER) {
+ converter = this.getSubject().addCustomConverter(getSubject().customConvertersSize());
+ }
+ else if (converterType == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
+ converter = this.getSubject().addObjectTypeConverter(getSubject().objectTypeConvertersSize());
+ }
+ else if (converterType == EclipseLinkConverter.STRUCT_CONVERTER) {
+ converter = this.getSubject().addStructConverter(getSubject().structConvertersSize());
+ }
+ else if (converterType == EclipseLinkConverter.TYPE_CONVERTER) {
+ converter = this.getSubject().addTypeConverter(getSubject().typeConvertersSize());
+ }
+ else {
+ throw new IllegalArgumentException();
+ }
+ converter.setName(dialog.getName());
+
+ listSelectionModel.setSelectedValue(converter);
+ }
+
+ private Transformer<EclipseLinkConverter, Control> buildPaneTransformer() {
+ return new Transformer<EclipseLinkConverter, Control>() {
+ public Control transform(EclipseLinkConverter converter) {
+ if (converter == null) {
+ return null;
+ }
+
+ if (converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) {
+ return ConvertersComposite.this.converterComposite.getControl();
+ }
+ if (converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
+ return ConvertersComposite.this.objectTypeConverterComposite.getControl();
+ }
+ if (converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) {
+ return ConvertersComposite.this.structConverterComposite.getControl();
+ }
+ if (converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) {
+ return ConvertersComposite.this.typeConverterComposite.getControl();
+ }
+
+ return null;
+ }
+ };
+ }
+
+ private ListValueModel<EclipseLinkConverter> buildDisplayableConvertersListHolder() {
+ return new ItemPropertyListValueModelAdapter<EclipseLinkConverter>(
+ buildEclipseLinkConvertersHolder(),
+ EclipseLinkConverter.NAME_PROPERTY
+ );
+ }
+
+ private ListValueModel<EclipseLinkConverter> buildEclipseLinkConvertersHolder() {
+ List<ListValueModel<? extends EclipseLinkConverter>> list = new ArrayList<ListValueModel<? extends EclipseLinkConverter>>();
+ list.add(buildCustomConvertersListHolder());
+ list.add(buildObjectTypeConvertersListHolder());
+ list.add(buildStructConvertersListHolder());
+ list.add(buildTypeConvertersListHolder());
+ return new CompositeListValueModel<ListValueModel<? extends EclipseLinkConverter>, EclipseLinkConverter>(list);
+ }
+
+ private ListValueModel<CustomConverter> buildCustomConvertersListHolder() {
+ return new ListAspectAdapter<ConverterHolder, CustomConverter>(
+ getSubjectHolder(),
+ ConverterHolder.CUSTOM_CONVERTERS_LIST)
+ {
+ @Override
+ protected ListIterator<CustomConverter> listIterator_() {
+ return this.subject.customConverters();
+ }
+
+ @Override
+ protected int size_() {
+ return this.subject.customConvertersSize();
+ }
+ };
+ }
+
+ private ListValueModel<ObjectTypeConverter> buildObjectTypeConvertersListHolder() {
+ return new ListAspectAdapter<ConverterHolder, ObjectTypeConverter>(
+ getSubjectHolder(),
+ ConverterHolder.OBJECT_TYPE_CONVERTERS_LIST)
+ {
+ @Override
+ protected ListIterator<ObjectTypeConverter> listIterator_() {
+ return this.subject.objectTypeConverters();
+ }
+
+ @Override
+ protected int size_() {
+ return this.subject.objectTypeConvertersSize();
+ }
+ };
+ }
+
+ private ListValueModel<StructConverter> buildStructConvertersListHolder() {
+ return new ListAspectAdapter<ConverterHolder, StructConverter>(
+ getSubjectHolder(),
+ ConverterHolder.STRUCT_CONVERTERS_LIST)
+ {
+ @Override
+ protected ListIterator<StructConverter> listIterator_() {
+ return this.subject.structConverters();
+ }
+
+ @Override
+ protected int size_() {
+ return this.subject.structConvertersSize();
+ }
+ };
+ }
+
+ private ListValueModel<TypeConverter> buildTypeConvertersListHolder() {
+ return new ListAspectAdapter<ConverterHolder, TypeConverter>(
+ getSubjectHolder(),
+ ConverterHolder.TYPE_CONVERTERS_LIST)
+ {
+ @Override
+ protected ListIterator<TypeConverter> listIterator_() {
+ return this.subject.typeConverters();
+ }
+
+ @Override
+ protected int size_() {
+ return this.subject.typeConvertersSize();
+ }
+ };
+ }
+
+ private PropertyValueModel<CustomConverter> buildCustomConverterHolder() {
+ return new TransformationPropertyValueModel<EclipseLinkConverter, CustomConverter>(this.selectedConverterHolder) {
+ @Override
+ protected CustomConverter transform_(EclipseLinkConverter value) {
+ return value.getType() == EclipseLinkConverter.CUSTOM_CONVERTER ? (CustomConverter) value : null;
+ }
+ };
+ }
+
+ private PropertyValueModel<ObjectTypeConverter> buildObjectTypeConverterHolder() {
+ return new TransformationPropertyValueModel<EclipseLinkConverter, ObjectTypeConverter>(this.selectedConverterHolder) {
+ @Override
+ protected ObjectTypeConverter transform_(EclipseLinkConverter value) {
+ return value.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER ? (ObjectTypeConverter) value : null;
+ }
+ };
+ }
+
+ private PropertyValueModel<StructConverter> buildStructConverterHolder() {
+ return new TransformationPropertyValueModel<EclipseLinkConverter, StructConverter>(this.selectedConverterHolder) {
+ @Override
+ protected StructConverter transform_(EclipseLinkConverter value) {
+ return value.getType() == EclipseLinkConverter.STRUCT_CONVERTER ? (StructConverter) value : null;
+ }
+ };
+ }
+
+ private PropertyValueModel<TypeConverter> buildTypeConverterHolder() {
+ return new TransformationPropertyValueModel<EclipseLinkConverter, TypeConverter>(this.selectedConverterHolder) {
+ @Override
+ protected TypeConverter transform_(EclipseLinkConverter value) {
+ return value.getType() == EclipseLinkConverter.TYPE_CONVERTER ? (TypeConverter) value : null;
+ }
+ };
+ }
+
+ private ILabelProvider buildConvertersListLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return ((EclipseLinkConverter) element).getName();
+ }
+ };
+ }
+
+ @Override
+ public void enableWidgets(boolean enabled) {
+ super.enableWidgets(enabled);
+ this.listPane.enableWidgets(enabled);
+ }
+
+ //TODO need to check the converter repository for this, should check all converters, except for the override case, hmm
+ //we at least need to check typeconverters, converters, structconverters, and objectypeconverters, on this particular
+ //object. or we need to give a warning about the case where you are overriding or an error if it's not an override?
+ private Iterator<String> converterNames() {
+ return new TransformationIterator<CustomConverter, String>(getSubject().customConverters()) {
+ @Override
+ protected String transform(CustomConverter next) {
+ return next.getName();
+ }
+ };
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterDialog.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterDialog.java
new file mode 100644
index 0000000000..00a1933f44
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkConverterDialog.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.eclipselink.ui.internal.orm.details;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.DialogPane;
+import org.eclipse.jpt.ui.internal.widgets.ValidatingDialog;
+import org.eclipse.jpt.utility.internal.StringConverter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.StaticListValueModel;
+import org.eclipse.jpt.utility.model.value.ListValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Clients can use this dialog to prompt the user for SecondaryTable settings.
+ * Use the following once the dialog is closed:
+ * @see #getSelectedTable()
+ * @see #getSelectedCatalog()
+ * @see #getSelectedSchema()
+ * @version 2.1
+ * @since 2.1
+ */
+public class EclipseLinkConverterDialog extends ValidatingDialog<EclipseLinkStateObject> {
+
+
+ // ********** constructors **********
+
+ /**
+ * Use this constructor to edit an existing conversion value
+ */
+ public EclipseLinkConverterDialog(Shell parent) {
+ super(parent);
+ }
+
+ @Override
+ protected EclipseLinkStateObject buildStateObject() {
+ return new EclipseLinkStateObject();
+ }
+
+ // ********** open **********
+
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(this.getTitle());
+ }
+
+ @Override
+ protected String getTitle() {
+ return EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_addConverter;
+ }
+
+ @Override
+ protected String getDescriptionTitle() {
+ return EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_addConverterDescriptionTitle;
+ }
+
+ @Override
+ protected String getDescription() {
+ return EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_addConverterDescription;
+ }
+
+ @Override
+ protected DialogPane<EclipseLinkStateObject> buildLayout(Composite container) {
+ return new ConversionValueDialogPane(container);
+ }
+
+ @Override
+ public void create() {
+ super.create();
+
+ ConversionValueDialogPane pane = (ConversionValueDialogPane) getPane();
+ pane.selectAll();
+
+ getButton(OK).setEnabled(false);
+ }
+
+
+ // ********** public API **********
+
+ /**
+ * Return the data value set in the text widget.
+ */
+ public String getName() {
+ return getSubject().getName();
+ }
+
+ /**
+ * Return the object value set in the text widget.
+ */
+ public String getConverterType() {
+ return getSubject().getConverterType();
+ }
+
+ private class ConversionValueDialogPane extends DialogPane<EclipseLinkStateObject> {
+
+ private Text nameText;
+
+ ConversionValueDialogPane(Composite parent) {
+ super(EclipseLinkConverterDialog.this.getSubjectHolder(), parent);
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+ this.nameText = addLabeledText(
+ container,
+ EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_name,
+ buildNameHolder()
+ );
+
+ addLabeledCombo(
+ container,
+ EclipseLinkUiMappingsMessages.EclipseLinkConverterDialog_converterType,
+ buildConverterTypeListHolder(),
+ buildConverterTypeHolder(),
+ buildStringConverter(),
+ null);
+ }
+
+ protected ListValueModel<String> buildConverterTypeListHolder() {
+ List<String> converterTypes = new ArrayList<String>();
+ converterTypes.add(EclipseLinkConverter.CUSTOM_CONVERTER);
+ converterTypes.add(EclipseLinkConverter.OBJECT_TYPE_CONVERTER);
+ converterTypes.add(EclipseLinkConverter.STRUCT_CONVERTER);
+ converterTypes.add(EclipseLinkConverter.TYPE_CONVERTER);
+
+ return new StaticListValueModel<String>(converterTypes);
+ }
+
+ private StringConverter<String> buildStringConverter() {
+ return new StringConverter<String>() {
+ public String convertToString(String value) {
+ if (value == EclipseLinkConverter.CUSTOM_CONVERTER) {
+ return EclipseLinkUiMappingsMessages.ConvertersComposite_converter;
+ }
+ if (value == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) {
+ return EclipseLinkUiMappingsMessages.ConvertersComposite_objectTypeConverter;
+ }
+ if (value == EclipseLinkConverter.STRUCT_CONVERTER) {
+ return EclipseLinkUiMappingsMessages.ConvertersComposite_structConverter;
+ }
+ if (value == EclipseLinkConverter.TYPE_CONVERTER) {
+ return EclipseLinkUiMappingsMessages.ConvertersComposite_typeConverter;
+ }
+ return value;
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<String> buildNameHolder() {
+ return new PropertyAspectAdapter<EclipseLinkStateObject, String>(getSubjectHolder(), EclipseLinkStateObject.NAME_PROPERTY) {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getName();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ this.subject.setName(value);
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<String> buildConverterTypeHolder() {
+ return new PropertyAspectAdapter<EclipseLinkStateObject, String>(getSubjectHolder(), EclipseLinkStateObject.CONVERTER_TYPE_PROPERTY) {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getConverterType();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ this.subject.setConverterType(value);
+ }
+ };
+ }
+
+ void selectAll() {
+ this.nameText.selectAll();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkStateObject.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkStateObject.java
new file mode 100644
index 0000000000..6a8dc15987
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EclipseLinkStateObject.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.eclipselink.ui.internal.orm.details;
+
+import java.util.List;
+import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.node.AbstractNode;
+import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.jpt.utility.internal.node.Problem;
+
+/**
+ * This is the state object used by the <code>NewNameDialog</code>, which stores
+ * the current name and validates it when it is modified.
+ *
+ * @see NewNameDialog
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+final class EclipseLinkStateObject extends AbstractNode
+{
+ /**
+ * The initial name or <code>null</code>
+ */
+ private String name;
+
+ /**
+ * The initial converterType or <code>null</code>
+ */
+ private String converterType;
+
+ /**
+ * The <code>Validator</code> used to validate this state object.
+ */
+ private Validator validator;
+
+ /**
+ * Notifies a change in the data value property.
+ */
+ static final String NAME_PROPERTY = "nameProperty"; //$NON-NLS-1$
+
+ /**
+ * Notifies a change in the object value property.
+ */
+ static final String CONVERTER_TYPE_PROPERTY = "converterTypeProperty"; //$NON-NLS-1$
+
+ /**
+ * Creates a new <code>NewNameStateObject</code>.
+ *
+ * @param name The initial input or <code>null</code> if no initial value can
+ * be specified
+ * @param names The collection of names that can't be used or an empty
+ * collection if none are available
+ */
+ EclipseLinkStateObject() {
+ super(null);
+
+ }
+
+ private void addNameProblemsTo(List<Problem> currentProblems) {
+ if (StringTools.stringIsEmpty(this.name)) {
+ currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.ConversionValueStateObject_dataValueMustBeSpecified));
+ }
+ }
+
+ private void addConverterTypeProblemsTo(List<Problem> currentProblems) {
+ if (StringTools.stringIsEmpty(this.converterType)) {
+ currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.ConversionValueStateObject_objectValueMustBeSpecified));
+ }
+ }
+
+ @Override
+ protected void addProblemsTo(List<Problem> currentProblems) {
+ super.addProblemsTo(currentProblems);
+ addNameProblemsTo(currentProblems);
+ addConverterTypeProblemsTo(currentProblems);
+ }
+
+ @Override
+ protected void checkParent(@SuppressWarnings("unused") Node parentNode) {
+ //no parent
+ }
+
+ public String displayString() {
+ return null;
+ }
+
+ String getName() {
+ return this.name;
+ }
+
+ String getConverterType() {
+ return this.converterType;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public void setConverterType(String newConverterType) {
+ String oldConverterType = this.converterType;
+ this.converterType = newConverterType;
+ firePropertyChanged(CONVERTER_TYPE_PROPERTY, oldConverterType, newConverterType);
+ }
+
+ @Override
+ public void setValidator(Validator validator) {
+ this.validator = validator;
+ }
+
+ @Override
+ public Validator getValidator() {
+ return this.validator;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EntityMappingsDetailsPage.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EntityMappingsDetailsPage.java
new file mode 100644
index 0000000000..bf5aaa89ca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/EntityMappingsDetailsPage.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.eclipselink.ui.internal.orm.details;
+
+import org.eclipse.jpt.core.context.orm.EntityMappings;
+import org.eclipse.jpt.eclipselink.core.internal.context.orm.ConverterHolder;
+import org.eclipse.jpt.eclipselink.core.internal.context.orm.EclipseLinkEntityMappings;
+import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages;
+import org.eclipse.jpt.ui.WidgetFactory;
+import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.orm.JptUiOrmMessages;
+import org.eclipse.jpt.ui.internal.orm.details.OrmGeneratorsComposite;
+import org.eclipse.jpt.ui.internal.orm.details.OrmPackageChooser;
+import org.eclipse.jpt.ui.internal.orm.details.OrmQueriesComposite;
+import org.eclipse.jpt.ui.internal.orm.details.PersistenceUnitMetadataComposite;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | XmlPackageChooser | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------ |
+ * | Schema: | SchemaCombo | |
+ * | ------------------------------------------------------------ |
+ * | ------------------------------------------------------------ |
+ * | Catalog: | CatalogCombo | |
+ * | ------------------------------------------------------------ |
+ * | ------------------------------------------------------------ |
+ * | Access Type: | |v| |
+ * | ------------------------------------------------------------ |
+ * | |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | PersistenceUnitMetadataComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OrmGeneratorsComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OrmQueriesComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | ConvertersComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see EntityMappings
+ * @see EntityMappingsDetailsPage - The parent container
+ * @see CatalogCombo
+ * @see EnumFormComboViewer
+ * @see OrmGeneratorsComposite
+ * @see OrmPackageChooser
+ * @see OrmQueriesComposite
+ * @see PersistenceUnitMetadataComposite
+ * @see SchemaCombo
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public class EntityMappingsDetailsPage extends org.eclipse.jpt.ui.internal.orm.details.EntityMappingsDetailsPage
+{
+ /**
+ * Creates a new <code>XmlEntityMappingsDetailsPage</code>.
+ *
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public EntityMappingsDetailsPage(Composite parent,
+ WidgetFactory widgetFactory) {
+
+ super(parent, widgetFactory);
+ }
+
+
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Package widgets
+ new OrmPackageChooser(this, container);
+
+ // Schema widgets
+ addLabeledComposite(
+ container,
+ JptUiOrmMessages.EntityMappingsDetailsPage_schema,
+ addSchemaCombo(container),
+ JpaHelpContextIds.ENTITY_ORM_SCHEMA
+ );
+
+ // Catalog widgets
+ addLabeledComposite(
+ container,
+ JptUiOrmMessages.EntityMappingsDetailsPage_catalog,
+ addCatalogCombo(container),
+ JpaHelpContextIds.ENTITY_ORM_CATALOG
+ );
+
+ // Access Type widgets
+ addLabeledComposite(
+ container,
+ JptUiOrmMessages.EntityMappingsDetailsPage_access,
+ addAccessTypeCombo(container),
+ JpaHelpContextIds.ENTITY_ORM_ACCESS
+ );
+
+ // Persistence Unit Metadata widgets
+ new PersistenceUnitMetadataComposite(
+ this,
+ buildPersistentUnitMetadataHolder(),
+ addSubPane(container, 5)
+ );
+
+ // Generators pane
+ new OrmGeneratorsComposite(
+ this,
+ container
+ );
+
+ // Queries pane
+ new OrmQueriesComposite(
+ this,
+ container
+ );
+
+ // Converters section
+ container = addCollapsableSection(
+ container,
+ EclipseLinkUiMappingsMessages.ConvertersComposite_Label
+ );
+
+ new ConvertersComposite(
+ this,
+ buildConverterHolder(),
+ container
+ );
+ }
+
+ private PropertyValueModel<ConverterHolder> buildConverterHolder() {
+ return new PropertyAspectAdapter<EntityMappings, ConverterHolder>(getSubjectHolder()) {
+ @Override
+ protected ConverterHolder buildValue_() {
+ return ((EclipseLinkEntityMappings) this.subject).getConverterHolder();
+ }
+ };
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmDetailsProvider.java
new file mode 100644
index 0000000000..4c106c7128
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/orm/details/OrmDetailsProvider.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.eclipselink.ui.internal.orm.details;
+
+import org.eclipse.jpt.core.JpaStructureNode;
+import org.eclipse.jpt.core.context.XmlContextNode;
+import org.eclipse.jpt.core.context.orm.OrmStructureNodes;
+import org.eclipse.jpt.eclipselink.core.EclipseLinkJpaFile;
+import org.eclipse.jpt.ui.WidgetFactory;
+import org.eclipse.jpt.ui.details.JpaDetailsPage;
+import org.eclipse.jpt.ui.details.JpaDetailsProvider;
+import org.eclipse.jpt.ui.internal.orm.details.OrmPersistentAttributeDetailsPage;
+import org.eclipse.jpt.ui.internal.orm.details.OrmPersistentTypeDetailsPage;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This provider is responsible for creating the {@link JpaDetailsPage}
+ * when the information comes from the XML file (either from the persistence
+ * configuration or from the Mappings Descriptor).
+ *
+ * @version 2.1
+ * @since 2.1
+ */
+public class OrmDetailsProvider
+ implements JpaDetailsProvider
+{
+ public OrmDetailsProvider() {
+ super();
+ }
+
+ public JpaDetailsPage<? extends JpaStructureNode> buildDetailsPage(
+ Composite parent,
+ JpaStructureNode structureNode,
+ WidgetFactory widgetFactory) {
+
+ if (structureNode.getId() == OrmStructureNodes.ENTITY_MAPPINGS_ID) {
+ //TODO JpaPlatformUi really needs a complete overhaul, this is not a good solution
+ if ((((XmlContextNode) structureNode).getEResource()).getType() == EclipseLinkJpaFile.ECLIPSELINK_ORM_RESOURCE_TYPE) {
+ return new EntityMappingsDetailsPage(parent, widgetFactory);
+ }
+ return new org.eclipse.jpt.ui.internal.orm.details.EntityMappingsDetailsPage(parent, widgetFactory);
+ }
+
+ if (structureNode.getId() == OrmStructureNodes.PERSISTENT_TYPE_ID) {
+ return new OrmPersistentTypeDetailsPage(parent, widgetFactory);
+ }
+
+ if (structureNode.getId() == OrmStructureNodes.PERSISTENT_ATTRIBUTE_ID) {
+ return new OrmPersistentAttributeDetailsPage(parent, widgetFactory);
+ }
+
+ return null;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceDetailsProvider.java
index 78c0b862ba..f8d90be378 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistencexml/details/PersistenceDetailsProvider.java
@@ -27,13 +27,13 @@ public class PersistenceDetailsProvider implements JpaDetailsProvider
public JpaDetailsPage<? extends JpaStructureNode> buildDetailsPage(
Composite parent,
- Object contentNodeId,
+ JpaStructureNode structureNode,
WidgetFactory widgetFactory) {
- if (contentNodeId == PersistenceStructureNodes.PERSISTENCE_ID) {
+ if (structureNode.getId() == PersistenceStructureNodes.PERSISTENCE_ID) {
return new PersistenceXmlDetailsPage(parent, widgetFactory);
}
- else if (contentNodeId == PersistenceStructureNodes.PERSISTENCE_UNIT_ID) {
+ else if (structureNode.getId() == PersistenceStructureNodes.PERSISTENCE_UNIT_ID) {
return new PersistenceXmlDetailsPage(parent, widgetFactory);
}
return null;
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUI.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUI.java
index f34cbd2541..f2ed1b5fe8 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUI.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUI.java
@@ -23,10 +23,12 @@ import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkJpaUiFactory;
import org.eclipse.jpt.eclipselink.ui.internal.ddlgen.EclipseLinkDDLGeneratorUi;
import org.eclipse.jpt.eclipselink.ui.internal.java.details.DefaultOneToManyMappingUiProvider;
import org.eclipse.jpt.eclipselink.ui.internal.java.details.DefaultOneToOneMappingUiProvider;
+import org.eclipse.jpt.eclipselink.ui.internal.orm.details.OrmDetailsProvider;
import org.eclipse.jpt.eclipselink.ui.internal.persistencexml.details.PersistenceDetailsProvider;
import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaDetailsProvider;
import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
+import org.eclipse.jpt.ui.internal.java.details.JavaDetailsProvider;
import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
import org.eclipse.jpt.ui.internal.structure.OrmResourceModelStructureProvider;
import org.eclipse.jpt.ui.navigator.JpaNavigatorProvider;
@@ -72,7 +74,11 @@ public class EclipseLinkJpaPlatformUI extends BaseJpaPlatformUi
@Override
protected void addDetailsProvidersTo(Collection<JpaDetailsProvider> providers) {
- super.addDetailsProvidersTo(providers);
+ //using a different OrmDetailsProvider and the one in BaseJpaPlatformUi.
+ //This is not the best solution here, just trying to make it work for M3.
+ //TODO JpaPlatformUi really needs a complete overhaul
+ providers.add(new JavaDetailsProvider());
+ providers.add(new OrmDetailsProvider());
providers.add(new PersistenceDetailsProvider());
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/JpaDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/JpaDetailsProvider.java
index b5bdfa7a09..3591aad024 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/JpaDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/JpaDetailsProvider.java
@@ -40,6 +40,6 @@ public interface JpaDetailsProvider
*/
JpaDetailsPage<? extends JpaStructureNode> buildDetailsPage(
Composite parent,
- Object contentNodeId,
+ JpaStructureNode structureNode,
WidgetFactory widgetFactory);
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java
index 1f7f36fde4..255885597d 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java
@@ -38,14 +38,14 @@ public class JavaDetailsProvider
*/
public JpaDetailsPage<? extends JpaStructureNode> buildDetailsPage(
Composite parent,
- Object contentNodeId,
+ JpaStructureNode structureNode,
WidgetFactory widgetFactory) {
- if (contentNodeId == JavaStructureNodes.PERSISTENT_TYPE_ID) {
+ if (structureNode.getId() == JavaStructureNodes.PERSISTENT_TYPE_ID) {
return new JavaPersistentTypeDetailsPage(parent, widgetFactory);
}
- if (contentNodeId == JavaStructureNodes.PERSISTENT_ATTRIBUTE_ID) {
+ if (structureNode.getId() == JavaStructureNodes.PERSISTENT_ATTRIBUTE_ID) {
return new JavaPersistentAttributeDetailsPage(parent, widgetFactory);
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/EntityMappingsDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/EntityMappingsDetailsPage.java
index 4b0a70204e..e1a2e4831c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/EntityMappingsDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/EntityMappingsDetailsPage.java
@@ -89,7 +89,7 @@ public class EntityMappingsDetailsPage extends AbstractJpaDetailsPage<EntityMapp
super(parent, widgetFactory);
}
- private EnumFormComboViewer<EntityMappings, AccessType> addAccessTypeCombo(Composite container) {
+ protected EnumFormComboViewer<EntityMappings, AccessType> addAccessTypeCombo(Composite container) {
return new EnumFormComboViewer<EntityMappings, AccessType>(this, container) {
@@ -131,7 +131,7 @@ public class EntityMappingsDetailsPage extends AbstractJpaDetailsPage<EntityMapp
};
}
- private CatalogCombo<EntityMappings> addCatalogCombo(Composite container) {
+ protected CatalogCombo<EntityMappings> addCatalogCombo(Composite container) {
return new CatalogCombo<EntityMappings>(this, container) {
@@ -159,7 +159,7 @@ public class EntityMappingsDetailsPage extends AbstractJpaDetailsPage<EntityMapp
};
}
- private PropertyValueModel<PersistenceUnitMetadata> buildPersistentUnitMetadaHolder() {
+ protected PropertyValueModel<PersistenceUnitMetadata> buildPersistentUnitMetadataHolder() {
return new TransformationPropertyValueModel<EntityMappings, PersistenceUnitMetadata>(getSubjectHolder()) {
@Override
protected PersistenceUnitMetadata transform_(EntityMappings value) {
@@ -168,7 +168,7 @@ public class EntityMappingsDetailsPage extends AbstractJpaDetailsPage<EntityMapp
};
}
- private SchemaCombo<EntityMappings> addSchemaCombo(Composite container) {
+ protected SchemaCombo<EntityMappings> addSchemaCombo(Composite container) {
return new SchemaCombo<EntityMappings>(this, container) {
@@ -238,7 +238,7 @@ public class EntityMappingsDetailsPage extends AbstractJpaDetailsPage<EntityMapp
// Persistence Unit Metadata widgets
new PersistenceUnitMetadataComposite(
this,
- buildPersistentUnitMetadaHolder(),
+ buildPersistentUnitMetadataHolder(),
addSubPane(container, 5)
);
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmDetailsProvider.java
index 3556e7c717..37918da2bc 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmDetailsProvider.java
@@ -33,18 +33,18 @@ public class OrmDetailsProvider
public JpaDetailsPage<? extends JpaStructureNode> buildDetailsPage(
Composite parent,
- Object contentNodeId,
+ JpaStructureNode structureNode,
WidgetFactory widgetFactory) {
- if (contentNodeId == OrmStructureNodes.ENTITY_MAPPINGS_ID) {
+ if (structureNode.getId() == OrmStructureNodes.ENTITY_MAPPINGS_ID) {
return new EntityMappingsDetailsPage(parent, widgetFactory);
}
- if (contentNodeId == OrmStructureNodes.PERSISTENT_TYPE_ID) {
+ if (structureNode.getId() == OrmStructureNodes.PERSISTENT_TYPE_ID) {
return new OrmPersistentTypeDetailsPage(parent, widgetFactory);
}
- if (contentNodeId == OrmStructureNodes.PERSISTENT_ATTRIBUTE_ID) {
+ if (structureNode.getId() == OrmStructureNodes.PERSISTENT_ATTRIBUTE_ID) {
return new OrmPersistentAttributeDetailsPage(parent, widgetFactory);
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java
index ba77e9501c..df8b202e31 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java
@@ -69,7 +69,7 @@ public class JpaDetailsView extends AbstractJpaView
JpaDetailsPage<? extends JpaStructureNode> page = detailsProvider.buildDetailsPage(
container,
- id,
+ structureNode,
getWidgetFactory()
);

Back to the top