Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2011-01-11 21:49:13 +0000
committerkmoore2011-01-11 21:49:13 +0000
commite4cc08c13b5fc669b0165f1f7d0aa9309d711b5c (patch)
treefb22007c81c024688ccbfb1f859271c4858a55b2 /jaxb/plugins/org.eclipse.jpt.jaxb.ui/src
parent469df7940ee373b6ff9261d9eb973069c87c88ba (diff)
downloadwebtools.dali-e4cc08c13b5fc669b0165f1f7d0aa9309d711b5c.tar.gz
webtools.dali-e4cc08c13b5fc669b0165f1f7d0aa9309d711b5c.tar.xz
webtools.dali-e4cc08c13b5fc669b0165f1f7d0aa9309d711b5c.zip
adding attribute mapping support - XmlAttribute, XmlElement, XmlTransient
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.ui/src')
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java60
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java9
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java58
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentFieldItemLabelProvider.java26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentPropertyItemLabelProvider.java25
6 files changed, 132 insertions, 48 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java
new file mode 100644
index 0000000000..b9d65a6924
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.jaxb.ui.internal;
+
+import org.eclipse.jpt.jaxb.core.MappingKeys;
+import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.swt.graphics.Image;
+
+public class JaxbMappingImageHelper
+{
+//
+// public static Image imageForTypeMapping(String mappingKey) {
+// return JptUiPlugin.getImage(iconKeyForTypeMapping(mappingKey));
+// }
+//
+// public static String iconKeyForTypeMapping(String mappingKey) {
+// if (MappingKeys.NULL_TYPE_MAPPING_KEY == mappingKey) {
+// return JptUiIcons.NULL_TYPE_MAPPING;
+// }
+// else if (MappingKeys.ENTITY_TYPE_MAPPING_KEY.equals(mappingKey)) {
+// return JptUiIcons.ENTITY;
+// }
+// else if (MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY.equals(mappingKey)) {
+// return JptUiIcons.EMBEDDABLE;
+// }
+// else if (MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY.equals(mappingKey)) {
+// return JptUiIcons.MAPPED_SUPERCLASS;
+// }
+// return null;
+// }
+
+ public static Image imageForAttributeMapping(String mappingKey) {
+ return JptJaxbUiPlugin.getImage(iconKeyForAttributeMapping(mappingKey));
+ }
+
+ public static String iconKeyForAttributeMapping(String mappingKey) {
+ if (MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY == mappingKey) {
+ return JptJaxbUiIcons.NULL_ATTRIBUTE_MAPPING;
+ }
+ else if (MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptJaxbUiIcons.XML_ATTRIBUTE;
+ }
+ else if (MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptJaxbUiIcons.XML_ELEMENT;
+ }
+ else if (MappingKeys.XML_TRANSIENT_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptJaxbUiIcons.XML_TRANSIENT;
+ }
+ //return the JAXB_CONTENT icon instead of null, might as well have an icon if one is not defined
+ return JptJaxbUiIcons.JAXB_CONTENT;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java
index 1b5ac5e342..b75773c347 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2010 Oracle. All rights reserved.
+* Copyright (c) 2010, 2011 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.
@@ -29,4 +29,11 @@ public class JptJaxbUiIcons
public static final String SCHEMA_GEN_WIZ_BANNER = "full/wizban/NewXSD";
public static final String CLASSES_GEN_WIZ_BANNER = "full/wizban/newclass_wiz";
public static final String JAXB_WIZ_BANNER = "full/wizban/new_jaxb_prj_wiz";
+
+
+ public static final String XML_ATTRIBUTE = "full/obj16/xml-attribute";
+ public static final String XML_ELEMENT = "full/obj16/xml-element";
+ public static final String XML_TRANSIENT = "full/obj16/xml-transient";
+ public static final String NULL_ATTRIBUTE_MAPPING = "full/obj16/null-attribute-mapping";
+
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java
new file mode 100644
index 0000000000..9630b0b20e
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.jaxb.ui.internal.jaxb21;
+
+import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
+import org.eclipse.jpt.jaxb.ui.internal.JaxbMappingImageHelper;
+import org.eclipse.jpt.ui.internal.jface.AbstractItemLabelProvider;
+import org.eclipse.jpt.ui.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.graphics.Image;
+
+
+public abstract class JaxbPersistentAttributeItemLabelProvider
+ extends AbstractItemLabelProvider {
+
+ public JaxbPersistentAttributeItemLabelProvider(
+ JaxbPersistentAttribute attribute, DelegatingContentAndLabelProvider labelProvider) {
+
+ super(attribute, labelProvider);
+ }
+
+
+ @Override
+ public JaxbPersistentAttribute model() {
+ return (JaxbPersistentAttribute) super.model();
+ }
+
+ @Override
+ protected PropertyValueModel<Image> buildImageModel() {
+ return new PropertyAspectAdapter<JaxbPersistentAttribute, Image>(
+ new String[] {JaxbPersistentAttribute.DEFAULT_MAPPING_KEY_PROPERTY, JaxbPersistentAttribute.MAPPING_PROPERTY},
+ model()) {
+ @Override
+ protected Image buildValue_() {
+ return JaxbMappingImageHelper.imageForAttributeMapping(this.subject.getMappingKey());
+ }
+ };
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildTextModel() {
+ return new StaticPropertyValueModel<String>(model().getName());
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildDescriptionModel() {
+ return new StaticPropertyValueModel<String>(model().getName());
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java
index a91c447eb1..33d21656e3 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentFieldItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentFieldItemLabelProvider.java
index 1e903de442..87a80a6d0b 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentFieldItemLabelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentFieldItemLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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
@@ -10,17 +10,11 @@
package org.eclipse.jpt.jaxb.ui.internal.jaxb21;
import org.eclipse.jpt.jaxb.core.context.JaxbPersistentField;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
-import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
-import org.eclipse.jpt.ui.internal.jface.AbstractItemLabelProvider;
import org.eclipse.jpt.ui.jface.DelegatingContentAndLabelProvider;
-import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.graphics.Image;
public class JaxbPersistentFieldItemLabelProvider
- extends AbstractItemLabelProvider {
+ extends JaxbPersistentAttributeItemLabelProvider {
public JaxbPersistentFieldItemLabelProvider(
JaxbPersistentField jaxbField, DelegatingContentAndLabelProvider labelProvider) {
@@ -33,19 +27,5 @@ public class JaxbPersistentFieldItemLabelProvider
public JaxbPersistentField model() {
return (JaxbPersistentField) super.model();
}
-
- @Override
- protected PropertyValueModel<Image> buildImageModel() {
- return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PERSISTENT_FIELD));
- }
-
- @Override
- protected PropertyValueModel<String> buildTextModel() {
- return new StaticPropertyValueModel<String>(model().getName());
- }
-
- @Override
- protected PropertyValueModel<String> buildDescriptionModel() {
- return new StaticPropertyValueModel<String>(model().getName());
- }
+
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentPropertyItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentPropertyItemLabelProvider.java
index 29bfd5698e..7e2c359274 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentPropertyItemLabelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentPropertyItemLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 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
@@ -10,17 +10,11 @@
package org.eclipse.jpt.jaxb.ui.internal.jaxb21;
import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
-import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
-import org.eclipse.jpt.ui.internal.jface.AbstractItemLabelProvider;
import org.eclipse.jpt.ui.jface.DelegatingContentAndLabelProvider;
-import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
-import org.eclipse.jpt.utility.model.value.PropertyValueModel;
-import org.eclipse.swt.graphics.Image;
public class JaxbPersistentPropertyItemLabelProvider
- extends AbstractItemLabelProvider {
+ extends JaxbPersistentAttributeItemLabelProvider {
public JaxbPersistentPropertyItemLabelProvider(
JaxbPersistentProperty jaxbProperty, DelegatingContentAndLabelProvider labelProvider) {
@@ -33,19 +27,4 @@ public class JaxbPersistentPropertyItemLabelProvider
public JaxbPersistentProperty model() {
return (JaxbPersistentProperty) super.model();
}
-
- @Override
- protected PropertyValueModel<Image> buildImageModel() {
- return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PERSISTENT_PROPERTY));
- }
-
- @Override
- protected PropertyValueModel<String> buildTextModel() {
- return new StaticPropertyValueModel<String>(model().getName());
- }
-
- @Override
- protected PropertyValueModel<String> buildDescriptionModel() {
- return new StaticPropertyValueModel<String>(model().getName());
- }
}

Back to the top