diff options
author | kmoore | 2011-02-15 22:39:54 +0000 |
---|---|---|
committer | kmoore | 2011-02-15 22:39:54 +0000 |
commit | 542105a7f2293bad776fcea3c48a6691300c2b11 (patch) | |
tree | 0b037c3dc6df708942c2b80c9db5bb93903785b5 /jaxb/plugins/org.eclipse.jpt.jaxb.ui/src | |
parent | 19af78230ff2c9ae094f0efebe1cc408e589fc24 (diff) | |
download | webtools.dali-542105a7f2293bad776fcea3c48a6691300c2b11.tar.gz webtools.dali-542105a7f2293bad776fcea3c48a6691300c2b11.tar.xz webtools.dali-542105a7f2293bad776fcea3c48a6691300c2b11.zip |
336388 - added preliminary JaxbTransientType support to the JAXB context
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.ui/src')
7 files changed, 129 insertions, 38 deletions
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 f5667f9e26..13cc8458a0 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 @@ -20,6 +20,7 @@ public class JptJaxbUiIcons public static final String PERSISTENT_CLASS = "full/obj16/persistent_class"; public static final String PERSISTENT_ENUM = "full/obj16/persistent_enum"; public static final String TRANSIENT_CLASS = "full/obj16/transient_class"; + public static final String REGISTRY = "full/obj16/registry"; public static final String PERSISTENT_FIELD = "full/obj16/persistent_field"; public static final String PERSISTENT_PROPERTY = "full/obj16/persistent_property"; diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java index f943f3db3a..12ddba7c75 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.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 @@ -15,10 +15,12 @@ import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; import org.eclipse.jpt.jaxb.core.context.JaxbPackage; +import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; import org.eclipse.jpt.jaxb.core.context.JaxbPersistentField; import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty; -import org.eclipse.jpt.jaxb.core.context.JaxbType; +import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; +import org.eclipse.jpt.jaxb.core.context.JaxbTransientType; public class GenericJaxb_2_1_NavigatorItemLabelProviderFactory @@ -50,11 +52,17 @@ public class GenericJaxb_2_1_NavigatorItemLabelProviderFactory else if (item instanceof JaxbPackage) { return new JaxbPackageItemLabelProvider((JaxbPackage) item, contentAndLabelProvider); } + else if (item instanceof JaxbRegistry) { + return new JaxbRegistryItemLabelProvider((JaxbRegistry) item, contentAndLabelProvider); + } + else if (item instanceof JaxbPersistentClass) { + return new JaxbPersistentClassItemLabelProvider((JaxbPersistentClass) item, contentAndLabelProvider); + } else if (item instanceof JaxbPersistentEnum) { return new JaxbPersistentEnumItemLabelProvider((JaxbPersistentEnum) item, contentAndLabelProvider); } - else if (item instanceof JaxbType) { - return new JaxbTypeItemLabelProvider((JaxbType) item, contentAndLabelProvider); + else if (item instanceof JaxbTransientType) { + return new JaxbTransientTypeItemLabelProvider((JaxbTransientType) item, contentAndLabelProvider); } else if (item instanceof JaxbPersistentField) { return new JaxbPersistentFieldItemLabelProvider((JaxbPersistentField) item, contentAndLabelProvider); diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemLabelProvider.java new file mode 100644 index 0000000000..d13e1c3664 --- /dev/null +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemLabelProvider.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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 + * + * Contributors: + * Oracle - initial API and implementation + *******************************************************************************/ +package org.eclipse.jpt.jaxb.ui.internal.jaxb21; + +import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; +import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; +import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; +import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; +import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; +import org.eclipse.swt.graphics.Image; + + +public class JaxbPersistentClassItemLabelProvider + extends JaxbTypeItemLabelProvider { + + public JaxbPersistentClassItemLabelProvider( + JaxbPersistentClass jaxbPersistentClass, DelegatingContentAndLabelProvider labelProvider) { + + super(jaxbPersistentClass, labelProvider); + } + + @Override + protected PropertyValueModel<Image> buildImageModel() { + return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PERSISTENT_CLASS)); + } +} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java index 08d0114d95..36e6c40455 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.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 @@ -9,7 +9,6 @@ *******************************************************************************/ package org.eclipse.jpt.jaxb.ui.internal.jaxb21; -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; @@ -20,7 +19,7 @@ import org.eclipse.swt.graphics.Image; public class JaxbPersistentEnumItemLabelProvider - extends AbstractItemLabelProvider { + extends JaxbTypeItemLabelProvider { public JaxbPersistentEnumItemLabelProvider( JaxbPersistentEnum jaxbEnum, DelegatingContentAndLabelProvider labelProvider) { @@ -29,23 +28,7 @@ public class JaxbPersistentEnumItemLabelProvider } @Override - public JaxbPersistentEnum model() { - return (JaxbPersistentEnum) super.model(); - } - - @Override protected PropertyValueModel<Image> buildImageModel() { return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PERSISTENT_ENUM)); } - - @Override - protected PropertyValueModel<String> buildTextModel() { - return new StaticPropertyValueModel(model().getTypeQualifiedName()); - } - - @Override - protected PropertyValueModel<String> buildDescriptionModel() { - return new StaticPropertyValueModel( - model().getFullyQualifiedName() + " - " + model().getResource().getFullPath().makeRelative()); - } } diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemLabelProvider.java new file mode 100644 index 0000000000..4d897515e1 --- /dev/null +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemLabelProvider.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.common.ui.jface.DelegatingContentAndLabelProvider; +import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; +import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; +import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; +import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; +import org.eclipse.swt.graphics.Image; + + +public class JaxbRegistryItemLabelProvider + extends JaxbTypeItemLabelProvider { + + public JaxbRegistryItemLabelProvider( + JaxbRegistry jaxbRegistry, DelegatingContentAndLabelProvider labelProvider) { + + super(jaxbRegistry, labelProvider); + } + + @Override + protected PropertyValueModel<Image> buildImageModel() { + return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.REGISTRY)); + } +} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTransientTypeItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTransientTypeItemLabelProvider.java new file mode 100644 index 0000000000..a699bcf74c --- /dev/null +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTransientTypeItemLabelProvider.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * 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.common.ui.jface.DelegatingContentAndLabelProvider; +import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; +import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; +import org.eclipse.jpt.jaxb.core.context.JaxbTransientType; +import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; +import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; +import org.eclipse.swt.graphics.Image; + + +public class JaxbTransientTypeItemLabelProvider + extends JaxbTypeItemLabelProvider { + + public JaxbTransientTypeItemLabelProvider( + JaxbTransientType jaxbTransientType, DelegatingContentAndLabelProvider labelProvider) { + + super(jaxbTransientType, labelProvider); + } + + @Override + protected PropertyValueModel<Image> buildImageModel() { + return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.TRANSIENT_CLASS)); + } +} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java index 2e64650d86..20dac55e72 100644 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java +++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.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 @@ -14,36 +14,33 @@ import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; import org.eclipse.jpt.jaxb.core.context.JaxbType; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; -public class JaxbTypeItemLabelProvider +public abstract class JaxbTypeItemLabelProvider extends AbstractItemLabelProvider { - public JaxbTypeItemLabelProvider( + protected JaxbTypeItemLabelProvider( JaxbType jaxbType, DelegatingContentAndLabelProvider labelProvider) { super(jaxbType, labelProvider); } - - @Override - protected PropertyValueModel<Image> buildImageModel() { - return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PERSISTENT_CLASS)); + public JaxbType model() { + return (JaxbType) super.model(); } - + @Override protected PropertyValueModel<String> buildTextModel() { - return new StaticPropertyValueModel(((JaxbType) model()).getTypeQualifiedName()); + return new StaticPropertyValueModel<String>(model().getTypeQualifiedName()); } @Override protected PropertyValueModel<String> buildDescriptionModel() { - JaxbType type = (JaxbType) model(); - return new StaticPropertyValueModel( - type.getFullyQualifiedName() + " - " + type.getResource().getFullPath().makeRelative()); + StringBuilder sb = new StringBuilder(); + sb.append(model().getFullyQualifiedName()); + sb.append(" - "); //$NON-NLS-1$ + sb.append(model().getResource().getFullPath().makeRelative()); + return new StaticPropertyValueModel<String>(sb.toString()); } } |