Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jaxb
diff options
context:
space:
mode:
authorPaul Fullbright2012-09-19 12:58:51 -0400
committerPaul Fullbright2012-09-19 13:11:50 -0400
commitb8216a510948c5450cddd673b9598e2847ff3e0c (patch)
tree080cdfaf004683c02180d527deb4b30656230d63 /jaxb
parentbe4c19e21a14963533cadf1a3b016178a6c13b85 (diff)
downloadwebtools.dali-b8216a510948c5450cddd673b9598e2847ff3e0c.tar.gz
webtools.dali-b8216a510948c5450cddd673b9598e2847ff3e0c.tar.xz
webtools.dali-b8216a510948c5450cddd673b9598e2847ff3e0c.zip
added oxm files to project explorer
Diffstat (limited to 'jaxb')
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/oxm-file.gifbin0 -> 967 bytes
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/oxm-file.icobin0 -> 1150 bytes
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorItemLabelProviderFactory.java29
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorTreeItemContentProviderFactory.java52
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorUi.java6
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbPackageContentProvider.java51
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/JptJaxbEclipseLinkUiIcons.java7
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/OxmFileContentProvider.java35
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java13
9 files changed, 184 insertions, 9 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/oxm-file.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/oxm-file.gif
new file mode 100644
index 0000000000..1fb940df94
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/oxm-file.gif
Binary files differ
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/oxm-file.ico b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/oxm-file.ico
new file mode 100644
index 0000000000..2d08f4b3fd
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/oxm-file.ico
Binary files differ
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorItemLabelProviderFactory.java
index 52d9500cb7..00c4a13f32 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorItemLabelProviderFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorItemLabelProviderFactory.java
@@ -9,8 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jaxb.eclipselink.ui.internal;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jpt.common.ui.internal.jface.StaticItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.oxm.OxmFile;
+import org.eclipse.jpt.jaxb.eclipselink.ui.internal.plugin.JptJaxbEclipseLinkUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.jaxb21.GenericJaxb_2_1_NavigatorItemLabelProviderFactory;
@@ -36,7 +40,32 @@ public class ELJaxbNavigatorItemLabelProviderFactory
if (item instanceof JaxbPersistentAttribute) {
return new ELJaxbPersistentAttributeItemLabelProvider((JaxbPersistentAttribute) item, manager);
}
+ else if (item instanceof OxmFile) {
+ return buildOxmFileLabelProvider((OxmFile) item, manager);
+ }
return super.buildProvider(item, manager);
}
+
+ protected ItemExtendedLabelProvider buildOxmFileLabelProvider(OxmFile file, ItemExtendedLabelProvider.Manager manager) {
+ return new StaticItemExtendedLabelProvider(
+ JptJaxbEclipseLinkUiPlugin.instance().getImage(JptJaxbEclipseLinkUiIcons.OXM_FILE),
+ buildOxmFileText(file),
+ buildOxmFileDescription(file)
+ );
+ }
+
+ private String buildOxmFileText(OxmFile file) {
+ StringBuffer text = new StringBuffer();
+ IPath path = file.getOxmResource().getFile().getRawLocation();
+ text.append(path.lastSegment());
+ text.append(" - ");
+ text.append(path.removeLastSegments(1).toOSString());
+ return text.toString();
+ }
+
+ private String buildOxmFileDescription(OxmFile file) {
+ // the same, for now
+ return buildOxmFileText(file);
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorTreeItemContentProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorTreeItemContentProviderFactory.java
new file mode 100644
index 0000000000..b1dfb79e47
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorTreeItemContentProviderFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.eclipselink.ui.internal;
+
+import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
+import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider.Manager;
+import org.eclipse.jpt.jaxb.core.context.JaxbPackage;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.ELJaxbPackage;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.oxm.OxmFile;
+import org.eclipse.jpt.jaxb.ui.internal.jaxb21.GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory;
+
+public class ELJaxbNavigatorTreeItemContentProviderFactory
+ extends GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory {
+
+ private static ELJaxbNavigatorTreeItemContentProviderFactory INSTANCE
+ = new ELJaxbNavigatorTreeItemContentProviderFactory();
+
+
+ public static ELJaxbNavigatorTreeItemContentProviderFactory instance() {
+ return INSTANCE;
+ }
+
+
+ private ELJaxbNavigatorTreeItemContentProviderFactory() {
+ super();
+ }
+
+
+ @Override
+ public ItemTreeContentProvider buildProvider(Object item, Manager manager) {
+ if (item instanceof OxmFile) {
+ return buildOxmFileContentProvider((OxmFile) item, manager);
+ }
+ return super.buildProvider(item, manager);
+ }
+
+ @Override
+ protected ItemTreeContentProvider buildJaxbPackageProvider(JaxbPackage item, Manager manager) {
+ return new ELJaxbPackageContentProvider((ELJaxbPackage) item, manager);
+ }
+
+ protected ItemTreeContentProvider buildOxmFileContentProvider(OxmFile item, Manager manager) {
+ return new OxmFileContentProvider(item, manager);
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorUi.java
index 86a9cfa556..6ee7708c6a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorUi.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorUi.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jaxb.eclipselink.ui.internal;
import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProviderFactory;
+import org.eclipse.jpt.common.ui.jface.ItemTreeContentProviderFactory;
import org.eclipse.jpt.jaxb.ui.internal.jaxb21.GenericJaxb_2_1_NavigatorUi;
@@ -33,4 +34,9 @@ public class ELJaxbNavigatorUi
public ItemExtendedLabelProviderFactory getItemLabelProviderFactory() {
return ELJaxbNavigatorItemLabelProviderFactory.instance();
}
+
+ @Override
+ public ItemTreeContentProviderFactory getTreeItemContentProviderFactory() {
+ return ELJaxbNavigatorTreeItemContentProviderFactory.instance();
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbPackageContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbPackageContentProvider.java
new file mode 100644
index 0000000000..13e6be02b4
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbPackageContentProvider.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.eclipselink.ui.internal;
+
+import org.eclipse.jpt.common.utility.internal.NotNullFilter;
+import org.eclipse.jpt.common.utility.internal.model.value.CompositeCollectionValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.FilteringCollectionValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter;
+import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
+import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.ELJaxbPackage;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.oxm.OxmFile;
+import org.eclipse.jpt.jaxb.ui.internal.jaxb21.JaxbPackageItemContentProvider;
+
+public class ELJaxbPackageContentProvider
+ extends JaxbPackageItemContentProvider {
+
+ public ELJaxbPackageContentProvider(ELJaxbPackage jaxbPackage, Manager manager) {
+ super(jaxbPackage, manager);
+ }
+
+
+ @Override
+ protected CollectionValueModel<JaxbContextNode> buildChildrenModel() {
+ return new CompositeCollectionValueModel(
+ buildOxmFileChildrenModel(),
+ super.buildChildrenModel());
+ }
+
+ protected CollectionValueModel<JaxbContextNode> buildOxmFileChildrenModel() {
+ return new FilteringCollectionValueModel(
+ new PropertyCollectionValueModelAdapter(
+ new PropertyAspectAdapter<ELJaxbPackage, OxmFile>(
+ ELJaxbPackage.OXM_FILE_PROPERTY,
+ (ELJaxbPackage) ELJaxbPackageContentProvider.this.item) {
+ @Override
+ protected OxmFile buildValue_() {
+ return this.subject.getOxmFile();
+ }
+ }),
+ NotNullFilter.instance());
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/JptJaxbEclipseLinkUiIcons.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/JptJaxbEclipseLinkUiIcons.java
index e9e4faacdf..db18d7220b 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/JptJaxbEclipseLinkUiIcons.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/JptJaxbEclipseLinkUiIcons.java
@@ -12,7 +12,8 @@ package org.eclipse.jpt.jaxb.eclipselink.ui.internal;
public class JptJaxbEclipseLinkUiIcons {
- public static final String XML_INVERSE_REFERENCE = "full/obj16/xml-inverse-reference";
- public static final String XML_JOIN_NODES = "full/obj16/xml-join-nodes";
- public static final String XML_TRANSFORMATION = "full/obj16/xml-transformation";
+ public static final String OXM_FILE = "full/obj16/oxm-file"; //$NON-NLS-1$
+ public static final String XML_INVERSE_REFERENCE = "full/obj16/xml-inverse-reference"; //$NON-NLS-1$
+ public static final String XML_JOIN_NODES = "full/obj16/xml-join-nodes"; //$NON-NLS-1$
+ public static final String XML_TRANSFORMATION = "full/obj16/xml-transformation"; //$NON-NLS-1$
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/OxmFileContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/OxmFileContentProvider.java
new file mode 100644
index 0000000000..4ad116f0d2
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/OxmFileContentProvider.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.eclipselink.ui.internal;
+
+import org.eclipse.jpt.common.ui.internal.jface.AbstractItemTreeContentProvider;
+import org.eclipse.jpt.common.utility.internal.model.value.NullCollectionValueModel;
+import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
+import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.ELJaxbPackage;
+import org.eclipse.jpt.jaxb.eclipselink.core.context.oxm.OxmFile;
+
+public class OxmFileContentProvider
+ extends AbstractItemTreeContentProvider<OxmFile, JaxbContextNode> {
+
+ public OxmFileContentProvider(OxmFile item, Manager manager) {
+ super(item, manager);
+ }
+
+
+ public ELJaxbPackage getParent() {
+ return (ELJaxbPackage) this.item.getContextRoot().getPackage(this.item.getPackageName());
+ }
+
+ @Override
+ protected CollectionValueModel<JaxbContextNode> buildChildrenModel() {
+ return new NullCollectionValueModel();
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java
index 37fc82362f..7db5dd401f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java
@@ -10,15 +10,16 @@
package org.eclipse.jpt.jaxb.ui.internal.jaxb21;
import org.eclipse.jpt.common.ui.internal.jface.AbstractItemTreeContentProvider;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter;
import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
+import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot;
import org.eclipse.jpt.jaxb.core.context.JaxbPackage;
-import org.eclipse.jpt.jaxb.core.context.JaxbType;
public class JaxbPackageItemContentProvider
- extends AbstractItemTreeContentProvider<JaxbPackage, JaxbType> {
+ extends AbstractItemTreeContentProvider<JaxbPackage, JaxbContextNode> {
public JaxbPackageItemContentProvider(JaxbPackage jaxbPackage, Manager manager) {
super(jaxbPackage, manager);
@@ -30,12 +31,12 @@ public class JaxbPackageItemContentProvider
}
@Override
- protected CollectionValueModel<JaxbType> buildChildrenModel() {
- return new CollectionAspectAdapter<JaxbContextRoot, JaxbType>(
+ protected CollectionValueModel<JaxbContextNode> buildChildrenModel() {
+ return new CollectionAspectAdapter<JaxbContextRoot, JaxbContextNode>(
JaxbContextRoot.TYPES_COLLECTION, getParent()) {
@Override
- protected Iterable<JaxbType> getIterable() {
- return this.subject.getTypes(JaxbPackageItemContentProvider.this.item);
+ protected Iterable<JaxbContextNode> getIterable() {
+ return new SuperIterableWrapper(this.subject.getTypes(JaxbPackageItemContentProvider.this.item));
}
};
}

Back to the top