diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java | 72 |
1 files changed, 5 insertions, 67 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java index a7ff6dfe03..a0de016858 100644 --- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java +++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. + * Copyright (c) 2006, 2009 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. @@ -9,19 +9,11 @@ ******************************************************************************/ package org.eclipse.jpt.ui.internal.java.details; -import java.util.Iterator; -import org.eclipse.jpt.core.context.AttributeMapping; -import org.eclipse.jpt.core.context.PersistentAttribute; import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.AttributeMappingUiProvider; -import org.eclipse.jpt.ui.details.DefaultAttributeMappingUiProvider; import org.eclipse.jpt.ui.internal.details.PersistentAttributeDetailsPage; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; +import org.eclipse.jpt.ui.internal.mappings.details.PersistentAttributeMapAsComposite; import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.part.PageBook; /** * The default implementation of the details page used for the Java persistent @@ -45,7 +37,7 @@ import org.eclipse.ui.part.PageBook; * @see JavaPersistentAttribute * @see JavaPersistentTypeMapAsComposite * - * @version 2.0 + * @version 2.2 * @since 2.0 */ public class JavaPersistentAttributeDetailsPage extends PersistentAttributeDetailsPage<JavaPersistentAttribute> @@ -63,68 +55,14 @@ public class JavaPersistentAttributeDetailsPage extends PersistentAttributeDetai } @Override - protected Iterator<AttributeMappingUiProvider<? extends AttributeMapping>> attributeMappingUiProviders() { - return getJpaPlatformUi().javaAttributeMappingUiProviders(); - } - - /** - * These AtttributeMappingUiProviders will be used as elements in the attributeMapping combo - * The first element in the combo will be one of the defaultAttributeMappingUiProviders or - * if none of those apply the nullAttributeMappingUiProvider will be used. The rest of the elements - * will be the attributeMappingUiProviders. The defaultAttributeMappingUiProvider is - * determined by matching its key with the key of the current attributeMapping. - */ - @Override - protected AttributeMappingUiProvider<? extends AttributeMapping>[] attributeMappingUiProvidersFor(PersistentAttribute persistentAttribute) { - AttributeMappingUiProvider<? extends AttributeMapping>[] providers = new AttributeMappingUiProvider<?>[CollectionTools.size(attributeMappingUiProviders()) + 1]; - providers[0] = getDefaultAttributeMappingUiProvider(persistentAttribute.getDefaultMappingKey()); - int i = 1; - for (Iterator<AttributeMappingUiProvider<? extends AttributeMapping>> iterator = attributeMappingUiProviders(); iterator.hasNext(); ) { - providers[i++] = iterator.next(); - } - return providers; - } - - @Override - protected DefaultAttributeMappingUiProvider<? extends AttributeMapping> getDefaultAttributeMappingUiProvider(String key) { - for (Iterator<DefaultAttributeMappingUiProvider<? extends AttributeMapping>> i = defaultAttributeMappingUiProviders(); i.hasNext(); ) { - DefaultAttributeMappingUiProvider<? extends AttributeMapping> provider = i.next(); - - if (provider.getDefaultKey() == key) { - return provider; - } - } - - return this.nullAttributeMappingUiProvider(); - } - - @Override - protected Iterator<DefaultAttributeMappingUiProvider<? extends AttributeMapping>> defaultAttributeMappingUiProviders() { - return getJpaPlatformUi().defaultJavaAttributeMappingUiProviders(); - } - - @Override protected void initializeLayout(Composite container) { // Map as composite - new JavaPersistentAttributeMapAsComposite( + new PersistentAttributeMapAsComposite( this, addSubPane(container, 0, 0, 5, 0) ); - // Mapping properties page - PageBook mappingPane = buildMappingPageBook(container); - - GridData gridData = new GridData(); - gridData.horizontalAlignment = SWT.FILL; - gridData.verticalAlignment = SWT.TOP; - gridData.grabExcessHorizontalSpace = true; - gridData.grabExcessVerticalSpace = true; - - mappingPane.setLayoutData(gridData); - } - - protected DefaultAttributeMappingUiProvider<AttributeMapping> nullAttributeMappingUiProvider() { - return NullAttributeMappingUiProvider.instance(); + buildMappingPageBook(container); } }
\ No newline at end of file |