diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst')
16 files changed, 0 insertions, 3035 deletions
diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/Messages.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/Messages.java deleted file mode 100644 index 8b20b3e66..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/Messages.java +++ /dev/null @@ -1,75 +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.wst.wsi.ui.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Translated messages. - */ -public class Messages extends NLS -{ - //--------------- Validation Wizard --------------- - public static String VALIDATION_WIZARD_TITLE; - - //--------------- Validation Wizard (WSDL page) --------------- - public static String WSDL_PAGE_FILE_SHELL_TEXT; - public static String WSDL_PAGE_FILE_TITLE ; - public static String WSDL_PAGE_FILE_DESCRIPTION; - public static String WSDL_PAGE_SELECT_WSDL_FILENAME_HEADING; - public static String WSDL_PAGE_SELECT_WSDL_FILENAME_EXPL; - public static String WSDL_PAGE_INCLUDE_WSDL_BUTTON; - public static String WSDL_PAGE_INCLUDE_WSDL_LABEL; - public static String WSDL_PAGE_VALID_WSDL_LABEL; - public static String WSDL_PAGE_WORKBENCH_BUTTON; - public static String WSDL_PAGE_BROWSE_BUTTON; - public static String WSDL_PAGE_SEARCH_UDDI_BUTTON; - - //--------------- Validation Wizard (WSDL content page) --------------- - public static String WSDL_CONTENT_PAGE_SELECT_HEADING; - public static String WSDL_CONTENT_PAGE_SELECT_EXPL; - public static String WSDL_CONTENT_PAGE_GROUP_TEXT_ELEMENT; - public static String WSDL_CONTENT_PAGE_GROUP_TEXT_TYPE; - public static String WSDL_CONTENT_PAGE_RADIO_PORT; - public static String WSDL_CONTENT_PAGE_RADIO_BINDING; - public static String WSDL_CONTENT_PAGE_RADIO_PORT_TYPE; - public static String WSDL_CONTENT_PAGE_RADIO_OPERATION; - public static String WSDL_CONTENT_PAGE_RADIO_MESSAGE; - public static String WSDL_CONTENT_PAGE_LABEL_NAME; - public static String WSDL_CONTENT_PAGE_LABEL_NAMESPACE; - public static String WSDL_CONTENT_PAGE_LABEL_PARENT; - - //--------------- Validation Wizard (Log page) --------------- - public static String LOG_PAGE_SELECT_LOG_FILENAME_HEADING; - public static String LOG_PAGE_SELECT_LOG_FILENAME_EXPL; - - // Actions - public static String ACTION_WSI_VALIDATOR; - - //--------------- Errors --------------- - public static String ERROR_UNABLE_TO_VALIDATE; - public static String ERROR_VALIDATION_FAILED; - public static String ERROR_THE_WSIMSG_FILE_IS_NOT_VALID; - public static String ERROR_PROBLEMS_READING_WSIMSG_FILE; - public static String ERROR_INVALID_LOG_FILE_EXTENSION; - public static String WARNING_VALIDATION_WARNINGS_DETECTED; - public static String WARNING_FILE_ALREADY_EXISTS; - - //--------------- Informational messages --------------- - public static String INFO_VALIDATION_SUCEEDED; - public static String INFO_THE_WSIMSG_FILE_IS_VALID; - public static String INFO_NO_MESSAGES_TO_VALIDATE; - - static - { - NLS.initializeMessages(WSIUIPlugin.PLUGIN_ID + ".internal.Messages", Messages.class); - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/Messages.properties b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/Messages.properties deleted file mode 100644 index 864b370c6..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/Messages.properties +++ /dev/null @@ -1,61 +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 - Initial API and implementation -# *******************************************************************************/ - -# --------------- Validation Wizard --------------- -VALIDATION_WIZARD_TITLE = Validate WS-I Message Log File - -# --------------- Validation Wizard (WSDL page) --------------- -WSDL_PAGE_FILE_SHELL_TEXT = Select File -WSDL_PAGE_FILE_TITLE = Select a File -WSDL_PAGE_FILE_DESCRIPTION = Select a file from the workbench. -WSDL_PAGE_SELECT_WSDL_FILENAME_HEADING = Include WSDL File -WSDL_PAGE_SELECT_WSDL_FILENAME_EXPL = Optionally select a WSDL file for the Web service -WSDL_PAGE_INCLUDE_WSDL_BUTTON = Include WSDL document for Web service -WSDL_PAGE_INCLUDE_WSDL_LABEL = Enter the location of the WSDL document for the Web service -WSDL_PAGE_VALID_WSDL_LABEL = *Note: You can only select the Next button if the WSDL document is valid. -WSDL_PAGE_WORKBENCH_BUTTON = Workbench... -WSDL_PAGE_BROWSE_BUTTON = Browse... -WSDL_PAGE_SEARCH_UDDI_BUTTON = Search UDDI... - -# --------------- Validation Wizard (WSDL content page) --------------- -WSDL_CONTENT_PAGE_SELECT_HEADING = Specify the WSDL element to be Analyzed -WSDL_CONTENT_PAGE_SELECT_EXPL = Indicate the name, type, and namespace of the WSDL element to be analyzed -WSDL_CONTENT_PAGE_GROUP_TEXT_ELEMENT = The WSDL element -WSDL_CONTENT_PAGE_GROUP_TEXT_TYPE = type -WSDL_CONTENT_PAGE_RADIO_PORT = port -WSDL_CONTENT_PAGE_RADIO_BINDING = binding -WSDL_CONTENT_PAGE_RADIO_PORT_TYPE = portType -WSDL_CONTENT_PAGE_RADIO_OPERATION = operation -WSDL_CONTENT_PAGE_RADIO_MESSAGE = message -WSDL_CONTENT_PAGE_LABEL_NAME = name: -WSDL_CONTENT_PAGE_LABEL_NAMESPACE = namespace: -WSDL_CONTENT_PAGE_LABEL_PARENT = parent: - -# --------------- Validation Wizard (Log page) --------------- -LOG_PAGE_SELECT_LOG_FILENAME_HEADING = Specify the WS-I Message Log File Name -LOG_PAGE_SELECT_LOG_FILENAME_EXPL = Select a folder and specify a message log file name - -# Actions -ACTION_WSI_VALIDATOR = WS-I Message Validator - -# --------------- Errors --------------- -ERROR_UNABLE_TO_VALIDATE = Unable to Validate -ERROR_VALIDATION_FAILED = Validation Failed -ERROR_THE_WSIMSG_FILE_IS_NOT_VALID = The WS-I Message Log file is not valid. See the Problems view for a list of the validation errors. -ERROR_PROBLEMS_READING_WSIMSG_FILE = Problems reading the WS-I Message Log file. See the Problems view for a list of errors. -ERROR_INVALID_LOG_FILE_EXTENSION = The file name extension can only be ".wsimsg". -WARNING_VALIDATION_WARNINGS_DETECTED = However warnings have been issued. See the Problems view for a list of the validation warnings. -WARNING_FILE_ALREADY_EXISTS = Warning: The file already exists and will be overwritten. - -# --------------- Informational messages --------------- -INFO_VALIDATION_SUCEEDED = Validation Succeeded -INFO_THE_WSIMSG_FILE_IS_VALID = The WS-I Message Log file is valid. -INFO_NO_MESSAGES_TO_VALIDATE = No Messages to Validate diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/Resource.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/Resource.java deleted file mode 100644 index 04b20ca9a..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/Resource.java +++ /dev/null @@ -1,21 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal; - -/** - * GIF constants - * - * @author David Lauzon, IBM - */ -public interface Resource -{ - public static final String VALIDATE_WSI_LOGFILE_WIZ = "actions/icons/wsi_logfile_wiz.gif"; -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/ResourceFilter.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/ResourceFilter.java deleted file mode 100644 index be02256d1..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/ResourceFilter.java +++ /dev/null @@ -1,101 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; - -import java.util.Collection; - -public class ResourceFilter extends ViewerFilter -{ - protected String[] fExtensions; - protected IFile[] fExcludedFiles; - protected Collection fExcludes; - - public ResourceFilter(String[] extensions, Collection exclude) - { - fExtensions= extensions; - fExcludes= exclude; - fExcludedFiles = null; - } - - public ResourceFilter(String[] extensions, IFile[] excludedFiles, Collection exclude) - { - fExtensions= extensions; - fExcludes= exclude; - fExcludedFiles = excludedFiles; - } - - public boolean isFilterProperty(Object element, Object property) - { - return false; - } - - public boolean select(Viewer viewer, Object parent, Object element) - { - if (element instanceof IFile) - { - if (fExcludes != null && fExcludes.contains(element)) - { - return false; - } - String name= ((IFile)element).getName(); - if (fExcludedFiles != null) - { - for (int j= 0; j < fExcludedFiles.length; j++) - { - if ( ((IFile)element).getLocation(). - toString().compareTo(((IFile)fExcludedFiles[j]).getLocation().toString()) == 0 ) - return false; - } - } - if (fExtensions.length == 0) - { - // assume that we don't want to filter any files based on - // extension - return true; - } - for (int i= 0; i < fExtensions.length; i++) - { - if (name.endsWith(fExtensions[i])) - { - return true; - } - } - return false; - } - else if (element instanceof IContainer) - { // IProject, IFolder - try - { - IResource[] resources= ((IContainer)element).members(); - for (int i= 0; i < resources.length; i++) - { - // recursive! - if (select(viewer, parent, resources[i])) - { - return true; - } - } - } - catch (CoreException e) - { - } - } - return false; - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/WSIMessageValidator.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/WSIMessageValidator.java deleted file mode 100644 index c5ea44c07..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/WSIMessageValidator.java +++ /dev/null @@ -1,59 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.wst.validation.internal.core.ValidationException; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.wst.validation.internal.provisional.core.IValidationContext; -import org.eclipse.wst.validation.internal.provisional.core.IValidator; -import org.eclipse.wst.wsi.ui.internal.actions.WSIValidateAction; -//import org.eclipse.wst.wsi.internal.core.report.impl.DefaultReporter; - -/** - * A Validator that performs validation on a WS-I Message Log file. - * - * @author David Lauzon, IBM - */ -public class WSIMessageValidator implements IValidator -{ - protected IReporter reporter; - public static final String WSI_MESSAGE_VALIDATOR_ID = "wsimessagevalidator".intern(); - - /* (non-Javadoc) - * @see org.eclipse.validate.IValidator#validate(org.eclipse.core.resources.IFile) - */ - public void validate(IFile file) - { - WSIValidateAction validateAction = new WSIValidateAction(file, false); - validateAction.setValidator(this); - //validateAction.setReporter(getReporter()); - validateAction.run(); - } - - /* (non-Javadoc) - * @see org.eclipse.validate.IValidator#setReporter(org.eclipse.validate.IReporter) - */ - public void setReporter(IReporter reporter) - { - this.reporter = reporter; - } - -public void cleanup(IReporter reporter) { - // TODO Auto-generated method stub - -} - -public void validate(IValidationContext helper, IReporter reporter) throws ValidationException - { - // TODO Auto-generated method stub - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/WSIUIPlugin.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/WSIUIPlugin.java deleted file mode 100644 index 6bac68f69..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/WSIUIPlugin.java +++ /dev/null @@ -1,82 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * WSIValidatePlugin is a plugin that integrates with the Eclipse platform UI. - * - * @author David Lauzon, IBM - * @author Lawrence Mandel, IBM - */ - -public class WSIUIPlugin extends AbstractUIPlugin -{ - /** - * The singleton. - */ - protected static WSIUIPlugin instance; - public static final String PLUGIN_ID = "org.eclipse.wst.wsi.ui"; - /** - * Constructor. - */ - public WSIUIPlugin() - { - super(); - instance = this; - } - - /** - * Returns the singleton. (Based on the Singleton Pattern). - */ - public static WSIUIPlugin getInstance() - { - return instance; - } - - protected ImageRegistry createImageRegistry() - { - ImageRegistry registry = super.createImageRegistry(); - registerImage(registry, Resource.VALIDATE_WSI_LOGFILE_WIZ); - return registry; - } - - /** - * Register an image with the registry. - * - * @param key the key - */ - private void registerImage(ImageRegistry registry, String key) - { - try - { - ImageDescriptor id = ImageDescriptor.createFromFile(WSIUIPlugin.class, key); - registry.put(key, id); - } catch (Exception e) - { - } - } - - /** - * Convience API. - * Finds the specified image stored in this plug-in's image registry. - * @param iconName: the name of the image. - * @return the image associated with the given name. - */ - public static Image getResourceImage(String iconName) - { - return instance.getImageRegistry().get(iconName); - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/WSIValidator.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/WSIValidator.java deleted file mode 100644 index 0db64458f..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/WSIValidator.java +++ /dev/null @@ -1,65 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.wst.wsi.ui.internal.actions.WSIValidateAction; - -/** - * A simple interface to the WS-I message log validator. - * - * @author Lawrence Mandel, IBM - */ -public class WSIValidator { - - /** - * Constructor. - */ - public WSIValidator() - { - } - - /** - * Validate the given log file. - * - * @param file The log file to validate. - */ - public void validate(IFile file) - { - WSIMessageValidator messageValidator = new WSIMessageValidator(); - WSIValidateAction validateAction = new WSIValidateAction(file, true); - validateAction.setValidator(messageValidator); - validateAction.run(); - } - - /** - * Validate the given log file with a WSDL document specified. - * - * @param file The log file to validate. - * @param wsdlfile The WSDL file to use for validation. - * @param elementname The WSDL element to validate. - * @param namespace The namespace of the WSDL element to validate. - * @param parentname The name of the parent element of the element to validate. - * @param type The type of the element to validate. - */ - /** - * Validate the given log file. - * - * @param file The log file to validate. - */ - public void validate(IFile file, String wsdlfile, String elementname, String namespace, String parentname, String type) - { - WSIMessageValidator messageValidator = new WSIMessageValidator(); - WSIValidateAction validateAction = new WSIValidateAction(file, true, wsdlfile, elementname, namespace, parentname, type); - validateAction.setValidator(messageValidator); - validateAction.run(); - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/WSIValidateAction.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/WSIValidateAction.java deleted file mode 100644 index 07d04bf48..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/WSIValidateAction.java +++ /dev/null @@ -1,296 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal.actions; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.wst.validation.internal.core.IMessageAccess; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.wst.validation.internal.provisional.core.IValidator; -import org.eclipse.wst.validation.internal.provisional.core.MessageLimitException; -import org.eclipse.wst.wsi.internal.analyzer.MessageAnalyzer; -import org.eclipse.wst.wsi.internal.analyzer.WSIAnalyzerException; -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.ui.internal.Messages; -import org.eclipse.wst.wsi.internal.report.AssertionError; -import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage; -import org.eclipse.wst.xml.ui.internal.validation.ValidateAction; -import org.xml.sax.SAXParseException; - -/** - * Action for running the validator. - * - * @author David Lauzon, IBM - * @author Lawrence Mandel, IBM - */ -public class WSIValidateAction extends ValidateAction -{ - protected IValidator validator; - - protected String wsdlfile = null; - protected String elementname = null; - protected String namespace = null; - protected String parentname = null; - protected String type = null; - protected boolean wsdlspecified = false; - protected boolean exceptionCaught = false; - - /** - * Constructor. - * - * @param f The file to validate - * @param showDialog Whether or not to show a status dialog after validation. - */ - public WSIValidateAction(IFile f, boolean showDialog) - { - super(f, showDialog); - } - - /** - * Constructor with WSDL element specified. - * - * @param f The file to validate. - * @param showDialog Whether or not to show a status dialog after validation. - * @param file The WSDL file to use for validation. - * @param elementname The name of the WSDL element to validate. - * @param namespace The namespace of the WSDL element to validate - * @param parentname The parent name of the WSDL element to validate. - * @param type The type of element to validate. - */ - public WSIValidateAction(IFile f, boolean showDialog, String file, String elementname, String namespace, String parentname, String type) - { - this(f, showDialog); - if (file != null) - { - wsdlfile = file.replace('\\', '/'); - if ((!wsdlfile.startsWith(WSIConstants.FILE_PREFIX)) && - (!wsdlfile.startsWith(WSIConstants.HTTP_PREFIX))) - { - wsdlfile = WSIConstants.FILE_PROTOCOL + wsdlfile; - } - } - this.elementname = elementname; - this.namespace = namespace; - this.parentname = parentname; - this.type = type; - this.wsdlspecified = true; - } - - /* (non-Javadoc) - * @see org.eclipse.validate.ValidateAction#validate(org.eclipse.core.resources.IFile) - */ - protected void validate(final IFile file1) - { - final MessageAnalyzer messageanalyzer; - - if(wsdlspecified) - { - messageanalyzer = new MessageAnalyzer(WSIConstants.FILE_PROTOCOL + file1.getLocation().toString(), wsdlfile, elementname, namespace, parentname, type); - } - else - { - messageanalyzer = new MessageAnalyzer(WSIConstants.FILE_PROTOCOL + file1.getLocation().toString()); - } - - IWorkspaceRunnable op = new IWorkspaceRunnable() - { - public void run(IProgressMonitor progressMonitor) throws CoreException - { - clearMarkers(file1); - try - { - messageanalyzer.validateConformance(); - } - catch (WSIAnalyzerException ae) - { - exceptionCaught = true; - if (ae.getTargetException() instanceof SAXParseException) - { - createMarkers(file1, new ValidationMessage[]{createValidationMessageForException((SAXParseException)ae.getTargetException(), ValidationMessage.SEV_NORMAL)}); - } - else - { - createMarkers(file1, new ValidationMessage[]{createValidationMessageForException(ae, ValidationMessage.SEV_NORMAL)}); - } - } - catch (Exception e) - { - } - - createMarkers(file1, convertValidationMessages(messageanalyzer.getAssertionWarnings(), ValidationMessage.SEV_LOW)); - createMarkers(file1, convertValidationMessages(messageanalyzer.getAssertionErrors(), ValidationMessage.SEV_NORMAL)); - file.setSessionProperty(ValidationMessage.ERROR_MESSAGE_MAP_QUALIFIED_NAME, getOrCreateReporter().getMessages()); - } - }; - - - try - { - ResourcesPlugin.getWorkspace().run(op, null); - if (showDialog) - { - if (exceptionCaught) - { - MessageDialog.openError(Display.getDefault().getActiveShell(), - Messages.ERROR_UNABLE_TO_VALIDATE, - Messages.ERROR_PROBLEMS_READING_WSIMSG_FILE); - } - else if (messageanalyzer.getAssertionErrors().size() != 0) - { - MessageDialog.openError(Display.getDefault().getActiveShell(), - Messages.ERROR_VALIDATION_FAILED, - Messages.ERROR_THE_WSIMSG_FILE_IS_NOT_VALID); - } - else if (messageanalyzer.getAssertionWarnings().size() != 0) - { - String title = Messages.INFO_VALIDATION_SUCEEDED; - String message = Messages.WARNING_VALIDATION_WARNINGS_DETECTED; - MessageDialog.openInformation(Display.getDefault().getActiveShell(), title, message); - } - else - { - String title = Messages.INFO_VALIDATION_SUCEEDED; - String message = Messages.INFO_THE_WSIMSG_FILE_IS_VALID; - MessageDialog.openInformation(Display.getDefault().getActiveShell(), title, message); - } - } - } - catch(Exception e){} - } - - /** - * Create a validation message from the exception and severity. - * - * @param error The error. - * @param severity The severity. - * @return An error message. - */ - protected ValidationMessage createValidationMessageForException(SAXParseException error, int severity) - { - String uri = error.getSystemId(); - if(uri == null) - { - uri = error.getPublicId(); - } - ValidationMessage validationMessage = new ValidationMessage(error.getMessage(), error.getLineNumber(), error.getColumnNumber(), uri); - validationMessage.setSeverity(severity); - return validationMessage; - } - - - /** - * Create a validation message from the exception and severity. - * - * @param error The error. - * @param severity The severity. - * @return An error message. - */ - protected ValidationMessage createValidationMessageForException(WSIAnalyzerException error, int severity) - { - ValidationMessage validationMessage = new ValidationMessage(error.getMessage(), 0, 0); - validationMessage.setSeverity(severity); - return validationMessage; - } - - public ValidationMessage[] convertValidationMessages(List list, int marker) - { - if (list != null) - { - int size = list.size(); - ValidationMessage[] messages = new ValidationMessage[size]; - - for (int i = 0; i < size; i++) - { - AssertionError assertionError = (AssertionError) list.get(i); - - int n = assertionError.getLine(); - int c = assertionError.getColumn(); - String m = WSIConstants.WSI_PREFIX + "(" + assertionError.getAssertionID()+ ") " + assertionError.getErrorMessage(); - - ValidationMessage message = new ValidationMessage(m,n, c); - message.setSeverity(marker); - messages[i] = message; - } - return messages; - } - return new ValidationMessage[0]; - } - - /** - protected IReporter getOrCreateReporter() - { - if (reporter == null) - { - reporter = new Reporter(); - } - return reporter; - } - */ - // My Implementation of IReporter - class Reporter implements IReporter - { - List list = new ArrayList(); - - public Reporter() { - super(); - } - - public IMessageAccess getMessageAccess() { - return null; // do not need to implement - } - - public boolean isCancelled() { - return false; // do not need to implement - } - - public void removeAllMessages(IValidator origin, Object object) { // do - // not - // need - // to - // implement - } - - public void removeAllMessages(IValidator origin) {// do not need to - // implement - } - - public void removeMessageSubset(IValidator validator, Object obj, String groupName) {// do - // not - // need - // to - // implement - } - - public List getMessages() { - return list; - } - - public void addMessage(IValidator origin, IMessage message) throws MessageLimitException - { - list.add(message); - } - - public void displaySubtask(IValidator validator, IMessage message) - { - // TODO Auto-generated method stub - - } - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/RequestHandlerImpl.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/RequestHandlerImpl.java deleted file mode 100644 index 425f608fd..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/RequestHandlerImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -package org.eclipse.wst.wsi.ui.internal.actions.actionDelegates; - -import java.util.Date; - -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.wsi.internal.core.log.RequestHandler; - -/** - * Implements the RequestHandler interface which represents a TCP/IP - * request made between the client and the server. Each request - * represents a request-response pair, where the request is from - * client -> server, and the response is from server -> client. - * - * @author lauzond - */ -public class RequestHandlerImpl implements RequestHandler -{ - /** - * The HTTP header of the request portion of this request. - */ - protected byte[] requestHeader; - - /** - * The HTTP header of the response portion of this request. - */ - protected byte[] responseHeader; - - /** - * The HTTP body of the request portion of this request. - */ - protected byte[] requestContent; - - /** - * The HTTP body of the response portion of this request. - */ - protected byte[] responseContent; - - /** - * The time this request was made. - */ - protected Date date = null; - - /** - * The local (client) port. - */ - protected int localPort = 0; - - /** - * The remote (server) port. - */ - protected int remotePort = 0; - - /** - * The remote (server) host. - */ - protected String remoteHost = null; - - /** - * The server's response time in milliseconds. - */ - protected long responseTime = 0; - - /** - * Constructor. - * @param request a TCP/IP request - */ - RequestHandlerImpl(Request request) - { - if (request != null) - { - this.requestHeader = request.getRequest(Request.TRANSPORT); - this.requestContent = request.getRequest(Request.CONTENT); - this.responseHeader = request.getResponse(Request.TRANSPORT); - this.responseContent = request.getResponse(Request.CONTENT); - this.date = request.getDate(); - this.localPort = request.getLocalPort(); - this.remotePort = request.getRemotePort(); - this.remoteHost = request.getRemoteHost(); - this.responseTime = request.getResponseTime(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getRequestHeader() - */ - public byte[] getRequestHeader() - { - return this.requestHeader; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setRequestHeader(byte[]) - */ - public void setRequestHeader(byte[] requestHeader) - { - this.requestHeader = requestHeader; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getResponseHeader() - */ - public byte[] getResponseHeader() - { - return this.responseHeader; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setResponseHeader(byte[]) - */ - public void setResponseHeader(byte[] responseHeader) - { - this.responseHeader = responseHeader; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getRequestContent() - */ - public byte[] getRequestContent() - { - return this.requestContent; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setResponseContent(byte[]) - */ - public void setResponseContent(byte[] responseContent) - { - this.responseContent = responseContent; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getResponseContent() - */ - public byte[] getResponseContent() - { - return this.responseContent; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setRequestContent(byte[]) - */ - public void setRequestContent(byte[] requestContent) - { - this.requestContent = requestContent; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getDate() - */ - public Date getDate() - { - return this.date; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setDate(java.util.Date) - */ - public void setDate(Date date) - { - this.date = date; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getLocalPort() - */ - public int getLocalPort() - { - return this.localPort; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setLocalPort(int) - */ - public void setLocalPort(int localPort) - { - this.localPort = localPort; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getRemotePort() - */ - public int getRemotePort() - { - return this.remotePort; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setRemotePort(int) - */ - public void setRemotePort(int remotePort) - { - this.remotePort = remotePort; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getRemoteHost() - */ - public String getRemoteHost() - { - return this.remoteHost; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setRemoteHost(java.lang.String) - */ - public void setRemoteHost(String remoteHost) - { - this.remoteHost = remoteHost; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#getResponseTime() - */ - public long getResponseTime() - { - return this.responseTime; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsi.internal.core.log.RequestHandler#setResponseTime(long) - */ - public void setResponseTime(long responseTime) - { - this.responseTime = responseTime; - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSILogFileActionDelegate.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSILogFileActionDelegate.java deleted file mode 100644 index 3c410e841..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSILogFileActionDelegate.java +++ /dev/null @@ -1,76 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal.actions.actionDelegates; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IActionDelegate; - -import org.eclipse.wst.wsi.ui.internal.WSIMessageValidator; -import org.eclipse.wst.wsi.ui.internal.actions.WSIValidateAction; - - -/** - * Action delegate for validating a WS-I log file. - * - * @author David Lauzon, IBM - * @author Lawrence Mandel, IBM - */ -public class ValidateWSILogFileActionDelegate implements IActionDelegate -{ - /** - * The current selection, or null if there is no selection. - */ - ISelection selection; - - /** - * Constructor. - */ - public ValidateWSILogFileActionDelegate() - { - } - - /** - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) - { - try - { - if (selection instanceof IStructuredSelection) - { - Object obj = ((IStructuredSelection)selection).getFirstElement(); - if (obj instanceof IFile) - { - IFile file = (IFile)obj; - WSIMessageValidator messageValidator = new WSIMessageValidator(); - WSIValidateAction validateAction = new WSIValidateAction(file, true); - validateAction.setValidator(messageValidator); - validateAction.run(); - } - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) - { - this.selection = selection; - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSIProfileActionDelegate.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSIProfileActionDelegate.java deleted file mode 100644 index 31bae5be5..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/actionDelegates/ValidateWSIProfileActionDelegate.java +++ /dev/null @@ -1,240 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal.actions.actionDelegates; - -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.internet.monitor.ui.internal.provisional.MonitorUICore; -import org.eclipse.wst.wsi.internal.core.log.LogBuilder; -import org.eclipse.wst.wsi.internal.core.log.RequestHandler; -import org.eclipse.wst.wsi.ui.internal.Messages; -import org.eclipse.wst.wsi.ui.internal.wizards.ValidationWizard; -import org.eclipse.wst.wsi.ui.internal.WSIValidator; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.ContainerGenerator; -import org.eclipse.wst.wsi.internal.core.log.Log; - -/** - * Action delegate for the WS-I validator. - * - * @author David Lauzon, IBM - * @author Lawrence Mandel, IBM - */ -public class ValidateWSIProfileActionDelegate implements IViewActionDelegate -{ - /** - * The default WS-I Message Log filename. - */ - public static final String DEFAULT_LOG_FILENAME = "log.wsimsg"; - - /** - * The HTTP protocol. - */ - private final String HTTP = "http://"; - - - /** - * The default tag for WSDL locations. - */ - private final String WSDL = "?WSDL"; - - /** - * The current selection, or null if there is no selection. - */ - ISelection selection; - - /** - * The list of messages in the form of request-response pairs. - */ - Request[] requestResponses; - - /** - * The view that provides the context for this delegate. - */ - IViewPart view; - - /** - * Constructor. - */ - public ValidateWSIProfileActionDelegate() - { - } - - /** - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) - { - this.view = view; - } - - /** - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) - { - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() - { - protected void execute(IProgressMonitor progressMonitor) - throws CoreException - { - validate(progressMonitor); - } - }; - - try - { - operation.run(null); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /** - * The validate action. - * - * @param progressMonitor - */ - public void validate(IProgressMonitor progressMonitor) - { - try - { - requestResponses = MonitorUICore.getRequests(); - Shell shell = Display.getCurrent().getActiveShell(); - if ((requestResponses != null) && (requestResponses.length > 0)) - { - ValidationWizard validateWizard = new ValidationWizard(DEFAULT_LOG_FILENAME); - List wsdllocs = new Vector(); - - for (int i=0; i<requestResponses.length; i++) - { - Request reqresp = requestResponses[i]; - String remotehost = reqresp.getRemoteHost(); - int remoteport = reqresp.getRemotePort(); - String remotelabel = reqresp.getName(); - String location = HTTP + remotehost + ":" + remoteport + remotelabel + WSDL; - if(!wsdllocs.contains(location)) - { - wsdllocs.add(location); - } - } - - validateWizard.setWSDLLocations((String[])wsdllocs.toArray(new String[wsdllocs.size()])); - WizardDialog wizardDialog = new WizardDialog(shell, validateWizard); - wizardDialog.create(); - - int result = wizardDialog.open(); - - if (validateWizard.isValid() && (result != org.eclipse.jface.window.Window.CANCEL)) - { - // If the container doesn't exist, create it now - checkAndCreateContainer(validateWizard.getContainerFullPath()); - - IFile file = validateWizard.getFile(); - LogBuilder builder = new LogBuilder(file); - Log log = builder.buildLog(getRequestHandlers(requestResponses)); - - builder.writeLog(log); - file.refreshLocal(1, progressMonitor); - - WSIValidator messageValidator = new WSIValidator(); - if(validateWizard.includeWSDLFile()) - { - String wsdlfile = validateWizard.getWSDLFile(); - String name = validateWizard.getElementName(); - String namespace = validateWizard.getNamespace(); - String parentname = validateWizard.getParentName(); - String type = validateWizard.getType(); - messageValidator.validate(file, wsdlfile, name, namespace, parentname, type); - } - else - { - messageValidator.validate(file); - } - } - } - else - { - // no available messages to validate - String title = Messages.ACTION_WSI_VALIDATOR; - String message = Messages.INFO_NO_MESSAGES_TO_VALIDATE; - MessageDialog.openInformation(shell, title, message); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - private List getRequestHandlers(Request[] requestResponses) - { - List requestHandlers = new ArrayList(); - int size = requestResponses.length; - for (int i = 0; i<size; i++) - { - Request request = requestResponses[i]; - RequestHandler handler = new RequestHandlerImpl(request); - requestHandlers.add(handler); - } - return requestHandlers; - } - - /** - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) - { - this.selection = selection; - } - - /** - * If the container doesn't exist for the selected IFile, create it now. - * - * @param containerPath The container for the selected IFile. - */ - public static void checkAndCreateContainer(IPath containerPath) - { - IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(containerPath); - - // If the container doesn't exist in the workspace, create it. - if (resource == null) - { - try - { - ContainerGenerator generator = new ContainerGenerator(containerPath); - generator.generateContainer(null); - } - catch (CoreException e) - { - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/icons/wsi_logfile_wiz.gif b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/icons/wsi_logfile_wiz.gif Binary files differdeleted file mode 100644 index 0cc8d3f6e..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/actions/icons/wsi_logfile_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizard.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizard.java deleted file mode 100644 index 0b38b9ade..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizard.java +++ /dev/null @@ -1,319 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal.wizards; - -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.wst.wsi.ui.internal.Messages; -import org.eclipse.wst.wsi.ui.internal.Resource; -import org.eclipse.wst.wsi.ui.internal.WSIUIPlugin; -import org.eclipse.ui.IViewReference; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.navigator.ResourceNavigator; - -/** - * This wizard allows the user to specify the location of the - * WS-I Message Log file for purposes of validation. - * - * @author David Lauzon, IBM - * @author Lawrence Mandel, IBM - */ - -public class ValidationWizard extends Wizard -{ - /** - * Wizard page to specify the location of the - * WS-I Message Log file for purposes of validation. - */ - protected ValidationWizardLogPage logPage; - - /** - * Wizard page to optionally specify the location - * of the WSDL document for the Web service. - */ - protected ValidationWizardWSDLPage wsdlPage; - - /** - * Wizard page to specify the name, type and namespace - * for the WSDL element to analyze. - */ - protected ValidationWizardWSDLContentPage wsdlContentPage; - - /** - * Default WS-I Message filename passed in the Constructor. - */ - protected String filename; - - /** - * The selected WS-I Message Log file. - */ - protected IFile file; - - /** - * The container holding the selected WS-I Message Log file. - */ - protected IPath containerFullPath; - - /** - * Flag indicating whether selected file is valid. - */ - protected boolean isValid; - - /** - * The name of the element to validate. - */ - protected String elementname; - - /** - * The namespace of the element to validate. - */ - protected String namespace; - - /** - * The name of the parent of the element to validate. - */ - protected String parentname; - - /** - * The type of the element to validate. - */ - protected String type; - - /** - * The WSDL file to use for validation; - */ - protected String wsdlfile; - - /** - * True if a WSDL file is included, false otherwise. - */ - protected boolean includewsdlfile; - - - /** - * This list of WSDL locations the user can choose from. - */ - protected String[] wsdllocations = null; - - /** - * Constructor. - * @param filename Default message log file name. - */ - public ValidationWizard(String filename) - { - this.filename = filename; - this.setWindowTitle(Messages.VALIDATION_WIZARD_TITLE); - setDefaultPageImageDescriptor( - ImageDescriptor.createFromFile(WSIUIPlugin.class, Resource.VALIDATE_WSI_LOGFILE_WIZ)); - setNeedsProgressMonitor(true); - } - - /** - * @see org.eclipse.jface.wizard.IWizard#addPages() - */ - public void addPages() - { - logPage = new ValidationWizardLogPage((IStructuredSelection) getResourceNavigatorSelection(), filename); - wsdlPage = new ValidationWizardWSDLPage((IStructuredSelection) getResourceNavigatorSelection()); - wsdlContentPage = new ValidationWizardWSDLContentPage((IStructuredSelection) getResourceNavigatorSelection()); - addPage(logPage); - addPage(wsdlPage); - addPage(wsdlContentPage); - - } - - /** - * @return True if a WSDL file is included, false otherwise. - */ - public boolean includeWSDLFile() - { - if (!isValid) - { - return wsdlPage.includeWSDLFile(); - } - return includewsdlfile; - } - - /** - * Get the element name to validate. - * - * @return The element name to validate. - */ - public String getElementName() - { - return elementname; - } - - /** - * Get the namespace for the element. - * - * @return The namespace for the element. - */ - public String getNamespace() - { - return namespace; - } - - /** - * Get the name of the parent of the element. - * - * @return The name of the parent of the element. - */ - public String getParentName() - { - return parentname; - } - - /** - * Get the type of the element. - * - * @return The type of the element. - */ - public String getType() - { - return type; - } - - public String getWSDLFile() - { - if (!isValid) - { - return wsdlPage.getWSDLFile(); - } - return wsdlfile; - } - - /** - * @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage) - */ - public IWizardPage getNextPage(IWizardPage currentPage) - { - if (currentPage == wsdlPage) - { - if (!wsdlPage.includeWSDLFile()) - { - return null; - } - else - { - try - { - WSDLFactory factory = WSDLFactory.newInstance(); - WSDLReader reader = factory.newWSDLReader(); - reader.readWSDL(getWSDLFile()); - } - catch (Exception e) - { - // If there is a problem with the WSDL file there is no next page. - return null; - } - } - } - return super.getNextPage(currentPage); - } - - /** - * Returns true if the selected file is a valid WS-I Message Log filename. - * - * @return True if the selected file is a valid WS-I Message Log filename. - */ - public boolean isValid() - { - return isValid; - } - - /** - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public boolean performFinish() - { - file = logPage.getFile(); - containerFullPath = logPage.getContainerFullPath(); - includewsdlfile = wsdlPage.includeWSDLFile(); - wsdlfile = wsdlPage.getWSDLFile(); - elementname = wsdlContentPage.getElementName(); - namespace = wsdlContentPage.getNamespace(); - parentname = wsdlContentPage.getParentName(); - type = wsdlContentPage.getType(); - isValid = true; - return true; - } - - /** - * Returns the file selected by the user in the choose page. - * - * @return the file selectedby the user in the choose page. - */ - public IFile getFile() - { - return file; - } - - /** - * Returns the IPath containing the selected IFile. - * - * @return the IPath containing the selected IFile. - */ - public IPath getContainerFullPath() - { - return containerFullPath; - } - - /** - * Returns the selection in the Resource Navigator view. - * - * @return the selection in the Resource Navigator view. - */ - public ISelection getResourceNavigatorSelection() - { - IViewReference viewParts[] = - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences(); - - for (int i = 0; i < viewParts.length; i++) - { - if (viewParts[i] instanceof ResourceNavigator) - { - return ((ResourceNavigator) viewParts[i]).getViewSite().getSelectionProvider().getSelection(); - } - } - return StructuredSelection.EMPTY; - } - - /** - * Set the list of WSDL locations to let the user choose from. - * - * @param wsdllocations A list of WSDL document locations. - */ - public void setWSDLLocations(String[] wsdllocations) - { - this.wsdllocations = wsdllocations; - - } - - /** - * Get the list of WSDL locations the user can choose from. - * - * @return The list of WSDL locations. - */ - public String[] getWSDLLocations() - { - return wsdllocations; - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizardLogPage.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizardLogPage.java deleted file mode 100644 index 8f88caa2f..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizardLogPage.java +++ /dev/null @@ -1,133 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal.wizards; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; - -import org.eclipse.wst.wsi.ui.internal.Messages; - -/** - * Wizard page that allows the user to specify the location of the - * WS-I Message Log file for purposes of validation. - * - * @author David Lauzon, IBM - */ - -public class ValidationWizardLogPage extends WizardNewFileCreationPage -{ - /** - * Recommended extension for a WS-I Message Log file. - */ - public static final String WSI_LOG_EXTENSION = "wsimsg"; - - /** - * Default WS-I Message filename passed in the Constructor. - */ - protected String filename; - - /** - * Constructor. - * - * @param selection: selection in the Resource Navigator view. - * @param filename: default message log file name. - */ - public ValidationWizardLogPage(IStructuredSelection selection, String filename) - { - super("ValidationWizardLogPage", selection); - this.filename = filename; - this.setTitle(Messages.LOG_PAGE_SELECT_LOG_FILENAME_HEADING); - this.setDescription(Messages.LOG_PAGE_SELECT_LOG_FILENAME_EXPL); - } - - - /** - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) - { - super.createControl(parent); - super.setFileName(filename); - setPageComplete(validatePage()); - } - - /** - * Returns the current selected file. - * - * @return the selected IFile. - */ - public IFile getFile() - { - String fileName = getFileName(); - String fileExtension = (new Path(fileName)).getFileExtension(); - - if (fileExtension == null) - fileName = fileName.concat("." + WSI_LOG_EXTENSION); - - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(fileName)); - } - - /** - * Returns true if selected file is a valid WS-I Message Log filename. - * - * Since the WizardNewFileCreationPage does not provide an interface to - * allow the file specified to already exist (it gives an error that the - * the file already exists, an no way of allowing it to pass), and we want - * to allow the file to exist, so that we can overwrite it, we have to - * override this method, and do some magic to allow this case to pass. - * - * @return true if selected file is a valid WS-I Message Log filename. - * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validatePage() - */ - protected boolean validatePage() - { - String fileExtension = (new Path(getFileName())).getFileExtension(); - if (fileExtension != null) - { - if (fileExtension.compareTo(WSI_LOG_EXTENSION) != 0) - { - setErrorMessage(Messages.ERROR_INVALID_LOG_FILE_EXTENSION); - return false; - } - } - - // Essentially, we take the container and concat the file to it, and - // check if its in the workspace, if it is, then it exists and we can - // proceed. Otherwise, continue with the default validating. - if ( (getContainerFullPath() != null) && (getContainerFullPath().isEmpty() == false) - && (getFileName().compareTo("") != 0)) - { - Path fullPath; - - if (fileExtension != null) - fullPath = new Path(getContainerFullPath().toString() + '/' + getFileName()); - else - fullPath = new Path(getContainerFullPath().toString() + '/' + getFileName() + "." + WSI_LOG_EXTENSION); - - IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(fullPath); - - setErrorMessage(null); - if (resource != null) - setMessage(Messages.WARNING_FILE_ALREADY_EXISTS); - else - setMessage(null); - - return true; - } - return super.validatePage(); - } -} - diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizardWSDLContentPage.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizardWSDLContentPage.java deleted file mode 100644 index 6ca057107..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizardWSDLContentPage.java +++ /dev/null @@ -1,908 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal.wizards; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; - -import javax.wsdl.Binding; -import javax.wsdl.Definition; -import javax.wsdl.Message; -import javax.wsdl.Operation; -import javax.wsdl.Port; -import javax.wsdl.PortType; -import javax.wsdl.Service; -import javax.wsdl.WSDLException; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; -import javax.xml.namespace.QName; - -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.wst.wsi.ui.internal.Messages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.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.Text; - -/** - * Wizard page that allows the user to specify the location of the - * WSDL document for the Web service. - * - * @author David Lauzon, IBM - * @author Lawrence Mandel, IBM - */ - -public class ValidationWizardWSDLContentPage extends WizardPage implements SelectionListener -{ - IStructuredSelection selection; - - public static final String PORT = "port"; - public static final String OPERATION = "operation"; - public static final String BINDING = "binding"; - public static final String PORTTYPE = "porttype"; - public static final String MESSAGE = "message"; - /** - * Access to the includeWSDL flag. - */ - protected Button wsdlPortButton; - protected Button wsdlBindingButton; - protected Button wsdlPortTypeButton; - protected Button wsdlOperationButton; - protected Button wsdlMessageButton; - - protected Combo nameCombo; - protected Text namespaceText; - //protected Combo parentCombo; - //protected Text nameText; - protected Text parentnameText; - - protected List ports = null; - protected List operations = null; - protected List bindings = null; - protected List porttypes = null; - protected List messages = null; - - /** - * Constructor. - * - * @param selection: selection in the Resource Navigator view. - */ - public ValidationWizardWSDLContentPage(IStructuredSelection selection) - { - super("ValidationWizardWSDLContentPage"); - this.selection = selection; - this.setTitle(Messages.WSDL_CONTENT_PAGE_SELECT_HEADING); - this.setDescription(Messages.WSDL_CONTENT_PAGE_SELECT_EXPL); - } - - /** - * Always returns true. - */ - public boolean isPageComplete() - { - if (((ValidationWizard) getWizard()).includeWSDLFile()) - { - int selection = nameCombo.getSelectionIndex(); - if (selection != -1 && !nameCombo.getItem(selection).equals("")) - { - return true; - } - return false; - } - return true; - } - - /* - * Creates the top level control for this page under the given - * parent composite. Implementors are responsible for ensuring - * that the created control can be accessed via getControl - * - * @param parent - the parent composite - */ - public void createControl(Composite parent) - { - Composite base = new Composite(parent, SWT.NONE); - base.setLayout(new GridLayout()); - GridData data; - - // create a group - Group wsdlElementGroup = new Group(base, SWT.SHADOW_ETCHED_IN); - wsdlElementGroup.setText(Messages.WSDL_CONTENT_PAGE_GROUP_TEXT_ELEMENT); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - wsdlElementGroup.setLayoutData(data); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - wsdlElementGroup.setLayout(layout); - - // create a base panel with 2 columns - Composite basePanel = new Composite(wsdlElementGroup, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 2; - layout.makeColumnsEqualWidth = false; - basePanel.setLayout(layout); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - basePanel.setLayoutData(data); - - // content for first column - createWSDLElementTypeContent(basePanel); - - // content for second column - createWSDLElementContent(basePanel); - - setControl(base); - } - - /** - * Create a group of radio buttons indicating the type of WSDL element. - * The five tpes are: port, binding, portType, operation and message. - * @param parent the parent container. - */ - protected void createWSDLElementTypeContent(Composite parent) - { - // create a group - Group wsdlTypeGroup = new Group(parent, SWT.SHADOW_ETCHED_IN); - wsdlTypeGroup.setText(Messages.WSDL_CONTENT_PAGE_GROUP_TEXT_TYPE); - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = false; - wsdlTypeGroup.setLayoutData(data); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - wsdlTypeGroup.setLayout(layout); - - wsdlPortButton = new Button(wsdlTypeGroup, SWT.RADIO); - wsdlPortButton.setText(Messages.WSDL_CONTENT_PAGE_RADIO_PORT); - wsdlPortButton.setData("wsdlPortButton"); - wsdlPortButton.setSelection(true); - wsdlPortButton.addSelectionListener(new PortButtonSelectionListener()); - - wsdlBindingButton = new Button(wsdlTypeGroup, SWT.RADIO); - wsdlBindingButton.setData("wsdlBindingButton"); - wsdlBindingButton.setText(Messages.WSDL_CONTENT_PAGE_RADIO_BINDING); - wsdlBindingButton.setSelection(false); - wsdlBindingButton.addSelectionListener(new BindingButtonSelectionListener()); - - wsdlPortTypeButton = new Button(wsdlTypeGroup, SWT.RADIO); - wsdlPortTypeButton.setData("wsdlPortTypeButton"); - wsdlPortTypeButton.setText(Messages.WSDL_CONTENT_PAGE_RADIO_PORT_TYPE); - wsdlPortTypeButton.setSelection(false); - wsdlPortTypeButton.addSelectionListener(new PortTypeButtonSelectionListener()); - - wsdlOperationButton = new Button(wsdlTypeGroup, SWT.RADIO); - wsdlOperationButton.setData("wsdlOperationButton"); - wsdlOperationButton.setText(Messages.WSDL_CONTENT_PAGE_RADIO_OPERATION); - wsdlOperationButton.setSelection(false); - wsdlOperationButton.addSelectionListener(new OperationButtonSelectionListener()); - - wsdlMessageButton = new Button(wsdlTypeGroup, SWT.RADIO); - wsdlMessageButton.setData("wsdlMessageButton"); - wsdlMessageButton.setText(Messages.WSDL_CONTENT_PAGE_RADIO_MESSAGE); - wsdlMessageButton.setSelection(false); - wsdlMessageButton.addSelectionListener(new MessageButtonSelectionListener()); - } - - /** - * Create a panel to capture the name, namespace and parent of an - * WSDL element. - * @param parent the parent container. - */ - protected void createWSDLElementContent(Composite parent) - { - // create a grouping with 2 columns, one for labels and theother for fields - Composite fieldColumn = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.makeColumnsEqualWidth = false; - fieldColumn.setLayout(layout); - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - fieldColumn.setLayoutData(data); - - // The WSDL element name label - Label label = new Label(fieldColumn, SWT.LEFT); - label.setText(Messages.WSDL_CONTENT_PAGE_LABEL_NAME); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - - // The WSDL element name field - nameCombo = new Combo(fieldColumn, SWT.READ_ONLY); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - nameCombo.setLayoutData(data); - nameCombo.addSelectionListener(new NameSelectionListener()); - //nameText = new Text(fieldColumn, SWT.SINGLE | SWT.BORDER); - //data = new GridData(); - //data.horizontalAlignment = GridData.FILL; - //data.grabExcessHorizontalSpace = true; - //data.widthHint = 50; - //nameText.setLayoutData(data); - //nameText.addModifyListener(new TextBoxListener()); - - // The WSDL element namespace label - label = new Label(fieldColumn, SWT.LEFT); - label.setText(Messages.WSDL_CONTENT_PAGE_LABEL_NAMESPACE); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - - // The WSDL element namespace field - namespaceText = new Text(fieldColumn, SWT.SINGLE | SWT.BORDER); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.widthHint = 50; - namespaceText.setLayoutData(data); - namespaceText.addModifyListener(new TextBoxListener()); - namespaceText.setEditable(false); - - // The WSDL element parent label - label = new Label(fieldColumn, SWT.LEFT); - label.setText(Messages.WSDL_CONTENT_PAGE_LABEL_PARENT); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - label.setLayoutData(data); - - // The WSDL element parent field - // parentCombo = new Combo(fieldColumn, SWT.READ_ONLY); - // data = new GridData(); - // data.horizontalAlignment = GridData.FILL; - // data.grabExcessHorizontalSpace = true; - // parentCombo.setLayoutData(data); - parentnameText = new Text(fieldColumn, SWT.SINGLE | SWT.BORDER); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.widthHint = 50; - parentnameText.setLayoutData(data); - parentnameText.addModifyListener(new TextBoxListener()); - parentnameText.setEditable(false); - } - - /** - * Always return true. - */ - public boolean performFinish() - { - return true; - } - - /** - * Sent when default selection occurs in the control. - * @param e - an event containing information about the selection - */ - public void widgetDefaultSelected(SelectionEvent e) - {} - - /** - * Handles the includeWSDL checkbox. - * Sent when selection occurs in the control. - * @param e - an event containing information about the selection - */ - public void widgetSelected(SelectionEvent e) - {} - - /** - * Get the element name. - * - * @return The element name. - */ - public String getElementName() - { - int selection = nameCombo.getSelectionIndex(); - if(selection != -1) - { - return nameCombo.getItem(selection); - } - return ""; - } - - /** - * Get the namespace. - * - * @return The namespace. - */ - public String getNamespace() - { - return namespaceText.getText(); - } - - /** - * Get the name of the parent of the element. - * - * @return The name of the parent of the element. - */ - public String getParentName() - { - //return parentCombo.getItem(parentCombo.getSelectionIndex()); - return parentnameText.getText(); - } - - /** - * Return the type of the element. - * - * @return the type of the element. - */ - public String getType() - { - if (wsdlBindingButton.getSelection()) - { - return BINDING; - } - else if (wsdlMessageButton.getSelection()) - { - return MESSAGE; - } - else if (wsdlOperationButton.getSelection()) - { - return OPERATION; - } - else if (wsdlPortButton.getSelection()) - { - return PORT; - } - else if (wsdlPortTypeButton.getSelection()) - { - return PORTTYPE; - } - return null; - - } - - public void addElement(String type, String name, String namespace, String parent) - { - if (ports == null) - { - resetElements(); - } - if (type.equals(PORT)) - { - ports.add(new WSDLElement(name, namespace, parent)); - } - else if (type.equalsIgnoreCase(OPERATION)) - { - operations.add(new WSDLElement(name, namespace, parent)); - } - else if (type.equalsIgnoreCase(BINDING)) - { - bindings.add(new WSDLElement(name, namespace, parent)); - } - else if (type.equalsIgnoreCase(PORTTYPE)) - { - porttypes.add(new WSDLElement(name, namespace, parent)); - } - else if (type.equalsIgnoreCase(MESSAGE)) - { - messages.add(new WSDLElement(name, namespace, parent)); - } - } - - public void resetElements() - { - ports = new Vector(); - operations = new Vector(); - bindings = new Vector(); - porttypes = new Vector(); - messages = new Vector(); - nameCombo.clearSelection(); - nameCombo.removeAll(); - } - - /** - * Add value to the list box - */ - class WorkspaceButtonListener implements SelectionListener - { - public void widgetDefaultSelected(SelectionEvent e) - {} - - public void widgetSelected(SelectionEvent e) - {} - } - - /** - * Add value to the list box - */ - class BrowseButtonListener implements SelectionListener - { - public void widgetDefaultSelected(SelectionEvent e) - {} - - public void widgetSelected(SelectionEvent e) - {} - } - - /** - * Add value to the list box - */ - class SearchUDDIButtonListener implements SelectionListener - { - public void widgetDefaultSelected(SelectionEvent e) - {} - - public void widgetSelected(SelectionEvent e) - {} - } - /** - * Add value to the file field. - */ - class TextBoxListener implements ModifyListener - { - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) - */ - public void modifyText(ModifyEvent e) - { - getContainer().updateButtons(); - - } - - } - private class WSDLElement - { - private String name; - private String namespace; - private String parent; - - public WSDLElement(String name, String namespace, String parent) - { - this.name = name; - this.namespace = namespace; - this.parent = parent; - } - - public String getName() - { - return name; - } - - public String getNamespace() - { - return namespace; - } - - public String getParentName() - { - return parent; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean) - */ - public void setVisible(boolean visible) - { - resetElements(); - super.setVisible(visible); - if (visible) - { - try - { - WSDLFactory factory = WSDLFactory.newInstance(); - WSDLReader reader = factory.newWSDLReader(); - Definition defElem = reader.readWSDL(((ValidationWizard) getWizard()).getWSDLFile()); - QName defQName = defElem.getQName(); - String defname = ""; - if (defQName != null) - { - defname = defQName.getLocalPart(); - } - String namespace = defElem.getTargetNamespace(); - - // register the ports - Map servmap = defElem.getServices(); - if (servmap != null) - { - Collection servs = servmap.values(); - if (servs != null) - { - Iterator servIter = servs.iterator(); - while (servIter.hasNext()) - { - Service service = (Service) servIter.next(); - String servname = service.getQName().getLocalPart(); - - Map portmap = service.getPorts(); - if (portmap != null) - { - Collection ports = portmap.values(); - if (ports != null) - { - Iterator portIter = ports.iterator(); - while (portIter.hasNext()) - { - Port port = (Port) portIter.next(); - String name = port.getName(); - addElement(ValidationWizardWSDLContentPage.PORT, name, namespace, servname); - } - } - } - } - } - } - - // Register the Bindings - Map bindingmap = defElem.getBindings(); - if (bindingmap != null) - { - Collection bindings = bindingmap.values(); - if (bindings != null) - { - Iterator bindIter = bindings.iterator(); - while (bindIter.hasNext()) - { - Binding binding = (Binding) bindIter.next(); - String name = binding.getQName().getLocalPart(); - addElement(ValidationWizardWSDLContentPage.BINDING, name, namespace, defname); - } - } - } - - // Register the PortTypes and Operations - Map porttypemap = defElem.getPortTypes(); - if (porttypemap != null) - { - Collection porttypes = porttypemap.values(); - if (porttypes != null) - { - Iterator porttypeIter = porttypes.iterator(); - while (porttypeIter.hasNext()) - { - PortType porttype = (PortType) porttypeIter.next(); - String porttypename = porttype.getQName().getLocalPart(); - addElement(ValidationWizardWSDLContentPage.PORTTYPE, porttypename, namespace, defname); - - // Register the Operations - List operations = porttype.getOperations(); - if (operations != null) - { - Iterator operIter = operations.iterator(); - while (operIter.hasNext()) - { - Operation operation = (Operation) operIter.next(); - String name = operation.getName(); - addElement(ValidationWizardWSDLContentPage.OPERATION, name, namespace, porttypename); - } - } - } - } - } - Map messagemap = defElem.getMessages(); - if (messagemap != null) - { - Collection messages = messagemap.values(); - if (messages != null) - { - Iterator messIter = messages.iterator(); - while (messIter.hasNext()) - { - Message message = (Message) messIter.next(); - String name = message.getQName().getLocalPart(); - addElement(ValidationWizardWSDLContentPage.MESSAGE, name, namespace, defname); - } - } - } - nameCombo.removeAll(); - namespaceText.setText(""); - parentnameText.setText(""); - int numElems = ports.size(); - WSDLElement[] elems = (WSDLElement[]) ports.toArray(new WSDLElement[numElems]); - for (int i = 0; i < numElems; i++) - { - nameCombo.add(elems[i].getName(), i); - if (i == 0) - { - nameCombo.select(0); - namespaceText.setText(elems[i].getNamespace()); - parentnameText.setText(elems[i].getParentName()); - - } - } - wsdlPortButton.setSelection(true); - wsdlBindingButton.setSelection(false); - wsdlMessageButton.setSelection(false); - wsdlOperationButton.setSelection(false); - wsdlPortTypeButton.setSelection(false); - - } - catch (WSDLException e) - { - // The WSDL file is not valid. - } - } - else - { - resetElements(); - } - - } - - class PortButtonSelectionListener implements SelectionListener - { - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) - { - widgetSelected(e); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) - { - nameCombo.removeAll(); - namespaceText.setText(""); - parentnameText.setText(""); - int numElems = ports.size(); - WSDLElement[] elems = (WSDLElement[]) ports.toArray(new WSDLElement[numElems]); - for (int i = 0; i < numElems; i++) - { - nameCombo.add(elems[i].getName(), i); - if (i == 0) - { - nameCombo.select(0); - namespaceText.setText(elems[i].getNamespace()); - parentnameText.setText(elems[i].getParentName()); - - } - } - } - - } - class BindingButtonSelectionListener implements SelectionListener - { - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) - { - widgetSelected(e); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) - { - nameCombo.removeAll(); - namespaceText.setText(""); - parentnameText.setText(""); - int numElems = bindings.size(); - WSDLElement[] elems = (WSDLElement[]) bindings.toArray(new WSDLElement[numElems]); - for (int i = 0; i < numElems; i++) - { - nameCombo.add(elems[i].getName(), i); - if (i == 0) - { - nameCombo.select(0); - namespaceText.setText(elems[i].getNamespace()); - parentnameText.setText(elems[i].getParentName()); - } - } - - } - - } - class PortTypeButtonSelectionListener implements SelectionListener - { - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) - { - widgetSelected(e); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) - { - nameCombo.removeAll(); - namespaceText.setText(""); - parentnameText.setText(""); - int numElems = porttypes.size(); - WSDLElement[] elems = (WSDLElement[]) porttypes.toArray(new WSDLElement[numElems]); - for (int i = 0; i < numElems; i++) - { - nameCombo.add(elems[i].getName(), i); - if (i == 0) - { - nameCombo.select(0); - namespaceText.setText(elems[i].getNamespace()); - parentnameText.setText(elems[i].getParentName()); - } - } - - } - - } - class OperationButtonSelectionListener implements SelectionListener - { - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) - { - widgetSelected(e); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) - { - nameCombo.removeAll(); - namespaceText.setText(""); - parentnameText.setText(""); - int numElems = operations.size(); - WSDLElement[] elems = (WSDLElement[]) operations.toArray(new WSDLElement[numElems]); - for (int i = 0; i < numElems; i++) - { - nameCombo.add(elems[i].getName(), i); - if (i == 0) - { - nameCombo.select(0); - namespaceText.setText(elems[i].getNamespace()); - parentnameText.setText(elems[i].getParentName()); - } - } - - } - - } - class MessageButtonSelectionListener implements SelectionListener - { - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) - { - widgetSelected(e); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) - { - nameCombo.removeAll(); - namespaceText.setText(""); - parentnameText.setText(""); - int numElems = messages.size(); - WSDLElement[] elems = (WSDLElement[]) messages.toArray(new WSDLElement[numElems]); - for (int i = 0; i < numElems; i++) - { - nameCombo.add(elems[i].getName(), i); - if (i == 0) - { - nameCombo.select(0); - namespaceText.setText(elems[i].getNamespace()); - parentnameText.setText(elems[i].getParentName()); - } - } - - } - - } - - class NameSelectionListener implements SelectionListener - { - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) - { - widgetSelected(e); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) - { - int selection = ((Combo) e.getSource()).getSelectionIndex(); - String type = getType(); - WSDLElement elem = null; - if (type.equals(PORT)) - { - elem = (WSDLElement) ports.get(selection); - } - else if (type.equals(BINDING)) - { - elem = (WSDLElement) bindings.get(selection); - } - else if (type.equals(PORTTYPE)) - { - elem = (WSDLElement) porttypes.get(selection); - } - else if (type.equals(OPERATION)) - { - elem = (WSDLElement) operations.get(selection); - } - else if (type.equals(MESSAGE)) - { - elem = (WSDLElement) messages.get(selection); - } - - if (elem != null) - { - namespaceText.setText(elem.getNamespace()); - parentnameText.setText(elem.getParentName()); - } - } - - } -} diff --git a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizardWSDLPage.java b/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizardWSDLPage.java deleted file mode 100644 index 205931845..000000000 --- a/bundles/org.eclipse.wst.wsi.ui/src/org/eclipse/wst/wsi/ui/internal/wizards/ValidationWizardWSDLPage.java +++ /dev/null @@ -1,373 +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 - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.ui.internal.wizards; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.wst.common.ui.internal.dialogs.SelectSingleFileDialog; -import org.eclipse.wst.wsi.ui.internal.Messages; -import org.eclipse.wst.wsi.ui.internal.Resource; -import org.eclipse.wst.wsi.ui.internal.WSIUIPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.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.FileDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * Wizard page that allows the user to specify the location of the - * WSDL document for the Web service. - * - * @author David Lauzon, IBM - * @author Lawrence Mandel, IBM - */ - -public class ValidationWizardWSDLPage extends WizardPage implements SelectionListener -{ - - IStructuredSelection selection; - - protected boolean wsdlinvalid = false; - /** - * Access to the includeWSDL flag. - */ - protected Button includeWSDLButton; - - /** - * Access to the wsdl document group. - */ - protected Group documentGroup; - protected Text documentLocationText; - protected Combo fileField; - /** - * Constructor. - * - * @param selection: selection in the Resource Navigator view. - */ - public ValidationWizardWSDLPage(IStructuredSelection selection) - { - super("ValidationWizardWSDLPage"); - this.selection = selection; - this.setTitle(Messages.WSDL_PAGE_SELECT_WSDL_FILENAME_HEADING); - this.setDescription(Messages.WSDL_PAGE_SELECT_WSDL_FILENAME_EXPL); - } - - /** - * Always returns true. - */ - public boolean isPageComplete() - { - if (includeWSDLFile()) - { - - if (fileField.getText() == null || fileField.getText().equals("") || wsdlinvalid) - { - return false; - } - } - return true; - } - - /* - * Creates the top level control for this page under the given parent - * composite. Implementors are responsible for ensuring that the created - * control can be accessed via getControl - * - * @param parent - the parent composite - */ - public void createControl(Composite parent) - { - Composite base = new Composite(parent, SWT.NONE); - base.setLayout(new GridLayout()); - GridData data; - - // add includeWSDL flag - includeWSDLButton = new Button(base, SWT.CHECK); - includeWSDLButton.setText(Messages.WSDL_PAGE_INCLUDE_WSDL_BUTTON); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - includeWSDLButton.setLayoutData(data); - includeWSDLButton.addSelectionListener(this); - includeWSDLButton.setSelection(false); - - // create a WSDL document group - documentGroup = new Group(base, SWT.SHADOW_ETCHED_IN); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - documentGroup.setLayoutData(data); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - documentGroup.setLayout(layout); - documentGroup.setVisible(false); - - createDocumentGroupContents(documentGroup); - - setControl(base); - } - - protected Control createDocumentGroupContents(Composite documentGroup) - { - //radio buttons' container - Composite basePanel = new Composite(documentGroup, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.makeColumnsEqualWidth = false; - layout.marginWidth = 0; - basePanel.setLayout(layout); - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - basePanel.setLayoutData(data); - - Composite group1 = new Composite(basePanel, SWT.NONE); - group1.setFont(getFont()); - layout = new GridLayout(); - layout.numColumns = 1; - group1.setLayout(layout); - data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - group1.setLayoutData(data); - - Label documentLabel = new Label(group1, SWT.LEFT); - documentLabel.setText(Messages.WSDL_PAGE_INCLUDE_WSDL_LABEL); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - documentLabel.setLayoutData(data); - /** - * Label label = new Label(basePanel, SWT.LEFT); data = new GridData(); - * data.horizontalAlignment = GridData.FILL; data.horizontalSpan = 1; - * label.setLayoutData(data); - */ - fileField = new Combo(group1, SWT.DROP_DOWN); - String[] wsdllocations = ((ValidationWizard) getWizard()).getWSDLLocations(); - if(wsdllocations != null) - { - int numlocs = wsdllocations.length; - for(int i = 0; i < numlocs; i++) - { - fileField.add(wsdllocations[i]); - } - } - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.widthHint = 30; - fileField.setLayoutData(data); - fileField.addModifyListener(new FileFieldListener()); - - Label wsdlLabel = new Label(group1, SWT.LEFT); - wsdlLabel.setText(Messages.WSDL_PAGE_VALID_WSDL_LABEL); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - documentLabel.setLayoutData(data); - - // documentLocationText = new Text(documentGroup, SWT.SINGLE | SWT.BORDER); - // data = new GridData(); - // data.horizontalAlignment = GridData.FILL; - // data.grabExcessHorizontalSpace = true; - // data.widthHint = 30; - // documentLocationText.setLayoutData(data); - - Composite group = new Composite(basePanel, SWT.NONE); - group.setFont(getFont()); - layout = new GridLayout(); - layout.numColumns = 1; - group.setLayout(layout); - data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - group.setLayoutData(data); - - Button workspaceButton = new Button(group, SWT.PUSH); - workspaceButton.setText(Messages.WSDL_PAGE_WORKBENCH_BUTTON); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - workspaceButton.setLayoutData(data); - workspaceButton.addSelectionListener(new WorkspaceButtonListener()); - - Button browseButton = new Button(group, SWT.PUSH); - browseButton.setText(Messages.WSDL_PAGE_BROWSE_BUTTON); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - browseButton.setLayoutData(data); - browseButton.addSelectionListener(new BrowseButtonListener()); - - // Button searchUDDIButton = new Button(group, SWT.PUSH); - // searchUDDIButton.setText(Messages.("_UI_WIZARD_V_SEARCH_UDDI_BUTTON")); - // data = new GridData(); - // data.horizontalAlignment = GridData.FILL; - // searchUDDIButton.setLayoutData(data); - // searchUDDIButton.addSelectionListener(new SearchUDDIButtonListener()); - - return documentGroup; - } - - public boolean includeWSDLFile() - { - return includeWSDLButton.getSelection(); - } - - public String getWSDLFile() - { - return fileField.getText(); - } - - /** - * Always return true. - */ - public boolean performFinish() - { - return true; - } - - /** - * Sent when default selection occurs in the control. - * - * @param e - - * an event containing information about the selection - */ - public void widgetDefaultSelected(SelectionEvent e) - {} - - /** - * Handles the includeWSDL checkbox. Sent when selection occurs in the - * control. - * - * @param e - - * an event containing information about the selection - */ - public void widgetSelected(SelectionEvent e) - { - if (e.widget == includeWSDLButton) - { - if (includeWSDLButton.getSelection()) - { - documentGroup.setVisible(true); - } - else - { - documentGroup.setVisible(false); - } - getContainer().updateButtons(); - } - } - - public void setWSDLInvalid() - { - wsdlinvalid = true; - } - - /** - * Add value to the list box - */ - class WorkspaceButtonListener implements SelectionListener - { - public void widgetDefaultSelected(SelectionEvent e) - {} - - public void widgetSelected(SelectionEvent e) - { - SelectSingleFileDialog dialog = new SelectSingleFileDialog(getShell(), selection, false); - dialog.addFilterExtensions(new String[] { ".wsdl" }); - dialog.create(); - dialog.getShell().setText(Messages.WSDL_PAGE_FILE_SHELL_TEXT); - dialog.setTitle(Messages.WSDL_PAGE_FILE_TITLE); - dialog.setMessage(Messages.WSDL_PAGE_FILE_DESCRIPTION); - dialog.setTitleImage(WSIUIPlugin.getResourceImage(Resource.VALIDATE_WSI_LOGFILE_WIZ)); - - int result = dialog.open(); - - if (result == Window.OK) - { - IFile currentIFile = dialog.getFile(); - if (currentIFile != null) - { - fileField.add(currentIFile.getLocation().toString(), 0); - fileField.select(0); - } - } - } - } - - /** - * Add value to the list box - */ - class BrowseButtonListener implements SelectionListener - { - public void widgetDefaultSelected(SelectionEvent e) - {} - - public void widgetSelected(SelectionEvent e) - { - FileDialog dialog = new FileDialog(getShell()); - dialog.setFilterExtensions(new String[] { "*.wsdl" }); - String selection = dialog.open(); - if (selection != null) - { - fileField.add(selection, 0); - fileField.select(0); - } - } - } - - /** - * Add value to the list box - */ - // class SearchUDDIButtonListener implements SelectionListener - // { - // public void widgetDefaultSelected(SelectionEvent e) - // {} - // - // public void widgetSelected(SelectionEvent e) - // { - // String title = "Information"; - // String message = "The chosen operation is not currently available."; - // MessageDialog.openInformation(Display.getDefault().getActiveShell(), title, message); - // } - //} - - /** - * Add value to the file field. - */ - class FileFieldListener implements ModifyListener - { - - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) - */ - public void modifyText(ModifyEvent e) - { - wsdlinvalid = false; - getContainer().updateButtons(); - - } - - } - -} |