diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse')
161 files changed, 0 insertions, 32971 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 aa71abd70..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUI.properties +++ /dev/null @@ -1,638 +0,0 @@ -############################################################################### -# Copyright (c) 2004, 2007 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -# yyyymmdd bug Email and other contact information -# -------- -------- ----------------------------------------------------------- -# 20060204 124143 rsinha@ca.ibm.com - Rupam Kuehner -# 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner -# 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner -# 20060321 128827 joan - Joan Haggarty -# 20060329 128069 rsinha@ca.ibm.com - Rupam Kuehner -# 20060407 135443 joan@ca.ibm.com - Joan Haggarty -# 20060411 136134 kathy@ca.ibm.com - Kathy Chan -# 20060417 136390 joan@ca.ibm.com - Joan Haggarty -# 20060413 135581 rsinha@ca.ibm.com - Rupam Kuehner -# 20060418 136335 joan@ca.ibm.com - Joan Haggarty -# 20060420 136158 rsinha@ca.ibm.com - Rupam Kuehner -# 20060420 120714 kathy@ca.ibm.com - Kathy Chan -# 20060420 135912 joan@ca.ibm.com - Joan Haggarty -# 20060510 141115 rsinha@ca.ibm.com - Rupam Kuehner -# 20060509 119296 pmoogk@ca.ibm.com - Peter Moogk -# 20060602 145054 kathy@ca.ibm.com - Kathy Chan -# 20070427 177360 pmoogk@ca.ibm.com - Peter Moogk -# 20071031 140518 joan@ca.ibm.com - Joan Haggarty -############################################################################### - -# -# 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 a server runtime. - - -# -# 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_WEBSERVICEIMPL=Service implementation: -LABEL_WEBSERVICEDEF=Service definition: -LABEL_J2EE_VERSION=J2EE version: -LABEL_NA=N/A - -BUTTON_BROWSE=B&rowse... -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_SERVICE=Select a service implementation or definition and move the sliders to set the level of service and client generation. -PAGE_DESC_WS_CLIENT=Select a service definition and move the slider to set the level of client generation. -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 type: - -TOOLTIP_WSWSCEN_SERVICEPROJECT_LINK=Click on the link to edit service project and EAR settings. -TOOLTIP_WSWSCEN_CLIENTPROJECT_LINK=Click on the link to edit client project and EAR settings. - -DIALOG_TITILE_SERVICE_IMPL_SELECTION=Select Service Implementation -DIALOG_TITILE_SERVICE_DEF_SELECTION=Select Service Definition -DIALOG_TITILE_SERVICE_PROJECT_SETTINGS=Specify Service Project Settings -DIALOG_TITILE_CLIENT_PROJECT_SETTINGS=Specify Client Project Settings - -# Items common to WebServiceRuntimeSelectionPage and WebServiceClientRuntimeSelectionPage -# WebServiceRuntimeSelectionPage -LABEL_SUMMARY=Configuration: -LABEL_SUMMARY_NO_CLIENT=Configuration: No client generation. -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=Click on the link to specify the web service runtime. -TOOLTIP_PWRS_TEXT_SERVER=Click on the link to specify a server. -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_NO_OBJECT_SELECTION=Select a service implementation. -MSG_NO_SERVICE_SELECTION=Select a service definition. -MSG_INVALID_SERVICE_IMPL=The service implementation selected is invalid. -MSG_INVALID_SERVICE_DEF=The service definition selected is invalid. -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_WARN_STUB_ONLY={0} has only stub runtimes associated with it so the server will not be created or started. -MSG_WARN_NO_SERVICE_SERVER=No server has been selected. The Web service will not be deployed, installed, or run. -MSG_WARN_NO_CLIENT_SERVER=No server has been selected. The Web service client will not be deployed, installed, or run. - -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_PROJECT_TYPE_EMPTY=Select a service project type. -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_PROJECT_TYPE_EMPTY=Select a client project type. -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. - -MSG_CLIENT_CANNOT_ASSOCIATE=The client project, {0}, cannot be associated with the EAR, {1}. Choose an EAR with a J2EE level of {2} or higher. -MSG_SERVICE_CANNOT_ASSOCIATE=The service project, {0}, cannot be associated with the EAR, {1}. Choose an EAR with a J2EE level of {2} or higher. - -MSG_PROJECT_MUST_EXIST=No server can be found and {0} does not exist. Choose an existing project or use the preferences to configure a server runtime. - - -# 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=Test Web Service -PAGE_DESC_WSTEST=Select a test facility -CHECKBOX_TEST_WEBSERVICE=&Test the Web service -CHECKBOX_MONITOR_WEBSERVICE=&Monitor the Web service -CHECKBOX_OVERWRITE_FILES=&Overwrite files without warning -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. -MSG_ERROR_MODULE_DEPENDENCY=Unable to establish module dependency from {0} to {1}. - -# -# 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. -LABEL_SHOW_ALL_STATELESS_SESSION_EJBS=<<Show all stateless session EJBs>> - -# -# Tooltips for WebServiceWSDLSelectionPage -# -TOOLTIP_PWWS_PAGE= - -# -# Tooltips for Web Service Wizard Scenario Page -# -BUTTON_WSWSCEN_PUBLISH=&Publish the Web service -TOOLTIP_WSWSCEN_SCALE_DEVELOP=Develop -TOOLTIP_WSWSCEN_SCALE_ASSEMBLE=Assemble -TOOLTIP_WSWSCEN_SCALE_DEPLOY=Deploy -TOOLTIP_WSWSCEN_SCALE_INSTALL=Install -TOOLTIP_WSWSCEN_SCALE_RUN=Start -TOOLTIP_WSWSCEN_SCALE_TEST=Test -TOOLTIP_WSWSCEN_SCALE_SERVICE=Move the slider to set the level of service generation. -TOOLTIP_WSWSCEN_SCALE_CLIENT=Move the slider to set the level of client generation. Service must be started to enable client generation. -TOOLTIP_WSWSCEN_SCALE_CLIENT_ONLY=Move the slider to set the level of client generation. -TOOLTIP_WSWSCEN_TEXT_IMPL=Implementation for the web service. -TOOLTIP_WSWSCEN_BUTTON_BROWSE_IMPL=Browse implementation files for specified service type. -TOOLTIP_WSWSCEN_BUTTON_OVERWRITE_FILES=Existing files will be overwritten with no warning during generation. - -# -# 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 traffic 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 a URI to a WSDL, WSIL or HTML document. -PAGE_MSG_NO_SUCH_FILE=File "{0}" does not exist. -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 a 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 a 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. - -# -# Table column heading for ValidationMessageViewerWidget -# -TABLE_COLUMN_VALIDATION_SEVERITY=Severity -TABLE_COLUMN_VALIDATION_LINE=Line -TABLE_COLUMN_VALIDATION_COLUMN=Column -TABLE_COLUMN_VALIDATION_MESSAGE=Message -# -# 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 References: -LABEL_COMBO_WS_SERVICE_DESC=Service Descriptions: -MSG_TEXT_NUM_OF_SERVICES=You have selected {0} services. -MSG_TEXT_NUM_OF_CLIENTS=You have selected {0} client services. - -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 -PAGE_DESC_MULTIPLE_SERVICES_CONFIG=Add handlers to multiple Web services. -PAGE_DESC_MULTIPLE_CLIENTS_CONFIG=Add handlers to multiple Web service clients. - -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. -MSG_ERROR_INVALID_MULTIPLE_SERVICE_SELECT=Invalid multiple selection of Services. Ensure all selections are Services.# - -# 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 - -# -# 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. - -LABEL_BUTTON_STOP_WSDL_VALIDATION=Stop Validation -TOOLTIP_STOP_VALIDATION_BUTTON=Stops the current WSDL validation operation. - - -# -# Start server page -# -PAGE_TITLE_WS_START_SERVER=Server startup -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} - -MSG_INFO_WSDL_OPERATION_TIMED_OUT=Could not retrieve the WSDL file {0}. Do you want to continue to wait for this file? 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 c5375682d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ConsumptionUIMessages.java +++ /dev/null @@ -1,397 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060204 124143 rsinha@ca.ibm.com - Rupam Kuehner - * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060329 128069 rsinha@ca.ibm.com - Rupam Kuehner - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060411 136134 kathy@ca.ibm.com - Kathy Chan - * 20060417 136390/136159 joan@ca.ibm.com - Joan Haggarty - * 20060413 135581 rsinha@ca.ibm.com - Rupam Kuehner - * 20060418 136335 joan@ca.ibm.com - Joan Haggarty - * 20060420 136158 rsinha@ca.ibm.com - Rupam Kuehner - * 20060420 120714 kathy@ca.ibm.com - Kathy Chan - * 20060420 135912 joan@ca.ibm.com - Joan Haggarty - * 20060426 138647 joan@ca.ibm.com - Joan Haggarty - * 20060510 141115 rsinha@ca.ibm.com - Rupam Kuehner - * 20060509 119296 pmoogk@ca.ibm.com - Peter Moogk - * 20060719 139977 kathy@ca.ibm.com - Kathy Chan - * 20071031 140518 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ -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_WEBSERVICEIMPL; - public static String LABEL_WEBSERVICEDEF; - 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_SERVICE; - public static String PAGE_DESC_WS_CLIENT; - 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_SUMMARY; - public static String LABEL_SUMMARY_NO_CLIENT; - 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_NO_OBJECT_SELECTION; - public static String MSG_NO_SERVICE_SELECTION; - public static String MSG_INVALID_SERVICE_DEF; - public static String MSG_INVALID_SERVICE_IMPL; - 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_WARN_STUB_ONLY; - public static String MSG_WARN_NO_SERVICE_SERVER; - public static String MSG_WARN_NO_CLIENT_SERVER; - 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_PROJECT_TYPE_EMPTY; - public static String MSG_SERVICE_EAR_EMPTY; - public static String MSG_CLIENT_PROJECT_EMPTY; - public static String MSG_CLIENT_PROJECT_TYPE_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_WSWSCEN_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 LABEL_SHOW_ALL_STATELESS_SESSION_EJBS; - public static String CHECKBOX_OVERWRITE_FILES; - public static String DIALOG_TITILE_SERVICE_PROJECT_SETTINGS; - public static String DIALOG_TITILE_CLIENT_PROJECT_SETTINGS; - public static String DIALOG_TITILE_SERVICE_IMPL_SELECTION; - public static String DIALOG_TITILE_SERVICE_DEF_SELECTION; - public static String TOOLTIP_WSWSCEN_SERVICEPROJECT_LINK; - public static String TOOLTIP_WSWSCEN_CLIENTPROJECT_LINK; - public static String TOOLTIP_WSWSCEN_SCALE_DEVELOP; - public static String TOOLTIP_WSWSCEN_SCALE_ASSEMBLE; - public static String TOOLTIP_WSWSCEN_SCALE_DEPLOY; - public static String TOOLTIP_WSWSCEN_SCALE_INSTALL; - public static String TOOLTIP_WSWSCEN_SCALE_RUN; - public static String TOOLTIP_WSWSCEN_SCALE_TEST; - public static String TOOLTIP_WSWSCEN_SCALE_SERVICE; - public static String TOOLTIP_WSWSCEN_SCALE_CLIENT; - public static String TOOLTIP_WSWSCEN_SCALE_CLIENT_ONLY; - public static String TOOLTIP_WSWSCEN_TEXT_IMPL; - public static String TOOLTIP_WSWSCEN_BUTTON_OVERWRITE_FILES; - public static String TOOLTIP_WSWSCEN_BUTTON_BROWSE_IMPL; - 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 TABLE_COLUMN_VALIDATION_SEVERITY; - public static String TABLE_COLUMN_VALIDATION_LINE; - public static String TABLE_COLUMN_VALIDATION_COLUMN; - public static String TABLE_COLUMN_VALIDATION_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 MSG_TEXT_NUM_OF_SERVICES; - public static String MSG_TEXT_NUM_OF_CLIENTS; - 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 PAGE_DESC_MULTIPLE_SERVICES_CONFIG; - public static String PAGE_DESC_MULTIPLE_CLIENTS_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 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 LABEL_BUTTON_STOP_WSDL_VALIDATION; - public static String TOOLTIP_STOP_VALIDATION_BUTTON; - 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; - public static String MSG_CLIENT_CANNOT_ASSOCIATE; - public static String MSG_SERVICE_CANNOT_ASSOCIATE; - public static String MSG_PROJECT_MUST_EXIST; - public static String MSG_ERROR_INVALID_MULTIPLE_SERVICE_SELECT; - public static String MSG_ERROR_MODULE_DEPENDENCY; - public static String MSG_INFO_WSDL_OPERATION_TIMED_OUT; - - - static { - NLS.initializeMessages(BUNDLE_NAME, ConsumptionUIMessages.class); - } -} 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 14e0d372b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/ant/AntClientRootCommandFragment.java +++ /dev/null @@ -1,224 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20060530 144358 kathy@ca.ibm.com - Kathy Chan - * 20060530 144350 kathy@ca.ibm.com - Kathy Chan - * 20060825 155114 pmoogk@ca.ibm.com - Peter Moogk - * 20061011 159283 makandre@ca.ibm.com - Andrew Mak, project not associated to EAR when using ant on command-line - * 20070501 178129 makandre@ca.ibm.com - Andrew Mak, workspace reports "crash detected" after running WS ant task (cmdline) - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.ant; - -import org.eclipse.jst.ws.internal.consumption.ui.command.AntDefaultingOperation; -import org.eclipse.jst.ws.internal.consumption.ui.command.AntRestoringCommand; -import org.eclipse.jst.ws.internal.consumption.ui.command.AntWorkspaceSaveCommand; -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.common.ScenarioCleanupCommand; -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.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(true), "" ) ); - add( new SimpleFragment( new ClientWizardWidgetOutputCommand(), "" )); - add( new SimpleFragment( new WSDLSelectionWidgetDefaultingCommand(), "")); - - add( new SimpleFragment( new WSDLSelectionOutputCommand(), "")); - 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 AntRestoringCommand(), "" )); - add( new SimpleFragment( new ScenarioCleanupCommand(), "" )); - add( new SimpleFragment( new AntWorkspaceSaveCommand(), "")); - - } - - /* (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); - - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "DevelopClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "AssembleClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "DeployClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "StartClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ResourceContext", ClientRuntimeSelectionWidgetDefaultingCommand.class); - - - // Map ClientWizardWidgetOutputCommand command. - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ClientTypeRuntimeServer", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "TestService", WSDLSelectionOutputCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "TestService", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "TestService", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ResourceContext", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ResourceContext", ClientExtensionDefaultingCommand.class); - - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "InstallClient", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "StartClient", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "DevelopClient", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "AssembleClient", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "DeployClient", 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); - dataRegistry.addMapping(AntDefaultingOperation.class, "DeployClient", 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( ClientExtensionDefaultingCommand.class, "DevelopClient", PreClientDevelopCommand.class); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "AssembleClient", PreClientDevelopCommand.class); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "DeployClient", PreClientDevelopCommand.class ); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "StartClient", PreClientDevelopCommand.class, "StartService", null); - - 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 ); - - dataRegistry.addMapping(AntDefaultingOperation.class, "RendererValidation", AntRestoringCommand.class); - } -} 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 3fbf57ba6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntDefaultingOperation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20061011 159283 makandre@ca.ibm.com - Andrew Mak, project not associated to EAR when using ant on command-line - *******************************************************************************/ -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; -import org.eclipse.wst.common.internal.emf.resource.RendererFactory; - -public class AntDefaultingOperation extends AbstractDataModelOperation{ - - private boolean rendererValidation; - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - // TODO Auto-generated method stub - - rendererValidation = RendererFactory.getDefaultRendererFactory().isValidating(); - RendererFactory.getDefaultRendererFactory().setValidating(false); - - return Status.OK_STATUS; - } - - public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - RendererFactory.getDefaultRendererFactory().setValidating(rendererValidation); - - return Status.OK_STATUS; - } - - public boolean getServiceIdsFixed() - { - return true; - } - - public boolean getClientIdsFixed() - { - return true; - } - - public boolean getStartService() - { - return false; - } - - public boolean getInstallService() - { - return false; - } - - public boolean getDeployService() - { - return true; - } - - public boolean getDeployClient() - { - return true; - } - - public boolean getRendererValidation() - { - return rendererValidation; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntRestoringCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntRestoringCommand.java deleted file mode 100644 index 5c7390239..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntRestoringCommand.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20061011 159283 makandre@ca.ibm.com - Andrew Mak, project not associated to EAR when using ant on command-line - *******************************************************************************/ -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; -import org.eclipse.wst.common.internal.emf.resource.RendererFactory; - -public class AntRestoringCommand extends AbstractDataModelOperation{ - - private boolean rendererValidation; - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - RendererFactory.getDefaultRendererFactory().setValidating(rendererValidation); - - return Status.OK_STATUS; - } - - public void setRendererValidation(boolean rendererValidation) - { - this.rendererValidation = rendererValidation; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntWorkspaceSaveCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntWorkspaceSaveCommand.java deleted file mode 100644 index be0009908..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntWorkspaceSaveCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070501 178129 makandre@ca.ibm.com - Andrew Mak, workspace reports "crash detected" after running WS ant task (cmdline) - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import org.eclipse.core.commands.ExecutionException; -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.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -public class AntWorkspaceSaveCommand extends AbstractDataModelOperation { - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - try { - // attempt to save the state of the workspace - ResourcesPlugin.getWorkspace().save(true, monitor); - return Status.OK_STATUS; - } - catch (CoreException e) { - throw new ExecutionException(e.getMessage(), e); - } - } -} 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 b356743ed..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, 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 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 98782617a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060517 142027 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -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.Enumeration; -import java.util.Hashtable; -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.jst.ws.internal.consumption.ui.common.HandlerDescriptionHolder; -import org.eclipse.jst.ws.internal.consumption.ui.common.HandlerServiceRefHolder; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -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 boolean genSkeleton_; - private String handlerNameForEdit_ = null; - - private HandlerServiceRefHolder[] handlerServiceRefHolder_; - private HandlerDescriptionHolder[]handlerDescriptionHolder_; - - public GenerateHandlerSkeletonCommand() - { - } - - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - - IStatus returnStatus = Status.OK_STATUS; - - if (!genSkeleton_) return returnStatus; - - // form the map of classname to locations - if (handlerDescriptionHolder_!=null){ - for (int i=0;i<handlerDescriptionHolder_.length;i++){ - Hashtable handlerTable = new Hashtable(); - IPath outPath = handlerDescriptionHolder_[i].getSourceOutputPath(); - List handlers = handlerDescriptionHolder_[i].getHandlerList(); - for (int j=0;j<handlers.size();j++){ - HandlerTableItem hti = (HandlerTableItem)handlers.get(j); - String className = hti.getHandlerClassName(); - if (className!=null && outPath!=null) - handlerTable.put(className, outPath); - } - returnStatus = genHandlersClasses(handlerTable, monitor); - } - - } - else { - for (int i=0;i<handlerServiceRefHolder_.length;i++){ - Hashtable handlerTable = new Hashtable(); - IPath outPath = handlerServiceRefHolder_[i].getSourceOutputPath(); - List handlers = handlerServiceRefHolder_[i].getHandlerList(); - for (int j=0;j<handlers.size();j++){ - HandlerTableItem hti = (HandlerTableItem)handlers.get(j); - String className = hti.getHandlerClassName(); - if (className!=null && outPath!=null) - handlerTable.put(className, outPath); - } - returnStatus = genHandlersClasses(handlerTable, monitor); - } - } - - - return returnStatus; - - } - - private IStatus genHandlersClasses(Hashtable handlersForGen, IProgressMonitor monitor){ - IEnvironment env = getEnvironment(); - MultiStatus status = null; - IStatus returnStatus = Status.OK_STATUS; - boolean error = false; - - IStatus writeStatus; - Enumeration keys = handlersForGen.keys(); - while (keys.hasMoreElements()) { - String className = (String)keys.nextElement(); - writeStatus = writeFile(env, className, (IPath)handlersForGen.get(className), 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; - outputLocation_ = outputLocation; - } - - 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 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; - } - - /** - * An array of HandlerDescriptionHolders - * @return - */ - public void setHandlerServiceRefHolder(HandlerServiceRefHolder[] handlerHolders){ - this.handlerServiceRefHolder_ = handlerHolders; - } - - /** - * An array of HandlerDescriptionHolders - * @return - */ - public void setHandlerDescriptionHolders(HandlerDescriptionHolder[] handlerHolders){ - this.handlerDescriptionHolder_ = handlerHolders; - } - - -} 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 53bedd530..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004,2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -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; - private boolean isEnabled_ = true; // is true by default - - public OpenJavaEditorCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - if (isEnabled_) { - 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; - } - - public void setIsEnabled(boolean isEnabled){ - this.isEnabled_ = isEnabled; - } - - 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 Status.OK_STATUS; - } - else if (project!=null || classNames.isEmpty()){ - // do nothing ; nothing to open - return Status.OK_STATUS; - } - 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/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 3fa302eb7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/StartServerCommand.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070426 162287 makandre@ca.ibm.com - Andrew Mak, Server publish cancel button unavailable - *******************************************************************************/ - -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.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -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_ ) - { - ProgressMonitorDialog dialog = new ProgressMonitorDialog(null); - dialog.run(true, true, 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]; - if (status.getSeverity() == IStatus.CANCEL) - status = StatusUtils.errorStatus(""); - 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 507cdad38..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060420 120714 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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 - { - // Set message to empty string so that an error dialog does - // not pop-up telling the user that they cannot continue - // because they choose not to ignore the WS-I non-compliance warning. - return StatusUtils.errorStatus( "" ); - } - } - else - { - // Set message to empty string so that an error dialog does - // not pop-up telling the user that they cannot continue - // because they choose not to ignore the WS-I non-compliance warning. - return StatusUtils.errorStatus( "" ); - } - } - - 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 ca35e38e2..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, 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.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 ac65f4176..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ProjectName2IProjectTransformer.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060221 124302 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ -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) - { - if (value != null) - { - 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); - } else - { - return null; - } - } -} 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 6f881ca49..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, 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 - *******************************************************************************/ -/* - * 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 815d797b4..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, 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.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/DefaultingUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/DefaultingUtils.java deleted file mode 100644 index bba32af1e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/DefaultingUtils.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060427 138058 joan@ca.ibm.com - Joan Haggarty - * 20070723 194434 kathy@ca.ibm.com - Kathy Chan, Check for non-existing EAR with content not deleted - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.common; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -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.wst.common.componentcore.resources.IVirtualComponent; - -public class DefaultingUtils { - - public DefaultingUtils() - { - - } - - /** - * - * Uses the following steps to determine a valid default EAR project name: - * - * 1. If project does exist: - * a - look for an existing, referencing EAR component, if one exists return that EAR name - * b - look for an existing EAR component with the same J2EE version as the project - * 2. If can't find an appropriate existing EAR component or project does not exist in the - * workspace, return a new EAR name of form projectNameEAR - * 3. If project name is null or an empty string return the default EAR name - * - * @param projectName a string representing the name of the project for the service - * @return a string to be used as the default EAR project name for the project name provided - */ - public static String getDefaultEARProjectName(String projectName) - { - - if (projectName != null && projectName.length() > 0) { - - IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - - if (proj.exists()) { - - //Step 1a - return a referencing EAR project - IVirtualComponent[] ears = J2EEUtils.getReferencingEARComponents(proj); - if (ears != null && ears.length > 0) { - return ears[0].getName(); - } - - //Step 1b - return an appropriate existing EAR project - IVirtualComponent[] allEarComps = J2EEUtils.getAllEARComponents(); - - if (allEarComps.length > 0) - { - for (int i=0; i < allEarComps.length; i++) - { - IProject earProject = allEarComps[i].getProject(); - IStatus associationStatus = J2EEUtils.canAssociateProjectToEAR(proj, earProject); - if (associationStatus.getSeverity()==IStatus.OK) - { - return allEarComps[i].getName(); - } - } - } - } - - - String baseEARName = projectName + ResourceUtils.getDefaultEARExtension(); - String earName = baseEARName; - - boolean foundEAR = false; - int i = 1; - - while (!foundEAR) { - // 194434 - Check for non-existing EAR with contents that's not deleted previously - IStatus canCreateEARStatus = J2EEUtils.canCreateEAR(ProjectUtilities.getProject(earName)); - if (canCreateEARStatus.isOK()) { - foundEAR = true; - } else { - earName = baseEARName + i; - i++; - } - } - - - //Step 2 - return project name with EAR on the end - return earName; - } - - //Step 3 - return the default EAR project name - return ResourceUtils.getDefaultServiceEARProjectName(); - } -} 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 cd8e70962..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, 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 - *******************************************************************************/ -/* - * 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/HandlerDescriptionHelper.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerDescriptionHelper.java deleted file mode 100644 index de63bbbec..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerDescriptionHelper.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * -------- -------- ----------------------------------------------------------- - */ -package org.eclipse.jst.ws.internal.consumption.ui.common; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; - - - -public class HandlerDescriptionHelper { - - /** - * Helper method for getting the HandlerDescriptorHolder given the name - * @param hdhs - * @param descName - * @return - */ - public static HandlerDescriptionHolder getForDescriptionName(HandlerDescriptionHolder[] hdhs, String descName){ - for (int i=0;i<hdhs.length;i++){ - String name = hdhs[i].getDescriptionName(); - if (name!=null && name.equals(descName)){ - return hdhs[i]; - } - } - return null; - } - - /** - * Helper method for getting all description names - * @param hdhs - * @return - */ - public static String[] getAllDescriptionNames(HandlerDescriptionHolder[] hdhs){ - String[] names = new String[hdhs.length]; - for(int i=0;i<hdhs.length;i++){ - names[i]=hdhs[i].getDescriptionName(); - } - return names; - } - - public static String[] getAllHandlerClassNames(HandlerDescriptionHolder[] hdhs){ - Vector v = new Vector(); - for (int i=0;i<hdhs.length;i++){ - List list = hdhs[i].getHandlerList(); - if (list!=null && !list.isEmpty()){ - for (int j=0;j<list.size();j++){ - HandlerTableItem hti = (HandlerTableItem)list.get(j); - v.add(hti.getHandlerClassName()); - } - } - } - return (String[])v.toArray(new String[0]); - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerDescriptionHolder.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerDescriptionHolder.java deleted file mode 100644 index 00cbadde2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerDescriptionHolder.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060518 142554 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.common; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -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.internal.impl.WsddFactoryImpl; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; - - -public class HandlerDescriptionHolder { - - private String descriptionName; - private List handlerList; - private WebServiceDescription descriptionObject; - private IPath sourceOutputPath; - - - public IPath getSourceOutputPath() { - return sourceOutputPath; - } - - public void setSourceOutputPath(IPath sourceOutputPath) { - this.sourceOutputPath = sourceOutputPath; - } - - public IProject getProject(){ - if (descriptionObject!=null) - return ProjectUtilities.getProject(descriptionObject); - else - return null; - } - - /* - * get the WebServiceDescription object - */ - public WebServiceDescription getDescriptionObject() { - return descriptionObject; - } - - /** - * set WebServiceDescription object - * @param descriptionObject - */ - public void setDescriptionObject(WebServiceDescription descriptionObject) { - this.descriptionObject = descriptionObject; - } - - /** - * get Description name - * @return - */ - public String getDescriptionName() { - return descriptionName; - } - - /** - * set Description name - * @param descriptionName - */ - public void setDescriptionName(String descriptionName) { - this.descriptionName = descriptionName; - } - - /** - * get List of HandlerTableItem associated with this service description - * @return - */ - public List getHandlerList() { - return handlerList; - } - - /** - * set List of HandlerTableItem associated with this service description - * @param handlerList - */ - public void setHandlerList(List handlerList) { - this.handlerList = handlerList; - } - - public void addHandlerToAllPorts(){ - - if (handlerList!=null && !handlerList.isEmpty()){ - - for (int z=0;z<handlerList.size();z++){ - HandlerTableItem hti = (HandlerTableItem)handlerList.get(z); - if (descriptionObject!=null) { - List portComponents = descriptionObject.getPortComponents(); - for (int x=0;x<portComponents.size();x++){ - PortComponent wsPort = (PortComponent) portComponents.get(x); - List wsHandlers = wsPort.getHandlers(); - if (wsHandlers!=null){ - boolean alreadyExists = false; - for (int y=0;y<wsHandlers.size();y++){ - Handler handler = (Handler)wsHandlers.get(y); - if (handler.getHandlerClass().equals(hti.getHandlerClassName())){ - alreadyExists = true; - } - } - - if (!alreadyExists) { - //create it and add to the list - WsddFactory wsddFactory = new WsddFactoryImpl(); - Handler newHandler = wsddFactory.createHandler(); - newHandler.setHandlerName(hti.getHandlerName()); - newHandler.setHandlerClass(hti.getHandlerClassName()); - wsHandlers.add(newHandler); - } - } - } - } - } - } - - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerServiceRefHelper.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerServiceRefHelper.java deleted file mode 100644 index 3daff3bfd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerServiceRefHelper.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * -------- -------- ----------------------------------------------------------- - */ -package org.eclipse.jst.ws.internal.consumption.ui.common; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; - - -public class HandlerServiceRefHelper { - - /** - * Helper method for getting the HandlerServiceRefHolder given the name - * @param hsrh - * @param descName - * @return - */ - public static HandlerServiceRefHolder getForServiceRefName(HandlerServiceRefHolder[] hsrh, String descName){ - for (int i=0;i<hsrh.length;i++){ - String name = hsrh[i].getServiceRefName(); - if (name!=null && name.equals(descName)){ - return hsrh[i]; - } - } - return null; - } - - /** - * Gets all the handler Class names associated with each service ref - * @param hsrh - * @return - */ - public static String[] getAllHandlerClassNames(HandlerServiceRefHolder[] hsrh){ - Vector v = new Vector(); - for (int i=0;i<hsrh.length;i++){ - List list = hsrh[i].getHandlerList(); - if (list!=null && !list.isEmpty()){ - for (int j=0;j<list.size();j++){ - HandlerTableItem hti = (HandlerTableItem)list.get(j); - v.add(hti.getHandlerClassName()); - } - } - } - return (String[])v.toArray(new String[0]); - } - - /** - * Get all the service Ref names - * @param hsrh - * @return - */ - public static String[] getAllServiceRefNames(HandlerServiceRefHolder[] hsrh){ - String[] names = new String[hsrh.length]; - for(int i=0;i<hsrh.length;i++){ - names[i]=hsrh[i].getServiceRefName(); - } - return names; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerServiceRefHolder.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerServiceRefHolder.java deleted file mode 100644 index b1b004bdf..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/HandlerServiceRefHolder.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913sengpl@ca.ibm.com - Seng Phung-Lu - * 20060517 142339 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.common; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -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.JavaMOFUtils; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; - - -public class HandlerServiceRefHolder { - - private String serviceRefName; - private List handlerList; - private ServiceRef serviceRef; - private IPath sourceOutputPath; - - public IPath getSourceOutputPath() { - return sourceOutputPath; - } - - public void setSourceOutputPath(IPath sourceOutputPath) { - this.sourceOutputPath = sourceOutputPath; - } - - public IProject getProject() { - if (serviceRef!=null) - return ProjectUtilities.getProject(serviceRef); - else - return null; - } - - public List getHandlerList() { - return handlerList; - } - - public void setHandlerList(List handlerList) { - this.handlerList = handlerList; - } - - public ServiceRef getServiceRef() { - return serviceRef; - } - - public void setServiceRef(ServiceRef serviceRef) { - this.serviceRef = serviceRef; - } - - public String getServiceRefName() { - return serviceRefName; - } - - public void setServiceRefName(String serviceRefName) { - this.serviceRefName = serviceRefName; - } - - public void addHandlerToServiceRef(){ - if (handlerList!=null && !handlerList.isEmpty()){ - - for (int x=0;x<handlerList.size();x++){ - HandlerTableItem hti = (HandlerTableItem)handlerList.get(x); - if (serviceRef!=null){ - List existingHandlers = serviceRef.getHandlers(); - boolean alreadyExists = false; - for (int i=0;i<existingHandlers.size();i++){ - Handler handler = (Handler)existingHandlers.get(i); - if (handler.getHandlerClass().getJavaName().equals(hti.getHandlerClassName())){ - alreadyExists = true; - } - } - - if (!alreadyExists) { - - Webservice_clientFactory wsClientFactory = new Webservice_clientFactoryImpl(); - Handler newHandler = wsClientFactory.createHandler(); - newHandler.setHandlerName(hti.getHandlerName()); - try { - IProject project = ProjectUtilities.getProject(serviceRef); - if (project!=null) { - JavaClass javaClass = JavaMOFUtils.getJavaClass(hti.getHandlerClassName(), project); - if (javaClass != null) { - newHandler.setHandlerClass(javaClass); - } - existingHandlers.add(newHandler); - } - } - catch(Exception e){ - e.printStackTrace(); - } - } - - } - - } - } - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ScenarioCleanupCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ScenarioCleanupCommand.java deleted file mode 100644 index a9b44f6b5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ScenarioCleanupCommand.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060825 155114 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.common; - -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.common.WSDLParserFactory; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.ObjectSelectionRegistry; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -/** - * This command is intended to clean up data after either the - * client or service wizards. Currently is just resets the - * parser factory. - * - */ -public class ScenarioCleanupCommand extends AbstractDataModelOperation -{ - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - WSDLParserFactory.killParser(); - ObjectSelectionRegistry.getInstance().cleanup(); - - return Status.OK_STATUS; - } - - - public IStatus undo( IProgressMonitor monitor, IAdaptable adaptable ) - { - // Even if the user cancels out of the wizard we want to - // kill the parser. - WSDLParserFactory.killParser(); - ObjectSelectionRegistry.getInstance().cleanup(); - - return Status.OK_STATUS; - } -} 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 2adfab0b8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060324 116750 rsinha@ca.ibm.com - Rupam Kuehner - * 20070119 159458 mahutch@ca.ibm.com - Mark Hutchinson - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.common; - -import java.util.ArrayList; - -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.ws.internal.consumption.common.IServerDefaulter; -import org.eclipse.jst.ws.internal.consumption.common.ServerInfo; -import org.eclipse.wst.server.core.IRuntime; -import org.eclipse.wst.server.core.IRuntimeType; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - - -public class ServerSelectionUtils -{ - - 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(); - IRuntimeType runtimeType = runtime.getRuntimeType(); - if (runtimeType != null) - { - String runtimeId = runtimeType.getId(); - for (int i=0; i<servers.length; i++) - { - IServer server = (IServer)servers[i]; - IRuntimeType runtimeType2 = server.getRuntime().getRuntimeType(); - if (runtimeType2 != null) - { - String serverRuntimeId = runtimeType2.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; - } - - 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; - } -} 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 b329618e0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java +++ /dev/null @@ -1,1076 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060222 115834 rsinha@ca.ibm.com - Rupam Kuehner - * 20060413 135581 rsinha@ca.ibm.com - Rupam Kuehner - * 20060420 136158 rsinha@ca.ibm.com - Rupam Kuehner - * 20060420 136705 rsinha@ca.ibm.com - Rupam Kuehner - * 20060421 136761 rsinha@ca.ibm.com - Rupam Kuehner - * 20060425 137831 rsinha@ca.ibm.com - Rupam Kuehner - * 20060427 126780 rsinha@ca.ibm.com - Rupam Kuehner - * 20060427 138058 joan@ca.ibm.com - Joan Haggarty - * 20060905 156230 kathy@ca.ibm.com - Kathy Chan, Handling projects with no target runtime - * 20070119 159458 mahutch@ca.ibm.com - Mark Hutchinson - * 20070723 194434 kathy@ca.ibm.com - Kathy Chan, Check for non-existing EAR with content not deleted - * 20071107 203826 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -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.IFile; -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.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.jst.j2ee.internal.project.J2EEProjectUtilities; -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.j2ee.webservice.wsdd.WebServices; -import org.eclipse.jst.j2ee.webservice.wsdd.WsddResource; -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.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor; -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.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.ComponentCore; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -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.IRuntimeType; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntimeChecker; -import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario; - -/** - * - */ -public class ValidationUtils -{ - //Constants to help decide how much validation to do. - public static final int VALIDATE_NONE = 0; - public static final int VALIDATE_ALL = 1; - public static final int VALIDATE_SERVER_RUNTIME_CHANGES = 2; - public static final int VALIDATE_PROJECT_CHANGES = 3; - public static final int VALIDATE_SCALE_CHANGES = 4; - - /** - * - */ - public ValidationUtils() - { - } - - /** - * Returns a new validation state based on the current validation state - * and the requested validation state. If the requested validation state - * does not cover all the validation covered by the current validation - * state, VALIDATE_ALL is returned. Otherwise, the requested validation - * state is returned. - * - * @param currentValidationState the validaton state at the time the caller's requests a change - * @param requestedValidationState the validation state being requested by the caller. - * @return Returns VALIDATE_ALL if the requested validation state - * does not cover all the validation covered by the current validation - * state. Returned requestedValidationState otherwise. - */ - public int getNewValidationState(int currentValidationState, int requestedValidationState) { - int newValidationState; - if (currentValidationState == VALIDATE_NONE - || currentValidationState == requestedValidationState) { - newValidationState = requestedValidationState; - } else { - newValidationState = VALIDATE_ALL; - } - - return newValidationState; - - } - - /** - * Returns IStatus resulting from checking for empty fields. Used for validation of page 1 of the - * Web service/client wizards. - * @param validationState one of VALIDATE_NONE, VALIDATE_ALL, VALIDATE_SERVER_RUNTIME_CHANGES, VALIDATE_PROJECT_CHANGES, VALIDATE_SCALE_CHANGES - * @param typeId Web service type id (isClient=false) or Web service client implementation type id (isClient=true) - * @param serviceImpl String representation of the object selection from page 1 - * @param runtimeId Web service runtime id - * @param serverId server type id - * @param projectName name of project - * @param needEar boolean <code>true</code> if EAR is required, <code>false</code> if not. - * @param earProjectName name of EAR project - * @param projectTypeId template id - * @param isClient boolean <code>true</code> if the method is being called for client side validation, - * <code>false</code> for service side validation. - * @return IStatus with severity IStatus.OK if all mandatory fields are non-null and non-empty. - * IStatus with severity IStatus.ERROR otherwise. - */ - public IStatus checkMissingFieldStatus(int validationState, String typeId, String serviceImpl, String runtimeId, String serverId, - String projectName, boolean needEar, String earProjectName, String projectTypeId, - boolean isClient) - { - // Object selection - if (validationState==VALIDATE_ALL && !isClient) - { - if (serviceImpl.length() == 0) { - int scenario = WebServiceRuntimeExtensionUtils2.getScenarioFromTypeId(typeId); - if (scenario == WebServiceScenario.BOTTOMUP) - { - return StatusUtils - .errorStatus(ConsumptionUIMessages.MSG_NO_OBJECT_SELECTION); - } - else - { - return StatusUtils - .errorStatus(ConsumptionUIMessages.MSG_NO_SERVICE_SELECTION); - } - } - } - - // Web service runtime - if (validationState == VALIDATE_ALL || validationState == VALIDATE_SERVER_RUNTIME_CHANGES) { - if (runtimeId == null || runtimeId.length() == 0) { - if (isClient) { - return StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_RUNTIME, - new String[] { ConsumptionUIMessages.MSG_CLIENT_SUB })); - } else { - return StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_RUNTIME, - new String[] { ConsumptionUIMessages.MSG_SERVICE_SUB })); - } - } - } - - if (validationState == VALIDATE_ALL || validationState == VALIDATE_PROJECT_CHANGES) { - // Project - if (projectName == null || projectName.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[] { "" })); - } - } - - // Project type (if project does not exist) - IProject project = ProjectUtilities.getProject(projectName); - if (!project.exists()) { - if (projectTypeId == null || projectTypeId.length() == 0) { - - if (isClient) { - return StatusUtils - .errorStatus(ConsumptionUIMessages.MSG_CLIENT_PROJECT_TYPE_EMPTY); - } else { - return StatusUtils - .errorStatus(ConsumptionUIMessages.MSG_SERVICE_PROJECT_TYPE_EMPTY); - } - } - } - - // Ear (if need ear) - if (needEar) { - if (earProjectName == null || earProjectName.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[] { "" })); - } - } - } - } - - // Server (if Web service runtime requires a server or project does not - // exist) - if (validationState == VALIDATE_ALL || validationState == VALIDATE_SERVER_RUNTIME_CHANGES - || validationState == VALIDATE_PROJECT_CHANGES) { - if (serverId == null || serverId.length() == 0) { - RuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getRuntimeById(runtimeId); - if (desc.getServerRequired()) { - if (isClient) { - StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER, - new String[] { ConsumptionUIMessages.MSG_CLIENT_SUB })); - } else { - StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER, - new String[] { ConsumptionUIMessages.MSG_SERVICE_SUB })); - } - } else { - IProject project = ProjectUtilities.getProject(projectName); - if (!project.exists()) { - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_PROJECT_MUST_EXIST, - new String[] { projectName })); - - } - } - } - } - - return Status.OK_STATUS; - } - - /** - * Returns IStatus resulting from checking for errors. Used for validation of page 1 of the - * Web service/client wizards. - * @param validationState one of VALIDATE_NONE, VALIDATE_ALL, VALIDATE_SERVER_RUNTIME_CHANGES, VALIDATE_PROJECT_CHANGES, VALIDATE_SCALE_CHANGES - * @param typeId Web service type id (isClient=false) or Web service client implementation type id (isClient=true) - * @param runtimeId Web service runtime id - * @param serverId server type id - * @param projectName name of project - * @param needEar boolean <code>true</code> if EAR is required, <code>false</code> if not. - * @param earProjectName name of EAR project - * @param projectTypeId template id - * @param isClient boolean <code>true</code> if the method is being called for client side validation, - * <code>false</code> for service side validation. - * @return IStatus with severity IStatus.OK if no errors are present, - * IStatus with severity IStatus.ERROR otherwise. - */ - public IStatus checkErrorStatus(int validationState, String typeId, String runtimeId, String serverId, - String projectName, boolean needEar, String earProjectName, String projectTypeId, - boolean isClient) { - - // Ensure server, Web service runtime, and Web service type are - // compatible - - // Labels - String serverLabel = ""; - if (serverId != null && serverId.length()>0) - { - serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId); - } - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); - - if (validationState == VALIDATE_ALL || validationState == VALIDATE_SERVER_RUNTIME_CHANGES) { - if (serverId != null && serverId.length() > 0) { - if (isClient) { - if (!WebServiceRuntimeExtensionUtils2 - .isServerClientRuntimeTypeSupported(serverId, - runtimeId, typeId)) { - return StatusUtils - .errorStatus(NLS - .bind( - ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, - new String[] { serverLabel, - runtimeLabel })); - } - } else { - if (!WebServiceRuntimeExtensionUtils2 - .isServerRuntimeTypeSupported(serverId, runtimeId, - typeId)) { - return StatusUtils - .errorStatus(NLS - .bind( - ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, - new String[] { serverLabel, - runtimeLabel })); - } - } - } - } - - // If the project exists, ensure it supports the Web service type, Web - // service runtime, and server. If the Ear also exists and the project - // and Ear are not already associated, ensure they can be. - // If the project does not exist, ensure the project type supports the - // Web service type, Web service runtime, and server - if (validationState == VALIDATE_ALL || validationState == VALIDATE_SERVER_RUNTIME_CHANGES - || validationState == VALIDATE_PROJECT_CHANGES) { - ValidationUtils valUtils = new ValidationUtils(); - IProject project = ProjectUtilities.getProject(projectName); - if (project.exists()) { - - if (isClient) { - // Check if the runtime supports it. - if (!WebServiceRuntimeExtensionUtils2.doesClientTypeAndRuntimeSupportProject( - typeId, runtimeId, projectName)) { - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_PROJECT, - new String[] { runtimeLabel, projectName })); - } - - // Check if the server supports it. - if (serverId != null && serverId.length() > 0) { - if (!valUtils.doesServerSupportProject(serverId, projectName)) { - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_PROJECT, - new String[] { serverLabel, projectName })); - } - } - } else { - // Check if the runtime supports it. - if (!WebServiceRuntimeExtensionUtils2.doesServiceTypeAndRuntimeSupportProject( - typeId, runtimeId, projectName)) { - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_SERVICE_RUNTIME_DOES_NOT_SUPPORT_PROJECT, - new String[] { runtimeLabel, projectName })); - } - - // Check if the server supports it. - if (serverId != null && serverId.length() > 0) - { - if (!valUtils.doesServerSupportProject(serverId, projectName)) { - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_SERVICE_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 = projectTypeId; - String templateLabel = FacetUtils.getTemplateLabelById(templateId); - - if (isClient) { - // Check if the runtime supports it. - if (!WebServiceRuntimeExtensionUtils2.doesClientTypeAndRuntimeSupportTemplate( - typeId, runtimeId, templateId)) { - - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_CLIENT_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE, - new String[] { runtimeLabel, templateLabel })); - } - - // Check if the server supports it. - if (serverId != null && serverId.length()>0) - { - if (!valUtils.doesServerSupportTemplate(serverId, templateId)) { - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_CLIENT_SERVER_DOES_NOT_SUPPORT_TEMPLATE, - new String[] { serverLabel, templateLabel })); - } - } - - } else { - // Check if the runtime supports it. - if (!WebServiceRuntimeExtensionUtils2.doesServiceTypeAndRuntimeSupportTemplate( - typeId, runtimeId, templateId)) { - return StatusUtils - .errorStatus(NLS - .bind( - ConsumptionUIMessages.MSG_SERVICE_RUNTIME_DOES_NOT_SUPPORT_TEMPLATE, - new String[] { runtimeLabel, templateLabel })); - } - - // Check if the server supports it. - if (serverId != null && serverId.length()>0) - { - if (!valUtils.doesServerSupportTemplate(serverId, templateId)) { - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_SERVICE_SERVER_DOES_NOT_SUPPORT_TEMPLATE, - new String[] { serverLabel, templateLabel })); - } - } - } - - } - - } - - if (validationState == VALIDATE_ALL || validationState == VALIDATE_PROJECT_CHANGES) { - // Check if project/EAR association is good. - if (needEar) { - IProject project = ProjectUtilities.getProject(projectName); - IProject ep = ProjectUtilities.getProject(earProjectName); - - // 194434 - Check for non-existing EAR with contents that's not deleted previously - IStatus canCreateEARStatus = J2EEUtils.canCreateEAR(ep); - if (!canCreateEARStatus.isOK()) { - return canCreateEARStatus; - } - - if (project.exists() && ep.exists()) { - if (!J2EEUtils.isComponentAssociated(ep, project)) { - IStatus associateStatus = J2EEUtils.canAssociateProjectToEAR(project, ep); - if (associateStatus.getSeverity() == IStatus.ERROR) { - if (isClient) { - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_CLIENT_CANNOT_ASSOCIATE, - new String[] { projectName, ep.getName(), - associateStatus.getMessage() })); - } else { - return StatusUtils.errorStatus(NLS.bind( - ConsumptionUIMessages.MSG_SERVICE_CANNOT_ASSOCIATE, - new String[] { projectName, ep.getName(), - associateStatus.getMessage() })); - } - - } - } - } - } - } - - // Defect 203826 - Give extender a way to veto server, project, project type and EAR choices - if (validationState == VALIDATE_ALL || validationState == VALIDATE_SERVER_RUNTIME_CHANGES - || validationState == VALIDATE_PROJECT_CHANGES) { - TypeRuntimeServer trs = new TypeRuntimeServer(); - trs.setTypeId(typeId); - trs.setRuntimeId(runtimeId); - trs.setServerId(serverId); - IWebServiceRuntimeChecker runtimeChecker = null; - if (isClient) { - String clientRuntimeId = WebServiceRuntimeExtensionUtils2.getClientRuntimeId(trs, projectName, projectTypeId); - runtimeChecker = WebServiceRuntimeExtensionUtils2.getClientRuntimeChecker(clientRuntimeId); - - } else { - String serviceRuntimeId = WebServiceRuntimeExtensionUtils2.getServiceRuntimeId(trs, projectName, projectTypeId); - runtimeChecker = WebServiceRuntimeExtensionUtils2.getServiceRuntimeChecker(serviceRuntimeId); - } - if (runtimeChecker != null) { - return runtimeChecker.checkRuntimeCompatibility(serverId, projectName, projectTypeId, earProjectName); - } - } - - - return Status.OK_STATUS; - - } - - /** - * Returns IStatus resulting from checking for warnings. Used for validation of page 1 of the - * Web service/client wizards. - * @param validationState one of VALIDATE_NONE, VALIDATE_ALL, VALIDATE_SERVER_RUNTIME_CHANGES, VALIDATE_PROJECT_CHANGES, VALIDATE_SCALE_CHANGES - * @param scaleSetting one of <BR/> - * ScenarioContext.WS_TEST<BR/> - * ScenarioContext.WS_START<BR/> - * ScenarioContext.WS_INSTALL<BR/> - * ScenarioContext.WS_DEPLOY<BR/> - * ScenarioContext.WS_ASSEMBLE<BR/> - * ScenarioContext.WS_DEVELOP<BR/> - * ScenarioContext.WS_NONE - * @param serverId server type id - * @param isClient boolean <code>true</code> if the method is being called for client side validation, - * <code>false</code> for service side validation. - * @return IStatus with severity IStatus.OK if no errors are present, - * IStatus with severity IStatus.WARNING otherwise. - */ - public IStatus checkWarningStatus(int validationState, int scaleSetting, String serverId, - boolean isClient) { - // Return a warning if there is no server selection and scale setting is - // anything beyond assemble. - if (validationState == VALIDATE_ALL || validationState == VALIDATE_SCALE_CHANGES - || validationState == VALIDATE_SERVER_RUNTIME_CHANGES) { - if (serverId == null || serverId.length() == 0) { - if (scaleSetting < ScenarioContext.WS_ASSEMBLE) { - if (isClient) { - return StatusUtils.warningStatus(NLS.bind( - ConsumptionUIMessages.MSG_WARN_NO_CLIENT_SERVER, new String[0])); - } else { - return StatusUtils.warningStatus(NLS.bind( - ConsumptionUIMessages.MSG_WARN_NO_SERVICE_SERVER, new String[0])); - } - } - } else { - // Return a warning if the selected server has only stub - // runtimes - // and the scale setting is anything beyond deploy. - IServerType serverType = ServerCore.findServerType(serverId); - if (serverType != null) { - // Find a Runtime which is not a stub - IRuntime nonStubRuntime = ServerUtils.getNonStubRuntime(serverId); - if ((scaleSetting < ScenarioContext.WS_DEPLOY) && nonStubRuntime == null) { - String servertypeLabel = WebServiceRuntimeExtensionUtils2 - .getServerLabelById(serverId); - return StatusUtils.warningStatus(NLS.bind( - ConsumptionUIMessages.MSG_WARN_STUB_ONLY, - new String[] { servertypeLabel })); - } - } - - } - } - - return Status.OK_STATUS; - - } - - /** - * Returns whether or not the provided server type supports the facet versions on the provided project - * @param serverFactoryId server type id - * @param projectName name of a project that may or may not exist. - * @return boolean <code>true</code> - * <ul> - * <li>if the server type supports the facet versions on the project or</li> - * <li>if the project is not a faceted project or</li> - * <li>if the project does not exist.</li> - * </ul> - * Returns <code>false</code> otherwise. - */ - 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; - } - - } - - /** - * Returns whether or not the provided server type supports the facet versions in the provided set. - * @param serverFactoryId server type id - * @param facets set containing elements of type {@link IProjectFacetVersion} - * @return boolean <code>true</code> if the server type supports the facet versions in the provided set, - * <code>false</code> otherwise. - */ - 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 (sRuntime != null) - { - IRuntimeType runtimeType = sRuntime.getRuntimeType(); - if (runtimeType != null && runtimeTypeId.equals(runtimeType.getId())) - { - //found a match - return true; - } - } - } - - return false; - } - - /** - * Returns whether or not the provided server type supports at least one version of - * each of the fixed facets on the provided template - * @param serverFactoryId server type id - * @param templateId id of a {@link IFacetedProjectTemplate} - * @return boolean <code>true</code> if the server type supports at least one version of - * each of the fixed facets on the provided template, <code>false</code> otherwise. - */ - 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; - } - - /** - * Returns whether or not the provided project or project type (if the project is null or does not exist) - * rules out the need for an EAR. - * @param projectName name of a project - * @param projectTypeId id of a {@link IFacetedProjectTemplate}. Must be non-empty if the project is null or - * does not exist. - * @return boolean <code>true</code> if the need for an EAR is not ruled out, <code>false</code> otherwise. - */ - public boolean projectOrProjectTypeNeedsEar(String projectName, String projectTypeId) - { - // If the project is a simple Java project or the project type is - // Java utility return false. - if (projectName != null && projectName.length() > 0) { - IProject project = ResourceUtils.getWorkspaceRoot().getProject(projectName); - if (project.exists()) { - if (FacetUtils.isJavaProject(project)) { - return false; - } - } - } - - // Project didn't rule out the need for an EAR - // so check the proect type - String templateId = projectTypeId; - if (templateId != null && templateId.length() > 0) { - if (FacetUtils.isUtilityTemplate(templateId)) { - return false; - } - } - - return true; - } - - /** - * Returns whether or not an J2EE 1.3 EAR project can be installed on a server of - * the provided server type. - * @param serverTypeId server type id - * @return boolean <code>true</code> if a J2EE 1.3 EAR project can be installed on a server of - * the provided server type, <code>false</code> otherwise. - */ - public boolean serverNeedsEAR(String serverTypeId) - { - if (serverTypeId == null) { - return false; - } - if (serverTypeId.length() > 0) { - String targetId = ServerUtils.getRuntimeTargetIdFromFactoryId(serverTypeId); - if (targetId != null && targetId.length() > 0) { - if (!ServerUtils.isTargetValidForEAR(targetId, "13")) // rm j2ee - { - 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; - } - - //TODO: This method is obselete - should be removed. - 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; - } - - //TODO: This method is obselete - should be removed. - 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; - } - - //TODO: This method is obselete - should be removed. - 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; - - } - - //TODO: This method is obselete - should be removed. - 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; - } - } - - /** - * Returns whether or not this project is likely hosting any of the services - * in the provided WSDL as a J2EE Web service. - * @param p IProject in the workspace - * @param wsdlURL URL of a WSDL document - * @param parser - * @return boolean <code>true</code> if the project contains a webservices.xml - * deployment descriptor that points to at least one of the ports in the provided WSDL. - * Returns <code>false</code> otherwise. - */ - 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 - if (!(wsXML instanceof IFile)) - { - return false; - } - - Resource res = WorkbenchResourceHelperBase.getResource((IFile)wsXML, true); - WsddResource wsddRes = (WsddResource)res; - WebServices webServices = wsddRes.getWebServices(); - Iterator wsDescs = webServices.getWebServiceDescriptions().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; - } - - /** - * Returns the IResource corresponding to the webservices.xml in the provided project. - * @param p an IProject in the workspace. - * @return IResource corresponding to the webservices.xml in the provided project, - * null if there is no webservices.xml in the project. - */ - private IResource getWebServcesXML(IProject p) - { - //Get the module root. - IResource moduleRoot = getModuleRoot(p); - if (!(moduleRoot instanceof IContainer)) - return null; - - IResource webServicesXML = null; - if (J2EEProjectUtilities.isDynamicWebProject(p)) - { - StringBuffer wsPath = new StringBuffer(); - wsPath.append("WEB-INF/"); - wsPath.append(WebServiceConstants.WEBSERVICE_DD_SHORT_NAME); - webServicesXML = ((IContainer) moduleRoot).findMember(wsPath.toString()); - } - else - { - StringBuffer wsPath = new StringBuffer(); - wsPath.append("META-INF/"); - wsPath.append(WebServiceConstants.WEBSERVICE_DD_SHORT_NAME); - webServicesXML = ((IContainer) moduleRoot).findMember(wsPath.toString()); - } - return webServicesXML; - } - - private IResource getModuleRoot(IProject p) - { - IPath modulePath = null; - try - { - IVirtualComponent vc = ComponentCore.createComponent(p); - if (vc != null) - { - modulePath = vc.getRootFolder().getWorkspaceRelativePath(); - } - } - catch(Exception ex) - { - - } - - IResource res = ResourceUtils.findResource(modulePath); - return res; - } - - /** - * Returns a list of WSDL ports in the provided WSDL - * @param wsdlURL URL of a WSDL document - * @param parser - * @return ArrayList containing elements of type {@link QualifiedName} - */ - 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 3e4feacd4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/ClientRootFragment.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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, "Context", PreClientAssembleCommand.class ); - registry.addMapping( PreClientDevelopCommand.class, "Context", PreClientDeployCommand.class ); - - 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, "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 35951ceaf..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientAssembleCommand.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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.j2ee.internal.plugin.IJ2EEModuleConstants; -import org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand; -import org.eclipse.jst.ws.internal.consumption.command.common.CreateFacetedProjectCommand; -import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion; -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 PreClientAssembleCommand 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 ) - { - IStatus status = Status.OK_STATUS; - - if (context_ != null && context_.getAssemble()) { - IEnvironment environment = getEnvironment(); - - // Check if EAR module is req'd, ie. !=null - if (earProject_==null) - return Status.OK_STATUS; - - // Create the client EAR module - CreateFacetedProjectCommand command = new CreateFacetedProjectCommand(); - command.setProjectName(earProject_); - command.setTemplateId(IJ2EEModuleConstants.JST_EAR_TEMPLATE); - - // RequiredFacetVersions is set to an empty array because we don't need to impose any additional constraints. - // We just want to create the highest level of EAR project that the selected server supports. - command.setRequiredFacetVersions(new RequiredFacetVersion[0]); - - command.setServerFactoryId(webServiceClient_.getWebServiceClientInfo().getServerFactoryId()); - command.setServerInstanceId(webServiceClient_.getWebServiceClientInfo().getServerInstanceId()); - 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 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/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 cb571d8b0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDeployCommand.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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; -import org.eclipse.wst.ws.internal.wsrt.IContext; - -public class PreClientDeployCommand extends AbstractDataModelOperation -{ - private IContext context_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - if (context_ != null && context_.getDeploy()) - { - //If and when there are framework specific deploy things to be done, - //do them here. - } - - return Status.OK_STATUS; - } - - 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/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 06fb55a49..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientDevelopCommand.java +++ /dev/null @@ -1,285 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060516 126965 kathy@ca.ibm.com - Kathy Chan - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20070123 167487 makandre@ca.ibm.com - Andrew Mak - * 20070403 173654 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.extension; - -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.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.common.HTTPUtility; -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 develop_; - private boolean assemble_; - private boolean deploy_; - private boolean test_; - private boolean install_; - private boolean run_; - private String wsdlURI_; - private Object dataObject_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - if (develop_) { - 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()); - - // check for redirection in the wsdl - HTTPUtility httpUtil = new HTTPUtility(); - wsInfo.setWsdlURL(httpUtil.handleRedirect(wsdlURI_)); - - webServiceClient_ = wsrt.getWebServiceClient(wsInfo); - WebServiceScenario scenario = WebServiceScenario.CLIENT_LITERAL; - context_ = new SimpleContext(develop_, assemble_, deploy_, install_, run_, true, test_, - false, scenario, resourceContext_.isOverwriteFilesEnabled(), - resourceContext_.isCreateFoldersEnabled(), resourceContext_ - .isCheckoutFilesEnabled()); - - // Create the client module if needed. - IProject project = ProjectUtilities.getProject(project_); - RequiredFacetVersion[] rfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRequiredFacetVersions(); - if (!project.exists()) - { - boolean matches = WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportTemplate(clientRuntimeId_, moduleType_); - if (matches) - { - CreateFacetedProjectCommand command = new CreateFacetedProjectCommand(); - command.setProjectName(project_); - command.setTemplateId(moduleType_); - command.setRequiredFacetVersions(rfv); - command.setServerFactoryId(typeRuntimeServer_.getServerId()); - command.setServerInstanceId(typeRuntimeServer_.getServerInstanceId()); - status = command.execute( monitor, adaptable ); - if (status.getSeverity() == Status.ERROR) - { - environment.getStatusHandler().reportError( status ); - return status; - } - } - } else { - // add facets required by Web service runtime - if (rfv.length != 0) { - status = FacetUtils.addRequiredFacetsToProject(project, rfv, 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 setDevelopClient(boolean developClient) { - develop_ = developClient; - } - - public void setAssembleClient(boolean assembleClient) { - assemble_ = assembleClient; - } - - public void setDeployClient(boolean deployClient) - { - deploy_ = deployClient; - } - - 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 8be6fdfcf..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientInstallCommand.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20070815 199626 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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_ != null && 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()); - webServiceClient_.getWebServiceClientInfo().setServerCreated(true); - } - 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 59315bf22..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/extension/PreClientRunCommand.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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_ != null && 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 f59936725..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/plugin/WebServiceConsumptionUIPlugin.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060424 115690 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060504 136118 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.plugin; - -import java.net.URL; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Path; -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; - - -/** -* 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 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 imageURL = FileLocator.find(instance_.getBundle(), new Path("$nl$/"+name), null); - return ImageDescriptor.createFromURL(imageURL); - } - catch (Exception 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 5662e980e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/PersistentProjectTopologyContext.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060202 119780 pmoogk@ca.ibm.com - Peter Moogk - * 20060216 127138 pmoogk@ca.ibm.com - Peter Moogk - * 20060227 124392 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ - -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; -import com.ibm.icu.util.StringTokenizer; - - -public class PersistentProjectTopologyContext extends PersistentContext implements ProjectTopologyContext -{ - - public PersistentProjectTopologyContext () - { - super( WebServiceConsumptionUIPlugin.getInstance()); - } - - public void load() - { - //Load the service project types - String[] serviceIds = ProjectTopologyDefaults.getServiceTypes(); - StringBuffer serviceSb = new StringBuffer(); - for (int i = 0; i < serviceIds.length; i++) - { - if (i != 0) - serviceSb.append(" "); - serviceSb.append(serviceIds[i]); - } - setDefaultStringIfNoDefault(PREFERENCE_SERVICE_TYPES, serviceSb.toString()); - - //Load the client project types - 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]); - } - setDefaultStringIfNoDefault(PREFERENCE_CLIENT_TYPES, sb.toString()); - setDefault(PREFERENCE_USE_TWO_EARS, ProjectTopologyDefaults.isUseTwoEARs()); - } - - public void setServiceTypes(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_SERVICE_TYPES, sb.toString()); - } - - public String[] getServiceTypes() - { - StringTokenizer st = new StringTokenizer(getValueAsString(PREFERENCE_SERVICE_TYPES)); - String[] s = new String[st.countTokens()]; - for (int i = 0; i < s.length; i++) - s[i] = st.nextToken(); - return s; - } - - public String[] getDefaultServiceTypes() - { - StringTokenizer st = new StringTokenizer(getDefaultString(PREFERENCE_SERVICE_TYPES)); - String[] s = new String[st.countTokens()]; - for (int i = 0; i < s.length; i++) - s[i] = st.nextToken(); - return s; - } - - 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 String[] getDefaultClientTypes() - { - StringTokenizer st = new StringTokenizer(getDefaultString(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.setServiceTypes(getServiceTypes()); - context.setDefaultServiceTypes(getDefaultServiceTypes()); - context.setClientTypes(getClientTypes()); - context.setDefaultClientTypes(getDefaultClientTypes()); - 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 51a9e9829..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, 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.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 cc21c4bf1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyContext.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060227 124392 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ - -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"; - public static final String PREFERENCE_SERVICE_TYPES = "serviceTypes"; - - /** - * This constant String is used to lookup the two EAR option - **/ - public static final String PREFERENCE_USE_TWO_EARS = "useTwoEARs"; - - public void setServiceTypes(String[] ids); - public String[] getServiceTypes(); - public String[] getDefaultServiceTypes(); - - public void setClientTypes(String[] ids); - public String[] getClientTypes(); - public String[] getDefaultClientTypes(); - - 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 e19e1f555..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyDefaults.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060227 124392 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ - -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[] getServiceTypes() - { - return WebServiceRuntimeExtensionUtils2.getAllServiceProjectTypes(); - } - - 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 40c7bc1fa..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyPreferencePage.java +++ /dev/null @@ -1,406 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060227 124392 rsinha@ca.ibm.com - Rupam Kuehner - * 20060515 141398 cbrealey@ca.ibm.com - Chris Brealey - *******************************************************************************/ - -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.Group; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -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 serviceTypeViewer_; - private Button serviceMoveUp_; - private Button serviceMoveDown_; - private Vector serviceTypes_; - - 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); - - Group serviceTypeComposite = new Group( parent, SWT.NONE ); - GridLayout servicegl = new GridLayout(); - servicegl.numColumns = 2; - servicegl.marginHeight = 0; - servicegl.marginWidth = 0; - serviceTypeComposite.setLayout(servicegl); - serviceTypeComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL )); - serviceTypeComposite.setText(WSUIPluginMessages.LABEL_SERVICE_TYPE_NAME); - - Table serviceTable= new Table(serviceTypeComposite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); - GridData servicegd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); - servicegd.widthHint = 256; - serviceTable.setLayoutData(servicegd); - serviceTable.setToolTipText(WSUIPluginMessages.TOOLTIP_SERVICE_TYPE_TABLE_VIEWER); - - serviceTypes_ = new Vector(); - serviceTypeViewer_ = new TableViewer(serviceTable); - serviceTypeViewer_.setContentProvider(new ClientTypeContentProvider()); - serviceTypeViewer_.setLabelProvider(new ClientTypeLabelProvider()); - serviceTypeViewer_.setInput(serviceTypes_); - - TableLayout serviceTableLayout = new TableLayout(); - TableColumn serviceTableColumn = new TableColumn(serviceTable, SWT.NONE); - serviceTableColumn.setText(WSUIPluginMessages.LABEL_SERVICE_TYPE_NAME); - ColumnWeightData serviceColumnData = new ColumnWeightData(256, 256, false); - serviceTableLayout.addColumnData(serviceColumnData); - serviceTable.setLayout(serviceTableLayout); - - Composite servicec = new Composite(serviceTypeComposite, SWT.NONE); - servicegl = new GridLayout(); - servicegl.numColumns = 1; - servicegl.marginHeight = 10; - servicegl.marginWidth = 0; - servicec.setLayout(servicegl); - - serviceMoveUp_ = new Button(servicec, SWT.PUSH); - serviceMoveUp_.setText(WSUIPluginMessages.LABEL_MOVE_UP); - serviceMoveUp_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - serviceMoveUp_.addSelectionListener(this); - serviceMoveUp_.setToolTipText(WSUIPluginMessages.TOOLTIP_MOVE_UP); - - serviceMoveDown_ = new Button(servicec, SWT.PUSH); - serviceMoveDown_.setText(WSUIPluginMessages.LABEL_MOVE_DOWN); - serviceMoveDown_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); - serviceMoveDown_.addSelectionListener(this); - serviceMoveDown_.setToolTipText(WSUIPluginMessages.TOOLTIP_MOVE_DOWN); - - - Group clientTypeComposite = new Group( 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 )); - clientTypeComposite.setText(WSUIPluginMessages.LABEL_CLIENT_TYPE_NAME); - - 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_2); - 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_2); - 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) { } - - - /** - * Adds the String elements of array a into Vector v. If String array b contains any elements - * that are not already in array a, appends these elements from array b to the end of Vector v. - * @param a a String array - * @param b a String array - * @param v a non-null Vector - */ - private void setVectorContentsFromTwoArrays(String[] a, String[] b, Vector v) - { - for (int i = 0; i < a.length; i++) - { - v.add(a[i]); - } - - for (int i = 0; i < b.length; i++) - { - if (v.indexOf(b[i]) == -1) - { - v.add(b[i]); - } - } - } - - /** - * Initializes states of the controls to their burned-in defaults. - */ - private void initializeDefaults() - { - ProjectTopologyContext context = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - serviceTypes_.clear(); - String[] defaultServiceTypes = context.getDefaultServiceTypes(); - String[] allServiceTypes = ProjectTopologyDefaults.getServiceTypes(); - setVectorContentsFromTwoArrays(defaultServiceTypes, allServiceTypes, serviceTypes_); - serviceTypeViewer_.refresh(); - - clientTypes_.clear(); - String[] defaultClientTypes = context.getDefaultClientTypes(); - String[] allClientTypes = ProjectTopologyDefaults.getClientTypes(); - setVectorContentsFromTwoArrays(defaultClientTypes, allClientTypes, clientTypes_); - clientTypeViewer_.refresh(); - - twoEAR_.setSelection(true); - } - - /** - * Initializes states of the controls from the preference helper. - */ - private void initializeValues() - { - //Initial service project types. - ProjectTopologyContext context = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - String[] serviceTypesFromContext = context.getServiceTypes(); - String[] allServiceTypes = ProjectTopologyDefaults.getServiceTypes(); - setVectorContentsFromTwoArrays(serviceTypesFromContext, allServiceTypes, serviceTypes_); - if (allServiceTypes.length > serviceTypesFromContext.length) - { - String[] serviceTypesArray = new String[serviceTypes_.size()]; - serviceTypes_.copyInto(serviceTypesArray); - context.setServiceTypes(serviceTypesArray); - } - // refresh viewer - serviceTypeViewer_.refresh(); - - - //Initialize client project types. - String[] clientTypesFromContext = context.getClientTypes(); - String[] allClientTypes = ProjectTopologyDefaults.getClientTypes(); - setVectorContentsFromTwoArrays(clientTypesFromContext, allClientTypes, clientTypes_); - if (allClientTypes.length > clientTypesFromContext.length) - { - String[] clientTypesArray = new String[clientTypes_.size()]; - clientTypes_.copyInto(clientTypesArray); - context.setClientTypes(clientTypesArray); - } - - // 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[] serviceTypesArray = new String[serviceTypes_.size()]; - serviceTypes_.copyInto(serviceTypesArray); - context.setServiceTypes(serviceTypesArray); - 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) - { - if (e.widget == serviceMoveUp_ || e.widget == serviceMoveDown_) - { - int index = serviceTypeViewer_.getTable().getSelectionIndex(); - if (index != -1) - { - if (e.widget == serviceMoveUp_ && index > 0) - { - Object object = serviceTypes_.remove(index); - serviceTypes_.insertElementAt(object, index-1); - serviceTypeViewer_.refresh(); - } - else if (e.widget == serviceMoveDown_ && index < serviceTypes_.size()-1) - { - Object object = serviceTypes_.remove(index); - serviceTypes_.insertElementAt(object, index+1); - serviceTypeViewer_.refresh(); - } - } - } - else if (e.widget == moveUp_ || e.widget == moveDown_) - { - 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 699f53424..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ServerRuntimePreferencePage.java +++ /dev/null @@ -1,358 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060728 151723 mahutch@ca.ibm.com - Mark Hutchinson - * 20070109 130965 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.preferences; - -import java.util.ArrayList; -import java.util.Arrays; - -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(); - applyDialogFont(page); - 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); - - // TODO (see bug 116025) - Since the server and runtime set in serverToRuntimeToJ2EE is just the list of - // all servers and all runtime (i.e. no validation checking is being done), no need to update the runtime, - // just keep the original value. - //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]); - } - - //sort the labels (bug 151723) - Arrays.sort(runtimeLabels); - 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 1102733c6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/preferences/TransientProjectTopologyContext.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060227 124392 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.preferences; - - -public class TransientProjectTopologyContext implements ProjectTopologyContext -{ - private String[] serviceTypes; - private String[] defaultServiceTypes; - - private String[] clientTypes; - private String[] defaultClientTypes; - - private boolean twoEARs; - - public TransientProjectTopologyContext () {} - - public void setServiceTypes(String[] serviceTypes) - { - this.serviceTypes = serviceTypes; - } - public String[] getServiceTypes() - { - return serviceTypes; - } - - 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.setServiceTypes(getServiceTypes()); - context.setDefaultServiceTypes(getDefaultServiceTypes()); - context.setClientTypes(getClientTypes()); - context.setDefaultClientTypes(getDefaultClientTypes()); - context.setUseTwoEARs(isUseTwoEARs()); - return context; - } - - -public void setDefaultServiceTypes(String[] defaultServiceTypes) -{ - this.defaultServiceTypes = defaultServiceTypes; -} - -public String[] getDefaultServiceTypes() -{ - return defaultServiceTypes; - -} - - -public void setDefaultClientTypes(String[] defaultClientTypes) -{ - this.defaultClientTypes = defaultClientTypes; -} - -public String[] getDefaultClientTypes() -{ - return defaultClientTypes; - -} -} 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 2397f2cdb..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/selection/SelectionTransformer.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available 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(); - - if (inSelection != null) - { - 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 47e597291..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartClientWidgetFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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_.getRun()) - { - 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 5e62fef92..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/server/StartServerWidget.java +++ /dev/null @@ -1,446 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070314 176886 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ - -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.BaseStatusHandler; -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.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) - { - BaseStatusHandler handler = new BaseStatusHandler(); - 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 d92f6ab83..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractHandlersWidgetDefaultingCmd.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -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/AbstractObjectSelectionLaunchable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractObjectSelectionLaunchable.java deleted file mode 100644 index 1c00cca66..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AbstractObjectSelectionLaunchable.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060420 135912 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -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.swt.widgets.Shell; - -public abstract class AbstractObjectSelectionLaunchable implements IObjectSelectionLaunchable { - - public int launch(Shell shell) { - return -1; - } - - public IStatus validateSelection(IStructuredSelection objectSelection) { - // subclass should override this method - return Status.OK_STATUS; - } - - public IStructuredSelection getObjectSelection() { - // subclass should override this method - return new StructuredSelection(); - } - - public void setInitialSelection(IStructuredSelection initialSelection) { - // subclass should override this method - } - - public String getObjectSelectionDisplayableString() - { - // subclass should override this method - return ""; - } - - public boolean validate(String s) { - // subclass should override this method - return true; - } - -} 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 045aa362b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/AddHandlerDialog.java +++ /dev/null @@ -1,265 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060529 143518 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -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 boolean isMultipleServices_; - 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); - setShellStyle(getShellStyle() | SWT.RESIZE); - 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_ && !isMultipleServices_){ - 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_ && !isMultipleServices_){ - 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); - } - - public void setIsMultipleServices(boolean isMultipleServices){ - this.isMultipleServices_ = isMultipleServices; - } -} 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 3962d82e5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/CheckWSDLValidationCommand.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060420 120714 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -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 { - // Setting the error string to an empty string so that the command engine would not - // pop-up another error message when the user decided to wait for WSDL validation. - return StatusUtils.errorStatus( "" ); - } - } - } - } - - 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; - } - - -} 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 b9fb927cd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetDefaultingCommand.java +++ /dev/null @@ -1,329 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.Collection; -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.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.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.common.HandlerServiceRefHolder; -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 WebServicesManager webServicesManager_; - - private IProject project_; - - private String serviceRefName_ = null; - - private List wsServiceRefs_; - - private HandlerServiceRefHolder[] handlerServiceRefHolder_; - private String errorStatusMsg_ = null; - private boolean isMultipleSelection_; - - 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; - } - else if (selection.size()>1){ - status = processMultipleHandlers(); - return status; - } - - status = processHandlers(); - return status; - - } - - /** - * For processing handlers - * @return - */ - public IStatus processHandlers() { - try { - - Collection selectedServiceRefs = getWSServiceRefsFromSelection(); // get initial selection values - if (selectedServiceRefs==null || selectedServiceRefs.isEmpty()){ - //report no Web service client is available - return StatusUtils.errorStatus(ConsumptionUIMessages.MSG_ERROR_WEB_SERVICE_CLIENTS_NOT_FOUND); - } - wsServiceRefs_ = webServicesManager_.getAllWorkspaceServiceRefs(); - - if (wsServiceRefs_ != null) { - int numberOfServiceRefs = wsServiceRefs_.size(); - handlerServiceRefHolder_ = new HandlerServiceRefHolder[numberOfServiceRefs]; - - for (int i = 0; i < numberOfServiceRefs; i++) { - ServiceRef wsServiceRef = (ServiceRef) wsServiceRefs_.get(i); - Vector handlers = new Vector(); - List wsHandlers = wsServiceRef.getHandlers(); - - 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); - - handlers.add(handlerItem); - } - String wsServiceRefName = wsServiceRef.getServiceRefName(); - handlerServiceRefHolder_[i] = new HandlerServiceRefHolder(); - handlerServiceRefHolder_[i].setHandlerList(handlers); - handlerServiceRefHolder_[i].setServiceRef(wsServiceRef); - handlerServiceRefHolder_[i].setServiceRefName(wsServiceRefName); - - } - - } - - } - catch (Exception e) { - return StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_TASK_EXCEPTED, e); - } - return Status.OK_STATUS; - } - - public IStatus processMultipleHandlers(){ - ServiceRef[] serviceRefs = getServiceRefs(); - if (errorStatusMsg_ != null){ - return StatusUtils.errorStatus(errorStatusMsg_); - } - isMultipleSelection_ = true; - - handlerServiceRefHolder_ = new HandlerServiceRefHolder[serviceRefs.length]; - Vector handlers = new Vector(); - for (int i=0;i<serviceRefs.length;i++){ - - String refName = serviceRefs[i].getServiceRefName(); - handlerServiceRefHolder_[i] = new HandlerServiceRefHolder(); - handlerServiceRefHolder_[i].setHandlerList(handlers); - handlerServiceRefHolder_[i].setServiceRefName(refName); - handlerServiceRefHolder_[i].setServiceRef(serviceRefs[i]); - } - return Status.OK_STATUS; - } - - /** - * @return Returns the isGenSkeletonEnabled_. - */ - public boolean getGenSkeletonEnabled() { - if (isMultipleSelection_) - return false; - return true; - } - - - public String getServiceRefName() { - return this.serviceRefName_; - } - - public IProject getClientProject() { - return project_; - } - - private ServiceRef[] getServiceRefs(){ - IStructuredSelection initSel = getInitialSelection(); - ServiceRef[] serviceRefs = new ServiceRef[initSel.size()]; - Iterator iter = initSel.iterator(); - for (int i=0;i<initSel.size();i++) { - Object obj = iter.next(); - if (obj instanceof ServiceRef){ - serviceRefs[i] = (ServiceRef)obj; - } - else{ - errorStatusMsg_ = ConsumptionUIMessages.MSG_ERROR_INVALID_MULTIPLE_SERVICE_SELECT; - return null; - } - } - return serviceRefs; -} - - 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(); - if (!serviceRefs.isEmpty()) { - ServiceRef ref = (ServiceRef)((List)serviceRefs).get(0); - serviceRefName_ = ref.getServiceRefName(); - project_ = ProjectUtilities.getProject(ref); - return serviceRefs; - } - return null; - } - 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 Collection getWsServiceRefs(){ - return this.wsServiceRefs_; - } - - public boolean getIsMultipleSelection(){ - return this.isMultipleSelection_; - } - - public HandlerServiceRefHolder[] getHandlerServiceRefHolder(){ - return this.handlerServiceRefHolder_; - } -} 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 4cee18a13..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060517 142339 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.List; - -import 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.common.HandlerServiceRefHolder; -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 HandlerServiceRefHolder[] handlerServiceRefHolder_; - private Hashtable oldWSServiceRefsToHandlersTable_; - private Hashtable newWSServiceRefsToHandlersTable_; - private IProject project_; - private boolean isMultipleSelection_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - - try { - - if (isMultipleSelection_) { - if (handlerServiceRefHolder_ != null) { - // add new handler to internal model if it doesn't already exist - for (int i = 0; i < handlerServiceRefHolder_.length; i++) { - handlerServiceRefHolder_[i].addHandlerToServiceRef(); - saveEditModel(handlerServiceRefHolder_[i].getProject()); - } - - } - - } - else { - oldWSServiceRefsToHandlersTable_ = new Hashtable(); - newWSServiceRefsToHandlersTable_ = new Hashtable(); - - if (handlerServiceRefHolder_ != null) { - - for (int i = 0; i < handlerServiceRefHolder_.length; i++) { - - ServiceRef wsServiceRef =handlerServiceRefHolder_[i].getServiceRef(); - - List wsHandlers = wsServiceRef.getHandlers(); - oldWSServiceRefsToHandlersTable_.put(wsServiceRef, wsHandlers); - newWSServiceRefsToHandlersTable_.put(wsServiceRef, new ArrayList()); - } - - //Enumeration e = handlersTable_.keys(); - for (int j=0;j<handlerServiceRefHolder_.length;j++) { - - List handlerTableItems_ = handlerServiceRefHolder_[j].getHandlerList(); - 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 saveEditModel(IProject project){ - project_ = project; - saveEditModel(); - } - - private void addHandlersToServiceRefs() { - try { - Enumeration refsToHandlers = newWSServiceRefsToHandlersTable_.keys(); - while (refsToHandlers.hasMoreElements()) { - ServiceRef serviceRef = (ServiceRef) refsToHandlers.nextElement(); - if (serviceRef != null) { - List handlers = (List) newWSServiceRefsToHandlersTable_.get(serviceRef); - List modelHandlers = (List) oldWSServiceRefsToHandlersTable_.get(serviceRef); - modelHandlers.clear(); - modelHandlers.addAll(handlers); - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - - - public void setClientProject(IProject project) { - this.project_ = project; - } - - /** - * An array of HandlerDescriptionHolders - * @return - */ - public void setHandlerServiceRefHolder(HandlerServiceRefHolder[] handlerHolders){ - this.handlerServiceRefHolder_ = handlerHolders; - } - - public void setIsMultipleSelection(boolean isMulitpleSelection) { - this.isMultipleSelection_ = isMulitpleSelection; - } - -} 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 4997297f1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidget.java +++ /dev/null @@ -1,524 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060407 135415 rsinha@ca.ibm.com - Rupam Kuehner - * 20060417 136390/136159 joan@ca.ibm.com - Joan Haggarty - * 20060413 135581 rsinha@ca.ibm.com - Rupam Kuehner - * 20060420 135912 joan@ca.ibm.com - Joan Haggarty - * 20060424 138052 kathy@ca.ibm.com - Kathy Chan - * 20060425 137831 rsinha@ca.ibm.com - Rupam Kuehner - * 20060509 119296 pmoogk@ca.ibm.com - Peter Moogk - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20060612 145081 pmoogk@ca.ibm.com - Peter Moogk - * 20060725 149351 makandre@ca.ibm.com - Andrew Mak, Deleted service definition keeps reappearing - * 20060803 152486 makandre@ca.ibm.com - Andrew Mak, Typing WSDL in Service definition field is very slow - * 20060817 140017 makandre@ca.ibm.com - Andrew Mak, longer project or server/runtime strings do not resize wizard - * 20060825 135570 makandre@ca.ibm.com - Andrew Mak, Service implementation URL not displayed properly on first page - * 20060829 155441 makandre@ca.ibm.com - Andrew Mak, web service wizard hangs during resize - * 20060907 156211 makandre@ca.ibm.com - Andrew Mak, Selecting service definition invalidated project config when creating web service java client - * 20061212 159911 makandre@ca.ibm.com - Andrew Mak, changing service definition resets some configuration fields - * 20060125 159911 kathy@ca.ibm.com - Kathy Chan, Remove unused method and imports - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.Dialog; -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.command.data.EclipseIPath2URLStringTransformer; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.Timer; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; -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.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.IWorkbench; -import org.eclipse.ui.PlatformUI; -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.ui.widgets.PageInfo; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -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.WidgetDataEvents; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -public class ClientWizardWidget extends SimpleWidgetDataContributor implements Runnable -{ - private WebServiceClientTypeWidget clientWidget_; - private Button overwriteButton_; - private Button monitorService_; - - private Text serviceImpl_; - private Button browseButton_; - private WSDLSelectionDialog wsdlDialog_; - private String componentName_; - private IProject project_; - private String webServiceURI_; - private WebServicesParser parser_; - private ResourceContext resourceContext_; - - private Listener statusListener_; - private ModifyListener objectModifyListener_ ; - private int validationState_; - private boolean validObjectSelection_ = true; - private WSDLSelectionWidgetWrapper wsdlValidatorWidget_; - - private Timer timer_ = null; - - /* CONTEXT_ID WSWSCEN0020 for the Service Implemenation text field of the Scenario Page */ - private String INFOPOP_WSWSCEN_TEXT_SERVICE_IMPL = "WSWSCEN0020"; - - - /* CONTEXT_ID WSWSCEN0014 for the monitor service checkbox of the Scenario page */ - private String INFOPOP_WSWSCEN_CHECKBOX_MONITOR_SERVICE = "WSWSCEN0014"; - /* CONTEXT_ID WSWSCEN0030 for the Overwrite Files checkbox of the Scenario Page */ - private String INFOPOP_WSWSCEN_CHECKBOX_OVERWRITE = "WSWSCEN0030"; - /* CONTEXT_ID WSWSCEN0001 for the Scenario Page */ - private String INFOPOP_WSWSCEN_PAGE = "WSWSCEN0001"; - - /** - * Run this ClientWizardWidget, which validates the entry field values. - */ - public void run() { - validationState_ = ValidationUtils.VALIDATE_ALL; - statusListener_.handleEvent(null); - if (validObjectSelection_) - callObjectTransformation(project_, - wsdlValidatorWidget_.getComponentName(), - wsdlValidatorWidget_.getWsdlURI()); - } - - public WidgetDataEvents addControls( Composite parent, Listener statusListener) - { - String pluginId = "org.eclipse.jst.ws.consumption.ui"; - UIUtils utils = new UIUtils( pluginId ); - utils.createInfoPop(parent, INFOPOP_WSWSCEN_PAGE); - - statusListener_ = statusListener; - validationState_ = ValidationUtils.VALIDATE_ALL; - // Create text field and browse for service selection - Composite typeComposite = utils.createComposite(parent, 3); - serviceImpl_ = utils.createText(typeComposite, ConsumptionUIMessages.LABEL_WEBSERVICEDEF, - ConsumptionUIMessages.TOOLTIP_WSWSCEN_TEXT_IMPL, - INFOPOP_WSWSCEN_TEXT_SERVICE_IMPL, SWT.LEFT | SWT.BORDER ); - - objectModifyListener_ = new ModifyListener(){ - public void modifyText(ModifyEvent e) { - if (serviceImpl_.getText().indexOf(':') > 0) { - timer_ = Timer.newInstance(timer_, Display.getCurrent(), ClientWizardWidget.this); - timer_.startTimer(); - } - else - run(); - } - }; - - serviceImpl_.addModifyListener(objectModifyListener_); - - browseButton_ = utils.createPushButton(typeComposite, - ConsumptionUIMessages.BUTTON_BROWSE, ConsumptionUIMessages.TOOLTIP_WSWSCEN_BUTTON_BROWSE_IMPL, null); - - IWorkbench workbench = PlatformUI.getWorkbench(); - wsdlDialog_ = new WSDLSelectionDialog(workbench.getActiveWorkbenchWindow().getShell(), - new PageInfo(ConsumptionUIMessages.DIALOG_TITILE_SERVICE_IMPL_SELECTION, "", - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new WSDLSelectionWidgetWrapper(); - } - })); - browseButton_.addSelectionListener(new WSDLBrowseListener()); - - utils.createHorizontalSeparator(parent, 1); - - Composite clientComposite = utils.createComposite( parent, 1, 0, 0 ); - - clientWidget_ = new WebServiceClientTypeWidget(true); - clientWidget_.addControls(clientComposite , statusListener ); - - // Create test service check box. - Composite buttonGroup = utils.createComposite(clientComposite,1); - - // Create monitor service check box. - monitorService_ = utils.createCheckbox(buttonGroup , ConsumptionUIMessages.CHECKBOX_MONITOR_WEBSERVICE, - ConsumptionUIMessages.TOOLTIP_PWPR_CHECKBOX_MONITOR_SERVICE, - INFOPOP_WSWSCEN_CHECKBOX_MONITOR_SERVICE); - - //show overwrite if it is enabled in the preferences - if (getResourceContext().isOverwriteFilesEnabled()) { - Label prefSeparator = utils.createHorizontalSeparator(parent, 1); - prefSeparator.setText("File Options"); - Composite prefButtonPanel = utils.createComposite(parent, 1); - overwriteButton_ = utils.createCheckbox(prefButtonPanel, - ConsumptionUIMessages.CHECKBOX_OVERWRITE_FILES, - ConsumptionUIMessages.TOOLTIP_WSWSCEN_BUTTON_OVERWRITE_FILES, - INFOPOP_WSWSCEN_CHECKBOX_OVERWRITE); - overwriteButton_.setSelection(getResourceContext() - .isOverwriteFilesEnabled()); - } - return this; - } - - public void setResourceContext( ResourceContext context ) - { - resourceContext_ = context; - } - - public ResourceContext getResourceContext() - { - if (resourceContext_ == null) { - resourceContext_ = WebServicePlugin.getInstance() - .getResourceContext(); - } - return resourceContext_; - } - - public void setClientTypeRuntimeServer( TypeRuntimeServer ids ) - { - clientWidget_.setTypeRuntimeServer( ids ); - } - - public void setClientProjectName(String name) - { - clientWidget_.setClientProjectName(name); - } - - public void setClientEarProjectName(String name) - { - clientWidget_.setClientEarProjectName(name); - } - - public void setClientComponentType(String name) - { - clientWidget_.setClientComponentType(name); - } - - public void setClientNeedEAR(boolean b) - { - clientWidget_.setClientNeedEAR(b); - } - - public String getClientRuntimeId() - { - return clientWidget_.getClientRuntimeId(); - } - - public String getClientEarProjectName() - { - return clientWidget_.getClientEarProjectName(); - } - - public String getClientProjectName() - { - return clientWidget_.getClientProjectName(); - } - - public String getClientComponentType() - { - return clientWidget_.getClientComponentType(); - } - - public boolean getClientNeedEAR() - { - return clientWidget_.getClientNeedEAR(); - } - - public void setWebServiceURI(String uri) - { - webServiceURI_ = uri; - } - -public void internalize() { - - if (webServiceURI_ == null || webServiceURI_.length() == 0) - return; - - serviceImpl_.removeModifyListener(objectModifyListener_); - serviceImpl_.setText(webServiceURI_); - serviceImpl_.addModifyListener(objectModifyListener_); - - EclipseIPath2URLStringTransformer transformer = new EclipseIPath2URLStringTransformer(); - webServiceURI_ = (String) transformer.transform(webServiceURI_); -} - - public void setProject(IProject project) - { - project_ = project; - } - public void setComponentName(String name) - { - componentName_ = name; - } - - public String getWebServiceURI() - { - return webServiceURI_ ; - } - - public String getWsdlURI() - { - return getWebServiceURI(); - } - - public IProject getProject() - { - return project_; - } - - public String getComponentName() - { - return componentName_ ; - } - - public WebServicesParser getWebServicesParser() - { - return WSDLParserFactory.getWSDLParser(); - } - - public void setWebServicesParser(WebServicesParser parser) - { - parser_ = getWebServicesParser(); - clientWidget_.setWebServicesParser(parser_); - } - - public TypeRuntimeServer getClientTypeRuntimeServer() - { - return clientWidget_.getTypeRuntimeServer(); - } - - public void setInstallClient( Boolean install) - { - clientWidget_.setInstallClient( install ); - } - - public Boolean getInstallClient() - { - return clientWidget_.getInstallClient(); - } - - public Boolean getTestService() - { - return clientWidget_.getTestClient(); - } - - public void setTestService( Boolean value ) - { - clientWidget_.setTestClient(value); - } - - public int getClientGeneration() - { - return clientWidget_.getClientGeneration(); - } - - public void setClientGeneration(int value) - { - clientWidget_.setClientGeneration(value); - } - - public void setDevelopClient(boolean develop) { - clientWidget_.setDevelopClient( develop ); - } - - public boolean getDevelopClient() { - return clientWidget_.getDevelopClient(); - } - - public void setAssembleClient(boolean assemble) { - clientWidget_.setAssembleClient( assemble ); - } - - public boolean getAssembleClient() { - return clientWidget_.getAssembleClient(); - } - - public void setDeployClient(boolean deploy) { - clientWidget_.setDeployClient( deploy ); - } - - public boolean getDeployClient() { - return clientWidget_.getDeployClient(); - } - - public void setStartClient(Boolean start) { - clientWidget_.setStartClient( start ); - } - - public Boolean getStartClient() { - return clientWidget_.getStartClient(); - } - - public Boolean getMonitorService() - { - return new Boolean(monitorService_.getSelection()); - } - - public void setMonitorService(Boolean value) - { - monitorService_.setSelection(value.booleanValue()); - } - - public IStatus getStatus() { - - validObjectSelection_ = false; // assume false at first - - IStatus missingFieldStatus = checkMissingFieldStatus(); - if (missingFieldStatus.getSeverity() == IStatus.ERROR) { - return missingFieldStatus; - } - - IStatus invalidServiceImplStatus = checkServiceImplTextStatus(); - if (invalidServiceImplStatus.getSeverity() == IStatus.ERROR) { - return invalidServiceImplStatus; - } - - IStatus possibleErrorStatus = checkErrorStatus(); - if (possibleErrorStatus.getSeverity() == IStatus.ERROR) { - return possibleErrorStatus; - } - - IStatus possibleWarningStatus = checkWarningStatus(); - if (possibleWarningStatus.getSeverity() == IStatus.WARNING) { - return possibleWarningStatus; - } - - // if no errors or warnings were found, clear the validation state. - validationState_ = ValidationUtils.VALIDATE_NONE; - clientWidget_.setValidationState(ValidationUtils.VALIDATE_NONE); - - return Status.OK_STATUS; - } - - private IStatus checkMissingFieldStatus() { - - if (validationState_ == ValidationUtils.VALIDATE_ALL) { - if (serviceImpl_.getText().trim().length() == 0) { - return StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_SERVICE_SELECTION, new String[]{ConsumptionUIMessages.LABEL_WEBSERVICEIMPL})); - } - } - - IStatus clientMissingFieldsStatus = clientWidget_.checkMissingFieldStatus(); - if (clientMissingFieldsStatus.getSeverity() == IStatus.ERROR) { - return clientMissingFieldsStatus; - } - - return Status.OK_STATUS; - - } - - private IStatus checkErrorStatus() { - IStatus clientSideErrorStatus = clientWidget_.checkErrorStatus(); - if (clientSideErrorStatus.getSeverity() == IStatus.ERROR) { - return clientSideErrorStatus; - } - return Status.OK_STATUS; - } - - private IStatus checkWarningStatus() { - IStatus clientWarningStatus = clientWidget_.checkWarningStatus(); - if (clientWarningStatus.getSeverity() == IStatus.WARNING) { - return clientWarningStatus; - } - return Status.OK_STATUS; - } - - /*call validation code in the object selection widget to ensure - any modifications to the serviceImpl_ field are valid*/ - private IStatus checkServiceImplTextStatus() { - - String fieldText = serviceImpl_.getText().trim(); - - if (wsdlValidatorWidget_ == null) - wsdlValidatorWidget_ = new WSDLSelectionWidgetWrapper(); - - validObjectSelection_ = wsdlValidatorWidget_.validate(fieldText); - - if (!validObjectSelection_) - { - return StatusUtils.errorStatus(ConsumptionUIMessages.MSG_INVALID_SERVICE_DEF); - } - - return Status.OK_STATUS; - } - - private void callObjectTransformation(IProject project, String componentName, - String wsdlURI) - { - WSDLSelectionOutputCommand wsdlOutputCommand = new WSDLSelectionOutputCommand(); - wsdlOutputCommand.setComponentName(componentName); - wsdlOutputCommand.setProject(project); - wsdlOutputCommand.setWsdlURI(wsdlURI); - wsdlOutputCommand.setTestService(getTestService().booleanValue()); - wsdlOutputCommand.setWebServicesParser(getWebServicesParser()); - - wsdlOutputCommand.execute(null, null); - - setComponentName(wsdlOutputCommand.getComponentName()); - setProject(wsdlOutputCommand.getProject()); - setWebServicesParser(wsdlOutputCommand.getWebServicesParser()); - setWebServiceURI(wsdlOutputCommand.getWsdlURI()); - - // bug 159911: our starting point is a wsdl, we should not need to - // refresh the runtime everytime the user specify a new wsdl path - // refreshClientRuntimeSelection(); - } - - private class WSDLBrowseListener implements SelectionListener - { - public void widgetDefaultSelected(SelectionEvent e) { - // TODO Auto-generated method stub - - } - public void widgetSelected(SelectionEvent e) { - - wsdlDialog_.setComponentName(getComponentName()); - wsdlDialog_.setProject(getProject()); - wsdlDialog_.setWebServiceURI( serviceImpl_.getText() ); - - int result = wsdlDialog_.open(); - - if (result == Dialog.OK) - { - serviceImpl_.removeModifyListener(objectModifyListener_); - serviceImpl_.setText(wsdlDialog_.getDisplayableSelectionString()); - serviceImpl_.addModifyListener(objectModifyListener_); - - // call WSDLSelectionOutputCommand to carry out any transformation on the objectSelection - callObjectTransformation(project_, - wsdlDialog_.getComponentName(), wsdlDialog_.getWebServiceURI()); - - validationState_ = ValidationUtils.VALIDATE_ALL; - clientWidget_.setValidationState(ValidationUtils.VALIDATE_ALL); - statusListener_.handleEvent(null); //validate the page - } - } - } -} - - - - 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 6d8aef4f8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetDefaultingCommand.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20060728 150560 kathy@ca.ibm.com - Kathy Chan - * 20060728 151078 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -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 -{ - private int clientGeneration_; - private boolean developClient_; - private boolean assembleClient_; - private boolean deployClient_; - private boolean installClient_; - private boolean startClient_; - private boolean testClient_; - private boolean clientOnly_ = false; - - public ClientWizardWidgetDefaultingCommand() { - } - - - /** - * @param clientOnly Set to true for if called from ClientWidgetWizard - */ - public ClientWizardWidgetDefaultingCommand(boolean clientOnly) { - clientOnly_ = clientOnly; - } - - public Boolean getTestService() - { - return new Boolean( getScenarioContext().getTestWebService() ); - } - - public Boolean getMonitorService() - { - return new Boolean( getScenarioContext().getMonitorWebService()); - } - - public boolean getInstallClient() - { - return installClient_; - } - - public boolean getRunTestClient() - { - return getScenarioContext().isLaunchSampleEnabled() ; - } - - public int getClientGeneration() - { - return clientGeneration_; - } - - 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[] servers = WebServiceRuntimeExtensionUtils2.getAllClientServerFactoryIds(); - String server = null; - if (servers != null && servers.length>0) - { - server = servers[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 - { - defaultClientScale(); - return Status.OK_STATUS; - } - - protected void defaultClientScale() { - clientGeneration_ = getScenarioContext().getGenerateClient(); - - if (clientOnly_ && clientGeneration_ == ScenarioContext.WS_NONE) { - developClient_ = true; - assembleClient_ = true; - deployClient_ = true; - clientGeneration_ = ScenarioContext.WS_DEPLOY; - } else { - developClient_ = clientGeneration_ <= ScenarioContext.WS_DEVELOP; - assembleClient_ = clientGeneration_ <= ScenarioContext.WS_ASSEMBLE; - deployClient_ = clientGeneration_ <= ScenarioContext.WS_DEPLOY; - } - installClient_ = clientGeneration_ <= ScenarioContext.WS_INSTALL; - startClient_ = clientGeneration_ <= ScenarioContext.WS_START; - testClient_ = clientGeneration_ <= ScenarioContext.WS_TEST; - } - - public boolean getDevelopClient() { - return developClient_; - } - - public boolean getAssembleClient() { - return assembleClient_; - } - - public boolean getDeployClient() { - return deployClient_; - } - - public boolean getStartClient() { - return startClient_; - } - - public boolean getTestClient() { - return testClient_; - } - -} 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 35511e131..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientWizardWidgetOutputCommand.java +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.commands.ExecutionException; -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.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_; - - private String webServiceURI_; - private IProject project_; - private String componentName_; - private boolean runTestClient_; - private boolean developClient_; - private boolean assembleClient_; - private boolean deployClient_; - private boolean startClient_; - private boolean testClient_; - - public boolean getTestService() - { - return testService_; - } - - public void setTestService( boolean testService ) - { - testService_ = testService; - } - - public boolean getRunTestClient() - { - return runTestClient_; - } - - public void setRunTestClient( boolean runTestClient ) - { - runTestClient_ = runTestClient; - } - - public void setInstallClient( boolean installClient) - { - installClient_ = installClient; - } - - public boolean getInstallClient() - { - return installClient_; - } - - public boolean getDevelopClient() { - return developClient_; - } - - public void setDevelopClient(boolean developClient) { - this.developClient_ = developClient; - } - - public boolean getAssembleClient() { - return assembleClient_; - } - - public void setAssembleClient(boolean assembleClient) { - this.assembleClient_ = assembleClient; - } - - public boolean getDeployClient() { - return deployClient_; - } - - public void setDeployClient(boolean deployClient) { - this.deployClient_ = deployClient; - } - - public boolean getStartClient() { - return startClient_; - } - - public void setStartClient(boolean startClient) { - this.startClient_ = startClient; - } - - public boolean getTestClient() { - return testClient_; - } - - public void setTestClient(boolean testClient) { - this.testClient_ = testClient; - } - 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; - } - - public String getWsdlURI() - { - return webServiceURI_ ; - } - - public void setWsdlURI(String uri) - { - webServiceURI_ = uri; - } - - public void setProject(IProject project) - { - project_ = project; - } - - public IProject getProject() - { - return project_; - } - - public void setComponentName(String name) - { - componentName_ = name; - } - - public String getComponentName() - { - return componentName_ ; - } -} 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 c615cce7c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigClientHandlersTableWidget.java +++ /dev/null @@ -1,637 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060426 135614 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.Hashtable; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.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.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.common.HandlerServiceRefHelper; -import org.eclipse.jst.ws.internal.consumption.ui.common.HandlerServiceRefHolder; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -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.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.core.common.StatusUtils; -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 String outputLocation_; - private Composite webServiceRefComp_; - private Combo webServiceRefCombo_; - private Text webServiceDescText_ = null; - private Table handlersTable_; - private TableViewer tableViewer_; - private Button addButton_; - private Button removeButton_; - private Button genSkeletonRadioButton_; - private Composite sourceLocationComp_; - private Combo sourceLocationCombo_; - - private HandlerServiceRefHolder[] handlerServiceRefHolder_; - private HandlerServiceRefHolder currentHSRH_; - private Hashtable pathsTable_ = new Hashtable(); - private boolean isMultipleSelection_ = false; - private boolean isGenSkeletonEnabled_; - 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 - webServiceRefComp_ = uiUtils.createComposite(parent_, 2); - - 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 muGriddata = new GridData(); - Point musize = moveUpButton.computeSize(SWT.DEFAULT, SWT.DEFAULT); - 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 mdGriddata = new GridData(); - Point mdsize = moveDownButton.computeSize(SWT.DEFAULT, SWT.DEFAULT); - 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 addGriddata = new GridData(); - Point addSize = addButton_.computeSize(SWT.DEFAULT, SWT.DEFAULT); - 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 remGriddata = new GridData(); - Point remSize = removeButton_.computeSize(SWT.DEFAULT, SWT.DEFAULT); - removeButton_.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleRemoveButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - enableRemove(false); - - // set the width to the max of the button labels - int widthHint = 0; - int[] sizes = new int[]{musize.x, mdsize.x, addSize.x, remSize.x, 100}; - for(int j = 0; j < sizes.length; j++) { - if (sizes[j] > widthHint) - widthHint = sizes[j]; - } - muGriddata.widthHint = widthHint; - mdGriddata.widthHint = widthHint; - addGriddata.widthHint = widthHint; - remGriddata.widthHint = widthHint; - - moveUpButton.setLayoutData(muGriddata); - moveDownButton.setLayoutData(mdGriddata); - addButton_.setLayoutData(addGriddata); - removeButton_.setLayoutData(remGriddata); - - // 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 - 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 { - UIUtils uiUtils = new UIUtils(pluginId_); - - // process for multiple service selection - if (isMultipleSelection_) { - webServiceDescText_ = uiUtils.createText(webServiceRefComp_, ConsumptionUIMessages.LABEL_COMBO_WS_CLIENT_REF, - ConsumptionUIMessages.TOOLTIP_WS_CLIENT_REF, INFOPOP_WS_CLIENT_REF, SWT.READ_ONLY); - if (handlerServiceRefHolder_!=null){ - currentHSRH_ = handlerServiceRefHolder_[0]; - String text = NLS.bind(ConsumptionUIMessages.MSG_TEXT_NUM_OF_CLIENTS, Integer.toString(handlerServiceRefHolder_.length)); - webServiceDescText_.setText(text); - } - - genSkeletonRadioButton_.setSelection(false); - genSkeletonRadioButton_.setEnabled(false); - genSkeletonRadioButton_.setVisible(false); - - sourceLocationComp_.setVisible(false); - sourceLocationCombo_.setEnabled(false); - sourceLocationCombo_.setVisible(false); - - refresh(); - - } - else { - - 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); - } - }); - - String[] wsRefNames = HandlerServiceRefHelper.getAllServiceRefNames(handlerServiceRefHolder_); - webServiceRefCombo_.setItems(wsRefNames); - - if (handlerServiceRefHolder_.length < 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); - } - - // set handler table - HandlerServiceRefHolder hsrh = HandlerServiceRefHelper.getForServiceRefName(handlerServiceRefHolder_, webServiceRefCombo_.getText()); - if (hsrh != null) { - currentHSRH_ = hsrh; - List handlers = hsrh.getHandlerList(); - tableViewer_.setInput(handlers); - tableViewer_.refresh(); - } - - // set output folder - setSourceOutputLocation(); - } - parent_.getShell().setSize(530, 650); - } - 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; - if (isMultipleSelection_) - return StatusUtils.infoStatus(ConsumptionUIMessages.PAGE_DESC_MULTIPLE_CLIENTS_CONFIG); - return finalStatus; - } - - protected void handleAddButtonSelected(SelectionEvent event) { - - AddHandlerDialog 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); - - ServiceRef serviceRef = currentHSRH_.getServiceRef(); - hi.setWsDescRef(serviceRef); - currentHSRH_.getHandlerList().add(hi); - } - - refresh(); - } - - protected void handleRemoveButtonSelected(SelectionEvent event) { - handleDeleteKeyPressed(); - } - - protected void handleMoveUpButtonSelected(SelectionEvent event) { - - int index = tableViewer_.getTable().getSelectionIndex(); - if (index != -1) { - if (index > 0) { - if (currentHSRH_!=null) { - List handlers = currentHSRH_.getHandlerList(); - Object object = handlers.remove(index); - handlers.add( index - 1, object); - tableViewer_.refresh(); - } - } - } - - } - - protected void handleMoveDownButtonSelected(SelectionEvent event) { - - int index = tableViewer_.getTable().getSelectionIndex(); - if (index != -1) { - if (currentHSRH_!=null){ - List handlers = currentHSRH_.getHandlerList(); - if (index < handlers.size() - 1) { - Object object = handlers.remove(index); - handlers.add(index + 1, object); - tableViewer_.refresh(); - } - } - } - - } - - protected void handleSourceLocationCombo(SelectionEvent event) { - outputLocation_ = sourceLocationCombo_.getText(); - IPath outputPath = (IPath) pathsTable_.get(outputLocation_); - currentHSRH_.setSourceOutputPath(outputPath); - } - - protected void handleGenSkeletonRadioButton() { - if (genSkeletonRadioButton_.isEnabled()) { - if (genSkeletonRadioButton_.getSelection()) { - this.isGenSkeletonEnabled_ = true; - sourceLocationCombo_.setEnabled(true); - } - else { - this.isGenSkeletonEnabled_ = false; - sourceLocationCombo_.setEnabled(false); - } - } - } - - protected void handleWebServiceRefCombo(SelectionEvent event) { - - if (webServiceRefCombo_!=null && webServiceRefCombo_.isEnabled()) { - HandlerServiceRefHolder hsrh = HandlerServiceRefHelper.getForServiceRefName(handlerServiceRefHolder_, webServiceRefCombo_.getText()); - currentHSRH_ = hsrh; - refresh(); - } - - if (isGenSkeletonEnabled_){ - setSourceOutputLocation(); - } - - } - - /** - * @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; - } - } - - protected void handleDeleteKeyPressed() { - ISelection selection = tableViewer_.getSelection(); - if (selection != null && !selection.isEmpty() && (selection instanceof IStructuredSelection)) { - int selectionIndex = handlersTable_.getSelectionIndex(); - if (currentHSRH_!=null){ - currentHSRH_.getHandlerList().remove(selectionIndex); - } - refresh(); - } - } - - public void refresh() { - - try { - tableViewer_.setInput(null); - if (currentHSRH_!=null){ - List handlers = currentHSRH_.getHandlerList(); - tableViewer_.setInput(handlers); - tableViewer_.refresh(); - } - } - catch (Exception e) { - e.printStackTrace(); - } - - } - - public void setGenSkeletonEnabled(boolean isGenSkeletonEnabled) { - this.isGenSkeletonEnabled_ = isGenSkeletonEnabled; - genSkeletonRadioButton_.setSelection(isGenSkeletonEnabled); - - } - - public boolean getGenSkeletonEnabled() { - return this.isGenSkeletonEnabled_; - } - - private void setSourceOutputLocation(){ - if (currentHSRH_!=null){ - IProject project = currentHSRH_.getProject(); - if (project!=null){ - IPath[]locations = ResourceUtils.getAllJavaSourceLocations(project); - 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); - } - - // set in model - outputLocation_ = sourceLocationCombo_.getText(); - IPath outputPath = (IPath) pathsTable_.get(outputLocation_); - currentHSRH_.setSourceOutputPath(outputPath); - } - } - - /** - * Called at the beginning - */ - public void internalize(){ - populateHandlersTable(); - } - - /** - * Initial selection - * @param wsRefName - */ - public void setServiceRefName(String wsRefName) { - serviceRefName_ = wsRefName; - } - - /** - * true if multiple clients are selected - * @param isMulitpleSelection - */ - public void setIsMultipleSelection(boolean isMulitpleSelection) { - this.isMultipleSelection_ = isMulitpleSelection; - } - - /** - * An array of HandlerDescriptionHolders - * @return - */ - public void setHandlerServiceRefHolder(HandlerServiceRefHolder[] handlerHolders){ - this.handlerServiceRefHolder_ = handlerHolders; - } - - public HandlerServiceRefHolder[] getHandlerServiceRefHolder(){ - return this.handlerServiceRefHolder_; - } - -} 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 37b15ead0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ConfigServiceHandlersTableWidget.java +++ /dev/null @@ -1,685 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060426 135614 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060529 143518 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import java.util.Hashtable; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.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.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.common.HandlerDescriptionHelper; -import org.eclipse.jst.ws.internal.consumption.ui.common.HandlerDescriptionHolder; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -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.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.core.common.StatusUtils; -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 Table handlersTable_; - private TableViewer tableViewer_; - private Composite webServiceDescComp_; - private Combo webServiceDescCombo_ = null; - private Text webServiceDescText_ = null; - private Button addButton_; - private Button removeButton_; - private Button genSkeletonRadioButton_; - private Composite sourceLocationComp_; - private Combo sourceLocationCombo_; - - private HandlerDescriptionHolder[] handlerDescriptionHolder_; - private HandlerDescriptionHolder currentHDH_; - private Hashtable pathsTable_ = new Hashtable(); // available paths for combo - private String outputLocation_; // selected path from combo - private String descriptionName_ = null; - private boolean isMultipleSelection_ = false; - private boolean isGenSkeletonEnabled_; - - 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; - - // Web service description composite (combo/text to be created later) - webServiceDescComp_ = uiUtils.createComposite(parent_, 2); - - 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 muGriddata = new GridData(); - Point musize = moveUpButton.computeSize(SWT.DEFAULT, SWT.DEFAULT); - 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 mdGriddata = new GridData(); - Point mdsize = moveDownButton.computeSize(SWT.DEFAULT, SWT.DEFAULT); - 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 addGriddata = new GridData(); - Point addSize = addButton_.computeSize(SWT.DEFAULT, SWT.DEFAULT); - 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 remGriddata = new GridData(); - Point remSize = removeButton_.computeSize(SWT.DEFAULT, SWT.DEFAULT); - removeButton_.addSelectionListener(new SelectionListener() { - - public void widgetSelected(SelectionEvent event) { - handleRemoveButtonSelected(event); - } - - public void widgetDefaultSelected(SelectionEvent event) { - } - }); - enableRemove(false); - - int widthHint = 0; - int[] sizes = new int[]{musize.x, mdsize.x, addSize.x, remSize.x, 100}; - for(int j = 0; j < sizes.length; j++) { - if (sizes[j] > widthHint) - widthHint = sizes[j]; - } - muGriddata.widthHint = widthHint; - mdGriddata.widthHint = widthHint; - addGriddata.widthHint = widthHint; - remGriddata.widthHint = widthHint; - - moveUpButton.setLayoutData(muGriddata); - moveDownButton.setLayoutData(mdGriddata); - addButton_.setLayoutData(addGriddata); - removeButton_.setLayoutData(remGriddata); - - // 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(); - } - }); - - 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 and only for single service selection - private void populateHandlersTable() { - try { - UIUtils uiUtils = new UIUtils(pluginId_); - - // process for multiple service selection - if (isMultipleSelection_) { - parent_.getShell().setText(ConsumptionUIMessages.PAGE_DESC_MULTIPLE_SERVICES_CONFIG); - - webServiceDescText_ = uiUtils.createText(webServiceDescComp_, ConsumptionUIMessages.LABEL_COMBO_WS_SERVICE_DESC, - ConsumptionUIMessages.TOOLTIP_WS_SERVICE_DESC, INFOPOP_WS_SERVICE_DESC, SWT.READ_ONLY); - if (handlerDescriptionHolder_!=null){ - currentHDH_ = handlerDescriptionHolder_[0]; - String text = NLS.bind(ConsumptionUIMessages.MSG_TEXT_NUM_OF_SERVICES, Integer.toString(handlerDescriptionHolder_.length)); - webServiceDescText_.setText(text); - } - - genSkeletonRadioButton_.setSelection(false); - genSkeletonRadioButton_.setEnabled(false); - genSkeletonRadioButton_.setVisible(false); - - sourceLocationComp_.setVisible(false); - sourceLocationCombo_.setEnabled(false); - sourceLocationCombo_.setVisible(false); - - refresh(); - - } - else { - // populate the table for a single service selection - - webServiceDescCombo_ = uiUtils.createCombo(webServiceDescComp_, 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); - } - }); - - String[] wsDescNames = HandlerDescriptionHelper.getAllDescriptionNames(handlerDescriptionHolder_); - webServiceDescCombo_.setItems(wsDescNames); - - if (handlerDescriptionHolder_.length < 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); - } - - // set Descriptions - HandlerDescriptionHolder hdh = HandlerDescriptionHelper.getForDescriptionName(handlerDescriptionHolder_, webServiceDescCombo_.getText()); - if (hdh!=null){ - currentHDH_ = hdh; - List handlers = hdh.getHandlerList(); - tableViewer_.setInput(handlers); - tableViewer_.refresh(); - } - // set output folder - setSourceOutputLocation(); - } - parent_.getShell().setSize(530, 650); - } - 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; - if (isMultipleSelection_) - return StatusUtils.infoStatus(ConsumptionUIMessages.PAGE_DESC_MULTIPLE_SERVICES_CONFIG); - return finalStatus; - } - - protected void handleAddButtonSelected(SelectionEvent event) { - AddHandlerDialog dialog = new AddHandlerDialog(parent_.getShell(), false); - dialog.setIsMultipleServices(isMultipleSelection_); - dialog.create(); - - WebServiceDescription serviceDesc = null; - if (!isMultipleSelection_ ){ - if (currentHDH_!=null) { - serviceDesc = currentHDH_.getDescriptionObject(); - String[] portNames = getPortComponentNames(serviceDesc); - dialog.setPortNames(portNames); - } - } - - dialog.getShell().setSize(500, 230); - - int result = dialog.open(); - - if (result == Window.OK) { - String name = dialog.getName(); - String className = dialog.getClassName(); - String port = dialog.getPortName(); - if (port == null) - port = "*"; - - HandlerTableItem hi = new HandlerTableItem(); - hi.setHandlerName(name); - hi.setHandlerClassName(className); - hi.setPortName(port); - - if (serviceDesc!=null){ - hi.setWsDescRef(serviceDesc); - } - - if (currentHDH_!=null){ - List handlers = currentHDH_.getHandlerList(); - handlers.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]; - } - - protected void handleRemoveButtonSelected(SelectionEvent event) { - handleDeleteKeyPressed(); - } - - protected void handleMoveUpButtonSelected(SelectionEvent event) { - - int index = tableViewer_.getTable().getSelectionIndex(); - if (index != -1) { - if (index > 0) { - if (currentHDH_!=null){ - List handlers = currentHDH_.getHandlerList(); - Object object = handlers.remove(index); - handlers.add(index - 1, object); - } - tableViewer_.refresh(); - } - } - - } - - protected void handleMoveDownButtonSelected(SelectionEvent event) { - - int index = tableViewer_.getTable().getSelectionIndex(); - if (index != -1) { - if (currentHDH_!=null){ - List handlers = currentHDH_.getHandlerList(); - if (index < handlers.size() - 1) { - Object object = handlers.remove(index); - handlers.add(index+1, object); - } - tableViewer_.refresh(); - } - } - - } - - protected void handleSourceLocationCombo(SelectionEvent event) { - outputLocation_ = sourceLocationCombo_.getText(); - IPath outputPath = (IPath) pathsTable_.get(outputLocation_); - currentHDH_.setSourceOutputPath(outputPath); - } - - protected void handleGenSkeletonRadioButton() { - if (genSkeletonRadioButton_.isEnabled()) { - if (genSkeletonRadioButton_.getSelection()) { - this.isGenSkeletonEnabled_ = true; - sourceLocationCombo_.setEnabled(true); - } - else { - this.isGenSkeletonEnabled_ = false; - sourceLocationCombo_.setEnabled(false); - } - } - } - - protected void handleWebServiceDescCombo(SelectionEvent event) { - - if (webServiceDescCombo_!=null && webServiceDescCombo_.isEnabled()) { - HandlerDescriptionHolder hdh = HandlerDescriptionHelper.getForDescriptionName(handlerDescriptionHolder_, webServiceDescCombo_.getText()); - currentHDH_ = hdh; - refresh(); - } - - if (isGenSkeletonEnabled_){ - setSourceOutputLocation(); - } - - } - - /** - * @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; - } - } - - protected void handleDeleteKeyPressed() { - // internalDispose(); - ISelection selection = tableViewer_.getSelection(); - if (selection != null && !selection.isEmpty() && (selection instanceof IStructuredSelection)) { - int selectionIndex = handlersTable_.getSelectionIndex(); - if (currentHDH_!=null){ - currentHDH_.getHandlerList().remove(selectionIndex); - } - refresh(); - } - } - - public void refresh() { - try { - tableViewer_.setInput(null); - if (currentHDH_!=null){ - List handlers = currentHDH_.getHandlerList(); - tableViewer_.setInput(handlers); - tableViewer_.refresh(); - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - - public void setGenSkeletonEnabled(boolean isGenSkeletonEnabled) { - this.isGenSkeletonEnabled_ = isGenSkeletonEnabled; - genSkeletonRadioButton_.setSelection(isGenSkeletonEnabled); - - } - - public boolean getGenSkeletonEnabled() { - return this.isGenSkeletonEnabled_; - } - - private void setSourceOutputLocation(){ - IProject project = currentHDH_.getProject(); - if (project!=null){ - IPath[] locations = ResourceUtils.getAllJavaSourceLocations(project); - - 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); - } - - // set in model - outputLocation_ = sourceLocationCombo_.getText(); - IPath outputPath = (IPath) pathsTable_.get(outputLocation_); - currentHDH_.setSourceOutputPath(outputPath); - - } - - /** - * An array of HandlerDescriptionHolders - * @return - */ - public void setHandlerDescriptionHolders(HandlerDescriptionHolder[] handlerHolders){ - this.handlerDescriptionHolder_ = handlerHolders; - } - - public HandlerDescriptionHolder[] getHandlerDescriptionHolders(){ - return this.handlerDescriptionHolder_; - } - - /** - * For getting the handlers to apply for multiple services - * @return - */ - public List getHandlersList(){ - if (handlerDescriptionHolder_[0]!=null) - return handlerDescriptionHolder_[0].getHandlerList(); - return null; - } - - public void setDescriptionName(String wsDescName) { - descriptionName_ = wsDescName; - } - - public void setIsMultipleSelection(boolean isMulitpleSelection) { - this.isMultipleSelection_ = isMulitpleSelection; - } - - public void internalize(){ - populateHandlersTable(); - } - -} 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 44a212910..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, 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; - -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_; -} -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/IObjectSelectionLaunchable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/IObjectSelectionLaunchable.java deleted file mode 100644 index c59ad6df6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/IObjectSelectionLaunchable.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060420 135912 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ -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.swt.widgets.Shell; - -public interface IObjectSelectionLaunchable { - /** - * 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(); - - /** - * Called to launch a dialog which allows the user to make an object selection. - * This is an alternative to implementing IObjectSelectionWidget which can be used by the dialog framework. - * The implementation of this method should call the necessary getters on the dialog to update the - * object selection. - * - * @return the status of completing the dialog launch - */ - public int launch(Shell shell); - - /** - * - * @return returns the string to displayed in the UI for the selected object - */ - public String getObjectSelectionDisplayableString(); - - /** - * - * @param s A string representation of the object selection - * @return true if the string represents a valid object selection. - * The implementation of this method should set the widget object selection - * according to the input string so that a subsequent call to getObjectSelection - * will retrieve the correct object. - */ - public boolean validate(String s); -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/IPackable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/IPackable.java deleted file mode 100644 index 5600bd90a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/IPackable.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060829 155441 makandre@ca.ibm.com - Andrew Mak, web service wizard hangs during resize - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -/** - * An interface that marks an UI element as having some custom packing code. - */ -public interface IPackable { - - /** - * Calling this method should cause the UI element to pack itself. Note that - * this does not necessarily have the same behavior as the pack() method in SWT. - */ - void packIt(); -} 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 b35ef7abc..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, 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; - -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; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/JavaBeanSelectionLaunchable.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/JavaBeanSelectionLaunchable.java deleted file mode 100644 index 920d3457c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/JavaBeanSelectionLaunchable.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060420 135912 joan@ca.ibm.com - Joan Haggarty - * 20060719 149352 mahutch@ca.ibm.com - Mark Hutchinson - * 20060826 135570 makandre@ca.ibm.com - Andrew Mak, Service implementation URL not displayed properly on first page - * 20070313 170126 makandre@ca.ibm.com - Andrew Mak, BUJava scenario doesn't catch improper service definition - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.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.JavaConventions; -import org.eclipse.jdt.core.JavaCore; -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.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.ui.dialog.DialogUtils; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class JavaBeanSelectionLaunchable extends AbstractObjectSelectionLaunchable { - - private IProject serverProject_ = null; - private String serverComponentName_ = null; - private String beanClassString_=""; - - 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); - else if (object instanceof String) - beanClassString_ = (String) object; // use for displayable string - } - } - - public IStructuredSelection getObjectSelection() - { - return new StructuredSelection(beanClassString_); - } - - public IProject getProject() - { - return serverProject_; - } - - public String getComponentName() - { - return serverComponentName_; - } - - public int launch(Shell shell) { - - IType itype = DialogUtils.browseClassesAsIType(shell, ResourcesPlugin.getWorkspace().getRoot().getProjects(), new ProgressMonitorDialog(shell)); - if (itype != null) - { - beanClassString_ = itype.getFullyQualifiedName(); - try - { - IResource res = itype.getUnderlyingResource(); - if (res != null) - { - serverProject_ = res.getProject(); - IVirtualComponent comp = ResourceUtils.getComponentOf(res); - if (comp!=null) - { - serverComponentName_ = comp.getName(); - } - } - else - { - serverProject_ = null; - serverComponentName_ = null; - } - return Status.OK; - } - catch (JavaModelException jme) - { - serverProject_ = null; - serverComponentName_ = null; - return Status.ERROR; - } - } - return Status.CANCEL; - } - - 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('.') ); - } - - beanClassString_ = 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; - beanClassString_ = pci.getServiceEndpointInterface(); - } - } - } - - private void setBeanClass(BeanLink serviceImpl) - { - if( serviceImpl != null ) - { - EObject eObject = serviceImpl.eContainer(); - if(eObject instanceof ServiceImplBeanImpl){ - setBeanClass((ServiceImplBeanImpl)eObject); - } - } - } - - public IStatus getStatus() - { - if (beanClassString_.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; - } - - public String getObjectSelectionDisplayableString() { - return beanClassString_; - } - - public boolean validate(String s) { - beanClassString_ = s; - String sourceLevel = JavaCore.getOption(JavaCore.COMPILER_SOURCE); - String complianceLevel = JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE); - return JavaConventions.validateJavaTypeName(s, sourceLevel, complianceLevel).isOK(); - } - -} 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 82c464941..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, 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; - -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/ProjectSelectionDialog.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ProjectSelectionDialog.java deleted file mode 100644 index 94916f315..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ProjectSelectionDialog.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060413 135581 rsinha@ca.ibm.com - Rupam Kuehner - * 20060802 148731 mahutch@ca.ibm.com - Mark Hutchinson - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ProjectSelectionWidget; -import org.eclipse.jst.ws.internal.data.TypeRuntimeServer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.command.internal.env.ui.widgets.PageInfo; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleDialog; - -public class ProjectSelectionDialog extends SimpleDialog { - - String titleText_=""; - String projectName_=""; - String earProjectName_=""; - String componentType_=""; - TypeRuntimeServer trs_; - boolean needEAR_; - - public ProjectSelectionDialog(Shell shell, PageInfo pageInfo) - { - super(shell, pageInfo); - titleText_ = pageInfo.getPageName(); - } - - protected void callSetters() { - // TODO Auto-generated method stub - ProjectSelectionWidget projWidget = (ProjectSelectionWidget)getWidget(); - projWidget.setEarProjectName(earProjectName_); - projWidget.setProjectName(projectName_); - projWidget.setComponentType(componentType_); - projWidget.setNeedEAR(needEAR_); - projWidget.setTypeRuntimeServer(trs_); - - projWidget.refreshProjectItems(); - } - - protected Point getInitialSize() - { - return this.getShell().computeSize(250, SWT.DEFAULT, true); - } - - - protected void setShellStyle(int newShellStyle) - { - super.setShellStyle( newShellStyle | SWT.RESIZE ); - } - - protected void configureShell(Shell newShell) - { - newShell.setText(titleText_); - super.configureShell(newShell); - } - - public void setProjectName(String name) - { - projectName_ = name; - } - - public String getProjectName() - { - return projectName_; - } - - public void setEarProjectName(String name) - { - earProjectName_ = name; - } - - public String getEarProjectName() - { - return earProjectName_; - } - - public void setProjectComponentType( String type ) - { - componentType_ = type; - } - - public String getProjectComponentType() - { - return componentType_; - } - - public void setNeedEAR(boolean b) - { - needEAR_ = b; - } - - public boolean getNeedEAR() - { - return needEAR_; - } - - public void setTypeRuntimeServer(TypeRuntimeServer trs) - { - trs_ = trs; - } - - public boolean close() { - - projectName_ = ((ProjectSelectionWidget)getWidget()).getProjectName(); - earProjectName_ = ((ProjectSelectionWidget)getWidget()).getEarProjectName(); - needEAR_ = ((ProjectSelectionWidget)getWidget()).getNeedEAR(); - componentType_ = ((ProjectSelectionWidget)getWidget()).getComponentType(); - return super.close(); - } -} 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 f81138eb4..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, 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; - -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; - } -} 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 1a3683f4f..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, 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; - -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]); - } -} 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 beeab2fa4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetDefaultingCommand.java +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060517 142027 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060518 142554 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -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.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.common.HandlerDescriptionHolder; -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 WsddResource[] wsddResource_ = null; - private IProject project_; - private String descriptionName_ = null; - private String errorStatusMsg_ = null; - private boolean isMultipleSelection_; - private HandlerDescriptionHolder[] handlerDescriptionHolder_; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - IStructuredSelection selection = getInitialSelection(); - if (selection == null) { - status = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_ERROR_TASK_EXCEPTED ); - env.getStatusHandler().reportError(status); - return status; - } - else if (selection.size()>1){ - status = processMultipleHandlers(env); - return status; - } - - status = processHandlers(env); - return status; - - } - - public IStatus processHandlers(IEnvironment env) { - try { - WebServicesManager webServicesManager = new WebServicesManager(); - List allWSDLServices = webServicesManager.getAllWSDLServices(); - int servicesSize = allWSDLServices.size(); - - wsddResource_= new WsddResource[servicesSize]; - wsddResource_[0] = getWsddResourceFromSelection(); - if (wsddResource_[0] == null) { - return StatusUtils.errorStatus(ConsumptionUIMessages.MSG_ERROR_WSDD_NOT_FOUND); - } - - // check for another wsddResource of another J2EE level - int x = 0; - while (x<servicesSize) { - Service service = (Service )allWSDLServices.get(x); - WsddResource wsddRes = webServicesManager.getWsddResource(service); - boolean isUniqueWsdd = true; - for (int w=0;w<wsddResource_.length;w++){ - if (wsddRes.equals(wsddResource_[w])){ - isUniqueWsdd = false; - break; - } - } - - if (isUniqueWsdd) { - wsddResource_[x] = wsddRes; - } - x++; - } - - // determine total # for descriptions - handlerDescriptionHolder_ = new HandlerDescriptionHolder[getNumberofServices(wsddResource_)]; - - int descCounter = 0; - for (int y=0;y<wsddResource_.length;y++) { - if (wsddResource_[y] !=null) { - WebServices webServices = wsddResource_[y].getWebServices(); - if (webServices != null) { - List wsDescriptions = webServices.getWebServiceDescriptions(); - for (int i = 0; i < wsDescriptions.size() ; i++) { - - WebServiceDescription wsDescription = (WebServiceDescription) wsDescriptions.get(i); - Vector handlers = new Vector(); - 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(); - - 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); - - handlers.add(handlerItem); - } - } - String wsDescName = wsDescription.getWebServiceDescriptionName(); - handlerDescriptionHolder_[descCounter] = new HandlerDescriptionHolder(); - handlerDescriptionHolder_[descCounter].setHandlerList(handlers); - handlerDescriptionHolder_[descCounter].setDescriptionObject(wsDescription); - handlerDescriptionHolder_[descCounter].setDescriptionName(wsDescName); - descCounter++; - } - } - } - } - - if (handlerDescriptionHolder_ == null){ - //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; - } - - /** - * For processing multiple service selection; only prepare table of service description names - * description objects will be processed later by the output command - * @param env - * @return - */ - private IStatus processMultipleHandlers(IEnvironment env){ - - Service[] services = getSelectedServices(); - if (errorStatusMsg_ != null){ - return StatusUtils.errorStatus(errorStatusMsg_); - } - isMultipleSelection_ = true; - - handlerDescriptionHolder_ = new HandlerDescriptionHolder[services.length]; - Vector handlers = new Vector(); - for (int i=0;i<services.length;i++){ - - String descName = services[i].getQName().getLocalPart(); - WebServiceDescription wsDescription = getServiceDescription(services[i], descName); - handlerDescriptionHolder_[i] = new HandlerDescriptionHolder(); - handlerDescriptionHolder_[i].setHandlerList(handlers); - handlerDescriptionHolder_[i].setDescriptionName(descName); - handlerDescriptionHolder_[i].setDescriptionObject(wsDescription); - } - return Status.OK_STATUS; - } - - /** - * Matches the serviceName with the ServiceDescriptionName to get the WebServiceDescription - * @param service - * @param serviceName - * @return - */ - private WebServiceDescription getServiceDescription(Service service, String serviceName){ - WebServicesManager webServicesManager = new WebServicesManager(); - WsddResource wsddResource = webServicesManager.getWsddResource(service); - if (wsddResource!=null) { - WebServices services = wsddResource.getWebServices(); - if (services!=null) { - List descriptions = services.getWebServiceDescriptions(); - for (int i=0;i<descriptions.size();i++){ - WebServiceDescription wsd = (WebServiceDescription)descriptions.get(i); - if (wsd!=null && wsd.getWebServiceDescriptionName().equals(serviceName)){ - return wsd; - } - } - } - } - return null; - } - - public boolean getIsMultipleSelection(){ - return this.isMultipleSelection_; - } - - /** - * @return Returns the isGenSkeletonEnabled_. - */ - public boolean getGenSkeletonEnabled() { - if (isMultipleSelection_) - return false; - 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; - } - - /** - * Gets the WsddResource - * @return - */ - public WsddResource[] getWsddResource() { - return wsddResource_; - } - - private WsddResource getWsddResourceFromSelection() { - WebServicesManager webServicesManager = new WebServicesManager(); - - 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; - WebServices webServices = wsddRes.getWebServices(); - if (webServices != null) { - List wsDescriptions = webServices.getWebServiceDescriptions(); - if (wsDescriptions!=null) { - WebServiceDescription wsd = (WebServiceDescription)wsDescriptions.get(0); - descriptionName_ = wsd.getWebServiceDescriptionName(); - } - } - project_ = ProjectUtilities.getProject(res); - return wsddRes; - } - } - - return null; - - } - - /** - * Get total number of ServiceDescriptions given 14 and 13 services - * @param wsddRes - * @return - */ - private int getNumberofServices(WsddResource[] wsddRes){ - int num= 0; - for (int i=0;i<wsddRes.length;i++){ - if (wsddRes[i]!=null) { - WebServices ws = wsddRes[i].getWebServices(); - if (ws!=null){ - num += ws.getWebServiceDescriptions().size(); - } - } - } - return num; - - } - - /** - * For multiple selection of Services - * @return - */ - private Service[] getSelectedServices(){ - WebServicesManager wsManager = new WebServicesManager(); - IStructuredSelection initSel = getInitialSelection(); - Service[] services = new Service[initSel.size()]; - wsddResource_ = new WsddResource[initSel.size()]; - Iterator iter = initSel.iterator(); - for (int i=0;i<initSel.size();i++) { - Object obj = iter.next(); - if (obj instanceof Service){ - services[i] = (Service)obj; - wsddResource_[i] = wsManager.getWsddResource(services[i]); - } - else{ - errorStatusMsg_ = ConsumptionUIMessages.MSG_ERROR_INVALID_MULTIPLE_SERVICE_SELECT; - return null; - } - } - return services; - } - - - - /** - * Get Description Name for single Web services selected - * null if mulitple services are selected - * @return - */ - public String getDescriptionName(){ - return descriptionName_; - } - - /** - * An array of HandlerDescriptionHolders - * @return - */ - public HandlerDescriptionHolder[] getHandlerDescriptionHolders(){ - return handlerDescriptionHolder_; - } - - -} 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 9ef8c607b..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ServiceHandlersWidgetOutputCommand.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004,2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060517 142027 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -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.common.HandlerDescriptionHelper; -import org.eclipse.jst.ws.internal.consumption.ui.common.HandlerDescriptionHolder; -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 boolean isMultipleSelection_; - private HandlerDescriptionHolder[] handlerDescriptionHolder_; - - /** - * For each HandlerDescriptionHolder, the user selected Handlers are - * sync'd up with the internal model - * For multiple services, handlers are added (not removed) to each port. - * - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IStatus status = Status.OK_STATUS; - try { - if (isMultipleSelection_){ - for (int i=0; i<handlerDescriptionHolder_.length;i++){ - - handlerDescriptionHolder_[i].addHandlerToAllPorts(); - } - } - else { - // add handler(s) for single service selected - for (int h=0;h<handlerDescriptionHolder_.length;h++){ - - Hashtable wsPortsTable = new Hashtable(); - Hashtable wsPortToHandlerTable = new Hashtable(); - - String serviceDescName = handlerDescriptionHolder_[h].getDescriptionName(); - // load PortName -> PortComponent table - HandlerDescriptionHolder hdh = HandlerDescriptionHelper.getForDescriptionName(handlerDescriptionHolder_, serviceDescName); - if (hdh!=null) { - - WebServiceDescription wsDescription_ = hdh.getDescriptionObject(); - 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 = hdh.getHandlerList(); - 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); - } - } - } - - // save - if (wsddResource_ != null) { - for (int i=0;i<wsddResource_.length;i++) { - if (wsddResource_[i]!=null) - wsddResource_[i].save(new HashMap()); - } - } - - } - catch (Exception e) { - 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(); - } - } - - /** - * HandlerDescriptionHolder - * @param hdhs - */ - public void setHandlerDescriptionHolders(HandlerDescriptionHolder[] hdhs){ - this.handlerDescriptionHolder_ = hdhs; - } - - public void setIsMultipleSelection(boolean isMulitpleSelection) { - this.isMultipleSelection_ = isMulitpleSelection; - } - - - public void setWsddResource(WsddResource[] wsddRes) { - this.wsddResource_ = wsddRes; - } - -}
\ 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 1bc252332..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/TableViewerWidget.java +++ /dev/null @@ -1,630 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060505 139918 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -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.FocusAdapter; -import org.eclipse.swt.events.FocusEvent; -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(); - } - } - ); - - text_.addFocusListener( new FocusAdapter() - { - public void focusLost(FocusEvent e) - { - internalRefresh(); - } - } ); - - 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/TimedWSDLSelectionConditionCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/TimedWSDLSelectionConditionCommand.java deleted file mode 100644 index f56b6e014..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/TimedWSDLSelectionConditionCommand.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060504 119296 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -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.jface.preference.IPreferenceStore; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.wst.command.internal.env.core.common.Condition; -import org.eclipse.wst.command.internal.env.ui.common.TimedOperation; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -public class TimedWSDLSelectionConditionCommand extends AbstractDataModelOperation implements Condition -{ - private final String TIMEOUT_PREFERENCE = "wsdlTimeOut"; - private WSDLSelectionConditionCommand selectionCommand; - private int timeOutValue; - - public TimedWSDLSelectionConditionCommand() - { - selectionCommand = new WSDLSelectionConditionCommand(); - - IPreferenceStore prefStore = WebServiceConsumptionUIPlugin.getInstance().getPreferenceStore(); - - timeOutValue = prefStore.getDefaultString(TIMEOUT_PREFERENCE).equals("") ? 10000 : prefStore.getInt( TIMEOUT_PREFERENCE ); - } - - public void setWebServicesParser(WebServicesParser webServicesParser) - { - selectionCommand.setWebServicesParser( webServicesParser ); - } - - public WebServicesParser getWebServicesParser() - { - return selectionCommand.getWebServicesParser(); - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - String timeOutMessage = ConsumptionUIMessages.bind( ConsumptionUIMessages.MSG_INFO_WSDL_OPERATION_TIMED_OUT, getWebServiceURI() ); - - TimedOperation timedOperation = new TimedOperation( selectionCommand, timeOutValue, timeOutMessage ); - - return timedOperation.execute(monitor, adaptable); - } - - public boolean evaluate() - { - return selectionCommand.evaluate(); - } - - public String getWebServiceURI() - { - return selectionCommand.getWebServiceURI(); - } - - public void setWebServiceURI(String webServiceURI) - { - selectionCommand.setWebServiceURI(webServiceURI); - } - - public String getWsdlURI() - { - return getWebServiceURI(); - } -/** - * @return Returns the httpBasicAuthPassword. - */ -public String getHttpBasicAuthPassword() { - return selectionCommand.getHttpBasicAuthPassword(); -} -/** - * @return Returns the httpBasicAuthUsername. - */ -public String getHttpBasicAuthUsername() { - return selectionCommand.getHttpBasicAuthUsername(); -} -} 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 bb6049aa9..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, 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; - -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/WSDLSelectionDialog.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionDialog.java deleted file mode 100644 index a24276ecf..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionDialog.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060525 142281 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.command.internal.env.ui.widgets.AbstractSelectionDialog; -import org.eclipse.wst.command.internal.env.ui.widgets.PageInfo; - -public class WSDLSelectionDialog extends AbstractSelectionDialog { - - private String titleText_; - private String wsUri_; - private String componentName_; - private IProject project_; - - public WSDLSelectionDialog(Shell parent, PageInfo pageInfo) { - super(parent, pageInfo); - titleText_ = pageInfo.getPageName(); - } - - protected void callSetters() - { - ((WSDLSelectionWidgetWrapper)getWidget()).setComponentName(componentName_); - ((WSDLSelectionWidgetWrapper)getWidget()).setProject(project_); - ((WSDLSelectionWidgetWrapper)getWidget()).setWebServiceURI(wsUri_); - } - - public void setComponentName(String componentName) - { - componentName_ = componentName; - } - - public String getComponentName() - { - return componentName_ ; - } - - public void setProject(IProject project) - { - project_ = project; - } - - public void setWebServiceURI(String wsUri) - { - wsUri_ = wsUri; - } - - protected void setShellStyle(int newShellStyle) - { - super.setShellStyle( newShellStyle | SWT.RESIZE ); - } - - protected void configureShell(Shell newShell) - { - newShell.setText(titleText_); - super.configureShell(newShell); - } - - public String getDisplayableSelectionString() { - - return ((WSDLSelectionWidgetWrapper)getWidget()).getObjectSelectionDisplayableString(); - } - - public IStructuredSelection getObjectSelection() { - return ((WSDLSelectionWidgetWrapper)getWidget()).getObjectSelection(); - } - - public String getWebServiceURI() - { - return wsUri_; - } - - public IProject getProject(){ - return project_; - } - - public boolean close() { - setComponentName(((WSDLSelectionWidgetWrapper)getWidget()).getComponentName()); - setProject(((WSDLSelectionWidgetWrapper)getWidget()).getProject()); - setWebServiceURI(((WSDLSelectionWidgetWrapper)getWidget()).getWebServiceURI()); - return super.close(); - } -} 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 861311e67..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060413 135581 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ -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 ); - if (env != null) - { - env.getStatusHandler().reportError(status); - } - return status; - } - } -} 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 28cc163fe..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionTreeWidget.java +++ /dev/null @@ -1,291 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060418 136712 joan@ca.ibm.com - Joan Haggarty - * 20070131 168786 makandre@ca.ibm.com - Andrew Mak, wsdl url on web service wizard page 1 is not reflected in browse dialog - *******************************************************************************/ -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_; - private WebServiceEntity entity_; - - /** - * 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; - if (!tree_.isDisposed()) { - 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() - { - 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() - { - entity_ = getSelectionAsWebServiceEntity(); - if (entity_ == null || entity_.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 73a7abcdd..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070116 159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer - * 20070327 172339 kathy@ca.ibm.com - Kathy Chan - * 20070125 171071 makandre@ca.ibm.com - Andrew Mak, Create public utility method for copying WSDL files - * 20070410 181827 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -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.Path; -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.ws.internal.ui.utils.AdapterUtils; -import org.eclipse.wst.ws.internal.util.UniversalPathTransformer; -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() - { - String uri = ""; - - 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"))) - { - uri = ifile.getFullPath().toString(); - } - } else if (firstSel instanceof ServiceImpl) - { - ServiceImpl serviceImpl = (ServiceImpl)firstSel; - uri = J2EEActionAdapterFactory.getWSDLURI(serviceImpl); - } else if (firstSel instanceof ServiceRef) - { - ServiceRef serviceRef = (ServiceRef)firstSel; - uri = J2EEActionAdapterFactory.getWSDLURI(serviceRef); - } else if (firstSel instanceof WSDLResourceImpl) - { - WSDLResourceImpl wsdlRI = (WSDLResourceImpl)firstSel; - uri = J2EEActionAdapterFactory.getWSDLURI(wsdlRI); - } else if (firstSel instanceof String) - { - uri = (String)firstSel; - } else { - String adaptedUri = AdapterUtils.getAdaptedWSDL(firstSel); - if (adaptedUri != null) { - uri = adaptedUri; - } - } - - uri = UniversalPathTransformer.toPath(uri); - } - return uri; - } - - 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 boolean hasProtocol(String url) { - return url.indexOf(":") != -1; - } - - 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) { - String uri = getWebServiceURI(); - if (hasProtocol(uri)) return null; - return ResourceUtils.getProjectOf(new Path(uri)); - } - else - return ResourceUtils.getProjectOf(resource.getFullPath()); - } 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); - IVirtualComponent comp; - if (resource==null) { - String uri = getWebServiceURI(); - if (hasProtocol(uri)) return null; - comp = ResourceUtils.getComponentOf(new Path(uri)) ; - } - else - 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; - } - -} 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 56a9a6abe..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetWrapper.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060420 135912 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ -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() - { - wsdlSelectionWidget = new WSDLSelectionWidget(); - } - - public WidgetDataEvents addControls(Composite parent, Listener statusListener) - { - 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; - } - - public String getObjectSelectionDisplayableString() { - if (wsdlSelectionWidget != null) - { - return wsdlSelectionWidget.getObjectSelectionDisplayableString(); - } - else return ""; - } - - public IStructuredSelection getObjectSelection() { - return wsdlSelectionWidget.getObjectSelection(); - } - - public boolean validate(String s) - { - return wsdlSelectionWidget.validate(s); - } -} 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 12561b2b8..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WebServiceClientTypeWidget.java +++ /dev/null @@ -1,1052 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060407 135443 joan@ca.ibm.com - Joan Haggarty - * 20060410 135441 joan@ca.ibm.com - Joan Haggarty - * 20060410 136030 kathy@ca.ibm.com - Kathy Chan - * 20060411 136167 kathy@ca.ibm.com - Kathy Chan - * 20060417 136390 joan@ca.ibm.com - Joan Haggarty - * 20060413 135581 rsinha@ca.ibm.com - Rupam Kuehner - * 20060420 136158 rsinha@ca.ibm.com - Rupam Kuehner - * 20060420 136705 rsinha@ca.ibm.com - Rupam Kuehner - * 20060421 136761 rsinha@ca.ibm.com - Rupam Kuehner - * 20060424 138052 kathy@ca.ibm.com - Kathy Chan - * 20060425 137831 rsinha@ca.ibm.com - Rupam Kuehner - * 20060426 137622 joan@ca.ibm.com - Joan Haggarty - * 20060427 138058 joan@ca.ibm.com - Joan Haggarty - * 20060504 138035 joan@ca.ibm.com - Joan Haggarty - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20060607 144826 joan@ca.ibm.com - Joan Haggarty - * 20060607 144049 joan@ca.ibm.com - Joan Haggarty - * 20060614 146270 joan@ca.ibm.com - Joan Haggarty - * 20060717 150577 makandre@ca.ibm.com - Andrew Mak - * 20060726 150865 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060817 140017 makandre@ca.ibm.com - Andrew Mak, longer project or server/runtime strings do not resize wizard - * 20060829 155441 makandre@ca.ibm.com - Andrew Mak, web service wizard hangs during resize - * 20070126 138484 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -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.resource.ImageRegistry; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.common.DefaultingUtils; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ClientRuntimeSelectionWidgetDefaultingCommand; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime.ProjectSelectionWidget; -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.context.ScenarioContext; -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.accessibility.Accessible; -import org.eclipse.swt.accessibility.AccessibleAdapter; -import org.eclipse.swt.accessibility.AccessibleControlAdapter; -import org.eclipse.swt.accessibility.AccessibleControlEvent; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.ControlListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Rectangle; -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.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Scale; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.HyperlinkGroup; -import org.eclipse.ui.forms.HyperlinkSettings; -import org.eclipse.ui.forms.events.HyperlinkEvent; -import org.eclipse.ui.forms.events.IHyperlinkListener; -import org.eclipse.ui.forms.widgets.Hyperlink; -import org.eclipse.wst.command.internal.env.ui.widgets.PageInfo; -import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; -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.WidgetDataEvents; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -public class WebServiceClientTypeWidget extends SimpleWidgetDataContributor implements IPackable -{ - // INFOPOPS - /* CONTEXT_ID WSWSCEN0022 for the Server hyperlink of the Scenario Page */ - private String INFOPOP_WSWSCEN_HYPERLINK_SERVER = "WSWSCEN0022"; - /* CONTEXT_ID WSWSCEN0023 for the Runtime hyperlink of the Scenario Page */ - private String INFOPOP_WSWSCEN_HYPERLINK_RUNTIME = "WSWSCEN0023"; - /* CONTEXT_ID WSWSCEN0024 for theProjects hyperlink of the Scenario Page */ - private String INFOPOP_WSWSCEN_HYPERLINK_PROJECTS = "WSWSCEN0024"; - /* CONTEXT_ID WSWSCEN0025 for theClient Type combo box of the Scenario Page */ - private String INFOPOP_WSWSCEN_COMBO_CLIENTTYPE = "WSWSCEN0025"; - /* CONTEXT_ID WSWSCEN0026 for theClient Slider of the Scenario Page */ - private String INFOPOP_WSWSCEN_SCALE_CLIENT = "WSWSCEN0026"; - - private String GRAPHIC_CLIENT_0="icons/client_test.jpg"; //$NON-NLS-N$ - private String GRAPHIC_CLIENT_1="icons/client_run.jpg"; //$NON-NLS-N$ - private String GRAPHIC_CLIENT_2="icons/client_install.jpg"; //$NON-NLS-N$ - private String GRAPHIC_CLIENT_3="icons/client_deploy.jpg"; //$NON-NLS-N$ - private String GRAPHIC_CLIENT_4="icons/client_assemble.jpg"; //$NON-NLS-N$ - private String GRAPHIC_CLIENT_5="icons/client_develop.jpg"; //$NON-NLS-N$ - private String GRAPHIC_CLIENT_6="icons/client_none.jpg"; //$NON-NLS-N$ - - private String ICON_SCALE_BG_0="icons/scale0_bground.jpg"; //$NON-NLS-N$ - private String ICON_SCALE_BG_1="icons/scale1_bground.jpg"; //$NON-NLS-N$ - private String ICON_SCALE_BG_2="icons/scale2_bground.jpg"; //$NON-NLS-N$ - private String ICON_SCALE_BG_3="icons/scale3_bground.jpg"; //$NON-NLS-N$ - private String ICON_SCALE_BG_4="icons/scale4_bground.jpg"; //$NON-NLS-N$ - private String ICON_SCALE_BG_5="icons/scale5_bground.jpg"; //$NON-NLS-N$ - private String ICON_SCALE_BG_6="icons/scale6_bground.jpg"; //$NON-NLS-N$ - - private Composite clientComposite_; - private Composite hCompClient_; - private Shell shell_; - private Combo clientTypeCombo_; - private Scale clientScale_; - private Label topologySpot_; - private Label clientDetailsLabel_; - private Hyperlink hLinkClientRuntime_; - private Hyperlink hLinkClientServer_; - private Hyperlink hLinkClientProject_; - private Hyperlink hLinkClientEAR_; - private ProjectSelectionDialog projectDialog_; - - private boolean developClient_; - private boolean assembleClient_; - private boolean deployClient_; - - private Boolean testClient_; - private Boolean installClient_; - private Boolean startClient_; - - private TypeRuntimeServer ids_; - private IStructuredSelection objectSelection_; - private boolean enableProxy_; //service scale is set to a level that the client scale can be enabled - private boolean clientOnly_=false; - private int clientScaleSetting_; - private ImageRegistry imageReg_; - private IProject project_; - private WebServicesParser parser_; - private String earProjectName_; - private String projectName_; - private boolean needEar_; - private String clientComponentType_; - - private Listener statusListener_; - private int validationState_; - - private ScaleSelectionListener scaleSelectionListener = new ScaleSelectionListener(); - - private String CLIENT_RUNTIME_PREFIX = ConsumptionUIMessages.LABEL_RUNTIMES_LIST ; - private String CLIENT_SERVER_PREFIX = ConsumptionUIMessages.LABEL_SERVERS_LIST; - private String CLIENT_PROJECT_PREFIX = ConsumptionUIMessages.LABEL_CLIENT_PROJECT; - private String CLIENT_EAR_PREFIX = ConsumptionUIMessages.LABEL_CLIENT_EAR_PROJECT; - - private Composite clientGroupComposite_ ; - - private UIUtils utils_ = new UIUtils("org.eclipse.jst.ws.consumption.ui"); - private IPackable packable_ = null; - private LabelsAndIds labelIds_; - - public WebServiceClientTypeWidget(boolean clientOnly) { - clientOnly_ = clientOnly; - initImageRegistry(); - validationState_ = ValidationUtils.VALIDATE_ALL; - } - - /** - * Give this widget a handle to an IPackable instance, which will also be - * packed when this widget's packIt() is called. - * - * @param packable The IPackable instance. - */ - public void setPackable(IPackable packable) { - packable_ = packable; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.ws.internal.consumption.ui.widgets.IPackable#packIt() - */ - public void packIt() { - clientGroupComposite_.pack(true); - utils_.horizontalResize(clientGroupComposite_.getShell(), clientGroupComposite_, UIUtils.DEFAULT_PADDING); - if (!clientOnly_ && packable_ != null) - packable_.packIt(); - } - - /* (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) - { - statusListener_ = statusListener; - Composite clientTypeComposite = new Composite(parent, SWT.NONE); - GridLayout cclayout = new GridLayout(); - cclayout.numColumns = 2; - cclayout.marginTop=3; - clientTypeComposite.setLayout( cclayout ); - GridData ccGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); - clientTypeComposite.setLayoutData(ccGridData); - - int comboStyle = SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY; - clientTypeCombo_ = utils_.createCombo( clientTypeComposite, - ConsumptionUIMessages.LABEL_WEBSERVICECLIENTTYPE, - ConsumptionUIMessages.TOOLTIP_PWPR_COMBO_CLIENTTYPE, - INFOPOP_WSWSCEN_COMBO_CLIENTTYPE, - comboStyle ); - GridData comboGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); - clientTypeCombo_.setLayoutData(comboGridData); - clientTypeCombo_.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - } - - public void widgetSelected(SelectionEvent e) { - String oldTypeId = ids_.getTypeId(); - int currentSelectionIdx = clientTypeCombo_.getSelectionIndex(); - String currentTypeId = labelIds_.getIds_()[currentSelectionIdx]; - if (!oldTypeId.equals(currentTypeId)) { - // handle changing client type - ids_.setTypeId(currentTypeId); - refreshServerRuntimeSelection(); - } - validationState_ = ValidationUtils.VALIDATE_ALL; - statusListener_.handleEvent(null); - } - - }); - - clientGroupComposite_ = new Composite(parent, SWT.NONE); - GridLayout gclayout = new GridLayout(); - gclayout.numColumns = 2; - gclayout.horizontalSpacing=0; - gclayout.marginHeight=0; - gclayout.marginBottom=5; - clientGroupComposite_.setLayout( gclayout ); - GridData gcGridData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true); - clientGroupComposite_.setLayoutData(gcGridData); - - clientGroupComposite_.addControlListener(new ControlListener() - { - public void controlMoved(ControlEvent e) { - // TODO Auto-generated method stub - - } - public void controlResized(ControlEvent e) { - clientGroupComposite_.pack(true); - } - }); - - - clientComposite_ = new Composite(clientGroupComposite_, SWT.NONE); - GridLayout gridlayout = new GridLayout(); - gridlayout.numColumns = 2; - gridlayout.horizontalSpacing=0; - gridlayout.marginHeight=0; - clientComposite_.setLayout( gridlayout ); - GridData scGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - clientComposite_.setLayoutData(scGridData); - - clientScale_ = new Scale(clientComposite_ , SWT.VERTICAL | SWT.BORDER); - utils_.createInfoPop(clientScale_, INFOPOP_WSWSCEN_SCALE_CLIENT); - clientScale_.setMinimum(0); - clientScale_.setMaximum(6); - clientScale_.setIncrement(1); - clientScale_.addSelectionListener(scaleSelectionListener); - setClientScale(getClientGeneration()); - clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT); - - Accessible accessibleScale = clientScale_.getAccessible(); - accessibleScale.addAccessibleListener(new AccessibleAdapter(){ - // return a string that describes what to do with the slider - // this is read by the screen reader when the slider first gets focus - public void getName(AccessibleEvent e) { - e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT; - } - }); - accessibleScale.addAccessibleControlListener(new AccessibleControlAdapter(){ - // return a meaningful string when the screen reader - // attempts to get the value from the service scale - public void getValue(AccessibleControlEvent e) { - int selection = clientScale_.getSelection(); - switch (selection) { - case 0: - e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_TEST; - break; - case 1: - e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_RUN; - break; - case 2: - e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_INSTALL; - break; - case 3: - e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEPLOY; - break; - case 4: - e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_ASSEMBLE; - break; - case 5: - e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEVELOP; - break; - case 6: - if (clientOnly_) - e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT_ONLY; - else - e.result = ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT; - break; - default: - break; - } - } - }); - - GridData layoutData1 = new GridData(); - layoutData1.horizontalAlignment=SWT.CENTER; - layoutData1.verticalAlignment = SWT.BEGINNING; - Rectangle scaleR = (imageReg_.get(ICON_SCALE_BG_0)).getBounds(); - layoutData1.heightHint=scaleR.height; - layoutData1.widthHint=scaleR.width+1; - clientScale_.setLayoutData(layoutData1); - - topologySpot_ = new Label(clientComposite_ , SWT.CENTER | SWT.BORDER ); - topologySpot_.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); - if (clientOnly_) - topologySpot_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT_ONLY); - else - topologySpot_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT); - - GridData layoutData = new GridData(); - layoutData.verticalAlignment=SWT.BEGINNING; - layoutData.horizontalAlignment=SWT.BEGINNING; - Rectangle topR = (imageReg_.get(GRAPHIC_CLIENT_6)).getBounds(); - layoutData.widthHint=topR.width; - layoutData.heightHint=topR.height; - topologySpot_.setLayoutData(layoutData); - - setGraphics(getClientGeneration()); - - hCompClient_ = utils_.createComposite(clientGroupComposite_, 1); - - clientDetailsLabel_ = new Label(hCompClient_, SWT.NONE); - clientDetailsLabel_.setText(ConsumptionUIMessages.LABEL_SUMMARY); - - hLinkClientServer_= new Hyperlink(hCompClient_, SWT.NULL); - utils_.createInfoPop(hLinkClientServer_, INFOPOP_WSWSCEN_HYPERLINK_SERVER); - hLinkClientServer_.setToolTipText(ConsumptionUIMessages.TOOLTIP_PWRS_TEXT_SERVER); - hLinkClientServer_.addHyperlinkListener(new IHyperlinkListener(){ - public void linkActivated(HyperlinkEvent e){ - launchRuntimeSelectionDialog(true, true); - } - public void linkEntered(HyperlinkEvent e){} - public void linkExited(HyperlinkEvent e){} - }); - - hLinkClientRuntime_ = new Hyperlink(hCompClient_, SWT.NULL); - utils_.createInfoPop(hLinkClientRuntime_, INFOPOP_WSWSCEN_HYPERLINK_RUNTIME); - hLinkClientRuntime_.setToolTipText(ConsumptionUIMessages.TOOLTIP_PWRS_TEXT_RUNTIME); - hLinkClientRuntime_.addHyperlinkListener(new IHyperlinkListener(){ - public void linkActivated(HyperlinkEvent e){ - launchRuntimeSelectionDialog(true); - } - public void linkEntered(HyperlinkEvent e){} - public void linkExited(HyperlinkEvent e){} - }); - - IWorkbench workbench = PlatformUI.getWorkbench(); - projectDialog_ = new ProjectSelectionDialog(workbench.getActiveWorkbenchWindow().getShell(), - new PageInfo(ConsumptionUIMessages.DIALOG_TITILE_CLIENT_PROJECT_SETTINGS, "", - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new ProjectSelectionWidget(true); - } - })); - - hLinkClientProject_ = new Hyperlink(hCompClient_, SWT.NULL); - utils_.createInfoPop(hLinkClientRuntime_, INFOPOP_WSWSCEN_HYPERLINK_PROJECTS); - hLinkClientProject_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_CLIENTPROJECT_LINK); - hLinkClientProject_.addHyperlinkListener(new IHyperlinkListener(){ - public void linkActivated(HyperlinkEvent e){ - launchProjectDialog(); - } - public void linkEntered(HyperlinkEvent e){} - public void linkExited(HyperlinkEvent e){} - }); - - hLinkClientEAR_ = new Hyperlink(hCompClient_, SWT.NULL); - utils_.createInfoPop(hLinkClientRuntime_, INFOPOP_WSWSCEN_HYPERLINK_PROJECTS); - hLinkClientEAR_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_CLIENTPROJECT_LINK); - hLinkClientEAR_.addHyperlinkListener(new IHyperlinkListener(){ - public void linkActivated(HyperlinkEvent e){ - launchProjectDialog(); - } - public void linkEntered(HyperlinkEvent e){} - public void linkExited(HyperlinkEvent e){} - }); - - hLinkClientServer_.setText(CLIENT_SERVER_PREFIX); - hLinkClientRuntime_.setText(CLIENT_RUNTIME_PREFIX); - hLinkClientProject_.setText(CLIENT_PROJECT_PREFIX); - hLinkClientEAR_.setText(CLIENT_EAR_PREFIX); - - HyperlinkGroup serverRuntimeGroup = new HyperlinkGroup(Display.getCurrent()); - serverRuntimeGroup.add(hLinkClientServer_); - serverRuntimeGroup.add(hLinkClientRuntime_); - serverRuntimeGroup.add(hLinkClientProject_); - serverRuntimeGroup.add(hLinkClientEAR_); - serverRuntimeGroup.setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_ALWAYS); - - enableClientSlider(getGenerateProxy()); - - return this; - } - - public void enableClientSlider( boolean enable ) - { - enableProxy_ = enable; - clientScale_.setEnabled(enable); - int selection = getClientGeneration(); - if (enable) - { - setGraphics(selection); - } - else - { - setClientScale(ScenarioContext.WS_NONE); - setGraphics(ScenarioContext.WS_NONE); - clientScale_.setBackgroundImage(null); //override background for disable to grey - } - showSummary(enable && (selection <= ScenarioContext.WS_DEVELOP)); - } - - private void showSummary(boolean show) - { - if (clientOnly_) - show = true; //short circuit to eliminate flicker... - - hLinkClientEAR_.setVisible(show && needEar_); - hLinkClientProject_.setVisible(show); - hLinkClientRuntime_.setVisible(show); - hLinkClientServer_.setVisible(show); - - if (show) - { - clientDetailsLabel_.setText(ConsumptionUIMessages.LABEL_SUMMARY); - } - else - { - if (clientOnly_) - hCompClient_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT_ONLY); - else - hCompClient_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT); - clientDetailsLabel_.setText(ConsumptionUIMessages.LABEL_SUMMARY_NO_CLIENT); - } - clientDetailsLabel_.pack(true); - hLinkClientProject_.pack(true); - hLinkClientEAR_.pack(true); - packIt(); - } - - public void setTypeRuntimeServer( TypeRuntimeServer ids ) - { - LabelsAndIds labelIds = WebServiceRuntimeExtensionUtils2.getClientTypeLabels(); - int selection = 0; - String[] clientIds = labelIds.getIds_(); - String selectedId = ids.getTypeId(); - - labelIds_ = labelIds; - // 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; - - if (ids_ != null) - { - String clientServerText = ""; - String serverId = ids_.getServerId(); - if (serverId != null && serverId.length()>0) - { - clientServerText = WebServiceRuntimeExtensionUtils2.getServerLabelById(serverId); - } - String clientRuntimeText = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(ids_.getRuntimeId()); - - String currentServerText = hLinkClientServer_.getText(); - String currentRuntimeText = hLinkClientRuntime_.getText(); - String newServerText = CLIENT_SERVER_PREFIX + " " + clientServerText; - String newRuntimeText = CLIENT_RUNTIME_PREFIX + " " + clientRuntimeText; - hLinkClientServer_.setText(newServerText); - hLinkClientRuntime_.setText(newRuntimeText); - - /*check to see if text has changed for server or runtime - if so, repaint links */ - if (!newServerText.equals(currentServerText)) - { - hLinkClientServer_.pack(true); - packIt(); - } - - if (!newRuntimeText.equals(currentRuntimeText)) - { - hLinkClientRuntime_.pack(true); - packIt(); - } - } - - if (projectDialog_ != null) - projectDialog_.setTypeRuntimeServer(ids_); - - //When the server changes, the state of needEar could change. - //If the the server change results in a change in the state of needEar, - //update needEar and clientEarProjectName. - - ValidationUtils vu = new ValidationUtils(); - boolean oldNeedEar = getClientNeedEAR(); - boolean clientProjectOrProjectTypeNeedsEar; - - if (!oldNeedEar) { - // If an EAR was not needed previously it could have been because of - // the project/project type or the server. - // If it was because of the project/project type, changing the - // server should have no impact - // on the state of needEar. - clientProjectOrProjectTypeNeedsEar = vu.projectOrProjectTypeNeedsEar(getClientProjectName(), - getClientComponentType()); - } else { - clientProjectOrProjectTypeNeedsEar = true; - } - - // boolean clientProjectOrProjectTypeNeedsEar = - // vu.projectOrProjectTypeNeedsEar(getClientProjectName(), - // getClientComponentType()); - if (clientProjectOrProjectTypeNeedsEar) { - // Could not rule out need for an Ear from the project/project type - // so changing the server - // may impact the need for an Ear. - boolean currentServerNeedsEar = vu.serverNeedsEAR(getTypeRuntimeServer().getServerId()); - if (oldNeedEar != currentServerNeedsEar) { - // Update needEar and serviceEarProjectName. - if (currentServerNeedsEar) { - // Calculate a reasonable default for the Ear project name - String earProjectName = DefaultingUtils.getDefaultEARProjectName(getClientProjectName()); - setClientNeedEAR(currentServerNeedsEar); - setClientEarProjectName(earProjectName); - } else { - setClientNeedEAR(currentServerNeedsEar); - setClientEarProjectName(""); - } - - } - } - } - - public TypeRuntimeServer getTypeRuntimeServer() - { - return ids_; - } - - public boolean getGenerateProxy() - { - return getClientGeneration() <= ScenarioContext.WS_DEVELOP; - } - - public boolean getDevelopClient() { - return developClient_; - } - - public void setDevelopClient(boolean developClient) { - this.developClient_ = developClient; - } - - public boolean getAssembleClient() { - return assembleClient_; - } - - public void setAssembleClient(boolean assembleClient) { - this.assembleClient_ = assembleClient; - } - - public boolean getDeployClient() { - return deployClient_; - } - - public void setDeployClient(boolean deployClient) { - this.deployClient_ = deployClient; - } - - public void setTestClient(Boolean value) - { - testClient_ = value; - } - - public Boolean getTestClient() - { - return testClient_; - } - - public Boolean getInstallClient() - { - return installClient_; - } - - public Boolean getStartClient() - { - return startClient_; - } - - public void setInstallClient( Boolean value ) - { - installClient_ = value; - } - - public void setStartClient( Boolean value ) - { - startClient_ = value; - } - - - private void launchProjectDialog() - { - String currentProjectName = getClientProjectName(); - String currentEarProjectName = getClientEarProjectName(); - String currentProjectType = getClientComponentType(); - boolean currentNeedEar = getClientNeedEAR(); - - projectDialog_.setProjectName(currentProjectName); - projectDialog_.setEarProjectName(currentEarProjectName); - projectDialog_.setNeedEAR(currentNeedEar); - projectDialog_.setProjectComponentType(currentProjectType); - - int status = projectDialog_.open(); - - if (status == Window.OK) - { - String newProjectName = projectDialog_.getProjectName(); - String newEarProjectName = projectDialog_.getEarProjectName(); - String newProjectType = projectDialog_.getProjectComponentType(); - boolean newNeedEar = projectDialog_.getNeedEAR(); - - //Update project settings and validate page if selections changed. - if (!newProjectName.equals(currentProjectName) - || !newEarProjectName.equals(currentEarProjectName) - || !newProjectType.equals(currentProjectType) - || newNeedEar != currentNeedEar) { - setClientProjectName(newProjectName); - setClientEarProjectName(newEarProjectName); - setClientNeedEAR(newNeedEar); - setClientComponentType(newProjectType); - validationState_ = (new ValidationUtils()).getNewValidationState(validationState_, ValidationUtils.VALIDATE_PROJECT_CHANGES); - statusListener_.handleEvent(null); - } - - /*check to see if text has changed for project or EAR - if so, repaint links */ - if (!newProjectName.equals(currentProjectName)) - { - hLinkClientProject_.pack(true); - packIt(); - } - if (!newEarProjectName.equals(currentEarProjectName)) - { - hLinkClientEAR_.pack(true); - packIt(); - } - } - } - - private void launchRuntimeSelectionDialog(boolean clientContext) { - launchRuntimeSelectionDialog(clientContext, false); - } - - private void launchRuntimeSelectionDialog(boolean clientContext, boolean selectServerFirst) - { - TypeRuntimeServer currentClientTRS = getTypeRuntimeServer(); - RuntimeServerSelectionDialog rssd = new RuntimeServerSelectionDialog(shell_, (byte)1, getTypeRuntimeServer(), "14"); - rssd.setSelectServerFirst(selectServerFirst); - int status = rssd.open(); - if (status == Window.OK) - { - TypeRuntimeServer newClientTRS = rssd.getTypeRuntimeServer(); - if (!currentClientTRS.equals(newClientTRS)) - { - setTypeRuntimeServer(rssd.getTypeRuntimeServer()); - validationState_ = (new ValidationUtils()).getNewValidationState(validationState_, ValidationUtils.VALIDATE_SERVER_RUNTIME_CHANGES); - statusListener_.handleEvent(null); //validate the page - } - } - } - - //Private method should be used whenever clientScale_ setting is changed - //instead of calling clientScale_.setSelection directly. - private void setClientScale(int setting) - { - clientScale_.setSelection(setting); - clientScaleSetting_ = setting; - } - - protected void initImageRegistry() - { - imageReg_ = new ImageRegistry(Display.getCurrent()); - - imageReg_.put(ICON_SCALE_BG_0, WebServiceConsumptionUIPlugin - .getImageDescriptor(ICON_SCALE_BG_0)); - imageReg_.put(ICON_SCALE_BG_1, WebServiceConsumptionUIPlugin - .getImageDescriptor(ICON_SCALE_BG_1)); - imageReg_.put(ICON_SCALE_BG_2, WebServiceConsumptionUIPlugin - .getImageDescriptor(ICON_SCALE_BG_2)); - imageReg_.put(ICON_SCALE_BG_3, WebServiceConsumptionUIPlugin - .getImageDescriptor(ICON_SCALE_BG_3)); - imageReg_.put(ICON_SCALE_BG_4, WebServiceConsumptionUIPlugin - .getImageDescriptor(ICON_SCALE_BG_4)); - imageReg_.put(ICON_SCALE_BG_5, WebServiceConsumptionUIPlugin - .getImageDescriptor(ICON_SCALE_BG_5)); - imageReg_.put(ICON_SCALE_BG_6, WebServiceConsumptionUIPlugin - .getImageDescriptor(ICON_SCALE_BG_6)); - - imageReg_.put(GRAPHIC_CLIENT_0, WebServiceConsumptionUIPlugin - .getImageDescriptor(GRAPHIC_CLIENT_0)); - imageReg_.put(GRAPHIC_CLIENT_1, WebServiceConsumptionUIPlugin - .getImageDescriptor(GRAPHIC_CLIENT_1)); - imageReg_.put(GRAPHIC_CLIENT_2, WebServiceConsumptionUIPlugin - .getImageDescriptor(GRAPHIC_CLIENT_2)); - imageReg_.put(GRAPHIC_CLIENT_3, WebServiceConsumptionUIPlugin - .getImageDescriptor(GRAPHIC_CLIENT_3)); - imageReg_.put(GRAPHIC_CLIENT_4, WebServiceConsumptionUIPlugin - .getImageDescriptor(GRAPHIC_CLIENT_4)); - imageReg_.put(GRAPHIC_CLIENT_5, WebServiceConsumptionUIPlugin - .getImageDescriptor(GRAPHIC_CLIENT_5)); - imageReg_.put(GRAPHIC_CLIENT_6, WebServiceConsumptionUIPlugin - .getImageDescriptor(GRAPHIC_CLIENT_6)); - } - - private void setGraphics(int selection) - { - String iconImage = ""; - String topologyImage = ""; - - //TODO: change the hard coded integers here to the the ScenarioContext.WS_xxx when in less critical phase - switch (selection) { - case 0: - iconImage=ICON_SCALE_BG_0; - topologyImage=GRAPHIC_CLIENT_0; - clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_TEST); - break; - case 1: - iconImage=ICON_SCALE_BG_1; - topologyImage=GRAPHIC_CLIENT_1; - clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_RUN); - break; - case 2: - iconImage=ICON_SCALE_BG_2; - topologyImage=GRAPHIC_CLIENT_2; - clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_INSTALL); - break; - case 3: - iconImage=ICON_SCALE_BG_3; - topologyImage=GRAPHIC_CLIENT_3; - clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEPLOY); - break; - case 4: - iconImage=ICON_SCALE_BG_4; - topologyImage=GRAPHIC_CLIENT_4; - clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_ASSEMBLE); - break; - case 5: - iconImage=ICON_SCALE_BG_5; - topologyImage=GRAPHIC_CLIENT_5; - clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEVELOP); - break; - case 6: - if (!clientOnly_) - { - if (enableProxy_) //if service is install run or test... - iconImage=ICON_SCALE_BG_6; - else - iconImage=null; - topologyImage=GRAPHIC_CLIENT_6; - clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_CLIENT); - } - else - { - setClientScale(ScenarioContext.WS_DEVELOP); //"no selection" is not allowed...must develop client @ minimum - iconImage=ICON_SCALE_BG_5; - topologyImage=GRAPHIC_CLIENT_5; - clientScale_.setToolTipText(ConsumptionUIMessages.TOOLTIP_WSWSCEN_SCALE_DEVELOP); - } - break; - default: - break; - } - clientScale_.setBackgroundImage(imageReg_.get(iconImage)); - topologySpot_.setImage(imageReg_.get(topologyImage)); - } - - public IStructuredSelection getObjectSelection() - { - return objectSelection_; - } - - public void setObjectSelection(IStructuredSelection selection) - { - objectSelection_ = selection; - } - - public int getClientGeneration() - { - return clientScaleSetting_; - } - - public void setClientGeneration(int value) - { - if (clientOnly_ && value == ScenarioContext.WS_NONE) { - value = ScenarioContext.WS_DEVELOP; - setDevelopClient(true); - } - - clientScaleSetting_ = value; - setClientScale(value); - - setGraphics(value); - showSummary(value < ScenarioContext.WS_NONE); - } - - public void setProject(IProject project) - { - project_ = project; - } - - public IProject getProject() - { - return project_; - } - - public String getClientRuntimeId() - { - // calculate the most appropriate clientRuntimeId based on current settings. - return WebServiceRuntimeExtensionUtils2.getClientRuntimeId(getTypeRuntimeServer(), getClientProjectName(), getClientComponentType()); - - } - - public void setClientComponentType(String type) - { - clientComponentType_= type; - } - - public String getClientComponentType() - { - return clientComponentType_; - } - - public void setClientProjectName(String name) - { - projectName_ = name; - hLinkClientProject_.setText(CLIENT_PROJECT_PREFIX + " " + projectName_); - hLinkClientProject_.pack(true); - packIt(); - } - - public String getClientProjectName() - { - if (projectName_ == null) - return ""; - return projectName_; - } - - public void setClientEarProjectName(String name) - { - earProjectName_ = name; - refreshEARLink(); - - } - - public void refreshEARLink() - { - hLinkClientEAR_.setVisible(needEar_ && getGenerateProxy()); - if (needEar_) - { - hLinkClientEAR_.setText(CLIENT_EAR_PREFIX + " " + earProjectName_); - hLinkClientEAR_.pack(true); - packIt(); - } - } - - public String getClientEarProjectName() - { - if (earProjectName_ == null) - return ""; - return earProjectName_; - } - - public void setClientNeedEAR(boolean b) - { - needEar_ = b; - refreshEARLink(); - } - - public boolean getClientNeedEAR() - { - return needEar_; - } - - public WebServicesParser getWebServicesParser() - { - return parser_; - } - - public void setWebServicesParser(WebServicesParser parser) - { - parser_ = parser; - } - - //for the purposes of disabling the service implementation controls from the preferences dialog - public void disableNonPreferenceWidgets() - { - if (hCompClient_ != null) - { - hCompClient_.setVisible(false); - } - } - - public int getValidationState() - { - return validationState_; - } - - public void setValidationState(int state) - { - validationState_ = state; - } - - public IStatus checkMissingFieldStatus() { - - ValidationUtils valUtils = new ValidationUtils(); - String runtimeId = getTypeRuntimeServer().getRuntimeId(); - String serverId = getTypeRuntimeServer().getServerId(); - String projectName = getClientProjectName(); - boolean needEar = getClientNeedEAR(); - String earProjectName = getClientEarProjectName(); - String projectTypeId = getClientComponentType(); - IStatus missingFieldStatus = valUtils.checkMissingFieldStatus(validationState_, null, null, runtimeId, serverId, - projectName, needEar, earProjectName, projectTypeId, true); - return missingFieldStatus; - } - - public IStatus checkErrorStatus() { - - ValidationUtils valUtils = new ValidationUtils(); - String runtimeId = getTypeRuntimeServer().getRuntimeId(); - String serverId = getTypeRuntimeServer().getServerId(); - String typeId = getTypeRuntimeServer().getTypeId(); - String projectName = getClientProjectName(); - boolean needEar = getClientNeedEAR(); - String earProjectName = getClientEarProjectName(); - String projectTypeId = getClientComponentType(); - IStatus possibleErrorStatus = valUtils.checkErrorStatus(validationState_, typeId, runtimeId, serverId, - projectName, needEar, earProjectName, projectTypeId, true); - return possibleErrorStatus; - } - - public IStatus checkWarningStatus() { - ValidationUtils valUtils = new ValidationUtils(); - - int scaleSetting = getClientGeneration(); - String serverId = getTypeRuntimeServer().getServerId(); - IStatus warningStatus = valUtils.checkWarningStatus(validationState_, scaleSetting, serverId, true); - return warningStatus; - } - - - private class ScaleSelectionListener implements SelectionListener - { - public void widgetSelected(SelectionEvent e) { - int oldClientScaleSetting = clientScaleSetting_; - - setGraphics(((Scale)e.widget).getSelection()); - - int selection = clientScale_.getSelection(); - setClientGeneration(selection); - - setDevelopClient(selection <= ScenarioContext.WS_DEVELOP); - setAssembleClient(selection <= ScenarioContext.WS_ASSEMBLE); - setDeployClient(selection <= ScenarioContext.WS_DEPLOY); - setTestClient(new Boolean(selection <= ScenarioContext.WS_TEST)); - setInstallClient(new Boolean(selection <= ScenarioContext.WS_INSTALL)); - setStartClient(new Boolean(selection <= ScenarioContext.WS_START)); - - //disable the client settings if the client scenario setting isn't at least "DEVELOP" - boolean generate = selection<=ScenarioContext.WS_DEVELOP; - showSummary(generate); - - - //When client slider moves out of the "WS_NONE" state, VALIDATE_ALL should be done. - //Otherwise, VALIDATE_SCALE_CHANGES is sufficient. - if (oldClientScaleSetting==ScenarioContext.WS_NONE && clientScaleSetting_!=ScenarioContext.WS_NONE) - { - validationState_ = ValidationUtils.VALIDATE_ALL; - } - else - { - validationState_ = (new ValidationUtils()).getNewValidationState(validationState_, ValidationUtils.VALIDATE_SCALE_CHANGES); - } - statusListener_.handleEvent(null); //validate the page - } - - - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } - } - - private void refreshServerRuntimeSelection() - { - //new up ServerRuntimeSelectionWidgetDefaultingCommand - ClientRuntimeSelectionWidgetDefaultingCommand clientRTDefaultCmd = new ClientRuntimeSelectionWidgetDefaultingCommand(); - - //call setters of new defaulting command: - clientRTDefaultCmd.setClientInitialSelection(getObjectSelection()); - clientRTDefaultCmd.setClientInitialProject(getProject()); - clientRTDefaultCmd.setClientTypeRuntimeServer(getTypeRuntimeServer()); - clientRTDefaultCmd.setWebServicesParser(getWebServicesParser()); - clientRTDefaultCmd.setClientEarProjectName(getClientEarProjectName()); - - clientRTDefaultCmd.execute(null, null); - - //perform mappings from the defaulting command to the project settings... - setClientProjectName(clientRTDefaultCmd.getClientProjectName()); - setClientEarProjectName(clientRTDefaultCmd.getClientEarProjectName()); - setClientComponentType(clientRTDefaultCmd.getClientComponentType()); - setTypeRuntimeServer(clientRTDefaultCmd.getClientTypeRuntimeServer()); - setClientNeedEAR(clientRTDefaultCmd.getClientNeedEAR()); - } -} - 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 c8dbb4a43..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java +++ /dev/null @@ -1,469 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner - * 20060204 121605 rsinha@ca.ibm.com - Rupam Kuehner - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060223 129020 rsinha@ca.ibm.com - Rupam Kuehner - * 20060406 135350 kathy@ca.ibm.com - Kathy Chan - * 20060407 135415 rsinha@ca.ibm.com - Rupam Kuehner - * 20060425 138052 kathy@ca.ibm.com - Kathy Chan - * 20060517 141880 pmoogk@ca.ibm.com - Peter Moogk - * 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20060530 144358 kathy@ca.ibm.com - Kathy Chan - * 20060530 141422 kathy@ca.ibm.com - Kathy Chan - * 20060717 146332 makandre@ca.ibm.com - Andrew Mak - * 20060728 145426 kathy@ca.ibm.com - Kathy Chan - * 20060821 153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime - * 20060825 155114 pmoogk@ca.ibm.com - Peter Moogk - * 20070502 180304 gilberta@ca.ibm.com - Gilbert Andrews - * 20071031 140518 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ -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.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.common.ScenarioCleanupCommand; -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.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.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.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) - { - //jvh mapping for initialselection???? - - // 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, "ClientGeneration", ClientWizardWidget.class ); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ResourceContext", ClientWizardWidget.class ); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "DevelopClient", ClientWizardWidget.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "AssembleClient", ClientWizardWidget.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "DeployClient", ClientWizardWidget.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "StartClient", 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); - dataRegistry.addMapping(ClientWizardWidget.class, "ClientProjectName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "DevelopClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "AssembleClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "DeployClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "StartClient", ClientWizardWidgetOutputCommand.class); - - //jvh added.. - dataRegistry.addMapping(ClientWizardWidget.class, "Project", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "WebServicesParser", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "WsdlURI", ClientWizardWidgetOutputCommand.class); - - //jvh - rerouted the defaulting command to the ClientWizardWidget - // Before ClientRuntimeSelectionWidget - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientWizardWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientProjectName", ClientWizardWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientEarProjectName", ClientWizardWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientComponentType", ClientWizardWidget.class); - dataRegistry.addMapping(ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientNeedEAR", ClientWizardWidget.class); - - //jvh - rerouted from ClientWizardWidget instead of runtimeserverwidget- add getters to ClientWizardWidget for them - // After ClientRuntimeSelectionWidget - dataRegistry.addMapping(ClientWizardWidget.class, "ClientTypeRuntimeServer", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "ClientRuntimeId", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "ClientProjectName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "ClientEarProjectName", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "ClientComponentType", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidget.class, "ClientNeedEAR", ClientExtensionDefaultingCommand.class); - - // Before WSDLSelectionWidgetWrapper - // jvh - rerouted these to ClientWizardWidget - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WebServiceURI", ClientWizardWidget.class ); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "Project", ClientWizardWidget.class ); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "ComponentName", ClientWizardWidget.class ); - -/* // After WSDLSelectionWidgetWrapper - //jvh - reroute these from the dialog to ClientWizardWidget - call setters on the other dialogs... - 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); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "ClientRuntimeId",TestDefaultingFragment.class); - - // Before Client Test widget. - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService",FinishTestFragment.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService", ClientTestWidget.class ); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "RunTestClient", FinishTestFragment.class ); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "RunTestClient", 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, "RunTestClient",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, "RunTestClient",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "Methods",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_CLIENT, - new WidgetContributorFactory() - { - public WidgetContributor create() - { - return new ClientWizardWidget(); - } - } ); - - //jvh - /*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(); - } - } );*/ - - //jvh - /*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(true), "" ) ); - add( new SimpleFragment( new WSDLSelectionWidgetDefaultingCommand(), "")); //jvh moved this up - add( new SimpleFragment( new ClientRuntimeSelectionWidgetDefaultingCommand(), "")); //jvh moved this up - add( new SimpleFragment( "ClientWizardWidget" ) ); - //add( new TestCommandFactoryFragment() ); - add( new SimpleFragment( new ClientWizardWidgetOutputCommand(), "" )); - - //add( new TestCommandFactoryFragment2() ); - //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, "RunTestClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "MonitorService", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ResourceContext", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "DevelopClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "AssembleClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "DeployClient", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "StartClient", ClientWizardWidgetOutputCommand.class); - - - // Map ClientWizardWidgetOutputCommand command. - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ResourceContext", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "ClientTypeRuntimeServer", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "InstallClient", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "RunTestClient", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "TestService", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "TestService", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "StartClient", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "DevelopClient", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "AssembleClient", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "DeployClient", ClientExtensionDefaultingCommand.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, "Project", ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialProject", null); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WebServiceURI", ClientRuntimeSelectionWidgetDefaultingCommand.class, "WsdlURI", new EclipseIPath2URLStringTransformer()); - - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "GenWSIL", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WsilURI", ClientExtensionDefaultingCommand.class); - //jvh - rerouted these to the ClientWizardWidgetOutputCommand - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WebServiceURI", ClientWizardWidgetOutputCommand.class, "WsdlURI", new EclipseIPath2URLStringTransformer()); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "Project", ClientWizardWidgetOutputCommand.class); - dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "ComponentName", ClientWizardWidgetOutputCommand.class); - - // WSDLSelectionOutputCommand - //jvh - rerouted these from ClientWizardWidgetOutputCommand - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "WsdlURI", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "WebServicesParser", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "WsdlURI", GetMonitorCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "WebServicesParser", GetMonitorCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "WsdlURI", CheckForServiceProjectCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "WebServicesParser", CheckForServiceProjectCommand.class); - - - //jvh - add code to widget so that the appropriate sets happen and defaulting occurs again after object selection - /*dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "Project", ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialProject", null); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", ClientRuntimeSelectionWidgetDefaultingCommand.class);*/ - - // Setup the PreClientDevelopCommand. - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "DeployClient", PreClientDevelopCommand.class); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "InstallClient", PreClientDevelopCommand.class); - - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "DevelopClient", PreClientDevelopCommand.class); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "AssembleClient", PreClientDevelopCommand.class); - dataRegistry.addMapping( ClientExtensionDefaultingCommand.class, "StartClient", PreClientDevelopCommand.class, "StartService", null); - - - dataRegistry.addMapping( ClientExtensionDefaultingCommand.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, "ProxyBean", 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, "RunTestClient",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, "ProxyEndpoint", GetMonitorCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "CanGenerateProxy", ClientTestFragment.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "CanGenerateProxy", 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 16b3fa8a0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigClientHandlersWidgetBinding.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060517 142339 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -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) { - - // widget - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"HandlerServiceRefHolder", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"IsMultipleSelection", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"GenSkeletonEnabled", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"ServiceRefName", ConfigClientHandlersTableWidget.class); - - // output - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"IsMultipleSelection", ClientHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"ClientProject", ClientHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"HandlerServiceRefHolder", ClientHandlersWidgetOutputCommand.class); - - // gen skeleton - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"HandlerServiceRefHolder", GenerateHandlerSkeletonCommand.class); - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"GenSkeletonEnabled", GenerateHandlerSkeletonCommand.class); - - // open in editor - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"Project", OpenJavaEditorCommand.class); - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"ClassNames", OpenJavaEditorCommand.class); - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"GenSkeletonEnabled", OpenJavaEditorCommand.class,"IsEnabled", null); - - } - - /* - * (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 c7b7c7a90..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigServiceHandlersWidgetBinding.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -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) { - - // widget - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"HandlerDescriptionHolders", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "IsMultipleSelection", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"GenSkeletonEnabled", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"DescriptionName", ConfigServiceHandlersTableWidget.class); - - // output command (adds/removes from model) - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"HandlerDescriptionHolders", ServiceHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "IsMultipleSelection", ServiceHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"WsddResource", ServiceHandlersWidgetOutputCommand.class); - - // gen skeleton command - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"HandlerDescriptionHolders", GenerateHandlerSkeletonCommand.class); - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"GenSkeletonEnabled", GenerateHandlerSkeletonCommand.class); - - // open Java editor - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"Project", OpenJavaEditorCommand.class); - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"ClassNames", OpenJavaEditorCommand.class); - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"GenSkeletonEnabled", OpenJavaEditorCommand.class,"IsEnabled", null); - } - - /* - * (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 53969b4b9..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ConfigureHandlersWidgetBinding.java +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004,2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -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.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 - // widget - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"HandlerServiceRefHolder", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"IsMultipleSelection", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"GenSkeletonEnabled", ConfigClientHandlersTableWidget.class); - dataRegistry.addMapping(ClientHandlersWidgetDefaultingCommand.class,"ServiceRefName", ConfigClientHandlersTableWidget.class); - - // output - - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"HandlerServiceRefHolder", ClientHandlersWidgetOutputCommand.class); - - // gen skeleton - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"HandlerServiceRefHolder", GenerateHandlerSkeletonCommand.class); - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"GenSkeletonEnabled", GenerateHandlerSkeletonCommand.class); - - // open in editor - dataRegistry.addMapping(ConfigClientHandlersTableWidget.class,"GenSkeletonEnabled", OpenJavaEditorCommand.class,"IsEnabled", null); - - - // Map service-side widgets to commands - // widget - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"HandlerDescriptionHolders", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "IsMultipleSelection", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"GenSkeletonEnabled", ConfigServiceHandlersTableWidget.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"DescriptionName", ConfigServiceHandlersTableWidget.class); - - // output command (adds/removes from model) - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"HandlerDescriptionHolders", ServiceHandlersWidgetOutputCommand.class); - - - // gen skeleton command - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"HandlerDescriptionHolders", GenerateHandlerSkeletonCommand.class); - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"GenSkeletonEnabled", GenerateHandlerSkeletonCommand.class); - - // open Java editor - dataRegistry.addMapping(ConfigServiceHandlersTableWidget.class,"GenSkeletonEnabled", OpenJavaEditorCommand.class,"IsEnabled", 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("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,"IsMultipleSelection", ClientHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"Project", OpenJavaEditorCommand.class); - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"ClassNames", OpenJavaEditorCommand.class); - - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class, "IsMultipleSelection", ServiceHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(ServiceHandlersWidgetDefaultingCommand.class,"WsddResource", ServiceHandlersWidgetOutputCommand.class); - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"Project", OpenJavaEditorCommand.class); - dataRegistry.addMapping(GenerateHandlerSkeletonCommand.class,"ClassNames", OpenJavaEditorCommand.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 6f6dab214..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/GenSampleWidgetBinding.java +++ /dev/null @@ -1,414 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20060608 145529 kathy@ca.ibm.com - Kathy Chan - * 20060717 146332 makandre@ca.ibm.com - Andrew Mak - * 20070516 186233 gilberta@ca.ibm.com - Gilbert Andrews - * 20070815 199626 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -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(ClientExtensionDefaultingCommand.class, "RunTestClient", 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, "RunTestClient",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, "RunTestClient",ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientTestWidget.class, "Methods",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()); - clientInfo.setServerCreated(true); - } - 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 boolean getCanGenerateProxy() - { - 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(true), "" ) ); - 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); - dataRegistry.addMapping(ClientWizardWidgetDefaultingCommand.class, "RunTestClient", ClientWizardWidgetOutputCommand.class); - - // Map ClientWizardWidgetOutputCommand command. - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "ClientTypeRuntimeServer", ClientRuntimeSelectionWidgetDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "TestService", ClientExtensionDefaultingCommand.class); - dataRegistry.addMapping(ClientWizardWidgetOutputCommand.class, "RunTestClient", 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, "RunTestClient", 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", ClientExtensionDefaultingCommand.class); - - // Map ClientExtensionOutputCommand command. - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ProxyBean", WebServiceClientTestArrivalCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "ProxyBean", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "GenerateProxy", TestDefaultingFragment.class); - dataRegistry.addMapping(InitializeProxyCommand.class, "CanGenerateProxy", ClientTestFragment.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "GenerateProxy", FinishTestFragment.class); - dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "GenerateProxy", ClientTestDelegateCommand.class); - dataRegistry.addMapping(ClientExtensionOutputCommand.class, "RunTestClient", 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 bd7ef3929..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, 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.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(); - } - } - ); - } -} 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 e95cd41f8..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, 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.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); - } - } - ); - } -} 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 c590291d9..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionDefaultingCommand.java +++ /dev/null @@ -1,619 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20060818 154402 pmoogk@ca.ibm.com - Peter Moogk - * 20060830 151091 kathy@ca.ibm.com - Kathy Chan, Client side still enabled when there's only stub server - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; - -import org.eclipse.core.commands.ExecutionException; -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.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -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.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.server.core.IRuntime; -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 boolean developClient_; - private boolean assembleClient_; - private boolean deployClient_; - - private TypeRuntimeServer clientIds_; - private String clientRuntimeId_; - private Boolean testService; - private Boolean installClient; - private boolean startClient; - private boolean runTestClient; - 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 testProxySelected. - */ - public boolean getRunTestClient() - { - return runTestClient; - } - - /** - * @param testProxySelected - * The testProxySelected to set. - */ - public void setRunTestClient(boolean runTestClient) - { - this.runTestClient = runTestClient; - } - - public boolean getDevelopClient() { - return developClient_; - } - - public void setDevelopClient(boolean developClient) { - this.developClient_ = developClient; - } - - public boolean getAssembleClient() { - return assembleClient_; - } - - public void setAssembleClient(boolean assembleClient) { - this.assembleClient_ = assembleClient; - } - - public boolean getDeployClient() { - return deployClient_; - } - - public void setDeployClient(boolean deployClient) { - this.deployClient_ = deployClient; - } - - /** - * @return Returns the installClient. - */ - public Boolean getInstallClient() - { - return installClient; - } - - /** - * @param installClient - * The installClient to set. - */ - public void setInstallClient(Boolean installClient) - { - this.installClient = installClient; - } - - /** - * @return Returns the startClient. - */ - public boolean getStartClient() - { - return startClient; - } - - /** - * @param startClient - * The startClient to set. - */ - public void setStartClient(boolean startClient) - { - this.startClient = startClient; - } - - /** - * @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) - { - //Popup and error if the selected client project does not exist. - IProject clientProject = ProjectUtilities.getProject(clientProjectName_); - if (!clientProject.exists()) - { - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); - status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_ERROR_NO_SERVER_RUNTIME, new String[]{runtimeLabel } ) ); - env.getStatusHandler().reportError(status); - } - else - { - RuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getRuntimeById(runtimeId); - - if (desc.getServerRequired()) - { - status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER, new String[] { scenario })); - env.getStatusHandler().reportError(status); - } - else - { - // No server has been selected and the selected Web service runtime - // does not - // require a server. Set deploy, install, run, and test to false. - deployClient_ = false; - installClient = Boolean.FALSE; - testService = Boolean.FALSE; - } - } - } - - //If the server is non-null, ensure the server, runtime, and type are compatible - if (serverId != null && serverId.length() > 0) - { - 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); - } - - // Determine if the selected server type has only stub runtimes associated - // with it. - // If so, set install and test to false in the context. - IRuntime nonStubRuntime = ServerUtils.getNonStubRuntime(serverId); - if (nonStubRuntime == null) - { - installClient = Boolean.FALSE; - startClient = false; - testService = Boolean.FALSE; - } - } - - // calculate the most appropriate clientRuntimeId based on current settings. - clientRuntimeId_ = WebServiceRuntimeExtensionUtils2.getClientRuntimeId(clientIds_, clientProjectName_, clientComponentType_); - - return status; - } -} 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 fa05d0520..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, 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.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 50631d4cf..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ClientExtensionOutputCommand.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060728 145426 kathy@ca.ibm.com - Kathy Chan - * 20070502 180304 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ -/** - */ -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 getCanGenerateProxy() - { - return !(webServiceClient_.getWebServiceClientInfo().getImplURL() == null); - } - - /** - * @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(); - } - - /** - * @return Returns the proxyEndpoint. - */ - public String getProxyEndpoint() { - return webServiceClient_.getWebServiceClientInfo().getProxyEndpoint(); - } - - 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 0169b1594..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/extensions/ServerExtensionDefaultingCommand.java +++ /dev/null @@ -1,407 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060529 141422 kathy@ca.ibm.com - Kathy Chan - * 20060823 154938 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.extensions; - -import org.eclipse.core.commands.ExecutionException; -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.common.ServerUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -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.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.server.core.IRuntime; -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 developService_; - private boolean assembleService_; - private boolean deployService_; - - 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(); - } - - public boolean getDevelopService() { - return developService_; - } - - public void setDevelopService(boolean developService) { - this.developService_ = developService; - } - - public boolean getAssembleService() { - return assembleService_; - } - - public void setAssembleService(boolean assembleService) { - this.assembleService_ = assembleService; - } - - public boolean getDeployService() { - return deployService_; - } - - public void setDeployService(boolean deployService) { - this.deployService_ = deployService; - } - - /** - * @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) - { - //Popup and error if the selected service project does not exist. - IProject serviceProject = ProjectUtilities.getProject(serviceProjectName_); - if (!serviceProject.exists()) - { - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(runtimeId); - status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_ERROR_NO_SERVER_RUNTIME, new String[]{ runtimeLabel } ) ); - env.getStatusHandler().reportError(status); - } - else - { - - RuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getRuntimeById(runtimeId); - if (desc.getServerRequired()) - { - status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_NO_SERVER, new String[] { scenario })); - env.getStatusHandler().reportError(status); - } - else - { - // No server has been selected and the selected Web service runtime - // does not require a server. Set deploy, install, run, and test to false. - deployService_ = false; - installService = Boolean.FALSE; - startService = Boolean.FALSE; - testService = Boolean.FALSE; - } - } - } - - //If the server is non-null, ensure the server, runtime, and type are compatible - if (serverId != null && serverId.length() > 0) - { - 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); - } - - // Determine if the selected server type has only stub runtimes associated - // with it. - // If so, set install, run, and test to false in the context. - IRuntime nonStubRuntime = ServerUtils.getNonStubRuntime(serverId); - if (nonStubRuntime == null) - { - installService = Boolean.FALSE; - startService = Boolean.FALSE; - testService = Boolean.FALSE; - } - } - - // calculate the most appropriate clientRuntimeId based on current settings. - serviceRuntimeId_ = WebServiceRuntimeExtensionUtils2.getServiceRuntimeId( serviceIds_, serviceProjectName_, serviceComponentType_); - - return status; - } -} 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 500a49525..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, 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.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 b183cd26e..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, 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.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 805c970f9..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/AbstractObjectSelectionWidget.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060410 135441 joan@ca.ibm.com - Joan Haggarty - * 20060420 135912 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ -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.swt.graphics.Point; -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; - } - - public String getObjectSelectionDisplayableString() - { - // subclass should override this method - return ""; - } - - public Point getWidgetSize() - { - // subclasses should override with an appropriate default dialog size for this widget - return null; - } - - public boolean validate(String s) { - // subclass should override this method - return true; - } - } 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 6306fbb70..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionTransformer.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070116 159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.j2ee.ejb.EnterpriseBean; -import org.eclipse.jst.j2ee.webservice.wsdd.EJBLink; -import org.eclipse.jst.j2ee.webservice.wsdd.PortComponent; -import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean; -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()); - } - else if (sel instanceof ServiceImplBean) - { - return new StructuredSelection(getBeanName((ServiceImplBean) sel)); - } - else if (sel instanceof EJBLink) - { - return new StructuredSelection(getBeanName((EJBLink) sel)); - } - } - return value; - } - - private String getBeanName(ServiceImplBean bean) { - EObject eObject = bean.eContainer(); - if (eObject instanceof PortComponent) { - PortComponent pc = (PortComponent) eObject; - return pc.getPortComponentName(); - } - return ""; - } - - private String getBeanName(EJBLink link) { - EObject eObject = link.eContainer(); - if (eObject instanceof ServiceImplBean) - return getBeanName((ServiceImplBean) eObject); - return ""; - } -} 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 5a7b2d0e2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java +++ /dev/null @@ -1,377 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060329 128069 rsinha@ca.ibm.com - Rupam Kuehner - * 20060418 136180 kathy@ca.ibm.com - Kathy Chan - * 20060524 141194 joan@ca.ibm.com - Joan Haggarty - * 20060825 135570 makandre@ca.ibm.com - Andrew Mak, Service implementation URL not displayed properly on first page - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import java.util.Collections; -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.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.jst.ws.internal.ui.common.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -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.internal.util.ComponentUtilities; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class EJBSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget -{ - - private Combo earList; - private EJBTableViewer beanList; - private IVirtualComponent[] earComponents; - private Integer selectedBeanIndex = null; - private Vector ejbBeanNames; - private Vector ejbComponentNames; - private Vector ejbComponentProjectNames; - private Hashtable ejbValuesByEARSelectionCache; - private Listener statusListener_; - private String displayString_ = ""; - /* 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(); - ejbValuesByEARSelectionCache = new Hashtable(); - } - - 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; - UIUtils utils = new UIUtils(INFOPOP_PEBD_EAR_PROJECTS); - - Composite composite = utils.createComposite(parent, 1, 0, 0); - - Composite projectComposite = utils.createComposite(composite, 2); - 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); - int earListSelectionIndex = widget.getSelectionIndex(); - if (earListSelectionIndex > 0) - { - setBeanList(earComponents[earListSelectionIndex-1]); - } - else - { - setBeanList(null); - } - selectedBeanIndex = null; - statusListener_.handleEvent(null); - } - }); - addEARNamesToList(); - earList.setToolTipText(ConsumptionUIMessages.TOOLTIP_EAR_PROJECTS); - PlatformUI.getWorkbench().getHelpSystem().setHelp(earList, INFOPOP_PEBD_EAR_PROJECTS); - - Group beanComposite = utils.createGroup(composite, ConsumptionUIMessages.LABEL_EJB_BEAN_NAME, "", ""); - beanList = new EJBTableViewer(beanComposite); - Table beanTable = beanList.getTable(); - GridData 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]); - } - else - { - setBeanList(null); - } - - // 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() - { - earList.add(ConsumptionUIMessages.LABEL_SHOW_ALL_STATELESS_SESSION_EJBS); - if (earComponents != null && earComponents.length > 0) - { - for (int index = 0; index < earComponents.length; index++) - { - earList.add(earComponents[index].getName()); - } - earList.setText(earList.getItem(1)); - } - } - - private void setBeanList(IVirtualComponent earComponent) - { - String cacheKey = (earComponent == null)? earList.getItem(0): earComponent.getName(); - - //Check if we've already cached results for this case. If so, use the - //cached values and return. If not, continue. - EJBTableValues cachedValues = (EJBTableValues)ejbValuesByEARSelectionCache.get(cacheKey); - if (cachedValues != null) - { - ejbBeanNames = cachedValues.cachedEjbBeanNames; - ejbComponentNames = cachedValues.cachedEjbComponentNames; - ejbComponentProjectNames = cachedValues.cachdedEjbComponentProjectNames; - beanList.setData(ejbBeanNames, ejbComponentNames); - beanList.setInput(ejbBeanNames); - return; - } - - IVirtualComponent[] ejbComponentsArray = null; - if (earComponent == null) - { - ejbComponentsArray = J2EEUtils.getAllEJBComponents(); - } - else - { - 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); - - //Cache the results for next time - EJBTableValues ejbTableValues = new EJBTableValues(); - ejbTableValues.cachedEjbBeanNames = ejbBeanNames; - ejbTableValues.cachedEjbComponentNames = ejbComponentNames; - ejbTableValues.cachdedEjbComponentProjectNames = ejbComponentProjectNames; - ejbValuesByEARSelectionCache.put(cacheKey, ejbTableValues); - } - - 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(); - } - - } - } - - //Haven't returned yet so we did not find an EAR that contains this EJB. Initialize the page accordingly. - earList.setText(earList.getItem(0)); - setBeanList(null); - beanList.setSelection(new StructuredSelection(new Integer[]{new Integer(ejbBeanNames.indexOf(session.getName()))})); - selectedBeanIndex = new Integer(ejbBeanNames.indexOf(session.getName())); - } - } - else if (object instanceof String) - displayString_ = (String) object; // save for display use - } - } - - public IStructuredSelection getObjectSelection() - { - String selEJBName = (String) ejbBeanNames.get(selectedBeanIndex.intValue()); - if (selEJBName != null) - { - //Get the project containing the bean to get the corresponding Session object. - //Then return the Session object in an IStructuredSelection. - String ejbComponentName = (String) ejbComponentNames.get(selectedBeanIndex.intValue()); - IVirtualComponent ejbComponent = ComponentUtilities.getComponent(ejbComponentName); - EJBArtifactEdit ejbEdit = null; - try - { - ejbEdit = EJBArtifactEdit.getEJBArtifactEditForRead(ejbComponent); - 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(); - } - } - 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 String getObjectSelectionDisplayableString() { - - if (ejbBeanNames == null) - return displayString_; - - int index = selectedBeanIndex == null ? 0 : selectedBeanIndex.intValue(); - String bean = (String) ejbBeanNames.get(index); - return bean == null ? displayString_ : bean; - } - - public IStatus validateSelection(IStructuredSelection objectSelection) - { - return Status.OK_STATUS; - } - - public IStatus getStatus() - { - if (selectedBeanIndex == null) - { - return StatusUtils.errorStatus( "" ); - } - - return Status.OK_STATUS; - } - - public Point getWidgetSize() { - return new Point(450, 350); - } - - private class EJBTableValues - { - Vector cachedEjbBeanNames; - Vector cachedEjbComponentNames; - Vector cachdedEjbComponentProjectNames; - } - -} 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 155b4f04e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBTableViewer.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060524 141194 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ -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}; - int columnsWidth[] = {60, 20}; - int columnMins[] = {175, 125}; - - 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, SWT.NONE, i); - column.setText(columnProperties[i]); - column.pack(); - layout.addColumnData(new ColumnWeightData(columnsWidth[i], columnMins[i], 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; - } - } -} 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 ab80c3818..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/IObjectSelectionWidget.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060410 135441 joan@ca.ibm.com - Joan Haggarty - * 20060420 135912 joan@ca.ibm.com - Joan Haggarty - *******************************************************************************/ -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.swt.graphics.Point; -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(); - - /** - * - * @return returns the string to displayed in the UI for the selected object - */ - public String getObjectSelectionDisplayableString(); - - /** - * - * @return returns the default initial size for the widget to be called from getInitialSize from any parent dialog - */ - public Point getWidgetSize(); - - /** - * - * @param s A string representation of the object selection - * @return true if the string represents a valid object selection - */ - public boolean validate(String s); -} 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 8e76b8884..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionTransformer.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070116 159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer - *******************************************************************************/ -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.emf.ecore.EObject; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean; -import org.eclipse.jst.j2ee.webservice.wsdd.ServletLink; -import org.eclipse.jst.j2ee.webservice.wsdd.internal.impl.PortComponentImpl; -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)); - } - else if (sel instanceof ServiceImplBean) - { - return new StructuredSelection(getBeanName((ServiceImplBean) sel)); - } - else if(sel instanceof ServletLink) - { - return new StructuredSelection(getBeanName((ServletLink) sel)); - } - } - 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; - } - - private String getBeanName(ServiceImplBean bean) { - EObject eObject = bean.eContainer(); - if (eObject instanceof PortComponentImpl) { - PortComponentImpl pci = (PortComponentImpl) eObject; - return pci.getServiceEndpointInterface(); - } - return ""; - } - - private String getBeanName(ServletLink link) { - EObject eObject = link.eContainer(); - if (eObject instanceof ServiceImplBean) - return getBeanName((ServiceImplBean) eObject); - return ""; - } -} 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 b8d401a4d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java +++ /dev/null @@ -1,281 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available 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; - } - - public String getObjectSelectionDisplayableString() { - // TODO Auto-generated method stub - return "Java bean string "; - } -} 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 ec77dc79b..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, 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.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; - } - } - } - } -} 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 5378e11d5..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java +++ /dev/null @@ -1,296 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060830 155114 pmoogk@ca.ibm.com - Peter Moogk, Updated patch for this defect. - * 20070116 159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer - * 20070326 171071 makandre@ca.ibm.com - Andrew Mak, Create public utility method for copying WSDL files - *******************************************************************************/ -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.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -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.util.UniversalPathTransformer; -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_; - - private boolean topDown_ = false; - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - - // Transformation - if (objectSelectionWidgetId_ != null && objectSelectionWidgetId_.length() > 0) - { - Transformer transformer = ObjectSelectionRegistry.getInstance().getTransformer(objectSelectionWidgetId_); - Object transformedSelection = transformer == null ? null : transformer.transform(objectSelection_); - - if (transformedSelection instanceof IStructuredSelection) - { - objectSelection_ = (IStructuredSelection)transformedSelection; - } - } - - // Validation - IStatus status = (objectSelectionWidget_ != null) ? objectSelectionWidget_.validateSelection(getObjectSelection()) : Status.OK_STATUS; - if (status.getSeverity() != Status.OK && env != null) - { - 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"; - topDown_ = true; - } - else - { - objectSelectionWidgetId = wsimpl.getObjectSelectionWidget(); - } - - objectSelectionWidgetId_ = objectSelectionWidgetId; - - Object object = ObjectSelectionRegistry.getInstance().getSelectionWidget(objectSelectionWidgetId_); - - if( object instanceof IObjectSelectionWidget ) - { - objectSelectionWidget_ = (IObjectSelectionWidget)object; - } - } - } - } - - /** - * @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() - { - if (project_ == null && topDown_) - project_ = getProjectFromTransformedSelection(); - return project_; - } - - public void setProject(IProject project) - { - this.project_ = project; - } - - public String getComponentName() - { - if (componentName_ == null && topDown_) - componentName_ = getComponentNameFromTransformedSelection(); - return componentName_; - } - - public void setComponentName(String componentName) - { - this.componentName_ = componentName; - } - - /** - * @return Returns the parser_. - */ - public WebServicesParser getWebServicesParser() - { - return parser_; - } - - private boolean hasProtocol(String url) { - return url.indexOf(":") != -1; - } - - private IResource findResourceFromSelection(Object selection) throws CoreException { - - IResource resource = ResourceUtils.getResourceFromSelection(selection); - - // try finding at least the project using the EMF way - if (resource == null && selection instanceof EObject) - resource = ProjectUtilities.getProject(selection); - - return resource; - } - - private IProject getProjectFromTransformedSelection() { - if (objectSelection_ != null && objectSelection_.size() == 1) - { - Object obj = objectSelection_.getFirstElement(); - if (obj instanceof String) { - String str = UniversalPathTransformer.toPath((String) obj); - if (hasProtocol(str)) return null; - return ResourceUtils.getProjectOf(new Path(str)); - } - } - return null; - } - - private IProject getProjectFromObjectSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = findResourceFromSelection(obj); - if (resource==null) - return null; - if (resource instanceof IProject) - return (IProject) resource; - IProject p = ResourceUtils.getProjectOf(resource.getFullPath()); - return p; - } catch(CoreException e) - { - e.printStackTrace(); - return null; - } - } - } - return null; - } - - private String getComponentNameFromTransformedSelection() { - if (objectSelection_ != null && objectSelection_.size() == 1) - { - Object obj = objectSelection_.getFirstElement(); - if (obj instanceof String) { - String str = UniversalPathTransformer.toPath((String) obj); - if (hasProtocol(str)) return null; - IVirtualComponent comp = ResourceUtils.getComponentOf(new Path(str)); - return comp == null ? null : comp.getName(); - } - } - return null; - } - - private String getComponentNameFromObjectSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = findResourceFromSelection(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; - } -} 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 e6b29184e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionRegistry.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060825 155114 pmoogk@ca.ibm.com - Peter Moogk - * 20060830 155114 pmoogk@ca.ibm.com - Peter Moogk, Updated patch for this defect. - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import java.util.Hashtable; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.IObjectSelectionLaunchable; -import org.eclipse.wst.command.internal.env.core.data.Transformer; - -public class ObjectSelectionRegistry -{ - private static ObjectSelectionRegistry instance; - private IConfigurationElement[] elements; - private Hashtable cachedSelectionWidgets; - - private ObjectSelectionRegistry() - { - elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.jst.ws.consumption.ui", "objectSelectionWidget"); - cachedSelectionWidgets = new Hashtable(); - } - - public static ObjectSelectionRegistry getInstance() - { - if (instance == null) - { - instance = new ObjectSelectionRegistry(); - } - - return instance; - } - - /** - * - * @param id if the selection widget object. - * @return returns the transformer class if has been specified. Otherwise - * null is returned. - */ - public Transformer getTransformer( String id ) - { - TableEntry entry = getTableEntry( id ); - Transformer result = null; - - if( entry != null ) - { - try - { - Object object = entry.element.createExecutableExtension("transformer"); - - if( object instanceof Transformer ) - { - result = (Transformer)object; - } - } - catch( CoreException exc ){} - } - - return result; - } - - /** - * - * @param id if the selection widget object. - * @return returns the value of the external modify attribute if - * it has been specified. Otherwise false is returned. - */ - public boolean getExternalModify( String id ) - { - TableEntry entry = getTableEntry( id ); - boolean result = false; - - if( entry != null ) - { - String modifyString = entry.element.getAttribute("external_modify"); - - result = new Boolean( modifyString ).booleanValue(); - } - - return result; - } - - /** - * Gets the IObjectSelectionWidget based on the selectionId. If one is - * not found null is returned. - * - * @param selectionId the ID of the selection widget. - * @return returns the registered IObjectSelectionWidget object. - */ - public Object getSelectionWidget( String selectionId ) - { - TableEntry entry = getTableEntry( selectionId ); - - return entry == null ? null : entry.objectSelection; - } - - public void cleanup() - { - instance = null; - elements = null; - cachedSelectionWidgets = null; - } - - private TableEntry getTableEntry( String id ) - { - if( id == null ) return null; - - TableEntry entry = (TableEntry)cachedSelectionWidgets.get( id ); - - if( entry == null ) - { - for( int index = 0; index < elements.length; index++ ) - { - IConfigurationElement element = elements[index]; - String elemId = element.getAttribute( "id" ); - - if( id.equals( elemId ) ) - { - try - { - Object object = element.createExecutableExtension("class"); - - if( object instanceof IObjectSelectionWidget || object instanceof IObjectSelectionLaunchable ) - { - entry = new TableEntry(); - entry.element = element; - entry.objectSelection = object; - cachedSelectionWidgets.put( id, entry ); - break; - } - } - catch( CoreException exc ){} - } - } - } - - return entry; - } - - private class TableEntry - { - public IConfigurationElement element; - public Object objectSelection; - } -} 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 1a1a59700..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java +++ /dev/null @@ -1,258 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060224 129387 pmoogk@ca.ibm.com - Peter Moogk - * 20060410 135441 joan@ca.ibm.com - Joan Haggarty - * 20060825 155114 pmoogk@ca.ibm.com - Peter Moogk - * 20061220 161232 makandre@ca.ibm.com - Andrew Mak, AbstractObjectSelectionWidget.setInitialSelection(IStructuredSelection initialSelection) called twice each time Browse pressed - *******************************************************************************/ -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.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.graphics.Point; -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 Composite parent; - private Listener statusListener; - private Composite composite; - private IProject project; - private String componentName; - private IObjectSelectionWidget child; - private Point widgetSize_; - - public WidgetDataEvents addControls(Composite parentComposite, Listener statListener) - { - this.parent = parentComposite; - this.statusListener = statListener; - composite = null; - return this; - } - - public Control getControl(){ - return composite; - } - - /** - * @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(); - } - - Object object = ObjectSelectionRegistry.getInstance().getSelectionWidget( objectSelectionWidgetId ); - - if( object instanceof IObjectSelectionWidget ) - { - child = (IObjectSelectionWidget)object; - } - - if( child != null ) - { - Control shell = parent.getShell(); - 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.addControls(composite, statusListener); - - Point origSize = shell.getSize(); - Point compSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); - int newX = origSize.x; - int newY = origSize.y; - - // Note: we are trying to determine here if the wizard page should - // be resized based on the size of the control that is - // given to us by the extension. The hard coded constants - // below represent the vertical and horizontal pixels that need - // to go around object selection control. Hopefully, a more - // programatic method of doing this can be found in the future. - if( compSize.x + 20 > origSize.x ) - { - newX = compSize.x + 20; - } - - if( compSize.y + 205 > origSize.y ) - { - newY = compSize.y + 205; - } - - widgetSize_ = new Point(newX, newY); - - return; - } - } - } - } - - public IStatus getStatus() - { - return (child != null) ? child.getStatus() : Status.OK_STATUS; - } - - public void setInitialSelection(IStructuredSelection 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; - } - - public String getObjectSelectionDisplayableString() { - return child.getObjectSelectionDisplayableString(); - } - - public Point getWidgetSize() - { - Point childWidgetSize = child.getWidgetSize(); - if (childWidgetSize == null) - return widgetSize_; - return childWidgetSize; - } -} 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 165067d5e..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/Timer.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060803 152486 makandre@ca.ibm.com - Andrew Mak, Typing WSDL in Service definition field is very slow - *******************************************************************************/ -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 final long ONE_SECOND = 1000; - private long refreshTime; - private boolean isRunning = true; - private Display display; - private Runnable runnable; - - private Timer(Display display, Runnable runnable) - { - this.display = display; - this.runnable = runnable; - } - - public synchronized static Timer newInstance(Timer timer, Display display, Runnable runnable) - { - if (!Timer.isRunning(timer)) - return new Timer(display, runnable); - - return timer; - } - - public synchronized static boolean isRunning(Timer timer) - { - return timer != null && timer.isRunning; - } - - 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(); - } - isRunning = false; - display.syncExec(runnable); - } -} 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 177f5dcc0..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ValidationMessageViewerWidget.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060310 131352 pmoogk@ca.ibm.com - Peter Moogk - * 20060411 136134 kathy@ca.ibm.com - Kathy Chan - * 20060420 136221 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -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.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.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_[] = {ConsumptionUIMessages.TABLE_COLUMN_VALIDATION_SEVERITY, - ConsumptionUIMessages.TABLE_COLUMN_VALIDATION_LINE, - ConsumptionUIMessages.TABLE_COLUMN_VALIDATION_COLUMN, - ConsumptionUIMessages.TABLE_COLUMN_VALIDATION_MESSAGE}; - static final int columnsWidth_[] = {12, 10, 10, 60}; - static final int columnMins_[] = {60, 50, 50, 300}; - - - - 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)); - - Text messageLabel = new Text( composite, SWT.READ_ONLY); - 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], columnMins_[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 eff161733..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070116 159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer - * 20070327 172339 kathy@ca.ibm.com - Kathy Chan - * 20070713 191357 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.object; - -import java.net.MalformedURLException; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -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.j2ee.webservice.wsdd.BeanLink; -import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean; -import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription; -import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory; -import org.eclipse.jst.ws.internal.common.J2EEUtils; -import org.eclipse.wst.command.internal.env.core.data.Transformer; -import org.eclipse.wst.ws.internal.ui.utils.AdapterUtils; -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) - { - IStructuredSelection selection = (IStructuredSelection)value; - if (selection != null && !selection.isEmpty()) { - - Object sel = selection.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)); - } - /* - * TODO - Remove the cases below after bug 170834 is fixed - * - * WSDLSelectionTransformer should not need to handle ServiceImplBean and BeanLink which - * represent service classes. These catches are here for now since we incorrectly allow - * the wizard to default to top-down sceanrio when launch from these objects in the JSR-109 - * branch. - */ - else if (sel instanceof ServiceImplBean) - { - return new StructuredSelection(getWSDLURI((ServiceImplBean) sel)); - } - else if (sel instanceof BeanLink) - { - return new StructuredSelection(getWSDLURI((BeanLink) sel)); - } else { - String wsdlURI = AdapterUtils.getAdaptedWSDL(sel); - if (wsdlURI != null) { - return new StructuredSelection(wsdlURI); - } - } - } - } - return value; - } - - private String getWSDLURI(ServiceImplBean bean) { - EObject eObject = bean.eContainer(); - if (eObject == null) - return ""; - - eObject = eObject.eContainer(); - - if (eObject instanceof WebServiceDescription) { - WebServiceDescription wsd = (WebServiceDescription) eObject; - IProject project = ProjectUtilities.getProject(wsd); - - // getWebContentPath returns the "WebContent" folder path for Web projects - // for EJB projects, it returns the "ebjModule" folder path - IPath path = J2EEUtils.getWebContentPath(project); - path = path.append(wsd.getWsdlFile()); - - return path.toString(); - } - return ""; - } - - private String getWSDLURI(BeanLink link) { - EObject eObject = link.eContainer(); - if (eObject instanceof ServiceImplBean) - return getWSDLURI((ServiceImplBean) eObject); - return ""; - } -} 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 2ade0446d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java +++ /dev/null @@ -1,721 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060410 135441 joan@ca.ibm.com - Joan Haggarty - * 20060410 136011 kathy@ca.ibm.com - Kathy Chan - * 20060420 135912 joan@ca.ibm.com - Joan Haggarty - * 20060504 119296 pmoogk@ca.ibm.com - Peter Moogk - * 20060525 142281 joan@ca.ibm.com - Joan Haggarty - * 20060607 144932 kathy@ca.ibm.com - Kathy Chan - * 20060612 145081 pmoogk@ca.ibm.com - Peter Moogk - * 20060719 139977 kathy@ca.ibm.com - Kathy Chan - * 20060803 152701 cbrealey@ca.ibm.com - Chris Brealey - * 20060803 152486 makandre@ca.ibm.com - Andrew Mak, Typing WSDL in Service definition field is very slow - * 20060825 135570 makandre@ca.ibm.com - Andrew Mak, Service implementation URL not displayed properly on first page - * 20060831 155883 makandre@ca.ibm.com - Andrew Mak, service impl field doesn't work after switching from BU to TD - * 20061106 142500 david.schneider@unisys.com - David Schneider, WTP properties pages fonts don't follow Eclipse preferences - * 20061211 161589 makandre@ca.ibm.com - Andrew Mak, NPE in service generation after opening and cancelling from browse dialog - * 20070131 168786 makandre@ca.ibm.com - Andrew Mak, wsdl url on web service wizard page 1 is not reflected in browse dialog - * 20070326 171071 makandre@ca.ibm.com - Andrew Mak, Create public utility method for copying WSDL files - *******************************************************************************/ -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.dialogs.Dialog; -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.TimedWSDLSelectionConditionCommand; -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.graphics.Point; -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.ws.internal.util.UniversalPathTransformer; -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 String wsdlURI_; - - private Composite parent_; - private Listener statusListener_; - private ModifyListener modifyListener_; - private WSDLSelectionTreeWidget tree; - - private Timer timer_ = null; - - /*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_; - - /*CONTEXT_ID PCON0006 for the Stop Wizard WSDL Validation button of the WSDL Selection Page*/ - private Button stopValidationButton_; - private final String INFOPOP_PCON_BUTTON_STOP_VALIDATION = "PCON0006"; - - 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()); - setValidationInProgress(false); - } - }; - - 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 ); - modifyListener_ = - new ModifyListener() - { - public void modifyText(ModifyEvent event) - { - handleWebServiceURIModifyEvent(); - } - }; - - webServiceURI.addModifyListener(modifyListener_); - -// 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(SWT.FILL, SWT.FILL, false, false); - validationSummaryText_.setLayoutData(gd1); - validationSummaryText_.setToolTipText( ConsumptionUIMessages.TOOLTIP_VALIDATE_TEXT_MESSAGE_SUMMARY ); - - validationSummaryText2_ = new Text( parent, SWT.WRAP); - validationSummaryText2_.setEditable(false); - validationSummaryText2_.setLayoutData(gd1); - - stopValidationButton_ = uiUtils.createPushButton(parent, - ConsumptionUIMessages.LABEL_BUTTON_STOP_WSDL_VALIDATION, - ConsumptionUIMessages.TOOLTIP_STOP_VALIDATION_BUTTON, - INFOPOP_PCON_BUTTON_STOP_VALIDATION); - setValidationInProgress(false); - - stopValidationButton_.addSelectionListener( - new SelectionListener() - { - public void widgetDefaultSelected(SelectionEvent event) - { - handleStopValidationButton(); - } - - public void widgetSelected(SelectionEvent event) - { - handleStopValidationButton(); - } - }); - - setMessageSummary(); - Dialog.applyDialogFont(parent); - 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_ = Timer.newInstance(timer_, Display.getCurrent(), this); - timer_.startTimer(); - } - else - handleWebServiceURI(); - statusListener_.handleEvent(null); - } - - private void handleWebServiceURI() { - handleWebServiceURI(webServiceURI.getText()); - } - - private void handleWebServiceURI(String wsURI) - { - if (wsURI.indexOf(':') < 0) - { - IFile file = uri2IFile(wsURI); - if (file != null) - wsURI = iFile2URI(file); - } - if (wsURI != null && wsURI.indexOf(':') >= 0 && webServicesParser.getWebServiceEntityByURI(wsURI) == null) - { - TimedWSDLSelectionConditionCommand cmd = new TimedWSDLSelectionConditionCommand(); - 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(); - wsdlURI_ = wsURI; - } - - 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 ) - { - wsdlURI_ = res.getFullPath().toString(); - webServiceURI.setText( wsdlURI_ ); - } - - statusListener_.handleEvent(null); - } - - private void setValidationInProgress(boolean validating) { - stopValidationButton_.setEnabled(validating); - } - - private void handleStopValidationButton() - { - 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) { - existingValidateWSDLJob.cancel(); - } - } - } - clearValidationMessages(); - setValidationInProgress(false); - } - - private void clearValidationMessages() { - msgViewer_.clearInput(); - validationSummaryText_.setText(" " ); - validationSummaryText2_.setText(" "); - } - - 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 ) { - clearValidationMessages(); - return StatusUtils.errorStatus( ConsumptionUIMessages.PAGE_MSG_INVALID_WEB_SERVICE_URI ); - } - else if( wsPath.indexOf(':') < 0 ) - { - IResource res = ResourceUtils.findResource(wsPath); - if( res == null ) { - clearValidationMessages(); - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.PAGE_MSG_NO_SUCH_FILE, new Object[] {wsPath}) ); - } - else if( res.getType() != IResource.FILE ) { - clearValidationMessages(); - 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(timer_) && tree.isEnabled()) - { - IStatus status = tree.getStatus(); - if (status != null) - { - int severity = status.getSeverity(); - if (severity == Status.ERROR || severity == Status.WARNING) { - clearValidationMessages(); - return status; - } - } - } - else - { - if( wsPath.indexOf(':') < 0 ) - { - String wsdlURI = iFile2URI((IFile)ResourceUtils.findResource(wsPath)); - if (webServicesParser.getWSDLDefinition(wsdlURI) == null) { - clearValidationMessages(); - return StatusUtils.errorStatus(ConsumptionUIMessages.PAGE_MSG_SELECTION_MUST_BE_WSDL ); - } - } - } - - - if (!Timer.isRunning(timer_)) { - String wsdlURI1 = wsPath; - boolean isRemote = true; - if (tree.isEnabled()) { // is wsil - wsdlURI1 = tree.getWsdlURI(); - if (wsdlURI1.startsWith("file:") || wsdlURI1.startsWith("platform:")) - { - isRemote = false; - } - } else { - if (wsPath.indexOf(':') < 0) - { - isRemote = false; - wsdlURI1 = iFile2URI((IFile)ResourceUtils.findResource(wsPath)); - } - else if (wsPath.startsWith("file:") || wsPath.startsWith("platform:")) - { - isRemote = false; - } - } - - setMessageSummary(); - msgViewer_.clearInput(); - 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(); - setValidationInProgress(false); - } else { - startWSDLValidation = false; - } - } - } - } - - if (startWSDLValidation) { - startWSDLValidationJob(wsdlURI); - } - } - return; - } - - private void startWSDLValidationJob (String wsdlURI) { - validateWSDLJob_ = new ValidateWSDLJob(wsdlURI); - validateWSDLJob_.addJobChangeListener( jobChangeAdapter_ ); - validateWSDLJob_.schedule(); - setValidationInProgress(true); - } - - 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); - wsdlURI_ = wsdlURI; - - if (wsdlURI != null && webServiceURI != null) - { - handleWebServiceURI(wsdlURI); - - webServiceURI.removeModifyListener(modifyListener_); - webServiceURI.setText(getObjectSelectionDisplayableString()); - webServiceURI.addModifyListener(modifyListener_); - } - } - } - - 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() - { - StructuredSelection ss; - if (tree != null && tree.getWsdlURI() != null) - ss = new StructuredSelection(tree.getWsdlURI()); - else - ss = new StructuredSelection(wsdlURI_); - return new StructuredSelection( - new WSDLSelectionWrapper( webServicesParser, ss)); - } - - public WebServicesParser getWebServicesParser() - { - return webServicesParser; - } - - public IStatus validateSelection(IStructuredSelection objectSelection) - { - return Status.OK_STATUS; - } - - public IProject getProject() - { - String wsdlURI; - - if (tree != null) - wsdlURI = tree.getWsdlURI(); - else - wsdlURI = wsdlURI_; - - if (wsdlURI != null) - { - IProject p = getProjectFromURI(wsdlURI); - if (p!=null && p.exists()) - return p; - - String wsRelPath = wsdlURI_; - 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; - if (tree != null) - wsdlURI = tree.getWsdlURI(); - else - wsdlURI = wsdlURI_; - - if (wsdlURI != null) - { - String cname = getComponentNameFromURI(wsdlURI); - if (cname!=null && cname.length()>0) - return cname; - - String wsRelPath = wsdlURI_; - 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; - } - - public String getObjectSelectionDisplayableString() - { - if (tree != null) - { - return UniversalPathTransformer.toPath(tree.getWsdlURI()); - } - else - { - return UniversalPathTransformer.toPath(wsdlURI_); - } - } - - public Point getWidgetSize() { - return new Point( 580, 580); - } - - public boolean validate(String s) { - String wsURI = s; - - if (wsURI.indexOf(':') < 0) - { - IFile file = uri2IFile(wsURI); - if (file != null) - wsURI = iFile2URI(file); - } - if (wsURI != null && wsURI.indexOf(':') >= 0 && webServicesParser.getWebServiceEntityByURI(wsURI) == null) - { - TimedWSDLSelectionConditionCommand cmd = new TimedWSDLSelectionConditionCommand(); - cmd.setWebServicesParser(webServicesParser); - cmd.setWebServiceURI(wsURI); - cmd.execute(null, null); - } - - // prime widget based on the string - wsdlURI_ = wsURI; - if (tree != null) - tree.setWebServiceURI(wsURI); - - WebServiceEntity entity = webServicesParser.getWebServiceEntityByURI(wsURI); - if (entity != null && entity.getType() == WebServiceEntity.TYPE_WSDL) - return true; - else - return false; - - } -} 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/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 2f169627d..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java +++ /dev/null @@ -1,1589 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation. and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation. - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070523 158230 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime; - -import java.util.ArrayList; -import java.util.HashSet; -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.common.DefaultingUtils; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.preferences.PersistentServerRuntimeContext; -import org.eclipse.jst.ws.internal.consumption.ui.preferences.ProjectTopologyContext; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.FacetMatchCache; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor; -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.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.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.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 String DEFAULT_CLIENT_EAR_PROJECT_EXT = "EAR"; - 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 initial projects ... - //The difference between clientInitialProject_ and initialProject_ is that - //clientInitialProject_ comes from the ObjectSelectionOutputCommand while initialProject_ - //comes from SelectionCommand (i.e. it is the project containing the thing that was selected before - //the wizard was launched). In the defaulting algorithm, clientInitialProject_ will - //be given first priority. If, however, it is deemed that clientInitialProject_ is not a valid project - //because it contains the J2EE Web service for which we are trying to create a client, initialProject_ - //will be given second priority. - private IProject initialProject_; //This is the project containing the selection prior to the wizard being launched. - private IProject clientInitialProject_; //This is the project containing the object selection from page 2. - private String wsdlURI_; - private WebServicesParser parser_; - - 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_; - } - - /** - * Defaults the following bits of information in the following order: - * clientRuntimeId_ : the clientRuntimeId. Must be defaulted to non-empty String. - * clientIds_.runtimeId_: the Web service runtime id. Must be defaulted to non-empty String. - * clientProjectName_ : the name of the client project. Must be non-empty. May or may not exist. - * clientComponentType_: the id of the client project template. Must be empty if the client - * project exists. Must be non-empty of the client project does not exist. - * clientIds_.serverId_: the server type id. May be an empty String if the defaulted Web service runtime - * does not require a server. - * clientIds_.serverInstanceId_: the server id. May be null or an empty String. - * clientNeedEAR_: true if an EAR is needed. False otherwise. - * clientEarProjectName_: the client EAR project. Must be empty if the clientNeedEAR_ is false. - * Must be non-empty if the clientNeedEAR_ is true. - * webServiceClient_ : the IWebServiceClient based on the calculated defaults. Must be non-null for "Next" - * button to be enabled on the page following this command. - * context_ : an IContext. Must be non-null for "Next" button to be enabled on the page following this command. - */ - public IStatus execute(IProgressMonitor monitor, IAdaptable adaptable) - { - - IEnvironment env = getEnvironment(); - - try - { - - //**Step 1** Default the Web service runtime. - - //clientIdsFixed_ is set to true for the Ant scenario. It's always false for the wizard - //scenarios. - if (clientIdsFixed_ && (clientProjectName_ == null)) - { - // Set the clientRuntime based on the runtime, server, and initial - // selection. - DefaultRuntimeTriplet drt = getDefaultClientRuntimeForFixedRuntimeAndServer(clientInitialProject_); - clientFacetMatcher_ = drt.getFacetMatcher(); - clientProjectName_ = drt.getProjectName(); - clientRuntimeId_ = drt.getRuntimeId(); - } - else - { - ValidationUtils vu = new ValidationUtils(); - - // Set the runtime based on the project containing the object selection/initial selection. - DefaultRuntimeTriplet drt = null; - - if (!vu.isProjectServiceProject(clientInitialProject_, wsdlURI_, parser_) && !clientIdsFixed_) - { - //If clientIntialProject_ does not contain the J2EE Web service, choose a clientRuntime based on it. - drt = getDefaultRuntime(clientInitialProject_, clientIds_.getTypeId(), true); - clientFacetMatcher_ = drt.getFacetMatcher(); - clientProjectName_ = drt.getProjectName(); - clientRuntimeId_ = drt.getRuntimeId(); - } - else - { - //clientInitialProject_ contains the J2EE Web service so don't use it. - //Try using the initalProject_ instead. - if (!vu.isProjectServiceProject(initialProject_, wsdlURI_, parser_) && !clientIdsFixed_) - { - //If intialProject_ does not contain the J2EE Web service, choose a clientRuntime based on it. - drt = getDefaultRuntime(initialProject_, clientIds_.getTypeId(), true); - clientFacetMatcher_ = drt.getFacetMatcher(); - clientProjectName_ = drt.getProjectName(); - clientRuntimeId_ = drt.getRuntimeId(); - } - else - { - //Both clientIntialProject_ and initialProject_ contain the J2EE Web service - //and cannot be used to influence clientRuntime defaulting. - //Choose a clientRuntime but don't choose clientInitialProject_ - //as the clientProject. - drt = getDefaultRuntime(null, clientIds_.getTypeId(), true); - clientRuntimeId_ = drt.getRuntimeId(); - } - } - - //Set the Web service runtime id from the clientRuntime - clientIds_.setRuntimeId(WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_).getRuntime() - .getId()); - } - - //**Step 2** Default the client project if it was not already defaulted - //as part of defaulting the Web service runtime. - if (clientProjectName_ == null) - { - // Project name did not get set when the runtime was set, so set it now - clientProjectName_ = getDefaultClientProjectName(); - } - - //**Step 3** Default the client project type. - IProject clientProject = ProjectUtilities.getProject(clientProjectName_); - if (!clientProject.exists()) - { - // Set the project template - clientComponentType_ = getDefaultClientProjectTemplate(); - } - else - { - //Set it to an empty String - clientComponentType_ = ""; - } - - - //**Step 4** Default the client server if this is not an Ant scenario. - if (!clientIdsFixed_) - { - IStatus serverStatus = setClientDefaultServer(); - if (serverStatus.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(serverStatus); - return serverStatus; - } - } - - //**Step 5** Default clientNeedEAR and client EAR if an EAR is needed - setDefaultClientEarProject(); - - - //**Step 6** Calculate default IWebServiceClient. This is need to make sure that - // Next is enabled on the page following this command. - 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; - } - } - } else { // serverId == null, assume that it does not need EAR - clientNeedEAR_ = false; - - } - } - - if (clientNeedEAR_) - { - clientEarProjectName_ = DefaultingUtils.getDefaultEARProjectName(clientProjectName_); - } - 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 && configuredServers[0].getServerType() != null) - { - 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 && server.getServerType() != 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 && server.getServerType() != 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 if the default Web service - // runtime requires a server. - RuntimeDescriptor runtimeDescriptor = WebServiceRuntimeExtensionUtils2.getRuntimeById(clientIds_.getRuntimeId()); - if (runtimeDescriptor.getServerRequired()) - { - String runtimeLabel = WebServiceRuntimeExtensionUtils2.getRuntimeLabelById(clientIds_.getRuntimeId()); - IStatus status = StatusUtils.errorStatus(NLS.bind(ConsumptionUIMessages.MSG_ERROR_NO_SERVER_RUNTIME, new String[] { - runtimeLabel})); - return status; - } - - return Status.OK_STATUS; - } - - private IServer getServerFromClientRuntimeId() - { - IServer[] servers = ServerCore.getServers(); - if (servers != null && servers.length > 0) { - - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String preferredServerFactoryId = context.getServerFactoryId(); - - //If a server of the preferred server type is present, check that one first - for (int j = 0; j < servers.length; j++) - { - if (servers[j] != null && servers[j].getServerType() != null) - { - String serverFactoryId = servers[j].getServerType().getId(); - if (serverFactoryId == preferredServerFactoryId) - { - if (WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportServer(clientRuntimeId_, serverFactoryId)) - { - return servers[j]; - } - } - } - } - - //A server of the preferred server type could not be found or did not match. Check all the existing servers. - - for (int i = 0; i < servers.length; i++) - { - if (servers[i] != null && servers[i].getServerType() != null) - { - 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) - { - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String preferredServerFactoryId = context.getServerFactoryId(); - - // 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.getPrimaryRuntime(); - } - } catch (CoreException ce) - { - - } - } - - if (fRuntime != null) - { - // Get an existing server that has the same runtime. - IServer firstMatchingServer = null; - IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - for (int i = 0; i < servers.length; i++) - { - IServer thisServer = servers[i]; - IRuntime thisServerRuntime = thisServer.getRuntime(); - if ( thisServerRuntime != null && sRuntime != null && thisServerRuntime.getId().equals(sRuntime.getId())) - { - if (firstMatchingServer==null) - { - firstMatchingServer = thisServer; - } - - if (thisServer != null && thisServer.getServerType() != null && thisServer.getServerType().getId().equals(preferredServerFactoryId)) - { - - server = thisServer; - break; - } - } - } - - //If a server of the preferred server type was not found but - //there was a server that matched, return that one. - if (server == null && firstMatchingServer != null) - { - server = firstMatchingServer; - } - } - - // 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) - { - Set facetsClone = new HashSet(); - facetsClone.addAll(facets); - if (facetMatcher.getFacetsToAdd() != null) - { - Iterator itr = facetMatcher.getFacetsToAdd().iterator(); - while (itr.hasNext()) - { - facetsClone.add(itr.next()); - } - } - server = getServerFromFacets(facetsClone); - } - } - } - } - 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(); - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String preferredServerFactoryId = context.getServerFactoryId(); - - //If one of the servers is of the preferred type, and its runtime - //is in the set of matching runtimes, return that server. - for (int j=0; j<servers.length; j++) - { - IServer thisServer = servers[j]; - if (thisServer != null && thisServer.getServerType() != null && thisServer.getRuntime() != null && thisServer.getServerType().getId().equals(preferredServerFactoryId)) - { - IRuntime thisServerRuntime = thisServer.getRuntime(); - //Check to see if it matches any of the runtimes. - Iterator runtimesItr = runtimes.iterator(); - while(runtimesItr.hasNext()) - { - org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)runtimesItr.next(); - IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - if (sRuntime != null && thisServerRuntime.getId().equals(sRuntime.getId())) - { - server = thisServer; - } - } - } - } - - if (server == null) - { - 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]; - IRuntime thisServerRuntime = thisServer.getRuntime(); - if (thisServerRuntime != null && sRuntime != null && thisServerRuntime.getId().equals(sRuntime.getId())) - { - server = thisServer; - break outer; - } - } - } - } - - return server; - - } - - protected IServerType getServerTypeFromProject(String projectName, FacetMatcher facetMatcher) - { - IServerType serverType = null; - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String preferredServerFactoryId = context.getServerFactoryId(); - - 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.getPrimaryRuntime(); - } - } catch (CoreException ce) - { - - } - } - - if (fRuntime != null) - { - //Get a server type that has the same runtime type. - IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - if (sRuntime != null) - { - IRuntimeType sRuntimeType = sRuntime.getRuntimeType(); - IServerType firstMatchingServerType = null; - for (int i=0; i<serverTypes.length; i++) - { - IServerType thisServerType = serverTypes[i]; - IRuntimeType thisServerRuntimeType = thisServerType.getRuntimeType(); - if (sRuntimeType != null && thisServerRuntimeType != null && thisServerRuntimeType.getId().equals(sRuntimeType.getId())) - { - if (firstMatchingServerType == null) - { - firstMatchingServerType = thisServerType; - } - if (thisServerType.getId().equals(preferredServerFactoryId)) - { - serverType = thisServerType; - break; - } - } - } - - //If the preferred server type was not found but - //there was a server type that matched, return that one. - if (serverType == null && firstMatchingServerType != null) - { - serverType = firstMatchingServerType; - } - } - } - - //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) - { - Set facetsClone = new HashSet(); - facetsClone.addAll(facets); - if (facetMatcher != null && facetMatcher.getFacetsToAdd() != null) - { - Iterator itr = facetMatcher.getFacetsToAdd().iterator(); - while (itr.hasNext()) - { - facetsClone.add(itr.next()); - } - } - serverType = getServerTypeFromFacets(facetsClone); - } - } - } - - 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(); - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String preferredServerFactoryId = context.getServerFactoryId(); - - //If one of the server types is of the preferred type, and its runtime - //is in the set of matching runtimes, return that server type. - for (int j=0; j<serverTypes.length; j++) - { - IServerType thisServerType = serverTypes[j]; - IRuntimeType thisServerTypeRuntimeType = thisServerType.getRuntimeType(); - if (thisServerTypeRuntimeType != null && thisServerType.getId().equals(preferredServerFactoryId)) - { - //Check to see if it matches any of the runtimes. - Iterator runtimesItr = runtimes.iterator(); - while(runtimesItr.hasNext()) - { - org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)runtimesItr.next(); - IRuntime sRuntime = FacetUtil.getRuntime(fRuntime); - if (sRuntime != null) - { - IRuntimeType sRuntimeType = sRuntime.getRuntimeType(); - if (sRuntimeType != null && thisServerTypeRuntimeType.getId().equals(sRuntimeType.getId())) - { - serverType = thisServerType; - } - } - } - } - } - - - if (serverType == null) - { - 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); - if (sRuntime != null) - { - IRuntimeType sRuntimeType = sRuntime.getRuntimeType(); - for (int i = 0; i < serverTypes.length; i++) - { - IServerType thisServerType = serverTypes[i]; - if (thisServerType != null) - { - IRuntimeType thisServerTypeRuntimeType = thisServerType.getRuntimeType(); - if (sRuntimeType != null && thisServerTypeRuntimeType != null && thisServerTypeRuntimeType.getId().equals(sRuntimeType.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()); - - //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])) - { - - boolean matches = WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportTemplate(clientRuntimeId_, templateId); - if (matches) - { - return templates[i]; - } - } - } - } - - //Since the preferredTemplateIds contains the union of all project types for all client runtimes, we are - //guaranteed to have returned by now, so the code below will never be executed under normal - //circumstances. Just return something to satisfy the compiler. - if (templates.length > 0) - return templates[0]; - - return ""; - } - - private String getDefaultClientProjectName() - { - ValidationUtils vu = new ValidationUtils(); - IProject[] projects = FacetUtils.getAllProjects(); - ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId_); - RequiredFacetVersion[] rfvs = desc.getRequiredFacetVersions(); - - //Check each project and its facetRuntime for compatibility with the clientRuntime - for (int i=0; i<projects.length; i++) - { - if (!vu.isProjectServiceProject(projects[i], wsdlURI_, parser_)) - { - Set facetVersions = FacetUtils.getFacetsForProject(projects[i].getName()); - org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = null; - String fRuntimeName = null; - fRuntime = FacetUtils.getFacetRuntimeForProject(projects[i].getName()); - if (fRuntime != null) - { - fRuntimeName = fRuntime.getName(); - } - - if (facetVersions != null) - { - - // FacetMatcher fm = FacetUtils.match(rfvs, facetVersions); - FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(true, clientRuntimeId_, projects[i].getName()); - boolean facetRuntimeMatches = true; - if (fRuntimeName != null) - { - facetRuntimeMatches = FacetUtils.isFacetRuntimeSupported(rfvs, fRuntimeName); - } - - if (fm.isMatch() && facetRuntimeMatches) - { - clientFacetMatcher_ = fm; - return projects[i].getName(); - } - } - } - } - - //No project was suitable, return a new project name - return ResourceUtils.getDefaultWebProjectName(); - - } - - private DefaultRuntimeTriplet 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); - FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(true, clientRuntimes[i], project.getName()); - if (fm.isMatch()) - { - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(fm); - drt.setProjectName(project.getName()); - drt.setRuntimeId(desc.getId()); - return drt; - } - } - } - - } - } - - } - - if (validClientRuntimes.size() > 0) - { - //We couldn't match to the initially selected project so return the first valid runtime. - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(null); - drt.setProjectName(null); - drt.setRuntimeId(((String[])validClientRuntimes.toArray(new String[0]))[0]); - return drt; - } - else - { - //There are no client runtimes that match the fixed runtime and server. Fall back to original algorithm - clientIdsFixed_ = false; - return getDefaultRuntime(project, clientIds_.getTypeId(), true); - } - } - - protected DefaultRuntimeTriplet getDefaultRuntime(IProject project, String typeId, boolean isClient) - { - String[] runtimes = null; - if (isClient) - { - runtimes = WebServiceRuntimeExtensionUtils2.getClientRuntimesByType(typeId); - } - else - { - runtimes = WebServiceRuntimeExtensionUtils2.getServiceRuntimesByServiceType(typeId); - } - - //Split the array of service/client runtimes into one containing the preferred set and one containing the rest. - PersistentServerRuntimeContext context = WebServiceConsumptionUIPlugin.getInstance().getServerRuntimeContext(); - String preferredRuntimeId = context.getRuntimeId(); - ArrayList preferredRuntimeIdsList = new ArrayList(); - ArrayList otherRuntimeIdsList = new ArrayList(); - for (int k=0; k<runtimes.length; k++ ) - { - String descRuntimeId = null; - if (isClient) - { - ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(runtimes[k]); - descRuntimeId = desc.getRuntime().getId(); - } - else - { - ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(runtimes[k]); - descRuntimeId = desc.getRuntime().getId(); - } - - if (descRuntimeId.equals(preferredRuntimeId)) - { - preferredRuntimeIdsList.add(runtimes[k]); - } - else - { - otherRuntimeIdsList.add(runtimes[k]); - } - } - String[] preferredRuntimeIds = (String[])preferredRuntimeIdsList.toArray(new String[0]); - String[] otherRuntimeIds = (String[])otherRuntimeIdsList.toArray(new String[0]); - - Set facetVersions = null; - org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = null; - String fRuntimeName = null; - - //If the initially selected project exists and facets can be inferred from it, look for - //a service/client runtime that matches the project's facets and also, if possible, its facet runtime. - //Preference should be given to the preferred service/client runtimes. - if (project != null && project.exists()) - { - facetVersions = FacetUtils.getFacetsForProject(project.getName()); - fRuntime = FacetUtils.getFacetRuntimeForProject(project.getName()); - fRuntimeName = null; - if (fRuntime != null) - { - fRuntimeName = fRuntime.getName(); - } - - if (facetVersions != null) - { - //1. First check to see if one of the preferred service/client runtimes matches the existing - //project's facets and runtime. - for (int p = 0; p < preferredRuntimeIds.length; p++) - { - RequiredFacetVersion[] prfv = null; - if (isClient) - { - prfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(preferredRuntimeIds[p]).getRequiredFacetVersions(); - } - else - { - prfv = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(preferredRuntimeIds[p]).getRequiredFacetVersions(); - } - - //FacetMatcher fm = FacetUtils.match(prfv, facetVersions); - FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(isClient, preferredRuntimeIds[p], project.getName()); - boolean facetRuntimeMatches = true; - if (fRuntimeName != null) - { - facetRuntimeMatches = FacetUtils.isFacetRuntimeSupported(prfv, fRuntimeName); - } - - if (fm.isMatch() && facetRuntimeMatches) - { - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(fm); - drt.setProjectName(project.getName()); - drt.setRuntimeId(preferredRuntimeIds[p]); - return drt; - } - } - - //2. Second, check to see if one of the other clientRuntimes matches the existing - //project's facets and runtime. - for (int i=0; i<otherRuntimeIds.length; i++) - { - RequiredFacetVersion[] rfv = null; - if (isClient) - { - rfv = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(otherRuntimeIds[i]).getRequiredFacetVersions(); - } - else - { - rfv = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(otherRuntimeIds[i]).getRequiredFacetVersions(); - } - - FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(isClient, otherRuntimeIds[i], project.getName()); - boolean facetRuntimeMatches = true; - if (fRuntimeName != null) - { - facetRuntimeMatches = FacetUtils.isFacetRuntimeSupported(rfv, fRuntimeName); - } - if (fm.isMatch() && facetRuntimeMatches) - { - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(fm); - drt.setProjectName(project.getName()); - drt.setRuntimeId(otherRuntimeIds[i]); - return drt; - } - } - - //3. Third, check to see if one of the preferred clientRuntimes matches the existing - //project's facets. - for (int p = 0; p < preferredRuntimeIds.length; p++) - { - FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(isClient, preferredRuntimeIds[p], project.getName()); - if (fm.isMatch()) - { - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(fm); - drt.setProjectName(project.getName()); - drt.setRuntimeId(preferredRuntimeIds[p]); - return drt; - } - } - - //4. Fourth, check to see if the one the other clientRuntimes matches the existing - //project's facets. - for (int i=0; i<otherRuntimeIds.length; i++) - { - FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(isClient, otherRuntimeIds[i], project.getName()); - if (fm.isMatch()) - { - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(fm); - drt.setProjectName(project.getName()); - drt.setRuntimeId(otherRuntimeIds[i]); - return drt; - } - } - } - } - - //Haven't returned yet so this means that the intitially selected project cannot be used - //to influence the selection of the service/client runtime. - - //Use the preferred project types to influence the selection of a runtime. - ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - String[] preferredTemplateIds = null; - if (isClient) - { - preferredTemplateIds = ptc.getClientTypes(); - } - else - { - preferredTemplateIds = ptc.getServiceTypes(); - } - - - for (int n=0; n<preferredTemplateIds.length; n++) - { - String preferredTemplateId = preferredTemplateIds[n]; - - for (int m=0; m<preferredRuntimeIds.length; m++) - { - //If this client or service runtime supports this template, choose it and exit. - boolean matches = false; - if (isClient) - { - matches = WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportTemplate(preferredRuntimeIds[m], preferredTemplateId); - } - else - { - matches = WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportTemplate(preferredRuntimeIds[m], preferredTemplateId); - } - - if (matches) - { - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(null); - //If the project doesn't exist, use the name of the project that was passed in. - //If the project exists, it means that previous code in this method - //determined it to not be a suitable project. Clear the project name. - if (project==null || project.exists()) - { - drt.setProjectName(null); - } - else - { - drt.setProjectName(project.getName()); - } - drt.setRuntimeId(preferredRuntimeIds[m]); - return drt; - } - } - } - - - //Still haven't returned. Return the first preferred service/client runtime id. - if (preferredRuntimeIds.length > 0) - { - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(null); - //If the project doesn't exist, use the name of the project that was passed in. - //If the project exists, it means that previous code in this method - //determined it to not be a suitable project. Clear the project name. - if (project==null || project.exists()) - { - drt.setProjectName(null); - } - else - { - drt.setProjectName(project.getName()); - } - drt.setRuntimeId(preferredRuntimeIds[0]); - return drt; - } - - if (runtimes.length > 0) - { - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(null); - //If the project doesn't exist, use the name of the project that was passed in. - //If the project exists, it means that previous code in this method - //determined it to not be a suitable project. Clear the project name. - if (project==null || project.exists()) - { - drt.setProjectName(null); - } - else - { - drt.setProjectName(project.getName()); - } - drt.setRuntimeId(runtimes[0]); - return drt; - } - else - { - DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet(); - drt.setFacetMatcher(null); - //If the project doesn't exist, use the name of the project that was passed in. - //If the project exists, it means that previous code in this method - //determined it to not be a suitable project. Clear the project name. - if (project==null || project.exists()) - { - drt.setProjectName(null); - } - else - { - drt.setProjectName(project.getName()); - } - drt.setRuntimeId(null); - return drt; - } - } - /** - * - * @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; - } - - - - /* - * Set defaults for the client-side from the service-side if possible. - * Sets clientProjectName_ to a value based on the service project name. - * - * Returns an IStatus.OK if the service side values for server and Web - * service runtime can be used to set the values for clientRuntimeId_, - * clientComponentType_, all the values in clientIds_, and clientEarProjectName_. - * - * Returns an IStatus.ERROR otherwise, leaving only the clientProjectName_ set. - */ - protected IStatus defaultClientSideFromServiceSide(String serviceProjectName, TypeRuntimeServer serviceIds, boolean serviceNeedEAR, String serviceEarProjectName) - { - //1. Start with setting the default client project name based on the service project name. - boolean isEJB = false; - String implId = WebServiceRuntimeExtensionUtils2.getWebServiceImplIdFromTypeId(serviceIds.getTypeId()); - isEJB = (implId.equals("org.eclipse.jst.ws.wsImpl.ejb")); - String[] updatedNames = ResourceUtils.getClientProjectComponentName(serviceProjectName, serviceProjectName, isEJB); - clientProjectName_ = updatedNames[0]; - - //2. Ideally, the server and runtime on the client-side will be defaulted - // to the same values as the service side. If a client runtime id that - // supports clientProjectName_ and the service-side server and runtime defaults - // can be found, choose it. - IProject clientProject = ProjectUtilities.getProject(clientProjectName_); - TypeRuntimeServer testIds = new TypeRuntimeServer(); - testIds.setTypeId(clientIds_.getTypeId()); - testIds.setRuntimeId(serviceIds.getRuntimeId()); - testIds.setServerId(serviceIds.getServerId()); - testIds.setServerInstanceId(serviceIds.getServerInstanceId()); - - if (clientProject.exists()) - { - clientComponentType_ = ""; - clientRuntimeId_ = WebServiceRuntimeExtensionUtils2.getClientRuntimeId(testIds, serviceProjectName, clientComponentType_); - if (clientRuntimeId_ != null && clientRuntimeId_.length()>0) - { - clientIds_.setRuntimeId(serviceIds.getRuntimeId()); - clientIds_.setServerId(serviceIds.getServerId()); - clientIds_.setServerInstanceId(serviceIds.getServerInstanceId()); - } - } - else - { - //See if there is a client project type that supports the service-side - //server and runtime defaults. Pick a client project type based on project topology preferences. - //Choose the clientRuntimeId_ accordingly. - String[] templateIds = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(clientIds_.getTypeId(), testIds.getRuntimeId()); - if (templateIds != null && templateIds.length > 0) - { - 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(testIds, clientProjectName_, - templateId); - if (newClientRuntimeId.length() > 0) - { - clientRuntimeId_ = newClientRuntimeId; - clientComponentType_ = templateId; - clientIds_.setRuntimeId(serviceIds.getRuntimeId()); - clientIds_.setServerId(serviceIds.getServerId()); - clientIds_.setServerInstanceId(serviceIds.getServerInstanceId()); - break outer; - } - } - } - } - } - } - - //3. If step 2 was successful, clientRuntimeId_ should now be set, along with clientProjectName_, - // clientComponentType_, and all the values in clientIds_. All that remains is setting the EAR. - if (clientRuntimeId_ != null && clientRuntimeId_.length()>0) - { - setDefaultClientEarProject(); - //Update the client side EAR from the service side EAR if necessary. - if (serviceNeedEAR) - { - defaultClientEarFromServiceEar(serviceProjectName, serviceEarProjectName); - } - return Status.OK_STATUS; - } - else - { - //Step 2 was not successful. Client side defaulting cannot be done using the service side server - //and web service runtime defaults. Return an error status. - return StatusUtils.errorStatus(""); - } - } - - protected void defaultClientEarFromServiceEar(String serviceProjectName, String serviceEarProjectName) - { - //Client side - if (clientNeedEAR_) - { - IProject clientProject = ProjectUtilities.getProject(clientProjectName_); - if(clientProject==null || !clientProject.exists() - || !(clientEarProjectName_.equalsIgnoreCase(serviceEarProjectName))) - { - ProjectTopologyContext ptc= WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - if (!ptc.isUseTwoEARs()) - { - clientEarProjectName_ = serviceEarProjectName; - } - else - { - IProject proxyEARProject = getUniqueClientEAR(clientEarProjectName_, serviceEarProjectName, clientProjectName_, serviceProjectName); - clientEarProjectName_ = proxyEARProject.getName(); - } - } - } - - } - - private IProject getUniqueClientEAR(String earProjectName, String serviceEARProject, String clientProjectName, String serviceProjectName) { - - String projectName = new String(); - //If the client project doesn't exist and the service project does, ensure the - //the client side EAR's J2EE level is such that the service project could be added to it. - //This will ensure we don't default the page with a client project EAR at a lower - //J2EE level than the service side. - boolean goodJ2EELevel = true; - if (!earProjectName.equalsIgnoreCase(serviceEARProject)) - { - IProject clientProject = ProjectUtilities.getProject(clientProjectName); - IProject serviceProject = ProjectUtilities.getProject(serviceProjectName); - IProject earProject = ProjectUtilities.getProject(earProjectName); - if (!clientProject.exists() && serviceProject.exists()) - { - IStatus associationStatus = J2EEUtils.canAssociateProjectToEAR(serviceProject, earProject); - goodJ2EELevel = (associationStatus.getSeverity() == IStatus.OK); - } - } - - if (!earProjectName.equalsIgnoreCase(serviceEARProject) && goodJ2EELevel) { - projectName = earProjectName; - } - else { - projectName = clientProjectName+DEFAULT_CLIENT_EAR_PROJECT_EXT; - int i=1; - while (projectName.equalsIgnoreCase(serviceEARProject)) { - projectName = projectName+i; - i++; - } - } - return projectName.equals("") ? null : ResourceUtils.getWorkspaceRoot().getProject(projectName); - - } - - 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); - } - } - - // This is for the Ant scenario where the client project name can be set in the property file. - // If the user has set the ClientProjectName use it for defaulting purposes - public void setClientProjectName(String name) - { - clientProjectName_ = name; - } - - public void setClientInitialProject(IProject clientInitialProject) - { - clientInitialProject_ = clientInitialProject; - } - - /** - * @param initialInitialSelection_ The initialInitialSelection_ to set. - */ - public void setInitialInitialSelection(IStructuredSelection initialInitialSelection) - { - initialProject_ = getProjectFromInitialSelection(initialInitialSelection); - } - - public boolean getClientNeedEAR() - { - return clientNeedEAR_; - } - - /** - * @param parser_ The parser_ to set. - */ - public void setWebServicesParser(WebServicesParser parser) { - parser_ = parser; - } - - public void setWsdlURI(String wsdlURI) - { - wsdlURI_ = wsdlURI; - } - - public void setTestService(boolean testService) - { - test_ = testService; - } - - public void setResourceContext( ResourceContext resourceContext ) - { - resourceContext_ = resourceContext; - } - - private IProject getProjectFromInitialSelection(IStructuredSelection selection) - { - if (selection != null && selection.size() == 1) - { - Object obj = selection.getFirstElement(); - if (obj != null) - { - try - { - IResource resource = ResourceUtils.getResourceFromSelection(obj); - if (resource==null) - return null; - IProject p = ResourceUtils.getProjectOf(resource.getFullPath()); - return p; - } catch(CoreException e) - { - return null; - } - } - } - return null; - } - - 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]); - - } - - protected class FacetRuntimeMatcher - { - FacetMatcher facetMatcher; - boolean runtimeMatches; - - public FacetMatcher getFacetMatcher() - { - return facetMatcher; - } - public void setFacetMatcher(FacetMatcher facetMatcher) - { - this.facetMatcher = facetMatcher; - } - public boolean isRuntimeMatches() - { - return runtimeMatches; - } - public void setRuntimeMatches(boolean runtimeMatches) - { - this.runtimeMatches = runtimeMatches; - } - } - - protected class DefaultRuntimeTriplet - { - FacetMatcher facetMatcher_; - String projectName_; - String runtimeId_; - - - public DefaultRuntimeTriplet() - { - } - - public FacetMatcher getFacetMatcher() - { - return facetMatcher_; - } - public void setFacetMatcher(FacetMatcher facetMatcher_) - { - this.facetMatcher_ = facetMatcher_; - } - public String getProjectName() - { - return projectName_; - } - public void setProjectName(String projectName_) - { - this.projectName_ = projectName_; - } - public String getRuntimeId() - { - return runtimeId_; - } - public void setRuntimeId(String runtimeId_) - { - this.runtimeId_ = runtimeId_; - } - } -} 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 dac452a78..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java +++ /dev/null @@ -1,614 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060204 124143 rsinha@ca.ibm.com - Rupam Kuehner - * 20060221 122661 rsinha@ca.ibm.com - Rupam Kuehner - * 20060223 129020 rsinha@ca.ibm.com - Rupam Kuehner - * 20060227 124392 rsinha@ca.ibm.com - Rupam Kuehner - * 20060413 135581 rsinha@ca.ibm.com - Rupam Kuehner - * 20060427 138058 joan@ca.ibm.com - Joan Haggarty - * 20060510 140868 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060524 141024 joan@ca.ibm.com - Joan Haggarty - * 20060829 145449 makandre@ca.ibm.com - Andrew Mak, Web service client project type dropdown disabled after selecting client project - *******************************************************************************/ -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.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.common.DefaultingUtils; -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 Composite parent_; - 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) { - - parent_ = parent; - UIUtils uiUtils = new UIUtils(pluginId_); - - statusListener_ = statusListener; - - if (isClient_) - { - moduleProject_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_CLIENT_PROJECT, ConsumptionUIMessages.LABEL_CLIENT_PROJECT, INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - projectType_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_CLIENT_TYPE, ConsumptionUIMessages.TOOLTIP_PWCR_COMBO_CLIENT_TYPE, INFOPOP_PWRS_COMBO_CLIENT_PROJECT_TYPE, SWT.SINGLE | SWT.BORDER |SWT.READ_ONLY); - earProject_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_CLIENT_EAR_PROJECT, ConsumptionUIMessages.LABEL_CLIENT_EAR_PROJECT, INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - } - else - { - moduleProject_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_SERVICE_PROJECT, ConsumptionUIMessages.LABEL_SERVICE_PROJECT, INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - projectType_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_SERVICE_TYPE, ConsumptionUIMessages.TOOLTIP_PWCR_COMBO_SERVICE_TYPE, INFOPOP_PWRS_COMBO_SERVICE_PROJECT_TYPE, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); - earProject_ = uiUtils.createCombo(parent, ConsumptionUIMessages.LABEL_SERVICE_EAR_PROJECT, ConsumptionUIMessages.LABEL_SERVICE_EAR_PROJECT, INFOPOP_PWRS_COMBO_PROJECT, SWT.SINGLE | SWT.BORDER ); - } - - //Temporarily remove the listeners - - projectTypeListener_ = new ModifyListener() - { - public void modifyText(ModifyEvent evt) - { - handleProjectTypeChanged(); - 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_ ); - } - - public String getProjectName() - { - return moduleProject_.getText(); - } - - public void setProjectName( String name ) - { - listenersOff(); - moduleProject_.setText( name ); - handleProjectChanged(); - updateEARState(); - 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(""); - - handleProjectTypeChanged(); - 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; - if (earProject_ != null) - { - 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(); - updateEARState(); - 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 handleProjectTypeChanged() - { - updateEARState(); - } - - private void handleProjectChanged() - { - 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_.deselectAll(); - } - else - { - populateProjectTypeCombo(); - projectType_.setEnabled(true); - } - } - } - - private void populateProjectTypeCombo() - { - //Get the old value if there was one. - String oldTemplateId = getComponentType(); - - String[] templates = null; - if (trsIds_ != 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 - { - // Select the preferred client project type. - ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); - String[] preferredTemplateIds = null; - if (isClient_) - { - preferredTemplateIds = ptc.getClientTypes(); - } - else - { - preferredTemplateIds = ptc.getServiceTypes(); - } - - 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); - } - } - } - } - } - - - 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 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(); - setEarProjectItems(); - - String earName = DefaultingUtils.getDefaultEARProjectName(moduleProject_.getText()); - earProject_.setText(earName); - } - - private boolean projectNeedsEAR(String projectName) - { - //If the project is a simple Java project or the project type is - //Java utility return false. - if (projectName != null && projectName.length()>0) - { - IProject project = ProjectUtilities.getProject(projectName); - if (project.exists()) - { - if (FacetUtils.isJavaProject(project)) - { - return false; - } - } - } - - //Project didn't rule out the need for an EAR - //so check the proect type - String templateId = getComponentType(); - if (templateId != null && templateId.length()>0) - { - if (FacetUtils.isUtilityTemplate(templateId)) - { - return false; - } - } - - - //Project or project type didn't rule out the need for an EAR - //so check 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)); - } - parent_.layout(); //force message area resize/wrap - } - 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[]{""} ) ); - } - } - - //If the project and EAR both exist and the project is not already associated with the EAR, ensure - //they can be associated. - if (needEAR_) - { - IProject p = ProjectUtilities.getProject(projectText.trim()); - IProject ep = ProjectUtilities.getProject(earText.trim()); - if (p.exists() && ep.exists()) - { - if (!J2EEUtils.isComponentAssociated(ep,p)) - { - IStatus associateStatus = J2EEUtils.canAssociateProjectToEAR(p, ep); - if (associateStatus.getSeverity() == IStatus.ERROR) - { - if (isClient_) - { - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_CLIENT_CANNOT_ASSOCIATE, new String[]{p.getName(), ep.getName(), associateStatus.getMessage()} ) ); - } - else - { - return StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_SERVICE_CANNOT_ASSOCIATE, new String[]{p.getName(), ep.getName(), associateStatus.getMessage()} ) ); - } - } - } - } - } - - return finalStatus; - } -} 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 271982326..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestDelegateCommand.java +++ /dev/null @@ -1,355 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews - * 20060608 145529 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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 boolean runTestClient; - 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; - } - - testInfo.setRunTestClient(runTestClient); - - 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 setRunTestClient(boolean runTestClient) - { - this.runTestClient = runTestClient; - } - - 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 08638af05..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestFragment.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060727 144354 kathy@ca.ibm.com - Kathy Chan - * 20070502 180304 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ -/** - */ -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; // This actually represent whether client test is requested - private boolean launchedTest = false; - private boolean canGenProxy; - - public ClientTestFragment( String id ) - { - SequenceFragment clientTestRoot = new SequenceFragment(); - Condition condition = new Condition() - { - public boolean evaluate() - { - return testService && genProxy; - } - }; - setCondition( condition ); - - - Condition jspCondition = new Condition() - { - public boolean evaluate() - { - return canGenProxy; - } - }; - - SimpleFragment simpleJSPFragment = new SimpleFragment( new WebServiceClientTestArrivalCommand(), "" ); - BooleanFragment choiceJSPFragment = new BooleanFragment(); - choiceJSPFragment.setTrueFragment(simpleJSPFragment); - choiceJSPFragment.setCondition(jspCondition); - clientTestRoot.add(choiceJSPFragment); - - clientTestRoot.add( new SimpleFragment( id ) ); - setTrueFragment( clientTestRoot ); - - } - - public void setGenerateProxy( boolean genProxy ) - { - this.genProxy = genProxy; - } - - public void setCanGenerateProxy( boolean canGenProxy ) - { - this.canGenProxy = canGenProxy; - } - - 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 6b579d3ba..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/ClientTestWidget.java +++ /dev/null @@ -1,480 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews - * 20060815 104870 makandre@ca.ibm.com - Andrew Mak, enable/disable test page controls base on settings in test facility extension - * 20060815 153903 makandre@ca.ibm.com - Andrew Mak, Browse does not work in generate client test page - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -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.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.ext.test.WebServiceTestExtension; -import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; -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; - - private IPath webContentPath_; - private IResource webContent_; - - 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 ); - testTypeCombo_.addSelectionListener( - new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - handleTestFacilitySelection(); - } - } - ); - - 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() - { - // webContentPath_ is set when jspFolderText_ is set for the first time. Therefore, - // if webContentPath_ is still null, there is no need to touch jspFolderText_ yet. - - if (webContentPath_ == null) - return; - - String folder = sampleFolderText_.getText(); - jspFolderText_.setText(webContentPath_.toString() + IPath.SEPARATOR + folder); - } - - private void handleSampleBrowse() - { - IPath selectedPath = null; - IResource initialResource = null; - - try - { - initialResource = ResourceUtils.getResourceFromSelection( initialSelection_ ); - } - catch( CoreException exc ) - { - } - - if( initialResource == null )initialResource = webContent_; - - IResource resource = DialogUtils.browseResources( comboGroup_.getShell(), - webContent_, - initialResource, - folderFilter_ ); - - if( resource != null ) - { - selectedPath = resource.getFullPath(); - - int webModuleSegments = selectedPath.matchingFirstSegments(webContentPath_); - - if ( webModuleSegments < webContentPath_.segmentCount() ) - { - sampleFolderText_.setText(""); - handleFolderText(); - } - else - { - sampleFolderText_.setText(selectedPath.removeFirstSegments(webModuleSegments).toString()); - handleFolderText(); - } - } - } - - private void handleTestButton() - { - boolean enabled = testCheckbox_.getSelection(); - - testTypeCombo_.setEnabled( enabled ); - - if (enabled && testFacilities_ != null) { - handleTestFacilitySelection(); - return; - } - - sampleFolderText_.setEnabled( enabled ); - methodsTree_.setEnabled( enabled ); - runTestCheckbox_.setEnabled( enabled ); - selectAllMethodsButton_.setEnabled( enabled ); - deselectAllMethodsButton_.setEnabled( enabled ); - sampleFolderBrowseButton_.setEnabled( enabled ); - } - - private void handleTestFacilitySelection() { - - String clientTestID = getTestFacility().getSelection(); - - WebServiceTestExtension testExtension = - (WebServiceTestExtension) WebServiceTestRegistry.getInstance() - .getWebServiceExtensionsByName(clientTestID); - - boolean hasCodeGen = testExtension.isCodeGenNeeded(); - - // folder selection is only applicable for test facilities with codegen - sampleFolderText_.setEnabled( hasCodeGen ); - sampleFolderBrowseButton_.setEnabled( hasCodeGen && webContent_ != null ); - - boolean hasMethods = testExtension.areMethodsNeeded(); - - // method selection is only applicable for test facilities with methods - methodsTree_.setEnabled( hasMethods ); - selectAllMethodsButton_.setEnabled( hasMethods ); - deselectAllMethodsButton_.setEnabled( hasMethods ); - - // run on server only applicable for test facilities that needs launching - runTestCheckbox_.setEnabled( testExtension.isServerNeeded() ); - } - - 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() ); - handleTestFacilitySelection(); - } - - public SelectionList getTestFacility() - { - testFacilities_.setIndex( testTypeCombo_.getSelectionIndex() ); - return testFacilities_; - } - - public String getTestID() - { - return testTypeCombo_.getText(); - } - - /** - * Given a project name which may be of the (obsolete) format "project/module", - * return only the project part of the name - * - * @param project The project name. - * @return If the name has the format "project/module", returns only "project", - * otherwise returns the name as is. - */ - private String extractProjectName(String project) { - - int index = project.indexOf("/"); - - if (index != -1) - project = project.substring(0, index); - - return project; - } - - public void setSampleProject(String clientProject) - { - projectCombo_.setItems( new String[]{ extractProjectName(clientProject) } ); - projectCombo_.select(0); - } - - public void setSampleProjectEAR(String clientProjectEAR) - { - earCombo_.setItems( new String[]{ extractProjectName(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 ) - { - webContentPath_ = (new Path(folder)).removeLastSegments(1); - webContent_ = ResourceUtils.findResource(webContentPath_); - sampleFolderBrowseButton_.setEnabled(webContent_ != null); - - jspFolderText_.setText( folder ); - } - - public String getJspFolder() - { - return jspFolderText_.getText(); - } - - public void setLaunchedServiceTestName (String launchedServiceTestName) - { - } - - public boolean getRunTestClient() - { - return runTestCheckbox_.getSelection(); - } - - public void setRunTestClient( 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 b87d2725f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/CopyWebServiceUtilsJarCommand.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060912 157039 makandre@ca.ibm.com - Andrew Mak, new webserviceutils.jar not copied in client generation - * 20061025 161250 makandre@ca.ibm.com - Andrew Mak, Installations or workspace paths with spaces break Sample Gen and Java Editor Launch - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; - -import java.io.File; -import java.net.URL; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.FileLocator; -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; -import org.eclipse.wst.ws.internal.common.BundleUtils; - - -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); - URL sourceURL = BundleUtils.getURLFromBundle( WebServiceConsumptionPlugin.ID, source ); - if(resource != null) { - File sourceFile = new File(FileLocator.toFileURL(sourceURL).getPath()); - if (resource.getLocation().toFile().length() == sourceFile.length()) - return Status.OK_STATUS; - } - FileResourceUtils.createFile(context, - target, - sourceURL.openStream(), - 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/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 6a73995ac..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, 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.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 94ca347e7..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, 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 - *******************************************************************************/ -/* - * 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 c9eb16fe2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/FinishTestFragment.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060727 144354 kathy@ca.ibm.com - Kathy Chan - * 20070502 180304 gilberta@ca.ibm.com - Gilbert Andrews - *******************************************************************************/ -/* - * 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; // This actually represent whether client test is requested - 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 setCanGenerateProxy(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 21f2f7466..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, 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 - *******************************************************************************/ -/* - * 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 a246e7cbc..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/TestDefaultingFragment.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060727 144354 kathy@ca.ibm.com - Kathy Chan - * 20060821 153833 makandre@ca.ibm.com - Andrew Mak, Allow the Web Service Test extension point to specify the supported client runtime - * 20060907 156606 makandre@ca.ibm.com - Andrew Mak, no sample JSP in the pop-up action of Generate Sample JSPs - *******************************************************************************/ -/* - * 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 java.util.ArrayList; -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.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.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; // This actually represent whether client test is requested - - private String clientRuntimeId_; - - 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(); - List newTestTypes = new ArrayList(); - String[] wsdlCases = scenarioContext.getNonJavaTestService(); - boolean launched = false; - - for(int i = 0;i<testTypes.length;i++){ - - WebServiceTestExtension extension = - (WebServiceTestExtension) WebServiceTestRegistry.getInstance() - .getWebServiceExtensionsByName(testTypes[i]); - - if (clientRuntimeId_ != null && !extension.supportsRuntime(clientRuntimeId_)) - continue; - - if(testTypes[i].equals(launchedServiceTestName)) - launched = true; - else{ - newTestTypes.add(testTypes[i]); - } - } - - if(launched) - newTestTypes.add(launchedServiceTestName); - - - if(!generateProxy) - testFacilities = new SelectionList(wsdlCases,0); - else { - String[] tempArray = new String[newTestTypes.size()]; - testFacilities = new SelectionList((String[]) newTestTypes.toArray(tempArray), 0); - } - } - - public void setLaunchedServiceTestName(String launchedServiceTestName) - { - this.launchedServiceTestName = launchedServiceTestName; - } - - public void setGenerateProxy(boolean generateProxy) - { - this.generateProxy = generateProxy; - } - - /** - * Sets the client runtime ID. - * - * @param clientRuntimeId The client runtime ID. - */ - public void setClientRuntimeId(String clientRuntimeId) { - clientRuntimeId_ = clientRuntimeId; - } - -} 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 74553e5de..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, 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 - *******************************************************************************/ -/* - * 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 646a72ad5..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, 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 - *******************************************************************************/ -/* - * 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 9cd65589a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/test/WebServiceClientTestArrivalCommand.java +++ /dev/null @@ -1,276 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060608 144500 mahutch@ca.ibm.com - Mark Hutchinson - * 20060818 153903 makandre@ca.ibm.com - Andrew Mak, Browse does not work in generate client test page - * 20060906 154548 gilberta@ca.ibm.com - Gilbert Andrews, This fixes name collisions when creating a sample project - * 20060922 158177 makandre@ca.ibm.com - Andrew Mak, NPE when creating web service client into existing Java project with test - *******************************************************************************/ -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.IPath; -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.j2ee.internal.project.J2EEProjectUtilities; -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); - IPath webcontentPath = null; - - // *need* to double-check that clientIProject is a web project - if (J2EEUtils.isWebComponent(clientIProject)) - webcontentPath = J2EEUtils.getWebContentPath(clientIProject); - - //Get the sample Folder ready - StringBuffer sb = new StringBuffer(); - - if (webcontentPath != null) - { - String path = webcontentPath.toString(); - sb.append(path).append("/"); - } - else - { //then just use the default - 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; - - String sampleTemp = sampleP; - - boolean nameFound = false; - int i = 1; - while(!nameFound){ - IProject sampleIProject = (IProject)ProjectUtilities.getProject(sampleTemp); - if(sampleIProject.exists() && !J2EEProjectUtilities.isDynamicWebProject(sampleIProject)){ - sampleTemp = sampleP + Integer.toString(i); - sampleProject = sampleTemp + "/" + sampleC; - - } - else - nameFound = true; - - i++; - } - sampleP = sampleTemp; - - } - - - - - 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 fd945a71d..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, 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 - *******************************************************************************/ -/* - * 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 bee7b6325..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, 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.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; - } -} 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 dbfc9ae16..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, 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 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 3c6638f50..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,292 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060324 122799 rsinha@ca.ibm.com - Rupam Kuehner - * 20060503 138478 rsinha@ca.ibm.com - Rupam Kuehner - * 20060510 141115 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ -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.plugin.IJ2EEModuleConstants; -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.CreateFacetedProjectCommand; -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.command.StartServerCommand; -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.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.internal.util.ComponentUtilities; -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; - - 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(); - //1. Create a Web project for the sample if one does not already exist. - sampleIProject = ProjectUtilities.getProject(testInfo.getGenerationProject()); - boolean createdSampleProject = false; - if (!sampleIProject.exists()) - { - CreateFacetedProjectCommand command = new CreateFacetedProjectCommand(); - command.setProjectName(testInfo.getGenerationProject()); - command.setTemplateId(IJ2EEModuleConstants.JST_WEB_TEMPLATE); - // RequiredFacetVersions is set to an empty array because we don't need to impose any additional constraints. - // We just want to create the highest level of Web project that the selected server supports. - command.setRequiredFacetVersions(new RequiredFacetVersion[0]); - command.setServerFactoryId(testInfo.getClientServerTypeID()); - command.setServerInstanceId(testInfo.getClientExistingServer().getId()); - IStatus status = command.execute( monitor, adaptable ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError( status ); - return status; - } - createdSampleProject = true; - } - - //2. If the selected server requires an EAR and no EAR name - //has been provided, choose an EAR name and create it if it doesn't exist. - ValidationUtils vu = new ValidationUtils(); - boolean serverNeedsEAR = vu.serverNeedsEAR(testInfo.getClientServerTypeID()); - if (serverNeedsEAR) { - 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.exists()) - { - CreateFacetedProjectCommand command = new CreateFacetedProjectCommand(); - command.setProjectName(sampleEARProject); - command.setTemplateId(IJ2EEModuleConstants.JST_EAR_TEMPLATE); - // RequiredFacetVersions is set to an empty array because we don't need to impose any additional constraints. - // We just want to create the highest level of Web project that the selected server supports. - command.setRequiredFacetVersions(new RequiredFacetVersion[0]); - command.setServerFactoryId(testInfo.getClientServerTypeID()); - command.setServerInstanceId(testInfo.getClientExistingServer().getId()); - IStatus status = command.execute( monitor, adaptable ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError( status ); - return status; - } - } - - } - - // 3. If the selected server requires an EAR, and the sample project has - // not already been added to the EAR, add it. - if (serverNeedsEAR) - { - AssociateModuleWithEARCommand associateCommand = new AssociateModuleWithEARCommand(); - associateCommand.setProject(testInfo.getGenerationProject()); - associateCommand.setEARProject(sampleEARProject); - associateCommand.setEar(sampleEARProject); - associateCommand.setEnvironment( env ); - IStatus status = associateCommand.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - - - - - // 4. If server requires an EAR, and the sample EAR has not already been - // added to the server, add it. - // If no EAR is required, and sample project has not been added to the server add it. - if (serverNeedsEAR) - { - //Add sampleEARIProject to the server if needed. - AddModuleToServerCommand modToServer = new AddModuleToServerCommand(); - modToServer.setModule(sampleEARProject); - modToServer.setProject(sampleEARProject); - modToServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - modToServer.setEnvironment( env ); - IStatus status = modToServer.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - else - { - //add sampleIProject directly to the server if needed. - AddModuleToServerCommand addToServer = new AddModuleToServerCommand(); - addToServer.setModule(testInfo.getGenerationProject()); - addToServer.setProject(testInfo.getGenerationProject()); - addToServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - addToServer.setEnvironment( env ); - IStatus status = addToServer.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - - //5. Call StartServerCommand if this command had to create the sample project. - if (createdSampleProject) - { - StartServerCommand startServer = new StartServerCommand(true); - startServer.setServerInstanceId(testInfo.getClientExistingServer().getId()); - startServer.setEnvironment( env ); - IStatus status = startServer.execute( monitor, null ); - if (status.getSeverity()==Status.ERROR) - { - env.getStatusHandler().reportError(status); - } - } - - - //6. Establish all necessary dependencies between client project, sample project, and EAR - - clientIProject = ProjectUtilities.getProject(testInfo.getClientProject()); - - if (clientIProject != null && !J2EEUtils.isWebComponent(clientIProject)) { - if (J2EEUtils.isJavaComponent(clientIProject)) { - addJavaProjectAsUtilityJar(clientIProject, sampleEARIProject, monitor); - addJavaProjectAsUtilityJar(clientIProject, sampleIProject,monitor); - } - - try - { - String uri = clientIProject.getName() + ".jar"; - addJAROrModuleDependency(sampleIProject, uri); - } catch (CoreException ce) - { - String errorMessage = NLS.bind(ConsumptionUIMessages.MSG_ERROR_MODULE_DEPENDENCY, new String[]{sampleIProject.getName(), clientIProject.getName()}); - IStatus errorStatus = StatusUtils.errorStatus(errorMessage); - env.getStatusHandler().reportError(errorStatus); - } catch (IOException ioe) - { - String errorMessage = NLS.bind(ConsumptionUIMessages.MSG_ERROR_MODULE_DEPENDENCY, new String[]{sampleIProject.getName(), clientIProject.getName()}); - IStatus errorStatus = StatusUtils.errorStatus(errorMessage); - env.getStatusHandler().reportError(errorStatus); - } - - try { - addBuildPath(sampleIProject, clientIProject); - } catch (JavaModelException jme) { - // Do nothing in this catch block. The worst that - // will happen is that the sample Web project - // will show some compile errors. The sample will - // likely still launch successfully on the server - // and the user will be able to use it. - } - } - - return Status.OK_STATUS; - } - - private void addJAROrModuleDependency(IProject project, String uri) throws IOException, CoreException - { - if (J2EEUtils.isWebComponent(project)) - { - ArchiveManifest manifest = J2EEProjectUtilities.readManifest(project); - manifest.mergeClassPath(new String[]{uri}); - J2EEProjectUtilities.writeManifest(project, manifest); - } - } - - private void addJavaProjectAsUtilityJar(IProject javaProject, IProject earProject,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); - IVirtualComponent sourcecomponent = ComponentUtilities.getComponent(earProject.getName()); - targetCompList.add(targetcomponent); - - refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT,sourcecomponent ); - refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetCompList); - refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, "/WEB-INF/lib"); - refdm.getDefaultOperation().execute(monitor, null); - }catch (Exception e) { - - } - } - - - 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()); - } - } - - - public static final String DEFAULT_SAMPLE_EAR_PROJECT_EXT = "EAR"; - -} 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 15bfc8cf3..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,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060418 134322 rsinha@ca.ibm.com - Rupam Kuehner - * 20060424 124368 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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.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. - } - - 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){ - env.getLog().log(ILog.ERROR, 5048, this, "launchSample", exc); - status = StatusUtils.errorStatus(exc.getMessage(), exc); - env.getStatusHandler().reportError(status); - 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; - } - } -} 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 ea068568d..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,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060608 145529 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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(); - if (testInfo.getRunTestClient()) { - 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 9a7bc7e0d..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,322 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060424 124368 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.widgets.test.wssample; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.command.common.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(); - - 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 f14dd8dea..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, 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.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 8f00dc398..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, 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.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 e3f94263e..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, 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.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 206f597ff..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/RuntimeServerSelectionDialog.java +++ /dev/null @@ -1,751 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060327 131605 rsinha@ca.ibm.com - Rupam Kuehner - * 20060717 150577 makandre@ca.ibm.com - Andrew Mak - * 20060726 150865 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060726 150867 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060728 151723 mahutch@ca.ibm.com - Mark Hutchinson - * 20060802 148731 mahutch@ca.ibm.com - Mark Hutchinson - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wizard; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.Hashtable; -import java.util.Vector; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ILabelProvider; -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.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -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.Display; -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_; - private ILabelProvider labelProvider_; - private Image serverTypesIcon; - private Image existingServersIcon; - - /* - * 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_; - - private boolean selectServerFirst_ = false; - - 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(); - labelProvider_ = ServerUICore.getLabelProvider(); - } - - public void setSelectServerFirst(boolean selectServerFirst) { - selectServerFirst_ = selectServerFirst; - } - - protected Point getInitialSize() - { - return this.getShell().computeSize(550, SWT.DEFAULT, true); - } - - 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); - comp.pack(); - - if (selectServerFirst_) { - viewSelectionByServerButton_.setSelection(true); - handleServerViewSelectionEvent(); - } - else - viewSelectionByRuntimeButton_.setSelection(true); - - return comp; - } - - protected void setShellStyle(int newShellStyle) - { - super.setShellStyle( newShellStyle | SWT.RESIZE ); - } - - 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); - 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() { - - if (selectionMode_ == MODE_SERVICE) { - if (selectedServerFactoryID_ != null && selectedRuntime_ != null) - { - - if (WebServiceRuntimeExtensionUtils2.isServerRuntimeTypeSupported(selectedServerFactoryID_, selectedRuntime_.getId(), - typeId_)) - { - setOKStatusMessage(); - } else - { - String serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(selectedServerFactoryID_); - String runtimeLabel = selectedRuntime_.getLabel(); - setERRORStatusMessage(NLS.bind(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, new String[] { serverLabel, - runtimeLabel })); - // Found an error - so return. - return; - } - } - } - else { - - if (selectedServerFactoryID_ != null && selectedRuntime_ != null) - { - String clientId = typeId_; - if (WebServiceRuntimeExtensionUtils2.isServerClientRuntimeTypeSupported(selectedServerFactoryID_, selectedRuntime_ - .getId(), clientId)) - { - setOKStatusMessage(); - } else - { - String serverLabel = WebServiceRuntimeExtensionUtils2.getServerLabelById(selectedServerFactoryID_); - String runtimeLabel = selectedRuntime_.getLabel(); - setERRORStatusMessage(NLS.bind(ConsumptionUIMessages.MSG_INVALID_SRT_SELECTIONS, new String[] { serverLabel, - runtimeLabel })); - - // Found an error - so return. - return; - } - } - } - // 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); - messageBanner_.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); - enableOKButton(); - } - - private void setERRORStatusMessage(String message) { - messageBanner_.setText(message); - messageBanner_.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_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() { - if (labelProvider_!=null) - labelProvider_.dispose(); - if (existingServersIcon!=null) - existingServersIcon.dispose(); - if (serverTypesIcon!=null) - serverTypesIcon.dispose(); - setReturnCode(OK); - close(); - } - - protected void cancelPressed() { - if (labelProvider_!=null) - labelProvider_.dispose(); - if (existingServersIcon!=null) - existingServersIcon.dispose(); - if (serverTypesIcon!=null) - serverTypesIcon.dispose(); - setReturnCode(CANCEL); - 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); - runtimesGroup_.moveAbove(serversGroup_); - 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); - serversGroup_.moveAbove(runtimesGroup_); - primaryGroup_.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); - runtimesGroup_.moveAbove(serversGroup_); - 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.getRuntimesByClientType(typeId_); - } - - //sort the runtimes based on the runtime name (bug 151723) - Comparator comparator = new RuntimeNameComparator(); - Arrays.sort(runtimes, comparator); - - 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 class RuntimeNameComparator implements Comparator - { - public RuntimeNameComparator() - { - } - //Compare to runtime ID strings by their labels. Used for sorting. - public int compare(Object item1, Object item2) { - try { - String runtime1 = (String)item1; - String runtime2 = (String)item2; - - return getRuntimeLabel(runtime1).compareToIgnoreCase(getRuntimeLabel(runtime2)); - } - catch (Exception e) - { //Just in case of class cast exception or NPE. should never happen - } - return 0; - } - } - - 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) { - existingServersIcon = id.createImage(); - existingServersTree[0].setImage(existingServersIcon); - } - 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(labelProvider_.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) { - serverTypesIcon = id.createImage(); - serverTypesTree[0].setImage(serverTypesIcon); - } - 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 = labelProvider_.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 = labelProvider_.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/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 9a9007d86..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java +++ /dev/null @@ -1,214 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060606 105045 mahutch@ca.ibm.com - Mark Hutchinson - * 20070328 172339 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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.j2ee.webservice.wsdd.BeanLink; -import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean; -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); - } - } - - } - } - - //TODO: Bug 179751 - Need to make checking for types recognized as bottom-up to be more extensible - - if (supportedTypes.isEmpty()) { - if (initialObject instanceof BeanLink || initialObject instanceof ServiceImplBean) { - 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 if (initialObject instanceof String) - { //the initialObject could be a path name that is a string - //bug 105045 - name = (String)initialObject; - } - 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 8275acc8c..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionMetadata.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060216 127138 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.wizard; - -import com.ibm.icu.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/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 b93efbbb6..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, 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.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 c72f4fa1d..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, 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.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 86267d682..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, 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.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 93bacf162..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, 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.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 ea57878bb..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, 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.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 100750caa..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, 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.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 38a45fc38..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, 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.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 f2b49ee33..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, 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.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 22b88c24a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientRuntimeDescriptor.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * -------- -------- ----------------------------------------------------------- - * 20071107 203826 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntimeChecker; - -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; - private IWebServiceRuntimeChecker webServiceRuntimeChecker; - - 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; - } - - public IWebServiceRuntimeChecker getClientRuntimeChecker() - { - if (webServiceRuntimeChecker == null) - { - try - { - if (elem.getAttribute("checkerClass") != null ) { - webServiceRuntimeChecker = (IWebServiceRuntimeChecker)elem.createExecutableExtension("checkerClass"); - } - } - catch(CoreException ce) - { - - } - } - - return webServiceRuntimeChecker; - } -} 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 e3c4b51fe..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ClientType.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060216 127138 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.Hashtable; -import org.eclipse.core.runtime.IConfigurationElement; -import com.ibm.icu.util.StringTokenizer; - -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/FacetMatchCache.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/FacetMatchCache.java deleted file mode 100644 index 293d9f48a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/FacetMatchCache.java +++ /dev/null @@ -1,495 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner (initial creation) - * 20060426 138051 kathy@ca.ibm.com - Kathy Chan - * 20060427 126780 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.consumption.common.FacetMatcher; -import org.eclipse.jst.ws.internal.consumption.common.FacetSetsByTemplateCache; -import org.eclipse.jst.ws.internal.consumption.common.FacetUtils; -import org.eclipse.jst.ws.internal.consumption.common.RequiredFacetVersion; -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; - -/** - * FacetMatchCache caches results of calculations made respecting - * the suitability of projects and project types for serviceRuntimes - * and clientRuntimes. - * - * <br/><br/> - * Teminology used in the javadoc in this class: - * <ul> - * <li><b>serviceRuntime</b>: extension to org.eclipse.jst.ws.consumption.ui.serviceRuntimes. - * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor</li> - * <li><b>clientRuntime</b>: extension to org.eclipse.jst.ws.consumption.ui.clientRuntimes. - * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor</li> - * </ul> - * - */ -public class FacetMatchCache implements IResourceChangeListener -{ - //single instance per workbench - private static FacetMatchCache instance_; - - - //Tables related to existing projects in the workspace - - //serviceFacetMatchTable_: - //key: Object of type String. - // Forward slash separated concatenation of a serviceRuntimeId and a projectName - // (e.g. org.eclipse.jst.ws.axis.creation.java/wp). - //value: Object of type org.eclipse.jst.ws.internal.consumption.common.FacetMatcher. - // The FacetMatcher contains the matching characteristics calculated for the - // serviceRuntime and project in the key. - private Hashtable serviceFacetMatchTable_; - - //serviceTableKeysByProjectName_: - //key: Object of type String. - // project name (e.g. wp) - //value: Set of elements of type String. The Strings in the Set are keys from the serviceFacetMatchTable_ - // that contain the project name (e.g. org.eclipse.jst.ws.axis.creation.java/wp). Used to rapidly - // delete entries from serviceFacetMatchTable_ after a project is deleted from the workspace. - private Hashtable serviceTableKeysByProjectName_; - - //clientFacetMatchTable_; - //key: Object of type String. - // forward slash separated concatenation of a clientRuntimeId and a projectName - // (e.g. org.eclipse.jst.ws.axis.consumption.java/wp) - //value: Object of type org.eclipse.jst.ws.internal.consumption.common.FacetMatcher - // The FacetMatcher contains the matching characteristics calculated for the - // clientRuntime and project in the key. - private Hashtable clientFacetMatchTable_; - - //clientTableKeysByProjectName_ - //key: Object of type String. - // project name (e.g. wp) - //value: Set of elements of type String. The Strings in the Set are keys from the clientFacetMatchTable_ - // that contain the project name (e.g. org.eclipse.jst.ws.axis.consumption.java/wp). Used to rapidly - // delete entries from clientFacetMatchTable_ after a project is deleted from the workspace. - private Hashtable clientTableKeysByProjectName_; - - //projectEntriesToDelete_: elements of type String containing the names of projects that have - //been deleted from the workspace but their corresponding entries from serviceFacetMatchTable_ - //and clientFacetMatchTable_ have yet to be deleted. - private List projectEntriesToDelete_; - - - - //Tables related to templates - - //templatesByServiceRuntimeId_: - //key: Object of type String. - // serviceRuntime id - //value: Set of elements of type org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate - // This the set of templates that support the serviceRuntime identified by the key. - private Hashtable templatesByServiceRuntimeId_; - - //templatesByClientRuntimeId_ - //key: Object of type String. - // clientRuntime id - //value: Set of elements of type org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate - // This the set of templates that support the clientRuntime identified by the key. - private Hashtable templatesByClientRuntimeId_; - - - /** - * Returns a singleton instance of this class. - * - * @return A singleton FacetMatchCache object. - */ - public static synchronized FacetMatchCache getInstance() - { - if (instance_ == null) - { - instance_ = new FacetMatchCache(); - instance_.load(); - } - return instance_; - } - - private void load() - { - serviceFacetMatchTable_ = new Hashtable(); - serviceTableKeysByProjectName_ = new Hashtable(); - clientFacetMatchTable_ = new Hashtable(); - clientTableKeysByProjectName_ = new Hashtable(); - projectEntriesToDelete_ = new ArrayList(); - templatesByClientRuntimeId_ = new Hashtable(); - templatesByServiceRuntimeId_ = new Hashtable(); - - //Listen for deletions of projects in order to delete all entries in - //Hashtables for the deleted project. - ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.PRE_DELETE); - } - - - /* - * Returns the FacetMatcher resulting from matching a serviceRuntime or clientRuntime with an existing project. - * @param isClient true if runtimeId is a clientRuntimeId. false if runtimeId is a serviceRuntimeId. - * @param runtimeId the id of a clientRuntime if isClient is true or the id of a serviceRuntime if - * isClient is false. - * @param projectName the name of an existing project. - * - * @returns FacetMatcher resulting from calling FacetUtils.match(..) using the serviceRuntime or clientRuntime id - * and the project name. Returns null if the project doesn't exist. Non-faceted existing projects will always result - * in a FacetMatcher with isMatch() equal to false (with the exception of Java projects which are a special case - * - see FacetUtils.getFacetsForProject()). - */ - public synchronized FacetMatcher getMatchForProject(boolean isClient, String runtimeId, String projectName) - { - //Delete entries from tables if there are deletions pending. - if (projectEntriesToDelete_.size() > 0) - { - Iterator projectItr = projectEntriesToDelete_.iterator(); - while(projectItr.hasNext()) - { - String projectNameToDelete = (String)projectItr.next(); - - //Delete entries from client table - removeTableEntriesForProject(true, projectNameToDelete); - - //Delete entries from service table - removeTableEntriesForProject(false, projectNameToDelete); - } - - //Clear the projectEntriesToDelete list - projectEntriesToDelete_.clear(); - } - - IProject project = ProjectUtilities.getProject(projectName); - FacetMatcher fm = null; - if (project != null && project.exists()) - { - String key = getKey(runtimeId, projectName); - if (isClient) - { - fm = (FacetMatcher) clientFacetMatchTable_.get(key); - } - else - { - fm = (FacetMatcher) serviceFacetMatchTable_.get(key); - } - - if (fm == null) - { - // This combination has not yet been calculated and cached so calculate it and cache it. - fm = calculateFacetMatcher(isClient, runtimeId, projectName); - if (isClient) - { - clientFacetMatchTable_.put(key,fm); - } - else - { - serviceFacetMatchTable_.put(key, fm); - } - updateTableOfKeys(isClient, key, projectName); - - } else - { - // If the project's facets have changed since the last time the - // facets were calculated, refresh the facetMatcher. - Set currentFacetVersions = FacetUtils.getFacetsForProject(projectName); - Set previousFacetVersions = fm.getFacetsTested(); - if (!currentFacetVersions.equals(previousFacetVersions)) - { - //recalculate and cache the FacetMatcher - fm = calculateFacetMatcher(isClient, runtimeId, projectName); - if (isClient) - { - clientFacetMatchTable_.put(key,fm); - } - else - { - serviceFacetMatchTable_.put(key, fm); - } - } - } - } - - return fm; - } - - /** - * Updates serviceTableKeysByProjectName_ or clientTableKeysByProjectName_ with - * the provided project name and key. This is called whenever a new entry is - * added to serviceFacetMatchTable_ or clientFacetMatchTable_. - * @param isClient true if runtimeId is a clientRuntimeId. false if runtimeId is a serviceRuntimeId. - * @param key - * @param projectName - */ - private void updateTableOfKeys(boolean isClient, String key, String projectName) - { - Set setOfKeysForProjectName = null; - if (isClient) - { - setOfKeysForProjectName = (Set)clientTableKeysByProjectName_.get(projectName); - } - else - { - setOfKeysForProjectName = (Set)serviceTableKeysByProjectName_.get(projectName); - } - - if (setOfKeysForProjectName == null) - { - //Add an entry in the table for this project. - Set keys = new HashSet(); - keys.add(key); - if (isClient) - { - clientTableKeysByProjectName_.put(projectName, keys); - } - else - { - serviceTableKeysByProjectName_.put(projectName, keys); - } - } - else - { - //Update the entry in the table for this project. - setOfKeysForProjectName.add(key); - } - } - - /** - * Returns the {@link FacetMatcher} calculated for the given serviceRuntime or clientRuntime and project - * @param isClient true if runtimeId is a clientRuntimeId. false if runtimeId is a serviceRuntimeId. - * @param runtimeId the id of a clientRuntime if isClient is true or the id of a serviceRuntime if - * isClient is false. - * @param projectName the name of an existing project. - * @return FacetMatcher resulting from calling FacetUtils.match(..) using the serviceRuntime or clientRuntime id - * and the project name. Returns null if the project doesn't exist. Non-faceted existing projects will always result - * in a FacetMatcher with isMatch() equal to false (with the exception of Java projects which are a special case - * - see FacetUtils.getFacetsForProject()). - */ - private FacetMatcher calculateFacetMatcher(boolean isClient, String runtimeId, String projectName) - { - FacetMatcher fm = null; - RequiredFacetVersion[] rfvs = null; - if (isClient) - { - ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(runtimeId); - rfvs = desc.getRequiredFacetVersions(); - } - else - { - ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(runtimeId); - rfvs = desc.getRequiredFacetVersions(); - } - - Set facetVersions = FacetUtils.getFacetsForProject(projectName); - if (facetVersions == null) - { - fm = new FacetMatcher(); - fm.setMatch(false); - return fm; - } - - fm = FacetUtils.match(rfvs, facetVersions); - - // Check if the facet runtime required by the required facet is supported - // by the project without chaning it's current facet runtime - - IRuntime fProjectRuntime = FacetUtils.getFacetRuntimeForProject(projectName); - if (fProjectRuntime != null) { - String fProjectRuntimeName = fProjectRuntime.getName(); - boolean projectSupportRequiredFacetRuntime = false; - Set rts = FacetUtils.getRuntimes(rfvs); - for (Iterator iterator = rts.iterator(); iterator.hasNext() && !projectSupportRequiredFacetRuntime;) { - IRuntime fRequiredRuntime = (IRuntime) iterator.next(); - if (fRequiredRuntime != null) { - if (fRequiredRuntime.getName().equals(fProjectRuntimeName)) { - projectSupportRequiredFacetRuntime = true; - } - } - } - - // if project does not support the required facet runtime, set FacetMatch match to false - if (!projectSupportRequiredFacetRuntime) { - fm.setMatch(false); - } - } - return fm; - } - - private String getKey(String a, String b) - { - StringBuffer keysb = new StringBuffer(); - keysb.append(a); - keysb.append("/"); - keysb.append(b); - return keysb.toString(); - } - - /** - * Removes all table entries in this cache for the given project - * @param isClient true to remove entries from client side tables. false to remove entries from service side tables - * @param projectName - */ - private void removeTableEntriesForProject(boolean isClient, String projectName) - { - //First remove the entries from clientFacetMatchTable_ or serviceFacetMatchTable_ - //that have keys containing this project name. - Set setOfKeysForProjectName = null; - if (isClient) - { - setOfKeysForProjectName = (Set)clientTableKeysByProjectName_.get(projectName); - } - else - { - setOfKeysForProjectName = (Set)serviceTableKeysByProjectName_.get(projectName); - } - - if (setOfKeysForProjectName != null) - { - Iterator keysItr = setOfKeysForProjectName.iterator(); - while (keysItr.hasNext()) - { - String key = (String)keysItr.next(); - if (isClient) - { - clientFacetMatchTable_.remove(key); - } - else - { - serviceFacetMatchTable_.remove(key); - } - } - - //Second, remove the entry in clientTableKeysByProjectName_ or serviceTableKeysByProjectName_ - //with this projectName as the key. - if (isClient) - { - clientTableKeysByProjectName_.remove(projectName); - } - else - { - serviceTableKeysByProjectName_.remove(projectName); - } - - } - - } - - /** - * Returns a set of templates supported by the given clientRuntime - * @param clientRuntimeId id of a clientRuntime - * @returns Set (elementtype: IFacetedProjectTemplate) - */ - public synchronized Set getTemplatesForClientRuntime(String clientRuntimeId) - { - Set templates = (Set)templatesByClientRuntimeId_.get(clientRuntimeId); - if (templates != null) - { - //Return the cached set of templates. - return templates; - } - else - { - //Calculate the templates, cache them for later use, and return them. - ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(clientRuntimeId); - Set validTemplates = getTemplates(desc.getRequiredFacetVersions()); - templatesByClientRuntimeId_.put(clientRuntimeId, validTemplates); - return validTemplates; - } - } - - /** - * Returns a set of templates supported by the given serviceRuntime - * @param serviceRuntimeId id of a serviceRuntime - * @returns Set (elementtype: IFacetedProjectTemplate) - */ - public synchronized Set getTemplatesForServiceRuntime(String serviceRuntimeId) - { - Set templates = (Set)templatesByServiceRuntimeId_.get(serviceRuntimeId); - if (templates != null) - { - //Return the cached set of templates. - return templates; - } - else - { - //Calculate the templates, cache them for later use, and return them. - ServiceRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getServiceRuntimeDescriptorById(serviceRuntimeId); - Set validTemplates = getTemplates(desc.getRequiredFacetVersions()); - templatesByServiceRuntimeId_.put(serviceRuntimeId, validTemplates); - return validTemplates; - } - } - - - /** - * Returns the set of templates that supported the given required facet versions. - * @param requiredFacetVersions - * @return Set containing elemets of type {@link IFacetedProjectTemplate}. - */ - private Set getTemplates(RequiredFacetVersion[] requiredFacetVersions) - { - Set templates = new HashSet(); - - for( Iterator itr = ProjectFacetsManager.getTemplates().iterator(); itr.hasNext(); ) - { - final IFacetedProjectTemplate template = (IFacetedProjectTemplate) itr.next(); - String templateId = template.getId(); - if (templateId.indexOf("ear") == -1 && templateId.indexOf("wst.web") == -1) //Don't include the EARs!! - { - Set[] combinations = FacetSetsByTemplateCache.getInstance().getFacetVersionCombinationsFromTemplate(templateId); - for (int i=0; i<combinations.length; i++) - { - FacetMatcher fm = FacetUtils.match(requiredFacetVersions, combinations[i]); - if (fm.isMatch()) - { - //Found a combination that worked. Add the template to the list and move on. - templates.add(template); - break; - } - } - } - } - - return templates; - - } - - public synchronized void resourceChanged(IResourceChangeEvent event) - { - if (event.getType() == IResourceChangeEvent.PRE_DELETE) - { - IResource projectResource = event.getResource(); - if (projectResource!=null) - { - String projectName = projectResource.getName(); - - //Add this project name to the list of project entries - //to delete. Next time getMatchForProject is called all - //entries for this project from all tables in this cache - //will be deleted. - projectEntriesToDelete_.add(projectName); - } - } - } -} 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 ac2bb3709..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/RuntimeDescriptor.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ - -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; - private String serverRequiredString; - private boolean serverRequired; - - - 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"}; - } - - public boolean getServerRequired() - { - if (serverRequiredString == null) - { - //Defaults to true if the extension omits this attribute - serverRequired = true; - - serverRequiredString = elem.getAttribute("serverRequired"); - if (serverRequiredString != null) - { - serverRequired = Boolean.valueOf(serverRequiredString).booleanValue(); - } - - } - return serverRequired; - } - -} 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 9d1756ea1..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceRuntimeDescriptor.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060802 152150 mahutch@ca.ibm.com - * 20071107 203826 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntimeChecker; - - -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; - private IWebServiceRuntimeChecker webServiceRuntimeChecker; - - 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++) - { - String facetID = facetElems[i].getAttribute("facet"); - if (ProjectFacetsManager.isProjectFacetDefined(facetID)) - { - RequiredFacetVersion rfv = new RequiredFacetVersion(); - IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(facetID); - 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; - } - - public IWebServiceRuntimeChecker getServiceRuntimeChecker() - { - if (webServiceRuntimeChecker == null) - { - try - { - if (elem.getAttribute("checkerClass") != null ) { - webServiceRuntimeChecker = (IWebServiceRuntimeChecker)elem.createExecutableExtension("checkerClass"); - } - } - catch(CoreException ce) - { - - } - } - - return webServiceRuntimeChecker; - } - -} 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 417cc2917..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/ServiceType.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060216 127138 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.Hashtable; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario; -import com.ibm.icu.util.StringTokenizer; - -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 6caf1ac26..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceImpl.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060216 127138 pmoogk@ca.ibm.com - Peter Moogk - * 20070509 182274 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.wst.ws.internal.wsrt.IMerger; - -import com.ibm.icu.util.StringTokenizer; - -public class WebServiceImpl { - - private IConfigurationElement elem_; - private String id; - private String label; - private String[] resourceTypeMetadata; - private String[] extensionMetadata; - private String objectSelectionWidget; - private IMerger mergerClass; - - 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; - } - -public IMerger getMergerClass() { - if (mergerClass == null) - { - try - { - mergerClass = (IMerger) elem_.createExecutableExtension("mergerClass"); - } - catch(CoreException ce) - { - - } - } - return mergerClass; -} - - - -} 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 ec58deeb6..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, 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.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 ab2df35e4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionRegistry2.java +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060427 126780 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ - -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_; - - //webServiceImpls_: - //key: id attribute of extension to org.eclipse.jst.ws.consumption.ui.wsImpl - //value: org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl - Hashtable webServiceImpls_; - - //webServiceClientImpls_: - //key: id attribute of extension to org.eclipse.jst.ws.consumption.ui.wsClientImpl - //value: org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceClientImpl - Hashtable webServiceClientImpls_; - - //runtimes_: - //key: id attribute of extension to org.eclipse.jst.ws.consumption.ui.runtimes - //value: org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor - Hashtable runtimes_; - - //serviceRuntimes_: - //key: id attribute of extension to org.eclipse.jst.ws.consumption.ui.serviceRuntimes - //value: org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor - Hashtable serviceRuntimes_; - - //clientRuntimes_: - //key: id attribute of extension to org.eclipse.jst.ws.consumption.ui.clientRuntimes - //value: org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor - Hashtable clientRuntimes_; - - //webServiceTypesList_ contains a list of String values in this form: "scenario/webServiceImplId", - //where sceanrio the String representation of one of - //org.eclipse.wst.ws.internal.wsrt.WebServiceScenario.BOTTOM_UP or - //org.eclipse.wst.ws.internal.wsrt.WebServiceScenario.TOP_DOWN - //and webServiceImplId is the id attribute of an extension to org.eclipse.jst.ws.consumption.ui.wsImpl - //This list is used to determine the items displayed in the WebServiceType combo-box of page 1 of the - //Web serivce wizard. - ArrayList webServiceTypesList_; - - //TODO: Not used. Remove this and all references to it in this class. - 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 by reading all extensions to org.eclipse.jst.ws.consumption.ui.wsImpl - 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 by reading all extensions to org.eclipse.jst.ws.consumption.ui.wsClientImpl - 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 by reading all extensions to org.eclipse.jst.ws.consumption.ui.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 by reading all extensions to org.eclipse.jst.ws.consumption.ui.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 clientRuntimes by reading all extensions to org.eclipse.jst.ws.consumption.ui.clientRuntimes - 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); - - } - } - } - - /** - * Updates the list of Web service types with the provided service runtime's contribution of - * scenario/webServiceImpl combination. - * @param descriptor - */ - 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/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 5e02e9265..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java +++ /dev/null @@ -1,1974 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060131 121071 rsinha@ca.ibm.com - Rupam Kuehner - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20060227 124392 rsinha@ca.ibm.com - Rupam Kuehner - * 20060324 116750 rsinha@ca.ibm.com - Rupam Kuehner - * 20060427 126780 rsinha@ca.ibm.com - Rupam Kuehner - * 20070119 159458 mahutch@ca.ibm.com - Mark Hutchinson - * 20071107 203826 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -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.ConsumptionUIMessages; -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.osgi.util.NLS; -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.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; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntimeChecker; -import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario; - -/** - * This class contains numerous utility methods that - * process the information provided through extension points - * which are read in WebServiceRuntimeExtensionRegistry2: - * <ul> - * <li> org.eclipse.jst.ws.consumption.ui.wsImpl </li> - * <li> org.eclipse.jst.ws.consumption.ui.wsClientImpl </li> - * <li> org.eclipse.jst.ws.consumption.ui.runtimes </li> - * <li> org.eclipse.jst.ws.consumption.ui.serviceRuntimes </li> - * <li> org.eclipse.jst.ws.consumption.ui.clientRuntimes </li> - * </ul> - * - * to provide answers to common questions regarding which servers, - * projects, and project types a particular Web service runtime - * supports. - * <br/><br/> - * Teminology used in the javadoc in this class: - * <ul> - * <li><b>Web service scenario</b>: One of WebServiceScenario.BOTTOM_UP or WebServiceScenario.TOP_DOWN.</li> - * <li><b>Web service implementation type</b>: extension to org.eclipse.jst.ws.consumption.ui.wsImpl. - * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl.</li> - * <li><b>Web service type</b>: Forward slash separated concatenation of the String representation - * of a Web service scenario and a Web service implementation type id. - * For example, "0/org.eclipse.jst.ws.wsImpl.java", represents the bottom up Java bean Web service type.</li> - * <li><b>Web service client implementation type</b>: extension to org.eclipse.jst.ws.consumption.ui.wsClientImpl. - * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceClientImpl.</li> - * <li><b>Web service runtime</b>: extension to org.eclipse.jst.ws.consumption.ui.runtimes. - * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.RuntimeDescriptor</li> - * <li><b>serviceRuntime</b>: extension to org.eclipse.jst.ws.consumption.ui.serviceRuntimes. - * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.ServiceRuntimeDescriptor</li> - * <li><b>clientRuntime</b>: extension to org.eclipse.jst.ws.consumption.ui.clientRuntimes. - * The Java representation of this is org.eclipse.jst.ws.internal.consumption.ui.wsrt.ClientRuntimeDescriptor</li> - * <li><b>server type</b>: This is a server tools artifact. You see a list of these when creating a new server - * in the tool.</li> - * <li><b>server runtime</b>: This is a server tools artifact. You see a list of these if you go to Preferences, - * Server > Installed Runtimes in the tool. The Java representation of this is org.eclipse.wst.server.core.IRuntime</li> - * <li><b>facet runtime</b>: The facet equivalent of a server runtime. The Java representation of this is - * org.eclipse.wst.common.project.facet.core.runtime.IRuntime. org.eclipse.jst.server.core.FacetUtil - * provides methods to translate from a server runtime to a facet runtime and vice-versa.</li> - * </ul> - */ -public class WebServiceRuntimeExtensionUtils2 -{ - private static WebServiceRuntimeExtensionRegistry2 registry = WebServiceRuntimeExtensionRegistry2.getInstance(); - - /** - * Returns the RuntimeDescriptor representing the Web service runtime - * with an id attribute equal to the provided id - * @param id - * @return RuntimeDescriptor representing the Web service runtime - * with an id attribute equal to the provided id. Returns null - * if such a RuntimeDescriptor cannot be found. - */ - public static RuntimeDescriptor getRuntimeById(String id) - { - Object result = registry.runtimes_.get(id); - if (result!=null) - { - return (RuntimeDescriptor)result; - } - return null; - } - - /** - * Returns the union of all project types supported by all serviceRuntimes. Used by the - * ProjectTopology preference page. - * @return String[] array of template ids. The array may have 0 elements. - */ - public static String[] getAllServiceProjectTypes() - { - ArrayList finalTemplateIdList = new ArrayList(); - Iterator iter = registry.serviceRuntimes_.values().iterator(); - - //Loop through all the serviceRuntimes - while (iter.hasNext()) - { - ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next(); - - //Get the templates for this serviceRuntime - Set templates = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(desc.getId()); - - //Add the template ids to the list if they have not already been added - Iterator itr = templates.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (!finalTemplateIdList.contains(template.getId())) - { - finalTemplateIdList.add(template.getId()); - } - } - } - - return (String[])finalTemplateIdList.toArray(new String[]{}); - } - - /** - * Returns the union of all project types supported by all clientRuntimes. Used by the - * ProjectTopology preference page. - * @return String[] array of template ids. The array may have 0 elements. - */ - 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 clientRuntime - Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(desc.getId()); - - //Add the template ids to the list if they have not already been added - Iterator itr = templates.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (!finalTemplateIdList.contains(template.getId())) - { - finalTemplateIdList.add(template.getId()); - } - } - } - - return (String[])finalTemplateIdList.toArray(new String[]{}); - } - - /** - * Returns the label of a Web service runtime given its id - * @param runtimeId id of a Web service runtime - * @return String the label of the Web service runtime with an id equal to runtimeId. - * Returns null if such a Web service runtime cannot be found. - */ - public static String getRuntimeLabelById(String runtimeId) - { - RuntimeDescriptor desc = getRuntimeById(runtimeId); - if (desc == null) - return null; - - return desc.getLabel(); - } - - /** - * Returns the RuntimeDescriptor corresponding to the Web service runtime with the provided label - * @param label label of a Web service runtime - * @return RuntimeDescriptor corresponding to the Web service runtime with the provided label - * Returns null if such a Web service runtime cannot be found. - */ - 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; - } - - /** - * Returns the label of an server type given its id - * @param serverFactoryId id of a server type - * @return String label of the server type with an id equal to serverFactoryId. - * Returns null if such a server type cannot be found. - */ - public static String getServerLabelById(String serverFactoryId) - { - IServerType serverType = ServerCore.findServerType(serverFactoryId); - if (serverType == null) - return null; - - String serverLabel = ServerUICore.getLabelProvider().getText(serverType); - return serverLabel; - } - - /** - * Returns the label of an IServer given its id - * @param instanceId id of an IServer - * @return String label of the IServer with an id equal to instanceId. - */ - public static String getServerInstanceLabelFromInstanceId( String instanceId ) - { - IServer server = ServerCore.findServer( instanceId ); - return server.getName(); - } - - /** - * Returns the union of all server type ids corresponding to the facet runtimes - * in the provided set. - * @param facetRuntimes a set containing elements of type {@link IRuntime}. - * @return an array of IServerType ids. The array may have 0 elements. - */ - 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]); - IRuntimeType runtimeType = serverType.getRuntimeType(); - if (runtimeType != null) - { - String runtimeTypeId = runtimeType.getId(); - if (sRuntime != null && sRuntime.getRuntimeType() != null && 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 - /** - * Returns a WebServiceImpl given the id of a Web service implementation type. - * @param id - * @return WebServiceImpl with the given id - * Returns null if such a WebServiceImpl cannot be found. - */ - public static WebServiceImpl getWebServiceImplById(String id) - { - Object result = registry.webServiceImpls_.get(id); - if (result!=null) - { - return (WebServiceImpl)result; - } - return null; - } - - /** - * Returns a {@link ServiceRuntimeDescriptor} given the id of a servicRuntime. - * @param id of a serviceRuntime - * @return ServiceRuntimeDescriptor with the given id - * Returns null if such a ServiceRuntimeDescriptor cannot be found. - */ - public static ServiceRuntimeDescriptor getServiceRuntimeDescriptorById(String id) - { - Object result = registry.serviceRuntimes_.get(id); - if (result!=null) - { - return (ServiceRuntimeDescriptor)result; - } - return null; - } - - /** - * Returns the {@link IWebServiceRuntime} of the given serviceRuntime. Extenders provide the fully - * qualified name of a concrete IWebServiceRuntime in the class attribute of a serviceRuntimes extension. - * @param serviceRuntimeId id of a serviceRuntime - * @return IWebServiceRuntime - */ - public static IWebServiceRuntime getServiceRuntime( String serviceRuntimeId ) - { - ServiceRuntimeDescriptor descriptor = getServiceRuntimeDescriptorById(serviceRuntimeId); - IWebServiceRuntime webserviceRuntime = null; - if (descriptor != null) - { - webserviceRuntime = descriptor.getWebServiceRuntime(); - } - - return webserviceRuntime; - } - - /** - * Returns the id of a serviceRuntime that supports the provided Web service type, Web service runtime, - * server type/server instance (if present), project or project type. - * @param trs an instance of {@link TypeRuntimeServer} containing a Web service type id, Web service runtime id, - * server type id and server instance id. The Web service type id and Web service runtime id must be non-null - * and non-empty. The server type id and server instance id may be null or empty. - * @param projectName the name of an IProject thay may or mat not exist in the workspace. Must be non-null and - * non-empty. - * @param templateId the id of an {@link IFacetedProjectTemplate}. Must be non-null and non-empty if - * an IProject with the name projectName does not exist in the workspace. - * @return String id of a serviceRuntime that supports the provided Web service type, Web service runtime, - * server type/server instance (if present), project or project type. Returns an empty String if no - * such serviceRuntime could be found. - */ - public static String getServiceRuntimeId(TypeRuntimeServer trs, String projectName, String templateId) - { - boolean serverSelected = (trs.getServerId() != null) && (trs.getServerId().length() > 0); - //Find the first serviceRuntime 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())) - { - if (serverSelected) - { - 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 ""; - - } - - /** - * Returns the Web service scenario from the Web service type. - * @param typeId must 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 Web service implementation type id. - * @return int scenario (e.g. WebServiceScenario.BOTTOM_UP or WebServiceScenario.TOP_DOWN) - */ - public static int getScenarioFromTypeId(String typeId) - { - return Integer.parseInt(typeId.substring(0,typeId.indexOf("/"))); - } - - /** - * Returns the Web service implemenation type id fron the Web service type id. - * @param typeId must 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 Web service implementation type id. - * @return String the WebServiceImpl id. - */ - public static String getWebServiceImplIdFromTypeId(String typeId) - { - return typeId.substring(typeId.indexOf("/")+1); - } - - /** - * Returns the ids of all Web service runtimes that support the given - * Web service type. - * - * @param typeId must 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 Web service implementation type id. - * - * @return String[] array containing the ids of all Web service runtimes that - * support the given Web service type. The array may have 0 elements. - */ - 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[]{}); - } - - /** - * Returns the ids of all serviceRuntimes that support the given - * Web service type. - * - * @param typeId must 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 Web service implementation type id. - * - * @returns String[] array containing the ids of all serviceRuntimes that - * support the given Web service type. The array may have 0 elements. - */ - 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[]{}); - } - - /** - * Returns whether or not the given Web service runtime supports the given - * Web service type. - * - * @param typeId must 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 Web service implementation type id. - * - * @param runtimeId id of a Web service runtime - * - * @return boolean <code>true</code> if the given Web service runtime supports the given - * Web service type. <code>false</code> otherwise. - */ - 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; - } - - /** - * Returns the ids of all server types that support the given - * Web service type. - * - * @param typeId must 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 Web service implementation type id. - * - * @returns String[] array containing the ids of all server types that - * support the given Web service type. The array may have 0 elements. - */ - 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 serviceRuntime - 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(); - } - - /** - * Returns whether or not the given server type supports the given - * Web service type. - * - * @param typeId must 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 Web service implementation type id. - * - * @param serverFactoryId id of a server type - * - * @return boolean <code>true</code> if the given server type supports the given - * Web service type. <code>false</code> otherwise. - */ - 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; - } - - /** - * Returns the ids of all server types that support the given - * serviceRuntime. - * - * @param serviceRuntimeId id of a serviceRuntime - * - * @returns String[] array containing the ids of all server types that - * support the given serviceRuntime. The array may have 0 elements. - */ - 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); - } - - - - /** - * Returns whether or not the given server type supports the given - * serviceRuntime. - * - * @param serviceRuntimeId id of a serviceRuntime - * @param serverFactoryId id of a server type - * - * @return boolean <code>true</code> if the given server type supports the given - * serviceRuntime. <code>false</code> otherwise. - */ - 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; - } - - /** - * Returns the labels and ids of all Web service types. Used to populate the Web service type combo box on - * page 1 of the Web service wizard. - * @return {@link LabelsAndIds} - */ - public static LabelsAndIds getServiceTypeLabels() - { - 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 = NLS.bind(ConsumptionUIMessages.BOTTOMUP_LABEL, new String[0]); - break; - case WebServiceScenario.TOPDOWN: - scenLabel = NLS.bind(ConsumptionUIMessages.TOPDOWN_LABEL, new String[0]); - break; - default: - } - labels[index] = NLS.bind(ConsumptionUIMessages.COMBINED_TYPE_AND_RUNTIME_LABEL, new String[]{ scenLabel, impllabel }); - index++; - } - - return labelIds; - } - - /** - * Returns the id of a Web service runtime that supports the given Web service type. - * - * @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 Web service implementation type id. - * - * @return String id of a Web service runtime that supports the given Web service type. - * Returns null if such a Web service runtime cannot be found. - */ - public static String getDefaultRuntimeValueFor(String typeId) - { - String[] srIds = getServiceRuntimesByServiceType(typeId); - if (srIds == null) - { - return null; - } - - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(srIds[0]); - return desc.getRuntime().getId(); - } - - /** - * Returns the id of a server type that supports the given Web service type. - * - * @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 Web service implementation type id. - * - * @return String id of a id of a server type that supports the given Web service type. - * Returns null if such a server type cannot be found. - */ - public static String getDefaultServerValueFor(String typeId) - { - String[] fIds = getServerFactoryIdsByServiceType(typeId); - if (fIds==null || fIds.length==0) - return null; - - return fIds[0]; - } - - /** - * Returns whether or not the given combination of server type, Web service runtime, and Web service type is - * supported. Used for validation. - * - * @param serverFactoryId id of a server type - * @param runtimeId id of a Web service runtime - * @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 Web service implementation type id. - * - * @return boolean <code>true</code> if the given combination of server type, Web service runtime, and Web service type is - * supported. <code>false</code> otherwise. - */ - public static boolean isServerRuntimeTypeSupported(String serverFactoryId, String runtimeId, String typeId) - { - //Ensure there is at least one serviceRuntime 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; - } - - /** - * Returns an array of Web service type ids that are suitable for the provided selection. - * Used to default the Web service type combo box on page 1 of the Web service wizard - * based on the user's initial selection. - * @param selection - * @return String[] an array of Web service type ids that are suitable for the provided selection. - * Returns null if the selection is empty or no suitable Web service types are found. - */ - public static String[] getWebServiceTypeBySelection(IStructuredSelection selection) - { - TypeSelectionFilter2 tsf = new TypeSelectionFilter2(); - String[] wst = tsf.getWebServiceTypeByInitialSelection(selection, registry.webServiceTypesList_); - return wst == null ? null : wst; - } - - /** - * Returns whether or not the given server type supports the given Web service runtime - * - * @param runtimeId : id of a Web service runtime - * @param factoryId : id of a server type - * @return boolean <code>true</code> if the given server type supports the given - * Web service runtime for the service side. <code>false</code> otherwise. - */ - 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 serviceRuntime 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 serviceRuntime matched. Return false. - return false; - } - - /** - * Returns the id of a server type that supports the given Web service runtime - * on the service side. - * - * @param runtimeId id of a Web service runtime - * @return String the id of a server type that supports the given Web service runtime. - * Returns null if such a server type cannot be found. - */ - 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 serviceRuntime 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; - } - - /** - * Returns the names of all projects in the workspace which support the given Web service type - * and Web service runtime. - * @param typeId must 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 Web service implementation type id. - * @param runtimeId id of a Web service runtime - * @return String[] array of project names. The array may have 0 elements. - */ - public static String[] getProjectsForServiceTypeAndRuntime(String typeId, String runtimeId) - { - IProject[] projects = FacetUtils.getAllProjects(); - ArrayList validProjects = new ArrayList(); - - for (int i=0; i<projects.length;i++) - { - if (doesServiceTypeAndRuntimeSupportProject(typeId, runtimeId, projects[i].getName())) - { - validProjects.add(projects[i].getName()); - } - } - - return (String[])validProjects.toArray(new String[0]); - - } - - /** - * Returns whether or not the given project supports the given Web service type and Web service runtime. - * @param typeId must 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 Web service implementation type id. - * @param runtimeId id of a Web service runtime - * @param projectName name of an IProject in the workspace - * @return boolean <code>true</code> if the project supports the given Web service type and - * Web service runtime. Returns <code>false</code> - * <ul> - * <li>if the project does not support the given Web service type and Web service runtime or</li> - * <li>if the project does not exist or</li> - * <li>if projectName is null or empty</li> - * </ul> - */ - public static boolean doesServiceTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName) - { - String[] descs = getServiceRuntimesByServiceType(typeId); - for (int j = 0; j < descs.length; j++) - { - ServiceRuntimeDescriptor desc = getServiceRuntimeDescriptorById(descs[j]); - if (desc.getRuntime().getId().equals(runtimeId)) - { - if (doesServiceRuntimeSupportProject(descs[j], projectName)) - { - return true; - } - } - } - - return false; - - } - - /** - * Returns whether or not the given project supports the given serviceRuntime. - * @param serviceRuntimeId id of a serviceRuntime - * @param projectName name of an IProject in the workspace - * @return boolean <code>true</code> if the project supports the given - * serviceRuntime. Returns <code>false</code> - * <ul> - * <li>if the project does not support the given serviceRuntime or</li> - * <li>if the project does not exist or</li> - * <li>if projectName is null or empty</li> - * </ul> - */ - public static boolean doesServiceRuntimeSupportProject(String serviceRuntimeId, String projectName) - { - FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(false, serviceRuntimeId, projectName); - if (fm != null) - { - return fm.isMatch(); - } - else - { - return false; - } - } - - - /** - * Returns an array of {@link IFacetedProjectTemplate} ids that support the given Web service type - * and Web service runtime. - * @param typeId must 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 Web service implementation type id. - * @param runtimeId id of a Web service runtime - * @return String[] array of {@link IFacetedProjectTemplate} ids that support the given Web service type - * and Web service runtime. The array may have 0 elements. Returns null if no serviceRuntimes supporting - * the given Web service type could be found. - */ - 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 serviceRuntime - Set templates = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(desc.getId()); - - //Add the template ids to the list if they have not already been added - Iterator itr = templates.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (!templateIdList.contains(template.getId())) - { - templateIdList.add(template.getId()); - } - } - } - - } - - return (String[])templateIdList.toArray(new String[]{}); - } - - /** - * Returns whether or not the given {@link IFacetedProjectTemplate} supports the given Web service type - * and Web service runtime. - * @param typeId must 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 Web service implementation type id. - * @param runtimeId id of a Web service runtime - * @param templateId id of a {@link IFacetedProjectTemplate} - * @return boolean <code>true</code> if the given {@link IFacetedProjectTemplate} supports the given - * Web service type and Web service runtime. Returns <code>false</code> otherwise. - */ - 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 serviceRuntime - Set templates = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(srIds[i]); - - //Check if any of the template ids match the given one. - Iterator itr = templates.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (template.getId().equals(templateId)) - { - return true; - } - - } - } - - } - - return false; - } - - /** - * Returns whether or not the given {@link IFacetedProjectTemplate} supports the given serviceRuntime. - * @param serviceRuntimeId id of a serviceRuntime - * @param templateId id of a {@link IFacetedProjectTemplate} - * @return boolean <code>true</code> if the given {@link IFacetedProjectTemplate} supports the given - * serviceRuntime. Returns <code>false</code> otherwise. - */ - public static boolean doesServiceRuntimeSupportTemplate(String serviceRuntimeId, String templateId) - { - //Get the templates for this serviceRuntime - Set templates = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(serviceRuntimeId); - IFacetedProjectTemplate checkingTemplate = ProjectFacetsManager.getTemplate(templateId); - return templates.contains(checkingTemplate); - } - - //Client-side utilities - /** - * Returns a WebServiceClientImpl given the id of a Web service client implementation type. - * @param id - * @return {@link WebServiceClientImpl} with the given id - * Returns null if such a WebServiceClientImpl cannot be found. - */ - public static WebServiceClientImpl getWebServiceClientImplById(String id) - { - Object result = registry.webServiceClientImpls_.get(id); - if (result!=null) - { - return (WebServiceClientImpl)result; - } - return null; - } - - /** - * Returns a {@link ClientRuntimeDescriptor} given the id of a clientRuntime. - * @param id of a clientRuntime - * @return ClientRuntimeDescriptor with the given id - * Returns null if such a ClientRuntimeDescriptor cannot be found. - */ - public static ClientRuntimeDescriptor getClientRuntimeDescriptorById(String id) - { - Object result = registry.clientRuntimes_.get(id); - if (result!=null) - { - return (ClientRuntimeDescriptor)result; - } - return null; - } - - /** - * Returns the {@link IWebServiceRuntime} of the given clientRuntime. Extenders provide the fully - * qualified name of a concrete IWebServiceRuntime in the class attribute of a clientRuntimes extension. - * @param clientRuntimeId id of a clientRuntime - * @return IWebServiceRuntime - */ - public static IWebServiceRuntime getClientRuntime( String clientRuntimeId ) - { - ClientRuntimeDescriptor descriptor = getClientRuntimeDescriptorById(clientRuntimeId); - IWebServiceRuntime webserviceRuntime = null; - if (descriptor != null) - { - webserviceRuntime = descriptor.getWebServiceRuntime(); - } - - return webserviceRuntime; - } - - /** - * Returns the id of a clientRuntime that supports the provided Web service client implementation type, Web service runtime, - * server type/server instance (if present), project or project type. - * @param trs an instance of {@link TypeRuntimeServer} containing a Web service client implementation type id, Web service runtime id, - * server type id and server instance id. The Web service client implementation type id and Web service runtime id must be non-null - * and non-empty. The server type id and server instance id may be null or empty. - * @param projectName the name of an IProject thay may or mat not exist in the workspace. Must be non-null and - * non-empty. - * @param templateId the id of an {@link IFacetedProjectTemplate}. Must be non-null and non-empty if - * an IProject with the name projectName does not exist in the workspace. - * @return String id of a clientRuntime that supports the provided Web service client implementation type, Web service runtime, - * server type/server instance (if present), project or project type. Returns an empty String if no - * such clientRuntime could be found. - */ - public static String getClientRuntimeId(TypeRuntimeServer trs, String projectName, String templateId) - { - boolean serverSelected = (trs.getServerId()!=null) && (trs.getServerId().length()>0); - //Find the first clientRuntime 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())) - { - if (serverSelected) - { - 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 ""; - - } - - /** - * Returns all Web service runtime ids for the client side. - * @return String[] array of Web service runtime ids for the client side. - * The array may have 0 elements. - */ - 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[]{}); - } - - /** - * Returns the ids of all clientRuntimes that support the given - * Web service client implementation type. - * @param clientImplId id of a Web service client implementation type - * @returns String[] array containing the ids of all clientRuntimes that - * support the given Web service client implementation type. The array may have 0 elements. - */ - 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[]{}); - } - - /** - * Returns the ids of all Web service runtimes that support the given - * Web service client implementation type. - * @param clientImplId id of a Web service client implementation type - * @return String[] array containing the ids of all Web service runtimes that - * support the given Web service client implementation type. The array may have 0 elements. - */ - 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)) - { - if (!runtimeIds.contains(desc.getRuntime().getId())) - { - runtimeIds.add(desc.getRuntime().getId()); - } - } - } - - return (String[])runtimeIds.toArray(new String[]{}); - } - - /** - * Returns whether or not the given Web service runtime supports the given - * Web service client implementation type. - * @param clientImplId id of a Web service client implementation type - * @param runtimeId id of a Web service runtime - * @return boolean <code>true</code> if the given Web service runtime supports the given - * Web service client implementation type. <code>false</code> otherwise. - */ - 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; - } - - /** - * Returns all server type ids with configured server runtimes. - * @return String[] array of server type ids. The array may have 0 elements. - */ - 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(); - } - - /** - * Returns the ids of all server types that support the given - * Web service client implementation type. - * - * @param clientImplId id of a Web service client implementation type - * @return String[] array containing the ids of all server types that - * support the given Web service client implementation type. The array may have 0 elements. - */ - 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 serviceRuntime - 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[]{}); - } - - /** - * Returns whether or not the given server type supports the given - * Web service client implementation type. - * @param clientImplId id of a Web service client implementation type - * @param serverFactoryId id of a server type - * @return <code>true</code> if the given server type supports the given - * Web service client implementation type. <code>false</code> otherwise. - */ - 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; - } - - /** - * Returns the ids of all server types that support the given - * clientRuntime. - * - * @param clientRuntimeId id of a clientRuntime - * @return String[] array containing the ids of all server types that - * support the given clientRuntime. The array may have 0 elements. - */ - public static String[] getServerFactoryIdsByClientRuntime(String clientRuntimeId) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(clientRuntimeId); - Set facetRuntimes = getRuntimes(desc.getRequiredFacetVersions()); - - String[] fIds = getServerFactoryIdsByFacetRuntimes(facetRuntimes); - return fIds; - } - - /** - * Returns whether or not the given server type supports the given - * clientRuntime. - * - * @param clientRuntimeId id of a clientRuntime - * @param serverFactoryId id of a server type - * @return boolean <code>true</code> if the given server type supports the given - * clientRuntime. <code>false</code> otherwise. - */ - 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; - } - - /** - * Returns whether or not the given server type supports the given Web service runtime - * - * @param runtimeId id of a Web service runtime - * @param factoryId id of a server type - * @return boolean <code>true</code> if the given server type supports the given - * Web service runtime for the client side. <code>false</code> otherwise. - */ - 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 clientRuntime 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; - } - - /** - * Returns the id of a server type that supports the given Web service runtime - * on the client side. - * - * @param runtimeId id of a Web service runtime - * @return String the id of a server type that supports the given Web service runtime - * on the client side. Returns null if such a server type cannot be found. - */ - 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 clientRuntime 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; - - } - - - /** - * Returns whether or not the given combination of server type, Web service runtime, and - * Web service client implementation type is supported. Used for validation. - * - * @param serverFactoryId id of a server type - * @param runtimeId id of a Web service runtime - * @param clientImplId id of a Web service client implementation type - * @return boolean <code>true</code> if the given combination of server type, Web service runtime, - * and Web service client implementation type is supported. <code>false</code> otherwise. - */ - public static boolean isServerClientRuntimeTypeSupported(String serverFactoryId, String runtimeId, String clientImplId) - { - //Ensure there is at least one clientRuntime 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 an array of {@link IFacetedProjectTemplate} ids that support the given Web service client implementation type - * and Web service runtime. - * - * @param clientImplId id of a Web service client implementation type - * @param runtimeId id of a Web service runtime - * @return String[] array of {@link IFacetedProjectTemplate} ids that support the given Web service client implementation type - * and Web service runtime. The array may have 0 elements. Returns null if no clientRuntimes supporting - * the given Web service client implementation type could be found. - */ - 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 clientRuntime - Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(desc.getId()); - - //Add the template ids to the list if they have not already been added - Iterator itr = templates.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (!templateIdList.contains(template.getId())) - { - templateIdList.add(template.getId()); - } - } - } - - } - - return (String[])templateIdList.toArray(new String[]{}); - } - - /** - * Returns whether or not the given {@link IFacetedProjectTemplate} supports the given - * Web service client implementation type and Web service runtime. - * - * @param clientImplId id of a Web service client implementation type - * @param runtimeId id of a Web service runtime - * @param templateId id of a {@link IFacetedProjectTemplate} - * @return boolean <code>true</code> if the given {@link IFacetedProjectTemplate} supports the given - * Web service client implementation type and Web service runtime. Returns <code>false</code> otherwise. - */ - 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 clientRuntime - Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(crIds[i]); - - //Check if the template ids contains the template we're checking for - Iterator itr = templates.iterator(); - while (itr.hasNext()) - { - IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next(); - if (template.getId().equals(templateId)) - { - return true; - } - } - } - - } - - return false; - } - - - /** - * Returns whether or not the given {@link IFacetedProjectTemplate} - * supports the given clientRuntime - * - * @param clientRuntimeId id of a clientRuntime - * @param templateId id of a {@link IFacetedProjectTemplate} - * @return boolean <code>true</code> if the given {@link IFacetedProjectTemplate} supports the given - * clientRuntime. Returns <code>false</code> otherwise. - */ - public static boolean doesClientRuntimeSupportTemplate(String clientRuntimeId, String templateId) - { - //Get the templates for this clientRuntime - Set templates = FacetMatchCache.getInstance().getTemplatesForClientRuntime(clientRuntimeId); - IFacetedProjectTemplate checkingTemplate = ProjectFacetsManager.getTemplate(templateId); - return templates.contains(checkingTemplate); - } - - /** - * Returns the labels and ids of all Web service client implementation types. - * Used to populate the Web service client type combo box on - * page 1 of the Web service wizard and Web service client wizard. - * @return {@link LabelsAndIds} - */ - 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; - - } - - /** - * Returns all server type ids for which there are configured server runtimes - * present in the workspace. - * - * @return String[] array of server type ids for which there are configured server runtimes - * present in the workspace. The array may have 0 elements. - */ - 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++) - { - if (st == null || st.getRuntimeType() == null) break; - 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(); - - if (rt != null) - { - IRuntimeType rtType = rt.getRuntimeType(); - if (rtType != null) - { - String runtimeRuntimeTypeId = rtType.getId(); - if (serverTypeRuntimeTypeId.equals(runtimeRuntimeTypeId)) - { - if (!fids.contains(st.getId())) - { - fids.add(st.getId()); - } - } - } - } - } - } - - return (String[])fids.toArray(new String[0]); - } - - /** - * Returns the names of all projects in the workspace which support the given Web service client - * implementation type and Web service runtime. - * - * @param typeId id of a Web service client implementation type - * @param runtimeId id of a Web service runtime - * @return String[] array of project names. The array may have 0 elements. - */ - public static String[] getProjectsForClientTypeAndRuntime(String typeId, String runtimeId) - { - IProject[] projects = FacetUtils.getAllProjects(); - ArrayList validProjects = new ArrayList(); - - for (int i=0; i<projects.length;i++) - { - if (doesClientTypeAndRuntimeSupportProject(typeId, runtimeId, projects[i].getName())) - { - validProjects.add(projects[i].getName()); - } - } - - return (String[])validProjects.toArray(new String[0]); - - } - - /** - * Returns whether or not the given project supports the given Web service client implementation type - * and Web service runtime. - * - * @param typeId id of a Web service client implementation type - * @param runtimeId id of a Web service runtime - * @param projectName name of an IProject in the workspace - * @return boolean <code>true</code> if the project supports the given Web service type and - * Web service runtime. Returns <code>false</code> - * <ul> - * <li>if the project does not support the given Web service client implementation type and - * Web service runtime or</li> - * <li>if the project does not exist or</li> - * <li>if projectName is null or empty</li> - * </ul> - */ - public static boolean doesClientTypeAndRuntimeSupportProject(String typeId, String runtimeId, String projectName) - { - String[] descs = getClientRuntimesByType(typeId); - for (int j = 0; j < descs.length; j++) - { - ClientRuntimeDescriptor desc = getClientRuntimeDescriptorById(descs[j]); - if (desc.getRuntime().getId().equals(runtimeId)) - { - if (doesClientRuntimeSupportProject(descs[j], projectName)) - { - return true; - } - } - } - - return false; - - - } - - - /** - * Returns whether or not the given project supports the given clientRuntime. - * @param clientRuntimeId id of a clientRuntime - * @param projectName name of an IProject in the workspace - * @return boolean <code>true</code> if the project supports the given - * clientRuntime. Returns <code>false</code> - * <ul> - * <li>if the project does not support the given clientRuntime or</li> - * <li>if the project does not exist or</li> - * <li>if projectName is null or empty</li> - * </ul> - */ - public static boolean doesClientRuntimeSupportProject(String clientRuntimeId, String projectName) - { - FacetMatcher fm = FacetMatchCache.getInstance().getMatchForProject(true, clientRuntimeId, projectName); - if (fm != null) - { - return fm.isMatch(); - } - else - { - return false; - } - } - - //Utilities used by the ServerRuntimePreferencePage - - private static SelectionListChoices serverToRuntimeToJ2EE_; - private static Hashtable serverFactoryIdByLabel_; - private static Hashtable runtimeIdByLabel_; - - /** - * Returns the {@link SelectionListChoices} data structure representing the - * server type > Web service runtime > J2EE cascading lists . - * {@link SelectionListChoices} is a data structure which is like a cascading - * set of lists useful for populating a group of combo boxes in which the - * selection in a given combo box determines the list of items used to populate - * the combo box below it. The Server Runtime preference page contains two combo - * boxes: one for server types and, below it, one for Web service runtimes. - * The server type combo box is meant to contain the list of all available server types - * that support at least one Web service runtime on either the client or service side. - * The Web service runtime combo box is meant to contain the subset of Web service runtimes - * supported by the server type selected in the server type combo box. - * The SelectionListChoices returned by this method has three lists: server types, Web service runtimes, - * and J2EE levels. The first two lists correspond to the combo boxes on the preference - * page and are used to populate them. The J2EE levels list is a historical remnant from - * when J2EE levels used to be displayed on the preference page. It remains in this - * data structure with some hard-coded values but is not rendered to the user. - * - * @return SelectionListChoices representing the server type > Web service runtime > J2EE cascading lists - */ - public static SelectionListChoices getServerToRuntimeToJ2EE() - { - if (serverToRuntimeToJ2EE_!=null) - { - return serverToRuntimeToJ2EE_; - } - - //TODO (see bug 116025): Instead of all server type ids, we should be calculating the set of server - //types that support at least one Web service runtime on either the client or service side. - //Getting all server types for now. - 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) - { - //TODO (see bug 116025): Instead of all Web service runtimes, we should be - //calculating the subset of Web service runtimes supported by the server type - //with id equal to serverFactoryId. Getting all the Web service runtimes for now. - Set runtimes = registry.runtimes_.keySet(); - Iterator itr = registry.runtimes_.keySet().iterator(); - String[] runtimeIds = new String[runtimes.size()]; - 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 have been removed from the Server Runtime preference page. - //Return some hard coded values. These will not be rendered on the preference page. - String[] j2eeVersions = new String[]{"13", "14"}; - SelectionList j2eeVersionsList = new SelectionList(j2eeVersions, 0); - return new SelectionListChoices(j2eeVersionsList, null); - } - - private static String[] getAllServerFactoryIds() - { - //TODO (see bug 116025): Instead of all server type ids, we should be calculating the set of server - //types that support at least one Web service runtime on either the client or service side. - //Return all server type ids for now. - 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; - } - - /** - * Returns a server type id given the server type's label - * @param label server type label - * @return server type id or null if no server type with the given - * label is found. - */ - 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; - } - } - - /** - * Returns a Web service runtime's id given its label - * @param label Web service runtime label - * @return Web service runtime id or null if no - * Web service runtime with the given label is found. - */ - 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); - } - - - /** - * Returns a set of facet runtimes that support the given - * required facet versions. - * @param requiredFacetVersions an array containing elements of type {@link RequiredFacetVersion} - * @return Set set of facet runtimes that support the given required facet versions. - * (element type: {@link IRuntime}) - */ - private static Set getRuntimes(RequiredFacetVersion[] requiredFacetVersions) - { - return FacetUtils.getRuntimes(requiredFacetVersions); - } - -/** - * Get the service runtime checker class - * @param serviceRuntimeId service runtime ID - * @return - */ - public static IWebServiceRuntimeChecker getServiceRuntimeChecker(String serviceRuntimeId) { - return getServiceRuntimeDescriptorById(serviceRuntimeId).getServiceRuntimeChecker(); - - } - -/** - * Get the client runtime checker class - * @param clientRuntimeId - * @return - */ -public static IWebServiceRuntimeChecker getClientRuntimeChecker(String clientRuntimeId) { - return getClientRuntimeDescriptorById(clientRuntimeId).getClientRuntimeChecker(); - - } -} 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 a8e2562d7..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeInfo.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060216 127138 pmoogk@ca.ibm.com - Peter Moogk - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.wsrt; - -import java.util.Hashtable; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.wst.ws.internal.wsrt.IWebServiceRuntime; -import com.ibm.icu.util.StringTokenizer; - - -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_; - } - -} |