Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkchan2005-11-25 20:45:09 +0000
committerkchan2005-11-25 20:45:09 +0000
commite7e7190b3bd1e8515e813e86bdc9d0cbc9afce48 (patch)
tree9052e05a4de3fbbec6fbe4ac30b63de1b147bb61 /bundles/org.eclipse.jst.ws/src/org/eclipse
parentb0e3deeec667324f46ac9b6aebf911cca8db1524 (diff)
downloadwebtools.webservices-e7e7190b3bd1e8515e813e86bdc9d0cbc9afce48.tar.gz
webtools.webservices-e7e7190b3bd1e8515e813e86bdc9d0cbc9afce48.tar.xz
webtools.webservices-e7e7190b3bd1e8515e813e86bdc9d0cbc9afce48.zip
[116481] wst.command.env has dependancy on jface.
Diffstat (limited to 'bundles/org.eclipse.jst.ws/src/org/eclipse')
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2PathTransformer.java32
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2SelectionTransformer.java73
2 files changed, 105 insertions, 0 deletions
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2PathTransformer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2PathTransformer.java
new file mode 100644
index 000000000..da7e1da65
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2PathTransformer.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.common;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.command.internal.env.core.data.Transformer;
+
+/**
+ *
+ * Transforms a input String to a Path
+ *
+ * @author joan
+ *
+ */
+
+public class String2PathTransformer implements Transformer {
+
+ public Object transform(Object value) {
+ Path path = new Path(value.toString());
+ return path;
+ }
+
+}
+
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2SelectionTransformer.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2SelectionTransformer.java
new file mode 100644
index 000000000..a311c1f24
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/String2SelectionTransformer.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.internal.common;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jem.java.JavaClass;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jst.j2ee.ejb.EJBJar;
+import org.eclipse.jst.j2ee.ejb.EJBResource;
+import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit;
+import org.eclipse.wst.command.internal.env.common.FileResourceUtils;
+import org.eclipse.wst.command.internal.env.core.data.Transformer;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+/**
+ * Transforms a string value representing a workspace resource path into a StructuredSelection object
+ *
+ * @author joan
+ *
+ */
+
+public class String2SelectionTransformer implements Transformer {
+
+ public Object transform(Object value) {
+
+ StructuredSelection selection = null;
+ IResource resource = FileResourceUtils.getWorkspaceRoot().findMember(new Path(value.toString()));
+ IProject resProject = resource.getProject();
+
+ // check if resource is part of an EJB
+ if (J2EEUtils.isEJBComponent(resProject))
+ {
+ // if resource is part of EJB need to get the EnterpriseBean as the selection
+ IVirtualComponent[] ejbComponents = J2EEUtils.getEJBComponents(resProject);
+ EJBArtifactEdit ejbEdit = null;
+ try{
+ ejbEdit = EJBArtifactEdit.getEJBArtifactEditForRead(ejbComponents[0]);
+ EJBResource ejbRes = ejbEdit.getEJBJarXmiResource();
+ EJBJar ejbJar = ejbRes.getEJBJar();
+ String resourceFilename =resource.getName();
+ String javaClassName = resourceFilename.substring(resourceFilename.indexOf('.'));
+ JavaClass javaClass = JavaMOFUtils.getJavaClass(javaClassName, resProject);
+ EnterpriseBean ejb = ejbJar.getEnterpriseBeanWithReference(javaClass);
+ selection = new StructuredSelection(ejb.getName());
+ }
+ catch (Exception exc)
+ {
+
+ }
+ finally {
+ if (ejbEdit!=null)
+ ejbEdit.dispose();
+ }
+ }
+ else if (resource != null)
+ {
+ selection = new StructuredSelection(resource);
+ }
+ return selection;
+ }
+
+}

Back to the top