diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst')
139 files changed, 0 insertions, 24687 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/consumption/ui/plugin.properties b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/consumption/ui/plugin.properties deleted file mode 100644 index 376ed9fb8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/consumption/ui/plugin.properties +++ /dev/null @@ -1,564 +0,0 @@ -############################################################################### -# Copyright (c) 2004 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 -############################################################################### - -# -# Messages in plugin.xml. -# - -PLUGIN_NEW_WIZARD_NAME_WS_CLIENT=Web Service Client -# -# Web services "Internet" preferences extension. -# - -# -# Web Samples IDs -# - -# -# Pop-up actions -# -ACTION_GENERATE_JAVA_PROXY=Generate Client - -# -# Dialogs -# -CHECKBOX_SHOW_GENERATE_JAVA_PROXY_DIALOG=Show Generate Java bean Proxy Dialog -TOOLTIP_PPAD_CHECKBOX_WSDL2PROXY=Show the dialog for generating the Java bean proxy action. - -# -# Web Services Preferance Pages -# -# Categories -# - -# -# Preferences Tooltips -# - -# -#Server Runtime Preferences -# -TOOLTIP_SRPF_COMBO_SERVER=The preferred server type -TOOLTIP_SRPF_COMBO_RUNTIME=The preferred Web service runtime -TOOLTIP_SRPF_COMBO_J2EE=The preferred J2EE version - -# -# Pop-up actions -# - -# -# General messages. -# -MSG_ERROR_TASK_EXCEPTED=IWAB0234E An internal error occurred. Details: {0} -MSG_ERROR_NO_SERVER_RUNTIME=No suitable server can be found for the {0} Web service runtime. Go to Window > Preferences. Select Server > Installed Runtimes and configure one of the following: {1} - - - - -# -#Runtime labels -# - - -# -# Wizard page task labels and descriptions -# (used only for progress indication). -# - -# -# Common wizard strings. -# -LABEL_FOLDER_NAME=Folder: -LABEL_JSP_FOLDER_NAME=JSP folder: -LABEL_WEB_PROJECT_NAME=Web project: -LABEL_WEBSERVICETYPE=Web service type: -LABEL_J2EE_VERSION=J2EE version: -LABEL_NA=N/A - -BUTTON_BROWSE=Browse... -BUTTON_BROWSE_FILES=Browse files... -BUTTON_USE_ABSOLUTE_LOCATION=Use absolute location URI for WSDL input statements -BUTTON_USE_INLINE_SCHEMA=Use inline schema - -BOTTOMUP_LABEL=Bottom up -TOPDOWN_LABEL=Top down -CLIENT_LABEL=Client -COMBINED_TYPE_AND_RUNTIME_LABEL={0} {1} - - - -# -# Wizards. -# -WIZARD_TITLE_WSC=Web Service Client - -# -# WebServiceClientSelectionPage -# - -# -# WebServiceServerSelectionPage -# - -# -# WebServiceProjectPage -# -PAGE_TITLE_WS_PROJECT=Web Services -PAGE_DESC_WS_PROJECT=Review your Web service options and make any necessary changes before proceeding to the next page. -BUTTON_START_WEB_PROJECT=Start Web service in Web project -GROUP_SCENARIO_SERVICE=Service -GROUP_SCENARIO_CLIENT=Client proxy -LABEL_WEBSERVICECLIENTTYPE=Client proxy type: - - - -# Items common to WebServiceRuntimeSelectionPage and WebServiceClientRuntimeSelectionPage -# WebServiceRuntimeSelectionPage -PAGE_TITLE_WS_RUNTIME_SELECTION=Service Deployment Configuration -PAGE_DESC_WS_RUNTIME_SELECTION=Choose from the list of runtimes and deployment servers, or use the default settings. -LABEL_RUNTIMES_LIST=Web service runtime: -LABEL_SERVERS_LIST=Server: -LABEL_EDIT_BUTTON=Edit... -LABEL_SERVICE_EAR_MODULE=Service EAR module: -LABEL_CLIENT_EAR_MODULE=Client EAR module: -LABEL_CLIENT_MODULE=Client module: -LABEL_SERVICE_MODULE=Service module: -LABEL_CLIENT_PROJECT=Client project: -LABEL_SERVICE_PROJECT=Service project: -LABEL_CLIENT_EAR_PROJECT=Client EAR project: -LABEL_SERVICE_EAR_PROJECT=Service EAR project: - -# -# Client component type labels -# -LABEL_CLIENT_COMP_TYPE_WEB=Web -LABEL_CLIENT_COMP_TYPE_EJB=EJB -LABEL_CLIENT_COMP_TYPE_APP_CLIENT=Application Client -LABEL_CLIENT_COMP_TYPE_CONTAINERLESS=Java - - -TOOLTIP_PWRS_TEXT_RUNTIME=The runtime to be used. -TOOLTIP_PWRS_TEXT_SERVER=The server to be used. -TOOLTIP_PWRS_J2EE_VERSION=J2EE version to be used. - -LABEL_SELECTION_VIEW_TITLE=Server-Side Deployment Selection: -LABEL_SELECTION_VIEW_RUNTIME=Choose Web service runtime first -LABEL_SELECTION_VIEW_SERVER=Choose server first -LABEL_SELECTION_VIEW_EXPLORE=Explore options - -LABEL_TREE_EXISTING_SERVERS=Existing Servers -LABEL_TREE_SERVER_TYPES=Server Types - -MSG_INVALID_SRT_SELECTIONS=This server and runtime combination is not supported. Choose a different server or runtime to proceed through the Web services wizard. -MSG_NO_RUNTIME=No runtime specified for the {0} scenario. -MSG_NO_SERVER=No server specified for the {0} scenario. -MSG_ERROR_STUB_ONLY={0} has only stub runtimes associated with it. Choose a different server or configure a non-stub runtime in the server preferences. - -MSG_SERVER_TARGET_MISMATCH=The project, {0}, has a server target which is not compatible with the selected server type -MSG_J2EE_MISMATCH=The project, {0}, has a different J2EE level from the selected J2EE level -MSG_SERVICE_PROJECT_EMPTY=The service project {0} cannot be empty. Select a service project {0}. -MSG_SERVICE_EAR_EMPTY=The service EAR {0} cannot be empty. Select a service EAR {0}. -MSG_CLIENT_PROJECT_EMPTY=The client project {0} cannot be empty. Select a client project {0}. -MSG_CLIENT_EAR_EMPTY=The client EAR {0} cannot be empty. Select a client EAR {0}. -MSG_INVALID_EJB_PROJECT={0} is not an EJB project. Choose an EJB project, or enter a new EJB project name. -MSG_INVALID_WEB_PROJECT={0} is not a Web project. Choose a Web project, or enter a new Web project name. -MSG_INVALID_PROJECT_TYPE={0} is not a {1} project. Choose a {1} project, or enter a new project name. -MSG_MODULE=module -MSG_MODULE_NAME_AND_PROJECT_NAME_NOT_THE_SAME=The flexible project preference is off. Therefore, project names and module names must be the same for new modules. - -MSG_SAME_CLIENT_AND_SERVICE_EARS=Your selected service and client {0} modules have the same name. Proceeding with this configuration may result in runtime errors. -MSG_SAME_CLIENT_AND_SERVICE_COMPONENTS=Your selected service and client {0} modules have the same name. Proceeding with this configuration will result in runtime errors. -MSG_SAME_CLIENT_AND_SERVICE_PROJECTS=Your selected service and client projects are the same. Proceeding with this configuration will result in errors. -MSG_WRONG_CLIENT_PROJECT_TYPE=The selected client project, {0}, is not a {1} project. Please select a {1} project or enter a new project name. -MSG_CLIENT_SUB=client -MSG_SERVICE_SUB=service -MSG_GENERAL_PROJECT_AND_EAR=Select the {0} project and the EAR project with which you want it to be associated. -MSG_EAR_PROJECT_WILL_BE_CREATED=If an EAR or project does not exist or is currently unassociated, it will be created and \nassociated as required when you click Next. - -MSG_EAR_WILL_BE_ASSOCIATED=The selected {0} project will be associated with the EAR project. -MSG_PROJECT_WILL_BE_CREATED=The {0} project will be created and associated with the EAR project. -MSG_EAR_WILL_BE_CREATED=The {0} EAR project will be created and associated with the project. -MSG_PROJECT_AND_EAR_CREATED=The {0} project and EAR project will be created and associated with one another. - -# WebServiceClientRuntimeSelectionPage -PAGE_TITLE_WS_CLIENT_RUNTIME_SELECTION=Client Environment Configuration -PAGE_DESC_WS_CLIENT_RUNTIME_SELECTION=Choose from the list of supported runtimes and servers for the client environment, or use the default settings. - -LABEL_CLIENT_SELECTION_VIEW_TITLE=Client-Side Environment Selection: -LABEL_CLIENT_TYPE=Client type: -LABEL_WEB=Web -LABEL_EJB=EJB -LABEL_NO_LABEL= - -# -# Items common to WebServiceMappingsPage, WebServiceMappingsPage (client), and WebServiceSOAPBindingPage -# -PAGE_MSG_VALIDATION_INTERNAL_ERROR=An internal error occurred during page validation. See logs for details. - -# -# WebServiceMappingsPage -# -PAGE_TITLE_WS_XML2BEAN=Web Service Skeleton XML to Java Mappings -PAGE_DESC_N2P_MAPPINGS=Define custom mapping for namespace to package. -MSG_MAPPING_DUPLICATE_ENTRIES=Duplicate {0} mapped to the same {1}. - - -# -# The two ITEM_* strings are entries in a list box of mappings. -# There are two forms, one when the page is in Java-to-XML mode: -# <java-bean-name>, <encoding-style> -# and one when the page is in XML-to-Java mode: -# <xml-namespace-uri>:<xml-short-name>, <encoding-style> -# where: -# <java-bean-name> is a fully-qualified Java class name -# <xml-namespace-uri> is the namespace of an XML type -# <xml-short-name> is the XML type name within the namespace -# <encoding-style> is the encoding style (SOAP or Literal XML) -# - -# -# WebServiceProxyPage -# -BUTTON_GENERATE_PROXY=Generate a proxy - -# -# WebServiceSkeletonConfigPage -# -PAGE_DESC_WSSKEL_CONFIG=Define a skeleton Java bean as a Web service. -PAGE_TITLE_WSSKEL_CONFIG=Web Service Skeleton Java Bean Configuration -TOOLTIP_PBSC_TEXT_SKELETON_FOLDER=Folder for generated Java skeleton. -TOOLTIP_PBSC_BUTTON_SKELETON_FOLDER_BROWSE=Browse folders. -LABEL_SKELETON_ROOT_NAME=Skeleton folder: - -# -# WebServiceBeanClassPage -# -LABEL_BEAN_CLASS_NAME=Bean: -PAGE_MSG_BEAN_CANNOT_BE_EMPTY=Please select a Java bean class. -BUTTON_BROWSE_CLASSES=Browse classes... - - -# -# WebServiceTestPage -# -PAGE_TITLE_WSTEST=Web Service Test Page -PAGE_DESC_WSTEST=Select a test facility -LABEL_TEST_TYPES=Test Facility -CHECKBOX_TEST_WEBSERVICE=Test the Web service -CHECKBOX_MONITOR_WEBSERVICE=Monitor the Web service -MSG_ERROR_UNABLE_TO_LAUNCH_WSDL_TEST=An error occurred. Unable to launch WSDL test facility. - -# -# WebServiceExplorerPage -# -BUTTON_LAUNCH_SERVICE_TEST=Launch - -# -# WebServiceClientTestPage -# -PAGE_TITLE_WS_SAMPLE=Web Service Client Test -PAGE_DESC_WS_SAMPLE=Do you want to test the generated proxy? -BUTTON_TEST=Test the generated proxy -LABEL_TEST_TYPES=Test facility -BUTTON_RUN_TEST=Run test on server -LABEL_METHODS=Methods -MSG_ERROR_JTS_JSP_GEN=IWAB0313E Error encountered while generating the sample. -LABEL_JSP_PROJECT_NAME=JSP project: -MSG_ERROR_JTS_PROXY_NOT_COMPILED=IWAB0357E The Generated proxy was not found. WebService sample jsps cannot be generated. -MSG_ERROR_MALFORMED_URL=IWAB0358E Test client URL is malformed. - -# -# WebServiceISDPage -# - -# -# WebServiceBeanConfigPage -# - -# -# WebServiceBeanMethodsPage -# -BUTTON_SELECT_ALL=Select All -BUTTON_DESELECT_ALL=Deselect All -TOOLTIP_PBME_BUTTON_SELECT_ALL=Select all methods -TOOLTIP_PBME_BUTTON_DESELECT_ALL=Deselect all methods - -# -# WebServiceEJBConfigPage -# - -# -# WebServiceWSDLSelectionPage -# -PAGE_TITLE_WSDL_SELECTION=Web Service WSDL File Selection -PAGE_DESC_WSDL_SELECTION=Select a WSDL file. - - -# -# WebServicePublishPage -# -PAGE_TITLE_WS_PUBLISH=Web Service Publication -PAGE_DESC_WS_PUBLISH=Do you want to publish your Web service? -PAGE_TITLE_WS_FIND=Find a Web service -PAGE_DESC_WS_FIND=Do you want to find a Web service? -BUTTON_WS_PUBLISH=Launch the Web Services Explorer to publish this Web service to a UDDI Registry -BUTTON_WS_PUBLISH_PRIVATE_UDDI=Launch the Web Services Explorer to publish this Web service to the Unit Test UDDI Registry -BUTTON_WS_FIND=Launch the Web Services Explorer to find a Web service from a UDDI Registry -BUTTON_WS_FIND_PRIVATE_UDDI=Launch the Web Services Explorer to find a Web service from the Unit Test UDDI Registry -LABEL_PUBLIC_UDDI_REGISTRIES=Public UDDI Registry - -# -# EJB UI strings -# -LABEL_EJB_BEAN_NAME=EJB bean -TABLE_TITLE_EJB_BEAN_NAMES=Stateless EJB beans -TABLE_TITLE_EJB_PROJECT_NAME=EJB project -LABEL_EAR_PROJECTS=EAR projects -TOOLTIP_EAR_PROJECTS=Enterprise application projects. -TOOLTIP_TABLE_BEAN_NAMES=Select an EJB. - -# -# Tooltips for WebServiceWSDLSelectionPage -# -TOOLTIP_PWWS_PAGE= - -# -# Tooltips for beans.WebServiceBeanClassPage -# -TOOLTIP_PBCL_PAGE= -TOOLTIP_PBCL_TEXT_BEAN_CLASS=Selected Java bean. -TOOLTIP_PBCL_BUTTON_BEAN_CLASS_BROWSE=Browse classes. -TOOLTIP_PBCL_BUTTON_BEAN_RESOURCE_BROWSE=Browse Java files. - - -# -# Tooltips for beans.WebServiceTestPage -# -TOOLTIP_PSTP_COMBOBOX_TEST=Test facilities available to test the service. -TOOLTIP_PSTP_LAUNCH_BUTTON=Launch the selected test facility. - - - - -# -# Tooltips for WebServiceRuntimeSelectionPage -# -TOOLTIP_PWRS_PAGE= -TOOLTIP_PWRS_LIST_RUNTIMES=Select from the following deployment runtime(s). -TOOLTIP_PWRS_LIST_SERVERS=Select from application server(s). -TOOLTIP_PWRS_RADIO_SERVER=Server oriented selection. -TOOLTIP_PWRS_RADIO_RUNTIME=Runtime oriented selection. -TOOLTIP_PWRS_RADIO_EXPLORE=Explore combinations. -TOOLTIP_PWRS_COMBO_PROJECT=Web project. - -# -# Tooltips for WebServiceClientRuntimeSelectionPage -# -TOOLTIP_PWCR_COMBO_CLIENT_TYPE=Client type. - - -# -# Tooltips for WebServiceProjectPage -# -TOOLTIP_PWPR_COMBO_TYPE=Web service implementation type. -TOOLTIP_PWPR_GROUP_SCENARIO_SERVICE=Service defaults for this wizard scenario. -TOOLTIP_PWPR_CHECKBOX_GENERATE_PROXY=Enable/disable proxy generation for this scenario. -TOOLTIP_PWPR_CHECKBOX_START_WEB_PROJECT=Start Web service in Web project for this scenario. -TOOLTIP_PWPR_CHECKBOX_LAUNCH_WS=Launch the Web Services Explorer to publish the Web service in this scenario to a UDDI Registry. -TOOLTIP_PWPR_CHECKBOX_TEST_SERVICE=Select this to explore the Web service created. -TOOLTIP_PWPR_CHECKBOX_MONITOR_SERVICE=Select this to monitor the SOAP traffics of this Web service. -TOOLTIP_PWPR_GROUP_SCENARIO_CLIENT=Client proxy defaults for this wizard scenario. -TOOLTIP_PWPR_COMBO_CLIENTTYPE=Client proxy selection type. - -# -# Tooltips for WebServicePublishPage -# -TOOLTIP_PWPB_PAGE= -TOOLTIP_PWPB_CHECKBOX_WS_LAUNCH=Publish the Web service. - - -# -# WSIL proxy -# - -PAGE_WSIL_IMPORT=WSIL Import Page -TITLE_WSIL_IMPORT=WSIL Import -DESC_WSIL_IMPORT=Import WSDL references to a WSIL document -PAGE_TITLE_WS_SELECTION=Web Service Selection Page -PAGE_DESC_WS_SELECTION=Enter a web service URI. - -PAGE_MSG_LOADING_WEB_SERVICE_URI=Loading Web service URI... -PAGE_MSG_INVALID_WEB_SERVICE_URI=Invalid Web service URI. Enter an URI to a WSDL, WSIL or HTML document. -PAGE_MSG_NO_SUCH_FILE=File "{0}" does not exists. -PAGE_MSG_SELECTION_MUST_BE_WSDL=Selection must be WSDL. -PAGE_MSG_INVALID_WSIL_FILE_NAME=Invalid WSIL file name. WSIL file name must end with .wsil - - - -MSG_ERROR_URI_NOT_RESOLVABLE=IWAB0469E "{0}" is not resolvable. -MSG_ERROR_WSDL_HAS_NO_SERVICE_ELEMENT=IWAB0551E WSDL file at {0} has no service element. - -LABEL_WSIL_URI=WSIL URI: -LABEL_BROWSE=Browse -LABEL_WSDL=WSDL: -LABEL_WSDL_URI=WSDL URI -LABEL_IMPORT=Import... -LABEL_ADD=Add -LABEL_REMOVE=Remove -LABEL_WS_SELECTION=Enter an URI to a WSDL, WSIL or HTML document: -LABEL_SELECT_WSDL=Select a WSDL -LABEL_VALIDATE_MESSAGES=WSDL validation messages: - - -TOOLTIP_WSIL_IMPORT_PAGE=This page allows you to add WSDL references to a WSIL document. -TOOLTIP_WSIL_TEXT_WSIL=Enter the location of a new or existing WSIL document. -TOOLTIP_WSIL_BUTTON_BROWSE_WSIL=Browse for a WSIL document. -TOOLTIP_WSIL_TABLE_WSDL=Enter the URIs of the WSDLs that are going to be added as service references. -TOOLTIP_PCON_PAGE=Select a web service for consumption. -TOOLTIP_PCON_TEXT_WS=Enter an URI to a WSDL, WSIL or HTML document. -TOOLTIP_PCON_BUTTON_BROWSE_WS=Browse for a web service resource. -TOOLTIP_VALIDATE_TEXT_MESSAGE=Messages from WSDL validation. -TOOLTIP_TABLE_VALIDATE_MESSAGE=Use the Web Service Profile Validation preference to enable or disable WSDL validation. - -# -# Tooltips for client.WebServiceClienTestPage -# -TOOLTIP_PWSM_PAGE= -TOOLTIP_PWSM_CHECKBOX_TEST=Enable/disable Test. -TOOLTIP_PWSM_COMBOBOX_TEST=Select the test type. -TOOLTIP_PWSM_CHECKBOX_LAUNCH=Run test on a server. -TOOLTIP_PWSM_TEXT_JSP_FOLDER=Destination folder of generated sample files. -TOOLTIP_PWSM_BUTTON_JSP_FOLDER_BROWSE=Browse folders. -TOOLTIP_PWSM_BUTTON_SELECT_ALL=Select all methods. -TOOLTIP_PWSM_BUTTON_DESELECT_ALL=Deselect all methods. -TOOLTIP_PWSM_COMBO_PROJECT=Web project for generated sample. -TOOLTIP_PWSM_TEXT_SAMPLE_FOLDER=Destination folder of generated sample files. -TOOLTIP_PWSM_TREE_METHODS=Methods to generate into the sample. -TOOLTIP_PWSM_EAR_PROJECT=EAR project for the generated sample. - -# -# HTTP Basic Auth -# -DIALOG_TITLE_HTTP_BASIC_AUTH=HTTP Basic Authentication -LABEL_URL=URL: -LABEL_HTTP_BASIC_AUTH_USERNAME=User name: -LABEL_HTTP_BASIC_AUTH_PASSWORD=Password: - -TOOLTIP_HTTP_BASIC_AUTH_USERNAME=Enter your HTTP basic authentication user name. -TOOLTIP_HTTP_BASIC_AUTH_PASSWORD=Enter your HTTP basic authentication password. - -# -# Web Service Server Runtime Type -# - - -# -# Client project type -# - -# -# Generate Handler Skeleton -# -TASK_LABEL_GEN_HANDLER_SKELETON=Generate handler skeleton command -TASK_DESC_GEN_HANDLER_SKELETON=Generate handler skeleton command -MSG_ERROR_GENERATE_HANDLER_SKELETON=IWAB0359E Error in generating handler skeleton. -MSG_ERROR_WRITE_FILE=IWAB0360E Error in writing file {0}. - -# -# Handlers Configuration wizard page -# -LABEL_HANDLERS_CONFIG=Handler Configuration -LABEL_BUTTON_ADD=Add -LABEL_BUTTON_REMOVE=Remove -LABEL_BUTTON_MOVE_UP=Move Up -LABEL_BUTTON_MOVE_DOWN=Move Down -LABEL_BUTTON_GEN_SKELETON=Generate skeleton classes for new handlers -LABEL_COMBO_SOURCE_LOC=Output folder: -LABEL_COMBO_WS_CLIENT_REF=Client Service Reference: -LABEL_COMBO_WS_SERVICE_DESC=Service Description: - -LABEL_HANDLER_NAME=Name -LABLE_HANDLER_CLASS=Class Name -LABEL_HANDLER_PORT=Port Name - -DIALOG_TITLE_WS_ADD_HANDLER=Add New Handler -LABEL_TEXT_HANDLER_NAME=Name: -LABEL_TEXT_HANDLER_CLASS=Class name: -LABEL_TEXT_HANDLER_PORT=Port name: - -PAGE_TITLE_SERVICE_HDLR_CONFIG=Service Handlers Configuration -PAGE_DESC_SERVICE_HDLR_CONFIG=Configure service-side handlers -PAGE_TITLE_CLIENT_HDLR_CONFIG=Client Handlers Configuration -PAGE_DESC_CLIENT_HDLR_CONFIG=Configure client-side handlers - -TOOLTIP_EDIT_WS_HANDLERS=Configure Web Service Handlers -TOOLTIP_BUTTON_GEN_SKELETON=Select to generate skeleton classes for new handlers. -TOOLTIP_COMBO_SOURCE_LOC=Select the output location for file generation. -TOOLTIP_TEXT_HANDLER_NAME=Handler name -TOOLTIP_TEXT_HANDLER_CLASS=Handler class name -TOOLTIP_TEXT_HANDLER_PORT=Handler port component name -TOOLTIP_WS_CLIENT_REF=Select a client service-reference to show its handlers. -TOOLTIP_WS_SERVICE_DESC=Select a service description to show its handlers. - -# -# OpenJavaEditorCommand -# -MSG_ERROR_UNABLE_TO_OPEN_JAVA_EDITOR=IWAB0029E Unable to open class {0} from project {1} in the Java editor. - -# -# CheckIfServiceProject -# -MSG_WARN_IS_SERVICE_PROJECT=The selected client project, {0}, contains the Web service. Proceeding with this configuration may result in runtime errors when invoking the Web service. Would you like to proceed? -MSG_USER_ABORTED=User pressed cancel in warning dialog which warned about the selected client project being the service project. - - -# -# Missing third party file error message -# -MSG_MISSING_THIRD_PARTY_FILES=Missing third party files. Refer to http://www.eclipse.org/webtools/wst/components/ws/download_instructions_for_jars.html - -# -# WSDLSelectionOutputCommand -# -MSG_WARNING_NO_SERVICE_ELEMENT=The WSDL file does not contain a Service element. Therefore a service interface and Java proxy will not be generated and as a result, a Java test client will not be launched. Click OK to proceed, or click Cancel to select another WSDL file. Alternately, exit the wizard and use the WSDL editor to create a Service WSDL document. - -# -# CheckWSDLValidationCommand -# -STILL_VALIDATING_WSDL=Still performing WSDL validation. \nClick Ignore to ignore WSDL validation and continue. \nClick IgnoreAll to always ignore WSDL validation and continue. \nClick Cancel to wait for WSDL validation to complete. -IGNORE_LABEL=Ignore -IGNORE_DESCRIPTION=Ignore the WSDL validation and continue -IGNORE_ALL_LABEL=Ignore All -IGNORE_ALL_DESCRIPTION=Always ignore WSDL validation and continue -CANCEL_LABEL=Cancel -TASK_LABEL_CHECK_WSDL_VALIDATION=Check for WSDL validation -TASK_DESC_CHECK_WSDL_VALIDATION=Check if WSDL validation has completed -CANCEL_DESCRIPTION=Cancel -WAIT_FOR_WSDL=Do not continue with wizard. Wait for WSDL validation to complete. - -# -# Start server page -# -PAGE_TITLE_WS_START_SERVER=Server startup page -PAGE_DESC_WS_START_SERVER=Start the server from this page. -LABEL_START_SERVER_TEXT1=In order to proceed the server "{0}" must be started. -LABEL_START_SERVER_TEXT2=Once the server is started the "next" button will be enabled. -LABEL_START_SERVER_TEXT3=The "back" button can be used while the server is starting to -LABEL_START_SERVER_TEXT4=change any previous settings in this wizard. -LABEL_START_SERVER_BUTTON=Start server -TOOLTIP_START_SERVER_BUTTON=Start the server -TEXT_SERVER_STATUS=Currently the server is {0}. -TEXT_SERVER_MSG=Server {0} -TEXT_SERVER_STARTED=started -TEXT_SERVER_STARTING=starting -TEXT_SERVER_STOPPED=stopped - - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/action/LaunchWSEAction.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/action/LaunchWSEAction.java deleted file mode 100644 index b34dc7e66..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/action/LaunchWSEAction.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.action; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.eclipse.wst.command.internal.env.ui.eclipse.EclipseEnvironment; -import org.eclipse.wst.command.internal.env.ui.eclipse.EclipseStatusHandler; -import org.eclipse.wst.command.internal.provisional.env.core.context.TransientResourceContext; -import org.eclipse.wst.ws.internal.explorer.LaunchOption; -import org.eclipse.wst.ws.internal.explorer.LaunchOptions; -import org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand; -import org.eclipse.wst.ws.internal.explorer.plugin.ExplorerPlugin; - - -public class LaunchWSEAction implements IWorkbenchWindowActionDelegate -{ - public void run(IAction action) - { - EclipseStatusHandler handler = new EclipseStatusHandler(); - TransientResourceContext context = new TransientResourceContext(); - EclipseEnvironment environment = new EclipseEnvironment( null, context, handler ); - WSExplorerLauncherCommand cmd = new WSExplorerLauncherCommand(); - - String stateLocation = ExplorerPlugin.getInstance().getPluginStateLocation(); - String defaultFavoritesLocation = ExplorerPlugin.getInstance().getDefaultFavoritesLocation(); - LaunchOption[] launchOptions = new LaunchOption[] { - new LaunchOption(LaunchOptions.STATE_LOCATION,stateLocation), - new LaunchOption(LaunchOptions.DEFAULT_FAVORITES_LOCATION,defaultFavoritesLocation) - }; - cmd.setLaunchOptions(launchOptions); - cmd.setEnvironment( environment ); - cmd.execute( null, null ); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() - */ - public void dispose() { } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) - */ - public void init(IWorkbenchWindow window) { } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java deleted file mode 100644 index 6508f699c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -/** - * This command checks to see if the selected client project is the - * service project. If so, the user is warned. - */ -public class CheckForServiceProjectCommand extends AbstractDataModelOperation -{ - MessageUtils msgUtils; - SelectionListChoices runtime2ClientTypes; - String wsdlURI; - WebServicesParser webServicesParser; - - public CheckForServiceProjectCommand() - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils = new MessageUtils(pluginId + ".plugin", this); - } - - public void setRuntime2ClientTypes( SelectionListChoices runtime2ClientTypes ) - { - this.runtime2ClientTypes = runtime2ClientTypes; - } - - public void setWsdlURI(String wsdlURI) - { - this.wsdlURI = wsdlURI; - } - - public void setWebServicesParser(WebServicesParser webServicesParser) - { - this.webServicesParser = webServicesParser; - } - - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.Command#execute(org.eclipse.wst.command.internal.provisional.env.core.common.Environment) - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment environment = getEnvironment(); - IStatus status = Status.OK_STATUS; - if (runtime2ClientTypes==null || wsdlURI==null || wsdlURI.length()==0 || webServicesParser==null) - return status; - - String clientProjectName = runtime2ClientTypes.getChoice().getChoice().getList().getSelection(); - if (clientProjectName==null || clientProjectName.length()==0) - return status; - - IProject clientProject = ProjectUtilities.getProject(clientProjectName); - ValidationUtils vu = new ValidationUtils(); - boolean isServiceProject = vu.isProjectServiceProject(clientProject, wsdlURI, webServicesParser); - if (isServiceProject) - { - IStatus wStatus = StatusUtils.warningStatus( msgUtils.getMessage("MSG_WARN_IS_SERVICE_PROJECT", new String[]{clientProjectName}) ); - try - { - environment.getStatusHandler().report(wStatus); - } - catch (StatusException se) - { - //User decided to abort. Return an error status - IStatus eStatus = StatusUtils.errorStatus( msgUtils.getMessage("MSG_USER_ABORTED") ); - return eStatus; - } - } - - return status; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java deleted file mode 100644 index 75fe3a5c4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.common.EnvironmentUtils; - - - -public class GenerateHandlerSkeletonCommand extends AbstractDataModelOperation -{ - - private MessageUtils msgUtils_; - private IPath outputLocation_; - private String[] handlerNames_; - private boolean genSkeleton_; - private String handlerNameForEdit_ = null; - - public GenerateHandlerSkeletonCommand() - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); - } - - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - MultiStatus status = null; - IStatus returnStatus = Status.OK_STATUS; - - if (!genSkeleton_) return returnStatus; - - int i; - boolean error = false; - - IStatus writeStatus; - - - for (i=0; i<handlerNames_.length; i++) - { - writeStatus = writeFile(env, handlerNames_[i], outputLocation_, monitor ); - // handle status return - if (writeStatus.getSeverity() == Status.ERROR) - { // write status is OK or ERROR - error = true; - if (status == null) - { - status = StatusUtils.multiStatus( msgUtils_.getMessage("MSG_ERROR_GENERATE_HANDLER_SKELETON"), new IStatus[0] ); - } - status.add(writeStatus); - } - } - - if (error) - { - env.getStatusHandler().reportError(status); - returnStatus = status; - } - - return returnStatus; - } - - private IStatus writeFile (Environment env, String className, IPath outputLocation, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - int index; - - String simpleClassName = className; - String packageName = null; - IPath filePath = outputLocation; - if (className != null) { - index = className.lastIndexOf('.'); - if (index != -1) { - simpleClassName = className.substring(index + 1); - packageName = className.substring(0, index); - - String packageSegment = packageName; - int j = 0; - j = packageSegment.indexOf('.'); - while (j != -1) { - filePath = filePath.append(packageSegment.substring(0, j)); - packageSegment = packageSegment.substring(j + 1); - j = packageSegment.indexOf('.'); - } - filePath = filePath.append(packageSegment); - } - else { - packageName = ""; - } - } - - filePath = filePath.append(simpleClassName); - - filePath = filePath.addFileExtension("java"); - - // check if Handler already exists; do not overwrite existing Handlers - IResource workspaceRes = ResourceUtils.findResource(filePath); - if (workspaceRes!=null && workspaceRes.exists()) { - return status; - } - - if (handlerNameForEdit_ == null){ - handlerNameForEdit_ = className; - } - - OutputStream outputStream = FileResourceUtils.newFileOutputStream( EnvironmentUtils.getResourceContext(env), filePath, monitor, env.getStatusHandler()); - // create buffered writer for writing file - BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(outputStream)); - try { - if (packageName.length() != 0) { - bw.write("package " +packageName+";"); - bw.newLine(); - bw.newLine(); - } - bw.write("import javax.xml.rpc.handler.GenericHandler;"); - bw.newLine(); - bw.write("import javax.xml.rpc.handler.MessageContext;"); - bw.newLine(); - bw.write("import javax.xml.namespace.QName;"); - bw.newLine(); - bw.newLine(); - - bw.write("public class "+simpleClassName+" extends GenericHandler"); - bw.newLine(); - bw.write("{"); - bw.newLine(); - bw.newLine(); - - bw.write(" public QName[] getHeaders ()"); - bw.newLine(); - bw.write(" {"); - bw.newLine(); - bw.write(" // Fill in method body"); - bw.newLine(); - bw.write(" return null;"); - bw.newLine(); - bw.write(" }"); - bw.newLine(); - bw.newLine(); - bw.write(" public boolean handleRequest( MessageContext context )"); - bw.newLine(); - bw.write(" {"); - bw.newLine(); - bw.write(" // Fill in method body or delete method to use GenericHandler"); - bw.newLine(); - bw.write(" return true;"); - bw.newLine(); - bw.write(" }"); - bw.newLine(); - bw.newLine(); - bw.write(" public boolean handleResponse( MessageContext context )"); - bw.newLine(); - bw.write(" {"); - bw.newLine(); - bw.write(" // Fill in method body or delete method to use GenericHandler "); - bw.newLine(); - bw.write(" return true;"); - bw.newLine(); - bw.write(" }"); - bw.newLine(); - bw.newLine(); - bw.write(" public boolean handleFault( MessageContext context )"); - bw.newLine(); - bw.write(" {"); - bw.newLine(); - bw.write(" // Fill in method body or delete method to use GenericHandler"); - bw.newLine(); - bw.write(" return true;"); - bw.newLine(); - bw.write(" }"); - bw.newLine(); - - bw.newLine(); - bw.write("}"); - bw.close(); - status = Status.OK_STATUS; - } - catch (IOException e) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_WRITE_FILE", new String[]{ className }), e ); - if (bw != null) { - try { - bw.close(); - } catch (IOException e1) { - } - } - } - return status; - } - - public void setOutputLocation(IPath outputLocation) - { - this.outputLocation_ = outputLocation; - } - - public void setHandlerNames (String[] handlerNames) - { - this.handlerNames_ = handlerNames; - } - - public void setGenSkeletonEnabled(boolean genSkeleton) - { - this.genSkeleton_ = genSkeleton; - } - - public IProject getProject(){ - IProject project = null; - if (outputLocation_!=null){ - project = ResourceUtils.getProjectOf(outputLocation_); - } - return project; - } - - public List getClassNames(){ - List classes = new ArrayList(); - if (handlerNameForEdit_!=null){ - classes.add(handlerNameForEdit_); - } - return classes; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java deleted file mode 100644 index c809e7a4e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.ui.progress.UIJob; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; - - -public class OpenJavaEditorCommand extends AbstractDataModelOperation -{ - private List classNames; - private IProject project; - - public OpenJavaEditorCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - OpenJavaEditorJob job = new OpenJavaEditorJob(classNames, project); - job.setPriority(Job.LONG); - job.schedule(); - return Status.OK_STATUS; - } - - public void setClassNames(List classNames) - { - this.classNames = classNames; - } - - public void setProject(IProject project) - { - this.project = project; - } - - private class OpenJavaEditorJob extends UIJob - { - private List classNames; - private IProject project; - - public OpenJavaEditorJob(List classNames, IProject project) - { - super("org.eclipse.jst.ws.internal.consumption.ui.command.OpenJavaEditorJob"); - this.classNames = classNames; - this.project = project; - } - - public IStatus runInUIThread(IProgressMonitor monitor) - { - if (project != null && classNames != null) - { - IJavaProject javaProject = JavaCore.create(project); - for (Iterator it = classNames.iterator(); it.hasNext();) - { - String className = (String)it.next(); - try - { - IType type = javaProject.findType(className); - JavaUI.openInEditor(type); - } - catch (Throwable t) - { - return new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.Status.ERROR, WebServiceConsumptionUIPlugin.ID, 0, WebServiceConsumptionUIPlugin.getMessage("MSG_ERROR_UNABLE_TO_OPEN_JAVA_EDITOR", new String[]{className, project.getName()}), t); - } - } - return new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.Status.OK, WebServiceConsumptionUIPlugin.ID, 0, "", null); - } - else - return new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.Status.ERROR, WebServiceConsumptionUIPlugin.ID, 0, WebServiceConsumptionUIPlugin.getMessage("MSG_ERROR_UNABLE_TO_OPEN_JAVA_EDITOR", new String[]{classNames != null ? classNames.toString() : "", project != null ? project.getName() : ""}), null); - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java deleted file mode 100644 index 0ddde2b30..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import java.util.Vector; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.ui.plugin.WSUIPlugin; -import org.eclipse.wst.ws.internal.ui.wsi.preferences.PersistentWSIAPContext; -import org.eclipse.wst.ws.internal.ui.wsi.preferences.PersistentWSISSBPContext; -import org.eclipse.wst.ws.internal.ui.wsi.preferences.WSIComplianceUtils; - - - -public class WSINonCompliantRuntimeCommand extends AbstractDataModelOperation -{ - - private IProject serviceProject_; - private MessageUtils msgUtils_; - - public WSINonCompliantRuntimeCommand() - { - String pluginId = "org.eclipse.wst.ws.ui"; - msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); - } - - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment environment = getEnvironment(); - - PersistentWSISSBPContext wsiSSBPContext = WSUIPlugin.getInstance().getWSISSBPContext(); - PersistentWSIAPContext wsiAPContext = WSUIPlugin.getInstance().getWSIAPContext(); - Vector statusSSBP = new Vector(); - statusSSBP.add( new Status( WSIComplianceUtils.getWSISeverity(serviceProject_, wsiSSBPContext), "id", 0, - msgUtils_.getMessage("WSI_SSBP_INCOMPLIANT_RUNTIME"), null ) ); - Status[] statusesSSBP = (Status[]) statusSSBP.toArray(new Status[statusSSBP.size()]); - - Vector statusAP = new Vector(); - statusAP.add( new Status( WSIComplianceUtils.getWSISeverity(serviceProject_, wsiAPContext), "id", 0, - msgUtils_.getMessage("WSI_AP_INCOMPLIANT_RUNTIME"), null )); - Status[] statusesAP = (Status[]) statusAP.toArray(new Status[statusAP.size()]); - - if (WSIComplianceUtils.checkWSICompliance (environment.getStatusHandler(), statusesSSBP, serviceProject_, wsiSSBPContext)) - { - if (WSIComplianceUtils.checkWSICompliance (environment.getStatusHandler(), statusesAP, serviceProject_, wsiAPContext)) - { - return Status.OK_STATUS; - } - else - { - return StatusUtils.errorStatus( msgUtils_.getMessage("NOT_OK") ); - } - } - else - { - return StatusUtils.errorStatus( msgUtils_.getMessage("NOT_OK") ); - } - } - - public void setServiceProject(IProject serviceProject) { - this.serviceProject_ = serviceProject; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/EclipseIPath2URLStringTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/EclipseIPath2URLStringTransformer.java deleted file mode 100644 index 8f8400b6e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/EclipseIPath2URLStringTransformer.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command.data; - -import java.net.MalformedURLException; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; - - -public class EclipseIPath2URLStringTransformer implements Transformer -{ - public Object transform(Object value) - { - String s = value.toString(); - if (s.indexOf(":") < 0) - { - IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(value.toString()); - if (res.exists()) - { - try - { - s = res.getLocation().toFile().toURL().toString(); - } - catch (MalformedURLException murle) - { - } - } - } - return s; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ProjectName2IProjectTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ProjectName2IProjectTransformer.java deleted file mode 100644 index 0f772542b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ProjectName2IProjectTransformer.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command.data; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; - -public class ProjectName2IProjectTransformer implements Transformer -{ - public Object transform(Object value) - { - String project = (String)value; - int slashIndex = project.indexOf( '/' ); - String projectName = project; - - if( slashIndex != -1 ) - { - projectName = project.substring( 0, slashIndex ); - } - - return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerInstToIServerTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerInstToIServerTransformer.java deleted file mode 100644 index c96075d21..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerInstToIServerTransformer.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on Apr 20, 2004 - */ -package org.eclipse.jst.ws.internal.consumption.ui.command.data; - -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - -/* - * Transforms a server instance id to an IServer - */ -public class ServerInstToIServerTransformer implements Transformer { - - /* (non-Javadoc) - * @see org.eclipse.wst.command.internal.provisional.env.core.data.Transformer#transform(java.lang.Object) - */ - public Object transform(Object value) { - - String existingServerInstId = (String)value; - IServer serverInst = null; - if (existingServerInstId != null) { - serverInst = ServerCore.findServer(existingServerInstId); - } - return serverInst; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerName2IServerTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerName2IServerTransformer.java deleted file mode 100644 index 0e228a0c8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerName2IServerTransformer.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command.data; - -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - -public class ServerName2IServerTransformer implements Transformer -{ - public Object transform(Object value) - { - { - String serverName = value.toString(); - IServer[] servers = ServerCore.getServers(); - if (servers != null && servers.length!=0) - { - for (int i = 0; i < servers.length; i++) - { - IServer server = (IServer)servers[i]; - if ((server.getName()).equals(serverName)) - return server; - } - } - } - return null; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/FinishFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/FinishFragment.java deleted file mode 100644 index a603ed932..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/FinishFragment.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.common; - -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; - - -/** - * @author gilberta - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class FinishFragment extends SequenceFragment -{ - public FinishFragment() - { - add(new FinishTestFragment() ); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java deleted file mode 100644 index ae8a5c96c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java +++ /dev/null @@ -1,570 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.common; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.j2ee.internal.servertarget.IServerTargetConstants; -import org.eclipse.jst.j2ee.internal.servertarget.ServerTargetHelper; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.common.IServerDefaulter; -import org.eclipse.jst.ws.internal.consumption.common.ServerInfo; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeInfo; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.ServerUtil; - - -public class ServerSelectionUtils -{ - /* - * Returns reasonable defaults for server factory id and instance id based on - * an existing project - * index [0] contains factoryId, index[1] contains instance Id. - * @deprecated - */ - public static String[] getServerInfoFromExistingProject(IProject project, String componentName, String runtimeId, boolean askExtenders) - { - String[] serverInfo = new String[2]; //serverInfp[0] contains factoryId, serverInfo[1] contains instance Id - - // If the project has been added to an existing server, pick that server - //IServer[] configuredServers = ServerUtil.getServersByModule(ResourceUtils.getModule(project), null); - IServer[] configuredServers = ServerUtil.getServersByModule(ServerUtils.getModule(project, componentName), null); - IServer firstSupportedServer = getFirstSupportedServer(configuredServers, runtimeId ); - if (firstSupportedServer != null) - { - serverInfo[0] = firstSupportedServer.getServerType().getId(); - serverInfo[1] = firstSupportedServer.getId(); - return serverInfo; - - } - - - //Does the project have a runtime-target? - IRuntime runtimeTarget = getRuntimeTarget(project.getName()); - if (runtimeTarget != null) - { - //Look for an existing server which is compatible with the runtime-target - IServer[] compatibleServers = getCompatibleExistingServers(runtimeTarget); - if (compatibleServers!=null && compatibleServers.length > 0) - { - IServer firstSupportedCompatServer = getFirstSupportedServer(compatibleServers, runtimeId); - if (firstSupportedCompatServer != null) - { - serverInfo[0] = firstSupportedCompatServer.getServerType().getId(); - serverInfo[1] = firstSupportedCompatServer.getId(); - return serverInfo; - - } - } - - //No existing compatible server was found. Choose a compatible server type. - - //If the preferred server is compatible with the project's runtime target, use it. - PersistentServerRuntimeContext ctx = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String pFactoryId = ctx.getServerFactoryId(); - IServerType serverType = ServerCore.findServerType(pFactoryId); - if (serverType!=null){ - String serverRuntimeId = serverType.getRuntimeType().getId(); - if (serverRuntimeId.equals(runtimeTarget.getRuntimeType().getId())) - { - serverInfo[0] = pFactoryId; - return serverInfo; - } - } - - //The preferred server was not compatible. Pick the first valid compatible server type. - String factoryId = getFirstSupportedServerType(runtimeTarget, runtimeId); - if (factoryId != null) serverInfo[0] = factoryId; - return serverInfo; - - } - - if (askExtenders) - { - ServerInfo recommendedServerInfo = getExtenderRecommendation(project); - if (recommendedServerInfo!=null) - { - if (recommendedServerInfo.getServerFactoryId()!=null && recommendedServerInfo.getServerFactoryId().length()>0) - serverInfo[0] = recommendedServerInfo.getServerFactoryId(); - - if (recommendedServerInfo.getServerInstanceId()!=null && recommendedServerInfo.getServerInstanceId().length()>0) - serverInfo[1] = recommendedServerInfo.getServerInstanceId(); - - return serverInfo; - } - - } - - //Use ServerTargetHelper to get a list of valid runtime-targets and use these to determine a default server type. - String[] projectAttrs = ServerTargetHelper.getProjectTypeAndJ2EELevel(project); - List runtimes = ServerTargetHelper.getServerTargets(projectAttrs[0], projectAttrs[1]); - String[] compatServerInfo = getCompatibleExistingServer(runtimes,runtimeId); - if ( compatServerInfo != null) - { - return compatServerInfo; - } - - //No existing compatible server, pick a type. - String factoryId = getFirstSupportedServerType(runtimes, runtimeId); - if (factoryId != null) serverInfo[0] = factoryId; - return serverInfo; - - } - - /* - * Returns reasonable defaults for server factory id and instance id based on - * an existing project - * index [0] contains factoryId, index[1] contains instance Id. - */ - /* - public static String[] getServerInfoFromExistingProject(IProject project, String runtimeId, boolean askExtenders) - { - String[] serverInfo = new String[2]; //serverInfp[0] contains factoryId, serverInfo[1] contains instance Id - - // If the project has been added to an existing server, pick that server - IServer[] configuredServers = ServerUtil.getServersByModule(ResourceUtils.getModule(project), null); - IServer firstSupportedServer = getFirstSupportedServer(configuredServers, runtimeId ); - if (firstSupportedServer != null) - { - serverInfo[0] = firstSupportedServer.getServerType().getId(); - serverInfo[1] = firstSupportedServer.getId(); - return serverInfo; - - } - - - //Does the project have a runtime-target? - IRuntime runtimeTarget = getRuntimeTarget(project.getName()); - if (runtimeTarget != null) - { - //Look for an existing server which is compatible with the runtime-target - IServer[] compatibleServers = getCompatibleExistingServers(runtimeTarget); - if (compatibleServers!=null && compatibleServers.length > 0) - { - IServer firstSupportedCompatServer = getFirstSupportedServer(compatibleServers, runtimeId); - if (firstSupportedCompatServer != null) - { - serverInfo[0] = firstSupportedCompatServer.getServerType().getId(); - serverInfo[1] = firstSupportedCompatServer.getId(); - return serverInfo; - - } - } - - //No existing compatible server was found. Choose a compatible server type. - - //If the preferred server is compatible with the project's runtime target, use it. - PersistentServerRuntimeContext ctx = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String pFactoryId = ctx.getServerFactoryId(); - IServerType serverType = ServerCore.findServerType(pFactoryId); - if (serverType!=null){ - String serverRuntimeId = serverType.getRuntimeType().getId(); - if (serverRuntimeId.equals(runtimeTarget.getRuntimeType().getId())) - { - serverInfo[0] = pFactoryId; - return serverInfo; - } - } - - //The preferred server was not compatible. Pick the first valid compatible server type. - String factoryId = getFirstSupportedServerType(runtimeTarget, typeId); - if (factoryId != null) serverInfo[0] = factoryId; - return serverInfo; - - } - - if (askExtenders) - { - ServerInfo recommendedServerInfo = getExtenderRecommendation(project); - if (recommendedServerInfo!=null) - { - if (recommendedServerInfo.getServerFactoryId()!=null && recommendedServerInfo.getServerFactoryId().length()>0) - serverInfo[0] = recommendedServerInfo.getServerFactoryId(); - - if (recommendedServerInfo.getServerInstanceId()!=null && recommendedServerInfo.getServerInstanceId().length()>0) - serverInfo[1] = recommendedServerInfo.getServerInstanceId(); - - return serverInfo; - } - - } - - //Use ServerTargetHelper to get a list of valid runtime-targets and use these to determine a default server type. - String[] projectAttrs = ServerTargetHelper.getProjectTypeAndJ2EELevel(project); - List runtimes = ServerTargetHelper.getServerTargets(projectAttrs[0], projectAttrs[1]); - List suppRuntimes = getRuntimeTargetsSupportedByWSRuntime(runtimes, runtimeId); - String[] compatServerInfo = getCompatibleExistingServer(suppRuntimes,typeId); - if ( compatServerInfo != null) - { - return compatServerInfo; - } - - //No existing compatible server, pick a type. - String factoryId = getFirstSupportedServerType(suppRuntimes, typeId); - if (factoryId != null) serverInfo[0] = factoryId; - return serverInfo; - - } - */ - - /* - * Given a list of existing servers, this returns the first one that is supported - * by the given Web service runtime id. - * Returns null of there are no supported servers in the array. - */ - public static IServer getFirstSupportedServer(IServer[] servers, String webServiceRuntimeId) - { - //WebServiceServerRuntimeTypeRegistry wssrtRegistry = WebServiceServerRuntimeTypeRegistry.getInstance(); - if (servers != null && servers.length > 0) { - for (int i = 0; i < servers.length; i++) - { - String serverFactoryId = servers[i].getServerType().getId(); - if (WebServiceRuntimeExtensionUtils.doesRuntimeSupportServer(webServiceRuntimeId, serverFactoryId)) - { - return servers[i]; - } - } - } - return null; - } - - - /* - * Returns the factory id of a server type compatible with the Web service type and the runtime target. - * Returns null if there are none. - */ - public static String getFirstSupportedServerType(IRuntime runtimeTarget, String webServiceRuntimeId) - { - String runtimeId = runtimeTarget.getRuntimeType().getId(); - WebServiceRuntimeInfo wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(webServiceRuntimeId); - String[] serverFactoryIds = wsrt.getServerFactoryIds(); - for (int i=0; i<serverFactoryIds.length; i++) - { - IServerType serverType = ServerCore.findServerType(serverFactoryIds[i]); - if (serverType!=null){ - String serverRuntimeId = serverType.getRuntimeType().getId(); - if (serverRuntimeId.equals(runtimeId)) - { - return serverFactoryIds[i]; - } - } - } - return null; - } - - - /* - * Return the factory id of the first server type compatible with the runtimeTargets and webServiceRuntimeId. - * Returns null if there are none. - */ - public static String getFirstSupportedServerType(List runtimeTargets, String webServiceRuntimeId) - { - for (int i=0; i<runtimeTargets.size(); i++ ) - { - IRuntime runtimeTarget = (IRuntime)runtimeTargets.get(i); - String factoryId = getFirstSupportedServerType(runtimeTarget, webServiceRuntimeId); - if (factoryId != null && factoryId.length()>0) - return factoryId; - } - - return null; - } - /* - * Return the factory id of the first server type compatible with the runtimeTargets and typeId. - * Returns null if there are none. - * @deprecated - */ - /* - public static String getFirstSupportedServerType(List runtimeTargets, String typeId) - { - for (int i=0; i<runtimeTargets.size(); i++ ) - { - IRuntime runtimeTarget = (IRuntime)runtimeTargets.get(i); - String factoryId = getFirstSupportedServerType(runtimeTarget, typeId); - if (factoryId != null && factoryId.length()>0) - return factoryId; - } - - return null; - } - */ - public static IRuntime getRuntimeTarget(String projectName) - { - if( projectName != null && projectName.length() > 0 ){ //$NON-NLS-1$ - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if( project != null && project.exists() ){ - return ServerCore.getProjectProperties(project).getRuntimeTarget(); - } - } - return null; - } - - public static IServer getFirstExistingServerFromFactoryId(String factoryId) - { - IServer[] servers = ServerCore.getServers(); - if (servers==null || servers.length!=0) - return null; - else - { - for (int i=0; i<servers.length; i++) - { - IServer server = (IServer)servers[i]; - if (server.getServerType().getId().equals(factoryId)) - { - return server; - } - } - } - return null; - } - - public static IServer[] getCompatibleExistingServers(IRuntime runtime) - { - if (runtime == null) - return null; - - IServer[] servers = ServerCore.getServers(); - if (servers==null || servers.length==0) - return null; - - ArrayList compatibleServersList = new ArrayList(); - String runtimeId = runtime.getRuntimeType().getId(); - for (int i=0; i<servers.length; i++) - { - IServer server = (IServer)servers[i]; - String serverRuntimeId = server.getRuntime().getRuntimeType().getId(); - if (serverRuntimeId.equals(runtimeId)) - compatibleServersList.add(server); - - } - if (compatibleServersList.size()<1) - return null; - - - Object[] compatibleServersArray = compatibleServersList.toArray(); - IServer[] compatibleServers = new IServer[compatibleServersArray.length]; - for (int j=0; j<compatibleServersArray.length; j++) - { - compatibleServers[j] = (IServer)compatibleServersArray[j]; - } - - return compatibleServers; - } - - - /* - * Returns the factory Id and instance id of the first exiting server compatible - * with the runtime targets and typeId - * Returns null if there are none. - * The item at [0] is the factory id. - * The item at [1] is the instance id. - * @deprecated - */ - public static String[] getCompatibleExistingServer(List runtimeTargets, String webServiceRuntimeId) - { - String[] serverInfo = new String[2]; - for (int i=0; i<runtimeTargets.size(); i++ ) - { - IRuntime runtimeTarget = (IRuntime)runtimeTargets.get(i); - IServer[] existingCompatServers = getCompatibleExistingServers(runtimeTarget); - IServer compatServer = getFirstSupportedServer(existingCompatServers, webServiceRuntimeId); - if (compatServer != null) - { - serverInfo[0] = compatServer.getServerType().getId(); - serverInfo[1] = compatServer.getId(); - return serverInfo; - } - } - return null; - } - - /* - * Returns the factory Id and instance id of the first exiting server compatible - * with the runtime targets and typeId - * Returns null if there are none. - * The item at [0] is the factory id. - * The item at [1] is the instance id. - * @deprecated - */ - /* - public static String[] getCompatibleExistingServer(List runtimeTargets, String typeId) - { - String[] serverInfo = new String[2]; - for (int i=0; i<runtimeTargets.size(); i++ ) - { - IRuntime runtimeTarget = (IRuntime)runtimeTargets.get(i); - IServer[] existingCompatServers = getCompatibleExistingServers(runtimeTarget); - IServer compatServer = getFirstSupportedServer(existingCompatServers, typeId); - if (compatServer != null) - { - serverInfo[0] = compatServer.getServerType().getId(); - serverInfo[1] = compatServer.getId(); - return serverInfo; - } - } - return null; - } - */ - - public static ServerInfo getExtenderRecommendation(IProject project) - { - try - { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] elements = reg.getConfigurationElementsFor("org.eclipse.jst.ws.consumption", "serverDefaulter"); - for (int i=0; i<elements.length; i++) - { - Object serverDefaulterObject = elements[i].createExecutableExtension("class"); - if (serverDefaulterObject instanceof IServerDefaulter) - { - IServerDefaulter serverDefaulter = (IServerDefaulter)serverDefaulterObject; - ServerInfo serverInfo = serverDefaulter.recommendDefaultServer(project); - if (serverInfo != null) - return serverInfo; - } - - } - } catch (CoreException ce) - { - return null; - } - - return null; - } - - /** - * Use this method to get a server factory id and instance id that is compatible with the given Web - * service runtime. - * @param webServiceRuntimeId - * @param j2eeVersion String representation of the int values in J2EEVersionConstants i.e. "12", "13", "14" - * @return String[] index [0] contains factoryId, index[1] contains instance Id. - */ - public static String[] getServerFromWebServceRuntimeAndJ2EE(String webServiceRuntimeId, String j2eeVersion) - { - String[] serverInfo = new String[2]; - - //Get all possible valid servers. If there are none, we can't default intelligently, return null. - - WebServiceRuntimeInfo wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(webServiceRuntimeId); - String[] validServerFactoryIds = wsrt.getServerFactoryIds(); - if (validServerFactoryIds==null || validServerFactoryIds.length<1) - return null; - - //Get all existing servers - IServer[] servers = ServerCore.getServers(); //Get all existing servers - - //Get the preferred server. - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String prefServerFactoryId = context.getServerFactoryId(); - - boolean preferredIsValid = containsString(validServerFactoryIds, prefServerFactoryId) - && isServerValid(prefServerFactoryId, j2eeVersion); - if (preferredIsValid) - { - for (int i=0; i<servers.length; i++) - { - IServer server = (IServer)servers[i]; - String thisFactoryId = server.getServerType().getId(); - - if (thisFactoryId.equals(prefServerFactoryId)) - { - serverInfo[0] = prefServerFactoryId; - serverInfo[1] = server.getId(); - return serverInfo; - } - } - } - - //Either the preferred server was not valid or it was valid but does not exist. - //Check the existing servers for validity - for (int i=0; i<servers.length; i++) - { - IServer server = (IServer)servers[i]; - String thisFactoryId = server.getServerType().getId(); - - boolean thisServerValid = containsString(validServerFactoryIds, thisFactoryId) - && isServerValid(thisFactoryId, j2eeVersion); - if (thisServerValid) - { - serverInfo[0] = thisFactoryId; - serverInfo[1] = server.getId(); - return serverInfo; - } - } - - //None of the existing servers is valid. Pick the preferred one if valid. Otherwise, pick the - //first valid server type. - if (preferredIsValid) - { - serverInfo[0] = prefServerFactoryId; - return serverInfo; - } - else - { - for (int i=0; i<validServerFactoryIds.length; i++ ) - { - boolean isValid = isServerValid(validServerFactoryIds[i], j2eeVersion); - if (isValid) - { - serverInfo[0] = validServerFactoryIds[i]; - return serverInfo; - } - } - } - - //We can't determine a valid server selection. Return null. - return null; - } - - private static boolean isServerValid(String serverFactoryId, String j2eeVersion) - { - if (serverFactoryId==null || serverFactoryId.length()==0 || j2eeVersion==null || j2eeVersion.length()==0) - return true; - - String runtimeTargetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverFactoryId); - if (runtimeTargetId == null || runtimeTargetId.length()==0) - return false; - String webModuleType = IServerTargetConstants.WEB_TYPE; - boolean isValid = ServerUtils.isTargetValidForProjectType(runtimeTargetId, j2eeVersion, webModuleType); - return isValid; - } - /* - * Returns true is a contains b, false otherwise. - */ - private static boolean containsString(String[] a, String b) - { - if (a==null || a.length<0 || b == null || b.length()==0 ) - return false; - - for (int i=0; i<a.length; i++) - { - String s = a[i]; - if (s.equals(b)) - { - return true; - } - } - return false; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java deleted file mode 100644 index 44345accc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.common; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.Service; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.internal.webservice.helper.WebServicesManager; -import org.eclipse.jst.j2ee.webservice.internal.WebServiceConstants; -import org.eclipse.jst.j2ee.webservice.wsdd.PortComponent; -import org.eclipse.jst.j2ee.webservice.wsdd.WSDLPort; -import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - -/** - * - */ -public class ValidationUtils -{ - MessageUtils msgUtils; - - /** - * - */ - public ValidationUtils() - { - String pluginId = WebServiceConsumptionUIPlugin.ID; //"org.eclipse.jst.ws.consumption.ui"; - msgUtils = new MessageUtils( pluginId + ".plugin", this ); - } - - public IStatus validateProjectTargetAndJ2EE(String projectName, String compName, String earName, String earCompName, String serverFactoryId, String j2eeLevel) - { - IProject p = ProjectUtilities.getProject(projectName); - IProject earP = null; - if (earName!=null && !earName.equalsIgnoreCase("")) { - earP = ProjectUtilities.getProject(earName); - } - IStatus targetStatus = doesProjectTargetMatchServerType(p, serverFactoryId); - if (earP!=null && targetStatus.getSeverity()==Status.OK) - { - //check the EAR - IStatus earTargetStatus = doesProjectTargetMatchServerType(earP, serverFactoryId); - if(earTargetStatus.getSeverity()==Status.ERROR) - { - return earTargetStatus; - } - } - else - { - return targetStatus; - } - - - //Validate service side J2EE level - IStatus j2eeStatus = doesProjectMatchJ2EELevel(p, compName, j2eeLevel); - if(earP!=null && j2eeStatus.getSeverity()==Status.OK) - { - IStatus earJ2EEStatus = doesProjectMatchJ2EELevel(earP, earCompName, j2eeLevel); - if(earJ2EEStatus.getSeverity()==Status.ERROR) - { - return earJ2EEStatus; - } - } - else - { - return j2eeStatus; - } - - return Status.OK_STATUS; - } - - private IStatus doesProjectTargetMatchServerType(IProject p, String serverFactoryId) - { - if (p!=null && p.exists()) - { - IRuntime projectTarget = ServerSelectionUtils.getRuntimeTarget(p.getName()); - if (projectTarget!=null) - { - String projectTargetId = projectTarget.getRuntimeType().getId(); - String serverTargetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverFactoryId); - if (serverTargetId!=null && serverTargetId.length()>0) - { - if(!projectTargetId.equals(serverTargetId)) - { - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_SERVER_TARGET_MISMATCH",new String[]{p.getName()}) ); - } - } - } - } - return Status.OK_STATUS; - } - - private IStatus doesProjectMatchJ2EELevel(IProject p, String compName, String j2eeLevel) - { - - try { - if (p!=null && p.exists()) - { - int projectJ2EELevel = J2EEUtils.getJ2EEVersion(p, compName); - if (projectJ2EELevel!=-1) - { - String projectJ2EELevelString = String.valueOf(projectJ2EELevel); - if (j2eeLevel!=null && j2eeLevel.length()>0) - { - if (!projectJ2EELevelString.equals(j2eeLevel)) - { - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_J2EE_MISMATCH",new String[]{p.getName()}) ); - } - } - } - } - } catch(Exception e){ - - } - - return Status.OK_STATUS; - } - - public IStatus validateProjectType(String projectName, SelectionListChoices runtime2ClientTypes) - { - IStatus status = Status.OK_STATUS; - IProject p = ProjectUtilities.getProject(projectName); - if (p==null || !p.exists()) - { - //Project does not exist which means a new project of the correct type will be created - //We're done. All is good. - return status; - } - - //If the project exists, we should see it in the project list for the selected client - //project type. - String[] projectNames = runtime2ClientTypes.getChoice().getChoice().getList().getList(); - for (int i=0; i<projectNames.length; i++) - { - if (projectName.equals(projectNames[i])) - { - //Found the project. All is good. - return status; - } - } - - //Didn't find the project. Return an error. - //Get the label for the client type id - String clientTypeLabel = getClientTypeLabel(runtime2ClientTypes.getChoice().getList().getSelection()); - String message = msgUtils.getMessage("MSG_WRONG_CLIENT_PROJECT_TYPE",new String[]{projectName, clientTypeLabel}); - IStatus eStatus = StatusUtils.errorStatus( message ); - return eStatus; - - } - - - private String getClientTypeLabel( String type ) - { - if (type.equals(IModuleConstants.JST_WEB_MODULE)) - { - return msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_WEB"); - } - else if (type.equals(IModuleConstants.JST_EJB_MODULE)) - { - return msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_EJB"); - } - else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE)) - { - return msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_APP_CLIENT"); - } - else if (type.equals(IModuleConstants.JST_UTILITY_MODULE)) - { - return msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_CONTAINERLESS"); - } - else - { - //No known label, return the typeId itself. - return type; - } - } - - /** - * - * @param p - * @param wsdlURL - * @param parser - * @return - */ - public boolean isProjectServiceProject(IProject p, String wsdlURL, WebServicesParser parser) - { - if (p==null || wsdlURL==null || wsdlURL.length()==0 || parser==null) - return false; - - IResource wsXML = getWebServcesXML(p); - if (wsXML==null) - return false; - - - //Make a list of all the wsdl-port's in webservices.xml - WebServicesManager wsm = WebServicesManager.getInstance(); - //WebServiceEditModel wsEditModel = wsm.getWSEditModel(p); - //WebServices ws = wsEditModel.getWebServices(); - Iterator wsDescs = wsm.getInternalWebServicesDescriptions().iterator(); - ArrayList wsdlPortList = new ArrayList(); - while(wsDescs.hasNext()) - { - WebServiceDescription wsDesc = (WebServiceDescription)wsDescs.next(); - Iterator pcs = wsDesc.getPortComponents().iterator(); - while(pcs.hasNext()) - { - PortComponent pc = (PortComponent)pcs.next(); - WSDLPort wsdlPort = pc.getWsdlPort(); - wsdlPortList.add(new QualifiedName(wsdlPort.getNamespaceURI(), wsdlPort.getLocalPart())); - } - } - - ArrayList portList = getPortNamesFromWsdl(wsdlURL, parser); - - //If any of the QualifiedNames in portList equals any of the QualifiedNames - //in wsdlPortList, this is the service project. Return true. - Object[] ports = portList.toArray(); - Object[] wsdlPorts = wsdlPortList.toArray(); - for (int i = 0; i < ports.length; i++) - { - QualifiedName portName = (QualifiedName) ports[i]; - for (int j = 0; j < wsdlPorts.length; j++) - { - QualifiedName wsdlPortName = (QualifiedName) wsdlPorts[j]; - if (portName.equals(wsdlPortName)) - { - return true; - } - } - } - - return false; - } - - /** - * @deprecated - * - */ - private IResource getWebServcesXML(IProject p) - { - // -// J2EENature nature = (J2EENature) J2EENature.getRegisteredRuntime(p); -// if (nature == null) -// return null; - -// IResource moduleRoot = nature.getModuleServerRoot(); -// IResource moduleRoot = ResourceUtils.getWebModuleServerRoot(p); - IResource moduleRoot = J2EEUtils.getFirstWebContentContainer(p); - if (!(moduleRoot instanceof IContainer)) - return null; - - IResource webServicesXML=null; -// if (nature instanceof J2EEWebNatureRuntime) - if (ResourceUtils.isWebProject(p)) - { - StringBuffer wsPath = new StringBuffer(); - wsPath.append("WEB-INF/"); - wsPath.append(WebServiceConstants.WEBSERVICE_DD_SHORT_NAME); - webServicesXML = ((IContainer)moduleRoot).findMember(wsPath.toString()); - } - else //Must be an Application Client Module or an EJB Module - { - StringBuffer wsPath = new StringBuffer(); - wsPath.append("META-INF/"); - wsPath.append(WebServiceConstants.WEBSERVICE_DD_SHORT_NAME); - webServicesXML = ((IContainer)moduleRoot).findMember(wsPath.toString()); - } - - return webServicesXML; - } - - private ArrayList getPortNamesFromWsdl(String wsdlURL, WebServicesParser parser) - { - ArrayList portNameList = new ArrayList(); - Definition def = parser.getWSDLDefinition(wsdlURL); - Map services = def.getServices(); - Service service = null; - for (Iterator it = services.values().iterator(); it.hasNext();) - { - service = (Service)it.next(); - String namespace = service.getQName().getNamespaceURI(); - Map ports = service.getPorts(); - for (Iterator it2 = ports.values().iterator(); it2.hasNext();) - { - Port port = (Port)it2.next(); - portNameList.add(new QualifiedName(namespace, port.getName())); - } - } - - return portNameList; - - } - - private class QualifiedName - { - String namespaceURI; - - String localPart; - - /** - * @param namespaceURI - * @param localPart - */ - public QualifiedName(String namespaceURI, String localPart) - { - super(); - this.namespaceURI = namespaceURI; - this.localPart = localPart; - } - - /** - * @return Returns the localPart. - */ - public String getLocalPart() - { - return localPart; - } - - /** - * @param localPart - * The localPart to set. - */ - public void setLocalPart(String localPart) - { - this.localPart = localPart; - } - - /** - * @return Returns the namespaceURI. - */ - public String getNamespaceURI() - { - return namespaceURI; - } - - /** - * @param namespaceURI - * The namespaceURI to set. - */ - public void setNamespaceURI(String namespaceURI) - { - this.namespaceURI = namespaceURI; - } - - public boolean equals(QualifiedName qn) - { - return (qn.getNamespaceURI().equals(namespaceURI) && qn.getLocalPart() - .equals(localPart)); - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/ClientRootFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/ClientRootFragment.java deleted file mode 100644 index c888d6f34..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/ClientRootFragment.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.extension; - -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.DataObjectCommand; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; -import org.eclipse.wst.ws.internal.extensions.AssembleClientFragment; -import org.eclipse.wst.ws.internal.extensions.DeployClientFragment; -import org.eclipse.wst.ws.internal.extensions.DevelopClientFragment; -import org.eclipse.wst.ws.internal.extensions.InstallClientFragment; -import org.eclipse.wst.ws.internal.extensions.RunClientFragment; - -public class ClientRootFragment extends SequenceFragment -{ - public ClientRootFragment() - { - add( new SimpleFragment( new PreClientDevelopCommand(), "" ) ); - add( new DevelopClientFragment() ); - add( new SimpleFragment( new PreClientAssembleCommand(), "" ) ); - add( new AssembleClientFragment() ); - add( new SimpleFragment( new PreClientDeployCommand(), "" ) ); - add( new DeployClientFragment() ); - add( new SimpleFragment( new PreClientInstallCommand(), "" ) ); - add( new InstallClientFragment() ); - add( new SimpleFragment( new PreClientRunCommand(), - "org.eclipse.jst.ws.internal.consumption.ui.extension.PreClientRunCommand" ) ); - add( new RunClientFragment() ); - } - - public void registerDataMappings(DataMappingRegistry registry) - { - registry.addMapping( PreClientDevelopCommand.class, "WebService", DevelopClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Environment", DevelopClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Context", DevelopClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Selection", DevelopClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Project", DevelopClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Module", DevelopClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "EarProject", DevelopClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Ear", DevelopClientFragment.class ); - - // Map the PreClientDevelopCommand into the dataObject. - registry.addMapping( PreClientDevelopCommand.class, "DataObject", DataObjectCommand.class ); - - registry.addMapping( PreClientDevelopCommand.class, "WebService", AssembleClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Environment", AssembleClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Context", AssembleClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Selection", AssembleClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Project", AssembleClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Module", AssembleClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "EarProject", AssembleClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Ear", AssembleClientFragment.class ); - - registry.addMapping( PreClientDevelopCommand.class, "WebService", DeployClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Environment", DeployClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Context", DeployClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Selection", DeployClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Project", DeployClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Module", DeployClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "EarProject", DeployClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Ear", DeployClientFragment.class ); - - registry.addMapping( PreClientDevelopCommand.class, "WebService", InstallClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Environment", InstallClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Context", InstallClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Selection", InstallClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Project", InstallClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Module", InstallClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "EarProject", InstallClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Ear", InstallClientFragment.class ); - - registry.addMapping( PreClientDevelopCommand.class, "WebService", RunClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Environment", RunClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Context", RunClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Selection", RunClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Project", RunClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Module", RunClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "EarProject", RunClientFragment.class ); - registry.addMapping( PreClientDevelopCommand.class, "Ear", RunClientFragment.class ); - - //Mappings from framework to framework commands - registry.addMapping( PreClientDevelopCommand.class, "WebService", PreClientAssembleCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "Project", PreClientAssembleCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "Module", PreClientAssembleCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "EarProject", PreClientAssembleCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "Ear", PreClientAssembleCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "J2eeLevel", PreClientAssembleCommand.class ); - - registry.addMapping( PreClientDevelopCommand.class, "WebService", PreClientInstallCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "Project", PreClientInstallCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "Module", PreClientInstallCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "EarProject", PreClientInstallCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "Ear", PreClientInstallCommand.class ); - - registry.addMapping( PreClientDevelopCommand.class, "WebService", PreClientRunCommand.class ); - - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientAssembleCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientAssembleCommand.java deleted file mode 100644 index 948cb5cf8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientAssembleCommand.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.extension; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; - -public class PreClientAssembleCommand extends AbstractDataModelOperation -{ - private IWebServiceClient webServiceClient_; - private String project_; - private String module_; - private String earProject_; - private String ear_; - private String j2eeLevel_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment environment = getEnvironment(); - - System.out.println("In Pre client assemble command."); - - // Check if EAR module is req'd, ie. !=null - if (earProject_==null) - return Status.OK_STATUS; - - //Create the client EAR module - CreateModuleCommand command = new CreateModuleCommand(); - command.setProjectName(earProject_); - command.setModuleName(ear_); - command.setModuleType(CreateModuleCommand.EAR); - command.setServerFactoryId(webServiceClient_.getWebServiceClientInfo().getServerFactoryId()); - command.setServerInstanceId( webServiceClient_.getWebServiceClientInfo().getServerInstanceId() ); - command.setJ2eeLevel(j2eeLevel_); - command.setEnvironment( environment ); - IStatus status = command.execute( null, null ); - if (status.getSeverity()==Status.ERROR) - { - environment.getStatusHandler().reportError( status ); - return status; - } - - - //Associate the client module and service EAR - AssociateModuleWithEARCommand associateCommand = new AssociateModuleWithEARCommand(); - associateCommand.setProject(project_); - associateCommand.setModule(module_); - associateCommand.setEARProject(earProject_); - associateCommand.setEar(ear_); - associateCommand.setEnvironment( environment ); - status = associateCommand.execute( null, null ); - if (status.getSeverity()==Status.ERROR) - { - environment.getStatusHandler().reportError( status ); - } - - return status; - } - - public void setProject( String project ) - { - project_ = project; - } - - public void setModule( String module ) - { - module_ = module; - } - - public void setEarProject( String earProject ) - { - earProject_ = earProject; - } - - public void setEar( String ear ) - { - ear_ = ear; - } - - - public void setJ2eeLevel( String j2eeLevel ) - { - j2eeLevel_ = j2eeLevel; - } - - public void setWebService( IWebServiceClient webServiceClient ) - { - webServiceClient_ = webServiceClient; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDeployCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDeployCommand.java deleted file mode 100644 index cb8966583..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDeployCommand.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.extension; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; - -public class PreClientDeployCommand extends AbstractDataModelOperation -{ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java deleted file mode 100644 index feedac3a1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java +++ /dev/null @@ -1,259 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.extension; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.provisional.wsrt.IContext; -import org.eclipse.wst.ws.internal.provisional.wsrt.ISelection; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebService; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceRuntime; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceClientInfo; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceState; -import org.eclipse.wst.ws.internal.wsrt.SimpleContext; - -public class PreClientDevelopCommand extends AbstractDataModelOperation -{ - /* - private String ID_WEB = "org.eclipse.jst.ws.consumption.ui.clientProjectType.Web"; - private String ID_EJB = "org.eclipse.jst.ws.consumption.ui.clientProjectType.EJB"; - private String ID_APP_CLIENT = "org.eclipse.jst.ws.consumption.ui.clientProjectType.AppClient"; - private String ID_JAVA = "org.eclipse.jst.ws.consumption.ui.clientProjectType.Containerless"; - */ - - private TypeRuntimeServer typeRuntimeServer_; - private IContext context_; - private ISelection selection_; - private String project_; - private String module_; - private String moduleType_; - private String earProject_; - private String ear_; - private IWebServiceClient webServiceClient_; - private String j2eeLevel_; - private ResourceContext resourceContext_; - private boolean test_; - private String wsdlURI_; - private Object dataObject_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment environment = getEnvironment(); - - // Split up the project and module - int index = module_.indexOf("/"); - if (index!=-1){ - project_ = module_.substring(0,index); - module_ = module_.substring(index+1); - } - - if (ear_!=null && ear_.length()>0) - { - int earIndex = ear_.indexOf("/"); - if (earIndex!=-1) { - earProject_ = ear_.substring(0,earIndex); - ear_ = ear_.substring(earIndex+1); - } - } - - IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils - .getWebServiceRuntime(typeRuntimeServer_.getRuntimeId()); - WebServiceClientInfo wsInfo = new WebServiceClientInfo(); - - System.out.println("In Pre client develop command."); - - wsInfo.setJ2eeLevel(j2eeLevel_); - wsInfo.setServerFactoryId(typeRuntimeServer_.getServerId()); - wsInfo.setServerInstanceId(typeRuntimeServer_.getServerInstanceId()); - wsInfo.setState(WebServiceState.UNKNOWN_LITERAL); - wsInfo.setWebServiceRuntimeId(typeRuntimeServer_.getRuntimeId()); - wsInfo.setWsdlURL(wsdlURI_); - - webServiceClient_ = wsrt.getWebServiceClient(wsInfo); - WebServiceScenario scenario = WebServiceScenario.CLIENT_LITERAL; - context_ = new SimpleContext(true, true, true, true, true, true, test_, - false, scenario, resourceContext_.isOverwriteFilesEnabled(), - resourceContext_.isCreateFoldersEnabled(), resourceContext_ - .isCheckoutFilesEnabled()); - - // Create the client module - - int intModuleType = convertModuleType(moduleType_); - - CreateModuleCommand command = new CreateModuleCommand(); - command.setProjectName(project_); - command.setModuleName(module_); - command.setModuleType(intModuleType); - command.setServerFactoryId(typeRuntimeServer_.getServerId()); - command.setJ2eeLevel(j2eeLevel_); - command.setEnvironment( environment ); - IStatus status = command.execute( null, null ); - - // rsk todo -- once the clientProjectType extension is gone, determination - // of what type of module to create will have to be done. - //if (moduleType_.equals(ID_WEB)) command.setModuleType(CreateModuleCommand.WEB); - //if (moduleType_.equals(ID_EJB)) command.setModuleType(CreateModuleCommand.EJB); - //if (moduleType_.equals(ID_APP_CLIENT)) command.setModuleType(CreateModuleCommand.APPCLIENT); - - command.setServerInstanceId( typeRuntimeServer_.getServerInstanceId() ); - - - if (status.getSeverity() == Status.ERROR) - { - environment.getStatusHandler().reportError( status ); - } - return status; - } - - private int convertModuleType(String type) - { - if (type.equals(IModuleConstants.JST_WEB_MODULE)) - { - return CreateModuleCommand.WEB; - } - else if (type.equals(IModuleConstants.JST_EJB_MODULE)) - { - return CreateModuleCommand.EJB; - } - else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE)) - { - return CreateModuleCommand.APPCLIENT; - } - else if (type.equals(IModuleConstants.JST_EAR_MODULE)) - { - return CreateModuleCommand.EAR; - } - else - { - return -1; - } - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer typeRuntimeServer ) - { - typeRuntimeServer_ = typeRuntimeServer; - } - - public void setClientJ2EEVersion( String j2eeLevel ) - { - j2eeLevel_ = j2eeLevel; - } - - public String getJ2eeLevel() - { - return j2eeLevel_; - } - - public IWebServiceClient getWebService() - { - return webServiceClient_; - } - - public IContext getContext() - { - return context_; - } - - public void setResourceContext( ResourceContext resourceContext ) - { - resourceContext_ = resourceContext; - } - - public ISelection getSelection() - { - return selection_; - } - - public void setSelection( ISelection selection ) - { - selection_ = selection; - } - - public String getProject() - { - return project_; - } - - public String getModule() - { - return module_; - } - - public void setModule( String module ) - { - module_ = module; - } - - public void setModuleType( String moduleType) - { - moduleType_ = moduleType; - } - - public String getEarProject() - { - return earProject_; - } - - public String getEar() - { - return ear_; - } - - public void setEar( String ear ) - { - ear_ = ear; - } - - public void setTestService(boolean testService) - { - test_ = testService; - } - - public void setWsdlURI(String uri) - { - wsdlURI_ = uri; - } - - public void setDataObject( Object object ) - { - dataObject_ = object; - } - - public Object getDataObject() - { - Object result = null; - - if( dataObject_ != null && dataObject_ instanceof IWebService ) - { - // The data object has already been set with an IWebService - // so we will keep this value. - result = dataObject_; - } - else - { - result = webServiceClient_; - } - - return result; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientInstallCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientInstallCommand.java deleted file mode 100644 index df45d2f9a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientInstallCommand.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.extension; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateServerCommand; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; - -public class PreClientInstallCommand extends AbstractDataModelOperation -{ - private IWebServiceClient webServiceClient_; - private String project_; - private String module_; - private String earProject_; - private String ear_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment environment = getEnvironment(); - - if (webServiceClient_.getWebServiceClientInfo().getServerInstanceId()==null) - { - CreateServerCommand createServerCommand = new CreateServerCommand(); - createServerCommand.setServerFactoryid(webServiceClient_.getWebServiceClientInfo().getServerFactoryId()); - createServerCommand.setEnvironment( environment ); - IStatus createServerStatus = createServerCommand.execute(null, null); - if (createServerStatus.getSeverity()==Status.OK) - { - webServiceClient_.getWebServiceClientInfo().setServerInstanceId(createServerCommand.getServerInstanceId()); - } - else - { - if (createServerStatus.getSeverity()==Status.ERROR) - { - environment.getStatusHandler().reportError( createServerStatus ); - } - return createServerStatus; - } - } - - - - AddModuleToServerCommand command = new AddModuleToServerCommand(); - command.setServerInstanceId(webServiceClient_.getWebServiceClientInfo().getServerInstanceId()); - if (earProject_ != null && earProject_.length()>0 && ear_!= null && ear_.length()>0) - { - command.setProject(earProject_); - command.setModule(ear_); - } - else - { - command.setProject(project_); - command.setModule(module_); - } - - command.setEnvironment( environment ); - IStatus status = command.execute( null, null ); - if (status.getSeverity()==Status.ERROR) - { - environment.getStatusHandler().reportError( status ); - } - return status; - } - - public void setProject( String project ) - { - project_ = project; - } - - public void setModule( String module ) - { - module_ = module; - } - - public void setEarProject( String earProject ) - { - earProject_ = earProject; - } - - public void setEar( String ear ) - { - ear_ = ear; - } - - public void setWebService( IWebServiceClient webServiceClient ) - { - webServiceClient_ = webServiceClient; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientRunCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientRunCommand.java deleted file mode 100644 index cc843529b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientRunCommand.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.extension; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.command.common.StartServerCommand; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; - -public class PreClientRunCommand extends AbstractDataModelOperation -{ - private IWebServiceClient webServiceClient_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment environment = getEnvironment(); - - System.out.println("In Pre client run command."); - StartServerCommand command = new StartServerCommand(); - command.setServerInstanceId(webServiceClient_.getWebServiceClientInfo().getServerInstanceId()); - command.setEnvironment( environment ); - IStatus status = command.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - environment.getStatusHandler().reportError( status ); - } - return status; - } - - public void setWebService( IWebServiceClient webServiceClient ) - { - webServiceClient_ = webServiceClient; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/plugin/WebServiceConsumptionUIPlugin.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/plugin/WebServiceConsumptionUIPlugin.java deleted file mode 100644 index 092411ee4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/plugin/WebServiceConsumptionUIPlugin.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.plugin; - -import java.net.MalformedURLException; -import java.net.URL; -import java.text.MessageFormat; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; - - -/** -* This is the plugin class for the Web Services plugin. -* <p> -* This plugin contains the graphic user interface to the -* Web Services runtime found in org.eclipse.jst.ws. -*/ -public class WebServiceConsumptionUIPlugin extends AbstractUIPlugin -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - /** - * The identifier of the descriptor of this plugin in plugin.xml. - */ - public static final String ID = "org.eclipse.jst.ws.consumption.ui"; - - /** - * The reference to the singleton instance of this plugin. - */ - private static WebServiceConsumptionUIPlugin instance_; - - private PersistentServerRuntimeContext serverRuntimeContext_; - - /** - * Constructs a runtime plugin object for this plugin. - */ - public WebServiceConsumptionUIPlugin () - { - super(); - instance_ = this; - } - - /** - * Returns the singleton instance of this plugin. Equivalent to calling - * (WebServiceConsumptionUIPlugin)Platform.getPlugin("org.eclipse.jst.ws.ui"); - * @return The WebServiceConsumptionUIPlugin singleton. - */ - static public WebServiceConsumptionUIPlugin getInstance () - { - return instance_; - } - - /** - * Returns the message string identified by the given key from - * the plugin.properties file for the appropriate locale. - * @param key The message key string prefixed by a "%" symbol. - * That is, the string passed in must be of the form "%KEY" - * where the plugin.properties file contains a line of the - * form: "KEY = value". - * @return The locale-specific message. - */ - public static String getMessage ( String key ) - { - MessageUtils msgUtils = new MessageUtils( "org.eclipse.jst.ws.consumption.ui.plugin", instance_ ); - - if( key.startsWith("%")) - { - key = key.substring( 1, key.length() ); - } - - return msgUtils.getMessage(key); - } - - /** - * Returns the message string identified by the given key from - * the plugin.properties file for the appropriate locale. - * Substitution sequences in the message string - * are replaced by the given array of substitution objects (which - * are most frequently strings). See java.text.MessageFormat for - * further details on substitution. - * @param key The message key string prefixed by a "%" symbol. - * That is, the string passed in must be of the form "%KEY" - * where the plugin.properties file contains a line of the - * form: "KEY = value". - * @param args The substitution values for the message - * as required by the message in plugin.properties and - * by the rules of class java.text.MessageFormat. - * @return The locale-specific message. - */ - public static String getMessage ( String key, Object[] args ) - { - return MessageFormat.format(getMessage(key),args); - } - - /** - * Returns an image descriptor for the named resource - * as relative to the plugin install location. - * @return An image descriptor, possibly null. - */ - public static ImageDescriptor getImageDescriptor ( String name ) - { - try - { - URL installURL = instance_.getBundle().getEntry("/");; - URL imageURL = new URL(installURL,name); - return ImageDescriptor.createFromURL(imageURL); - } - catch (MalformedURLException e) - { - return null; - } - } - - public PersistentServerRuntimeContext getServerRuntimeContext() - { - if (serverRuntimeContext_ == null) - { - serverRuntimeContext_ = new PersistentServerRuntimeContext(); - serverRuntimeContext_.load(); - } - return serverRuntimeContext_; - } - } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/PersistentServerRuntimeContext.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/PersistentServerRuntimeContext.java deleted file mode 100644 index 946f456f7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/PersistentServerRuntimeContext.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.preferences; - -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.wst.command.internal.env.context.PersistentContext; - - -/** - * - */ -public class PersistentServerRuntimeContext extends PersistentContext { - - private String PREFERENCE_SERVER = "PREFERENCE_SERVER"; - private String PREFERENCE_RUNTIME = "PREFERENCE_RUNTIME"; - private String PREFERENCE_J2EE_VERSION = "PREFERENCE_J2EE_VERSION"; - - private String SERVER_FACTORY_ID_DEFAULT = "org.eclipse.jst.server.tomcat.50"; - private String RUNTIME_ID_DEFAULT = "org.eclipse.jst.ws.axis.creation.axisWebServiceRT"; - private String J2EE_VERSION_DEFAULT = "14"; - - public PersistentServerRuntimeContext() - { - super(WebServiceConsumptionUIPlugin.getInstance()); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.ws.internal.context.Context#load() - */ - public void load() { - //Defaults will be set via the .ini customization. They are hard coded to default values in the - //absence of a .ini file. - String serverDefault = getDefaultString(PREFERENCE_SERVER); - if (serverDefault==null || serverDefault.length()==0) - { - setDefault(PREFERENCE_SERVER, SERVER_FACTORY_ID_DEFAULT); - } - - String runtimeDefault = getDefaultString(PREFERENCE_RUNTIME); - if (runtimeDefault==null || runtimeDefault.length()==0) - { - setDefault(PREFERENCE_RUNTIME, RUNTIME_ID_DEFAULT); - } - - String j2eeDefault = getDefaultString(PREFERENCE_J2EE_VERSION); - if (j2eeDefault==null || j2eeDefault.length()==0) - { - setDefault(PREFERENCE_J2EE_VERSION, J2EE_VERSION_DEFAULT); - } - - - } - - public String getDefaultServerFactoryId() - { - return getDefaultString(PREFERENCE_SERVER); - } - - public String getDefaultRuntimeId() - { - return getDefaultString(PREFERENCE_RUNTIME); - } - - public String getDefaultJ2EEVersion() - { - return getDefaultString(PREFERENCE_J2EE_VERSION); - } - - public String getServerFactoryId() - { - String value = getValueAsString(PREFERENCE_SERVER); - /* - if (value==null || value.length()==0) - { - value = SERVER_FACTORY_ID_DEFAULT; - setServerFactoryId(value); - } - */ - return value; - } - - public String getRuntimeId() - { - String value = getValueAsString(PREFERENCE_RUNTIME); - /* - if (value==null || value.length()==0) - { - value = RUNTIME_ID_DEFAULT; - setRuntimeId(value); - } - */ - return value; - } - - public String getJ2EEVersion() - { - String value = getValueAsString(PREFERENCE_J2EE_VERSION); - /* - if (value==null || value.length()==0) - { - value = J2EE_VERSION_DEFAULT; - setJ2EEVersion(value); - } - */ - return value; - } - - public void setServerFactoryId(String id) - { - setValue(PREFERENCE_SERVER,id); - } - - public void setRuntimeId(String id) - { - setValue(PREFERENCE_RUNTIME, id); - } - - public void setJ2EEVersion(String version) - { - setValue(PREFERENCE_J2EE_VERSION, version); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java deleted file mode 100644 index b2abb86e1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java +++ /dev/null @@ -1,392 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.preferences; - -import java.util.ArrayList; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -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.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; - - -/** - * - */ -public class ServerRuntimePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener -{ - private String pluginId_= "org.eclipse.jst.ws.consumption.ui"; - private MessageUtils msgUtils_; - - /* CONTEXT_ID SRPF0001 for server preference on the server runtime preference page */ - private String INFOPOP_SRPF_SERVER_PREF = pluginId_ + ".SRPF0001"; - private Combo server_; - - /* CONTEXT_ID SRPF0002 for runtime preference on the server runtime preference page */ - private String INFOPOP_SRPF_RUNTIME_PREF = pluginId_ + ".SRPF0002"; - private Combo runtime_; - - /* CONTEXT_ID SRPF0003 for J2EE version preference on the server runtime preference page */ - private String INFOPOP_SRPF_J2EE_PREF = pluginId_ + ".SRPF0003"; - private Combo j2eeVersion_; - - SelectionListChoices serverToRuntimeToJ2EE_; - - public void init(IWorkbench workbench) { } - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite parent) - { - - msgUtils_ = new MessageUtils(pluginId_ + ".plugin", this); - UIUtils uiUtils = new UIUtils(msgUtils_, pluginId_); - - Composite page = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(); - gl.numColumns = 2; - page.setLayout(gl); - GridData gd = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL); - page.setLayoutData(gd); - - server_ = uiUtils.createCombo(page,"LABEL_SERVERS_LIST", - "TOOLTIP_SRPF_COMBO_SERVER", - INFOPOP_SRPF_SERVER_PREF, - SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY); - - runtime_ = uiUtils.createCombo(page,"LABEL_RUNTIMES_LIST", - "TOOLTIP_SRPF_COMBO_RUNTIME", - INFOPOP_SRPF_RUNTIME_PREF, - SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY); - - j2eeVersion_ = uiUtils.createCombo(page,"LABEL_J2EE_VERSION", - "TOOLTIP_SRPF_COMBO_J2EE", - INFOPOP_SRPF_J2EE_PREF, - SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY); - - initializeValues(); - startListening(); - return page; - } - - private void initializeValues() - { - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - //serverToRuntimeToJ2EE_ = WebServiceServerRuntimeTypeRegistry.getInstance().getServerToRuntimeToJ2EE(); - serverToRuntimeToJ2EE_ = WebServiceRuntimeExtensionUtils.getServerToRuntimeToJ2EE(); - - - setServerItems(serverToRuntimeToJ2EE_.getList().getList()); - String defaultServerText = context.getServerFactoryId(); - serverToRuntimeToJ2EE_.getList().setSelectionValue(defaultServerText); - setServerSelection(defaultServerText); - - setRuntimeItems(serverToRuntimeToJ2EE_.getChoice().getList().getList()); - String defaultRuntimeText = context.getRuntimeId(); - serverToRuntimeToJ2EE_.getChoice().getList().setSelectionValue(defaultRuntimeText); - setRuntimeSelection(defaultRuntimeText); - - setJ2EEItems(serverToRuntimeToJ2EE_.getChoice().getChoice().getList().getList()); - String defaultJ2EEVersion = context.getJ2EEVersion(); - serverToRuntimeToJ2EE_.getChoice().getChoice().getList().setSelectionValue(defaultJ2EEVersion); - setJ2EESelection(defaultJ2EEVersion); - - } - - public void handleEvent(Event event) - { - if (server_ == event.widget) - { - handleServerSelected(); - } - else if (runtime_ == event.widget) - { - handleRuntimeSelected(); - } - else if (j2eeVersion_ == event.widget) - { - handleJ2EESelected(); - } - } - - private void handleServerSelected() - { - stopListening(); - - String selectedText = getServerSelection(); - serverToRuntimeToJ2EE_.getList().setSelectionValue(selectedText); - - //Update the runtime ------------------------------- - setRuntimeItems(serverToRuntimeToJ2EE_.getChoice().getList().getList()); - if (serverToRuntimeToJ2EE_.getChoice().getList().getList().length > 0) - serverToRuntimeToJ2EE_.getChoice().getList().setIndex(0); - - String newRuntimeText = serverToRuntimeToJ2EE_.getChoice().getList().getSelection(); - if (newRuntimeText!=null && newRuntimeText.length()>0) - setRuntimeSelection(newRuntimeText); - - //Update the j2ee version ------------------------------- - if (newRuntimeText!=null && newRuntimeText.length()>0) - { - setJ2EEItems(serverToRuntimeToJ2EE_.getChoice().getChoice().getList().getList()); - if (serverToRuntimeToJ2EE_.getChoice().getChoice().getList().getList().length > 0) - serverToRuntimeToJ2EE_.getChoice().getChoice().getList().setIndex(0); - - String newJ2EEText = serverToRuntimeToJ2EE_.getChoice().getChoice().getList().getSelection(); - if (newJ2EEText!=null && newJ2EEText.length()>0) - setJ2EESelection(newJ2EEText); - } - else - { - setJ2EEItems(new String[0]); - } - - startListening(); - } - - private void handleRuntimeSelected() - { - stopListening(); - - String selectedText = getRuntimeSelection(); - serverToRuntimeToJ2EE_.getChoice().getList().setSelectionValue(selectedText); - - //Update the j2ee version ------------------------------- - setJ2EEItems(serverToRuntimeToJ2EE_.getChoice().getChoice().getList().getList()); - if (serverToRuntimeToJ2EE_.getChoice().getChoice().getList().getList().length > 0) - serverToRuntimeToJ2EE_.getChoice().getChoice().getList().setIndex(0); - - String newJ2EEText = serverToRuntimeToJ2EE_.getChoice().getChoice().getList().getSelection(); - if (newJ2EEText!=null && newJ2EEText.length()>0) - setJ2EESelection(newJ2EEText); - - startListening(); - } - - private void handleJ2EESelected() - { - stopListening(); - - String selectedText = getJ2EESelection(); - serverToRuntimeToJ2EE_.getChoice().getChoice().getList().setSelectionValue(selectedText); - - startListening(); - } - /** - * Does anything necessary because the default button has been pressed. - */ - protected void performDefaults() - { - super.performDefaults(); - setToDefaults(); - } - - private void setToDefaults() - { - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - - String defaultServerText = context.getDefaultServerFactoryId(); - serverToRuntimeToJ2EE_.getList().setSelectionValue(defaultServerText); - setServerSelection(defaultServerText); - - setRuntimeItems(serverToRuntimeToJ2EE_.getChoice().getList().getList()); - String defaultRuntimeText = context.getDefaultRuntimeId(); - serverToRuntimeToJ2EE_.getChoice().getList().setSelectionValue(defaultRuntimeText); - setRuntimeSelection(defaultRuntimeText); - - setJ2EEItems(serverToRuntimeToJ2EE_.getChoice().getChoice().getList().getList()); - String defaultJ2EEVersion = context.getDefaultJ2EEVersion(); - serverToRuntimeToJ2EE_.getChoice().getChoice().getList().setSelectionValue(defaultJ2EEVersion); - setJ2EESelection(defaultJ2EEVersion); - } - - /** - * Do anything necessary because the OK button has been pressed. - * @return whether it is okay to close the preference page - */ - public boolean performOk() - { - storeValues(); - return true; - } - - private void storeValues() - { - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - context.setServerFactoryId(getServerSelection()); - context.setRuntimeId(getRuntimeSelection()); - context.setJ2EEVersion(getJ2EESelection()); - } - - protected void performApply() - { - performOk(); - } - - - private void startListening() - { - server_.addListener(SWT.Selection,this); - runtime_.addListener(SWT.Selection,this); - j2eeVersion_.addListener(SWT.Selection,this); - } - - private void stopListening() - { - server_.removeListener(SWT.Selection, this); - runtime_.removeListener(SWT.Selection, this); - j2eeVersion_.removeListener(SWT.Selection, this); - } - - private void setServerItems(String[] factoryIds) - { - - if (factoryIds != null) - { - ArrayList serverLabelsList = new ArrayList(); - for (int i=0;i<factoryIds.length;i++) - { - //String thisServerLabel = WebServiceServerRuntimeTypeRegistry.getInstance().getServerLabel(factoryIds[i]); - String thisServerLabel = WebServiceRuntimeExtensionUtils.getServerLabelById(factoryIds[i]); - if (thisServerLabel!=null && thisServerLabel.length()>0) - { - serverLabelsList.add(thisServerLabel); - } - - } - String[] serverLabels = convertToStringArray(serverLabelsList.toArray()); - server_.setItems(serverLabels); - } - - } - - private void setRuntimeItems(String[] ids) - { - if (ids != null) - { - String[] runtimeLabels = new String[ids.length]; - for (int i=0;i<ids.length;i++) - { - //runtimeLabels[i] = WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeLabel(ids[i]); - runtimeLabels[i] = WebServiceRuntimeExtensionUtils.getRuntimeLabelById(ids[i]); - } - runtime_.setItems(runtimeLabels); - } - - } - - private void setJ2EEItems(String[] versions) - { - if (versions != null) - { - String[] j2eeLabels = new String[versions.length]; - for (int i = 0; i < versions.length; i++) - { - String label = J2EEUtils.getLabelFromJ2EEVersion(versions[i]); - if (label != null && label.length()>0) - j2eeLabels[i] = label; - else - j2eeLabels[i] = msgUtils_.getMessage("LABEL_NA"); - } - j2eeVersion_.setItems(j2eeLabels); - - //Disable the combo if it has no items. - if (j2eeLabels.length > 0) - j2eeVersion_.setEnabled(true); - else - j2eeVersion_.setEnabled(false); - } - - } - - private String getServerSelection() - { - String serverLabel = server_.getText(); - //return WebServiceServerRuntimeTypeRegistry.getInstance().getServerFactoryId(serverLabel); - return WebServiceRuntimeExtensionUtils.getServerFactoryId(serverLabel); - } - - private String getRuntimeSelection() - { - String runtimeLabel = runtime_.getText(); - //return WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeId(runtimeLabel); - return WebServiceRuntimeExtensionUtils.getRuntimeId(runtimeLabel); - } - - private String getJ2EESelection() - { - String j2eeLabel = j2eeVersion_.getText(); - return J2EEUtils.getJ2EEVersionFromLabel(j2eeLabel); - } - - private void setServerSelection(String factoryId) - { - //String label = WebServiceServerRuntimeTypeRegistry.getInstance().getServerLabel(factoryId); - String label = WebServiceRuntimeExtensionUtils.getServerLabelById(factoryId); - setSelection(server_,label); - } - - private void setRuntimeSelection(String id) - { - //String label = WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeLabel(id); - String label = WebServiceRuntimeExtensionUtils.getRuntimeLabelById(id); - setSelection(runtime_,label); - } - - private void setJ2EESelection(String version) - { - String label = J2EEUtils.getLabelFromJ2EEVersion(version); - setSelection(j2eeVersion_, label); - } - - private void setSelection(Combo combo, String s) - { - String[] items = combo.getItems(); - for (int i=0; i<items.length; i++) - { - if (items[i].equals(s)) - { - combo.select(i); - return; - } - } - } - - private String[] convertToStringArray(Object[] a) - { - if (a==null) return new String[0]; - - int length = a.length; - String[] sa = new String[length]; - for (int i=0; i<length; i++) - { - Object obj = a[i]; - if (obj instanceof String) - { - sa[i] = (String)obj; - } - } - return sa; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/selection/SelectionTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/selection/SelectionTransformer.java deleted file mode 100644 index 96b9860ad..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/selection/SelectionTransformer.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.selection; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.Selection; -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; - -public class SelectionTransformer implements Transformer -{ - public Object transform(Object value) - { - IStructuredSelection inSelection = (IStructuredSelection)value; - Selection outSelection = new Selection(); - - outSelection.setSelection( inSelection.toArray() ); - - return outSelection; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartClientWidgetContributor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartClientWidgetContributor.java deleted file mode 100644 index a08597eeb..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartClientWidgetContributor.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.server; - -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.ui.widgets.INamedWidgetContributor; -import org.eclipse.wst.server.core.IServer; - -public class StartClientWidgetContributor implements INamedWidgetContributor -{ - private IServer server_; - private MessageUtils msgUtils_; - - public StartClientWidgetContributor( IServer server ) - { - server_ = server; - msgUtils_ = new MessageUtils( "org.eclipse.jst.ws.consumption.ui.plugin", this ); - } - - public String getDescription() - { - return msgUtils_.getMessage( "PAGE_DESC_WS_START_SERVER" ); - } - - public String getName() - { - return ""; - } - - public String getTitle() - { - return msgUtils_.getMessage( "PAGE_TITLE_WS_START_SERVER" ); - } - - public WidgetContributorFactory getWidgetContributorFactory() - { - return new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new StartServerWidget( server_ ); - } - }; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartClientWidgetFactory.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartClientWidgetFactory.java deleted file mode 100644 index 77f3dc230..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartClientWidgetFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.server; - -import org.eclipse.jst.ws.internal.consumption.ui.extension.PreClientDevelopCommand; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.internal.provisional.env.ui.widgets.INamedWidgetContributor; -import org.eclipse.wst.command.internal.provisional.env.ui.widgets.INamedWidgetContributorFactory; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; - -public class StartClientWidgetFactory implements INamedWidgetContributorFactory -{ - private IWebServiceClient webserviceClient_; - - public INamedWidgetContributor getFirstNamedWidget() - { - IServer server = null; - - if( webserviceClient_ != null ) - { - server = ServerCore.findServer(webserviceClient_.getWebServiceClientInfo().getServerInstanceId() ); - } - - if( server != null && server.getServerState() != IServer.STATE_STARTED ) - { - return new StartClientWidgetContributor( server ); - } - - return null; - } - - public INamedWidgetContributor getNextNamedWidget( INamedWidgetContributor widgetContributor) - { - return null; - } - - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - dataRegistry.addMapping( PreClientDevelopCommand.class, "WebService", StartClientWidgetFactory.class ); - } - - public void setWebService( IWebServiceClient webserviceClient ) - { - webserviceClient_ = webserviceClient; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartServerWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartServerWidget.java deleted file mode 100644 index 17ce11172..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartServerWidget.java +++ /dev/null @@ -1,444 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.server; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.jface.wizard.ProgressMonitorPart; -import org.eclipse.jst.ws.internal.consumption.command.common.StartServerCommand; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -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.Display; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.ui.eclipse.EclipseEnvironment; -import org.eclipse.wst.command.internal.env.ui.eclipse.EclipseStatusHandler; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.context.TransientResourceContext; -import org.eclipse.wst.common.environment.NullStatusHandler; -import org.eclipse.wst.server.core.IServer; - -public class StartServerWidget extends SimpleWidgetDataContributor -{ - private IServer server_; - private IStatus status_; - private Listener statusListener_; - private Button button_; - private JobChangeAdapter jobChangeAdapter_; - private Text serverStateText_; - private ProgressMonitorPart progressMonitor_; - private MessageUtils msgUtils_; - private String pluginId_; - private Composite buttonGroup_; - - /*CONTEXT_ID SSWP0001 Start the server button. */ - private String INFOPOP_SSWP_SERVER_BUTTON = "SSWP0001"; - - public StartServerWidget( IServer server ) - { - pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - msgUtils_ = new MessageUtils( pluginId_ + ".plugin", this ); - - server_ = server; - - jobChangeAdapter_ = new JobChangeAdapter() - { - public void done(final IJobChangeEvent event) - { - Display.getDefault().asyncExec( new Runnable() - { - public void run() - { - if( !progressMonitor_.isDisposed() ) - { - setServerState(); - progressMonitor_.done(); - reportErrorIfRequired( (StartServerJob)event.getJob() ); - } - } - }); - } - }; - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) - { - statusListener_ = statusListener; - - UIUtils uiUtils = new UIUtils( msgUtils_, pluginId_ ); - Composite group = uiUtils.createComposite( parent, 1 ); - - Text text1 = uiUtils.createText( group, null, null, null, SWT.READ_ONLY ); - text1.setText( msgUtils_.getMessage( "LABEL_START_SERVER_TEXT1", new String[]{ server_.getName() } )); - - Text text2 = uiUtils.createText( group, null, null, null, SWT.READ_ONLY ); - text2.setText( msgUtils_.getMessage( "LABEL_START_SERVER_TEXT2", new String[]{ server_.getName() } )); - - Text text3 = uiUtils.createText( group, null, null, null, SWT.READ_ONLY ); - text3.setText( msgUtils_.getMessage( "LABEL_START_SERVER_TEXT3", new String[]{ server_.getName() } )); - - Text text4 = uiUtils.createText( group, null, null, null, SWT.READ_ONLY ); - text4.setText( msgUtils_.getMessage( "LABEL_START_SERVER_TEXT4", new String[]{ server_.getName() } )); - - buttonGroup_ = uiUtils.createComposite( group, 2,-1, 0 ); - serverStateText_ = uiUtils.createText( buttonGroup_, null, null, null, SWT.READ_ONLY ); - serverStateText_.setLayoutData( new GridData() ); - - button_ = uiUtils.createPushButton( buttonGroup_, - "LABEL_START_SERVER_BUTTON", - "TOOLTIP_START_SERVER_BUTTON", - INFOPOP_SSWP_SERVER_BUTTON ); - - button_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - serverStateText_.setText( getStateMessage( "TEXT_SERVER_STATUS", "TEXT_SERVER_STARTING" ) ); - progressMonitor_.beginTask( getStateMessage( "TEXT_SERVER_MSG", "TEXT_SERVER_STARTING" ), IProgressMonitor.UNKNOWN ); - button_.setEnabled( false ); - buttonGroup_.pack(); - startServerJob(); - } - } ); - - progressMonitor_ = new ProgressMonitorPart( group, new GridLayout() ); - progressMonitor_.setLayoutData( new GridData( GridData.FILL_HORIZONTAL )); - - setServerState(); - return this; - } - - public IStatus getStatus() - { - return status_; - } - - private void setServerState() - { - int state = server_.getServerState(); - - switch( state ) - { - case IServer.STATE_STARTED: - { - status_ = Status.OK_STATUS; - button_.setEnabled( false ); - serverStateText_.setText( getStateMessage( "TEXT_SERVER_STATUS", "TEXT_SERVER_STARTED" ) ); - - break; - } - - case IServer.STATE_STARTING: - { - status_ = StatusUtils.errorStatus( "" ); - button_.setEnabled( false ); - serverStateText_.setText( getStateMessage( "TEXT_SERVER_STATUS", "TEXT_SERVER_STARTING" ) ); - progressMonitor_.beginTask( getStateMessage( "TEXT_SERVER_MSG", "TEXT_SERVER_STARTING" ), IProgressMonitor.UNKNOWN ); - - // The server is still starting so we need to reconnect to the job - // that is starting it. - startServerJob(); - break; - } - - default: - { - status_ = StatusUtils.errorStatus( "" ); - button_.setEnabled( true ); - serverStateText_.setText( getStateMessage( "TEXT_SERVER_STATUS", "TEXT_SERVER_STOPPED" ) ); - break; - } - }; - - statusListener_.handleEvent( null ); - buttonGroup_.pack(); - } - - private String getStateMessage( String mainKey, String subKey ) - { - return msgUtils_.getMessage( mainKey, new String[]{ msgUtils_.getMessage( subKey ) } ); - } - - // Connect to an existing server thread otherwise start a new one. - private void startServerJob() - { - IJobManager jobManager = Platform.getJobManager(); - Job[] jobs = jobManager.find( StartServerFamily ); - StartServerJob startServerJob = null; - - // There may be more than one job starting for different servers. - // Therefore, we need to find the one for our server if it is available. - for( int index = 0; index < jobs.length; index++ ) - { - StartServerJob jobFound = (StartServerJob)jobs[index]; - - if( jobFound.getServer() == server_ ) - { - startServerJob = jobFound; - break; - } - } - - if( startServerJob != null ) - { - synchronized( StartServerFamily ) - { - IStatus status = startServerJob.getStatus(); - - // We are using status to determine if the job has completed or not. - // Normally, we would not get here if the job had already completed, - // but there is a slim window where the job manager gives us the job - // and then it immediately completes. - if( status == null ) - { - // The job had not completed yet so we will add a job change listener. - // We are adding the job listener here so that we don't have to assume - // that this instance of this widget is the same as the previous instance. - // If startServerJob already has "jobChangeAdapter_" added to it this - // method call will not have an effect.(Which is what we want.) - startServerJob.addJobChangeListener( jobChangeAdapter_ ); - - // Note: this job was reporting progress to different progressMonitor_ - // control. We need to tell the job that it should report progress - // to our new progressMonitor_ control on this wizard page. - ProgressMonitorWrapper monitor = (ProgressMonitorWrapper)startServerJob.getMonitor(); - monitor.setMonitor( progressMonitor_ ); - } - else - { - // The job completed before we had a chance to add the job change listener - // Therefore, we will just call jobChangeAdapter_ directly to notify - // the UI that the job has completed. - jobChangeAdapter_.done( null ); - } - } - } - else - { - startServerJob = new StartServerJob(); - startServerJob.addJobChangeListener( jobChangeAdapter_ ); - startServerJob.schedule(); - } - } - - private void reportErrorIfRequired( StartServerJob serverJob ) - { - IStatus status = serverJob.getStatus(); - - if( status.getSeverity() == Status.ERROR ) - { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - EclipseStatusHandler handler = new EclipseStatusHandler( shell ); - - handler.reportError( status ); - } - } - - final private static String StartServerFamily = "StartServerFamily"; - - // This class is used to start up the server in an Eclipse job. - private class StartServerJob extends Job - { - private IStatus status_ = null; - private ProgressMonitorWrapper envMonitor_; - - public StartServerJob() - { - super( "StartServerJob" ); - - envMonitor_ = new ProgressMonitorWrapper( progressMonitor_ ); - } - - public IServer getServer() - { - return server_; - } - - public ProgressMonitorWrapper getMonitor() - { - return envMonitor_; - } - - public boolean belongsTo(Object family) - { - return family == StartServerFamily; - } - - protected IStatus run(IProgressMonitor monitor) - { - NullStatusHandler handler = new NullStatusHandler(); - TransientResourceContext resourceContext = new TransientResourceContext(); - EclipseEnvironment environment = new EclipseEnvironment( null,resourceContext, handler ); - StartServerCommand serverCommand = new StartServerCommand( false, false ); - - serverCommand.setServerInstanceId( server_.getId() ); - serverCommand.setEnvironment( environment ); - - try - { - setStatus( serverCommand.execute( envMonitor_, null ) ); - } - catch( Throwable exc ) - { - exc.printStackTrace(); - setStatus( StatusUtils.errorStatus( exc ) ); - } - - return Status.OK_STATUS; - } - - // Calls to this method need to first synchronize on the - // StartServerFamily object. - public IStatus getStatus() - { - return status_; - } - - private void setStatus( IStatus status ) - { - synchronized( StartServerFamily ) - { - status_ = status; - } - } - } - - private class ProgressMonitorWrapper implements IProgressMonitor - { - private IProgressMonitor monitor_ = new NullProgressMonitor(); - - public ProgressMonitorWrapper( IProgressMonitor monitor ) - { - monitor_ = monitor; - } - - public void setMonitor( IProgressMonitor monitor ) - { - monitor_ = monitor; - } - - public void beginTask(final String name, final int totalWork) - { - Display.getDefault().asyncExec( new Runnable() - { - public void run() - { - if( !progressMonitor_.isDisposed() ) - { - monitor_.beginTask( name, totalWork ); - } - } - } ); - } - - public void done() - { - Display.getDefault().asyncExec( new Runnable() - { - public void run() - { - if( !progressMonitor_.isDisposed() ) - { - monitor_.done(); - } - } - } ); - } - - public void internalWorked(final double work) - { - Display.getDefault().asyncExec( new Runnable() - { - public void run() - { - if( !progressMonitor_.isDisposed() ) - { - monitor_.internalWorked( work ); - } - } - } ); - } - - public boolean isCanceled() - { - return progressMonitor_.isDisposed() ? false : monitor_.isCanceled(); - } - - public void setCanceled(boolean value) - { - if( !progressMonitor_.isDisposed() ) - { - monitor_.setCanceled( value ); - } - } - - public void setTaskName(final String name) - { - Display.getDefault().asyncExec( new Runnable() - { - public void run() - { - if( !progressMonitor_.isDisposed() ) - { - monitor_.setTaskName( name ); - } - } - } ); - } - - public void subTask( final String name) - { - Display.getDefault().asyncExec( new Runnable() - { - public void run() - { - if( !progressMonitor_.isDisposed() ) - { - monitor_.subTask( name ); - } - } - } ); - } - - public void worked(final int work) - { - Display.getDefault().asyncExec( new Runnable() - { - public void run() - { - if( !progressMonitor_.isDisposed() ) - { - monitor_.worked( work ); - } - } - } ); - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractHandlersWidgetDefaultingCmd.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractHandlersWidgetDefaultingCmd.java deleted file mode 100644 index 0514a0324..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractHandlersWidgetDefaultingCmd.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.List; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Environment; - - -/** - * AbstractHandlersWidgetDefaultingCmd - * - * Initialize and load the handlers data - */ -public abstract class AbstractHandlersWidgetDefaultingCmd extends AbstractDataModelOperation -{ - - private IStructuredSelection initialSelection_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); - IStatus status = Status.OK_STATUS; - - IStructuredSelection selection = initialSelection_; - if (selection == null) { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED") ); - env.getStatusHandler().reportError(status); - return status; - } - - - return status; - - } - - - public List getClientHandlers(){ - return null; - } - - public void setInitialSelection(IStructuredSelection initSelection){ - this.initialSelection_ = initSelection; - } - - public IStructuredSelection getInitialSelection(){ - return this.initialSelection_; - } - - protected IResource getResourceFromInitialSelection() - { - if (initialSelection_ != null && initialSelection_.size() == 1) - { - Object obj = initialSelection_.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - return resource; - } catch(CoreException e) - { - return null; - } - } - } - return null; - } - - public IProject getProject(){ - - IResource resource = getResourceFromInitialSelection(); - if (resource != null) - { - return ResourceUtils.getProjectOf( resource.getFullPath() ); - } - - return null; - } - - public String getComponentName(){ - IResource resource = getResourceFromInitialSelection(); - if (resource!=null) { - IPath absolutePath = resource.getFullPath(); - if (absolutePath.isAbsolute()) { - return absolutePath.segment(1); - } - } - return null; - } - -// public WebServiceEditModel getWebServiceEditModel() { -// WebServicesManager wsm = new WebServicesManager(); -// IProject project = getProject(); -// return wsm.getWSEditModel(project); -// } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AddHandlerDialog.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AddHandlerDialog.java deleted file mode 100644 index cf0081546..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AddHandlerDialog.java +++ /dev/null @@ -1,266 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on May 12, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jdt.core.IType; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.jst.ws.internal.ui.dialog.DialogUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; - - - -public class AddHandlerDialog extends Dialog implements Listener { - - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - private MessageUtils msgUtils_; - private boolean validateOn_; - private boolean isClient_; - private String className; - private String name; - private String selectedPortName; - - private Text classNameText; - private Text nameText; - private Combo portNameCombo; - - // ----TOOLTIPS Section---- - /* CONTEXT_ID AHDL0001 for the Handler Config Page */ - private final String INFOPOP_TEXT_HANDLER_NAME = "AHDL0001"; //$NON-NLS-1$ - private final String TOOLTIP_TEXT_HANDLER_NAME = "TOOLTIP_TEXT_HANDLER_NAME"; - - /* CONTEXT_ID AHDL0002 for the Handler Config Page */ - private final String INFOPOP_TEXT_HANDLER_CLASS = "AHDL0002"; //$NON-NLS-1$ - private final String TOOLTIP_TEXT_HANDLER_CLASS = "TOOLTIP_TEXT_HANDLER_CLASS"; - - /* CONTEXT_ID AHDL0001 for the Handler Config Page */ - private final String INFOPOP_TEXT_HANDLER_PORT = "AHDL0003"; //$NON-NLS-1$ - private final String TOOLTIP_TEXT_HANDLER_PORT = "TOOLTIP_TEXT_HANDLER_PORT"; - - private Button beanClassBrowseButton_; - /*CONTEXT_ID PBCL0003 for the Bean Class Browse button of the Bean Selection Page*/ - private String INFOPOP_PBCL_BUTTON_BEAN_CLASS_BROWSE = "PBCL0003"; - - public AddHandlerDialog( Shell shell, boolean isClientHandler) - { - super(shell); - isClient_ = isClientHandler; - } - - protected Control createContents(Composite parent) { - Composite comp = (Composite) super.createContents(parent); - parent.getShell().pack(); - return comp; - } - - protected Control createDialogArea(Composite parent) { - validateOn_ = false; - msgUtils_ = new MessageUtils(WebServiceConsumptionUIPlugin.ID + ".plugin", this); - UIUtils uiUtils = new UIUtils(msgUtils_, pluginId_); - - Shell thisShell = parent.getShell(); - if (thisShell == null) { - thisShell = createShell(); - } - thisShell.setText(msgUtils_.getMessage("DIALOG_TITLE_WS_ADD_HANDLER")); - - Composite composite = (Composite) super.createDialogArea(parent); - - Composite sourceLocationComp = uiUtils.createComposite(composite, 3); - - classNameText = uiUtils.createText(sourceLocationComp, "LABEL_TEXT_HANDLER_CLASS", TOOLTIP_TEXT_HANDLER_CLASS, INFOPOP_TEXT_HANDLER_CLASS, SWT.SINGLE | SWT.BORDER); - classNameText.addListener(SWT.Modify,this); - - beanClassBrowseButton_ = uiUtils.createPushButton( sourceLocationComp, "BUTTON_BROWSE_CLASSES", - "TOOLTIP_PBCL_BUTTON_BEAN_CLASS_BROWSE", - INFOPOP_PBCL_BUTTON_BEAN_CLASS_BROWSE ); - beanClassBrowseButton_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleBrowseClasses(); - } - } ); - - nameText = uiUtils.createText(sourceLocationComp, "LABEL_TEXT_HANDLER_NAME", TOOLTIP_TEXT_HANDLER_NAME, INFOPOP_TEXT_HANDLER_NAME, SWT.SINGLE | SWT.BORDER ); - nameText.addListener(SWT.Modify, this); - - // dummy label for column 3. - new Label( sourceLocationComp, SWT.NONE ); - - if (!isClient_){ - portNameCombo = uiUtils.createCombo(sourceLocationComp, "LABEL_TEXT_HANDLER_PORT", TOOLTIP_TEXT_HANDLER_PORT, INFOPOP_TEXT_HANDLER_PORT, SWT.SINGLE | SWT.BORDER ); - portNameCombo.addListener(SWT.Modify, this); - - // dummy label for column 3. - new Label( sourceLocationComp, SWT.NONE ); - } - validateOn_ = true; - return composite; - } - - private void handleBrowseClasses() - { - Shell shell = getShell(); - IType itype = DialogUtils.browseClassesAsIType(shell, ResourcesPlugin.getWorkspace().getRoot().getProjects(), new ProgressMonitorDialog(shell)); - - if( itype != null ) - { - classNameText.setText(itype.getFullyQualifiedName()); - } - } - - /* (non-Javadoc) - * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) - */ - public void handleEvent(Event event) { - if (!validateOn_) - return; - if (classNameText == event.widget) { - handleClassNameTextEvent(); - validateTextFieldEntries(); - return; - } - if (nameText == event.widget) { - handleNameTextEvent(); - validateTextFieldEntries(); - return; - } - if (portNameCombo == event.widget) { - handlePortNameTextEvent(); - validateTextFieldEntries(); - return; - } - } - - private void handleClassNameTextEvent(){ - className = classNameText.getText(); - if (className.lastIndexOf(".java") != -1){ - nameText.setText(className.substring(0, className.lastIndexOf(".java"))); - } - else { - nameText.setText(className); - } - - if (className.lastIndexOf(".") != -1){ - nameText.setText(className.substring(className.lastIndexOf(".")+1, className.length())); - } - name = nameText.getText(); - } - - private void handleNameTextEvent() { - name = nameText.getText(); - - } - - private void handlePortNameTextEvent(){ - selectedPortName = portNameCombo.getText(); - } - - private void disableOKButton() { - if (getButton(0) != null) - getButton(0).setEnabled(false); - } - - private void enableOKButton() { - if (getButton(0) != null) - getButton(0).setEnabled(true); - } - - private void validateTextFieldEntries(){ - if (classNameText.getText().equals("")){ - disableOKButton(); - return; - } - if (nameText.getText().equals("")){ - disableOKButton(); - return; - } - if (!isClient_){ - if (portNameCombo.getText()!=null && portNameCombo.getText().equals("")){ - disableOKButton(); - return; - } - else if (portNameCombo.getText()==null) { - disableOKButton(); - return; - } - } - - enableOKButton(); - - - } - - /** - * @return Returns the className. - */ - public String getClassName() { - if (className.lastIndexOf(".java") != -1){ - return className.substring(0, className.lastIndexOf(".java")); - } - else { - return className; - } - } - /** - * @param className The className to set. - */ - public void setClassName(String className) { - this.className = className; - } - /** - * @return Returns the name. - */ - public String getName() { - return name; - } - /** - * @param name The name to set. - */ - public void setName(String name) { - this.name = name; - } - /** - * @return Returns the portName. - */ - public String getPortName() { - return selectedPortName; - } - /** - * @param portName The portName to set. - */ - public void setPortNames(String[] portNames) { - portNameCombo.setItems(portNames); - portNameCombo.select(0); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/CheckWSDLValidationCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/CheckWSDLValidationCommand.java deleted file mode 100644 index 8aa7f35f8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/CheckWSDLValidationCommand.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.ValidateWSDLJob; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.plugin.WSPlugin; - - -public class CheckWSDLValidationCommand extends AbstractDataModelOperation -{ - private static MessageUtils msgUtils_; - - public CheckWSDLValidationCommand () { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - IJobManager jobManager = Platform.getJobManager(); - Job[] jobs = jobManager.find( ValidateWSDLJob.VALIDATE_WSDL_JOB_FAMILY ); - ValidateWSDLJob existingValidateWSDLJob = null; - - if( jobs.length > 0 ) - { - for (int i=0; i<jobs.length; i++) { - existingValidateWSDLJob = (ValidateWSDLJob)jobs[i]; - - if (existingValidateWSDLJob.getState() != Job.NONE) { - if (ignoreWSDLValidation(env)) { - // if don't want to wait for validation, cancel existing validation job - existingValidateWSDLJob.cancel(); - return Status.OK_STATUS; - } else { - // wait for WSDL validation - return StatusUtils.errorStatus( msgUtils_.getMessage("WAIT_FOR_WSDL") ); - } - } - } - } - - return Status.OK_STATUS; - - } - - private boolean ignoreWSDLValidation(Environment env) { - if (!WSPlugin.getInstance().getWaitForWSDLValidationContext().getPersistentWaitForWSDLValidation()) - return true; // do not want to wait for WSDL validation, i.e. Ignore all - - // give a warning message with the options to stop, ignore this one, or - // ignore all coming messages - IStatus status_ = StatusUtils.warningStatus( msgUtils_.getMessage("STILL_VALIDATING_WSDL") ); - // adding all messages from WSI Incompliances - - Choice ignoreChoice = new Choice('I', msgUtils_ - .getMessage("IGNORE_LABEL"), msgUtils_ - .getMessage("IGNORE_DESCRIPTION")); - Choice ignoreAllChoice = new Choice('A', msgUtils_ - .getMessage("IGNORE_ALL_LABEL"), msgUtils_ - .getMessage("IGNORE_ALL_DESCRIPTION")); - Choice cancelChoice = new Choice('C', msgUtils_ - .getMessage("CANCEL_LABEL"), msgUtils_ - .getMessage("CANCEL_DESCRIPTION")); - - Choice result = env.getStatusHandler().report(status_, - new Choice[] { ignoreChoice, ignoreAllChoice, cancelChoice }); - - // if the user closes the message box or selects ignore continue - if (result == null - || (result.getLabel().equals(ignoreChoice.getLabel()))) { - return true; - // if the user selects ignore all, change the preference - } else if (result.getLabel().equals(ignoreAllChoice.getLabel())) { - // update ignore WSDL validation preference - WSPlugin.getInstance().getWaitForWSDLValidationContext().setWaitForWSDLValidation(false); - return true; - } - // if the user selects to cancel , do not continue with the command - else if (result.getLabel().equals(cancelChoice.getLabel())) { - return false; - } - return true; - } - - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetDefaultingCommand.java deleted file mode 100644 index da2558ba3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetDefaultingCommand.java +++ /dev/null @@ -1,270 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.Collection; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.j2ee.internal.webservice.WebServiceNavigatorGroupType; -import org.eclipse.jst.j2ee.internal.webservice.helper.WebServicesManager; -import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.jst.j2ee.webservice.wsclient.Handler; -import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; -import org.eclipse.jst.j2ee.webservice.wsclient.WebServicesResource; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.environment.Environment; - -/** - * ClientHandlersWidgetDefaultingCommand - * - * Initialize and load the handlers data - */ -public class ClientHandlersWidgetDefaultingCommand extends AbstractHandlersWidgetDefaultingCmd { - - private HandlerTableItem[] handlers_; - - private MessageUtils msgUtils_; - - private Hashtable wsRefsToHandlersTable_; - - private Hashtable refNameToServiceRefObj_; - -// private WebServiceEditModel wsEditModel_; - - private WebServicesManager webServicesManager_; - - private IProject project_; - - private String componentName_; - - private WebServicesResource wsClientRes_; - - private String serviceRefName_ = null; - - private Collection wsServiceRefs_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - IStatus status = Status.OK_STATUS; - - webServicesManager_ = new WebServicesManager(); - - IStructuredSelection selection = getInitialSelection(); - if (selection == null) { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED") ); - env.getStatusHandler().reportError(status); - return status; - } - - status = processHandlers(); - return status; - - } - - public IStatus processHandlers() { - try { - Vector handlers = new Vector(); - wsRefsToHandlersTable_ = new Hashtable(); - refNameToServiceRefObj_ = new Hashtable(); - -// wsEditModel_ = getWebServiceEditModel(); - - wsServiceRefs_ = getWSServiceRefsFromSelection(); - - if (wsServiceRefs_ != null) { - Iterator wsRefsIter = wsServiceRefs_.iterator(); - for (int i = 0; i < wsServiceRefs_.size(); i++) { - - ServiceRef wsServiceRef = (ServiceRef) wsRefsIter.next(); - - List wsHandlers = wsServiceRef.getHandlers(); - HandlerTableItem[] handlerItems = new HandlerTableItem[wsHandlers.size()]; - for (int k = 0; k < wsHandlers.size(); k++) { - - Handler wsHandler = (Handler) wsHandlers.get(k); - - HandlerTableItem handlerItem = new HandlerTableItem(); - handlerItem.setHandler(wsHandler); - handlerItem.setHandlerName(wsHandler.getHandlerName()); - handlerItem.setHandlerClassName(wsHandler.getHandlerClass().getQualifiedName()); - handlerItem.setWsDescRef(wsServiceRef); - handlerItems[k] = handlerItem; - handlers.add(handlerItem); - } - String wsServiceRefName = wsServiceRef.getServiceRefName(); - wsRefsToHandlersTable_.put(wsServiceRefName, handlerItems); - refNameToServiceRefObj_.put(wsServiceRefName, wsServiceRef); - - } - - handlers_ = (HandlerTableItem[]) handlers.toArray(new HandlerTableItem[0]); - } - } - catch (Exception e) { - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED"), e); - } - return Status.OK_STATUS; - } - - public HandlerTableItem[] getAllHandlers() { - return this.handlers_; - } - - public Hashtable getHandlers() { - return wsRefsToHandlersTable_; - } - - /** - * @return Returns the isGenSkeletonEnabled_. - */ - public boolean getGenSkeletonEnabled() { - return true; - } - - /** - * @return Returns the sourceOutputLocation_. - */ - public IPath[] getSourceOutputLocation() { - IPath[] locations = null; - if (project_==null) - project_ = getProject(); - if (project_ != null) { - locations = ResourceUtils.getAllJavaSourceLocations(project_); - } - - return locations; - } - - /** - * @return Returns the wsEditModel. - */ -// public WebServiceEditModel getWsEditModel() { -// return wsEditModel_; -// } - - public String getServiceRefName() { - return this.serviceRefName_; - } - - public WebServicesResource getWsClientResource() { - return wsClientRes_; - } - - public IProject getClientProject() { - return project_; - } - - private Collection getWSServiceRefsFromSelection() { - - IStructuredSelection initSel = getInitialSelection(); - if (initSel != null && initSel.size() == 1) { - Object obj = initSel.getFirstElement(); - ServiceRef serviceRef = null; - if (obj instanceof ServiceRef) { - // Client ServiceRef - serviceRef = (ServiceRef) obj; - serviceRefName_ = serviceRef.getServiceRefName(); - project_ = ProjectUtilities.getProject(serviceRef); - } - else if (obj instanceof WebServiceNavigatorGroupType) { - WebServiceNavigatorGroupType wsngt = (WebServiceNavigatorGroupType) obj; - serviceRef = wsngt.getServiceRef(); - serviceRefName_ = serviceRef.getServiceRefName(); - project_ = ProjectUtilities.getProject(serviceRef); - } - - if (project_==null){ - project_ = getProject(); - } - if (project_==null){ - return null; - } - - // get module name - componentName_ = getComponentName(); - - - List clientWSResourceList = webServicesManager_.get13ServiceRefs(project_); - if (!clientWSResourceList.isEmpty()) - wsClientRes_ = (WebServicesResource)clientWSResourceList.get(0); - - if (J2EEUtils.isWebComponent(project_, componentName_)) { - WebArtifactEdit webEdit = null; - try { - IVirtualComponent vc = ComponentCore.createComponent(project_, componentName_); - webEdit = WebArtifactEdit.getWebArtifactEditForRead(vc); - if (webEdit != null) - { - WebApp webApp = (WebApp) webEdit.getDeploymentDescriptorRoot(); - if (webApp != null) { - return webServicesManager_.getServiceRefs(webApp); - } - } - } - finally{ - if(webEdit!=null) - webEdit.dispose(); - } - } - //TODO Remove old Nature refs -// else if (J2EEUtils.isAppClientComponent(project_, componentName_)){ -// ApplicationClientNatureRuntime rt = ApplicationClientNatureRuntime.getRuntime(project_); -// if (rt!=null) { -// ApplicationClient appClient = rt.getApplicationClient(); -// if (appClient != null){ -// return webServicesManager_.getServiceRefs(appClient); -// } -// } -// } -// else if (J2EEUtils.isEJBComponent(project_, componentName_)){ -// EJBNatureRuntime rt = EJBNatureRuntime.getRuntime(project_); -// if(rt!=null){ -// EJBJar ejbJar = rt.getEJBJar(); -// if (ejbJar !=null){ -// return webServicesManager_.getServiceRefs(ejbJar); -// } -// } -// } - - - } - return null; - } - - public Hashtable getRefNameToServiceRef() { - return this.refNameToServiceRefObj_; - } - - public Collection getWsServiceRefs(){ - return this.wsServiceRefs_; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java deleted file mode 100644 index e13fdc27e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.internal.plugin.JavaEMFNature; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaRefFactory; -import org.eclipse.jst.j2ee.webservice.wsclient.Handler; -import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; -import org.eclipse.jst.j2ee.webservice.wsclient.WebServicesResource; -import org.eclipse.jst.j2ee.webservice.wsclient.Webservice_clientFactory; -import org.eclipse.jst.j2ee.webservice.wsclient.internal.impl.Webservice_clientFactoryImpl; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopyUtility; -import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel; - -/* - * Provide a way to externalize the edited fields and create new handlers - * - */ -public class ClientHandlersWidgetOutputCommand extends AbstractDataModelOperation -{ - - //private List handlerTableItems_; - private Hashtable oldWSServiceRefsToHandlersTable_; - - private Hashtable newWSServiceRefsToHandlersTable_; - -// private WebServiceEditModel wsEditModel_; - - private Hashtable handlersTable_; - - private IProject project_; - - private Collection wsServiceRefs_; - - private EditModel editModel_; - - private Object accessorKey_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - IStatus status = Status.OK_STATUS; - - try { - - JavaEMFNature jMOF = (JavaEMFNature) JavaEMFNature.createRuntime(project_); - - oldWSServiceRefsToHandlersTable_ = new Hashtable(); - newWSServiceRefsToHandlersTable_ = new Hashtable(); - - if (wsServiceRefs_ != null) { - Iterator wsRefsIter = wsServiceRefs_.iterator(); - for (int i = 0; i < wsServiceRefs_.size(); i++) { - - ServiceRef wsServiceRef = (ServiceRef) wsRefsIter.next(); - - List wsHandlers = wsServiceRef.getHandlers(); - oldWSServiceRefsToHandlersTable_.put(wsServiceRef, wsHandlers); - newWSServiceRefsToHandlersTable_.put(wsServiceRef, new ArrayList()); - } - - Enumeration e = handlersTable_.keys(); - while (e.hasMoreElements()) { - - String serviceRefName = (String) e.nextElement(); - List handlerTableItems_ = (List) handlersTable_.get(serviceRefName); - if (handlerTableItems_ != null) { - // form Handler tables - for (int i = 0; i < handlerTableItems_.size(); i++) { - - HandlerTableItem hti = (HandlerTableItem) handlerTableItems_.get(i); - Object wsModelRef = hti.getWsDescRef(); - if (wsModelRef != null && wsModelRef instanceof ServiceRef) { - ServiceRef wsRef = (ServiceRef) wsModelRef; - - Object handler = hti.getHandler(); - if (handler != null && handler instanceof Handler) { - // clone it - Handler clonedHandler = (Handler) EtoolsCopyUtility.createCopy((Handler) handler); - ((List) newWSServiceRefsToHandlersTable_.get(wsRef)).add(clonedHandler); - } - else { - // create it - Webservice_clientFactory wsClientFactory = new Webservice_clientFactoryImpl(); - Handler newHandler = wsClientFactory.createHandler(); - newHandler.setHandlerName(hti.getHandlerName()); - - JavaClass javaClass = (JavaClass)JavaRefFactory.eINSTANCE.reflectType(hti.getHandlerClassName(), jMOF.getResourceSet()); - if (javaClass != null) { - newHandler.setHandlerClass(javaClass); - } - - ((List) newWSServiceRefsToHandlersTable_.get(wsRef)).add(newHandler); - } - - } - - } - } - } - - // add handlers to ports - addHandlersToServiceRefs(); - getJ2EEEditModel(); - - // save the resource - //TODO Remove old Nature refs -// if (J2EEUtils.getJ2EEVersion(project_) == J2EEVersionConstants.J2EE_1_4_ID) { -// editModel_.save(accessorKey_); -// } -// else { -// if (wsClientRes_!=null) -// wsClientRes_.save(new HashMap()); -// } - } - } - catch (Exception e) - { - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED"), e); - } - finally { - if (editModel_ != null) - editModel_.releaseAccess(accessorKey_); - } - return status; - } - - private void addHandlersToServiceRefs() { - try { - Enumeration refsToHandlers = newWSServiceRefsToHandlersTable_.keys(); - while (refsToHandlers.hasMoreElements()) { - ServiceRef serviceRef = (ServiceRef) refsToHandlers.nextElement(); - if (serviceRef != null) { - - List handlers = (List) newWSServiceRefsToHandlersTable_.get(serviceRef); - List modelHandlers = (List) oldWSServiceRefsToHandlersTable_.get(serviceRef); - modelHandlers.clear(); - modelHandlers.addAll(handlers); - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * @param handlerTableItems - * The handlerTableItems to set. - */ - // public void setAllHandlersList(List handlerTableItems) { - // this.handlerTableItems_ = handlerTableItems; - // } - public void setHandlersTable(Hashtable handlersTable) { - this.handlersTable_ = handlersTable; - } - - /** - * @param wsEditModel - * The wsEditModel to set. - */ -// public void setWsEditModel(WebServiceEditModel wsEditModel) { -// this.wsEditModel_ = wsEditModel; -// } - - public void setClientProject(IProject project) { - this.project_ = project; - } - - public void setWsClientResource(WebServicesResource wsRes) { - } - - public void setWsServiceRefs(Collection wsRefs) { - this.wsServiceRefs_ = wsRefs; - } - - public void getJ2EEEditModel() { - //TODO Remove old Nature refs -// accessorKey_ = new Object(); -// if (ResourceUtils.isWebProject(project_)) { -// J2EEWebNatureRuntime rt = J2EEWebNatureRuntime.getRuntime(project_); -// if (rt != null) { -// editModel_ = rt.getWebAppEditModelForWrite(accessorKey_); -// } -// } -// else if (ResourceUtils.isAppClientProject(project_)){ -// ApplicationClientNatureRuntime rt = ApplicationClientNatureRuntime.getRuntime(project_); -// if (rt!=null) { -// editModel_ = rt.getAppClientEditModelForWrite(accessorKey_); -// } -// } -// else if (ResourceUtils.isEJBProject(project_)){ -// EJBNatureRuntime rt = EJBNatureRuntime.getRuntime(project_); -// if(rt!=null){ -// editModel_ = rt.getEJBEditModelForWrite(accessorKey_); -// } -// } - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidget.java deleted file mode 100644 index 82b37bf18..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidget.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; - - -public class ClientWizardWidget extends SimpleWidgetDataContributor -{ - private WebServiceClientTypeWidget clientWidget_; - private PreferencesSelectionWidget preferencesWidget_; - - /*CONTEXT_ID PWPR0013 for the test service checkbox of the project page*/ - private String INFOPOP_PWPR_CHECKBOX_TEST_SERVICE = "PWPR0013"; - private Button testService_; - - /*CONTEXT_ID PWPR0014 for the monitor service checkbox of the project page*/ - private String INFOPOP_PWPR_CHECKBOX_MONITOR_SERVICE = "PWRPR0014"; - private Button monitorService; - - /*CONTEXT_ID PWPR0001 for the Project Page*/ - private String INFOPOP_PWPR_PAGE = "PWPR0001"; - - public WidgetDataEvents addControls( Composite parent, Listener statusListener) - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId + ".plugin", this ); - UIUtils utils = new UIUtils( msgUtils, pluginId ); - - PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, pluginId + "." + INFOPOP_PWPR_PAGE ); - - Composite clientComposite = utils.createComposite( parent, 1 ); - - clientWidget_ = new WebServiceClientTypeWidget(); - clientWidget_.addControls(clientComposite, statusListener ); - - - // Create test service check box. - Composite testGroup = utils.createComposite(clientComposite,1); - - testService_ = utils.createCheckbox( testGroup, "CHECKBOX_TEST_WEBSERVICE", - "TOOLTIP_PWPR_CHECKBOX_TEST_SERVICE", - INFOPOP_PWPR_CHECKBOX_TEST_SERVICE ); - - // Create monitor service check box. - monitorService = utils.createCheckbox(testGroup, "CHECKBOX_MONITOR_WEBSERVICE", "TOOLTIP_PWPR_CHECKBOX_MONITOR_SERVICE", INFOPOP_PWPR_CHECKBOX_MONITOR_SERVICE); - - // Create the preferences controls. - preferencesWidget_ = new PreferencesSelectionWidget(); - preferencesWidget_.addControls( clientComposite, statusListener ); - - return this; - } - - public void setResourceContext( ResourceContext context ) - { - preferencesWidget_.setResourceContext( context ); - } - - public ResourceContext getResourceContext() - { - return preferencesWidget_.getResourceContext(); - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer ids ) - { - clientWidget_.setTypeRuntimeServer( ids ); - } - - public TypeRuntimeServer getClientTypeRuntimeServer() - { - return clientWidget_.getTypeRuntimeServer(); - } - - public Boolean getTestService() - { - return new Boolean( testService_.getSelection() ); - } - - public void setTestService( Boolean value ) - { - testService_.setSelection( value.booleanValue() ); - } - - public Boolean getMonitorService() - { - return new Boolean(monitorService.getSelection()); - } - - public void setMonitorService(Boolean value) - { - monitorService.setSelection(value.booleanValue()); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetDefaultingCommand.java deleted file mode 100644 index 06a01bd84..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetDefaultingCommand.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.context.ScenarioContext; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; - - -public class ClientWizardWidgetDefaultingCommand extends AbstractDataModelOperation -{ - public Boolean getTestService() - { - return new Boolean( getScenarioContext().getTestWebService() ); - } - - public Boolean getMonitorService() - { - return new Boolean( getScenarioContext().getMonitorWebService()); - } - - public ResourceContext getResourceContext() - { - return WebServicePlugin.getInstance().getResourceContext(); - } - - // Current ScenarioContext is used to default the first page of the wizard. The - // properties in ScenarioContext are mapped individual. Therefore, ScenarioContext - // should not also be mapped. - protected ScenarioContext getScenarioContext() - { - return WebServicePlugin.getInstance().getScenarioContext(); - } - - // TODO Set client name defaults here. - public TypeRuntimeServer getClientTypeRuntimeServer() - { - // rskreg - //WebServiceClientTypeRegistry registry = WebServiceClientTypeRegistry.getInstance(); - String type = getScenarioContext().getClientWebServiceType(); - //String runtime = registry.getAllClientRuntimes()[0]; - String runtime = WebServiceRuntimeExtensionUtils.getAllClientRuntimes()[0]; - //String server = registry.getAllClientServerFactoryIds()[0]; - String server = WebServiceRuntimeExtensionUtils.getAllClientServerFactoryIds()[0]; - TypeRuntimeServer result = new TypeRuntimeServer(); - // rskreg - - result.setTypeId( type ); - result.setRuntimeId( runtime ); - result.setServerId( server ); - - return result; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetOutputCommand.java deleted file mode 100644 index 203c4963f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetOutputCommand.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; - - -public class ClientWizardWidgetOutputCommand extends AbstractDataModelOperation -{ - private boolean testService_; - private boolean monitorService; - private ResourceContext resourceContext_; - private TypeRuntimeServer clientIds_; - - public boolean getTestService() - { - return testService_; - } - - public void setTestService( boolean testService ) - { - testService_ = testService; - } - - public boolean getMonitorService() - { - return monitorService; - } - - public void setMonitorService(boolean monitorService) - { - this.monitorService = monitorService; - } - - public ResourceContext getResourceContext() - { - - return resourceContext_; - } - - public void setResourceContext( ResourceContext context ) - { - resourceContext_ = context; - } - - public TypeRuntimeServer getClientTypeRuntimeServer() - { - return clientIds_; - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer clientIds ) - { - clientIds_ = clientIds; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigClientHandlersTableWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigClientHandlersTableWidget.java deleted file mode 100644 index 2dae0b23d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigClientHandlersTableWidget.java +++ /dev/null @@ -1,585 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.List; -import java.util.Vector; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; - -/** - * ConfigClientHandlersTreeWidget - * - */ -public class ConfigClientHandlersTableWidget extends SimpleWidgetDataContributor { - - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - private MessageUtils msgUtils_ = null; - private Composite parent_; - private boolean isGenSkeletonEnabled_; - private String outputLocation_; - private Combo webServiceRefCombo_; - private Table handlersTable_; - private TableViewer tableViewer_; - private Button addButton_; - private Button removeButton_; - private Button genSkeletonRadioButton_; - private Combo sourceLocationCombo_; - - private Hashtable pathsTable_ = new Hashtable(); - private Hashtable wsRefsToHandlers_; - private Hashtable refNameToServiceRef_; - private Vector orderedHandlers_; - //private ServiceRef serviceRef_; - private String serviceRefName_; - private int DEFAULT_COLUMN_WIDTH = 150; - - // ----TOOLTIPS Section---- - /* CONTEXT_ID HDLR0001 for the Handler Config Page */ - private final String INFOPOP_HDLR_WS_HANDLERS = "HDLR0001"; //$NON-NLS-1$ - private final String TOOLTIP_EDIT_WS_HANDLERS = "TOOLTIP_EDIT_WS_HANDLERS"; - - /* CONTEXT_ID HDLR0002 for the Handler Config Page */ - private final String INFOPOP_HDLR_GEN_SKELETON = "HDLR0002"; //$NON-NLS-1$ - private final String TOOLTIP_BUTTON_GEN_SKELETON = "TOOLTIP_BUTTON_GEN_SKELETON"; - - /* CONTEXT_ID HDLR0003 for the Handler Config Page */ - private final String INFOPOP_COMBO_SOURCE_LOC = "HDLR0003"; //$NON-NLS-1$ - private final String TOOLTIP_COMBO_SOURCE_LOC = "TOOLTIP_COMBO_SOURCE_LOC"; - - /* CONTEXT_ID HDLR0004 for the Handler Config Page */ - private final String INFOPOP_WS_CLIENT_REF = "HDLR0004"; //$NON-NLS-1$ - private final String TOOLTIP_WS_CLIENT_REF = "TOOLTIP_WS_CLIENT_REF"; - - // ------------------------ - - public ConfigClientHandlersTableWidget() { - super(); - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) { - msgUtils_ = new MessageUtils(WebServiceConsumptionUIPlugin.ID + ".plugin", this); - UIUtils uiUtils = new UIUtils(msgUtils_, pluginId_); - - parent_ = parent; - - // Web service reference combo - Composite webServiceRefComp = uiUtils.createComposite(parent_, 2); - webServiceRefCombo_ = uiUtils.createCombo(webServiceRefComp, "LABEL_COMBO_WS_CLIENT_REF", TOOLTIP_WS_CLIENT_REF, INFOPOP_WS_CLIENT_REF, - SWT.READ_ONLY); - webServiceRefCombo_.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent evt) { - handleWebServiceRefCombo(evt); - } - }); - - Composite displayComp = new Composite(parent_, SWT.NONE); - GridLayout gridlayout = new GridLayout(2, false); - displayComp.setLayout(gridlayout); - displayComp.setLayoutData(uiUtils.createFillAll()); - - Composite handlersComp = uiUtils.createComposite(displayComp, 1); - GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING - | GridData.VERTICAL_ALIGN_FILL); - handlersComp.setLayoutData(griddata); - handlersComp.setSize(130, 600); - - Composite buttonsComp = uiUtils.createComposite(displayComp, 1); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - buttonsComp.setLayoutData(griddata); - - Text handlersText = new Text(handlersComp, SWT.READ_ONLY); - handlersText.setText(msgUtils_.getMessage("LABEL_HANDLERS_CONFIG")); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - handlersText.setLayoutData(gd); - - handlersTable_ = uiUtils.createTable(handlersComp, TOOLTIP_EDIT_WS_HANDLERS, INFOPOP_HDLR_WS_HANDLERS, SWT.MULTI | SWT.FULL_SELECTION); - handlersTable_.setHeaderVisible(true); - handlersTable_.setLinesVisible(true); - - // empty space - Label wsLabel = new Label(buttonsComp, SWT.NONE); - gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - wsLabel.setLayoutData(gd); - - Button moveUpButton = uiUtils.createPushButton(buttonsComp, "LABEL_BUTTON_MOVE_UP", null, null); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - moveUpButton.setLayoutData(griddata); - moveUpButton.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleMoveUpButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - - Button moveDownButton = uiUtils.createPushButton(buttonsComp, "LABEL_BUTTON_MOVE_DOWN", null, null); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - moveDownButton.setLayoutData(griddata); - moveDownButton.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleMoveDownButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - - // empty space - wsLabel = new Label(buttonsComp, SWT.NONE); - gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - wsLabel.setLayoutData(gd); - - addButton_ = uiUtils.createPushButton(buttonsComp, "LABEL_BUTTON_ADD", null, null); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - addButton_.setLayoutData(griddata); - addButton_.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleAddButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - - removeButton_ = uiUtils.createPushButton(buttonsComp, "LABEL_BUTTON_REMOVE", null, null); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - removeButton_.setLayoutData(griddata); - removeButton_.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleRemoveButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - enableRemove(false); - - // table stuff - String[] columns_ = new String[] { msgUtils_.getMessage("LABEL_HANDLER_NAME"), msgUtils_.getMessage("LABLE_HANDLER_CLASS")}; - - for (int i = 0; i < columns_.length; i++) { - TableColumn tableColumn = new TableColumn(handlersTable_, i); - tableColumn.setText(columns_[i]); - tableColumn.setAlignment(SWT.LEFT); - tableColumn.setWidth(DEFAULT_COLUMN_WIDTH); - tableColumn.setResizable(true); - } - - tableViewer_ = new TableViewer(handlersTable_); - Control control = tableViewer_.getControl(); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - control.setLayoutData(data); - - tableViewer_.setColumnProperties(columns_); - tableViewer_.setContentProvider(new ListContentProvider()); - tableViewer_.setLabelProvider(new ListLabelProvider()); - tableViewer_.addSelectionChangedListener(new ISelectionChangedListener() { - - public void selectionChanged(SelectionChangedEvent event) { - enableRemove(true); - } - }); - - // gen skeleton check box - genSkeletonRadioButton_ = uiUtils.createCheckbox(parent_, "LABEL_BUTTON_GEN_SKELETON", TOOLTIP_BUTTON_GEN_SKELETON, INFOPOP_HDLR_GEN_SKELETON); - genSkeletonRadioButton_.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent evt) { - handleGenSkeletonRadioButton(); - } - }); - - // source location combo - Composite sourceLocationComp = uiUtils.createComposite(parent_, 2); - sourceLocationCombo_ = uiUtils.createCombo(sourceLocationComp, "LABEL_COMBO_SOURCE_LOC", TOOLTIP_COMBO_SOURCE_LOC, INFOPOP_COMBO_SOURCE_LOC, - SWT.READ_ONLY); - sourceLocationCombo_.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent evt) { - handleSourceLocationCombo(evt); - } - }); - - return this; - } - - // Called at start - private void populateHandlersTable() { - try { - - int sizeOfHandlers = wsRefsToHandlers_.size(); - - String[] wsRefNames = (String[]) wsRefsToHandlers_.keySet().toArray(new String[0]); - webServiceRefCombo_.setItems(wsRefNames); - webServiceRefCombo_.select(0); - - if (sizeOfHandlers < 1) { - webServiceRefCombo_.select(0); - webServiceRefCombo_.setEnabled(false); - } - else { - if (serviceRefName_ != null) { - int index = webServiceRefCombo_.indexOf(serviceRefName_); - if (index != -1) webServiceRefCombo_.select(index); - } - else - webServiceRefCombo_.select(0); - } - - // get webServiceRef hint - String wsRef = webServiceRefCombo_.getText(); - - if (wsRefsToHandlers_.get(wsRef) != null) { - orderedHandlers_ = (Vector) wsRefsToHandlers_.get(wsRef); - tableViewer_.setInput(orderedHandlers_); - tableViewer_.refresh(); - } - } - catch (Exception e) { - e.printStackTrace(); - } - - } - - /** - * @return Returns the handlers. - */ - public List getAllHandlersList() { - // convert to a ArrayList and return as List - List list = new ArrayList(); - if (orderedHandlers_ != null && !orderedHandlers_.isEmpty()) list.addAll(orderedHandlers_); - - return list; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#getStatus() - */ - public IStatus getStatus() { - IStatus finalStatus = Status.OK_STATUS; - - return finalStatus; - } - - private void handleAddButtonSelected(SelectionEvent event) { - - AddHandlerDialog dialog = dialog = new AddHandlerDialog(parent_.getShell(), true); - dialog.create(); - dialog.getShell().setSize( 500, 200 ); - - int result = dialog.open(); - - if (result == Window.OK) { - String name = dialog.getName(); - String className = dialog.getClassName(); - - HandlerTableItem hi = new HandlerTableItem(); - hi.setHandlerName(name); - hi.setHandlerClassName(className); - String wsRefName = webServiceRefCombo_.getText(); - ServiceRef serviceRef = (ServiceRef) refNameToServiceRef_.get(wsRefName); - hi.setWsDescRef(serviceRef); - - orderedHandlers_ = (Vector) wsRefsToHandlers_.get(wsRefName); - orderedHandlers_.add(hi); - - } - - refresh(); - } - - private void handleRemoveButtonSelected(SelectionEvent event) { - handleDeleteKeyPressed(); - } - - private void handleMoveUpButtonSelected(SelectionEvent event) { - - int index = tableViewer_.getTable().getSelectionIndex(); - if (index != -1) { - if (index > 0) { - orderedHandlers_ = (Vector) wsRefsToHandlers_.get(webServiceRefCombo_.getText()); - Object object = orderedHandlers_.remove(index); - orderedHandlers_.insertElementAt(object, index - 1); - tableViewer_.refresh(); - } - } - - } - - private void handleMoveDownButtonSelected(SelectionEvent event) { - - int index = tableViewer_.getTable().getSelectionIndex(); - if (index != -1) { - if (index < orderedHandlers_.size() - 1) { - orderedHandlers_ = (Vector) wsRefsToHandlers_.get(webServiceRefCombo_.getText()); - Object object = orderedHandlers_.remove(index); - orderedHandlers_.insertElementAt(object, index + 1); - tableViewer_.refresh(); - } - } - - } - - public void handleSourceLocationCombo(SelectionEvent event) { - outputLocation_ = sourceLocationCombo_.getText(); - } - - public void handleGenSkeletonRadioButton() { - if (genSkeletonRadioButton_.isEnabled()) { - if (genSkeletonRadioButton_.getSelection()) - this.isGenSkeletonEnabled_ = true; - else - this.isGenSkeletonEnabled_ = false; - } - } - - public void handleWebServiceRefCombo(SelectionEvent event) { - - if (webServiceRefCombo_.isEnabled()) { - String webServiceRefName = webServiceRefCombo_.getText(); - Vector hndlers = (Vector) wsRefsToHandlers_.get(webServiceRefName); - //HandlerTableItem item = (HandlerTableItem)hndlers.get(0); - //serviceRef_ = (ServiceRef)item.getWsDescRef(); - if (hndlers != null) { - tableViewer_.setInput(hndlers); - tableViewer_.refresh(); - } - } - } - - /** - * @return Returns the isGenSkeletonEnabled_. - */ - public boolean isGenSkeletonEnabled_() { - return isGenSkeletonEnabled_; - } - - protected class ListLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - public String getColumnText(Object object, int columnIndex) { - - if (object instanceof HandlerTableItem) { - HandlerTableItem hti = (HandlerTableItem) object; - if (columnIndex == 0) { - - return hti.getHandlerName() != null ? hti.getHandlerName() : ""; - } - else if (columnIndex == 1) { return hti.getHandlerClassName() != null ? hti.getHandlerClassName() : ""; } - } - return null; - } - - } - - private void enableRemove(boolean enabled) { - removeButton_.setEnabled(enabled && !tableViewer_.getSelection().isEmpty()); - } - - protected class ListContentProvider implements IStructuredContentProvider { - - public Object[] getElements(Object element) { - if (element instanceof Vector) { return ((Vector) element).toArray(); } - return null; - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object old, Object newobj) { - } - - public boolean isDeleted(Object object) { - return false; - } - } - - private void handleDeleteKeyPressed() { - ISelection selection = tableViewer_.getSelection(); - if (selection != null && !selection.isEmpty() && (selection instanceof IStructuredSelection)) { - int selectionIndex = handlersTable_.getSelectionIndex(); - - orderedHandlers_ = (Vector) wsRefsToHandlers_.get(webServiceRefCombo_.getText()); - orderedHandlers_.remove(selectionIndex); - refresh(); - } - } - - public void refresh() { - try { - tableViewer_.setInput(null); - if (orderedHandlers_ != null) tableViewer_.setInput(orderedHandlers_); - tableViewer_.refresh(); - } - catch (Exception e) { - e.printStackTrace(); - } - } - - public void setGenSkeletonEnabled(boolean isGenSkeletonEnabled) { - this.isGenSkeletonEnabled_ = isGenSkeletonEnabled; - genSkeletonRadioButton_.setSelection(isGenSkeletonEnabled); - - } - - public boolean getGenSkeletonEnabled() { - return this.isGenSkeletonEnabled_; - } - - public void setSourceOutputLocation(IPath[] locations) { - if (locations[0]!=null) - this.outputLocation_ = locations[0].toString(); - else - return; - - String[] paths = new String[locations.length]; - for (int i = 0; i < locations.length; i++) { - paths[i] = locations[i].toString(); - pathsTable_.put(paths[i], locations[i]); - } - sourceLocationCombo_.setItems(paths); - sourceLocationCombo_.select(0); - - } - - public IPath getSourceOutputLocation() { - IPath outputPath = (IPath) pathsTable_.get(outputLocation_); - return outputPath; - } - - /** - * @return Returns the handlerClassNames. - */ - public String[] getHandlerClassNames() { - Vector handlerClasses = new Vector(); - - Enumeration e = wsRefsToHandlers_.keys(); - while (e.hasMoreElements()) { - - String wsRefName = (String) e.nextElement(); - orderedHandlers_ = (Vector) wsRefsToHandlers_.get(wsRefName); - - if (orderedHandlers_ != null) { - for (int i = 0; i < orderedHandlers_.size(); i++) { - HandlerTableItem hti = (HandlerTableItem) orderedHandlers_.get(i); - handlerClasses.add(hti.getHandlerClassName()); - } - } - } - return (String[])handlerClasses.toArray(new String[0]); - } - - /** - * @return Returns the wsRefsToHandlers_. - */ - public Hashtable getWsRefsToHandlers() { - return wsRefsToHandlers_; - } - - /** - * @param wsRefsToHandlers_ - * The wsRefsToHandlers_ to set. - */ - public void setWsRefsToHandlers(Hashtable wsRefsToHandlersArray) { - - wsRefsToHandlers_ = new Hashtable(); - try { - - if (wsRefsToHandlersArray != null) { - // store the wsRefs - Enumeration wsRef = wsRefsToHandlersArray.keys(); - while (wsRef.hasMoreElements()) { - String wsRefName = (String) wsRef.nextElement(); - - HandlerTableItem[] handlers = (HandlerTableItem[]) wsRefsToHandlersArray.get(wsRefName); - // process the handlersTable - orderedHandlers_ = new Vector(); - for (int i = 0; i < handlers.length; i++) { - orderedHandlers_.add(handlers[i]); - } - wsRefsToHandlers_.put(wsRefName, orderedHandlers_); - - } - } - populateHandlersTable(); - } - catch (Exception e) { - e.printStackTrace(); - } - - } - - public void setServiceRefName(String wsRefName) { - serviceRefName_ = wsRefName; - } - - public void setRefNameToServiceRef(Hashtable refName2SF) { - this.refNameToServiceRef_ = refName2SF; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigServiceHandlersTableWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigServiceHandlersTableWidget.java deleted file mode 100644 index d51b3a4b1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigServiceHandlersTableWidget.java +++ /dev/null @@ -1,620 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Vector; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.j2ee.webservice.wsdd.PortComponent; -import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; - -/** - * ConfigServiceHandlersTreeWidget - * - */ -public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributor { - - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - private MessageUtils msgUtils_ = null; - private Composite parent_; - private boolean isGenSkeletonEnabled_; - private String outputLocation_; - - private Table handlersTable_; - private TableViewer tableViewer_; - private Combo webServiceDescCombo_; - private Button addButton_; - private Button removeButton_; - private Button genSkeletonRadioButton_; - private Combo sourceLocationCombo_; - private Hashtable pathsTable_ = new Hashtable(); - private Hashtable wsDescToHandlers_; - private Hashtable wsDescToPorts_; - private Hashtable serviceDescNameToDescObj_; - private String descriptionName_ = null; - - private Vector orderedHandlers_; - - private int DEFAULT_COLUMN_WIDTH = 90; - - // ----TOOLTIPS Section---- - /* CONTEXT_ID SHLD0001 for the Handler Config Page */ - private final String INFOPOP_HDLR_WS_HANDLERS = "SHDL0001"; //$NON-NLS-1$ - private final String TOOLTIP_EDIT_WS_HANDLERS = "TOOLTIP_EDIT_WS_HANDLERS"; - - /* CONTEXT_ID SHDL0002 for the Handler Config Page */ - private final String INFOPOP_HDLR_GEN_SKELETON = "SHDL0002"; //$NON-NLS-1$ - private final String TOOLTIP_BUTTON_GEN_SKELETON = "TOOLTIP_BUTTON_GEN_SKELETON"; - - /* CONTEXT_ID SHDL0003 for the Handler Config Page */ - private final String INFOPOP_COMBO_SOURCE_LOC = "SHDL0003"; //$NON-NLS-1$ - private final String TOOLTIP_COMBO_SOURCE_LOC = "TOOLTIP_COMBO_SOURCE_LOC"; - - /* CONTEXT_ID SHDL0004 for the Handler Config Page */ - private final String INFOPOP_WS_SERVICE_DESC = "SHDL0004"; //$NON-NLS-1$ - private final String TOOLTIP_WS_SERVICE_DESC = "TOOLTIP_WS_SERVICE_DESC"; - - // ------------------------ - - public ConfigServiceHandlersTableWidget() { - super(); - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) { - msgUtils_ = new MessageUtils(WebServiceConsumptionUIPlugin.ID + ".plugin", this); - UIUtils uiUtils = new UIUtils(msgUtils_, pluginId_); - - parent_ = parent; - - // Web service reference combo - Composite webServiceRefComp = uiUtils.createComposite(parent_, 2); - webServiceDescCombo_ = uiUtils.createCombo(webServiceRefComp, "LABEL_COMBO_WS_SERVICE_DESC", TOOLTIP_WS_SERVICE_DESC, INFOPOP_WS_SERVICE_DESC, - SWT.READ_ONLY); - webServiceDescCombo_.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent evt) { - handleWebServiceDescCombo(evt); - } - }); - - Composite displayComp = new Composite(parent, SWT.NONE); - - GridLayout gridlayout = new GridLayout(2, false); - displayComp.setLayout(gridlayout); - displayComp.setLayoutData(uiUtils.createFillAll()); - - Composite handlersComp = uiUtils.createComposite(displayComp, 1); - GridData griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING - | GridData.VERTICAL_ALIGN_FILL); - handlersComp.setLayoutData(griddata); - handlersComp.setSize(130, 600); - - Composite buttonsComp = uiUtils.createComposite(displayComp, 1); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - buttonsComp.setLayoutData(griddata); - - Text handlersText = new Text(handlersComp, SWT.READ_ONLY); - handlersText.setText(msgUtils_.getMessage("LABEL_HANDLERS_CONFIG")); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - handlersText.setLayoutData(gd); - - handlersTable_ = uiUtils.createTable(handlersComp, TOOLTIP_EDIT_WS_HANDLERS, INFOPOP_HDLR_WS_HANDLERS, SWT.MULTI | SWT.FULL_SELECTION); - handlersTable_.setHeaderVisible(true); - handlersTable_.setLinesVisible(true); - - // empty space - Label wsLabel = new Label(buttonsComp, SWT.NONE); - gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - wsLabel.setLayoutData(gd); - - Button moveUpButton = uiUtils.createPushButton(buttonsComp, "LABEL_BUTTON_MOVE_UP", null, null); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - moveUpButton.setLayoutData(griddata); - moveUpButton.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleMoveUpButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - - Button moveDownButton = uiUtils.createPushButton(buttonsComp, "LABEL_BUTTON_MOVE_DOWN", null, null); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - moveDownButton.setLayoutData(griddata); - moveDownButton.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleMoveDownButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - - // empty space - wsLabel = new Label(buttonsComp, SWT.NONE); - gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - wsLabel.setLayoutData(gd); - - addButton_ = uiUtils.createPushButton(buttonsComp, "LABEL_BUTTON_ADD", null, null); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - addButton_.setLayoutData(griddata); - addButton_.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleAddButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - - removeButton_ = uiUtils.createPushButton(buttonsComp, "LABEL_BUTTON_REMOVE", null, null); - griddata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - removeButton_.setLayoutData(griddata); - removeButton_.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleRemoveButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - enableRemove(false); - - // table stuff here - String[] columns_ = new String[] { msgUtils_.getMessage("LABEL_HANDLER_NAME"), msgUtils_.getMessage("LABLE_HANDLER_CLASS"), - msgUtils_.getMessage("LABEL_HANDLER_PORT")}; - - for (int i = 0; i < columns_.length; i++) { - TableColumn tableColumn = new TableColumn(handlersTable_, i); - tableColumn.setText(columns_[i]); - tableColumn.setAlignment(SWT.LEFT); - tableColumn.setWidth(DEFAULT_COLUMN_WIDTH); - tableColumn.setResizable(true); - } - - tableViewer_ = new TableViewer(handlersTable_); - Control control = tableViewer_.getControl(); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - control.setLayoutData(data); - - tableViewer_.setColumnProperties(columns_); - tableViewer_.setContentProvider(new ListContentProvider()); - tableViewer_.setLabelProvider(new ListLabelProvider()); - tableViewer_.addSelectionChangedListener(new ISelectionChangedListener() { - - public void selectionChanged(SelectionChangedEvent event) { - enableRemove(true); - } - }); - - genSkeletonRadioButton_ = uiUtils.createCheckbox(parent_, "LABEL_BUTTON_GEN_SKELETON", TOOLTIP_BUTTON_GEN_SKELETON, INFOPOP_HDLR_GEN_SKELETON); - genSkeletonRadioButton_.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent evt) { - handleGenSkeletonRadioButton(); - } - }); - - Composite sourceLocationComp = uiUtils.createComposite(parent_, 2); - sourceLocationCombo_ = uiUtils.createCombo(sourceLocationComp, "LABEL_COMBO_SOURCE_LOC", TOOLTIP_COMBO_SOURCE_LOC, INFOPOP_COMBO_SOURCE_LOC, - SWT.READ_ONLY); - sourceLocationCombo_.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent evt) { - handleSourceLocationCombo(evt); - } - }); - - return this; - } - - // Called at start - private void populateHandlersTable() { - try { - - int sizeOfHandlers = wsDescToHandlers_.size(); - - String[] wsRefNames = (String[]) wsDescToHandlers_.keySet().toArray(new String[0]); - webServiceDescCombo_.setItems(wsRefNames); - - if (sizeOfHandlers < 1) { - webServiceDescCombo_.select(0); - webServiceDescCombo_.setEnabled(false); - } - else { - if (descriptionName_ != null) { - int index = webServiceDescCombo_.indexOf(descriptionName_); - if (index != -1) webServiceDescCombo_.select(index); - } - else - webServiceDescCombo_.select(0); - } - // get webServiceRef hint - String wsRef = webServiceDescCombo_.getText(); - - if (wsDescToHandlers_.get(wsRef) != null) { - orderedHandlers_ = (Vector) wsDescToHandlers_.get(wsRef); - tableViewer_.setInput(orderedHandlers_); - tableViewer_.refresh(); - } - } - catch (Exception e) { - e.printStackTrace(); - } - - } - - /** - * @return Returns the handlers. - */ - public List getHandlersList() { - // convert to a ArrayList and return as List - List list = new ArrayList(); - if (orderedHandlers_ != null && !orderedHandlers_.isEmpty()) list.addAll(orderedHandlers_); - - return list; - } - - public Hashtable getWsDescToHandlers() { - return this.wsDescToHandlers_; - } - - /** - * @param handlers - * The handlers to set. - */ - public void setHandlers(HandlerTableItem[] handlers) { - populateHandlersTable(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#getStatus() - */ - public IStatus getStatus() { - IStatus finalStatus = Status.OK_STATUS; - - return finalStatus; - } - - private void handleAddButtonSelected(SelectionEvent event) { - - String descName = webServiceDescCombo_.getText(); - WebServiceDescription serviceDesc = (WebServiceDescription) serviceDescNameToDescObj_.get(descName); - - AddHandlerDialog dialog = dialog = new AddHandlerDialog(parent_.getShell(), false); - dialog.create(); - - String[] portNames = getPortComponentNames(serviceDesc); - dialog.setPortNames(portNames); - dialog.getShell().setSize( 500, 200 ); - - int result = dialog.open(); - - if (result == Window.OK) { - String name = dialog.getName(); - String className = dialog.getClassName(); - String port = dialog.getPortName(); - - HandlerTableItem hi = new HandlerTableItem(); - hi.setHandlerName(name); - hi.setHandlerClassName(className); - hi.setPortName(port); - - - hi.setWsDescRef(serviceDesc); - - orderedHandlers_ = (Vector) wsDescToHandlers_.get(descName); - orderedHandlers_.add(hi); - - } - - refresh(); - } - - private String[] getPortComponentNames(WebServiceDescription webServiceDesc) { - - List ports = webServiceDesc.getPortComponents(); - if (ports!=null){ - String[] portNames = new String[ports.size()]; - for(int i=0;i<ports.size();i++){ - PortComponent pc = (PortComponent)ports.get(i); - String pcName = pc.getPortComponentName(); - portNames[i] = pcName; - } - return portNames; - } - return new String[0]; - } - - private void handleRemoveButtonSelected(SelectionEvent event) { - handleDeleteKeyPressed(); - } - - private void handleMoveUpButtonSelected(SelectionEvent event) { - - int index = tableViewer_.getTable().getSelectionIndex(); - if (index != -1) { - if (index > 0) { - orderedHandlers_ = (Vector) wsDescToHandlers_.get(webServiceDescCombo_.getText()); - Object object = orderedHandlers_.remove(index); - orderedHandlers_.insertElementAt(object, index - 1); - tableViewer_.refresh(); - } - } - - } - - private void handleMoveDownButtonSelected(SelectionEvent event) { - - int index = tableViewer_.getTable().getSelectionIndex(); - if (index != -1) { - if (index < orderedHandlers_.size() - 1) { - orderedHandlers_ = (Vector) wsDescToHandlers_.get(webServiceDescCombo_.getText()); - Object object = orderedHandlers_.remove(index); - orderedHandlers_.insertElementAt(object, index + 1); - tableViewer_.refresh(); - } - } - - } - - public void handleSourceLocationCombo(SelectionEvent event) { - outputLocation_ = sourceLocationCombo_.getText(); - } - - public void handleGenSkeletonRadioButton() { - if (genSkeletonRadioButton_.isEnabled()) { - if (genSkeletonRadioButton_.getSelection()) - this.isGenSkeletonEnabled_ = true; - else - this.isGenSkeletonEnabled_ = false; - } - } - - public void handleWebServiceDescCombo(SelectionEvent event) { - - if (webServiceDescCombo_.isEnabled()) { - String webServiceRefName = webServiceDescCombo_.getText(); - Vector hndlers = (Vector) wsDescToHandlers_.get(webServiceRefName); - if (hndlers != null) { - tableViewer_.setInput(hndlers); - tableViewer_.refresh(); - } - } - } - - /** - * @return Returns the isGenSkeletonEnabled_. - */ - public boolean isGenSkeletonEnabled_() { - return isGenSkeletonEnabled_; - } - - protected class ListLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - public String getColumnText(Object object, int columnIndex) { - - if (object instanceof HandlerTableItem) { - HandlerTableItem hti = (HandlerTableItem) object; - if (columnIndex == 0) { - return hti.getHandlerName() != null ? hti.getHandlerName() : ""; - } - else if (columnIndex == 1) { - return hti.getHandlerClassName() != null ? hti.getHandlerClassName() : ""; - } - else { - return hti.getPortName() != null ? hti.getPortName() : ""; - } - } - return null; - } - - } - - private void enableRemove(boolean enabled) { - removeButton_.setEnabled(enabled && !tableViewer_.getSelection().isEmpty()); - } - - protected class ListContentProvider implements IStructuredContentProvider { - - public Object[] getElements(Object element) { - if (element instanceof Vector) { return ((Vector) element).toArray(); } - return null; - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object old, Object newobj) { - } - - public boolean isDeleted(Object object) { - return false; - } - } - - private void handleDeleteKeyPressed() { - //internalDispose(); - ISelection selection = tableViewer_.getSelection(); - if (selection != null && !selection.isEmpty() && (selection instanceof IStructuredSelection)) { - int selectionIndex = handlersTable_.getSelectionIndex(); - - orderedHandlers_ = (Vector) wsDescToHandlers_.get(webServiceDescCombo_.getText()); - orderedHandlers_.remove(selectionIndex); - refresh(); - } - } - - public void refresh() { - try { - tableViewer_.setInput(null); - if (orderedHandlers_ != null) tableViewer_.setInput(orderedHandlers_); - tableViewer_.refresh(); - } - catch (Exception e) { - e.printStackTrace(); - } - } - - public void setGenSkeletonEnabled(boolean isGenSkeletonEnabled) { - this.isGenSkeletonEnabled_ = isGenSkeletonEnabled; - genSkeletonRadioButton_.setSelection(isGenSkeletonEnabled); - - } - - public boolean getGenSkeletonEnabled() { - return this.isGenSkeletonEnabled_; - } - - public void setSourceOutputLocation(IPath[] locations) { - this.outputLocation_ = locations[0].toString(); - - String[] paths = new String[locations.length]; - for (int i = 0; i < locations.length; i++) { - paths[i] = locations[i].toString(); - pathsTable_.put(paths[i], locations[i]); - } - sourceLocationCombo_.setItems(paths); - sourceLocationCombo_.select(0); - - } - - public IPath getSourceOutputLocation() { - IPath outputPath = (IPath) pathsTable_.get(outputLocation_); - return outputPath; - } - - /** - * @return Returns the handlerClassNames. - */ - public String[] getHandlerClassNames() { - - Vector handlerClasses = new Vector(); - Enumeration e = wsDescToHandlers_.keys(); - while (e.hasMoreElements()) { - - String wsDescName = (String)e.nextElement(); - orderedHandlers_ = (Vector) wsDescToHandlers_.get(wsDescName); - - if (orderedHandlers_ != null) { - - for (int i = 0; i < orderedHandlers_.size(); i++) { - HandlerTableItem hti = (HandlerTableItem) orderedHandlers_.get(i); - handlerClasses.add(hti.getHandlerClassName()); - } - } - } - return (String[])handlerClasses.toArray(new String[0]); - } - - /** - * @param wsDescToHandlersArray_ - * The wsDescToHandlersArray_ to set. - */ - public void setWsRefsToHandlers(Hashtable wsDescToHandlersArray) { - - wsDescToHandlers_ = new Hashtable(); - wsDescToPorts_ = new Hashtable(); - try { - - if (wsDescToHandlersArray != null) { - // store the wsRefs - Enumeration wsDesc = wsDescToHandlersArray.keys(); - while (wsDesc.hasMoreElements()) { - String wsDescName = (String) wsDesc.nextElement(); - - HandlerTableItem[] handlers = (HandlerTableItem[]) wsDescToHandlersArray.get(wsDescName); - // process the handlersTable - orderedHandlers_ = new Vector(); - HashSet portNameVector = new HashSet(); - - for (int i = 0; i < handlers.length; i++) { - orderedHandlers_.add(handlers[i]); - String portName = handlers[i].getPortName(); - portNameVector.add(new String(portName)); - } - wsDescToHandlers_.put(wsDescName, orderedHandlers_); - wsDescToPorts_.put(wsDescName, (String[]) portNameVector.toArray(new String[0])); - } - } - populateHandlersTable(); - } - catch (Exception e) { - e.printStackTrace(); - } - - } - - public void setDescriptionName(String wsDescName) { - descriptionName_ = wsDescName; - } - - public void setServiceDescNameToDescObj(Hashtable serviceDescNameToDescObj) { - this.serviceDescNameToDescObj_ = serviceDescNameToDescObj; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/HandlersDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/HandlersDefaultingCommand.java deleted file mode 100644 index dc8d31992..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/HandlersDefaultingCommand.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.j2ee.internal.webservice.WebServiceNavigatorGroupType; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Environment; - - -/** - * HandlersDefaultingCommand - * - * Determine if Handlers belongs to service or client side - */ -public class HandlersDefaultingCommand extends AbstractHandlersWidgetDefaultingCmd -{ - private boolean isClientHandler_ = false; - private boolean isServiceHandler_ = false; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - IStatus status = Status.OK_STATUS; - - IStructuredSelection selection = getInitialSelection(); - if (selection != null && selection.size() == 1) { - Object obj = selection.getFirstElement(); - - if (obj instanceof WebServiceNavigatorGroupType) { - WebServiceNavigatorGroupType wsngt = (WebServiceNavigatorGroupType) obj; - if (wsngt.getWsdlService()!=null){ - isServiceHandler_ = true; - } - - if (wsngt.getServiceRef()!=null){ - isClientHandler_ = true; - } - - } - } - else { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED") ); - env.getStatusHandler().reportError(status); - return status; - } - - return status; - - } - - -/** - * @return Returns the isClientHandler_. - */ -public boolean getIsClientHandler() { - return isClientHandler_; -} -/** - * @return Returns the isServiceHandler_. - */ -public boolean getIsServiceHandler() { - return isServiceHandler_; -} -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ImportWSILWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ImportWSILWidget.java deleted file mode 100644 index a2c7612e0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ImportWSILWidget.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Iterator; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; -import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.wsil.Arguments; -import org.eclipse.jst.ws.internal.consumption.ui.wsil.TableViewerEditor; -import org.eclipse.jst.ws.internal.ui.common.DialogResourceBrowser; -import org.eclipse.jst.ws.internal.ui.common.FileExtensionFilter; -import org.eclipse.swt.SWT; -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.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.help.IWorkbenchHelpSystem; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.ws.internal.wsil.AddWSDLToWSILCommand; -import org.eclipse.wst.wsdl.internal.impl.ServiceImpl; -import org.eclipse.wst.wsdl.util.WSDLResourceImpl; - -/** -* Page for importing WSDL references into a WSIL in the workbench. -*/ -public class ImportWSILWidget extends SimpleWidgetDataContributor -{ - /*CONTEXT_ID WSIL0001 for the WSIL Import Page*/ - private final String INFOPOP_WSIL_IMPORT_PAGE = WebServiceConsumptionUIPlugin.ID + ".WSIL0001"; - - /*CONTEXT_ID WSIL0002 for the WSIL text field*/ - private final String INFOPOP_WSIL_TEXT_WSIL = WebServiceConsumptionUIPlugin.ID + ".WSIL0002"; - - /*CONTEXT_ID WSIL0003 for the WSIL browse button*/ - private final String INFOPOP_WSIL_BUTTON_BROWSE_WSIL = WebServiceConsumptionUIPlugin.ID + ".WSIL0003"; - - /*CONTEXT_ID WSIL0004 for the WSDL table*/ - private final String INFOPOP_WSIL_TABLE_WSDL = WebServiceConsumptionUIPlugin.ID + ".WSIL0004"; - - private final String INSPECTION_WSIL = "inspection.wsil"; - - private Text wsil_; - private Button browse_; - private TableViewerEditor wsdls_; - - private MessageUtils msgUtils; - - /** - * Constructs a new page. - */ - public ImportWSILWidget() - { - msgUtils = new MessageUtils(WebServiceConsumptionUIPlugin.ID + ".plugin", this); - //super(msgUtils.getMessage("PAGE_WSIL_IMPORT"), msgUtils.getMessage("TITLE_WSIL_IMPORT"), msgUtils.getMessage("DESC_WSIL_IMPORT")); - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) - { - IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem(); - - parent.setToolTipText(msgUtils.getMessage("TOOLTIP_WSIL_IMPORT_PAGE")); - helpSystem.setHelp(parent, INFOPOP_WSIL_IMPORT_PAGE); - - Composite composite = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(); - gl.numColumns = 3; - composite.setLayout(gl); - GridData gd = new GridData(GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); - gd.grabExcessVerticalSpace = true; - gd.grabExcessHorizontalSpace = true; - composite.setLayoutData(gd); - - Label label = new Label(composite, SWT.WRAP); - label.setText(msgUtils.getMessage("LABEL_WSIL_URI")); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - wsil_ = new Text(composite, SWT.WRAP | SWT.SINGLE | SWT.BORDER); - gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); - gd.widthHint = 256; - wsil_.setLayoutData(gd); - wsil_.addListener(SWT.Modify, statusListener); - wsil_.setToolTipText(msgUtils.getMessage("TOOLTIP_WSIL_TEXT_WSIL")); - helpSystem.setHelp(wsil_, INFOPOP_WSIL_TEXT_WSIL); - - browse_ = new Button(composite, SWT.PUSH); - browse_.setText(msgUtils.getMessage("LABEL_BROWSE")); - browse_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - browse_.addListener(SWT.Selection, - new Listener() - { - public void handleEvent(Event event) - { - handleBrowseEvent(event); - } - } - ); - browse_.setToolTipText(msgUtils.getMessage("TOOLTIP_WSIL_BUTTON_BROWSE_WSIL")); - helpSystem.setHelp(browse_, INFOPOP_WSIL_BUTTON_BROWSE_WSIL); - - Composite wsdlComposite = new Composite(composite, SWT.NONE); - wsdlComposite.setLayout(new GridLayout()); - gd = new GridData(GridData.FILL_BOTH); - gd.horizontalSpan = 3; - wsdlComposite.setLayoutData(gd); - label = new Label(wsdlComposite, SWT.WRAP); - label.setText(msgUtils.getMessage("LABEL_WSDL")); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - String[] columns = {msgUtils.getMessage("LABEL_WSDL_URI")}; - wsdls_ = new TableViewerEditor(wsdlComposite, columns, new ArrayList(), "http://"); - wsdls_.setToolTipText(msgUtils.getMessage("TOOLTIP_WSIL_TABLE_WSDL")); - wsdls_.setInfopop(INFOPOP_WSIL_TABLE_WSDL); - return this; - } - - public void handleBrowseEvent(Event event) - { - DialogResourceBrowser dialog = new DialogResourceBrowser(browse_.getShell(), null, new FileExtensionFilter(new String[] {"wsil"})); - dialog.open(); - IResource res = dialog.getFirstSelection(); - if (res != null) - { - if (res instanceof IFile) - wsil_.setText(res.getFullPath().toString()); - else - wsil_.setText(res.getFullPath().addTrailingSeparator().append(INSPECTION_WSIL).toString()); - } - } - - public IStatus getStatus() - { - if (!wsil_.getText().endsWith(".wsil")) - return StatusUtils.errorStatus( msgUtils.getMessage("PAGE_MSG_INVALID_WSIL_FILE_NAME") ); - else - return Status.OK_STATUS; - } - - public void setInitialSelection(IStructuredSelection selection) - { - ArrayList list = new ArrayList(); - if (selection != null && !selection.isEmpty()) - { - for (Iterator it = selection.iterator(); it.hasNext();) - { - Object object = it.next(); - if ((object instanceof IFile) && ((IFile)object).getFileExtension() != null && ((IFile)object).getFileExtension().equals("wsdl")) - list.add(((IFile)object).getFullPath().toString()); - if (object instanceof ServiceImpl) - list.add(J2EEActionAdapterFactory.getWSILPath(((ServiceImpl)(object)))); - if (object instanceof ServiceRef) - list.add(J2EEActionAdapterFactory.getWSILPath(((ServiceRef)(object)))); - if (object instanceof WSDLResourceImpl) - list.add(J2EEActionAdapterFactory.getWSILPath(((WSDLResourceImpl)(object)))); - } - } - wsdls_.setInput(list); - wsdls_.refresh(); - if (list.size() > 0) - { - StringBuffer path = new StringBuffer(list.get(0).toString()); - // change extension from .wsdl to .wsil - int length = path.length(); - path = path.replace(length-4, length, "wsil"); - wsil_.setText(path.toString()); - } - } - - public Arguments getGenWSILArguments() - { - Arguments args = new Arguments(); - String wsilPath = wsil_.getText(); - if (wsilPath.indexOf(':') < 0) - args.add(AddWSDLToWSILCommand.ARG_WSIL, URI.createPlatformResourceURI(wsil_.getText()).toString()); - else - args.add(AddWSDLToWSILCommand.ARG_WSIL, wsilPath); - TableItem[] items = wsdls_.getItems(); - for (int i = 0; i < items.length; i++) - { - String uri = items[i].getText(0); - if (uri.indexOf(':') < 0) - { - IResource res = ResourceUtils.findResource(uri); - if (res != null) - { - try - { - uri = res.getLocation().toFile().toURL().toString(); - } - catch (MalformedURLException murle) - { - murle.getMessage(); - } - } - } - args.add(AddWSDLToWSILCommand.ARG_WSDL, uri); - } - args.add(AddWSDLToWSILCommand.ARG_RESOLVE_WSDL, null); - return args; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PreferencesSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PreferencesSelectionWidget.java deleted file mode 100644 index 1d1f70662..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PreferencesSelectionWidget.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; - - -public class PreferencesSelectionWidget extends SimpleWidgetDataContributor -{ - private ResourceContext context_; - - /*CONTEXT_ID PWPR0003 for the Overwrite Files check box of the Project Page*/ - private String INFOPOP_PWPR_CHECKBOX_OVERWRITE_FILES = "PWPR0003"; - private Button overwriteFilesCheckbox_; - - /*CONTEXT_ID PWPR0004 for the Create Folders check box of the Project Page*/ - private String INFOPOP_PWPR_CHECKBOX_CREATE_FOLDERS = "PWPR0004"; - private Button createFoldersCheckbox_; - - /*CONTEXT_ID PWPR0015 for the Check Out Files check box of the Project Page*/ - private String INFOPOP_PWPR_CHECKBOX_CHECKOUT_FILES = "PWPR0015"; - private Button checkoutFilesCheckbox_; - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#addControls(org.eclipse.swt.widgets.Composite, org.eclipse.swt.widgets.Listener) - */ - public WidgetDataEvents addControls( Composite parent, Listener statusListener) - { - String pluginId = "org.eclipse.jst.ws.ui"; - String conPluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId + ".plugin", this ); - UIUtils utils = new UIUtils( msgUtils, conPluginId ); - - Composite resourcesGroup = utils.createComposite( parent, 1 ); - - overwriteFilesCheckbox_ = utils.createCheckbox( resourcesGroup, "BUTTON_OVERWRITE_FILES", - "TOOLTIP_PPRM_CHECKBOX_OVERWRITE_FILES", - INFOPOP_PWPR_CHECKBOX_OVERWRITE_FILES ); - - createFoldersCheckbox_ = utils.createCheckbox( resourcesGroup, "BUTTON_CREATE_FOLDERS", - "TOOLTIP_PPRM_CHECKBOX_CREATE_FOLDERS" , - INFOPOP_PWPR_CHECKBOX_CREATE_FOLDERS ); - - checkoutFilesCheckbox_ = utils.createCheckbox( resourcesGroup, "BUTTON_CHECKOUT_FILES", - "TOOLTIP_PPRM_CHECKBOX_CHECK_OUT", - INFOPOP_PWPR_CHECKBOX_CHECKOUT_FILES ); - - return this; - } - - public void setResourceContext( ResourceContext context ) - { - overwriteFilesCheckbox_.setSelection( context.isOverwriteFilesEnabled() ); - createFoldersCheckbox_.setSelection( context.isCreateFoldersEnabled() ); - checkoutFilesCheckbox_.setSelection( context.isCheckoutFilesEnabled() ); - - context_ = context; - } - - public ResourceContext getResourceContext() - { - context_.setOverwriteFilesEnabled( overwriteFilesCheckbox_.getSelection() ); - context_.setCreateFoldersEnabled( createFoldersCheckbox_.getSelection() ); - context_.setCheckoutFilesEnabled( checkoutFilesCheckbox_.getSelection() ); - - return context_; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishToPrivateUDDICommandFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishToPrivateUDDICommandFragment.java deleted file mode 100644 index 7312ef8a2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishToPrivateUDDICommandFragment.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.jst.ws.internal.consumption.ui.wizard.PrivateUDDIRegistryTypeRegistry; -import org.eclipse.wst.command.internal.env.core.fragment.AbstractCommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; - - -public class PublishToPrivateUDDICommandFragment extends AbstractCommandFragment -{ - private DataMappingRegistry dataMappingRegistry; - private CanFinishRegistry canFinishRegistry; - private WidgetRegistry widgetRegistry; - private boolean publishToPrivateUDDI; - private CommandWidgetBinding privateUDDIBinding; - - public PublishToPrivateUDDICommandFragment() - { - super(null, ""); - privateUDDIBinding = PrivateUDDIRegistryTypeRegistry.getInstance().getPrivateUDDIRegistryType().getBinding(); - } - - /** - * Gets the first child fragment for this fragment. - * - * @return returns the first child fragment for this fragment. Returns - * null when there is no first child. - **/ - public CommandFragment getFirstSubFragment() - { - if (privateUDDIBinding != null && publishToPrivateUDDI && !PrivateUDDIRegistryTypeRegistry.getInstance().getPrivateUDDIRegistryType().isPrivateUDDIRegistryInstalled()) - { - privateUDDIBinding.registerCanFinish(canFinishRegistry); - privateUDDIBinding.registerDataMappings(dataMappingRegistry); - privateUDDIBinding.registerWidgetMappings(widgetRegistry); - return privateUDDIBinding.create().create(); - } - else - return null; - } - - /** - * Gets the next child fragment for this fragment. - * - * @return returns the next child fragment for this fragment. Returns null - * when there is no next child. - **/ - public CommandFragment getNextSubFragment(CommandFragment fragment) - { - return null; - } - - /* - * This method is called to retrieve the data mappings for this command fragment. - */ - public void registerDataMappings(DataMappingRegistry registry) - { - dataMappingRegistry = registry; - } - - public void registerCanFinish(CanFinishRegistry canFinishRegistry) - { - this.canFinishRegistry = canFinishRegistry; - } - - public void registerWidgetMappings(WidgetRegistry widgetRegistry) - { - this.widgetRegistry = widgetRegistry; - } - - /** - * All wizard fragments need to be cloneable. - **/ - public Object clone() - { - PublishToPrivateUDDICommandFragment fragment = new PublishToPrivateUDDICommandFragment(); - fragment.registerDataMappings(dataMappingRegistry); - fragment.registerCanFinish(canFinishRegistry); - fragment.registerWidgetMappings(widgetRegistry); - fragment.setPublishToPrivateUDDI(publishToPrivateUDDI); - return fragment; - } - - public void setPublishToPrivateUDDI(boolean publish) - { - publishToPrivateUDDI = publish; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishWSWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishWSWidget.java deleted file mode 100644 index 9a40b1af2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishWSWidget.java +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.Vector; - -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.PrivateUDDIRegistryTypeRegistry; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.PublicUDDIRegistryTypeRegistry; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi.PublicUDDIRegistryType; -import org.eclipse.jst.ws.internal.ui.uddi.PrivateUDDIRegistryType; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.help.IWorkbenchHelpSystem; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.ws.internal.explorer.LaunchOption; -import org.eclipse.wst.ws.internal.explorer.LaunchOptions; - - -public class PublishWSWidget extends SimpleWidgetDataContributor -{ - /* CONTEXT_ID PWPB0001 for the UDDI Publish Page */ - private String INFOPOP_PWPB_PAGE = WebServiceConsumptionUIPlugin.ID + ".PWPB0001"; - /* CONTEXT_ID PWPB0002 for the UDDI Launch check box of the UDDI Publish Page */ - private String INFOPOP_PWPB_CHECKBOX_WS_LAUNCH = WebServiceConsumptionUIPlugin.ID + ".PWPB0002"; - private Button launchUDDICheckbox_; - private Button launchPrivateUDDICheckbox_; - private Label pubilcUDDIRegComboLabel_; - private Combo publicUDDIRegCombo_; - private MessageUtils msgUtils; - private Listener statusListener; - private Boolean publish; - - public PublishWSWidget(boolean publish) - { - msgUtils = new MessageUtils(WebServiceConsumptionUIPlugin.ID + ".plugin", this); - this.publish = new Boolean(publish); - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) - { - this.statusListener = statusListener; - Listener selListener = new Listener() - { - public void handleEvent(Event event) - { - handleSelectionEvent(event); - } - }; - parent.setToolTipText(msgUtils.getMessage("TOOLTIP_PWPB_PAGE")); - IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem(); - helpSystem.setHelp(parent, INFOPOP_PWPB_PAGE); - launchPrivateUDDICheckbox_ = new Button(parent, SWT.CHECK); - if (publish.booleanValue()) - launchPrivateUDDICheckbox_.setText(msgUtils.getMessage("BUTTON_WS_PUBLISH_PRIVATE_UDDI")); - else - launchPrivateUDDICheckbox_.setText(msgUtils.getMessage("BUTTON_WS_FIND_PRIVATE_UDDI")); - launchPrivateUDDICheckbox_.setToolTipText(msgUtils.getMessage("TOOLTIP_PWPB_CHECKBOX_WS_LAUNCH")); - launchPrivateUDDICheckbox_.addListener(SWT.Selection, selListener); - helpSystem.setHelp(launchPrivateUDDICheckbox_, INFOPOP_PWPB_CHECKBOX_WS_LAUNCH); - launchUDDICheckbox_ = new Button(parent, SWT.CHECK); - if (publish.booleanValue()) - launchUDDICheckbox_.setText(msgUtils.getMessage("BUTTON_WS_PUBLISH")); - else - launchUDDICheckbox_.setText(msgUtils.getMessage("BUTTON_WS_FIND")); - launchUDDICheckbox_.setToolTipText(msgUtils.getMessage("TOOLTIP_PWPB_CHECKBOX_WS_LAUNCH")); - launchUDDICheckbox_.addListener(SWT.Selection, selListener); - helpSystem.setHelp(launchUDDICheckbox_, INFOPOP_PWPB_CHECKBOX_WS_LAUNCH); - Composite c = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(); - gl.numColumns = 3; - gl.marginHeight = 0; - gl.marginWidth = 0; - c.setLayout(gl); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); - c.setLayoutData(gd); - new Label(c, SWT.WRAP); - pubilcUDDIRegComboLabel_ = new Label(c, SWT.WRAP); - pubilcUDDIRegComboLabel_.setText(msgUtils.getMessage("LABEL_PUBLIC_UDDI_REGISTRIES")); - publicUDDIRegCombo_ = new Combo(c, SWT.DROP_DOWN | SWT.READ_ONLY); - publicUDDIRegCombo_.setEnabled(false); - initPublicUDDI(); - initPrivateUDDI(); - return this; - } - - private void initPublicUDDI() - { - PublicUDDIRegistryTypeRegistry reg = PublicUDDIRegistryTypeRegistry.getInstance(); - PublicUDDIRegistryType[] types = reg.getAllPublicUDDIRegistryTypes(); - for (int i = 0; i < types.length; i++) - { - if (publish.booleanValue()) - { - // Ignore read-only registries. - String publishURL = types[i].getPublishURL(); - if (publishURL == null || publishURL.indexOf("://") == -1) - continue; - } - publicUDDIRegCombo_.add(types[i].getName()); - } - if (types.length > 0) - publicUDDIRegCombo_.setText(publicUDDIRegCombo_.getItem(0)); - } - - private void initPrivateUDDI() - { - if (!publish.booleanValue() && !PrivateUDDIRegistryTypeRegistry.getInstance().getPrivateUDDIRegistryType().isPrivateUDDIRegistryInstalled()) - launchPrivateUDDICheckbox_.setEnabled(false); - } - - private void handleSelectionEvent(Event event) - { - if (launchUDDICheckbox_ == event.widget) - publicUDDIRegCombo_.setEnabled(launchUDDICheckbox_.getSelection()); - statusListener.handleEvent(event); - } - - public void setPublishToPublicUDDI(boolean publish) - { - launchUDDICheckbox_.setSelection(publish); - publicUDDIRegCombo_.setEnabled(publish); - } - - public void setPublishToPublicUDDI(Boolean publish) - { - setPublishToPublicUDDI(publish.booleanValue()); - } - - public void setPublishToPrivateUDDI(boolean publish) - { - launchPrivateUDDICheckbox_.setSelection(publish); - } - - public void setPublishToPrivateUDDI(Boolean publish) - { - setPublishToPrivateUDDI(publish.booleanValue()); - } - - public boolean getPublishToPublicUDDI() - { - return launchUDDICheckbox_.getSelection(); - } - - public boolean getPublishToPrivateUDDI() - { - return launchPrivateUDDICheckbox_.getSelection(); - } - - public boolean getForceLaunchOutsideIDE() - { - return false; - } - - public LaunchOption[] getLaunchOptions() - { - Vector launchOptionVector = new Vector(); - if (launchUDDICheckbox_.getSelection()) - { - PublicUDDIRegistryTypeRegistry reg = PublicUDDIRegistryTypeRegistry.getInstance(); - int UDDIRegSelectionIndex = publicUDDIRegCombo_.getSelectionIndex(); - if (UDDIRegSelectionIndex != -1) - { - String name = publicUDDIRegCombo_.getItem(UDDIRegSelectionIndex); - String id = reg.getPublicUDDIRegistryTypeIDByName(name); - PublicUDDIRegistryType type = reg.getPublicUDDIRegistryTypeByID(id); - launchOptionVector.add(new LaunchOption(LaunchOptions.INQUIRY_URL, type.getInquiryURL())); - launchOptionVector.add(new LaunchOption(LaunchOptions.PUBLISH_URL, type.getPublishURL())); - } - } - if (launchPrivateUDDICheckbox_.getSelection()) - { - PrivateUDDIRegistryTypeRegistry privateReg = PrivateUDDIRegistryTypeRegistry.getInstance(); - PrivateUDDIRegistryType privateType = privateReg.getPrivateUDDIRegistryType(); - String[] privateInquiryURL = privateType.getPrivateUDDIRegistryInquiryAPI(); - String[] privatePublishURL = privateType.getPrivateUDDIRegistryPublishAPI(); - for (int i = 0; i < privateInquiryURL.length; i++) - { - launchOptionVector.add(new LaunchOption(LaunchOptions.INQUIRY_URL, privateInquiryURL[i])); - launchOptionVector.add(new LaunchOption(LaunchOptions.PUBLISH_URL, privatePublishURL[i])); - } - } - return (LaunchOption[]) launchOptionVector.toArray(new LaunchOption[0]); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetDefaultingCommand.java deleted file mode 100644 index f27949441..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetDefaultingCommand.java +++ /dev/null @@ -1,227 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.Hashtable; -import java.util.List; -import java.util.Vector; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.j2ee.internal.webservice.WebServiceNavigatorGroupType; -import org.eclipse.jst.j2ee.internal.webservice.helper.WebServicesManager; -import org.eclipse.jst.j2ee.webservice.wsdd.Handler; -import org.eclipse.jst.j2ee.webservice.wsdd.PortComponent; -import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription; -import org.eclipse.jst.j2ee.webservice.wsdd.WebServices; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddResource; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.internal.impl.ServiceImpl; -import org.eclipse.wst.wsdl.util.WSDLResourceImpl; - -/** - * ServiceHandlersWidgetDefaultingCommand - * - * Initialize and load the handlers data - */ -public class ServiceHandlersWidgetDefaultingCommand extends AbstractHandlersWidgetDefaultingCmd { - - private HandlerTableItem[] handlers_; - private MessageUtils msgUtils_; - private WebServiceDescription wsDescription_; - private WsddResource wsddResource_; - private WebServicesManager webServicesManager_; - private IProject project_; - private Hashtable wsDescToHandlers_; - private Hashtable serviceDescNameToDescObj_; - private String descriptionName_ = null; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils_ = new MessageUtils(pluginId + ".plugin", this); - IStatus status = Status.OK_STATUS; - - webServicesManager_ = new WebServicesManager(); - IStructuredSelection selection = getInitialSelection(); - if (selection == null) { - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED") ); - env.getStatusHandler().reportError(status); - return status; - } - - status = processHandlers(env); - return status; - - } - - public IStatus processHandlers(Environment env) { - try { - Vector handlers = new Vector(); - wsDescToHandlers_ = new Hashtable(); - serviceDescNameToDescObj_ = new Hashtable(); - -// WebServiceEditModel wsed = getWebServiceEditModel(); - // if (wsed == null) - wsddResource_ = getWsddResourceFromSelection(); - // else - // wsddResource_ = wsed.getWebServicesXmlResource(); - - if (wsddResource_ == null) { - IStatus status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED") ); - env.getStatusHandler().reportError(status); - return status; - } - - WebServices webServices = wsddResource_.getWebServices(); - if (webServices != null) { - List wsDescriptions = wsddResource_.getWebServices().getWebServiceDescriptions(); - for (int i = 0; i < wsDescriptions.size(); i++) { - - wsDescription_ = (WebServiceDescription) wsDescriptions.get(i); - - List wsPortComponents = wsDescription_.getPortComponents(); - for (int j = 0; j < wsPortComponents.size(); j++) { - PortComponent wsPort = (PortComponent) wsPortComponents.get(j); - String portName = wsPort.getPortComponentName(); - List wsHandlers = wsPort.getHandlers(); - HandlerTableItem[] handlerItems = new HandlerTableItem[wsHandlers.size()]; - for (int k = 0; k < wsHandlers.size(); k++) { - - Handler wsHandler = (Handler) wsHandlers.get(k); - - HandlerTableItem handlerItem = new HandlerTableItem(); - handlerItem.setHandler(wsHandler); - handlerItem.setHandlerName(wsHandler.getHandlerName()); - handlerItem.setHandlerClassName(wsHandler.getHandlerClass()); - handlerItem.setPort(wsPort); - handlerItem.setPortName(portName); - handlerItem.setWsDescRef(wsDescription_); - handlerItems[k] = handlerItem; - - handlers.add(handlerItem); - } - String wsDescName = wsDescription_.getWebServiceDescriptionName(); - wsDescToHandlers_.put(wsDescName, handlerItems); - serviceDescNameToDescObj_.put(wsDescName, wsDescription_); - - } - - } - - handlers_ = (HandlerTableItem[]) handlers.toArray(new HandlerTableItem[0]); - } - } - catch (Exception e) - { - e.printStackTrace(); - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED"), e); - } - return Status.OK_STATUS; - } - - public HandlerTableItem[] getHandlers() { - return this.handlers_; - } - - /** - * @return Returns the isGenSkeletonEnabled_. - */ - public boolean getGenSkeletonEnabled() { - return true; - } - - /** - * @return Returns the sourceOutputLocation_. - */ - public IPath[] getSourceOutputLocation() { - IPath[] locations = null; - IProject project = getProject(); - - if (project != null) { - locations = ResourceUtils.getAllJavaSourceLocations(project); - } - else { - project = project_; - if (project != null) { - locations = ResourceUtils.getAllJavaSourceLocations(project); - } - } - return locations; - } - - public WsddResource getWsddResource() { - return wsddResource_; - } - - private WsddResource getWsddResourceFromSelection() { - IStructuredSelection initSel = getInitialSelection(); - if (initSel != null && initSel.size() == 1) { - Object obj = initSel.getFirstElement(); - if (obj instanceof ServiceImpl) { - // Service object - Service service = (Service) obj; - descriptionName_ = service.getQName().getLocalPart(); - project_ = ProjectUtilities.getProject(service); - return webServicesManager_.getWsddResource(service); - } - else if (obj instanceof WSDLResourceImpl) { - // WSDL resource - WSDLResourceImpl res = (WSDLResourceImpl) obj; - project_ = ProjectUtilities.getProject(res); - List wsdlResources = webServicesManager_.getWSDLServices(res); - return webServicesManager_.getWsddResource((Service) wsdlResources.get(0)); - } - else if (obj instanceof WebServiceNavigatorGroupType) { - WebServiceNavigatorGroupType wsngt = (WebServiceNavigatorGroupType) obj; - Service service = (Service)wsngt.getWsdlService(); - descriptionName_ = service.getQName().getLocalPart(); - project_ = ProjectUtilities.getProject(service); - return webServicesManager_.getWsddResource(service); - } - } - - return null; - - } - - /** - * @deprecated - */ - public WebServiceDescription getWsDescription() { - return wsDescription_; - } - - public String getDescriptionName(){ - return descriptionName_; - } - - public Hashtable getWsRefsToHandlers(){ - return wsDescToHandlers_; - } - - public Hashtable getServiceDescNameToDescObj(){ - return this.serviceDescNameToDescObj_; - } - - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetOutputCommand.java deleted file mode 100644 index 15214d600..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetOutputCommand.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.j2ee.webservice.wsdd.Handler; -import org.eclipse.jst.j2ee.webservice.wsdd.PortComponent; -import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddFactory; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddResource; -import org.eclipse.jst.j2ee.webservice.wsdd.internal.impl.WsddFactoryImpl; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopyUtility; - -/* - * Provide a way to externalize the edited fields and create new handlers - * - */ -public class ServiceHandlersWidgetOutputCommand extends AbstractDataModelOperation -{ - - private WsddResource wsddResource_; - private Hashtable wsDescToHandlers_; - private Hashtable serviceDescNameToDescObj_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - try { - Enumeration e = wsDescToHandlers_.keys(); - while (e.hasMoreElements()) { - - Hashtable wsPortsTable = new Hashtable(); - Hashtable wsPortToHandlerTable = new Hashtable(); - - String serviceDescName = (String) e.nextElement(); - // load PortName -> PortComponent table - WebServiceDescription wsDescription_ = (WebServiceDescription) serviceDescNameToDescObj_.get(serviceDescName); - if (wsDescription_ != null) { - - List wsPorts = wsDescription_.getPortComponents(); - for (int k = 0; k < wsPorts.size(); k++) { - PortComponent port = (PortComponent) wsPorts.get(k); - wsPortsTable.put(port.getPortComponentName(), port); - wsPortToHandlerTable.put(port.getPortComponentName(), new ArrayList()); - } - } - - List handlerTableItems = (List) wsDescToHandlers_.get(serviceDescName); - if (handlerTableItems != null) { - - WsddFactory wsddFactory = new WsddFactoryImpl(); - - //form port components tables first - for (int i = 0; i < handlerTableItems.size(); i++) { - - HandlerTableItem hti = (HandlerTableItem) handlerTableItems.get(i); - PortComponent wsPort = (PortComponent) hti.getPort(); - if (wsPort == null) { - //find it - if (wsPortsTable.get(hti.getPortName()) != null) - wsPort = (PortComponent) wsPortsTable.get(hti.getPortName()); - else { - // create it; should not get into here - wsPort = wsddFactory.createPortComponent(); - wsPort.setPortComponentName(hti.getPortName()); - wsPortsTable.put(wsPort.getPortComponentName(), wsPort); - } - } - wsPortToHandlerTable.put(wsPort.getPortComponentName(), new ArrayList()); - } - - // form Handler and ports table - for (int i = 0; i < handlerTableItems.size(); i++) { - - HandlerTableItem hti = (HandlerTableItem) handlerTableItems.get(i); - String portName = hti.getPortName(); - - PortComponent port = (PortComponent) wsPortsTable.get(portName); - if (port == null) return status; - - List existingHandlers = port.getHandlers(); - - Object handler = hti.getHandler(); - if (!existingHandlers.contains(handler)) { - // create it - Handler newHandler = wsddFactory.createHandler(); - newHandler.setHandlerName(hti.getHandlerName()); - newHandler.setHandlerClass(hti.getHandlerClassName()); - ((List) wsPortToHandlerTable.get(portName)).add(newHandler); - - } - else if (handler instanceof Handler) { - // clone it - EtoolsCopyUtility copyUtil = new EtoolsCopyUtility(); - copyUtil.setCopyAdapters(true); - Handler clonedHandler = (Handler) copyUtil.copy((Handler) handler); - ((List) wsPortToHandlerTable.get(portName)).add(clonedHandler); - } - } - - } - - // remove existing handlers from ports - removeExistingHandlers(wsPortsTable, wsPortToHandlerTable); - - // add ports to wsDescription - addPortsToDescriptions(wsPortsTable, wsDescription_); - - // add handlers to ports - addHandlersToPorts(wsPortsTable, wsPortToHandlerTable); - } - if (wsddResource_ != null) { - wsddResource_.save(new HashMap()); - } - - } - catch (Exception e) { - //status = new - e.printStackTrace(); - } - return status; - } - - private void removeExistingHandlers(Hashtable portsTable, Hashtable portsToHandlersTable) { - try { - Enumeration ports = portsToHandlersTable.keys(); - while (ports.hasMoreElements()) { - String portName = (String) ports.nextElement(); - Object port = portsTable.get(portName); - if (port != null && port instanceof PortComponent) { - List handlers = ((PortComponent) port).getHandlers(); - handlers.clear(); - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - - private void addPortsToDescriptions(Hashtable portsTable, WebServiceDescription wsDescription_) { - try { - Enumeration ports = portsTable.keys(); - while (ports.hasMoreElements()) { - String portName = (String) ports.nextElement(); - // newly edited port - Object port = portsTable.get(portName); - - // existing port - List emfPorts = wsDescription_.getPortComponents(); - if (!emfPorts.contains(port) && port != null && port instanceof PortComponent) { - emfPorts.add((PortComponent) port); - } - } - } - - catch (Exception e) { - e.printStackTrace(); - } - } - - private void addHandlersToPorts(Hashtable portsTable, Hashtable portsToHandlersTable) { - try { - Enumeration ports = portsToHandlersTable.keys(); - while (ports.hasMoreElements()) { - String portName = (String) ports.nextElement(); - Object port = portsTable.get(portName); - if (port != null && port instanceof PortComponent) { - List handlers = (List) portsToHandlersTable.get(portName); - - List modelHandlers = ((PortComponent) port).getHandlers(); - modelHandlers.addAll(handlers); - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * @param handlerTableItems - * The handlerTableItems to set. - */ - public void setHandlersList(List handlerTableItems) { - } - - public void setWsDescToHandlers(Hashtable wsDescToHandlers) { - this.wsDescToHandlers_ = wsDescToHandlers; - } - -// public void setWsDescription(WebServiceDescription wsDesc) { -// this.wsDescription_ = wsDesc; -// } - - public void setWsddResource(WsddResource wsddRes) { - this.wsddResource_ = wsddRes; - } - - public void setServiceDescNameToDescObj(Hashtable serviceDescNameToDescObj) { - this.serviceDescNameToDescObj_ = serviceDescNameToDescObj; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/TableViewerWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/TableViewerWidget.java deleted file mode 100644 index 9064efc8d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/TableViewerWidget.java +++ /dev/null @@ -1,619 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.common.PropertiesResourceFilter; -import org.eclipse.jst.ws.internal.ui.dialog.DialogUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.TableEditor; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.events.TraverseListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Rectangle; -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.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; - - -public class TableViewerWidget extends SimpleWidgetDataContributor -{ - private int DEFAULT_TABLE_HEIGHT_HINT = 100; - private int DEFAULT_COLUMN_WIDTH = 80; - - public static byte MAP_ONE_TO_ONE = 3; - public static byte MAP_MANY_TO_ONE = 1; - public static byte MAP_MANY_TO_MANY = 0; - - private String[] columns_; - private TableViewer tableViewer_; - private Table table_; - private TableEditor editor_; - private TableEditorListener tableEditorListener_; - private Text text_; - private Button import_; - private Button add_; - private Button remove_; - - private Composite parent_; - private Listener statusListener_; - - private String message = null; - private byte rescriction = MAP_MANY_TO_MANY; - - private List values_; - private Object defaultValue_; - - private PropertiesResourceFilter filter_ = new PropertiesResourceFilter(); - - public TableViewerWidget(String[] columns, List initValues, Object defaultValue, byte rescriction) - { - columns_ = columns; - values_ = new ArrayList(); - if (initValues != null && initValues.size() > 0) - values_.addAll(initValues); - defaultValue_ = (defaultValue != null) ? defaultValue : new String(""); - this.rescriction = rescriction; - } - - public WidgetDataEvents addControls( Composite parent, Listener statusListener ) - { - parent_ = parent; - statusListener_ = statusListener; - - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId + ".plugin", this ); - - Composite composite = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(); - - gl.marginHeight = 0; - gl.marginWidth = 0; - composite.setLayout(gl); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - table_ = new Table(composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = DEFAULT_TABLE_HEIGHT_HINT; - table_.setLayoutData(gd); - table_.setHeaderVisible(true); - table_.setLinesVisible(true); - TableLayout tableLayout = new TableLayout(); - int maxWidth = DEFAULT_COLUMN_WIDTH; - for (int i = 0; i < columns_.length; i++) - { - TableColumn tableColumn = new TableColumn(table_, SWT.NONE); - tableColumn.setText(columns_[i]); - tableColumn.pack(); - int tableColumnWidth = Math.max(DEFAULT_COLUMN_WIDTH, tableColumn.getWidth()); - maxWidth = Math.max(maxWidth, tableColumnWidth); - ColumnWeightData columnData = new ColumnWeightData(tableColumnWidth, tableColumnWidth, true); - tableLayout.addColumnData(columnData); - } - table_.setLayout(tableLayout); - // initialize the table editor - editor_ = new TableEditor(table_); - // The editor must have the same size as the cell and must - // not be any smaller than 50 pixels. - editor_.horizontalAlignment = SWT.LEFT; - editor_.grabHorizontal = true; - editor_.minimumWidth = maxWidth; - tableEditorListener_ = new TableEditorListener(); - table_.addMouseListener(tableEditorListener_); - tableViewer_ = new TableViewer(table_); - tableViewer_.getControl().addKeyListener( - new KeyListener() - { - public void keyPressed(KeyEvent e) - { - int asciiDel = (int)e.character; - // Del - if (asciiDel == 127) - handleDeleteKeyPressed(); - // Enter or space - if (((int)e.character) == 13 || ((int)e.character) == 32) - tableEditorListener_.editSelection(); - } - public void keyReleased(KeyEvent e) - { - } - } - ); - tableViewer_.setContentProvider(new ListContentProvider()); - tableViewer_.setLabelProvider(new ListLabelProvider()); - tableViewer_.setInput(values_); - tableViewer_.addSelectionChangedListener( - new ISelectionChangedListener() - { - public void selectionChanged(SelectionChangedEvent event) - { - enableRemove(true); - } - } - ); - - Composite buttonComposite = new Composite(composite, SWT.NONE); - gl = new GridLayout(); - gl.numColumns = 3; - gl.makeColumnsEqualWidth = true; - buttonComposite.setLayout(gl); - buttonComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING)); - - import_ = new Button(buttonComposite, SWT.PUSH); - import_.setText(msgUtils.getMessage("LABEL_IMPORT")); - import_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - import_.addSelectionListener( - new SelectionListener() - { - public void widgetSelected(SelectionEvent event) - { - handleImportButtonSelected(event); - } - public void widgetDefaultSelected(SelectionEvent event) - { - } - } - ); - - add_ = new Button(buttonComposite, SWT.PUSH); - add_.setText(msgUtils.getMessage("LABEL_ADD")); - add_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - add_.addSelectionListener( - new SelectionListener() - { - public void widgetSelected(SelectionEvent event) - { - handleAddButtonSelected(event); - } - public void widgetDefaultSelected(SelectionEvent event) - { - } - } - ); - - - remove_ = new Button(buttonComposite, SWT.PUSH); - remove_.setText(msgUtils.getMessage("LABEL_REMOVE")); - remove_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - remove_.addSelectionListener( - new SelectionListener() - { - public void widgetSelected(SelectionEvent event) - { - handleRemoveButtonSelected(event); - } - public void widgetDefaultSelected(SelectionEvent event) - { - } - } - ); - enableRemove(false); - - return this; - } - - private void enableRemove(boolean enabled) - { - remove_.setEnabled(enabled && !tableViewer_.getSelection().isEmpty()); - } - - private void handleImportButtonSelected(SelectionEvent event) - { - IResource resource = DialogUtils.browseResources( - parent_.getShell(), - ResourceUtils.getWorkspaceRoot(), - null, - filter_ - ); - if (resource != null && resource instanceof IFile) - { - try - { - Properties props = new Properties(); - props.load(((IFile)resource).getContents()); - Set set = props.entrySet(); - java.util.List list = new LinkedList(); - Iterator i = set.iterator(); - while (i.hasNext()) - { - Map.Entry me = (Map.Entry)i.next(); - String key = (String)me.getKey(); - String val = (String)me.getValue(); - list.add(new String[] {key,val}); - } - values_.addAll(list); - } - catch (Exception e) - { - // TODO Report some error here. - } - } - refresh(); - } - - private void handleAddButtonSelected(SelectionEvent event) - { - values_.add(defaultValue_); - refresh(); - setSelectionAsObject(values_.get(table_.getItemCount()-1)); - tableEditorListener_.editSelection(); - } - - private void handleRemoveButtonSelected(SelectionEvent event) - { - handleDeleteKeyPressed(); - } - - private void handleDeleteKeyPressed() - { - internalDispose(); - ISelection selection = tableViewer_.getSelection(); - if (selection != null && !selection.isEmpty() && (selection instanceof IStructuredSelection)) - { - int selectionIndex = table_.getSelectionIndex(); - int selectionCount = table_.getItemCount(); - values_.remove(selectionIndex); - if (selectionIndex < selectionCount-1) - setSelectionAsObject(values_.get(selectionIndex)); - else if (selectionCount -2 >= 0) - setSelectionAsObject(values_.get(selectionCount-2)); - refresh(); - } - } - - private void internalRefresh() - { - // synchronize text field, previously selected table cell and model (inputObject) - if (text_ != null) - { - TableItem oldTableItem = editor_.getItem(); - int oldColumnIndex = editor_.getColumn(); - if (oldTableItem != null && oldColumnIndex >= 0 && oldColumnIndex < columns_.length) - { - String oldText = text_.getText(); - oldTableItem.setText(oldColumnIndex, oldText); - int oldRowIndex = table_.indexOf(oldTableItem); - values_.set(oldRowIndex, new String[] {oldTableItem.getText(0), oldTableItem.getText(1)}); - } - } - checkMappingConstraints(); - statusListener_.handleEvent( null ); - } - - private void checkMappingConstraints() { - - HashMap map = new HashMap(); - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId + ".plugin", this ); - - for(int cnt=0; cnt<values_.size(); cnt++){ - String[] value = (String[])values_.get(cnt); - if(map.containsKey(value[0]) && ((rescriction & 1)!=0)){ - message = msgUtils.getMessage("MSG_MAPPING_DUPLICATE_ENTRIES", new String[]{columns_[0],columns_[1]}); - return; - } - if(map.containsValue(value[1]) && ((rescriction & 2)!=0)){ - message = msgUtils.getMessage("MSG_MAPPING_DUPLICATE_ENTRIES", new String[]{columns_[1],columns_[0]}); - return; - } - map.put(value[0],value[1]); - - } - message = null; - - } - - public IStatus getStatus() - { - return message == null ? Status.OK_STATUS : - StatusUtils.errorStatus( message ); - } - - private void setSelectionAsObject(Object object) - { - tableViewer_.setSelection(new StructuredSelection(object), true); - } - - public void refresh() - { - internalRefresh(); - tableViewer_.refresh(); - } - - public TableItem[] getItems() - { - //internalRefresh(); - return table_.getItems(); - } - - public void setEnabled(boolean enabled) - { - add_.setEnabled(enabled); - enableRemove(enabled); - } - - public void dispose() - { - internalDispose(); - if (editor_ != null) - editor_.dispose(); - if (table_ != null) - table_.dispose(); - if (add_ != null) - add_.dispose(); - if (remove_ != null) - remove_.dispose(); - } - - private void internalDispose() - { - if (text_ != null) - text_.dispose(); - text_ = null; - } - - protected class TableEditorListener implements MouseListener - { - private int currSelectionIndex_; - private int editRow_; - private int editColumn_; - - public TableEditorListener() - { - super(); - currSelectionIndex_ = -1; - editRow_ = -1; - editColumn_ = -1; - } - - public void mouseDoubleClick(MouseEvent e) - { - mouseDown(e); - } - - public void mouseDown(MouseEvent e) - { - // refresh table - internalRefresh(); - // Clean up previous text editor control - internalDispose(); - // update table - if (table_.isFocusControl()) - { - int selectedRowIndex = getSelectedRow(table_, e.y); - if (currSelectionIndex_ != -1 && selectedRowIndex != -1 && currSelectionIndex_ == selectedRowIndex) - { - TableItem tableItem = table_.getItem(selectedRowIndex); - int selectedColumnIndex = getSelectedColumn(tableItem, e.x, e.y); - if (selectedColumnIndex != -1 && (text_ == null || text_.isDisposed() || selectedColumnIndex != editor_.getColumn())) - editSelection(selectedRowIndex, selectedColumnIndex); - } - currSelectionIndex_ = selectedRowIndex; - } - } - - public void mouseUp(MouseEvent e) - { - } - - private int getSelectedRow(Table table, int y) - { - TableItem[] tableItems = table.getItems(); - for (int i = 0; i < tableItems.length; i++) - { - Rectangle rectangle = tableItems[i].getBounds(0); - if (rectangle != null && y >= rectangle.y && y < (rectangle.y + rectangle.height)) - return i; - } - return -1; - } - - private int getSelectedColumn(TableItem tableItem, int x, int y) - { - for (int i = 0; i < columns_.length; i++) - { - if (tableItem.getBounds(i).contains(x, y)) - return i; - } - return -1; - } - - private void editSelection(int row, int column) - { - editRow_ = row; - editColumn_ = column; - TableItem tableItem = table_.getItem(row); - // Setup adapter for the new selection - text_ = new Text(table_, SWT.NONE); - String text = tableItem.getText(column); - text_.setText((text != null) ? text : ""); - text_.addKeyListener(new KeyListener() - { - public void keyPressed(KeyEvent e) - { - // Esc - if (((int)e.character) == 27) - cancelSelection(); - } - public void keyReleased(KeyEvent e) - { - } - } - ); - text_.addTraverseListener(new TraverseListener() - { - public void keyTraversed(TraverseEvent e) - { - if (e.detail == SWT.TRAVERSE_TAB_NEXT) - traverseTabNext(); - else if (e.detail == SWT.TRAVERSE_TAB_PREVIOUS) - traverseTabPrevious(); - } - } - ); - editor_.setEditor(text_, tableItem, column); - text_.setFocus(); - text_.selectAll(); - } - - protected void traverseTabNext() - { - internalRefresh(); - internalDispose(); - if (!(editRow_ == table_.getItems().length-1 && editColumn_ == columns_.length-1)) - { - if (editColumn_ < columns_.length-1) - editColumn_++; - else - { - editColumn_ = 0; - editRow_++; - table_.select(editRow_); - } - editSelection(editRow_, editColumn_); - } - } - - protected void traverseTabPrevious() - { - internalRefresh(); - internalDispose(); - if (!(editRow_ == 0 && editColumn_ == 0)) - { - if (editColumn_ > 0) - editColumn_--; - else - { - editColumn_ = columns_.length-1; - editRow_--; - table_.select(editRow_); - } - editSelection(editRow_, editColumn_); - } - } - - public void cancelSelection() - { - internalDispose(); - internalRefresh(); - } - - public void editSelection() - { - int selectedRowIndex = table_.getSelectionIndex(); - if (selectedRowIndex != -1 && columns_.length > 0) - { - // refresh table - internalRefresh(); - // Clean up any previous editor control - internalDispose(); - editSelection(selectedRowIndex, 0); - } - currSelectionIndex_ = selectedRowIndex; - } - } - - protected class ListContentProvider implements IStructuredContentProvider - { - public void dispose() - { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) - { - tableViewer_.add(getElements(newInput)); - } - - public Object[] getElements(Object inputElement) - { - if (inputElement instanceof List) - { - List list = (List)inputElement; - Object[] objects = new Object[list.size()]; - for (int i = 0; i < objects.length; i++) - objects[i] = list.get(i); - return objects; - } - else - return new Object[0]; - } - } - - protected class ListLabelProvider implements ITableLabelProvider - { - public Image getColumnImage(Object element, int columnIndex) - { - return null; - } - - public String getColumnText(Object element, int columnIndex) - { - return ((String[])element)[columnIndex]; - } - - public void addListener(ILabelProviderListener listener) - { - } - - public void removeListener(ILabelProviderListener listener) - { - } - - public boolean isLabelProperty(Object element, String property) - { - return true; - } - - public void dispose() - { - } - } - } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionConditionCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionConditionCommand.java deleted file mode 100644 index d4de766dd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionConditionCommand.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.ui.wsil.DialogWWWAuthentication; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.Condition; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; -import org.eclipse.wst.ws.internal.parser.wsil.WWWAuthenticationException; -import org.eclipse.wst.ws.internal.parser.wsil.WebServiceEntity; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -public class WSDLSelectionConditionCommand extends AbstractDataModelOperation implements Condition -{ - private String pluginId_; - private MessageUtils msgUtils_; - private WebServicesParser webServicesParser; - private String webServiceURI; - private String httpBasicAuthUsername; - private String httpBasicAuthPassword; - private boolean needWSDLSelectionTreeWidget; - - public WSDLSelectionConditionCommand() - { - pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - msgUtils_ = new MessageUtils( pluginId_ + ".plugin", this ); - } - - public void setWebServicesParser(WebServicesParser webServicesParser) - { - this.webServicesParser = webServicesParser; - } - - public WebServicesParser getWebServicesParser() - { - if (webServicesParser == null) - webServicesParser = new WebServicesParserExt(); - return webServicesParser; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - needWSDLSelectionTreeWidget = false; - WebServicesParser parser = getWebServicesParser(); - parser.setURI(webServiceURI); - try - { - parser.parse(WebServicesParser.PARSE_WSIL | WebServicesParser.PARSE_DISCO | WebServicesParser.PARSE_LINKS); - } - catch (WWWAuthenticationException wwwae) - { - DialogWWWAuthentication dialog = new DialogWWWAuthentication(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); - dialog.handleWWWAuthentication(wwwae); - String username = dialog.getUsername(); - String password = dialog.getPassword(); - httpBasicAuthUsername = username; - httpBasicAuthPassword = password; - if (username != null && password != null) - { - parser.setHTTPBasicAuthUsername(username); - parser.setHTTPBasicAuthPassword(password); - try - { - parser.parse(WebServicesParser.PARSE_WSIL | WebServicesParser.PARSE_DISCO | WebServicesParser.PARSE_LINKS); - } - catch (Throwable t) - { - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_URI_NOT_RESOLVABLE", new Object[] {webServiceURI}), t); - } - finally - { - parser.setHTTPBasicAuthUsername(null); - parser.setHTTPBasicAuthPassword(null); - } - } - } - catch (Throwable t) - { - return StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_URI_NOT_RESOLVABLE", new Object[] {webServiceURI}), t); - } - WebServiceEntity wsEntity = parser.getWebServiceEntityByURI(webServiceURI); - if (wsEntity != null) - { - int type = wsEntity.getType(); - if (type != WebServiceEntity.TYPE_WSDL) - needWSDLSelectionTreeWidget = true; - } - return Status.OK_STATUS; - } - - public boolean evaluate() - { - return needWSDLSelectionTreeWidget; - } - - public String getWebServiceURI() - { - return webServiceURI; - } - - public void setWebServiceURI(String webServiceURI) - { - this.webServiceURI = webServiceURI; - } - - public String getWsdlURI() - { - return getWebServiceURI(); - } -/** - * @return Returns the httpBasicAuthPassword. - */ -public String getHttpBasicAuthPassword() { - return httpBasicAuthPassword; -} -/** - * @return Returns the httpBasicAuthUsername. - */ -public String getHttpBasicAuthUsername() { - return httpBasicAuthUsername; -} -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java deleted file mode 100644 index 9273f6d15..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.Map; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -public class WSDLSelectionOutputCommand extends AbstractDataModelOperation -{ - private WebServicesParser webServicesParser; - private String wsdlURI; - private IProject project; - private String componentName; - - private boolean testService; - - - public boolean getTestService() { - return testService; - } - - - public void setTestService(boolean testService) { - this.testService = testService; - } - - /** - * @return Returns the project. - */ - public IProject getProject() - { - return project; - } - - /** - * @param project - * The project to set. - */ - public void setProject(IProject project) - { - this.project = project; - } - - - - public String getComponentName() - { - return componentName; - } - - public void setComponentName(String componentName) - { - this.componentName = componentName; - } - - public String getWsdlURI() - { - return wsdlURI; - } - - public void setWsdlURI(String wsdlURI) - { - this.wsdlURI = wsdlURI; - } - - /** - * @return Returns the webServicesParser. - */ - public WebServicesParser getWebServicesParser() - { - if (webServicesParser != null) - return webServicesParser; - else - return new WebServicesParserExt(); - } - - /** - * @param webServicesParser to set. - */ - public void setWebServicesParser(WebServicesParser webServicesParser) - { - this.webServicesParser = webServicesParser; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - MessageUtils msgUtils = new MessageUtils("org.eclipse.jst.ws.consumption.ui.plugin", this); - if (wsdlURI != null && getWebServicesParser().getWSDLDefinition(wsdlURI) != null) { - IStatus status = Status.OK_STATUS; - Map services = getWebServicesParser().getWSDLDefinition(wsdlURI).getServices(); - if (services.isEmpty()){ - if (testService==true){ - testService = false; - status = StatusUtils.warningStatus( msgUtils.getMessage("MSG_WARNING_NO_SERVICE_ELEMENT") ); - try{ - env.getStatusHandler().report(status); - }catch(Exception e){ - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_WARNING_NO_SERVICE_ELEMENT") ); - } - } - } - return status; - } - else - { - IStatus status = StatusUtils.errorStatus( msgUtils.getMessage("PAGE_MSG_SELECTION_MUST_BE_WSDL") ); - env.getStatusHandler().reportError(status); - return status; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionTreeWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionTreeWidget.java deleted file mode 100644 index f7b9d2b7a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionTreeWidget.java +++ /dev/null @@ -1,287 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.List; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.ws.internal.parser.wsil.WebServiceEntity; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -/** -* This wizard page allows the user to select the WSDL URI for consumption -*/ -public class WSDLSelectionTreeWidget extends SimpleWidgetDataContributor -{ - private String pluginId_; - private MessageUtils msgUtils_; - - /*CONTEXT_ID PWWS0001 for the WSDL Selection Page*/ - private final String INFOPOP_PWWS_PAGE = ".PWWS0001"; - - private WebServicesParser webServicesParser; - private String webServiceURI; - - private Listener statusListener; - private TreeViewer treeViewer_; - private TreeContentProvider treeContentProvider; - private Tree tree_; - private int pageWidth_; - - /** - * Default constructor. - */ - public WSDLSelectionTreeWidget() - { - pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - msgUtils_ = new MessageUtils( pluginId_ + ".plugin", this ); - } - - public WidgetDataEvents addControls( Composite parent, Listener statusListener ) - { - this.statusListener = statusListener; - parent.setToolTipText(msgUtils_.getMessage("TOOLTIP_PWWS_PAGE")); - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, pluginId_ + INFOPOP_PWWS_PAGE); - - Label wsdlLabel = new Label(parent, SWT.WRAP); - wsdlLabel.setText(msgUtils_.getMessage("LABEL_SELECT_WSDL")); - wsdlLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - tree_ = new Tree(parent, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 200; - tree_.setLayoutData(gd); - pageWidth_ = tree_.getShell().getSize().x; - treeViewer_ = new TreeViewer(tree_); - treeContentProvider = new TreeContentProvider(); - treeViewer_.setContentProvider(treeContentProvider); - treeViewer_.setLabelProvider(new TreeLabelProvider()); - treeViewer_.addSelectionChangedListener( - new ISelectionChangedListener() - { - public void selectionChanged(SelectionChangedEvent event) - { - handleTreeSelectionChangedEvent(event); - } - } - ); - return this; - } - - private void handleTreeSelectionChangedEvent(SelectionChangedEvent event) - { - statusListener.handleEvent(new Event()); - } - - /** - * @return Returns the webServicesParser. - */ - public WebServicesParser getWebServicesParser() - { - return webServicesParser; - } - /** - * @param webServicesParser The webServicesParser to set. - */ - public void setWebServicesParser(WebServicesParser webServicesParser) - { - this.webServicesParser = webServicesParser; - treeViewer_.setInput(this.webServicesParser); - refreshTreeViewer(); - } - - public void setWebServiceURI(String wsURI) - { - webServiceURI = wsURI; - treeContentProvider.setWebServiceURI(webServiceURI); - refreshTreeViewer(); - } - - public void refreshTreeViewer() - { - if (webServicesParser != null && webServiceURI != null) - { - treeViewer_.refresh(); - Control shell = tree_.getShell(); - if (tree_.getSize().x > pageWidth_ || shell.getSize().x > pageWidth_) - { - tree_.setSize(pageWidth_, tree_.getSize().y); - shell.setSize(pageWidth_, shell.getSize().y); - shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); - shell.redraw(); - } - } - } - - public void setEnabled(boolean enabled) - { - tree_.setEnabled(enabled); - } - - public boolean isEnabled() - { - return tree_.isEnabled(); - } - - public String getWsdlURI() - { - WebServiceEntity entity = getSelectionAsWebServiceEntity(); - if (entity != null) - return entity.getURI(); - else - return webServiceURI; - } - - private WebServiceEntity getSelectionAsWebServiceEntity() - { - if (treeViewer_ != null) - { - ISelection sel = treeViewer_.getSelection(); - if (!sel.isEmpty() && (sel instanceof IStructuredSelection)) - { - IStructuredSelection ssel = (IStructuredSelection)sel; - Object object = ssel.getFirstElement(); - if (object instanceof WebServiceEntity) - return (WebServiceEntity)object; - } - } - return null; - } - - public IStatus getStatus() - { - WebServiceEntity wsEntity = getSelectionAsWebServiceEntity(); - if (wsEntity == null || wsEntity.getType() != WebServiceEntity.TYPE_WSDL) - return StatusUtils.errorStatus( msgUtils_.getMessage("PAGE_MSG_SELECTION_MUST_BE_WSDL") ); - else - return Status.OK_STATUS; - } - - private class TreeContentProvider implements ITreeContentProvider - { - private String webServiceURI; - - public void dispose() - { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) - { - } - - public Object[] getElements(Object inputElement) - { - if (inputElement instanceof WebServicesParser) - { - WebServicesParser parser = (WebServicesParser)inputElement; - Object wsEntity = parser.getWebServiceEntityByURI(webServiceURI); - if (wsEntity != null) - return new Object[] {wsEntity}; - } - return new Object[0]; - } - - public Object[] getChildren(Object parentElement) - { - if (parentElement instanceof WebServiceEntity) - { - List list = ((WebServiceEntity)parentElement).getChildren(); - Object[] objects = new Object[list.size()]; - for (int i = 0; i < objects.length; i++) - objects[i] = list.get(i); - return objects; - } - return new Object[0]; - } - - public Object getParent(Object element) - { - if (element instanceof WebServiceEntity) - return ((WebServiceEntity)element).getParent(); - return new Object[0]; - } - - public boolean hasChildren(Object element) - { - return (getChildren(element).length > 0); - } - - public void setWebServiceURI(String wsURI) - { - webServiceURI = wsURI; - } - } - - private class TreeLabelProvider implements ILabelProvider - { - public Image getImage(Object element) - { - switch (((WebServiceEntity)element).getType()) - { - case WebServiceEntity.TYPE_HTML: - return WebServiceConsumptionUIPlugin.getImageDescriptor("icons/wsil/html.gif").createImage(); - case WebServiceEntity.TYPE_WSIL: - return WebServiceConsumptionUIPlugin.getImageDescriptor("icons/wsil/wsil.gif").createImage(); - case WebServiceEntity.TYPE_WSDL: - return WebServiceConsumptionUIPlugin.getImageDescriptor("icons/wsil/wsdl.gif").createImage(); - default: - return null; - } - } - - public String getText(Object element) - { - return ((WebServiceEntity)element).getURI(); - } - - public void addListener(ILabelProviderListener listener) - { - } - - public void removeListener(ILabelProviderListener listener) - { - } - - public boolean isLabelProperty(Object element, String property) - { - return true; - } - - public void dispose() - { - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java deleted file mode 100644 index 029e4451b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; -import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.wsdl.internal.impl.ServiceImpl; -import org.eclipse.wst.wsdl.util.WSDLResourceImpl; - -public class WSDLSelectionWidgetDefaultingCommand extends AbstractDataModelOperation -{ - private IStructuredSelection selection_; - - public String getWebServiceURI() - { - if (selection_ != null && !selection_.isEmpty()) - { - Object firstSel = selection_.getFirstElement(); - if (firstSel instanceof IFile) - { - IFile ifile = (IFile)firstSel; - String ext = ifile.getFileExtension(); - if (ext != null && (ext.equals("wsdl") || ext.equals("wsil") || ext.equals("html"))) - { - return ifile.getFullPath().toString(); - } - } - if (firstSel instanceof ServiceImpl) - { - ServiceImpl serviceImpl = (ServiceImpl)firstSel; - return J2EEActionAdapterFactory.getWSDLURI(serviceImpl); - } - if (firstSel instanceof ServiceRef) - { - ServiceRef serviceRef = (ServiceRef)firstSel; - return J2EEActionAdapterFactory.getWSDLURI(serviceRef); - } - if (firstSel instanceof WSDLResourceImpl) - { - WSDLResourceImpl wsdlRI = (WSDLResourceImpl)firstSel; - return J2EEActionAdapterFactory.getWSDLURI(wsdlRI); - } - if (firstSel instanceof String) - return (String)firstSel; - } - return ""; - } - - public void setInitialSelection( IStructuredSelection selection ) - { - selection_ = selection; - } - - public boolean getGenWSIL() - { - return false; - } - - public String getWsilURI() - { - String wsURI = getWebServiceURI(); - if (wsURI != null && wsURI.length() > 0 && wsURI.endsWith("wsdl")) - { - StringBuffer sb = new StringBuffer(wsURI.substring(0, wsURI.length()-4)); - sb.append("wsil"); - return sb.toString(); - } - return ""; - } - - public IProject getProject() - { - IProject p = getProjectFromInitialSelection(selection_); - return p; - } - - public String getComponentName() - { - String cname = getComponentNameFromInitialSelection(selection_); - return cname; - } - - private IProject getProjectFromInitialSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - if (resource==null) - return null; - IProject p = ResourceUtils.getProjectOf(resource.getFullPath()); - return p; - } catch(CoreException e) - { - return null; - } - } - } - return null; - } - - private String getComponentNameFromInitialSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - if (resource==null) - return null; - - IVirtualComponent comp = ResourceUtils.getComponentOf(resource); - if (comp!=null) - { - return comp.getName(); - } - } catch(CoreException e) - { - return null; - } - } - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetWrapper.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetWrapper.java deleted file mode 100644 index e05e8fd19..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetWrapper.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.WSDLSelectionWidget; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.WSDLSelectionWrapper; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - -public class WSDLSelectionWidgetWrapper extends SimpleWidgetDataContributor -{ - private WSDLSelectionWidget wsdlSelectionWidget; - private IProject project; - private String componentName; - - public WSDLSelectionWidgetWrapper() - { - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) - { - wsdlSelectionWidget = new WSDLSelectionWidget(); - wsdlSelectionWidget.addControls(parent, statusListener); - return this; - } - - public IStatus getStatus() - { - return wsdlSelectionWidget.getStatus(); - } - - public void setWebServiceURI(String wsUri) - { - IStructuredSelection sel; - if (wsUri != null) - sel = new StructuredSelection(wsUri); - else - sel = new StructuredSelection(); - wsdlSelectionWidget.setInitialSelection(sel); - } - - public String getWebServiceURI() - { - IStructuredSelection sel = wsdlSelectionWidget.getObjectSelection(); - Object object = sel.getFirstElement(); - String result = null; - - if (object != null ) - { - if( object instanceof WSDLSelectionWrapper ) - { - // Get at the inner structured selection object. - WSDLSelectionWrapper wrapper = (WSDLSelectionWrapper)object; - IStructuredSelection innerSelection = wrapper.wsdlSelection; - Object innerObject = innerSelection.getFirstElement(); - - result = innerObject == null ? null : innerObject.toString(); - } - else - { - result = object.toString(); - } - } - - return result; - } - - public String getWsdlURI() - { - return getWebServiceURI(); - } - - public WebServicesParser getWebServicesParser() - { - return wsdlSelectionWidget.getWebServicesParser(); - } - - public void setProject(IProject project) - { - this.project = project; - } - - public IProject getProject() - { - IProject p = wsdlSelectionWidget.getProject(); - if (p==null) - { - return project; - } - else - return p; - } - - public String getComponentName() - { - String cname = wsdlSelectionWidget.getComponentName(); - if (cname==null) - { - return componentName; - } - else - return cname; - } - - public void setComponentName(String componentName) - { - this.componentName = componentName; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java deleted file mode 100644 index d0e1d20fb..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.data.LabelsAndIds; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; - - -public class WebServiceClientTypeWidget extends SimpleWidgetDataContributor -{ - /*CONTEXT_ID PWPR0013 for the Wizard Scenario Client group of the Project Page*/ - private String INFOPOP_PWPR_GROUP_SCENARIO_CLIENT = "PWPR0013"; - - /*CONTEXT_ID PWPR0014 for the Web Service Client Type combo box of the Project Page*/ - private String INFOPOP_PWPR_COMBO_CLIENTTYPE = "PWPR0014"; - private Combo clientTypeCombo_; - - private TypeRuntimeServer ids_; - private LabelsAndIds labelIds_; - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#addControls(org.eclipse.swt.widgets.Composite, org.eclipse.swt.widgets.Listener) - */ - public WidgetDataEvents addControls( Composite parent, Listener statusListener) - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId + ".plugin", this ); - UIUtils utils = new UIUtils( msgUtils, pluginId ); - - Group clientGroup = utils.createGroup( parent, - "GROUP_SCENARIO_CLIENT", - "TOOLTIP_PWPR_GROUP_SCENARIO_CLIENT", - INFOPOP_PWPR_GROUP_SCENARIO_CLIENT, - 2, 10, 10 ); - - - int comboStyle = SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY; - clientTypeCombo_ = utils.createCombo( clientGroup, - "LABEL_WEBSERVICECLIENTTYPE", - "TOOLTIP_PWPR_COMBO_CLIENTTYPE", - INFOPOP_PWPR_COMBO_CLIENTTYPE, - comboStyle ); - - - - return this; - } - - public void enableWidget( boolean enable ) - { - clientTypeCombo_.setEnabled( enable ); - } - - public void setTypeRuntimeServer( TypeRuntimeServer ids ) - { - // rskreg - //WebServiceClientTypeRegistry registry = WebServiceClientTypeRegistry.getInstance(); - //LabelsAndIds labelIds = registry.getClientTypeLabels(); - LabelsAndIds labelIds = WebServiceRuntimeExtensionUtils.getClientTypeLabels(); - int selection = 0; - String[] clientIds = labelIds.getIds_(); - String selectedId = ids.getTypeId(); - - // rskreg - clientTypeCombo_.setItems( labelIds.getLabels_() ); - - // Now find the selected one. - for( int index = 0; index < clientIds.length; index++ ) - { - if( selectedId.equals( clientIds[index ]) ) - { - selection = index; - break; - } - } - - clientTypeCombo_.select( selection ); - ids_ = ids; - labelIds_ = labelIds; - } - - public TypeRuntimeServer getTypeRuntimeServer() - { - int selectionIndex = clientTypeCombo_.getSelectionIndex(); - - ids_.setTypeId( labelIds_.getIds_()[selectionIndex] ); - - return ids_; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java deleted file mode 100644 index 83941f9ce..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java +++ /dev/null @@ -1,404 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; - -import org.eclipse.jst.ws.internal.consumption.command.common.GetMonitorCommand; -import org.eclipse.jst.ws.internal.consumption.common.ScenarioCleanupCommand; -import org.eclipse.jst.ws.internal.consumption.ui.command.CheckForServiceProjectCommand; -import org.eclipse.jst.ws.internal.consumption.ui.command.data.EclipseIPath2URLStringTransformer; -import org.eclipse.jst.ws.internal.consumption.ui.common.FinishFragment; -import org.eclipse.jst.ws.internal.consumption.ui.extension.ClientRootFragment; -import org.eclipse.jst.ws.internal.consumption.ui.extension.PreClientDevelopCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.CheckWSDLValidationCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidget; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetOutputCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionOutputCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionWidgetWrapper; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionOutputCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidget; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestDelegateCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestWidget; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishDefaultCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.TestDefaultingFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.WebServiceClientTestArrivalCommand; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactory; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.SelectionCommand; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; -import org.eclipse.wst.ws.internal.extensions.AssembleClientFragment; -import org.eclipse.wst.ws.internal.extensions.DeployClientFragment; -import org.eclipse.wst.ws.internal.extensions.DevelopClientFragment; -import org.eclipse.wst.ws.internal.extensions.InstallClientFragment; -import org.eclipse.wst.ws.internal.extensions.RunClientFragment; - - -public class ClientWidgetBinding implements CommandWidgetBinding -{ - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#create() - */ - public CommandFragmentFactory create() - { - return new CommandFragmentFactory() - { - public CommandFragment create() - { - return new ClientRootCommandFragment(); - } - }; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) - */ - public void registerCanFinish(CanFinishRegistry canFinishRegistry) - { - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - // Before ClientWizardWidget - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientWizardWidget.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "TestService", ClientWizardWidget.class ); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "MonitorService", ClientWizardWidget.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ResourceContext", ClientWizardWidget.class ); - - // After ClientWizardWidget - dataRegistry.addMapping(ClientWizardWidget.class, "ClientTypeRuntimeServer", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "TestService", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "MonitorService", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "ResourceContext", ClientWizardWidgetOutputCommand.class); - - // Before ClientRuntimeSelectionWidget - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientRuntimeSelectionWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ClientRuntimeSelectionWidget.class, "J2EEVersion", null); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", ClientRuntimeSelectionWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ClientRuntimeSelectionWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ClientRuntimeSelectionWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientNeedEAR", ClientRuntimeSelectionWidget.class,"NeedEAR",null); - - // After ClientRuntimeSelectionWidget - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "J2EEVersion", ClientExtensionDefaultingCommand.class, "ClientJ2EEVersion", null); - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientProjectName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientEarProjectName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientComponentName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientComponentType", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientNeedEAR", ClientExtensionDefaultingCommand.class); - - // The ClientRuntimeSelectionWidget can control what client extension comes up. - dataRegistry.addMapping(ClientRuntimeSelectionWidget.class, "ClientTypeRuntimeServer", ClientExtensionFragment.class); - - // Before WSDLSelectionWidgetWrapper - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WebServiceURI", WSDLSelectionWidgetWrapper.class ); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "Project", WSDLSelectionWidgetWrapper.class ); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "ComponentName", WSDLSelectionWidgetWrapper.class ); - - // After WSDLSelectionWidgetWrapper - dataRegistry.addMapping(WSDLSelectionWidgetWrapper.class, "WsdlURI", WSDLSelectionOutputCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetWrapper.class, "WebServicesParser", WSDLSelectionOutputCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetWrapper.class, "Project", WSDLSelectionOutputCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetWrapper.class, "ComponentName", WSDLSelectionOutputCommand.class); - - // Before Client Test widget. - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService",FinishTestFragment.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService", ClientTestWidget.class ); - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ClientTestWidget.class ); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProject", ClientTestWidget.class ); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProjectEAR", ClientTestWidget.class ); - dataRegistry.addMapping(TestDefaultingFragment.class, "TestFacility",ClientTestWidget.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Folder",ClientTestWidget.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "JspFolder",ClientTestWidget.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "RunClientTest",ClientTestWidget.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Methods",ClientTestWidget.class); - - // After the client test widget - dataRegistry.addMapping(ClientTestWidget.class, "SampleProjectEAR",FinishDefaultCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "SampleProject",FinishDefaultCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "TestFacility",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "Folder",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "JspFolder",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "RunClientTest",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "SampleMethods",ClientTestDelegateCommand.class); - - dataRegistry.addMapping(ClientTestWidget.class, "TestService",FinishTestFragment.class); - dataRegistry.addMapping(ClientTestWidget.class, "TestID",FinishTestFragment.class); - dataRegistry.addMapping(ClientTestWidget.class, "IsTestWidget",FinishTestFragment.class); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerWidgetMappings(org.eclipse.wst.command.env.ui.widgets.WidgetRegistry) - */ - public void registerWidgetMappings(WidgetRegistry widgetRegistry) - { - String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - - widgetRegistry.add( "ClientWizardWidget", - msgUtils.getMessage("PAGE_TITLE_WS_PROJECT"), - msgUtils.getMessage("PAGE_DESC_WS_PROJECT"), - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new ClientWizardWidget(); - } - } ); - - widgetRegistry.add( "ClientRuntimeSelectionWidget", - msgUtils.getMessage("PAGE_TITLE_WS_CLIENT_RUNTIME_SELECTION"), - msgUtils.getMessage("PAGE_DESC_WS_CLIENT_RUNTIME_SELECTION"), - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new ClientRuntimeSelectionWidget(); - } - } ); - - widgetRegistry.add( "WSDLSelectionWidgetWrapper", - msgUtils.getMessage("PAGE_TITLE_WS_SELECTION"), - msgUtils.getMessage("PAGE_DESC_WS_SELECTION"), - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new WSDLSelectionWidgetWrapper(); - } - } ); - - widgetRegistry.add( "ClientTestWidget", - msgUtils.getMessage("PAGE_TITLE_WS_SAMPLE"), - msgUtils.getMessage("PAGE_DESC_WS_SAMPLE"), - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new ClientTestWidget(); - } - }); - } - - private class ClientRootCommandFragment extends SequenceFragment - { - public ClientRootCommandFragment() - { - add( new SimpleFragment( new ScenarioCleanupCommand(), "" )); - - //add( new SimpleFragment( new CheckForMissingFiles(), "" ) ); - add( new SimpleFragment( new ClientWizardWidgetDefaultingCommand(), "" ) ); - add( new SimpleFragment( "ClientWizardWidget" ) ); - //add( new TestCommandFactoryFragment() ); - add( new SimpleFragment( new ClientWizardWidgetOutputCommand(), "" )); - add( new SimpleFragment( new WSDLSelectionWidgetDefaultingCommand(), "")); - add( new SimpleFragment( "WSDLSelectionWidgetWrapper" ) ); - add( new SimpleFragment( new WSDLSelectionOutputCommand(), "")); - add( new SimpleFragment( new CheckWSDLValidationCommand(), "")); - add( new SimpleFragment( new ClientRuntimeSelectionWidgetDefaultingCommand(), "")); - //add( new TestCommandFactoryFragment2() ); - add( new SimpleFragment( "ClientRuntimeSelectionWidget" ) ); - //add( new SimpleFragment( new CheckForServiceProjectCommand(), "")); - add( new SimpleFragment( new ClientExtensionDefaultingCommand( true ), "")); - //add(new SimpleFragment(new ClientServerDeployableConfigCommand(false), "")); //Note: added here for client - //add( new ClientExtensionFragment() ); - add( new ClientRootFragment() ); - add( new SimpleFragment( new ClientExtensionOutputCommand(), "" ) ); - add( new SimpleFragment(new GetMonitorCommand(), "")); - add( new SimpleFragment(new TestDefaultingFragment(),"")); - add( new ClientTestFragment( "ClientTestWidget") ); - add(new FinishFragment()); - - add( new SimpleFragment( new ScenarioCleanupCommand(), "" )); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.internal.env.core.fragment.CommandFragment#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - //Map SelectionCommand - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ClientRuntimeSelectionWidgetDefaultingCommand.class, "InitialInitialSelection", null); - - // Map ClientWizardWidgetDefaultingCommand command. - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "TestService", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "MonitorService", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ResourceContext", ClientWizardWidgetOutputCommand.class); - - // Map ClientWizardWidgetOutputCommand command. - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ClientTypeRuntimeServer", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "TestService", WSDLSelectionOutputCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "TestService", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "TestService", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ResourceContext", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ResourceContext", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "MonitorService", GetMonitorCommand.class); - - // Map ClientRuntimeSelectionWidgetDefaultingCommand command - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentType", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientNeedEAR", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", CheckForServiceProjectCommand.class); - - // Map WSDLSelectionWidgetDefaultingCommand command. - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", WSDLSelectionWidgetDefaultingCommand.class ); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "GenWSIL", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WsilURI", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WebServiceURI", WSDLSelectionOutputCommand.class, "WsdlURI", new EclipseIPath2URLStringTransformer()); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "Project", WSDLSelectionOutputCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "ComponentName", WSDLSelectionOutputCommand.class); - - // WSDLSelectionOutputCommand - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", GetMonitorCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", GetMonitorCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "Project", ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialProject", null); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "ComponentName", ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialComponentName", null); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", CheckForServiceProjectCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", CheckForServiceProjectCommand.class); - - // Setup the PreClientDevelopCommand. - // - dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "TestService", PreClientDevelopCommand.class); - dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "ResourceContext", PreClientDevelopCommand.class); - // - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", PreClientDevelopCommand.class ); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientJ2EEVersion", PreClientDevelopCommand.class); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProject", PreClientDevelopCommand.class, "Module", null ); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProjectType", PreClientDevelopCommand.class, "ModuleType", null); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProjectEAR", PreClientDevelopCommand.class, "Ear", null ); - dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "ResourceContext", PreClientDevelopCommand.class); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "WsdlURI", PreClientDevelopCommand.class ); - - dataRegistry.addMapping( PreClientDevelopCommand.class, "WebService", ClientExtensionOutputCommand.class, "WebServiceClient", null ); - - // Map ClientExtensionDefaultingCommand command. - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionFragment.class); - - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", WebServiceClientTestArrivalCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject", WebServiceClientTestArrivalCommand.class); - - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "GenerateProxy", ClientTestFragment.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService", ClientTestFragment.class ); - - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientNeedEAR", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientEarProjectName", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientEarComponentName", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServer", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "WsdlURI", ClientTestDelegateCommand.class); - - // Map ClientExtensionOutputCommand command. - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ProxyBean", WebServiceClientTestArrivalCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ProxyBean", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "GenerateProxy", ClientTestFragment.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "GenerateProxy", FinishTestFragment.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "GenerateProxy", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "SetEndpointMethod", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ServerInstanceId", FinishDefaultCommand.class); - - - // GetMonitorCommand - dataRegistry.addMapping(GetMonitorCommand.class, "Endpoints", ClientTestDelegateCommand.class); - - // MAP post server config call - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", ClientExtensionOutputCommand.class, "EarProjectName", null); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServerInstance", ClientExtensionOutputCommand.class, "ExistingServerId", null); - - // Map WebServiceClientTestArrivalCommand command. - dataRegistry.addMapping(TestDefaultingFragment.class, "TestFacility",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "TestFacility",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Folder",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "JspFolder",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "RunClientTest",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Methods",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProject",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProjectEAR",ClientTestDelegateCommand.class); - - - //Mappings to enable peek-ahead for Page 3 of the client wizard - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", DevelopClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", DevelopClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", DevelopClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", DevelopClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", DevelopClientFragment.class, "Project", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", DevelopClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", DevelopClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", DevelopClientFragment.class, "Ear", null ); - - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", AssembleClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", AssembleClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", AssembleClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", AssembleClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", AssembleClientFragment.class, "Project", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", AssembleClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", AssembleClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", AssembleClientFragment.class, "Ear", null ); - - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", DeployClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", DeployClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", DeployClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", DeployClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", DeployClientFragment.class, "Project", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", DeployClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", DeployClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", DeployClientFragment.class, "Ear", null ); - - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", InstallClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", InstallClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", InstallClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", InstallClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", InstallClientFragment.class, "Project", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", InstallClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", InstallClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", InstallClientFragment.class, "Ear", null ); - - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "WebService", RunClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Environment", RunClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Context", RunClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "Selection", RunClientFragment.class ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", RunClientFragment.class, "Project", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", RunClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", RunClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", RunClientFragment.class, "Ear", null ); - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigClientHandlersWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigClientHandlersWidgetBinding.java deleted file mode 100644 index 6e4b80779..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigClientHandlersWidgetBinding.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; - -import org.eclipse.jst.ws.internal.consumption.ui.command.GenerateHandlerSkeletonCommand; -import org.eclipse.jst.ws.internal.consumption.ui.command.OpenJavaEditorCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientHandlersWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientHandlersWidgetOutputCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ConfigClientHandlersTableWidget; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactory; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.SelectionCommand; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; - - -/** - * - * Handler Configuration Window - Preferences - Java - Code Generation - Code - * and Comments - */ -public class ConfigClientHandlersWidgetBinding implements CommandWidgetBinding -{ - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerWidgetMappings(org.eclipse.wst.command.env.ui.widgets.WidgetRegistry) - */ - public void registerWidgetMappings(WidgetRegistry widgetRegistry) { - - String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils(pluginId_ + ".plugin", this); - - widgetRegistry.add("ConfigClientHandlersTableWidget", - msgUtils.getMessage("PAGE_TITLE_CLIENT_HDLR_CONFIG"), - msgUtils.getMessage("PAGE_DESC_CLIENT_HDLR_CONFIG"), - new WidgetContributorFactory() { - - public WidgetContributor create() { - return new ConfigClientHandlersTableWidget(); - } - }); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) { - - -// dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"AllHandlers", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"Handlers", ConfigClientHandlersTableWidget.class,"WsRefsToHandlers", null); - - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"GenSkeletonEnabled", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"SourceOutputLocation", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"ServiceRefName", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"RefNameToServiceRef", ConfigClientHandlersTableWidget.class); - - //dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"AllHandlersList", ClientHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"WsRefsToHandlers", ClientHandlersWidgetOutputCommand.class,"HandlersTable",null); - - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"SourceOutputLocation", GenerateHandlerSkeletonCommand.class,"OutputLocation",null); - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"HandlerClassNames", GenerateHandlerSkeletonCommand.class,"HandlerNames",null); - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"GenSkeletonEnabled", GenerateHandlerSkeletonCommand.class); - - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"Project", OpenJavaEditorCommand.class); - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"ClassNames", OpenJavaEditorCommand.class); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) - */ - public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactoryFactory#create() - */ - public CommandFragmentFactory create() { - return new CommandFragmentFactory() { - - public CommandFragment create() { - - return new ClientHandlersConfigCommandFragment(); - } - }; - } - - private class ClientHandlersConfigCommandFragment extends SequenceFragment{ - - public ClientHandlersConfigCommandFragment() - { - add( new SimpleFragment( new ClientHandlersWidgetDefaultingCommand(), "" )); - add( new SimpleFragment( "ConfigClientHandlersTableWidget" ) ); - add( new SimpleFragment( new ClientHandlersWidgetOutputCommand(), "" )); - add( new SimpleFragment( new GenerateHandlerSkeletonCommand(), "")); - add( new SimpleFragment( new OpenJavaEditorCommand(), "")); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.internal.env.core.fragment.CommandFragment#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ClientHandlersWidgetDefaultingCommand.class); - - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"WsClientResource", ClientHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"WsServiceRefs", ClientHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"ClientProject", ClientHandlersWidgetOutputCommand.class); - } - - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigServiceHandlersWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigServiceHandlersWidgetBinding.java deleted file mode 100644 index ecbbc351c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigServiceHandlersWidgetBinding.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; - -import org.eclipse.jst.ws.internal.consumption.ui.command.GenerateHandlerSkeletonCommand; -import org.eclipse.jst.ws.internal.consumption.ui.command.OpenJavaEditorCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ConfigServiceHandlersTableWidget; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ServiceHandlersWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ServiceHandlersWidgetOutputCommand; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactory; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.SelectionCommand; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; - - -/** - * - * Handler Configuration Window - Preferences - Java - Code Generation - Code - * and Comments - */ -public class ConfigServiceHandlersWidgetBinding implements CommandWidgetBinding { - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerWidgetMappings(org.eclipse.wst.command.env.ui.widgets.WidgetRegistry) - */ - public void registerWidgetMappings(WidgetRegistry widgetRegistry) { - - String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils(pluginId_ + ".plugin", this); - - widgetRegistry.add("ConfigServiceHandlersTableWidget", - msgUtils.getMessage("PAGE_TITLE_SERVICE_HDLR_CONFIG"), - msgUtils.getMessage("PAGE_DESC_SERVICE_HDLR_CONFIG"), - new WidgetContributorFactory() { - - public WidgetContributor create() { - return new ConfigServiceHandlersTableWidget(); - } - }); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) { - - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"WsRefsToHandlers", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"GenSkeletonEnabled", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"SourceOutputLocation", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"ServiceDescNameToDescObj", ConfigServiceHandlersTableWidget.class); - - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"DescriptionName", ConfigServiceHandlersTableWidget.class); - - - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"HandlersList", ServiceHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"WsDescToHandlers", ServiceHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"ServiceDescNameToDescObj", ServiceHandlersWidgetOutputCommand.class); - - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"SourceOutputLocation", GenerateHandlerSkeletonCommand.class,"OutputLocation",null); - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"HandlerClassNames", GenerateHandlerSkeletonCommand.class,"HandlerNames",null); - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"GenSkeletonEnabled", GenerateHandlerSkeletonCommand.class); - - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"Project", OpenJavaEditorCommand.class); - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"ClassNames", OpenJavaEditorCommand.class); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) - */ - public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactoryFactory#create() - */ - public CommandFragmentFactory create() { - return new CommandFragmentFactory() { - - public CommandFragment create() { - - return new ServiceHandlersConfigCommandFragment(); - } - }; - } - - private class ServiceHandlersConfigCommandFragment extends SequenceFragment{ - - public ServiceHandlersConfigCommandFragment() - { - add( new SimpleFragment( new ServiceHandlersWidgetDefaultingCommand(), "" )); - add( new SimpleFragment( "ConfigServiceHandlersTableWidget" ) ); - add( new SimpleFragment( new ServiceHandlersWidgetOutputCommand(), "" )); - add( new SimpleFragment( new GenerateHandlerSkeletonCommand(), "")); - add( new SimpleFragment( new OpenJavaEditorCommand(), "")); - - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.internal.env.core.fragment.CommandFragment#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ServiceHandlersWidgetDefaultingCommand.class); - - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "WsddResource", ServiceHandlersWidgetOutputCommand.class); - - - } - - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigureHandlersWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigureHandlersWidgetBinding.java deleted file mode 100644 index ef14da7a8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigureHandlersWidgetBinding.java +++ /dev/null @@ -1,245 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; - -import org.eclipse.jst.ws.internal.consumption.ui.command.GenerateHandlerSkeletonCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientHandlersWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientHandlersWidgetOutputCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ConfigClientHandlersTableWidget; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ConfigServiceHandlersTableWidget; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.HandlersDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ServiceHandlersWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ServiceHandlersWidgetOutputCommand; -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactory; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.SelectionCommand; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.common.Condition; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; - - -public class ConfigureHandlersWidgetBinding implements CommandWidgetBinding { - - - public ConfigureHandlersWidgetBinding() { - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#create() - */ - public CommandFragmentFactory create() { - return new CommandFragmentFactory() { - - public CommandFragment create() { - return new HandlersCommandFragment(); - } - }; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) - */ - public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - } - - /* - * (non-Javadoc), - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) { - - // Map client-side widgets to commands - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class, "Handlers", ConfigClientHandlersTableWidget.class, "WsRefsToHandlers", null); - - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class, "GenSkeletonEnabled", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class, "SourceOutputLocation", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class, "ServiceRefName", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class, "RefNameToServiceRef", ConfigClientHandlersTableWidget.class); - - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class, "WsRefsToHandlers", ClientHandlersWidgetOutputCommand.class, "HandlersTable", null); - - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class, "SourceOutputLocation", GenerateHandlerSkeletonCommand.class, "OutputLocation", null); - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class, "HandlerClassNames", GenerateHandlerSkeletonCommand.class, "HandlerNames", null); - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class, "GenSkeletonEnabled", GenerateHandlerSkeletonCommand.class); - - // Map service-side widgets to commands - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "WsRefsToHandlers", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "GenSkeletonEnabled", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "SourceOutputLocation", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "ServiceDescNameToDescObj", ConfigServiceHandlersTableWidget.class); - - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "DescriptionName", ConfigServiceHandlersTableWidget.class); - - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class, "HandlersList", ServiceHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class, "WsDescToHandlers", ServiceHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "ServiceDescNameToDescObj", ServiceHandlersWidgetOutputCommand.class); - - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class, "SourceOutputLocation", GenerateHandlerSkeletonCommand.class, "OutputLocation", null); - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class, "HandlerClassNames", GenerateHandlerSkeletonCommand.class, "HandlerNames", null); - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class, "GenSkeletonEnabled", GenerateHandlerSkeletonCommand.class); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerWidgetMappings(org.eclipse.wst.command.env.ui.widgets.WidgetRegistry) - */ - public void registerWidgetMappings(WidgetRegistry widgetRegistry) { - String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils(pluginId_ + ".plugin", this); - - widgetRegistry.add("ConfigServiceHandlersTableWidget", msgUtils.getMessage("PAGE_TITLE_SERVICE_HDLR_CONFIG"), msgUtils - .getMessage("PAGE_DESC_SERVICE_HDLR_CONFIG"), new WidgetContributorFactory() { - - public WidgetContributor create() { - return new ConfigServiceHandlersTableWidget(); - } - }); - - widgetRegistry.add("ConfigClientHandlersTableWidget", msgUtils.getMessage("PAGE_TITLE_CLIENT_HDLR_CONFIG"), msgUtils - .getMessage("PAGE_DESC_CLIENT_HDLR_CONFIG"), new WidgetContributorFactory() { - - public WidgetContributor create() { - return new ConfigClientHandlersTableWidget(); - } - }); - - } - - private class HandlersCommandFragment extends SequenceFragment { - - public HandlersCommandFragment() { - - add(new SimpleFragment(new HandlersDefaultingCommand(), "")); - - add(new ServiceHandlersFragment()); - add(new ClientHandlersFragment()); - } - - public void registerDataMappings(DataMappingRegistry dataRegistry) { - - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", HandlersDefaultingCommand.class); - - dataRegistry.addMapping(HandlersDefaultingCommand.class, "IsClientHandler", ClientHandlersFragment.class, "ClientHandlersEnabled", null); - dataRegistry.addMapping(HandlersDefaultingCommand.class, "IsServiceHandler", ServiceHandlersFragment.class, "ServiceHandlersEnabled", null); - - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"WsClientResource", ClientHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"WsServiceRefs", ClientHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"ClientProject", ClientHandlersWidgetOutputCommand.class); - - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "WsddResource", ServiceHandlersWidgetOutputCommand.class); - - } - - public void registerCanFinish(CanFinishRegistry canFinishRegistry) { - } - } - - private class ClientHandlersFragment extends BooleanFragment { - - boolean isClient_ = false; - - public ClientHandlersFragment() { - setCondition(new Condition() { - - public boolean evaluate() { - return isClient_; - } - }); - - SequenceFragment clientHandlersRootFragment = new SequenceFragment(); - - clientHandlersRootFragment.add(new SimpleFragment(new ClientHandlersWidgetDefaultingCommand(), "")); - - clientHandlersRootFragment.add(new SimpleFragment("ConfigClientHandlersTableWidget")); - clientHandlersRootFragment.add(new SimpleFragment(new ClientHandlersWidgetOutputCommand(), "")); - clientHandlersRootFragment.add(new SimpleFragment(new GenerateHandlerSkeletonCommand(), "")); - - setTrueFragment(clientHandlersRootFragment); - } - - public void setClientHandlersEnabled(boolean isClient) { - isClient_ = isClient; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.internal.env.core.fragment.CommandFragment#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) { - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ClientHandlersWidgetDefaultingCommand.class); - - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class, "WsClientResource", ClientHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class, "ClientProject", ClientHandlersWidgetOutputCommand.class); - - } - - } - - private class ServiceHandlersFragment extends BooleanFragment { - - boolean isService_ = false; - - public ServiceHandlersFragment() { - setCondition(new Condition() { - - public boolean evaluate() { - return isService_; - } - }); - - SequenceFragment serviceHandlersRootFragment = new SequenceFragment(); - serviceHandlersRootFragment.add(new SimpleFragment(new ServiceHandlersWidgetDefaultingCommand(), "")); - - SequenceFragment serviceHandlersFragment = new SequenceFragment(); - serviceHandlersFragment.add(new SimpleFragment("ConfigServiceHandlersTableWidget")); - serviceHandlersFragment.add(new SimpleFragment(new ServiceHandlersWidgetOutputCommand(), "")); - serviceHandlersFragment.add(new SimpleFragment(new GenerateHandlerSkeletonCommand(), "")); - - serviceHandlersRootFragment.add(serviceHandlersFragment); - - setTrueFragment(serviceHandlersRootFragment); - } - - public void setServiceHandlersEnabled(boolean isService) { - isService_ = isService; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.command.internal.env.core.fragment.CommandFragment#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) { - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ServiceHandlersWidgetDefaultingCommand.class); - - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "WsddResource", ServiceHandlersWidgetOutputCommand.class); - - } - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/GenSampleWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/GenSampleWidgetBinding.java deleted file mode 100644 index 6ee84f190..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/GenSampleWidgetBinding.java +++ /dev/null @@ -1,403 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.common.StringToIProjectTransformer; -import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateServerCommand; -import org.eclipse.jst.ws.internal.consumption.ui.command.data.EclipseIPath2URLStringTransformer; -import org.eclipse.jst.ws.internal.consumption.ui.common.FinishFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetOutputCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions.ClientExtensionOutputCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestDelegateCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.ClientTestWidget; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishDefaultCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.FinishTestFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.TestDefaultingFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.TestWebServiceClient; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.WebServiceClientTestArrivalCommand; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactory; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.SelectionCommand; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceClientInfo; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceState; - - -public class GenSampleWidgetBinding implements CommandWidgetBinding -{ - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#create() - */ - public CommandFragmentFactory create() - { - return new CommandFragmentFactory() - { - public CommandFragment create() - { - return new GenSampleRootCommandFragment(); - } - }; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) - */ - public void registerCanFinish(CanFinishRegistry canFinishRegistry) - { - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - // Before Client Test widget. - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService",FinishTestFragment.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService", ClientTestWidget.class ); - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ClientTestWidget.class ); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProject", ClientTestWidget.class ); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProjectEAR", ClientTestWidget.class ); - dataRegistry.addMapping(TestDefaultingFragment.class, "TestFacility",ClientTestWidget.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Folder",ClientTestWidget.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "JspFolder",ClientTestWidget.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "RunClientTest",ClientTestWidget.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Methods",ClientTestWidget.class); - - // After the client test widget - dataRegistry.addMapping(ClientTestWidget.class, "SampleProjectEAR",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "SampleProject",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "TestFacility",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "Folder",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "JspFolder",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "RunClientTest",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "SampleMethods",ClientTestDelegateCommand.class); - - dataRegistry.addMapping(ClientTestWidget.class, "TestService",FinishTestFragment.class); - dataRegistry.addMapping(ClientTestWidget.class, "TestID",FinishTestFragment.class); - dataRegistry.addMapping(ClientTestWidget.class, "IsTestWidget",FinishTestFragment.class); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerWidgetMappings(org.eclipse.wst.command.env.ui.widgets.WidgetRegistry) - */ - public void registerWidgetMappings(WidgetRegistry widgetRegistry) - { - String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - - widgetRegistry.add( "ClientTestWidget", - msgUtils.getMessage("PAGE_TITLE_WS_SAMPLE"), - msgUtils.getMessage("PAGE_DESC_WS_SAMPLE"), - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new ClientTestWidget(); - } - }); - } - - private class InitializeProxyCommand extends AbstractDataModelOperation - { - private IStructuredSelection selection_; - private TypeRuntimeServer typeRuntimeServer_; - private String project_; - private String module_; - private String earProject_; - private String ear_; - private IWebServiceClient webServiceClient_; - private String j2eeLevel_; - private String wsdlURI_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - // Split up the project and module - int index = module_.indexOf("/"); - if (index!=-1){ - project_ = module_.substring(0,index); - module_ = module_.substring(index+1); - } - - if (ear_!=null && ear_.length()>0) - { - int earIndex = ear_.indexOf("/"); - if (earIndex!=-1) { - earProject_ = ear_.substring(0,earIndex); - ear_ = ear_.substring(earIndex+1); - } - } - - WebServiceClientInfo clientInfo = new WebServiceClientInfo(); - clientInfo.setImplURL(getProxyBean()); - clientInfo.setJ2eeLevel(j2eeLevel_); - clientInfo.setServerFactoryId(typeRuntimeServer_.getServerId()); - clientInfo.setServerInstanceId(typeRuntimeServer_.getServerInstanceId()); - clientInfo.setState(WebServiceState.UNKNOWN_LITERAL); - clientInfo.setWebServiceRuntimeId(typeRuntimeServer_.getRuntimeId()); - clientInfo.setWsdlURL(wsdlURI_); - if (clientInfo.getServerInstanceId()==null) - { - CreateServerCommand createServerCommand = new CreateServerCommand(); - createServerCommand.setServerFactoryid(clientInfo.getServerFactoryId()); - createServerCommand.setEnvironment( env ); - IStatus createServerStatus = createServerCommand.execute( null, null ); - if (createServerStatus.getSeverity()==Status.OK){ - clientInfo.setServerInstanceId(createServerCommand.getServerInstanceId()); - } - else if (createServerStatus.getSeverity()==Status.ERROR){ - env.getStatusHandler().reportError( createServerStatus ); - } - - } - - AddModuleToServerCommand command = new AddModuleToServerCommand(); - command.setServerInstanceId(clientInfo.getServerInstanceId()); - if (earProject_ != null && earProject_.length()>0 && ear_!= null && ear_.length()>0) - { - command.setProject(earProject_); - command.setModule(ear_); - } - else - { - command.setProject(project_); - command.setModule(module_); - } - - command.setEnvironment( env ); - status = command.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - - webServiceClient_ = new TestWebServiceClient(clientInfo); - return status; - } - - public String getProxyBean() - { - String proxyBean = ""; - - try - { - IResource resource = ResourceUtils.getResourceFromSelection( selection_.getFirstElement() ); - String beanPackage = ResourceUtils.getJavaResourcePackageName( resource.getFullPath() ); - - if( beanPackage==null ) - beanPackage = ""; - else - beanPackage = beanPackage + "."; - - proxyBean = beanPackage + resource.getName(); - - if( proxyBean.toLowerCase().endsWith(".java") || proxyBean.toLowerCase().endsWith(".class")) - { - proxyBean = proxyBean.substring(0,proxyBean.lastIndexOf('.')); - } - } - catch( CoreException exc ) - { - } - - return proxyBean; - } - - public IWebServiceClient getWebServiceClient() - { - return webServiceClient_; - } - - public boolean getGenerateProxy() - { - return true; - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer typeRuntimeServer ) - { - typeRuntimeServer_ = typeRuntimeServer; - } - - public void setClientJ2EEVersion( String j2eeLevel ) - { - j2eeLevel_ = j2eeLevel; - } - - public void setModule( String module ) - { - module_ = module; - } - - public void setModuleType( String moduleType) - { - } - - public void setResourceContext( ResourceContext resourceContext ) - { - } - - public void setInitialSelection( IStructuredSelection selection ) - { - selection_ = selection; - } - } - - private class GenSampleRootCommandFragment extends SequenceFragment - { - public GenSampleRootCommandFragment() - { - add( new SimpleFragment( new ClientWizardWidgetDefaultingCommand(), "" ) ); - add( new SimpleFragment( new ClientWizardWidgetOutputCommand(), "" )); - add( new SimpleFragment( new WSDLSelectionWidgetDefaultingCommand(), "")); - add( new SimpleFragment( new ClientRuntimeSelectionWidgetDefaultingCommand(), "")); - add( new SimpleFragment( new ClientExtensionDefaultingCommand( true ), "")); - add( new SimpleFragment( new InitializeProxyCommand(), "" )); - add( new SimpleFragment( new ClientExtensionOutputCommand(), "" ) ); - add( new SimpleFragment( new TestDefaultingFragment(),"")); - add( new ClientTestFragment( "ClientTestWidget") ); - add( new FinishFragment() ); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.internal.env.core.fragment.CommandFragment#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - //Map SelectionCommand - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialSelection", null); - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", InitializeProxyCommand.class ); - - // Map ClientWizardWidgetDefaultingCommand command. - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "TestService", ClientWizardWidgetOutputCommand.class, "TestService", new ForceTrue() ); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ResourceContext", ClientWizardWidgetOutputCommand.class); - - // Map ClientWizardWidgetOutputCommand command. - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ClientTypeRuntimeServer", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "TestService", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ResourceContext", ClientExtensionDefaultingCommand.class); - - // Map ClientRuntimeSelectionWidgetDefaultingCommand command - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "Runtime2ClientTypes", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarComponentName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentType", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientJ2EEVersion", ClientExtensionDefaultingCommand.class); - - // Map WSDLSelectionWidgetDefaultingCommand command. - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", WSDLSelectionWidgetDefaultingCommand.class ); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "GenWSIL", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WsilURI", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WebServiceURI", ClientExtensionDefaultingCommand.class, "WsdlURI", new EclipseIPath2URLStringTransformer()); - - // Map ClientExtensionDefaultingCommand command. - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionFragment.class); - - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject", WebServiceClientTestArrivalCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", WebServiceClientTestArrivalCommand.class); - - - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "GenerateProxy", ClientTestFragment.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService", ClientTestFragment.class ); - - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientNeedEAR", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientEarProjectName", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientEarComponentName", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProject",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ServiceServerInstanceId", FinishDefaultCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServer", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "WsdlURI", ClientTestDelegateCommand.class); - - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientTypeRuntimeServer", InitializeProxyCommand.class ); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientJ2EEVersion", InitializeProxyCommand.class); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProject", InitializeProxyCommand.class, "Module", null ); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProjectType", InitializeProxyCommand.class, "ModuleType", null); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "ClientProjectEAR", InitializeProxyCommand.class, "Ear", null ); - dataRegistry.addMapping( ClientWizardWidgetOutputCommand.class, "ResourceContext", InitializeProxyCommand.class); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "WsdlURI", InitializeProxyCommand.class ); - - - - - // Map InitializeProxyCommand command. - dataRegistry.addMapping(InitializeProxyCommand.class, "WebServiceClient", ClientExtensionOutputCommand.class); - dataRegistry.addMapping(InitializeProxyCommand.class, "GenerateProxy", ClientExtensionOutputCommand.class); - - // Map ClientExtensionOutputCommand command. - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ProxyBean", WebServiceClientTestArrivalCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ProxyBean", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "GenerateProxy", ClientTestFragment.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "GenerateProxy", FinishTestFragment.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "GenerateProxy", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ServerInstanceId", FinishDefaultCommand.class); - - // MAP post server config call - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", ClientExtensionOutputCommand.class, "EARProjectName", new StringToIProjectTransformer()); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServerInstance", ClientExtensionOutputCommand.class, "ExistingServerId", null); - - - // Map WebServiceClientTestArrivalCommand command. - dataRegistry.addMapping(TestDefaultingFragment.class, "TestFacility",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "TestFacility",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Folder",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "JspFolder",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "RunClientTest",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "Methods",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProject",ClientTestDelegateCommand.class); - dataRegistry.addMapping(WebServiceClientTestArrivalCommand.class, "SampleProjectEAR",ClientTestDelegateCommand.class); - - - } - } - - private class ForceTrue implements Transformer - { - public Object transform(Object value) - { - return new Boolean(true); - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSILWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSILWidgetBinding.java deleted file mode 100644 index 5cf4625c7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSILWidgetBinding.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; - -import org.eclipse.jst.ws.internal.consumption.ui.widgets.ImportWSILWidget; -import org.eclipse.jst.ws.internal.consumption.ui.wsil.AddWSDLToWSILWrapperCommand; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactory; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.SelectionCommand; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; - - -public class ImportWSILWidgetBinding implements CommandWidgetBinding -{ - public ImportWSILWidgetBinding() - { - } - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#create() - */ - public CommandFragmentFactory create() - { - return new CommandFragmentFactory() - { - public CommandFragment create() - { - SequenceFragment root = new SequenceFragment(); - root.add(new SimpleFragment("ImportWSILWidget")); - root.add(new SimpleFragment(new AddWSDLToWSILWrapperCommand(), "")); - return root; - } - }; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) - */ - public void registerCanFinish(CanFinishRegistry canFinishRegistry) - { - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - // ImportWSILWidget - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ImportWSILWidget.class); - - // AddWSDLToWSILWrapperCommand - dataRegistry.addMapping(ImportWSILWidget.class, "GenWSILArguments", AddWSDLToWSILWrapperCommand.class, "Args", null); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerWidgetMappings(org.eclipse.wst.command.env.ui.widgets.WidgetRegistry) - */ - public void registerWidgetMappings(WidgetRegistry widgetRegistry) - { - String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - - widgetRegistry.add("ImportWSILWidget", - msgUtils.getMessage("TITLE_WSIL_IMPORT"), - msgUtils.getMessage("DESC_WSIL_IMPORT"), - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new ImportWSILWidget(); - } - } - ); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSWidgetBinding.java deleted file mode 100644 index eeaf6294e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSWidgetBinding.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.binding; - -import org.eclipse.jst.ws.internal.consumption.ui.widgets.PublishToPrivateUDDICommandFragment; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.PublishWSWidget; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment; -import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentFactory; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.CanFinishRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.CommandWidgetBinding; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; -import org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand; - - -public class ImportWSWidgetBinding implements CommandWidgetBinding -{ - private CanFinishRegistry canFinishRegistry; - private WidgetRegistry widgetRegistry; - private DataMappingRegistry dataMappingRegistry; - private PublishToPrivateUDDICommandFragment publishToPrivateUDDICmdFrag; - - public ImportWSWidgetBinding() - { - publishToPrivateUDDICmdFrag = new PublishToPrivateUDDICommandFragment(); - } - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#create() - */ - public CommandFragmentFactory create() - { - return new CommandFragmentFactory() - { - public CommandFragment create() - { - SequenceFragment root = new SequenceFragment(); - root.add(new SimpleFragment("WSImport")); - root.add(publishToPrivateUDDICmdFrag); - root.add(new SimpleFragment(new WSExplorerLauncherCommand(), "")); - return root; - } - }; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerCanFinish(org.eclipse.wst.command.env.ui.widgets.CanFinishRegistry) - */ - public void registerCanFinish(CanFinishRegistry canFinishRegistry) - { - this.canFinishRegistry = canFinishRegistry; - publishToPrivateUDDICmdFrag.registerCanFinish(this.canFinishRegistry); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerDataMappings(org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - this.dataMappingRegistry = dataRegistry; - publishToPrivateUDDICmdFrag.registerDataMappings(this.dataMappingRegistry); - - // PublishToPrivateUDDICommandFragment - dataMappingRegistry.addMapping(PublishWSWidget.class, "PublishToPrivateUDDI", PublishToPrivateUDDICommandFragment.class); - - // LaunchWebServicesExplorerCommand - dataMappingRegistry.addMapping(PublishWSWidget.class, "ForceLaunchOutsideIDE", WSExplorerLauncherCommand.class); - dataMappingRegistry.addMapping(PublishWSWidget.class, "LaunchOptions", WSExplorerLauncherCommand.class); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.CommandWidgetBinding#registerWidgetMappings(org.eclipse.wst.command.env.ui.widgets.WidgetRegistry) - */ - public void registerWidgetMappings(WidgetRegistry widgetRegistry) - { - String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - this.widgetRegistry = widgetRegistry; - publishToPrivateUDDICmdFrag.registerWidgetMappings(this.widgetRegistry); - - widgetRegistry.add("WSImport", - msgUtils.getMessage("PAGE_TITLE_WS_FIND"), - msgUtils.getMessage("PAGE_DESC_WS_FIND"), - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new PublishWSWidget(false); - } - } - ); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionDefaultingCommand.java deleted file mode 100644 index 676e74f46..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionDefaultingCommand.java +++ /dev/null @@ -1,413 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; - -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; -import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -public class ClientExtensionDefaultingCommand extends AbstractDataModelOperation -{ - // ClientWizardWidget - private TypeRuntimeServer clientIds_; - private Boolean testService; - private ResourceContext resourceContext; - - // ClientRuntimeSelectionWidget - private SelectionListChoices clientChoices_; - private String clientProjectName_; - private String clientEarProjectName_; - private String clientComponentName_; - private String clientEarComponentName_; - private String clientComponentType_; - private String j2eeVersion; - private boolean clientNeedEAR_; - - private String serviceServerFactoryId_; - private String serviceServerInstanceId_; - - // WSDLSelectionWidget - private boolean genWSIL; - private String wsilURI; - - // WSDLSelectionConditionCommand - private WebServicesParser webServicesParser; - - // WSDLSelectionTreeWidget - private String wsdlURI; - - private boolean isClientScenario_; - private boolean genProxy_ = true; - private String launchedServiceTestName; - - //ServerDeployableConfigurationCommand - private String serverInstId_; - - public ClientExtensionDefaultingCommand( boolean isClientScenario ) - { - isClientScenario_ = isClientScenario; - } - - /** - * - * @return returns true if this command is running in the client wizard and - * false if this command is running in the create web service wizard. - */ - public boolean getIsClientScenario() - { - return isClientScenario_; - } - - - public void setRuntime2ClientTypes( SelectionListChoices choices ) - { - clientChoices_ = choices; - } - - public SelectionListChoices getRuntime2ClientTypes() - { - return clientChoices_; - } - - - public void setClientTypeRuntimeServer(TypeRuntimeServer ids) - { - clientIds_ = ids; - } - - public TypeRuntimeServer getClientTypeRuntimeServer() - { - if (clientIds_.getServerInstanceId()==null || clientIds_.getServerInstanceId().length()==0) - { - //Set the instance id from the service side if the factory ids match - if (serviceServerInstanceId_!=null && serviceServerInstanceId_.length()>0) - { - if (serviceServerFactoryId_!=null && serviceServerFactoryId_.length()>0) - { - if (serviceServerFactoryId_.equals(clientIds_.getServerId())) - { - clientIds_.setServerInstanceId(serviceServerInstanceId_); - } - } - } - } - return clientIds_; - } - - public void setServiceExistingServerInstId(String serverInstId) { - this.serverInstId_ = serverInstId; - } - - public String getServiceExistingServerInstId(){ - return this.serverInstId_; - } - - /** - * @return Returns the clientIsExistingServer. - */ - public boolean isClientIsExistingServer() - { - return clientIds_.getServerInstanceId() != null; - } - - /** - * @return Returns the clientProject. - */ - public String getClientProject() - { - return clientProjectName_ + "/" + clientComponentName_; - } - - /** - * @return Returns the clientProjectEAR. - */ - public String getClientProjectEAR() - { - if (clientEarProjectName_!=null && clientEarProjectName_.length()>0 - && clientEarComponentName_!=null && clientEarComponentName_.length()>0) - { - return clientEarProjectName_ + "/" + clientEarComponentName_; - } - else - { - return ""; - } - } - - /* - private String getModuleProjectName( String projectName ) - { - String result = ""; - - if( projectName != null && !projectName.equals("") ) - { - IPath projectPath = new Path( projectName ); - IProject project = (IProject)ResourceUtils.findResource( projectPath ); - String moduleName = J2EEUtils.getFirstWebModuleName( project ); - - result = projectName + "/" + moduleName; - } - - return result; - } - */ - /** - * @return Returns the clientProjectType. - */ - - public String getClientProjectType() - { - //return clientChoices_.getChoice().getList().getSelection(); - return clientComponentType_; - } - - /** - * @return Returns the clientRuntime. - */ - public String getClientRuntime() - { - return clientIds_.getRuntimeId(); - } - - /** - * @return Returns the clientServer. - */ - public String getClientServer() - { - return clientIds_.getServerId(); - } - - public String getClientServerInstance() - { - return clientIds_.getServerInstanceId(); - } - - public void setClientExistingServerInstanceId(String serverInstId){ - - if (clientIds_.getServerInstanceId()==null) - clientIds_.setServerInstanceId(serverInstId); - } - - /** - * @return Returns the genWSIL. - */ - public boolean isGenWSIL() - { - return genWSIL; - } - - /** - * @param genWSIL - * The genWSIL to set. - */ - public void setGenWSIL(boolean genWSIL) - { - this.genWSIL = genWSIL; - } - - /** - * @return Returns the resourceContext. - */ - public ResourceContext getResourceContext() - { - return resourceContext; - } - - /** - * @param resourceContext - * The resourceContext to set. - */ - public void setResourceContext(ResourceContext resourceContext) - { - this.resourceContext = resourceContext; - } - - /** - * @return Returns the testProxySelected. - */ - public Boolean getTestService() - { - return testService; - } - - /** - * @param testProxySelected - * The testProxySelected to set. - */ - public void setTestService(Boolean testService) - { - this.testService = testService; - } - - /** - * @return Returns the wsdlURI. - */ - public String getWsdlURI() - { - return wsdlURI; - } - - /** - * @param wsdlURI - * The wsdlURI to set. - */ - public void setWsdlURI(String wsdlURI) - { - this.wsdlURI = wsdlURI; - } - - /** - * @return Returns the wsilURI. - */ - public String getWsilURI() - { - return wsilURI; - } - - /** - * @param wsilURI - * The wsilURI to set. - */ - public void setWsilURI(String wsilURI) - { - this.wsilURI = wsilURI; - } - - /** - * @return Returns the webServicesParser. - */ - public WebServicesParser getWebServicesParser() - { - if (webServicesParser != null) - return webServicesParser; - else - return new WebServicesParserExt(); - } - - /** - * @param webServicesParser - * The webServicesParser to set. - */ - public void setWebServicesParser(WebServicesParser webServicesParser) - { - this.webServicesParser = webServicesParser; - } - - /** - * @return Returns the j2eeVersion. - */ - public String getClientJ2EEVersion() - { - return j2eeVersion; - } - - /** - * @param version The j2eeVersion to set. - */ - public void setClientJ2EEVersion(String version) - { - j2eeVersion = version; - } - - /** - * - * @return returns true if a proxy should be generated and false otherwise. - */ - public boolean getGenerateProxy() - { - return genProxy_; - } - - public void setGenerateProxy( boolean genProxy ) - { - genProxy_ = genProxy; - } - - public void setLaunchedServiceTestName(String launchedServiceTestName) - { - this.launchedServiceTestName = launchedServiceTestName; - } - - /** - * - * @return returns the name of the test facility to launch. - */ - public String getLaunchedServiceTestName() - { - return launchedServiceTestName; - } - - /** - * - * @return returns true if the client project needs an EAR project. - */ - public boolean getClientNeedEAR() - { - return clientNeedEAR_; - } - - public void setClientNeedEAR(boolean clientNeedEAR) - { - clientNeedEAR_ = clientNeedEAR; - } - - - public void setClientComponentType(String clientComponentType) - { - this.clientComponentType_ = clientComponentType; - } - - public void setClientProjectName(String clientProjectName) - { - this.clientProjectName_ = clientProjectName; - } - - public void setClientComponentName(String clientComponentName) - { - this.clientComponentName_ = clientComponentName; - } - - public void setClientEarProjectName(String clientEarProjectName) - { - this.clientEarProjectName_ = clientEarProjectName; - } - - public void setClientEarComponentName(String clientEarComponentName) - { - this.clientEarComponentName_ = clientEarComponentName; - } - - public String getClientEarProjectName() - { - return clientEarProjectName_; - } - - public String getClientEarComponentName() - { - return clientEarComponentName_; - } - - public void setServiceServerFactoryId(String id) - { - serviceServerFactoryId_ = id; - } - - public void setServiceServerInstanceId(String id) - { - serviceServerInstanceId_ = id; - } - - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionFragment.java deleted file mode 100644 index 7fcd8b265..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionFragment.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; - -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.env.core.fragment.ExtensionFragment; - - -public class ClientExtensionFragment extends ExtensionFragment -{ - public ClientExtensionFragment() - { - } - - protected ClientExtensionFragment( ClientExtensionFragment fragment ) - { - super( fragment ); - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer ids ) - { - setExtensionIds( new String[]{ ids.getTypeId(), ids.getRuntimeId(), ids.getServerId() } ); - } - - /* (non-Javadoc) - * @see java.lang.Object#clone() - */ - public Object clone() - { - return new ClientExtensionFragment( this ); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionOutputCommand.java deleted file mode 100644 index 4068f1dd1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionOutputCommand.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/** - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; - -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; - -public class ClientExtensionOutputCommand extends AbstractDataModelOperation -{ - private IWebServiceClient webServiceClient_; - - /** - * @return Returns the proxyBean. - */ - - public String getProxyBean() - { - return webServiceClient_.getWebServiceClientInfo().getImplURL(); - } - - public boolean getGenerateProxy() - { - return true; - } - - /** - * @return Returns the setEndpointMethod. - */ - public String getSetEndpointMethod() - { - return "setEndpoint"; - } - - public void setWebServiceClient(IWebServiceClient wsc) - { - webServiceClient_ = wsc; - } - - public String getServerInstanceId() - { - return webServiceClient_.getWebServiceClientInfo().getServerInstanceId(); - } - - public String getServerFactoryId() - { - return webServiceClient_.getWebServiceClientInfo().getServerFactoryId(); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionDefaultingCommand.java deleted file mode 100644 index 9440444b4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionDefaultingCommand.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; - -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -public class ServerExtensionDefaultingCommand extends AbstractDataModelOperation -{ - private Boolean startService; - private Boolean testService; - private Boolean publishService; - private TypeRuntimeServer serviceIds_; - //private SelectionListChoices serviceChoices_; - private String serviceProjectName_; - private String serviceEarProjectName_; - private String serviceComponentName_; - private String serviceEarComponentName_; - private String j2eeVersion; - private boolean serviceNeedEAR_; - private WebServicesParser wsdlParser_; - - - - public void setServiceTypeRuntimeServer(TypeRuntimeServer ids) - { - serviceIds_ = ids; - } - - public void setServiceExistingServerInstanceId(String serverInstId){ - - if (serviceIds_.getServerInstanceId()==null) - serviceIds_.setServerInstanceId(serverInstId); - } - - /** - * - * @return returns the TypeRuntimeService object that the user has selected on - * page 3 of the wizard. - */ - public TypeRuntimeServer getServiceTypeRuntimeServer() - { - return serviceIds_; - } - - /* - public void setServiceProject2EARProject(SelectionListChoices choices) - { - serviceChoices_ = choices; - } - */ - - /** - * @return Returns the publishService. - */ - public Boolean getPublishService() - { - return publishService; - } - - /** - * @param publishService - * The publishService to set. - */ - public void setPublishService(Boolean publishService) - { - this.publishService = publishService; - } - - /** - * @return Returns the serverIsExistingServer. - */ - public boolean getServerIsExistingServer() - { - return serviceIds_.getServerInstanceId() != null; - } - - /** - - * @return Returns the serverInstanceId - */ - public String getServiceServerInstanceId() - { - return serviceIds_.getServerInstanceId(); - } - - /** - * @return Returns the serverProject. - */ - public String getServerProject() - { - return serviceProjectName_ + "/" + serviceComponentName_; - } - - /** - * @return Returns the serverProjectEAR. - */ - public String getServerProjectEAR() - { - if (serviceEarProjectName_!=null && serviceEarProjectName_.length()>0 && - serviceEarComponentName_!=null && serviceEarComponentName_.length()>0) - { - return serviceEarProjectName_ + "/" + serviceEarComponentName_; - } - else - { - return ""; - } - } - - /** - * @return Returns the serverRuntime. - */ - public String getServerRuntime() - { - return serviceIds_.getRuntimeId(); - } - - /** - * @return Returns the serverServer. - */ - public String getServerServer() - { - return serviceIds_.getServerId(); - } - - /** - * @return Returns the serviceScenarioId. - */ - public String getServiceScenarioId() - { - return serviceIds_.getTypeId(); - } - - /** - * @return Returns the startService. - */ - public Boolean getStartService() - { - return startService; - } - - /** - * @param startService - * The startService to set. - */ - public void setStartService(Boolean startService) - { - this.startService = startService; - } - - /** - * @return Returns the testService. - */ - public Boolean getTestService() - { - return testService; - } - - /** - * @param testService - * The testService to set. - */ - public void setTestService(Boolean testService) - { - this.testService = testService; - } - - public Boolean getPublish() - { - return new Boolean(true); - } - - /** - * @return Returns the j2eeVersion. - */ - public String getServiceJ2EEVersion() - { - return j2eeVersion; - } - - /** - * @param version The j2eeVersion to set. - */ - public void setServiceJ2EEVersion(String version) - { - j2eeVersion = version; - } - - /** - * - * @return returns true if the web service project needs to be in an EAR project. - */ - public boolean getServiceNeedEAR() - { - return serviceNeedEAR_; - } - - public void setServiceNeedEAR(boolean serviceNeedEAR) - { - serviceNeedEAR_ = serviceNeedEAR; - } - - /** - * - * @return returns true if the web service project is an EJB project. - */ - public boolean getIsServiceProjectEJB() - { - //If the type/server/runtime suggests that an EJB project - //is required, return true. - boolean ejbRequired = false; - boolean ejbRequired2 = false; - // rskreg - //WebServiceServerRuntimeTypeRegistry wssrtRegistry = WebServiceServerRuntimeTypeRegistry.getInstance(); - if (serviceIds_ != null) - { - //String serverTypeId = wssrtRegistry.getWebServiceServerByFactoryId(serviceIds_.getServerId()).getId(); - //String serverTypeId = wssrtRegistry.getWebServiceServerByFactoryId(serviceIds_.getServerId()).getId(); - //ejbRequired = wssrtRegistry.requiresEJBModuleFor(serverTypeId, serviceIds_.getRuntimeId(), serviceIds_.getTypeId()); - ejbRequired = WebServiceRuntimeExtensionUtils.requiresEJBModuleFor(serviceIds_.getServerId(), serviceIds_.getRuntimeId(), serviceIds_.getTypeId()); - //ejbRequired2 = wssrtRegistry.requiresEJBProject(serviceIds_.getTypeId()); - ejbRequired2 = WebServiceRuntimeExtensionUtils.requiresEJBProject(serviceIds_.getRuntimeId(), serviceIds_.getTypeId()); - } - - // rskreg - return (ejbRequired || ejbRequired2); - } - - /** - * @return Returns the wsdlParser_. - */ - public WebServicesParser getWebServicesParser() - { - if( wsdlParser_ == null ) - { - wsdlParser_ = new WebServicesParserExt(); - } - - return wsdlParser_; - } - /** - * @param wsdlParser_ The wsdlParser_ to set. - */ - public void setWebServicesParser(WebServicesParser wsdlParser ) - { - wsdlParser_ = wsdlParser; - } - - - public void setServiceProjectName(String serviceProjectName) - { - this.serviceProjectName_ = serviceProjectName; - } - - public void setServiceComponentName(String s) - { - serviceComponentName_ = s; - } - - public void setServiceEarProjectName(String serviceEarProjectName) - { - this.serviceEarProjectName_ = serviceEarProjectName; - } - - public void setServiceEarComponentName(String s) - { - serviceEarComponentName_ = s; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionFragment.java deleted file mode 100644 index 101cddece..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionFragment.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; - -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.env.core.fragment.ExtensionFragment; - - -public class ServerExtensionFragment extends ExtensionFragment -{ - public ServerExtensionFragment() - { - - } - - protected ServerExtensionFragment( ServerExtensionFragment fragment ) - { - super( fragment ); - } - - public void setServiceTypeRuntimeServer( TypeRuntimeServer ids ) - { - setExtensionIds( new String[]{ ids.getTypeId(), ids.getRuntimeId(), ids.getServerId() } ); - } - - /* (non-Javadoc) - * @see java.lang.Object#clone() - */ - public Object clone() - { - return new ServerExtensionFragment( this ); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionOutputCommand.java deleted file mode 100644 index 4f8f2a01f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionOutputCommand.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/** - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; - -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebService; - -public class ServerExtensionOutputCommand extends AbstractDataModelOperation -{ - //private String wsdlURI_; - private WebServicesParser wsdlParser_; - private IWebService webService_; - - private boolean isWebProjectStartupRequested_ = false; - - - /** - * @return Returns the wsdlURI. - */ - public String getWsdlURI() - { - return webService_.getWebServiceInfo().getWsdlURL(); - } - - /** - * @param wsdlURI - * The wsdlURI to set. - */ - /* - public void setWsdlURI(String wsdlURI) - { - wsdlURI_ = wsdlURI; - } - */ - - public void setWebService(IWebService ws) - { - webService_ = ws; - } - - /** - * @return Returns the wsdlParser_. - */ - public WebServicesParser getWebServicesParser() - { - if( wsdlParser_ == null ) - { - wsdlParser_ = new WebServicesParserExt(); - } - - return wsdlParser_; - } - /** - * @param wsdlParser_ The wsdlParser_ to set. - */ - public void setWebServicesParser(WebServicesParser wsdlParser_) - { - this.wsdlParser_ = wsdlParser_; - } -/** - * @param earProjectName The earProjectName to set. - */ -public void setEarProjectName(String earProjectName) { -} -/** - * @param existingServerId The existingServerId to set. - */ -public void setExistingServerId(String existingServerId) { -} - -/** - * @return Returns the isRestartProjectNeeded. - */ -public boolean getIsWebProjectStartupRequested() { - return isWebProjectStartupRequested_; -} -/** - * @param isRestartProjectNeeded The isRestartProjectNeeded to set. - */ -public void setIsWebProjectStartupRequested(boolean isRestartProjectNeeded) { - this.isWebProjectStartupRequested_ = isRestartProjectNeeded; -} - -public String getServiceServerFactoryId() -{ - return webService_.getWebServiceInfo().getServerFactoryId(); -} - -public String getServiceServerInstanceId() -{ - return webService_.getWebServiceInfo().getServerInstanceId(); -} -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/AbstractObjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/AbstractObjectSelectionWidget.java deleted file mode 100644 index cdb6e3b1f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/AbstractObjectSelectionWidget.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; - - -public abstract class AbstractObjectSelectionWidget extends SimpleWidgetDataContributor implements IObjectSelectionWidget -{ - public void setInitialSelection(IStructuredSelection initialSelection) - { - // subclass should override this method - } - - public IStructuredSelection getObjectSelection() - { - // subclass should override this method - return new StructuredSelection(); - } - - public IStatus validateSelection(IStructuredSelection objectSelection) - { - // subclass should override this method - return Status.OK_STATUS; - } - - public IProject getProject() - { - // subclass should override this method - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionTransformer.java deleted file mode 100644 index 61f6e3a66..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionTransformer.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.j2ee.ejb.EnterpriseBean; -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; - -public class EJBSelectionTransformer implements Transformer -{ - - public Object transform(Object value) - { - if (value instanceof IStructuredSelection) - { - Object sel = ((IStructuredSelection)value).getFirstElement(); - if (sel instanceof EnterpriseBean) - { - return new StructuredSelection(((EnterpriseBean)sel).getName()); - } - } - return value; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java deleted file mode 100644 index 2caee32e8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java +++ /dev/null @@ -1,394 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import java.util.Collections; -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.j2ee.ejb.EJBJar; -import org.eclipse.jst.j2ee.ejb.EJBResource; -import org.eclipse.jst.j2ee.ejb.Session; -import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -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.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class EJBSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget -{ - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - private Combo earList; - private EJBTableViewer beanList; - private IVirtualComponent[] earComponents; - //rskejb private EARNatureRuntime[] earProjects; - private Integer selectedBeanIndex = null; - private Vector ejbBeanNames; - private Vector ejbComponentNames; - private Vector ejbComponentProjectNames; - //rskejb private Vector ejbProjectNames; - private Listener statusListener_; - /* CONTEXT_ID PEBD0001 for the EAR Projects drop-down box */ - private String INFOPOP_PEBD_EAR_PROJECTS = "org.eclipse.jst.ws.consumption.ui.PEBD0001"; - /* CONTEXT_ID PEBD0002 for the table containing all of the bean names */ - private String INFOPOP_PEBD_TABLE_BEAN_NAMES = "org.eclipse.jst.ws.consumption.ui.PEBD0002"; - - public EJBSelectionWidget() - { - earComponents = J2EEUtils.getAllEARComponents(); - /* rskejb - IProject[] projects = J2EEUtils.getEARProjects(); - - - Vector earVector = new Vector(); - for (int i = 0; i < projects.length; i++) - { - try - { - earVector.add(projects[i].getNature(IEARNatureConstants.NATURE_ID)); - } - catch (CoreException ce) - { - } - } - earProjects = (EARNatureRuntime[]) earVector.toArray(new EARNatureRuntime[0]); - rskejb */ - } - - public String getSelectedBean() - { - if (selectedBeanIndex != null) - { - return (String) (ejbBeanNames.elementAt(selectedBeanIndex.intValue())); - } - return null; - } - - public String getSelectedProject() - { - if (selectedBeanIndex != null) - { - return (String) (ejbComponentProjectNames.elementAt(selectedBeanIndex.intValue())); - } - return null; - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) - { - MessageUtils msgUtils = new MessageUtils(pluginId_ + ".plugin", this); - statusListener_ = statusListener; - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - GridData gd = new GridData(GridData.FILL_BOTH); - composite.setLayout(layout); - composite.setLayoutData(gd); - Composite projectComposite = new Composite(composite, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 2; - projectComposite.setLayout(layout); - projectComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); - new Label(projectComposite, SWT.NULL).setText(msgUtils.getMessage("LABEL_EAR_PROJECTS")); - earList = new Combo(projectComposite, SWT.DROP_DOWN | SWT.READ_ONLY); - earList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - earList.addSelectionListener(new SelectionAdapter() - { - public void widgetSelected(SelectionEvent evt) - { - Combo widget = (Combo) (evt.widget); - setBeanList(earComponents[widget.getSelectionIndex()]); - selectedBeanIndex = null; - statusListener_.handleEvent(null); - } - }); - addEARNamesToList(); - earList.setToolTipText(msgUtils.getMessage("TOOLTIP_EAR_PROJECTS")); - PlatformUI.getWorkbench().getHelpSystem().setHelp(earList, INFOPOP_PEBD_EAR_PROJECTS); - Group beanComposite = new Group(composite, SWT.NONE); - layout = new GridLayout(); - beanComposite.setLayout(layout); - beanComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); - beanComposite.setText(msgUtils.getMessage("LABEL_EJB_BEAN_NAME")); - beanList = new EJBTableViewer(beanComposite); - Table beanTable = beanList.getTable(); - gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); - gd.heightHint = 100; - beanTable.setLayoutData(gd); - beanTable.addSelectionListener(new SelectionAdapter() - { - public void widgetSelected(SelectionEvent evt) - { - Table table = (Table) (evt.widget); - selectedBeanIndex = new Integer(table.getSelectionIndex()); - statusListener_.handleEvent(null); - } - }); - beanTable.setToolTipText(msgUtils.getMessage("TOOLTIP_TABLE_BEAN_NAMES")); - PlatformUI.getWorkbench().getHelpSystem().setHelp(beanTable, INFOPOP_PEBD_TABLE_BEAN_NAMES); - if (earComponents != null && earComponents.length > 0) - { - setBeanList(earComponents[0]); - } - beanTable.getColumn(0).pack(); - beanTable.getColumn(1).pack(); - // This is a dummy label that forces the status label into the second - // column. - new Label(composite, SWT.NULL).setText(""); - return this; - } - - private void addEARNamesToList() - { - if (earComponents != null && earComponents.length > 0) - { - for (int index = 0; index < earComponents.length; index++) - { - earList.add(earComponents[index].getName()); - } - earList.setText(earList.getItem(0)); - } - } - - private void setBeanList(IVirtualComponent earComponent) - { - IVirtualComponent[] ejbComponentsArray = J2EEUtils.getReferencingEJBComponentsFromEAR(earComponent.getProject(), earComponent.getName()); - Table beanTable = beanList.getTable(); - beanTable.removeAll(); - ejbBeanNames = new Vector(); - ejbComponentNames = new Vector(); - ejbComponentProjectNames = new Vector(); - for (int index = 0; index < ejbComponentsArray.length; index++) - { - EJBArtifactEdit ejbEdit = null; - try { - ejbEdit = EJBArtifactEdit.getEJBArtifactEditForRead(ejbComponentsArray[index]); - EJBResource ejbRes = ejbEdit.getEJBJarXmiResource(); - EJBJar jar = ejbRes.getEJBJar(); - Vector beans = J2EEUtils.getBeanNames(jar); - String componentName = ejbComponentsArray[index].getName(); - String projectName = ejbComponentsArray[index].getProject().getName(); - ejbBeanNames.addAll(beans); - ejbComponentNames.addAll(Collections.nCopies(beans.size(), componentName)); - ejbComponentProjectNames.addAll(Collections.nCopies(beans.size(), projectName)); - } - finally { - if (ejbEdit!=null) - ejbEdit.dispose(); - } - } - beanList.setData(ejbBeanNames, ejbComponentNames); - beanList.setInput(ejbBeanNames); - - } - - /* - * @deprecated - */ - /* - private void setBeanList(EARNatureRuntime earProject) - { - Vector ejbProjects = J2EEUtils.getEJBProjects(earProject); - Table beanTable = beanList.getTable(); - beanTable.removeAll(); - ejbBeanNames = new Vector(); - //rskejb ejbProjectNames = new Vector(); - ejbComponentNames = new Vector(); - ejbComponents = new Vector(); - for (int index = 0; index < ejbProjects.size(); index++) - { - EJBNatureRuntime ejbNature = (EJBNatureRuntime) (ejbProjects.elementAt(index)); - EJBProjectResources ejbResource = new EJBProjectResources(ejbNature.getProject()); - EJBJar jar = ejbResource.getEJBJar(); - Vector beans = J2EEUtils.getBeanNames(jar); - String projectName = ejbNature.getProject().getName(); - ejbBeanNames.addAll(beans); - ejbProjectNames.addAll(Collections.nCopies(beans.size(), projectName)); - ejbResource.cleanup(); - } - beanList.setData(ejbBeanNames, ejbProjectNames); - beanList.setInput(ejbBeanNames); - } - */ - - public void setInitialSelection(IStructuredSelection initialSelection) - { - if (initialSelection != null && !initialSelection.isEmpty()) - { - Object object = initialSelection.getFirstElement(); - if (object instanceof Session) - { - Session session = (Session) object; - EJBJar jar = session.getEjbJar(); - if (jar != null) - { - for (int i = 0; i < earComponents.length; i++) - { - IVirtualComponent[] ejbComponents = J2EEUtils.getReferencingEJBComponentsFromEAR(earComponents[i].getProject(), earComponents[i].getName()); - for (int j=0; j <ejbComponents.length; j++) - { - EJBArtifactEdit ejbEdit = null; - try { - ejbEdit = EJBArtifactEdit.getEJBArtifactEditForRead(ejbComponents[j]); - EJBResource ejbRes = ejbEdit.getEJBJarXmiResource(); - if (ejbRes.getEJBJar() == jar) - { - earList.setText(earComponents[i].getName()); - setBeanList(earComponents[i]); - beanList.setSelection(new StructuredSelection(new Integer[]{new Integer(ejbBeanNames.indexOf(session.getName()))})); - selectedBeanIndex = new Integer(ejbBeanNames.indexOf(session.getName())); - return; - } - - } - finally { - if (ejbEdit!=null) - ejbEdit.dispose(); - } - - } - /* rskejb - Vector ejbProjects = J2EEUtils.getEJBProjects(earProjects[i]); - for (Iterator it = ejbProjects.iterator(); it.hasNext();) - { - EJBProjectResources ejbResource = new EJBProjectResources(((EJBNatureRuntime) it.next()).getProject()); - if (ejbResource.getEJBJar() == jar) - { - earList.setText(earProjects[i].getProject().getName()); - setBeanList(earProjects[i]); - beanList.setSelection(new StructuredSelection(new Integer[]{new Integer(ejbBeanNames.indexOf(session.getName()))})); - selectedBeanIndex = new Integer(ejbBeanNames.indexOf(session.getName())); - ejbResource.cleanup(); - return; - } - ejbResource.cleanup(); - } - rskejb */ - } - } - } - } - } - - public IStructuredSelection getObjectSelection() - { - IStructuredSelection sel = (IStructuredSelection) beanList.getSelection(); - if (sel != null && !sel.isEmpty()) - { - Object object = sel.getFirstElement(); - if (object instanceof Integer) - { - String selEJBName = (String) ejbBeanNames.get(((Integer) object).intValue()); - if (selEJBName != null) - { - IProject project = earComponents[earList.getSelectionIndex()].getProject(); - String name = earComponents[earList.getSelectionIndex()].getName(); - IVirtualComponent[] ejbComponents = J2EEUtils.getReferencingEJBComponentsFromEAR(project, name); - for (int i=0; i<ejbComponents.length; i++) - { - EJBArtifactEdit ejbEdit = null; - try - { - ejbEdit = EJBArtifactEdit.getEJBArtifactEditForRead(ejbComponents[i]); - EJBResource ejbRes = ejbEdit.getEJBJarXmiResource(); - EJBJar jar = ejbRes.getEJBJar(); - java.util.List sessions = jar.getSessionBeans(); - for (Iterator it2 = sessions.iterator(); it2.hasNext();) - { - Session session = (Session) it2.next(); - if (selEJBName.equals(session.getName())) - { - return new StructuredSelection(new Session[]{session}); - } - } - } - finally { - if (ejbEdit!=null) - ejbEdit.dispose(); - } - } - /* rskejb - Vector ejbProjects = J2EEUtils.getEJBProjects(earProjects[earList.getSelectionIndex()]); - for (Iterator it = ejbProjects.iterator(); it.hasNext();) - { - EJBProjectResources ejbResource = new EJBProjectResources(((EJBNatureRuntime) it.next()).getProject()); - EJBJar jar = ejbResource.getEJBJar(); - java.util.List sessions = jar.getSessionBeans(); - for (Iterator it2 = sessions.iterator(); it2.hasNext();) - { - Session session = (Session) it2.next(); - if (selEJBName.equals(session.getName())) - { - ejbResource.cleanup(); - return new StructuredSelection(new Session[]{session}); - } - } - ejbResource.cleanup(); - } - rskejb */ - } - } - } - return new StructuredSelection(new Object[0]); - } - - public IProject getProject() - { - String projectName = getSelectedProject(); - if (projectName != null && projectName.length() > 0) - return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - else - return null; - } - - public String getComponentName() - { - if (selectedBeanIndex != null) - { - return (String) (ejbComponentNames.elementAt(selectedBeanIndex.intValue())); - } - return null; - } - - public IStatus validateSelection(IStructuredSelection objectSelection) - { - return Status.OK_STATUS; - } - - public IStatus getStatus() - { - if (selectedBeanIndex == null) - { - return StatusUtils.errorStatus( "" ); - } - - return Status.OK_STATUS; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBTableViewer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBTableViewer.java deleted file mode 100644 index 98afd649a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBTableViewer.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import java.util.Vector; - -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; - -public class EJBTableViewer extends TableViewer -{ - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - private Vector beanNames; - private Vector projectNames; - - public EJBTableViewer(Composite parent) - { - super(parent, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); - MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - String columnProperties[] = {msgUtils.getMessage("TABLE_TITLE_EJB_BEAN_NAMES"), msgUtils.getMessage("TABLE_TITLE_EJB_PROJECT_NAME")}; - Table table = getTable(); - table.setHeaderVisible(true); - table.setLinesVisible(true); - TableLayout layout = new TableLayout(); - for (int i = 0; i < columnProperties.length; i++) - { - TableColumn column = new TableColumn(table, i); - column.setText(columnProperties[i]); - column.setAlignment(SWT.LEFT); - layout.addColumnData(new ColumnWeightData(50, 80, true)); - } - table.setLayout(layout); - setColumnProperties(columnProperties); - setContentProvider(new EJBContentProvider()); - setLabelProvider(new EJBLabelProvider()); - } - - public void setData(Vector beanNames, Vector projectNames) - { - this.beanNames = beanNames; - this.projectNames = projectNames; - } - private class EJBLabelProvider extends LabelProvider implements ITableLabelProvider - { - public String getColumnText(Object object, int columnIndex) - { - String result = null; - if (object instanceof Integer) - { - int index = ((Integer) object).intValue(); - if (columnIndex == 0) - { - return (String) (beanNames.elementAt(index)); - } - else if (columnIndex == 1) - { - return (String) (projectNames.elementAt(index)); - } - } - return result; - } - - public Image getColumnImage(Object object, int columnIndex) - { - return null; - } - } - public class EJBContentProvider implements IStructuredContentProvider - { - public Object[] getElements(Object element) - { - if (beanNames != null) - { - int size = beanNames.size(); - Object[] result = new Object[size]; - for (int index = 0; index < size; index++) - { - result[index] = new Integer(index); - } - return result; - } - return null; - } - - public void dispose() - { - } - - public void inputChanged(Viewer viewer, Object old, Object newobj) - { - } - - public boolean isDeleted(Object object) - { - return false; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/HandlerTableItem.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/HandlerTableItem.java deleted file mode 100644 index a7be6f437..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/HandlerTableItem.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.jst.j2ee.webservice.wsdd.PortComponent; - - - -public class HandlerTableItem { - - private String handlerClassName; - private String handlerName; - private String portName; - private int index; - - private PortComponent port; - private Object handler; - private Object wsDescRef; - - /** - * @return Returns the handlerClassName. - */ - public String getHandlerClassName() { - return handlerClassName; - } - /** - * @param handlerClassName The handlerClassName to set. - */ - public void setHandlerClassName(String handlerClassName) { - this.handlerClassName = handlerClassName; - } - /** - * @return Returns the handlerName. - */ - public String getHandlerName() { - return handlerName; - } - /** - * @param handlerName The handlerName to set. - */ - public void setHandlerName(String handlerName) { - this.handlerName = handlerName; - } - /** - * @return Returns the port. - */ - public PortComponent getPort() { - return port; - } - /** - * @param port The port to set. - */ - public void setPort(PortComponent port) { - this.port = port; - } - /** - * @return Returns the handler. - */ - public Object getHandler() { - return handler; - } - /** - * @param handler The handler to set. - */ - public void setHandler(Object handler) { - this.handler = handler; - } - /** - * @return Returns the portName. - */ - public String getPortName() { - return portName; - } - /** - * @param portName The portName to set. - */ - public void setPortName(String portName) { - this.portName = portName; - } - - /** - * @return Returns the index. - */ - public int getIndex() { - return index; - } - /** - * @param index The index to set. - */ - public void setIndex(int index) { - this.index = index; - } - /** - * @return Returns the wsDescRef. - */ - public Object getWsDescRef() { - return wsDescRef; - } - /** - * @param wsDescRef The wsDescRef to set. - */ - public void setWsDescRef(Object wsDescRef) { - this.wsDescRef = wsDescRef; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/IObjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/IObjectSelectionWidget.java deleted file mode 100644 index 1383a1781..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/IObjectSelectionWidget.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataContributor; - -/** - * This interface defines extra methods that Object Selection Widgets - * need to implement. Object Selection Widgets are displayed on page 2 - * of the Web services wizard. - */ -public interface IObjectSelectionWidget extends WidgetDataContributor -{ - /** - * The framework will call this method to set the initial selection - * value that the user has specified. - * - * @param initialSelection the initial selection the user specified. - */ - public void setInitialSelection(IStructuredSelection initialSelection); - - /** - * The intent of the Object Selection Widget is that the user has - * the opportunity change/find the object that they want to turn into - * a Web service. - * - * @return returns the an IStructuredSelection object that the user - * want to turn into a Web service. This object may be different than - * the initialSelection passed in by the setInitialSelection method. - */ - public IStructuredSelection getObjectSelection(); - - /** - * Validates whether the objectSelection parameter is valid for - * this Object selection widget. An error status should be returned - * if this object is not value. Otherwise, and ok status should be - * returned - * - * @param objectSelection the object to be validated. - * @return the status of the validation. - */ - public IStatus validateSelection(IStructuredSelection objectSelection); - - /** - * - * @return returns the IProject that contains the selection - * object that the user has chosen with this widget. The value can be - * null if there is no IProject for this object. - */ - public IProject getProject(); - - /** - * - * @return returns the name of the IVirtualComponent that contains the selection - * object that the user has chosen with this widget. The value can be - * null if there is no IVirtualComponent for this object - */ - public String getComponentName(); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionTransformer.java deleted file mode 100644 index eef2d28c1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionTransformer.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; - -public class JavaBeanSelectionTransformer implements Transformer -{ - public Object transform(Object value) - { - if (value instanceof IStructuredSelection) - { - Object sel = ((IStructuredSelection)value).getFirstElement(); - if (sel instanceof IFile) - { - return new StructuredSelection(computeFullyQualifiedJavaName((IFile)sel)); - } - else if (sel instanceof ICompilationUnit) - { - IResource res = ((ICompilationUnit)sel).getResource(); - if (res instanceof IFile) - return new StructuredSelection(computeFullyQualifiedJavaName((IFile)res)); - } - } - return value; - } - - private String computeFullyQualifiedJavaName(IFile resource) - { - IPath path = resource.getFullPath(); - String basename = path.lastSegment(); - String beanClass = ""; - if (basename != null && basename.length() > 0) - { - String beanPackage = org.eclipse.jst.ws.internal.common.ResourceUtils.getJavaResourcePackageName(path); - beanClass = (beanPackage == null ? basename : (beanPackage + "." + basename)); - if (beanClass.toLowerCase().endsWith(".java") || beanClass.toLowerCase().endsWith(".class")) - beanClass = beanClass.substring(0, beanClass.lastIndexOf('.')); - } - return beanClass; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java deleted file mode 100644 index d0d2ede1f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java +++ /dev/null @@ -1,278 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.j2ee.webservice.wsdd.BeanLink; -import org.eclipse.jst.j2ee.webservice.wsdd.internal.impl.PortComponentImpl; -import org.eclipse.jst.j2ee.webservice.wsdd.internal.impl.ServiceImplBeanImpl; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.common.JavaResourceFilter; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.jst.ws.internal.ui.dialog.DialogUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class JavaBeanSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget -{ - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - private IProject serverProject_ = null; - private String serverComponentName_ = null; - private Composite parent_ = null; - private JavaResourceFilter filter_ = new JavaResourceFilter(); - private IResource initialResource_ = null; - private Listener statusListener; - - /*CONTEXT_ID PBCL0001 for the Bean Selection Page*/ - private String INFOPOP_PBCL_PAGE = "PBCL0001"; - - private Text beanClassText_; - /*CONTEXT_ID PBCL0002 for the Bean Selection field of the Bean Selection Page*/ - private String INFOPOP_PBCL_TEXT_BEAN_CLASS = "PBCL0002"; - - private Button beanClassBrowseButton_; - /*CONTEXT_ID PBCL0003 for the Bean Class Browse button of the Bean Selection Page*/ - private String INFOPOP_PBCL_BUTTON_BEAN_CLASS_BROWSE = "PBCL0003"; - - private Button beanResourceBrowseButton_; - /*CONTEXT_ID PBCL0004 for the Bean Resource Browse button of the Bean Selection Page*/ - private String INFOPOP_PBCL_BUTTON_BEAN_RESOURCE_BROWSE = "PBCL0004"; - - public WidgetDataEvents addControls( Composite parent, Listener statusListener ) - { - this.statusListener = statusListener; - MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - UIUtils uiUtils = new UIUtils(msgUtils, pluginId_ ); - - parent_ = parent; - - Composite group = uiUtils.createComposite( parent, 4 ); - - group.setToolTipText( msgUtils.getMessage("TOOLTIP_PBCL_PAGE") ); - PlatformUI.getWorkbench().getHelpSystem().setHelp( group, pluginId_ + "." + INFOPOP_PBCL_PAGE ); - - beanClassText_ = uiUtils.createText( group, "LABEL_BEAN_CLASS_NAME", - "TOOLTIP_PBCL_TEXT_BEAN_CLASS", - INFOPOP_PBCL_TEXT_BEAN_CLASS, - SWT.SINGLE | SWT.BORDER); - beanClassText_.addModifyListener( - new ModifyListener() - { - public void modifyText(ModifyEvent e) - { - handleModifyBeanClassText(); - } - } - ); - - beanClassBrowseButton_ = uiUtils.createPushButton( group, "BUTTON_BROWSE_CLASSES", - "TOOLTIP_PBCL_BUTTON_BEAN_CLASS_BROWSE", - INFOPOP_PBCL_BUTTON_BEAN_CLASS_BROWSE ); - beanClassBrowseButton_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleBrowseClasses(); - } - } ); - - beanResourceBrowseButton_ = uiUtils.createPushButton( group, "BUTTON_BROWSE_FILES", - "TOOLTIP_PBCL_BUTTON_BEAN_RESOURCE_BROWSE", - INFOPOP_PBCL_BUTTON_BEAN_RESOURCE_BROWSE ); - beanResourceBrowseButton_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleBrowseFiles(); - } - } ); - return this; - } - - private void handleModifyBeanClassText() - { - statusListener.handleEvent(null); - serverProject_ = null; - serverComponentName_ = null; - } - - private void handleBrowseClasses() - { - Shell shell = parent_.getShell(); - IType itype = DialogUtils.browseClassesAsIType(shell, ResourcesPlugin.getWorkspace().getRoot().getProjects(), new ProgressMonitorDialog(shell)); - if (itype != null) - { - beanClassText_.setText(itype.getFullyQualifiedName()); - try - { - IResource res = itype.getCorrespondingResource(); - if (res != null) - { - serverProject_ = res.getProject(); - IVirtualComponent comp = ResourceUtils.getComponentOf(res); - if (comp!=null) - { - serverComponentName_ = comp.getName(); - } - } - else - { - serverProject_ = null; - serverComponentName_ = null; - } - } - catch (JavaModelException jme) - { - serverProject_ = null; - serverComponentName_ = null; - } - } - } - - private void handleBrowseFiles() - { - IResource topResource = ResourceUtils.getWorkspaceRoot(); - IResource resource = DialogUtils.browseResources( parent_.getShell(), topResource, initialResource_, filter_ ); - setBeanClass(resource); - } - - private void setBeanClass(IResource resource) - { - if( resource != null && resource instanceof IFile ) - { - IPath path = resource.getFullPath(); - String basename = path.lastSegment(); - - if( basename != null && basename.length() > 0 ) - { - String beanPackage = org.eclipse.jst.ws.internal.common.ResourceUtils.getJavaResourcePackageName(path); - String beanClass = (beanPackage == null ? basename : (beanPackage + "." + basename)); - - if( beanClass.toLowerCase().endsWith(".java") || beanClass.toLowerCase().endsWith(".class" ) ) - { - beanClass = beanClass.substring( 0, beanClass.lastIndexOf('.') ); - } - - beanClassText_.setText(beanClass); - serverProject_ = ResourceUtils.getProjectOf(path); - IVirtualComponent comp = ResourceUtils.getComponentOf(resource); - - if (comp!=null) - { - serverComponentName_ = comp.getName(); - } - - } - } - } - - private void setBeanClass(ServiceImplBeanImpl serviceImpl) - { - if( serviceImpl != null ) - { - EObject eObject = serviceImpl.eContainer(); - if(eObject instanceof PortComponentImpl){ - PortComponentImpl pci = (PortComponentImpl)eObject; - String beanClass = pci.getServiceEndpointInterface(); - beanClassText_.setText(beanClass); - } - } - } - - private void setBeanClass(BeanLink serviceImpl) - { - if( serviceImpl != null ) - { - EObject eObject = serviceImpl.eContainer(); - if(eObject instanceof ServiceImplBeanImpl){ - setBeanClass((ServiceImplBeanImpl)eObject); - } - } - } - - public void setInitialSelection(IStructuredSelection initialSelection) - { - if (initialSelection != null && !initialSelection.isEmpty()) - { - Object object = initialSelection.getFirstElement(); - if (object instanceof IFile) - { - IFile iFile = (IFile)object; - String fileExt = iFile.getFileExtension().toLowerCase(); - if (fileExt.equals("java") || fileExt.equals("class")) - setBeanClass(iFile); - } - else if (object instanceof ICompilationUnit) - setBeanClass(((ICompilationUnit)object).getResource()); - else if (object instanceof ServiceImplBeanImpl) - setBeanClass((ServiceImplBeanImpl)object); - else if(object instanceof BeanLink) - setBeanClass((BeanLink)object); - } - } - - public IStructuredSelection getObjectSelection() - { - return new StructuredSelection(beanClassText_.getText()); - } - - public IProject getProject() - { - return serverProject_; - } - - public String getComponentName() - { - return serverComponentName_; - } - - public IStatus getStatus() - { - String beanClassName = beanClassText_.getText().trim(); - if (beanClassName == null || beanClassName.length() <= 0) - { - MessageUtils msgUtils = new MessageUtils(pluginId_ + ".plugin", this); - return StatusUtils.errorStatus( msgUtils.getMessage("PAGE_MSG_BEAN_CANNOT_BE_EMPTY") ); - } - return Status.OK_STATUS; - } - - public IStatus validateSelection(IStructuredSelection objectSelection) - { - return Status.OK_STATUS; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java deleted file mode 100644 index 87b31d70f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.env.ui.widgets.SelectionCommand; -import org.eclipse.wst.command.internal.provisional.env.core.common.Condition; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; - - -public class ObjectSelectionFragment extends SequenceFragment implements Condition -{ - private TypeRuntimeServer typeRuntimeServer; - private boolean hasObjectSelectionWidget; - - public ObjectSelectionFragment() - { - super(); - BooleanFragment boolFragment = new BooleanFragment(new SimpleFragment("ObjectSelectionWidget"), new SimpleFragment(""), this); - add(boolFragment); - add(new SimpleFragment(new ObjectSelectionOutputCommand(), "")); - hasObjectSelectionWidget = false; - } - - /** - * This method is called retrieve the data mappings for this command fragment. - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ObjectSelectionWidget.class ); - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ObjectSelectionOutputCommand.class, "ObjectSelection", null); - dataRegistry.addMapping(ObjectSelectionFragment.class, "TypeRuntimeServer", ObjectSelectionWidget.class); - dataRegistry.addMapping(ObjectSelectionFragment.class, "TypeRuntimeServer", ObjectSelectionOutputCommand.class); - - dataRegistry.addMapping(ObjectSelectionWidget.class, "ObjectSelection", ObjectSelectionOutputCommand.class); - dataRegistry.addMapping(ObjectSelectionWidget.class, "Project", ObjectSelectionOutputCommand.class); - dataRegistry.addMapping(ObjectSelectionWidget.class, "ComponentName", ObjectSelectionOutputCommand.class); - } - - public boolean evaluate() - { - return hasObjectSelectionWidget; - } - - public TypeRuntimeServer getTypeRuntimeServer() - { - return typeRuntimeServer; - } - - /** - * @param typeRuntimeServer The typeRuntimeServer to set. - */ - public void setTypeRuntimeServer(TypeRuntimeServer typeRuntimeServer) - { - this.typeRuntimeServer = typeRuntimeServer; - if (typeRuntimeServer != null) - { - String wst = typeRuntimeServer.getTypeId(); - - int scenario = WebServiceRuntimeExtensionUtils.getScenarioFromTypeId(wst); - String implId = WebServiceRuntimeExtensionUtils.getImplIdFromTypeId(wst); - if (scenario == WebServiceScenario.TOPDOWN) - { - //Must have WSDL object selection. No choice. - hasObjectSelectionWidget=true; - } - else - { - WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils.getWebServiceImplById(implId); - if (wsimpl!=null) - { - String objectSelectionWidgetId = wsimpl.getObjectSelectionWidget(); - hasObjectSelectionWidget = objectSelectionWidgetId != null && objectSelectionWidgetId.length() > 0; - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java deleted file mode 100644 index 2314e8738..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java +++ /dev/null @@ -1,270 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; - - -public class ObjectSelectionOutputCommand extends AbstractDataModelOperation -{ - private String objectSelectionWidgetId_; - private IStructuredSelection objectSelection_; - private IObjectSelectionWidget objectSelectionWidget_; - private IProject project_; - private String componentName_; - private WebServicesParser parser_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - // Transformation - if (objectSelectionWidgetId_ != null && objectSelectionWidgetId_.length() > 0) - { - IConfigurationElement[] elements = ObjectSelectionRegistry.getInstance().getConfigurationElements(); - for (int i = 0; i < elements.length; i++) - { - if (objectSelectionWidgetId_.equals(elements[i].getAttribute("id"))) - { - String transformerId = elements[i].getAttribute("transformer"); - if (transformerId != null && transformerId.length() > 0) - { - try - { - Object transformer = elements[i].createExecutableExtension("transformer"); - if (transformer instanceof Transformer) - { - Object transformedSelection = ((Transformer)transformer).transform(objectSelection_); - if (transformedSelection instanceof IStructuredSelection) - objectSelection_ = (IStructuredSelection)transformedSelection; - } - } - catch (CoreException ce) - { - } - } - } - } - } - - // Validation - IStatus status = (objectSelectionWidget_ != null) ? objectSelectionWidget_.validateSelection(getObjectSelection()) : Status.OK_STATUS; - if (status.getSeverity() != Status.OK) - { - try - { - env.getStatusHandler().report(status); - } - catch (StatusException se) - { - } - } - - return status; - } - - /** - * @param typeRuntimeServer The typeRuntimeServer to set. - */ - public void setTypeRuntimeServer(TypeRuntimeServer typeRuntimeServer) - { - if (typeRuntimeServer != null) - { - String wst = typeRuntimeServer.getTypeId(); - - int scenario = WebServiceRuntimeExtensionUtils.getScenarioFromTypeId(wst); - String implId = WebServiceRuntimeExtensionUtils.getImplIdFromTypeId(wst); - - WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils.getWebServiceImplById(implId); - //IWebServiceType wst = WebServiceRuntimeExtensionUtils.getWebServiceTypeById(typeRuntimeServer.getTypeId()); - - if (wsimpl != null) - { - String objectSelectionWidgetId = null; - if (scenario == WebServiceScenario.TOPDOWN) - { - objectSelectionWidgetId = "org.eclipse.jst.ws.internal.consumption.ui.widgets.object.WSDLSelectionWidget"; - } - else - { - objectSelectionWidgetId = wsimpl.getObjectSelectionWidget(); - } - - objectSelectionWidgetId_ = objectSelectionWidgetId; - - if (objectSelectionWidgetId_ != null && objectSelectionWidgetId_.length() > 0) - { - IConfigurationElement[] elements = ObjectSelectionRegistry.getInstance().getConfigurationElements(); - for (int i = 0; i < elements.length; i++) - { - if (objectSelectionWidgetId_.equals(elements[i].getAttribute("id"))) - { - try - { - Object object = elements[i].createExecutableExtension("class"); - if (object instanceof IObjectSelectionWidget) - { - objectSelectionWidget_ = (IObjectSelectionWidget)object; - return; - } - } - catch (CoreException ce) - { - } - } - } - } - } - } - } - - /** - * @return Returns the selection. - */ - public IStructuredSelection getObjectSelection() - { - return objectSelection_; - } - /** - * @param selection The selection to set. - */ - public void setObjectSelection(IStructuredSelection objectSelection) - { - objectSelection_ = objectSelection; - - //Set the project if you can - if (project_==null) - { - project_ = getProjectFromObjectSelection(objectSelection); - } - - //Set the componentName if you can - if (componentName_ == null) - { - componentName_ = getComponentNameFromObjectSelection(objectSelection); - } - - // Check if this is a WSDL selection object. If it is we need - // to unwrap it. - if( objectSelection != null && !objectSelection.isEmpty() ) - { - Object object = objectSelection.getFirstElement(); - - if( object instanceof WSDLSelectionWrapper ) - { - WSDLSelectionWrapper wsdlWrapper = (WSDLSelectionWrapper)object; - - objectSelection_ = wsdlWrapper.wsdlSelection; - parser_ = wsdlWrapper.parser; - } - } - } - - public IProject getProject() - { - return project_; - } - - public void setProject(IProject project) - { - this.project_ = project; - } - - public String getComponentName() - { - return componentName_; - } - - public void setComponentName(String componentName) - { - this.componentName_ = componentName; - } - - /** - * @return Returns the parser_. - */ - public WebServicesParser getWebServicesParser() - { - return parser_; - } - - private IProject getProjectFromObjectSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - if (resource==null) - return null; - IProject p = ResourceUtils.getProjectOf(resource.getFullPath()); - return p; - } catch(CoreException e) - { - e.printStackTrace(); - return null; - } - } - } - return null; - } - - private String getComponentNameFromObjectSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - if (resource==null) - return null; - - IVirtualComponent comp = ResourceUtils.getComponentOf(resource); - - if (comp!=null) - { - return comp.getName(); - } - } catch(CoreException e) - { - e.printStackTrace(); - return null; - } - } - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionRegistry.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionRegistry.java deleted file mode 100644 index 8cdbd641b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionRegistry.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; - -public class ObjectSelectionRegistry -{ - private static ObjectSelectionRegistry instance; - private static IConfigurationElement[] elements; - - private ObjectSelectionRegistry() - { - elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.jst.ws.consumption.ui", "objectSelectionWidget"); - } - - public static ObjectSelectionRegistry getInstance() - { - if (instance == null) - instance = new ObjectSelectionRegistry(); - return instance; - } - - public IConfigurationElement[] getConfigurationElements() - { - return elements; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java deleted file mode 100644 index 779de1ee1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; - - -public class ObjectSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget -{ - private IConfigurationElement[] elements; - private Composite parent; - private Listener statusListener; - private Composite composite; - private IStructuredSelection initialSelection; - private IProject project; - private String componentName; - private IObjectSelectionWidget child; - - public WidgetDataEvents addControls(Composite parentComposite, Listener statListener) - { - elements = ObjectSelectionRegistry.getInstance().getConfigurationElements(); - this.parent = parentComposite; - this.statusListener = statListener; - composite = null; - return this; - } - - /** - * @param typeRuntimeServer The typeRuntimeServer to set. - */ - public void setTypeRuntimeServer(TypeRuntimeServer typeRuntimeServer) - { - if (composite != null) - { - composite.dispose(); - child = null; - } - if (typeRuntimeServer != null) - { - String wst = typeRuntimeServer.getTypeId(); - int scenario = WebServiceRuntimeExtensionUtils.getScenarioFromTypeId(wst); - String implId = WebServiceRuntimeExtensionUtils.getImplIdFromTypeId(wst); - WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils.getWebServiceImplById(implId); - - //IWebServiceType wst = WebServiceRuntimeExtensionUtils.getWebServiceTypeById(typeRuntimeServer.getTypeId()); - if (wsimpl != null) - { - String objectSelectionWidgetId = null; - if (scenario == WebServiceScenario.TOPDOWN) - { - objectSelectionWidgetId = "org.eclipse.jst.ws.internal.consumption.ui.widgets.object.WSDLSelectionWidget"; - } - else - { - objectSelectionWidgetId = wsimpl.getObjectSelectionWidget(); - } - - if (objectSelectionWidgetId != null && objectSelectionWidgetId.length() > 0) - { - for (int i = 0; i < elements.length; i++) - { - if (objectSelectionWidgetId.equals(elements[i].getAttribute("id"))) - { - try - { - Object object = elements[i].createExecutableExtension("class"); - if (object instanceof IObjectSelectionWidget) - { - Control shell = parent.getShell(); - int x = shell.getSize().x; - composite = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(); - gl.marginHeight = 0; - gl.marginWidth = 0; - GridData gd = new GridData(GridData.FILL_BOTH); - composite.setLayout(gl); - composite.setLayoutData(gd); - child = (IObjectSelectionWidget)object; - child.addControls(composite, statusListener); - child.setInitialSelection(initialSelection); - composite.setSize(x-20, composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); - parent.setSize(x-10, parent.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); - shell.setSize(x, shell.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); - shell.setRedraw(true); - shell.redraw(); - shell.update(); - return; - } - } - catch (CoreException ce) - { - } - } - } - } - } - } - } - - public IStatus getStatus() - { - return (child != null) ? child.getStatus() : Status.OK_STATUS; - } - - public void setInitialSelection(IStructuredSelection initialSelection) - { - this.initialSelection = initialSelection; - project = getProjectFromInitialSelection(initialSelection); - componentName = getComponentNameFromInitialSelection(initialSelection); - if (child != null) - child.setInitialSelection(initialSelection); - } - - public IStructuredSelection getObjectSelection() - { - return (child != null) ? child.getObjectSelection() : null; - } - - public IStatus validateSelection(IStructuredSelection objectSelection) - { - return (child != null) ? child.validateSelection(objectSelection) : Status.OK_STATUS; - } - - public IProject getProject() - { - if (child != null) - { - IProject p = child.getProject(); - if (p != null) - return p; - else - return project; - } - else - { - return null; - } - } - - public String getComponentName() - { - if (child != null) - { - String cname = child.getComponentName(); - if (cname != null && cname.length()>0) - return cname; - else - return componentName; - } - else - { - return null; - } - - } - - private IProject getProjectFromInitialSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - if (resource==null) - return null; - IProject p = ResourceUtils.getProjectOf(resource.getFullPath()); - return p; - } catch(CoreException e) - { - return null; - } - } - } - return null; - } - - private String getComponentNameFromInitialSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - if (resource==null) - return null; - - IVirtualComponent comp = ResourceUtils.getComponentOf(resource); - if (comp != null) - { - return comp.getName(); - } - } catch(CoreException e) - { - return null; - } - } - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/Timer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/Timer.java deleted file mode 100644 index 546120c40..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/Timer.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import java.util.Calendar; - -import org.eclipse.swt.widgets.Display; - -public class Timer extends Thread -{ - private static Timer instance = null; - private final long ONE_SECOND = 1000; - private long refreshTime; - private Display display; - private Runnable runnable; - - private Timer(Display display, Runnable runnable) - { - this.display = display; - this.runnable = runnable; - } - - public synchronized static Timer newInstance(Display display, Runnable runnable) - { - if (instance == null) - instance = new Timer(display, runnable); - return instance; - } - - public synchronized static boolean isRunning() - { - return instance != null; - } - - public synchronized void startTimer() - { - refreshTime = getCurrentTime() + ONE_SECOND; - if (!isAlive()) - this.start(); - } - - private long getCurrentTime() - { - return Calendar.getInstance().getTime().getTime(); - } - - public void run() - { - long currTime = getCurrentTime(); - while (currTime < refreshTime) - { - try - { - sleep(refreshTime - currTime); - } - catch (InterruptedException ie) - { - } - currTime = getCurrentTime(); - } - instance = null; - display.syncExec(runnable); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ValidateWSDLJob.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ValidateWSDLJob.java deleted file mode 100644 index 8463a028a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ValidateWSDLJob.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.wst.wsdl.validation.internal.IValidationMessage; -import org.eclipse.wst.wsdl.validation.internal.IValidationReport; -import org.eclipse.wst.wsdl.validation.internal.ui.eclipse.WSDLValidator; - - - -public class ValidateWSDLJob extends Job { - - final public static String VALIDATE_WSDL_JOB_FAMILY = "ValidateWSDLJobJamily"; - - private String wsdlURI_ = null; - private IValidationMessage[] validationMessages_ = null; - - public ValidateWSDLJob(String wsdlURI) { - super("ValidateWSDLJob"); - wsdlURI_ = wsdlURI; - } - - protected IStatus run(IProgressMonitor monitor) { - WSDLValidator wsdlValidator = WSDLValidator.getInstance(); - IValidationReport valReport = wsdlValidator.validate(wsdlURI_); - validationMessages_ = valReport.getValidationMessages(); - return Status.OK_STATUS; - } - - public boolean belongsTo(Object family) - { - return family == VALIDATE_WSDL_JOB_FAMILY; - } - - public IValidationMessage[] getValidationMessages() { - return validationMessages_; - } - - public String getWsdlURI() { - return wsdlURI_; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ValidationMessageViewerWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ValidationMessageViewerWidget.java deleted file mode 100644 index 7c55b0114..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ValidationMessageViewerWidget.java +++ /dev/null @@ -1,245 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.wsdl.validation.internal.IValidationMessage; - - -public class ValidationMessageViewerWidget extends SimpleWidgetDataContributor -{ - private int DEFAULT_TABLE_HEIGHT_HINT = 100; - private TableViewer tableViewer_; - private Table table_; - private String message = null; - static final String columns_[] = {"severity", "line", "column", "message"}; - static final int columnsWidth_[] = {10, 10, 10, 60}; - - - - public ValidationMessageViewerWidget() - { - } - - public WidgetDataEvents addControls( Composite parent, Listener statusListener ) - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId + ".plugin", this ); - - Composite composite = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(); - - gl.marginHeight = 0; - gl.marginWidth = 0; - composite.setLayout(gl); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Label messageLabel = new Label( composite, SWT.WRAP); - messageLabel.setText( msgUtils.getMessage("LABEL_VALIDATE_MESSAGES")); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - messageLabel.setLayoutData(gd); - messageLabel.setToolTipText( msgUtils.getMessage("TOOLTIP_VALIDATE_TEXT_MESSAGE") ); - - table_ = new Table(composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); - gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = DEFAULT_TABLE_HEIGHT_HINT; - table_.setLayoutData(gd); - table_.setHeaderVisible(true); - table_.setLinesVisible(true); - table_.setToolTipText(msgUtils.getMessage("TOOLTIP_TABLE_VALIDATE_MESSAGE") ); - TableLayout tableLayout = new TableLayout(); - for (int i = 0; i < columns_.length; i++) - { - TableColumn tableColumn = new TableColumn(table_, SWT.NONE); - tableColumn.setText(columns_[i]); - tableColumn.pack(); - ColumnWeightData columnData = new ColumnWeightData(columnsWidth_[i], columnsWidth_[i], true); - tableLayout.addColumnData(columnData); - } - table_.setLayout(tableLayout); - - tableViewer_ = new TableViewer(table_); - - tableViewer_.setContentProvider(new ListContentProvider()); - tableViewer_.setLabelProvider(new ListLabelProvider()); - - Composite buttonComposite = new Composite(composite, SWT.NONE); - gl = new GridLayout(); - gl.numColumns = 3; - gl.makeColumnsEqualWidth = true; - buttonComposite.setLayout(gl); - buttonComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING)); - - - return this; - } - - public void setInput(IValidationMessage[] messages) - { - tableViewer_.setInput(messages); - tableViewer_.refresh(); - } - - public void clearInput() - { - IValidationMessage emptyMessages[] = {}; - this.setInput(emptyMessages); - } - - public IContentProvider getContentProvider() - { - return tableViewer_.getContentProvider(); - } - - public IStatus getStatus() - { - return message == null ? Status.OK_STATUS : - StatusUtils.errorStatus(message ); - } - - public void refresh() - { - tableViewer_.refresh(); - } - - public TableItem[] getItems() - { - //internalRefresh(); - return table_.getItems(); - } - - public void setEnabled(boolean enabled) - { - } - - public void dispose() - { - if (table_ != null) - table_.dispose(); - } - - protected class ListContentProvider implements IStructuredContentProvider - { - public void dispose() - { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) - { - tableViewer_.add(getElements(newInput)); - } - - public Object[] getElements(Object inputElement) - { - if (inputElement instanceof IValidationMessage[]) - { - IValidationMessage[] valMessages = (IValidationMessage[]) inputElement; - return valMessages; - } - else - return new Object[0]; - } - } - - protected class ListLabelProvider implements ITableLabelProvider - { - public Image getColumnImage(Object element, int columnIndex) - { - if (element instanceof IValidationMessage) - { - IValidationMessage msg = (IValidationMessage) element; - - if (columnIndex == 0) - { - int severity = msg.getSeverity(); - if (severity == 0) { - return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); - } else if (severity == 1) { - return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK); - } else if (severity == 2) { - return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK); - } - } - } - return null; - } - - public String getColumnText(Object element, int columnIndex) - { - String text = ""; - if (element instanceof IValidationMessage) - { - IValidationMessage msg = (IValidationMessage) element; - - switch (columnIndex) { - case 0: - // no text to display, only display severity as image - break; - case 1: - text = (new Integer(msg.getLine())).toString(); - break; - case 2: - text = (new Integer(msg.getColumn())).toString(); - break; - case 3: - text = msg.getMessage(); - break; - - default: - break; - } - } - return text; - } - - public void addListener(ILabelProviderListener listener) - { - } - - public void removeListener(ILabelProviderListener listener) - { - } - - public boolean isLabelProperty(Object element, String property) - { - return true; - } - - public void dispose() - { - } - } - } diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java deleted file mode 100644 index 79672c379..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import java.net.MalformedURLException; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.j2ee.webservice.wsclient.internal.impl.ServiceRefImpl; -import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory; -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; -import org.eclipse.wst.wsdl.internal.impl.ServiceImpl; -import org.eclipse.wst.wsdl.util.WSDLResourceImpl; - -public class WSDLSelectionTransformer implements Transformer -{ - public Object transform(Object value) - { - if (value instanceof IStructuredSelection) - { - Object sel = ((IStructuredSelection)value).getFirstElement(); - if (sel instanceof IResource) - { - try - { - return new StructuredSelection(((IResource)sel).getLocation().toFile().toURL().toString()); - } - catch (MalformedURLException murle) - { - } - } - else if (sel instanceof ServiceImpl) - { - return new StructuredSelection(J2EEActionAdapterFactory.getWSDLURI((ServiceImpl)sel)); - } - else if (sel instanceof ServiceRefImpl) - { - return new StructuredSelection(J2EEActionAdapterFactory.getWSDLURI((ServiceRefImpl)sel)); - } - else if (sel instanceof WSDLResourceImpl) - { - return new StructuredSelection(J2EEActionAdapterFactory.getWSDLURI((WSDLResourceImpl)sel)); - } - } - return value; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java deleted file mode 100644 index 707c9f279..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java +++ /dev/null @@ -1,494 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import java.io.File; -import java.net.MalformedURLException; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.jobs.JobChangeAdapter; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; -import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.common.WSDLParserFactory; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionConditionCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.WSDLSelectionTreeWidget; -import org.eclipse.jst.ws.internal.ui.common.DialogResourceBrowser; -import org.eclipse.jst.ws.internal.ui.common.FileExtensionFilter; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.ws.internal.parser.wsil.WebServiceEntity; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.ws.internal.plugin.WSPlugin; -import org.eclipse.wst.ws.internal.preferences.PersistentWSDLValidationContext; -import org.eclipse.wst.wsdl.internal.impl.ServiceImpl; -import org.eclipse.wst.wsdl.util.WSDLResourceImpl; - -public class WSDLSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget, Runnable -{ - private String pluginId_; - private MessageUtils msgUtils_; - private FileExtensionFilter wsFilter_; - private WebServicesParser webServicesParser; - - private Composite parent_; - private Listener statusListener_; - private WSDLSelectionTreeWidget tree; - private ValidationMessageViewerWidget msgViewer_; - - /*CONTEXT_ID PCON0001 for the WSDL Selection Page*/ - private final String INFOPOP_PCON_PAGE = "PCON0001"; - - /*CONTEXT_ID PCON0002 for the WSDL Document text field of the WSDL Selection Page*/ - private final String INFOPOP_PCON_TEXT_WSDL = "PCON0002"; - private Text webServiceURI; - - /*CONTEXT_ID PCON0003 for the WSDL Resource Browse button of the WSDL Selection Page*/ - private final String INFOPOP_PCON_BUTTON_BROWSE_WSDL = "PCON0003"; - private Button wsBrowseButton_; - - private ValidateWSDLJob validateWSDLJob_; - private JobChangeAdapter jobChangeAdapter_; - - - public WSDLSelectionWidget() - { - pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - msgUtils_ = new MessageUtils( pluginId_ + ".plugin", this ); - wsFilter_ = new FileExtensionFilter(new String[] {"wsdl", "wsil", "html"}); - webServicesParser = WSDLParserFactory.getWSDLParser(); - - final Runnable handleValidationMessages = new Runnable() - { - public void run() - { - msgViewer_.setInput(validateWSDLJob_.getValidationMessages()); - } - }; - - jobChangeAdapter_ = new JobChangeAdapter() - { - public void done(IJobChangeEvent event) - { - if (msgViewer_!= null && msgViewer_.getContentProvider() != null) { - Display.getDefault().asyncExec( handleValidationMessages ); - } - } - }; - } - - public WidgetDataEvents addControls( Composite parent, Listener statusListener ) - { - UIUtils uiUtils = new UIUtils( msgUtils_, pluginId_ ); - parent_ = parent; - statusListener_ = statusListener; - - parent.setToolTipText( msgUtils_.getMessage( "TOOLTIP_PCON_PAGE" ) ); - PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, pluginId_ + "." + INFOPOP_PCON_PAGE ); - - Composite wsdlGroup = uiUtils.createComposite( parent, 2, 5, 0 ); - - Label wsLabel = new Label( wsdlGroup, SWT.WRAP); - wsLabel.setText( msgUtils_.getMessage("LABEL_WS_SELECTION")); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - wsLabel.setLayoutData(gd); - wsLabel.setToolTipText( msgUtils_.getMessage("TOOLTIP_PCON_TEXT_WS") ); - - webServiceURI = uiUtils.createText( wsdlGroup, null, "TOOLTIP_PCON_TEXT_WS", INFOPOP_PCON_TEXT_WSDL, SWT.SINGLE | SWT.BORDER ); - webServiceURI.addModifyListener( - new ModifyListener() - { - public void modifyText(ModifyEvent event) - { - handleWebServiceURIModifyEvent(); - } - }); -// webServiceURI.addListener( SWT.Modify, statusListener ); - - wsBrowseButton_ = uiUtils.createPushButton( wsdlGroup, "BUTTON_BROWSE", "TOOLTIP_PCON_BUTTON_BROWSE_WS", INFOPOP_PCON_BUTTON_BROWSE_WSDL ); - wsBrowseButton_.addSelectionListener( - new SelectionListener() - { - public void widgetDefaultSelected(SelectionEvent event) - { - handleWSDLButton(); - } - - public void widgetSelected(SelectionEvent event) - { - handleWSDLButton(); - } - }); - - tree = new WSDLSelectionTreeWidget(); - tree.addControls(parent, statusListener); - tree.setWebServicesParser(webServicesParser); - - msgViewer_ = new ValidationMessageViewerWidget(); - msgViewer_.addControls(parent, statusListener); - - return this; - } - - private void handleWebServiceURIModifyEvent() - { - if (webServiceURI.getText().indexOf(':') > 0) - Timer.newInstance(Display.getCurrent(), this).startTimer(); - else - handleWebServiceURI(); - statusListener_.handleEvent(null); - } - - private void handleWebServiceURI() - { - String wsURI = webServiceURI.getText(); - if (wsURI.indexOf(':') < 0) - { - IFile file = uri2IFile(wsURI); - if (file != null) - wsURI = iFile2URI(file); - } - if (wsURI != null && wsURI.indexOf(':') >= 0 && webServicesParser.getWebServiceEntityByURI(wsURI) == null) - { - WSDLSelectionConditionCommand cmd = new WSDLSelectionConditionCommand(); - cmd.setWebServicesParser(webServicesParser); - cmd.setWebServiceURI(wsURI); - cmd.execute(null, null); - } - WebServiceEntity entity = webServicesParser.getWebServiceEntityByURI(wsURI); - if (entity != null && entity.getType() == WebServiceEntity.TYPE_WSDL) - tree.setEnabled(false); - else - tree.setEnabled(true); - tree.setWebServiceURI(wsURI); - tree.refreshTreeViewer(); - } - - public void run() - { - handleWebServiceURI(); - statusListener_.handleEvent(null); - } - - private void handleWSDLButton() - { - DialogResourceBrowser dialog = new DialogResourceBrowser( parent_.getShell(), null, wsFilter_); - dialog.open(); - IResource res = dialog.getFirstSelection(); - if( res != null ) webServiceURI.setText( res.getFullPath().toString() ); - statusListener_.handleEvent(null); - } - - public IStatus getStatus() - { - // Timer validation - /* - * Commenting out because we don't want to block fast typers from hitting Next/Finish - if (Timer.isRunning()) - return new SimpleStatus("", msgUtils_.getMessage("PAGE_MSG_LOADING_WEB_SERVICE_URI"), Status.ERROR); - */ - - // Validate the String representation of the Web service URI - // For example, is it pointing to an existing resource in the workspace? - String wsPath = webServiceURI.getText(); - if( wsPath == null || wsPath.length() <= 0 ) - return StatusUtils.errorStatus( msgUtils_.getMessage("PAGE_MSG_INVALID_WEB_SERVICE_URI") ); - else if( wsPath.indexOf(':') < 0 ) - { - IResource res = ResourceUtils.findResource(wsPath); - if( res == null ) { - msgViewer_.clearInput(); - return StatusUtils.errorStatus( msgUtils_.getMessage("PAGE_MSG_NO_SUCH_FILE", new Object[] {wsPath}) ); - } - else if( res.getType() != IResource.FILE ) { - msgViewer_.clearInput(); - return StatusUtils.errorStatus( msgUtils_.getMessage("PAGE_MSG_INVALID_WEB_SERVICE_URI") ); - } - } - - - // Validate the content of the Web service URI - // For example, is selection a WSDL URI? - if (!Timer.isRunning() && tree.isEnabled()) - { - IStatus status = tree.getStatus(); - if (status != null) - { - int severity = status.getSeverity(); - if (severity == Status.ERROR || severity == Status.WARNING) { - msgViewer_.clearInput(); - return status; - } - } - } - else - { - if( wsPath.indexOf(':') < 0 ) - { - String wsdlURI = iFile2URI((IFile)ResourceUtils.findResource(wsPath)); - if (webServicesParser.getWSDLDefinition(wsdlURI) == null) { - msgViewer_.clearInput(); - return StatusUtils.errorStatus(msgUtils_.getMessage("PAGE_MSG_SELECTION_MUST_BE_WSDL") ); - } - } - } - - - if (!Timer.isRunning()) { - String wsdlURI1 = wsPath; - boolean isRemote = true; - if (tree.isEnabled()) { // is wsil - wsdlURI1 = tree.getWsdlURI(); - if (wsdlURI1.startsWith("file:")) { - isRemote = false; - } - } else { // is wsil - - if( wsPath.indexOf(':') < 0 ) - { // not remote - isRemote = false; - wsdlURI1 = iFile2URI((IFile)ResourceUtils.findResource(wsPath)); - } - } - - validateWSDL(wsdlURI1, isRemote); - } - - - // OK status - return Status.OK_STATUS; - } - - private void validateWSDL (String wsdlURI, boolean isRemote) { - - String validationSelection = WSPlugin.getInstance().getWSDLValidationContext().getPersistentWSDLValidation();; - if ((PersistentWSDLValidationContext.VALIDATE_ALL_WSDL.equals(validationSelection)) || - (PersistentWSDLValidationContext.VALIDATE_REMOTE_WSDL.equals(validationSelection) && isRemote)) { - - IJobManager jobManager = Platform.getJobManager(); - Job[] jobs = jobManager.find( ValidateWSDLJob.VALIDATE_WSDL_JOB_FAMILY ); - ValidateWSDLJob existingValidateWSDLJob = null; - - boolean startWSDLValidation = true; - if( jobs.length > 0 ) - { - for (int i=0; i<jobs.length; i++) { - existingValidateWSDLJob = (ValidateWSDLJob)jobs[i]; - - if (existingValidateWSDLJob.getState() != Job.NONE) { - // Job running or to be run - // If the job is validating the same wsdlURI, let it finish running and ignore this one. - // It is not for the same wsdlURI, cancel the job and schedule this one. - - if (!wsdlURI.equals(existingValidateWSDLJob.getWsdlURI())) { - existingValidateWSDLJob.cancel(); - } else { - startWSDLValidation = false; - } - } - } - } - - if (startWSDLValidation) { - startWSDLValidationJob(wsdlURI); - } - } - return; - } - - private void startWSDLValidationJob (String wsdlURI) { - validateWSDLJob_ = new ValidateWSDLJob(wsdlURI); - validateWSDLJob_.addJobChangeListener( jobChangeAdapter_ ); - validateWSDLJob_.schedule(); - } - - private IFile uri2IFile(String uri) - { - IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(uri); - if (res instanceof IFile) - return (IFile)res; - else - return null; - } - - private String iFile2URI(IFile file) - { - File f = file.getLocation().toFile(); - try - { - return f.toURL().toString(); - } - catch (MalformedURLException murle) - { - } - return f.toString(); - } - - public void setInitialSelection(IStructuredSelection initialSelection) - { - if (initialSelection != null && !initialSelection.isEmpty()) - { - Object object = initialSelection.getFirstElement(); - String wsdlURI = toWsdlURI(object); - if (wsdlURI != null) - { - webServiceURI.setText(wsdlURI); - handleWebServiceURI(); - } - } - } - - private String toWsdlURI(Object object) - { - if (object instanceof ServiceImpl) - return J2EEActionAdapterFactory.getWSDLURI((ServiceImpl)object); - else if (object instanceof WSDLResourceImpl) - return J2EEActionAdapterFactory.getWSDLURI((WSDLResourceImpl)object); - else if (object instanceof ServiceRef) - return J2EEActionAdapterFactory.getWSDLURI((ServiceRef)object); - else if (object instanceof IFile) - return ((IFile)object).getFullPath().toString(); - else if (object instanceof String) - return (String)object; - else - return null; - } - - public IStructuredSelection getObjectSelection() - { - return new StructuredSelection( - new WSDLSelectionWrapper( webServicesParser, - new StructuredSelection(tree.getWsdlURI()) ) ); - } - - public WebServicesParser getWebServicesParser() - { - return webServicesParser; - } - - public IStatus validateSelection(IStructuredSelection objectSelection) - { - return Status.OK_STATUS; - } - - public IProject getProject() - { - String wsdlURI = tree.getWsdlURI(); - if (wsdlURI != null) - { - IProject p = getProjectFromURI(wsdlURI); - if (p!=null && p.exists()) - return p; - - String wsRelPath = webServiceURI.getText(); - IResource wsRes = ResourceUtils.findResource(wsRelPath); - if (wsRes!=null && wsRes instanceof IFile) - { - IProject p2 = ((IFile)wsRes).getProject(); - return p2; - } - - } - return null; - } - - public String getComponentName() - { - String wsdlURI = tree.getWsdlURI(); - if (wsdlURI != null) - { - String cname = getComponentNameFromURI(wsdlURI); - if (cname!=null && cname.length()>0) - return cname; - - String wsRelPath = webServiceURI.getText(); - IResource wsRes = ResourceUtils.findResource(wsRelPath); - if (wsRes!=null && wsRes instanceof IFile) - { - IVirtualComponent comp = ResourceUtils.getComponentOf(wsRes); - if (comp!=null) - { - return comp.getName(); - } - } - - } - return null; - } - - private IProject getProjectFromURI(String uri) - { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - String wkspcRootLoc = root.getLocation().toString(); - int idx = uri.indexOf(wkspcRootLoc); - if (idx != -1) - { - String relPath = uri.substring(wkspcRootLoc.length()+idx); - IResource res = root.findMember(new Path(relPath)); - if (res instanceof IFile) - { - IProject p = ((IFile)res).getProject(); - return p; - } - } - return null; - } - - private String getComponentNameFromURI(String uri) - { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - String wkspcRootLoc = root.getLocation().toString(); - int idx = uri.indexOf(wkspcRootLoc); - if (idx != -1) - { - String relPath = uri.substring(wkspcRootLoc.length()+idx); - IResource res = root.findMember(new Path(relPath)); - if (res instanceof IFile) - { - IVirtualComponent comp = ResourceUtils.getComponentOf(res); - if (comp!=null) - { - return comp.getName(); - } - } - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWrapper.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWrapper.java deleted file mode 100644 index b0a600576..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWrapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - -/** - * This class is a very simple wrapper that binds a WSDL parser with - * a wsdlSelection object. - */ -public class WSDLSelectionWrapper -{ - public WebServicesParser parser; - public IStructuredSelection wsdlSelection; - - public WSDLSelectionWrapper( WebServicesParser parser, - IStructuredSelection selection ) - { - this.parser = parser; - this.wsdlSelection = selection; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidget.java deleted file mode 100644 index f9adcab51..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidget.java +++ /dev/null @@ -1,371 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionList; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; - - -public class ClientRuntimeSelectionWidget extends SimpleWidgetDataContributor -{ - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - - /* CONTEXT_ID PWRS0003 for the Wizard Scenario Client configuration of the Runtime Selection Page */ - private String INFOPOP_PWRS_GROUP_CLIENT = pluginId_ + ".PWRS0003"; - - private Group clientGroup_; - private RuntimeServerSelectionWidget runtimeWidget_; - private SelectionListChoices runtime2ClientTypes_; - private Combo clientType_; - private SelectionAdapter clientTypeSelListener; - private ProjectSelectionWidget projectWidget_; - private boolean isVisible_; - - - public WidgetDataEvents addControls( Composite parent, final Listener statusListener ) - { - MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - UIUtils uiUtils = new UIUtils(msgUtils, pluginId_ ); - - clientGroup_ = uiUtils.createGroup( parent, "LABEL_CLIENT_SELECTION_VIEW_TITLE", - null, INFOPOP_PWRS_GROUP_CLIENT, 2, 5, 5 ); - - runtimeWidget_ = new RuntimeServerSelectionWidget( true ); - runtimeWidget_.addControls( clientGroup_, statusListener ); - runtimeWidget_.addModifyListener( new ModifyListener() - { - public void modifyText(ModifyEvent e) - { - handleRuntime2ClientTypesEvent(); - handleUpdateProjectWidget(); - } - }); - - clientType_ = uiUtils.createCombo( clientGroup_, "LABEL_CLIENT_TYPE", - "TOOLTIP_PWCR_COMBO_CLIENT_TYPE", - INFOPOP_PWRS_GROUP_CLIENT, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - - clientTypeSelListener = new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleSetProjects( clientType_.getSelectionIndex() ); - statusListener.handleEvent(null); - } - }; - - clientType_.addSelectionListener(clientTypeSelListener); - - projectWidget_ = new ProjectSelectionWidget(true); - projectWidget_.addControls( clientGroup_, statusListener ); - - //projectWidget_.addModifyListener(new ModifyListener(){ - // public void modifyText(ModifyEvent e){ - // getProjectSelections(); - // } - // }); - - return this; - } - - // This method is called by the creator of this widget to control - // whether it is visible or not. - public void setVisible( boolean value ) - { - clientGroup_.setVisible( value ); - isVisible_ = value; - } - - public boolean isVisible(){ - return this.isVisible_; - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer ids ) - { - runtimeWidget_.setTypeRuntimeServer( ids ); - projectWidget_.setTypeRuntimeServer(ids); - } - - public TypeRuntimeServer getClientTypeRuntimeServer() - { - return runtimeWidget_.getTypeRuntimeServer(); - } - - public String getJ2EEVersion() - { - return runtimeWidget_.getJ2EEVersion(); - } - - public void setJ2EEVersion(String j2eeVersion) - { - runtimeWidget_.setJ2EEVersion(j2eeVersion); - projectWidget_.setJ2EEVersion(j2eeVersion); - } - - public boolean getClientNeedEAR() - { - return projectWidget_.getNeedEAR(); - } - - public void setClientNeedEAR(boolean b) - { - projectWidget_.setNeedEAR(b); - } - - public String getClientComponentName() - { - return projectWidget_.getComponentName(); - } - - public void setClientComponentName( String name ) - { - projectWidget_.setComponentName( name ); - } - - public String getClientEarComponentName() - { - return projectWidget_.getEarComponentName(); - } - - public void setClientEarComponentName( String name ) - { - projectWidget_.setEarComponentName( name ); - } - - public String getClientComponentType() - { - SelectionList projTypeList = runtime2ClientTypes_.getChoice().getList(); - projTypeList.setIndex( clientType_.getSelectionIndex() ); - return projTypeList.getSelection(); - } - - public void setClientComponentType( String type ) - { - projectWidget_.setComponentType( type ); - } - - public String getClientProjectName() - { - return projectWidget_.getProjectName(); - } - - public String getClientEarProjectName() - { - return projectWidget_.getEarProjectName(); - } - - /** - * @param runtime2ClientTypes The runtime2ClientTypes to set. - */ - public void setRuntime2ClientTypes(SelectionListChoices runtime2ClientTypes) - { - runtime2ClientTypes_ = runtime2ClientTypes; - handleRuntime2ClientTypesEvent(); - } - - public SelectionListChoices getRuntime2ClientTypes() - { - - String runtime = runtimeWidget_.getTypeRuntimeServer().getRuntimeId(); - String clientProject = projectWidget_.getProjectChoices().getList().getSelection(); - String earProject = projectWidget_.getProjectChoices().getChoice().getList().getSelection(); - - SelectionList runtimeList = runtime2ClientTypes_.getList(); - runtimeList.setSelectionValue( runtime ); - - SelectionList projTypeList = runtime2ClientTypes_.getChoice().getList(); - projTypeList.setIndex( clientType_.getSelectionIndex() ); - - SelectionListChoices clientProjChoice = runtime2ClientTypes_.getChoice().getChoice(); - SelectionList clientProjList = clientProjChoice.getList(); - clientProjList.setSelectionValue( clientProject ); - - SelectionList earProjList = clientProjChoice.getChoice().getList(); - earProjList.setSelectionValue( earProject ); - - return runtime2ClientTypes_; - } - - private void handleRuntime2ClientTypesEvent() - { - if (runtime2ClientTypes_ != null) - { - //If the runtimeId from runtimeWidget_ is already selected in - //in runtime2ClientTypes_, do nothing. - String currentRuntimeId = runtime2ClientTypes_.getList().getSelection(); - String newRuntimeId = runtimeWidget_.getTypeRuntimeServer().getRuntimeId(); - if (currentRuntimeId != newRuntimeId) - { - SelectionList runtimes = runtime2ClientTypes_.getList(); - runtimes.setSelectionValue( runtimeWidget_.getTypeRuntimeServer().getRuntimeId() ); - } - - String[] clientTypeIds = runtime2ClientTypes_.getChoice().getList().getList(); - int selectedClientTypeIdx = runtime2ClientTypes_.getChoice().getList().getIndex(); - - clientType_.removeSelectionListener(clientTypeSelListener); - clientType_.setItems( getClientTypeLabels( clientTypeIds )); - clientType_.select(selectedClientTypeIdx); - clientType_.addSelectionListener(clientTypeSelListener); - handleSetProjects(selectedClientTypeIdx); - - } - } - - - private void handleUpdateProjectWidget() - { - projectWidget_.setTypeRuntimeServer(runtimeWidget_.getTypeRuntimeServer()); - projectWidget_.setJ2EEVersion(runtimeWidget_.getJ2EEVersion()); - } - - - private void handleSetProjects( int clientTypeIndex ) - { - SelectionListChoices clientType2Projects = runtime2ClientTypes_.getChoice(); - clientType2Projects.getList().setIndex( clientTypeIndex ); - - // Make sure that the project name and EAR name are kept the same - // even if the client type is changed. Note: the project and EAR lists - // will be updated according to what is set by the client type. - SelectionListChoices currentProjects = projectWidget_.getProjectChoices(); - - if( currentProjects != null ) - { - String projectName = currentProjects.getList().getSelection(); - String earName = currentProjects.getChoice().getList().getSelection(); - - // Set the project to it's original state. - clientType2Projects.getChoice().getList().setSelectionValue( projectName ); - - // Set the EAR name to it's original state. - clientType2Projects.getChoice().getChoice().getList().setSelectionValue( earName ); - } - - //projectWidget_.setProjectTypeId(clientType2Projects.getList().getSelection()); - projectWidget_.setComponentType(clientType2Projects.getList().getSelection()); - projectWidget_.setProjectChoices( clientType2Projects.getChoice() ); - } - - private String[] getClientTypeLabels( String[] types ) - { - MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - //ClientProjectTypeRegistry registry = ClientProjectTypeRegistry.getInstance(); - String[] clientTypeLabels = new String[types.length]; - - for( int index = 0; index < types.length; index++ ) - { - //clientTypeLabels[index] = registry.getElementById(types[index]).getAttribute("label"); - String type = types[index]; - if (type.equals(IModuleConstants.JST_WEB_MODULE)) - { - clientTypeLabels[index] = msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_WEB"); - } - else if (type.equals(IModuleConstants.JST_EJB_MODULE)) - { - clientTypeLabels[index] = msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_EJB"); - } - else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE)) - { - clientTypeLabels[index] = msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_APP_CLIENT"); - } - else if (type.equals(IModuleConstants.JST_UTILITY_MODULE)) - { - clientTypeLabels[index] = msgUtils.getMessage("LABEL_CLIENT_COMP_TYPE_CONTAINERLESS"); - } - else - { - clientTypeLabels[index] = type; - } - } - - return clientTypeLabels; - } - - public ProjectSelectionWidget getProjectSelectionWidget() { - return this.projectWidget_; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#getStatus() - */ - public IStatus getStatus() - { - IStatus finalStatus = Status.OK_STATUS; - IStatus projectStatus = projectWidget_.getStatus(); - IStatus runtimeStatus = runtimeWidget_.getStatus(); - - if( runtimeStatus.getSeverity() == Status.ERROR ) - { - finalStatus = runtimeStatus; - } - else if( projectStatus.getSeverity() == Status.ERROR ) - { - finalStatus = projectStatus; - } - else - { - SelectionListChoices clientProjects = getProjectSelectionWidget().getProjectChoices(); - ValidationUtils valUtils = new ValidationUtils(); - if (clientProjects != null) - { - String clientEARName = projectWidget_.getEarProjectName(); - if (clientEARName == null){ - clientEARName = clientProjects.getChoice().getList().getSelection(); - } - String clientProjName = projectWidget_.getProjectName(); - if (clientProjName == null){ - clientProjName = clientProjects.getList().getSelection(); - } - - String clientCompName = projectWidget_.getComponentName(); - String clientEARCompName = projectWidget_.getEarComponentName(); - - //Validate that the selected client project is of the type indicated by client project type. - IStatus clientProjectTypeStatus = valUtils.validateProjectType(clientProjName, runtime2ClientTypes_); - if (clientProjectTypeStatus.getSeverity() == Status.ERROR) - { - finalStatus = clientProjectTypeStatus; - } - - //Validate client side server targets and J2EE levels - String clientServerFactoryId = getClientTypeRuntimeServer().getServerId(); - String clientJ2EElevel = getJ2EEVersion(); - IStatus clientProjectStatus = valUtils.validateProjectTargetAndJ2EE(clientProjName, clientCompName, clientEARName, clientEARCompName, clientServerFactoryId, - clientJ2EElevel); - if (clientProjectStatus.getSeverity() == Status.ERROR) - { - finalStatus = clientProjectStatus; - } - } - } - return finalStatus; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java deleted file mode 100644 index 29f63c6d5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java +++ /dev/null @@ -1,1179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime; - -import java.util.Vector; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ui.common.ServerSelectionUtils; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeInfo; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionList; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.ws.internal.provisional.wsrt.IContext; -import org.eclipse.wst.ws.internal.provisional.wsrt.ISelection; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceClient; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceRuntime; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceClientInfo; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceState; -import org.eclipse.wst.ws.internal.wsrt.SimpleContext; - -public class ClientRuntimeSelectionWidgetDefaultingCommand extends AbstractDataModelOperation -{ - protected MessageUtils msgUtils_; - // clientRuntimeJ2EEType contains the default client runtime and J2EE level based on the initial selection. - // If the initialSeleciton does not result in a valid client runtime and J2EE level, clientRuntimeJ2EEType - // should remain null for the life of this instance. - private WSRuntimeJ2EEType clientRuntimeJ2EEType_; - - private TypeRuntimeServer clientIds_; - private SelectionListChoices runtimeClientTypes_; - private String clientComponentName_; - private String clientEarComponentName_; - - private IContext context_; - private ISelection selection_; - private IWebServiceClient webServiceClient_; - private ResourceContext resourceContext_; - private boolean test_; - - //A note on initialSelections ... - //The difference between clientInitialProject/Component_ and initialInitialSelection is that - //clientInitialProject/Component_ comes from the ObjectSelectionOutputCommand while initialInitialSelection - //is the actual thing that was selected before the wizard was launched. In the runtime/j2ee/project - //defaulting algorithm, clientInitialSelection will be given first priority. If, however, it is - //deemed that clientInitialProject is not a valid initial selection, initialInitialSelection - //will be given second priority. Things that could make an initialSelection invalid include - //1. The containing project contains the Web service for which we are trying to create a client - //2. The containing project has a J2EE level, server target, and project type combination which - // is not supported by any of the registered Web service runtimes. - private IProject clientInitialProject_; - private String clientInitialComponentName_; - private IProject initialInitialProject_; - private String initialInitialComponentName_; - - private String clientJ2EEVersion_; - protected boolean clientNeedEAR_ = true; - - private String wsdlURI_; - private WebServicesParser parser_; - - - public ClientRuntimeSelectionWidgetDefaultingCommand() - { - super(); - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils_ = new MessageUtils( pluginId + ".plugin", this ); - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer ids ) - { - clientIds_ = ids; - } - - public TypeRuntimeServer getClientTypeRuntimeServer() - { - return clientIds_; - } - - public SelectionListChoices getRuntime2ClientTypes() - { - return runtimeClientTypes_; - } - - public String getClientProjectName() - { - return getRuntime2ClientTypes().getChoice().getChoice().getList().getSelection(); - } - - public String getClientEarProjectName() - { - return getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().getSelection(); - } - - public String getClientComponentName() - { - return clientComponentName_; - } - - public String getClientEarComponentName() - { - return clientEarComponentName_; - } - - protected void setClientEARComponentName(String name) - { - clientEarComponentName_ = name; - } - - public String getClientComponentType() - { - return getRuntime2ClientTypes().getChoice().getList().getSelection(); - } - - public String getClientJ2EEVersion() - { - return clientJ2EEVersion_; - } - - public IWebServiceClient getWebService() - { - return webServiceClient_; - } - - public IContext getContext() - { - return context_; - } - - public ISelection getSelection() - { - return selection_; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.Command#execute(org.eclipse.wst.command.internal.provisional.env.core.common.Environment) - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - try - { - - String[] runtimeIds = WebServiceRuntimeExtensionUtils.getRuntimesByClientType(clientIds_.getTypeId()); - SelectionList list = new SelectionList(runtimeIds, 0); - Vector choices = new Vector(); - for (int i = 0; i < runtimeIds.length; i++) { - choices.add(getClientTypesChoice(runtimeIds[i])); - } - runtimeClientTypes_ = new SelectionListChoices(list, choices); - setClientDefaultRuntimeFromPreference(); - setClientDefaultJ2EEVersionFromPreference(); - setClientComponentType(); - clientRuntimeJ2EEType_ = getClientRuntimeAndJ2EEFromProject(clientInitialProject_, clientInitialComponentName_); - if (clientRuntimeJ2EEType_ != null) - { - clientJ2EEVersion_ = clientRuntimeJ2EEType_.getJ2eeVersionId(); - setClientRuntimeId(clientRuntimeJ2EEType_.getWsrId()); - setClientProjectType(clientRuntimeJ2EEType_.getClientProjectTypeId()); - - } - //setClientRuntimeId((WebServiceRuntimeExtensionUtils.getRuntimesByClientType(clientIds_.getTypeId()))[0]); - //setClientComponentType(); - //clientJ2EEVersion_ = (WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(clientIds_.getRuntimeId()).getJ2eeLevels())[0]; - - - //If clientInitialProject is the service project, check the initialInitialProject - //to see if it is valid. - ///* - ValidationUtils vu = new ValidationUtils(); - if (vu.isProjectServiceProject(clientInitialProject_, wsdlURI_, parser_)) - { - clientRuntimeJ2EEType_ = getClientRuntimeAndJ2EEFromProject(initialInitialProject_, initialInitialComponentName_); - if (clientRuntimeJ2EEType_ != null) - { - clientJ2EEVersion_ = clientRuntimeJ2EEType_.getJ2eeVersionId(); - setClientRuntimeId(clientRuntimeJ2EEType_.getWsrId()); - setClientProjectType(clientRuntimeJ2EEType_.getClientProjectTypeId()); - //Since the original clientIntialProject was invalid but initialInitialProject is valid, - //reset clientInitalProject_ to be initialInitialProject for the benefit of - //downstream project defaulting. - clientInitialProject_ = initialInitialProject_; - clientInitialComponentName_ = initialInitialComponentName_; - } - } - //*/ - - setClientDefaultProject(); - setClientDefaultEAR(); - IStatus serverStatus = setClientDefaultServer(); - if (serverStatus.getSeverity()== Status.ERROR) - { - env.getStatusHandler().reportError(serverStatus); - return serverStatus; - } - updateClientEARs(); - - //Calculate default IWebServiceClient - setDefaultsForExtension(env); - return Status.OK_STATUS; - } catch (Exception e) - { - //Catch all Exceptions in order to give some feedback to the user - IStatus errorStatus = StatusUtils.errorStatus(msgUtils_.getMessage("MSG_ERROR_TASK_EXCEPTED",new String[]{e.getMessage()}), e); - env.getStatusHandler().reportError(errorStatus); - return errorStatus; - } - - } - - - /** - * - * @param runtimeId - * @return - */ - private SelectionListChoices getClientTypesChoice(String runtimeId) - { - String[] clientComponentTypes; - clientComponentTypes = WebServiceRuntimeExtensionUtils.getClientProjectTypes(clientIds_.getTypeId(), runtimeId); - SelectionList list = new SelectionList(clientComponentTypes, 0); - Vector choices = new Vector(); - for (int i = 0; i < clientComponentTypes.length; i++) { - choices.add(getProjectChoice(clientComponentTypes[i])); - } - return new SelectionListChoices(list, choices); - } - - /** - * - * @param clientType - * @return - * - */ - private SelectionListChoices getProjectChoice(String clientType) - { - //IProject[] projects = ClientProjectTypeRegistry.getInstance().getProjects(clientType); - //String[] projectNames = new String[projects.length]; - //for (int i = 0; i < projectNames.length; i++) - // projectNames[i] = projects[i].getName(); - String[] projectNames = J2EEUtils.getProjectsContainingComponentOfType(clientType); - SelectionList list = new SelectionList(projectNames, 0); - Vector choices = new Vector(); - for (int i = 0; i < projectNames.length; i++) - { - IProject project = ProjectUtilities.getProject(projectNames[i]); - choices.add(getProjectEARChoice(project)); - } - return new SelectionListChoices(list, choices, getEARProjects()); - } - -/** - * - * @param project - * @return - */ - protected SelectionListChoices getProjectEARChoice(IProject project) - { - String[] flexProjects = getAllFlexibleProjects(); - SelectionList list = new SelectionList(flexProjects, 0); - return new SelectionListChoices(list, null); - } - - protected SelectionList getEARProjects() - { - /* - IProject[] earProjects = J2EEUtils.getEARProjects(); - String[] earProjectNames = new String[earProjects.length]; - for (int i=0; i<earProjects.length; i++) - { - earProjectNames[i] = earProjects[i].getName(); - } - */ - String[] flexProjects = getAllFlexibleProjects(); - return new SelectionList(flexProjects, 0); - } - - // rskreg - /* - private String[] gatherAttributeValues(IConfigurationElement[] elements, String key) - { - Vector v = new Vector(); - for (int i = 0; i < elements.length; i++) - { - String value = elements[i].getAttribute(key); - if (value != null && value.length() > 0) - { - if (!v.contains(value)) - v.add(value); - } - } - return (String [])v.toArray(new String[0]); - } - */ - // rskreg - - - private void setClientDefaultRuntimeFromPreference() - { - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String pRuntimeId = context.getRuntimeId(); - - //set the client runtime to be the preferred runtime if the client type allows. - setClientRuntimeId(pRuntimeId); - } - - - private void setClientRuntimeId(String id) - { - String[] clientRuntimeIds = getRuntime2ClientTypes().getList().getList(); - for (int i=0; i<clientRuntimeIds.length;i++) - { - if(clientRuntimeIds[i].equals(id)) - { - getClientTypeRuntimeServer().setRuntimeId(id); - getRuntime2ClientTypes().getList().setIndex(i); - break; - } - } - } - - private void setClientProjectType(String id) - { - String[] clientProjectTypeIds = getRuntime2ClientTypes().getChoice().getList().getList(); - for (int i=0; i<clientProjectTypeIds.length;i++) - { - if(clientProjectTypeIds[i].equals(id)) - { - getRuntime2ClientTypes().getChoice().getList().setIndex(i); - break; - } - } - } - - - protected void setClientDefaultJ2EEVersionFromPreference() - { - if (clientIds_ != null) - { - String runtimeId = clientIds_.getRuntimeId(); - if (runtimeId != null) - { - //IWebServiceRuntime wsr = WebServiceServerRuntimeTypeRegistry.getInstance().getWebServiceRuntimeById(runtimeId); - WebServiceRuntimeInfo wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(runtimeId); - if (wsrt != null) - { - String[] versions = wsrt.getJ2eeLevels(); - if (versions != null && versions.length > 0) - { - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String pJ2EE = context.getJ2EEVersion(); - if (pJ2EE!=null && pJ2EE.length()>0) - { - for (int i=0;i<versions.length;i++) - { - if (versions[i].equals(pJ2EE)) - { - clientJ2EEVersion_ = versions[i]; - return; - } - } - } - clientJ2EEVersion_ = versions[0]; - return; - } - } - } - } - } - - - private WSRuntimeJ2EEType getClientRuntimeAndJ2EEFromProject(IProject project, String componentName) - { - WSRuntimeJ2EEType cRJ2EE = null; - //If there is a valid initial selection, use it to determine - //reasonable J2EE version and Web service runtime values - - if (project != null && project.exists()) - { - boolean isValidComponentType = false; - if (componentName != null && componentName.length()>0) - { - isValidComponentType = J2EEUtils.isWebComponent(project, componentName) || - J2EEUtils.isEJBComponent(project, componentName) || - J2EEUtils.isAppClientComponent(project, componentName) || - J2EEUtils.isJavaComponent(project, componentName); - } - - if (isValidComponentType) - { - //WebServiceClientTypeRegistry wsctReg = WebServiceClientTypeRegistry.getInstance(); - - //Get the J2EE level - String versionString = null; - if (!J2EEUtils.isJavaComponent(project, componentName)) - { - int versionId = J2EEUtils.getJ2EEVersion(project, componentName); - versionString = String.valueOf(versionId); - } - - //Get the runtime target of the project - IRuntime runtimeTarget = ServerSelectionUtils.getRuntimeTarget(project.getName()); - String runtimeTargetId = null; - if (runtimeTarget != null) - runtimeTargetId = runtimeTarget.getRuntimeType().getId(); - - //Get the client project type - //String clientProjectTypeId = getClientProjectTypeFromRuntimeId(project, clientIds_.getRuntimeId()); - String clientComponentTypeId = J2EEUtils.getComponentTypeId(project, componentName); - - //If the preferred runtime supports this J2EE level and server target, keep it - if ((versionString == null || WebServiceRuntimeExtensionUtils.doesRuntimeSupportJ2EELevel(versionString, clientIds_.getRuntimeId())) && - ((runtimeTarget == null) || - ((runtimeTarget != null) && WebServiceRuntimeExtensionUtils.doesRuntimeSupportServerTarget(runtimeTargetId, clientIds_.getRuntimeId()))) && - (WebServiceRuntimeExtensionUtils.doesRuntimeSupportComponentType(clientIds_.getTypeId(), clientIds_.getRuntimeId(), clientComponentTypeId)) - ) - { - //Set the J2EE level and web service runtime to match the project - cRJ2EE = new WSRuntimeJ2EEType(); - cRJ2EE.setJ2eeVersionId(versionString); - cRJ2EE.setWsrId(clientIds_.getRuntimeId()); - cRJ2EE.setClientProjectTypeId(clientComponentTypeId); - return cRJ2EE; - } else - { - //Look for a runtime that matches - String[] validRuntimes = WebServiceRuntimeExtensionUtils.getRuntimesByClientType(clientIds_.getTypeId()); - for (int i = 0; i < validRuntimes.length; i++) - { - //String thisClientProjectTypeId = getClientProjectTypeFromRuntimeId(project, validRuntimes[i]); - if ((versionString == null || WebServiceRuntimeExtensionUtils.doesRuntimeSupportJ2EELevel(versionString, validRuntimes[i])) && - ((runtimeTarget == null) || - ((runtimeTarget != null) && WebServiceRuntimeExtensionUtils.doesRuntimeSupportServerTarget(runtimeTargetId, validRuntimes[i]))) && - (WebServiceRuntimeExtensionUtils.doesRuntimeSupportComponentType(clientIds_.getTypeId(), validRuntimes[i], clientComponentTypeId)) - ) - { - cRJ2EE = new WSRuntimeJ2EEType(); - cRJ2EE.setJ2eeVersionId(versionString); - cRJ2EE.setWsrId(validRuntimes[i]); - cRJ2EE.setClientProjectTypeId(clientComponentTypeId); - return cRJ2EE; - } - } - } - } - } - return cRJ2EE; - } - - - private void setClientComponentType() - { - getRuntime2ClientTypes().getChoice().getList().setIndex(0); - } - - /* - private void setClientDefaultProjectNew() - { - if (clientInitialProject_ != null) - { - getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(clientInitialProject_.getName()); - String moduleName = null; - if (clientInitialComponentName_!=null && clientInitialComponentName_.length()>0) - { - moduleName = clientInitialComponentName_; - } - else - { - moduleName = J2EEUtils.getFirstWebModuleName(clientInitialProject_); - } - clientComponentName_ = moduleName; - String version = String.valueOf(J2EEUtils.getJ2EEVersion(clientInitialProject_, moduleName)); - String[] validVersions = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(clientIds_.getRuntimeId()).getJ2eeLevels(); - for (int i=0; i< validVersions.length; i++) - { - if (validVersions[i].equals(version)) - { - clientJ2EEVersion_ = validVersions[i]; - } - } - } - else - { - //Pick the first one - IProject[] projects = WebServiceRuntimeExtensionUtils.getAllProjects(); - if (projects.length>0) - { - getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(projects[0].getName()); - String moduleName = J2EEUtils.getFirstWebModuleName(projects[0]); - clientComponentName_ = moduleName; - String version = String.valueOf(J2EEUtils.getJ2EEVersion(projects[0], moduleName)); - String[] validVersions = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(clientIds_.getRuntimeId()).getJ2eeLevels(); - for (int i=0; i< validVersions.length; i++) - { - if (validVersions[i].equals(version)) - { - clientJ2EEVersion_ = validVersions[i]; - } - } - - } - else - { - //there are no projects in the workspace. Pass the default names for new projects. - getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(ResourceUtils.getDefaultWebProjectName()); - clientComponentName_ = ResourceUtils.getDefaultWebComponentName(); - } - } - } - */ - - private void setClientDefaultProject() - { - //Handle the case where no valid initial selection exists - if (clientInitialProject_ == null || (clientInitialProject_!=null && clientRuntimeJ2EEType_==null)) - { - //Select the first existing project that is valid. - setClientProjectToFirstValid(); - return; - } - - ValidationUtils vu = new ValidationUtils(); - if (!vu.isProjectServiceProject(clientInitialProject_, wsdlURI_, parser_)) - { - getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(clientInitialProject_.getName()); - clientComponentName_ = clientInitialComponentName_; - } - else - { - setClientProjectToFirstValid(); - } - - } - - - private void setClientProjectToFirstValid() - { - //WebServiceClientTypeRegistry wsctReg = WebServiceClientTypeRegistry.getInstance(); - ValidationUtils vu = new ValidationUtils(); - String[] projectNames = getRuntime2ClientTypes().getChoice().getChoice().getList().getList(); - - for (int i=0;i<projectNames.length; i++) - { - IProject project = ProjectUtilities.getProject(projectNames[i]); - IVirtualComponent[] vcs = J2EEUtils.getComponentsByType(project, getClientComponentType()); - if (project.isOpen() && vcs!=null && vcs.length>0) - { - - //Get the runtime target of the project - IRuntime runtimeTarget = ServerSelectionUtils.getRuntimeTarget(project.getName()); - String runtimeTargetId = null; - if (runtimeTarget != null) - runtimeTargetId = runtimeTarget.getRuntimeType().getId(); - - for (int j=0; j < vcs.length; j++) - { - //Get the J2EE level - int versionId = J2EEUtils.getJ2EEVersion(vcs[j]); - String versionString = String.valueOf(versionId); - - - - if (clientJ2EEVersion_ != null && clientJ2EEVersion_.length()>0 && clientJ2EEVersion_.equals(versionString)) - { - if (WebServiceRuntimeExtensionUtils.doesRuntimeSupportJ2EELevel(versionString, clientIds_.getRuntimeId()) && - ((runtimeTarget == null) || - ((runtimeTarget!=null) && WebServiceRuntimeExtensionUtils.doesRuntimeSupportServerTarget(runtimeTargetId, clientIds_.getRuntimeId()))) - ) - { - if (!vu.isProjectServiceProject(project, wsdlURI_, parser_)) - { - getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(projectNames[i]); - clientComponentName_ = vcs[j].getName(); - return; - } - } - } - } - } - } - - //No valid project was found. Enter a new project name. - getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(ResourceUtils.getDefaultWebProjectName()); - clientComponentName_ = ResourceUtils.getDefaultWebProjectName(); - } - - - protected IResource getResourceFromInitialSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - return resource; - } catch(CoreException e) - { - return null; - } - } - } - return null; - } - - - private void setClientDefaultEAR() - { - //Client-side - String initialClientProjectName = getRuntime2ClientTypes().getChoice().getChoice().getList().getSelection(); - IProject initialClientProject = ProjectUtilities.getProject(initialClientProjectName); - //IProject defaultClientEAR = getDefaultEARFromClientProject(initialClientProject); - String[] clientEARInfo = getDefaultEARFromClientProject(initialClientProject, clientComponentName_); - - getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setSelectionValue(clientEARInfo[0]); - clientEarComponentName_ = clientEARInfo[1]; - } - - /* - private void setClientDefaultEARNew() - { - String initialClientProjectName = getRuntime2ClientTypes().getChoice().getChoice().getList().getSelection(); - IProject initialClientProject = (IProject)((new StringToIProjectTransformer()).transform(initialClientProjectName)); - IVirtualComponent[] earComps = J2EEUtils.getReferencingEARComponents(initialClientProject, clientComponentName_); - if (earComps.length>0) - { - //Pick the first one - IVirtualComponent earComp = earComps[0]; - String earProjectName = earComp.getProject().getName(); - String earComponentName = earComp.getName(); - getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setSelectionValue(earProjectName); - clientEarComponentName_ = earComponentName; - } - else - { - //Component is not associated with any EARs, so pick the first EAR you see with the correct J2EE version. - IVirtualComponent[] allEarComps = J2EEUtils.getAllEARComponents(); - if (allEarComps.length>0) - { - for (int i=0; i<allEarComps.length; i++) - { - if (clientJ2EEVersion_.equals(String.valueOf(J2EEUtils.getJ2EEVersion(allEarComps[i])))) - { - String earProjectName = allEarComps[i].getProject().getName(); - getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setSelectionValue(earProjectName); - clientEarComponentName_ = allEarComps[i].getName(); - - } - - } - } - else - { - //there are no Ears. - getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setSelectionValue(ResourceUtils.getDefaultClientEARProjectName()); - clientEarComponentName_ = ResourceUtils.getDefaultClientEARComponentName(); - } - - - } - } - */ - /** - * - * @param project - * @return - * - * - */ - - protected String[] getDefaultEARFromClientProject(IProject project, String componentName) - { - String[] projectAndComp = new String[2]; - IVirtualComponent[] earComps = J2EEUtils.getReferencingEARComponents(project, componentName); - if (earComps.length>0) - { - //Pick the first one - IVirtualComponent earComp = earComps[0]; - projectAndComp[0] = earComp.getProject().getName(); - projectAndComp[1]= earComp.getName(); - return projectAndComp; - //getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setSelectionValue(earProjectName); - //clientEarComponentName_ = earComponentName; - } - - //Either project does not exist or component is not associated with any EARs, so pick the first EAR you see with the correct J2EE version. - IVirtualComponent[] allEarComps = J2EEUtils.getAllEARComponents(); - if (allEarComps.length>0) - { - for (int i=0; i<allEarComps.length; i++) - { - if (clientJ2EEVersion_.equals(String.valueOf(J2EEUtils.getJ2EEVersion(allEarComps[i])))) - { - String earProjectName = allEarComps[i].getProject().getName(); - projectAndComp[0] = earProjectName; - projectAndComp[1] = allEarComps[i].getName(); - return projectAndComp; - //getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setSelectionValue(earProjectName); - //clientEarComponentName_ = allEarComps[i].getName(); - - } - - } - projectAndComp[0] = ResourceUtils.getDefaultClientEARProjectName(); - projectAndComp[1] = ResourceUtils.getDefaultClientEARComponentName(); - return projectAndComp; - - } - else - { - //there are no Ears. - projectAndComp[0] = ResourceUtils.getDefaultClientEARProjectName(); - projectAndComp[1] = ResourceUtils.getDefaultClientEARComponentName(); - return projectAndComp; - //getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setSelectionValue(ResourceUtils.getDefaultClientEARProjectName()); - //clientEarComponentName_ = ResourceUtils.getDefaultClientEARComponentName(); - } - } - - private IStatus setClientDefaultServer() - { - IStatus status = Status.OK_STATUS; - //Calculate reasonable default server based on initial project selection. - String initialClientProjectName = runtimeClientTypes_.getChoice().getChoice().getList().getSelection(); - IProject initialClientProject = ProjectUtilities.getProject(initialClientProjectName); - if (initialClientProject.exists()) - { - String[] serverInfo = ServerSelectionUtils.getServerInfoFromExistingProject(initialClientProject, clientComponentName_, clientIds_.getRuntimeId(), true); - if (serverInfo!=null) - { - if (serverInfo[0]!=null && serverInfo[0].length()>0) - { - clientIds_.setServerId(serverInfo[0]); - } - if (serverInfo[1]!=null && serverInfo[1].length()>0) - { - clientIds_.setServerInstanceId(serverInfo[1]); - } - } - } - else //the project does not exist. - { - //Does the EAR exist? - String initialClientEARProjectName = runtimeClientTypes_.getChoice().getChoice().getChoice().getList().getSelection(); - IProject initialClientEARProject = ProjectUtilities.getProject(initialClientEARProjectName); - if (initialClientEARProject.exists()) - { - String[] serverInfo = ServerSelectionUtils.getServerInfoFromExistingProject(initialClientEARProject, clientEarComponentName_, clientIds_.getRuntimeId(), false); - if (serverInfo!=null) - { - if (serverInfo[0]!=null && serverInfo[0].length()>0) - { - clientIds_.setServerId(serverInfo[0]); - } - if (serverInfo[1]!=null && serverInfo[1].length()>0) - { - clientIds_.setServerInstanceId(serverInfo[1]); - } - } - } - else - { - String[] serverInfo = ServerSelectionUtils.getServerFromWebServceRuntimeAndJ2EE(clientIds_.getRuntimeId(), clientJ2EEVersion_); - if (serverInfo!=null) - { - if (serverInfo[0]!=null && serverInfo[0].length()>0) - { - clientIds_.setServerId(serverInfo[0]); - } - if (serverInfo[1]!=null && serverInfo[1].length()>0) - { - clientIds_.setServerInstanceId(serverInfo[1]); - } - } - else - { - //Since the project and the EAR are both new, try changing the J2EE level - boolean foundServer = false; - WebServiceRuntimeInfo wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(clientIds_.getRuntimeId()); - if (wsrt != null) - { - String[] versions = wsrt.getJ2eeLevels(); - if (versions != null && versions.length > 0) - { - for (int k=0; k<versions.length; k++) - { - //If this J2EE version is different from the current one, see if there is - //a server available. - if (clientJ2EEVersion_!=versions[k]) - { - String[] si = ServerSelectionUtils.getServerFromWebServceRuntimeAndJ2EE(clientIds_.getRuntimeId(), versions[k]); - if (si!=null) - { - if (si[0]!=null && si[0].length()>0) - { - clientIds_.setServerId(si[0]); - } - if (si[1]!=null && si[1].length()>0) - { - clientIds_.setServerInstanceId(si[1]); - } - clientJ2EEVersion_ = versions[k]; - foundServer = true; - break; - } - - } - } - } - } - //No valid server runtimes appear to be configured, this is an error condition. - if (!foundServer) - { - String runtimeLabel = WebServiceRuntimeExtensionUtils.getRuntimeLabelById(clientIds_.getRuntimeId()); - String serverLabels = getServerLabels(clientIds_.getRuntimeId()); - status = StatusUtils.errorStatus(msgUtils_.getMessage("MSG_ERROR_NO_SERVER_RUNTIME", new String[]{runtimeLabel, serverLabels}) ); - } - - } - } - - } - - return status; - } - - protected String getServerLabels(String runtimeId) - { - WebServiceRuntimeInfo wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(runtimeId); - String[] validServerFactoryIds = wsrt.getServerFactoryIds(); - //String[] validServerLabels = new String[validServerFactoryIds.length]; - StringBuffer validServerLabels = new StringBuffer(); - for (int i=0; i<validServerFactoryIds.length; i++) - { - if (i>0) - { - validServerLabels.append(", "); - } - validServerLabels.append(WebServiceRuntimeExtensionUtils.getServerLabelById(validServerFactoryIds[i])); - - } - return validServerLabels.toString(); - } - - protected void updateClientProject(String projectName, String componentName, String serviceTypeId) - { - boolean isEJB = false; - String implId = WebServiceRuntimeExtensionUtils.getImplIdFromTypeId(serviceTypeId); - isEJB = (implId.equals("org.eclipse.jst.ws.wsImpl.ejb")); - String[] updatedNames = ResourceUtils.getClientProjectComponentName(projectName, componentName, isEJB); - getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(updatedNames[0]); - clientComponentName_ = updatedNames[1]; - - } - - protected void updateClientEARs() - { - //Set EAR selection to null if the project/server defaults imply an EAR should not be created - String clientProjectName = getRuntime2ClientTypes().getChoice().getChoice().getList().getSelection(); - IProject clientProject = ProjectUtilities.getProject(clientProjectName); - if (clientProject != null && clientProject.exists()) - { - //Get the runtime target on the serviceProject - IRuntime clientTarget = ServerSelectionUtils.getRuntimeTarget(clientProjectName); - String j2eeVersion = String.valueOf(J2EEUtils.getJ2EEVersion(clientProject, clientComponentName_)); - if (clientTarget != null) - { - if (!ServerUtils.isTargetValidForEAR(clientTarget.getRuntimeType().getId(),j2eeVersion)) - { - //Default the EAR selection to be empty - getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setIndex(-1); - clientEarComponentName_=""; - clientNeedEAR_ = false; - } - } - - } - else - { - String serverId = clientIds_.getServerId(); - if (serverId != null) - { - //Use the server type - String clientServerTargetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverId); - if (clientServerTargetId!=null && clientServerTargetId.length()>0) - { - if (!ServerUtils.isTargetValidForEAR(clientServerTargetId,clientJ2EEVersion_)) - { - //Default the EAR selection to be empty - getRuntime2ClientTypes().getChoice().getChoice().getChoice().getList().setIndex(-1); - clientEarComponentName_=""; - clientNeedEAR_ = false; - } - } - } - } - } - - private void setDefaultsForExtension(Environment env) - { - IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntime(clientIds_.getRuntimeId()); - if (wsrt != null) - { - WebServiceClientInfo wsInfo = new WebServiceClientInfo(); - - wsInfo.setJ2eeLevel(clientJ2EEVersion_); - wsInfo.setServerFactoryId(clientIds_.getServerId()); - wsInfo.setServerInstanceId(clientIds_.getServerInstanceId()); - wsInfo.setState(WebServiceState.UNKNOWN_LITERAL); - wsInfo.setWebServiceRuntimeId(clientIds_.getRuntimeId()); - wsInfo.setWsdlURL(wsdlURI_); - - webServiceClient_ = wsrt.getWebServiceClient(wsInfo); - WebServiceScenario scenario = WebServiceScenario.CLIENT_LITERAL; - if (resourceContext_ != null) - { - context_ = new SimpleContext(true, true, true, true, true, true, test_, false, scenario, resourceContext_.isOverwriteFilesEnabled(), resourceContext_ - .isCreateFoldersEnabled(), resourceContext_.isCheckoutFilesEnabled()); - } - } - - } - - public void setClientInitialSelection(IStructuredSelection selection) - { - if (clientInitialProject_ == null) - { - clientInitialProject_ = getProjectFromInitialSelection(selection); - clientInitialComponentName_ = getComponentNameFromInitialSelection(selection); - } - } - - public void setClientInitialProject(IProject clientInitialProject) - { - clientInitialProject_ = clientInitialProject; - } - - public void setClientInitialComponentName(String name) - { - clientInitialComponentName_ = name; - } - - /** - * @param initialInitialSelection_ The initialInitialSelection_ to set. - */ - public void setInitialInitialSelection(IStructuredSelection initialInitialSelection) - { - initialInitialProject_ = getProjectFromInitialSelection(initialInitialSelection); - initialInitialComponentName_ = getComponentNameFromInitialSelection(initialInitialSelection); - } - - public boolean getClientNeedEAR() - { - return clientNeedEAR_; - } - - /** - * @param parser_ The parser_ to set. - */ - public void setWebServicesParser(WebServicesParser parser) { - parser_ = parser; - } - - public void setWsdlURI(String wsdlURI) - { - wsdlURI_ = wsdlURI; - } - - public void setTestService(boolean testService) - { - test_ = testService; - } - - public void setResourceContext( ResourceContext resourceContext ) - { - resourceContext_ = resourceContext; - } - - private IProject getProjectFromInitialSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - if (resource==null) - return null; - IProject p = ResourceUtils.getProjectOf(resource.getFullPath()); - return p; - } catch(CoreException e) - { - return null; - } - } - } - return null; - } - - private String getComponentNameFromInitialSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - if (resource==null) - return null; - - IVirtualComponent comp = ResourceUtils.getComponentOf(resource); - if (comp!=null) - { - return comp.getName(); - } - } catch(CoreException e) - { - return null; - } - } - } - return null; - } - - /* - private String getClientProjectTypeFromRuntimeId(IProject p, String runtimeId) - { - //Navigate the runtimeClientTypes to see if we can navigate from the provided - //runtime to the provided project's name. - String pName = p.getName(); - String[] runtimeIds = getRuntime2ClientTypes().getList().getList(); - int numberOfRuntimes = runtimeIds.length; - //Get the index of the runtimeId we are interested in - for (int i=0; i<numberOfRuntimes; i++) - { - if (runtimeIds[i].equals(runtimeId)) - { - //Get the list of client project types for this runtimeId - SelectionListChoices clientProjectTypesToProjects= getRuntime2ClientTypes().getChoice(i); - String[] clientProjectTypes = clientProjectTypesToProjects.getList().getList(); - for (int j=0; j<clientProjectTypes.length; j++) - { - //Get the list of projects for this clientProjectType. If pName - //is in this list, we know the runtimeId supports this project - //and we know the client project type. - String[] clientProjects = clientProjectTypesToProjects.getChoice(j).getList().getList(); - for (int k=0; k<clientProjects.length; k++) - { - if (clientProjects[k].equals(pName)) - { - //Found the project!! - return clientProjectTypes[j]; - } - } - } - - } - } - - //We didn't find the project under any of this runtimes client project types. - //This means that this runtime does not support that client type. Return null - return null; - } - */ - - protected String[] getAllFlexibleProjects() - { - Vector v = new Vector(); - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - for (int i = 0; i < projects.length; i++) - { - if (!projects[i].getName().equals("Servers") && !projects[i].getName().startsWith(".")) - { - v.add(projects[i].getName()); - } - } - - return (String[])v.toArray(new String[0]); - - } - - /** - * This inner class is being used to pass around Web service runtime - * and J2EE level information. - * - */ - protected class WSRuntimeJ2EEType - { - private String wsrId_; - private String j2eeVersionId_; - private String clientProjectTypeId; //only used for client-side defaulting - - public WSRuntimeJ2EEType() - { - //making this ctor public so that subclasses can instantiate. - } - /** - * @return Returns the j2eeVersionId_. - */ - public String getJ2eeVersionId() - { - return j2eeVersionId_; - } - /** - * @param versionId_ The j2eeVersionId_ to set. - */ - public void setJ2eeVersionId(String versionId_) - { - j2eeVersionId_ = versionId_; - } - /** - * @return Returns the wsrId_. - */ - public String getWsrId() - { - return wsrId_; - } - /** - * @param wsrId_ The wsrId_ to set. - */ - public void setWsrId(String wsrId_) - { - this.wsrId_ = wsrId_; - } - - /** - * @return Returns the clientProjectTypeId. - */ - public String getClientProjectTypeId() - { - return clientProjectTypeId; - } - /** - * @param clientProjectTypeId The clientProjectTypeId to set. - */ - public void setClientProjectTypeId(String clientProjectTypeId) - { - this.clientProjectTypeId = clientProjectTypeId; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java deleted file mode 100644 index 81a2cd5a6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java +++ /dev/null @@ -1,651 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ui.common.ServerSelectionUtils; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.server.core.IRuntime; - -public class ProjectSelectionWidget extends SimpleWidgetDataContributor { - - private final String EAR_PERMITTED_PROJECT_TYPE = "EAR_PERMITTED_PROJECT_TYPE"; - //private final String JAVA_PROJECT_TYPE_ID = "org.eclipse.jst.ws.consumption.ui.clientProjectType.Containerless"; - - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - - private SelectionListChoices projects_; - - private boolean needEAR_; - - private TypeRuntimeServer trsIds_; - - private String j2eeVersion_; - - private String projectTypeId_ = EAR_PERMITTED_PROJECT_TYPE; - - private Listener statusListener_; - - private Text messageText_; - - private boolean isClient_ = false; - - private MessageUtils msgUtils; - - private byte CREATE_PROJECT = (byte) 1; - - private byte CREATE_EAR = (byte) 2; - - private byte ADD_EAR_ASSOCIATION = (byte) 4; - - private Combo moduleProject_; - private Combo earProject_; - private String componentType_; - - private ModifyListener moduleProjectListener_; - private ModifyListener moduleListener_; - private ModifyListener earProjectListener_; - private ModifyListener earModuleListener_; - - private String initialModuleName_; - - /* - * CONTEXT_ID PWRS0006 for the service-side Web project combo box of the - * runtime selection Page - */ - private String INFOPOP_PWRS_COMBO_PROJECT = pluginId_ + ".PWRS0006"; - - private Combo module_; - - /* CONTEXT_ID PWRS0012 for the EAR combo box of the runtime selection Page */ - private String INFOPOP_PWRS_COMBO_EAR = pluginId_ + ".PWRS0012"; - - private Combo earModule_; - - /* - * Default Constructor - */ - public ProjectSelectionWidget() { - } - - /* - * ProjectSelectionWidget @param isClient - */ - public ProjectSelectionWidget(boolean isClient) { - this.isClient_ = isClient; - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) { - msgUtils = new MessageUtils(pluginId_ + ".plugin", this); - UIUtils uiUtils = new UIUtils(msgUtils, pluginId_); - - statusListener_ = statusListener; - - if (isClient_) - { - moduleProject_ = uiUtils.createCombo(parent, "LABEL_CLIENT_PROJECT", "LABEL_CLIENT_PROJECT", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - module_ = uiUtils.createCombo(parent, "LABEL_CLIENT_MODULE", "LABEL_CLIENT_MODULE", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - earProject_ = uiUtils.createCombo(parent, "LABEL_CLIENT_EAR_PROJECT", "LABEL_CLIENT_EAR_PROJECT", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - earModule_ = uiUtils.createCombo(parent, "LABEL_CLIENT_EAR_MODULE", "LABEL_CLIENT_EAR_MODULE", INFOPOP_PWRS_COMBO_EAR, SWT.SINGLE | SWT.BORDER ); - } - else - { - moduleProject_ = uiUtils.createCombo(parent, "LABEL_SERVICE_PROJECT", "LABEL_SERVICE_PROJECT", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - module_ = uiUtils.createCombo(parent, "LABEL_SERVICE_MODULE", "LABEL_SERVICE_MODULE", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - earProject_ = uiUtils.createCombo(parent, "LABEL_SERVICE_EAR_PROJECT", "LABEL_SERVICE_EAR_PROJECT", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - earModule_ = uiUtils.createCombo(parent, "LABEL_SERVICE_EAR_MODULE", "LABEL_SERVICE_EAR_MODULE", INFOPOP_PWRS_COMBO_EAR, SWT.SINGLE | SWT.BORDER ); - } - - //module_.addModifyListener(projectListener_); - - //earModule_.addModifyListener(earListener_); - //earModule_.addListener(SWT.Modify, statusListener); - - moduleProjectListener_ = new ModifyListener() - { - public void modifyText(ModifyEvent evt) - { - handleModuleProjectChanged(null); - statusListener_.handleEvent( null ); - } - }; - - moduleListener_ = new ModifyListener() - { - public void modifyText(ModifyEvent evt) - { - handleModuleChanged(); - statusListener_.handleEvent( null ); - } - }; - - earProjectListener_ = new ModifyListener() - { - public void modifyText(ModifyEvent evt) - { - handleEarProjectChanged(); - statusListener_.handleEvent( null ); - } - }; - - earModuleListener_ = new ModifyListener() - { - public void modifyText(ModifyEvent evt) - { - statusListener_.handleEvent( null ); - } - }; - - // message area - messageText_ = uiUtils.createText(parent, "LABEL_NO_LABEL", "LABEL_NO_LABEL", null, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY); - - return this; - } - - private void listenersOn() - { - module_.addModifyListener( moduleListener_ ); - moduleProject_.addModifyListener( moduleProjectListener_ ); - earProject_.addModifyListener( earProjectListener_ ); - earModule_.addModifyListener( earModuleListener_ ); - } - - private void listenersOff() - { - module_.removeModifyListener( moduleListener_ ); - moduleProject_.removeModifyListener( moduleProjectListener_ ); - earProject_.removeModifyListener( earProjectListener_ ); - earModule_.removeModifyListener( earModuleListener_ ); - } - - private void handleModuleProjectChanged(String moduleName) - { - String projectName = moduleProject_.getText(); - IProject project = null; - - if( projectName.equals( "" ) ) - { - module_.setItems( new String[0] ); - - return; - } - - project = ProjectUtilities.getProject( projectName ); - - - IVirtualComponent[] components = J2EEUtils.getComponentsByType( project, componentType_ ); - String[] modules = new String[components.length]; - - for( int index = 0; index < components.length; index++ ) - { - modules[index] = components[index].getName(); - } - - module_.setItems( modules ); - - if( modules.length > 0 ) - { - if (moduleName != null) - { - module_.setText(moduleName); - } - else - { - module_.setText( modules[0] ); - } - - } - else - { - module_.setText( projectName ); - } - - } - - private void handleModuleChanged() - { - IVirtualComponent component = getEarModuleForModule(); - - if( component != null ) - { - String earProject = component.getProject().getName(); - String componentName = component.getName(); - - // This will cause the module list to be update via a listener. - earProject_.setText( earProject ); - earModule_.setText( componentName ); - } - else - { - earProject_.setText( "" ); - earModule_.setText( "" ); - } - - updateEAREnabledState(); - } - - private void handleEarProjectChanged() - { - - String projectName = earProject_.getText(); - - if( projectName != null && !projectName.equals( "" )) - { - IProject project = ProjectUtilities.getProject( projectName ); - - IVirtualComponent[] components = J2EEUtils.getComponentsByType( project, J2EEUtils.EAR ); - String[] earModules = new String[components.length]; - - for( int index = 0; index < components.length; index++ ) - { - earModules[index] = components[index].getName(); - } - - earModule_.setItems( earModules ); - - if( earModules.length > 0 ) - { - earModule_.setText( earModules[0] ); - } - else - { - earModule_.setText( projectName ); - } - } - else - { - earModule_.setItems( new String[0] ); - } - } - - private IVirtualComponent getEarModuleForModule() - { - String projectName = moduleProject_.getText(); - - if( projectName.equals( "" ) ) - { - return null; - } - - IProject project = ProjectUtilities.getProject( projectName ); - String compName = module_.getText(); - - IVirtualComponent[] components = J2EEUtils.getReferencingEARComponents( project, compName ); - - return components.length == 0 ? null : components[0]; - } - - public void setProjectChoices(SelectionListChoices projects) - { - listenersOff(); - - projects_ = projects; - - String selectedModuleProject = projects.getList().getSelection(); - String selectedEarModuleProject = projects.getChoice().getList().getSelection(); - String[] projectNames = getProjects(); - - moduleProject_.setItems( projectNames ); - moduleProject_.setText( selectedModuleProject ); - earProject_.setItems( projectNames ); - earProject_.setText( selectedEarModuleProject ); - - handleModuleProjectChanged(initialModuleName_); - handleModuleChanged(); - updateEAREnabledState(); - listenersOn(); - } - - public SelectionListChoices getProjectChoices() - { - return projects_; - } - - public String getComponentName() - { - return module_.getText(); - } - - public void setComponentName( String name ) - { - listenersOff(); - module_.setText( name ); - initialModuleName_ = name; - listenersOn(); - } - - public String getEarComponentName() - { - return earModule_.getText(); - } - - public void setEarComponentName( String name ) - { - listenersOff(); - earModule_.setText( name ); - listenersOn(); - } - - public void setComponentType( String type ) - { - componentType_ = type; - } - - public String getComponentType( ) - { - return componentType_; - } - - public boolean getNeedEAR() - { - return needEAR_; - } - - public String getProjectName() - { - return moduleProject_.getText(); - } - - public String getEarProjectName() - { - return earProject_.getText(); - } - - public void setNeedEAR(boolean b) - { - needEAR_ = b; - } - - public void setTypeRuntimeServer(TypeRuntimeServer trs) - { - trsIds_ = trs; - listenersOff(); - updateEAREnabledState(); - listenersOn(); - } - - public void setJ2EEVersion(String j2eeVersion) - { - j2eeVersion_ = j2eeVersion; - listenersOff(); - updateEAREnabledState(); - listenersOn(); - } - - public void setProjectTypeId(String id) - { - projectTypeId_ = id; - } - - private String[] getProjects() - { - IProject[] projects = J2EEUtils.getAllFlexibleProjects(); - String[] projectNames = new String[projects.length]; - - for( int index = 0; index < projects.length; index++ ) - { - projectNames[index] = projects[index].getName(); - } - - return projectNames; - } - - private void updateEAREnabledState() - { - if (projects_ != null) - { - if(!projectNeedsEAR(moduleProject_.getText(), module_.getText())) - { - earModule_.setEnabled(false); - earProject_.setEnabled(false); - earModule_.setText(""); - earProject_.setText(""); - needEAR_ = false; - } - else - { - needEAR_ = true; - earModule_.setEnabled(true); - earProject_.setEnabled(true); - populateEARCombos(); - } - } - } - - private void populateEARCombos() - { - earModule_.removeAll(); - earProject_.removeAll(); - String moduleName = module_.getText(); - IProject moduleProj = ResourcesPlugin.getWorkspace().getRoot().getProject(moduleProject_.getText()); - if (moduleProj.exists()) - { - IVirtualComponent[] ears = J2EEUtils.getReferencingEARComponents(moduleProj, moduleName); - if (ears != null && ears.length > 0) - { - for (int i = 0; i < ears.length; i++) - { - earModule_.add(ears[i].getName()); - earProject_.add(ears[i].getProject().getName()); - } - earModule_.select(0); - earProject_.select(0); - return; - } - } - String earName = moduleName + "EAR"; - earModule_.setText(earName); - earProject_.setText(earName); - } - - private boolean projectNeedsEAR(String projectName, String componentName) - { - if (projectTypeId_.equals(IModuleConstants.JST_UTILITY_MODULE)) - return false; - - if (projectName == null || projectName.length()==0) - return true; - - if (componentName == null || componentName.length()==0) - return true; - - - //IProject project = (IProject)((new StringToIProjectTransformer()).transform(projectName)); - IProject project = ResourceUtils.getWorkspaceRoot().getProject(projectName); - if (project != null && project.exists()) - { - //Get the runtime target on the project - IRuntime target = ServerSelectionUtils.getRuntimeTarget(projectName); - String j2eeVersion = String.valueOf(J2EEVersionConstants.J2EE_1_4_ID); - if (J2EEUtils.exists(project, componentName)) - j2eeVersion = String.valueOf(J2EEUtils.getJ2EEVersion(project, componentName)); - - - if (target != null) - { - if (!ServerUtils.isTargetValidForEAR(target.getRuntimeType().getId(),j2eeVersion)) - { - return false; - } - - } - } - else - { - //Use the server type - if (trsIds_ != null && trsIds_.getServerId() != null) - { - String targetId = ServerUtils.getRuntimeTargetIdFromFactoryId(trsIds_.getServerId()); - if (targetId!=null && targetId.length()>0) - { - if (!ServerUtils.isTargetValidForEAR(targetId,j2eeVersion_)) - { - return false; - } - } - } - } - - return true; - } - - private IStatus handleSetMessageText() { - IStatus status = Status.OK_STATUS; - try { - byte result = (byte) 0; - if (module_.getText().length() != 0 && earModule_.getText().length() != 0) { - String moduleName = module_.getText(); - String earModuleName = earModule_.getText(); - String projectText = moduleProject_.getText(); - String earText = earProject_.getText(); - IProject project = ResourceUtils.getWorkspaceRoot().getProject(projectText); - IProject ear = ResourceUtils.getWorkspaceRoot().getProject(earText); - if (project != null) { - if (!project.exists()) { - result = (byte) (result | CREATE_PROJECT); - } - if (!ear.exists()) { - result = (byte) (result | CREATE_EAR); - } - - if (project.exists() && J2EEUtils.exists(project, moduleName) && ear.exists() && J2EEUtils.exists(ear, earModuleName)) { - if (!J2EEUtils.isComponentAssociated(ear, earModuleName, project, moduleName)) result = (byte) (result | ADD_EAR_ASSOCIATION); - } - } - } - if (isClient_) { - messageText_.setText(getValidationMessage(result, msgUtils.getMessage("MSG_CLIENT_SUB"))); - } - else { - messageText_.setText(getValidationMessage(result, msgUtils.getMessage("MSG_SERVICE_SUB"))); - } - } - catch (Exception e) { - return StatusUtils.errorStatus( msgUtils.getMessage("PAGE_MSG_VALIDATION_INTERNAL_ERROR"), e ); - } - return status; - } - - private String getValidationMessage(byte result, String serviceOrClient) { - String msg = null; - switch (result) { - case 0: - return ""; - case 1: - case 5: - msg = "MSG_PROJECT_WILL_BE_CREATED"; - break; - case 2: - case 6: - msg = "MSG_EAR_WILL_BE_CREATED"; - break; - case 3: - case 7: - msg = "MSG_PROJECT_AND_EAR_CREATED"; - break; - case 4: - msg = "MSG_EAR_WILL_BE_ASSOCIATED"; - break; - } - return msg != null ? msgUtils.getMessage(msg, new Object[] { serviceOrClient}) : ""; - } - - public IStatus getStatus() - { - IStatus finalStatus = Status.OK_STATUS; - handleSetMessageText(); - String projectText = moduleProject_.getText(); - String earText = earProject_.getText(); - String moduleText = msgUtils.getMessage( "MSG_MODULE" ); - - if (projectText==null || projectText.length()==0) - { - if (isClient_) - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_CLIENT_PROJECT_EMPTY", new String[]{""} ) ); - else - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_SERVICE_PROJECT_EMPTY", new String[]{""} ) ); - } - - if (needEAR_ && (earText==null || earText.length()==0)) - { - if (isClient_) - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_CLIENT_EAR_EMPTY", new String[]{""} ) ); - else - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_SERVICE_EAR_EMPTY", new String[]{""} ) ); - } - - if( module_ == null || module_.getText().length() == 0 ) - { - if( isClient_ ) - { - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_CLIENT_PROJECT_EMPTY", new String[]{moduleText} ) ); - } - else - { - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_CLIENT_EAR_EMPTY", new String[]{moduleText} ) ); - } - } - - if( needEAR_ && ( earModule_ == null || earModule_.getText().length() == 0 ) ) - { - if( isClient_ ) - { - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_CLIENT_EAR_EMPTY", new String[]{moduleText} ) ); - } - else - { - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_SERVICE_EAR_EMPTY", new String[]{moduleText} ) ); - } - } - -// TODO: Defect 107997 - Revisit prject and module creation logic -// if( !FlexibleJavaProjectPreferenceUtil.getMultipleModulesPerProjectProp() ) -// { -// IProject project = ResourceUtils.getWorkspaceRoot().getProject(projectText); -// -// if( project != null && project.exists() ) -// { -// String moduleName = module_.getText(); -// IVirtualComponent component = J2EEUtils.getVirtualComponent( project, moduleName ); -// -// if( !component.exists() && !moduleName.equals( projectText ) ) -// { -// finalStatus = new SimpleStatus("",msgUtils.getMessage("MSG_MODULE_NAME_AND_PROJECT_NAME_NOT_THE_SAME" ),Status.ERROR); -// } -// } -// } - - return finalStatus; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/RuntimeServerSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/RuntimeServerSelectionWidget.java deleted file mode 100644 index 6b4db2bf1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/RuntimeServerSelectionWidget.java +++ /dev/null @@ -1,273 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.RuntimeServerSelectionDialog; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.ServerUtil; - - - -public class RuntimeServerSelectionWidget extends SimpleWidgetDataContributor -{ - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - private Text runtime_; - private Text server_; - private Text j2eeVersionText; - private Composite parent_; - private boolean isClientContext_; - private TypeRuntimeServer ids_; - private String j2eeVersion_; - private MessageUtils msgUtils_; - private Listener statusListener_; - - /* CONTEXT_ID PWRS0004 for the service-side runtime selection of the runtime selection Page */ - private String INFOPOP_PWRS_GROUP_SERVICE_RUNTIME = pluginId_ + ".PWRS0004"; - - /* CONTEXT_ID PWRS0005 for the service-sdie server selection of the runtime selection Page */ - private String INFOPOP_PWRS_GROUP_SERVICE_SERVER = pluginId_ + ".PWRS0005"; - - /* CONTEXT_ID PWRS0009 for the J2EE version selection of the runtime selection Page */ - private String INFOPOP_PWRS_J2EE_VERSION = pluginId_ + ".PWRS0009"; - - public RuntimeServerSelectionWidget( boolean isClientScenario ) - { - isClientContext_ = isClientScenario; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#addControls(org.eclipse.swt.widgets.Composite, org.eclipse.swt.widgets.Listener) - */ - public WidgetDataEvents addControls( Composite parent, Listener statusListener ) - { - msgUtils_ = new MessageUtils( pluginId_ + ".plugin", this ); - UIUtils uiUtils = new UIUtils(msgUtils_, pluginId_ ); - - parent_ = parent; - statusListener_ = statusListener; - - // Runtime label and text - runtime_ = uiUtils.createText( parent, "LABEL_RUNTIMES_LIST", - "TOOLTIP_PWRS_TEXT_RUNTIME", - INFOPOP_PWRS_GROUP_SERVICE_RUNTIME, SWT.READ_ONLY ); - - // Server label and text - server_ = uiUtils.createText( parent, "LABEL_SERVERS_LIST", - "TOOLTIP_PWRS_TEXT_SERVER", - INFOPOP_PWRS_GROUP_SERVICE_SERVER, SWT.READ_ONLY ); - - j2eeVersionText = uiUtils.createText(parent, "LABEL_J2EE_VERSION", "TOOLTIP_PWRS_J2EE_VERSION", INFOPOP_PWRS_J2EE_VERSION, SWT.READ_ONLY); - - Button editButton = new Button( parent, SWT.NONE ); - editButton.setText( msgUtils_.getMessage("LABEL_EDIT_BUTTON")); - editButton.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleEditButton(); - } - } ); - - // Dummy label that goes on the right side of the edit button. - new Label( parent, SWT.NONE ); - - return this; - } - - public TypeRuntimeServer getTypeRuntimeServer() - { - return ids_; - } - - public void setTypeRuntimeServer( TypeRuntimeServer ids ) - { - ids_ = ids; - setLabels(); - } - - public String getJ2EEVersion() - { - return j2eeVersion_; - } - - public void setJ2EEVersion(String j2eeVersion) - { - this.j2eeVersion_ = j2eeVersion; - j2eeVersionText.setText((j2eeVersion_ != null) ? J2EEUtils.getLabelFromJ2EEVersion(j2eeVersion_) : msgUtils_.getMessage("LABEL_NA")); - //setLabels(); - } - - private void setLabels() - { - // rskreg - //WebServiceClientTypeRegistry registry = WebServiceClientTypeRegistry.getInstance(); - //String runtimeLabel = registry.getRuntimeLabelById( ids_.getRuntimeId() ); - String runtimeLabel = WebServiceRuntimeExtensionUtils.getRuntimeLabelById( ids_.getRuntimeId() ); - String serverLabel = null; - - if( ids_.getServerInstanceId() == null ) - { - // Get the label for the general server type. - //WebServiceServer server = registry.getWebServiceServerByFactoryId( ids_.getServerId() ); - //serverLabel = server == null ? "" : server.getLabel(); - String serverId = ids_.getServerId(); - if (serverId != null) - serverLabel = WebServiceRuntimeExtensionUtils.getServerLabelById(serverId); - } - else - { - // Get the label for the server instance. - //serverLabel = registry.getServerInstanceLabelFromInstanceId( ids_.getServerInstanceId() ); - String serverInstanceId = ids_.getServerInstanceId(); - if (serverInstanceId != null) - serverLabel = WebServiceRuntimeExtensionUtils.getServerInstanceLabelFromInstanceId(serverInstanceId); - } - // rskreg - runtimeLabel = runtimeLabel == null ? "" : runtimeLabel; - - runtime_.setText( runtimeLabel ); - if (serverLabel != null) - server_.setText( serverLabel ); - j2eeVersionText.setText((j2eeVersion_ != null) ? J2EEUtils.getLabelFromJ2EEVersion(j2eeVersion_) : msgUtils_.getMessage("LABEL_NA")); - } - - public void handleEditButton() - { - byte mode = isClientContext_ ? (byte)1 : (byte)0; - - RuntimeServerSelectionDialog dialog - = dialog = new RuntimeServerSelectionDialog( parent_.getShell(), mode, ids_, j2eeVersion_ ); - dialog.create(); - dialog.handleServerViewSelectionEvent(); - int result = dialog.open(); - - if (result == Window.OK) - { - ids_ = dialog.getTypeRuntimeServer(); - j2eeVersion_ = dialog.getJ2EEVersion(); - setLabels(); - statusListener_.handleEvent(null); - } - } - - public void addModifyListener(ModifyListener listener) - { - if (runtime_ != null) - runtime_.addModifyListener(listener); - } - - public void removeModifyListener(ModifyListener listener) - { - if (runtime_ != null) - runtime_.removeModifyListener(listener); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#getStatus() - */ - public IStatus getStatus() - { - IStatus status = Status.OK_STATUS; - String scenario = isClientContext_ ? msgUtils_.getMessage( "MSG_CLIENT_SUB" ) - : msgUtils_.getMessage( "MSG_SERVICE_SUB" ); - - String runtimeLabel = WebServiceRuntimeExtensionUtils.getRuntimeLabelById( ids_.getRuntimeId() ); - String serverLabel = ids_.getServerId() == null ? "" : WebServiceRuntimeExtensionUtils.getServerLabelById(ids_.getServerId()); - - - if( ids_.getRuntimeId() == null || runtimeLabel == null || runtimeLabel.equals("" )) - { - status = StatusUtils.errorStatus(msgUtils_.getMessage( "MSG_NO_RUNTIME", new String[]{ scenario } ) ); - } - else if( ids_.getServerId() == null || serverLabel.equals( "" )) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage( "MSG_NO_SERVER", new String[]{ scenario } ) ); - } - - //Check if only stub runtime is available for the selected server type - - String serverFactoryId = ids_.getServerId(); - // - IServerType serverType = ServerCore.findServerType(serverFactoryId); - if (serverType!=null) { - - //Find a Runtime which is not a stub - //IRuntime nonStubRuntime = null; - boolean foundNonStubRuntime = false; - IRuntime[] runtimes = ServerUtil.getRuntimes(null, null); - String serverRuntimeTypeId = serverType.getRuntimeType().getId(); - for (int i = 0; i < runtimes.length; i++) { - IRuntime runtime = runtimes[i]; - String thisRuntimeTypeId = runtime.getRuntimeType().getId(); - if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub()) { - //Found an appropriate IRuntime that is not a stub - foundNonStubRuntime=true; - break; - } - } - - if (!foundNonStubRuntime) - { - String servertypeLabel = WebServiceRuntimeExtensionUtils.getServerLabelById(serverFactoryId); - status = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_STUB_ONLY",new String[]{servertypeLabel}) ); - } - } - - // - - //--------- check if WSCT exists for these selections - if (!(ids_.getServerId() == null) && !(ids_.getRuntimeId() == null) && isClientContext_) - { - - if (!WebServiceRuntimeExtensionUtils.webServiceClientRuntimeTypeExists( ids_.getServerId(), ids_.getRuntimeId(), ids_.getTypeId())) - { - status = StatusUtils.errorStatus( msgUtils_.getMessage( "MSG_INVALID_SRT_SELECTIONS", new String[]{ scenario } ) ); - } - - } - - //--------- check if WSSRT exists for these selections - if (!(ids_.getServerId() == null) && !(ids_.getRuntimeId() == null) && !isClientContext_) - { - - if (!WebServiceRuntimeExtensionUtils.isServerRuntimeTypeSupported(ids_.getServerId(), ids_.getRuntimeId(), ids_.getTypeId())) { - status = StatusUtils.errorStatus( msgUtils_.getMessage( "MSG_INVALID_SRT_SELECTIONS", new String[]{ scenario } ) ); - } - - } - - - - return status; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java deleted file mode 100644 index 72afb34cb..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java +++ /dev/null @@ -1,351 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import java.util.List; -import java.util.Vector; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.context.ScenarioContext; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSelection; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionList; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.common.environment.StatusHandler; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; - - -/* -* The JSPGeneration task runs the jsp generation engine found in the -* JBWizard Plugin -* -* -*/ -public class ClientTestDelegateCommand extends AbstractDataModelOperation -{ - private WebServiceTestRegistry testRegistry; - private SelectionList testFacilities; - private String jspFolder; - private BooleanSelection[] methods; - private String sampleServerTypeID; - private IServer sampleExistingServer; - private String proxyBean; - private String sampleProject; - private String sampleP; - private String sampleC; - private String clientProject; - private String clientP; - private String clientC; - private boolean clientNeedEAR; - private String clientEarProjectName; - private String clientEarComponentName; - private TypeRuntimeServer serverIds; - private String serviceProject; - private String serviceP; - private String wsdlServiceURL; - private boolean isTestWidget = false; - private String setEndpointMethod; - private List endpoints; - - public ClientTestDelegateCommand () - { - testRegistry = WebServiceTestRegistry.getInstance(); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - String clientTestID = testFacilities.getSelection(); - - //Get the webservice extension - - WebServiceTestExtension wscte = (WebServiceTestExtension)testRegistry.getWebServiceExtensionsByName(clientTestID); - IWebServiceTester iwst = (IWebServiceTester)wscte.getWebServiceExecutableExtension(); - TestInfo testInfo = getTestInfo(); - - status = commandFactoryExecution(iwst.generate(testInfo),env, monitor ); - if(status.getSeverity() == Status.ERROR){ - return status; - } - status = commandFactoryExecution(iwst.launch(testInfo),env, monitor ); - if(status.getSeverity() == Status.ERROR){ - return status; - } - - return status; - } - - private IStatus commandFactoryExecution(ICommandFactory commandFactory,Environment env, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - - while(commandFactory.hasNext()) - { - AbstractDataModelOperation operation = commandFactory.getNextCommand(); - operation.setEnvironment( env ); - - try - { - status = operation.execute( monitor, null ); - } - catch( Exception exc ) - { - status = StatusUtils.errorStatus( exc ); - } - - if(status.getSeverity() == Status.ERROR){ - StatusHandler sHandler = env.getStatusHandler(); - sHandler.reportError(status); - return status; - } - } - return status; - } - - - //Helper method which sets up the TestInfo data structure - private TestInfo getTestInfo() - { - IServer serviceExistingServer = null; - String serviceServerTypeID = null; - - //service server info - if(serverIds != null){ - if (serverIds.getServerInstanceId() != null) - serviceExistingServer = ServerCore.findServer(serverIds.getServerInstanceId()); - } - if (serviceExistingServer != null) - serviceServerTypeID = serviceExistingServer.getServerType().getId(); - - - if(clientProject != null){ - int index = clientProject.indexOf("/"); - if (index!=-1){ - clientP = clientProject.substring(0,index); - clientC = clientProject.substring(index + 1); - } - } - - - if(sampleProject != null){ - int index = sampleProject.indexOf("/"); - if (index!=-1){ - sampleP = sampleProject.substring(0,index); - sampleC = sampleProject.substring(index + 1); - } - } - - - - TestInfo testInfo = new TestInfo(); - testInfo.setClientExistingServer(sampleExistingServer); - testInfo.setClientServerTypeID(sampleServerTypeID); - testInfo.setJspFolder(jspFolder); - testInfo.setEndpoint(endpoints); - testInfo.setGenerationProject(sampleP); - testInfo.setGenerationModule(sampleC); - testInfo.setProxyBean(proxyBean); - testInfo.setSetEndpointMethod(setEndpointMethod); - testInfo.setClientProject(clientP); - testInfo.setClientModule(clientC); - testInfo.setClientNeedEAR(clientNeedEAR); - testInfo.setClientEARProject(clientEarProjectName); - testInfo.setClientEARModule(clientEarComponentName); - testInfo.setMethods(methods); - - //if this is a client scenario the service stuff is empty - if(serviceServerTypeID == null){ - serviceServerTypeID = sampleServerTypeID; - serviceExistingServer = sampleExistingServer; - } - - - testInfo.setServiceServerTypeID(serviceServerTypeID); - testInfo.setServiceExistingServer(serviceExistingServer); - //wsdl stuff - testInfo.setServiceProject(getWSDLProject()); - testInfo.setWsdlServiceURL(wsdlServiceURL); - return testInfo; - } - - - - //The test facilities retrieved from the extension - //plus the default - public void setTestFacility(SelectionList selection) - { - testFacilities = selection; - } - - public void setFolder(String folder) - { - } - - public void setJspFolder(String jspFolder) - { - this.jspFolder = jspFolder; - } - - public void setMethods(BooleanSelection[] methods) - { - this.methods = methods; - } - - public void setRunClientTest(boolean runClientTest) - { - } - - public void setProxyBean(String proxyBean) - { - this.proxyBean = proxyBean; - } - - public void setSampleProject(String sampleProject) - { - this.sampleProject = sampleProject; - } - - public void setClientProject(String clientProject) - { - this.clientProject = clientProject; - } - - public void setScenarioContext(ScenarioContext scenarioContext) - { - } - - public void setClientTestRegistry(WebServiceTestRegistry testRegistry) - { - this.testRegistry = testRegistry; - } - - public void setSampleServerTypeID(String sampleServerTypeID) - { - this.sampleServerTypeID = sampleServerTypeID; - } - - public void setSampleExistingServer(IServer sampleExistingServer) - { - this.sampleExistingServer = sampleExistingServer; - } - - public void setClientTypeRuntimeServer(TypeRuntimeServer ids) - { - } - - public void setServiceTypeRuntimeServer(TypeRuntimeServer ids) - { - serverIds = ids; - } - - public String getSampleServerTypeID() - { - return sampleServerTypeID; - } - - public IServer getSampleExistingServer() - { - return sampleExistingServer; - } - - public void setClientServer(String clientServer) - { - } - - public void setServerProject(String serviceProject) - { - this.serviceProject = serviceProject; - } - - public String getWSDLProject() - { - if(serviceProject != null){ - int index = serviceProject.indexOf("/"); - if (index!=-1) { - serviceP = serviceProject.substring(0,index); - return serviceP; - } - } - - return clientP; - } - - public void setWsdlURI(String wsdlServiceURL) - { - this.wsdlServiceURL = wsdlServiceURL; - } - - public void setGenerateProxy(boolean generateProxy) - { - } - - public boolean getIsTestWidget() - { - return isTestWidget; - } - - public void setClientEarProjectName(String clientEarProjectName) - { - this.clientEarProjectName = clientEarProjectName; - } - - public void setClientEarComponentName(String clientEarComponentName) - { - this.clientEarComponentName = clientEarComponentName; - } - - - - /** - * @param setEndpointMethod The setEndpointMethod to set. - */ - public void setSetEndpointMethod(String setEndpointMethod) - { - this.setEndpointMethod = setEndpointMethod; - } - /** - * @param endpoint The endpoint to set. - */ - public void setEndpoint(String endpoint) - { - if (endpoint != null && endpoint.length() > 0) - { - Vector v = new Vector(); - v.add(endpoint); - setEndpoints(v); - } - } - - public void setEndpoints(List endpoints) - { - this.endpoints = endpoints; - } - - public boolean getClientNeedEAR() { - return clientNeedEAR; - } - - public void setClientNeedEAR(boolean clientNeedEAR) { - this.clientNeedEAR = clientNeedEAR; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestFragment.java deleted file mode 100644 index 1c13e3b4d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestFragment.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/** - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.provisional.env.core.common.Condition; - - -public class ClientTestFragment extends BooleanFragment -{ - private boolean testService; - private boolean genProxy; - private boolean launchedTest = false; - - public ClientTestFragment( String id ) - { - SequenceFragment clientTestRoot = new SequenceFragment(); - Condition condition = new Condition() - { - public boolean evaluate() - { - return testService && genProxy; - } - }; - setCondition( condition ); - - clientTestRoot.add( new SimpleFragment( new WebServiceClientTestArrivalCommand(), "" ) ); - clientTestRoot.add( new SimpleFragment( id ) ); - setTrueFragment( clientTestRoot ); - - } - - public void setGenerateProxy( boolean genProxy ) - { - this.genProxy = genProxy; - } - - public void setTestService( Boolean testService ) - { - this.testService = testService.booleanValue(); - } - - public boolean getLaunchedTest() - { - return launchedTest; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestWidget.java deleted file mode 100644 index 87d54067f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestWidget.java +++ /dev/null @@ -1,416 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/** - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.common.FolderResourceFilter; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.jst.ws.internal.ui.dialog.DialogUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSelection; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionList; - - -public class ClientTestWidget extends SimpleWidgetDataContributor -{ - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - - /*CONTEXT_ID PWSM0001 for the Sample Page*/ - private String INFOPOP_PWSM_PAGE = "PWSM0001"; - // - private Button testCheckbox_; - /*CONTEXT_ID PWSM0002 for the Test check box of the Sample Page*/ - private String INFOPOP_PWSM_CHECKBOX_TEST = "PWSM0002"; - - private Combo testTypeCombo_; - /*CONTEXT_ID PWSM0003 for the Test Type Combo box of the Sample Page*/ - private String INFOPOP_PWSM_COMBOBOX_TEST = "PWSM0003"; - - private Text jspFolderText_; - /*CONTEXT_ID PWSM0008 for the JSP Folder field of the Sample Page*/ - private String INFOPOP_PWSM_TEXT_JSP_FOLDER = "PWSM0008"; - - private Button sampleFolderBrowseButton_; - /*CONTEXT_ID PWSM0009 for the JSP Folder Browse button of the Sample Page*/ - private String INFOPOP_PWSM_BUTTON_JSP_FOLDER_BROWSE = "PWSM0009"; - - private Combo projectCombo_; - /*CONTEXT_ID PWSM0010 for the Project combo box of the Sample Page*/ - private String INFOPOP_PWSM_COMBO_PROJECT = "PWSM0010"; - - private Tree methodsTree_; - - private Button selectAllMethodsButton_; - /*CONTEXT_ID PWSM0006 for the Select All button of the Sample Page*/ - private String INFOPOP_PWSM_BUTTON_SELECT_ALL = "PWSM0006"; - - private Button deselectAllMethodsButton_; - /*CONTEXT_ID PWSM0007 for the Deselect All button of the Sample Page*/ - private String INFOPOP_PWSM_BUTTON_DESELECT_ALL = "PWSM0007"; - - private Text sampleFolderText_; - /*CONTEXT_ID PWSM0014 for the Folder field of the Sample Page*/ - private String INFOPOP_PWSM_TEXT_SAMPLE_FOLDER = "PWSM0014"; - // - private Button runTestCheckbox_; - /*CONTEXT_ID PWSM0015 for the run test check box of the Sample Page*/ - private String INFOPOP_PWSM_CHECKBOX_LAUNCH = "PWSM0015"; - // - private Combo earCombo_; - /*CONTEXT_ID PWSM0016 for the EAR combo box of the Sample Page*/ - private String INFOPOP_PWSM_EAR_COMBO = "PWSM0016"; - - private Composite comboGroup_; - private SelectionList testFacilities_; - private FolderResourceFilter folderFilter_ = new FolderResourceFilter(); - private IStructuredSelection initialSelection_; - private boolean isTestWidget = false; - - public WidgetDataEvents addControls( Composite parent, Listener statusListener ) - { - isTestWidget = true; - MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - UIUtils uiUtils = new UIUtils(msgUtils, pluginId_ ); - - parent.setToolTipText( msgUtils.getMessage( "TOOLTIP_PWSM_PAGE" ) ); - PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, pluginId_ + "." + INFOPOP_PWSM_PAGE ); - - testCheckbox_ = uiUtils.createCheckbox( parent, "BUTTON_TEST", - "TOOLTIP_PWSM_CHECKBOX_TEST", - INFOPOP_PWSM_CHECKBOX_TEST ); - testCheckbox_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleTestButton(); - } - }); - - comboGroup_ = uiUtils.createComposite( parent, 3, 5, 0 ); - - testTypeCombo_ = uiUtils.createCombo( comboGroup_, "LABEL_TEST_TYPES", - "TOOLTIP_PWSM_COMBOBOX_TEST", - INFOPOP_PWSM_COMBOBOX_TEST, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - new Label( comboGroup_, SWT.NONE ); - - projectCombo_ = uiUtils.createCombo( comboGroup_, "LABEL_JSP_PROJECT_NAME", - "TOOLTIP_PWSM_COMBO_PROJECT", - INFOPOP_PWSM_COMBO_PROJECT, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - projectCombo_.setEnabled( false ); - new Label( comboGroup_, SWT.NONE ); - - - earCombo_ = uiUtils.createCombo( comboGroup_, "LABEL_EAR_PROJECTS", - "TOOLTIP_PWSM_EAR_PROJECT", - INFOPOP_PWSM_EAR_COMBO, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - earCombo_.setEnabled( false ); - new Label( comboGroup_, SWT.NONE ); - - - - sampleFolderText_ = uiUtils.createText( comboGroup_, "LABEL_FOLDER_NAME", - "TOOLTIP_PWSM_TEXT_SAMPLE_FOLDER", - INFOPOP_PWSM_TEXT_SAMPLE_FOLDER, - SWT.SINGLE | SWT.BORDER ); - - sampleFolderText_.addModifyListener( new ModifyListener() - { - public void modifyText( ModifyEvent evt ) - { - handleFolderText(); - } - }); - - - sampleFolderBrowseButton_ = uiUtils.createPushButton( comboGroup_, "BUTTON_BROWSE", - "TOOLTIP_PWSM_BUTTON_JSP_FOLDER_BROWSE", - INFOPOP_PWSM_BUTTON_JSP_FOLDER_BROWSE ); - sampleFolderBrowseButton_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleSampleBrowse(); - } - }); - - jspFolderText_ = uiUtils.createText( comboGroup_, "LABEL_JSP_FOLDER_NAME", - "TOOLTIP_PWSM_TEXT_JSP_FOLDER", - INFOPOP_PWSM_TEXT_JSP_FOLDER, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - jspFolderText_.setEnabled( false ); - - Group methodsGroup = uiUtils.createGroup( parent, "LABEL_METHODS", - "TOOLTIP_PWSM_TREE_METHODS", null ); - - methodsGroup.setLayoutData( uiUtils.createFillAll() ); - - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - methodsGroup.setLayout( layout ); - - // TODO No infopop for this tree. - methodsTree_ = uiUtils.createTree( methodsGroup, "TOOLTIP_PWSM_TREE_METHODS", - null, - SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.CHECK ); - - Composite selectButtons = uiUtils.createComposite( methodsGroup, 2 ); - - selectAllMethodsButton_ - = uiUtils.createPushButton( selectButtons, "BUTTON_SELECT_ALL", - "TOOLTIP_PWSM_BUTTON_SELECT_ALL", - INFOPOP_PWSM_BUTTON_SELECT_ALL ); - selectAllMethodsButton_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleSelectAll( true ); - } - }); - - deselectAllMethodsButton_ - = uiUtils.createPushButton( selectButtons, "BUTTON_DESELECT_ALL", - "TOOLTIP_PWSM_BUTTON_DESELECT_ALL", - INFOPOP_PWSM_BUTTON_DESELECT_ALL ); - deselectAllMethodsButton_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - handleSelectAll( false ); - } - }); - - runTestCheckbox_ = uiUtils.createCheckbox( parent, "BUTTON_RUN_TEST", - "TOOLTIP_PWSM_CHECKBOX_LAUNCH", - INFOPOP_PWSM_CHECKBOX_LAUNCH ); - - return this; - } - - private void handleFolderText() - { - String folder = sampleFolderText_.getText(); - String jspFolder = jspFolderText_.getText(); - int index = jspFolder.lastIndexOf(Path.SEPARATOR); - if(index == -1) return; - jspFolder = jspFolder.substring(0,index + 1); - jspFolder = jspFolder + folder; - jspFolderText_.setText(jspFolder); - } - - private void handleSampleBrowse() - { - IPath selectedPath = null; - IResource initialResource = null; - IPath projectPath = new Path( projectCombo_.getText() ).makeAbsolute(); - IResource project = ResourceUtils.findResource( projectPath ); -// IContainer webModuleContainer = ResourceUtils.getWebModuleServerRoot( (IProject)project); - IContainer webModuleContainer = J2EEUtils.getFirstWebContentContainer((IProject)project); - try - { - initialResource = ResourceUtils.getResourceFromSelection( initialSelection_ ); - } - catch( CoreException exc ) - { - } - - if( initialResource == null )initialResource = project; - - IResource resource = DialogUtils.browseResources( comboGroup_.getShell(), - project, - initialResource, - folderFilter_ ); - - if( resource != null ) - { - selectedPath = resource.getFullPath(); - - int webModuleSegments = selectedPath.matchingFirstSegments(webModuleContainer.getFullPath()); - - if ( webModuleSegments < 2 ) - { - sampleFolderText_.setText(""); - handleFolderText(); - } - else - { - sampleFolderText_.setText(selectedPath.removeFirstSegments(webModuleSegments).toString()); - handleFolderText(); - } - } - } - - private void handleTestButton() - { - boolean enabled = testCheckbox_.getSelection(); - - testTypeCombo_.setEnabled( enabled ); - sampleFolderText_.setEnabled( enabled ); - methodsTree_.setEnabled( enabled ); - runTestCheckbox_.setEnabled( enabled ); - selectAllMethodsButton_.setEnabled( enabled ); - deselectAllMethodsButton_.setEnabled( enabled ); - sampleFolderBrowseButton_.setEnabled( enabled ); - } - - private void handleSelectAll( boolean value ) - { - TreeItem[] items = methodsTree_.getItems(); - - for( int i = 0; i < items.length; i++ ) - { - items[i].setChecked(value); - } - } - - // Here are the getters and setters for this widget. - public void setTestService( Boolean testService ) - { - testCheckbox_.setSelection( testService.booleanValue() ); - handleTestButton(); - } - - public Boolean getTestService() - { - return new Boolean( testCheckbox_.getSelection() ); - } - - public void setTestFacility( SelectionList testFacilities ) - { - testFacilities_ = testFacilities; - testTypeCombo_.setItems( testFacilities.getList() ); - testTypeCombo_.select( testFacilities.getIndex() ); - } - - public SelectionList getTestFacility() - { - testFacilities_.setIndex( testTypeCombo_.getSelectionIndex() ); - return testFacilities_; - } - - public String getTestID() - { - return testTypeCombo_.getText(); - } - - public void setSampleProject(String clientProject) - { - projectCombo_.setItems( new String[]{ clientProject } ); - projectCombo_.select(0); - } - - public void setSampleProjectEAR(String clientProjectEAR) - { - earCombo_.setItems( new String[]{ clientProjectEAR } ); - earCombo_.select(0); - } - - public String getFolder() - { - return sampleFolderText_.getText(); - } - - public void setFolder( String folder ) - { - sampleFolderText_.setText( folder ); - } - - public boolean getIsTestWidget() - { - return isTestWidget; - } - - public void setJspFolder( String folder ) - { - jspFolderText_.setText( folder ); - } - - public String getJspFolder() - { - return jspFolderText_.getText(); - } - - public void setLaunchedServiceTestName (String launchedServiceTestName) - { - } - - public boolean getRunClientTest() - { - return runTestCheckbox_.getSelection(); - } - - public void setRunClientTest( boolean value ) - { - runTestCheckbox_.setSelection( value ); - } - - public BooleanSelection[] getMethods() - { - TreeItem[] items = methodsTree_.getItems(); - BooleanSelection[] methods = new BooleanSelection[items.length]; - - for( int index = 0; index < items.length; index++ ) - { - methods[index] = new BooleanSelection( items[index].getText(), items[index].getChecked() ); - } - - return methods; - } - - public void setMethods( BooleanSelection[] methods ) - { - methodsTree_.removeAll(); - - for( int index = 0; index < methods.length; index++ ) - { - if(methods[index] == null)continue; - TreeItem item = new TreeItem( methodsTree_, SWT.NULL ); - item.setText( methods[index].getValue() ); - item.setChecked( methods[index].isSelected() ); - } - } - - public void setInitialSelection( IStructuredSelection selection ) - { - initialSelection_ = selection; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java deleted file mode 100644 index 887507d23..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.ProgressUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext; -import org.eclipse.wst.command.internal.provisional.env.core.context.TransientResourceContext; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.common.environment.StatusHandler; - - -public class CopyWebServiceUtilsJarCommand extends AbstractDataModelOperation -{ - private String sampleProject; - private String sampleC; - private MessageUtils msgUtils; - -/** - * Default CTOR; - */ - - -public CopyWebServiceUtilsJarCommand() -{ - String pluginId = "org.eclipse.jst.ws.consumption"; - msgUtils = new MessageUtils(pluginId + ".plugin", this); -} - -/** - * Execute the command - */ -public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) -{ - Environment env = getEnvironment(); - - try - { - ProgressUtils.report( monitor, msgUtils.getMessage( "PROGRESS_INFO_COPY_WEBSERVICE_UTILS" ) ); - IProject sampleIProject = ProjectUtilities.getProject(sampleProject); - IPath webModulePath = J2EEUtils.getWebContentPath(sampleIProject, sampleC); - if (webModulePath == null) - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_PROJECT_NOT_FOUND") ); - - IStatus status = copyIFile("webserviceutils.jar",webModulePath,"WEB-INF/lib/webserviceutils.jar", WebServiceConsumptionPlugin.getInstance(),env, monitor); - if(status.getSeverity() == Status.ERROR){ - StatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_FILECOPY_WEBSERVICE_UTILS") ); - sHandler.reportError(errorStatus); - return status; - } - - - } - catch (Exception e) { - StatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_FILECOPY_WEBSERVICE_UTILS") ); - sHandler.reportError(errorStatus); - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_FILECOPY_WEBSERVICE_UTILS"), e); - } - return Status.OK_STATUS; -} - -/** - * - */ -private IStatus copyIFile(String source, IPath targetPath, String targetFile, Plugin plugin,Environment env, IProgressMonitor monitor ) -{ - - if (plugin != null) - { - IPath target = targetPath.append(new Path(targetFile)); - - ProgressUtils.report( monitor, msgUtils.getMessage( "PROGRESS_INFO_COPYING_FILE" ) ); - try - { - ResourceContext context = new TransientResourceContext(); - context.setOverwriteFilesEnabled(true); - context.setCreateFoldersEnabled(true); - context.setCheckoutFilesEnabled(true); - IResource resource = FileResourceUtils.findResource(target); - if(resource != null) return Status.OK_STATUS; - FileResourceUtils.createFile(context, - target, - plugin.openStream(new Path(source)), - monitor, - env.getStatusHandler()); - } - catch (Exception e) { - return StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_FILECOPY_WEBSERVICE_UTILS") ,e); - } - } - return Status.OK_STATUS; -} - -public void setSampleProject(String sampleProject) -{ - this.sampleProject = sampleProject; -} - -public void setSampleComponent(String sampleComponent){ - this.sampleC = sampleComponent; -} - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java deleted file mode 100644 index a5de43f1c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CreateSampleProjectCommand.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.server.core.IServer; - -public class CreateSampleProjectCommand extends AbstractDataModelOperation -{ - private String sampleProject; - private String sampleProjectEar; - private IServer existingServer; - private String serverFactoryId; - private boolean needEAR; - private String j2eeVersion; - - - public CreateSampleProjectCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - if (!root.getProject(sampleProject).exists() || !root.getProject(sampleProjectEar).exists()) - { - //Do the following - //1. Create the Web project/component to house the sample JSPs. - //2. If needEAR is true then - // - create a EAR project and component if it doesn't exist - // - add the Web component to the EAR component - //3. Add the right component to the server. - CreateModuleCommand command = new CreateModuleCommand(); - command.setProjectName(sampleProject); - command.setModuleName(sampleProject); - command.setModuleType(CreateModuleCommand.WEB); - command.setServerFactoryId(serverFactoryId); - command.setServerInstanceId(existingServer.getId()); - command.setJ2eeLevel(j2eeVersion); - command.setEnvironment( env ); - IStatus status = command.execute( monitor, null ) ; - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - - if (needEAR) - { - CreateModuleCommand commandEAR = new CreateModuleCommand(); - commandEAR.setProjectName(sampleProjectEar); - //TODO The EAR component name is not necessarily the same as the project name - //so the component name needs to somehow be piped into this command - commandEAR.setModuleName(sampleProjectEar); - commandEAR.setModuleType(CreateModuleCommand.EAR); - commandEAR.setServerFactoryId(serverFactoryId); - commandEAR.setServerInstanceId(existingServer.getId()); - commandEAR.setJ2eeLevel(j2eeVersion); - commandEAR.setEnvironment( env ); - status = commandEAR.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - - - //Associate the service module and service EAR - AssociateModuleWithEARCommand associateCommand = new AssociateModuleWithEARCommand(); - associateCommand.setProject(sampleProject); - associateCommand.setModule(sampleProject); - associateCommand.setEARProject(sampleProjectEar); - //TODO The EAR component name is not necessarily the same as the project name - //so the component name needs to somehow be piped into this command - associateCommand.setEar(sampleProjectEar); - associateCommand.setEnvironment( env ); - status = associateCommand.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - - //Add the EAR to the server - AddModuleToServerCommand commandInstall = new AddModuleToServerCommand(); - commandInstall.setServerInstanceId(existingServer.getId()); - commandInstall.setProject(sampleProjectEar); - //TODO The EAR component name is not necessarily the same as the project name - //so the component name needs to somehow be piped into this command - commandInstall.setModule(sampleProjectEar); - commandInstall.setEnvironment( env ); - status = commandInstall.execute( monitor, null ) ; - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - else - { - //Add the Web component to the server - AddModuleToServerCommand commandInstall = new AddModuleToServerCommand(); - commandInstall.setServerInstanceId(existingServer.getId()); - commandInstall.setProject(sampleProject); - commandInstall.setModule(sampleProject); - commandInstall.setEnvironment( env ); - - status = commandInstall.execute( monitor, null ) ; - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - - } - return Status.OK_STATUS; - } - - public void setSampleProject(String sampleProject) - { - this.sampleProject = sampleProject; - } - - public void setSampleProjectEAR(String sampleProjectEar) - { - this.sampleProjectEar = sampleProjectEar; - } - - public void setExistingServer(IServer existingServer) { - - this.existingServer = existingServer; - } - - public void setServerFactoryId(String serverFactoryId) - { - this.serverFactoryId = serverFactoryId; - } - - /** - * @param needEAR The needEAR to set. - */ - public void setNeedEAR(boolean needEAR) - { - this.needEAR = needEAR; - } - - /** - * @param version The j2eeVersion to set. - */ - public void setJ2eeVersion(String version) - { - j2eeVersion = version; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java deleted file mode 100644 index d18ad63a4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishDefaultCommand.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - - -/* -* The JSPGeneration task runs the jsp generation engine found in the -* JBWizard Plugin -* -* -*/ -public class FinishDefaultCommand extends AbstractDataModelOperation -{ - private String sampleServerTypeID; - private IServer sampleExistingServer; - private String sampleServerInstanceId; - - - public FinishDefaultCommand () - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - if(sampleServerInstanceId != null){ - sampleExistingServer = ServerCore.findServer(sampleServerInstanceId); - if (sampleExistingServer != null) - sampleServerTypeID = sampleExistingServer.getServerType().getId(); - - } - return status; - - } - - public void setServerInstanceId(String serverInstanceId) - { - this.sampleServerInstanceId = serverInstanceId; - } - - public String getSampleServerTypeID() - { - return sampleServerTypeID; - - } - - public IServer getSampleExistingServer() - { - return sampleExistingServer; - } - - public void setExistingServerId(String existingServerId) - { - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishJavaTestFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishJavaTestFragment.java deleted file mode 100644 index b6e822d23..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishJavaTestFragment.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.jst.ws.internal.consumption.command.common.BuildProjectCommand; -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.provisional.env.core.common.Condition; - - -/** - * @author gilberta - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class FinishJavaTestFragment extends BooleanFragment -{ - private boolean generateProxy; - - public FinishJavaTestFragment() - { - SequenceFragment javaTestRoot = new SequenceFragment(); - Condition condition = new Condition() - { - public boolean evaluate() - { - return generateProxy; - } - }; - setCondition(condition); - javaTestRoot.add(new SimpleFragment(new TestClientDepartureInitCommand(), "")); - javaTestRoot.add(new SimpleFragment(new BuildProjectCommand(), "")); - setTrueFragment(javaTestRoot); - } - - public void setGenerateProxy(boolean generateProxy) - { - this.generateProxy = generateProxy; - } - - public void setIsJSPGen(boolean jspGen) - { - - } - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishTestFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishTestFragment.java deleted file mode 100644 index c5d4b774f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishTestFragment.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.jst.ws.internal.context.ScenarioContext; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; -import org.eclipse.wst.command.internal.provisional.env.core.common.Condition; - - -/** - * @author gilberta - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class FinishTestFragment extends BooleanFragment{ - - private boolean isTestWidget; - private boolean generateProxy; - private String launchedServiceTestName; - private boolean testService; - private String testID; - public FinishTestFragment() - { - Condition condition = new Condition() - { - public boolean evaluate() - { - if(!testService) return false; - if(launchedServiceTestName == null) return true; - if(launchedServiceTestName != null) - if((!launchedServiceTestName.equals("") && (!isPreferedAWSDLTest() || (isTestWidget && isClientTestJava())) && generateProxy) || launchedServiceTestName.equals("")) return true; - - return false; - } - }; - - setTrueFragment(new WebServiceTestClientDepartureFragment()); - setCondition(condition); - } - - public void setLaunchedServiceTestName(String launchedServiceTestName) - { - this.launchedServiceTestName = launchedServiceTestName; - } - - public boolean isPreferedAWSDLTest() - { - ScenarioContext scenarioContext = WebServicePlugin.getInstance().getScenarioContext().copy(); - String[] testTypes = scenarioContext.getWebServiceTestTypes(); - WebServiceTestRegistry wsttRegistry = WebServiceTestRegistry.getInstance(); - WebServiceTestExtension wscte = (WebServiceTestExtension)wsttRegistry.getWebServiceExtensionsByName(testTypes[0]); - if(wscte.testWSDL()) - return true; - return false; - } - - public boolean isClientTestJava() - { - if(testID == null) return false; - WebServiceTestRegistry wsttRegistry = WebServiceTestRegistry.getInstance(); - WebServiceTestExtension wscte = (WebServiceTestExtension)wsttRegistry.getWebServiceExtensionsByName(testID); - if(!wscte.testWSDL()) - return true; - return false; - } - - - public void setTestService(boolean testService) - { - this.testService = testService; - } - - public void setGenerateProxy(boolean generateProxy) - { - this.generateProxy = generateProxy; - } - - public void setTestID(String testID) - { - this.testID = testID; - } - - public void setIsTestWidget(boolean isTestWidget) - { - this.isTestWidget = isTestWidget; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java deleted file mode 100644 index 66c233d64..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on Mar 25, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; - -/** - * @author gilberta - * - * To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -public class TestClientDepartureInitCommand extends AbstractDataModelOperation -{ - - private boolean forceBuild; - - public TestClientDepartureInitCommand() - { - forceBuild = true; - } - - public boolean getForceBuild() - { - return forceBuild; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java deleted file mode 100644 index 4c78feb6a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.context.ScenarioContext; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionList; - - -/** - * @author gilberta - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class TestDefaultingFragment extends AbstractDataModelOperation -{ - - private SelectionList testFacilities; - private String launchedServiceTestName; - private ScenarioContext scenarioContext; - - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - scenarioContext = WebServicePlugin.getInstance().getScenarioContext().copy(); - // test facilities - selectTestFacility(); - return status; - } - - // The test facilities retrieved from the extension - // plus the default - public SelectionList getTestFacility() - { - return testFacilities; - } - - - - // *********************** - // This method uses the preference to - // select the correct test facility - // - //*********************** - private void selectTestFacility() - { - //if we find something we launched earlier - //put it on the bottom - String[] testTypes = scenarioContext.getWebServiceTestTypes(); - String[] newTestTypes = new String[testTypes.length]; - boolean launched = false; - int j = 0; - for(int i = 0;i<testTypes.length;i++){ - if(testTypes[i].equals(launchedServiceTestName)) - launched = true; - else{ - newTestTypes[j] = testTypes[i]; - j++; - } - } - - if(launched) - newTestTypes[testTypes.length - 1] = launchedServiceTestName; - - testFacilities = new SelectionList(newTestTypes,0); - } - - public void setLaunchedServiceTestName(String launchedServiceTestName) - { - this.launchedServiceTestName = launchedServiceTestName; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestWebServiceClient.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestWebServiceClient.java deleted file mode 100644 index 5d8d401db..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestWebServiceClient.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.wst.command.internal.provisional.env.core.ICommandFactory; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.provisional.wsrt.AbstractWebServiceClient; -import org.eclipse.wst.ws.internal.provisional.wsrt.IContext; -import org.eclipse.wst.ws.internal.provisional.wsrt.ISelection; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceClientInfo; - -public class TestWebServiceClient extends AbstractWebServiceClient { - - public TestWebServiceClient(WebServiceClientInfo clientInfo){ - super(clientInfo); - } - - public ICommandFactory assemble(Environment env, IContext ctx, ISelection sel, - String project, String module, String earProject, String ear){ - return null; - } - - public ICommandFactory deploy(Environment env, IContext ctx, ISelection sel, - String project, String module, String earProject, String ear){ - return null; - } - - - public ICommandFactory develop(Environment env, IContext ctx, ISelection sel, - String project, String module, String earProject, String ear){ - return null; - } - - public ICommandFactory install(Environment env, IContext ctx, ISelection sel, - String project, String module, String earProject, String ear){ - return null; - } - - - public ICommandFactory run(Environment env, IContext ctx, ISelection sel, - String project, String module, String earProject, String ear){ - return null; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLFinishFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLFinishFragment.java deleted file mode 100644 index 07f436804..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLFinishFragment.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.wst.command.internal.env.core.fragment.BooleanFragment; - -/** - * @author gilberta - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class WSDLFinishFragment extends BooleanFragment{ - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java deleted file mode 100644 index e3d7cc22f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on May 4, 2004 - * - * Window - Preferences - Java - Code Style - Code Templates - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import java.util.List; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.common.environment.StatusHandler; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; - -/** - * @author gilberta - * - * Window - Preferences - Java - Code Style - Code Templates - */ -public class WSDLTestLaunchCommand extends AbstractDataModelOperation -{ - private String testID; - private String launchedServiceTestName; - private TypeRuntimeServer serviceids; - private String serverProject; - private String serverModule; - private String wsdlURI; - private MessageUtils msgUtils; - private List endpoints; - private IServer serviceExistingServer = null; - private String serviceServerTypeID = null; - private String serviceServerInstanceId = null; - - public WSDLTestLaunchCommand() - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils = new MessageUtils(pluginId + ".plugin", this); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - WebServiceTestRegistry testRegistry = WebServiceTestRegistry.getInstance(); - WebServiceTestExtension wscte = (WebServiceTestExtension)testRegistry.getWebServiceExtensionsByName(testID); - IWebServiceTester iwst = (IWebServiceTester)wscte.getWebServiceExecutableExtension(); - TestInfo testInfo = getTestInfo(); - - - status = commandFactoryExecution(iwst.launch(testInfo),env, monitor); - - //Dont need to shut everything down because the wsdl test doesnt work - if(status.getSeverity() != Status.OK){ - StatusHandler sHandler = env.getStatusHandler(); - IStatus infoStatus = StatusUtils.infoStatus( msgUtils.getMessage("MSG_ERROR_UNABLE_TO_LAUNCH_WSDL_TEST") ); - sHandler.reportInfo(infoStatus); - return infoStatus; - } - return status; - - } - - private IStatus commandFactoryExecution(ICommandFactory commandFactory,Environment env, IProgressMonitor monitor) - { - IStatus status = Status.OK_STATUS; - while(commandFactory.hasNext()) - { - AbstractDataModelOperation operation = commandFactory.getNextCommand(); - - if (operation != null) - { - try - { - operation.setEnvironment( env ); - status = operation.execute( monitor, null ); - } - catch( Exception exc ) - { - status = StatusUtils.errorStatus( exc ); - } - } - - if(status.getSeverity() == Status.ERROR){ - StatusHandler sHandler = env.getStatusHandler(); - sHandler.reportError(status); - return status; - } - } - return status; - } - - - private TestInfo getTestInfo() - { - // get the server stuff - if (serviceids.getServerInstanceId() != null) - serviceExistingServer = ServerCore.findServer(serviceids.getServerInstanceId()); - else if (serviceServerInstanceId!=null) - serviceExistingServer = ServerCore.findServer(serviceServerInstanceId); - - if (serviceExistingServer != null) - serviceServerTypeID = serviceExistingServer.getServerType().getId(); - else - serviceServerTypeID = serviceids.getServerId(); - // server will be created in ServerDeployableConfigurationCommand - - TestInfo testInfo = new TestInfo(); - if (serviceExistingServer!=null) - testInfo.setServiceExistingServer(serviceExistingServer); - testInfo.setServiceServerTypeID(serviceServerTypeID); - testInfo.setServiceProject(serverProject); - testInfo.setWsdlServiceURL(wsdlURI); - testInfo.setEndpoint(endpoints); - return testInfo; - - } - - - public void setTestID(String testID) - { - this.testID = testID; - } - - public String getLaunchedServiceTestName() - { - return launchedServiceTestName; - } - public void setWsdlURI(String wsdlURI) - { - this.wsdlURI = wsdlURI; - } - - public void setServerProject(String serverProject) - { - this.serverProject = serverProject; - } - - - public void setServiceTypeRuntimeServer(TypeRuntimeServer serviceids) - { - this.serviceids = serviceids; - } - - public void setExternalBrowser(boolean externalBrowser) - { - } - - public void setEndpoint(List endpoints) - { - this.endpoints = endpoints; - } - -public String getServerModule() { - return serverModule; -} - -public void setServerModule(String serverModule) { - this.serverModule = serverModule; -} - -public void setServiceServerInstanceId(String ssInstanceId){ - this.serviceServerInstanceId = ssInstanceId; -} - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java deleted file mode 100644 index 42a6e539f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java +++ /dev/null @@ -1,235 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import java.util.List; -import java.util.ListIterator; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.Method; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.command.common.JavaMofReflectionCommand; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSelection; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.common.environment.StatusHandler; - - -/** -* This task sets up all the defaults for the webservice test -* client page -* -*/ -public class WebServiceClientTestArrivalCommand extends AbstractDataModelOperation -{ - public static final String DEFAULT_WEB_MODULE_ROOT = "WebContent"; - public static final String DEFAULT_SAMPLE_WEB_PROJECT_EXT = "Sample"; - - private MessageUtils msgUtils; - public static String SAMPLE_DIR = "sample"; - - private String clientProject; - private String clientProjectEAR; - private String clientP; - private String clientC; - private IProject clientIProject; - private String folder; - private String jspFolder; - private BooleanSelection[] methods; - private String proxyBean; - private String sampleProject; - private String sampleP; - private String sampleC; - private String sampleProjectEAR; - - - - /** - * Constructs a new WebServiceClientTestArrivalTask object with the given label and description. - */ - public WebServiceClientTestArrivalCommand () - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils = new MessageUtils(pluginId + ".plugin", this); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - sampleProjectAndEarSetup(env); - - //Get the sample Folder ready - StringBuffer sb = new StringBuffer(); - - sb.append("/").append(sampleC).append("/").append(DEFAULT_WEB_MODULE_ROOT).append("/"); - folder = SAMPLE_DIR + getBean(); - - sb.append(folder); - jspFolder = sb.toString(); - - //get the method names ready - //find the full path of the file in the project - /* - * Getting the method names using javamof introspection - */ - if(proxyBean == null){ - StatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_JTS_PROXY_NOT_COMPILED") ); - sHandler.reportError(errorStatus); - return errorStatus; - - } - - - JavaMofReflectionCommand javamofcommand = new JavaMofReflectionCommand(); - javamofcommand.setProxyBean(proxyBean); - javamofcommand.setClientProject(clientP); - javamofcommand.setEnvironment( env ); - - - - try{ - IStatus mofStatus = javamofcommand.execute( monitor, null); - if(mofStatus.getSeverity() == Status.ERROR) - return mofStatus; - }catch(Exception exc){ - StatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_JTS_PROXY_NOT_COMPILED") ); - sHandler.reportError(errorStatus); - return errorStatus; - } - JavaHelpers javaHelpers = javamofcommand.getJavaClass(); - if (javaHelpers == null) return status; - - JavaClass javaClass = null; - if(javaHelpers instanceof JavaClass) - javaClass = (JavaClass)javaHelpers; - else return status; - List methodList = javaClass.getPublicMethods(); - BooleanSelection[] tempMethods = new BooleanSelection[methodList.size()]; - ListIterator listIterator = methodList.listIterator(); - - int j = 0; - while (listIterator.hasNext()) - { - Method method = (Method)listIterator.next(); - if(method.isConstructor()) continue; - - tempMethods[j] = new BooleanSelection( method.getMethodElementSignature(), true); - j++; - } - methods = tempMethods; - return status; - } - public static final String DEFAULT_SAMPLE_EAR_PROJECT_EXT = "EAR"; - - private void sampleProjectAndEarSetup(Environment env) - { - if(clientProject == null) return; - else{ - int index = clientProject.indexOf("/"); - clientP = clientProject.substring(0,index); - clientC = clientProject.substring(index + 1); - } - - clientIProject = (IProject)ProjectUtilities.getProject(clientP); - - if(J2EEUtils.isWebComponent(clientIProject, clientC)){ - sampleProject = clientProject; - sampleP = clientP; - sampleC = clientC; - } - else{ - sampleP = clientP + DEFAULT_SAMPLE_WEB_PROJECT_EXT; - sampleC = clientC + DEFAULT_SAMPLE_WEB_PROJECT_EXT; - sampleProject = sampleP + "/" + sampleC; - - - } - sampleProjectEAR = clientProjectEAR; - if (sampleProjectEAR == null || sampleProjectEAR.length()==0){ - sampleProjectEAR = sampleP + DEFAULT_SAMPLE_EAR_PROJECT_EXT + "/" + sampleC + DEFAULT_SAMPLE_EAR_PROJECT_EXT; - } - - } - - //getters and setters - - private String getBean() - { - int index = proxyBean.lastIndexOf("."); - String end = ""; - if(index != -1){ - end = proxyBean.substring(index + 1); - } - String bean = end.substring(0,end.length()); - - return bean; - } - - - - - public String getFolder() - { - return folder; - } - - public String getJspFolder() - { - return jspFolder; - } - - public BooleanSelection[] getMethods() - { - return methods; - } - - public String getSampleProject() - { - return sampleProject; - } - - public void setClientProject(String clientProject) - { - this.clientProject = clientProject; - } - - - public void setClientProjectEAR(String clientProjectEAR) - { - this.clientProjectEAR = clientProjectEAR; - } - - - public void setProxyBean(String proxyBean) - { - this.proxyBean = proxyBean; - } - - public String getSampleProjectEAR() - { - return sampleProjectEAR; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceTestClientDepartureFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceTestClientDepartureFragment.java deleted file mode 100644 index 9e0efec2f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceTestClientDepartureFragment.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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 - *******************************************************************************/ -/* - * Created on Mar 25, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import org.eclipse.jst.ws.internal.consumption.command.common.BuildProjectCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample.AddModuleDependenciesCommand; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; - - -/** - * @author gilberta - * - * To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -public class WebServiceTestClientDepartureFragment extends SequenceFragment -{ - public WebServiceTestClientDepartureFragment() - { - add(new SimpleFragment(new FinishDefaultCommand(),"")); - add(new SimpleFragment(new ClientTestDelegateCommand(),"")); - } - - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - dataRegistry.addMapping(TestClientDepartureInitCommand.class, "ForceBuild",BuildProjectCommand.class); - dataRegistry.addMapping(FinishDefaultCommand.class, "SampleServerTypeID",AddModuleDependenciesCommand.class); - dataRegistry.addMapping(FinishDefaultCommand.class, "SampleExistingServer",AddModuleDependenciesCommand.class); - dataRegistry.addMapping(FinishDefaultCommand.class, "SampleServerTypeID",ClientTestDelegateCommand.class); - dataRegistry.addMapping(FinishDefaultCommand.class, "SampleExistingServer",ClientTestDelegateCommand.class); - - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java deleted file mode 100644 index df2ae28cf..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/ExplorerServiceTestCommand.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.explorer; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.command.common.StartProjectCommand; -import org.eclipse.jst.ws.internal.ext.test.WSDLTestFinishCommand; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.ws.internal.explorer.LaunchOption; -import org.eclipse.wst.ws.internal.explorer.LaunchOptions; -import org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand; -import org.eclipse.wst.ws.internal.explorer.plugin.ExplorerPlugin; - -public class ExplorerServiceTestCommand extends AbstractDataModelOperation implements WSDLTestFinishCommand -{ - - private boolean externalBrowser = true; - private String wsdlServiceURL; - private String serviceServerTypeID; - private IServer serviceExistingServer; - private String serviceProject; - private List endpoints; - - /** - * Constructs a new WebServiceExplorerLaunch object with the given label and description. - */ - public ExplorerServiceTestCommand () - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - StartProjectCommand spc = new StartProjectCommand( true ); - spc.setServiceServerTypeID(serviceServerTypeID); - spc.setServiceExistingServer(serviceExistingServer); - IProject project = (IProject) ResourceUtils.findResource(serviceProject); - spc.setServiceProject(project); - spc.setIsWebProjectStartupRequested(true); - spc.setEnvironment( env ); - - status = spc.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR) - return status; - - WSExplorerLauncherCommand launchCommand = new WSExplorerLauncherCommand(); - launchCommand.setForceLaunchOutsideIDE(externalBrowser); - Vector launchOptionVector = new Vector(); - String stateLocation = ExplorerPlugin.getInstance().getPluginStateLocation(); - String defaultFavoritesLocation = ExplorerPlugin.getInstance().getDefaultFavoritesLocation(); - launchOptionVector.add(new LaunchOption(LaunchOptions.STATE_LOCATION,stateLocation)); - launchOptionVector.add(new LaunchOption(LaunchOptions.DEFAULT_FAVORITES_LOCATION,defaultFavoritesLocation)); - launchOptionVector.add(new LaunchOption(LaunchOptions.WSDL_URL,wsdlServiceURL)); - if (endpoints != null) - for (Iterator it = endpoints.iterator(); it.hasNext();) - launchOptionVector.add(new LaunchOption(LaunchOptions.WEB_SERVICE_ENDPOINT, it.next().toString())); - launchCommand.setLaunchOptions((LaunchOption[])launchOptionVector.toArray(new LaunchOption[0])); - launchCommand.setEnvironment( env ); - status = launchCommand.execute( monitor, null ); - return status; - } - - public void setExternalBrowser(boolean externalBrowser) - { - this.externalBrowser = externalBrowser; - } - - public void setWsdlServiceURL(String wsdlServiceURL) - { - this.wsdlServiceURL = wsdlServiceURL; - } - - public void setServerTypeID(String serviceServerTypeID) - { - this.serviceServerTypeID = serviceServerTypeID; - } - - public void setExistingServer(IServer serviceExistingServer) - { - this.serviceExistingServer = serviceExistingServer; - } - - public void setServiceProject(String serviceProject) - { - this.serviceProject = serviceProject; - } - - public void setEndpoint(List endpoints) - { - this.endpoints = endpoints; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java deleted file mode 100644 index b7f60ca96..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEGenerateCommand.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.explorer; - -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.consumption.command.common.StartProjectCommand; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.explorer.LaunchOption; -import org.eclipse.wst.ws.internal.explorer.LaunchOptions; -import org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand; -import org.eclipse.wst.ws.internal.explorer.plugin.ExplorerPlugin; -import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; - -public class WSEGenerateCommand extends AbstractDataModelOperation -{ - - private TestInfo testInfo; - - public WSEGenerateCommand(TestInfo testInfo){ - this.testInfo = testInfo; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - StartProjectCommand spc = new StartProjectCommand( true ); - spc.setServiceServerTypeID(testInfo.getServiceServerTypeID()); - spc.setServiceExistingServer(testInfo.getServiceExistingServer()); - IProject project = (IProject) ProjectUtilities.getProject(testInfo.getServiceProject()); - spc.setServiceProject(project); - spc.setIsWebProjectStartupRequested(true); - spc.setEnvironment( env ); - - status = spc.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR) - return status; - - WSExplorerLauncherCommand launchCommand = new WSExplorerLauncherCommand(); - launchCommand.setForceLaunchOutsideIDE(false); - Vector launchOptionVector = new Vector(); - String stateLocation = ExplorerPlugin.getInstance().getPluginStateLocation(); - String defaultFavoritesLocation = ExplorerPlugin.getInstance().getDefaultFavoritesLocation(); - launchOptionVector.add(new LaunchOption(LaunchOptions.STATE_LOCATION,stateLocation)); - launchOptionVector.add(new LaunchOption(LaunchOptions.DEFAULT_FAVORITES_LOCATION,defaultFavoritesLocation)); - launchOptionVector.add(new LaunchOption(LaunchOptions.WSDL_URL,testInfo.getWsdlServiceURL())); - if (testInfo.getEndpoint() != null) - for (Iterator it = testInfo.getEndpoint().iterator(); it.hasNext();) - launchOptionVector.add(new LaunchOption(LaunchOptions.WEB_SERVICE_ENDPOINT, it.next().toString())); - launchCommand.setLaunchOptions((LaunchOption[])launchOptionVector.toArray(new LaunchOption[0])); - launchCommand.setEnvironment( env ); - status = launchCommand.execute( monitor, null ); - return status; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEWebServiceTester.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEWebServiceTester.java deleted file mode 100644 index 6ab3b93ab..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WSEWebServiceTester.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.explorer; - -import java.util.Vector; - -import org.eclipse.wst.command.internal.provisional.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommandFactory; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; - -public class WSEWebServiceTester implements IWebServiceTester { - - public ICommandFactory generate(TestInfo testInfo){ - Vector commands = new Vector(); - return new SimpleCommandFactory(commands); - } - - public ICommandFactory launch(TestInfo testInfo){ - Vector commands = new Vector(); - commands.add(new WSEGenerateCommand(testInfo)); - return new SimpleCommandFactory(commands); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java deleted file mode 100644 index 5d40bee5f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/explorer/WebServiceExplorerExecutable.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.explorer; - -import org.eclipse.jst.ws.internal.ext.WebServiceExecutable; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; - -/** -* This is the interface for objects that represent a kind of -* Web Service-Server-Runtime artifact. The primary purpose of a WebServiceServerRuntimeType -* object is to manufacture the wizard pages that support the type, server, and runtime configuration. -*/ -public class WebServiceExplorerExecutable implements WebServiceExecutable -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - - public AbstractDataModelOperation getFinishCommand() - { - return new ExplorerServiceTestCommand(); - } - -} - - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java deleted file mode 100644 index 38724a7a7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/AddModuleDependenciesCommand.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import java.io.IOException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.command.common.AddModuleToServerCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.StartServerCommand; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; - -public class AddModuleDependenciesCommand extends AbstractDataModelOperation -{ - - private TestInfo testInfo; - - private IProject sampleIProject; - private IProject clientIProject; - private IProject sampleEARIProject; - private String sampleEARProject; - private String sampleEARModule; - - public AddModuleDependenciesCommand(TestInfo testInfo) - { - this.testInfo = testInfo; - } - - /** - * Execute WebServerDefaultingTask Set the default server name and id given a - * deployable. - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - try - { - createSampleProjects(env, monitor ); - clientIProject = ProjectUtilities.getProject(testInfo.getClientProject()); - - if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject, testInfo.getClientModule())) - { - String uri = clientIProject.getName() + ".jar"; - if (J2EEUtils.isJavaComponent(clientIProject,testInfo.getClientModule())) - addJavaProjectAsUtilityJar(clientIProject, sampleEARIProject, uri); - addJAROrModuleDependency(sampleIProject, testInfo.getGenerationModule(), uri); - addBuildPath(sampleIProject, clientIProject); - } - } - catch (IOException ioe) - { - } - catch (CoreException ce) - { - } - return Status.OK_STATUS; - } - - private void addJavaProjectAsUtilityJar(IProject javaProject, IProject earProject, String uri) - { - // TODO Remove refs to old command -// AddUtilityJARMapCommand cmd = new AddUtilityJARMapCommand(earProject, uri, javaProject); -// cmd.execute(); - } - - private void addJAROrModuleDependency(IProject project, String compName, String uri) throws IOException, CoreException - { - ArchiveManifest manifest = J2EEProjectUtilities.readManifest(project); - manifest.mergeClassPath(new String[]{uri}); - J2EEProjectUtilities.writeManifest(project, manifest); - - } - - public static final String DEFAULT_SAMPLE_EAR_PROJECT_EXT = "EAR"; - - private void createSampleProjects(Environment env, IProgressMonitor monitor ) - { - - - - sampleIProject = ProjectUtilities.getProject(testInfo.getGenerationProject()); - clientIProject = ProjectUtilities.getProject(testInfo.getClientProject()); - - if (testInfo.getClientNeedEAR()) { - if(testInfo.getClientEARProject() == null || testInfo.getClientEARProject().length() == 0){ - sampleEARProject = testInfo.getGenerationProject() + DEFAULT_SAMPLE_EAR_PROJECT_EXT; - sampleEARModule = testInfo.getGenerationModule() + DEFAULT_SAMPLE_EAR_PROJECT_EXT; - } - else{ - sampleEARProject = testInfo.getClientEARProject(); - sampleEARModule = testInfo.getClientEARModule(); - } - - sampleEARIProject = ProjectUtilities.getProject(sampleEARProject); - if(sampleEARIProject == null || !sampleEARIProject.isOpen()){ - - CreateModuleCommand createEAR = new CreateModuleCommand(); - createEAR.setProjectName(sampleEARProject); - createEAR.setModuleName(sampleEARModule); - createEAR.setServerInstanceId(testInfo.getClientExistingServer().getId()); - createEAR.setServerFactoryId(testInfo.getClientServerTypeID()); - createEAR.setModuleType(CreateModuleCommand.EAR); - createEAR.setJ2eeLevel(J2EEUtils.getJ2EEVersionAsString(clientIProject,testInfo.getClientModule())); - createEAR.setEnvironment( env ); - IStatus status = createEAR.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - - AddModuleToServerCommand modToServer = new AddModuleToServerCommand(); - modToServer.setModule(sampleEARModule); - modToServer.setProject(sampleEARProject); - modToServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - modToServer.setEnvironment( env ); - status = modToServer.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - - } - } - - if (!sampleIProject.isOpen()) - { - CreateModuleCommand createSample = new CreateModuleCommand(); - createSample.setProjectName(testInfo.getGenerationProject()); - createSample.setModuleName(testInfo.getGenerationModule()); - createSample.setModuleType(CreateModuleCommand.WEB); - createSample.setServerInstanceId(testInfo.getClientExistingServer().getId()); - createSample.setServerFactoryId(testInfo.getClientServerTypeID()); - createSample.setJ2eeLevel(J2EEUtils.getJ2EEVersionAsString(clientIProject,testInfo.getClientModule())); - createSample.setEnvironment( env ); - IStatus status = createSample.execute( monitor, null ); - - if (testInfo.getClientNeedEAR()) { -// Associate the client module and service EAR - AssociateModuleWithEARCommand associateCommand = new AssociateModuleWithEARCommand(); - associateCommand.setProject(testInfo.getGenerationProject()); - associateCommand.setModule(testInfo.getGenerationModule()); - associateCommand.setEARProject(sampleEARProject); - associateCommand.setEar(sampleEARModule); - associateCommand.setEnvironment( env ); - status = associateCommand.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - - StartServerCommand startServer = new StartServerCommand(false, true); - startServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - startServer.setEnvironment( env ); - status = startServer.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - - } - - } - - private void addBuildPath(IProject referencingProject, IProject referencedProject) throws JavaModelException - { - IJavaProject javaProject = JavaCore.create(referencingProject); - if (javaProject != null) - { - IClasspathEntry[] oldCp = javaProject.getRawClasspath(); - IClasspathEntry[] newCp = new IClasspathEntry[oldCp.length + 1]; - for (int i = 0; i < oldCp.length; i++) - newCp[i] = oldCp[i]; - newCp[newCp.length - 1] = JavaCore.newProjectEntry(referencedProject.getFullPath()); - javaProject.setRawClasspath(newCp, new NullProgressMonitor()); - } - } - - - - - - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java deleted file mode 100644 index 2ef743893..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCGenerateCommand.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.InputFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.MethodFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.ResultFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.TestClientFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.command.GeneratePageCommand; -import org.eclipse.jst.ws.internal.consumption.sampleapp.command.JavaToModelCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.CopyWebServiceUtilsJarCommand; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.common.EnvironmentUtils; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; - -public class GSTCGenerateCommand extends AbstractDataModelOperation -{ - - public static String INPUT = "Input.jsp"; - public static String TEST_CLIENT = "TestClient.jsp"; - public static String RESULT = "Result.jsp"; - public static String METHOD = "Method.jsp"; - - private TestInfo testInfo; - private Model proxyModel; - private String jspfolder; - - public GSTCGenerateCommand(TestInfo testInfo){ - this.testInfo = testInfo; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - CopyWebServiceUtilsJarCommand copy = new CopyWebServiceUtilsJarCommand(); - copy.setSampleProject(testInfo.getGenerationProject()); - copy.setSampleComponent(testInfo.getGenerationModule()); - copy.setEnvironment( env ); - status = copy.execute( monitor, null); - if (status.getSeverity() == Status.ERROR) return status; - setJSPFolder(); - status = createModel(env, monitor); - if (status.getSeverity() == Status.ERROR) return status; - status = generatePages(env); - if (status.getSeverity() == Status.ERROR) return status; - return status; - } - - private void setJSPFolder(){ - //if the client is not a webcomponent then the - //sample must have been created, we must now factor in - //flexible projects - - IProject clientIProject = ProjectUtilities.getProject(testInfo.getClientProject()); - if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject, testInfo.getClientModule())){ - IProject project = ProjectUtilities.getProject(testInfo.getGenerationProject()); - IPath path = J2EEUtils.getWebContentPath(project,testInfo.getGenerationModule()); - int index = testInfo.getJspFolder().lastIndexOf("/"); - String jsp = testInfo.getJspFolder().substring(index + 1); - StringBuffer sb = new StringBuffer(); - sb.append("/").append(path.toString()).append("/").append(jsp); - jspfolder = sb.toString(); - } - else - jspfolder = testInfo.getJspFolder(); - - - } - - //create the model from the resource - private IStatus createModel(Environment env, IProgressMonitor monitor ) { - JavaToModelCommand jtmc = new JavaToModelCommand(); - jtmc.setMethods(testInfo.getMethods()); - jtmc.setClientProject(testInfo.getClientProject()); - jtmc.setProxyBean(testInfo.getProxyBean()); - jtmc.setEnvironment( env ); - IStatus status = jtmc.execute( monitor, null); - if (status.getSeverity() == Status.ERROR) return status; - proxyModel = jtmc.getJavaDataModel(); - return status; - } - - /** - * Generate the four jsps that make up this - * sample app. - */ - private IStatus generatePages(Environment env) - { - IStatus status = Status.OK_STATUS; - IPath fDestinationFolderPath = new Path(jspfolder); - fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); - IWorkspaceRoot fWorkspace = ResourcesPlugin.getWorkspace().getRoot(); - - IPath pathTest = fDestinationFolderPath.append(TEST_CLIENT); - IFile fileTest = fWorkspace.getFile(pathTest); - GeneratePageCommand gpcTest = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - new TestClientFileGenerator(INPUT,METHOD,RESULT),fileTest); - //gpcTest.setStatusMonitor(getStatusMonitor()); - gpcTest.setEnvironment( env ); - status = gpcTest.execute( null, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - - //input codegen - IPath pathInput = fDestinationFolderPath.append(INPUT); - IFile fileInput = fWorkspace.getFile(pathInput); - InputFileGenerator inputGenerator = new InputFileGenerator(RESULT); - GeneratePageCommand gpcInput = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - inputGenerator,fileInput); - //gpcInput.setStatusMonitor(getStatusMonitor()); - gpcInput.setEnvironment( env ); - status = gpcInput.execute( null, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - //method codegen - IPath pathMethod = fDestinationFolderPath.append(METHOD); - IFile fileMethod = fWorkspace.getFile(pathMethod); - MethodFileGenerator methodGenerator = new MethodFileGenerator(INPUT); - methodGenerator.setClientFolderPath(jspfolder); - GeneratePageCommand gpcMethod = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - methodGenerator,fileMethod); - //gpcMethod.setStatusMonitor(getStatusMonitor()); - gpcMethod.setEnvironment( env ); - status = gpcMethod.execute( null, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - - //result codegen - IPath pathResult = fDestinationFolderPath.append(RESULT); - IFile fileResult = fWorkspace.getFile(pathResult); - ResultFileGenerator rfg = new ResultFileGenerator(); - rfg.setClientFolderPath(jspfolder); - rfg.setSetEndpointMethod(testInfo.getSetEndpointMethod()); - GeneratePageCommand gpcResult = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - rfg,fileResult); - gpcResult.setEnvironment( env ); - status = gpcResult.execute( null, null ); - - return status; - } - - - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java deleted file mode 100644 index fe212516a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCLaunchCommand.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.command.common.PublishProjectCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.StartServerCommand; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.browser.IWebBrowser; -import org.eclipse.ui.browser.IWorkbenchBrowserSupport; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.common.environment.Log; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; - -public class GSTCLaunchCommand extends AbstractDataModelOperation -{ - - public static String INPUT = "Input.jsp"; - public static String TEST_CLIENT = "TestClient.jsp"; - public static String RESULT = "Result.jsp"; - public static String METHOD = "Method.jsp"; - - private TestInfo testInfo; - private MessageUtils msgUtils; - private String jspfolder; - - public GSTCLaunchCommand(TestInfo testInfo){ - this.testInfo = testInfo; - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils = new MessageUtils(pluginId + ".plugin", this); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - setJSPFolder(); - - return launchSample(env, monitor); - } - private void setJSPFolder(){ - //if the client is not a webcomponent then the - //sample must have been created, we must now factor in - //flexible projects - - IProject clientIProject = ProjectUtilities.getProject(testInfo.getClientProject()); - if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject, testInfo.getClientModule())){ - IProject project = ProjectUtilities.getProject(testInfo.getGenerationProject()); - IPath path = J2EEUtils.getWebContentPath(project,testInfo.getGenerationModule()); - int index = testInfo.getJspFolder().lastIndexOf("/"); - String jsp = testInfo.getJspFolder().substring(index + 1); - StringBuffer sb = new StringBuffer(); - sb.append("/").append(path.toString()).append("/").append(jsp); - jspfolder = sb.toString(); - } - else - jspfolder = testInfo.getJspFolder(); - - - } - - private IStatus launchSample (Environment env, IProgressMonitor monitor ) { - IStatus status = Status.OK_STATUS; - IPath fDestinationFolderPath = new Path(jspfolder); - fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); - PublishProjectCommand ppc = new PublishProjectCommand(); - ppc.setServerTypeID(testInfo.getClientServerTypeID()); - ppc.setExistingServer(testInfo.getClientExistingServer()); - ppc.setProject(testInfo.getGenerationProject()); - ppc.setEnvironment( env ); - status = ppc.execute( monitor, null ); - - StartServerCommand serverCommand = new StartServerCommand( true, true ); - serverCommand.setServerInstanceId( testInfo.getClientExistingServer().getId() ); - serverCommand.setEnvironment( env ); - - status = serverCommand.execute(monitor, null); - if (status.getSeverity() == Status.ERROR) return status; - - IProject sampleProject = ProjectUtilities.getProject(testInfo.getGenerationProject()); - IPath newPath = new Path(ServerUtils.getWebComponentURL(sampleProject,testInfo.getGenerationModule(),testInfo.getClientServerTypeID(),testInfo.getClientExistingServer())); - int count = J2EEUtils.getWebContentPath(sampleProject,testInfo.getGenerationModule()).segmentCount(); - - newPath = newPath.append(fDestinationFolderPath.removeFirstSegments(count).makeAbsolute()); - StringBuffer urlString = new StringBuffer(newPath.append(TEST_CLIENT).toString()); - if (testInfo.getEndpoint() != null && !testInfo.getEndpoint().isEmpty()) - { - urlString.append("?endpoint="); - urlString.append(testInfo.getEndpoint().get(0).toString()); - } - - try{ - URL url; - url = new URL(urlString.toString()); - - for( int retries = 0; retries < 10; retries++ ) - { - try - { - // Test the URLs - (new URL(newPath.append(RESULT).toString())).openStream(); - (new URL(newPath.append(METHOD).toString())).openStream(); - (new URL(newPath.append(INPUT).toString())).openStream(); - (new URL(newPath.append(TEST_CLIENT).toString())).openStream(); - // Looks good, exit loop - break; - } - catch( IOException ioe ) - { - try - { - Thread.sleep(1000); - } - catch (InterruptedException ie) {} - } - } - - IWorkbenchBrowserSupport browserSupport = WebServiceConsumptionUIPlugin.getInstance().getWorkbench().getBrowserSupport(); - IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR, null, null, null); - browser.openURL(url); - return status; - }catch(PartInitException exc){ - //TODO: change error message - env.getLog().log(Log.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( msgUtils.getMessage("MSG_ERROR_MALFORMED_URL") ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_MALFORMED_URL"), e ); - } - return status; - }catch(MalformedURLException exc){ - env.getLog().log(Log.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( msgUtils.getMessage("MSG_ERROR_MALFORMED_URL"), exc ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_MALFORMED_URL"), e ); - } - return status; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCWebServiceTester.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCWebServiceTester.java deleted file mode 100644 index 4926adc59..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/GSTCWebServiceTester.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import java.util.Vector; - -import org.eclipse.wst.command.internal.provisional.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommandFactory; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.provisional.wsrt.TestInfo; - -public class GSTCWebServiceTester implements IWebServiceTester { - - public ICommandFactory generate(TestInfo testInfo){ - Vector commands = new Vector(); - commands.add(new AddModuleDependenciesCommand(testInfo)); - commands.add(new GSTCGenerateCommand(testInfo)); - return new SimpleCommandFactory(commands); - } - - public ICommandFactory launch(TestInfo testInfo){ - Vector commands = new Vector(); - commands.add(new GSTCLaunchCommand(testInfo)); - return new SimpleCommandFactory(commands); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java deleted file mode 100644 index 74a41f2f5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WSSampleFinishCommand.java +++ /dev/null @@ -1,330 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.command.common.PublishProjectCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.StartProjectCommand; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.InputFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.MethodFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.ResultFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.codegen.TestClientFileGenerator; -import org.eclipse.jst.ws.internal.consumption.sampleapp.command.GeneratePageCommand; -import org.eclipse.jst.ws.internal.consumption.sampleapp.command.JavaToModelCommand; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.test.CopyWebServiceUtilsJarCommand; -import org.eclipse.jst.ws.internal.ext.test.JavaProxyTestCommand; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.browser.IWebBrowser; -import org.eclipse.ui.browser.IWorkbenchBrowserSupport; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.BooleanSelection; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.common.environment.Log; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.ws.internal.common.EnvironmentUtils; -import org.eclipse.wst.ws.internal.datamodel.Model; - -public class WSSampleFinishCommand extends AbstractDataModelOperation implements JavaProxyTestCommand -{ - - public static String INPUT = "Input.jsp"; - public static String TEST_CLIENT = "TestClient.jsp"; - public static String RESULT = "Result.jsp"; - public static String METHOD = "Method.jsp"; - - private MessageUtils msgUtils; - - private Model proxyModel; - private String sampleServerTypeID; - private IServer sampleExistingServer; - - - private String clientProject; - private String jspFolder; - private boolean runClientTest; - private String sampleProject; - private BooleanSelection[] methods; - private String proxyBean; - private String setEndpointMethod; - private List endpoints; - - /** - * Constructs a new JavaBeanToSampleActiveTask object with the given label and description. - */ - public WSSampleFinishCommand () - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - msgUtils = new MessageUtils(pluginId + ".plugin", this); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - //setters and getters to be removed - CopyWebServiceUtilsJarCommand copy = new CopyWebServiceUtilsJarCommand(); - copy.setSampleProject(sampleProject); - copy.setEnvironment( env ); - status = copy.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR) return status; - status = createModel(env, monitor ); - if (status.getSeverity() == Status.ERROR) return status; - status = generatePages(env, monitor ); - if (status.getSeverity() == Status.ERROR) return status; - //if (!isSuccessful()) return; - status = launchSample(env, monitor); - return status; - } - - - /** - * Generate the four jsps that make up this - * sample app. - */ - protected IStatus generatePages(Environment env, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - IPath fDestinationFolderPath = new Path(jspFolder); - fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); - IWorkspaceRoot fWorkspace = ResourcesPlugin.getWorkspace().getRoot(); - - IPath pathTest = fDestinationFolderPath.append(TEST_CLIENT); - IFile fileTest = fWorkspace.getFile(pathTest); - GeneratePageCommand gpcTest = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - new TestClientFileGenerator(INPUT,METHOD,RESULT),fileTest); - //gpcTest.setStatusMonitor(getStatusMonitor()); - gpcTest.setEnvironment( env ); - status = gpcTest.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - - //input codegen - IPath pathInput = fDestinationFolderPath.append(INPUT); - IFile fileInput = fWorkspace.getFile(pathInput); - InputFileGenerator inputGenerator = new InputFileGenerator(RESULT); - GeneratePageCommand gpcInput = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - inputGenerator,fileInput); - //gpcInput.setStatusMonitor(getStatusMonitor()); - gpcInput.setEnvironment( env ); - status = gpcInput.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - //method codegen - IPath pathMethod = fDestinationFolderPath.append(METHOD); - IFile fileMethod = fWorkspace.getFile(pathMethod); - MethodFileGenerator methodGenerator = new MethodFileGenerator(INPUT); - methodGenerator.setClientFolderPath(jspFolder); - GeneratePageCommand gpcMethod = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - methodGenerator,fileMethod); - //gpcMethod.setStatusMonitor(getStatusMonitor()); - gpcMethod.setEnvironment( env ); - status = gpcMethod.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR ) - return status; - - - //result codegen - IPath pathResult = fDestinationFolderPath.append(RESULT); - IFile fileResult = fWorkspace.getFile(pathResult); - ResultFileGenerator rfg = new ResultFileGenerator(); - rfg.setClientFolderPath(jspFolder); - rfg.setSetEndpointMethod(setEndpointMethod); - GeneratePageCommand gpcResult = new GeneratePageCommand(EnvironmentUtils.getResourceContext(env), proxyModel, - rfg,fileResult); - //gpcResult.setStatusMonitor(getStatusMonitor()); - gpcResult.setEnvironment( env ); - status = gpcResult.execute( monitor, null ); - - return status; - } - - - protected IStatus launchSample (Environment env, IProgressMonitor monitor ) { - - IStatus status = Status.OK_STATUS; - if (!runClientTest) return status; - - - IPath fDestinationFolderPath = new Path(jspFolder); - fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); - - PublishProjectCommand ppc = new PublishProjectCommand(); - ppc.setServerTypeID(sampleServerTypeID); - ppc.setExistingServer(sampleExistingServer); - ppc.setProject(sampleProject); - ppc.setEnvironment( env ); - status = ppc.execute( monitor, null ); - - StartProjectCommand spc = new StartProjectCommand(false ); - spc.setServiceServerTypeID(sampleServerTypeID); - spc.setSampleExistingServer(sampleExistingServer); - IProject project = (IProject) ResourceUtils.findResource(sampleProject); - spc.setSampleProject(project); - spc.setIsWebProjectStartupRequested(true); - spc.setEnvironment( env ); - - status = spc.execute( monitor, null ); - if (status.getSeverity() == Status.ERROR) return status; - - IPath newPath = new Path(ResourceUtils.getWebProjectURL(ResourceUtils.getProjectOf(fDestinationFolderPath),sampleServerTypeID,sampleExistingServer)); - newPath = newPath.append(fDestinationFolderPath.removeFirstSegments(2).makeAbsolute()); - StringBuffer urlString = new StringBuffer(newPath.append(TEST_CLIENT).toString()); - if (endpoints != null && !endpoints.isEmpty()) - { - urlString.append("?endpoint="); - urlString.append(endpoints.get(0).toString()); - } - - try{ - URL url; - url = new URL(urlString.toString()); - - for( int retries = 0; retries < 10; retries++ ) - { - try - { - // Test the URLs - (new URL(newPath.append(RESULT).toString())).openStream(); - (new URL(newPath.append(METHOD).toString())).openStream(); - (new URL(newPath.append(INPUT).toString())).openStream(); - (new URL(newPath.append(TEST_CLIENT).toString())).openStream(); - // Looks good, exit loop - break; - } - catch( IOException ioe ) - { - try - { - Thread.sleep(1000); - } - catch (InterruptedException ie) {} - } - } - - IWorkbenchBrowserSupport browserSupport = WebServiceConsumptionUIPlugin.getInstance().getWorkbench().getBrowserSupport(); - IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null); - browser.openURL(url); - return status; - }catch(PartInitException exc){ - //TODO: change error message - env.getLog().log(Log.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( msgUtils.getMessage("MSG_ERROR_MALFORMED_URL"), exc ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_MALFORMED_URL"), e ); - } - return status; - }catch(MalformedURLException exc){ - env.getLog().log(Log.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( msgUtils.getMessage("MSG_ERROR_MALFORMED_URL"), exc ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( msgUtils.getMessage("MSG_ERROR_MALFORMED_URL"), e ); - } - return status; - } - } - - - - protected IStatus createModel(Environment env, IProgressMonitor monitor ) { - - //create the model from the resource - JavaToModelCommand jtmc = new JavaToModelCommand(); - jtmc.setMethods(methods); - jtmc.setClientProject(clientProject); - jtmc.setProxyBean(proxyBean); - jtmc.setEnvironment( env ); - //jtmc.setStatusMonitor(getStatusMonitor()); - IStatus status = jtmc.execute( monitor, null); - if (status.getSeverity() == Status.ERROR) return status; - - proxyModel = jtmc.getJavaDataModel(); - return status; - } - - public void setServerTypeID(String sampleServerTypeID) - { - this.sampleServerTypeID = sampleServerTypeID; - } - - public void setExistingServer(IServer sampleExistingServer) - { - this.sampleExistingServer = sampleExistingServer; - } - - public void setJspFolder(String jspFolder) - { - this.jspFolder = jspFolder; - } - - public void setRunClientTest(boolean runClientTest) - { - this.runClientTest = runClientTest; - } - - public void setSampleProject(String sampleProject) - { - this.sampleProject = sampleProject; - } - - public void setClientProject(String clientProject) - { - this.clientProject = clientProject; - } - - public void setMethods(BooleanSelection[] methods) - { - this.methods = methods; - } - - public void setProxyBean(String proxyBean) - { - this.proxyBean = proxyBean; - } - - /** - * @param setEndpointMethod The setEndpointMethod to set. - */ - public void setSetEndpointMethod(String setEndpointMethod) - { - this.setEndpointMethod = setEndpointMethod; - } - - public void setEndpoint(List endpoints) - { - this.endpoints = endpoints; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java deleted file mode 100644 index 93ac97034..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/wssample/WebServiceWSSampleExecutable.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import org.eclipse.jst.ws.internal.ext.WebServiceExecutable; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; - -/** -* This is the interface for objects that represent a kind of -* Web Service-Server-Runtime artifact. The primary purpose of a WebServiceServerRuntimeType -* object is to manufacture the wizard pages that support the type, server, and runtime configuration. -*/ -public class WebServiceWSSampleExecutable implements WebServiceExecutable -{ - - - public AbstractDataModelOperation getFinishCommand() - { - return new WSSampleFinishCommand(); - } - -} - - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/PrivateUDDIRegistryTypeRegistry.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/PrivateUDDIRegistryTypeRegistry.java deleted file mode 100644 index e19b750e6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/PrivateUDDIRegistryTypeRegistry.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.ws.internal.ui.uddi.PrivateUDDIRegistryType; - - -public class PrivateUDDIRegistryTypeRegistry -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - private static PrivateUDDIRegistryTypeRegistry instance_; - - private PrivateUDDIRegistryTypeRegistry() { - } - - /** - * Returns a singleton instance of this class. - * @return A singleton WebServiceClientTypeRegistry object. - */ - public static PrivateUDDIRegistryTypeRegistry getInstance() { - if (instance_ == null) { - instance_ = new PrivateUDDIRegistryTypeRegistry(); - } - - return instance_; - } - - public PrivateUDDIRegistryType getPrivateUDDIRegistryType() { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] config = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", - "privateUDDIRegistryType"); - - try { - Object configElement = ((config.length > 0) ? config[0].createExecutableExtension("class") : null); - if(configElement != null && configElement instanceof PrivateUDDIRegistryType) - return (PrivateUDDIRegistryType)configElement; - else - return null; - } - catch (CoreException e) { - return null; - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/PublicUDDIRegistryTypeRegistry.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/PublicUDDIRegistryTypeRegistry.java deleted file mode 100644 index 4d2873220..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/PublicUDDIRegistryTypeRegistry.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard; - -import java.util.Vector; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi.PublicUDDIRegistryType; - - -public class PublicUDDIRegistryTypeRegistry -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - private static PublicUDDIRegistryTypeRegistry instance_; - private Vector types_; - private Vector configElements_; - - private PublicUDDIRegistryTypeRegistry() { - types_ = new Vector(); - configElements_ = new Vector(); - - init(); - } - - /** - * Returns a singleton instance of this class. - * @return A singleton WebServiceClientTypeRegistry object. - */ - public static PublicUDDIRegistryTypeRegistry getInstance() { - if (instance_ == null) { - instance_ = new PublicUDDIRegistryTypeRegistry(); - } - - return instance_; - } - - public void init() { - IExtensionRegistry reg = Platform.getExtensionRegistry(); - IConfigurationElement[] config = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", - "publicUDDIRegistryType"); - - for (int i = 0; i < config.length; i++) { - try { - Object configElement = config[i].createExecutableExtension("class"); - - if( configElement instanceof PublicUDDIRegistryType) { - types_.add(configElement); - configElements_.add(config[i]); - } - } - catch (CoreException e) {} - } - } - - public PublicUDDIRegistryType[] getAllPublicUDDIRegistryTypes() { - PublicUDDIRegistryType[] types = new PublicUDDIRegistryType[types_.size()]; - for (int i = 0; i < types_.size(); i++) { - types[i] = (PublicUDDIRegistryType)types_.elementAt(i); - } - return types; - } - - public PublicUDDIRegistryType getPublicUDDIRegistryTypeByID(String id) { - for (int i = 0; i < configElements_.size(); i++) { - IConfigurationElement c = (IConfigurationElement)configElements_.elementAt(i); - if (c.getAttribute("id").equals(id)) - return (PublicUDDIRegistryType)types_.elementAt(i); - } - return null; - } - - public String getPublicUDDIRegistryTypeIDByName(String name) { - for (int i = 0; i < types_.size(); i++) { - PublicUDDIRegistryType type = (PublicUDDIRegistryType)types_.elementAt(i); - if (type.getName().equals(name)) - return ((IConfigurationElement)configElements_.elementAt(i)).getAttribute("id"); - } - return null; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/RuntimeServerSelectionDialog.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/RuntimeServerSelectionDialog.java deleted file mode 100644 index cef821386..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/RuntimeServerSelectionDialog.java +++ /dev/null @@ -1,861 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wizard; - -import java.util.Hashtable; -import java.util.Vector; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.j2ee.internal.servertarget.IServerTargetConstants; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeInfo; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.help.IWorkbenchHelpSystem; -import org.eclipse.wst.server.core.IModuleType; -import org.eclipse.wst.server.core.IRuntimeType; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.ui.ServerUICore; - -public class RuntimeServerSelectionDialog extends Dialog implements Listener { - - private Shell thisShell; - private Group viewSelectionGroup_; - private Text messageBanner_; - private Composite primaryGroup_; - private Group runtimesGroup_; - private Group serversGroup_; - private Tree runtimesList_; - private Tree serverList_; - private Button viewSelectionByRuntimeButton_; - private Button viewSelectionByServerButton_; - private Button viewSelectionByExploreButton_; - private Combo j2eeVersionCombo; - /* - * CONTEXT_ID PWRS0001 for the selection of runtime, server and project combination - */ - private String INFOPOP_PWRS_DIALOG = WebServiceConsumptionUIPlugin.ID + ".PWRS0001"; - /* CONTEXT_ID PWRS0002 for the runtime selection on in the dailog */ - private String INFOPOP_PWRS_LIST_RUNTIMES = WebServiceConsumptionUIPlugin.ID + ".PWRS0002"; - /* CONTEXT_ID PWRS0003 for the server selection in the dialog */ - private String INFOPOP_PWRS_LIST_SERVERS = WebServiceConsumptionUIPlugin.ID + ".PWRS0003"; - /* - * CONTEXT_ID PWRS0004 for the EJB Project combo box of the runtime selection dialog - */ - // private String INFOPOP_PWRS_EJB_PROJECT = WebServiceConsumptionUIPlugin.ID - // + ".PWRS0004"; - /* - * CONTEXT_ID PWRS0005 for the runtime view radio button of the runtime selection dialog - */ - private String INFOPOP_PWRS_RADIO_RUNTIME = WebServiceConsumptionUIPlugin.ID + ".PWRS0005"; - /* - * CONTEXT_ID PWRS0006 for the server view radio button of the runtime selection dialog - */ - private String INFOPOP_PWRS_RADIO_SERVER = WebServiceConsumptionUIPlugin.ID + ".PWRS0006"; - /* - * CONTEXT_ID PWRS0007 for the explore view radio button of the runtime selection dialog - */ - private String INFOPOP_PWRS_RADIO_EXPLORE = WebServiceConsumptionUIPlugin.ID + ".PWRS0007"; - /* - * CONTEXT_ID PWRS0008 for the Web Project combo box of the runtime selection dialog - */ - // private String INFOPOP_PWRS_COMBO_PROJECT = - // WebServiceConsumptionUIPlugin.ID + ".PWRS0008"; - /* - * CONTEXT_ID PWRS0009 for the J2EE version combo box of the runtime selection dialog - */ - private String INFOPOP_PWRS_J2EE_VERSION = WebServiceConsumptionUIPlugin.ID + ".PWRS0009"; - - // rskreg - //private WebServiceServerRuntimeTypeRegistry wssrtRegistry; - //private WebServiceClientTypeRegistry wsctRegistry; - // rskreg - private Hashtable serverLabels_; - private Hashtable existingServersTable_; - private String defaultServer_; - private String defaultRuntime_; - private String typeId_; - // rskreg - //private IWebServiceRuntime selectedRuntime_; - private WebServiceRuntimeInfo selectedRuntime_; - // rskreg - private IServer selectedServer_; - private String selectedServerLabel_; - private String selectedServerFactoryID_; - private boolean isExistingServer_; - private boolean validateOn_ = false; - private byte selectionMode_; - private final byte MODE_SERVICE = (byte) 0; - private final String SERVER_TYPES_ICON = "icons/servers/servers_obj.gif"; - private final String EXISTING_SERVERS_ICON = "icons/servers/existing_server_obj.gif"; - private String j2eeVersion; - private String serverInstanceID_; - - public RuntimeServerSelectionDialog(Shell shell, byte mode, TypeRuntimeServer ids, String j2eeVersion) { - super(shell); - selectionMode_ = mode; - typeId_ = ids.getTypeId(); - defaultRuntime_ = ids.getRuntimeId(); - defaultServer_ = ids.getServerId(); - serverInstanceID_ = ids.getServerInstanceId(); - setIsExistingServer(ids.getServerInstanceId() != null); - serverLabels_ = new Hashtable(); - existingServersTable_ = new Hashtable(); - // rskreg - //wsctRegistry = WebServiceClientTypeRegistry.getInstance(); - //wssrtRegistry = WebServiceServerRuntimeTypeRegistry.getInstance(); - // rskreg - this.j2eeVersion = j2eeVersion; - } - - public TypeRuntimeServer getTypeRuntimeServer() { - TypeRuntimeServer ids = new TypeRuntimeServer(); - - ids.setTypeId(typeId_); - if (selectedRuntime_ != null) - ids.setRuntimeId(selectedRuntime_.getId()); - - if( selectedServerFactoryID_ == null ) - { - ids.setServerId( defaultServer_ ); - ids.setServerInstanceId( serverInstanceID_ ); - } - else - { - ids.setServerId(selectedServerFactoryID_); - - if (isExistingServer_ && selectedServer_ != null) - { - ids.setServerInstanceId(selectedServer_.getId()); - } - } - - return ids; - } - - public String getJ2EEVersion() { - return j2eeVersion; - } - - private boolean getIsExistingServer() { - return isExistingServer_; - } - - private void setIsExistingServer(boolean isExisting) { - isExistingServer_ = isExisting; - } - - protected Control createContents(Composite parent) { - Composite comp = (Composite) super.createContents(parent); - parent.getShell().pack(); - return comp; - } - - protected Control createDialogArea(Composite parent) { - validateOn_ = false; - thisShell = parent.getShell(); - if (thisShell == null) { - thisShell = createShell(); - } - Composite composite = (Composite) super.createDialogArea(parent); - GridLayout gl; - GridData gd; - // Window title - if (selectionMode_ == MODE_SERVICE) - thisShell.setText(getMessage("%PAGE_TITLE_WS_RUNTIME_SELECTION")); - else - thisShell.setText(getMessage("%PAGE_TITLE_WS_CLIENT_RUNTIME_SELECTION")); - - IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem(); - - helpSystem.setHelp(thisShell, INFOPOP_PWRS_DIALOG); - // Dialog description banner - messageBanner_ = new Text(composite, SWT.READ_ONLY | SWT.WRAP); - messageBanner_.setText(getMessage("%PAGE_DESC_WS_RUNTIME_SELECTION") + "\n" + " "); // reserves a second line for message display - messageBanner_.setToolTipText(getMessage("%PAGE_DESC_WS_RUNTIME_SELECTION")); - gd = new GridData(GridData.FILL_HORIZONTAL); - messageBanner_.setLayoutData(gd); - // -----------------------------------------------------------------------// - new Label(composite, SWT.HORIZONTAL); - // -----------------------------------------------------------------------// - // Selection - thisShell.setToolTipText(getMessage("%TOOLTIP_PWRS_PAGE")); - viewSelectionGroup_ = new Group(composite, SWT.NONE); - gl = new GridLayout(); - gl.marginHeight = 0; - gl.marginWidth = 0; - viewSelectionGroup_.setLayout(gl); - gd = new GridData(GridData.FILL_HORIZONTAL); - viewSelectionGroup_.setLayoutData(gd); - if (selectionMode_ == MODE_SERVICE) - viewSelectionGroup_.setText(getMessage("%LABEL_SELECTION_VIEW_TITLE")); - else - viewSelectionGroup_.setText(getMessage("%LABEL_CLIENT_SELECTION_VIEW_TITLE")); - viewSelectionByServerButton_ = new Button(viewSelectionGroup_, SWT.RADIO); - viewSelectionByServerButton_.setText(getMessage("%LABEL_SELECTION_VIEW_SERVER")); - viewSelectionByServerButton_.addListener(SWT.Selection, this); - viewSelectionByServerButton_.setToolTipText(getMessage("%TOOLTIP_PWRS_RADIO_SERVER")); - viewSelectionByServerButton_.setSelection(true); - helpSystem.setHelp(viewSelectionByServerButton_, INFOPOP_PWRS_RADIO_SERVER); - viewSelectionByRuntimeButton_ = new Button(viewSelectionGroup_, SWT.RADIO); - viewSelectionByRuntimeButton_.setText(getMessage("%LABEL_SELECTION_VIEW_RUNTIME")); - viewSelectionByRuntimeButton_.addListener(SWT.Selection, this); - viewSelectionByRuntimeButton_.setToolTipText(getMessage("%TOOLTIP_PWRS_RADIO_RUNTIME")); - helpSystem.setHelp(viewSelectionByRuntimeButton_, INFOPOP_PWRS_RADIO_RUNTIME); - viewSelectionByExploreButton_ = new Button(viewSelectionGroup_, SWT.RADIO); - viewSelectionByExploreButton_.setText(getMessage("%LABEL_SELECTION_VIEW_EXPLORE")); - viewSelectionByExploreButton_.addListener(SWT.Selection, this); - viewSelectionByExploreButton_.setToolTipText(getMessage("%TOOLTIP_PWRS_RADIO_EXPLORE")); - helpSystem.setHelp(viewSelectionByExploreButton_, INFOPOP_PWRS_RADIO_EXPLORE); - primaryGroup_ = new Composite(composite, SWT.NONE); - gl = new GridLayout(); - gl.numColumns = 1; - gl.makeColumnsEqualWidth = true; - gd = new GridData(GridData.FILL_BOTH); - primaryGroup_.setLayout(gl); - primaryGroup_.setLayoutData(gd); - runtimesGroup_ = new Group(primaryGroup_, SWT.NONE); - gl = new GridLayout(); - runtimesGroup_.setLayout(gl); - gd = new GridData(GridData.FILL_BOTH); - runtimesGroup_.setLayoutData(gd); - runtimesGroup_.setText(getMessage("%LABEL_RUNTIMES_LIST")); - runtimesList_ = new Tree(runtimesGroup_, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - gd = new GridData(GridData.FILL_BOTH); - runtimesList_.setLayoutData(gd); - runtimesList_.addListener(SWT.Selection, this); - runtimesList_.setToolTipText(getMessage("%TOOLTIP_PWRS_LIST_RUNTIMES")); - helpSystem.setHelp(runtimesList_, INFOPOP_PWRS_LIST_RUNTIMES); - // Server labels control - serversGroup_ = new Group(primaryGroup_, SWT.NONE); - gl = new GridLayout(); - serversGroup_.setLayout(gl); - gd = new GridData(GridData.FILL_BOTH); - serversGroup_.setLayoutData(gd); - serversGroup_.setText(getMessage("%LABEL_SERVERS_LIST")); - serverList_ = new Tree(serversGroup_, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - serverList_.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); - serverList_.addListener(SWT.Selection, this); - serverList_.setToolTipText(getMessage("%TOOLTIP_PWRS_LIST_SERVERS")); - ServersList serverList = new ServersList(); - serverList.setServerTreeItems(serverList_); - helpSystem.setHelp(serverList_, INFOPOP_PWRS_LIST_SERVERS); - setRuntimesGroup(); - // J2EE version - Composite j2eeVersionComposite = new Composite(composite, SWT.NONE); - gl = new GridLayout(); - gl.marginHeight = 0; - gl.marginWidth = 0; - gl.numColumns = 2; - gd = new GridData(GridData.FILL_HORIZONTAL); - j2eeVersionComposite.setLayout(gl); - j2eeVersionComposite.setLayoutData(gd); - Label j2eeVersionLabel = new Label(j2eeVersionComposite, SWT.NONE); - j2eeVersionLabel.setText(getMessage("%LABEL_J2EE_VERSION")); - j2eeVersionCombo = new Combo(j2eeVersionComposite, SWT.DROP_DOWN | SWT.READ_ONLY); - gl = new GridLayout(); - gl.marginHeight = 0; - gl.marginWidth = 0; - gd = new GridData(GridData.FILL_HORIZONTAL); - j2eeVersionCombo.setLayout(gl); - j2eeVersionCombo.setLayoutData(gd); - j2eeVersionCombo.addListener(SWT.Selection, this); - j2eeVersionCombo.setToolTipText(getMessage("%TOOLTIP_PWRS_J2EE_VERSION")); - helpSystem.setHelp(j2eeVersionCombo, INFOPOP_PWRS_J2EE_VERSION); - // -----------------------------------------------------------------------// - new Label(composite, SWT.HORIZONTAL); - validateOn_ = true; - org.eclipse.jface.dialogs.Dialog.applyDialogFont(parent); - setJ2EEVersions(); - return composite; - } - - private void setJ2EEVersions() { - j2eeVersionCombo.setEnabled(true); - j2eeVersionCombo.removeAll(); - String[] versions = null; - // rskreg - //if (selectedRuntime_ != null) - //versions = selectedRuntime_.getJ2EEVersions(); - if (selectedRuntime_ != null) - versions = selectedRuntime_.getJ2eeLevels(); - // rskreg - if (versions != null) { - //j2eeVersionCombo.setItems(versions); - setJ2EEComboItems(versions); - j2eeVersionCombo.select(0); - if (j2eeVersion != null) { - int i = j2eeVersionCombo.indexOf(J2EEUtils.getLabelFromJ2EEVersion(j2eeVersion)); - if (i > 0) - j2eeVersionCombo.select(i); - } - } - else - j2eeVersionCombo.setEnabled(false); - } - - private void setJ2EEComboItems(String[] versions) - { - String[] j2eeLabels = new String[versions.length]; - for (int i = 0; i < versions.length; i++) - { - String label = J2EEUtils.getLabelFromJ2EEVersion(versions[i]); - if (label != null && label.length() >0) - j2eeLabels[i] = J2EEUtils.getLabelFromJ2EEVersion(versions[i]); - else - j2eeLabels[i] = getMessage("%LABEL_NA"); - } - j2eeVersionCombo.setItems(j2eeLabels); - } - - private void setJ2EEVersionBasedOnServer() - { - //Get the list of J2EE versions - String[] versions = null; - if (selectedRuntime_ == null || selectedServerFactoryID_== null) - return; - - // rskreg - //versions = selectedRuntime_.getJ2EEVersions(); - versions = selectedRuntime_.getJ2eeLevels(); - // rskreg - if (versions==null) - return; - - //Pick the first version that the selected server supports - for (int i=0; i<versions.length; i++) - { - if (isServerValid(selectedServerFactoryID_, versions[i])) - { - //Set the j2ee level to this version - String label = J2EEUtils.getLabelFromJ2EEVersion(versions[i]); - j2eeVersionCombo.setText(label); - setJ2EEVersionFromJ2EEVersionCombo(); - } - } - } - - - private boolean isServerValid(String serverFactoryId, String j2eeVersion) - { - String stJ2EEVersion = ServerUtils.getServerTargetJ2EEVersion(j2eeVersion); - if (stJ2EEVersion == null) - return false; - - IServerType serverType = ServerCore.findServerType(serverFactoryId); - if (serverType!=null) - { - IRuntimeType serverRuntime = serverType.getRuntimeType(); - IModuleType[] mTypes = serverRuntime.getModuleTypes(); - for (int i=0; i<mTypes.length; i++) - { - IModuleType mType = mTypes[i]; - String type = mType.getId(); - String moduleVersion = mType.getVersion(); - if (type.equals(IServerTargetConstants.WEB_TYPE) && moduleVersion.equals(stJ2EEVersion)) - { - //Found a match, return true! - return true; - } - } - } - //no match found or the server type was null. Return false. - return false; - } - - private void validateServerRuntimeSelection() { - // Check if the extension exists - if (selectionMode_ == MODE_SERVICE) { - if (selectedServerFactoryID_!=null && selectedRuntime_!=null) { - // rskreg - //WebServiceServerRuntimeType wssrt = wssrtRegistry.getWebServiceServerRuntimeType(selectedServerFactoryID_, selectedRuntime_.getId(), typeId_); - // rskreg - // rm WebServiceServerRuntimeType wssrt = - // wssrtRegistry.getWebServiceServerRuntimeType(selectedServerFactoryID_, - // selectedRuntime_.getId(), wse.getWebServiceType()); - // rm if (wssrt!=null && - // wssrtRegistry.isServerSupportedForChosenType(wse.getWebServiceType(),selectedServerFactoryID_)) - // { - - //rskreg - boolean wssrtSupported = WebServiceRuntimeExtensionUtils.isServerRuntimeTypeSupported(selectedServerFactoryID_,selectedRuntime_.getId(),typeId_); - //if (wssrt != null && wssrtRegistry.isServerSupportedForChosenType(typeId_, selectedServerFactoryID_)) { - //setOKStatusMessage(); - //} - - if (wssrtSupported && WebServiceRuntimeExtensionUtils.isServerSupportedForChosenType(typeId_, selectedServerFactoryID_)) { - setOKStatusMessage(); - } - // rskreg - else { - setERRORStatusMessage("%MSG_INVALID_SRT_SELECTIONS"); - } - } - } - else { - // rm String clientId = - // wsctRegistry.getClientTypeIdByName(clientScenarioId_); - String clientId = typeId_; - // rm String clientId = - // wsctRegistry.getClientTypeIdByName(wse.getProxySelected()); - // rskreg - - //WebServiceServer wss = wsctRegistry.getWebServiceServerByFactoryId(selectedServerFactoryID_); - - //if (wss == null || selectedRuntime_ == null || !wsctRegistry.webServiceClientRuntimeTypeExists(wss.getId(), selectedRuntime_.getId(), clientId)) { - //setERRORStatusMessage("%MSG_INVALID_SRT_SELECTIONS"); - //} - if (selectedServerFactoryID_==null || selectedRuntime_ == null || !WebServiceRuntimeExtensionUtils.webServiceClientRuntimeTypeExists(selectedServerFactoryID_, selectedRuntime_.getId(), clientId)) { - setERRORStatusMessage("%MSG_INVALID_SRT_SELECTIONS"); - } - // rskreg - else { - setOKStatusMessage(); - } - } - // Disable OK button if the runtime selection is invalid - TreeItem[] runtimeSel = runtimesList_.getSelection(); - if (runtimeSel == null || runtimeSel.length <= 0 || runtimeSel[0].getText().length() == 0) { - disableOKButton(); - } - // Disable OK button if server selection is invalid - TreeItem[] serverSel = serverList_.getSelection(); - String currentSelection = (serverSel != null && serverSel.length > 0) ? serverSel[0].getText() : ""; - if (serverSel == null || currentSelection.length() == 0) { - disableOKButton(); - } - if (!serverLabels_.containsKey(currentSelection) || !existingServersTable_.containsKey(currentSelection)) { - disableOKButton(); - setOKStatusMessage(); - } - // Disable OK button if category is selected rather than a server - if (serverSel.length > 0 && serverSel[0].getItemCount()!=0) { - disableOKButton(); - } - else { - enableOKButton(); - } - - } - - private void setOKStatusMessage() { - messageBanner_.setText(getMessage("%PAGE_DESC_WS_RUNTIME_SELECTION")); - Color black = new Color(thisShell.getDisplay(), 0x00, 0, 0); - messageBanner_.setForeground(black); - enableOKButton(); - } - - private void setERRORStatusMessage(String message) { - messageBanner_.setText(getMessage(message)); - Color red = new Color(thisShell.getDisplay(), 0xFF, 0, 0); - messageBanner_.setForeground(red); - disableOKButton(); - } - - private void disableOKButton() { - if (getButton(0) != null) - getButton(0).setEnabled(false); - } - - private void enableOKButton() { - if (getButton(0) != null) - getButton(0).setEnabled(true); - } - - protected void okPressed() { - setJ2EEVersionFromJ2EEVersionCombo(); - //j2eeVersion = (j2eeVersionCombo.getEnabled()) ? j2eeVersionCombo.getText() : null; - setReturnCode(OK); - close(); - } - - private void setJ2EEVersionFromJ2EEVersionCombo() - { - if (j2eeVersionCombo.getEnabled()) - { - String j2eeLabel = j2eeVersionCombo.getText(); - String j2eeVersionString = J2EEUtils.getJ2EEVersionFromLabel(j2eeLabel); - if (j2eeVersionString != null && j2eeVersionString.length() > 0) - j2eeVersion = j2eeVersionString; - else - j2eeVersion = null; - } - else - j2eeVersion = null; - } - /** - * Called when an event occurs on the page. Handles the event and revalidates the page. - * - * @param event - * The event that occured. - */ - public void handleEvent(Event event) { - if (!validateOn_) - return; - enableOKButton(); - if (viewSelectionByRuntimeButton_ == event.widget) { - handleRuntimeViewSelectionEvent(); - return; - } - else if (viewSelectionByServerButton_ == event.widget) { - handleServerViewSelectionEvent(); - return; - } - else if (viewSelectionByExploreButton_ == event.widget) { - handleExploreViewSelectionEvent(); - return; - } - else if (j2eeVersionCombo == event.widget) { - setJ2EEVersionFromJ2EEVersionCombo(); - //j2eeVersion = (j2eeVersionCombo.getEnabled()) ? j2eeVersionCombo.getText() : null; - return; - } - else if (runtimesList_ == event.widget) { - TreeItem[] runtimeSel = runtimesList_.getSelection(); - processRuntimeListSelection(runtimeSel[0].getText()); - validateServerRuntimeSelection(); - setJ2EEVersions(); - setJ2EEVersionBasedOnServer(); - } - else if (serverList_ == event.widget) { - processServerListSelection(); - validateServerRuntimeSelection(); - setJ2EEVersionBasedOnServer(); - } - } - - private void handleRuntimeViewSelectionEvent() { - GridLayout gl = new GridLayout(); - gl.numColumns = 1; - gl.makeColumnsEqualWidth = true; - GridData gd = new GridData(GridData.FILL_BOTH); - primaryGroup_.setLayout(gl); - primaryGroup_.setLayoutData(gd); - primaryGroup_.layout(); - - // TODO: Show all runtimes, and only servers supported by current type id - } - - // - // Called by handleEvent() when the user selects the layout to view - // - public void handleServerViewSelectionEvent() { - GridLayout gl = new GridLayout(); - gl.numColumns = 1; - gl.makeColumnsEqualWidth = true; - GridData gd = new GridData(GridData.FILL_BOTH); - primaryGroup_.setLayout(gl); - primaryGroup_.setLayoutData(gd); - primaryGroup_.layout(); - serversGroup_.setLocation(5, 5); - runtimesGroup_.setLocation(4, 100); - serversGroup_.layout(); - runtimesGroup_.layout(); - - // TODO: Show all servers, and only runtimes supported by the current type id - } - - // - // Called by handleEvent() when the user selects the layout to view - // - private void handleExploreViewSelectionEvent() { - GridLayout gl; - gl = (GridLayout) primaryGroup_.getLayout(); - gl.numColumns = 2; - gl.makeColumnsEqualWidth = true; - GridData gd = new GridData(GridData.FILL_BOTH); - primaryGroup_.setLayout(gl); - primaryGroup_.setLayoutData(gd); - primaryGroup_.layout(); - - // TODO: Show all servers and runtimes from the type id - - } - - private void processRuntimeListSelection(String runtimeName) { - // rskreg - if (selectionMode_ == MODE_SERVICE) { - //selectedRuntime_ = wssrtRegistry.getWebServiceRuntimeByLabel(runtimeName); - selectedRuntime_ = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeByLabel(runtimeName); - } - else { - //selectedRuntime_ = wsctRegistry.getWebServiceRuntimeByName(runtimeName); - selectedRuntime_ = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeByLabel(runtimeName); - } - // rskreg - } - - private void processServerListSelection() { - String currentSelection; - TreeItem[] serverSel = serverList_.getSelection(); - if (serverSel != null && serverSel.length > 0) { - currentSelection = serverSel[0].getText(); - if (serverLabels_.containsKey(currentSelection) || existingServersTable_.containsKey(currentSelection)) { - if (existingServersTable_.containsKey(currentSelection)) { - selectedServer_ = (IServer) existingServersTable_.get(currentSelection); - selectedServerLabel_ = currentSelection; - selectedServerFactoryID_ = selectedServer_.getServerType().getId(); - } - else if (serverLabels_.containsKey(currentSelection)) { - TreeItem parentItem = serverSel[0].getParentItem(); - if (parentItem != null && !parentItem.getText().equalsIgnoreCase(getMessage("%LABEL_TREE_EXISTING_SERVERS"))) { - selectedServerLabel_ = currentSelection; - selectedServer_ = null; - selectedServerFactoryID_ = (String) serverLabels_.get(currentSelection); - } - } - - // check if isExistingServer or new ServerType - TreeItem parentItem = serverSel[0].getParentItem(); - if (parentItem != null && parentItem.getText().equalsIgnoreCase(getMessage("%LABEL_TREE_EXISTING_SERVERS"))) { - setIsExistingServer(true); - } - else { - setIsExistingServer(false); - } - } - else { - selectedServer_ = null; - selectedServerLabel_ = null; - selectedServerFactoryID_ = null; - setIsExistingServer(false); - return; - } - } - } - - private static String getMessage(String key) { - return WebServiceConsumptionUIPlugin.getMessage(key); - } - - private void setRuntimesGroup() { - runtimesList_.removeAll(); - String[] runtimes = null; - - if (selectionMode_ == MODE_SERVICE) { - // rskreg - //runtimes = wssrtRegistry.getRuntimesByType(typeId_); - runtimes = WebServiceRuntimeExtensionUtils.getRuntimesByType(typeId_); - } - else { - //runtimes = wsctRegistry.getAllClientRuntimes(); - runtimes = WebServiceRuntimeExtensionUtils.getAllClientRuntimes(); - // rskreg - } - - TreeItem[] runtimeName = new TreeItem[runtimes.length]; - - if (runtimes != null) { - for (int i = 0; i < runtimes.length; i++) { - String runtimeLabel = getRuntimeLabel(runtimes[i]); - runtimeName[i] = new TreeItem(runtimesList_, SWT.NONE); - runtimeName[i].setText(runtimeLabel); - - if (runtimes[i].equalsIgnoreCase(defaultRuntime_)) { - runtimesList_.setSelection(new TreeItem[] { runtimeName[i]}); - selectedRuntime_ = getRuntime(runtimes[i]); - } - } - } - } - - private String getRuntimeLabel(String type) { - return getRuntime(type).getLabel(); - } - - // rskreg - private WebServiceRuntimeInfo getRuntime(String type) { - if (selectionMode_ == MODE_SERVICE) { - //return wssrtRegistry.getRuntimeById(type); - return WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(type); - } - else { - //return wsctRegistry.getRuntimeById(type); - return WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(type); - } - } - // rskreg - - /** - * - * ServersList class - * - * Class which easily creates the Tree structure and entries for existing servers and server types - */ - public class ServersList { - - private TreeItem[] existingServersTree; - boolean existingServer = false; - - public void setServerTreeItems(Tree serversList) { - this.setExistingServersTree(serversList); - this.setServerTypesTree(serversList); - } - - public void setExistingServersTree(Tree serverList) { - String[] serverIds = this.getAllExistingServers(); - existingServersTree = new TreeItem[1]; - TreeItem[] existingServerItems = new TreeItem[serverIds.length]; - existingServersTree[0] = new TreeItem(serverList, SWT.NONE); - existingServersTree[0].setText(getMessage("%LABEL_TREE_EXISTING_SERVERS")); - ImageDescriptor id = WebServiceConsumptionUIPlugin.getImageDescriptor(EXISTING_SERVERS_ICON); - if (id != null) - existingServersTree[0].setImage(id.createImage()); - for (int k = 0; k < serverIds.length; k++) { - IServerType serverType = ServerCore.findServerType(((IServer) existingServersTable_.get(serverIds[k])).getServerType().getId()); - if (serverType != null) { - existingServerItems[k] = new TreeItem(existingServersTree[0], SWT.NONE); - existingServerItems[k].setText(serverIds[k]); - if (serverIds[k].equalsIgnoreCase(defaultServer_) && getIsExistingServer()) { - existingServersTree[0].setExpanded(true); - serverList.setSelection(new TreeItem[] { existingServerItems[k]}); - existingServer = true; - RuntimeServerSelectionDialog.this.setIsExistingServer(true); - selectedServer_ = (IServer) existingServersTable_.get(defaultServer_); - selectedServerLabel_ = serverIds[k]; - selectedServerFactoryID_ = selectedServer_.getServerType().getId(); - } - existingServerItems[k].setImage(ServerUICore.getLabelProvider().getImage(serverType)); - } - } - } - - public void setServerTypesTree(Tree serverList) { - - TreeItem[] serverTypesTree = new TreeItem[1]; - serverTypesTree[0] = new TreeItem(serverList, SWT.NONE); - serverTypesTree[0].setText(getMessage("%LABEL_TREE_SERVER_TYPES")); - ImageDescriptor id = WebServiceConsumptionUIPlugin.getImageDescriptor(SERVER_TYPES_ICON); - if (id != null) - serverTypesTree[0].setImage(id.createImage()); - Hashtable categories_ = new Hashtable(); - Hashtable categoryTreeItem = new Hashtable(); - String[] serverIds = null; - // rm String wst = wse.getWebServiceType(); - if (selectionMode_ == MODE_SERVICE) { - // rskreg - //serverIds = wssrtRegistry.getServerFactoryIdsByType(typeId_); - serverIds = WebServiceRuntimeExtensionUtils.getServerFactoryIdsByType(typeId_); - // rskreg - } - else { - //serverIds = wsctRegistry.getServerFactoryIdsByClientType(typeId_); - // rskreg - //serverIds = wsctRegistry.getAllClientServerFactoryIds(); - serverIds = WebServiceRuntimeExtensionUtils.getAllClientServerFactoryIds(); - // rskreg - - } - // rm serverId = - // wssrtRegistry.getServerFactoryIdsByType(wse.getWebServiceType()); - if (serverIds == null) { - serverIds = getAllServerTypes(); - } - TreeItem[] parent = new TreeItem[serverIds.length]; - TreeItem[] item = new TreeItem[serverIds.length]; - if (serverIds != null) { - for (int i = 0; i < serverIds.length; i++) { - String server = ServerUtils.getInstance().getServerLabelForId(serverIds[i]); - if (server != null) { - RuntimeServerSelectionDialog.this.serverLabels_.put(server, serverIds[i]); - IServerType serverType = ServerCore.findServerType(serverIds[i]); - IRuntimeType runtimeType = serverType.getRuntimeType(); - if (!categories_.containsKey(serverType) && runtimeType != null) { - categories_.put(serverType, runtimeType); - if (categoryTreeItem.get(runtimeType) == null) { - String categoryText = runtimeType.getName(); - Image categoryImage = ServerUICore.getLabelProvider().getImage(runtimeType); - parent[i] = new TreeItem(serverTypesTree[0], SWT.NONE); - parent[i].setText(categoryText); - parent[i].setImage(categoryImage); - categoryTreeItem.put(runtimeType, parent[i]); - } - else { - parent[i] = (TreeItem) categoryTreeItem.get(runtimeType); - } - String factoryText = serverType.getName(); - Image factoryImage = ServerUICore.getLabelProvider().getImage(serverType); - item[i] = new TreeItem(parent[i], SWT.NONE); - item[i].setText(factoryText); - item[i].setImage(factoryImage); - item[i].setData(serverType); - if (factoryText.equalsIgnoreCase(defaultServer_) && !existingServer) { - serverList.setSelection(new TreeItem[] { item[i]}); - selectedServer_ = null; - selectedServerLabel_ = factoryText; - selectedServerFactoryID_ = (String) serverLabels_.get(selectedServerLabel_); - } - } - } - } - } - - } - - /** - * Get all servers in the workspace - * - * @return String[] of existing server names - */ - private String[] getAllExistingServers() { - Vector serverIds = new Vector(); - { - IServer[] servers = ServerCore.getServers(); - if (servers != null && servers.length!=0) { - for (int i = 0; i < servers.length; i++) { - IServer server = (IServer) servers[i]; - serverIds.add(server.getName()); - existingServersTable_.put(server.getName(), server); - } - } - } - return (String[]) serverIds.toArray(new String[serverIds.size()]); - } - - /** - * Get all server types available for creation - * - * @return String[] of server names - */ - private String[] getAllServerTypes() { - Vector serverTypes_ = new Vector(); - IServerType[] defaultServersList = ServerCore.getServerTypes(); - for (int i = 0; i < defaultServersList.length; i++) { - IServerType serverType = (IServerType) defaultServersList[i]; - serverTypes_.add(serverType.getId()); - } - return (String[]) serverTypes_.toArray(new String[serverTypes_.size()]); - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter.java deleted file mode 100644 index ee1a33015..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard; - -import java.util.ArrayList; -import java.util.Iterator; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; - - -public class TypeSelectionFilter -{ - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - public String[] getWebServiceTypeByInitialSelection(IStructuredSelection initialSelection, ArrayList webServiceTypeList) - { - - ArrayList supportedTypes = new ArrayList(); - if (initialSelection != null && initialSelection.size() == 1) - { - - // Check for null initial selection - Object initialObject = initialSelection.getFirstElement(); - if (initialObject == null) - { - return null; - } - // Match up resource type metadata with initial selection - Iterator iter = webServiceTypeList.iterator(); - while (iter.hasNext()) - { - String wst = (String)iter.next(); - String scenario = wst.substring(0,wst.indexOf("/")); - String implId = wst.substring(wst.indexOf("/")+1); - //IWebServiceType wst = (IWebServiceType)iter.next(); - //String typeId = (String)wst.getId(); - if (scenario.equals(String.valueOf(WebServiceScenario.BOTTOMUP)) && !supportedTypes.contains(wst)) - { - - - WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils.getWebServiceImplById(implId); - String[] resourceTypes = wsimpl.getResourceTypeMetadata(); - for (int i=0; i<resourceTypes.length; i++) - { - if (resourceTypes[i]!=null) - { - if ((initialObject.getClass().getName()).endsWith(resourceTypes[i])) - { - String name = null; - IResource resource = null; - - try - { - resource = ResourceUtils.getResourceFromSelection(initialObject); - } - catch( CoreException exc ) - { - resource = null; - } - - if (resource instanceof IContainer) - { - name = initialObject.getClass().getName(); - } - else if( resource != null ) - { - name = resource.getFullPath().toString(); - } - else - { - name = initialObject.getClass().getName(); - } - String[] extensions = wsimpl.getExtensionMetadata(); - if (acceptsName(name, extensions)) - { - supportedTypes.add(wst); - } - } - - } - } - } - } - - //If no wsImpls have accepted this selection, check if this is WSDL. If it is, - //add the top-down Java service type to the list. - if (supportedTypes.isEmpty()) - { - String[] resourceTypes = {"File", "IResource", "String", "ServiceImpl", "ServiceRefImpl", "WSDLResourceImpl"}; - for (int i=0; i<resourceTypes.length; i++) - { - if (resourceTypes[i]!=null) - { - if ((initialObject.getClass().getName()).endsWith(resourceTypes[i])) - { - String name = null; - IResource resource = null; - - try - { - resource = ResourceUtils.getResourceFromSelection(initialObject); - } - catch( CoreException exc ) - { - resource = null; - } - - if (resource instanceof IContainer) - { - name = initialObject.getClass().getName(); - } - else if( resource != null ) - { - name = resource.getFullPath().toString(); - } - else - { - name = initialObject.getClass().getName(); - } - String[] extensions = {".wsdl", ".wsil", ".html", ".ServiceImpl", ".ServiceRefImpl", ".WSDLResourceImpl"}; - if (acceptsName(name, extensions)) - { - StringBuffer entrybuff = new StringBuffer(); - entrybuff.append(String.valueOf(WebServiceScenario.TOPDOWN)); - entrybuff.append("/"); - entrybuff.append("org.eclipse.jst.ws.wsImpl.java"); - String entry = entrybuff.toString(); - supportedTypes.add(entry); - } - } - - } - } - } - - } - - - - if (supportedTypes.isEmpty()) - { - //It's not a registered implementation and its not WSDL so return null; - return null; - } - else - { - return (String[])supportedTypes.toArray(new String[0]); - } - } - // - // Checks if the given name is acceptable based upon its extension - // - private boolean acceptsName ( String name, String[] extensions) - { - //Return true if "all" extensions are supported. - - if (extensions[0]!=null) - { - if (extensions[0].equals("all")) - { - return true; - } - } - - for (int i=0; i<extensions.length; i++) - { - if (extensions[i]!=null) - { - if (name.endsWith(extensions[i])) - return true; - } - } - return false; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionMetadata.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionMetadata.java deleted file mode 100644 index 198c12dd3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionMetadata.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard; - -import java.util.StringTokenizer; - - // - // This class holds the set of distinguishing factors in determining - // the default Web service type. The default Web Service type will be determined - // by pattern matching the initial selection with the supported extension - // and the resource type metadata specified in the manifest file. - // - public class TypeSelectionMetadata - { - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2000, 2002."; - - public String[] extensionMeta; - public String[] resourceTypeMeta; - - public TypeSelectionMetadata(String extensionMD, String resourceTypeMD) - { - setExtensionMetadata(extensionMD); - setResourceTypeMetadata(resourceTypeMD); - } - - public void setExtensionMetadata(String extensionMetadata) - { - StringTokenizer st = new StringTokenizer(extensionMetadata); - extensionMeta = new String[st.countTokens()]; - int i=0; - while (st.hasMoreElements()) - { - String exten = (String)st.nextToken(); - if (exten!=null) - { - extensionMeta[i]=exten; - } - i++; - } - - } - - public String[] getExtensionMetadata() - { - return extensionMeta; - } - - public void setResourceTypeMetadata(String resourceTypeMetadata) - { - StringTokenizer st = new StringTokenizer(resourceTypeMetadata); - resourceTypeMeta = new String[st.countTokens()]; - int i=0; - while (st.hasMoreElements()) - { - String resourceType = (String)st.nextToken(); - if (resourceType!=null) - { - resourceTypeMeta[i]=resourceType; - } - i++; - } - } - - public String[] getResourceTypeMetadata() - { - return resourceTypeMeta; - } - - } - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceInfo.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceInfo.java deleted file mode 100644 index 64bc552ba..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/WebServiceInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard; - - -/** -* This type is used to hold user or calculated -* data to be use by finsih tasks -*/ -public interface WebServiceInfo -{ - -} - - - - diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryIBM.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryIBM.java deleted file mode 100644 index e1e8d3db2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryIBM.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi; - -import org.eclipse.wst.ws.internal.parser.plugin.ParserPlugin; - -public class PublicUDDIRegistryIBM implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryIBM() { - } - - public String getName() { - return ParserPlugin.getMessage("%PUBLICUDDIREGISTRYTYPE_NAME_IBM"); - } - - public String getInquiryURL() { - return "http://uddi.ibm.com/ubr/inquiryapi"; - } - - public String getPublishURL() { - return "https://uddi.ibm.com/ubr/publishapi"; - } - - public String getRegistrationURL() { - return "http://uddi.ibm.com/ubr/registry.html"; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryIBMTest.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryIBMTest.java deleted file mode 100644 index 1df4395a5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryIBMTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi; - -import org.eclipse.wst.ws.internal.parser.plugin.ParserPlugin; - -public class PublicUDDIRegistryIBMTest implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryIBMTest() { - } - - public String getName() { - return ParserPlugin.getMessage("%PUBLICUDDIREGISTRYTYPE_NAME_IBM_TEST"); - } - - public String getInquiryURL() { - return "http://uddi.ibm.com/testregistry/inquiryapi"; - } - - public String getPublishURL() { - return "https://uddi.ibm.com/testregistry/publishapi"; - } - - public String getRegistrationURL() { - return "http://uddi.ibm.com/testregistry/registry.html"; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryMicrosoft.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryMicrosoft.java deleted file mode 100644 index 89bdd3ea5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryMicrosoft.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi; - -import org.eclipse.wst.ws.internal.parser.plugin.ParserPlugin; - -public class PublicUDDIRegistryMicrosoft implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryMicrosoft() { - } - - public String getName() { - return ParserPlugin.getMessage("%PUBLICUDDIREGISTRYTYPE_NAME_MICROSOFT"); - } - - public String getInquiryURL() { - return "http://uddi.microsoft.com/inquire"; - } - - public String getPublishURL() { - return "https://uddi.microsoft.com/publish"; - } - - public String getRegistrationURL() { - return "https://uddi.microsoft.com/register.aspx"; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryMicrosoftTest.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryMicrosoftTest.java deleted file mode 100644 index 80fb5f6e2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryMicrosoftTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi; - -import org.eclipse.wst.ws.internal.parser.plugin.ParserPlugin; - -public class PublicUDDIRegistryMicrosoftTest implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryMicrosoftTest() { - } - - public String getName() { - return ParserPlugin.getMessage("%PUBLICUDDIREGISTRYTYPE_NAME_MICROSOFT_TEST"); - } - - public String getInquiryURL() { - return "http://test.uddi.microsoft.com/inquire"; - } - - public String getPublishURL() { - return "https://test.uddi.microsoft.com/publish"; - } - - public String getRegistrationURL() { - return "http://test.uddi.microsoft.com/register.aspx"; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryNTTComm.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryNTTComm.java deleted file mode 100644 index 0158b0ffc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryNTTComm.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi; - -import org.eclipse.wst.ws.internal.parser.plugin.ParserPlugin; - -public class PublicUDDIRegistryNTTComm implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryNTTComm() { - } - - public String getName() { - return ParserPlugin.getMessage("%PUBLICUDDIREGISTRYTYPE_NAME_NTTCOMM"); - } - - public String getInquiryURL() { - return "http://www.uddi.ne.jp/ubr/inquiryapi"; - } - - public String getPublishURL() { - return "https://www.uddi.ne.jp/ubr/publishapi"; - } - - public String getRegistrationURL() { - return "http://www.ntt.com/uddi/"; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistrySAP.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistrySAP.java deleted file mode 100644 index 04d6d1f13..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistrySAP.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi; - -import org.eclipse.wst.ws.internal.parser.plugin.ParserPlugin; - -public class PublicUDDIRegistrySAP implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistrySAP() { - } - - public String getName() { - return ParserPlugin.getMessage("%PUBLICUDDIREGISTRYTYPE_NAME_SAP"); - } - - public String getInquiryURL() { - return "http://uddi.sap.com/UDDI/api/inquiry/"; - } - - public String getPublishURL() { - return "https://uddi.sap.com/UDDI/api/publish/"; - } - - public String getRegistrationURL() { - return "http://uddi.sap.com/"; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistrySAPTest.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistrySAPTest.java deleted file mode 100644 index 31762a692..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistrySAPTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi; - -import org.eclipse.wst.ws.internal.parser.plugin.ParserPlugin; - -public class PublicUDDIRegistrySAPTest implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistrySAPTest() { - } - - public String getName() { - return ParserPlugin.getMessage("%PUBLICUDDIREGISTRYTYPE_NAME_SAP_TEST"); - } - - public String getInquiryURL() { - return "http://udditest.sap.com/UDDI/api/inquiry/"; - } - - public String getPublishURL() { - return "https://udditest.sap.com/UDDI/api/publish/"; - } - - public String getRegistrationURL() { - return "http://udditest.sap.com/"; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryType.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryType.java deleted file mode 100644 index e4d9e6589..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryType.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi; - -public interface PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public String getName(); - public String getInquiryURL(); - public String getPublishURL(); - public String getRegistrationURL(); - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryXMethods.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryXMethods.java deleted file mode 100644 index 0041287d5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/uddi/PublicUDDIRegistryXMethods.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard.uddi; - -import org.eclipse.wst.ws.internal.parser.plugin.ParserPlugin; - -public class PublicUDDIRegistryXMethods implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryXMethods() { - } - - public String getName() { - return ParserPlugin.getMessage("%PUBLICUDDIREGISTRYTYPE_NAME_XMETHODS"); - } - - public String getInquiryURL() { - //return "http://uddi.xmethods.net/inquire"; - return "http://uddi.xmethods.net/inquire2"; - } - - // Read-only registry. The publish and registration URLs don't exist. - public String getPublishURL() { - return "https://uddi.xmethods.net/publish2"; - } - - public String getRegistrationURL() { - return "http://www.xmethods.net/ve2/Register.po?event=registerOrg"; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/AddWSDLToWSILWrapperCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/AddWSDLToWSILWrapperCommand.java deleted file mode 100644 index 9db02e7d6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/AddWSDLToWSILWrapperCommand.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wsil; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.provisional.env.core.AbstractDataModelOperation; -import org.eclipse.wst.common.environment.Environment; -import org.eclipse.wst.ws.internal.wsil.AddWSDLToWSILCommand; - - - -public class AddWSDLToWSILWrapperCommand extends AbstractDataModelOperation -{ - private AddWSDLToWSILCommand command; - private Arguments args; - - public AddWSDLToWSILWrapperCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - Environment env = getEnvironment(); - - if (command == null) - command = new AddWSDLToWSILCommand(); - if (!args.isEmpty()) - { - command.setArguments(args.getStringArguments()); - command.setWWWAuthenticationHandler(new DialogWWWAuthentication(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell())); - command.setEnvironment( env ); - return command.execute( null, null); - } - return Status.OK_STATUS; - } - /** - * @param args The args to set. - */ - public void setArgs(Arguments args) - { - this.args = args; - } - - /** - * @param command The command to set. - */ - public void setCommand(AddWSDLToWSILCommand command) - { - this.command = command; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/Arguments.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/Arguments.java deleted file mode 100644 index 7a177c5a8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/Arguments.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wsil; - -import java.util.Vector; - -public class Arguments -{ - private Vector args_; - - public Arguments() - { - args_ = new Vector(); - } - - public void add(String key, Object value) - { - args_.add(key); - if (value != null) - args_.add(value); - } - - public void remove(String key) - { - int index = args_.indexOf(key); - if (index >= 0) - { - args_.remove(index); - args_.remove(index+1); - } - } - - public Object get(String key) - { - int index = args_.indexOf(key); - if (index >= 0) - return args_.get(index+1); - else - return null; - } - - public void clear() - { - args_.clear(); - } - - public Object[] getArguments() - { - Object[] args = new Object[args_.size()]; - args_.copyInto(args); - return args; - } - - public String[] getStringArguments() - { - String[] args = new String[args_.size()]; - for (int i = 0; i < args.length; i++) - args[i] = args_.get(i).toString(); - return args; - } - - public boolean isEmpty() - { - return args_.isEmpty(); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/DialogWWWAuthentication.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/DialogWWWAuthentication.java deleted file mode 100644 index 61f9d5491..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/DialogWWWAuthentication.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wsil; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.ws.internal.parser.wsil.WWWAuthenticationException; -import org.eclipse.wst.ws.internal.parser.wsil.WWWAuthenticationHandler; - - -public class DialogWWWAuthentication extends Dialog implements WWWAuthenticationHandler -{ - - /*CONTEXT_ID DBAS0001 for the HTTP basic authentication user name*/ - private final String INFOPOP_DBAS_USERNAME = WebServiceConsumptionUIPlugin.ID + ".DBAS0001"; - - /*CONTEXT_ID DBAS0002 for the HTTP basic authentication password*/ - private final String INFOPOP_DBAS_PASSWORD = WebServiceConsumptionUIPlugin.ID + ".DBAS0002"; - - private String usernameString_; - private String passwordString_; - - private Text username_; - private Text password_; - - private WWWAuthenticationException wwwae_; - - public DialogWWWAuthentication(Shell shell) - { - super(shell); - usernameString_ = null; - passwordString_ = null; - wwwae_ = null; - } - - /** - * Called when the Cancel button is pressed. - */ - protected void cancelPressed() - { - usernameString_ = null; - passwordString_ = null; - super.cancelPressed(); - } - - /** - * Called when the OK button is pressed. - */ - protected void okPressed() - { - String usernameString = username_.getText(); - usernameString_ = (usernameString.length() > 0) ? usernameString : null; - String passwordString = password_.getText(); - passwordString_ = (passwordString.length() > 0) ? passwordString : null; - setReturnCode(Dialog.OK); - super.okPressed(); - } - - /** - * See {@link org.eclipse.jface.window.Window#configureShell}. - * @param shell The shell. - */ - protected void configureShell(Shell shell) - { - super.configureShell(shell); - shell.setText(getMessage("%DIALOG_TITLE_HTTP_BASIC_AUTH")); - } - - /** - * Creates the dialog area. - * @param parent The parent composite. - * @return The control area. - */ - protected Control createDialogArea(Composite parent) - { - Composite composite = (Composite)super.createDialogArea(parent); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL); - gd.widthHint = 400; - gd.grabExcessVerticalSpace = true; - gd.grabExcessHorizontalSpace = true; - composite.setLayoutData(gd); - GridLayout gl = new GridLayout(); - gl.numColumns = 2; - gl.verticalSpacing = 15; - composite.setLayout(gl); - - Label label = new Label(composite, SWT.WRAP); - label.setText(getMessage("%LABEL_URL")); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - label = new Label(composite, SWT.WRAP); - label.setText(wwwae_.getURL()); - label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - label = new Label(composite, SWT.WRAP); - label.setText(getMessage("%LABEL_HTTP_BASIC_AUTH_USERNAME")); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - username_ = new Text(composite, SWT.BORDER); - username_.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - username_.setToolTipText(getMessage("%TOOLTIP_HTTP_BASIC_AUTH_USERNAME")); - PlatformUI.getWorkbench().getHelpSystem().setHelp(username_, INFOPOP_DBAS_USERNAME); - - label = new Label(composite, SWT.WRAP); - label.setText(getMessage("%LABEL_HTTP_BASIC_AUTH_PASSWORD")); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - - password_ = new Text(composite, SWT.BORDER); - password_.setEchoChar('*'); - password_.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - password_.setToolTipText(getMessage("%TOOLTIP_HTTP_BASIC_AUTH_PASSWORD")); - PlatformUI.getWorkbench().getHelpSystem().setHelp(username_, INFOPOP_DBAS_PASSWORD); - - return composite; - } - - private String getMessage(String msgId) - { - return WebServiceConsumptionUIPlugin.getMessage(msgId); - } - - public void handleWWWAuthentication(WWWAuthenticationException wwwae) - { - usernameString_ = null; - passwordString_ = null; - wwwae_ = wwwae; - open(); - } - - public String getUsername() - { - return usernameString_; - } - - public String getPassword() - { - return passwordString_; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/TableViewerEditor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/TableViewerEditor.java deleted file mode 100644 index aa98c1428..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/TableViewerEditor.java +++ /dev/null @@ -1,525 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wsil; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.TableEditor; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.events.TraverseListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Rectangle; -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.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; - - -public class TableViewerEditor extends Composite -{ - private int DEFAULT_TABLE_HEIGHT_HINT = 100; - private int DEFAULT_COLUMN_WIDTH = 80; - - private String[] columns_; - private TableViewer tableViewer_; - private Table table_; - private TableEditor editor_; - private TableEditorListener tableEditorListener_; - private Text text_; - private Button add_; - private Button remove_; - - private List values_; - private Object defaultValue_; - - public TableViewerEditor(Composite parent, String[] columns, List initValues, Object defaultValue) - { - super(parent, SWT.NONE); - columns_ = columns; - values_ = new ArrayList(); - if (initValues != null && initValues.size() > 0) - values_.addAll(initValues); - defaultValue_ = (defaultValue != null) ? defaultValue : new String(""); - createPartControl(this); - } - - private void createPartControl(Composite parent) - { - GridLayout gl = new GridLayout(); - gl.marginHeight = 0; - gl.marginWidth = 0; - setLayout(gl); - setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Composite composite = new Composite(parent, SWT.NONE); - gl = new GridLayout(); - gl.marginHeight = 0; - gl.marginWidth = 0; - composite.setLayout(gl); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - table_ = new Table(composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = DEFAULT_TABLE_HEIGHT_HINT; - table_.setLayoutData(gd); - table_.setHeaderVisible(true); - table_.setLinesVisible(true); - TableLayout tableLayout = new TableLayout(); - int maxWidth = DEFAULT_COLUMN_WIDTH; - for (int i = 0; i < columns_.length; i++) - { - TableColumn tableColumn = new TableColumn(table_, SWT.NONE); - tableColumn.setText(columns_[i]); - tableColumn.pack(); - int tableColumnWidth = Math.max(DEFAULT_COLUMN_WIDTH, tableColumn.getWidth()); - maxWidth = Math.max(maxWidth, tableColumnWidth); - ColumnWeightData columnData = new ColumnWeightData(tableColumnWidth, tableColumnWidth, true); - tableLayout.addColumnData(columnData); - } - table_.setLayout(tableLayout); - // initialize the table editor - editor_ = new TableEditor(table_); - // The editor must have the same size as the cell and must - // not be any smaller than 50 pixels. - editor_.horizontalAlignment = SWT.LEFT; - editor_.grabHorizontal = true; - editor_.minimumWidth = maxWidth; - tableEditorListener_ = new TableEditorListener(); - table_.addMouseListener(tableEditorListener_); - tableViewer_ = new TableViewer(table_); - tableViewer_.getControl().addKeyListener( - new KeyListener() - { - public void keyPressed(KeyEvent e) - { - // Del - if (((int)e.character) == 127) - handleDeleteKeyPressed(); - // Enter or space - if (((int)e.character) == 13 || ((int)e.character) == 32) - tableEditorListener_.editSelection(); - } - public void keyReleased(KeyEvent e) - { - } - } - ); - tableViewer_.setContentProvider(new ListContentProvider()); - tableViewer_.setLabelProvider(new ListLabelProvider()); - tableViewer_.setInput(values_); - tableViewer_.addSelectionChangedListener( - new ISelectionChangedListener() - { - public void selectionChanged(SelectionChangedEvent event) - { - enableRemove(true); - } - } - ); - - Composite buttonComposite = new Composite(composite, SWT.NONE); - gl = new GridLayout(); - gl.numColumns = 2; - gl.makeColumnsEqualWidth = true; - buttonComposite.setLayout(gl); - buttonComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING)); - - add_ = new Button(buttonComposite, SWT.PUSH); - add_.setText(WebServiceConsumptionUIPlugin.getMessage("%LABEL_ADD")); - add_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - add_.addSelectionListener( - new SelectionListener() - { - public void widgetSelected(SelectionEvent event) - { - handleAddButtonSelected(event); - } - public void widgetDefaultSelected(SelectionEvent event) - { - } - } - ); - - remove_ = new Button(buttonComposite, SWT.PUSH); - remove_.setText(WebServiceConsumptionUIPlugin.getMessage("%LABEL_REMOVE")); - remove_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - remove_.addSelectionListener( - new SelectionListener() - { - public void widgetSelected(SelectionEvent event) - { - handleRemoveButtonSelected(event); - } - public void widgetDefaultSelected(SelectionEvent event) - { - } - } - ); - enableRemove(false); - } - - private void enableRemove(boolean enabled) - { - remove_.setEnabled(enabled && !tableViewer_.getSelection().isEmpty()); - } - - private void handleAddButtonSelected(SelectionEvent event) - { - values_.add(defaultValue_); - refresh(); - setSelectionAsObject(values_.get(table_.getItemCount()-1)); - tableEditorListener_.editSelection(); - } - - private void handleRemoveButtonSelected(SelectionEvent event) - { - handleDeleteKeyPressed(); - } - - private void handleDeleteKeyPressed() - { - internalDispose(); - ISelection selection = tableViewer_.getSelection(); - if (selection != null && !selection.isEmpty() && (selection instanceof IStructuredSelection)) - { - int selectionIndex = table_.getSelectionIndex(); - int selectionCount = table_.getItemCount(); - values_.remove(selectionIndex); - if (selectionIndex < selectionCount-1) - setSelectionAsObject(values_.get(selectionIndex)); - else if (selectionCount -2 >= 0) - setSelectionAsObject(values_.get(selectionCount-2)); - refresh(); - } - } - - private void internalRefresh() - { - // synchronize text field, previously selected table cell and model (inputObject) - if (text_ != null) - { - TableItem oldTableItem = editor_.getItem(); - int oldColumnIndex = editor_.getColumn(); - if (oldTableItem != null && oldColumnIndex >= 0 && oldColumnIndex < columns_.length) - { - String oldText = text_.getText(); - oldTableItem.setText(oldColumnIndex, oldText); - int oldRowIndex = table_.indexOf(oldTableItem); - values_.set(oldRowIndex, oldText); - } - } - } - - private void setSelectionAsObject(Object object) - { - tableViewer_.setSelection(new StructuredSelection(object), true); - } - - public void setToolTipText(String string) - { - table_.setToolTipText(string); - } - - public void setInfopop(String string) - { - PlatformUI.getWorkbench().getHelpSystem().setHelp(table_, string); - } - - public void setInput(List list) - { - values_.clear(); - values_.addAll(list); - } - - public void refresh() - { - internalRefresh(); - tableViewer_.refresh(); - } - - public TableItem[] getItems() - { - internalRefresh(); - return table_.getItems(); - } - - public void setEnabled(boolean enabled) - { - super.setEnabled(enabled); - add_.setEnabled(enabled); - enableRemove(enabled); - } - - public void dispose() - { - super.dispose(); - internalDispose(); - if (editor_ != null) - editor_.dispose(); - if (table_ != null) - table_.dispose(); - if (add_ != null) - add_.dispose(); - if (remove_ != null) - remove_.dispose(); - } - - private void internalDispose() - { - if (text_ != null) - text_.dispose(); - text_ = null; - } - - protected class TableEditorListener implements MouseListener - { - private int currSelectionIndex_; - private int editRow_; - private int editColumn_; - - public TableEditorListener() - { - super(); - currSelectionIndex_ = -1; - editRow_ = -1; - editColumn_ = -1; - } - - public void mouseDoubleClick(MouseEvent e) - { - mouseDown(e); - } - - public void mouseDown(MouseEvent e) - { - // refresh table - internalRefresh(); - // Clean up previous text editor control - internalDispose(); - // update table - if (table_.isFocusControl()) - { - int selectedRowIndex = getSelectedRow(table_, e.y); - if (currSelectionIndex_ != -1 && selectedRowIndex != -1 && currSelectionIndex_ == selectedRowIndex) - { - TableItem tableItem = table_.getItem(selectedRowIndex); - int selectedColumnIndex = getSelectedColumn(tableItem, e.x, e.y); - if (selectedColumnIndex != -1 && (text_ == null || text_.isDisposed() || selectedColumnIndex != editor_.getColumn())) - editSelection(selectedRowIndex, selectedColumnIndex); - } - currSelectionIndex_ = selectedRowIndex; - } - } - - public void mouseUp(MouseEvent e) - { - } - - private int getSelectedRow(Table table, int y) - { - TableItem[] tableItems = table.getItems(); - for (int i = 0; i < tableItems.length; i++) - { - Rectangle rectangle = tableItems[i].getBounds(0); - if (rectangle != null && y >= rectangle.y && y < (rectangle.y + rectangle.height)) - return i; - } - return -1; - } - - private int getSelectedColumn(TableItem tableItem, int x, int y) - { - for (int i = 0; i < columns_.length; i++) - { - if (tableItem.getBounds(i).contains(x, y)) - return i; - } - return -1; - } - - private void editSelection(int row, int column) - { - editRow_ = row; - editColumn_ = column; - TableItem tableItem = table_.getItem(row); - // Setup adapter for the new selection - text_ = new Text(table_, SWT.NONE); - String text = tableItem.getText(column); - text_.setText((text != null) ? text : ""); - text_.addKeyListener(new KeyListener() - { - public void keyPressed(KeyEvent e) - { - // Esc - if (((int)e.character) == 27) - cancelSelection(); - } - public void keyReleased(KeyEvent e) - { - } - } - ); - text_.addTraverseListener(new TraverseListener() - { - public void keyTraversed(TraverseEvent e) - { - if (e.detail == SWT.TRAVERSE_TAB_NEXT) - traverseTabNext(); - else if (e.detail == SWT.TRAVERSE_TAB_PREVIOUS) - traverseTabPrevious(); - } - } - ); - editor_.setEditor(text_, tableItem, column); - text_.setFocus(); - text_.selectAll(); - } - - protected void traverseTabNext() - { - internalRefresh(); - internalDispose(); - if (!(editRow_ == table_.getItems().length-1 && editColumn_ == columns_.length-1)) - { - if (editColumn_ < columns_.length-1) - editColumn_++; - else - { - editColumn_ = 0; - editRow_++; - table_.select(editRow_); - } - editSelection(editRow_, editColumn_); - } - } - - protected void traverseTabPrevious() - { - internalRefresh(); - internalDispose(); - if (!(editRow_ == 0 && editColumn_ == 0)) - { - if (editColumn_ > 0) - editColumn_--; - else - { - editColumn_ = columns_.length-1; - editRow_--; - table_.select(editRow_); - } - editSelection(editRow_, editColumn_); - } - } - - public void cancelSelection() - { - internalDispose(); - internalRefresh(); - } - - public void editSelection() - { - int selectedRowIndex = table_.getSelectionIndex(); - if (selectedRowIndex != -1 && columns_.length > 0) - { - // refresh table - internalRefresh(); - // Clean up any previous editor control - internalDispose(); - editSelection(selectedRowIndex, 0); - } - currSelectionIndex_ = selectedRowIndex; - } - } - - protected class ListContentProvider implements IStructuredContentProvider - { - public void dispose() - { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) - { - tableViewer_.add(getElements(newInput)); - } - - public Object[] getElements(Object inputElement) - { - if (inputElement instanceof List) - { - List list = (List)inputElement; - Object[] objects = new Object[list.size()]; - for (int i = 0; i < objects.length; i++) - objects[i] = list.get(i); - return objects; - } - else - return new Object[0]; - } - } - - protected class ListLabelProvider implements ITableLabelProvider - { - public Image getColumnImage(Object element, int columnIndex) - { - return null; - } - - public String getColumnText(Object element, int columnIndex) - { - return element.toString(); - } - - public void addListener(ILabelProviderListener listener) - { - } - - public void removeListener(ILabelProviderListener listener) - { - } - - public boolean isLabelProperty(Object element, String property) - { - return true; - } - - public void dispose() - { - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/Utils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/Utils.java deleted file mode 100644 index 41e17c363..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/Utils.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wsil; - -import java.net.MalformedURLException; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jst.ws.internal.common.ResourceUtils; - - -public class Utils -{ - public Utils() - { - } - - public String toFileSystemURI(String relativePlatformURI) - { - if (relativePlatformURI != null) - return toFileSystemURI(ResourceUtils.findResource(relativePlatformURI)); - else - return null; - } - - public String toFileSystemURI(IResource res) - { - if (res != null) - { - IPath path = res.getLocation(); - if (path != null) - { - try - { - return path.toFile().toURL().toString(); - } - catch (MalformedURLException murle) - { - } - } - } - return null; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientType.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientType.java deleted file mode 100644 index 808a1afc9..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientType.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.Hashtable; -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.IConfigurationElement; - -public class ClientType { - - private IConfigurationElement elem_; - private Hashtable webServiceClientImpls_; - - private String id; - private WebServiceClientImpl webServiceClientImpl; - private String[] moduleTypesInclude; - private String[] moduleTypesExclude; - - - - public ClientType(IConfigurationElement elem_, Hashtable webServiceClientImpls_) - { - super(); - this.elem_ = elem_; - this.webServiceClientImpls_ = webServiceClientImpls_; - } - - - - public String getId() - { - if (id==null) - { - id = elem_.getAttribute("id"); - } - return id; - } - - - - - public String[] getModuleTypesExclude() - { - if (moduleTypesExclude==null) - { - String attr = elem_.getAttribute("moduleTypesExclude"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - moduleTypesExclude = new String[size]; - for (int i = 0; i < moduleTypesExclude.length; i++) - moduleTypesExclude[i] = st.nextToken(); - } - } - return moduleTypesExclude; - } - - - - - public String[] getModuleTypesInclude() - { - if (moduleTypesInclude==null) - { - String attr = elem_.getAttribute("moduleTypesInclude"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - moduleTypesInclude = new String[size]; - for (int i = 0; i < moduleTypesInclude.length; i++) - moduleTypesInclude[i] = st.nextToken(); - } - } - return moduleTypesInclude; - } - - - - - public WebServiceClientImpl getWebServiceClientImpl() - { - if (webServiceClientImpl==null) - { - String wscimplId = elem_.getAttribute("implId"); - webServiceClientImpl = (WebServiceClientImpl)webServiceClientImpls_.get(wscimplId); - } - return webServiceClientImpl; - } - - - - /* - public String getWebServiceClientTypeId() - { - if (webServiceClientTypeId==null) - { - webServiceClientTypeId = elem_.getAttribute("webServiceClientTypeId"); - } - return webServiceClientTypeId; - } - */ - - - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/Context.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/Context.java deleted file mode 100644 index 3abfb4489..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/Context.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import org.eclipse.wst.ws.internal.provisional.wsrt.IContext; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; - -/** - * @author rsinha - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates - */ -public class Context implements IContext { - private WebServiceScenario scenario; - private boolean develop; - private boolean assemble; - private boolean deploy; - private boolean install; - private boolean run; - private boolean client; - private boolean test; - private boolean publish; - private boolean overWriteFiles; - private boolean createFolders; - private boolean checkOutFiles; - - public boolean getAssemble() { - return assemble; - } - - public boolean getCheckOutFiles() { - return checkOutFiles; - } - - public boolean getClient() { - return client; - } - - public boolean getCreateFolders() { - return createFolders; - } - - public boolean getDeploy() { - return deploy; - } - - public boolean getDevelop() { - return develop; - } - - public boolean getInstall() { - return install; - } - - public boolean getOverWriteFiles() { - return overWriteFiles; - } - - public boolean getPublish() { - return publish; - } - - public boolean getRun() { - return run; - } - - public WebServiceScenario getScenario() { - return scenario; - } - - public boolean getTest() { - return test; - } - - public void setAssemble(boolean assemble) { - this.assemble = assemble; - } - - - public void setCheckOutFiles(boolean checkOutFiles) { - this.checkOutFiles = checkOutFiles; - } - - - public void setClient(boolean client) { - this.client = client; - } - - - public void setCreateFolders(boolean createFolders) { - this.createFolders = createFolders; - } - - - public void setDeploy(boolean deploy) { - this.deploy = deploy; - } - - - public void setDevelop(boolean develop) { - this.develop = develop; - } - - - public void setInstall(boolean install) { - this.install = install; - } - - - public void setOverWriteFiles(boolean overWriteFiles) { - this.overWriteFiles = overWriteFiles; - } - - - public void setPublish(boolean publish) { - this.publish = publish; - } - - - public void setRun(boolean run) { - this.run = run; - } - - - public void setScenario(WebServiceScenario scenario) { - this.scenario = scenario; - } - - - public void setTest(boolean test) { - this.test = test; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/Selection.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/Selection.java deleted file mode 100644 index ec4640339..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/Selection.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import org.eclipse.wst.ws.internal.provisional.wsrt.ISelection; - -public class Selection implements ISelection { - - private Object[] selection; - - public Object[] getSelection() - { - return selection; - } - - public void setSelection(Object[] selection) - { - this.selection = selection; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceType.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceType.java deleted file mode 100644 index ec311b949..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceType.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.Hashtable; -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; - -public class ServiceType { - - private IConfigurationElement elem_; - private Hashtable webServiceImpls_; - private String id; - private WebServiceImpl webServiceImpl; - private String[] bottomUpModuleTypesInclude; - private String[] topDownModuleTypesInclude; - private String[] bottomUpModuleTypesExclude; - private String[] topDownModuleTypesExclude; - - - - - public ServiceType(IConfigurationElement elem_, Hashtable webServiceImpls_) - { - super(); - this.elem_ = elem_; - this.webServiceImpls_ = webServiceImpls_; - } - - public String[] getBottomUpModuleTypesExclude() - { - if (bottomUpModuleTypesExclude==null) - { - String attr = elem_.getAttribute("buModuleTypesExclude"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - bottomUpModuleTypesExclude = new String[size]; - for (int i = 0; i < bottomUpModuleTypesExclude.length; i++) - bottomUpModuleTypesExclude[i] = st.nextToken(); - } - } - return bottomUpModuleTypesExclude; - } - - public void setBottomUpModuleTypesExclude(String[] bottomUpModuleTypesExclude) - { - this.bottomUpModuleTypesExclude = bottomUpModuleTypesExclude; - } - - public String[] getBottomUpModuleTypesInclude() - { - if (bottomUpModuleTypesInclude==null) - { - String attr = elem_.getAttribute("buModuleTypesInclude"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - bottomUpModuleTypesInclude = new String[size]; - for (int i = 0; i < bottomUpModuleTypesInclude.length; i++) - bottomUpModuleTypesInclude[i] = st.nextToken(); - } - } - return bottomUpModuleTypesInclude; - } - - public void setBottomUpModuleTypesInclude(String[] bottomUpModuleTypesInclude) - { - this.bottomUpModuleTypesInclude = bottomUpModuleTypesInclude; - } - - public String getId() - { - if (id==null) - { - id = elem_.getAttribute("id"); - } - return id; - } - - public void setId(String id) - { - this.id = id; - } - - public String[] getTopDownModuleTypesExclude() - { - if (topDownModuleTypesExclude==null) - { - String attr = elem_.getAttribute("tdModuleTypesExclude"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - topDownModuleTypesExclude = new String[size]; - for (int i = 0; i < topDownModuleTypesExclude.length; i++) - topDownModuleTypesExclude[i] = st.nextToken(); - } - } - return topDownModuleTypesExclude; - } - - public void setTopDownModuleTypesExclude(String[] topDownModuleTypesExclude) - { - this.topDownModuleTypesExclude = topDownModuleTypesExclude; - } - - public String[] getTopDownModuleTypesInclude() - { - if (topDownModuleTypesInclude==null) - { - String attr = elem_.getAttribute("tdModuleTypesInclude"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - topDownModuleTypesInclude = new String[size]; - for (int i = 0; i < topDownModuleTypesInclude.length; i++) - topDownModuleTypesInclude[i] = st.nextToken(); - } - } - return topDownModuleTypesInclude; - } - - public void setTopDownModuleTypesInclude(String[] topDownModuleTypesInclude) - { - this.topDownModuleTypesInclude = topDownModuleTypesInclude; - } - - public WebServiceImpl getWebServiceImpl() - { - if (webServiceImpl == null) - { - String wsimplId = elem_.getAttribute("implId"); - webServiceImpl = (WebServiceImpl)webServiceImpls_.get(wsimplId); - } - return webServiceImpl; - } - - public void setWebServiceImpl1(WebServiceImpl webServiceImpl) - { - this.webServiceImpl = webServiceImpl; - } - - public boolean supportsScenario(int scenario) - { - switch(scenario) - { - case WebServiceScenario.BOTTOMUP: - String[] bus = getBottomUpModuleTypesInclude(); - if (bus!=null && bus.length>0) - { - return true; - } - break; - case WebServiceScenario.TOPDOWN: - String[] tds = getTopDownModuleTypesInclude(); - if (tds!=null && tds.length>0) - { - return true; - } - break; - default: - - } - - return false; - } - - public String[] getModuleTypesInclude(int scenario) - { - switch(scenario) - { - case WebServiceScenario.BOTTOMUP: - return getBottomUpModuleTypesInclude(); - case WebServiceScenario.TOPDOWN: - return getTopDownModuleTypesInclude(); - default: - } - - return null; - } - - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceClientImpl.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceClientImpl.java deleted file mode 100644 index d187b3a6a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceClientImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import org.eclipse.core.runtime.IConfigurationElement; - -public class WebServiceClientImpl { - - private IConfigurationElement elem_; - private String id; - private String label; - - public WebServiceClientImpl(IConfigurationElement elem_) - { - super(); - this.elem_ = elem_; - } - - public String getId() - { - if (id==null) - { - id = elem_.getAttribute("id"); - } - return id; - } - - - public String getLabel() - { - if (label==null) - { - label = elem_.getAttribute("label"); - } - return label; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceImpl.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceImpl.java deleted file mode 100644 index 971875ca1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.IConfigurationElement; - -public class WebServiceImpl { - - private IConfigurationElement elem_; - private String id; - private String label; - private String[] resourceTypeMetadata; - private String[] extensionMetadata; - private String objectSelectionWidget; - - public WebServiceImpl(IConfigurationElement elem_) - { - super(); - this.elem_ = elem_; - } - - public String[] getExtensionMetadata() - { - if (extensionMetadata==null) - { - String attr = elem_.getAttribute("extensionMetadata"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - extensionMetadata = new String[size]; - for (int i = 0; i < extensionMetadata.length; i++) - extensionMetadata[i] = st.nextToken(); - } - } - return extensionMetadata; - } - - - public String getId() - { - if (id==null) - { - id = elem_.getAttribute("id"); - } - return id; - } - - - public String getLabel() - { - if (label==null) - { - label = elem_.getAttribute("label"); - } - return label; - } - - - public String[] getResourceTypeMetadata() - { - if (resourceTypeMetadata==null) - { - String attr = elem_.getAttribute("resourceTypeMetadata"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - resourceTypeMetadata = new String[size]; - for (int i = 0; i < resourceTypeMetadata.length; i++) - resourceTypeMetadata[i] = st.nextToken(); - } - } - return resourceTypeMetadata; - } - - public String getObjectSelectionWidget() - { - if (objectSelectionWidget==null) - { - objectSelectionWidget = elem_.getAttribute("objectSelectionWidget"); - } - return objectSelectionWidget; - } - - - - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry.java deleted file mode 100644 index 3347379db..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry.java +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Hashtable; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; - -public class WebServiceRuntimeExtensionRegistry -{ - - private static WebServiceRuntimeExtensionRegistry instance_; - - HashMap webServiceTypes_; - - ArrayList webServiceTypesList_; - - ArrayList webServiceClientTypesList_; - - Hashtable webServiceImpls_; - - Hashtable webServiceClientImpls_; - - Hashtable serviceTypes_; - - Hashtable clientTypes_; - - Hashtable webServiceRuntimes_; - - /** - * Returns a singleton instance of this class. - * - * @return A singleton WebServiceRuntimeExtensionRegistry object. - */ - public static WebServiceRuntimeExtensionRegistry getInstance() - { - if (instance_ == null) - { - instance_ = new WebServiceRuntimeExtensionRegistry(); - instance_.load(); - } - return instance_; - } - - private void load() - { - // Can't get rid of webServiceTypes in M4 - webServiceTypes_ = new HashMap(); - webServiceTypesList_ = new ArrayList(); - webServiceClientTypesList_ = new ArrayList(); - webServiceImpls_ = new Hashtable(); - webServiceClientImpls_ = new Hashtable(); - serviceTypes_ = new Hashtable(); - clientTypes_ = new Hashtable(); - webServiceRuntimes_ = new Hashtable(); - - IExtensionRegistry reg = Platform.getExtensionRegistry(); - - //Load WebServiceImpls - IConfigurationElement[] wsImplExts = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", "wsImpl"); - - for(int idx=0; idx<wsImplExts.length; idx++) - { - IConfigurationElement elem = wsImplExts[idx]; - - if (elem.getName().equals("webServiceImpl")) - { - WebServiceImpl wsimpl = new WebServiceImpl(elem); - webServiceImpls_.put(elem.getAttribute("id"), wsimpl); - } - } - - //Load WebServiceClientImpls - IConfigurationElement[] wsClientImplExts = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", "wsClientImpl"); - - for(int idx=0; idx<wsClientImplExts.length; idx++) - { - IConfigurationElement elem = wsClientImplExts[idx]; - - if (elem.getName().equals("webServiceClientImpl")) - { - WebServiceClientImpl wsClientImpl = new WebServiceClientImpl(elem); - webServiceClientImpls_.put(elem.getAttribute("id"), wsClientImpl); - } - } - - //Load ServiceTypes - IConfigurationElement[] serviceTypeExts = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", "serviceType"); - - for(int idx=0; idx<serviceTypeExts.length; idx++) - { - IConfigurationElement elem = serviceTypeExts[idx]; - - if (elem.getName().equals("serviceType")) - { - ServiceType st = new ServiceType(elem,webServiceImpls_); - serviceTypes_.put(elem.getAttribute("id"), st); - } - } - - //Load ClientTypes - IConfigurationElement[] clientTypeExts = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", "clientType"); - - for(int idx=0; idx<clientTypeExts.length; idx++) - { - IConfigurationElement elem = clientTypeExts[idx]; - - if (elem.getName().equals("clientType")) - { - ClientType ct = new ClientType(elem,webServiceClientImpls_); - clientTypes_.put(elem.getAttribute("id"), ct); - } - } - - //Load WebSerivceRuntimes - IConfigurationElement[] wsrtExts = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", "webServiceRuntime"); - - for(int idx=0; idx<wsrtExts.length; idx++) - { - IConfigurationElement elem = wsrtExts[idx]; - - if (elem.getName().equals("webServiceRuntime")) - { - WebServiceRuntimeInfo wsrtInfo = new WebServiceRuntimeInfo(elem, serviceTypes_, clientTypes_); - webServiceRuntimes_.put(elem.getAttribute("id"), wsrtInfo); - - //Update the type lists - updateWebServiceTypeList(wsrtInfo); - updateWebServiceClientTypeList(wsrtInfo); - - } - } - } - - private void updateWebServiceTypeList(WebServiceRuntimeInfo wsrtInfo) - { - ServiceType[] sts = wsrtInfo.getServiceTypes(); - if (sts != null) - { - for (int j = 0; j < sts.length; j++) - { - String implId = sts[j].getWebServiceImpl().getId(); - String[] bus = sts[j].getBottomUpModuleTypesInclude(); - String[] tds = sts[j].getTopDownModuleTypesInclude(); - if (bus != null) - { - StringBuffer entrybuff = new StringBuffer(); - entrybuff.append(String.valueOf(WebServiceScenario.BOTTOMUP)); - entrybuff.append("/"); - entrybuff.append(implId); - String entry = entrybuff.toString(); - if (!webServiceTypesList_.contains(entry)) - { - webServiceTypesList_.add(entry); - } - } - if (tds != null) - { - StringBuffer entrybuff = new StringBuffer(); - entrybuff.append(String.valueOf(WebServiceScenario.TOPDOWN)); - entrybuff.append("/"); - entrybuff.append(implId); - String entry = entrybuff.toString(); - if (!webServiceTypesList_.contains(entry)) - { - webServiceTypesList_.add(entry); - } - } - } - } - } - - private void updateWebServiceClientTypeList(WebServiceRuntimeInfo wsrtInfo) - { - ClientType[] cts = wsrtInfo.getClientTypes(); - if (cts != null) - { - for (int j = 0; j < cts.length; j++) - { - String implId = cts[j].getWebServiceClientImpl().getId(); - String[] mods = cts[j].getModuleTypesInclude(); - if (mods != null) - { - StringBuffer entrybuff = new StringBuffer(); - entrybuff.append(String.valueOf(WebServiceScenario.CLIENT)); - entrybuff.append("/"); - entrybuff.append(implId); - String entry = entrybuff.toString(); - if (!webServiceClientTypesList_.contains(entry)) - { - webServiceClientTypesList_.add(entry); - } - } - } - } - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils.java deleted file mode 100644 index c0a22a6ea..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils.java +++ /dev/null @@ -1,957 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.TypeSelectionFilter; -import org.eclipse.jst.ws.internal.data.LabelsAndIds; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionList; -import org.eclipse.wst.command.internal.provisional.env.core.selection.SelectionListChoices; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.ui.ServerUICore; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceRuntime; -import org.eclipse.wst.ws.internal.provisional.wsrt.WebServiceScenario; - -public class WebServiceRuntimeExtensionUtils -{ - private static WebServiceRuntimeExtensionRegistry registry = WebServiceRuntimeExtensionRegistry.getInstance(); - private static SelectionListChoices serverToRuntimeToJ2EE_; - private static Hashtable serverFactoryIdByLabel_; - private static Hashtable runtimeIdByLabel_; - - public static IWebServiceRuntime getWebServiceRuntime( String runtimeId ) - { - WebServiceRuntimeInfo wsrtInfo = getWebServiceRuntimeById(runtimeId); - IWebServiceRuntime webserviceRuntime = null; - if (wsrtInfo != null) - { - webserviceRuntime = wsrtInfo.getWebServiceRuntime(); - } - - return webserviceRuntime; - } - - public static WebServiceImpl getWebServiceImplById(String id) - { - Object result = registry.webServiceImpls_.get(id); - if (result!=null) - { - return (WebServiceImpl)result; - } - return null; - } - - public static int getScenarioFromTypeId(String typeId) - { - return Integer.parseInt(typeId.substring(0,typeId.indexOf("/"))); - } - - public static String getImplIdFromTypeId(String typeId) - { - return typeId.substring(typeId.indexOf("/")+1); - } - /* - * @param typeId will be a String of the format "0/implId" - * where the digit before the "/" represents the scenario - * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id - * of the WebServiceImpl - */ - public static ServiceType getServiceType(String runtimeId, String typeId) - { - WebServiceRuntimeInfo wsrt = getWebServiceRuntimeById(runtimeId); - if (wsrt!=null) - { - int scenario = getScenarioFromTypeId(typeId); - String implId = getImplIdFromTypeId(typeId); - //Return the first service type that supports the impl and scenario - ServiceType[] sts = wsrt.getServiceTypes(); - if (sts != null) - { - for (int i = 0; i < sts.length; i++) - { - String thisImplId = sts[i].getWebServiceImpl().getId(); - if (implId.equals(thisImplId)) - { - // Check if scenario is supported - if (sts[i].supportsScenario(scenario)) - { - return sts[i]; - } - } - } - } - } - - return null; - } - - public static WebServiceRuntimeInfo getWebServiceRuntimeById(String id) - { - Object result = registry.webServiceRuntimes_.get(id); - if (result!=null) - { - return (WebServiceRuntimeInfo)result; - } - return null; - } - - public static WebServiceRuntimeInfo getWebServiceRuntimeByLabel(String label) - { - Iterator iter = registry.webServiceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - WebServiceRuntimeInfo wsr = (WebServiceRuntimeInfo)iter.next(); - if (wsr!=null) { - if (label.equals(wsr.getLabel())) - return wsr; - } - } - return null; - } - - /* - * @param typeId will be a String of the format "0/implId" - * where the digit before the "/" represents the scenario - * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id - * of the WebServiceImpl - */ - public static String[] getRuntimesByType(String typeId) - { - int scenario = getScenarioFromTypeId(typeId); - String implId = getImplIdFromTypeId(typeId); - ArrayList ids = new ArrayList(); - Iterator iter = registry.webServiceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - WebServiceRuntimeInfo wsr = (WebServiceRuntimeInfo)iter.next(); - ServiceType[] sts = wsr.getServiceTypes(); - if (sts != null) - { - for (int i = 0; i < sts.length; i++) - { - String thisImplId = sts[i].getWebServiceImpl().getId(); - if (implId.equals(thisImplId)) - { - // Check if scenario is supported - if (sts[i].supportsScenario(scenario)) - { - ids.add(wsr.getId()); - break; - } - } - } - } - } - - if (ids.size() > 0) - { - String[] runtimeIds = (String[])ids.toArray(new String[0]); - return runtimeIds; - } - - return null; - } - - /* - * @param typeId will be a String of the format "0/implId" - * where the digit before the "/" represents the scenario - * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id - * of the WebServiceImpl - */ - public static boolean isRuntimeSupportedForType(String typeId, String runtimeId) - { - String[] runtimeIds = getRuntimesByType(typeId); - if (runtimeIds!=null) - { - for (int i=0; i < runtimeIds.length; i++) - { - if (runtimeIds[i].equals(runtimeId)) - { - return true; - } - } - } - - return false; - } - - public static String[] getServerFactoryIdsByType(String typeId) - { - String[] wsrts = getRuntimesByType(typeId); - if (wsrts == null ) - { - return null; - } - - ArrayList ids = new ArrayList(); - for (int i=0; i<wsrts.length ;i++) - { - String[] fIds = getWebServiceRuntimeById(wsrts[i]).getServerFactoryIds(); - if (fIds != null) - { - for (int j=0; j<fIds.length; j++) - { - if (!ids.contains(fIds[j])) - { - ids.add(fIds[j]); - } - } - } - } - - if (ids.size() > 0) - { - String[] serverFactoryIds = (String[])ids.toArray(new String[0]); - return serverFactoryIds; - } - - return null; - } - - /* - * @param typeId will be a String of the format "0/implId" - * where the digit before the "/" represents the scenario - * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id - * of the WebServiceImpl - */ - public static boolean isServerSupportedForChosenType(String typeId, String serverFactoryId) - { - String[] fIds = getServerFactoryIdsByType(typeId); - if (fIds == null) - { - return false; - } - - for (int i=0;i<fIds.length;i++) - { - if (serverFactoryId.equals(fIds[i])) - { - return true; - } - } - - return false; - } - - /* - * @param typeId will be a String of the format "0/implId" - * where the digit before the "/" represents the scenario - * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id - * of the WebServiceImpl - */ - public static boolean isServerRuntimeTypeSupported(String serverFactoryId, String runtimeId, String typeId) - { - String[] rIds = getRuntimesByType(typeId); - if (rIds == null) - { - return false; - } - - for (int i = 0; i < rIds.length; i++) - { - if (runtimeId.equals(rIds[i])) - { - String[] fIds = getWebServiceRuntimeById(rIds[i]).getServerFactoryIds(); - if (fIds != null) - { - for (int j = 0; j < fIds.length; j++) - { - if (serverFactoryId.equals(fIds[j])) - { - // Found it! - return true; - } - } - } - } - } - - return false; - } - - public static boolean doesRuntimeSupportJ2EELevel(String j2eeVersionId, String runtimeId) - { - WebServiceRuntimeInfo wsrt = getWebServiceRuntimeById(runtimeId); - if (wsrt==null) - return false; - - String[] j2eeVersions = wsrt.getJ2eeLevels(); - if (j2eeVersions==null || j2eeVersions.length==0) - return true; - - for(int i=0; i<j2eeVersions.length; i++) - { - if (j2eeVersions[i].equals(j2eeVersionId)) - { - return true; - } - } - return false; - } - - public static boolean doesRuntimeSupportServerTarget(String serverTargetId, String runtimeId) - { - WebServiceRuntimeInfo wsrt = getWebServiceRuntimeById(runtimeId); - if (wsrt==null) - return false; - - String[] fIds = wsrt.getServerFactoryIds(); - for(int i=0;i<fIds.length;i++) - { - IServerType serverType = ServerCore.findServerType(fIds[i]); - if (serverType == null) - continue; - - String thisServerTargetId = serverType.getRuntimeType().getId(); - if (thisServerTargetId.equals(serverTargetId)) - return true; - } - - return false; - } - - /** - * Returns a list of valid projects for the Web service type with an id of typeId. - * In the case where the Web service type extension does not specify which project - * natures are included, a array of all Web and EJB projects in the workspace will - * be returned. - * @param typeId - * @return IProject[] an array of valid projects - */ - public static IProject[] getAllProjects() - { - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - ArrayList validProjects = new ArrayList(); - for (int i = 0; i < projects.length; i++) - { - if (!projects[i].getName().equals("Servers") && !projects[i].getName().startsWith(".")) - { - validProjects.add(projects[i]); - } - } - - return (IProject[])validProjects.toArray(new IProject[0]); - // rsktodo - /* - IWebServiceType wst = getWebServiceTypeById(typeId); - if (wst != null) - { - IConfigurationElement elem = wst.getConfigurationElement(); - String includedNatures = elem.getAttribute("includeNatures"); - String excludedNatures = elem.getAttribute("excludeNatures"); - if (includedNatures!=null && includedNatures.length()>0) - { - for (int i = 0; i < projects.length; i++) - { - if (include(projects[i], includedNatures) && exclude(projects[i], excludedNatures)) - validProjects.add(projects[i]); - } - return (IProject[])validProjects.toArray(new IProject[0]); - } - } - - //If wst was null or the extension didn't specify which project natures are - // to be included, revert to the old behaviour - for (int j = 0; j < projects.length; j++) - { - if (ResourceUtils.isWebProject(projects[j]) || ResourceUtils.isEJBProject(projects[j])) - validProjects.add(projects[j]); - } - return (IProject[])validProjects.toArray(new IProject[0]); - */ - // rsktodo - } - - public static LabelsAndIds getServiceTypeLabels() - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId + ".plugin", registry ); - - LabelsAndIds labelIds = new LabelsAndIds(); - Iterator iterator = registry.webServiceTypesList_.iterator(); - int size = registry.webServiceTypesList_.size(); - String[] labels = new String[size]; - String[] ids = new String[size]; - int index = 0; - - labelIds.setLabels_( labels ); - labelIds.setIds_( ids ); - - while( iterator.hasNext() ) - { - String wst = (String)iterator.next(); - int scenario = getScenarioFromTypeId(wst); - String implId = getImplIdFromTypeId(wst); - WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils.getWebServiceImplById(implId); - String impllabel = wsimpl.getLabel(); - ids[index] = wst; - String scenLabel = ""; - switch(scenario) - { - case WebServiceScenario.BOTTOMUP: - scenLabel = msgUtils.getMessage(WebServiceScenario.BOTTOMUP_LABEL); - break; - case WebServiceScenario.TOPDOWN: - scenLabel = msgUtils.getMessage(WebServiceScenario.TOPDOWN_LABEL); - break; - default: - } - labels[index] = msgUtils.getMessage( "COMBINED_TYPE_AND_RUNTIME_LABEL", new String[]{ scenLabel, impllabel } ); - index++; - } - - return labelIds; - } - - /* - * @param typeId will be a String of the format "0/implId" - * where the digit before the "/" represents the scenario - * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id - * of the WebServiceImpl - */ - public static String getDefaultRuntimeValueFor(String typeId) - { - String[] rIds = getRuntimesByType(typeId); - if (rIds == null) - { - return null; - } - - return rIds[0]; - } - - - public static String getDefaultServerValueFor(String typeId) - { - String[] fIds = getServerFactoryIdsByType(typeId); - if (fIds==null) - return null; - - return fIds[0]; - } - - public static String[] getWebServiceTypeBySelection(IStructuredSelection selection) - { - TypeSelectionFilter tsf = new TypeSelectionFilter(); - String[] wst = tsf.getWebServiceTypeByInitialSelection(selection, registry.webServiceTypesList_); - return wst == null ? null : wst; - } - /** - * Returns true if an EJB project is needed to host a Web service - * of the type identified by typeId. If multiple natureIds are specified in the - * "includeNatures" attribute, only the first one is checked. If no natureIds are specified, - * false is returned. - * - * @deprecated - * Should be refactored in future - */ -// public static boolean requiresEJBProject(String typeId) -// { -// IWebServiceType wst = getWebServiceTypeById(typeId); -// if (wst != null) -// { -// IConfigurationElement elem = wst.getConfigurationElement(); -// String includedNatures = elem.getAttribute("includeNatures"); -// if (includedNatures==null || includedNatures.length()==0) -// { -// return false; -// } -// else -// { -// StringTokenizer st = new StringTokenizer(includedNatures); -// if(st.hasMoreTokens()) -// { -// String firstIncludedNature = st.nextToken(); -// if (firstIncludedNature.equals(IEJBNatureConstants.NATURE_ID)) -// return true; -// } -// } -// } -// return false; -// } - - /* - * @param typeId will be a String of the format "0/implId" - * where the digit before the "/" represents the scenario - * (e.g. WebServiceScenario.BOTTOM_UP) and the implId is the id - * of the WebServiceImpl - */ - public static boolean requiresEJBProject(String runtimeId, String typeId) - { - ServiceType st = getServiceType(runtimeId, typeId); - if (st!=null) - { - String[] includedNatures = st.getModuleTypesInclude(getScenarioFromTypeId(typeId)); - if (includedNatures!=null && includedNatures.length>0) - { - if (includedNatures[0].equals(IModuleConstants.JST_EJB_MODULE)) - { - return true; - } - } - } - - return false; - } - - public static boolean requiresEJBModuleFor(String serverFactoryId, String runtimeId, String typeId) - { - // rsktodo - return false; - } - - //Ported from the former WebServiceClientRegistry - - public static String getRuntimeLabelById(String runtimeId) - { - WebServiceRuntimeInfo wsrt = getWebServiceRuntimeById(runtimeId); - if (wsrt == null) - return null; - - return wsrt.getLabel(); - } - - public static String getServerLabelById(String serverFactoryId) - { - IServerType serverType = ServerCore.findServerType(serverFactoryId); - if (serverType == null) - return null; - - String serverLabel = ServerUICore.getLabelProvider().getText(serverType); - return serverLabel; - } - - public static String getServerInstanceLabelFromInstanceId( String instanceId ) - { - IServer server = ServerCore.findServer( instanceId ); - return server.getName(); - } - - public static boolean doesRuntimeSupportServer(String runtimeId, String factoryId) - { - WebServiceRuntimeInfo wsrt = getWebServiceRuntimeById(runtimeId); - if (wsrt != null) - { - String[] fids = wsrt.getServerFactoryIds(); - if (fids!=null) - { - for (int i=0; i<fids.length; i++) - { - if (fids[i].equals(factoryId)) - { - return true; - } - } - } - } - return false; - } - - public static String getFirstSupportedServer(String runtimeId) - { - WebServiceRuntimeInfo wsrt = getWebServiceRuntimeById(runtimeId); - - if (wsrt != null) - { - String[] fids = wsrt.getServerFactoryIds(); - if (fids!=null && fids.length>0) - { - return fids[0]; - } - } - - return null; - } - - - public static String[] getRuntimesByClientType(String clientImplId) - { - ArrayList ids = new ArrayList(); - Iterator iter = registry.webServiceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - WebServiceRuntimeInfo wsr = (WebServiceRuntimeInfo)iter.next(); - ClientType[] cts = wsr.getClientTypes(); - if (cts != null) - { - for (int i = 0; i < cts.length; i++) - { - String wsClientImplId = cts[i].getWebServiceClientImpl().getId(); - if (wsClientImplId.equals(clientImplId)) - { - ids.add(wsr.getId()); - break; - } - } - } - } - - if (ids.size() > 0) - { - String[] runtimeIds = (String[])ids.toArray(new String[0]); - return runtimeIds; - } - - return null; - } - - - - public static boolean webServiceClientRuntimeTypeExists(String serverFactoryId, String runtimeId, String clientTypeId) - { - String[] rIds = getRuntimesByClientType(clientTypeId); - if (rIds == null) - { - return false; - } - - for (int i = 0; i < rIds.length; i++) - { - if (runtimeId.equals(rIds[i])) - { - String[] fIds = getWebServiceRuntimeById(rIds[i]).getServerFactoryIds(); - if (fIds != null) - { - for (int j = 0; j < fIds.length; j++) - { - if (serverFactoryId.equals(fIds[j])) - { - // Found it! - return true; - } - } - } - } - } - - return false; - } - - public static String[] getAllClientRuntimes() - { - ArrayList ids = new ArrayList(); - Iterator iter = registry.webServiceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - WebServiceRuntimeInfo wsr = (WebServiceRuntimeInfo)iter.next(); - ClientType[] cts = wsr.getClientTypes(); - if (cts!=null && cts.length>0) - { - //this runtime supports the client scenario - ids.add(wsr.getId()); - } - } - - if (ids.size() > 0) - { - String[] runtimeIds = (String[])ids.toArray(new String[0]); - return runtimeIds; - } - - return null; - } - - - public static String[] getAllClientServerFactoryIds() - { - String[] rIds = getAllClientRuntimes(); - if (rIds==null) - return null; - - ArrayList ids = new ArrayList(); - for (int i=0; i<rIds.length ;i++) - { - String[] fIds = getWebServiceRuntimeById(rIds[i]).getServerFactoryIds(); - if (fIds != null) - { - for (int j=0; j<fIds.length; j++) - { - if (!ids.contains(fIds[j])) - { - ids.add(fIds[j]); - } - } - } - } - - if (ids.size() > 0) - { - String[] serverFactoryIds = (String[])ids.toArray(new String[0]); - return serverFactoryIds; - } - - return null; - } - - - - public static String[] getClientProjectTypes(String clientImplId, String runtimeId) - { - String[] rIds = getRuntimesByClientType(clientImplId); - if (rIds == null) - { - return null; - } - - for (int i = 0; i < rIds.length; i++) - { - if (runtimeId.equals(rIds[i])) - { - ClientType[] cts = getWebServiceRuntimeById(rIds[i]).getClientTypes(); - if (cts != null) - { - for (int j = 0; j < cts.length; j++) - { - String thisClientImplId = cts[j].getWebServiceClientImpl().getId(); - if (clientImplId.equals(thisClientImplId)) - { - // Found the one! - String[] projectTypes = cts[j].getModuleTypesInclude(); - return projectTypes; - } - } - } - } - } - - return null; - } - - public static boolean doesRuntimeSupportComponentType(String clientImplId, String runtimeId, String componentTypeId) - { - String[] compTypeIds = getClientProjectTypes(clientImplId, runtimeId); - if (compTypeIds!=null) - { - for (int i=0; i<compTypeIds.length; i++) - { - if (compTypeIds[i].equals(componentTypeId)) - { - return true; - } - } - } - - return false; - } - - public static LabelsAndIds getClientTypeLabels() - { - - LabelsAndIds labelIds = new LabelsAndIds(); - String[] idsArray = new String[0]; - String[] labelsArray = new String[0]; - labelIds.setIds_(idsArray); - labelIds.setLabels_(labelsArray); - - String[] rIds = getAllClientRuntimes(); - if (rIds == null) - { - return labelIds; - } - - ArrayList ids = new ArrayList(); - ArrayList labels = new ArrayList(); - - for (int i=0; i < rIds.length; i++) - { - WebServiceRuntimeInfo wsrt = getWebServiceRuntimeById(rIds[i]); - ClientType[] cts = wsrt.getClientTypes(); - if (cts != null) - { - for (int j = 0; j < cts.length; j++) - { - ClientType ct = cts[j]; - // String id = ct.getWebServiceClientTypeId(); - String id = ct.getWebServiceClientImpl().getId(); - if (!ids.contains(id)) - { - ids.add(id); - labels.add(ct.getWebServiceClientImpl().getLabel()); - } - } - } - - } - - if (ids.size() > 0) - { - idsArray = (String[]) ids.toArray(new String[0]); - labelsArray = (String[]) labels.toArray(new String[0]); - labelIds.setIds_(idsArray); - labelIds.setLabels_(labelsArray); - } - - return labelIds; - - } - - //Utilities used by the ServerRuntimePreferencePage - - public static SelectionListChoices getServerToRuntimeToJ2EE() - { - if (serverToRuntimeToJ2EE_!=null) - { - return serverToRuntimeToJ2EE_; - } - - //String[] servers = getStringArrayIntersection(getAllServerFactoryIds(), WebServiceClientTypeRegistry.getInstance().getAllClientServerFactoryIds()); - String[] servers = getAllServerFactoryIds(); - SelectionList serversList = new SelectionList(servers, 0); - Vector choices = new Vector(); - for (int i=0; i<servers.length; i++) - { - choices.add(getRuntimeChoices(servers[i])); - } - serverToRuntimeToJ2EE_ = new SelectionListChoices(serversList, choices); - return serverToRuntimeToJ2EE_; - - } - - private static SelectionListChoices getRuntimeChoices(String serverFactoryId) - { - - String[] runtimes = getRuntimeIDsByServerFactoryID(serverFactoryId); - SelectionList runtimesList = new SelectionList(runtimes, 0); - Vector choices = new Vector(); - for (int i=0; i<runtimes.length; i++) - { - choices.add(getJ2EEChoices(runtimes[i])); - } - return new SelectionListChoices(runtimesList, choices); - } - - private static SelectionListChoices getJ2EEChoices(String runtimeId) - { - //String[] serviceJ2EEVersions = getWebServiceRuntimeById(runtimeId).getJ2EEVersions(); - //String[] clientJ2EEVersions = WebServiceClientTypeRegistry.getInstance().getWebServiceRuntimeById(runtimeId).getJ2EEVersions(); - //String[] j2eeVersions = getStringArrayIntersection(serviceJ2EEVersions, clientJ2EEVersions); - WebServiceRuntimeInfo wsr = getWebServiceRuntimeById(runtimeId); - if (wsr==null) - { - return null; - } - - String[] j2eeVersions = wsr.getJ2eeLevels(); - SelectionList j2eeVersionsList = new SelectionList(j2eeVersions, 0); - return new SelectionListChoices(j2eeVersionsList, null); - } - - private static String[] getAllServerFactoryIds() - { - ArrayList ids = new ArrayList(); - if (serverFactoryIdByLabel_ == null) - { - serverFactoryIdByLabel_ = new Hashtable(); - Iterator iter = registry.webServiceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - WebServiceRuntimeInfo wsr = (WebServiceRuntimeInfo) iter.next(); - String[] sfids = wsr.getServerFactoryIds(); - for (int i = 0; i < sfids.length; i++) - { - if (!ids.contains(sfids[i])) - { - String label = getServerLabelById(sfids[i]); - if (label != null) - { - ids.add(sfids[i]); - serverFactoryIdByLabel_.put(label, sfids[i]); - } - } - } - } - } - else - { - Iterator fids = serverFactoryIdByLabel_.values().iterator(); - while (fids.hasNext()) - { - String fid = (String)fids.next(); - ids.add(fid); - } - } - - if (ids.size() > 0) - { - String[] serverFactoryIds = (String[])ids.toArray(new String[0]); - return serverFactoryIds; - } - - return null; - } - - private static String[] getRuntimeIDsByServerFactoryID(String serverFactoryID) - { - ArrayList ids = new ArrayList(); - Iterator iter = registry.webServiceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - WebServiceRuntimeInfo wsr = (WebServiceRuntimeInfo)iter.next(); - if (doesRuntimeSupportServer(wsr.getId(), serverFactoryID)) - { - ids.add(wsr.getId()); - } - - } - - if (ids.size() > 0) - { - String[] runtimeIds = (String[])ids.toArray(new String[0]); - return runtimeIds; - } - - return null; - - - } - - public static String getServerFactoryId(String label) - { - if (label==null || label.length()==0) - return null; - - if (serverFactoryIdByLabel_ == null) - { - getAllServerFactoryIds(); - } - - if (serverFactoryIdByLabel_.containsKey(label)) - { - return (String)serverFactoryIdByLabel_.get(label); - } - else - { - return null; - } - } - - public static String getRuntimeId(String label) - { - - if (label==null || label.length()==0) - return null; - - if (runtimeIdByLabel_ == null) - { - runtimeIdByLabel_ = new Hashtable(); - Iterator iter = registry.webServiceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - WebServiceRuntimeInfo wsr = (WebServiceRuntimeInfo)iter.next(); - runtimeIdByLabel_.put(wsr.getLabel(), wsr.getId()); - } - } - - return (String)runtimeIdByLabel_.get(label); - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeInfo.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeInfo.java deleted file mode 100644 index 0c880bc98..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeInfo.java +++ /dev/null @@ -1,209 +0,0 @@ -/* -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.Hashtable; -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.wst.ws.internal.provisional.wsrt.IWebServiceRuntime; - - -public class WebServiceRuntimeInfo { - - private IConfigurationElement elem_; - private Hashtable allServiceTypes_; - private Hashtable allClientTypes_; - - private String id; - private String label; - private ServiceType[] serviceTypes; - private ClientType[] clientTypes; - private java.lang.String[] servletLevels; - private java.lang.String[] j2eeLevels; - private java.lang.String[] runtimeIds; - private java.lang.String[] serverFactoryIds; - private String className; - private IWebServiceRuntime webServiceRuntime_; - - public WebServiceRuntimeInfo(IConfigurationElement elem_, Hashtable allServiceTypes_, Hashtable allClientTypes_) - { - super(); - this.elem_ = elem_; - this.allServiceTypes_ = allServiceTypes_; - this.allClientTypes_ = allClientTypes_; - } - - public String getClassName() - { - if (className==null) - { - className=elem_.getAttribute("class"); - } - return className; - } - - - public ClientType[] getClientTypes() - { - if (clientTypes==null) - { - String attr = elem_.getAttribute("clientTypes"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - clientTypes = new ClientType[size]; - for (int i = 0; i < clientTypes.length; i++) - { - String ctid = st.nextToken(); - clientTypes[i] = (ClientType)allClientTypes_.get(ctid); - } - } - } - return clientTypes; - } - - - public String getId() - { - if (id==null) - { - id = elem_.getAttribute("id"); - } - return id; - } - - - public String getLabel() - { - if (label==null) - { - label = elem_.getAttribute("label"); - } - return label; - } - - - public java.lang.String[] getJ2eeLevels() - { - if (j2eeLevels == null) - { - String attr = elem_.getAttribute("j2eeLevels"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - j2eeLevels = new String[size]; - for (int i = 0; i < j2eeLevels.length; i++) - j2eeLevels[i] = st.nextToken(); - } - } - - return j2eeLevels; - } - - - public java.lang.String[] getRuntimeIds() - { - if (runtimeIds == null) - { - String attr = elem_.getAttribute("runtimes"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - runtimeIds = new String[size]; - for (int i = 0; i < runtimeIds.length; i++) - runtimeIds[i] = st.nextToken(); - } - } - - return runtimeIds; - } - - - public java.lang.String[] getServerFactoryIds() - { - if (serverFactoryIds == null) - { - String attr = elem_.getAttribute("servers"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - serverFactoryIds = new String[size]; - for (int i = 0; i < serverFactoryIds.length; i++) - serverFactoryIds[i] = st.nextToken(); - } - } - return serverFactoryIds; - } - - - public ServiceType[] getServiceTypes() - { - if (serviceTypes==null) - { - String attr = elem_.getAttribute("serviceTypes"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - serviceTypes = new ServiceType[size]; - for (int i = 0; i < serviceTypes.length; i++) - { - String ctid = st.nextToken(); - serviceTypes[i] = (ServiceType)allServiceTypes_.get(ctid); - } - } - } - return serviceTypes; - } - - - public java.lang.String[] getServletLevels() - { - if (servletLevels==null) - { - String attr = elem_.getAttribute("servletLevels"); - if (attr != null && attr.length()>0) - { - StringTokenizer st = new StringTokenizer(attr, " "); - int size = st.countTokens(); - servletLevels = new String[size]; - for (int i = 0; i < servletLevels.length; i++) - servletLevels[i] = st.nextToken(); - } - } - return servletLevels; - } - - public IWebServiceRuntime getWebServiceRuntime() - { - if (webServiceRuntime_ == null) - { - try - { - webServiceRuntime_ = (IWebServiceRuntime)elem_.createExecutableExtension("class"); - } - catch(CoreException ce) - { - ce.printStackTrace(); - } - } - - return webServiceRuntime_; - } - -} |