summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Butzke2012-09-19 12:48:57 (EDT)
committerKaren Butzke2012-09-19 14:29:11 (EDT)
commitd6c4962239112e52ba833dc494945d0ab7e11867 (patch)
tree67931a82487c9c43566b8a89618e09592608e493
parente3491e16cd355c3cc86ee1bc004676e80c013214 (diff)
downloadwebtools.dali-d6c4962239112e52ba833dc494945d0ab7e11867.zip
webtools.dali-d6c4962239112e52ba833dc494945d0ab7e11867.tar.gz
webtools.dali-d6c4962239112e52ba833dc494945d0ab7e11867.tar.bz2
simplifying MapAsComposite API
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java19
3 files changed, 19 insertions, 43 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java
index 4c8de82..d8800bf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.jpa.ui.internal.details;
import java.util.Comparator;
-import java.util.Iterator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -22,7 +21,6 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
@@ -122,8 +120,8 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
protected abstract DefaultMappingUiDefinition getDefaultDefinition(String mappingKey);
- protected MappingUiDefinition getMappingUiDefinition(String mappingKey) {
- return this.mappingChangeHandler.getMappingUiDefinition(mappingKey);
+ protected MappingUiDefinition getMappingUiDefinition() {
+ return this.mappingChangeHandler.getMappingUiDefinition();
}
/**
@@ -293,7 +291,7 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
* mapping being edited
*/
protected MappingUiDefinition initialSelection() {
- return this.mappingChangeHandler.getMappingUiDefinition(getMappingKey());
+ return this.mappingChangeHandler.getMappingUiDefinition();
}
/**
@@ -310,14 +308,6 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
}
/**
- * Returns the mapping key representing the current mapping object.
- *
- * @return A non-<code>null</code> unique identifier representing the type
- * of the mapping being edited
- */
- protected abstract String getMappingKey();
-
- /**
* Aks the <code>MappingChangeHandler</code> to change the mapping type using
* the given <code>MappingUiDefinition</code>.
*
@@ -456,19 +446,19 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
String getName();
/**
- * Returns the list of mapping UI definitions that are registered with the JPT plugin.
+ * Returns the list of mapping UI definitions that are registered with the JpaPlatformUi.
*
* @return The supported types of mapping
*/
Iterable<MappingUiDefinition<T, ?>> getMappingUiDefinitions();
/**
- * Returns the mapping UI definition for the specified mapping key
- * that is registered with the JPT plugin.
+ * Returns the mapping UI definition for current mapping
+ * that is registered with the JpaPlatformUi.
*
* @return The supported types of mapping
*/
- MappingUiDefinition<T, ?> getMappingUiDefinition(String mappingKey);
+ MappingUiDefinition<T, ?> getMappingUiDefinition();
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java
index 351fdb6..a05a4c6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java
@@ -24,9 +24,6 @@ import org.eclipse.swt.widgets.Composite;
/**
* This "Map As" composite is responsible for showing the mapping name and
* mapping type for an attribute.
- *
- * @see JavaPersistentAttributeMapAsComposite
- * @see OrmPersistentAttributeMapAsComposite
*/
public class PersistentAttributeMapAsComposite
extends MapAsComposite<ReadOnlyPersistentAttribute>
@@ -52,8 +49,6 @@ public class PersistentAttributeMapAsComposite
super(parentPane, parent, enabledModel);
}
-
- @Override
protected String getMappingKey() {
return getSubject().getMappingKey();
}
@@ -85,7 +80,7 @@ public class PersistentAttributeMapAsComposite
return mapping.isDefault() ?
getDefaultDefinition(mappingKey).getLinkLabel() :
- getMappingUiDefinition(mappingKey).getLinkLabel();
+ getMappingUiDefinition().getLinkLabel();
}
public void morphMapping(MappingUiDefinition definition) {
@@ -100,8 +95,8 @@ public class PersistentAttributeMapAsComposite
return getAttributeMappingUiDefinitions();
}
- public MappingUiDefinition getMappingUiDefinition(String mappingKey) {
- return getAttributeMappingUiDefinition(mappingKey);
+ public MappingUiDefinition getMappingUiDefinition() {
+ return getAttributeMappingUiDefinition();
}
}
@@ -109,8 +104,8 @@ public class PersistentAttributeMapAsComposite
return getJpaPlatformUi().getAttributeMappingUiDefinitions(getSubject().getResourceType());
}
- protected MappingUiDefinition<? extends ReadOnlyPersistentAttribute, ?> getAttributeMappingUiDefinition(String mappingKey) {
- return getJpaPlatformUi().getAttributeMappingUiDefinition(getSubject().getResourceType(), mappingKey);
+ protected MappingUiDefinition<? extends ReadOnlyPersistentAttribute, ?> getAttributeMappingUiDefinition() {
+ return getJpaPlatformUi().getAttributeMappingUiDefinition(getSubject().getResourceType(), getMappingKey());
}
@Override
@@ -124,8 +119,8 @@ public class PersistentAttributeMapAsComposite
}
@Override
- protected MappingUiDefinition getMappingUiDefinition(String mappingKey) {
- MappingUiDefinition definition = super.getMappingUiDefinition(mappingKey);
+ protected MappingUiDefinition getMappingUiDefinition() {
+ MappingUiDefinition definition = super.getMappingUiDefinition();
return (definition != null) ? definition : UnsupportedOrmAttributeMappingUiDefinition.instance();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java
index 2266c31..337f094 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.jpa.ui.internal.details;
import java.util.Collection;
-import java.util.Iterator;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.ui.details.DefaultMappingUiDefinition;
@@ -20,12 +19,6 @@ import org.eclipse.swt.widgets.Composite;
/**
* This "Map As" composite is responsible for showing the mapping name and
* mapping type for a type.
- *
- * @see JavaPersistentTypeMapAsComposite
- * @see OrmPersistentTypeMapAsComposite
- *
- * @version 2.2
- * @since 2.0
*/
public class PersistentTypeMapAsComposite
extends MapAsComposite<PersistentType>
@@ -43,8 +36,6 @@ public class PersistentTypeMapAsComposite
super(parentPane, parent);
}
-
- @Override
protected String getMappingKey() {
return getSubject().getMappingKey();
}
@@ -65,7 +56,7 @@ public class PersistentTypeMapAsComposite
}
public String getMappingText() {
- return getMappingUiDefinition(getMappingKey()).getLinkLabel();
+ return getMappingUiDefinition().getLinkLabel();
}
public void morphMapping(MappingUiDefinition definition) {
@@ -80,8 +71,8 @@ public class PersistentTypeMapAsComposite
return getTypeMappingUiDefinitions();
}
- public MappingUiDefinition getMappingUiDefinition(String mappingKey) {
- return getTypeMappingUiDefinition(mappingKey);
+ public MappingUiDefinition getMappingUiDefinition() {
+ return getTypeMappingUiDefinition();
}
}
@@ -94,8 +85,8 @@ public class PersistentTypeMapAsComposite
return getJpaPlatformUi().getTypeMappingUiDefinitions(getSubject().getResourceType());
}
- protected MappingUiDefinition<? extends PersistentType, ?> getTypeMappingUiDefinition(String mappingKey) {
- return getJpaPlatformUi().getTypeMappingUiDefinition(getSubject().getResourceType(), mappingKey);
+ protected MappingUiDefinition<? extends PersistentType, ?> getTypeMappingUiDefinition() {
+ return getJpaPlatformUi().getTypeMappingUiDefinition(getSubject().getResourceType(), getMappingKey());
}
@Override