diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.jaxrs.ui')
26 files changed, 0 insertions, 2372 deletions
diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/.classpath b/bundles/org.eclipse.jst.ws.jaxrs.ui/.classpath deleted file mode 100644 index 304e86186..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <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="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/.cvsignore b/bundles/org.eclipse.jst.ws.jaxrs.ui/.cvsignore deleted file mode 100644 index 117a1fe6b..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -bin -@dot* -temp.folder -build.xml -javaCompiler...args diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/.project b/bundles/org.eclipse.jst.ws.jaxrs.ui/.project deleted file mode 100644 index 568c0950c..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jst.ws.jaxrs.ui</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.jaxrs.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.jaxrs.ui/META-INF/MANIFEST.MF deleted file mode 100644 index c0671e379..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,29 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %plugin.name -Bundle-SymbolicName: org.eclipse.jst.ws.jaxrs.ui;singleton:=true -Bundle-Version: 1.0.400.qualifier -Bundle-Activator: org.eclipse.jst.ws.jaxrs.ui.internal.JAXRSUIPlugin -Bundle-Vendor: %PLUGIN_PROVIDER -Bundle-Localization: plugin -Require-Bundle: org.eclipse.jst.ws.jaxrs.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.wst.common.project.facet.ui;bundle-version="[1.4.100,2.0.0)", - org.eclipse.core.resources;bundle-version="[3.5.100,4.0.0)", - org.eclipse.jdt.core;bundle-version="[3.6.0,4.0.0)", - org.eclipse.jdt.ui;bundle-version="[3.6.0,4.0.0)", - org.eclipse.jst.j2ee;bundle-version="[1.1.400,2.0.0)", - org.eclipse.wst.common.frameworks.ui;bundle-version="[1.2.0,2.0.0)", - org.eclipse.emf.ecore;bundle-version="[2.6.0,3.0.0)", - org.eclipse.jst.server.core;bundle-version="[1.2.0,2.0.0)", - org.eclipse.wst.server.core;bundle-version="[1.1.202,2.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.100,2.0.0)", - org.eclipse.jst.common.project.facet.ui;bundle-version="[1.4.100,2.0.0)", - org.eclipse.jst.j2ee.core;bundle-version="[1.2.0,2.0.0)", - org.eclipse.jem.util;bundle-version="[2.1.0,3.0.0)", - org.eclipse.jem;bundle-version="[2.0.400,3.0.0)" -Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.jst.ws.jaxrs.ui.internal; - org.eclipse.jst.ws.jaxrs.ui.internal.classpath; - org.eclipse.jst.ws.jaxrs.ui.internal.project.facet -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Import-Package: org.eclipse.jst.common.project.facet.ui.libprov diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/about.html b/bundles/org.eclipse.jst.ws.jaxrs.ui/about.html deleted file mode 100644 index 4af3750b2..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<HTML> - -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> - -<BODY lang="EN-US"> - -<H3>About This Content</H3> - -<P>October, 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/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</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.jaxrs.ui/build.properties b/bundles/org.eclipse.jst.ws.jaxrs.ui/build.properties deleted file mode 100644 index 088f01d1b..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - icons/,\ - plugin.properties,\ - about.html diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/full/wizban/addlibrary_wiz.gif b/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/full/wizban/addlibrary_wiz.gif Binary files differdeleted file mode 100644 index 128c9d190..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/full/wizban/addlibrary_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/obj16/jar_l_obj.gif b/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/obj16/jar_l_obj.gif Binary files differdeleted file mode 100644 index 6cb185cff..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/obj16/jar_l_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/obj16/jar_obj.gif b/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/obj16/jar_obj.gif Binary files differdeleted file mode 100644 index 2fa1d777b..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/obj16/jar_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/obj16/library_obj.gif b/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/obj16/library_obj.gif Binary files differdeleted file mode 100644 index cb55e33b5..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/icons/obj16/library_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/plugin.properties b/bundles/org.eclipse.jst.ws.jaxrs.ui/plugin.properties deleted file mode 100644 index 75df1c91a..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/plugin.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2009, 2010 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -plugin.name=JAX-RS Tools - UI -PLUGIN_PROVIDER=Eclipse Web Tools Platform -preferencepage.jaxrslibraries.name=JAX-RS Libraries -classpathContainerPage.name.0 =JAX-RS Libraries -jaxrs.library.property.page =JAX-RS (REST Web Services) diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/plugin.xml b/bundles/org.eclipse.jst.ws.jaxrs.ui/plugin.xml deleted file mode 100644 index 8c1cfe6f4..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/plugin.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> -<plugin> - <!-- JAX-RS Project Facet --> - <extension point="org.eclipse.ui.propertyPages"> - <page - category="org.eclipse.wst.common.project.facet.ui.FacetsPropertyPage" - class="org.eclipse.jst.ws.jaxrs.ui.internal.project.facet.JAXRSLibraryPropertyPage" - id="org.eclipse.jst.ws.jaxrs.ui.internal.project.facet.JAXRSLibraryPropertyPage" - name="%jaxrs.library.property.page"> - <enabledWhen> - <adapt type="org.eclipse.core.resources.IProject"> - <test - forcePluginActivation="true" - property="org.eclipse.wst.common.project.facet.core.projectFacet" - value="jst.jaxrs"/> - </adapt> - </enabledWhen> - </page> - </extension> - <extension - point="org.eclipse.wst.common.project.facet.ui.wizardPages"> - <wizard-pages action="jst.jaxrs.v10.install"> - <page class="org.eclipse.jst.ws.jaxrs.ui.internal.project.facet.JAXRSFacetInstallPage"/> - </wizard-pages> - <wizard-pages action="jst.jaxrs.v11.install"> - <page class="org.eclipse.jst.ws.jaxrs.ui.internal.project.facet.JAXRSFacetInstallPage"/> - </wizard-pages> - - </extension> - - <extension point="org.eclipse.jst.common.project.facet.ui.libraryProviderActionPanels"> - <panel - provider="jaxrs-user-library-provider" - class="org.eclipse.jst.ws.jaxrs.ui.internal.project.facet.JAXRSUserLibraryProviderInstallPanel"/> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/IJAXRSUIConstants.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/IJAXRSUIConstants.java deleted file mode 100644 index adb106c7f..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/IJAXRSUIConstants.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100324 306937 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Properties page- NPE after pressing OK - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal; - -import org.eclipse.jst.ws.jaxrs.ui.internal.JAXRSUIPlugin; - -/** - * JAXRS Core framework constants - * - * <p> - * <b>Provisional API - subject to change</b> - * </p> - * - */ -public final class IJAXRSUIConstants { - /** - * The root value for saved settings - */ - public static final String SETTINGS_ROOT = JAXRSUIPlugin.PLUGIN_ID - + ".jaxrsFacetInstall"; //$NON-NLS-1$ - public static final String USER_LIBRARY_ID = "jaxrs-user-library-provider"; //$NON-NLS-1$ - - private IJAXRSUIConstants() { - // no instantiation - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/JAXRSUIPlugin.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/JAXRSUIPlugin.java deleted file mode 100644 index e08c5019f..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/JAXRSUIPlugin.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.jst.ws.jaxrs.core.internal.JAXRSCorePlugin; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * JAXRS UI plugin. - */ -public class JAXRSUIPlugin extends AbstractUIPlugin { - - /** - * The plugin id - */ - public static final String PLUGIN_ID = "org.eclipse.jst.ws.jaxrs.ui"; //$NON-NLS-1$ - // The shared instance. - private static JAXRSUIPlugin plugin; - - /** - * The constructor. - */ - public JAXRSUIPlugin() { - plugin = this; - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); - JAXRSCorePlugin.getDefault().setJAXRSUIDialogSettings( - getDialogSettings()); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - } - - /** - * Returns the shared instance. - * - * @return the default plugin instance - */ - public static JAXRSUIPlugin getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in - * relative path. - * - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - path = "icons/" + path; //$NON-NLS-1$ - return AbstractUIPlugin.imageDescriptorFromPlugin( - "org.eclipse.jst.ws.jaxrs.ui", path); //$NON-NLS-1$ - } - - /** - * Returns a shared image for the given name - * <p> - * Note: Images returned from this method will be automitically disposed of - * when this plug-in shuts down. Callers must not dispose of these images - * themselves. - * </p> - * - * @param name - * the image name found in /icons (with extension) - * @return the image, null on error or not found. - */ - public Image getImage(String name) { - if (name == null) { - return null; - } - - ImageRegistry images = getImageRegistry(); - Image image = images.get(name); - if (image == null) { - try { - final URL pluginBase = getBundle().getEntry("/"); - ; - ImageDescriptor id = ImageDescriptor.createFromURL(new URL( - pluginBase, "icons/" + name)); - images.put(name, id); - - image = images.get(name); - } catch (MalformedURLException ee) { - // log.CommonPlugin.image.error=Image {0} not found. - // .error("log.msg", "log.CommonPlugin.image.error", name, ee); - log(IStatus.ERROR, "Loading image", ee); - } - } - return image; - } - - /** - * @return the plugin id - */ - public String getPluginID() { - return PLUGIN_ID; - } - - /** - * Logs using the default ILog implementation provided by getLog(). - * - * @param severity - * Severity (IStatus constant) of log entry - * @param message - * Human-readable message describing log entry - * @param ex - * Throwable instance (can be null) - */ - public static void log(int severity, String message, Throwable ex) { - getDefault().getLog().log( - new Status(severity, PLUGIN_ID, IStatus.OK, message, ex)); - } - - /** - * Logs using the default ILog implementation provided by getLog(). - * - * @param severity - * Severity (IStatus constant) of log entry - * @param message - * Human-readable message describing log entry - */ - public static void log(int severity, String message) { - log(severity, message, null); - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/Messages.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/Messages.java deleted file mode 100644 index 2abaf7a98..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/Messages.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * String resource handler. - * - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.ws.jaxrs.ui.internal.messages"; //$NON-NLS-1$ - - static { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - public static String JAXRSFacetInstallPage_title; - public static String JAXRSFacetInstallPage_description; - public static String JAXRSFacetInstallPage_JAXRSServletLabel; - public static String JAXRSFacetInstallPage_JAXRSImplementationLibrariesFrame; - public static String JAXRSFacetInstallPage_Add2; - public static String JAXRSFacetInstallPage_JAXRSServletNameLabel; - public static String JAXRSFacetInstallPage_JAXRSServletClassNameLabel; - public static String JAXRSFacetInstallPage_JAXRSURLMappingLabel; - public static String JAXRSFacetInstallPage_PatternDialogTitle; - public static String JAXRSFacetInstallPage_PatternDialogDesc; - public static String JAXRSFacetInstallPage_Remove; - public static String JAXRSFacetInstallPage_PatternEmptyMsg; - public static String JAXRSFacetInstallPage_PatternSpecifiedMsg; - public static String JAXRSFacetInstallPage_ErrorNoWebAppDataModel; - public static String JAXRSFacetInstallPage_UpdateDD; - - public static String JAXRSLibraryConfigControl_IncludeGroupLabel; - public static String JAXRSLibraryConfigControl_DeployButtonLabel; - public static String JAXRSLibraryConfigControl_DeployJAR; - public static String JAXRSLibraryConfigControl_SharedLibButtonLabel; - public static String JAXRSLibraryConfigControl_TooltipIncludeAsSharedLib; - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/classpath/JAXRSLibraryValidationEvent.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/classpath/JAXRSLibraryValidationEvent.java deleted file mode 100644 index e086164c8..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/classpath/JAXRSLibraryValidationEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.classpath; - -import org.eclipse.core.runtime.IStatus; - -/** - * Validation event used by JAXRSLibraryControl to notify containers of updates - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public class JAXRSLibraryValidationEvent { - private String msg; - private int severity; - - /** - * Constructor - * - * @param msg - * @param severity - * - IStatus int value - */ - public JAXRSLibraryValidationEvent(String msg, int severity) { - this.msg = msg; - this.severity = severity; - } - - /** - * Constructs event with severity of IStatus.ERROR - * - * @param msg - */ - public JAXRSLibraryValidationEvent(String msg) { - this(msg, IStatus.ERROR); - } - - /** - * @return validation message - */ - public String getMessage() { - return msg; - } - - /** - * @return IStatus int value - */ - public int getSeverity() { - return severity; - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/classpath/JAXRSLibraryValidationListener.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/classpath/JAXRSLibraryValidationListener.java deleted file mode 100644 index 2aea54e29..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/classpath/JAXRSLibraryValidationListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100420 309846 ericdp@ca.ibm.com - Eric D. Peters, Remove dead code related to e.p. pluginProvidedJaxrsLibraries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.classpath; - -/** - * Listeners of {@link JAXRSLibraryValidationEvent}s should implement - * - * @deprecated - * - * <p> - * <b>Provisional API - subject to change - do not use</b> - * </p> - */ -public interface JAXRSLibraryValidationListener { - /** - * Callback - * - * @param e - */ - public void notifyValidation(JAXRSLibraryValidationEvent e); -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/messages.properties b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/messages.properties deleted file mode 100644 index a987b970d..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/messages.properties +++ /dev/null @@ -1,37 +0,0 @@ -############################################################################### -# Copyright (c) 2009, 2010 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# yyyymmdd bug Email and other contact information -# -------- -------- ----------------------------------------------------------- -# 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet -# 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet -# 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet -# 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect -############################################################################### -JAXRSFacetInstallPage_title=JAX-RS Capabilities -JAXRSFacetInstallPage_description=Add JAX-RS capabilities to this Web Project -JAXRSFacetInstallPage_JAXRSImplementationLibrariesFrame=JAX-RS &Implementation Library -JAXRSFacetInstallPage_JAXRSServletLabel=Servlet Information -JAXRSFacetInstallPage_Add2=&Add... -JAXRSFacetInstallPage_JAXRSServletNameLabel=JAX-RS &servlet name: -JAXRSFacetInstallPage_JAXRSServletClassNameLabel=JAX-RS servlet c&lass name: -JAXRSFacetInstallPage_JAXRSURLMappingLabel=&URL mapping patterns: -JAXRSFacetInstallPage_PatternDialogTitle=Specify URL Pattern -JAXRSFacetInstallPage_PatternDialogDesc=URL Pattern -JAXRSFacetInstallPage_Remove=&Remove -JAXRSFacetInstallPage_PatternEmptyMsg=Pattern must not be empty -JAXRSFacetInstallPage_PatternSpecifiedMsg=Pattern is already specified -JAXRSFacetInstallPage_ErrorNoWebAppDataModel=Unable to locate WebApp datamodel -JAXRSFacetInstallPage_UpdateDD=Update Deployment Descriptor - -JAXRSLibraryConfigControl_DeployJAR=Deploy jars to WEB-INF/lib -JAXRSLibraryConfigControl_DeployButtonLabel=Deploy -JAXRSLibraryConfigControl_IncludeGroupLabel=Include library with this application -JAXRSLibraryConfigControl_SharedLibButtonLabel=Shared Library -JAXRSLibraryConfigControl_TooltipIncludeAsSharedLib=Include as shared library diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSFacetIncludeLibrariesGroup.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSFacetIncludeLibrariesGroup.java deleted file mode 100644 index 577f7d13a..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSFacetIncludeLibrariesGroup.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100310 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100512 312640 kchong@ca.ibm.com - JAX-RS facet - Extraneous spacing needs to be removed. - * - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.project.facet; - -import org.eclipse.jst.ws.jaxrs.ui.internal.JAXRSUIPlugin; -import org.eclipse.jst.ws.jaxrs.ui.internal.Messages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.PlatformUI; - -public class JAXRSFacetIncludeLibrariesGroup extends Composite { - - private Button btnDeployJars; - private Button btnSharedLibrary; - Button copyOnPublishCheckBox; - private Composite includeLibRadiosComposite; - - public JAXRSFacetIncludeLibrariesGroup(Composite parent, int style) { - super(parent, style); - - // Set layout of this composite so its children will expand to fill available space. - GridLayout gridLayout = new GridLayout(1, true); - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - gridLayout.verticalSpacing = 0; - gridLayout.horizontalSpacing = 0; - setLayout(gridLayout); - setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // Children should have 'this' composite as their parent - copyOnPublishCheckBox = new Button(this, SWT.CHECK); - copyOnPublishCheckBox.setText(Messages.JAXRSLibraryConfigControl_IncludeGroupLabel); - includeLibRadiosComposite = new Composite(this, SWT.NONE); - GridLayout gridlayout = new GridLayout(); - gridlayout.numColumns = 1; - gridlayout.marginTop = 0; - gridlayout.marginBottom = 0; - gridlayout.marginRight = 0; - gridlayout.marginLeft = 10; - - includeLibRadiosComposite.setLayout(gridlayout); - GridData griddata = new GridData(GridData.FILL_HORIZONTAL); - includeLibRadiosComposite.setLayoutData(griddata); - - btnDeployJars = createRadioButton(includeLibRadiosComposite, Messages.JAXRSLibraryConfigControl_DeployButtonLabel, Messages.JAXRSLibraryConfigControl_DeployJAR, null); - - btnSharedLibrary = createRadioButton(includeLibRadiosComposite, Messages.JAXRSLibraryConfigControl_SharedLibButtonLabel, Messages.JAXRSLibraryConfigControl_TooltipIncludeAsSharedLib, null); - - copyOnPublishCheckBox.addSelectionListener(new SelectionAdapter() - { - public void widgetSelected(final SelectionEvent event) - { - boolean selection = copyOnPublishCheckBox.getSelection(); - btnDeployJars.setEnabled(selection); - btnSharedLibrary.setEnabled(selection); - - } - }); - // Need to initialize this properly - btnDeployJars.setSelection(true); - - } - - public Button getBtnDeployJars() { - return btnDeployJars; - } - - public Button getBtnSharedLibrary() { - return btnSharedLibrary; - } - - public Button getCopyOnPublishCheckBox() { - return copyOnPublishCheckBox; - } - - public Composite getIncludeLibRadiosComposite() { - return includeLibRadiosComposite; - } - - private Button createButton(int kind, Composite parent, String labelName, String tooltip, String infopop) - { - Button button = new Button(parent, kind); - - tooltip = tooltip == null ? labelName : tooltip; - button.setText(labelName); - button.setToolTipText(tooltip); - - if (infopop != null) - PlatformUI.getWorkbench().getHelpSystem().setHelp(button, JAXRSUIPlugin.PLUGIN_ID + "." + infopop); - - return button; - } - - private Button createCheckbox(Composite parent, String labelName, String tooltip, String infopop) - { - return createButton(SWT.CHECK, parent, labelName, tooltip, infopop); - } - - private Button createRadioButton(Composite parent, String labelName, String tooltip, String infopop) - { - return createButton(SWT.RADIO, parent, labelName, tooltip, infopop); - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSFacetInstallPage.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSFacetInstallPage.java deleted file mode 100644 index b92584289..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSFacetInstallPage.java +++ /dev/null @@ -1,698 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091021 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20091106 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100302 304405 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Facet : support JAX-RS 1.1 (JSR 311) - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100310 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100324 306937 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Properties page- NPE after pressing OK - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - * 20100428 310905 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet fails to install due to NPE or runtime exception due to duplicate cp entries - * 20100519 313576 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS tools- validation problems - * 20100618 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - * 20100820 323192 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS- Not prompted to enter servlet class when adding JAX-RS facet to a new web project - * 20101123 330916 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS - facet install should consider Web project associated with multiple EARs - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.project.facet; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.DialogSettings; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig; -import org.eclipse.jst.common.project.facet.core.libprov.internal.LibraryProvider; -import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi; -import org.eclipse.jst.j2ee.project.EarUtilities; -import org.eclipse.jst.j2ee.project.WebUtilities; -import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties; -import org.eclipse.jst.server.core.FacetUtil; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryproviderconfig.JAXRSLibraryProviderUtil; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig.SharedLibraryConfiguratorUtil; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.IJAXRSFacetInstallDataModelProperties; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSSharedLibraryProviderInstallOperationConfig; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSUserLibraryProviderInstallOperationConfig; -import org.eclipse.jst.ws.jaxrs.ui.internal.IJAXRSUIConstants; -import org.eclipse.jst.ws.jaxrs.ui.internal.JAXRSUIPlugin; -import org.eclipse.jst.ws.jaxrs.ui.internal.Messages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IPreset; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.common.project.facet.core.runtime.internal.BridgedRuntime; -import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage; -import org.eclipse.wst.common.project.facet.ui.IWizardContext; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.IRuntimeType; - -/** - * JAXRS Facet installation wizard page. - * - */ -@SuppressWarnings("restriction") -public class JAXRSFacetInstallPage extends DataModelWizardPage implements IJAXRSFacetInstallDataModelProperties, IFacetWizardPage -{ - // UI - private ServletInformationGroup servletInfoGroup; - - private IDialogSettings dialogSettings; - private IDataModel webAppDataModel; - private String sEARProject = null; - private String sWEBProject = null; - private IWizardContext context; - private String sTargetRuntime = null; - private IRuntime targetRuntime = null; - private boolean bAddToEAR = false; - private static final String SETTINGS_SERVLET = "servletName"; //$NON-NLS-1$ - private static final String SETTINGS_SERVLET_CLASSNAME = "servletClassname"; //$NON-NLS-1$ - private static final String SETTINGS_URL_MAPPINGS = "urlMappings"; //$NON-NLS-1$ - private static final String SETTINGS_URL_PATTERN = "pattern"; //$NON-NLS-1$ - private Button updateDDCheckBox; - private Composite composite = null; - private java.util.List<IProject> earProjects = null; - private IPreset selectedPreset = null; - private ILibraryProvider currentlySelectedLibraryType; - private boolean isProjectCreationMode = true; // project creation = true, - // add/remove facets mode = - // false - - /** - * Zero argument constructor - */ - public JAXRSFacetInstallPage() - { - super(DataModelFactory.createDataModel(new AbstractDataModelProvider() - {/* - * do nothing - */ - }), "jaxrs.facet.install.page"); //$NON-NLS-1$ - setTitle(Messages.JAXRSFacetInstallPage_title); - setDescription(Messages.JAXRSFacetInstallPage_description); - dialogSettings = JAXRSUIPlugin.getDefault().getDialogSettings(); - - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage - * #createTopLevelComposite(org.eclipse.swt.widgets.Composite) - */ - protected Composite createTopLevelComposite(final Composite parent) - { - initializeDialogUnits(parent); - composite = new Composite(parent, SWT.NONE); - final GridLayout jaxrsCompositeLayout = new GridLayout(1, false); - jaxrsCompositeLayout.marginTop = 0; - jaxrsCompositeLayout.marginBottom = 0; - jaxrsCompositeLayout.marginRight = 0; - jaxrsCompositeLayout.marginLeft = 0; - composite.setLayout(jaxrsCompositeLayout); - - final LibraryInstallDelegate librariesInstallDelegate = (LibraryInstallDelegate) getDataModel().getProperty(LIBRARY_PROVIDER_DELEGATE); - - currentlySelectedLibraryType = librariesInstallDelegate == null ? null : librariesInstallDelegate.getLibraryProvider(); - librariesInstallDelegate.getLibraryProviders(); - java.util.List<ILibraryProvider> providers = librariesInstallDelegate.getLibraryProviders(); - if (providers != null) { - for (ILibraryProvider provider : providers) { - if (provider != null) { - if (provider instanceof LibraryProvider) { - if (!provider.isAbstract()) { - LibraryProviderOperationConfig config = librariesInstallDelegate - .getLibraryProviderOperationConfig(provider); - - if (config instanceof JAXRSUserLibraryProviderInstallOperationConfig) { - JAXRSUserLibraryProviderInstallOperationConfig customConfig = (JAXRSUserLibraryProviderInstallOperationConfig) config; - customConfig.setModel(getDataModel()); - } else if (config instanceof JAXRSSharedLibraryProviderInstallOperationConfig) { - JAXRSSharedLibraryProviderInstallOperationConfig customConfig = (JAXRSSharedLibraryProviderInstallOperationConfig) config; - customConfig.setModel(getDataModel()); - } - } - } - } - } - } - - final Control librariesComposite = LibraryProviderFrameworkUi.createInstallLibraryPanel(composite, librariesInstallDelegate, Messages.JAXRSFacetInstallPage_JAXRSImplementationLibrariesFrame); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 3; - - librariesComposite.setLayoutData(gd); - updateDDCheckBox = new Button(composite, SWT.CHECK); - updateDDCheckBox.setText(Messages.JAXRSFacetInstallPage_UpdateDD); - updateDDCheckBox.addSelectionListener( - new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - servletInfoGroup.setFieldsEnabled(updateDDCheckBox.getSelection()); - } - }); - - servletInfoGroup = new ServletInformationGroup(composite, SWT.NONE); - servletInfoGroup.setDataModel(model); - updateUpdateDDState(librariesInstallDelegate.getLibraryProvider().getId()); - - addModificationListeners(); - - return composite; - } - -private void updateUpdateDDState(String libraryProviderID) { - boolean bUserLibrary = libraryProviderID.equals(IJAXRSUIConstants.USER_LIBRARY_ID); - if (bUserLibrary) { - updateDDCheckBox.setVisible(isJEE6orGreater()); - } else - updateDDCheckBox.setVisible(showUpdateDDCheckBox(libraryProviderID)); - if (updateDDCheckBox.getVisible()) { - boolean selected; - if (!bUserLibrary) - selected = getUpdateDDCheckBoxSelected(libraryProviderID); - else - selected = true; - servletInfoGroup.setFieldsEnabled(selected); - updateDDCheckBox.setSelection(selected); - updateDDCheckBox.getSelection(); - } - if (updateDDCheckBox.getVisible()) - model.setBooleanProperty(IJAXRSFacetInstallDataModelProperties.UPDATEDD, updateDDCheckBox.getSelection()); - else - model.setBooleanProperty(IJAXRSFacetInstallDataModelProperties.UPDATEDD, true); -} - - @SuppressWarnings("rawtypes") - private boolean isJEE6orGreater() { - sWEBProject = this.context.getProjectName(); - Iterator it = this.context.getSelectedProjectFacets().iterator(); - IProjectFacetVersion webFacetVersion = null; - while (it.hasNext()) { - // find Web facet - IProjectFacetVersion pfv = (IProjectFacetVersion) it.next(); - if (pfv.getProjectFacet().getId().equals("jst.web")) { //$NON-NLS-1$ - webFacetVersion = pfv; - break; - } - } - if (webFacetVersion != null) { - if (webFacetVersion.equals(WebUtilities.DYNAMIC_WEB_30)) - return true; - - } - - return false; - } - -private boolean getUpdateDDCheckBoxSelected(String libraryProviderID) { - return JAXRSLibraryProviderUtil.isUpdateDDCheckBoxSelectedByDefault(libraryProviderID); -} - -private boolean showUpdateDDCheckBox(String libraryProviderID) { - if (libraryProviderID.equals(IJAXRSUIConstants.USER_LIBRARY_ID)) - return true; - return JAXRSLibraryProviderUtil.isUpdateDDCheckBoxSupportAvailable(libraryProviderID); -} - -private void initializeValues() - { - IDialogSettings root = dialogSettings.getSection(IJAXRSUIConstants.SETTINGS_ROOT); - - if (!this.isProjectCreationMode) - { - // We are in add/remove facets mode - IProject webProject = SharedLibraryConfiguratorUtil.getWebProject(model); - if (webProject != null) - { - try - { - IFacetedProject fProject = ProjectFacetsManager.create(webProject); - // Get the runtime associated with this project - org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime = fProject.getPrimaryRuntime(); - if (facetRuntime != null) - { - IRuntime runtime = FacetUtil.getRuntime(facetRuntime); - if (runtime != null) - { - IRuntimeType rtType = runtime.getRuntimeType(); - if (rtType != null) - { - sTargetRuntime = rtType.getId(); - } - // Now, set the property - model.setStringProperty(IJAXRSFacetInstallDataModelProperties.TARGETRUNTIME, sTargetRuntime); - } - } - } - catch (CoreException e) - { - // We should have a faceted project - } - } - String earName = model.getStringProperty(IJAXRSFacetInstallDataModelProperties.EARPROJECT_NAME); - if (earName == null || earName.equals("")) - { - if (webProject != null) - { - - IProject[] earProjects = EarUtilities.getReferencingEARProjects(webProject); // required - // org.eclipse.jem.util - if (earProjects.length > 0) - { - earName = earProjects[0].getName(); - // Since we do have an EAR... - this.bAddToEAR = true; - this.sEARProject = earName; - model.setBooleanProperty(IJAXRSFacetInstallDataModelProperties.ADD_TO_EAR, true); - model.setStringProperty(IJAXRSFacetInstallDataModelProperties.EARPROJECT_NAME, earName); - } - } - } - } - - String servletName = null; - if (root != null) - servletName = root.get(SETTINGS_SERVLET); - if (servletName == null || servletName.equals("")) { //$NON-NLS-1$ - servletName = (String) model.getDefaultProperty(IJAXRSFacetInstallDataModelProperties.SERVLET_NAME); - } - servletInfoGroup.txtJAXRSServletName.setText(servletName); - - String servletClassname = null; - String libraryProviderID = ""; - LibraryInstallDelegate librariesInstallDelegate = (LibraryInstallDelegate) getDataModel().getProperty(LIBRARY_PROVIDER_DELEGATE); - if (librariesInstallDelegate != null && librariesInstallDelegate.getLibraryProvider() != null) - libraryProviderID = librariesInstallDelegate.getLibraryProvider().getId(); - if (root != null) { - servletClassname = root.get(libraryProviderID + SETTINGS_SERVLET_CLASSNAME); - } - if (servletClassname == null) { - servletClassname = JAXRSLibraryProviderUtil.getServletClassName(libraryProviderID); - if (servletClassname == null) - servletClassname = (String) model.getDefaultProperty(IJAXRSFacetInstallDataModelProperties.SERVLET_CLASSNAME); - } - servletInfoGroup.txtJAXRSServletClassName.setText(servletClassname); - - loadURLMappingPatterns(root); - } - - private void saveSettings() - { - DialogSettings root = new DialogSettings(IJAXRSUIConstants.SETTINGS_ROOT); - dialogSettings.addSection(root); - root.put(SETTINGS_SERVLET, getJAXRSServletName()); - LibraryInstallDelegate librariesInstallDelegate = (LibraryInstallDelegate) getDataModel().getProperty(LIBRARY_PROVIDER_DELEGATE); - root.put(new String (librariesInstallDelegate.getLibraryProvider().getId() + SETTINGS_SERVLET_CLASSNAME), getJAXRSServletClassname()); - DialogSettings mappings = new DialogSettings(SETTINGS_URL_MAPPINGS); - root.addSection(mappings); - mappings.put(SETTINGS_URL_PATTERN, getJAXRSPatterns()); - - } - - private String getJAXRSServletName() - { - return servletInfoGroup.txtJAXRSServletName.getText().trim(); - } - - private String getJAXRSServletClassname() - { - return servletInfoGroup.txtJAXRSServletClassName.getText().trim(); - } - - private String[] getJAXRSPatterns() - { - return servletInfoGroup.lstJAXRSServletURLPatterns.getItems(); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.project.facet.ui.IFacetWizardPage#setConfig(java - * .lang.Object) - */ - public void setConfig(Object config) - { - model.removeListener(this); - synchHelper.dispose(); - - model = (IDataModel) config; - model.addListener(this); - synchHelper = initializeSynchHelper(model); - model.setStringProperty(IJAXRSFacetInstallDataModelProperties.EARPROJECT_NAME, sEARProject); - model.setStringProperty(IJAXRSFacetInstallDataModelProperties.WEBPROJECT_NAME, sWEBProject); - model.setStringProperty(IJAXRSFacetInstallDataModelProperties.TARGETRUNTIME, sTargetRuntime); - model.setBooleanProperty(IJAXRSFacetInstallDataModelProperties.ADD_TO_EAR, bAddToEAR); - - model.setProperty(IJAXRSFacetInstallDataModelProperties.SERVER_IRUNTIME, targetRuntime); - model.setProperty(IJAXRSFacetInstallDataModelProperties.CONFIGURATION_PRESET, selectedPreset); - model.setProperty(IJAXRSFacetInstallDataModelProperties.EARPROJECTS, earProjects); - - } - - /* - * (non-Javadoc) - * - * @seeorg.eclipse.wst.common.project.facet.ui.IFacetWizardPage# - * transferStateToConfig() - */ - public void transferStateToConfig() - { - saveSettings(); - } - - private void addModificationListeners() - { -// jaxrsLibCfgComp.setSynchHelper(synchHelper); - synchHelper.synchText(servletInfoGroup.txtJAXRSServletName, SERVLET_NAME, null); - synchHelper.synchText(servletInfoGroup.txtJAXRSServletClassName, SERVLET_CLASSNAME, null); - synchHelper.synchList(servletInfoGroup.lstJAXRSServletURLPatterns, SERVLET_URL_PATTERNS, null); - synchHelper.synchCheckbox(updateDDCheckBox, UPDATEDD, null); - } - - private void loadURLMappingPatterns(IDialogSettings root) - { - servletInfoGroup.lstJAXRSServletURLPatterns.removeAll(); - IDialogSettings mappings = null; - if (root != null) - mappings = root.getSection(SETTINGS_URL_MAPPINGS); - String[] patterns = null; - if (mappings != null) - patterns = mappings.getArray(SETTINGS_URL_PATTERN); - - if (patterns == null || patterns.length == 0) - { - patterns = (String[]) model.getDefaultProperty(IJAXRSFacetInstallDataModelProperties.SERVLET_URL_PATTERNS); - } - for (int i = 0; i < patterns.length; i++) - { - addItemToList(patterns[i], false); - } - } - - private void addItemToList(String pattern, boolean selectMe) - { - servletInfoGroup.lstJAXRSServletURLPatterns.add(pattern == null ? "" : pattern); //$NON-NLS-1$ - if (pattern == null && selectMe) - servletInfoGroup.lstJAXRSServletURLPatterns.setSelection(servletInfoGroup.lstJAXRSServletURLPatterns.getItemCount() - 1); - // When 119321 is fixed - remove code below - updateModelForURLPattern(); - } - - private void removeItemFromList(String[] selection) - { - for (int i = 0; i < selection.length; i++) - { - String sel = selection[i]; - servletInfoGroup.lstJAXRSServletURLPatterns.remove(sel); - } - // When 119321 is fixed - remove code below - updateModelForURLPattern(); - } - - private void updateModelForURLPattern() - { - model.setProperty(IJAXRSFacetInstallDataModelProperties.SERVLET_URL_PATTERNS, servletInfoGroup.lstJAXRSServletURLPatterns.getItems()); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage - * #getValidationPropertyNames() - */ - protected String[] getValidationPropertyNames() - { - return new String[] { SERVLET_NAME, SERVLET_CLASSNAME, LIBRARY_PROVIDER_DELEGATE, UPDATEDD }; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.project.facet.ui.IFacetWizardPage#setWizardContext - * (org.eclipse.wst.common.project.facet.ui.IWizardContext) - */ - @SuppressWarnings("unchecked") - public void setWizardContext(IWizardContext context) { - // hook into web datamodel of new project wizard. - this.context = context; - sWEBProject = context.getProjectName(); - Iterator it = context.getSelectedProjectFacets().iterator(); - IProjectFacetVersion webFacetVersion = null; - while (it.hasNext()) { - // find Web facet - IProjectFacetVersion pfv = (IProjectFacetVersion) it.next(); - if (pfv.getProjectFacet().getId().equals("jst.web")) { //$NON-NLS-1$ - webFacetVersion = pfv; - break; - } - } - if (webFacetVersion != null) { - try { - webAppDataModel = (IDataModel) context.getConfig( - webFacetVersion, IFacetedProject.Action.Type.INSTALL, - context.getProjectName()); - if (webAppDataModel == null) { - // This means the web facet has already been installed! - isProjectCreationMode = false; - IProject webProject = ResourcesPlugin.getWorkspace() - .getRoot().getProject(sWEBProject); - - org.eclipse.wst.common.project.facet.core.runtime.IRuntime rt = ProjectFacetsManager - .create(webProject).getPrimaryRuntime(); - IRuntime runtime = FacetUtil.getRuntime(rt); - if (runtime != null) { - targetRuntime = runtime; - IRuntimeType rtType = runtime.getRuntimeType(); - if (rtType != null) { - sTargetRuntime = rtType.getId(); - } - - if (webProject != null) { - IProject[] referencingEARProjects = EarUtilities - .getReferencingEARProjects(webProject); - int size = referencingEARProjects.length; - - if (size == 1) { - String earName = referencingEARProjects[0] - .getName(); - // Since we do have only one EAR, let's use - // the existing 'support/variables' and - // continue as usual - // The two properties, ADD_TO_EAR and - // EARPROJECT_NAME will be set. - this.bAddToEAR = true; - this.sEARProject = earName; - } else if (size > 1) { - // On the other hand, if we have multiple - // ears, then we need to use the new - // property EARPROJECTS - // Perhaps we can just use this new property - // to handle the case for only one EAR. - this.bAddToEAR = true; - this.earProjects = new ArrayList<IProject>(); - String earName = referencingEARProjects[0] - .getName(); - this.sEARProject = earName; - for (int i = 0; i < size; i++) { - earProjects.add(referencingEARProjects[i]); - } - } - } - } - - } else { - Object oAddToEAR = webAppDataModel - .getProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR); - Object oTargetRuntime = webAppDataModel - .getProperty(IJ2EEModuleFacetInstallDataModelProperties.FACET_RUNTIME); - if (oAddToEAR != null) { - if (((Boolean) oAddToEAR).booleanValue() == true) { - bAddToEAR = true; - Object oEARProjectName = webAppDataModel - .getProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME); - if (oEARProjectName != null) { - this.sEARProject = (String) oEARProjectName; - - } - } - } - if (oTargetRuntime != null - && oTargetRuntime instanceof BridgedRuntime) { - BridgedRuntime br = (BridgedRuntime) oTargetRuntime; - if (br != null) { - IRuntime runtime = FacetUtil.getRuntime(br); - if (runtime != null) { - IRuntimeType rtType = runtime.getRuntimeType(); - if (rtType != null) - sTargetRuntime = rtType.getId(); - } - } - } - - } - - if (webAppDataModel != null) { - webAppDataModel.addListener(this); - } - } catch (CoreException e) { - JAXRSUIPlugin.log(IStatus.ERROR, - Messages.JAXRSFacetInstallPage_ErrorNoWebAppDataModel, - e); - } - } - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage - * # - * propertyChanged(org.eclipse.wst.common.frameworks.datamodel.DataModelEvent - * ) - */ - public void propertyChanged(DataModelEvent event) - { - - if (webAppDataModel != null) - { - String propertyName = event.getPropertyName(); - if (propertyName.equals(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER)) - { - model.setStringProperty(WEBCONTENT_DIR, event.getProperty().toString()); - } - else if (propertyName.equals(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR)) - { - model.setBooleanProperty(ADD_TO_EAR, ((Boolean) event.getProperty()).booleanValue()); - } - else if (propertyName.equals(IJ2EEModuleFacetInstallDataModelProperties.FACET_PROJECT_NAME)) - { - model.setStringProperty(WEBPROJECT_NAME, event.getProperty().toString()); - } - else if (propertyName.equals(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME)) - { - model.setStringProperty(EARPROJECT_NAME, event.getProperty().toString()); - } - else if (propertyName.equals(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE)) - { - if (event.getProperty() != null) { - - LibraryInstallDelegate librariesInstallDelegate = (LibraryInstallDelegate) getDataModel().getProperty(LIBRARY_PROVIDER_DELEGATE); - String libraryProviderID = librariesInstallDelegate.getLibraryProvider().getId(); - ILibraryProvider thisProvider = librariesInstallDelegate.getLibraryProvider(); - try { - //we are sometimes notified when the user has not actually changed the selected library type - if (currentlySelectedLibraryType != thisProvider) { - //only update servlet class name & update DD state when library - //type has changed - currentlySelectedLibraryType = thisProvider; - updateUpdateDDState(libraryProviderID); - updateServletClassName(libraryProviderID); - } - } catch (Exception e) { - //TODO exception as we are notified in non-UI thread and Invalid thread access exception, - //should find another way to get notified when library provider changes - - } - - } - } - } - super.propertyChanged(event); - } - - private void updateServletClassName(String libraryProviderID) { - servletInfoGroup.txtJAXRSServletClassName.setText(JAXRSLibraryProviderUtil.getServletClassName(libraryProviderID)); - } - -/* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage - * #dispose() - */ - public void dispose() - { - if (webAppDataModel != null) - webAppDataModel.removeListener(this); - -// jaxrsLibCfgComp.dispose(); - super.dispose(); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage - * #restoreDefaultSettings() - */ - protected void restoreDefaultSettings() - { - initializeValues(); - -// checkToCompletePage(jaxrsLibCfgComp); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage - * #showValidationErrorsOnEnter() - */ - protected boolean showValidationErrorsOnEnter() - { - return true; - } - @Override - public boolean isPageComplete() - { - final LibraryInstallDelegate librariesInstallDelegate = (LibraryInstallDelegate) getDataModel().getProperty(LIBRARY_PROVIDER_DELEGATE); - if (librariesInstallDelegate == null) - throw new IllegalArgumentException("LibraryInstallDelegate is expected to be non-null"); //$NON-NLS-1$ - - return super.isPageComplete() && (librariesInstallDelegate.validate().getSeverity() != IStatus.ERROR); - } - - - private void setChildrenEnabled(Composite parentComposite, boolean enabled) { - Control[] wsdlControls = parentComposite.getChildren(); - for (int i = 0; i < wsdlControls.length; i++) { - wsdlControls[i].setEnabled(enabled); - } - } - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSLibraryPropertyPage.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSLibraryPropertyPage.java deleted file mode 100644 index 6ef943826..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSLibraryPropertyPage.java +++ /dev/null @@ -1,294 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20091109 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100319 306594 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet install fails for Web 2.3 & 2.4 - * 20100324 306937 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Properties page- NPE after pressing OK - * 20100325 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - * 20100408 308565 kchong@ca.ibm.com - Keith Chong, JAX-RS: Servlet name and class not updated - * 20100413 307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect - * 20100512 311032 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Property page- SWT exception when removing facet - * 20100519 313576 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS tools- validation problems - * 20100618 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.project.facet; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.ui.libprov.LibraryFacetPropertyPage; -import org.eclipse.jst.j2ee.model.IModelProvider; -import org.eclipse.jst.javaee.core.UrlPatternType; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.ServletMapping; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.ws.jaxrs.core.internal.IJAXRSCoreConstants; -import org.eclipse.jst.ws.jaxrs.core.internal.Messages; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.IJAXRSFacetInstallDataModelProperties; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSJ2EEUtils; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSJEEUtils; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSUtils; -import org.eclipse.jst.ws.jaxrs.ui.internal.IJAXRSUIConstants; -import org.eclipse.jst.ws.jaxrs.ui.internal.JAXRSUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -@SuppressWarnings("restriction") -public final class JAXRSLibraryPropertyPage - -extends LibraryFacetPropertyPage - -implements IJAXRSFacetInstallDataModelProperties - -{ - - private static final String SETTINGS_SERVLET = "servletName"; //$NON-NLS-1$ - private static final String SETTINGS_SERVLET_CLASSNAME = "servletClassname"; //$NON-NLS-1$ - private static final String SETTINGS_URL_MAPPINGS = "urlMappings"; //$NON-NLS-1$ - private static final String SETTINGS_URL_PATTERN = "pattern"; //$NON-NLS-1$ - - private ServletInformationGroup servletInfoGroup; - - private IPath webXMLPath; - private IModelProvider provider; - private Object webAppObj; - - // J2EE - private org.eclipse.jst.j2ee.webapplication.Servlet j2eeServlet = null; - private org.eclipse.jst.j2ee.webapplication.ServletMapping j2eeServletMapping = null; - private String initialInstallDelegateLibraryProviderID =""; //$NON-NLS-1$ - @Override - protected Control createPageContents(Composite parent) - { - Control c = super.createPageContents(parent); - LibraryInstallDelegate initialInstallDelegate = super.getLibraryInstallDelegate(); - if ( initialInstallDelegate != null ) { - ILibraryProvider initialLibraryProvider = initialInstallDelegate.getLibraryProvider(); - if (initialLibraryProvider != null) { - String initID = initialLibraryProvider.getId(); - initialInstallDelegateLibraryProviderID = (initID == null) ? initialInstallDelegateLibraryProviderID : initID; - } - } - this.webXMLPath = new Path("WEB-INF").append("web.xml"); //$NON-NLS-1$ //$NON-NLS-2$ - this.provider = JAXRSUtils.getModelProvider(getProject()); - if (provider != null) - this.webAppObj = provider.getModelObject(); - if (doesDDFileExist(getProject(), this.webXMLPath)) { - servletInfoGroup = new ServletInformationGroup((Composite) c, SWT.NONE); - servletInfoGroup.txtJAXRSServletName.addListener(SWT.Modify, - new Listener() { - public void handleEvent(Event arg0) { - updateValidation(); - } - }); - servletInfoGroup.txtJAXRSServletClassName.addListener(SWT.Modify, - new Listener() { - public void handleEvent(Event arg0) { - updateValidation(); - } - }); - initializeValues(); - } - return c; - } - - public IProjectFacetVersion getProjectFacetVersion() - { - final IProjectFacet jaxrsFacet = ProjectFacetsManager.getProjectFacet(IJAXRSCoreConstants.JAXRS_FACET_ID); - final IFacetedProject fproj = getFacetedProject(); - return fproj.getInstalledVersion(jaxrsFacet); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - protected void initializeValues() - { - List<ServletMapping> servletMappings = new ArrayList<ServletMapping>(); - if (webAppObj != null) - { - servletInfoGroup.lstJAXRSServletURLPatterns.removeAll(); - //set defaults- in the rare case we do not find the servlet we will create another servlet entry - String servletName = JAXRSUtils.JAXRS_DEFAULT_SERVLET_NAME; - String servletClass = JAXRSUtils.JAXRS_SERVLET_CLASS; - //get id ofthe library provider being used - LibraryInstallDelegate installDelegate = super.getLibraryInstallDelegate(); - ILibraryProvider libraryProvider = installDelegate.getLibraryProvider(); - String id = ""; - if (libraryProvider != null) - id = libraryProvider.getId(); - if (JAXRSJEEUtils.isWebApp25or30(webAppObj)) { - WebApp webApp = (WebApp) webAppObj; - Servlet servlet = JAXRSJEEUtils.findJAXRSServlet(webApp, id); - if (servlet != null) { - servletMappings = webApp.getServletMappings(); - servletName = (servlet.getServletName() == null) ? servletName : servlet.getServletName(); - servletClass =(servlet.getServletClass() == null) ? servletClass : servlet.getServletClass(); - } else { - //we did not find the servlet entry, set default value - servletInfoGroup.lstJAXRSServletURLPatterns.add(JAXRSUtils.JAXRS_DEFAULT_URL_MAPPING); - } - } else { - // 2.3 or 2.4 web app - org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) webAppObj; - org.eclipse.jst.j2ee.webapplication.Servlet servlet = JAXRSJ2EEUtils - .findJAXRSServlet(webApp, id); - if (servlet != null) { - this.j2eeServlet = servlet; - servletMappings = webApp.getServletMappings(); - servletName = (servlet.getServletName() == null) ? servletName : servlet.getServletName(); - if (servlet.getServletClass() != null) { - servletClass =(servlet.getServletClass().getQualifiedName() == null) ? servletClass : servlet.getServletClass().getQualifiedName(); - } - } else { - //we did not find the servlet entry, set default value - servletInfoGroup.lstJAXRSServletURLPatterns.add(JAXRSUtils.JAXRS_DEFAULT_URL_MAPPING); - } - - } - servletInfoGroup.txtJAXRSServletName.setText(servletName); - servletInfoGroup.txtJAXRSServletClassName.setText(servletClass); - // Find the servletMapping that corresponds to the servletName - if (JAXRSJEEUtils.isWebApp25or30(webAppObj)) { - - for (Iterator<ServletMapping> i = servletMappings.iterator(); i.hasNext();) - { - Object o = i.next(); - if (o instanceof ServletMapping) - { - // init the servletMapping - ServletMapping next = (ServletMapping) o; - if (servletName.equals(next.getServletName())) - { - for (Iterator p = next.getUrlPatterns().iterator(); p.hasNext();) - { - UrlPatternType pattern = (UrlPatternType) p.next(); - servletInfoGroup.lstJAXRSServletURLPatterns.add(pattern.getValue()); - } - } - } - } - } else { - for (Iterator<ServletMapping> i = servletMappings.iterator(); i.hasNext();) - { - Object o = i.next(); - if (o instanceof org.eclipse.jst.j2ee.webapplication.ServletMapping) - { - // init the servletMapping - org.eclipse.jst.j2ee.webapplication.ServletMapping next = (org.eclipse.jst.j2ee.webapplication.ServletMapping) o; - org.eclipse.jst.j2ee.webapplication.Servlet aServlet = next.getServlet(); - // the servlet mapping may not have an associated servlet since the user could have modified the file - if (aServlet != null && servletName.equals(aServlet.getServletName())) - { - this.j2eeServletMapping = next; - String pattern = next.getUrlPattern(); - servletInfoGroup.lstJAXRSServletURLPatterns.add(new String(pattern)); - } - } - } - } - } - } - - public boolean performOk() - { - LibraryInstallDelegate installDelegate = super.getLibraryInstallDelegate(); - if (installDelegate == null) - //if null user has uninstalled the facet, no reason to update the project properties - return true; - ILibraryProvider libraryProvider = installDelegate.getLibraryProvider(); - if (libraryProvider != null) { - String id = libraryProvider.getId(); - if (!initialInstallDelegateLibraryProviderID.equals(id) - || IJAXRSUIConstants.USER_LIBRARY_ID.equals(id)) { - // This will update the libraries by calling the library - // provider delegate - super.performOk(); - } - } - - // Update the servlet properties - if (doesDDFileExist(getProject(), webXMLPath)) { - createServletAndModifyWebXML(getProject(), null, new NullProgressMonitor()); - } - return true; - } - - private void createServletAndModifyWebXML(final IProject project, final IDataModel config, final IProgressMonitor monitor) - { - List<String> listOfMappings = Arrays.asList(servletInfoGroup.lstJAXRSServletURLPatterns.getItems()); - if (JAXRSJEEUtils.isWebApp25or30(webAppObj)) - { - provider.modify(new UpdateWebXMLForJavaEE(project, initialInstallDelegateLibraryProviderID , servletInfoGroup.txtJAXRSServletName.getText(), servletInfoGroup.txtJAXRSServletClassName.getText(), listOfMappings), - IModelProvider.FORCESAVE); - } - else - // must be 2.3 or 2.4 - { - provider.modify(new UpdateWebXMLForJ2EE(project, this.j2eeServlet, this.j2eeServletMapping, servletInfoGroup.txtJAXRSServletName.getText(), servletInfoGroup.txtJAXRSServletClassName.getText(), listOfMappings), webXMLPath); - } - } - - private boolean doesDDFileExist(IProject project, IPath webXMLPath) - { - return getWebContentPath(project) == null ? false : project.getLocation().append(getWebContentPath(project).lastSegment()).append(webXMLPath).toFile().exists(); - } - private IPath getWebContentPath(IProject project){ - IVirtualComponent component = ComponentCore.createComponent(project); - IPath modulePath = component.getRootFolder().getWorkspaceRelativePath(); - return modulePath; - } - private IStatus validateServletInfo(String servletName, String ServletClassName) { - if (servletName == null || servletName.trim().length() == 0) { - String errorMessage = Messages.JAXRSFacetInstallDataModelProvider_ValidateServletName; - return createErrorStatus(errorMessage); - } - if (ServletClassName == null || ServletClassName.trim().length() == 0) { - String errorMessage = Messages.JAXRSFacetInstallDataModelProvider_ValidateServletClassName; - return createErrorStatus(errorMessage); - } - return Status.OK_STATUS; - } - private IStatus createErrorStatus(String msg) { - return new Status(IStatus.ERROR, JAXRSUIPlugin.PLUGIN_ID, msg); - } - protected IStatus performValidation() { - IStatus superValidation = super.performValidation(); - if (superValidation.isOK()) - if (doesDDFileExist(getProject(), this.webXMLPath)) - return validateServletInfo(servletInfoGroup.txtJAXRSServletName.getText(), servletInfoGroup.txtJAXRSServletClassName.getText()); - else - return Status.OK_STATUS; - else { - return superValidation; - } - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSUserLibraryProviderInstallPanel.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSUserLibraryProviderInstallPanel.java deleted file mode 100644 index 321bb8bec..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/JAXRSUserLibraryProviderInstallPanel.java +++ /dev/null @@ -1,342 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100310 291954 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS: Implement JAX-RS Facet - * 20100319 306595 ericdp@ca.ibm.com - Eric D. Peters, several install scenarios fail for both user library & non-user library - * 20100324 306937 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS Properties page- NPE after pressing OK - * 20100407 308401 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet wizard page - Shared-library option should be disabled - * 20100428 310905 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet fails to install due to NPE or runtime exception due to duplicate cp entries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.project.facet; - -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.ui.libprov.user.UserLibraryProviderInstallPanel; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryConfigDialogSettingData; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryConfigModel; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrslibraryconfig.JAXRSLibraryConfiglModelSource; -import org.eclipse.jst.ws.jaxrs.core.internal.jaxrssharedlibraryconfig.SharedLibraryConfiguratorUtil; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.IJAXRSFacetInstallDataModelProperties; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSUserLibraryProviderInstallOperationConfig; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener; - -public class JAXRSUserLibraryProviderInstallPanel extends UserLibraryProviderInstallPanel -{ - private JAXRSFacetIncludeLibrariesGroup includeLibsGroup; - private JAXRSLibraryConfigModel workingCopyModel = null; - private IDataModel model; - private JAXRSUserLibraryProviderInstallOperationConfig cfg;; - private ServletInformationGroup servletInfoGroup; - private boolean sharedLibSupported; - IDataModelListener listener; - private ILibraryProvider currentlySelectedLibraryType; - public JAXRSUserLibraryProviderInstallPanel() - { - super(); - } - - protected Control createControlNextToManageHyperlink(final Composite composite) - { - cfg = (JAXRSUserLibraryProviderInstallOperationConfig) getOperationConfig(); - model = cfg.getModel(); - - - Composite mainComp = new Composite(composite, SWT.NONE); - GridLayout gl = new GridLayout(); - gl.numColumns = 1; - gl.marginTop = 0; - gl.marginBottom = 0; - gl.marginRight = 0; - gl.marginLeft = 0; - mainComp.setLayout(gl); - if (!onPropertiesPage()) { - String libraryID = ((LibraryInstallDelegate)model.getProperty(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE)).getLibraryProvider().getId(); - //listen for all changes in the model- if user changes addToEAR or library type we might need to - //update the Deploy / Shared Library options - listener = new IDataModelListener() { - - public void propertyChanged(DataModelEvent arg0) { - DataModelEvent event = arg0; - if (event == null || event.getPropertyName() == null || (!event.getPropertyName().equals(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE) && !event.getPropertyName().equals(IJAXRSFacetInstallDataModelProperties.ADD_TO_EAR) )) - return; - LibraryInstallDelegate librariesInstallDelegate = (LibraryInstallDelegate) model - .getProperty(IJAXRSFacetInstallDataModelProperties.LIBRARY_PROVIDER_DELEGATE); - ILibraryProvider thisProvider = librariesInstallDelegate - .getLibraryProvider(); - if (currentlySelectedLibraryType == null) - currentlySelectedLibraryType = thisProvider; - else { - //we are sometimes notified when the user has not actually changed the selected library type - if (currentlySelectedLibraryType != thisProvider) { - //only update servlet class name & update DD state when library - //type has changed - currentlySelectedLibraryType = thisProvider; - } else if (!event.getPropertyName().equals(IJAXRSFacetInstallDataModelProperties.ADD_TO_EAR)) { - return; - } - } - String libraryProviderID = librariesInstallDelegate - .getLibraryProvider().getId(); - sharedLibSupported = SharedLibraryConfiguratorUtil - .isSharedLibSupportAvailable( - libraryProviderID, - model.getStringProperty(IJAXRSFacetInstallDataModelProperties.TARGETRUNTIME), - SharedLibraryConfiguratorUtil - .getWebProject(model), - SharedLibraryConfiguratorUtil - .getEARProject(model), - SharedLibraryConfiguratorUtil - .getAddToEar(model)); - try { - model.removeListener(listener); - initializeControlValues(); - model.addListener(listener); - } catch (Exception e) { - //TODO exception as we are notified in non-UI thread and Invalid thread access exception, - //should find another way to get notified when data model changes - - } - - } - - }; - model.addListener(listener); - sharedLibSupported = SharedLibraryConfiguratorUtil - .isSharedLibSupportAvailable( - libraryID, - model.getStringProperty(IJAXRSFacetInstallDataModelProperties.TARGETRUNTIME), - SharedLibraryConfiguratorUtil - .getWebProject(model), - SharedLibraryConfiguratorUtil - .getEARProject(model), - SharedLibraryConfiguratorUtil - .getAddToEar(model)); - - - //we are in facet install mode - includeLibsGroup = new JAXRSFacetIncludeLibrariesGroup(mainComp, SWT.NONE); - includeLibsGroup.getCopyOnPublishCheckBox().setSelection(cfg.isIncludeWithApplicationEnabled()); - - - - - includeLibsGroup.getCopyOnPublishCheckBox().addSelectionListener( - new SelectionAdapter() { - public void widgetSelected(final SelectionEvent event) { - cfg.setIncludeWithApplicationEnabled(includeLibsGroup - .getCopyOnPublishCheckBox().getSelection()); - boolean deployLib = false; - boolean shareLib = false; - if (includeLibsGroup.getCopyOnPublishCheckBox() - .getSelection()) { - deployLib = includeLibsGroup - .getBtnDeployJars().getSelection(); - shareLib = includeLibsGroup - .getBtnSharedLibrary().getSelection(); - cfg.setIsDeploy(deployLib); - cfg.setSharedLibrary(shareLib); - IDataModel model = cfg.getModel(); - model.setProperty( - IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION, - deployLib); - model.setProperty( - IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY, - shareLib); - updateIncludeLibrariesGroupState(shareLib, deployLib, sharedLibSupported); - } else { - cfg.setIsDeploy(deployLib); - cfg.setSharedLibrary(shareLib); - IDataModel model = cfg.getModel(); - model.setProperty( - IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION, - deployLib); - model.setProperty( - IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY, - shareLib); - setChildrenEnabled(includeLibsGroup.getIncludeLibRadiosComposite(), false); - - } - - - - } - }); - - includeLibsGroup.getBtnDeployJars().addSelectionListener( - new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - boolean deployLib = includeLibsGroup.getBtnDeployJars() - .getSelection(); - boolean shareLib = includeLibsGroup - .getBtnSharedLibrary().getSelection(); - cfg.setIsDeploy(deployLib); - cfg.setSharedLibrary(shareLib); - IDataModel model = cfg.getModel(); - model.setProperty( - IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION, - deployLib); - model.setProperty( - IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY, - shareLib); - } - }); - - includeLibsGroup.getBtnSharedLibrary().addSelectionListener( - new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - boolean deployLib = includeLibsGroup.getBtnDeployJars() - .getSelection(); - boolean shareLib = includeLibsGroup - .getBtnSharedLibrary().getSelection(); - cfg.setIsDeploy(deployLib); - cfg.setSharedLibrary(shareLib); - IDataModel model = cfg.getModel(); - model.setProperty( - IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION, - deployLib); - model.setProperty( - IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY, - shareLib); - } - }); - - final IPropertyChangeListener listener = new IPropertyChangeListener() - { - public void propertyChanged(final String property, final Object oldValue, final Object newValue) - { - if (oldValue != newValue) - { -// copyOnPublishCheckBox.setSelection(cfg.isIncludeWithApplicationEnabled()); - } - } - }; - - cfg.addListener(listener, JAXRSUserLibraryProviderInstallOperationConfig.PROP_INCLUDE_WITH_APPLICATION_ENABLED); - - includeLibsGroup.getCopyOnPublishCheckBox().addDisposeListener(new DisposeListener() - { - public void widgetDisposed(final DisposeEvent event) - { - cfg.removeListener(listener); - } - }); - } - - setDownloadCommandEnabled(false); - initialize(); - return mainComp; - } - - private boolean onPropertiesPage() { - return cfg.getModel() == null; - } - - - private void initialize() - { - // if shared lib not supported but shared lib setting was true, assume they - // still want to include libraries - JAXRSLibraryConfiglModelSource source; - if (!onPropertiesPage()) - source = new JAXRSLibraryConfigDialogSettingData(includeLibsGroup.getBtnDeployJars().getSelection(), includeLibsGroup.getBtnSharedLibrary().getSelection(), true); - else - source = new JAXRSLibraryConfigDialogSettingData(true, false, false); - if (source != null) - { - // never read persistentModel = source; - workingCopyModel = JAXRSLibraryConfigModel.JAXRSLibraryConfigModelFactory.createInstance(source); - initializeControlValues(); - } - } - - private void initializeControlValues() - { -// btnDeployJars.setSelection(false); -// btnSharedLibrary.setSelection(false); -// copyOnPublishCheckBox.setSelection(false); - - if (!onPropertiesPage()) - { - boolean bSharedLib = (Boolean) model - .getDefaultProperty(IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY); - boolean bDeploy = (Boolean) model - .getDefaultProperty(IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION); - if (sharedLibSupported) { - bSharedLib = SharedLibraryConfiguratorUtil - .isSharedLibSelectedByDefault(model - .getStringProperty(IJAXRSFacetInstallDataModelProperties.TARGETRUNTIME)); - if (!bSharedLib) - bDeploy = true; - else - // don't want both to be true, shared lib takes - // precedence - bDeploy = false; - - } - // set the properties on the model - model.setBooleanProperty( - IJAXRSFacetInstallDataModelProperties.DEPLOY_IMPLEMENTATION, - bDeploy); - // set the properties on the configuration object as well - cfg.setIsDeploy(bDeploy); - if (sharedLibSupported) { - cfg.setSharedLibrary(bSharedLib); - model.setBooleanProperty( - IJAXRSFacetInstallDataModelProperties.SHAREDLIBRARY, - bSharedLib); - } - - updateIncludeLibrariesGroupState(bSharedLib, bDeploy, sharedLibSupported); - - } - -// redraw(); - } - - private void updateIncludeLibrariesGroupState(boolean bSharedLib, boolean bDeploy, boolean sharedLibSupported) { - includeLibsGroup.getCopyOnPublishCheckBox().setEnabled(true); - includeLibsGroup.getCopyOnPublishCheckBox().setSelection(bDeploy - || (sharedLibSupported &&bSharedLib)); - updateChildrenState(bSharedLib, bDeploy, sharedLibSupported); - - } - - private void updateChildrenState(boolean bSharedLib, boolean bDeploy, boolean sharedLibSupported) { - includeLibsGroup.getBtnDeployJars().setSelection(bDeploy - || (includeLibsGroup.getCopyOnPublishCheckBox().getSelection() && (!sharedLibSupported || (sharedLibSupported && !bSharedLib)))); - // shared library has precedence - includeLibsGroup.getBtnSharedLibrary().setSelection(sharedLibSupported - && bSharedLib); - includeLibsGroup.getBtnSharedLibrary().setEnabled(includeLibsGroup.getCopyOnPublishCheckBox().getSelection() && sharedLibSupported); - includeLibsGroup.getBtnDeployJars().setEnabled(includeLibsGroup.getCopyOnPublishCheckBox().getSelection()); - - } - public static void setChildrenEnabled(Composite parentComposite, boolean enabled) { - Control[] wsdlControls = parentComposite.getChildren(); - for (int i=0; i<wsdlControls.length; i++) { - wsdlControls[i].setEnabled(enabled); - } - } - - -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/ServletInformationGroup.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/ServletInformationGroup.java deleted file mode 100644 index d4bb18dcf..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/ServletInformationGroup.java +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100428 310905 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet fails to install due to NPE or runtime exception due to duplicate cp entries - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.project.facet; - -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.dialogs.IInputValidator; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.IJAXRSFacetInstallDataModelProperties; -import org.eclipse.jst.ws.jaxrs.ui.internal.Messages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class ServletInformationGroup extends Composite { - - private Group servletInfo; - private Label lblJAXRSServletName; - public Text txtJAXRSServletName; - private Label lblJAXRSServletClassName; - public Text txtJAXRSServletClassName; - private Label lblJAXRSServletURLPatterns; - public List lstJAXRSServletURLPatterns; - public Button btnAddPattern; - public Button btnRemovePattern; - - private IDataModel optionalModel; - - private IDialogSettings dialogSettings; - private IDataModel webAppDataModel; - private String sEARProject = null; - private String sWEBProject = null; - private String sTargetRuntime = null; - private boolean bAddToEAR = false; - private static final String SETTINGS_SERVLET = "servletName"; //$NON-NLS-1$ - private static final String SETTINGS_SERVLET_CLASSNAME = "servletClassname"; //$NON-NLS-1$ - private static final String SETTINGS_URL_MAPPINGS = "urlMappings"; //$NON-NLS-1$ - private static final String SETTINGS_URL_PATTERN = "pattern"; //$NON-NLS-1$ -// private Composite composite = null; - - public ServletInformationGroup(Composite parent, int style) { - super(parent, style); - - GridLayout gridLayout = new GridLayout(1, true); - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - gridLayout.verticalSpacing = 0; - gridLayout.horizontalSpacing = 0; - setLayout(gridLayout); - setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - servletInfo = new Group(this, SWT.NONE); - GridData servletGD = new GridData(GridData.FILL_HORIZONTAL); - servletInfo.setLayoutData(servletGD); - servletInfo.setLayout(new GridLayout(3, false)); - servletInfo.setText(Messages.JAXRSFacetInstallPage_JAXRSServletLabel); - - lblJAXRSServletName = new Label(servletInfo, SWT.NONE); - lblJAXRSServletName - .setText(Messages.JAXRSFacetInstallPage_JAXRSServletNameLabel); - lblJAXRSServletName.setLayoutData(new GridData(GridData.BEGINNING)); - - txtJAXRSServletName = new Text(servletInfo, SWT.BORDER); - GridData gd2 = new GridData(GridData.FILL_HORIZONTAL); - gd2.horizontalSpan = 2; - txtJAXRSServletName.setLayoutData(gd2); - - lblJAXRSServletClassName = new Label(servletInfo, SWT.NONE); - lblJAXRSServletClassName - .setText(Messages.JAXRSFacetInstallPage_JAXRSServletClassNameLabel); - lblJAXRSServletClassName - .setLayoutData(new GridData(GridData.BEGINNING)); - - txtJAXRSServletClassName = new Text(servletInfo, SWT.BORDER); - GridData gd2c = new GridData(GridData.FILL_HORIZONTAL); - gd2c.horizontalSpan = 2; - txtJAXRSServletClassName.setLayoutData(gd2c); - - lblJAXRSServletURLPatterns = new Label(servletInfo, SWT.NULL); - lblJAXRSServletURLPatterns - .setText(Messages.JAXRSFacetInstallPage_JAXRSURLMappingLabel); - lblJAXRSServletURLPatterns.setLayoutData(new GridData( - GridData.BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING)); - lstJAXRSServletURLPatterns = new List(servletInfo, SWT.BORDER); - GridData gd3 = new GridData(GridData.FILL_BOTH); -// gd3.heightHint = convertHeightInCharsToPixels(5); - lstJAXRSServletURLPatterns.setLayoutData(gd3); - lstJAXRSServletURLPatterns.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - btnRemovePattern.setEnabled(lstJAXRSServletURLPatterns - .getSelectionCount() > 0); - } - }); - - Composite btnComposite = new Composite(servletInfo, SWT.NONE); - GridLayout gl = new GridLayout(1, false); - gl.marginLeft = 0; - btnComposite.setLayout(gl); - btnComposite.setLayoutData(new GridData(GridData.END - | GridData.VERTICAL_ALIGN_FILL)); - - btnAddPattern = new Button(btnComposite, SWT.NONE); - btnAddPattern.setText(Messages.JAXRSFacetInstallPage_Add2); - btnAddPattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL - | GridData.VERTICAL_ALIGN_BEGINNING)); - btnAddPattern.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - InputDialog dialog = new InputDialog(getShell(), - Messages.JAXRSFacetInstallPage_PatternDialogTitle, - Messages.JAXRSFacetInstallPage_PatternDialogDesc, null, - new IInputValidator() { - - public String isValid(String newText) { - return isValidPattern(newText); - } - - }); - dialog.open(); - if (dialog.getReturnCode() == Window.OK) { - addItemToList(dialog.getValue(), true); - } - } - }); - - btnRemovePattern = new Button(btnComposite, SWT.NONE); - btnRemovePattern.setText(Messages.JAXRSFacetInstallPage_Remove); - btnRemovePattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL - | GridData.VERTICAL_ALIGN_BEGINNING)); - btnRemovePattern.setEnabled(false); - btnRemovePattern.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - removeItemFromList(lstJAXRSServletURLPatterns.getSelection()); - btnRemovePattern.setEnabled(false); - } - }); - - } - - - - - private String isValidPattern(String value) { - if (value == null || value.trim().equals("")) //$NON-NLS-1$ - return Messages.JAXRSFacetInstallPage_PatternEmptyMsg; - if (lstJAXRSServletURLPatterns.indexOf(value) >= 0) - return Messages.JAXRSFacetInstallPage_PatternSpecifiedMsg; - - return null; - } - - private void addItemToList(String pattern, boolean selectMe) { - lstJAXRSServletURLPatterns.add(pattern == null ? "" : pattern); //$NON-NLS-1$ - if (pattern == null && selectMe) - lstJAXRSServletURLPatterns.setSelection(lstJAXRSServletURLPatterns - .getItemCount() - 1); - // When 119321 is fixed - remove code below - updateModelForURLPattern(); - } - - private void updateModelForURLPattern() { - if (optionalModel != null) - optionalModel.setProperty( - IJAXRSFacetInstallDataModelProperties.SERVLET_URL_PATTERNS, - lstJAXRSServletURLPatterns.getItems()); - } - - private void removeItemFromList(String[] selection) { - for (int i = 0; i < selection.length; i++) { - String sel = selection[i]; - lstJAXRSServletURLPatterns.remove(sel); - } - // When 119321 is fixed - remove code below - updateModelForURLPattern(); - } - - - public void setDataModel(IDataModel model) - { - this.optionalModel = model; - } - - - - - public void setFieldsEnabled(boolean selection) { - btnAddPattern.setEnabled(selection); - btnRemovePattern.setEnabled(selection); - txtJAXRSServletClassName.setEnabled(selection); - txtJAXRSServletName.setEnabled(selection); - lblJAXRSServletClassName.setEnabled(selection); - lblJAXRSServletName.setEnabled(selection); - lblJAXRSServletURLPatterns.setEnabled(selection); - lstJAXRSServletURLPatterns.setEnabled(selection); - - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/UpdateWebXMLBase.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/UpdateWebXMLBase.java deleted file mode 100644 index a90cfec95..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/UpdateWebXMLBase.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.project.facet; - -public abstract class UpdateWebXMLBase implements Runnable -{ - public abstract void run(); -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/UpdateWebXMLForJ2EE.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/UpdateWebXMLForJ2EE.java deleted file mode 100644 index bffaaa594..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/UpdateWebXMLForJ2EE.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100618 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.project.facet; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.j2ee.webapplication.Servlet; -import org.eclipse.jst.j2ee.webapplication.ServletMapping; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSJ2EEUtils; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class UpdateWebXMLForJ2EE extends UpdateWebXMLBase implements Runnable { - private IProject project; - private Servlet servlet; - private ServletMapping servletMapping; - private String newServletName, newServletClass; - private List<String> listOfMappings; - - public UpdateWebXMLForJ2EE(IProject project, Servlet servlet, ServletMapping servletMapping, String newServletName, String newServletClass, List listOfMappings) { - this.project = project; - this.project = project; - this.servlet = servlet; - this.servletMapping = servletMapping; - this.newServletName = newServletName; - this.newServletClass = newServletClass; - this.listOfMappings = listOfMappings; - } - - public void run() { - org.eclipse.jst.j2ee.webapplication.WebApp webApp = (org.eclipse.jst.j2ee.webapplication.WebApp) ModelProviderManager - .getModelProvider(project).getModelObject(); - //servlet may not exist yet, but will after call below - servlet = JAXRSJ2EEUtils.createOrUpdateServletRef(webApp, this.newServletName, this.newServletClass, this.servlet); - JAXRSJ2EEUtils.updateURLMappings(webApp, listOfMappings, servlet); - - } -} diff --git a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/UpdateWebXMLForJavaEE.java b/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/UpdateWebXMLForJavaEE.java deleted file mode 100644 index 9bff0d5cd..000000000 --- a/bundles/org.eclipse.jst.ws.jaxrs.ui/src/org/eclipse/jst/ws/jaxrs/ui/internal/project/facet/UpdateWebXMLForJavaEE.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20100303 291954 kchong@ca.ibm.com - Keith Chong, JAX-RS: Implement JAX-RS Facet - * 20100408 308565 kchong@ca.ibm.com - Keith Chong, JAX-RS: Servlet name and class not updated - * 20100618 307059 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS properties page- fields empty or incorrect - *******************************************************************************/ -package org.eclipse.jst.ws.jaxrs.ui.internal.project.facet; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.j2ee.model.ModelProviderManager; -import org.eclipse.jst.javaee.web.Servlet; -import org.eclipse.jst.javaee.web.ServletMapping; -import org.eclipse.jst.javaee.web.WebApp; -import org.eclipse.jst.ws.jaxrs.core.internal.project.facet.JAXRSJEEUtils; - -public class UpdateWebXMLForJavaEE extends UpdateWebXMLBase implements Runnable { - private IProject project; - private String newServletName, newServletClass, jaxrsLibraryID; - private List<String> listOfMappings; - - - /** - * @deprecated - * @param project - * @param servlet - * @param servletMapping - * @param newServletName - * @param newServletClass - * @param listOfMappings - */ - public UpdateWebXMLForJavaEE(final IProject project, Servlet servlet, ServletMapping servletMapping, String newServletName, String newServletClass, List<String> listOfMappings) { - this.project = project; - this.newServletName = newServletName; - this.newServletClass = newServletClass; - this.listOfMappings = listOfMappings; - } - /** - * @deprecated - */ - public UpdateWebXMLForJavaEE(final IProject project, String newServletName, String newServletClass, List<String> listOfMappings) { - this.project = project; - this.newServletName = newServletName; - this.newServletClass = newServletClass; - this.listOfMappings = listOfMappings; - - } - public UpdateWebXMLForJavaEE(final IProject project, String jaxrsLibraryID, String newServletName, String newServletClass, List<String> listOfMappings) { - this.project = project; - this.newServletName = newServletName; - this.newServletClass = newServletClass; - this.listOfMappings = listOfMappings; - this.jaxrsLibraryID = jaxrsLibraryID; - } - - public void run() { - WebApp webApp = (WebApp) ModelProviderManager.getModelProvider(project).getModelObject(); - Servlet servlet; - servlet = JAXRSJEEUtils.findJAXRSServlet(webApp, jaxrsLibraryID); - //servlet may not exist yet, but will after call below - servlet = JAXRSJEEUtils.createOrUpdateServletRef(webApp, this.newServletName, this.newServletClass, servlet); - JAXRSJEEUtils.updateURLMappings(webApp, listOfMappings, servlet); - } -} |