diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption.ui/src/org')
156 files changed, 0 insertions, 28677 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties deleted file mode 100644 index 31eaa8160..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties +++ /dev/null @@ -1,559 +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 - -# -# 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} - - -# -# 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... - -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 - -# -# 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 -#BUTTON_DEPLOY_WEB_PROJECT=Deploy Web service to a server type -BUTTON_INSTALL_SERVICE_WEB_PROJECT=Install Web service on server -BUTTON_INSTALL_CLIENT_WEB_PROJECT=Install Web service client on server (managed clients only) -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={0} does not support the {1} Web service runtime. 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_SERVICE_RUNTIME_DOES_NOT_SUPPORT_PROJECT=The {0} Web service runtime does not support the service project {1}. -MSG_SERVICE_SERVER_DOES_NOT_SUPPORT_PROJECT=The {0} server does not support the service project {1}. -MSG_SERVICE_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE=The {0} Web service runtime does not support the service project type {1}. -MSG_SERVICE_SERVER_DOES_NOT_SUPPORT_TEMPLATE=The {0} server does not support the service project type {1}. - -MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_PROJECT=The {0} Web service runtime does not support the client project {1}. -MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_PROJECT=The {0} server does not support the client project {1}. -MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE=The {0} Web service runtime does not support the client project type {1}. -MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_TEMPLATE=The {0} server does not support the client project type {1}. - -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 Project type: -LABEL_SERVICE_TYPE=Service Project 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 -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 -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. - -# -# 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 - -# -# 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. - -# -# Tooltips for WebServiceClientRuntimeSelectionPage -# -TOOLTIP_PWCR_COMBO_CLIENT_TYPE=Client project type. -TOOLTIP_PWCR_COMBO_SERVICE_TYPE=Service project 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_INSTALL_SERVICE_WEB_PROJECT=Install the Web service on the server for this scenario. -TOOLTIP_PWPR_CHECKBOX_INSTALL_CLIENT_WEB_PROJECT=Install the Web service client on the server for this scenario (managed client only). -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 Compliance and 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. - -# -# Generate Handler Skeleton -# -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. - -# -# ClientHandlersWidgetDefaultingCommand -# -MSG_ERROR_WEB_SERVICE_CLIENTS_NOT_FOUND=No Web service clients were found. Create a Web service client before configuring Web service client handlers. - -# -# ServiceHandlersWidgetDefaultingCommand -# -MSG_ERROR_WEB_SERVICES_NOT_FOUND=No Web services were found. Create a Web service before configuring Web service handlers. -MSG_ERROR_WSDD_NOT_FOUND=Unable to launch handler wizard. No deployment descriptor was found for this Web service. -# -# 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=Wizard WSDL validation in Progress. \n- Click Cancel to cancel the current WSDL validation and continue. \n- Click Cancel and Update to update the preference to always cancel incomplete WSDL validation while traversing the wizard. \n- Click Wait to wait for WSDL validation to complete. -CANCEL_VALIDATION_LABEL=Cancel -CANCEL_VALIDATION_DESCRIPTION=Cancel the current WSDL validation and continue -CANCEL_ALL_VALIDATION_LABEL=Cancel and Update -CANCEL_ALL_VALIDATION_DESCRIPTION=Update the preference to always cancel incomplete WSDL validation while traversing the wizard. -WAIT_VALIDATION_LABEL=Wait -WAIT_VALIDATION_DESCRIPTION=Wait for WSDL validation to complete -TASK_LABEL_CHECK_WSDL_VALIDATION=Check for WSDL validation -TASK_DESC_CHECK_WSDL_VALIDATION=Check if WSDL validation has completed -WAIT_FOR_WSDL=Do not continue with wizard. Wait for WSDL validation to complete. - -# -# WSDLValidation messages -# -MESSAGE_VALIDATE_NO_WSDL=Wizard WSDL validation is disabled. -MESSAGE_VALIDATE_REMOTE_WSDL=Wizard WSDL validation is only enabled for remote files. -MESSAGE_VALIDATE_ALL_WSDL=Wizard WSDL validation is enabled. -MESSAGE_VALIDATE_IN_PROGRESS=WSDL validation in progress ... -ERROR_MESSAGES_IN_VALIDATION=The WSDL file contains validation error(s). -WARNING_MESSAGES_IN_VALIDATION=The WSDL file contains validation warning(s). -WARNING_IF_CONTINUE=Continuing with the wizard may result in generation or runtime problem. -VALIDATION_COMPLETED=WSDL validation completes with no warning or error. -TOOLTIP_VALIDATE_TEXT_MESSAGE_SUMMARY=WSDL validation preference can be changed using the Web Services Profile Compliance and Validation preference. - - -# -# 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 - -# -# Ant task List options -# - -# Note to translation do not translate keyword RuntimeId -MSG_INFO_ANT_RUNTIME_HEADING=Web Service Runtime IDs (RuntimeId) -MSG_INFO_ANT_SERVER_RUNTIME=Server runtime: {0} -MSG_INFO_ANT_CLIENT_RUNTIME=Client runtime: {0} - -# Note to translation do not translate keyword ServerId -MSG_INFO_ANT_SERVER_HEADING=Server IDs (ServerId) -MSG_INFO_ANT_SERVER=Server: {0} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUIMessages.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUIMessages.java deleted file mode 100644 index 22fc125c8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUIMessages.java +++ /dev/null @@ -1,327 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 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; - -import org.eclipse.osgi.util.NLS; - -public final class ConsumptionUIMessages extends NLS { - - private static final String BUNDLE_NAME = "org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUI";//$NON-NLS-1$ - - private ConsumptionUIMessages() { - // Do not instantiate - } - - public static String PLUGIN_NEW_WIZARD_NAME_WS_CLIENT; - public static String ACTION_GENERATE_JAVA_PROXY; - public static String CHECKBOX_SHOW_GENERATE_JAVA_PROXY_DIALOG; - public static String TOOLTIP_PPAD_CHECKBOX_WSDL2PROXY; - public static String TOOLTIP_SRPF_COMBO_SERVER; - public static String TOOLTIP_SRPF_COMBO_RUNTIME; - public static String TOOLTIP_SRPF_COMBO_J2EE; - public static String MSG_ERROR_TASK_EXCEPTED; - public static String MSG_ERROR_NO_SERVER_RUNTIME; - public static String LABEL_FOLDER_NAME; - public static String LABEL_JSP_FOLDER_NAME; - public static String LABEL_WEB_PROJECT_NAME; - public static String LABEL_WEBSERVICETYPE; - public static String LABEL_J2EE_VERSION; - public static String LABEL_NA; - public static String BUTTON_BROWSE; - public static String BUTTON_BROWSE_FILES; - public static String BOTTOMUP_LABEL; - public static String TOPDOWN_LABEL; - public static String CLIENT_LABEL; - public static String COMBINED_TYPE_AND_RUNTIME_LABEL; - public static String WIZARD_TITLE_WSC; - public static String PAGE_TITLE_WS_PROJECT; - public static String PAGE_DESC_WS_PROJECT; - public static String BUTTON_START_WEB_PROJECT; - public static String BUTTON_INSTALL_SERVICE_WEB_PROJECT; - public static String BUTTON_INSTALL_CLIENT_WEB_PROJECT; - public static String GROUP_SCENARIO_SERVICE; - public static String GROUP_SCENARIO_CLIENT; - public static String LABEL_WEBSERVICECLIENTTYPE; - public static String PAGE_TITLE_WS_RUNTIME_SELECTION; - public static String PAGE_DESC_WS_RUNTIME_SELECTION; - public static String LABEL_RUNTIMES_LIST; - public static String LABEL_SERVERS_LIST; - public static String LABEL_EDIT_BUTTON; - public static String LABEL_SERVICE_EAR_MODULE; - public static String LABEL_CLIENT_EAR_MODULE; - public static String LABEL_CLIENT_MODULE; - public static String LABEL_SERVICE_MODULE; - public static String LABEL_CLIENT_PROJECT; - public static String LABEL_SERVICE_PROJECT; - public static String LABEL_CLIENT_EAR_PROJECT; - public static String LABEL_SERVICE_EAR_PROJECT; - public static String LABEL_CLIENT_COMP_TYPE_WEB; - public static String LABEL_CLIENT_COMP_TYPE_EJB; - public static String LABEL_CLIENT_COMP_TYPE_APP_CLIENT; - public static String LABEL_CLIENT_COMP_TYPE_CONTAINERLESS; - public static String TOOLTIP_PWRS_TEXT_RUNTIME; - public static String TOOLTIP_PWRS_TEXT_SERVER; - public static String TOOLTIP_PWRS_J2EE_VERSION; - public static String LABEL_SELECTION_VIEW_TITLE; - public static String LABEL_SELECTION_VIEW_RUNTIME; - public static String LABEL_SELECTION_VIEW_SERVER; - public static String LABEL_SELECTION_VIEW_EXPLORE; - public static String LABEL_TREE_EXISTING_SERVERS; - public static String LABEL_TREE_SERVER_TYPES; - public static String MSG_INVALID_SRT_SELECTIONS; - public static String MSG_NO_RUNTIME; - public static String MSG_NO_SERVER; - public static String MSG_ERROR_STUB_ONLY; - public static String MSG_SERVER_TARGET_MISMATCH; - public static String MSG_J2EE_MISMATCH; - public static String MSG_SERVICE_PROJECT_EMPTY; - public static String MSG_SERVICE_EAR_EMPTY; - public static String MSG_CLIENT_PROJECT_EMPTY; - public static String MSG_CLIENT_EAR_EMPTY; - public static String MSG_INVALID_EJB_PROJECT; - public static String MSG_INVALID_WEB_PROJECT; - public static String MSG_INVALID_PROJECT_TYPE; - public static String MSG_MODULE; - public static String MSG_MODULE_NAME_AND_PROJECT_NAME_NOT_THE_SAME; - public static String MSG_SERVICE_RUNTIME_DOES_NOT_SUPPORT_PROJECT; - public static String MSG_SERVICE_SERVER_DOES_NOT_SUPPORT_PROJECT; - public static String MSG_SERVICE_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE; - public static String MSG_SERVICE_SERVER_DOES_NOT_SUPPORT_TEMPLATE; - public static String MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_PROJECT; - public static String MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_PROJECT; - public static String MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE; - public static String MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_TEMPLATE; - public static String MSG_SAME_CLIENT_AND_SERVICE_EARS; - public static String MSG_SAME_CLIENT_AND_SERVICE_COMPONENTS; - public static String MSG_SAME_CLIENT_AND_SERVICE_PROJECTS; - public static String MSG_WRONG_CLIENT_PROJECT_TYPE; - public static String MSG_CLIENT_SUB; - public static String MSG_SERVICE_SUB; - public static String MSG_GENERAL_PROJECT_AND_EAR; - public static String MSG_EAR_PROJECT_WILL_BE_CREATED; - public static String MSG_EAR_WILL_BE_ASSOCIATED; - public static String MSG_PROJECT_WILL_BE_CREATED; - public static String MSG_EAR_WILL_BE_CREATED; - public static String MSG_PROJECT_AND_EAR_CREATED; - public static String PAGE_TITLE_WS_CLIENT_RUNTIME_SELECTION; - public static String PAGE_DESC_WS_CLIENT_RUNTIME_SELECTION; - public static String LABEL_CLIENT_SELECTION_VIEW_TITLE; - public static String LABEL_CLIENT_TYPE; - public static String LABEL_SERVICE_TYPE; - public static String LABEL_WEB; - public static String LABEL_EJB; - public static String LABEL_NO_LABEL; - public static String PAGE_MSG_VALIDATION_INTERNAL_ERROR; - public static String PAGE_TITLE_WS_XML2BEAN; - public static String PAGE_DESC_N2P_MAPPINGS; - public static String MSG_MAPPING_DUPLICATE_ENTRIES; - public static String BUTTON_GENERATE_PROXY; - public static String PAGE_DESC_WSSKEL_CONFIG; - public static String PAGE_TITLE_WSSKEL_CONFIG; - public static String TOOLTIP_PBSC_TEXT_SKELETON_FOLDER; - public static String TOOLTIP_PBSC_BUTTON_SKELETON_FOLDER_BROWSE; - public static String LABEL_SKELETON_ROOT_NAME; - public static String LABEL_BEAN_CLASS_NAME; - public static String PAGE_MSG_BEAN_CANNOT_BE_EMPTY; - public static String BUTTON_BROWSE_CLASSES; - public static String PAGE_TITLE_WSTEST; - public static String PAGE_DESC_WSTEST; - public static String CHECKBOX_TEST_WEBSERVICE; - public static String CHECKBOX_MONITOR_WEBSERVICE; - public static String MSG_ERROR_UNABLE_TO_LAUNCH_WSDL_TEST; - public static String BUTTON_LAUNCH_SERVICE_TEST; - public static String PAGE_TITLE_WS_SAMPLE; - public static String PAGE_DESC_WS_SAMPLE; - public static String BUTTON_TEST; - public static String LABEL_TEST_TYPES; - public static String BUTTON_RUN_TEST; - public static String LABEL_METHODS; - public static String LABEL_JSP_PROJECT_NAME; - public static String MSG_ERROR_JTS_PROXY_NOT_COMPILED; - public static String MSG_ERROR_MALFORMED_URL; - public static String BUTTON_SELECT_ALL; - public static String BUTTON_DESELECT_ALL; - public static String TOOLTIP_PBME_BUTTON_SELECT_ALL; - public static String TOOLTIP_PBME_BUTTON_DESELECT_ALL; - public static String PAGE_TITLE_WSDL_SELECTION; - public static String PAGE_DESC_WSDL_SELECTION; - public static String PAGE_TITLE_WS_PUBLISH; - public static String PAGE_DESC_WS_PUBLISH; - public static String PAGE_TITLE_WS_FIND; - public static String PAGE_DESC_WS_FIND; - public static String BUTTON_WS_PUBLISH; - public static String BUTTON_WS_PUBLISH_PRIVATE_UDDI; - public static String BUTTON_WS_FIND; - public static String BUTTON_WS_FIND_PRIVATE_UDDI; - public static String LABEL_PUBLIC_UDDI_REGISTRIES; - public static String LABEL_EJB_BEAN_NAME; - public static String TABLE_TITLE_EJB_BEAN_NAMES; - public static String TABLE_TITLE_EJB_PROJECT_NAME; - public static String LABEL_EAR_PROJECTS; - public static String TOOLTIP_EAR_PROJECTS; - public static String TOOLTIP_TABLE_BEAN_NAMES; - public static String TOOLTIP_PWWS_PAGE; - public static String TOOLTIP_PBCL_PAGE; - public static String TOOLTIP_PBCL_TEXT_BEAN_CLASS; - public static String TOOLTIP_PBCL_BUTTON_BEAN_CLASS_BROWSE; - public static String TOOLTIP_PBCL_BUTTON_BEAN_RESOURCE_BROWSE; - public static String TOOLTIP_PSTP_COMBOBOX_TEST; - public static String TOOLTIP_PSTP_LAUNCH_BUTTON; - public static String TOOLTIP_PWRS_PAGE; - public static String TOOLTIP_PWRS_LIST_RUNTIMES; - public static String TOOLTIP_PWRS_LIST_SERVERS; - public static String TOOLTIP_PWRS_RADIO_SERVER; - public static String TOOLTIP_PWRS_RADIO_RUNTIME; - public static String TOOLTIP_PWRS_RADIO_EXPLORE; - public static String TOOLTIP_PWCR_COMBO_CLIENT_TYPE; - public static String TOOLTIP_PWCR_COMBO_SERVICE_TYPE; - public static String TOOLTIP_PWPR_COMBO_TYPE; - public static String TOOLTIP_PWPR_GROUP_SCENARIO_SERVICE; - public static String TOOLTIP_PWPR_CHECKBOX_GENERATE_PROXY; - public static String TOOLTIP_PWPR_CHECKBOX_START_WEB_PROJECT; - public static String TOOLTIP_PWPR_CHECKBOX_INSTALL_SERVICE_WEB_PROJECT; - public static String TOOLTIP_PWPR_CHECKBOX_INSTALL_CLIENT_WEB_PROJECT; - public static String TOOLTIP_PWPR_CHECKBOX_LAUNCH_WS; - public static String TOOLTIP_PWPR_CHECKBOX_TEST_SERVICE; - public static String TOOLTIP_PWPR_CHECKBOX_MONITOR_SERVICE; - public static String TOOLTIP_PWPR_GROUP_SCENARIO_CLIENT; - public static String TOOLTIP_PWPR_COMBO_CLIENTTYPE; - public static String TOOLTIP_PWPB_PAGE; - public static String TOOLTIP_PWPB_CHECKBOX_WS_LAUNCH; - public static String PAGE_WSIL_IMPORT; - public static String TITLE_WSIL_IMPORT; - public static String DESC_WSIL_IMPORT; - public static String PAGE_TITLE_WS_SELECTION; - public static String PAGE_DESC_WS_SELECTION; - public static String PAGE_MSG_LOADING_WEB_SERVICE_URI; - public static String PAGE_MSG_INVALID_WEB_SERVICE_URI; - public static String PAGE_MSG_NO_SUCH_FILE; - public static String PAGE_MSG_SELECTION_MUST_BE_WSDL; - public static String PAGE_MSG_INVALID_WSIL_FILE_NAME; - public static String MSG_ERROR_URI_NOT_RESOLVABLE; - public static String MSG_ERROR_WSDL_HAS_NO_SERVICE_ELEMENT; - public static String LABEL_WSIL_URI; - public static String LABEL_BROWSE; - public static String LABEL_WSDL; - public static String LABEL_WSDL_URI; - public static String LABEL_IMPORT; - public static String LABEL_ADD; - public static String LABEL_REMOVE; - public static String LABEL_WS_SELECTION; - public static String LABEL_SELECT_WSDL; - public static String LABEL_VALIDATE_MESSAGES; - public static String TOOLTIP_WSIL_IMPORT_PAGE; - public static String TOOLTIP_WSIL_TEXT_WSIL; - public static String TOOLTIP_WSIL_BUTTON_BROWSE_WSIL; - public static String TOOLTIP_WSIL_TABLE_WSDL; - public static String TOOLTIP_PCON_PAGE; - public static String TOOLTIP_PCON_TEXT_WS; - public static String TOOLTIP_PCON_BUTTON_BROWSE_WS; - public static String TOOLTIP_VALIDATE_TEXT_MESSAGE; - public static String TOOLTIP_TABLE_VALIDATE_MESSAGE; - public static String TOOLTIP_PWSM_PAGE; - public static String TOOLTIP_PWSM_CHECKBOX_TEST; - public static String TOOLTIP_PWSM_COMBOBOX_TEST; - public static String TOOLTIP_PWSM_CHECKBOX_LAUNCH; - public static String TOOLTIP_PWSM_TEXT_JSP_FOLDER; - public static String TOOLTIP_PWSM_BUTTON_JSP_FOLDER_BROWSE; - public static String TOOLTIP_PWSM_BUTTON_SELECT_ALL; - public static String TOOLTIP_PWSM_BUTTON_DESELECT_ALL; - public static String TOOLTIP_PWSM_COMBO_PROJECT; - public static String TOOLTIP_PWSM_TEXT_SAMPLE_FOLDER; - public static String TOOLTIP_PWSM_TREE_METHODS; - public static String TOOLTIP_PWSM_EAR_PROJECT; - public static String DIALOG_TITLE_HTTP_BASIC_AUTH; - public static String LABEL_URL; - public static String LABEL_HTTP_BASIC_AUTH_USERNAME; - public static String LABEL_HTTP_BASIC_AUTH_PASSWORD; - public static String TOOLTIP_HTTP_BASIC_AUTH_USERNAME; - public static String TOOLTIP_HTTP_BASIC_AUTH_PASSWORD; - public static String MSG_ERROR_GENERATE_HANDLER_SKELETON; - public static String MSG_ERROR_WRITE_FILE; - public static String LABEL_HANDLERS_CONFIG; - public static String LABEL_BUTTON_ADD; - public static String LABEL_BUTTON_REMOVE; - public static String LABEL_BUTTON_MOVE_UP; - public static String LABEL_BUTTON_MOVE_DOWN; - public static String LABEL_BUTTON_GEN_SKELETON; - public static String LABEL_COMBO_SOURCE_LOC; - public static String LABEL_COMBO_WS_CLIENT_REF; - public static String LABEL_COMBO_WS_SERVICE_DESC; - public static String LABEL_HANDLER_NAME; - public static String LABLE_HANDLER_CLASS; - public static String LABEL_HANDLER_PORT; - public static String DIALOG_TITLE_WS_ADD_HANDLER; - public static String LABEL_TEXT_HANDLER_NAME; - public static String LABEL_TEXT_HANDLER_CLASS; - public static String LABEL_TEXT_HANDLER_PORT; - public static String PAGE_TITLE_SERVICE_HDLR_CONFIG; - public static String PAGE_DESC_SERVICE_HDLR_CONFIG; - public static String PAGE_TITLE_CLIENT_HDLR_CONFIG; - public static String PAGE_DESC_CLIENT_HDLR_CONFIG; - public static String TOOLTIP_EDIT_WS_HANDLERS; - public static String TOOLTIP_BUTTON_GEN_SKELETON; - public static String TOOLTIP_COMBO_SOURCE_LOC; - public static String TOOLTIP_TEXT_HANDLER_NAME; - public static String TOOLTIP_TEXT_HANDLER_CLASS; - public static String TOOLTIP_TEXT_HANDLER_PORT; - public static String TOOLTIP_WS_CLIENT_REF; - public static String TOOLTIP_WS_SERVICE_DESC; - public static String MSG_ERROR_UNABLE_TO_OPEN_JAVA_EDITOR; - public static String MSG_WARN_IS_SERVICE_PROJECT; - public static String MSG_USER_ABORTED; - public static String MSG_MISSING_THIRD_PARTY_FILES; - public static String MSG_WARNING_NO_SERVICE_ELEMENT; - public static String STILL_VALIDATING_WSDL; - public static String CANCEL_VALIDATION_LABEL; - public static String CANCEL_VALIDATION_DESCRIPTION; - public static String CANCEL_ALL_VALIDATION_LABEL; - public static String CANCEL_ALL_VALIDATION_DESCRIPTION; - public static String WAIT_VALIDATION_LABEL; - public static String WAIT_VALIDATION_DESCRIPTION; - public static String TASK_LABEL_CHECK_WSDL_VALIDATION; - public static String TASK_DESC_CHECK_WSDL_VALIDATION; - public static String WAIT_FOR_WSDL; - public static String MESSAGE_VALIDATE_NO_WSDL; - public static String MESSAGE_VALIDATE_REMOTE_WSDL; - public static String MESSAGE_VALIDATE_ALL_WSDL; - public static String MESSAGE_VALIDATE_IN_PROGRESS; - public static String ERROR_MESSAGES_IN_VALIDATION; - public static String WARNING_MESSAGES_IN_VALIDATION; - public static String WARNING_IF_CONTINUE; - public static String VALIDATION_COMPLETED; - public static String TOOLTIP_VALIDATE_TEXT_MESSAGE_SUMMARY; - public static String PAGE_TITLE_WS_START_SERVER; - public static String PAGE_DESC_WS_START_SERVER; - public static String LABEL_START_SERVER_TEXT1; - public static String LABEL_START_SERVER_TEXT2; - public static String LABEL_START_SERVER_TEXT3; - public static String LABEL_START_SERVER_TEXT4; - public static String LABEL_START_SERVER_BUTTON; - public static String TOOLTIP_START_SERVER_BUTTON; - public static String TEXT_SERVER_STATUS; - public static String TEXT_SERVER_MSG; - public static String TEXT_SERVER_STARTED; - public static String TEXT_SERVER_STARTING; - public static String TEXT_SERVER_STOPPED; - public static String MSG_INFO_ANT_RUNTIME_HEADING; - public static String MSG_INFO_ANT_SERVER_RUNTIME; - public static String MSG_INFO_ANT_CLIENT_RUNTIME; - public static String MSG_INFO_ANT_SERVER_HEADING; - public static String MSG_INFO_ANT_SERVER; - public static String MSG_ERROR_WEB_SERVICE_CLIENTS_NOT_FOUND; - public static String MSG_ERROR_WEB_SERVICES_NOT_FOUND; - public static String MSG_ERROR_WSDD_NOT_FOUND; - - static { - NLS.initializeMessages(BUNDLE_NAME, ConsumptionUIMessages.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/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 1266fece9..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.core.context.TransientResourceContext; -import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment; -import org.eclipse.wst.command.internal.env.ui.eclipse.EclipseStatusHandler; -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/ant/AntClientRootCommandFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ant/AntClientRootCommandFragment.java deleted file mode 100644 index 12e2438ac..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ant/AntClientRootCommandFragment.java +++ /dev/null @@ -1,193 +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.ant; - -import org.eclipse.jst.ws.internal.consumption.common.ScenarioCleanupCommand; -import org.eclipse.jst.ws.internal.consumption.ui.command.AntDefaultingOperation; -import org.eclipse.jst.ws.internal.consumption.ui.command.CheckForServiceProjectCommand; -import org.eclipse.jst.ws.internal.consumption.ui.command.ListOptionsCommand; -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.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.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.FinishDefaultCommand; -import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; -import org.eclipse.wst.ws.internal.extensions.AssembleClientFragment; -import org.eclipse.wst.ws.internal.extensions.DeployClientFragment; -import org.eclipse.wst.ws.internal.extensions.DevelopClientFragment; - -/** - * - * Command fragment for generating a web service client using Ant task. - * Run headless Eclipse or within workspace using Run as Ant Build. This fragment eliminates any UI specific - * commands and data mappings between commands and widgets. Widget to command mappings are - * replaced by Ant property file to command mappings which are enabled by a antDataMapping extension - * point in the org.eclipse.wst.command.env plugin. - * - * @author joan - * - */ - -public class AntClientRootCommandFragment extends SequenceFragment{ - - public AntClientRootCommandFragment() - { - - add( new SimpleFragment( new ScenarioCleanupCommand(), "" )); - - add( new SimpleFragment(new ListOptionsCommand(), "")); - add (new SimpleFragment(new AntDefaultingOperation(), "")); - - add( new SimpleFragment( new ClientWizardWidgetDefaultingCommand(), "" ) ); - add( new SimpleFragment( new ClientWizardWidgetOutputCommand(), "" )); - add( new SimpleFragment( new WSDLSelectionWidgetDefaultingCommand(), "")); - - add( new SimpleFragment( new WSDLSelectionOutputCommand(), "")); - add( new SimpleFragment( new CheckWSDLValidationCommand(), "")); - add( new SimpleFragment( new ClientRuntimeSelectionWidgetDefaultingCommand(), "")); - - add( new SimpleFragment( new ClientExtensionDefaultingCommand( true ), "")); - add( new ClientRootFragment() ); - add( new SimpleFragment( new ClientExtensionOutputCommand(), "" ) ); - - 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 ClientWizardWidgetDefaultingCommand command. - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "TestService", 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); - - // Map ClientRuntimeSelectionWidgetDefaultingCommand command - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientRuntimeId", 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 AntDefaultingOperation - dataRegistry.addMapping(AntDefaultingOperation.class, "ClientIdsFixed", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(AntDefaultingOperation.class, "StartService", PreClientDevelopCommand.class); - dataRegistry.addMapping(AntDefaultingOperation.class, "InstallClient", PreClientDevelopCommand.class); - - // Map WSDLSelectionWidgetDefaultingCommand command. - 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, "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( ClientExtensionDefaultingCommand.class, "ClientRuntimeId", PreClientDevelopCommand.class ); - 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, "GenerateProxy", 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, "WsdlURI", ClientTestDelegateCommand.class); - - // Map ClientExtensionOutputCommand command. - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ServerInstanceId", FinishDefaultCommand.class); - - // MAP post server config call - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientProjectEAR", ClientExtensionOutputCommand.class, "EarProjectName", null); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientServerInstance", ClientExtensionOutputCommand.class, "ExistingServerId", null); - - //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 ); - - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntDefaultingOperation.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntDefaultingOperation.java deleted file mode 100644 index 9e0dfc093..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntDefaultingOperation.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import org.eclipse.core.commands.ExecutionException; -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.common.frameworks.datamodel.AbstractDataModelOperation; - -public class AntDefaultingOperation extends AbstractDataModelOperation{ - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - // TODO Auto-generated method stub - return Status.OK_STATUS; - } - - public boolean getServiceIdsFixed() - { - return true; - } - - public boolean getClientIdsFixed() - { - return true; - } - - public boolean getStartService() - { - return false; - } - - public boolean getInstallService() - { - return false; - } -} 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 1b4d032cc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java +++ /dev/null @@ -1,94 +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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 -{ - //SelectionListChoices runtime2ClientTypes; - String clientProjectName; - String wsdlURI; - WebServicesParser webServicesParser; - - public CheckForServiceProjectCommand() - { - } - - - public void setClientProjectName(String name) - { - clientProjectName = name; - } - - 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.env.core.common.Environment) - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment environment = getEnvironment(); - IStatus status = Status.OK_STATUS; - if (clientProjectName==null || wsdlURI==null || wsdlURI.length()==0 || webServicesParser==null) - return status; - - 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( NLS.bind(ConsumptionUIMessages.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( ConsumptionUIMessages.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 14c3c0b55..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java +++ /dev/null @@ -1,248 +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.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.eclipse.EnvironmentUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - - -public class GenerateHandlerSkeletonCommand extends AbstractDataModelOperation -{ - private IPath outputLocation_; - private String[] handlerNames_; - private boolean genSkeleton_; - private String handlerNameForEdit_ = null; - - public GenerateHandlerSkeletonCommand() - { - } - - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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( ConsumptionUIMessages.MSG_ERROR_GENERATE_HANDLER_SKELETON, new IStatus[0] ); - } - status.add(writeStatus); - } - } - - if (error) - { - env.getStatusHandler().reportError(status); - returnStatus = status; - } - - return returnStatus; - } - - private IStatus writeFile (IEnvironment 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( NLS.bind(ConsumptionUIMessages.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/ListOptionsCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/ListOptionsCommand.java deleted file mode 100644 index d51a7c21f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/ListOptionsCommand.java +++ /dev/null @@ -1,122 +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.command; - -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.core.commands.ExecutionException; -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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; - -/** - * Command lists valid property values where requested. - * Requests made via a Ant property value setting which is mapped to this command in the plugin.xml - */ - -public class ListOptionsCommand extends AbstractDataModelOperation { - - private boolean runtimes_ = false; - private boolean servers_ = false; - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - - if (runtimes_) - { - String[] typeIds = WebServiceRuntimeExtensionUtils2.getServiceTypeLabels().getIds_(); - Vector runtimeIds = new Vector(); - for (int k = 0; k < typeIds.length; k++) { - - String typeId = typeIds[k]; - String[] runtimes = WebServiceRuntimeExtensionUtils2.getRuntimesByServiceType(typeId); - - for (int j = 0; j < runtimes.length; j++) { - String runtime = runtimes[j]; - if (!runtimeIds.contains(runtime)) - { - runtimeIds.add(runtime); - } - } - } - - Status statusObj = new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - ConsumptionUIMessages.MSG_INFO_ANT_RUNTIME_HEADING, - null); - getEnvironment().getStatusHandler().reportInfo(statusObj); - - - for (Iterator iterator = runtimeIds.iterator(); iterator - .hasNext();) { - getEnvironment().getStatusHandler().reportInfo(new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - NLS.bind(ConsumptionUIMessages.MSG_INFO_ANT_SERVER_RUNTIME, - iterator.next()), null)); - } - - - String[] clientRuntimes = WebServiceRuntimeExtensionUtils2.getAllRuntimesForClientSide(); - - for (int i = 0; i < clientRuntimes.length; i++) { - - getEnvironment().getStatusHandler().reportInfo(new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - NLS.bind(ConsumptionUIMessages.MSG_INFO_ANT_CLIENT_RUNTIME, - clientRuntimes[i]), null)); - } - } - - if (servers_) - { - getEnvironment().getStatusHandler().reportInfo(new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - ConsumptionUIMessages.MSG_INFO_ANT_SERVER_HEADING, null)); - - IServerType[] serverTypes = ServerCore.getServerTypes(); - for (int i=0; i<serverTypes.length; i++) - { - getEnvironment().getStatusHandler().reportInfo(new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - NLS.bind(ConsumptionUIMessages.MSG_INFO_ANT_SERVER, - serverTypes[i].getId()), null)); - - } - } - - return OK_STATUS; - } - - public void setListRuntimes(boolean value) - { - runtimes_=value; - } - - public void setListServers(boolean value) - { - servers_=value; - } -} 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 deae7fbb1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.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 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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.progress.UIJob; -import org.eclipse.wst.common.frameworks.datamodel.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, NLS.bind(ConsumptionUIMessages.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, NLS.bind(ConsumptionUIMessages.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/PublishProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/PublishProjectCommand.java deleted file mode 100644 index 1336782f3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/PublishProjectCommand.java +++ /dev/null @@ -1,143 +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.command; - -import java.lang.reflect.InvocationTargetException; - -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.jface.operation.IRunnableWithProgress; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.core.common.ProgressUtils; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.internal.Server; - -public class PublishProjectCommand extends AbstractDataModelOperation -{ - - -private String project; -private String serverTypeID; -private IServer existingServer; - - -/** - * Default CTOR; - */ -public PublishProjectCommand() { -} - -/** - * Execute the command - */ -public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) -{ - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - try - { - ProgressUtils.report( monitor, ConsumptionMessages.PROGRESS_INFO_PUBLISH_WEB_PROJECT ); - - if (project == null){ - status = StatusUtils.errorStatus( ConsumptionMessages.MSG_ERROR_PROJECT_NOT_FOUND ); - env.getStatusHandler().reportError(status); - return status; - } - - IProject iProject = (IProject)ResourceUtils.findResource(project); - IServer instance = ServerUtils.getServerForModule(ServerUtils.getModule(iProject), serverTypeID, existingServer, true, monitor); - if (instance == null) - { - status = StatusUtils.errorStatus(ConsumptionMessages.MSG_ERROR_INSTANCE_NOT_FOUND); - env.getStatusHandler().reportError(status); - return status; - } - - if (((Server)instance).shouldPublish()) { - IStatus returnedStatus = publish(instance,IServer.PUBLISH_INCREMENTAL, monitor); - status = returnedStatus; - - //getStatusMonitor().reportStatus (instance.publish(getProgressMonitor())); - env.getLog().log(ILog.OK, 5026, this, "execute", new String("project="+project+" successfully published")); - //ILog.write(PublishProjectCommand.class,"execute",ILog.OK,"project="+project+" successfully published"); - } - return status; - } - catch (Exception e) { - status = StatusUtils.errorStatus(ConsumptionMessages.MSG_ERROR_PUBLISH, e); - env.getStatusHandler().reportError(status); - return status; - - } -} - -private IStatus publish(final IServer server, final int kind, IProgressMonitor monitor ) -{ - final IStatus[] istatus = new IStatus[1]; - istatus[0] = Status.OK_STATUS; - monitor.subTask(ConsumptionMessages.PROGRESS_INFO_PUBLISHING_SERVER); - - IRunnableWithProgress runnable = new IRunnableWithProgress() - { - public void run(IProgressMonitor shellMonitor) throws InvocationTargetException, InterruptedException - { - istatus[0] = server.publish(kind, shellMonitor); - } - }; - - try - { - PlatformUI.getWorkbench().getProgressService().run(true,false,runnable); - } - catch(InvocationTargetException ite) - { - istatus[0] = new org.eclipse.core.runtime.Status( IStatus.ERROR, "id", 0, ite.getMessage(), ite ); - ite.printStackTrace(); - } - catch(InterruptedException ie) - { - istatus[0] = new org.eclipse.core.runtime.Status( IStatus.ERROR, "id", 0, ie.getMessage(), ie ); - ie.printStackTrace(); - } - - return istatus[0]; -} - -public void setProject(String project) -{ - this.project = project; -} - -public void setServerTypeID(String serverTypeID) -{ - this.serverTypeID = serverTypeID; -} - -public void setExistingServer(IServer existingServer) -{ - this.existingServer = existingServer; -} - - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/StartServerCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/StartServerCommand.java deleted file mode 100644 index 1a42b5348..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/StartServerCommand.java +++ /dev/null @@ -1,204 +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.command; - -import java.lang.reflect.InvocationTargetException; - -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.debug.core.ILaunchManager; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.EnvironmentService; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.server.core.internal.Server; - -/** - * (Re)Starts and publishes the server specifed by the serverInstanceId attribute. - * - * - */ -public class StartServerCommand extends AbstractDataModelOperation -{ - private ILog log; - private boolean doAsyncPublish_; - - private String serverInstanceId; - - - public StartServerCommand() - { - log = EnvironmentService.getEclipseLog(); - doAsyncPublish_ = true; - } - - public StartServerCommand( boolean doAsyncPublish ) - { - this(); - - doAsyncPublish_ = doAsyncPublish; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - IServer server = ServerCore.findServer(serverInstanceId); - if (server == null) - { - status = StatusUtils.errorStatus(ConsumptionMessages.MSG_ERROR_INSTANCE_NOT_FOUND); - env.getStatusHandler().reportError(status); - return status; - } - - int serverState = server.getServerState(); - - // Publish if required - if (((Server)server).shouldPublish()) { - if (server.canPublish().getSeverity() == IStatus.OK) - { - status = publish(server, IServer.PUBLISH_INCREMENTAL, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - } - - // start/restart server if required - - switch (serverState) - { - case IServer.STATE_STOPPED: - if (server.canStart(ILaunchManager.RUN_MODE).getSeverity()==IStatus.OK) - { - status = start(server, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - break; - case IServer.STATE_STARTED: - boolean shouldRestart = ((Server)server).shouldRestart(); - - if (shouldRestart && server.canRestart(ILaunchManager.RUN_MODE).getSeverity()==IStatus.OK) - { - status = restart(server, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - } - - return status; - } - - private IStatus publish(final IServer server, final int kind, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - final IStatus[] istatus = new IStatus[1]; - monitor.subTask(ConsumptionMessages.PROGRESS_INFO_PUBLISHING_SERVER); - IRunnableWithProgress runnable = new IRunnableWithProgress() - { - public void run(IProgressMonitor shellMonitor) throws InvocationTargetException, InterruptedException - { - istatus[0] = server.publish(kind, shellMonitor); - } - }; - - try - { - if( doAsyncPublish_ ) - { - PlatformUI.getWorkbench().getProgressService().run(true,false,runnable); - } - else - { - runnable.run( monitor ); - } - - } - catch(InvocationTargetException ite) - { - istatus[0] = new org.eclipse.core.runtime.Status( IStatus.ERROR, "id", 0, ite.getMessage(), ite ); - ite.printStackTrace(); - } - catch(InterruptedException ie) - { - istatus[0] = new org.eclipse.core.runtime.Status( IStatus.ERROR, "id", 0, ie.getMessage(), ie ); - ie.printStackTrace(); - } - - - if (istatus[0].getSeverity() != IStatus.OK) - { - status = istatus[0]; - return status; - } - - log.log(ILog.INFO, 5051, this, "publishProject", "IServer=" + server + ", Publish command completed"); - return status; - } - - private IStatus restart(IServer server, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - try - { - monitor.subTask(ConsumptionMessages.PROGRESS_INFO_STARTING_SERVER); - server.synchronousRestart(ILaunchManager.RUN_MODE, monitor); - log.log(ILog.INFO, 5052, this, "execute", "IServer=" + server + ", Restart command completed"); - return status; - } catch (CoreException e) - { - status = StatusUtils.errorStatus(ConsumptionMessages.MSG_ERROR_SERVER, e); - return status; - } - - } - - private IStatus start(IServer server, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - try - { - monitor.subTask(ConsumptionMessages.PROGRESS_INFO_STARTING_SERVER); - server.synchronousStart(ILaunchManager.RUN_MODE, monitor); - log.log(ILog.INFO, 5053, this, "execute", "IServer=" + server + ", Start command completed"); - return status; - } catch (CoreException e) - { - status = StatusUtils.errorStatus(ConsumptionMessages.MSG_ERROR_SERVER, e); - return status; - } - } - - public void setServerInstanceId(String serverInstanceId) - { - this.serverInstanceId = serverInstanceId; - } -} 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 ed3332a3c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java +++ /dev/null @@ -1,78 +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.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.WstWSPluginMessages; -import org.eclipse.wst.ws.internal.plugin.WSPlugin; -import org.eclipse.wst.ws.internal.preferences.PersistentWSIAPContext; -import org.eclipse.wst.ws.internal.preferences.PersistentWSISSBPContext; -import org.eclipse.wst.ws.internal.preferences.WSIComplianceUtils; - - - -public class WSINonCompliantRuntimeCommand extends AbstractDataModelOperation -{ - - private IProject serviceProject_; - - public WSINonCompliantRuntimeCommand() - { - } - - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment environment = getEnvironment(); - - PersistentWSISSBPContext wsiSSBPContext = WSPlugin.getInstance().getWSISSBPContext(); - PersistentWSIAPContext wsiAPContext = WSPlugin.getInstance().getWSIAPContext(); - Vector statusSSBP = new Vector(); - statusSSBP.add( new Status( WSIComplianceUtils.getWSISeverity(serviceProject_, wsiSSBPContext), "id", 0, - WstWSPluginMessages.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, - WstWSPluginMessages.WSI_AP_INCOMPLIANT_RUNTIME, null )); - Status[] statusesAP = (Status[]) statusAP.toArray(new Status[statusAP.size()]); - - if (WSIComplianceUtils.checkWSICompliance (environment.getStatusHandler(), statusesAP, serviceProject_, wsiAPContext)) - { - if (WSIComplianceUtils.checkWSICompliance (environment.getStatusHandler(), statusesSSBP, serviceProject_, wsiSSBPContext)) - { - return Status.OK_STATUS; - } - else - { - return StatusUtils.errorStatus( WstWSPluginMessages.NOT_OK ); - } - } - else - { - return StatusUtils.errorStatus( WstWSPluginMessages.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 8387d2e62..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/EclipseIPath2URLStringTransformer.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.command.data; - -import java.net.MalformedURLException; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.wst.command.internal.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 37c5817d7..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.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 3ba0cd072..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.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.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 e1160c50a..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.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 6943c0fee..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), 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 d7dd937fc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java +++ /dev/null @@ -1,496 +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.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -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.CoreException; -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.server.core.FacetUtil; -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.common.FacetUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.selection.SelectionListChoices; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.common.project.facet.core.VersionFormatException; -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.ws.internal.parser.wsil.WebServicesParser; - -/** - * - */ -public class ValidationUtils -{ - - /** - * - */ - public ValidationUtils() - { - } - - public boolean doesServerSupportProject(String serverFactoryId, String projectName) - { - IProject project = ProjectUtilities.getProject(projectName); - IFacetedProject fProject = null; - if (project.exists()) - { - try - { - fProject = ProjectFacetsManager.create(project); - } catch (CoreException ce) - { - - } - - if (fProject != null) - { - Set facets = fProject.getProjectFacets(); - return doesServerSupportFacets(serverFactoryId, facets); - } - else - { - //If it's not a faceted project, we have nothing to compare to - assume it's good. - return true; - } - } - else - { - //If the project doesn't exist, we have nothing to compare to - assume it's good. - return true; - } - - } - - public boolean doesServerSupportFacets(String serverFactoryId, Set facets) - { - Set runtimes = FacetUtils.getRuntimes(new Set[]{facets}); - Iterator itr = runtimes.iterator(); - IServerType st = ServerCore.findServerType(serverFactoryId); - String runtimeTypeId = st.getRuntimeType().getId(); - while (itr.hasNext()) - { - org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)itr.next(); - IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - if (runtimeTypeId.equals(sRuntime.getRuntimeType().getId())) - { - //found a match - return true; - } - } - - return false; - } - - public boolean doesServerSupportTemplate(String serverFactoryId, String templateId) - { - IFacetedProjectTemplate template = ProjectFacetsManager.getTemplate(templateId); - Set templateFacets = template.getFixedProjectFacets(); - Iterator templateFacetsItr = templateFacets.iterator(); - while (templateFacetsItr.hasNext()) - { - boolean serverSupportsThisOne = false; - IProjectFacet fixedFacet = (IProjectFacet)templateFacetsItr.next(); - List versions = null; - try - { - versions = fixedFacet.getSortedVersions(true); - } catch (VersionFormatException e) - { - Set versionSet = fixedFacet.getVersions(); - Iterator itr = versionSet.iterator(); - versions = new ArrayList(); - while (itr.hasNext()) - { - versions.add(itr.next()); - } - } catch (CoreException e) - { - Set versionSet = fixedFacet.getVersions(); - Iterator itr = versionSet.iterator(); - versions = new ArrayList(); - while (itr.hasNext()) - { - versions.add(itr.next()); - } - } - Iterator versionsItr = versions.iterator(); - while(versionsItr.hasNext()) - { - IProjectFacetVersion pfv = (IProjectFacetVersion)versionsItr.next(); - Set pfvs = new HashSet(); - pfvs.add(pfv); - if (doesServerSupportFacets(serverFactoryId, pfvs)) - { - serverSupportsThisOne = true; - break; - } - } - - if (!serverSupportsThisOne) - { - return false; - } - } - - return true; - } - - 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( NLS.bind(ConsumptionUIMessages.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); - if (projectJ2EELevel!=-1) - { - String projectJ2EELevelString = String.valueOf(projectJ2EELevel); - if (j2eeLevel!=null && j2eeLevel.length()>0) - { - if (!projectJ2EELevelString.equals(j2eeLevel)) - { - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.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 = NLS.bind(ConsumptionUIMessages.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 ConsumptionUIMessages.LABEL_CLIENT_COMP_TYPE_WEB; - } - else if (type.equals(IModuleConstants.JST_EJB_MODULE)) - { - return ConsumptionUIMessages.LABEL_CLIENT_COMP_TYPE_EJB; - } - else if (type.equals(IModuleConstants.JST_APPCLIENT_MODULE)) - { - return ConsumptionUIMessages.LABEL_CLIENT_COMP_TYPE_APP_CLIENT; - } - else if (type.equals(IModuleConstants.JST_UTILITY_MODULE)) - { - return ConsumptionUIMessages.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 d5fed5a39..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/ClientRootFragment.java +++ /dev/null @@ -1,110 +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.data.DataMappingRegistry; -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.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, "Context", 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 ); - registry.addMapping( PreClientDevelopCommand.class, "Context", 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 85c79de42..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientAssembleCommand.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.AssociateModuleWithEARCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateModuleCommand; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.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 ) - { - IEnvironment environment = getEnvironment(); - - // 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( monitor, adaptable ); - 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( monitor, adaptable ); - 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 28203c621..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.common.frameworks.datamodel.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 68e23e0b6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java +++ /dev/null @@ -1,260 +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 java.util.Set; - -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.CreateFacetedProjectCommand; -import org.eclipse.jst.ws.internal.consumption.common.FacetMatcher; -import org.eclipse.jst.ws.internal.consumption.common.FacetUtils; -import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.wsrt.IContext; -import org.eclipse.wst.ws.internal.wsrt.ISelection; -import org.eclipse.wst.ws.internal.wsrt.IWebService; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime; -import org.eclipse.wst.ws.internal.wsrt.SimpleContext; -import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo; -import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario; -import org.eclipse.wst.ws.internal.wsrt.WebServiceState; - -public class PreClientDevelopCommand extends AbstractDataModelOperation -{ - - private TypeRuntimeServer typeRuntimeServer_; - private String clientRuntimeId_; - 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 boolean install_; - private boolean run_; - private String wsdlURI_; - private Object dataObject_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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 = WebServiceRuntimeExtensionUtils2 - .getClientRuntime(clientRuntimeId_); - WebServiceClientInfo wsInfo = new WebServiceClientInfo(); - - 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, install_, run_, true, test_, - false, scenario, resourceContext_.isOverwriteFilesEnabled(), - resourceContext_.isCreateFoldersEnabled(), resourceContext_ - .isCheckoutFilesEnabled()); - - IStatus status = Status.OK_STATUS; - - // Create the client module if needed. - IProject project = ProjectUtilities.getProject(project_); - if (!project.exists()) - { - RequiredFacetVersion[] rfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRequiredFacetVersions(); - Set facetVersions = FacetUtils.getInitialFacetVersionsFromTemplate(moduleType_); - FacetMatcher fm = FacetUtils.match(rfv, facetVersions); - if (fm.isMatch()) - { - CreateFacetedProjectCommand command = new CreateFacetedProjectCommand(); - command.setProjectName(project_); - command.setTemplateId(moduleType_); - command.setRequiredFacetVersions(rfv); - command.setServerFactoryId(typeRuntimeServer_.getServerId()); - command.setServerInstanceId(typeRuntimeServer_.getServerInstanceId()); - //command.setFacetMatcher(fm); - status = command.execute( monitor, adaptable ); - if (status.getSeverity() == Status.ERROR) - { - environment.getStatusHandler().reportError( status ); - return status; - } - } - } - - //The project should now exist. Add facets if needed. - RequiredFacetVersion[] rfvs = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRequiredFacetVersions(); - status = FacetUtils.addRequiredFacetsToProject(project, rfvs, monitor); - if (status.getSeverity() == Status.ERROR) - { - environment.getStatusHandler().reportError( status ); - return status; - } - - return status; - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer typeRuntimeServer ) - { - typeRuntimeServer_ = typeRuntimeServer; - } - - public void setClientRuntimeId( String id) - { - clientRuntimeId_ = id; - } - - 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 setInstallClient(boolean installClient) - { - install_ = installClient; - } - - public void setTestService(boolean testService) - { - test_ = testService; - } - - public void setStartService(boolean startService) - { - run_ = startService; - } - - 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 c07be6b7f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientInstallCommand.java +++ /dev/null @@ -1,113 +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.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.wsrt.IContext; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient; - -public class PreClientInstallCommand extends AbstractDataModelOperation -{ - private IWebServiceClient webServiceClient_; - private String project_; - private String module_; - private String earProject_; - private String ear_; - private IContext context_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - if (context_.getInstall()) - { - IEnvironment 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; - } - return Status.OK_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; - } - - public void setContext(IContext context) - { - context_ = context; - } -} 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 bc4870109..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientRunCommand.java +++ /dev/null @@ -1,60 +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.ui.command.StartServerCommand; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.wsrt.IContext; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient; - -public class PreClientRunCommand extends AbstractDataModelOperation -{ - private IWebServiceClient webServiceClient_; - private IContext context_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - if (context_.getRun()) - { - IEnvironment environment = getEnvironment(); - - StartServerCommand command = new StartServerCommand(); - command.setServerInstanceId(webServiceClient_.getWebServiceClientInfo().getServerInstanceId()); - command.setEnvironment( environment ); - status = command.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - environment.getStatusHandler().reportError( status ); - } - } - - return status; - } - - - public void setWebService( IWebServiceClient webServiceClient ) - { - webServiceClient_ = webServiceClient; - } - - public void setContext(IContext context) - { - context_=context; - } -} 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 73175bb03..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/plugin/WebServiceConsumptionUIPlugin.java +++ /dev/null @@ -1,147 +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.PersistentProjectTopologyContext; -import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext; -import org.eclipse.jst.ws.internal.consumption.ui.preferences.ProjectTopologyContext; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.command.internal.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 -{ - - /** - * 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_; - private PersistentProjectTopologyContext projectTopologyContext_; - - /** - * 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 ProjectTopologyContext getProjectTopologyContext() - { - if (projectTopologyContext_ == null) - { - projectTopologyContext_ = new PersistentProjectTopologyContext(); - projectTopologyContext_.load(); - } - - return projectTopologyContext_; - } - - 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/PersistentProjectTopologyContext.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/PersistentProjectTopologyContext.java deleted file mode 100644 index 774c1dea0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/PersistentProjectTopologyContext.java +++ /dev/null @@ -1,77 +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.preferences; - -import java.util.StringTokenizer; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.wst.command.internal.env.context.PersistentContext; - - -public class PersistentProjectTopologyContext extends PersistentContext implements ProjectTopologyContext -{ - - public PersistentProjectTopologyContext () - { - super( WebServiceConsumptionUIPlugin.getInstance()); - } - - public void load() - { - String[] ids = ProjectTopologyDefaults.getClientTypes(); - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < ids.length; i++) - { - if (i != 0) - sb.append(" "); - sb.append(ids[i]); - } - setDefault(PREFERENCE_CLIENT_TYPES, sb.toString()); - setDefault(PREFERENCE_USE_TWO_EARS, ProjectTopologyDefaults.isUseTwoEARs()); - } - - public void setClientTypes(String[] ids) - { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < ids.length; i++) - { - if (i != 0) - sb.append(" "); - sb.append(ids[i]); - } - setValue(PREFERENCE_CLIENT_TYPES, sb.toString()); - } - - public String[] getClientTypes() - { - StringTokenizer st = new StringTokenizer(getValueAsString(PREFERENCE_CLIENT_TYPES)); - String[] s = new String[st.countTokens()]; - for (int i = 0; i < s.length; i++) - s[i] = st.nextToken(); - return s; - } - - public void setUseTwoEARs(boolean use) - { - setValue(PREFERENCE_USE_TWO_EARS, use); - } - public boolean isUseTwoEARs() - { - return getValueAsBoolean(PREFERENCE_USE_TWO_EARS); - } - - public ProjectTopologyContext copy() { - TransientProjectTopologyContext context = new TransientProjectTopologyContext(); - context.setClientTypes(getClientTypes()); - context.setUseTwoEARs(isUseTwoEARs()); - return context; -} -} 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 558e6b804..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/PersistentServerRuntimeContext.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.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"; - - 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); - } - - } - - public String getDefaultServerFactoryId() - { - return getDefaultString(PREFERENCE_SERVER); - } - - public String getDefaultRuntimeId() - { - return getDefaultString(PREFERENCE_RUNTIME); - } - - 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 void setServerFactoryId(String id) - { - setValue(PREFERENCE_SERVER,id); - } - - public void setRuntimeId(String id) - { - setValue(PREFERENCE_RUNTIME, id); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyContext.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyContext.java deleted file mode 100644 index 023ad738f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyContext.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.preferences; - -public interface ProjectTopologyContext -{ - /** - * This constant String is used to lookup the preferred order of the different client types - **/ - public static final String PREFERENCE_CLIENT_TYPES = "clientTypes"; - - /** - * This constant String is used to lookup the two EAR option - **/ - public static final String PREFERENCE_USE_TWO_EARS = "useTwoEARs"; - - public void setClientTypes(String[] ids); - public String[] getClientTypes(); - - public void setUseTwoEARs(boolean use); - public boolean isUseTwoEARs(); - - public ProjectTopologyContext copy(); -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyDefaults.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyDefaults.java deleted file mode 100644 index 113183c2b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyDefaults.java +++ /dev/null @@ -1,27 +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.preferences; - -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; - -public class ProjectTopologyDefaults -{ - public static final String[] getClientTypes() - { - return WebServiceRuntimeExtensionUtils2.getAllClientProjectTypes(); - } - - public static final boolean isUseTwoEARs() - { - return true; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyPreferencePage.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyPreferencePage.java deleted file mode 100644 index 23b613b6c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyPreferencePage.java +++ /dev/null @@ -1,293 +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.preferences; - -import java.util.Vector; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IStructuredContentProvider; -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.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.ui.WSUIPluginMessages; -import org.eclipse.jst.ws.internal.ui.plugin.WebServiceUIPlugin; -import org.eclipse.swt.SWT; -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.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - - - -public class ProjectTopologyPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, SelectionListener -{ - /*CONTEXT_ID PTPP0001 for the Project Topology Preference Page*/ - private String INFOPOP_PTPP_PAGE = WebServiceUIPlugin.ID + ".PPTP0001"; - - private TableViewer clientTypeViewer_; - private Button moveUp_; - private Button moveDown_; - private Vector clientTypes_; - - private Button twoEAR_; - - /** - * Creates preference page controls on demand. - * @param parent the parent for the preference page - */ - protected Control createContents(Composite superparent) - { - Composite parent = new Composite( superparent, SWT.NONE ); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - parent.setLayout( layout ); - parent.setToolTipText(WSUIPluginMessages.TOOLTIP_PTPP_PAGE); - parent.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,INFOPOP_PTPP_PAGE); - - Text clientTypeLabel = new Text(parent, SWT.READ_ONLY | SWT.WRAP); - clientTypeLabel.setText(WSUIPluginMessages.LABEL_CLIENT_TYPE_NAME); - clientTypeLabel.setLayoutData( new GridData( GridData.FILL_HORIZONTAL)); - - Composite clientTypeComposite = new Composite(parent, SWT.NONE); - GridLayout gl = new GridLayout(); - gl.numColumns = 2; - gl.marginHeight = 0; - gl.marginWidth = 0; - clientTypeComposite.setLayout(gl); - clientTypeComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL )); - - Table table= new Table(clientTypeComposite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); - GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); - gd.widthHint = 256; - table.setLayoutData(gd); - table.setToolTipText(WSUIPluginMessages.TOOLTIP_CLIENT_TYPE_TABLE_VIEWER); - - clientTypes_ = new Vector(); - clientTypeViewer_ = new TableViewer(table); - clientTypeViewer_.setContentProvider(new ClientTypeContentProvider()); - clientTypeViewer_.setLabelProvider(new ClientTypeLabelProvider()); - clientTypeViewer_.setInput(clientTypes_); - - TableLayout tableLayout = new TableLayout(); - TableColumn tableColumn = new TableColumn(table, SWT.NONE); - tableColumn.setText(WSUIPluginMessages.LABEL_CLIENT_TYPE_NAME); - ColumnWeightData columnData = new ColumnWeightData(256, 256, false); - tableLayout.addColumnData(columnData); - table.setLayout(tableLayout); - - Composite c = new Composite(clientTypeComposite, SWT.NONE); - gl = new GridLayout(); - gl.numColumns = 1; - gl.marginHeight = 10; - gl.marginWidth = 0; - c.setLayout(gl); - - moveUp_ = new Button(c, SWT.PUSH); - moveUp_.setText(WSUIPluginMessages.LABEL_MOVE_UP); - moveUp_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - moveUp_.addSelectionListener(this); - moveUp_.setToolTipText(WSUIPluginMessages.TOOLTIP_MOVE_UP); - - moveDown_ = new Button(c, SWT.PUSH); - moveDown_.setText(WSUIPluginMessages.LABEL_MOVE_DOWN); - moveDown_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - moveDown_.addSelectionListener(this); - moveDown_.setToolTipText(WSUIPluginMessages.TOOLTIP_MOVE_DOWN); - - twoEAR_ = new Button(parent, SWT.CHECK | SWT.WRAP ); - twoEAR_.setText(WSUIPluginMessages.LABEL_ENABLE_TWO_EARS); - twoEAR_.setToolTipText(WSUIPluginMessages.TOOLTIP_ENABLE_TWO_EARS); - - initializeValues(); - org.eclipse.jface.dialogs.Dialog.applyDialogFont(superparent); - - return parent; - } - - /** - * Does anything necessary because the default button has been pressed. - */ - protected void performDefaults() - { - super.performDefaults(); - initializeDefaults(); - } - - /** - * 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; - } - - protected void performApply() - { - performOk(); - } - - /** - * @see IWorkbenchPreferencePage - */ - public void init(IWorkbench workbench) { } - - /** - * Initializes states of the controls to their burned-in defaults. - */ - private void initializeDefaults() - { - clientTypes_.clear(); - String[] types = ProjectTopologyDefaults.getClientTypes(); - - for (int i = 0; i < types.length; i++) - { - clientTypes_.add(types[i]); - } - - clientTypeViewer_.refresh(); - twoEAR_.setSelection(true); - } - - /** - * Initializes states of the controls from the preference helper. - */ - private void initializeValues() - { - ProjectTopologyContext context = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - String[] types = context.getClientTypes(); - for (int i = 0; i < types.length; i++) - clientTypes_.add(types[i]); - // check whether we missed any types from the default list - boolean missed = false; - types = ProjectTopologyDefaults.getClientTypes(); - for (int i = 0; i < types.length; i++) - { - if (clientTypes_.indexOf(types[i]) == -1) - { - clientTypes_.add(types[i]); - missed = true; - } - } - if (missed) - { - types = new String[clientTypes_.size()]; - clientTypes_.copyInto(types); - context.setClientTypes(types); - } - // refresh viewer - clientTypeViewer_.refresh(); - twoEAR_.setSelection(context.isUseTwoEARs()); - } - - /** - * Stores the values of the controls back to the preference helper. - */ - private void storeValues() - { - ProjectTopologyContext context = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - String[] types = new String[clientTypes_.size()]; - clientTypes_.copyInto(types); - context.setClientTypes(types); - context.setUseTwoEARs(twoEAR_.getSelection()); - } - - public void widgetDefaultSelected(SelectionEvent e) - { - } - - public void widgetSelected(SelectionEvent e) - { - int index = clientTypeViewer_.getTable().getSelectionIndex(); - if (index != -1) - { - if (e.widget == moveUp_ && index > 0) - { - Object object = clientTypes_.remove(index); - clientTypes_.insertElementAt(object, index-1); - clientTypeViewer_.refresh(); - } - else if (e.widget == moveDown_ && index < clientTypes_.size()-1) - { - Object object = clientTypes_.remove(index); - clientTypes_.insertElementAt(object, index+1); - clientTypeViewer_.refresh(); - } - } - } - - private class ClientTypeContentProvider implements IStructuredContentProvider - { - /** - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object) - */ - public Object[] getElements(Object value) - { - return ((Vector)value).toArray(new String[0]); - } - - /** - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - public void dispose() - { - } - - /** - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object) - */ - public void inputChanged(Viewer arg0, Object arg1, Object arg2) - { - } - } - - private class ClientTypeLabelProvider extends LabelProvider - { - public ClientTypeLabelProvider() - { - } - - /** - * @see org.eclipse.jface.viewers.ILabelProvider#getImage(Object) - */ - public Image getImage(Object arg0) - { - return null; - } - - /** - * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object) - */ - public String getText(Object value) - { - IFacetedProjectTemplate template = ProjectFacetsManager.getTemplate( (String)value ); - - return template.getLabel(); - } - } -} 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 54f647fb6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java +++ /dev/null @@ -1,346 +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.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -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.env.core.selection.SelectionListChoices; - - -/** - * - */ -public class ServerRuntimePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener -{ - private String pluginId_= "org.eclipse.jst.ws.consumption.ui"; - - /* 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) - { - UIUtils uiUtils = new UIUtils(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,ConsumptionUIMessages.LABEL_SERVERS_LIST, - ConsumptionUIMessages.TOOLTIP_SRPF_COMBO_SERVER, - INFOPOP_SRPF_SERVER_PREF, - SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY); - - runtime_ = uiUtils.createCombo(page,ConsumptionUIMessages.LABEL_RUNTIMES_LIST, - ConsumptionUIMessages.TOOLTIP_SRPF_COMBO_RUNTIME, - INFOPOP_SRPF_RUNTIME_PREF, - SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY); - -/* - j2eeVersion_ = uiUtils.createCombo(page,ConsumptionUIMessages.LABEL_J2EE_VERSION, - ConsumptionUIMessages.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_ = WebServiceRuntimeExtensionUtils2.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); - } - - public void handleEvent(Event event) - { - if (server_ == event.widget) - { - handleServerSelected(); - } - else if (runtime_ == event.widget) - { - handleRuntimeSelected(); - } - } - - 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); - - startListening(); - } - - private void handleRuntimeSelected() - { - stopListening(); - - String selectedText = getRuntimeSelection(); - serverToRuntimeToJ2EE_.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); - } - - /** - * 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()); - } - - protected void performApply() - { - performOk(); - } - - - private void startListening() - { - server_.addListener(SWT.Selection,this); - runtime_.addListener(SWT.Selection,this); - } - - private void stopListening() - { - server_.removeListener(SWT.Selection, this); - runtime_.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 = WebServiceRuntimeExtensionUtils2.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] = WebServiceRuntimeExtensionUtils2.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] = ConsumptionUIMessages.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 WebServiceRuntimeExtensionUtils2.getServerFactoryId(serverLabel); - } - - private String getRuntimeSelection() - { - String runtimeLabel = runtime_.getText(); - //return WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeId(runtimeLabel); - return WebServiceRuntimeExtensionUtils2.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 = WebServiceRuntimeExtensionUtils2.getServerLabelById(factoryId); - setSelection(server_,label); - } - - private void setRuntimeSelection(String id) - { - //String label = WebServiceServerRuntimeTypeRegistry.getInstance().getRuntimeLabel(id); - String label = WebServiceRuntimeExtensionUtils2.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/preferences/TransientProjectTopologyContext.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/TransientProjectTopologyContext.java deleted file mode 100644 index 0737788d8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/TransientProjectTopologyContext.java +++ /dev/null @@ -1,46 +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.preferences; - - -public class TransientProjectTopologyContext implements ProjectTopologyContext -{ - private String[] clientTypes; - private boolean twoEARs; - - public TransientProjectTopologyContext () {} - - public void setClientTypes(String[] clientTypes) - { - this.clientTypes = clientTypes; - } - public String[] getClientTypes() - { - return clientTypes; - } - - public void setUseTwoEARs(boolean use) - { - this.twoEARs = use; - } - public boolean isUseTwoEARs() - { - return twoEARs; - } - - public ProjectTopologyContext copy() { - TransientProjectTopologyContext context = new TransientProjectTopologyContext(); - context.setClientTypes(getClientTypes()); - context.setUseTwoEARs(isUseTwoEARs()); - return context; - } -} 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 932c8af51..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.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 4a5a76d41..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartClientWidgetContributor.java +++ /dev/null @@ -1,54 +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.ConsumptionUIMessages; -import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetContributorFactory; -import org.eclipse.wst.server.core.IServer; - -public class StartClientWidgetContributor implements INamedWidgetContributor -{ - private IServer server_; - - public StartClientWidgetContributor( IServer server ) - { - server_ = server; - } - - public String getDescription() - { - return ConsumptionUIMessages.PAGE_DESC_WS_START_SERVER; - } - - public String getName() - { - return ""; - } - - public String getTitle() - { - return ConsumptionUIMessages.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 ba92ff807..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartClientWidgetFactory.java +++ /dev/null @@ -1,65 +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.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.INamedWidgetContributorFactory; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.wsrt.IContext; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient; - -public class StartClientWidgetFactory implements INamedWidgetContributorFactory -{ - private IWebServiceClient webserviceClient_; - private IContext context_; - - public INamedWidgetContributor getFirstNamedWidget() - { - IServer server = null; - - if( webserviceClient_ != null && context_.getInstall()) - { - 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 ); - dataRegistry.addMapping( PreClientDevelopCommand.class, "Context", StartClientWidgetFactory.class ); - } - - public void setWebService( IWebServiceClient webserviceClient ) - { - webserviceClient_ = webserviceClient; - } - - public void setContext ( IContext context ) - { - context_ = context; - } -} 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 47459296c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartServerWidget.java +++ /dev/null @@ -1,443 +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.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.command.StartServerCommand; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.osgi.util.NLS; -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.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.context.TransientResourceContext; -import org.eclipse.wst.command.internal.env.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.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 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"; - - 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( pluginId_ ); - Composite group = uiUtils.createComposite( parent, 1 ); - - Text text1 = uiUtils.createText( group, null, null, null, SWT.READ_ONLY ); - text1.setText( NLS.bind(ConsumptionUIMessages.LABEL_START_SERVER_TEXT1, new String[]{ server_.getName() } )); - - Text text2 = uiUtils.createText( group, null, null, null, SWT.READ_ONLY ); - text2.setText( NLS.bind(ConsumptionUIMessages.LABEL_START_SERVER_TEXT2, new String[]{ server_.getName() } )); - - Text text3 = uiUtils.createText( group, null, null, null, SWT.READ_ONLY ); - text3.setText( NLS.bind(ConsumptionUIMessages.LABEL_START_SERVER_TEXT3, new String[]{ server_.getName() } )); - - Text text4 = uiUtils.createText( group, null, null, null, SWT.READ_ONLY ); - text4.setText( NLS.bind(ConsumptionUIMessages.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_, - ConsumptionUIMessages.LABEL_START_SERVER_BUTTON, - ConsumptionUIMessages.TOOLTIP_START_SERVER_BUTTON, - INFOPOP_SSWP_SERVER_BUTTON ); - - button_.addSelectionListener( new SelectionAdapter() - { - public void widgetSelected( SelectionEvent evt ) - { - serverStateText_.setText( getStateMessage( ConsumptionUIMessages.TEXT_SERVER_STATUS, ConsumptionUIMessages.TEXT_SERVER_STARTING ) ); - progressMonitor_.beginTask( getStateMessage( ConsumptionUIMessages.TEXT_SERVER_MSG, ConsumptionUIMessages.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( ConsumptionUIMessages.TEXT_SERVER_STATUS, ConsumptionUIMessages.TEXT_SERVER_STARTED ) ); - - break; - } - - case IServer.STATE_STARTING: - { - status_ = StatusUtils.errorStatus( "" ); - button_.setEnabled( false ); - serverStateText_.setText( getStateMessage( ConsumptionUIMessages.TEXT_SERVER_STATUS, ConsumptionUIMessages.TEXT_SERVER_STARTING ) ); - progressMonitor_.beginTask( getStateMessage( ConsumptionUIMessages.TEXT_SERVER_MSG, ConsumptionUIMessages.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( ConsumptionUIMessages.TEXT_SERVER_STATUS, ConsumptionUIMessages.TEXT_SERVER_STOPPED ) ); - break; - } - }; - - statusListener_.handleEvent( null ); - buttonGroup_.pack(); - } - - private String getStateMessage( String mainKey, String subKey ) - { - return NLS.bind( mainKey, new String[]{ 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 ); - - 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 0e05fcc15..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractHandlersWidgetDefaultingCmd.java +++ /dev/null @@ -1,119 +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.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -/** - * AbstractHandlersWidgetDefaultingCmd - * - * Initialize and load the handlers data - */ -public abstract class AbstractHandlersWidgetDefaultingCmd extends AbstractDataModelOperation -{ - - private IStructuredSelection initialSelection_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - IStructuredSelection selection = initialSelection_; - if (selection == null) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.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 acae4f7ac..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AddHandlerDialog.java +++ /dev/null @@ -1,261 +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.ConsumptionUIMessages; -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; - - - -public class AddHandlerDialog extends Dialog implements Listener { - - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - - 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$ - - /* CONTEXT_ID AHDL0002 for the Handler Config Page */ - private final String INFOPOP_TEXT_HANDLER_CLASS = "AHDL0002"; //$NON-NLS-1$ - - /* CONTEXT_ID AHDL0001 for the Handler Config Page */ - private final String INFOPOP_TEXT_HANDLER_PORT = "AHDL0003"; //$NON-NLS-1$ - - 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; - UIUtils uiUtils = new UIUtils(pluginId_); - - Shell thisShell = parent.getShell(); - if (thisShell == null) { - thisShell = createShell(); - } - thisShell.setText(ConsumptionUIMessages.DIALOG_TITLE_WS_ADD_HANDLER); - - Composite composite = (Composite) super.createDialogArea(parent); - - Composite sourceLocationComp = uiUtils.createComposite(composite, 3); - - classNameText = uiUtils.createText(sourceLocationComp, ConsumptionUIMessages.LABEL_TEXT_HANDLER_CLASS, ConsumptionUIMessages.TOOLTIP_TEXT_HANDLER_CLASS, INFOPOP_TEXT_HANDLER_CLASS, SWT.SINGLE | SWT.BORDER); - classNameText.addListener(SWT.Modify,this); - - beanClassBrowseButton_ = uiUtils.createPushButton( sourceLocationComp, ConsumptionUIMessages.BUTTON_BROWSE_CLASSES, - ConsumptionUIMessages.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, ConsumptionUIMessages.LABEL_TEXT_HANDLER_NAME, ConsumptionUIMessages.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, ConsumptionUIMessages.LABEL_TEXT_HANDLER_PORT, ConsumptionUIMessages.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 67b1199d3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/CheckWSDLValidationCommand.java +++ /dev/null @@ -1,102 +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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.ValidateWSDLJob; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.Choice; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.plugin.WSPlugin; - - -public class CheckWSDLValidationCommand extends AbstractDataModelOperation -{ - - public CheckWSDLValidationCommand () { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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( ConsumptionUIMessages.WAIT_FOR_WSDL ); - } - } - } - } - - return Status.OK_STATUS; - - } - - private boolean ignoreWSDLValidation(IEnvironment 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( ConsumptionUIMessages.STILL_VALIDATING_WSDL ); - // adding all messages from WSI Incompliances - - Choice ignoreChoice = new Choice('C', ConsumptionUIMessages.CANCEL_VALIDATION_LABEL, - ConsumptionUIMessages.CANCEL_VALIDATION_DESCRIPTION); - Choice ignoreAllChoice = new Choice('A', ConsumptionUIMessages.CANCEL_ALL_VALIDATION_LABEL, - ConsumptionUIMessages.CANCEL_ALL_VALIDATION_DESCRIPTION); - Choice cancelChoice = new Choice('W', ConsumptionUIMessages.WAIT_VALIDATION_LABEL, - ConsumptionUIMessages.WAIT_VALIDATION_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 b3f0cdac3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetDefaultingCommand.java +++ /dev/null @@ -1,299 +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.IFile; -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.emf.ecore.resource.Resource; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.j2ee.applicationclient.componentcore.util.AppClientArtifactEdit; -import org.eclipse.jst.j2ee.client.ApplicationClient; -import org.eclipse.jst.j2ee.client.ApplicationClientResource; -import org.eclipse.jst.j2ee.ejb.EJBJar; -import org.eclipse.jst.j2ee.ejb.EJBResource; -import org.eclipse.jst.j2ee.ejb.internal.modulecore.util.EJBArtifactEditUtilities; -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.webapplication.WebAppResource; -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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.wst.command.internal.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.IEnvironment; - -/** - * ClientHandlersWidgetDefaultingCommand - * - * Initialize and load the handlers data - */ -public class ClientHandlersWidgetDefaultingCommand extends AbstractHandlersWidgetDefaultingCmd { - - private HandlerTableItem[] handlers_; - - private Hashtable wsRefsToHandlersTable_; - - private Hashtable refNameToServiceRefObj_; - - private WebServicesManager webServicesManager_; - - private IProject project_; - - private String serviceRefName_ = null; - - private Collection wsServiceRefs_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - webServicesManager_ = WebServicesManager.getInstance(); - - IStructuredSelection selection = getInitialSelection(); - if (selection == null) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.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(); - - wsServiceRefs_ = getWSServiceRefsFromSelection(); - - if (wsServiceRefs_ != null && wsServiceRefs_.size()>0) { - Iterator wsRefsIter = wsServiceRefs_.iterator(); - for (int i = 0; i < wsServiceRefs_.size(); i++) { - - ServiceRef wsServiceRef = (ServiceRef) wsRefsIter.next(); - if (serviceRefName_== null || wsServiceRef.getServiceRefName().equalsIgnoreCase(serviceRefName_)) { - 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]); - } - else if (wsServiceRefs_==null || wsServiceRefs_.isEmpty()){ - //report no Web service client is available - return StatusUtils.errorStatus(ConsumptionUIMessages.MSG_ERROR_WEB_SERVICE_CLIENTS_NOT_FOUND); - } - } - catch (Exception e) { - return StatusUtils.errorStatus( ConsumptionUIMessages.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; - } - - public String getServiceRefName() { - return this.serviceRefName_; - } - - 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); - } - else if (obj instanceof IFile){ - Resource res = WorkbenchResourceHelperBase.getResource((IFile)obj, true); - Collection serviceRefs = null; - if (res instanceof WebServicesResource) { - // webservicesclient.xml for J2EE 1.3 - WebServicesResource wsRes = (WebServicesResource)res; - serviceRefs = wsRes.getWebServicesClient().getServiceRefs(); - ServiceRef ref = (ServiceRef)((List)serviceRefs).get(0); - serviceRefName_ = ref.getServiceRefName(); - project_ = ProjectUtilities.getProject(ref); - return serviceRefs; - } - else { - if(res instanceof WebAppResource){ - // web.xml for J2EE 1.4 - WebAppResource webAppRes = (WebAppResource)res; - serviceRefs = webAppRes.getWebApp().getServiceRefs(); - - } - else if (res instanceof EJBResource){ - EJBResource ejbRes = (EJBResource)res; - serviceRefs = webServicesManager_.getServiceRefs(ejbRes.getEJBJar()); - - } - else if (res instanceof ApplicationClientResource){ - ApplicationClientResource appClientRes = (ApplicationClientResource)res; - serviceRefs = webServicesManager_.getServiceRefs(appClientRes.getApplicationClient());//appClientRes.getApplicationClient().getServiceRefs(); - } - if (serviceRefs!=null && serviceRefs.size()>0) { - ServiceRef ref = (ServiceRef)((List)serviceRefs).get(0); - serviceRefName_ = ref.getServiceRefName(); - project_ = ProjectUtilities.getProject(ref); - } - return serviceRefs; - } - } - - // This section is for obtaining all the serviceRefs from the project, given that the initial selection - // was from the J2EE view (ServiceRef or WebServiceNavigatorGroupType), it will select the right serviceRef - if (project_==null){ - project_ = getProject(); - } - if (project_==null){ - return null; - } - - if (J2EEUtils.isWebComponent(project_)) { - WebArtifactEdit webEdit = null; - try { - IVirtualComponent vc = ComponentCore.createComponent(project_); - 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(); - } - } - else if (J2EEUtils.isEJBComponent(project_)){ - - IVirtualComponent vc = ComponentCore.createComponent(project_); - EJBJar ejbJar = EJBArtifactEditUtilities.getEJBJar(vc); - if (ejbJar!=null) { - return webServicesManager_.getServiceRefs(ejbJar); - } - } - else if (J2EEUtils.isAppClientComponent(project_)){ - IVirtualComponent vc = ComponentCore.createComponent(project_); - AppClientArtifactEdit appEdit = null; - try { - appEdit = AppClientArtifactEdit.getAppClientArtifactEditForRead(vc); - if (appEdit!=null){ - ApplicationClient appClient = appEdit.getApplicationClient(); - if (appClient !=null){ - return webServicesManager_.getServiceRefs(appClient); - } - } - } - finally{ - if(appEdit!=null){ - appEdit.dispose(); - } - } - } - - - } - 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 4d77780bc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java +++ /dev/null @@ -1,190 +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.java.JavaClass; -import org.eclipse.jst.j2ee.applicationclient.componentcore.util.AppClientArtifactEdit; -import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit; -import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit; -import org.eclipse.jst.j2ee.webservice.wsclient.Handler; -import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; -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.common.J2EEUtils; -import org.eclipse.jst.ws.internal.common.JavaMOFUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.componentcore.ArtifactEdit; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopyUtility; - -/* - * Provide a way to externalize the edited fields and create new handlers - * - */ -public class ClientHandlersWidgetOutputCommand extends AbstractDataModelOperation -{ - - private Hashtable oldWSServiceRefsToHandlersTable_; - - private Hashtable newWSServiceRefsToHandlersTable_; - - private Hashtable handlersTable_; - - private IProject project_; - - private Collection wsServiceRefs_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - try { - - 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 = JavaMOFUtils.getJavaClass(hti.getHandlerClassName(), project_); - if (javaClass != null) { - newHandler.setHandlerClass(javaClass); - } - - ((List) newWSServiceRefsToHandlersTable_.get(wsRef)).add(newHandler); - } - - } - - } - } - } - - // add handlers to ports - addHandlersToServiceRefs(); - // save the artifact edit model - saveEditModel(); - - } - } - catch (Exception e) - { - return StatusUtils.errorStatus(ConsumptionUIMessages.MSG_ERROR_TASK_EXCEPTED, e); - } - - return status; - } - - private void saveEditModel() { - ArtifactEdit artifactEdit = null; - try { - if (J2EEUtils.isWebComponent(project_)) { - artifactEdit = WebArtifactEdit.getWebArtifactEditForWrite(project_); - } - else if (J2EEUtils.isEJBComponent(project_)){ - artifactEdit = EJBArtifactEdit.getEJBArtifactEditForWrite(project_); - } - else if (J2EEUtils.isAppClientComponent(project_)){ - artifactEdit = AppClientArtifactEdit.getAppClientArtifactEditForWrite(project_); - } - } - finally { - if (artifactEdit!=null) { - artifactEdit.save(null); - artifactEdit.dispose(); - } - } - } - - 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(); - //wsServiceRefs_.addAll(handlers); - modelHandlers.addAll(handlers); - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * The new handlerTableItems to set. - * @param handlerTableItems - */ - public void setHandlersTable(Hashtable handlersTable) { - this.handlersTable_ = handlersTable; - } - - public void setClientProject(IProject project) { - this.project_ = project; - } - - public void setWsServiceRefs(Collection wsRefs) { - this.wsServiceRefs_ = wsRefs; - } - -}
\ 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 2e933bb60..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidget.java +++ /dev/null @@ -1,122 +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.ConsumptionUIMessages; -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.core.context.ResourceContext; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; - - -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"; - UIUtils utils = new UIUtils( 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, ConsumptionUIMessages.CHECKBOX_TEST_WEBSERVICE, - ConsumptionUIMessages.TOOLTIP_PWPR_CHECKBOX_TEST_SERVICE, - INFOPOP_PWPR_CHECKBOX_TEST_SERVICE ); - - // Create monitor service check box. - monitorService = utils.createCheckbox(testGroup, ConsumptionUIMessages.CHECKBOX_MONITOR_WEBSERVICE, - ConsumptionUIMessages.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 void setInstallClient( Boolean install) - { - clientWidget_.setInstallClient( install ); - } - - public Boolean getInstallClient() - { - return clientWidget_.getInstallClient(); - } - - 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 f71c986dd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetDefaultingCommand.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.commands.ExecutionException; -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.wsrt.WebServiceRuntimeExtensionUtils2; -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.env.core.context.ResourceContext; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class ClientWizardWidgetDefaultingCommand extends AbstractDataModelOperation -{ - public Boolean getTestService() - { - return new Boolean( getScenarioContext().getTestWebService() ); - } - - public Boolean getMonitorService() - { - return new Boolean( getScenarioContext().getMonitorWebService()); - } - - public Boolean getInstallClient() - { - return new Boolean( getScenarioContext().getInstallClient() ); - } - - 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 = WebServiceRuntimeExtensionUtils2.getAllRuntimesForClientSide()[0]; - //String server = registry.getAllClientServerFactoryIds()[0]; - String server = WebServiceRuntimeExtensionUtils2.getAllClientServerFactoryIds()[0]; - TypeRuntimeServer result = new TypeRuntimeServer(); - // rskreg - - result.setTypeId( type ); - result.setRuntimeId( runtime ); - result.setServerId( server ); - - return result; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - 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/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 b800ecfee..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetOutputCommand.java +++ /dev/null @@ -1,86 +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.commands.ExecutionException; -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.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class ClientWizardWidgetOutputCommand extends AbstractDataModelOperation -{ - private boolean testService_; - private boolean monitorService; - private ResourceContext resourceContext_; - private TypeRuntimeServer clientIds_; - private boolean installClient_; - - public boolean getTestService() - { - return testService_; - } - - public void setTestService( boolean testService ) - { - testService_ = testService; - } - - public void setInstallClient( boolean installClient) - { - installClient_ = installClient; - } - - public boolean getInstallClient() - { - return installClient_; - } - - 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; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - 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/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 4bfc7c5b6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigClientHandlersTableWidget.java +++ /dev/null @@ -1,605 +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.Enumeration; -import java.util.Hashtable; -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.ConsumptionUIMessages; -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.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -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.graphics.Point; -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.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; - -/** - * ConfigClientHandlersTreeWidget - * - */ -public class ConfigClientHandlersTableWidget extends SimpleWidgetDataContributor { - - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - - 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$ - - /* CONTEXT_ID HDLR0002 for the Handler Config Page */ - private final String INFOPOP_HDLR_GEN_SKELETON = "HDLR0002"; //$NON-NLS-1$ - - /* CONTEXT_ID HDLR0003 for the Handler Config Page */ - private final String INFOPOP_COMBO_SOURCE_LOC = "HDLR0003"; //$NON-NLS-1$ - - /* CONTEXT_ID HDLR0004 for the Handler Config Page */ - private final String INFOPOP_WS_CLIENT_REF = "HDLR0004"; //$NON-NLS-1$ - - // ------------------------ - - public ConfigClientHandlersTableWidget() { - super(); - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) { - - UIUtils uiUtils = new UIUtils(pluginId_); - - parent_ = parent; - - // Web service reference combo - Composite webServiceRefComp = uiUtils.createComposite(parent_, 2); - webServiceRefCombo_ = uiUtils.createCombo(webServiceRefComp, ConsumptionUIMessages.LABEL_COMBO_WS_CLIENT_REF, - ConsumptionUIMessages.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()); - - final 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 | GridData.GRAB_VERTICAL | GridData.FILL_VERTICAL); - 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(ConsumptionUIMessages.LABEL_HANDLERS_CONFIG); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - handlersText.setLayoutData(gd); - - handlersTable_ = uiUtils.createTable(handlersComp, ConsumptionUIMessages.TOOLTIP_EDIT_WS_HANDLERS, INFOPOP_HDLR_WS_HANDLERS, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER); - 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, ConsumptionUIMessages.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, ConsumptionUIMessages.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, ConsumptionUIMessages.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, ConsumptionUIMessages.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[] { ConsumptionUIMessages.LABEL_HANDLER_NAME, ConsumptionUIMessages.LABLE_HANDLER_CLASS}; - - final TableColumn[] tableCols = new TableColumn[columns_.length]; - 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); - tableCols[i] = tableColumn; - } - - handlersComp.addControlListener(new ControlAdapter() { - public void controlResized(ControlEvent e) { - Rectangle area = handlersComp.getClientArea(); - Point preferredSize = handlersTable_.computeSize(SWT.DEFAULT, SWT.DEFAULT); - int width = area.width - 2*handlersTable_.getBorderWidth()-10; - if (preferredSize.y > area.height + handlersTable_.getHeaderHeight()) { - // Subtract the scrollbar width from the total column width - // if a vertical scrollbar will be required - Point vBarSize = handlersTable_.getVerticalBar().getSize(); - width -= vBarSize.x; - } - Point oldSize = handlersTable_.getSize(); - if (oldSize.x > area.width) { - // table is getting smaller so make the columns - // smaller first and then resize the table to - // match the client area width - tableCols[0].setWidth(width/2); - tableCols[1].setWidth(width - tableCols[0].getWidth()); - handlersTable_.setSize(area.width, area.height); - } else { - // table is getting bigger so make the table - // bigger first and then make the columns wider - // to match the client area width - handlersTable_.setSize(area.width, area.height); - tableCols[0].setWidth(width/2); - tableCols[1].setWidth(width - tableCols[0].getWidth()); - } - } - }); - - 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_, ConsumptionUIMessages.LABEL_BUTTON_GEN_SKELETON, ConsumptionUIMessages.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, ConsumptionUIMessages.LABEL_COMBO_SOURCE_LOC, ConsumptionUIMessages.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(); - } - - } - - /* - * (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 7d6f7a0bb..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigServiceHandlersTableWidget.java +++ /dev/null @@ -1,658 +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.ConsumptionUIMessages; -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.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -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.graphics.Point; -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.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; - -/** - * ConfigServiceHandlersTreeWidget - * - */ -public class ConfigServiceHandlersTableWidget extends SimpleWidgetDataContributor { - - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - 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 = 100; - - // ----TOOLTIPS Section---- - /* CONTEXT_ID SHLD0001 for the Handler Config Page */ - private final String INFOPOP_HDLR_WS_HANDLERS = "SHDL0001"; //$NON-NLS-1$ - - /* CONTEXT_ID SHDL0002 for the Handler Config Page */ - private final String INFOPOP_HDLR_GEN_SKELETON = "SHDL0002"; //$NON-NLS-1$ - - /* CONTEXT_ID SHDL0003 for the Handler Config Page */ - private final String INFOPOP_COMBO_SOURCE_LOC = "SHDL0003"; //$NON-NLS-1$ - - /* CONTEXT_ID SHDL0004 for the Handler Config Page */ - private final String INFOPOP_WS_SERVICE_DESC = "SHDL0004"; //$NON-NLS-1$ - - // ------------------------ - - public ConfigServiceHandlersTableWidget() { - super(); - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) { - UIUtils uiUtils = new UIUtils( pluginId_); - - parent_ = parent; - - int maxWidth = 130; - int maxHeight = 600; - - // Web service reference combo - Composite webServiceRefComp = uiUtils.createComposite(parent_, 2); - webServiceDescCombo_ = uiUtils.createCombo(webServiceRefComp, ConsumptionUIMessages.LABEL_COMBO_WS_SERVICE_DESC, - ConsumptionUIMessages.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()); - - final 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 | GridData.GRAB_VERTICAL | GridData.FILL_VERTICAL); - handlersComp.setLayoutData(griddata); - handlersComp.setSize(maxWidth, maxHeight); - - 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(ConsumptionUIMessages.LABEL_HANDLERS_CONFIG); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - handlersText.setLayoutData(gd); - - handlersTable_ = uiUtils.createTable(handlersComp, ConsumptionUIMessages.TOOLTIP_EDIT_WS_HANDLERS, INFOPOP_HDLR_WS_HANDLERS, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER); - 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, ConsumptionUIMessages.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, ConsumptionUIMessages.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, ConsumptionUIMessages.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, ConsumptionUIMessages.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[] {ConsumptionUIMessages.LABEL_HANDLER_NAME, ConsumptionUIMessages.LABLE_HANDLER_CLASS, - ConsumptionUIMessages.LABEL_HANDLER_PORT}; - - final TableColumn[] tableCols = new TableColumn[columns_.length]; - for (int i = 0; i < columns_.length; i++) { - TableColumn tableColumn = new TableColumn(handlersTable_, SWT.LEFT); - tableColumn.setText(columns_[i]); - tableColumn.setAlignment(SWT.LEFT); - tableColumn.setWidth(DEFAULT_COLUMN_WIDTH); - tableColumn.setResizable(true); - tableCols[i] = tableColumn; - } - handlersComp.addControlListener(new ControlAdapter() { - public void controlResized(ControlEvent e) { - Rectangle area = handlersComp.getClientArea(); - Point preferredSize = handlersTable_.computeSize(SWT.DEFAULT, SWT.DEFAULT); - int width = area.width - 2*handlersTable_.getBorderWidth()-10; - if (preferredSize.y > area.height + handlersTable_.getHeaderHeight()) { - // Subtract the scrollbar width from the total column width - // if a vertical scrollbar will be required - Point vBarSize = handlersTable_.getVerticalBar().getSize(); - width -= vBarSize.x; - } - Point oldSize = handlersTable_.getSize(); - if (oldSize.x > area.width) { - // table is getting smaller so make the columns - // smaller first and then resize the table to - // match the client area width - tableCols[0].setWidth(width/3); - tableCols[1].setWidth(width/3); - tableCols[2].setWidth(width - (tableCols[0].getWidth()+tableCols[1].getWidth())); - handlersTable_.setSize(area.width, area.height); - } else { - // table is getting bigger so make the table - // bigger first and then make the columns wider - // to match the client area width - handlersTable_.setSize(area.width, area.height); - tableCols[0].setWidth(width/3); - tableCols[1].setWidth(width/3); - tableCols[2].setWidth(width - (tableCols[0].getWidth()+tableCols[1].getWidth())); - } - } - }); - - 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_, ConsumptionUIMessages.LABEL_BUTTON_GEN_SKELETON, ConsumptionUIMessages.TOOLTIP_BUTTON_GEN_SKELETON, INFOPOP_HDLR_GEN_SKELETON); - griddata = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); - genSkeletonRadioButton_.setLayoutData( griddata ); - genSkeletonRadioButton_.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent evt) { - handleGenSkeletonRadioButton(); - } - }); - - Composite sourceLocationComp = uiUtils.createComposite(parent_, 2); - sourceLocationCombo_ = uiUtils.createCombo(sourceLocationComp, ConsumptionUIMessages.LABEL_COMBO_SOURCE_LOC, ConsumptionUIMessages.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 f5b6e148c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/HandlersDefaultingCommand.java +++ /dev/null @@ -1,78 +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.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; - - -/** - * 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 ) - { - IEnvironment env = getEnvironment(); - 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( ConsumptionUIMessages.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 7be3001ef..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ImportWSILWidget.java +++ /dev/null @@ -1,223 +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.ConsumptionUIMessages; -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.core.common.StatusUtils; -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.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_; - - /** - * Constructs a new page. - */ - public ImportWSILWidget() - { - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) - { - IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem(); - - parent.setToolTipText(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.TOOLTIP_WSIL_TEXT_WSIL); - helpSystem.setHelp(wsil_, INFOPOP_WSIL_TEXT_WSIL); - - browse_ = new Button(composite, SWT.PUSH); - browse_.setText(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.LABEL_WSDL); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - String[] columns = {ConsumptionUIMessages.LABEL_WSDL_URI}; - wsdls_ = new TableViewerEditor(wsdlComposite, columns, new ArrayList(), "http://"); - wsdls_.setToolTipText(ConsumptionUIMessages.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( ConsumptionUIMessages.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 27fc72bbe..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PreferencesSelectionWidget.java +++ /dev/null @@ -1,81 +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.WSUIPluginMessages; -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.core.context.ResourceContext; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; - - -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 conPluginId = "org.eclipse.jst.ws.consumption.ui"; - UIUtils utils = new UIUtils( conPluginId ); - - Composite resourcesGroup = utils.createComposite( parent, 1 ); - - overwriteFilesCheckbox_ = utils.createCheckbox( resourcesGroup, WSUIPluginMessages.BUTTON_OVERWRITE_FILES, - WSUIPluginMessages.TOOLTIP_PPRM_CHECKBOX_OVERWRITE_FILES, - INFOPOP_PWPR_CHECKBOX_OVERWRITE_FILES ); - - createFoldersCheckbox_ = utils.createCheckbox( resourcesGroup, WSUIPluginMessages.BUTTON_CREATE_FOLDERS, - WSUIPluginMessages.TOOLTIP_PPRM_CHECKBOX_CREATE_FOLDERS , - INFOPOP_PWPR_CHECKBOX_CREATE_FOLDERS ); - - checkoutFilesCheckbox_ = utils.createCheckbox( resourcesGroup, WSUIPluginMessages.BUTTON_CHECKOUT_FILES, - WSUIPluginMessages.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 656491948..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.data.DataMappingRegistry; -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; - - -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 d044f7ced..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/PublishWSWidget.java +++ /dev/null @@ -1,201 +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.ConsumptionUIMessages; -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.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 Listener statusListener; - private Boolean publish; - - public PublishWSWidget(boolean publish) - { - 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(ConsumptionUIMessages.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(ConsumptionUIMessages.BUTTON_WS_PUBLISH_PRIVATE_UDDI); - else - launchPrivateUDDICheckbox_.setText(ConsumptionUIMessages.BUTTON_WS_FIND_PRIVATE_UDDI); - launchPrivateUDDICheckbox_.setToolTipText(ConsumptionUIMessages.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(ConsumptionUIMessages.BUTTON_WS_PUBLISH); - else - launchUDDICheckbox_.setText(ConsumptionUIMessages.BUTTON_WS_FIND); - launchUDDICheckbox_.setToolTipText(ConsumptionUIMessages.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(ConsumptionUIMessages.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 546cbfc0b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetDefaultingCommand.java +++ /dev/null @@ -1,232 +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.IFile; -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.emf.ecore.resource.Resource; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase; -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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -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 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 ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - webServicesManager_ = new WebServicesManager(); - IStructuredSelection selection = getInitialSelection(); - if (selection == null) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_TASK_EXCEPTED ); - env.getStatusHandler().reportError(status); - return status; - } - - status = processHandlers(env); - return status; - - } - - public IStatus processHandlers(IEnvironment env) { - try { - Vector handlers = new Vector(); - wsDescToHandlers_ = new Hashtable(); - serviceDescNameToDescObj_ = new Hashtable(); - - wsddResource_ = getWsddResourceFromSelection(); - if (wsddResource_ == null) { - return StatusUtils.errorStatus(ConsumptionUIMessages.MSG_ERROR_WSDD_NOT_FOUND); - } - - 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]); - } - else { - //report no Web service is available - return StatusUtils.errorStatus(ConsumptionUIMessages.MSG_ERROR_WEB_SERVICES_NOT_FOUND); - } - } - catch (Exception e) - { - e.printStackTrace(); - return StatusUtils.errorStatus( ConsumptionUIMessages.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); - } - else if (obj instanceof IFile){ - // webservices.xml file - Resource res = WorkbenchResourceHelperBase.getResource((IFile)obj, true); - WsddResource wsddRes = (WsddResource)res; - project_ = ProjectUtilities.getProject(res); - return wsddRes; - } - } - - 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 504f1e5c6..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.common.frameworks.datamodel.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 ed902a368..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/TableViewerWidget.java +++ /dev/null @@ -1,616 +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.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.ui.dialog.DialogUtils; -import org.eclipse.osgi.util.NLS; -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.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; - - -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; - - 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(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.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(); - - for(int cnt=0; cnt<values_.size(); cnt++){ - String[] value = (String[])values_.get(cnt); - if(map.containsKey(value[0]) && ((rescriction & 1)!=0)){ - message =NLS.bind(ConsumptionUIMessages.MSG_MAPPING_DUPLICATE_ENTRIES, new String[]{columns_[0],columns_[1]}); - return; - } - if(map.containsValue(value[1]) && ((rescriction & 2)!=0)){ - message =NLS.bind(ConsumptionUIMessages.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 ad041c0db..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionConditionCommand.java +++ /dev/null @@ -1,135 +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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.wsil.DialogWWWAuthentication; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.command.internal.env.core.common.Condition; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 WebServicesParser webServicesParser; - private String webServiceURI; - private String httpBasicAuthUsername; - private String httpBasicAuthPassword; - private boolean needWSDLSelectionTreeWidget; - - public WSDLSelectionConditionCommand() - { - } - - 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( NLS.bind(ConsumptionUIMessages.MSG_ERROR_URI_NOT_RESOLVABLE, new Object[] {webServiceURI}), t); - } - finally - { - parser.setHTTPBasicAuthUsername(null); - parser.setHTTPBasicAuthPassword(null); - } - } - } - catch (Throwable t) - { - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.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 d861819f4..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.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 ) - { - IEnvironment env = getEnvironment(); - - 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( ConsumptionUIMessages.MSG_WARNING_NO_SERVICE_ELEMENT ); - try{ - env.getStatusHandler().report(status); - }catch(Exception e){ - status = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_WARNING_NO_SERVICE_ELEMENT ); - } - } - } - return status; - } - else - { - IStatus status = StatusUtils.errorStatus( ConsumptionUIMessages.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 71c3af8d1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionTreeWidget.java +++ /dev/null @@ -1,285 +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.ConsumptionUIMessages; -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.core.common.StatusUtils; -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.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_ = "org.eclipse.jst.ws.consumption.ui"; - - /*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() - { - } - - public WidgetDataEvents addControls( Composite parent, Listener statusListener ) - { - this.statusListener = statusListener; - parent.setToolTipText(ConsumptionUIMessages.TOOLTIP_PWWS_PAGE); - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, pluginId_ + INFOPOP_PWWS_PAGE); - - Label wsdlLabel = new Label(parent, SWT.WRAP); - wsdlLabel.setText(ConsumptionUIMessages.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( ConsumptionUIMessages.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 fc40135fe..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java +++ /dev/null @@ -1,158 +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.commands.ExecutionException; -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.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.webservice.wsclient.ServiceRef; -import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - 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/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 0300fc2f7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java +++ /dev/null @@ -1,137 +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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -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.layout.GridData; -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.Listener; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; - - -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"; - - /*CONTEXT_ID PWPR0016 for the Install Client check box of the Scenario page of Service and Client wizards*/ - private String INFOPOP_PWPR_CHECKBOX_INSTALL_CLIENT = "PWPR0016"; - - private Combo clientTypeCombo_; - - private Button installClient_; - - 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"; - UIUtils utils = new UIUtils( pluginId ); - - Group clientGroup = utils.createGroup( parent, - ConsumptionUIMessages.GROUP_SCENARIO_CLIENT, - ConsumptionUIMessages.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, - ConsumptionUIMessages.LABEL_WEBSERVICECLIENTTYPE, - ConsumptionUIMessages.TOOLTIP_PWPR_COMBO_CLIENTTYPE, - INFOPOP_PWPR_COMBO_CLIENTTYPE, - comboStyle ); - - Composite buttonGroup = utils.createComposite( clientGroup, 1 ); - GridData buttonGrid = new GridData(); - buttonGrid.horizontalSpan = 2; - buttonGroup.setLayoutData( buttonGrid ); - - installClient_ = utils.createCheckbox( buttonGroup, ConsumptionUIMessages.BUTTON_INSTALL_CLIENT_WEB_PROJECT, - ConsumptionUIMessages.TOOLTIP_PWPR_CHECKBOX_INSTALL_CLIENT_WEB_PROJECT, - INFOPOP_PWPR_CHECKBOX_INSTALL_CLIENT ); - - - - return this; - } - - public void enableWidget( boolean enable ) - { - clientTypeCombo_.setEnabled( enable ); - installClient_.setEnabled( enable ); - } - - public void setTypeRuntimeServer( TypeRuntimeServer ids ) - { - // rskreg - //WebServiceClientTypeRegistry registry = WebServiceClientTypeRegistry.getInstance(); - //LabelsAndIds labelIds = registry.getClientTypeLabels(); - LabelsAndIds labelIds = WebServiceRuntimeExtensionUtils2.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_; - } - - public Boolean getInstallClient() - { - return new Boolean( installClient_.getSelection() ); - } - - public void setInstallClient( Boolean value ) - { - installClient_.setSelection( value.booleanValue() ); - } - - -} 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 03faca1c0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.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.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.ConsumptionUIMessages; -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.data.DataMappingRegistry; -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.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.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - // Before ClientWizardWidget - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientWizardWidget.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "InstallClient", 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, "InstallClient", 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, "ClientRuntimeId", ClientRuntimeSelectionWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", ClientRuntimeSelectionWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", ClientRuntimeSelectionWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentType", 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, "ClientRuntimeId", 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); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "GenerateProxy",TestDefaultingFragment.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) - { - - widgetRegistry.add( "ClientWizardWidget", - ConsumptionUIMessages.PAGE_TITLE_WS_PROJECT, - ConsumptionUIMessages.PAGE_DESC_WS_PROJECT, - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new ClientWizardWidget(); - } - } ); - - widgetRegistry.add( "ClientRuntimeSelectionWidget", - ConsumptionUIMessages.PAGE_TITLE_WS_CLIENT_RUNTIME_SELECTION, - ConsumptionUIMessages.PAGE_DESC_WS_CLIENT_RUNTIME_SELECTION, - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new ClientRuntimeSelectionWidget(); - } - } ); - - widgetRegistry.add( "WSDLSelectionWidgetWrapper", - ConsumptionUIMessages.PAGE_TITLE_WS_SELECTION, - ConsumptionUIMessages.PAGE_DESC_WS_SELECTION, - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new WSDLSelectionWidgetWrapper(); - } - } ); - - widgetRegistry.add( "ClientTestWidget", - ConsumptionUIMessages.PAGE_TITLE_WS_SAMPLE, - ConsumptionUIMessages.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.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, "InstallClient", 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(ClientWizardWidgetOutputCommand.class, "InstallClient", ClientExtensionDefaultingCommand.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, "ClientRuntimeId", 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, "ClientProjectName", 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, "InstallClient", PreClientDevelopCommand.class); - 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( ClientExtensionDefaultingCommand.class, "ClientRuntimeId", 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, "ClientEarProjectName", ClientTestDelegateCommand.class,"ClientEarComponentName", null); - 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, "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, "ClientProjectName", DevelopClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", DevelopClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", 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, "ClientProjectName", AssembleClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", AssembleClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", 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, "ClientProjectName", DeployClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", DeployClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", 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, "ClientProjectName", InstallClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", InstallClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", 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, "ClientProjectName", RunClientFragment.class, "Module", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", RunClientFragment.class, "EarProject", null ); - dataRegistry.addMapping( ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", 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 dda8dc338..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigClientHandlersWidgetBinding.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.binding; - -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -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.data.DataMappingRegistry; -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; - - -/** - * - * 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) { - - widgetRegistry.add("ConfigClientHandlersTableWidget", - ConsumptionUIMessages.PAGE_TITLE_CLIENT_HDLR_CONFIG, - ConsumptionUIMessages.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.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) { - - 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); - - 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.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) - { - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ClientHandlersWidgetDefaultingCommand.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 94654e13c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigServiceHandlersWidgetBinding.java +++ /dev/null @@ -1,136 +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.ConsumptionUIMessages; -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.data.DataMappingRegistry; -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; - - -/** - * - * 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) { - - widgetRegistry.add("ConfigServiceHandlersTableWidget", - ConsumptionUIMessages.PAGE_TITLE_SERVICE_HDLR_CONFIG, - ConsumptionUIMessages.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.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.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 76ebc44f8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigureHandlersWidgetBinding.java +++ /dev/null @@ -1,241 +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.ConsumptionUIMessages; -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.common.Condition; -import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry; -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; - - -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.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) { - - widgetRegistry.add("ConfigServiceHandlersTableWidget", ConsumptionUIMessages.PAGE_TITLE_SERVICE_HDLR_CONFIG, - ConsumptionUIMessages.PAGE_DESC_SERVICE_HDLR_CONFIG, new WidgetContributorFactory() { - - public WidgetContributor create() { - return new ConfigServiceHandlersTableWidget(); - } - }); - - widgetRegistry.add("ConfigClientHandlersTableWidget", ConsumptionUIMessages.PAGE_TITLE_CLIENT_HDLR_CONFIG, - ConsumptionUIMessages.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,"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.env.core.data.DataMappingRegistry) - */ - public void registerDataMappings(DataMappingRegistry dataRegistry) { - dataRegistry.addMapping(SelectionCommand.class, "InitialSelection", ClientHandlersWidgetDefaultingCommand.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.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 5f723f508..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/GenSampleWidgetBinding.java +++ /dev/null @@ -1,396 +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.ConsumptionUIMessages; -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.context.ResourceContext; -import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry; -import org.eclipse.wst.command.internal.env.core.data.Transformer; -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.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient; -import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo; -import org.eclipse.wst.ws.internal.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.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) - { - - widgetRegistry.add( "ClientTestWidget", - ConsumptionUIMessages.PAGE_TITLE_WS_SAMPLE, - ConsumptionUIMessages.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 wsdlURI_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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 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.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, "ClientEarProjectName", ClientTestDelegateCommand.class,"ClientEarComponentName",null); - 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", TestDefaultingFragment.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 fc1c3122a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSILWidgetBinding.java +++ /dev/null @@ -1,88 +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.ConsumptionUIMessages; -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.data.DataMappingRegistry; -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; - - -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.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) - { - - widgetRegistry.add("ImportWSILWidget", - ConsumptionUIMessages.TITLE_WSIL_IMPORT, - ConsumptionUIMessages.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 c041a00fa..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ImportWSWidgetBinding.java +++ /dev/null @@ -1,103 +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.ConsumptionUIMessages; -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.data.DataMappingRegistry; -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.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.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) - { - this.widgetRegistry = widgetRegistry; - publishToPrivateUDDICmdFrag.registerWidgetMappings(this.widgetRegistry); - - widgetRegistry.add("WSImport", - ConsumptionUIMessages.PAGE_TITLE_WS_FIND, - ConsumptionUIMessages.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 bd18b0005..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionDefaultingCommand.java +++ /dev/null @@ -1,499 +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.core.commands.ExecutionException; -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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 String clientRuntimeId_; - private Boolean testService; - private Boolean installClient; - 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 setClientRuntimeId(String id) - { - clientRuntimeId_ = id; - } - - public String getClientRuntimeId() - { - return clientRuntimeId_; - } - - 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 clientProjectName_ + "/" + clientProjectName_; - } - - /** - * @return Returns the clientProjectEAR. - */ - public String getClientProjectEAR() - { - if (clientEarProjectName_!=null && clientEarProjectName_.length()>0) - { - //return clientEarProjectName_ + "/" + clientEarComponentName_; - return clientEarProjectName_ + "/" + clientEarProjectName_; - } - 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 installClient. - */ - public Boolean getInstallClient() - { - return installClient; - } - - /** - * @param testProxySelected - * The testProxySelected to set. - */ - public void setInstallClient(Boolean installClient) - { - this.installClient = installClient; - } - - /** - * @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 "14"; //rm j2ee - } - - /** - * @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; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - IEnvironment env = getEnvironment(); - //Do some basic validation to ensure the server/runtime/type combination is supported. - //This is needed to catch problems in the defaulting - //when the user clicks Finish prior to page 3 of the wizard. - - IStatus status = Status.OK_STATUS; - String scenario = ConsumptionUIMessages.MSG_CLIENT_SUB; - - //Ensure server and runtime are non-null - String runtimeId = clientIds_.getRuntimeId(); - String serverId = clientIds_.getServerId(); - String typeId = clientIds_.getTypeId(); - - if( runtimeId == null || runtimeId.length()==0) - { - status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_RUNTIME, new String[]{ scenario } ) ); - env.getStatusHandler().reportError(status); - } - - if( serverId == null || serverId.length()==0) - { - status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER, new String[]{ scenario } ) ); - env.getStatusHandler().reportError(status); - } - - //ensure the server, runtime, and type are compatible - if (!WebServiceRuntimeExtensionUtils2.isServerClientRuntimeTypeSupported(serverId, runtimeId, typeId)) - { - String serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId); - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); - status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, new String[]{ serverLabel, runtimeLabel } ) ); - 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/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 5923a9f98..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionOutputCommand.java +++ /dev/null @@ -1,68 +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.core.commands.ExecutionException; -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.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.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(); - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - return Status.OK_STATUS; - } -} 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 9a2ab9770..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionDefaultingCommand.java +++ /dev/null @@ -1,324 +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.core.commands.ExecutionException; -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.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.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 installService; - private Boolean startService; - private Boolean testService; - private Boolean publishService; - private TypeRuntimeServer serviceIds_; - private String serviceRuntimeId_; - //private SelectionListChoices serviceChoices_; - private String serviceProjectName_; - private String serviceEarProjectName_; - private String serviceComponentType_; - //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 setServiceRuntimeId(String id) - { - serviceRuntimeId_ = id; - } - - public String getServiceRuntimeId() - { - return serviceRuntimeId_; - } - - /* - 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_ + "/" + serviceProjectName_; - } - - /** - * @return Returns the serverProjectEAR. - */ - public String getServerProjectEAR() - { - if (serviceEarProjectName_!=null && serviceEarProjectName_.length()>0) - { - return serviceEarProjectName_ + "/" + serviceEarProjectName_; - } - 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 installService. - */ - public Boolean getInstallService() - { - return installService; - } - /** - * @param installService - * Specifies if service should be installed. - */ - public void setInstallService(Boolean installService) - { - this.installService = installService; - } - - /** - * @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 "14"; //rm j2ee - } - - /** - * - * @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 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 setServiceEarProjectName(String serviceEarProjectName) - { - this.serviceEarProjectName_ = serviceEarProjectName; - } - - public void setServiceComponentType(String type) - { - this.serviceComponentType_ = type; - } - - public String getServiceComponentType() - { - return serviceComponentType_; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - IEnvironment env = getEnvironment(); - //Do some basic validation to ensure the server/runtime/type combination is supported. - //This is needed to catch problems in the defaulting - //when the user clicks Finish prior to page 3 of the wizard. - - IStatus status = Status.OK_STATUS; - String scenario = ConsumptionUIMessages.MSG_SERVICE_SUB; - - //Ensure server and runtime are non-null - String runtimeId = serviceIds_.getRuntimeId(); - String serverId = serviceIds_.getServerId(); - String typeId = serviceIds_.getTypeId(); - - if( runtimeId == null || runtimeId.length()==0) - { - status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_RUNTIME, new String[]{ scenario } ) ); - env.getStatusHandler().reportError(status); - } - - if( serverId == null || serverId.length()==0) - { - status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER, new String[]{ scenario } ) ); - env.getStatusHandler().reportError(status); - } - - //ensure the server, runtime, and type are compatible - if (!WebServiceRuntimeExtensionUtils2.isServerRuntimeTypeSupported(serverId, runtimeId, typeId)) - { - String serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId); - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); - status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, new String[]{ serverLabel, runtimeLabel } ) ); - 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/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 1d84f039a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionOutputCommand.java +++ /dev/null @@ -1,115 +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.core.commands.ExecutionException; -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.common.frameworks.datamodel.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.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(); -} - -public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException -{ - return Status.OK_STATUS; -} -} 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 f6c35a6b0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionTransformer.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.j2ee.ejb.EnterpriseBean; -import org.eclipse.wst.command.internal.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 058f2d8b9..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java +++ /dev/null @@ -1,393 +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.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -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.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class EJBSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget -{ - - 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) - { - 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(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.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()); - 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()); - 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(); - IVirtualComponent[] ejbComponents = J2EEUtils.getReferencingEJBComponentsFromEAR(project); - 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 9d17a46e7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBTableViewer.java +++ /dev/null @@ -1,115 +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.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -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; - -public class EJBTableViewer extends TableViewer -{ - 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); - String columnProperties[] = {ConsumptionUIMessages.TABLE_TITLE_EJB_BEAN_NAMES, ConsumptionUIMessages.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 7a9335831..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.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 || beanPackage.length() == 0 ? 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 22fb63d5f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java +++ /dev/null @@ -1,276 +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.consumption.ui.ConsumptionUIMessages; -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.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class JavaBeanSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget -{ - 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 ) - { - String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - this.statusListener = statusListener; - UIUtils uiUtils = new UIUtils( pluginId_ ); - - parent_ = parent; - - Composite group = uiUtils.createComposite( parent, 4 ); - - group.setToolTipText( ConsumptionUIMessages.TOOLTIP_PBCL_PAGE ); - PlatformUI.getWorkbench().getHelpSystem().setHelp( group, pluginId_ + "." + INFOPOP_PBCL_PAGE ); - - beanClassText_ = uiUtils.createText( group, ConsumptionUIMessages.LABEL_BEAN_CLASS_NAME, - ConsumptionUIMessages.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, ConsumptionUIMessages.BUTTON_BROWSE_CLASSES, - ConsumptionUIMessages.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, ConsumptionUIMessages.BUTTON_BROWSE_FILES, - ConsumptionUIMessages.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 || beanPackage.length() == 0 ? 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) - { - return StatusUtils.errorStatus(ConsumptionUIMessages.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 a889d944a..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.WebServiceRuntimeExtensionUtils2; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.env.core.common.Condition; -import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistry; -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.ws.internal.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 = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(wst); - String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(wst); - if (scenario == WebServiceScenario.TOPDOWN) - { - //Must have WSDL object selection. No choice. - hasObjectSelectionWidget=true; - } - else - { - WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.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 3899686a6..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.WebServiceRuntimeExtensionUtils2; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.env.core.data.Transformer; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.ws.internal.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 ) - { - IEnvironment 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 = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(wst); - String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(wst); - - WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.getWebServiceImplById(implId); - //IWebServiceType wst = WebServiceRuntimeExtensionUtils2.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 25a07a015..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.WebServiceRuntimeExtensionUtils2; -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.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 = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(wst); - String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(wst); - WebServiceImpl wsimpl = WebServiceRuntimeExtensionUtils2.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 4db0a341c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/Timer.java +++ /dev/null @@ -1,71 +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 e27ee08da..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ValidateWSDLJob.java +++ /dev/null @@ -1,88 +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.eclipse.WSDLValidator; - - - -public class ValidateWSDLJob extends Job { - - final public static String VALIDATE_WSDL_JOB_FAMILY = "ValidateWSDLJobJamily"; - - private String wsdlURI_ = null; - private IValidationMessage[] validationMessages_ = null; - private int validationMessageSeverity_ = -1; // default value - - 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(); - reportSummary(); - return Status.OK_STATUS; - } - - // calculate the higher severity for all the validation messages - private void reportSummary() { - int i; - int severity; - int errorCount = 0; - int warningCount = 0; - for (i=0; i<validationMessages_.length && errorCount == 0; i++) { - severity = validationMessages_[i].getSeverity(); - switch (severity) { - case IValidationMessage.SEV_ERROR: - errorCount++; - break; - case IValidationMessage.SEV_WARNING: - warningCount++; - break; - default: - break; - } - } - if (errorCount > 0) { - validationMessageSeverity_ = IValidationMessage.SEV_ERROR; - } else if (warningCount > 0) { - validationMessageSeverity_ = IValidationMessage.SEV_WARNING; - } - - } - - public boolean belongsTo(Object family) - { - return family == VALIDATE_WSDL_JOB_FAMILY; - } - - public IValidationMessage[] getValidationMessages() { - return validationMessages_; - } - - public int getValidationMessageSeverity() { - return validationMessageSeverity_; - } - - 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 221645b89..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ValidationMessageViewerWidget.java +++ /dev/null @@ -1,235 +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.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -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.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -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 ) - { - - 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( ConsumptionUIMessages.LABEL_VALIDATE_MESSAGES); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - messageLabel.setLayoutData(gd); - messageLabel.setToolTipText( ConsumptionUIMessages.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(ConsumptionUIMessages.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()); - - 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 2e2a8093a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java +++ /dev/null @@ -1,55 +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.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 eb94809af..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java +++ /dev/null @@ -1,551 +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.ConsumptionUIMessages; -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.osgi.util.NLS; -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.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -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; -import org.eclipse.wst.wsdl.validation.internal.IValidationMessage; - -public class WSDLSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget, Runnable -{ - private String pluginId_; - private FileExtensionFilter wsFilter_; - private WebServicesParser webServicesParser; - - private Composite parent_; - private Listener statusListener_; - private WSDLSelectionTreeWidget tree; - - /*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_; - - /*CONTEXT_ID PCON0004 for the Wizard WSDL Validation table of the WSDL Selection Page*/ - private ValidationMessageViewerWidget msgViewer_; - private ValidateWSDLJob validateWSDLJob_; - private JobChangeAdapter jobChangeAdapter_; - - /*CONTEXT_ID PCON0005 for the Wizard WSDL Validation summary message of the WSDL Selection Page*/ - private Text validationSummaryText_; - private Text validationSummaryText2_; - - - public WSDLSelectionWidget() - { - pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - wsFilter_ = new FileExtensionFilter(new String[] {"wsdl", "wsil", "html"}); - webServicesParser = WSDLParserFactory.getWSDLParser(); - - final Runnable handleValidationMessages = new Runnable() - { - public void run() - { - msgViewer_.setInput(validateWSDLJob_.getValidationMessages()); - updateValidationSummary(validateWSDLJob_.getValidationMessageSeverity()); - } - }; - - 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( pluginId_ ); - parent_ = parent; - statusListener_ = statusListener; - - parent.setToolTipText( ConsumptionUIMessages.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( ConsumptionUIMessages.LABEL_WS_SELECTION); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - wsLabel.setLayoutData(gd); - wsLabel.setToolTipText( ConsumptionUIMessages.TOOLTIP_PCON_TEXT_WS ); - - webServiceURI = uiUtils.createText( wsdlGroup, null, - ConsumptionUIMessages.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, ConsumptionUIMessages.BUTTON_BROWSE, - ConsumptionUIMessages.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); - - validationSummaryText_ = new Text( parent, SWT.WRAP); - validationSummaryText_.setEditable(false); - GridData gd1 = new GridData(GridData.FILL_BOTH); - validationSummaryText_.setLayoutData(gd1); - validationSummaryText_.setToolTipText( ConsumptionUIMessages.TOOLTIP_VALIDATE_TEXT_MESSAGE_SUMMARY ); - - validationSummaryText2_ = new Text( parent, SWT.WRAP); - validationSummaryText2_.setEditable(false); - validationSummaryText2_.setLayoutData(gd1); - - setMessageSummary(); - return this; - } - - private void setMessageSummary() { - String validationMessageSummary = ConsumptionUIMessages.MESSAGE_VALIDATE_NO_WSDL; - PersistentWSDLValidationContext wsdlValidationContext = WSPlugin.getInstance().getWSDLValidationContext(); - String validationSelection = wsdlValidationContext.getPersistentWSDLValidation(); - if (PersistentWSDLValidationContext.VALIDATE_REMOTE_WSDL.equals(validationSelection)) { - validationMessageSummary = ConsumptionUIMessages.MESSAGE_VALIDATE_REMOTE_WSDL; - } else if (PersistentWSDLValidationContext.VALIDATE_ALL_WSDL.equals(validationSelection)) { - validationMessageSummary = ConsumptionUIMessages.MESSAGE_VALIDATE_ALL_WSDL; - } - validationSummaryText_.setText( validationMessageSummary ); - validationSummaryText2_.setText(" "); - } - - 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("", ConsumptionUIMessages.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( ConsumptionUIMessages.PAGE_MSG_INVALID_WEB_SERVICE_URI ); - else if( wsPath.indexOf(':') < 0 ) - { - IResource res = ResourceUtils.findResource(wsPath); - if( res == null ) { - msgViewer_.clearInput(); - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.PAGE_MSG_NO_SUCH_FILE, new Object[] {wsPath}) ); - } - else if( res.getType() != IResource.FILE ) { - msgViewer_.clearInput(); - return StatusUtils.errorStatus( ConsumptionUIMessages.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(ConsumptionUIMessages.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)); - } - } - - setMessageSummary(); - 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; - validationSummaryText_.setText( ConsumptionUIMessages.MESSAGE_VALIDATE_IN_PROGRESS ); - validationSummaryText2_.setText(" "); - 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(); - } - - public void updateValidationSummary(int messageSeverity) - { - - switch (messageSeverity) { - case IValidationMessage.SEV_ERROR: - validationSummaryText_.setText(ConsumptionUIMessages.ERROR_MESSAGES_IN_VALIDATION); - validationSummaryText2_.setText(ConsumptionUIMessages.WARNING_IF_CONTINUE); - break; - case IValidationMessage.SEV_WARNING: - validationSummaryText_.setText(ConsumptionUIMessages.WARNING_MESSAGES_IN_VALIDATION); - validationSummaryText2_.setText(ConsumptionUIMessages.WARNING_IF_CONTINUE); - break; - default: - validationSummaryText_.setText(ConsumptionUIMessages.VALIDATION_COMPLETED); - validationSummaryText2_.setText(" "); - break; - } - } - - 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 80a6c1823..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWrapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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.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 070494cc5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidget.java +++ /dev/null @@ -1,251 +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.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.consumption.common.FacetUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -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.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; - - -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 ProjectSelectionWidget projectWidget_; - private boolean isVisible_; - - - public WidgetDataEvents addControls( Composite parent, final Listener statusListener ) - { - UIUtils uiUtils = new UIUtils( pluginId_ ); - - clientGroup_ = uiUtils.createGroup( parent, ConsumptionUIMessages.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(); - } - }); - - - projectWidget_ = new ProjectSelectionWidget(true); - projectWidget_.addControls( clientGroup_, statusListener ); - - 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 getClientRuntimeId() - { - //calculate the most appropriate clientRuntimeId based on current settings. - String projectName = projectWidget_.getProjectName(); - String templateId = projectWidget_.getComponentType(); - - //Find the client runtime that fits this profile best. - return WebServiceRuntimeExtensionUtils2.getClientRuntimeId(runtimeWidget_.getTypeRuntimeServer(), projectName, templateId); - } - - public boolean getClientNeedEAR() - { - return projectWidget_.getNeedEAR(); - } - - public void setClientNeedEAR(boolean b) - { - projectWidget_.setNeedEAR(b); - } - - public String getClientProjectName() - { - return projectWidget_.getProjectName(); - } - - public void setClientProjectName( String name ) - { - projectWidget_.setProjectName( name ); - } - - public String getClientEarProjectName() - { - return projectWidget_.getEarProjectName(); - } - - public void setClientEarProjectName( String name ) - { - projectWidget_.setEarProjectName( name ); - } - - public String getClientComponentType() - { - return projectWidget_.getComponentType(); - } - - public void setClientComponentType( String type ) - { - projectWidget_.setComponentType( type ); - } - - private void handleUpdateProjectWidget() - { - projectWidget_.setTypeRuntimeServer(runtimeWidget_.getTypeRuntimeServer()); - - //Update the list of projects shown to the user. - projectWidget_.refreshProjectItems(); - } - - public ProjectSelectionWidget getProjectSelectionWidget() { - return this.projectWidget_; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.ui.widgets.WidgetContributor#getStatus() - */ - public IStatus getStatus() - { - //MessageUtils msgUtils = new MessageUtils( pluginId_ + ".plugin", this ); - ValidationUtils valUtils = new ValidationUtils(); - //Return OK all the time for now. - 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 - { - String projectName = projectWidget_.getProjectName(); - if (projectName != null && projectName.length()>0) - { - //If the project exists, ensure that it is suitable for the selected runtime - //and server. - - IProject project = ProjectUtilities.getProject(projectName); - String typeId = getClientTypeRuntimeServer().getTypeId(); - String runtimeId = getClientTypeRuntimeServer().getRuntimeId(); - String serverFactoryId = getClientTypeRuntimeServer().getServerId(); - - if (project.exists()) - { - //Check if the runtime supports it. - if (!WebServiceRuntimeExtensionUtils2.doesClientTypeAndRuntimeSupportProject(typeId, runtimeId, projectName)) - { - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); - finalStatus = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_PROJECT, new String[]{runtimeLabel, projectName})); - } - - //Check if the server supports it. - - if (serverFactoryId!=null && serverFactoryId.length()>0) - { - if (!valUtils.doesServerSupportProject(serverFactoryId, projectName)) - { - String serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverFactoryId); - finalStatus = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_PROJECT, new String[]{serverLabel, projectName})); - } - } - } - else - { - //Look at the project type to ensure that it is suitable for the selected runtime - //and server. - - String templateId = getClientComponentType(); - - if (templateId != null && templateId.length()>0) - { - //Check if the runtime supports it. - if (!WebServiceRuntimeExtensionUtils2.doesClientTypeAndRuntimeSupportTemplate(typeId, runtimeId, templateId)) - { - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); - String templateLabel = FacetUtils.getTemplateLabelById(templateId); - finalStatus = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE, new String[]{runtimeLabel, templateLabel})); - } - - //Check if the server supports it. - if (serverFactoryId!=null && serverFactoryId.length()>0) - { - if (!valUtils.doesServerSupportTemplate(serverFactoryId, templateId)) - { - String serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverFactoryId); - String templateLabel = FacetUtils.getTemplateLabelById(templateId); - finalStatus = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_TEMPLATE, new String[]{serverLabel, templateLabel})); - } - } - } - - - - } - } - } - - 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 aa6e1484a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java +++ /dev/null @@ -1,1129 +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.ArrayList; -import java.util.Iterator; -import java.util.Set; -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.server.core.FacetUtil; -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.common.FacetMatcher; -import org.eclipse.jst.ws.internal.consumption.common.FacetUtils; -import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -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.preferences.ProjectTopologyContext; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.command.internal.env.core.selection.SelectionList; -import org.eclipse.wst.command.internal.env.core.selection.SelectionListChoices; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -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; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.ws.internal.wsrt.IContext; -import org.eclipse.wst.ws.internal.wsrt.ISelection; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime; -import org.eclipse.wst.ws.internal.wsrt.SimpleContext; -import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo; -import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario; -import org.eclipse.wst.ws.internal.wsrt.WebServiceState; - -public class ClientRuntimeSelectionWidgetDefaultingCommand extends AbstractDataModelOperation -{ - - private TypeRuntimeServer clientIds_; - private boolean clientIdsFixed_ = false; - private String clientRuntimeId_; - private String clientProjectName_; - private String clientEarProjectName_; - protected boolean clientNeedEAR_ = true; - private String clientComponentType_; - private FacetMatcher clientFacetMatcher_; - - 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 wsdlURI_; - - public ClientRuntimeSelectionWidgetDefaultingCommand() - { - super(); - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer ids ) - { - clientIds_ = ids; - } - - public TypeRuntimeServer getClientTypeRuntimeServer() - { - return clientIds_; - } - - public void setClientIdsFixed(boolean b) - { - clientIdsFixed_ = b; - } - - public String getClientRuntimeId() - { - return clientRuntimeId_; - } - - public String getClientProjectName() - { - return clientProjectName_; - } - - public String getClientEarProjectName() - { - return clientEarProjectName_; - } - - public void setClientEarProjectName(String name) - { - clientEarProjectName_ = name; - } - - public String getClientComponentType() - { - return clientComponentType_; - } - - public IWebServiceClient getWebService() - { - return webServiceClient_; - } - - public IContext getContext() - { - return context_; - } - - public ISelection getSelection() - { - return selection_; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable adaptable) - { - - IEnvironment env = getEnvironment(); - - try - { - - if (clientIdsFixed_) - { - // Set the clientRuntime based on the runtime, server, and initial - // selection. - clientRuntimeId_ = getDefaultClientRuntimeForFixedRuntimeAndServer(clientInitialProject_); - } - else - { - // Set the runtime based on the initial selection - clientRuntimeId_ = getDefaultClientRuntime(clientInitialProject_); - if (clientRuntimeId_ == null) - { - // return and error. - } - clientIds_.setRuntimeId(WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRuntime() - .getId()); - } - - // Set the project - if (clientProjectName_ == null) - { - // Project name did not get set when the runtime was set, so set it now - clientProjectName_ = getDefaultClientProjectName(); - } - - IProject clientProject = ProjectUtilities.getProject(clientProjectName_); - if (!clientProject.exists()) - { - // Set the project template - clientComponentType_ = getDefaultClientProjectTemplate(); - } - else - { - //Set it to an empty String - clientComponentType_ = ""; - } - - - // Set the server - if (!clientIdsFixed_) - { - IStatus serverStatus = setClientDefaultServer(); - if (serverStatus.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(serverStatus); - return serverStatus; - } - } - - setDefaultClientEarProject(); - // 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(NLS.bind(ConsumptionUIMessages.MSG_ERROR_TASK_EXCEPTED, - new String[] { e.getMessage() }), e); - env.getStatusHandler().reportError(errorStatus); - return errorStatus; - } - } - - private void setDefaultClientEarProject() - { - //Don't need an ear if this is a Java project, or if the selected template is jst.utility - IProject clientProject = ProjectUtilities.getProject(clientProjectName_); - if (clientProject.exists()) - { - clientNeedEAR_ = !(FacetUtils.isJavaProject(clientProject)); - } - else - { - clientNeedEAR_ = !(FacetUtils.isUtilityTemplate(clientComponentType_)); - } - - //If clientNeedEAR_ is still true, it means that we're not dealing with a Java project - //or Java project type. Check the server. - if (clientNeedEAR_) - { - // Determine if an ear selection is needed based on the server type. - - String serverId = clientIds_.getServerId(); - if (serverId != null) - { - // Use the server type - String serverTargetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverId); - if (serverTargetId != null && serverTargetId.length() > 0) - { - if (!ServerUtils.isTargetValidForEAR(serverTargetId, "13")) - { - // Default the EAR selection to be empty - clientNeedEAR_ = false; - } - } - } - } - - if (clientNeedEAR_) - { - clientEarProjectName_ = getDefaultClientEarProjectName(); - } - else - { - clientEarProjectName_ = ""; - } - } - - private IStatus setClientDefaultServer() - { - //Choose an existing server the module is already associated with if possible - IProject clientProject = ProjectUtilities.getProject(clientProjectName_); - IServer[] configuredServers = ServerUtil.getServersByModule(ServerUtils.getModule(clientProject), null); - - if (configuredServers!=null && configuredServers.length>0) - { - clientIds_.setServerId(configuredServers[0].getServerType().getId()); - clientIds_.setServerInstanceId(configuredServers[0].getId()); - return Status.OK_STATUS; - } - - //If the project exists, choose a suitable server or server type based on the existing project's runtime or facets - if (clientProject.exists()) - { - IServer server = getServerFromProject(clientProjectName_, clientFacetMatcher_); - if (server != null) - { - clientIds_.setServerId(server.getServerType().getId()); - clientIds_.setServerInstanceId(server.getId()); - return Status.OK_STATUS; - } - else - { - IServerType serverType = getServerTypeFromProject(clientProjectName_, clientFacetMatcher_); - if (serverType != null) - { - clientIds_.setServerId(serverType.getId()); - return Status.OK_STATUS; - } - } - } - - //Haven't picked a server/server type on the basis of the project. Pick a server/server type - //that is compatible with the clientRuntimeId. - IServer server = getServerFromClientRuntimeId(); - if (server!=null) - { - clientIds_.setServerId(server.getServerType().getId()); - clientIds_.setServerInstanceId(server.getId()); - return Status.OK_STATUS; - } - - IServerType serverType = getServerTypeFromClientRuntimeId(); - if (serverType != null) - { - clientIds_.setServerId(serverType.getId()); - return Status.OK_STATUS; - } - - //No suitable server was found. Popup an error. - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(clientIds_.getRuntimeId()); - String serverLabels = getServerLabels(clientRuntimeId_); - IStatus status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_ERROR_NO_SERVER_RUNTIME, new String[]{runtimeLabel, serverLabels}) ); - return status; - } - - private IServer getServerFromClientRuntimeId() - { - IServer[] servers = ServerCore.getServers(); - if (servers != null && servers.length > 0) { - for (int i = 0; i < servers.length; i++) - { - String serverFactoryId = servers[i].getServerType().getId(); - if (WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportServer(clientRuntimeId_, serverFactoryId)) - { - return servers[i]; - } - } - } - return null; - } - - private IServerType getServerTypeFromClientRuntimeId() - { - String[] serverTypes = WebServiceRuntimeExtensionUtils2.getServerFactoryIdsByClientRuntime(clientRuntimeId_); - if (serverTypes!=null && serverTypes.length>0) - { - //Return the preferred one if it is in the list - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String preferredServerFactoryId = context.getServerFactoryId(); - for (int i=0; i<serverTypes.length; i++) - { - if (serverTypes[i].equals(preferredServerFactoryId)) - { - return ServerCore.findServerType(serverTypes[i]); - } - } - - return ServerCore.findServerType(serverTypes[0]); - } - - return null; - } - - protected IServer getServerFromProject(String projectName, FacetMatcher facetMatcher) - { - IServer server = null; - - IProject project = ProjectUtilities.getProject(projectName); - IServer[] servers = ServerCore.getServers(); - - if (servers.length > 0) - { - // Get the runtime. - org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = null; - IFacetedProject fProject = null; - - if (project != null && project.exists()) - { - try - { - fProject = ProjectFacetsManager.create(project); - if (fProject != null) - { - fRuntime = fProject.getRuntime(); - } - } catch (CoreException ce) - { - - } - } - - if (fRuntime != null) - { - // Get an existing server that has the same runtime. - IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - for (int i = 0; i < servers.length; i++) - { - IServer thisServer = servers[i]; - if (thisServer.getRuntime().getId().equals(sRuntime.getId())) - { - server = thisServer; - break; - } - } - } - - // If an existing server could not be chosen on the basis of the project's - // runtime, - // try to find an existing server using the project's facets and the - // facetsToAdd. - if (server == null) - { - if (project!=null && project.exists()) - { - Set facets = FacetUtils.getFacetsForProject(project.getName()); - if (facets != null) - { - if (facetMatcher.getFacetsToAdd() != null) - { - Iterator itr = facetMatcher.getFacetsToAdd().iterator(); - while (itr.hasNext()) - { - facets.add(itr.next()); - } - } - server = getServerFromFacets(facets); - } - } - } - } - return server; - } - - protected IServer getServerFromFacets(Set facets) - { - IServer server = null; - Set runtimes = FacetUtils.getRuntimes(new Set[]{facets}); - Iterator itr = runtimes.iterator(); - IServer[] servers = ServerCore.getServers(); - - outer: - while(itr.hasNext()) - { - org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)itr.next(); - IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - for (int i=0; i<servers.length; i++) - { - IServer thisServer = servers[i]; - if (thisServer.getRuntime().getId().equals(sRuntime.getId())) - { - server = thisServer; - break outer; - } - } - } - - return server; - } - - protected IServerType getServerTypeFromProject(String projectName, FacetMatcher facetMatcher) - { - IServerType serverType = null; - - IProject project = ProjectUtilities.getProject(projectName); - IServerType[] serverTypes = ServerCore.getServerTypes(); - - //Get the runtime. - org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = null; - IFacetedProject fProject = null; - - if (project != null && project.exists()) - { - try - { - fProject = ProjectFacetsManager.create(project); - if (fProject != null) - { - fRuntime = fProject.getRuntime(); - } - } catch (CoreException ce) - { - - } - } - - if (fRuntime != null) - { - //Get a server type that has the same runtime type. - IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - for (int i=0; i<serverTypes.length; i++) - { - IServerType thisServerType = serverTypes[i]; - if (thisServerType.getRuntimeType().getId().equals(sRuntime.getRuntimeType().getId())) - { - serverType = thisServerType; - break; - } - } - } - - //If a server type could not be chosen on the basis of the project's runtime, - //try to find a server type using the project's facets and the facetsToAdd. - if (serverType == null) - { - if (project != null && project.exists()) - { - Set facets = FacetUtils.getFacetsForProject(project.getName()); - if (facets != null) - { - if (facetMatcher.getFacetsToAdd() != null) - { - Iterator itr = facetMatcher.getFacetsToAdd().iterator(); - while (itr.hasNext()) - { - facets.add(itr.next()); - } - } - serverType = getServerTypeFromFacets(facets); - } - } - } - - return serverType; - } - - protected IServerType getServerTypeFromFacets(Set facets) - { - IServerType serverType = null; - Set runtimes = FacetUtils.getRuntimes(new Set[]{facets}); - Iterator itr = runtimes.iterator(); - IServerType[] serverTypes = ServerCore.getServerTypes(); - - outer: - while(itr.hasNext()) - { - org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)itr.next(); - IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - for (int i=0; i<serverTypes.length; i++) - { - IServerType thisServerType = serverTypes[i]; - if (thisServerType.getRuntimeType().getId().equals(sRuntime.getRuntimeType().getId())) - { - serverType = thisServerType; - break outer; - } - } - } - - return serverType; - } - - protected IServer getServerFromProjectType(String templateId, FacetMatcher facetMatcher) - { - IServer server = null; - Set facets = FacetUtils.getInitialFacetVersionsFromTemplate(templateId); - if (facetMatcher.getFacetsToAdd() != null) - { - Iterator itr = facetMatcher.getFacetsToAdd().iterator(); - while (itr.hasNext()) - { - facets.add(itr.next()); - } - } - server = getServerFromFacets(facets); - return server; - } - - protected IServerType getServerTypeFromProjectType(String templateId, FacetMatcher facetMatcher) - { - IServerType serverType = null; - Set facets = FacetUtils.getInitialFacetVersionsFromTemplate(templateId); - if (facetMatcher.getFacetsToAdd() != null) - { - Iterator itr = facetMatcher.getFacetsToAdd().iterator(); - while (itr.hasNext()) - { - facets.add(itr.next()); - } - } - //TODO Instead of passing in a single set of facets, pass in multiple sets, if the - //jst.java facet is one of them and the clientRuntimeId allows newer. - serverType = getServerTypeFromFacets(facets); - return serverType; - } - - private String getDefaultClientProjectTemplate() - { - String[] templates = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(clientIds_.getTypeId(), clientIds_.getRuntimeId()); - RequiredFacetVersion[] rfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRequiredFacetVersions(); - - //Pick the Web one if it's there, otherwise pick the first one. - //Walk the list of client project types in the project topology preference - ProjectTopologyContext ptc= WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - String[] preferredTemplateIds = ptc.getClientTypes(); - for (int j=0; j<preferredTemplateIds.length; j++) - { - for (int i=0; i<templates.length; i++) - { - String templateId = templates[i]; - if (templateId.equals(preferredTemplateIds[j])) - { - //Calculate the facet matcher for the template so that we know - //what to create and what to add during module creation. - - Set facetVersions = FacetUtils.getInitialFacetVersionsFromTemplate(templateId); - FacetMatcher fm = FacetUtils.match(rfv, facetVersions); - if (fm.isMatch()) - { - clientFacetMatcher_ = fm; - return templates[i]; - } - - } - } - } - - - //Didn't find a template id in the preferred list that worked. - //Return the first one that is a match. Calculate the facet matcher for the template - //so that we know what to create and what to add during module creation. - for (int j = 0; j < templates.length; j++) - { - String templateId = templates[j]; - Set facetVersions = FacetUtils.getInitialFacetVersionsFromTemplate(templateId); - FacetMatcher fm = FacetUtils.match(rfv, facetVersions); - if (fm.isMatch()) - { - clientFacetMatcher_ = fm; - return templates[j]; - } - } - - //Still nothing, return the first one if available. - if (templates.length > 0) - return templates[0]; - - return ""; - } - - private String getDefaultClientProjectName() - { - IProject[] projects = FacetUtils.getAllProjects(); - ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_); - RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions(); - - //Check each project for compatibility with the clientRuntime - for (int i=0; i<projects.length; i++) - { - Set facetVersions = FacetUtils.getFacetsForProject(projects[i].getName()); - if (facetVersions != null) - { - FacetMatcher fm = FacetUtils.match(rfvs, facetVersions); - if (fm.isMatch()) - { - clientFacetMatcher_ = fm; - return projects[i].getName(); - } - } - } - - //No project was suitable, return a new project name - return ResourceUtils.getDefaultWebProjectName(); - - } - - private String getDefaultClientRuntimeForFixedRuntimeAndServer(IProject project) - { - String[] clientRuntimes = WebServiceRuntimeExtensionUtils2.getClientRuntimesByType(clientIds_.getTypeId()); - ArrayList validClientRuntimes = new ArrayList(); - for (int i=0; i<clientRuntimes.length; i++ ) - { - ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimes[i]); - if (desc.getRuntime().getId().equals(clientIds_.getRuntimeId())) - { - //Check if this client runtime supports the server - if (WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportServer(desc.getId(), clientIds_.getServerId())) - { - validClientRuntimes.add(desc.getId()); - if (project != null && project.exists()) - { - RequiredFacetVersion[] rfv = desc.getRequiredFacetVersions(); - Set facetVersions = FacetUtils.getFacetsForProject(project.getName()); - if (facetVersions != null) - { - FacetMatcher fm = FacetUtils.match(rfv, facetVersions); - if (fm.isMatch()) - { - clientFacetMatcher_ = fm; - clientProjectName_ = project.getName(); - return desc.getId(); - } - } - } - - } - } - - } - - if (validClientRuntimes.size() > 0) - { - //We couldn't match to the initially selected project so return the first valid runtime. - return ((String[])validClientRuntimes.toArray(new String[0]))[0]; - } - else - { - //There are no client runtimes that match the fixed runtime and server. Fall back to original algorithm - clientIdsFixed_ = false; - return getDefaultClientRuntime(project); - } - } - - private String getDefaultClientRuntime(IProject project) - { - - - String[] clientRuntimes = WebServiceRuntimeExtensionUtils2.getClientRuntimesByType(clientIds_.getTypeId()); - - //Check if the preferred Web service runtime works with the initially selected project. - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String runtimeId = context.getRuntimeId(); - ArrayList preferredClientRuntimeIdsList = new ArrayList(); - for (int k=0; k<clientRuntimes.length; k++ ) - { - ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimes[k]); - if (desc.getRuntime().getId().equals(runtimeId)) - { - preferredClientRuntimeIdsList.add(desc.getId()); - } - } - String[] preferredClientRuntimeIds = (String[])preferredClientRuntimeIdsList.toArray(new String[0]); - - - if (project != null && project.exists()) - { - Set facetVersions = FacetUtils.getFacetsForProject(project.getName()); - if (facetVersions != null) - { - for (int p = 0; p < preferredClientRuntimeIds.length; p++) - { - RequiredFacetVersion[] prfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById( - preferredClientRuntimeIds[p]).getRequiredFacetVersions(); - FacetMatcher fm = FacetUtils.match(prfv, facetVersions); - if (fm.isMatch()) - { - clientFacetMatcher_ = fm; - clientProjectName_ = project.getName(); - return preferredClientRuntimeIds[p]; - } - } - } - } - - //Either there was no initially selected project or the preferred - //runtimes did not work with the initially selected project. - //If possible, pick a Web service runtime that works with the initially selected project. - //If the initially selected project does not work with any of the Web service runtimes, choose - //a runtime based on the preferred client project types. - - - if (project != null && project.exists()) - { - for (int i=0; i<clientRuntimes.length; i++) - { - RequiredFacetVersion[] rfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimes[i]).getRequiredFacetVersions(); - Set facetVersions = FacetUtils.getFacetsForProject(project.getName()); - if (facetVersions != null) - { - FacetMatcher fm = FacetUtils.match(rfv, facetVersions); - if (fm.isMatch()) - { - clientFacetMatcher_ = fm; - clientProjectName_ = project.getName(); - return clientRuntimes[i]; - } - } - } - } - - //Haven't returned yet so this means that the intitially selected project cannot be used - //to influence the selection of the runtime. Use the preferred client project types to - //influence the selection of a runtime. - ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - String[] preferredTemplateIds = ptc.getClientTypes(); - - for (int n=0; n<preferredTemplateIds.length; n++) - { - String preferredTemplateId = preferredTemplateIds[n]; - Set facetVersions = FacetUtils.getInitialFacetVersionsFromTemplate(preferredTemplateId); - - for (int m=0; m<preferredClientRuntimeIds.length; m++) - { - //If this clientRuntime supports this template, choose it and exit. - ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(preferredClientRuntimeIds[m]); - RequiredFacetVersion[] rfv = desc.getRequiredFacetVersions(); - FacetMatcher fm = FacetUtils.match(rfv, facetVersions); - if (fm.isMatch()) - { - return preferredClientRuntimeIds[m]; - } - } - } - - //Still haven't returned. Returned the first preferred client runtime id. - if (preferredClientRuntimeIds.length > 0) - { - return preferredClientRuntimeIds[0]; - } - - if (clientRuntimes.length > 0) - return WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimes[0]).getId(); - else - return null; - } - - /** - * - * @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() - { - String[] flexProjects = getAllFlexibleProjects(); - return new SelectionList(flexProjects, 0); - } - - 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; - } - - - protected String getDefaultClientEarProjectName() - { - IProject clientProject = ProjectUtilities.getProject(clientProjectName_); - IVirtualComponent[] earComps = J2EEUtils.getReferencingEARComponents(clientProject); - if (earComps.length>0) - { - //Pick the first one - return earComps[0].getName(); - } - - //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) - { - //TODO Choose an existing EAR that can be added to the server and who's J2EE level in consistent with - //that of the selected project, if applicable. Picking the first one for now. - return allEarComps[0].getName(); - } - else - { - //there are no Ears. - return ResourceUtils.getDefaultClientEARProjectName(); - } - } - - - private String getServerLabels(String clientRuntimeId) - { - String[] validServerFactoryIds = WebServiceRuntimeExtensionUtils2.getServerFactoryIdsByClientRuntime(clientRuntimeId); - //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(); - } - - - /* - * Update the client project, client project type and clientRuntime as needed. - * Used by ServerRuntimeSelectionWidgetDefaultingCommand to update client side - * stuff based on service side defaults. - */ - protected void updateClientProject(String projectName, String serviceTypeId) - { - boolean isEJB = false; - String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(serviceTypeId); - isEJB = (implId.equals("org.eclipse.jst.ws.wsImpl.ejb")); - String[] updatedNames = ResourceUtils.getClientProjectComponentName(projectName, projectName, isEJB); - clientProjectName_ = updatedNames[0]; - - IProject clientProject = ProjectUtilities.getProject(clientProjectName_); - if (clientProject.exists()) - { - clientComponentType_ = ""; - clientRuntimeId_ = WebServiceRuntimeExtensionUtils2.getClientRuntimeId(clientIds_, projectName, clientComponentType_); - - } - else - { - //Pick a client project type based on project topology preferences. Modify the clientRuntimeId_ - //as needed. - String[] templateIds = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(clientIds_.getTypeId(), clientIds_.getRuntimeId()); - ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - String[] preferredTemplateIds = ptc.getClientTypes(); - outer: - for (int j = 0; j < preferredTemplateIds.length; j++) - { - for (int i = 0; i < templateIds.length; i++) - { - String templateId = templateIds[i]; - if (templateId.equals(preferredTemplateIds[j])) - { - //Get a clientRuntimeId for this template - String newClientRuntimeId = WebServiceRuntimeExtensionUtils2.getClientRuntimeId(clientIds_, clientProjectName_, templateId); - if (newClientRuntimeId.length() > 0) - { - clientRuntimeId_ = newClientRuntimeId; - clientComponentType_ = templateId; - break outer; - } - } - } - } - } - } - - - private void setDefaultsForExtension(IEnvironment env) - { - IWebServiceRuntime wsrt = WebServiceRuntimeExtensionUtils2.getClientRuntime(clientRuntimeId_); - if (wsrt != null) - { - WebServiceClientInfo wsInfo = new WebServiceClientInfo(); - 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); - } - } - - public void setClientInitialProject(IProject clientInitialProject) - { - clientInitialProject_ = clientInitialProject; - } - - /** - * @param initialInitialSelection_ The initialInitialSelection_ to set. - */ - public void setInitialInitialSelection(IStructuredSelection initialInitialSelection) - { - // TODO Delete this method and corresponding mappings - // if no longer required. - } - - public boolean getClientNeedEAR() - { - return clientNeedEAR_; - } - - /** - * @param parser_ The parser_ to set. - */ - public void setWebServicesParser(WebServicesParser parser) { - // TODO Delete this method and corresponding mappings - // if no longer required. - } - - 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; - } - - 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 1ba81e3f2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java +++ /dev/null @@ -1,730 +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.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.common.FacetUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.preferences.ProjectTopologyContext; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.osgi.util.NLS; -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.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class ProjectSelectionWidget extends SimpleWidgetDataContributor { - - - - private String pluginId_ = "org.eclipse.jst.ws.consumption.ui"; - - //private SelectionListChoices projects_; - - private boolean needEAR_; - - private TypeRuntimeServer trsIds_; - - private Listener statusListener_; - - private Text messageText_; - - private boolean isClient_ = false; - - 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 Combo projectType_; - - private String[] templates_; - - //private String componentType_; - - private ModifyListener projectTypeListener_; - private ModifyListener moduleProjectListener_; - private ModifyListener earProjectListener_; - - /* - * 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 PWRS0018 for the client project type combo box of the runtime selection Page */ - private String INFOPOP_PWRS_COMBO_CLIENT_PROJECT_TYPE = pluginId_ + ".PWRS0018"; - - /* CONTEXT_ID PWRS0024 for the service project type combo box of the runtime selection Page */ - private String INFOPOP_PWRS_COMBO_SERVICE_PROJECT_TYPE = pluginId_ + ".PWRS0018"; - - //private Combo earModule_; - - /* - * Default Constructor - */ - public ProjectSelectionWidget() { - } - - /* - * ProjectSelectionWidget @param isClient - */ - public ProjectSelectionWidget(boolean isClient) { - this.isClient_ = isClient; - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) { - - UIUtils uiUtils = new UIUtils(pluginId_); - - statusListener_ = statusListener; - - if (isClient_) - { - projectType_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_CLIENT_TYPE, ConsumptionUIMessages.TOOLTIP_PWCR_COMBO_CLIENT_TYPE, INFOPOP_PWRS_COMBO_CLIENT_PROJECT_TYPE, SWT.SINGLE | SWT.BORDER); - moduleProject_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_CLIENT_PROJECT, ConsumptionUIMessages.LABEL_CLIENT_PROJECT, INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - //module_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_CLIENT_MODULE", ConsumptionUIMessages.LABEL_CLIENT_MODULE", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - earProject_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_CLIENT_EAR_PROJECT, ConsumptionUIMessages.LABEL_CLIENT_EAR_PROJECT, INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - //earModule_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_CLIENT_EAR_MODULE", ConsumptionUIMessages.LABEL_CLIENT_EAR_MODULE", INFOPOP_PWRS_COMBO_EAR, SWT.SINGLE | SWT.BORDER ); - } - else - { - projectType_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_SERVICE_TYPE, ConsumptionUIMessages.TOOLTIP_PWCR_COMBO_SERVICE_TYPE, INFOPOP_PWRS_COMBO_SERVICE_PROJECT_TYPE, SWT.SINGLE | SWT.BORDER); - moduleProject_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_SERVICE_PROJECT, ConsumptionUIMessages.LABEL_SERVICE_PROJECT, INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - //module_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_SERVICE_MODULE", ConsumptionUIMessages.LABEL_SERVICE_MODULE", INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - earProject_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_SERVICE_EAR_PROJECT, ConsumptionUIMessages.LABEL_SERVICE_EAR_PROJECT, INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - //earModule_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_SERVICE_EAR_MODULE, ConsumptionUIMessages.LABEL_SERVICE_EAR_MODULE, INFOPOP_PWRS_COMBO_EAR, SWT.SINGLE | SWT.BORDER ); - } - - //Temporarily remove the listeners - - projectTypeListener_ = new ModifyListener() - { - public void modifyText(ModifyEvent evt) - { - statusListener_.handleEvent( null ); - } - }; - - moduleProjectListener_ = new ModifyListener() - { - public void modifyText(ModifyEvent evt) - { - handleProjectChanged(); - statusListener_.handleEvent( null ); - } - }; - - earProjectListener_ = new ModifyListener() - { - public void modifyText(ModifyEvent evt) - { - statusListener_.handleEvent( null ); - } - }; - - // message area - messageText_ = uiUtils.createText(parent, ConsumptionUIMessages.LABEL_NO_LABEL, ConsumptionUIMessages.LABEL_NO_LABEL, null, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY); - setEarProjectItems(); - - return this; - } - - private void listenersOn() - { - projectType_.addModifyListener(projectTypeListener_); - moduleProject_.addModifyListener( moduleProjectListener_ ); - earProject_.addModifyListener( earProjectListener_ ); - } - - private void listenersOff() - { - projectType_.removeModifyListener(projectTypeListener_); - moduleProject_.removeModifyListener( moduleProjectListener_ ); - earProject_.removeModifyListener( earProjectListener_ ); - } - - /* - 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 ); - - IVirtualComponent[] components = J2EEUtils.getReferencingEARComponents( project ); - - 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 getProjectName() - { - return moduleProject_.getText(); - } - - public void setProjectName( String name ) - { - listenersOff(); - moduleProject_.setText( name ); - handleProjectChanged(); - listenersOn(); - } - - public String getEarProjectName() - { - return earProject_.getText(); - } - - public void setEarProjectName( String name ) - { - listenersOff(); - earProject_.setText( name ); - listenersOn(); - } - - public void setComponentType( String type ) - { - listenersOff(); - if (type != null && type.length()>0) - { - String label = FacetUtils.getTemplateLabelById(type); - projectType_.setText(label); - } - else - projectType_.setText(""); - - listenersOn(); - } - - public String getComponentType() - { - int idx = projectType_.getSelectionIndex(); - if (templates_ != null && idx > -1) - { - return templates_[idx]; - } - else - { - String templateLabel = projectType_.getText(); - String templateId = FacetUtils.getTemplateIdByLabel(templateLabel); - return templateId; - } - - } - - public boolean getNeedEAR() - { - return needEAR_; - } - - public void setNeedEAR(boolean b) - { - listenersOff(); - needEAR_ = b; - if (needEAR_) - { - earProject_.setEnabled(true); - populateEARCombos(); - } - else - { - earProject_.setEnabled(false); - earProject_.setText(""); - } - listenersOn(); - } - - public void setTypeRuntimeServer(TypeRuntimeServer trs) - { - trsIds_ = trs; - listenersOff(); - updateEARState(); - listenersOn(); - } - - public void refreshProjectItems() - { - listenersOff(); - String selectedModuleProject = moduleProject_.getText(); - String runtimeId = trsIds_.getRuntimeId(); - String typeId = trsIds_.getTypeId(); - - //Get all the projects that are compatible with the type and runtime - String[] projectNames = null; - if (isClient_) - { - projectNames = WebServiceRuntimeExtensionUtils2.getProjectsForClientTypeAndRuntime(typeId, runtimeId); - } - else - { - projectNames = WebServiceRuntimeExtensionUtils2.getProjectsForServiceTypeAndRuntime(typeId, runtimeId); - } - - moduleProject_.setItems(projectNames); - moduleProject_.setText(selectedModuleProject); - handleProjectChanged(); - listenersOn(); - } - - public void setEarProjectItems() - { - IVirtualComponent[] ears = J2EEUtils.getAllEARComponents(); - String[] earProjectNames = new String[ears.length]; - for (int i=0; i<earProjectNames.length; i++) - { - earProjectNames[i]=ears[i].getProject().getName(); - } - earProject_.setItems(earProjectNames); - - if (earProjectNames.length > 0) - earProject_.select(0); - } - - private void handleProjectChanged() - { - updateEARState(); - updateTemplates(); - } - - private void updateTemplates() - { - String projectName = moduleProject_.getText(); - if (projectName != null && projectName.length()>0) - { - IProject project = ProjectUtilities.getProject(projectName); - if (project.exists()) - { - projectType_.setEnabled(false); - projectType_.setText(""); - } - else - { - populateProjectTypeCombo(); - projectType_.setEnabled(true); - } - } - } - - private void populateProjectTypeCombo() - { - //Get the old value if there was one. - String oldTemplateId = getComponentType(); - - String[] templates = null; - if (isClient_) - { - templates = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(trsIds_.getTypeId(), trsIds_.getRuntimeId()); - } - else - { - templates = WebServiceRuntimeExtensionUtils2.getServiceProjectTemplates(trsIds_.getTypeId(), trsIds_.getRuntimeId()); - } - - String[] templateLabels = FacetUtils.getTemplateLabels(templates); - projectType_.setItems(templateLabels); - templates_ = templates; - - if (templates.length > 0) - { - - //Select the previous template selection if that one is in the list. - int idx = getIndexOfTemplateId(templates, oldTemplateId); - if (idx > -1) - { - projectType_.select(idx); - } - else - { - - if (isClient_) - { - // Select the preferred client project type. - ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - String[] preferredTemplateIds = ptc.getClientTypes(); - boolean selected = false; - outer: for (int j = 0; j < preferredTemplateIds.length; j++) - { - for (int i = 0; i < templates.length; i++) - { - String templateId = templates[i]; - if (templateId.equals(preferredTemplateIds[j])) - { - projectType_.select(i); - selected = true; - break outer; - } - } - } - - if (!selected) - { - projectType_.select(0); - } - - } else - { - // If a "..web.." template is there, pick that as the default. - int webTemplateIndex = getWebTemplateIndex(templates); - if (webTemplateIndex > -1) - { - projectType_.select(webTemplateIndex); - } else - { - projectType_.select(0); - } - } - } - } - } - - - private int getIndexOfTemplateId(String[] templateIds, String templateId) - { - for (int i=0; i<templateIds.length; i++) - { - if (templateIds[i].equals(templateId)) - { - return i; - } - } - - return -1; - } - - private int getWebTemplateIndex(String[] templateIds) - { - for (int i=0; i<templateIds.length; i++) - { - if (templateIds[i].indexOf("web") > -1) - { - return i; - } - } - - return -1; - } - - private void updateEARState() - { - if(!projectNeedsEAR(moduleProject_.getText())) - { - earProject_.setEnabled(false); - earProject_.setText(""); - needEAR_ = false; - } - else - { - needEAR_ = true; - earProject_.setEnabled(true); - populateEARCombos(); - } - - } - - private void populateEARCombos() - { - earProject_.removeAll(); - String projectName = moduleProject_.getText(); - if (projectName != null && projectName.length() > 0) - { - IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if (proj.exists()) - { - IVirtualComponent[] ears = J2EEUtils.getReferencingEARComponents(proj); - if (ears != null && ears.length > 0) - { - for (int i = 0; i < ears.length; i++) - { - earProject_.add(ears[i].getName()); - } - earProject_.select(0); - return; - } - } - - String earName = projectName + "EAR"; - earProject_.setText(earName); - } - else - { - setEarProjectItems(); - } - } - - private boolean projectNeedsEAR(String projectName) - { - //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,"13")) //rm j2ee - { - return false; - } - } - } - - return true; - } - - - private IStatus handleSetMessageText() { - IStatus status = Status.OK_STATUS; - try { - byte result = (byte) 0; - if (moduleProject_.getText().length() != 0 && earProject_.getText().length() != 0) { - 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) && ear.exists() && J2EEUtils.exists(ear)) { - if (!J2EEUtils.isComponentAssociated(ear, project)) result = (byte) (result | ADD_EAR_ASSOCIATION); - } - } - } - if (isClient_) { - messageText_.setText(getValidationMessage(result, ConsumptionUIMessages.MSG_CLIENT_SUB)); - } - else { - messageText_.setText(getValidationMessage(result, ConsumptionUIMessages.MSG_SERVICE_SUB)); - } - } - catch (Exception e) { - return StatusUtils.errorStatus( ConsumptionUIMessages.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 = ConsumptionUIMessages.MSG_PROJECT_WILL_BE_CREATED; - break; - case 2: - case 6: - msg = ConsumptionUIMessages.MSG_EAR_WILL_BE_CREATED; - break; - case 3: - case 7: - msg = ConsumptionUIMessages.MSG_PROJECT_AND_EAR_CREATED; - break; - case 4: - msg = ConsumptionUIMessages.MSG_EAR_WILL_BE_ASSOCIATED; - break; - } - return msg != null ? NLS.bind(msg, new Object[] { serviceOrClient}) : ""; - } - - public IStatus getStatus() - { - IStatus finalStatus = Status.OK_STATUS; - handleSetMessageText(); - String projectText = moduleProject_.getText(); - String earText = earProject_.getText(); - - if (projectText==null || projectText.length()==0) - { - if (isClient_) - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_CLIENT_PROJECT_EMPTY, new String[]{""} ) ); - else - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_SERVICE_PROJECT_EMPTY, new String[]{""} ) ); - } - - if (needEAR_ && (earText==null || earText.length()==0)) - { - if (isClient_) - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_CLIENT_EAR_EMPTY, new String[]{""} ) ); - else - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_SERVICE_EAR_EMPTY, new String[]{""} ) ); - } - - 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 1dc214fdd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/RuntimeServerSelectionWidget.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.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.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.RuntimeServerSelectionDialog; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.osgi.util.NLS; -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.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; -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 Composite parent_; - private boolean isClientContext_; - private TypeRuntimeServer ids_; - - 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"; - - 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 ) - { - UIUtils uiUtils = new UIUtils( pluginId_ ); - - parent_ = parent; - statusListener_ = statusListener; - - // Runtime label and text - runtime_ = uiUtils.createText( parent, ConsumptionUIMessages.LABEL_RUNTIMES_LIST, - ConsumptionUIMessages.TOOLTIP_PWRS_TEXT_RUNTIME, - INFOPOP_PWRS_GROUP_SERVICE_RUNTIME, SWT.READ_ONLY ); - - // Server label and text - server_ = uiUtils.createText( parent, ConsumptionUIMessages.LABEL_SERVERS_LIST, - ConsumptionUIMessages.TOOLTIP_PWRS_TEXT_SERVER, - INFOPOP_PWRS_GROUP_SERVICE_SERVER, SWT.READ_ONLY ); - - Button editButton = new Button( parent, SWT.NONE ); - editButton.setText( ConsumptionUIMessages.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(); - } - - private void setLabels() - { - String runtimeLabel = WebServiceRuntimeExtensionUtils2.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 = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId); - } - else - { - // Get the label for the server instance. - //serverLabel = registry.getServerInstanceLabelFromInstanceId( ids_.getServerInstanceId() ); - String serverInstanceId = ids_.getServerInstanceId(); - if (serverInstanceId != null) - serverLabel = WebServiceRuntimeExtensionUtils2.getServerInstanceLabelFromInstanceId(serverInstanceId); - } - // rskreg - runtimeLabel = runtimeLabel == null ? "" : runtimeLabel; - - runtime_.setText( runtimeLabel ); - if (serverLabel != null) - server_.setText( serverLabel ); - - } - - public void handleEditButton() - { - byte mode = isClientContext_ ? (byte)1 : (byte)0; - - RuntimeServerSelectionDialog dialog - = dialog = new RuntimeServerSelectionDialog( parent_.getShell(), mode, ids_, "14" ); //rm j2ee - dialog.create(); - dialog.handleServerViewSelectionEvent(); - int result = dialog.open(); - - if (result == Window.OK) - { - ids_ = dialog.getTypeRuntimeServer(); - 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_ ? ConsumptionUIMessages.MSG_CLIENT_SUB - : ConsumptionUIMessages.MSG_SERVICE_SUB; - - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById( ids_.getRuntimeId() ); - String serverLabel = ids_.getServerId() == null ? "" : WebServiceRuntimeExtensionUtils2.getServerLabelById(ids_.getServerId()); - - - if( ids_.getRuntimeId() == null || runtimeLabel == null || runtimeLabel.equals("" )) - { - status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_RUNTIME, new String[]{ scenario } ) ); - } - else if( ids_.getServerId() == null || serverLabel.equals( "" )) - { - status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.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 = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverFactoryId); - status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_ERROR_STUB_ONLY,new String[]{servertypeLabel}) ); - } - } - - // - - //--------- check if WSCT exists for these selections - if (!(ids_.getServerId() == null) && !(ids_.getRuntimeId() == null) && isClientContext_) - { - - if (!WebServiceRuntimeExtensionUtils2.isServerClientRuntimeTypeSupported( ids_.getServerId(), ids_.getRuntimeId(), ids_.getTypeId())) - { - status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, new String[]{ serverLabel, runtimeLabel } ) ); - } - - } - - //--------- check if WSSRT exists for these selections - if (!(ids_.getServerId() == null) && !(ids_.getRuntimeId() == null) && !isClientContext_) - { - - if (!WebServiceRuntimeExtensionUtils2.isServerRuntimeTypeSupported(ids_.getServerId(), ids_.getRuntimeId(), ids_.getTypeId())) { - status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, new String[]{ serverLabel, runtimeLabel } ) ); - } - - } - - - - 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 cac73e127..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java +++ /dev/null @@ -1,347 +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.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection; -import org.eclipse.wst.command.internal.env.core.selection.SelectionList; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.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 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 ) - { - IEnvironment 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,IEnvironment 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){ - IStatusHandler 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); - } - } - - TestInfo testInfo = new TestInfo(); - testInfo.setClientExistingServer(sampleExistingServer); - testInfo.setClientServerTypeID(sampleServerTypeID); - testInfo.setJspFolder(jspFolder); - testInfo.setExternalBrowser(false); - testInfo.setEndpoint(endpoints); - testInfo.setGenerationProject(sampleP); - 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 f86bb2619..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.common.Condition; -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; - - -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 9021919ad..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestWidget.java +++ /dev/null @@ -1,415 +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.consumption.ui.ConsumptionUIMessages; -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.core.selection.BooleanSelection; -import org.eclipse.wst.command.internal.env.core.selection.SelectionList; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; - - -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; - UIUtils uiUtils = new UIUtils( pluginId_ ); - - parent.setToolTipText( ConsumptionUIMessages.TOOLTIP_PWSM_PAGE ); - PlatformUI.getWorkbench().getHelpSystem().setHelp( parent, pluginId_ + "." + INFOPOP_PWSM_PAGE ); - - testCheckbox_ = uiUtils.createCheckbox( parent, ConsumptionUIMessages.BUTTON_TEST, - ConsumptionUIMessages.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_, ConsumptionUIMessages.LABEL_TEST_TYPES, - ConsumptionUIMessages.TOOLTIP_PWSM_COMBOBOX_TEST, - INFOPOP_PWSM_COMBOBOX_TEST, - SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); - new Label( comboGroup_, SWT.NONE ); - - projectCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_JSP_PROJECT_NAME, - ConsumptionUIMessages.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_, ConsumptionUIMessages.LABEL_EAR_PROJECTS, - ConsumptionUIMessages.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_, ConsumptionUIMessages.LABEL_FOLDER_NAME, - ConsumptionUIMessages.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_, ConsumptionUIMessages.BUTTON_BROWSE, - ConsumptionUIMessages.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_, ConsumptionUIMessages.LABEL_JSP_FOLDER_NAME, - ConsumptionUIMessages.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, ConsumptionUIMessages.LABEL_METHODS, - ConsumptionUIMessages.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, ConsumptionUIMessages.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, ConsumptionUIMessages.BUTTON_SELECT_ALL, - ConsumptionUIMessages.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, ConsumptionUIMessages.BUTTON_DESELECT_ALL, - ConsumptionUIMessages.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, ConsumptionUIMessages.BUTTON_RUN_TEST, - ConsumptionUIMessages.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 bb5e85a61..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java +++ /dev/null @@ -1,123 +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.ConsumptionMessages; -import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; -import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.env.core.common.ProgressUtils; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.context.ResourceContext; -import org.eclipse.wst.command.internal.env.core.context.TransientResourceContext; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class CopyWebServiceUtilsJarCommand extends AbstractDataModelOperation -{ - private String sampleProject; - -/** - * Default CTOR; - */ - - -public CopyWebServiceUtilsJarCommand() -{ - -} - -/** - * Execute the command - */ -public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) -{ - IEnvironment env = getEnvironment(); - - try - { - ProgressUtils.report( monitor, ConsumptionMessages.PROGRESS_INFO_COPY_WEBSERVICE_UTILS ); - IProject sampleIProject = ProjectUtilities.getProject(sampleProject); - IPath webModulePath = J2EEUtils.getWebContentPath(sampleIProject); - if (webModulePath == null) - return StatusUtils.errorStatus( ConsumptionMessages.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){ - IStatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( ConsumptionMessages.MSG_ERROR_FILECOPY_WEBSERVICE_UTILS ); - sHandler.reportError(errorStatus); - return status; - } - - - } - catch (Exception e) { - IStatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( ConsumptionMessages.MSG_ERROR_FILECOPY_WEBSERVICE_UTILS ); - sHandler.reportError(errorStatus); - return StatusUtils.errorStatus( ConsumptionMessages.MSG_ERROR_FILECOPY_WEBSERVICE_UTILS, e); - } - return Status.OK_STATUS; -} - -/** - * - */ -private IStatus copyIFile(String source, IPath targetPath, String targetFile, Plugin plugin,IEnvironment env, IProgressMonitor monitor ) -{ - - if (plugin != null) - { - IPath target = targetPath.append(new Path(targetFile)); - - ProgressUtils.report( monitor, ConsumptionMessages.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( ConsumptionMessages.MSG_ERROR_FILECOPY_WEBSERVICE_UTILS ,e); - } - } - return Status.OK_STATUS; -} - -public void setSampleProject(String sampleProject) -{ - this.sampleProject = sampleProject; -} - - -} 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 e6828443d..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.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 ) - { - IEnvironment 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 9c6df0cba..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.common.frameworks.datamodel.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 f90c1b5ac..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.common.Condition; -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; - - -/** - * @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 aeb174ab7..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.common.Condition; -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 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 6c61ebaaa..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestClientDepartureInitCommand.java +++ /dev/null @@ -1,52 +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.core.commands.ExecutionException; -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.common.frameworks.datamodel.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; - } - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - return Status.OK_STATUS; - } - -} 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 a59529450..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.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 - *******************************************************************************/ -/* - * 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.env.core.selection.SelectionList; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -/** - * @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; - private boolean generateProxy; - - - 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]; - String[] wsdlCases = scenarioContext.getNonJavaTestService(); - 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; - - - if(!generateProxy) - testFacilities = new SelectionList(wsdlCases,0); - else - testFacilities = new SelectionList(newTestTypes,0); - } - - public void setLaunchedServiceTestName(String launchedServiceTestName) - { - this.launchedServiceTestName = launchedServiceTestName; - } - - public void setGenerateProxy(boolean generateProxy) - { - this.generateProxy = generateProxy; - } - -} 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 a4efaabcb..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestWebServiceClient.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 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.test; - -import org.eclipse.wst.command.internal.env.core.ICommandFactory; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.ws.internal.wsrt.AbstractWebServiceClient; -import org.eclipse.wst.ws.internal.wsrt.IContext; -import org.eclipse.wst.ws.internal.wsrt.ISelection; -import org.eclipse.wst.ws.internal.wsrt.WebServiceClientInfo; - -public class TestWebServiceClient extends AbstractWebServiceClient { - - public TestWebServiceClient(WebServiceClientInfo clientInfo){ - super(clientInfo); - } - - public ICommandFactory assemble(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - return null; - } - - public ICommandFactory deploy(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - return null; - } - - - public ICommandFactory develop(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - return null; - } - - public ICommandFactory install(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - return null; - } - - - public ICommandFactory run(IEnvironment env, IContext ctx, ISelection sel, - String project, String earProject){ - 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 89d839b0d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WSDLTestLaunchCommand.java +++ /dev/null @@ -1,189 +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.consumption.ui.ConsumptionUIMessages; -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.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.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 boolean externalBrowser; - private List endpoints; - private IServer serviceExistingServer = null; - private String serviceServerTypeID = null; - private String serviceServerInstanceId = null; - - public WSDLTestLaunchCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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){ - IStatusHandler sHandler = env.getStatusHandler(); - IStatus infoStatus = StatusUtils.infoStatus( ConsumptionUIMessages.MSG_ERROR_UNABLE_TO_LAUNCH_WSDL_TEST ); - sHandler.reportInfo(infoStatus); - return infoStatus; - } - return status; - - } - - private IStatus commandFactoryExecution(ICommandFactory commandFactory,IEnvironment 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){ - IStatusHandler 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.setExternalBrowser(externalBrowser); - 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) - { - this.externalBrowser = 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 920259315..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java +++ /dev/null @@ -1,234 +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.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.IStatusHandler; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -/** -* 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"; - - 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 () - { - - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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){ - IStatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( ConsumptionUIMessages.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){ - IStatusHandler sHandler = env.getStatusHandler(); - IStatus errorStatus = StatusUtils.errorStatus( ConsumptionUIMessages.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(IEnvironment 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)){ - 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 00bdfd0b4..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.data.DataMappingRegistry; -import org.eclipse.wst.command.internal.env.core.fragment.SequenceFragment; -import org.eclipse.wst.command.internal.env.core.fragment.SimpleFragment; - - -/** - * @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 ebbf6a453..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,97 +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.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.ext.test.WSDLTestFinishCommand; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 List endpoints; - - /** - * Constructs a new WebServiceExplorerLaunch object with the given label and description. - */ - public ExplorerServiceTestCommand () - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_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) - { - //TODO: Type mappings to this property should be removed. - } - - public void setExistingServer(IServer serviceExistingServer) - { - //TODO: Type mappings to this property should be removed. - } - - public void setServiceProject(String serviceProject) - { - //TODO: Type mappings to this property should be removed. - } - - 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 8ad6eeb12..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,60 +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.test.explorer; - -import java.util.Iterator; -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.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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.wsrt.TestInfo; - -public class WSEGenerateCommand extends AbstractDataModelOperation -{ - - private TestInfo testInfo; - - public WSEGenerateCommand(TestInfo testInfo){ - this.testInfo = testInfo; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - IStatus status = Status.OK_STATUS; - - WSExplorerLauncherCommand launchCommand = new WSExplorerLauncherCommand(); - launchCommand.setForceLaunchOutsideIDE(testInfo.getExternalBrowser()); - 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 cfa116d05..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,34 +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.test.explorer; - -import java.util.Vector; - -import org.eclipse.wst.command.internal.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.env.core.SimpleCommandFactory; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.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 ecb320e5a..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.common.frameworks.datamodel.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 d4141a2c8..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,243 +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 java.util.List; - -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.j2ee.project.facet.IJavaProjectMigrationDataModelProperties; -import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationDataModelProvider; -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.ui.command.StartServerCommand; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties; -import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.ws.internal.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 ) - { - IEnvironment env = getEnvironment(); - try - { - createSampleProjects(env, monitor ); - clientIProject = ProjectUtilities.getProject(testInfo.getClientProject()); - - if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject)) - { - String uri = clientIProject.getName() + ".jar"; - if (J2EEUtils.isJavaComponent(clientIProject)) - addJavaProjectAsUtilityJar(clientIProject, sampleEARIProject, uri,monitor); - addJAROrModuleDependency(sampleIProject, uri); - addBuildPath(sampleIProject, clientIProject); - } - } - catch (IOException ioe) - { - } - catch (CoreException ce) - { - } - return Status.OK_STATUS; - } - - private void addJavaProjectAsUtilityJar(IProject javaProject, IProject earProject, String uri,IProgressMonitor monitor) - { - try { - IDataModel migrationdm = DataModelFactory.createDataModel(new JavaProjectMigrationDataModelProvider()); - migrationdm.setProperty(IJavaProjectMigrationDataModelProperties.PROJECT_NAME, javaProject.getName()); - migrationdm.getDefaultOperation().execute(monitor, null); - - - IDataModel refdm = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider()); - List targetCompList = (List) refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST); - - IVirtualComponent targetcomponent = ComponentCore.createComponent(javaProject); - targetCompList.add(targetcomponent); - - refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earProject); - refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetCompList); - refdm.getDefaultOperation().execute(monitor, null); - }catch (Exception e) { - - } - } - - private void addJAROrModuleDependency(IProject project, 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(IEnvironment 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; - } - else{ - sampleEARProject = testInfo.getClientEARProject(); - } - - 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)); - 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.setModuleType(CreateModuleCommand.WEB); - createSample.setServerInstanceId(testInfo.getClientExistingServer().getId()); - createSample.setServerFactoryId(testInfo.getClientServerTypeID()); - createSample.setJ2eeLevel(J2EEUtils.getJ2EEVersionAsString(clientIProject)); - 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.setEARProject(sampleEARProject); - associateCommand.setEar(sampleEARModule); - associateCommand.setEnvironment( env ); - status = associateCommand.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - else - { - // If no EAR is needed, the sample project needs to be added to - // to the server directly. - AddModuleToServerCommand addToServer = new AddModuleToServerCommand(); - addToServer.setModule(testInfo.getGenerationProject()); - addToServer.setProject(testInfo.getGenerationProject()); - addToServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - addToServer.setEnvironment( env ); - status = addToServer.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - - StartServerCommand startServer = new StartServerCommand(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 e7d91d9aa..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,172 +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.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.env.ui.eclipse.EnvironmentUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.datamodel.Model; -import org.eclipse.wst.ws.internal.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 ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - CopyWebServiceUtilsJarCommand copy = new CopyWebServiceUtilsJarCommand(); - copy.setSampleProject(testInfo.getGenerationProject()); - 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)){ - IProject project = ProjectUtilities.getProject(testInfo.getGenerationProject()); - IPath path = J2EEUtils.getWebContentPath(project); - 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(IEnvironment 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(IEnvironment 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 264ed9391..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,200 +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.test.wssample; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.core.resources.IProject; -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.Platform; -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.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.command.PublishProjectCommand; -import org.eclipse.jst.ws.internal.consumption.ui.command.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.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.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 String jspfolder; - - public GSTCLaunchCommand(TestInfo testInfo){ - this.testInfo = testInfo; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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)){ - IProject project = ProjectUtilities.getProject(testInfo.getGenerationProject()); - IPath path = J2EEUtils.getWebContentPath(project); - 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 (IEnvironment env, IProgressMonitor monitor ) { - IStatus status = Status.OK_STATUS; - IPath fDestinationFolderPath = new Path(jspfolder); - fDestinationFolderPath = fDestinationFolderPath.makeAbsolute(); - try - { - Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null); - } - catch( InterruptedException exc ) - { - // UISynchronizer.syncExec seems to interrupt the UI tread when the autobuilder is done. Not sure, why. - // I'm assuming here that the autobuilder has actually completed its stuff. - } - - 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 ); - 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()); - String newPath = ServerUtils.getWebComponentURL(sampleProject, testInfo.getClientServerTypeID(),testInfo.getClientExistingServer()); - int count = J2EEUtils.getWebContentPath(sampleProject).segmentCount(); - - newPath = newPath + "/" + fDestinationFolderPath.removeFirstSegments(count); - StringBuffer urlString = new StringBuffer( newPath + "/" + TEST_CLIENT ); - 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()); - - InputStream resultStream = null; - InputStream methodStream = null; - InputStream inputStream = null; - InputStream clientStream = null; - - for( int retries = 0; retries < 10; retries++ ) - { - try - { - // Test the URLs - - resultStream = new URL(newPath + "/" + RESULT).openStream(); - methodStream = new URL(newPath + "/" + METHOD).openStream(); - inputStream = new URL(newPath + "/" + INPUT).openStream(); - clientStream = new URL(newPath + "/" + TEST_CLIENT).openStream(); - - // Looks good, exit loop - break; - } - catch( IOException ioe ) - { - try - { - Thread.sleep(1000); - } - catch (InterruptedException ie) {} - } - finally - { - try - { - if( resultStream != null ) resultStream.close(); - if( methodStream != null ) methodStream.close(); - if( inputStream != null ) inputStream.close(); - if( clientStream != null ) clientStream.close(); - } - catch( IOException exc ) - { - } - } - } - - 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(ILog.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, e ); - } - return status; - }catch(MalformedURLException exc){ - env.getLog().log(ILog.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, exc ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.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 29f1651d6..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,36 +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.test.wssample; - -import java.util.Vector; - -import org.eclipse.wst.command.internal.env.core.ICommandFactory; -import org.eclipse.wst.command.internal.env.core.SimpleCommandFactory; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceTester; -import org.eclipse.wst.ws.internal.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 b0a0f587f..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,327 +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.ui.command.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.ConsumptionUIMessages; -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.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.core.selection.BooleanSelection; -import org.eclipse.wst.command.internal.env.ui.eclipse.EnvironmentUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -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 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 () - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment 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(IEnvironment 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 (IEnvironment 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(ILog.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, exc ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, e ); - } - return status; - }catch(MalformedURLException exc){ - env.getLog().log(ILog.WARNING, 5048, this, "launchSample", exc); - status = StatusUtils.warningStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, exc ); - try { - env.getStatusHandler().report(status); - } catch (StatusException e) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_MALFORMED_URL, e ); - } - return status; - } - } - - - - protected IStatus createModel(IEnvironment 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 59f68f977..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.common.frameworks.datamodel.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 0070383df..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/PublicUDDIRegistryTypeRegistry.java +++ /dev/null @@ -1,96 +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 e8ba923f0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/RuntimeServerSelectionDialog.java +++ /dev/null @@ -1,651 +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.ws.internal.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -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.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.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_; - - /* - * 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"; - private Hashtable serverLabels_; - private Hashtable existingServersTable_; - private String defaultServer_; - private String defaultRuntime_; - private String typeId_; - - private RuntimeDescriptor selectedRuntime_; - - 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 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(); - } - - 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; - } - - 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(ConsumptionUIMessages.PAGE_TITLE_WS_RUNTIME_SELECTION); - else - thisShell.setText(ConsumptionUIMessages.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(ConsumptionUIMessages.PAGE_DESC_WS_RUNTIME_SELECTION + "\n" + " "); // reserves a second line for message display - messageBanner_.setToolTipText(ConsumptionUIMessages.PAGE_DESC_WS_RUNTIME_SELECTION); - gd = new GridData(GridData.FILL_HORIZONTAL); - messageBanner_.setLayoutData(gd); - // -----------------------------------------------------------------------// - new Label(composite, SWT.HORIZONTAL); - // -----------------------------------------------------------------------// - // Selection - thisShell.setToolTipText(ConsumptionUIMessages.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(ConsumptionUIMessages.LABEL_SELECTION_VIEW_TITLE); - else - viewSelectionGroup_.setText(ConsumptionUIMessages.LABEL_CLIENT_SELECTION_VIEW_TITLE); - viewSelectionByServerButton_ = new Button(viewSelectionGroup_, SWT.RADIO); - viewSelectionByServerButton_.setText(ConsumptionUIMessages.LABEL_SELECTION_VIEW_SERVER); - viewSelectionByServerButton_.addListener(SWT.Selection, this); - viewSelectionByServerButton_.setToolTipText(ConsumptionUIMessages.TOOLTIP_PWRS_RADIO_SERVER); - viewSelectionByServerButton_.setSelection(true); - helpSystem.setHelp(viewSelectionByServerButton_, INFOPOP_PWRS_RADIO_SERVER); - viewSelectionByRuntimeButton_ = new Button(viewSelectionGroup_, SWT.RADIO); - viewSelectionByRuntimeButton_.setText(ConsumptionUIMessages.LABEL_SELECTION_VIEW_RUNTIME); - viewSelectionByRuntimeButton_.addListener(SWT.Selection, this); - viewSelectionByRuntimeButton_.setToolTipText(ConsumptionUIMessages.TOOLTIP_PWRS_RADIO_RUNTIME); - helpSystem.setHelp(viewSelectionByRuntimeButton_, INFOPOP_PWRS_RADIO_RUNTIME); - viewSelectionByExploreButton_ = new Button(viewSelectionGroup_, SWT.RADIO); - viewSelectionByExploreButton_.setText(ConsumptionUIMessages.LABEL_SELECTION_VIEW_EXPLORE); - viewSelectionByExploreButton_.addListener(SWT.Selection, this); - viewSelectionByExploreButton_.setToolTipText(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.TOOLTIP_PWRS_LIST_SERVERS); - ServersList serverList = new ServersList(); - serverList.setServerTreeItems(serverList_); - helpSystem.setHelp(serverList_, INFOPOP_PWRS_LIST_SERVERS); - setRuntimesGroup(); - // -----------------------------------------------------------------------// - new Label(composite, SWT.HORIZONTAL); - validateOn_ = true; - org.eclipse.jface.dialogs.Dialog.applyDialogFont(parent); - return composite; - } - - - private void validateServerRuntimeSelection() { - // Check if the extension exists - if (selectionMode_ == MODE_SERVICE) { - if (selectedServerFactoryID_!=null && selectedRuntime_!=null) { - - boolean wssrtSupported = WebServiceRuntimeExtensionUtils2.isServerRuntimeTypeSupported(selectedServerFactoryID_,selectedRuntime_.getId(),typeId_); - - if (wssrtSupported && WebServiceRuntimeExtensionUtils2.isServerSupportedForChosenServiceType(typeId_, selectedServerFactoryID_)) { - setOKStatusMessage(); - } - else { - setERRORStatusMessage(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS); - } - } - } - else { - - String clientId = typeId_; - if (selectedServerFactoryID_==null || selectedRuntime_ == null || !WebServiceRuntimeExtensionUtils2.isServerClientRuntimeTypeSupported(selectedServerFactoryID_, selectedRuntime_.getId(), clientId)) { - setERRORStatusMessage(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS); - } - 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(ConsumptionUIMessages.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(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() { - setReturnCode(OK); - close(); - } - - /** - * 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 (runtimesList_ == event.widget) { - TreeItem[] runtimeSel = runtimesList_.getSelection(); - processRuntimeListSelection(runtimeSel[0].getText()); - validateServerRuntimeSelection(); - } - else if (serverList_ == event.widget) { - processServerListSelection(); - validateServerRuntimeSelection(); - } - } - - 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) { - - if (selectionMode_ == MODE_SERVICE) { - selectedRuntime_ = WebServiceRuntimeExtensionUtils2.getRuntimeByLabel(runtimeName); - } - else { - selectedRuntime_ = WebServiceRuntimeExtensionUtils2.getRuntimeByLabel(runtimeName); - } - } - - 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(ConsumptionUIMessages.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(ConsumptionUIMessages.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) { - runtimes = WebServiceRuntimeExtensionUtils2.getRuntimesByServiceType(typeId_); - } - else { - runtimes = WebServiceRuntimeExtensionUtils2.getAllRuntimesForClientSide(); - } - - 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(); - } - - private RuntimeDescriptor getRuntime(String type) { - if (selectionMode_ == MODE_SERVICE) { - return WebServiceRuntimeExtensionUtils2.getRuntimeById(type); - } - else { - return WebServiceRuntimeExtensionUtils2.getRuntimeById(type); - } - } - - /** - * - * 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(ConsumptionUIMessages.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(ConsumptionUIMessages.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) { - serverIds = WebServiceRuntimeExtensionUtils2.getServerFactoryIdsByServiceType(typeId_); - } - else { - serverIds = WebServiceRuntimeExtensionUtils2.getAllClientServerFactoryIds(); - } - // 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 2d28a715f..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.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/TypeSelectionFilter2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java deleted file mode 100644 index b58fb52e3..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.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.WebServiceRuntimeExtensionUtils2; -import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario; - - -public class TypeSelectionFilter2 -{ - // 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 = WebServiceRuntimeExtensionUtils2.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 7f3aa24ee..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.parser.PluginMessages; - -public class PublicUDDIRegistryIBM implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryIBM() { - } - - public String getName() { - return PluginMessages.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 78d2c0ce0..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.parser.PluginMessages; - -public class PublicUDDIRegistryIBMTest implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryIBMTest() { - } - - public String getName() { - return PluginMessages.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 bbbb8d7a4..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.parser.PluginMessages; - -public class PublicUDDIRegistryMicrosoft implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryMicrosoft() { - } - - public String getName() { - return PluginMessages.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 a6f9bee2e..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.parser.PluginMessages; - -public class PublicUDDIRegistryMicrosoftTest implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryMicrosoftTest() { - } - - public String getName() { - return PluginMessages.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 26e14b4b1..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.parser.PluginMessages; - -public class PublicUDDIRegistryNTTComm implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryNTTComm() { - } - - public String getName() { - return PluginMessages.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 1ad68fe4a..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.parser.PluginMessages; - -public class PublicUDDIRegistrySAP implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistrySAP() { - } - - public String getName() { - return PluginMessages.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 5fad14824..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.parser.PluginMessages; - -public class PublicUDDIRegistrySAPTest implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistrySAPTest() { - } - - public String getName() { - return PluginMessages.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 8e7bde35a..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.parser.PluginMessages; - -public class PublicUDDIRegistryXMethods implements PublicUDDIRegistryType -{ - - // Copyright - public static final String copyright = "(c) Copyright IBM Corporation 2002."; - - public PublicUDDIRegistryXMethods() { - } - - public String getName() { - return PluginMessages.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 23193c1a5..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.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -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 ) - { - IEnvironment 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 565c91dc2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/DialogWWWAuthentication.java +++ /dev/null @@ -1,153 +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.ConsumptionUIMessages; -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(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.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(ConsumptionUIMessages.TOOLTIP_HTTP_BASIC_AUTH_USERNAME); - PlatformUI.getWorkbench().getHelpSystem().setHelp(username_, INFOPOP_DBAS_USERNAME); - - label = new Label(composite, SWT.WRAP); - label.setText(ConsumptionUIMessages.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(ConsumptionUIMessages.TOOLTIP_HTTP_BASIC_AUTH_PASSWORD); - PlatformUI.getWorkbench().getHelpSystem().setHelp(username_, INFOPOP_DBAS_PASSWORD); - - return composite; - } - - 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 6b47c1211..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.ConsumptionUIMessages; -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(ConsumptionUIMessages.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(ConsumptionUIMessages.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 4dae50bac..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsil/Utils.java +++ /dev/null @@ -1,52 +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/ClientRuntimeDescriptor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java deleted file mode 100644 index 65bedf58f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java +++ /dev/null @@ -1,147 +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.ArrayList; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime; - -public class ClientRuntimeDescriptor -{ - private IConfigurationElement elem; - private Hashtable allWebServiceClientImpls; - private Hashtable allRuntimes; - private String id; - private WebServiceClientImpl clientImplementationType; - private RuntimeDescriptor runtime; - private String clientRuntimeClassName; - private IWebServiceRuntime webServiceRuntime; - private RequiredFacetVersion[] requiredFacetVersions; - private Set projectFacetVersions; - - public ClientRuntimeDescriptor(IConfigurationElement elem, Hashtable allWebServiceClientImpls, Hashtable allRuntimes) - { - this.elem = elem; - this.allWebServiceClientImpls = allWebServiceClientImpls; - this.allRuntimes = allRuntimes; - } - - public WebServiceClientImpl getClientImplementationType() - { - if (clientImplementationType == null) - { - String clientImplementationTypeId = elem.getAttribute("clientImplementationTypeId"); - clientImplementationType = (WebServiceClientImpl)allWebServiceClientImpls.get(clientImplementationTypeId); - } - return clientImplementationType; - } - - public String getClientRuntimeClassName() - { - if (clientRuntimeClassName == null) - { - clientRuntimeClassName = elem.getAttribute("class"); - } - return clientRuntimeClassName; - } - - public String getId() - { - if (id == null) - { - id = elem.getAttribute("id"); - } - return id; - } - - public RequiredFacetVersion[] getRequiredFacetVersions() - { - if (requiredFacetVersions == null) - { - ArrayList requiredFacetVersionList = new ArrayList(); - IConfigurationElement[] facetElems = elem.getChildren("required-facet-version"); - for (int i = 0; i < facetElems.length; i++) - { - RequiredFacetVersion rfv = new RequiredFacetVersion(); - IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(facetElems[i].getAttribute("facet")); - IProjectFacetVersion projectFacetVersion = projectFacet.getVersion(facetElems[i].getAttribute("version")); - rfv.setProjectFacetVersion(projectFacetVersion); - String allowNewerValue = facetElems[i].getAttribute("allow-newer"); - if (allowNewerValue == null) - { - rfv.setAllowNewer(false); - } - else - { - rfv.setAllowNewer(Boolean.valueOf(allowNewerValue).booleanValue()); - } - - requiredFacetVersionList.add(rfv); - } - - requiredFacetVersions = (RequiredFacetVersion[])requiredFacetVersionList.toArray(new RequiredFacetVersion[]{}); - } - - return requiredFacetVersions; - } - - public Set getProjectFacetVersions() - { - if (projectFacetVersions == null) - { - projectFacetVersions = new HashSet(); - RequiredFacetVersion[] rfv = getRequiredFacetVersions(); - for (int i=0; i<rfv.length; i++) - { - projectFacetVersions.add(rfv[i].getProjectFacetVersion()); - } - } - - return projectFacetVersions; - } - - public RuntimeDescriptor getRuntime() - { - if (runtime == null) - { - String runtimeId = elem.getAttribute("runtimeId"); - runtime = (RuntimeDescriptor)allRuntimes.get(runtimeId); - } - return runtime; - } - - public IWebServiceRuntime getWebServiceRuntime() - { - if (webServiceRuntime == null) - { - try - { - webServiceRuntime = (IWebServiceRuntime)elem.createExecutableExtension("class"); - } - catch(CoreException ce) - { - - } - } - - return webServiceRuntime; - } -} 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 85a02603b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientType.java +++ /dev/null @@ -1,117 +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 034a6e8ef..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.wsrt.IContext; -import org.eclipse.wst.ws.internal.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/RuntimeDescriptor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/RuntimeDescriptor.java deleted file mode 100644 index b6295375f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/RuntimeDescriptor.java +++ /dev/null @@ -1,52 +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 RuntimeDescriptor -{ - - private IConfigurationElement elem; - private String id; - private String label; - - - public RuntimeDescriptor(IConfigurationElement elem) - { - 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; - } - - public String[] getJ2eeLevels() - { - return new String[]{"13", "14"}; - } - -} 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 631454bd6..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.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/ServiceRuntimeDescriptor.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java deleted file mode 100644 index fc5c87187..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java +++ /dev/null @@ -1,164 +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.ArrayList; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime; - - -public class ServiceRuntimeDescriptor -{ - private IConfigurationElement elem; - private Hashtable allWebServiceImpls; - private Hashtable allRuntimes; - private String id; - private WebServiceImpl serviceImplementationType; - private RuntimeDescriptor runtime; - private boolean bottomUp = false; - private boolean topDown = false; - private String serviceRuntimeClassName; - private IWebServiceRuntime webServiceRuntime; - private RequiredFacetVersion[] requiredFacetVersions; - private Set projectFacetVersions; - - public ServiceRuntimeDescriptor(IConfigurationElement elem, Hashtable allWebServiceImpls, Hashtable allRuntimes) - { - this.elem = elem; - this.allWebServiceImpls = allWebServiceImpls; - this.allRuntimes = allRuntimes; - - bottomUp = (Boolean.valueOf(elem.getAttribute("bottomUp"))).booleanValue(); - topDown = (Boolean.valueOf(elem.getAttribute("topDown"))).booleanValue(); - } - - public boolean getBottomUp() - { - return bottomUp; - } - - public String getId() - { - if (id == null) - { - id = elem.getAttribute("id"); - } - return id; - } - - - public RequiredFacetVersion[] getRequiredFacetVersions() - { - if (requiredFacetVersions == null) - { - ArrayList requiredFacetVersionList = new ArrayList(); - IConfigurationElement[] facetElems = elem.getChildren("required-facet-version"); - for (int i = 0; i < facetElems.length; i++) - { - RequiredFacetVersion rfv = new RequiredFacetVersion(); - IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(facetElems[i].getAttribute("facet")); - IProjectFacetVersion projectFacetVersion = projectFacet.getVersion(facetElems[i].getAttribute("version")); - rfv.setProjectFacetVersion(projectFacetVersion); - String allowNewerValue = facetElems[i].getAttribute("allow-newer"); - if (allowNewerValue == null) - { - rfv.setAllowNewer(false); - } - else - { - rfv.setAllowNewer(Boolean.valueOf(allowNewerValue).booleanValue()); - } - - requiredFacetVersionList.add(rfv); - } - - requiredFacetVersions = (RequiredFacetVersion[])requiredFacetVersionList.toArray(new RequiredFacetVersion[]{}); - } - - return requiredFacetVersions; - } - - public Set getProjectFacetVersions() - { - if (projectFacetVersions == null) - { - projectFacetVersions = new HashSet(); - RequiredFacetVersion[] rfv = getRequiredFacetVersions(); - for (int i=0; i<rfv.length; i++) - { - projectFacetVersions.add(rfv[i].getProjectFacetVersion()); - } - } - - return projectFacetVersions; - } - - public RuntimeDescriptor getRuntime() - { - if (runtime == null) - { - String runtimeId = elem.getAttribute("runtimeId"); - runtime = (RuntimeDescriptor)allRuntimes.get(runtimeId); - } - return runtime; - } - - public WebServiceImpl getServiceImplementationType() - { - if (serviceImplementationType == null) - { - String serviceImplementationTypeId = elem.getAttribute("serviceImplementationTypeId"); - serviceImplementationType = (WebServiceImpl)allWebServiceImpls.get(serviceImplementationTypeId); - } - return serviceImplementationType; - } - - public String getServiceRuntimeClassName() - { - if (serviceRuntimeClassName == null) - { - serviceRuntimeClassName = elem.getAttribute("class"); - } - return serviceRuntimeClassName; - } - - public boolean getTopDown() - { - return topDown; - } - - public IWebServiceRuntime getWebServiceRuntime() - { - if (webServiceRuntime == null) - { - try - { - webServiceRuntime = (IWebServiceRuntime)elem.createExecutableExtension("class"); - } - catch(CoreException ce) - { - - } - } - - return webServiceRuntime; - } -} 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 85bf5af4a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceType.java +++ /dev/null @@ -1,198 +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.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 b5630e9dc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceImpl.java +++ /dev/null @@ -1,100 +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 acb0acc1b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry.java +++ /dev/null @@ -1,216 +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.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/WebServiceRuntimeExtensionRegistry2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry2.java deleted file mode 100644 index 1cec7cad4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry2.java +++ /dev/null @@ -1,195 +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.ArrayList; -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.wsrt.WebServiceScenario; - -public class WebServiceRuntimeExtensionRegistry2 -{ - - private static WebServiceRuntimeExtensionRegistry2 instance_; - - - Hashtable webServiceImpls_; - - Hashtable webServiceClientImpls_; - - Hashtable runtimes_; - - Hashtable serviceRuntimes_; - - Hashtable clientRuntimes_; - - ArrayList webServiceTypesList_; - - ArrayList webServiceClientTypesList_; - - - /** - * Returns a singleton instance of this class. - * - * @return A singleton WebServiceRuntimeExtensionRegistry2 object. - */ - public static WebServiceRuntimeExtensionRegistry2 getInstance() - { - if (instance_ == null) - { - instance_ = new WebServiceRuntimeExtensionRegistry2(); - instance_.load(); - } - return instance_; - } - - private void load() - { - webServiceImpls_ = new Hashtable(); - webServiceClientImpls_ = new Hashtable(); - runtimes_ = new Hashtable(); - serviceRuntimes_ = new Hashtable(); - clientRuntimes_ = new Hashtable(); - webServiceTypesList_ = new ArrayList(); - webServiceClientTypesList_ = new ArrayList(); - - - 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 runtimes - IConfigurationElement[] runtimeExts = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", "runtimes"); - - for(int idx=0; idx<runtimeExts.length; idx++) - { - IConfigurationElement elem = runtimeExts[idx]; - - if (elem.getName().equals("runtime")) - { - RuntimeDescriptor rd = new RuntimeDescriptor(elem); - runtimes_.put(elem.getAttribute("id"), rd); - } - } - - //Load serviceRuntimes - IConfigurationElement[] serviceRuntimeExts = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", "serviceRuntimes"); - - for(int idx=0; idx<serviceRuntimeExts.length; idx++) - { - IConfigurationElement elem = serviceRuntimeExts[idx]; - - if (elem.getName().equals("serviceRuntime")) - { - ServiceRuntimeDescriptor rd = new ServiceRuntimeDescriptor(elem, webServiceImpls_, runtimes_); - serviceRuntimes_.put(elem.getAttribute("id"), rd); - updateWebServiceTypeList(rd); - } - } - - //Load serviceRuntimes - IConfigurationElement[] clientRuntimeExts = reg.getConfigurationElementsFor( - "org.eclipse.jst.ws.consumption.ui", "clientRuntimes"); - - for(int idx=0; idx<clientRuntimeExts.length; idx++) - { - IConfigurationElement elem = clientRuntimeExts[idx]; - - if (elem.getName().equals("clientRuntime")) - { - ClientRuntimeDescriptor rd = new ClientRuntimeDescriptor(elem, webServiceClientImpls_, runtimes_); - clientRuntimes_.put(elem.getAttribute("id"), rd); - updateWebServiceClientTypeList(rd); - - } - } - } - - private void updateWebServiceTypeList(ServiceRuntimeDescriptor descriptor) - { - String serviceImplId = descriptor.getServiceImplementationType().getId(); - boolean bottomUp = descriptor.getBottomUp(); - boolean topDown = descriptor.getTopDown(); - if (bottomUp) - { - StringBuffer entrybuff = new StringBuffer(); - entrybuff.append(String.valueOf(WebServiceScenario.BOTTOMUP)); - entrybuff.append("/"); - entrybuff.append(serviceImplId); - String entry = entrybuff.toString(); - if (!webServiceTypesList_.contains(entry)) - { - webServiceTypesList_.add(entry); - } - } - - if (topDown) - { - StringBuffer entrybuff = new StringBuffer(); - entrybuff.append(String.valueOf(WebServiceScenario.TOPDOWN)); - entrybuff.append("/"); - entrybuff.append(serviceImplId); - String entry = entrybuff.toString(); - if (!webServiceTypesList_.contains(entry)) - { - webServiceTypesList_.add(entry); - } - } - } - - private void updateWebServiceClientTypeList(ClientRuntimeDescriptor descriptor) - { - String clientImplId = descriptor.getClientImplementationType().getId(); - StringBuffer entrybuff = new StringBuffer(); - entrybuff.append(String.valueOf(WebServiceScenario.CLIENT)); - entrybuff.append("/"); - entrybuff.append(clientImplId); - 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 9dc843be8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils.java +++ /dev/null @@ -1,967 +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.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.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.env.core.selection.SelectionList; -import org.eclipse.wst.command.internal.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.wsrt.IWebServiceRuntime; -import org.eclipse.wst.ws.internal.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.internal.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId + ".ConsumptionUI", 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/WebServiceRuntimeExtensionUtils2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java deleted file mode 100644 index d97b1b9fc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java +++ /dev/null @@ -1,1542 +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.ArrayList; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Set; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jst.server.core.FacetUtil; -import org.eclipse.jst.ws.internal.consumption.common.FacetMatcher; -import org.eclipse.jst.ws.internal.consumption.common.FacetUtils; -import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion; -import org.eclipse.jst.ws.internal.consumption.ui.wizard.TypeSelectionFilter2; -import org.eclipse.jst.ws.internal.data.LabelsAndIds; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.wst.command.internal.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.env.core.selection.SelectionList; -import org.eclipse.wst.command.internal.env.core.selection.SelectionListChoices; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.common.project.facet.core.runtime.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.ui.ServerUICore; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime; -import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario; - -public class WebServiceRuntimeExtensionUtils2 -{ - private static WebServiceRuntimeExtensionRegistry2 registry = WebServiceRuntimeExtensionRegistry2.getInstance(); - - public static RuntimeDescriptor getRuntimeById(String id) - { - Object result = registry.runtimes_.get(id); - if (result!=null) - { - return (RuntimeDescriptor)result; - } - return null; - } - - public static String[] getAllClientProjectTypes() - { - ArrayList finalTemplateIdList = new ArrayList(); - Iterator iter = registry.clientRuntimes_.values().iterator(); - - //Loop through all the clientRuntimes - while (iter.hasNext()) - { - ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next(); - - //Get the templates for this client runtime - Set templateIds = FacetUtils.getTemplates(desc.getRequiredFacetVersions()); - - //Add the template ids to the list if they have not already been added - Iterator itr = templateIds.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (!finalTemplateIdList.contains(template.getId())) - { - finalTemplateIdList.add(template.getId()); - } - } - } - - return (String[])finalTemplateIdList.toArray(new String[]{}); - } - - public static String getRuntimeLabelById(String runtimeId) - { - RuntimeDescriptor desc = getRuntimeById(runtimeId); - if (desc == null) - return null; - - return desc.getLabel(); - } - - public static RuntimeDescriptor getRuntimeByLabel(String label) - { - Iterator iter = registry.runtimes_.values().iterator(); - while (iter.hasNext()) - { - RuntimeDescriptor descriptor = (RuntimeDescriptor)iter.next(); - if (descriptor!=null) { - if (label.equals(descriptor.getLabel())) - return descriptor; - } - } - return null; - } - - 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(); - } - - private static String[] getServerFactoryIdsByFacetRuntimes(Set facetRuntimes) - { - - ArrayList supportedServerFactoryIds = new ArrayList(); - String[] serverTypeIds = getAllServerFactoryIdsWithRuntimes(); - Iterator itr = facetRuntimes.iterator(); - while(itr.hasNext()) - { - IRuntime fRuntime = (IRuntime)itr.next(); - org.eclipse.wst.server.core.IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - for (int i=0; i<serverTypeIds.length; i++) - { - IServerType serverType = ServerCore.findServerType(serverTypeIds[i]); - String runtimeTypeId = serverType.getRuntimeType().getId(); - if (runtimeTypeId.equals(sRuntime.getRuntimeType().getId())) - { - supportedServerFactoryIds.add(serverTypeIds[i]); - } - } - } - - return (String[])supportedServerFactoryIds.toArray(new String[0]); - - //Temporarily return all factory ids with runtimes - //return getAllServerFactoryIdsWithRuntimes(); - } - - //Service-side utilities - public static WebServiceImpl getWebServiceImplById(String id) - { - Object result = registry.webServiceImpls_.get(id); - if (result!=null) - { - return (WebServiceImpl)result; - } - return null; - } - - public static ServiceRuntimeDescriptor getServiceRuntimeDescriptorById(String id) - { - Object result = registry.serviceRuntimes_.get(id); - if (result!=null) - { - return (ServiceRuntimeDescriptor)result; - } - return null; - } - - public static IWebServiceRuntime getServiceRuntime( String serviceRuntimeId ) - { - ServiceRuntimeDescriptor descriptor = getServiceRuntimeDescriptorById(serviceRuntimeId); - IWebServiceRuntime webserviceRuntime = null; - if (descriptor != null) - { - webserviceRuntime = descriptor.getWebServiceRuntime(); - } - - return webserviceRuntime; - } - - public static String getServiceRuntimeId(TypeRuntimeServer trs, String projectName, String templateId) - { - //Find the first client runtime that supports the implementation type, runtime, server, and project - String[] descs = getServiceRuntimesByServiceType(trs.getTypeId()); - for (int i=0; i<descs.length; i++) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(descs[i]); - if (desc.getRuntime().getId().equals(trs.getRuntimeId())) - { - boolean supportsServer = doesServiceRuntimeSupportServer(desc.getId(), trs.getServerId()); - if (!supportsServer) - { - continue; - } - - IProject project = ProjectUtilities.getProject(projectName); - if (project.exists()) - { - if (doesServiceRuntimeSupportProject(desc.getId(), projectName)) - { - return desc.getId(); - } - } - else - { - //Check if template is supported - if (doesServiceRuntimeSupportTemplate(desc.getId(), templateId)) - { - return desc.getId(); - } - } - } - } - - return ""; - - } - - /* - * @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 int getScenarioFromTypeId(String typeId) - { - return Integer.parseInt(typeId.substring(0,typeId.indexOf("/"))); - } - - /* - * @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 getWebServiceImplIdFromTypeId(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 - * - * @returns String[] containing the ids of all runtimes that - * support this type. - */ - public static String[] getRuntimesByServiceType(String typeId) - { - int scenario = getScenarioFromTypeId(typeId); - String implId = getWebServiceImplIdFromTypeId(typeId); - ArrayList ids = new ArrayList(); - Iterator iter = registry.serviceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next(); - //Check if this serviceRuntime supports the implementation type - if (desc.getServiceImplementationType().getId().equals(implId)) - { - switch (scenario) - { - case WebServiceScenario.BOTTOMUP: - if (desc.getBottomUp()) - { - String runtimeId = desc.getRuntime().getId(); - if (!ids.contains(runtimeId)) - { - ids.add(runtimeId); - } - } - break; - case WebServiceScenario.TOPDOWN: - if (desc.getTopDown()) - { - String runtimeId = desc.getRuntime().getId(); - if (!ids.contains(runtimeId)) - { - ids.add(runtimeId); - } - } - break; - default: - } - } - } - - return (String[])ids.toArray(new String[]{}); - } - - /* - * @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 - * - * @returns String[] containing the ids of all service runtimes that - * support this type. - */ - public static String[] getServiceRuntimesByServiceType(String typeId) - { - int scenario = getScenarioFromTypeId(typeId); - String implId = getWebServiceImplIdFromTypeId(typeId); - ArrayList ids = new ArrayList(); - Iterator iter = registry.serviceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next(); - //Check if this serviceRuntime supports the implementation type - if (desc.getServiceImplementationType().getId().equals(implId)) - { - switch (scenario) - { - case WebServiceScenario.BOTTOMUP: - if (desc.getBottomUp()) - { - String serviceRuntimeId = desc.getId(); - ids.add(serviceRuntimeId); - } - break; - case WebServiceScenario.TOPDOWN: - if (desc.getTopDown()) - { - String serviceRuntimeId = desc.getId(); - ids.add(serviceRuntimeId); - } - break; - default: - } - } - } - - return (String[])ids.toArray(new String[]{}); - } - /* - * @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 - * @param runtimeId id of a Web service runtime (RuntimeDescriptor) - */ - public static boolean isRuntimeSupportedForServiceType(String typeId, String runtimeId) - { - String[] serviceRuntimeIds = getServiceRuntimesByServiceType(typeId); - if (serviceRuntimeIds!=null) - { - for (int i=0; i < serviceRuntimeIds.length; i++) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeIds[i]); - if (desc.getRuntime().getId().equals(runtimeId)) - { - return true; - } - } - } - - return false; - } - - public static String[] getServerFactoryIdsByServiceType(String typeId) - { - ArrayList serverFactoryIds = new ArrayList(); - String[] srts = getServiceRuntimesByServiceType(typeId); - if (srts != null) - { - for (int i = 0; i < srts.length; i++) - { - //Get the runtimes that work for the facets required for this service runtime - String[] fIds = getServerFactoryIdsByServiceRuntime(srts[i]); - for (int j=0; j<fIds.length; j++) - { - if (!serverFactoryIds.contains(fIds[j])) - { - serverFactoryIds.add(fIds[j]); - } - } - } - } - - return (String[])serverFactoryIds.toArray(new String[]{}); - - //Temporarily return all server type ids. - //return getAllServerFactoryIdsWithRuntimes(); - } - - /* - * @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 isServerSupportedForChosenServiceType(String typeId, String serverFactoryId) - { - String[] fIds = getServerFactoryIdsByServiceType(typeId); - if (fIds == null) - { - return false; - } - - for (int i=0;i<fIds.length;i++) - { - if (serverFactoryId.equals(fIds[i])) - { - return true; - } - } - - return false; - } - - public static String[] getServerFactoryIdsByServiceRuntime(String serviceRuntimeId) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeId); - Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions()); - - //Temporarily return all server types - //return getAllServerFactoryIdsWithRuntimes(); - return getServerFactoryIdsByFacetRuntimes(facetRuntimes); - } - - - - - public static boolean doesServiceRuntimeSupportServer(String serviceRuntimeId, String serverFactoryId) - { - String[] serverIds = getServerFactoryIdsByServiceRuntime(serviceRuntimeId); - for (int i=0; i<serverIds.length; i++) - { - if (serverIds[i].equals(serverFactoryId)) - { - return true; - } - } - - return false; - } - - - public static LabelsAndIds getServiceTypeLabels() - { - String pluginId = "org.eclipse.jst.ws.internal.consumption.ui"; - MessageUtils msgUtils = new MessageUtils( pluginId + ".ConsumptionUI", 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 = getWebServiceImplIdFromTypeId(wst); - WebServiceImpl wsimpl = 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[] srIds = getServiceRuntimesByServiceType(typeId); - if (srIds == null) - { - return null; - } - - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(srIds[0]); - return desc.getRuntime().getId(); - } - - public static String getDefaultServerValueFor(String typeId) - { - String[] fIds = getServerFactoryIdsByServiceType(typeId); - if (fIds==null) - return null; - - return fIds[0]; - } - - /* - * @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 - * @param runtimeId is the id of a RuntimeDescriptor - * @param serverFactoryId server factory id - */ - public static boolean isServerRuntimeTypeSupported(String serverFactoryId, String runtimeId, String typeId) - { - //Ensure there is at least one service runtime that supports the given type - String[] serviceRuntimes = getServiceRuntimesByServiceType(typeId); - if (serviceRuntimes!=null && serviceRuntimes.length>0) - { - //Ensure that at least one of these server runtimes supports the given server - for (int i=0; i<serviceRuntimes.length; i++) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimes[i]); - if (desc.getRuntime().getId().equals(runtimeId)) - { - //Matches the type and the runtime. Check if it matches the server - Set runtimes = getRuntimes(desc.getRequiredFacetVersions()); - String[] fIds = getServerFactoryIdsByFacetRuntimes(runtimes); - for (int j=0; j<fIds.length; j++) - { - if (fIds[j].equals(serverFactoryId)) - { - return true; - } - } - } - } - } - - //didn't find a match. return false. - return false; - } - - public static String[] getWebServiceTypeBySelection(IStructuredSelection selection) - { - TypeSelectionFilter2 tsf = new TypeSelectionFilter2(); - String[] wst = tsf.getWebServiceTypeByInitialSelection(selection, registry.webServiceTypesList_); - return wst == null ? null : wst; - } - - /* - * @param runtimeId : id of a RuntimeDescriptor - * @param factoryId : id of a server type - */ - public static boolean doesRuntimeSupportServerForServiceSide(String runtimeId, String factoryId) - { - //Get all the ServiceRuntimeDescriptors that point to this runtimeId - Iterator iter = registry.serviceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next(); - //check if this service runtime points to runtimeId - String thisRuntimeId = desc.getRuntime().getId(); - if (thisRuntimeId.equals(runtimeId)) - { - Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions()); - String[] fIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes); - for (int j=0; j<fIds.length; j++) - { - if (fIds[j].equals(factoryId)) - { - return true; - } - } - } - } - - //No service runtime matched. Return false. - return false; - } - - /* - * @param runtimeId: id of a RuntimeDescriptor - * @return: server factory id - */ - public static String getFirstSupportedServerForServiceSide(String runtimeId) - { - //Get all the ServiceRuntimeDescriptors that point to this runtimeId - Iterator iter = registry.serviceRuntimes_.values().iterator(); - while (iter.hasNext()) - { - ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next(); - //check if this service runtime points to runtimeId - String thisRuntimeId = desc.getRuntime().getId(); - if (thisRuntimeId.equals(runtimeId)) - { - Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions()); - String[] factoryIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes); - if (factoryIds!=null && factoryIds.length >0) - { - return factoryIds[0]; - } - } - } - - //didn't get a single suitable server type id, return null. - return null; - } - - public static String[] getProjectsForServiceTypeAndRuntime(String typeId, String runtimeId) - { - String[] descs = getServiceRuntimesByServiceType(typeId); - IProject[] projects = FacetUtils.getAllProjects(); - ArrayList validProjects = new ArrayList(); - - for (int i=0; i<projects.length;i++) - { - //check if this projects suits any of the service runtimes - for (int j=0; j<descs.length; j++) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(descs[j]); - RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions(); - Set facetVersions = FacetUtils.getFacetsForProject(projects[i].getName()); - if (facetVersions != null) - { - FacetMatcher fm = FacetUtils.match(rfvs, facetVersions); - if (fm.isMatch()) - { - validProjects.add(projects[i].getName()); - break; - } - } - } - } - - return (String[])validProjects.toArray(new String[0]); - - } - - public static boolean doesServiceTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName) - { - String[] descs = getServiceRuntimesByServiceType(typeId); - IProject[] projects = FacetUtils.getAllProjects(); - - for (int i=0; i<projects.length;i++) - { - //if this is the test project, check if this project suits any of the service runtimes - if (projects[i].getName().equals(projectName)) - { - for (int j = 0; j < descs.length; j++) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(descs[j]); - RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions(); - Set facetVersions = FacetUtils.getFacetsForProject(projects[i].getName()); - if (facetVersions != null) - { - FacetMatcher fm = FacetUtils.match(rfvs, facetVersions); - if (fm.isMatch()) - { - // found a match. done. - return true; - } - } - } - } - } - - return false; - - } - public static boolean doesServiceRuntimeSupportProject(String serviceRuntimeId, String projectName) - { - IProject project = ProjectUtilities.getProject(projectName); - if (project==null || !project.exists()) - return false; - - ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimeId); - RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions(); - Set facetVersions = FacetUtils.getFacetsForProject(projectName); - if (facetVersions != null) - { - FacetMatcher fm = FacetUtils.match(rfvs, facetVersions); - if (fm.isMatch()) - { - return true; - } - } - return false; - } - - /* - * Returns a list of valid faceted project template ids - * @param typeId id of the form "0/implId" on the service side. - * @param runtimeId id of a RuntimeDescriptor - * - * @return String[] array of IFacetedProjectTemplate ids - */ - public static String[] getServiceProjectTemplates(String typeId, String runtimeId) - { - String[] srIds = getServiceRuntimesByServiceType(typeId); - if (srIds == null) - { - return null; - } - - ArrayList templateIdList = new ArrayList(); - for (int i = 0; i < srIds.length; i++) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(srIds[i]); - String thisRuntimeId = desc.getRuntime().getId(); - if (thisRuntimeId.equals(runtimeId)) - { - //Get the templates for this client runtime - Set templateIds = FacetUtils.getTemplates(desc.getRequiredFacetVersions()); - - //Add the template ids to the list if they have not already been added - Iterator itr = templateIds.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (!templateIdList.contains(template.getId())) - { - templateIdList.add(template.getId()); - } - } - } - - } - - return (String[])templateIdList.toArray(new String[]{}); - } - - public static boolean doesServiceTypeAndRuntimeSupportTemplate(String typeId, String runtimeId, String templateId) - { - String[] srIds = getServiceRuntimesByServiceType(typeId); - if (srIds == null) - { - return false; - } - - for (int i = 0; i < srIds.length; i++) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(srIds[i]); - String thisRuntimeId = desc.getRuntime().getId(); - if (thisRuntimeId.equals(runtimeId)) - { - //Get the templates for this service runtime - Set templateIds = FacetUtils.getTemplates(desc.getRequiredFacetVersions()); - - //Check if any of the template ids match the given one. - Iterator itr = templateIds.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (template.getId().equals(templateId)) - { - return true; - } - - } - } - - } - - return false; - } - - public static boolean doesServiceRuntimeSupportTemplate(String serviceRuntimeId, String templateId) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(serviceRuntimeId); - //Get the templates for this client runtime - Set templates = FacetUtils.getTemplates(desc.getRequiredFacetVersions()); - IFacetedProjectTemplate checkingTemplate = ProjectFacetsManager.getTemplate(templateId); - return templates.contains(checkingTemplate); - } - - //Client-side utilities - public static WebServiceClientImpl getWebServiceClientImplById(String id) - { - Object result = registry.webServiceClientImpls_.get(id); - if (result!=null) - { - return (WebServiceClientImpl)result; - } - return null; - } - - public static ClientRuntimeDescriptor getClientRuntimeDescriptorById(String id) - { - Object result = registry.clientRuntimes_.get(id); - if (result!=null) - { - return (ClientRuntimeDescriptor)result; - } - return null; - } - - public static IWebServiceRuntime getClientRuntime( String clientRuntimeId ) - { - ClientRuntimeDescriptor descriptor = getClientRuntimeDescriptorById(clientRuntimeId); - IWebServiceRuntime webserviceRuntime = null; - if (descriptor != null) - { - webserviceRuntime = descriptor.getWebServiceRuntime(); - } - - return webserviceRuntime; - } - - public static String getClientRuntimeId(TypeRuntimeServer trs, String projectName, String templateId) - { - //Find the first client runtime that supports the implementation type, runtime, server, and project - String[] descs = getClientRuntimesByType(trs.getTypeId()); - for (int i=0; i<descs.length; i++) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[i]); - if (desc.getRuntime().getId().equals(trs.getRuntimeId())) - { - boolean supportsServer = doesClientRuntimeSupportServer(desc.getId(), trs.getServerId()); - if (!supportsServer) - { - continue; - } - - IProject project = ProjectUtilities.getProject(projectName); - if (project.exists()) - { - if (doesClientRuntimeSupportProject(desc.getId(), projectName)) - { - return desc.getId(); - } - } - else - { - //Check if template is supported - if (doesClientRuntimeSupportTemplate(desc.getId(), templateId)) - { - return desc.getId(); - } - } - } - } - - return ""; - - } - - /* - * @return String[] array of ids of RuntimeDescriptors - */ - public static String[] getAllRuntimesForClientSide() - { - ArrayList runtimeIds = new ArrayList(); - Iterator iter = registry.clientRuntimes_.values().iterator(); - while (iter.hasNext()) - { - ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next(); - String thisRuntimeId = desc.getRuntime().getId(); - if (!runtimeIds.contains(thisRuntimeId)) - runtimeIds.add(thisRuntimeId); - } - return (String[])runtimeIds.toArray(new String[]{}); - } - - /* - * @param clientImpld The id of a client implementation type - * - * @returns String[] containing the ids of all clientRuntimes that - * support this client implementation type - */ - public static String[] getClientRuntimesByType(String clientImplId) - { - ArrayList ids = new ArrayList(); - Iterator iter = registry.clientRuntimes_.values().iterator(); - while (iter.hasNext()) - { - ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next(); - //Check if this serviceRuntime supports the implementation type - if (desc.getClientImplementationType().getId().equals(clientImplId)) - { - ids.add(desc.getId()); - } - } - - return (String[])ids.toArray(new String[]{}); - } - - /* - * @param clientImplId id of a WebServiceClientImpl - * @return String[] array of RuntimeDescriptor ids - */ - public static String[] getRuntimesByClientType(String clientImplId) - { - ArrayList runtimeIds = new ArrayList(); - Iterator iter = registry.clientRuntimes_.values().iterator(); - while (iter.hasNext()) - { - ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next(); - //Check if this serviceRuntime supports the implementation type - if (desc.getClientImplementationType().getId().equals(clientImplId)) - { - runtimeIds.add(desc.getRuntime().getId()); - } - } - - return (String[])runtimeIds.toArray(new String[]{}); - } - - /* - * @param clientImplId The id of a client implementation type - * @param runtimeId id of a runtime (RuntimeDescriptor) - */ - public static boolean isRuntimeSupportedForClientType(String clientImplId, String runtimeId) - { - String[] clientRuntimeIds = getClientRuntimesByType(clientImplId); - if (clientRuntimeIds!=null) - { - for (int i=0; i < clientRuntimeIds.length; i++) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeIds[i]); - if (desc.getRuntime().getId().equals(runtimeId)) - { - return true; - } - } - } - - return false; - } - - public static String[] getAllClientServerFactoryIds() - { - //Iterator iter = registry.clientRuntimes_.values().iterator(); - //while (iter.hasNext()) - //{ - //TODO iterate over all the server types and see if their runtime types have an - //id that matches the runtime type of any of the runtimes. - // ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next(); - // Set runtimes = getRuntimes(desc.getRequiredFacetVersions()); - // IServerType[] allServerTypes = ServerCore.getServerTypes(); - //} - //return (String[])serverFactoryIds.toArray(new String[]{}); - //Temporarily return all server types - return getAllServerFactoryIdsWithRuntimes(); - } - - public static String[] getServerFactoryIdsByClientType(String clientImplId) - { - ArrayList serverFactoryIds = new ArrayList(); - String[] crts = getClientRuntimesByType(clientImplId); - if (crts != null) - { - for (int i = 0; i < crts.length; i++) - { - //Get the runtimes that work for the facets required for this service runtime - String[] fIds = getServerFactoryIdsByClientRuntime(crts[i]); - for (int j=0; j<fIds.length; j++) - { - if (!serverFactoryIds.contains(fIds[j])) - { - serverFactoryIds.add(fIds[j]); - } - } - } - } - - return (String[])serverFactoryIds.toArray(new String[]{}); - } - - /* - * - */ - public static boolean isServerSupportedForChosenClientType(String clientImplId, String serverFactoryId) - { - String[] fIds = getServerFactoryIdsByClientType(clientImplId); - if (fIds == null) - { - return false; - } - - for (int i=0;i<fIds.length;i++) - { - if (serverFactoryId.equals(fIds[i])) - { - return true; - } - } - - return false; - } - - /* - * @prarm clientRuntimeId : id of a ClientRuntimeDescriptor - * - */ - public static String[] getServerFactoryIdsByClientRuntime(String clientRuntimeId) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId); - Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions()); - - String[] fIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes); - return fIds; - } - - /* - * @param clientRuntimeId id of a ClientRuntimeDescriptor - */ - public static boolean doesClientRuntimeSupportServer(String clientRuntimeId, String serverFactoryId) - { - String[] serverIds = getServerFactoryIdsByClientRuntime(clientRuntimeId); - for (int i=0; i<serverIds.length; i++) - { - if (serverIds[i].equals(serverFactoryId)) - { - return true; - } - } - - return false; - } - - /* - * @param runtimeId : id of a RuntimeDescriptor - * @param factoryId : id of a server type - */ - public static boolean doesRuntimeSupportServerForClientSide(String runtimeId, String factoryId) - { - //Get all the ClientRuntimeDescriptors that point to this runtimeId - Iterator iter = registry.clientRuntimes_.values().iterator(); - while (iter.hasNext()) - { - ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next(); - //check if this client runtime points to runtimeId - String thisRuntimeId = desc.getRuntime().getId(); - if (thisRuntimeId.equals(runtimeId)) - { - Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions()); - String[] fIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes); - for (int i=0; i<fIds.length; i++) - { - if (fIds[i].equals(factoryId)) - { - return true; - } - } - } - } - - //No match. - return false; - } - - /* - * @param runtimeId: id of a RuntimeDescriptor - * @return: server factory id - */ - public static String getFirstSupportedServerForClientSide(String runtimeId) - { - //Get all the ClientRuntimeDescriptors that point to this runtimeId - Iterator iter = registry.clientRuntimes_.values().iterator(); - while (iter.hasNext()) - { - ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)iter.next(); - //check if this service runtime points to runtimeId - String thisRuntimeId = desc.getRuntime().getId(); - if (thisRuntimeId.equals(runtimeId)) - { - Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions()); - String[] factoryIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes); - if (factoryIds!=null && factoryIds.length >0) - { - return factoryIds[0]; - } - } - } - - //No suitable servers found. Return null. - return null; - - } - - /* - * @param clientImplId is the id of a WebServiceClientImpl - * @param runtimeId is the id of a RuntimeDescriptor - * @param serverFactoryId server factory id - */ - public static boolean isServerClientRuntimeTypeSupported(String serverFactoryId, String runtimeId, String clientImplId) - { - //Ensure there is at least one client runtime that supports the given type - String[] clientRuntimes = getClientRuntimesByType(clientImplId); - if (clientRuntimes!=null && clientRuntimes.length>0) - { - //Ensure that at least one of these server runtimes supports the given server - for (int i=0; i<clientRuntimes.length; i++) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimes[i]); - if (desc.getRuntime().getId().equals(runtimeId)) - { - //Matched type and runtime. Check the server. - String[] factoryIds = getServerFactoryIdsByClientRuntime(desc.getId()); - for (int j=0; j<factoryIds.length; j++) - { - if (factoryIds[j].equals(serverFactoryId)) - { - return true; - } - } - } - } - } - - //No match found. return false. - return false; - } - - /* - * Returns a list of valid faceted project template ids - * @param clientImplId id of a WebServiceClientImpl - * @param runtimeId id of a RuntimeDescriptor - * - * @return String[] array of IFacetedProjectTemplate ids - */ - public static String[] getClientProjectTemplates(String clientImplId, String runtimeId) - { - String[] crIds = getClientRuntimesByType(clientImplId); - if (crIds == null) - { - return null; - } - - ArrayList templateIdList = new ArrayList(); - for (int i = 0; i < crIds.length; i++) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(crIds[i]); - String thisRuntimeId = desc.getRuntime().getId(); - if (thisRuntimeId.equals(runtimeId)) - { - //Get the templates for this client runtime - Set templateIds = FacetUtils.getTemplates(desc.getRequiredFacetVersions()); - - //Add the template ids to the list if they have not already been added - Iterator itr = templateIds.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (!templateIdList.contains(template.getId())) - { - templateIdList.add(template.getId()); - } - } - } - - } - - return (String[])templateIdList.toArray(new String[]{}); - } - - public static boolean doesClientTypeAndRuntimeSupportTemplate(String clientImplId, String runtimeId, String templateId) - { - String[] crIds = getClientRuntimesByType(clientImplId); - if (crIds == null) - { - return false; - } - - for (int i = 0; i < crIds.length; i++) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(crIds[i]); - String thisRuntimeId = desc.getRuntime().getId(); - if (thisRuntimeId.equals(runtimeId)) - { - //Get the templates for this client runtime - Set templateIds = FacetUtils.getTemplates(desc.getRequiredFacetVersions()); - - //Check if the template ids contains the template we're checking for - Iterator itr = templateIds.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (template.getId().equals(templateId)) - { - return true; - } - } - } - - } - - return false; - } - - - /* - public static boolean doesClientTypeAndRuntimeSupportTemplate(String clientImplId, String runtimeId, String templateId) - { - String[] templateIds = getClientProjectTemplates(clientImplId, runtimeId); - if (templateIds!=null) - { - for (int i=0; i<templateIds.length; i++) - { - if (templateIds[i].equals(templateId)) - { - return true; - } - } - } - - return false; - } - */ - - public static boolean doesClientRuntimeSupportTemplate(String clientRuntimeId, String templateId) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId); - //Get the templates for this client runtime - Set templates = FacetUtils.getTemplates(desc.getRequiredFacetVersions()); - IFacetedProjectTemplate checkingTemplate = ProjectFacetsManager.getTemplate(templateId); - return templates.contains(checkingTemplate); - } - - - public static LabelsAndIds getClientTypeLabels() - { - - LabelsAndIds labelIds = new LabelsAndIds(); - String[] idsArray = new String[0]; - String[] labelsArray = new String[0]; - labelIds.setIds_(idsArray); - labelIds.setLabels_(labelsArray); - - ArrayList ids = new ArrayList(); - ArrayList labels = new ArrayList(); - - Iterator itr = registry.clientRuntimes_.values().iterator(); - while(itr.hasNext()) - { - ClientRuntimeDescriptor desc = (ClientRuntimeDescriptor)itr.next(); - WebServiceClientImpl thisClientImpl = desc.getClientImplementationType(); - if (!ids.contains(thisClientImpl.getId())) - { - ids.add(thisClientImpl.getId()); - labels.add(thisClientImpl.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; - - } - - public static String[] getAllServerFactoryIdsWithRuntimes() - { - ArrayList fids = new ArrayList(); - IServerType[] sts = ServerCore.getServerTypes(); - org.eclipse.wst.server.core.IRuntime[] rts = ServerCore.getRuntimes(); - - for (int i=0; i<sts.length; i++) - { - IServerType st = sts[i]; - for (int j=0; j<rts.length; j++) - { - org.eclipse.wst.server.core.IRuntime rt = rts[j]; - // If the server type has the same runtime type as this runtime, add it to the list - String serverTypeRuntimeTypeId = st.getRuntimeType().getId(); - String runtimeRuntimeTypeId = rt.getRuntimeType().getId(); - if (serverTypeRuntimeTypeId.equals(runtimeRuntimeTypeId)) - { - if (!fids.contains(st.getId())) - { - fids.add(st.getId()); - } - } - } - } - - return (String[])fids.toArray(new String[0]); - } - - public static String[] getProjectsForClientTypeAndRuntime(String typeId, String runtimeId) - { - String[] descs = getClientRuntimesByType(typeId); - IProject[] projects = FacetUtils.getAllProjects(); - ArrayList validProjects = new ArrayList(); - - for (int i=0; i<projects.length;i++) - { - //check if this projects suits any of the client runtimes - for (int j=0; j<descs.length; j++) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[j]); - RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions(); - Set facetVersions = FacetUtils.getFacetsForProject(projects[i].getName()); - if (facetVersions != null) - { - FacetMatcher fm = FacetUtils.match(rfvs, facetVersions); - if (fm.isMatch()) - { - validProjects.add(projects[i].getName()); - break; - } - } - } - } - - return (String[])validProjects.toArray(new String[0]); - - } - - public static boolean doesClientTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName) - { - String[] descs = getClientRuntimesByType(typeId); - IProject[] projects = FacetUtils.getAllProjects(); - - for (int i=0; i<projects.length;i++) - { - // check if this projects suits any of the client runtimes - if (projects[i].getName().equals(projectName)) - { - for (int j = 0; j < descs.length; j++) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[j]); - RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions(); - Set facetVersions = FacetUtils.getFacetsForProject(projects[i].getName()); - if (facetVersions != null) - { - FacetMatcher fm = FacetUtils.match(rfvs, facetVersions); - if (fm.isMatch()) - { - return true; - } - } - } - } - } - - return false; - - } - - - public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName) - { - IProject project = ProjectUtilities.getProject(projectName); - if (project==null || !project.exists()) - return false; - - ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId); - RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions(); - Set facetVersions = FacetUtils.getFacetsForProject(projectName); - if (facetVersions != null) - { - FacetMatcher fm = FacetUtils.match(rfvs, facetVersions); - if (fm.isMatch()) - { - return true; - } - } - return false; - } - - //Utilities used by the ServerRuntimePreferencePage - - private static SelectionListChoices serverToRuntimeToJ2EE_; - private static Hashtable serverFactoryIdByLabel_; - private static Hashtable runtimeIdByLabel_; - - 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) - { - //Return all the runtimes for now. - Set runtimes = registry.runtimes_.keySet(); - Iterator itr = registry.runtimes_.keySet().iterator(); - String[] runtimeIds = new String[runtimes.size()]; - //TODO String[] runtimeIds = getRuntimeIDsByServerFactoryID(serverFactoryId); - int i = 0; - while (itr.hasNext()) - { - String runtimeId = (String)itr.next(); - runtimeIds[i] = runtimeId; - i++; - - } - - SelectionList runtimesList = new SelectionList(runtimeIds, 0); - Vector choices = new Vector(); - for (int j=0; j<runtimeIds.length; j++) - { - choices.add(getJ2EEChoices(runtimeIds[j])); - } - return new SelectionListChoices(runtimesList, choices); - } - - private static SelectionListChoices getJ2EEChoices(String runtimeId) - { - //J2EE levels will be removed from the Server Runtime preference page. - //Return some hard coded values for now. - String[] j2eeVersions = new String[]{"13", "14"}; - SelectionList j2eeVersionsList = new SelectionList(j2eeVersions, 0); - return new SelectionListChoices(j2eeVersionsList, null); - } - - private static String[] getAllServerFactoryIds() - { - //Return all server type ids for now. - //TODO Only the servers that are appropriate for the Web service runtimes should be displayed. - ArrayList ids = new ArrayList(); - if (serverFactoryIdByLabel_ == null) - { - serverFactoryIdByLabel_ = new Hashtable(); - IServerType[] serverTypes = ServerCore.getServerTypes(); - for (int i=0; i<serverTypes.length; i++) - { - String id = serverTypes[i].getId(); - String label = getServerLabelById(id); - serverFactoryIdByLabel_.put(label, id); - ids.add(id); - } - } - 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; - } - - //TODO this needs to be implemented once facet runtime to server runtime bridge is available. - /* - 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.runtimes_.values().iterator(); - while (iter.hasNext()) - { - RuntimeDescriptor desc = (RuntimeDescriptor)iter.next(); - runtimeIdByLabel_.put(desc.getLabel(), desc.getId()); - } - } - - return (String)runtimeIdByLabel_.get(label); - } - - - private static Set getRuntimes(RequiredFacetVersion[] requiredFacetVersions) - { - return FacetUtils.getRuntimes(requiredFacetVersions); - } -} 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 a69832c3d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeInfo.java +++ /dev/null @@ -1,208 +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.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_; - } - -} |