diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command')
13 files changed, 0 insertions, 1236 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntDefaultingOperation.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntDefaultingOperation.java deleted file mode 100644 index 3fbf57ba6..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntDefaultingOperation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060221 119111 rsinha@ca.ibm.com - Rupam Kuehner - * 20061011 159283 makandre@ca.ibm.com - Andrew Mak, project not associated to EAR when using ant on command-line - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.internal.emf.resource.RendererFactory; - -public class AntDefaultingOperation extends AbstractDataModelOperation{ - - private boolean rendererValidation; - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - // TODO Auto-generated method stub - - rendererValidation = RendererFactory.getDefaultRendererFactory().isValidating(); - RendererFactory.getDefaultRendererFactory().setValidating(false); - - return Status.OK_STATUS; - } - - public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - RendererFactory.getDefaultRendererFactory().setValidating(rendererValidation); - - return Status.OK_STATUS; - } - - public boolean getServiceIdsFixed() - { - return true; - } - - public boolean getClientIdsFixed() - { - return true; - } - - public boolean getStartService() - { - return false; - } - - public boolean getInstallService() - { - return false; - } - - public boolean getDeployService() - { - return true; - } - - public boolean getDeployClient() - { - return true; - } - - public boolean getRendererValidation() - { - return rendererValidation; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntRestoringCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntRestoringCommand.java deleted file mode 100644 index 5c7390239..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntRestoringCommand.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20061011 159283 makandre@ca.ibm.com - Andrew Mak, project not associated to EAR when using ant on command-line - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.internal.emf.resource.RendererFactory; - -public class AntRestoringCommand extends AbstractDataModelOperation{ - - private boolean rendererValidation; - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - RendererFactory.getDefaultRendererFactory().setValidating(rendererValidation); - - return Status.OK_STATUS; - } - - public void setRendererValidation(boolean rendererValidation) - { - this.rendererValidation = rendererValidation; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntWorkspaceSaveCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntWorkspaceSaveCommand.java deleted file mode 100644 index be0009908..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/AntWorkspaceSaveCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070501 178129 makandre@ca.ibm.com - Andrew Mak, workspace reports "crash detected" after running WS ant task (cmdline) - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -public class AntWorkspaceSaveCommand extends AbstractDataModelOperation { - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - try { - // attempt to save the state of the workspace - ResourcesPlugin.getWorkspace().save(true, monitor); - return Status.OK_STATUS; - } - catch (CoreException e) { - throw new ExecutionException(e.getMessage(), e); - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java deleted file mode 100644 index b356743ed..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/CheckForServiceProjectCommand.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.StatusException; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser; - - -/** - * This command checks to see if the selected client project is the - * service project. If so, the user is warned. - */ -public class CheckForServiceProjectCommand extends AbstractDataModelOperation -{ - //SelectionListChoices runtime2ClientTypes; - String clientProjectName; - String wsdlURI; - WebServicesParser webServicesParser; - - public CheckForServiceProjectCommand() - { - } - - - public void setClientProjectName(String name) - { - clientProjectName = name; - } - - public void setWsdlURI(String wsdlURI) - { - this.wsdlURI = wsdlURI; - } - - public void setWebServicesParser(WebServicesParser webServicesParser) - { - this.webServicesParser = webServicesParser; - } - - - /* (non-Javadoc) - * @see org.eclipse.wst.command.env.core.Command#execute(org.eclipse.wst.command.internal.env.core.common.Environment) - */ - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment environment = getEnvironment(); - IStatus status = Status.OK_STATUS; - if (clientProjectName==null || wsdlURI==null || wsdlURI.length()==0 || webServicesParser==null) - return status; - - if (clientProjectName==null || clientProjectName.length()==0) - return status; - - IProject clientProject = ProjectUtilities.getProject(clientProjectName); - ValidationUtils vu = new ValidationUtils(); - boolean isServiceProject = vu.isProjectServiceProject(clientProject, wsdlURI, webServicesParser); - if (isServiceProject) - { - IStatus wStatus = StatusUtils.warningStatus( NLS.bind(ConsumptionUIMessages.MSG_WARN_IS_SERVICE_PROJECT, new String[]{clientProjectName}) ); - try - { - environment.getStatusHandler().report(wStatus); - } - catch (StatusException se) - { - //User decided to abort. Return an error status - IStatus eStatus = StatusUtils.errorStatus( ConsumptionUIMessages.MSG_USER_ABORTED ); - return eStatus; - } - } - - return status; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java deleted file mode 100644 index 98782617a..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/GenerateHandlerSkeletonCommand.java +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - * 20060517 142027 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.common.ResourceUtils; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.common.HandlerDescriptionHolder; -import org.eclipse.jst.ws.internal.consumption.ui.common.HandlerServiceRefHolder; -import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.command.internal.env.common.FileResourceUtils; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.command.internal.env.ui.eclipse.EnvironmentUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - - -public class GenerateHandlerSkeletonCommand extends AbstractDataModelOperation -{ - private IPath outputLocation_; - private boolean genSkeleton_; - private String handlerNameForEdit_ = null; - - private HandlerServiceRefHolder[] handlerServiceRefHolder_; - private HandlerDescriptionHolder[]handlerDescriptionHolder_; - - public GenerateHandlerSkeletonCommand() - { - } - - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - - IStatus returnStatus = Status.OK_STATUS; - - if (!genSkeleton_) return returnStatus; - - // form the map of classname to locations - if (handlerDescriptionHolder_!=null){ - for (int i=0;i<handlerDescriptionHolder_.length;i++){ - Hashtable handlerTable = new Hashtable(); - IPath outPath = handlerDescriptionHolder_[i].getSourceOutputPath(); - List handlers = handlerDescriptionHolder_[i].getHandlerList(); - for (int j=0;j<handlers.size();j++){ - HandlerTableItem hti = (HandlerTableItem)handlers.get(j); - String className = hti.getHandlerClassName(); - if (className!=null && outPath!=null) - handlerTable.put(className, outPath); - } - returnStatus = genHandlersClasses(handlerTable, monitor); - } - - } - else { - for (int i=0;i<handlerServiceRefHolder_.length;i++){ - Hashtable handlerTable = new Hashtable(); - IPath outPath = handlerServiceRefHolder_[i].getSourceOutputPath(); - List handlers = handlerServiceRefHolder_[i].getHandlerList(); - for (int j=0;j<handlers.size();j++){ - HandlerTableItem hti = (HandlerTableItem)handlers.get(j); - String className = hti.getHandlerClassName(); - if (className!=null && outPath!=null) - handlerTable.put(className, outPath); - } - returnStatus = genHandlersClasses(handlerTable, monitor); - } - } - - - return returnStatus; - - } - - private IStatus genHandlersClasses(Hashtable handlersForGen, IProgressMonitor monitor){ - IEnvironment env = getEnvironment(); - MultiStatus status = null; - IStatus returnStatus = Status.OK_STATUS; - boolean error = false; - - IStatus writeStatus; - Enumeration keys = handlersForGen.keys(); - while (keys.hasMoreElements()) { - String className = (String)keys.nextElement(); - writeStatus = writeFile(env, className, (IPath)handlersForGen.get(className), monitor ); - // handle status return - if (writeStatus.getSeverity() == Status.ERROR) { // write status is OK or ERROR - error = true; - if (status == null) { - status = StatusUtils.multiStatus( ConsumptionUIMessages.MSG_ERROR_GENERATE_HANDLER_SKELETON, new IStatus[0] ); - } - status.add(writeStatus); - } - } - - if (error) - { - env.getStatusHandler().reportError(status); - returnStatus = status; - } - - return returnStatus; - - } - - - private IStatus writeFile (IEnvironment env, String className, IPath outputLocation, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - int index; - - String simpleClassName = className; - String packageName = null; - IPath filePath = outputLocation; - if (className != null) { - index = className.lastIndexOf('.'); - if (index != -1) { - simpleClassName = className.substring(index + 1); - packageName = className.substring(0, index); - - String packageSegment = packageName; - int j = 0; - j = packageSegment.indexOf('.'); - while (j != -1) { - filePath = filePath.append(packageSegment.substring(0, j)); - packageSegment = packageSegment.substring(j + 1); - j = packageSegment.indexOf('.'); - } - filePath = filePath.append(packageSegment); - } - else { - packageName = ""; - } - } - - filePath = filePath.append(simpleClassName); - - filePath = filePath.addFileExtension("java"); - - // check if Handler already exists; do not overwrite existing Handlers - IResource workspaceRes = ResourceUtils.findResource(filePath); - if (workspaceRes!=null && workspaceRes.exists()) { - return status; - } - - if (handlerNameForEdit_ == null){ - handlerNameForEdit_ = className; - outputLocation_ = outputLocation; - } - - OutputStream outputStream = FileResourceUtils.newFileOutputStream( EnvironmentUtils.getResourceContext(env), filePath, monitor, env.getStatusHandler()); - // create buffered writer for writing file - BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(outputStream)); - try { - if (packageName.length() != 0) { - bw.write("package " +packageName+";"); - bw.newLine(); - bw.newLine(); - } - bw.write("import javax.xml.rpc.handler.GenericHandler;"); - bw.newLine(); - bw.write("import javax.xml.rpc.handler.MessageContext;"); - bw.newLine(); - bw.write("import javax.xml.namespace.QName;"); - bw.newLine(); - bw.newLine(); - - bw.write("public class "+simpleClassName+" extends GenericHandler"); - bw.newLine(); - bw.write("{"); - bw.newLine(); - bw.newLine(); - - bw.write(" public QName[] getHeaders ()"); - bw.newLine(); - bw.write(" {"); - bw.newLine(); - bw.write(" // Fill in method body"); - bw.newLine(); - bw.write(" return null;"); - bw.newLine(); - bw.write(" }"); - bw.newLine(); - bw.newLine(); - bw.write(" public boolean handleRequest( MessageContext context )"); - bw.newLine(); - bw.write(" {"); - bw.newLine(); - bw.write(" // Fill in method body or delete method to use GenericHandler"); - bw.newLine(); - bw.write(" return true;"); - bw.newLine(); - bw.write(" }"); - bw.newLine(); - bw.newLine(); - bw.write(" public boolean handleResponse( MessageContext context )"); - bw.newLine(); - bw.write(" {"); - bw.newLine(); - bw.write(" // Fill in method body or delete method to use GenericHandler "); - bw.newLine(); - bw.write(" return true;"); - bw.newLine(); - bw.write(" }"); - bw.newLine(); - bw.newLine(); - bw.write(" public boolean handleFault( MessageContext context )"); - bw.newLine(); - bw.write(" {"); - bw.newLine(); - bw.write(" // Fill in method body or delete method to use GenericHandler"); - bw.newLine(); - bw.write(" return true;"); - bw.newLine(); - bw.write(" }"); - bw.newLine(); - - bw.newLine(); - bw.write("}"); - bw.close(); - status = Status.OK_STATUS; - } - catch (IOException e) - { - status = StatusUtils.errorStatus( NLS.bind(ConsumptionUIMessages.MSG_ERROR_WRITE_FILE, new String[]{ className }), e ); - if (bw != null) { - try { - bw.close(); - } catch (IOException e1) { - } - } - } - return status; - } - - public void setGenSkeletonEnabled(boolean genSkeleton) - { - this.genSkeleton_ = genSkeleton; - } - - public IProject getProject(){ - IProject project = null; - if (outputLocation_!=null){ - project = ResourceUtils.getProjectOf(outputLocation_); - } - return project; - } - - public List getClassNames(){ - List classes = new ArrayList(); - if (handlerNameForEdit_!=null){ - classes.add(handlerNameForEdit_); - } - return classes; - } - - /** - * An array of HandlerDescriptionHolders - * @return - */ - public void setHandlerServiceRefHolder(HandlerServiceRefHolder[] handlerHolders){ - this.handlerServiceRefHolder_ = handlerHolders; - } - - /** - * An array of HandlerDescriptionHolders - * @return - */ - public void setHandlerDescriptionHolders(HandlerDescriptionHolder[] handlerHolders){ - this.handlerDescriptionHolder_ = handlerHolders; - } - - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/ListOptionsCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/ListOptionsCommand.java deleted file mode 100644 index d51a7c21f..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/ListOptionsCommand.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServerType; -import org.eclipse.wst.server.core.ServerCore; - -/** - * Command lists valid property values where requested. - * Requests made via a Ant property value setting which is mapped to this command in the plugin.xml - */ - -public class ListOptionsCommand extends AbstractDataModelOperation { - - private boolean runtimes_ = false; - private boolean servers_ = false; - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - - if (runtimes_) - { - String[] typeIds = WebServiceRuntimeExtensionUtils2.getServiceTypeLabels().getIds_(); - Vector runtimeIds = new Vector(); - for (int k = 0; k < typeIds.length; k++) { - - String typeId = typeIds[k]; - String[] runtimes = WebServiceRuntimeExtensionUtils2.getRuntimesByServiceType(typeId); - - for (int j = 0; j < runtimes.length; j++) { - String runtime = runtimes[j]; - if (!runtimeIds.contains(runtime)) - { - runtimeIds.add(runtime); - } - } - } - - Status statusObj = new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - ConsumptionUIMessages.MSG_INFO_ANT_RUNTIME_HEADING, - null); - getEnvironment().getStatusHandler().reportInfo(statusObj); - - - for (Iterator iterator = runtimeIds.iterator(); iterator - .hasNext();) { - getEnvironment().getStatusHandler().reportInfo(new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - NLS.bind(ConsumptionUIMessages.MSG_INFO_ANT_SERVER_RUNTIME, - iterator.next()), null)); - } - - - String[] clientRuntimes = WebServiceRuntimeExtensionUtils2.getAllRuntimesForClientSide(); - - for (int i = 0; i < clientRuntimes.length; i++) { - - getEnvironment().getStatusHandler().reportInfo(new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - NLS.bind(ConsumptionUIMessages.MSG_INFO_ANT_CLIENT_RUNTIME, - clientRuntimes[i]), null)); - } - } - - if (servers_) - { - getEnvironment().getStatusHandler().reportInfo(new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - ConsumptionUIMessages.MSG_INFO_ANT_SERVER_HEADING, null)); - - IServerType[] serverTypes = ServerCore.getServerTypes(); - for (int i=0; i<serverTypes.length; i++) - { - getEnvironment().getStatusHandler().reportInfo(new Status(IStatus.INFO, - WebServiceConsumptionUIPlugin.ID, - IStatus.OK, - NLS.bind(ConsumptionUIMessages.MSG_INFO_ANT_SERVER, - serverTypes[i].getId()), null)); - - } - } - - return OK_STATUS; - } - - public void setListRuntimes(boolean value) - { - runtimes_=value; - } - - public void setListServers(boolean value) - { - servers_=value; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java deleted file mode 100644 index 53bedd530..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/OpenJavaEditorCommand.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004,2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060404 134913 sengpl@ca.ibm.com - Seng Phung-Lu - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; -import org.eclipse.jst.ws.internal.consumption.ui.plugin.WebServiceConsumptionUIPlugin; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.progress.UIJob; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - - -public class OpenJavaEditorCommand extends AbstractDataModelOperation -{ - private List classNames; - private IProject project; - private boolean isEnabled_ = true; // is true by default - - public OpenJavaEditorCommand() - { - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - if (isEnabled_) { - OpenJavaEditorJob job = new OpenJavaEditorJob(classNames, project); - job.setPriority(Job.LONG); - job.schedule(); - } - return Status.OK_STATUS; - } - - public void setClassNames(List classNames) - { - this.classNames = classNames; - } - - public void setProject(IProject project) - { - this.project = project; - } - - public void setIsEnabled(boolean isEnabled){ - this.isEnabled_ = isEnabled; - } - - private class OpenJavaEditorJob extends UIJob - { - private List classNames; - private IProject project; - - public OpenJavaEditorJob(List classNames, IProject project) - { - super("org.eclipse.jst.ws.internal.consumption.ui.command.OpenJavaEditorJob"); - this.classNames = classNames; - this.project = project; - } - - public IStatus runInUIThread(IProgressMonitor monitor) - { - if (project != null && classNames != null) - { - IJavaProject javaProject = JavaCore.create(project); - for (Iterator it = classNames.iterator(); it.hasNext();) - { - String className = (String)it.next(); - try - { - IType type = javaProject.findType(className); - JavaUI.openInEditor(type); - } - catch (Throwable t) - { - return new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.Status.ERROR, WebServiceConsumptionUIPlugin.ID, 0, NLS.bind(ConsumptionUIMessages.MSG_ERROR_UNABLE_TO_OPEN_JAVA_EDITOR, new String[]{className, project.getName()}), t); - } - } - return Status.OK_STATUS; - } - else if (project!=null || classNames.isEmpty()){ - // do nothing ; nothing to open - return Status.OK_STATUS; - } - else - return new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.Status.ERROR, WebServiceConsumptionUIPlugin.ID, 0, NLS.bind(ConsumptionUIMessages.MSG_ERROR_UNABLE_TO_OPEN_JAVA_EDITOR, new String[]{classNames != null ? classNames.toString() : "", project != null ? project.getName() : ""}), null); - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/StartServerCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/StartServerCommand.java deleted file mode 100644 index 283f01137..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/StartServerCommand.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20070426 162287 makandre@ca.ibm.com - Andrew Mak, Server publish cancel button unavailable - * 20080509 165327 kathy@ca.ibm.com - Kathy Chan, Use API from IServer to call shouldPublish and shouldRestart - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jst.ws.internal.consumption.ConsumptionMessages; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.EnvironmentService; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.environment.ILog; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - -/** - * (Re)Starts and publishes the server specifed by the serverInstanceId attribute. - * - * - */ -public class StartServerCommand extends AbstractDataModelOperation -{ - private ILog log; - private boolean doAsyncPublish_; - - private String serverInstanceId; - - - public StartServerCommand() - { - log = EnvironmentService.getEclipseLog(); - doAsyncPublish_ = true; - } - - public StartServerCommand( boolean doAsyncPublish ) - { - this(); - - doAsyncPublish_ = doAsyncPublish; - } - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment env = getEnvironment(); - IStatus status = Status.OK_STATUS; - - IServer server = ServerCore.findServer(serverInstanceId); - if (server == null) - { - status = StatusUtils.errorStatus(ConsumptionMessages.MSG_ERROR_INSTANCE_NOT_FOUND); - env.getStatusHandler().reportError(status); - return status; - } - - int serverState = server.getServerState(); - - // Publish if required - if (server.shouldPublish()) { - if (server.canPublish().getSeverity() == IStatus.OK) - { - status = publish(server, IServer.PUBLISH_INCREMENTAL, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - } - - // start/restart server if required - - switch (serverState) - { - case IServer.STATE_STOPPED: - if (server.canStart(ILaunchManager.RUN_MODE).getSeverity()==IStatus.OK) - { - status = start(server, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - break; - case IServer.STATE_STARTED: - boolean shouldRestart = server.shouldRestart(); - - if (shouldRestart && server.canRestart(ILaunchManager.RUN_MODE).getSeverity()==IStatus.OK) - { - status = restart(server, monitor ); - if (status.getSeverity() == Status.ERROR) - { - env.getStatusHandler().reportError(status); - return status; - } - } - } - - return status; - } - - private IStatus publish(final IServer server, final int kind, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - final IStatus[] istatus = new IStatus[1]; - monitor.subTask(ConsumptionMessages.PROGRESS_INFO_PUBLISHING_SERVER); - IRunnableWithProgress runnable = new IRunnableWithProgress() - { - public void run(IProgressMonitor shellMonitor) throws InvocationTargetException, InterruptedException - { - istatus[0] = server.publish(kind, shellMonitor); - } - }; - - try - { - if( doAsyncPublish_ ) - { - ProgressMonitorDialog dialog = new ProgressMonitorDialog(null); - dialog.run(true, true, runnable); - } - else - { - runnable.run( monitor ); - } - - } - catch(InvocationTargetException ite) - { - istatus[0] = new org.eclipse.core.runtime.Status( IStatus.ERROR, "id", 0, ite.getMessage(), ite ); - ite.printStackTrace(); - } - catch(InterruptedException ie) - { - istatus[0] = new org.eclipse.core.runtime.Status( IStatus.ERROR, "id", 0, ie.getMessage(), ie ); - ie.printStackTrace(); - } - - - if (istatus[0].getSeverity() != IStatus.OK) - { - status = istatus[0]; - if (status.getSeverity() == IStatus.CANCEL) - status = StatusUtils.errorStatus(""); - return status; - } - - log.log(ILog.INFO, 5051, this, "publishProject", "IServer=" + server + ", Publish command completed"); - return status; - } - - private IStatus restart(IServer server, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - try - { - monitor.subTask(ConsumptionMessages.PROGRESS_INFO_STARTING_SERVER); - server.synchronousRestart(ILaunchManager.RUN_MODE, monitor); - log.log(ILog.INFO, 5052, this, "execute", "IServer=" + server + ", Restart command completed"); - return status; - } catch (CoreException e) - { - status = StatusUtils.errorStatus(ConsumptionMessages.MSG_ERROR_SERVER, e); - return status; - } - - } - - private IStatus start(IServer server, IProgressMonitor monitor ) - { - IStatus status = Status.OK_STATUS; - try - { - monitor.subTask(ConsumptionMessages.PROGRESS_INFO_STARTING_SERVER); - server.synchronousStart(ILaunchManager.RUN_MODE, monitor); - log.log(ILog.INFO, 5053, this, "execute", "IServer=" + server + ", Start command completed"); - return status; - } catch (CoreException e) - { - status = StatusUtils.errorStatus(ConsumptionMessages.MSG_ERROR_SERVER, e); - return status; - } - } - - public void setServerInstanceId(String serverInstanceId) - { - this.serverInstanceId = serverInstanceId; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java deleted file mode 100644 index 507cdad38..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/WSINonCompliantRuntimeCommand.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060420 120714 kathy@ca.ibm.com - Kathy Chan - *******************************************************************************/ - -package org.eclipse.jst.ws.internal.consumption.ui.command; - -import java.util.Vector; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.env.core.common.StatusUtils; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.ws.internal.WstWSPluginMessages; -import org.eclipse.wst.ws.internal.plugin.WSPlugin; -import org.eclipse.wst.ws.internal.preferences.PersistentWSIAPContext; -import org.eclipse.wst.ws.internal.preferences.PersistentWSISSBPContext; -import org.eclipse.wst.ws.internal.preferences.WSIComplianceUtils; - - - -public class WSINonCompliantRuntimeCommand extends AbstractDataModelOperation -{ - - private IProject serviceProject_; - - public WSINonCompliantRuntimeCommand() - { - } - - - public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) - { - IEnvironment environment = getEnvironment(); - - PersistentWSISSBPContext wsiSSBPContext = WSPlugin.getInstance().getWSISSBPContext(); - PersistentWSIAPContext wsiAPContext = WSPlugin.getInstance().getWSIAPContext(); - Vector statusSSBP = new Vector(); - statusSSBP.add( new Status( WSIComplianceUtils.getWSISeverity(serviceProject_, wsiSSBPContext), "id", 0, - WstWSPluginMessages.WSI_SSBP_INCOMPLIANT_RUNTIME, null ) ); - Status[] statusesSSBP = (Status[]) statusSSBP.toArray(new Status[statusSSBP.size()]); - - Vector statusAP = new Vector(); - statusAP.add( new Status( WSIComplianceUtils.getWSISeverity(serviceProject_, wsiAPContext), "id", 0, - WstWSPluginMessages.WSI_AP_INCOMPLIANT_RUNTIME, null )); - Status[] statusesAP = (Status[]) statusAP.toArray(new Status[statusAP.size()]); - - if (WSIComplianceUtils.checkWSICompliance (environment.getStatusHandler(), statusesAP, serviceProject_, wsiAPContext)) - { - if (WSIComplianceUtils.checkWSICompliance (environment.getStatusHandler(), statusesSSBP, serviceProject_, wsiSSBPContext)) - { - return Status.OK_STATUS; - } - else - { - // Set message to empty string so that an error dialog does - // not pop-up telling the user that they cannot continue - // because they choose not to ignore the WS-I non-compliance warning. - return StatusUtils.errorStatus( "" ); - } - } - else - { - // Set message to empty string so that an error dialog does - // not pop-up telling the user that they cannot continue - // because they choose not to ignore the WS-I non-compliance warning. - return StatusUtils.errorStatus( "" ); - } - } - - public void setServiceProject(IProject serviceProject) { - this.serviceProject_ = serviceProject; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/EclipseIPath2URLStringTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/EclipseIPath2URLStringTransformer.java deleted file mode 100644 index ca35e38e2..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/EclipseIPath2URLStringTransformer.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command.data; - -import java.net.MalformedURLException; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.wst.command.internal.env.core.data.Transformer; - - -public class EclipseIPath2URLStringTransformer implements Transformer -{ - public Object transform(Object value) - { - String s = value.toString(); - if (s.indexOf(":") < 0) - { - IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(value.toString()); - if (res.exists()) - { - try - { - s = res.getLocation().toFile().toURL().toString(); - } - catch (MalformedURLException murle) - { - } - } - } - return s; - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ProjectName2IProjectTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ProjectName2IProjectTransformer.java deleted file mode 100644 index ac65f4176..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ProjectName2IProjectTransformer.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * yyyymmdd bug Email and other contact information - * -------- -------- ----------------------------------------------------------- - * 20060221 124302 rsinha@ca.ibm.com - Rupam Kuehner - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command.data; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.wst.command.internal.env.core.data.Transformer; - -public class ProjectName2IProjectTransformer implements Transformer -{ - public Object transform(Object value) - { - if (value != null) - { - String project = (String) value; - int slashIndex = project.indexOf('/'); - String projectName = project; - - if (slashIndex != -1) - { - projectName = project.substring(0, slashIndex); - } - - return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - } else - { - return null; - } - } -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerInstToIServerTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerInstToIServerTransformer.java deleted file mode 100644 index 6f881ca49..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerInstToIServerTransformer.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * Created on Apr 20, 2004 - */ -package org.eclipse.jst.ws.internal.consumption.ui.command.data; - -import org.eclipse.wst.command.internal.env.core.data.Transformer; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - -/* - * Transforms a server instance id to an IServer - */ -public class ServerInstToIServerTransformer implements Transformer { - - /* (non-Javadoc) - * @see org.eclipse.wst.command.internal.env.core.data.Transformer#transform(java.lang.Object) - */ - public Object transform(Object value) { - - String existingServerInstId = (String)value; - IServer serverInst = null; - if (existingServerInstId != null) { - serverInst = ServerCore.findServer(existingServerInstId); - } - return serverInst; - } - -} diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerName2IServerTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerName2IServerTransformer.java deleted file mode 100644 index 815d797b4..000000000 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/command/data/ServerName2IServerTransformer.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.ws.internal.consumption.ui.command.data; - -import org.eclipse.wst.command.internal.env.core.data.Transformer; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.ServerCore; - -public class ServerName2IServerTransformer implements Transformer -{ - public Object transform(Object value) - { - { - String serverName = value.toString(); - IServer[] servers = ServerCore.getServers(); - if (servers != null && servers.length!=0) - { - for (int i = 0; i < servers.length; i++) - { - IServer server = (IServer)servers[i]; - if ((server.getName()).equals(serverName)) - return server; - } - } - } - return null; - } -} |