JAX-WS DOM Tools check-in
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.classpath b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.classpath
new file mode 100755
index 0000000..2d1a430
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.project b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.project
new file mode 100755
index 0000000..0b19add
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.ws.jaxws.dom.integration</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..ae0484e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jul 20 15:25:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..e1f9838
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: DOM Integration (Incubation)
+Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.dom.integration;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationPlugin
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.jdt.core,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.navigator,
+ org.eclipse.wst.validation,
+ org.eclipse.jdt.ui,
+ org.eclipse.jst.j2ee.core,
+ org.eclipse.jst.jee.ui,
+ org.eclipse.jem.util,
+ org.eclipse.jst.ws.jaxws.dom.ui,
+ org.eclipse.jst.ws.jaxws.utils
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.jst.ws.jaxws.dom.integration.navigator,
+ org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions,
+ org.eclipse.jst.ws.jaxws.dom.integration.validation
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/about.html b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/about.html
new file mode 100644
index 0000000..8410afb
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 15, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/build.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/build.properties
new file mode 100755
index 0000000..df4e79e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/build.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# 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:
+# SAP AG - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.properties
new file mode 100755
index 0000000..4f2cc83
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# 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:
+# SAP AG - initial API and implementation
+###############################################################################
+###############################################################################
+# Language File for this Plugin
+###############################################################################
+
+# Generic Label and Description
+DomValidator_Name = Web Services Validation
+DomValidation_MarkerName = Web Services Problem Marker
+navigatorContent.name.0 = JAX-WS Web Services Elements
+decorator.label.0 = Web Service Decorator
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.xml b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.xml
new file mode 100755
index 0000000..4037979
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/plugin.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2009 by SAP AG, Walldorf.
+ 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:
+ SAP AG - initial API and implementation
+ -->
+
+<plugin>
+ <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
+ <factory
+ uri = "http:///org/eclipse/jst/ws/jaxws/dom/runtime/dom.ecore"
+ class = "org.eclipse.jst.ws.jaxws.dom.integration.navigator.CustomDomItemProviderAdapterFactory"
+ supportedTypes =
+ "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
+ org.eclipse.emf.edit.provider.IStructuredItemContentProvider
+ org.eclipse.emf.edit.provider.ITreeItemContentProvider
+ org.eclipse.emf.edit.provider.IItemLabelProvider
+ org.eclipse.emf.edit.provider.IItemPropertySource" />
+ </extension>
+
+ <!-- {{{ Defines integration for DOM objects to navigation tree -->
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ id="org.eclipse.jst.navigator.j2ee.ui.sapWS"
+ contentProvider="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryContentProvider"
+ labelProvider="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryLabelProvider"
+ activeByDefault="true"
+ name="%navigatorContent.name.0"
+ priority="highest">
+ <triggerPoints>
+ <or>
+ <instanceof value="org.eclipse.core.resources.IProject" />
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod"/>
+ </or>
+ </possibleChildren>
+ <actionProvider
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions.WSActionProvider"
+ id="org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions.WSActionProvider">
+ <enablement>
+ <or>
+ <instanceof value="org.eclipse.jst.javaee.ejb.SessionBean"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod"/>
+ <instanceof value="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam"/>
+ </or>
+ </enablement>
+ </actionProvider>
+ </navigatorContent>
+ </extension>
+
+ <extension point="org.eclipse.ui.decorators">
+ <decorator
+ adaptable="true"
+ location="BOTTOM_RIGHT"
+ lightweight="false"
+ label="%decorator.label.0"
+ state="true"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.WebServiceProblemsDecorator"
+ id="org.eclipse.jst.ws.jaxws.dom.integration.navigator.WebServiceDecorator">
+ <enablement>
+ <or>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.integration.navigator.IWebServiceChildList"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService"/>
+ <objectClass name="org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface"/>
+ </or>
+ </enablement>
+ </decorator>
+ </extension>
+ <!-- }}} -->
+ <!-- {{{ Defines integration for DOM objects to properties view -->
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMPropertyViewAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySourceProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.jst.ws.jaxws.dom.ui.IDOMPropertyValue"
+ class="org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMItemValuePropertySourceFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySource">
+ </adapter>
+ </factory>
+ </extension>
+<!-- }}} -->
+<!-- {{{ Defines integration for WST validation framework -->
+ <extension
+ id="wsValidator"
+ name="%DomValidator_Name"
+ point="org.eclipse.wst.validation.validator">
+ <validator>
+ <filter objectClass="org.eclipse.core.resources.IFile" nameFilter="*.java" />
+ <markerId markerIdValue="WsValidatorMarker" />
+ <helper
+ class="org.eclipse.jst.ws.jaxws.dom.integration.validation.DomValidationHelper">
+ </helper>
+ <run
+ class="org.eclipse.jst.ws.jaxws.dom.integration.validation.DomValidationManager">
+ </run>
+ </validator>
+ </extension>
+ <extension
+ id="WsValidatorMarker"
+ name="%DomValidation_MarkerName"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.core.resources.problemmarker"/>
+ <super type="org.eclipse.core.resources.textmarker"/>
+ <persistent value="true" />
+ <attribute name="implementation"/>
+ </extension>
+</plugin>
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.java
new file mode 100755
index 0000000..34421b0
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin;
+
+import org.eclipse.osgi.util.NLS;
+
+public class DomIntegrationMessages extends NLS
+{
+ private static final String BUNDLE_NAME = "org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationMessages"; //$NON-NLS-1$
+
+ public static String DOMAdapterFactoryLabelProvider_JaxWsWebServicesLabel;
+
+ public static String DOMAdapterFactoryLabelProvider_LoadingCanceledLabel;
+
+ public static String DOMAdapterFactoryLabelProvider_LoadingDummyLabel;
+
+ public static String DOMAdapterFactoryLabelProvider_SeiLabel;
+
+ public static String DOMAdapterFactoryLabelProvider_WebServicesLabel;
+
+ /** message constant */
+ public static String OpenWSResourceAction_Name;
+
+ /** message constant */
+ public static String NavigateToImplementationAction_ShowInWebServicesAreaAction;
+
+ /** message constant */
+ public static String NavigateToImplementationAction_ShowInEJBAreaAction;
+
+ /** message constant */
+ public static String SelectFilesToCheckoutDlgTitle;
+
+ /** message constant */
+ public static String SelectFilesToCheckoutDlgTblTitle;
+
+ /** message constant */
+ public static String SelectFilesToCheckout_CanceledMessage;
+
+
+ static
+ {
+ NLS.initializeMessages(BUNDLE_NAME, DomIntegrationMessages.class);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.properties b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.properties
new file mode 100755
index 0000000..07f9578
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationMessages.properties
@@ -0,0 +1,25 @@
+###############################################################################
+# Copyright (c) 2009 by SAP AG, Walldorf.
+# 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:
+# SAP AG - initial API and implementation
+###############################################################################
+DOMAdapterFactoryLabelProvider_JaxWsWebServicesLabel = JAX-WS Web Services
+DOMAdapterFactoryLabelProvider_LoadingCanceledLabel = Loading Canceled
+DOMAdapterFactoryLabelProvider_LoadingDummyLabel = Loading...
+DOMAdapterFactoryLabelProvider_SeiLabel = Service Endpoint Interfaces
+DOMAdapterFactoryLabelProvider_WebServicesLabel = Web Services
+
+OpenWSResourceAction_Name = Open
+
+NavigateToImplementationAction_ShowInWebServicesAreaAction = Locate in Web Services Node
+NavigateToImplementationAction_ShowInEJBAreaAction = Locate in Deployment Descriptor Node
+
+
+SelectFilesToCheckoutDlgTitle = Confirm resource checkout
+SelectFilesToCheckoutDlgTblTitle = The following resources need to be checked out during the operation
+SelectFilesToCheckout_CanceledMessage = Operation cannot continue as resources checkout has been canceled
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationPlugin.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationPlugin.java
new file mode 100755
index 0000000..6a9ab0e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/plugin/DomIntegrationPlugin.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin;
+
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryLabelProvider;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class DomIntegrationPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.jst.ws.jaxws.dom.integration";
+
+ // The shared instance
+ private static DomIntegrationPlugin plugin;
+
+ private DOMAdapterFactoryLabelProvider labelProvider;
+
+ /**
+ * The constructor
+ */
+ public DomIntegrationPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static DomIntegrationPlugin getDefault() {
+ return plugin;
+ }
+
+ public void setLabelProvider(final DOMAdapterFactoryLabelProvider labelProvider)
+ {
+ ContractChecker.nullCheckParam(labelProvider, "labelProvider"); //$NON-NLS-1$
+ this.labelProvider = labelProvider;
+ }
+
+ public DOMAdapterFactoryLabelProvider getLabelProvider()
+ {
+ return labelProvider;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/util/ProjectExplorerUtil.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/util/ProjectExplorerUtil.java
new file mode 100755
index 0000000..82f68fd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/internal/util/ProjectExplorerUtil.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.internal.util;
+
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Utility class that holds methods to manipulate ProjectExplorer
+ *
+ * @author Georgi Vachkov
+ */
+public class ProjectExplorerUtil
+{
+ public static final ProjectExplorerUtil INSTANCE = new ProjectExplorerUtil();
+
+ /**
+ * This method should be called only from UI thread otherwise <code>null</code> will be returned
+ *
+ * @return the project explorer {@link IViewPart} in case it is available otherwise <code>null</code>
+ */
+ public IViewPart findProjectExplorer()
+ {
+ final IWorkbenchWindow workbenchWin = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (workbenchWin==null || workbenchWin.getActivePage()==null) {
+ return null;
+ }
+
+ return workbenchWin.getActivePage().findView("org.eclipse.ui.navigator.ProjectExplorer"); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/CustomDomItemProviderAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/CustomDomItemProviderAdapterFactory.java
new file mode 100755
index 0000000..55f2522
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/CustomDomItemProviderAdapterFactory.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.ui.DomItemProviderAdapterFactory;
+
+/**
+ * Factory that adapts DOM objects with Item provider adapters. For {@link ISEIChildList} and
+ * {@link IWebServiceChildList} it creates specific adapter for other DOM objects delegates to
+ * {@link DomItemProviderAdapterFactory}.
+ *
+ * @author
+ */
+public class CustomDomItemProviderAdapterFactory extends DomItemProviderAdapterFactory
+{
+ /**
+ * The singleton instance
+ */
+ public static final CustomDomItemProviderAdapterFactory INSTANCE = new CustomDomItemProviderAdapterFactory();
+
+ /**
+ * Constructor
+ */
+ private CustomDomItemProviderAdapterFactory()
+ {
+ super();
+
+ supportedTypes.add(IWebServiceChildList.class);
+ supportedTypes.add(ISEIChildList.class);
+ }
+
+ protected Adapter createIWebServiceChildListAdapter(final IWebServiceProject wsProj)
+ {
+ return new IWebServiceChildList()
+ {
+ public EList<IWebService> getWSChildList()
+ {
+ return wsProj.getWebServices();
+ }
+
+ public Notifier getTarget()
+ {
+ return wsProj;
+ }
+
+ public boolean isAdapterForType(Object type)
+ {
+ return false;
+ }
+
+ public void notifyChanged(Notification notification)
+ {
+ // no processing needed currently
+ }
+
+ public void setTarget(Notifier newTarget)
+ {
+ // no processing needed currently
+ }
+ };
+ }
+
+ protected Adapter createISEIChildListAdapter(final IWebServiceProject wsProj)
+ {
+ return new ISEIChildList()
+ {
+ public EList<IServiceEndpointInterface> getSEIChildList()
+ {
+ return wsProj.getServiceEndpointInterfaces();
+ }
+
+ public Notifier getTarget()
+ {
+ return wsProj;
+ }
+
+ public boolean isAdapterForType(Object type)
+ {
+ return false;
+ }
+
+ public void notifyChanged(Notification notification)
+ {
+ // no processing needed currently
+ }
+
+ public void setTarget(Notifier newTarget)
+ {
+ // no processing needed currently
+ }
+ };
+ }
+
+ @Override
+ public Adapter adapt(Notifier notifier, Object type)
+ {
+ if (notifier instanceof IWebServiceProject && type instanceof Class)
+ {
+ if(type.equals(IWebServiceChildList.class))
+ {
+ return adaptIWebServiceChildList((IWebServiceProject)notifier);
+ }
+ else if(type.equals(ISEIChildList.class))
+ {
+ return adaptISEIChildList((IWebServiceProject)notifier);
+ }
+ }
+
+ return super.adapt(notifier, type);
+ }
+
+ protected Adapter adaptISEIChildList(final IWebServiceProject wsProject)
+ {
+ for(Adapter adapter : wsProject.eAdapters())
+ {
+ if(adapter instanceof ISEIChildList) {
+ return adapter;
+ }
+ }
+
+ final Adapter adapter = createISEIChildListAdapter(wsProject);
+ associate(adapter, wsProject);
+
+ return adapter;
+ }
+
+ protected Adapter adaptIWebServiceChildList(final IWebServiceProject wsProject)
+ {
+ for(Adapter adapter : wsProject.eAdapters())
+ {
+ if(adapter instanceof IWebServiceChildList) {
+ return adapter;
+ }
+ }
+
+ final Adapter adapter = createIWebServiceChildListAdapter(wsProject);
+ associate(adapter, wsProject);
+
+ return adapter;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryContentProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryContentProvider.java
new file mode 100755
index 0000000..5c0e3dd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryContentProvider.java
@@ -0,0 +1,370 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.util.ProjectExplorerUtil;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingCanceled;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingDummy;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDomLoadListener;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMRuntimeManager;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.IWsDOMRuntimeInfo;
+import org.eclipse.jst.ws.jaxws.dom.runtime.registry.WsDOMRuntimeRegistry;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.jst.ws.jaxws.utils.facets.FacetUtils;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.navigator.CommonNavigator;
+import org.eclipse.ui.navigator.CommonViewer;
+
+/**
+ * Content provider for DOM related objects
+ *
+ * @author
+ */
+public class DOMAdapterFactoryContentProvider extends AdapterFactoryContentProvider
+{
+ private Map<IWsDOMRuntimeExtension, IWsDomLoadListener> loadListeners = new HashMap<IWsDOMRuntimeExtension, IWsDomLoadListener>();
+
+ /**
+ * Constructor
+ */
+ public DOMAdapterFactoryContentProvider()
+ {
+ this(CustomDomItemProviderAdapterFactory.INSTANCE);
+ }
+
+ /**
+ * Constructor
+ * @param adapterFactory
+ */
+ public DOMAdapterFactoryContentProvider(AdapterFactory adapterFactory)
+ {
+ super(adapterFactory);
+ }
+
+ @Override
+ public Object[] getChildren(final Object context)
+ {
+ if (context instanceof IAdaptable)
+ {
+ return getWsProject((IProject)((IAdaptable) context).getAdapter(IProject.class));
+ }
+ else if(context instanceof ILoadingWsProject)
+ {
+ return new Object[] { ((ILoadingWsProject)context).isLoadCanceled() ? new ILoadingCanceled(){} : new ILoadingDummy(){} };
+ }
+ else if(context instanceof IWebServiceProject)
+ {
+ return new Object[]{ adapterFactory.adapt(context, ISEIChildList.class),
+ adapterFactory.adapt(context, IWebServiceChildList.class) };
+ }
+ else if(context instanceof IWebServiceChildList)
+ {
+ Object[] webServices = ((IWebServiceChildList)context).getWSChildList().toArray();
+
+ for(int ii=0; ii<webServices.length; ii++)
+ {
+ adapterFactory.adapt(webServices[ii], ITreeItemContentProvider.class);
+ }
+
+ return webServices;
+ }
+ else if(context instanceof ISEIChildList)
+ {
+ Object[] sEIs = ((ISEIChildList)context).getSEIChildList().toArray();
+
+ for(int ii=0; ii<sEIs.length; ii++)
+ {
+ adapterFactory.adapt(sEIs[ii], ITreeItemContentProvider.class);
+ }
+
+ return sEIs;
+ }
+ else if(context instanceof IWebService)
+ {
+ final IServiceEndpointInterface sei = ((IWebService)context).getServiceEndpoint();
+ if (sei == null) {
+ return new Object[0];
+ }
+
+ adapterFactory.adapt(sei, ITreeItemContentProvider.class);
+ return new Object[]{ sei };
+ }
+ else if(context instanceof IServiceEndpointInterface) {
+ return extractMethods((IServiceEndpointInterface) context);
+ }
+ else if (context instanceof IWebMethod) {
+ return extractParams((IWebMethod)context);
+ }
+
+ return new Object[0];
+ }
+
+ protected Object[] getWsProject(final IProject project)
+ {
+ try {
+ final IWsDOMRuntimeExtension runtime = getSupportingRuntime(project);
+ if (runtime == null) {
+ return new Object[0];
+ }
+
+ // WS project is loaded already
+ final IWebServiceProject wsProject = getWsProject(runtime.getDOM(), project);
+ if (wsProject != null)
+ {
+ adapterFactory.adapt(wsProject, ITreeItemContentProvider.class);
+ return new Object[] { wsProject };
+ }
+
+ addRuntimeLoadListener(runtime);
+ return new Object[] { new LoadingWsProject(project, false) };
+ }
+ catch (WsDOMLoadCanceledException e) { // $JL-EXC$
+ return new Object[] { new LoadingWsProject(project, true) };
+ }
+ }
+
+ protected IWsDomLoadListener addRuntimeLoadListener(final IWsDOMRuntimeExtension runtime)
+ {
+ IWsDomLoadListener loadListener = loadListeners.get(runtime);
+ if (loadListener!=null) {
+ return loadListener;
+ }
+
+ loadListener = new LoadListener(runtime);
+ loadListeners.put(runtime, loadListener);
+ runtime.addLoadListener(loadListener);
+
+ return loadListener;
+ }
+
+ protected Object[] extractMethods(final IServiceEndpointInterface sei)
+ {
+ final List<IWebMethod> webMethods = sei.getWebMethods();
+ for (IWebMethod webMethod : webMethods) {
+ adapterFactory.adapt(webMethod, ITreeItemContentProvider.class);
+ }
+
+ return webMethods.toArray();
+ }
+
+ protected Object[] extractParams(final IWebMethod method)
+ {
+ final List<IWebParam> params = method.getParameters();
+ for (IWebParam webParam : params) {
+ adapterFactory.adapt(webParam, ITreeItemContentProvider.class);
+ }
+
+ return params.toArray();
+ }
+
+ @Override
+ public boolean hasChildren(Object element)
+ {
+ if (element instanceof IWebServiceProject)
+ {
+ return true;
+ }
+ else if(element instanceof ILoadingWsProject)
+ {
+ return true;
+ }
+ else if(element instanceof IWebServiceChildList)
+ {
+ return !((IWebServiceChildList)element).getWSChildList().isEmpty();
+ }
+ else if(element instanceof ISEIChildList)
+ {
+ return !((ISEIChildList)element).getSEIChildList().isEmpty();
+ }
+ else if (element instanceof IWebService)
+ {
+ return ((IWebService) element).getServiceEndpoint() != null;
+ }
+ else if (element instanceof IServiceEndpointInterface)
+ {
+ return !((IServiceEndpointInterface)element).getWebMethods().isEmpty();
+ }
+ else if (element instanceof IWebMethod)
+ {
+ return !((IWebMethod)element).getParameters().isEmpty();
+ }
+
+ return false;
+ }
+
+ protected IWebServiceProject getWsProject(final IDOM dom, final IProject project)
+ {
+ if (dom == null) {
+ return null;
+ }
+
+ for (IWebServiceProject wsProject : dom.getWebServiceProjects()) {
+ if(wsProject.getName().equals(project.getName())) {
+ return wsProject;
+ }
+ }
+
+ return null;
+ }
+
+ protected IWsDOMRuntimeExtension getSupportingRuntime(final IProject project)
+ {
+ final Collection<IWsDOMRuntimeInfo> domRuntimeInfos = WsDOMRuntimeRegistry.getRegisteredRuntimesInfo();
+ Map<String, String> facets;
+ for (IWsDOMRuntimeInfo domRuntimeInfo : domRuntimeInfos)
+ {
+ facets = domRuntimeInfo.getProjectFacets();
+ if (hasFacet(facets, project)) {
+ return getDomRuntime(domRuntimeInfo.getId());
+ }
+ }
+
+ return null;
+ }
+
+ protected boolean hasFacet(final Map<String, String> facets, final IProject project)
+ {
+ for (String facetId : facets.keySet())
+ {
+ if (facetId == null || facets.get(facetId) == null) {
+ continue;
+ }
+
+ try {
+ if ((new FacetUtils()).hasFacetWithVersion(project, facets.get(facetId), facetId, true)){
+ return true;
+ }
+ }
+ catch (CoreException e) {
+ (new Logger()).logError(e.getMessage(), e);
+ }
+ }
+
+ return false;
+ }
+
+ protected IWsDOMRuntimeExtension getDomRuntime(String runtimeId) {
+ return WsDOMRuntimeManager.instance().getDOMRuntime(runtimeId);
+ }
+
+ /**
+ * Class that is used to listen when the DOM load will be finished. After the load has finished
+ * this class traverses the project explorers tree in order to find all instances of
+ * {@link ILoadingWsProject} and substitute them with loaded {@link IWebServiceProject}
+ *
+ * @author Georgi Vachkov
+ */
+ protected class LoadListener implements IWsDomLoadListener
+ {
+ private final IWsDOMRuntimeExtension runtime;
+
+ public LoadListener(final IWsDOMRuntimeExtension runtime)
+ {
+ ContractChecker.nullCheckParam(runtime, "runtime"); //$NON-NLS-1$
+ this.runtime = runtime;
+ }
+
+ public void finished()
+ {
+ Display.getDefault().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ final IViewPart viewPart = ProjectExplorerUtil.INSTANCE.findProjectExplorer();
+ if (viewPart instanceof CommonNavigator)
+ {
+ final CommonViewer commonViewer = ((CommonNavigator)viewPart).getCommonViewer();
+ for (TreeItem item : commonViewer.getTree().getItems()) {
+ exchangeDummy(item, commonViewer);
+ }
+ }
+ }
+ });
+ }
+
+ protected void exchangeDummy(final TreeItem treeItem, final CommonViewer commonViewer)
+ {
+ if (treeItem == null || treeItem.getData() instanceof IWebServiceProject) {
+ return;
+ }
+
+ if (treeItem.getData() instanceof ILoadingWsProject) {
+ exchangeTreeItemData(treeItem, commonViewer);
+ }
+ else {
+ for (TreeItem child : treeItem.getItems()) {
+ exchangeDummy(child, commonViewer);
+ }
+ }
+ }
+
+ private void exchangeTreeItemData(final TreeItem treeItem, final CommonViewer commonViewer)
+ {
+ final ILoadingWsProject loadingProject = (ILoadingWsProject)treeItem.getData();
+ try {
+ final IWebServiceProject wsProject = getWsProject(runtime.getDOM(), loadingProject.getProject());
+ adapterFactory.adapt(wsProject, ITreeItemContentProvider.class);
+ treeItem.setData(wsProject);
+
+ } catch (WsDOMLoadCanceledException e) { // $JL-EXC$
+ treeItem.setData(new LoadingWsProject(loadingProject.getProject(), true));
+ }
+
+ commonViewer.refresh(loadingProject.getProject());
+ }
+
+ public void started() {
+ // nothing to do here
+ }
+ }
+
+ private class LoadingWsProject implements ILoadingWsProject
+ {
+ final IProject project;
+ final boolean isCanceled;
+
+ public LoadingWsProject(final IProject project, final boolean isCanceled) {
+ ContractChecker.nullCheckParam(project, "project"); //$NON-NLS-1$
+ this.project = project;
+ this.isCanceled = isCanceled;
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public boolean isLoadCanceled() {
+ return isCanceled;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryLabelProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryLabelProvider.java
new file mode 100755
index 0000000..9484e8f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMAdapterFactoryLabelProvider.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationMessages;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationPlugin;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingCanceled;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ILoadingWsProject.ILoadingDummy;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.ui.Images;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.navigator.IDescriptionProvider;
+
+/**
+ * DOM adapter factory that extends {@link AdapterFactoryLabelProvider} by providing
+ * icons and labels for some objects that are not part of DOM and also overrides some
+ * labels
+ *
+ * @author
+ */
+public class DOMAdapterFactoryLabelProvider extends AdapterFactoryLabelProvider implements IDescriptionProvider
+{
+ /**
+ * Default Constructor uses {@link CustomDomItemProviderAdapterFactory} as default
+ * adapter factory provided to the base class.
+ */
+ public DOMAdapterFactoryLabelProvider()
+ {
+ super(CustomDomItemProviderAdapterFactory.INSTANCE);
+
+ DomIntegrationPlugin.getDefault().setLabelProvider(this);
+ }
+
+ @Override
+ public Image getImage(Object element)
+ {
+ if(element instanceof IWebServiceChildList)
+ {
+ return Images.INSTANCE.getImage(Images.IMG_WEB_SERVICE_GROUP);
+ }
+ else if(element instanceof ISEIChildList)
+ {
+ return Images.INSTANCE.getImage(Images.IMG_SEI_GROUP);
+ }
+ else if(element instanceof ILoadingWsProject)
+ {
+ return Images.INSTANCE.getImage(Images.IMG_DOM_WS_PROVIDER);
+ }
+ else if (element instanceof ILoadingDummy || element instanceof ILoadingCanceled)
+ {
+ return null;
+ }
+
+ return super.getImage(element);
+ }
+
+ @Override
+ public String getText(Object element)
+ {
+ if(element instanceof IWebServiceProject || element instanceof ILoadingWsProject)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_JaxWsWebServicesLabel;
+ }
+ if (element instanceof ILoadingDummy)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_LoadingDummyLabel;
+ }
+ if (element instanceof ILoadingCanceled)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_LoadingCanceledLabel;
+ }
+ else if(element instanceof IWebServiceChildList)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_WebServicesLabel;
+ }
+ else if(element instanceof ISEIChildList)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_SeiLabel;
+ }
+
+ return super.getText(element);
+ }
+
+ public String getDescription(Object element)
+ {
+ if(element instanceof IWebService)
+ {
+ return ((IWebService)element).getName();
+ }
+ else if(element instanceof IServiceEndpointInterface)
+ {
+ return ((IServiceEndpointInterface)element).getName();
+ }
+ else if(element instanceof IWebServiceProject || element instanceof ILoadingWsProject)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_JaxWsWebServicesLabel;
+ }
+ else if(element instanceof IWebServiceChildList)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_WebServicesLabel;
+ }
+ else if(element instanceof ISEIChildList)
+ {
+ return DomIntegrationMessages.DOMAdapterFactoryLabelProvider_SeiLabel;
+ }
+ else if(element instanceof IWebMethod)
+ {
+ return ((IWebMethod)element).getName();
+ }
+
+ return super.getText(element);
+ }
+
+ public void fireLabelProviderChanged(Object element)
+ {
+ for (ILabelProviderListener labelProviderListener : labelProviderListeners) {
+ labelProviderListener.labelProviderChanged(new LabelProviderChangedEvent(this, element));
+ }
+ }
+
+ @Override
+ protected Image getDefaultImage(Object object)
+ {
+ // No dfault images
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMItemValuePropertySourceFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMItemValuePropertySourceFactory.java
new file mode 100755
index 0000000..fd4f630
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMItemValuePropertySourceFactory.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.PropertySource;
+import org.eclipse.jst.ws.jaxws.dom.ui.IDOMPropertyValue;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * Adapter factory for that creates adapter from {@link IDOMPropertyValue} to
+ * {@link IPropertySource} interface. This factory is registered in org.eclipse.core.runtime.adapters extension
+ * point and is called when object of type {@link IDOMPropertyValue} needs to be
+ * displayed or edited in property sheet.
+ *
+ * @author Georgi Vachkov
+ */
+@SuppressWarnings("unchecked")
+public class DOMItemValuePropertySourceFactory implements IAdapterFactory
+{
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ public Object getAdapter(Object adaptableObject, Class adapterType)
+ {
+ assert adaptableObject instanceof IDOMPropertyValue;
+
+ final IDOMPropertyValue wrapper = (IDOMPropertyValue)adaptableObject;
+
+ return new PropertySource(wrapper.getEditableValue(), wrapper);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ public Class[] getAdapterList() {
+ return new Class[] {PropertySource.class};
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMPropertyViewAdapterFactory.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMPropertyViewAdapterFactory.java
new file mode 100755
index 0000000..7a3343f
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/DOMPropertyViewAdapterFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+public class DOMPropertyViewAdapterFactory implements IAdapterFactory
+{
+ private DOMAdapterFactoryContentProvider adapterFactory;
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Object adaptableObject, Class adapterType)
+ {
+ if (adapterType.isInstance(adaptableObject))
+ {
+ return adaptableObject;
+ }
+
+ if (adapterType == IPropertySourceProvider.class)
+ {
+ return getAdapterFactory();
+ }
+
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class[] getAdapterList()
+ {
+ return new Class[] {
+ DOMAdapterFactoryContentProvider.class,
+ };
+ }
+
+ protected DOMAdapterFactoryContentProvider getAdapterFactory()
+ {
+ if (adapterFactory == null) {
+ adapterFactory = new DOMAdapterFactoryContentProvider();
+ }
+
+ return adapterFactory;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ILoadingWsProject.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ILoadingWsProject.java
new file mode 100755
index 0000000..262eaa6
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ILoadingWsProject.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.core.resources.IProject;
+
+
+/**
+ * An interface presenting not loaded web service project. This interface is used
+ * to be added to the project explorer WS tree in cases when the project is relevant
+ * but it is not yet loaded by DOM loader.
+ *
+ * @author Georgi Vachkov
+ */
+public interface ILoadingWsProject
+{
+ /**
+ * @return the relevant project
+ */
+ public IProject getProject();
+
+ /**
+ * @return if the DOM loading has been canceled
+ */
+ public boolean isLoadCanceled();
+
+ /**
+ * Interface used to be added to the tree as a sub node of INotLoadedWsProject node
+ * and displayed with text "Loading...".
+ *
+ * @author Georgi Vachkov
+ */
+ public interface ILoadingDummy {};
+
+ public interface ILoadingCanceled {};
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ISEIChildList.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ISEIChildList.java
new file mode 100755
index 0000000..04f6b4b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/ISEIChildList.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+
+public interface ISEIChildList extends Adapter
+{
+ public EList<IServiceEndpointInterface> getSEIChildList();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/IWebServiceChildList.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/IWebServiceChildList.java
new file mode 100755
index 0000000..96381d8
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/IWebServiceChildList.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+
+public interface IWebServiceChildList extends Adapter
+{
+ public EList<IWebService> getWSChildList();
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/WebServiceProblemsDecorator.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/WebServiceProblemsDecorator.java
new file mode 100755
index 0000000..5a9d2be
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/WebServiceProblemsDecorator.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.ui.JavaElementImageDescriptor;
+import org.eclipse.jdt.ui.ProblemsLabelDecorator;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.DomPackage;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.util.Dom2ResourceMapper;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+
+public class WebServiceProblemsDecorator extends ProblemsLabelDecorator
+{
+ /** Enum to represent different marker types */
+ public enum Severity {OK, ERROR, WARNING};
+
+ private DomUtil domUtil = DomUtil.INSTANCE;
+
+ @Override
+ protected int computeAdornmentFlags(Object obj)
+ {
+ final Severity severity = defineSeverity(obj);
+ if (severity == Severity.ERROR) {
+ return JavaElementImageDescriptor.ERROR;
+ }
+
+ if (severity == Severity.WARNING) {
+ return JavaElementImageDescriptor.WARNING;
+ }
+
+ return 0;
+ }
+
+ /**
+ * Checks the object's resource for markers and defines the severity of the
+ * problem if any.
+ * @param obj
+ * @return the severity calculated.
+ */
+ protected Severity defineSeverity(final Object obj)
+ {
+ try
+ {
+ // process additional DOM objects needed for UI - IWebServiceChildList and ISEIChildList
+ if (obj instanceof IWebServiceChildList) {
+ return defineSeverityForEList(((IWebServiceChildList)obj).getWSChildList());
+ }
+
+ if (obj instanceof ISEIChildList) {
+ return defineSeverityForEList(((ISEIChildList)obj).getSEIChildList());
+ }
+
+ // do not process non DOM objects
+ if( !(obj instanceof EObject) ) {
+ return Severity.OK;
+ }
+
+ return defineSeverity((EObject) obj);
+ }
+ catch (CoreException e) {
+ (new Logger()).logError(e.getMessage(), e);
+ }
+
+ return Severity.OK;
+ }
+
+ protected Severity defineSeverityForEList(final List<? extends EObject> list) throws CoreException
+ {
+ Severity severity = Severity.OK;
+ for (EObject eObject : list)
+ {
+ Severity tempSeverity = defineSeverity(eObject);
+ if (tempSeverity == Severity.ERROR) {
+ return Severity.ERROR;
+ }
+
+ if (tempSeverity==Severity.WARNING) {
+ severity = Severity.WARNING;
+ }
+ }
+
+ return severity;
+ }
+
+ protected Severity defineSeverity(final EObject eObject) throws CoreException
+ {
+ final IResource resource = Dom2ResourceMapper.INSTANCE.findResource(eObject);
+ if (resource!=null) {
+ return defineSeverity(eObject, resource);
+ }
+
+ return Severity.OK;
+ }
+
+ protected Severity defineSeverity(final EObject eObject, final IResource resource) throws CoreException
+ {
+ if (!resource.isAccessible()) {
+ return Severity.OK;
+ }
+
+ final int depth = (resource.getType()==IResource.PROJECT) ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO;
+ final IMarker[] markers = resource.findMarkers(DomValidationConstants.MARKER_ID, false, depth);
+ Severity severity = Severity.OK;
+ for (IMarker marker : markers)
+ {
+ if (!isRelevantFor(eObject, marker)) {
+ continue;
+ }
+
+ int tempSeverity = (Integer)marker.getAttribute(IMarker.SEVERITY);
+ if (tempSeverity==IMarker.SEVERITY_ERROR) {
+ return Severity.ERROR;
+ }
+
+ if(tempSeverity==IMarker.SEVERITY_WARNING) {
+ severity = Severity.WARNING;
+ }
+ }
+
+ if (severity == Severity.OK && (eObject instanceof IWebService))
+ {
+ // for bean with explicit interface we need to check the interface as well
+ // because it resides in another resource
+ final IServiceEndpointInterface sei = ((IWebService)eObject).getServiceEndpoint();
+ if (sei != null && !sei.isImplicit()) {
+ severity = defineSeverity(sei);
+ }
+ }
+
+ return severity;
+ }
+
+ /**
+ * Defines if <code>marker</code> is relevant for <code>eObject</code>.
+ * Only for web method and web parameter we need to define if the marker is relevant
+ * because they are not unique in the scope of the resource. For example if there is a
+ * marker set on the resource containing SEI, the SEI should be marked in any case
+ * while the method only in case when the error is specifically for this method or
+ * method parameter.
+ * @param eObject the object to be validated
+ * @param marker the resource marker
+ * @return <code>true</code> in case the marker is relevant for <code>eObject</code>
+ * @throws CoreException
+ */
+ protected boolean isRelevantFor(final EObject eObject, final IMarker marker) throws CoreException
+ {
+ switch (eObject.eClass().getClassifierID())
+ {
+ case DomPackage.IWEB_METHOD:
+ return isRelevantForMethod((IWebMethod)eObject, marker);
+ case DomPackage.IWEB_PARAM:
+ return isRelevant(domUtil.calcUniqueImpl(eObject), marker);
+ }
+
+ return true;
+ }
+
+ /**
+ * Defines if <code>marker</code> is relevant for <code>webMethod</code>.
+ * Checks if the marker is specifically for this method or some of it's parameters.
+ * @param webMethod the method to be checked
+ * @param marker the marker to be checked
+ * @return <code>true</code> in case marker is relevant
+ * @throws CoreException
+ */
+ protected boolean isRelevantForMethod(final IWebMethod webMethod, final IMarker marker) throws CoreException
+ {
+ if (isRelevant(domUtil.calcUniqueImpl(webMethod), marker)) {
+ return true;
+ }
+
+ for (IWebParam webParam : webMethod.getParameters())
+ {
+ if (isRelevant(domUtil.calcUniqueImpl(webParam), marker)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if marker's {@link DomValidationConstants#IMPLEMENTATION} attribute has same
+ * value as <code>implementation</code>.
+ * @param implementation the implementation signature
+ * @param marker the marker to be checked
+ * @return <code>true</code> in case marker is for this implementation
+ * @throws CoreException
+ */
+ protected boolean isRelevant(final String implementation, final IMarker marker) throws CoreException
+ {
+ final Object found = marker.getAttribute(DomValidationConstants.IMPLEMENTATION);
+ if (found != null && found.equals(implementation)) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/NavigateToImplementationAction.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/NavigateToImplementationAction.java
new file mode 100755
index 0000000..0bf1369
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/NavigateToImplementationAction.java
@@ -0,0 +1,509 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jst.javaee.ejb.MessageDrivenBean;
+import org.eclipse.jst.javaee.ejb.SessionBean;
+import org.eclipse.jst.jee.ui.internal.navigator.ejb.GroupEJBProvider;
+import org.eclipse.jst.jee.ui.internal.navigator.ejb.GroupEjbSession;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationMessages;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMRuntimeManager;
+import org.eclipse.jst.ws.jaxws.dom.runtime.persistence.Jee5WsDomRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.jst.ws.jaxws.utils.resources.ProjectManagementUtils;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.actions.SelectionListenerAction;
+
+public class NavigateToImplementationAction extends SelectionListenerAction
+ implements IActionDelegate2 {
+ protected Object srcObject;
+
+ private IJavaProject project;
+
+ private StructuredViewer viewer;
+
+ protected NavigateToImplementationAction(StructuredViewer viewer) {
+ this(DomIntegrationMessages.OpenWSResourceAction_Name);
+
+ this.viewer = viewer;
+ }
+
+ protected NavigateToImplementationAction(String text) {
+ super(text);
+ }
+
+ @Override
+ public String getText()
+ {
+ if(srcObject instanceof SessionBean)
+ {
+ return DomIntegrationMessages.NavigateToImplementationAction_ShowInWebServicesAreaAction;
+ }
+ else
+ {
+ return DomIntegrationMessages.NavigateToImplementationAction_ShowInEJBAreaAction;
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ boolean isEnabled = super.isEnabled()
+ && this.viewer instanceof TreeViewer
+ && this.project !=null
+ && ProjectManagementUtils.isEjb3Project(this.project.getProject().getName());
+
+ if(srcObject instanceof IWebService)
+ {
+ return isEnabled;
+ }
+
+ if(srcObject instanceof SessionBean)
+ {
+ SessionBean sessionBean = ((SessionBean)srcObject);
+ IWebService webService = getWebService(sessionBean);
+ if (webService == null)
+ {
+ return false;
+ }
+ return isEnabled;
+ }
+
+ if(srcObject instanceof IServiceEndpointInterface
+ && ((IServiceEndpointInterface)srcObject).isImplicit())
+ {
+ return isEnabled;
+ }
+
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ // TODO Auto-generated method stub
+ run();
+
+ }
+
+ /**
+ * The user has invoked this action
+ */
+ public void run() {
+ if (!isEnabled())
+ return;
+
+ ICompilationUnit cu = null;
+
+ if(srcObject instanceof SessionBean)
+ {
+ SessionBean sessionBean = ((SessionBean)srcObject);
+ String ejbClass = sessionBean.getEjbClass();
+ IWebService webService = getWebService(sessionBean);
+ if (webService == null)
+ {
+ return;
+ }
+
+ IServiceEndpointInterface sEI = webService.getServiceEndpoint();
+ boolean isImplicit = sEI.isImplicit();
+ String sEIClass;
+ if (!isImplicit){
+ String impl = sEI.getImplementation();
+ sEIClass = impl;
+ } else {
+ sEIClass = ejbClass;
+ }
+ try {
+ cu = project.findType(sEIClass).getCompilationUnit();
+ IResource resource = cu.getResource();
+ moveToSEINode(resource);
+ } catch (JavaModelException jme) {
+ logger().logError("Unexpected exception occurred", jme); //$NON-NLS-1$
+ return;
+ }
+
+ }
+ else
+ {
+ try {
+ cu = project.findType(
+ ((IJavaWebServiceElement) srcObject)
+ .getImplementation()).getCompilationUnit();
+ } catch (JavaModelException jme) {
+ logger().logError("Unexpected exception occurred", jme); //$NON-NLS-1$
+ return;
+ }
+
+ moveToEjbNode(cu.getResource());
+ }
+ }
+
+ /**
+ * Returns IWebService if sessionBean has been exposed as web service.
+ * @param sessionBean a session bean.
+ * @return IWebService if sessionBean has been exposed as web service. If the session bean has not been
+ * exposed as web service - returns null.
+ * @throws NullPointerException if sessionBean is null.
+ */
+ protected IWebService getWebService(final SessionBean sessionBean)
+ {
+ final IWsDOMRuntimeExtension domRuntime = getDomRuntime();
+ if (domRuntime == null) {
+ return null;
+ }
+
+ try {
+ final IDOM dom = domRuntime.getDOM();
+ if (dom == null) {
+ return null;
+ }
+
+ final IWebServiceProject webServiceProject = DomUtil.INSTANCE.findProjectByName(dom, this.project.getProject().getName());
+ return DomUtil.INSTANCE.findWsByImplName(webServiceProject, sessionBean.getEjbClass());
+ }
+ catch (WsDOMLoadCanceledException e) { // $JL-EXC$
+ return null;
+ }
+ }
+
+ protected IWsDOMRuntimeExtension getDomRuntime() {
+ return WsDOMRuntimeManager.instance().getDOMRuntime(Jee5WsDomRuntimeExtension.ID);
+ }
+
+ private void moveToSEINode(IResource resource)
+ {
+ TreeViewer treeViewer = (TreeViewer)this.viewer;
+ ISelection sel = null;
+
+ Object[] expandedObjects = treeViewer.getExpandedElements();
+
+ Object[] projectElements = ((ITreeContentProvider) treeViewer
+ .getContentProvider()).getChildren(this.project.getProject());
+ IWebServiceProject wsProject = null;
+
+ for (int ii = 0; ii < projectElements.length; ii++) {
+ if (projectElements[ii] instanceof IWebServiceProject) {
+ wsProject = (IWebServiceProject) projectElements[ii];
+ treeViewer.expandToLevel(wsProject, 2);
+ break;
+ }
+ }
+
+ if (wsProject == null)
+ return;
+
+ for(IServiceEndpointInterface sEI : wsProject.getServiceEndpointInterfaces())
+ {
+ try {
+ ICompilationUnit cu = project.findType(
+ ((IJavaWebServiceElement) sEI)
+ .getImplementation()).getCompilationUnit();
+
+ if(cu.getResource().equals(resource))
+ {
+ sel = new StructuredSelection(sEI);
+ TreePath treePath = getTreePathForSEI(treeViewer,
+ wsProject);
+ Object[] elementsToExpand = new Object[treePath
+ .getSegmentCount()];
+
+ for (int jj = 0; jj < elementsToExpand.length; jj++) {
+ if (notAlreadyExpanded(treePath.getSegment(jj),
+ expandedObjects)) {
+ elementsToExpand[jj] = treePath.getSegment(jj);
+ }
+ }
+
+ for (int jj = 0; jj < elementsToExpand.length; jj++) {
+ if (elementsToExpand[jj] != null) {
+ Object[] tmp = expandedObjects;
+ expandedObjects = new Object[expandedObjects.length + 1];
+
+ for (int kk = 0; kk < tmp.length; kk++) {
+ expandedObjects[kk] = tmp[kk];
+ }
+
+ expandedObjects[expandedObjects.length - 1] = elementsToExpand[jj];
+ }
+ }
+
+ break;
+ }
+ } catch (JavaModelException jme) {
+ logger().logError("Unexpected exception occurred", jme); //$NON-NLS-1$
+ return;
+ }
+
+ }
+ setExpandedElementsAndSelection(treeViewer, expandedObjects, sel);
+ }
+
+ private void moveToEjbNode(IResource resource) {
+ TreeViewer treeViewer = (TreeViewer)this.viewer;
+ ISelection sel = null;
+
+ Object[] expandedObjects = treeViewer.getExpandedElements();
+
+ Object[] projectElements = ((ITreeContentProvider) treeViewer
+ .getContentProvider()).getChildren(this.project.getProject());
+ GroupEJBProvider ejbProvider = null;
+ GroupEjbSession ejbSession = null;
+
+ for (int ii = 0; ii < projectElements.length; ii++) {
+ if (projectElements[ii] instanceof GroupEJBProvider) {
+ ejbProvider = (GroupEJBProvider) projectElements[ii];
+ treeViewer.expandToLevel(ejbProvider, 1);
+ break;
+ }
+ }
+
+ if (ejbProvider == null)
+ return;
+
+ for (Object ejbProviderChild : ejbProvider.getChildren()) {
+ if (ejbProviderChild instanceof GroupEjbSession) {
+ ejbSession = (GroupEjbSession) ejbProviderChild;
+ treeViewer.expandToLevel(ejbSession, 2);
+ }
+ }
+
+ if (ejbSession == null) {
+ return;
+ }
+
+ Object[] ejbs = treeViewer.getExpandedElements();
+
+ for (int ii = 0; ii < ejbs.length; ii++) {
+ if ((ejbs[ii] instanceof SessionBean)||(ejbs[ii] instanceof MessageDrivenBean)) {
+
+ IJavaProject javaProject = findJavaProject(ejbs[ii]);
+ IType t = null;
+ try {
+ if((ejbs[ii] instanceof SessionBean))
+ t = javaProject.findType(((SessionBean)ejbs[ii]).getEjbClass());
+ else
+ t = javaProject.findType(((MessageDrivenBean)ejbs[ii]).getEjbClass());
+ } catch (JavaModelException e) {
+ return;
+ }
+ IResource r = t.getResource();
+
+ if (r.equals(resource)) {
+ sel = new StructuredSelection(ejbs[ii]);
+ TreePath treePath = getTreePathForObject(treeViewer,
+ ejbs[ii]);
+ expandElements(expandedObjects, treePath);
+
+ break;
+ }
+ }
+ }
+
+ setExpandedElementsAndSelection(treeViewer, expandedObjects, sel);
+ }
+
+ protected IJavaProject findJavaProject(Object ejb)
+ {
+ IProject proj = ProjectUtilities.getProject(ejb);
+ return JavaCore.create(proj);
+ }
+
+ private void setExpandedElementsAndSelection(TreeViewer treeViewer, Object[] expandedObjects, ISelection sel)
+ {
+ treeViewer.setExpandedElements(expandedObjects);
+
+ if (sel != null) {
+ treeViewer.setSelection(sel, true);
+ }
+ }
+
+ private void expandElements(Object[] expandedObjects, TreePath treePath)
+ {
+
+ Object[] elementsToExpand = new Object[treePath.getSegmentCount()];
+
+ for (int jj = 0; jj < elementsToExpand.length; jj++)
+ {
+ if (notAlreadyExpanded(treePath.getSegment(jj), expandedObjects))
+ {
+ elementsToExpand[jj] = treePath.getSegment(jj);
+ }
+ }
+
+ for (int jj = 0; jj < elementsToExpand.length; jj++) {
+ if (elementsToExpand[jj] != null) {
+ Object[] tmp = expandedObjects;
+ expandedObjects = new Object[expandedObjects.length + 1];
+
+ for (int kk = 0; kk < tmp.length; kk++) {
+ expandedObjects[kk] = tmp[kk];
+ }
+
+ expandedObjects[expandedObjects.length - 1] = elementsToExpand[jj];
+ }
+ }
+ }
+
+
+ private boolean notAlreadyExpanded(Object obj, Object[] expObjs) {
+ for (int ii = 0; ii < expObjs.length; ii++) {
+ if (expObjs[ii].equals(obj)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private TreePath getTreePathForSEI(TreeViewer treeViewer, IWebServiceProject wsProject)
+ {
+ TreePath[] treePaths = treeViewer.getExpandedTreePaths();
+
+ for (int ii = 0; ii < treePaths.length; ii++) {
+ if (treePaths[ii].getLastSegment() instanceof ISEIChildList
+ && contains(treePaths[ii], wsProject)) {
+ return treePaths[ii];
+ }
+ }
+ return null;
+ }
+
+ private boolean contains(TreePath treePath, IWebServiceProject wsProject)
+ {
+ for(int ii=0; ii<treePath.getSegmentCount(); ii++)
+ {
+ if(treePath.getSegment(ii).equals(wsProject))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ private TreePath getTreePathForObject(TreeViewer treeViewer, Object obj) {
+ TreePath[] treePaths = treeViewer.getExpandedTreePaths();
+
+ for (int ii = 0; ii < treePaths.length; ii++) {
+ if (treePaths[ii].getLastSegment().equals(obj)) {
+ return treePaths[ii];
+ }
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ // TODO HACK!
+ updateSelection((IStructuredSelection) selection);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IStructuredSelection selection,
+ IJavaProject project) {
+ super.selectionChanged(selection);
+
+ this.project = project;
+ }
+
+ /**
+ * The structured selection has changed in the workbench. Subclasses should
+ * override this method to react to the change. Returns true if the action
+ * should be enabled for this selection, and false otherwise.
+ *
+ * When this method is overridden, the super method must always be invoked.
+ * If the super method returns false, this method must also return false.
+ *
+ * @param sel
+ * the new structured selection
+ */
+ public boolean updateSelection(IStructuredSelection s) {
+ if (!super.updateSelection(s))
+ return false;
+
+ srcObject = s.getFirstElement();
+
+ return true;
+ }
+
+ private ILogger logger() {
+ return new Logger();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ // Dispose
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ // init
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction,
+ * org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ runWithEvent(event);
+
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/OpenWSResourceAction.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/OpenWSResourceAction.java
new file mode 100755
index 0000000..62f86dd
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/OpenWSResourceAction.java
@@ -0,0 +1,314 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions;
+
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationMessages;
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IJavaWebServiceElement;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebMethod;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebParam;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebService;
+import org.eclipse.jst.ws.jaxws.utils.logging.ILogger;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.SelectionListenerAction;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+
+public class OpenWSResourceAction extends SelectionListenerAction implements IActionDelegate2
+{
+ protected Object srcObject;
+
+ private IJavaProject project;
+
+ private IServiceEndpointInterface sei;
+ private DomUtil util = DomUtil.INSTANCE;
+
+ protected OpenWSResourceAction() {
+ this(DomIntegrationMessages.OpenWSResourceAction_Name);
+ }
+
+ protected OpenWSResourceAction(String text) {
+ super(text);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ boolean isEnabled = super.isEnabled()
+ && this.project!=null;
+
+ if(srcObject instanceof IWebService)
+ {
+ return isEnabled;
+ }
+
+ if(srcObject instanceof IServiceEndpointInterface)
+ {
+ return isEnabled;
+ }
+
+ if(srcObject instanceof IWebMethod)
+ {
+ return isEnabled;
+ }
+
+ if(srcObject instanceof IWebParam)
+ {
+ return isEnabled;
+ }
+
+ return false;
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ run();
+ }
+
+ /**
+ * The user has invoked this action
+ */
+ public void run() {
+ if (!isEnabled())
+ return;
+
+ ICompilationUnit cu;
+ IWebMethod webMethod = null;
+ IWebParam webParam = null;
+
+ if(srcObject instanceof IWebMethod)
+ {
+ webMethod = (IWebMethod)srcObject;
+ srcObject = sei;
+ }
+ if(srcObject instanceof IWebParam)
+ {
+ webParam = (IWebParam)srcObject;
+ webMethod = (IWebMethod)webParam.eContainer();
+ srcObject = sei;
+ }
+
+ try {
+
+ cu = project.findType(((IJavaWebServiceElement) srcObject).getImplementation()).getCompilationUnit();
+
+ IWorkbenchPage page = getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ IEditorDescriptor desc = getWorkbench().getEditorRegistry().getDefaultEditor(cu.getResource().getName());
+
+ cu = getCUToOpen(cu, webMethod);
+ if (cu == null)
+ {
+ logger().logError("Unable to locate containing CU to open"); //$NON-NLS-1$
+ return;
+ }
+
+ IFile file = getWorkspace().getRoot().findFilesForLocation(cu.getResource().getLocation())[0];
+ IEditorPart editor = page.openEditor(new FileEditorInput(file), desc.getId());
+
+ IMarker marker = file.createMarker(IMarker.TEXT);
+ HashMap<String, Integer> map = new HashMap<String, Integer>();
+
+ map.put(IMarker.CHAR_START, getMarkerPosition(cu, webMethod, false));
+ map.put(IMarker.CHAR_END, getMarkerPosition(cu, webMethod, true));
+
+ marker.setAttributes(map);
+
+ IDE.gotoMarker(editor, marker);
+ } catch (PartInitException pie) {
+ logger().logError("Unable to open part editor", pie); //$NON-NLS-1$
+ } catch(CoreException ce) {
+ logger().logError(ce.getMessage(), ce);
+ }
+ }
+
+ private int getMarkerPosition(ICompilationUnit cu, IWebMethod webMethod, boolean endPos) throws JavaModelException
+ {
+ final IType[] types = cu.getTypes();
+ for (int ii = 0; ii < types.length; ii++)
+ {
+ if (webMethod == null)
+ {
+ return getPosition(types[ii], endPos);
+ }
+
+ final IMethod method = util.findMethod(types[ii], webMethod);
+ if (method==null) {
+ continue;
+ }
+
+ return getPosition(method, endPos);
+ }
+
+ return 0;
+ }
+
+ private int getPosition(IMember member, boolean endPos) throws JavaModelException
+ {
+ return member.getNameRange().getOffset() + ((endPos) ? member.getNameRange().getLength() : 0);
+ }
+
+ private ICompilationUnit getCUToOpen(ICompilationUnit cu, IWebMethod webMethod)
+ {
+ if (webMethod == null)
+ {
+ return cu;
+ }
+
+ try
+ {
+ final IType[] types = cu.getTypes();
+ for(int ii=0; ii<types.length; ii++)
+ {
+ IMethod method = util.findMethod(types[ii], webMethod);
+ if (method != null)
+ {
+ return types[ii].getCompilationUnit();
+ }
+ }
+
+ for(int ii=0; ii<types.length; ii++)
+ {
+ IType[] superIntfTypes = types[ii].newSupertypeHierarchy(null).getSuperInterfaces(types[ii]);
+
+ for(int jj=0; jj<superIntfTypes.length; jj++)
+ {
+ ICompilationUnit cuToOpen = getCUToOpen(superIntfTypes[jj].getCompilationUnit(), webMethod);
+
+ if(cuToOpen!=null)
+ {
+ return cuToOpen;
+ }
+ }
+
+ IType superClassType = types[ii].newSupertypeHierarchy(null).getSuperclass(types[ii]);
+
+ ICompilationUnit cuToOpen = getCUToOpen(superClassType.getCompilationUnit(), webMethod);
+
+ if(cuToOpen!=null)
+ {
+ return cuToOpen;
+ }
+ }
+ }
+ catch(JavaModelException jme)
+ {
+ logger().logError(jme.getMessage(), jme);
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ updateSelection((IStructuredSelection) selection);
+ }
+
+ public void selectionChanged(IStructuredSelection selection, IJavaProject project, IServiceEndpointInterface sei) {
+ super.selectionChanged(selection);
+
+ this.project = project;
+ this.sei = sei;
+ }
+
+ /**
+ * The structured selection has changed in the workbench. Subclasses should
+ * override this method to react to the change. Returns true if the action
+ * should be enabled for this selection, and false otherwise.
+ *
+ * When this method is overridden, the super method must always be invoked.
+ * If the super method returns false, this method must also return false.
+ *
+ * @param sel
+ * the new structured selection
+ */
+ public boolean updateSelection(IStructuredSelection s) {
+ if (!super.updateSelection(s))
+ return false;
+
+ srcObject = s.getFirstElement();
+
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ // Dispose
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ // init
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction,
+ * org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ runWithEvent(event);
+
+ }
+
+ private ILogger logger() {
+ return new Logger();
+ }
+
+ private IWorkbench getWorkbench() {
+ return PlatformUI.getWorkbench();
+ }
+
+ private IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/WSActionProvider.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/WSActionProvider.java
new file mode 100755
index 0000000..bdf8ddf
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/navigator/actions/WSActionProvider.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.navigator.actions;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IServiceEndpointInterface;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionConstants;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonMenuConstants;
+
+
+public class WSActionProvider extends CommonActionProvider
+{
+ private OpenWSResourceAction openAction;
+
+ private NavigateToImplementationAction navigateAction;
+
+ @Override
+ public void fillActionBars(IActionBars actionBars)
+ {
+ if(openAction.isEnabled())
+ actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openAction);
+
+ if(navigateAction.isEnabled())
+ actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), navigateAction);
+ }
+
+ @Override
+ public void fillContextMenu(IMenuManager menu)
+ {
+ if (getContext()==null || getContext().getSelection().isEmpty())
+ return;
+
+ IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
+ openAction.selectionChanged(selection);
+ navigateAction.selectionChanged(selection);
+ navigateAction.setText(navigateAction.getText());
+
+ if (openAction.isEnabled())
+ menu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openAction);
+
+ if(navigateAction.isEnabled())
+ menu.insertAfter(ICommonMenuConstants.GROUP_OPEN_WITH, navigateAction);
+ }
+
+ @Override
+ public void init(ICommonActionExtensionSite site) {
+ super.init(site);
+
+ openAction = new OpenWSResourceAction();
+ navigateAction = initNavigateAction(site);
+ }
+
+ protected NavigateToImplementationAction initNavigateAction(ICommonActionExtensionSite site)
+ {
+ return new NavigateToImplementationAction(site.getStructuredViewer());
+ }
+
+ @Override
+ public void setContext(ActionContext context) {
+ if (context != null && context.getSelection() instanceof IStructuredSelection)
+ {
+ IStructuredSelection selection = (IStructuredSelection) context.getSelection();
+
+ if(selection instanceof ITreeSelection)
+ {
+ TreePath[] paths = ((ITreeSelection)selection).getPathsFor(selection.getFirstElement());
+ IProject project = null;
+
+ for(int ii=0; ii<paths.length; ii++)
+ {
+ TreePath path = paths[ii];
+ IServiceEndpointInterface sei = null;
+
+ for(int jj=0; jj<path.getSegmentCount(); jj++)
+ {
+ if(path.getSegment(jj) instanceof IServiceEndpointInterface)
+ {
+ sei = (IServiceEndpointInterface)path.getSegment(jj);
+ break;
+ }
+ }
+
+ for(int jj=0; jj<path.getSegmentCount(); jj++)
+ {
+ if(path.getSegment(jj) instanceof IProject)
+ {
+ project = (IProject)path.getSegment(jj);
+ openAction.selectionChanged(selection, getJavaProject(project), sei);
+ navigateAction.selectionChanged(selection, getJavaProject(project));
+ super.setContext(context);
+ return;
+ }
+ }
+ }
+ }
+
+ openAction.selectionChanged(selection);
+ navigateAction.selectionChanged(selection);
+ }
+
+ super.setContext(context);
+ }
+
+ protected IJavaProject getJavaProject(IProject project)
+ {
+ return JavaCore.create(project);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationHelper.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationHelper.java
new file mode 100755
index 0000000..b5ec3a4
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationHelper.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.validation;
+
+import org.eclipse.jst.ws.jaxws.dom.runtime.DomUtil;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IDOM;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWsDOMRuntimeExtension;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMLoadCanceledException;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.WsDOMRuntimeManager;
+import org.eclipse.jst.ws.jaxws.utils.ContractChecker;
+import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+
+/**
+ * {@link IValidationContext} implementor. Acts as helper class for validation. Used
+ * by {@link DomValidationManager} to retrieve DOM model.
+ *
+ * @author Georgi Vachkov
+ */
+@SuppressWarnings("restriction")
+public class DomValidationHelper extends WorkbenchContext
+{
+ /**
+ * Constructor - registers models that this helper will support. Registration is done
+ * by setting model 'symbolicName' and method to be called for this method to be retrieved
+ */
+ public DomValidationHelper()
+ {
+ registerModel("webServiceProject", "getWebServiceProject", new Class[] {String.class}); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Executed by {@link WorkbenchContext} when {@link WorkbenchContext#loadModel(String, Object[])} is called
+ * and finds the corresponding to {@link #getProject()} {@link IWebServiceProject}
+ *
+ * @param domId
+ * @return found {@link IWebServiceProject} or <code>null</code>
+ */
+ public IWebServiceProject getWebServiceProject(final String domId)
+ {
+ ContractChecker.nullCheckParam(domId, "domId"); //$NON-NLS-1$
+
+ final IWsDOMRuntimeExtension domRuntime = getDomRuntime(domId);
+ if (domRuntime == null) {
+ return null;
+ }
+
+ try {
+ final IDOM dom = domRuntime.getDOM();
+ if (dom==null) {
+ return null;
+ }
+
+ return DomUtil.INSTANCE.findProjectByName(dom, getProject().getName());
+ }
+ catch (WsDOMLoadCanceledException e) { // $JL-EXC$
+ return null;
+ }
+ }
+
+ protected IWsDOMRuntimeExtension getDomRuntime(final String domId) {
+ return WsDOMRuntimeManager.instance().getDOMRuntime(domId);
+ }
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationManager.java b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationManager.java
new file mode 100755
index 0000000..622f26c
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.dom.integration/src/org/eclipse/jst/ws/jaxws/dom/integration/validation/DomValidationManager.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2009 by SAP AG, Walldorf.
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.ws.jaxws.dom.integration.validation;
+
+import java.util.Collection;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jst.ws.jaxws.dom.integration.internal.plugin.DomIntegrationPlugin;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.CustomDomItemProviderAdapterFactory;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.DOMAdapterFactoryLabelProvider;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.ISEIChildList;
+import org.eclipse.jst.ws.jaxws.dom.integration.navigator.IWebServiceChildList;
+import org.eclipse.jst.ws.jaxws.dom.runtime.api.IWebServiceProject;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.DomValidatorFactory;
+import org.eclipse.jst.ws.jaxws.dom.runtime.validation.IDomValidator;
+import org.eclipse.jst.ws.jaxws.utils.dom.validation.DomValidationConstants;
+import org.eclipse.jst.ws.jaxws.utils.logging.Logger;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.validation.internal.provisional.core.IProjectValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+
+/**
+ * Registered to WST validation framework IValidator. Receives notifications for
+ * validation to be performed and calls registered DOM validators to perform the
+ * real validation.
+ *
+ * @author Georgi Vachkov
+ */
+public class DomValidationManager implements IValidatorJob
+{
+ public void cleanup(final IReporter reporter) {
+ // no resources for clean up
+ }
+
+ public void validate(final IValidationContext context, final IReporter reporter) {
+ validateInJob(context, reporter);
+ }
+
+ public IStatus validateInJob(final IValidationContext context, final IReporter reporter)
+ {
+ cleanMarkers((IProjectValidationContext) context);
+
+ IWebServiceProject wsProject;
+ for (IDomValidator validator : getValidators())
+ {
+ wsProject = (IWebServiceProject)context.loadModel("webServiceProject", new String []{validator.getSupportedDomRuntime()}); //$NON-NLS-1$
+ if (wsProject == null) {
+ continue;
+ }
+
+ validator.validate(wsProject);
+ refreshTree(wsProject);
+ }
+
+ return IValidatorJob.OK_STATUS;
+ }
+
+ public ISchedulingRule getSchedulingRule(final IValidationContext helper) {
+ return null;
+ }
+
+ protected void refreshTree(final IWebServiceProject wsProject)
+ {
+ final DOMAdapterFactoryLabelProvider labelProvider = labelProvider();
+ if (labelProvider == null) {
+ return;
+ }
+
+ Display.getDefault().asyncExec(new RefreshRunnable(labelProvider, wsProject));
+ }
+
+ protected DOMAdapterFactoryLabelProvider labelProvider()
+ {
+ return DomIntegrationPlugin.getDefault().getLabelProvider();
+ }
+
+ protected void cleanMarkers(IProjectValidationContext context)
+ {
+ try {
+ final IProject project = context.getProject();
+ if (project != null && project.isAccessible()) {
+ project.deleteMarkers(DomValidationConstants.MARKER_ID, true, IResource.DEPTH_INFINITE);
+ }
+ }
+ catch (CoreException e) {
+ (new Logger()).logError(e.getMessage(), e);
+ }
+ }
+
+ protected Collection<IDomValidator> getValidators()
+ {
+ return DomValidatorFactory.INSTANCE.getRegisteredValidators();
+ }
+
+ /**
+ * Class that fires label changed event to the label provider to apply validation
+ * results in the displayed tree - i.e. decorate images
+ *
+ * @author Georgi Vachkov
+ */
+ protected class RefreshRunnable implements Runnable
+ {
+ private final DOMAdapterFactoryLabelProvider labelProvider;
+ private final IWebServiceProject wsProject;
+
+ public RefreshRunnable(final DOMAdapterFactoryLabelProvider labelProvider, final IWebServiceProject wsProject) {
+ this.labelProvider = labelProvider;
+ this.wsProject = wsProject;
+ }
+
+ public void run()
+ {
+ labelProvider.fireLabelProviderChanged(wsProject);
+
+ fireLabelProviderChanged(ISEIChildList.class);
+ fireLabelProviderChanged(IWebServiceChildList.class);
+
+ final TreeIterator<EObject> allChilds = wsProject.eAllContents();
+ while (allChilds.hasNext()) {
+ labelProvider.fireLabelProviderChanged(allChilds.next());
+ }
+ }
+
+ private void fireLabelProviderChanged(final Class<?> adapterClass)
+ {
+ final Adapter adapter = CustomDomItemProviderAdapterFactory.INSTANCE.adapt(wsProject, adapterClass);
+ if (adapter == null) {
+ return;
+ }
+
+ labelProvider.fireLabelProviderChanged(adapter);
+ }
+ }
+}