diff options
Diffstat (limited to 'bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions')
23 files changed, 0 insertions, 1850 deletions
diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/Action.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/Action.java deleted file mode 100644 index 2207fe501..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/Action.java +++ /dev/null @@ -1,134 +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.wst.ws.internal.explorer.platform.actions; - -import java.util.Hashtable; -import java.util.Vector; - -import javax.servlet.http.HttpServletRequest; - -import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.CurrentNodeSelectionTransformer; -import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.MessageQueue; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Perspective; - -// Abstract action class used for both Link and Form actions. -public abstract class Action -{ - protected Controller controller_; - protected Hashtable propertyTable_; - protected Vector removedProperties_; - - public Action() - { - this(null); - } - - public Action(Controller controller) - { - controller_ = controller; - propertyTable_ = new Hashtable(); - removedProperties_ = new Vector(); - } - - public final Controller getController() - { - return controller_; - } - - /** - * Read properties from an HttpServletRequest and add them to the property table. - * @param HttpServletRequest The HttpServletRequest containing the embedded parameters. - * @return boolean Whether or not the operation was successful. - */ - public abstract boolean populatePropertyTable(HttpServletRequest request); - - /** - * Get the property table. - * @return Hashtable A hashtable containing the properties for this action. - */ - public final Hashtable getPropertyTable() - { - return propertyTable_; - } - - /** - * Set the property table. - * @return void - */ - public void setPropertyTable(Hashtable propertyTable) - { - propertyTable_ = propertyTable; - } - - /** - * Add a property to the property table. - * @param void - */ - public final void addProperty(Object key, Object value) - { - propertyTable_.put(key, value); - } - - /** - * Remove a property from the property table. Track the deletions. - * @param Object The key of the property being removed. - */ - public final void removeProperty(Object key) - { - propertyTable_.remove(key); - removedProperties_.addElement(key); - } - - public final String[] getPropertyAsStringArray(Object key) - { - Object object = propertyTable_.get(key); - if (object instanceof String[]) - return (String[])object; - else if (object != null) - return new String[] {object.toString()}; - else - return new String[0]; - } - - public final boolean execute() - { - return execute(true); - } - - public final boolean execute(boolean useActionEngine) - { - if (useActionEngine) - return controller_.getActionEngine().executeAction(this); - else - return run(); - } - - // Abstract method for running this action. - public abstract boolean run(); - - /** - * Return the transformers used to normalize the input/output parameters for this action - * @return ITransformer[] - */ - public ITransformer[] getTransformers() - { - return new ITransformer[] {new CurrentNodeSelectionTransformer(controller_)}; - } - - protected void handleUnexpectedException(Perspective perspective,MessageQueue messageQueue,String exceptionName,Throwable t) - { - messageQueue.addMessage(perspective.getController().getMessage("MSG_ERROR_UNEXPECTED")); - messageQueue.addMessage(exceptionName); - messageQueue.addMessage(t.getMessage()); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/CheckWorkbenchFileReadOnlyAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/CheckWorkbenchFileReadOnlyAction.java deleted file mode 100644 index 77832f6a0..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/CheckWorkbenchFileReadOnlyAction.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; - -public class CheckWorkbenchFileReadOnlyAction extends Action -{ - public static final String getActionLink() - { - return "actions/CheckWorkbenchFileReadOnlyActionJSP.jsp"; - } - - public boolean populatePropertyTable(HttpServletRequest request) - { - return true; - } - - public boolean run() - { - return true; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ClearNodeAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ClearNodeAction.java deleted file mode 100644 index c53fdc694..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ClearNodeAction.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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 - * -------- -------- ----------------------------------------------------------- - * 20060906 156398 jeffliu@ca.ibm.com - Jeffrey Liu - *******************************************************************************/ - -package org.eclipse.wst.ws.internal.explorer.platform.actions; - -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.wst.ws.internal.datamodel.Rel; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.MessageQueue; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -public abstract class ClearNodeAction extends NodeAction -{ - public ClearNodeAction(Controller controller,NodeManager nodeManager) - { - super(controller,nodeManager); - } - - public boolean run() - { - int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); - if (!isStaleNode(nodeId)) - { - Node node = nodeManager_.getNode(nodeId); - TreeElement element = node.getTreeElement(); - //element.disconnectAll(); - List elements2remove = new ArrayList(); - collectElements2Remove(element, elements2remove); - for (Iterator it = elements2remove.iterator(); it.hasNext();) - { - TreeElement e = (TreeElement)it.next(); - e.getModel().removeElement(e); - } - if (element.getModel().getRootElement() != element) - nodeManager_.removeFromNodeTable(nodeId); - // Do not add this to the history. - MessageQueue messageQueue = controller_.getCurrentPerspective().getMessageQueue(); - messageQueue.addMessage(controller_.getMessage("MSG_INFO_NODE_CLEARED",node.getNodeName())); - return true; - } - return false; - } - - private void collectElements2Remove(TreeElement element, List elements2remove) - { - if (!elements2remove.contains(element)) - { - if (element.getModel().getRootElement() != element) - elements2remove.add(element); - Enumeration rels = element.getRels(); - while (rels.hasMoreElements()) - { - Rel rel = (Rel)rels.nextElement(); - String relName = rel.getName(); - if (!ModelConstants.REL_OWNER.equals(relName)) - { - Enumeration children = element.getElements(rel.getName()); - while (children.hasMoreElements()) - { - collectElements2Remove((TreeElement)children.nextElement(), elements2remove); - } - } - } - } - } - - public final String getActionLinkForHistory() - { - return null; - } - - // Deleting a node from the tree results in changes to the treeview and status contents. - public abstract String getTreeContentVar(); - public abstract String getTreeContentPage(); - public abstract String getPropertiesContainerVar(); - public abstract String getPropertiesContainerPage(); - public abstract String getStatusContentVar(); - public abstract String getStatusContentPage(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ClearViewElementAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ClearViewElementAction.java deleted file mode 100644 index b7598d60f..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ClearViewElementAction.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.ListManager; -import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.ViewTool; - -// Abstract action class used for both Link and Form actions. -public abstract class ClearViewElementAction extends LinkAction -{ - private String listManagerRel_; - private NodeManager nodeManager_; - public ClearViewElementAction(Controller controller,NodeManager nodeManager,String listManagerRel) - { - super(controller); - nodeManager_ = nodeManager; - listManagerRel_ = listManagerRel; - } - - // ...jsp?viewId=... - protected final boolean processLinkParameters(HttpServletRequest request) - { - String viewIdString = request.getParameter(ActionInputs.VIEWID); - // Perform data validation. - try - { - Integer.parseInt(viewIdString); - } - catch (NumberFormatException e) - { - // Validation failed! - return false; - } - propertyTable_.put(ActionInputs.VIEWID,viewIdString); - return true; - } - - public final boolean run() - { - int viewId = Integer.parseInt((String)propertyTable_.get(ActionInputs.VIEWID)); - Node selectedNode = nodeManager_.getSelectedNode(); - ViewTool viewTool = (ViewTool)selectedNode.getToolManager().getSelectedTool(); - if (viewTool.getToolManager(viewId) == null) - { - // Stale view. - return false; - } - TreeElement element = selectedNode.getTreeElement(); - ListManager listManager = (ListManager)element.getPropertyAsObject(listManagerRel_); - listManager.removeElementWithViewId(viewId); - viewTool.clearViewToolManager(viewId); - selectedNode.setViewId(ActionInputs.VIEWID_DEFAULT); - // Do not add this to the history. - return true; - } - - public final String getActionLinkForHistory() - { - return null; - } - - public abstract String getPropertiesContainerVar(); - public abstract String getPropertiesContainerPage(); - public abstract String getStatusContentVar(); - public abstract String getStatusContentPage(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/FormAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/FormAction.java deleted file mode 100644 index a94d30d97..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/FormAction.java +++ /dev/null @@ -1,72 +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.wst.ws.internal.explorer.platform.actions; - -import java.util.Hashtable; -import java.util.Iterator; -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.FormTool; -import org.eclipse.wst.ws.internal.explorer.platform.util.HTMLUtils; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; - -public abstract class FormAction extends Action -{ - public FormAction(Controller controller) - { - super(controller); - } - - protected abstract boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException; - - public final boolean populatePropertyTable(HttpServletRequest request) - { - try - { - MultipartFormDataParser parser = new MultipartFormDataParser(); - parser.parseRequest(request,HTMLUtils.UTF8_ENCODING); - getSelectedFormTool().clearErrors(); - boolean result = processParsedResults(parser); - removedProperties_.removeAllElements(); - return result; - } - catch (MultipartFormDataException e) - { - } - return false; - } - - public void setPropertyTable(Hashtable propertyTable) - { - try - { - processParsedResults(new MultipartFormDataParser(propertyTable)); - } - catch (MultipartFormDataException mfde) - { - } - for (Iterator it = propertyTable.keySet().iterator(); it.hasNext();) - { - Object key = it.next(); - Hashtable thisPropertyTable = getPropertyTable(); - if (!thisPropertyTable.containsKey(key)) - addProperty(key, propertyTable.get(key)); - } - } - - protected final void addToHistory(int perspectiveId,String url) - { - controller_.addToHistory(perspectiveId,url); - } - - public abstract FormTool getSelectedFormTool(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/FormInputException.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/FormInputException.java deleted file mode 100644 index 3f2cca4f4..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/FormInputException.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -// A class for reporting form input exceptions. -public class FormInputException extends Exception -{ - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3257846601685938742L; - -public FormInputException(String msg) - { - super(msg); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ImportToFileSystemAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ImportToFileSystemAction.java deleted file mode 100644 index dd7245b73..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ImportToFileSystemAction.java +++ /dev/null @@ -1,127 +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.wst.ws.internal.explorer.platform.actions; - -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import javax.servlet.http.HttpServletRequest; -import javax.wsdl.Definition; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLWriter; -import org.apache.wsil.WSILDocument; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.wsdl.internal.impl.wsdl4j.WSDLFactoryImpl; - -public abstract class ImportToFileSystemAction extends LinkAction -{ - public ImportToFileSystemAction(Controller controller) - { - super(controller); - } - - // os is the OutputStream of the file in the file system - public abstract boolean write(OutputStream os); - - // the default name for the file - public abstract String getDefaultFileName(); - - public boolean writeWSDLDefinition(OutputStream os, Definition definition) - { - try - { - WSDLFactory wsdlFactory = new WSDLFactoryImpl(); - WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter(); - wsdlWriter.writeWSDL(definition, os); - return true; - } - catch (Throwable t) - { - return false; - } - } - - public boolean writeWSILDocument(OutputStream os, WSILDocument wsilDoc) - { - OutputStreamWriter osw = null; - try - { - osw = new OutputStreamWriter(os); - wsilDoc.write(osw); - return true; - } - catch (Exception e) - { - return false; - } - finally - { - try - { - if (osw != null) - osw.close(); - } - catch (Exception e) - { - } - } - } - - public static String getActionLink(int nodeID, int toolID, int viewID, int viewToolID, String jspPage) - { - StringBuffer actionLink = new StringBuffer(jspPage); - actionLink.append('?'); - actionLink.append(ActionInputs.NODEID); - actionLink.append('='); - actionLink.append(nodeID); - actionLink.append('&'); - actionLink.append(ActionInputs.TOOLID); - actionLink.append('='); - actionLink.append(toolID); - actionLink.append('&'); - actionLink.append(ActionInputs.VIEWID); - actionLink.append('='); - actionLink.append(viewID); - actionLink.append('&'); - actionLink.append(ActionInputs.VIEWTOOLID); - actionLink.append('='); - actionLink.append(viewToolID); - return actionLink.toString(); - } - - protected boolean processLinkParameters(HttpServletRequest request) - { - String nodeID = request.getParameter(ActionInputs.NODEID); - String toolID = request.getParameter(ActionInputs.TOOLID); - String viewID = request.getParameter(ActionInputs.VIEWID); - String viewToolID = request.getParameter(ActionInputs.VIEWTOOLID); - try - { - Integer.parseInt(nodeID); - Integer.parseInt(toolID); - Integer.parseInt(viewID); - Integer.parseInt(viewToolID); - propertyTable_.put(ActionInputs.NODEID, nodeID); - propertyTable_.put(ActionInputs.TOOLID, toolID); - propertyTable_.put(ActionInputs.VIEWID, viewID); - propertyTable_.put(ActionInputs.VIEWTOOLID, viewToolID); - } - catch (Exception e) - { - return false; - } - return true; - } - - public abstract String getStatusContentVar(); - - public abstract String getStatusContentPage(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ImportToWorkbenchAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ImportToWorkbenchAction.java deleted file mode 100644 index 8a0c3f998..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ImportToWorkbenchAction.java +++ /dev/null @@ -1,220 +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 - * -------- -------- ----------------------------------------------------------- - * 20060721 149070 gilberta@ca.ibm.com - Gilbert Andrews, update to respect preferences - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.actions; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.OutputStream; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.wst.command.internal.env.context.PersistentResourceContext; -import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment; -import org.eclipse.wst.common.environment.IEnvironment; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.MessageQueue; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; -import org.eclipse.wst.ws.internal.wsil.AddWSDLToWSILCommand; - -public abstract class ImportToWorkbenchAction extends FormAction { - private IWorkspaceRoot iWorkspaceRoot_; - private IProject iProject_; - private IResource targetFileResource_; - - public ImportToWorkbenchAction(Controller controller) { - super(controller); - iWorkspaceRoot_ = ResourcesPlugin.getWorkspace().getRoot(); - } - - protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException { - getSelectedFormTool(); - MessageQueue msgQueue = controller_.getCurrentPerspective().getMessageQueue(); - boolean inputsValid = true; - String workbenchProjectName = parser.getParameter(ActionInputs.WORKBENCH_PROJECT_NAME); - if (workbenchProjectName == null || workbenchProjectName.length() <= 0) { - msgQueue.addMessage(controller_.getMessage("MSG_ERROR_INVALID_WORKBENCH_PROJECT")); - inputsValid = false; - } - else - { - iProject_ = iWorkspaceRoot_.getProject(workbenchProjectName); - propertyTable_.put(ActionInputs.WORKBENCH_PROJECT_NAME, workbenchProjectName); - } - String importFile = parser.getParameter(ActionInputs.IMPORT_FILE); - if (importFile != null) - { - propertyTable_.put(ActionInputs.IMPORT_FILE, ActionInputs.IMPORT_FILE); - String importedFileName = parser.getParameter(ActionInputs.IMPORTED_FILE_NAME); - if (importedFileName == null || importedFileName.length() <= 0) - { - msgQueue.addMessage(controller_.getMessage("MSG_ERROR_INVALID_FILE_NAME")); - inputsValid = false; - } - else - propertyTable_.put(ActionInputs.IMPORTED_FILE_NAME, importedFileName); - } - String importToWSIL = parser.getParameter(ActionInputs.IMPORT_TO_WSIL); - if (importToWSIL != null) - { - propertyTable_.put(ActionInputs.IMPORT_TO_WSIL, ActionInputs.IMPORT_TO_WSIL); - propertyTable_.put(ActionInputs.IMPORTED_WSDL_URL, parser.getParameter(ActionInputs.IMPORTED_WSDL_URL)); - String wsilFileName = parser.getParameter(ActionInputs.WSIL_FILE_NAME); - if (wsilFileName == null || wsilFileName.length() <= 0) - { - msgQueue.addMessage(controller_.getMessage("MSG_ERROR_INVALID_WSIL_FILE_NAME")); - inputsValid = false; - } - else - propertyTable_.put(ActionInputs.WSIL_FILE_NAME, wsilFileName); - } - if (importFile == null && importToWSIL == null) - { - msgQueue.addMessage(controller_.getMessage("MSG_ERROR_NO_IMPORT_OPTION_SELECTED")); - inputsValid = false; - } - return inputsValid; - } - - private OutputStream getOutputStream(String defaultFileName) throws FileNotFoundException { - File file = new File(controller_.getServletEngineStateLocation() + defaultFileName); - FileOutputStream fos = new FileOutputStream(file); - return fos; - } - - private boolean importTempFileToWebProject(String defaultFileName) throws FileNotFoundException, CoreException - { - if (targetFileResource_ != null && targetFileResource_.getType() == IResource.FILE) - targetFileResource_.delete(true,new NullProgressMonitor()); - - String importedFileName = (String)propertyTable_.get(ActionInputs.IMPORTED_FILE_NAME); - File file = new File(controller_.getServletEngineStateLocation()+defaultFileName); - BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); - - IFile iFile = iProject_.getFile("/"+importedFileName); - iFile.create(bis,true,new NullProgressMonitor()); - - // Remove the temporary file - file.delete(); - return true; - } - - public boolean fileExists() - { - String importedFileName = (String)propertyTable_.get(ActionInputs.IMPORTED_FILE_NAME); - if (importedFileName != null) - { - targetFileResource_ = iProject_.findMember(importedFileName); - return (targetFileResource_ != null && targetFileResource_.getType() == IResource.FILE); - } - else - return false; - } - - public boolean isTargetFileResourceReadOnly() - { - return targetFileResource_.getResourceAttributes().isReadOnly(); - } - - - public boolean isCheckoutFilesEnabled() - { - return PersistentResourceContext.getInstance().isCheckoutFilesEnabled(); - } - - public String getWebServicePluginFileMessage(String messageId) - { - String importedFileName = (String)propertyTable_.get(ActionInputs.IMPORTED_FILE_NAME); - return controller_.getMessage(messageId,new String[]{iProject_.getFullPath().toString(),importedFileName}); - } - - - public boolean isOverwriteFilesEnabled() - { - return PersistentResourceContext.getInstance().isOverwriteFilesEnabled(); - } - - public boolean validateEdit() - { - IFile[] files = new IFile[1]; - files[0] = (IFile)targetFileResource_; - IStatus status = ResourcesPlugin.getWorkspace().validateEdit(files,null); - MessageQueue messageQueue = controller_.getCurrentPerspective().getMessageQueue(); - messageQueue.addMessage(status.getMessage()); - return status.isOK(); - } - - public boolean run() { - MessageQueue msgQueue = controller_.getCurrentPerspective().getMessageQueue(); - if (propertyTable_.get(ActionInputs.IMPORT_FILE) != null) - { - try { - ImportToFileSystemAction action = newImportToFileSystemAction(); - action.run(); - String defaultFileName = action.getDefaultFileName(); - if (!action.write(getOutputStream(defaultFileName))) { - msgQueue.addMessage(controller_.getMessage("MSG_ERROR_WRITING_TEMP_FILE_TO_FS")); - return false; - } - importTempFileToWebProject(defaultFileName); - String importedFileName = (String)propertyTable_.get(ActionInputs.IMPORTED_FILE_NAME); - msgQueue.addMessage(controller_.getMessage("MSG_INFO_IMPORT_TO_WORKBENCH_SUCCESSFUL", importedFileName)); - } - catch (FileNotFoundException fnfe) { - msgQueue.addMessage(fnfe.getMessage()); - return false; - } - catch (CoreException ce) { - msgQueue.addMessage(ce.getMessage()); - return false; - } - } - if (propertyTable_.get(ActionInputs.IMPORT_TO_WSIL) != null) - { - String projectName = (String)propertyTable_.get(ActionInputs.WORKBENCH_PROJECT_NAME); - String importedWSILFileName = (String)propertyTable_.get(ActionInputs.WSIL_FILE_NAME); - String wsdlURL = (String)propertyTable_.get(ActionInputs.IMPORTED_WSDL_URL); - StringBuffer wsilPlatformURL = new StringBuffer("platform:/resource/"); - wsilPlatformURL.append(projectName); - wsilPlatformURL.append('/'); - wsilPlatformURL.append(importedWSILFileName); - AddWSDLToWSILCommand command = new AddWSDLToWSILCommand(); - String[] args = new String[5]; - args[0] = AddWSDLToWSILCommand.ARG_WSIL; - args[1] = wsilPlatformURL.toString(); - args[2] = AddWSDLToWSILCommand.ARG_WSDL; - args[3] = wsdlURL; - args[4] = AddWSDLToWSILCommand.ARG_RESOLVE_WSDL; - command.setArguments(args); - IEnvironment env = new EclipseEnvironment(null, null, null); - command.setEnvironment( env ); - command.execute( null, null ); - msgQueue.addMessage(controller_.getMessage("MSG_INFO_IMPORT_SERVICE_REF_TO_WSIL_SUCCESSFUL", importedWSILFileName)); - } - return true; - } - - public abstract String getStatusContentVar(); - public abstract String getStatusContentPage(); - public abstract ImportToFileSystemAction newImportToFileSystemAction(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/LaunchWebServiceWizardAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/LaunchWebServiceWizardAction.java deleted file mode 100644 index 853a36b2b..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/LaunchWebServiceWizardAction.java +++ /dev/null @@ -1,57 +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.wst.ws.internal.explorer.platform.actions; - -import org.eclipse.wst.ws.internal.explorer.LaunchWizardRunnable; -import org.eclipse.wst.ws.internal.explorer.LaunchWizardTask; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; - -public abstract class LaunchWebServiceWizardAction extends FormAction -{ - public LaunchWebServiceWizardAction(Controller controller) - { - super(controller); - } - - protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException - { - String wizardID = parser.getParameter(ActionInputs.WEB_SERVICE_WIZARD); - propertyTable_.put(ActionInputs.WEB_SERVICE_WIZARD, wizardID); - return true; - } - - public boolean launchWizard(String wsdlURL) - { - LaunchWizardTask task = LaunchWizardTask.getInstance(); - if (task.getIsExecuting()) - { - controller_.getCurrentPerspective().getMessageQueue().addMessage(controller_.getMessage("MSG_ERROR_WIZARD_ALREADY_RUNNING")); - return false; - } - int wizardID = Integer.parseInt((String)propertyTable_.get(ActionInputs.WEB_SERVICE_WIZARD)); - LaunchWizardRunnable runnable; - if (wizardID == ActionInputs.WEB_SERVICE_CLIENT_WIZARD) - runnable = new LaunchWizardRunnable("org.eclipse.jst.ws.internal.consumption.ui.wizard.client.clientwizard", wsdlURL); - else if (wizardID == ActionInputs.WEB_SERVICE_SKELETON_WIZARD) - runnable = new LaunchWizardRunnable("org.eclipse.jst.ws.creation.ui.wizard.serverwizard", wsdlURL); - else - return false; - task.checkAndAsyncExec(runnable); - return true; - } - - public abstract String getStatusContentVar(); - - public abstract String getStatusContentPage(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/LinkAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/LinkAction.java deleted file mode 100644 index c7f644d91..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/LinkAction.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; - -// Abstract class representing the action of clicking a link. These actions -// may change the history list. -public abstract class LinkAction extends Action -{ - private boolean isAddedToHistory_; - private boolean isStaleBreadCrumb_; - - public LinkAction(Controller controller) - { - super(controller); - isAddedToHistory_ = false; - isStaleBreadCrumb_ = false; - } - - // Determine if the action was successfully added to this history list. - // This should be called after the run() method. - public final boolean isAddedToHistory() - { - return isAddedToHistory_; - } - - protected abstract boolean processLinkParameters(HttpServletRequest request); - - public final boolean populatePropertyTable(HttpServletRequest request) - { - String isHistoryString = request.getParameter(ActionInputs.ISHISTORY); - if (isHistoryString != null) - propertyTable_.put(ActionInputs.ISHISTORY,isHistoryString); - return processLinkParameters(request); - } - - // Add the action's URL to the controller's history list. - protected final void addToHistory(int perspectiveId,String url) - { - if (!isHistoryAction()) - isAddedToHistory_ = controller_.addToHistory(perspectiveId,url); - } - - public final boolean isHistoryAction() - { - return (propertyTable_.get(ActionInputs.ISHISTORY) != null); - } - - public final void setStaleBreadCrumb() - { - if (isHistoryAction()) - { - isStaleBreadCrumb_ = true; - controller_.processStaleBreadCrumb(); - } - } - - public final boolean isStaleBreadCrumb() - { - return isStaleBreadCrumb_; - } - - // Call this when a stale breadcrumb is encountered while traversing history chain. - public final String getNextHistoryActionLink() - { - return RetrieveHistoryAction.getActionLink(controller_.getHistoryDirection()); - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/NodeAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/NodeAction.java deleted file mode 100644 index cb44a618f..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/NodeAction.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.wst.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -public abstract class NodeAction extends LinkAction -{ - protected NodeManager nodeManager_; - private boolean requiresTreeViewRefresh_; - private boolean requiresNodeSelection_; - private boolean requiresViewSelection_; - private boolean requiresStatusUpdate_; - - public NodeAction(Controller controller,NodeManager nodeManager) - { - super(controller); - nodeManager_ = nodeManager; - requiresTreeViewRefresh_ = false; - requiresNodeSelection_ = false; - requiresViewSelection_ = false; - requiresStatusUpdate_ = false; - } - - // ...jsp?nodeId=...<&isHistory=1> - protected boolean processLinkParameters(HttpServletRequest request) - { - String nodeIdString = request.getParameter(ActionInputs.NODEID); - // Perform data validation. - try - { - Integer.parseInt(nodeIdString); - } - catch (NumberFormatException e) - { - // Validation failed! - return false; - } - propertyTable_.put(ActionInputs.NODEID,nodeIdString); - return true; - } - - protected final boolean isStaleNode(int nodeId) - { - return (nodeManager_.getNode(nodeId) == null); - } - - /** - * Make a node visible. A node is visible when all of its ancestors are expanded. - * @param Node The node to be made visible. - * @return boolean Indicator for whether or not the tree structure was changed (i.e. expanded to show the node in question). - */ - protected final boolean makeNodeVisible(Node node) - { - requiresTreeViewRefresh_ = node.getNodeManager().makeNodeVisible(node); - return requiresTreeViewRefresh_; - } - - /** - * Make a node visible. A node is visible when all of its ancestors are expanded. - * @param Node The node to be made visible. - * @return boolean Indicator for whether or not the tree structure was changed (i.e. expanded to show the node in question). - */ - public final void setTreeRefreshNeeded() - { - requiresTreeViewRefresh_ = true; - - } - - /** - * Select a node with id nodeId. - * @param int The id of the node to be selected. - */ - protected final void setSelectedNodeId(int nodeId) - { - if (nodeManager_.getSelectedNodeId() != nodeId) - { - requiresNodeSelection_ = true; - nodeManager_.setSelectedNodeId(nodeId); - } - } - - protected final void setSelectedViewId(int viewId) - { - Node selectedNode = nodeManager_.getSelectedNode(); - if (selectedNode.getViewId() != viewId) - { - requiresViewSelection_ = true; - selectedNode.setViewId(viewId); - } - } - - // Determine whether or not the treeview requires reloading as a result of this action. - // Reloading is required when branches are added/removed. - public boolean requiresTreeViewRefresh() - { - return requiresTreeViewRefresh_; - } - - // Determine whether or not a new node has been selected as a result of the action. - public boolean requiresNodeSelection() - { - return requiresNodeSelection_; - } - - // Determine if a new view element is selected. - public boolean requiresViewSelection() - { - return requiresViewSelection_; - } - - // Determine if any status messages arose from this action. - public boolean requiresStatusUpdate() - { - return requiresStatusUpdate_; - } - - protected abstract String getActionLinkForHistory(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/OpenCalendarBrowserAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/OpenCalendarBrowserAction.java deleted file mode 100644 index dd2211902..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/OpenCalendarBrowserAction.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; - -public class OpenCalendarBrowserAction extends Action -{ - public OpenCalendarBrowserAction() - { - } - - // calendar_browser.jsp?sessionId=...&calendarType=... - public static final String getActionLink(String sessionId,int calendarType) - { - StringBuffer actionLink = new StringBuffer("calendar_browser.jsp?"); - actionLink.append(ActionInputs.SESSIONID).append('=').append(sessionId); - actionLink.append('&').append(ActionInputs.CALENDAR_TYPE).append('=').append(calendarType); - return actionLink.toString(); - } - - public static final String getActionLinkForDate(String sessionId) - { - return getActionLink(sessionId,ActionInputs.CALENDAR_TYPE_DATE); - } - - public static final String getActionLinkForDateTime(String sessionId) - { - return getActionLink(sessionId,ActionInputs.CALENDAR_TYPE_DATETIME); - } - - public static final String getActionLinkForGYearMonth(String sessionId) - { - return getActionLink(sessionId,ActionInputs.CALENDAR_TYPE_GYEARMONTH); - } - - public static final String getActionLinkForGDay(String sessionId) - { - return getActionLink(sessionId,ActionInputs.CALENDAR_TYPE_GDAY); - } - - public static final String getActionLinkForGMonthDay(String sessionId) - { - return getActionLink(sessionId,ActionInputs.CALENDAR_TYPE_GMONTHDAY); - } - - public final boolean populatePropertyTable(HttpServletRequest request) - { - return true; - } - - public final boolean run() - { - return true; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/OpenWSDLBrowserAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/OpenWSDLBrowserAction.java deleted file mode 100644 index 204cd80de..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/OpenWSDLBrowserAction.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; - -public class OpenWSDLBrowserAction extends Action -{ - public OpenWSDLBrowserAction() - { - } - - public static final String getActionLink(String sessionId,int wsdlType) - { - StringBuffer actionLink = new StringBuffer("wsdl_browser.jsp?"); - actionLink.append(ActionInputs.SESSIONID).append('=').append(sessionId); - actionLink.append('&').append(ActionInputs.WSDL_TYPE).append('=').append(wsdlType); - return actionLink.toString(); - } - - public static final String getActionLinkForService(String sessionId) - { - return getActionLink(sessionId,ActionInputs.WSDL_TYPE_SERVICE); - } - - public static final String getActionLinkForServiceInterface(String sessionId) - { - return getActionLink(sessionId,ActionInputs.WSDL_TYPE_SERVICE_INTERFACE); - } - - public final boolean populatePropertyTable(HttpServletRequest request) - { - return true; - } - - public final boolean run() - { - return true; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ProxyLoadPageAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ProxyLoadPageAction.java deleted file mode 100644 index 5ee9309e6..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ProxyLoadPageAction.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; - -public class ProxyLoadPageAction extends Action -{ - // Get the action given a relative targetPage URL. e.g. "forms/LongLoadingForm.jsp" - public static final String getActionLink(String targetPage) - { - return getActionLink(null,targetPage); - } - - // Get the action given a sessionId and a relative targetPage URL. - public static final String getActionLink(String sessionId,String targetPage) - { - StringBuffer actionLink = new StringBuffer("forms/ProxyLoadPage.jsp?"); - if (sessionId != null) - actionLink.append(ActionInputs.SESSIONID).append('=').append(sessionId).append('&'); - actionLink.append(ActionInputs.TARGET_PAGE).append('=').append(targetPage); - return actionLink.toString(); - } - - public boolean populatePropertyTable(HttpServletRequest request) - { - return true; - } - - public boolean run() - { - return true; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ResizeFramesAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ResizeFramesAction.java deleted file mode 100644 index 677050e82..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ResizeFramesAction.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.util.HTMLUtils; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; - -public abstract class ResizeFramesAction extends Action -{ - protected Controller controller_; - protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException - { - String frameName = parser.getParameter(ActionInputs.FRAME_NAME); - if (frameName != null) - propertyTable_.put(ActionInputs.FRAME_NAME,frameName); - else - return false; - return processOthers(parser); - } - - protected abstract boolean processOthers(MultipartFormDataParser parser) throws MultipartFormDataException; - - public ResizeFramesAction(Controller controller) - { - controller_ = controller; - } - - public final boolean populatePropertyTable(HttpServletRequest request) - { - try - { - MultipartFormDataParser parser = new MultipartFormDataParser(); - parser.parseRequest(request,HTMLUtils.UTF8_ENCODING); - boolean result = processParsedResults(parser); - return result; - } - catch (MultipartFormDataException e) - { - } - return false; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/RetrieveHistoryAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/RetrieveHistoryAction.java deleted file mode 100644 index 9d9d22c0e..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/RetrieveHistoryAction.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.BreadCrumb; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; - -public class RetrieveHistoryAction extends LinkAction -{ - private BreadCrumb breadCrumb_; - - public RetrieveHistoryAction(Controller controller) - { - super(controller); - breadCrumb_ = null; - } - - // actions/RetrieveHistoryAction.jsp?jump=1 - forward (ActionInputs.JUMP_FORWARD) - // actions/RetrieveHistoryAction.jsp?jump=-1 - backward (ActionInputs.JUMP_BACK) - public final static String getActionLink(int jump) - { - StringBuffer actionLink = new StringBuffer("actions/RetrieveHistoryActionJSP.jsp?"); - actionLink.append(ActionInputs.JUMP).append('=').append(jump); - return actionLink.toString(); - } - - protected final boolean processLinkParameters(HttpServletRequest request) - { - String jumpString = request.getParameter(ActionInputs.JUMP); - // Perform data validation. - try - { - Integer.parseInt(jumpString); - } - catch (NumberFormatException e) - { - // Validation failed! - return false; - } - propertyTable_.put(ActionInputs.JUMP,jumpString); - return true; - } - - public final boolean run() - { - int jump = Integer.parseInt((String)propertyTable_.get(ActionInputs.JUMP)); - switch (jump) - { - case ActionInputs.JUMP_FORWARD: - breadCrumb_ = controller_.forward(); - return true; - case ActionInputs.JUMP_BACK: - breadCrumb_ = controller_.back(); - return true; - } - return false; - } - - public final BreadCrumb getBreadCrumb() - { - return breadCrumb_; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/SelectNodeAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/SelectNodeAction.java deleted file mode 100644 index 3238e88e8..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/SelectNodeAction.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.actions; - -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer; -import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.NodeSelectionTransformer; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -public abstract class SelectNodeAction extends NodeAction -{ - protected Node selectedNode_; - - public SelectNodeAction(Controller controller,NodeManager nodeManager) - { - super(controller,nodeManager); - selectedNode_ = null; - } - - public final void performBaseAction(int nodeId) - { - setSelectedNodeId(nodeId); - selectedNode_ = nodeManager_.getSelectedNode(); - } - - public void performExtendedAction() - { - //the extended classes can interject here - } - - public boolean run() - { - int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); - if (!isStaleNode(nodeId)) - { - // Ensure that the node is visible. - makeNodeVisible(nodeManager_.getNode(nodeId)); - performBaseAction(nodeId); - performExtendedAction(); - addToHistory(getPerspectiveId(),getActionLinkForHistory()); - return true; - } - setStaleBreadCrumb(); - return false; - } - - public final Node getSelectedNode() - { - return selectedNode_; - } - - public ITransformer[] getTransformers() - { - return new ITransformer[] {new NodeSelectionTransformer(controller_)}; - } - - // Selecting a node changes the treeview content and the properties container. - public abstract String getTreeContentVar(); - public abstract String getTreeContentPage(); - public abstract String getPropertiesContainerVar(); - public abstract String getPropertiesContainerPage(); - public abstract int getPerspectiveId(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/SelectNodeToolAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/SelectNodeToolAction.java deleted file mode 100644 index cf6ffe89f..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/SelectNodeToolAction.java +++ /dev/null @@ -1,163 +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.wst.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.CurrentNodeSelectionTransformer; -import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Tool; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.ToolManager; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.ViewTool; - -public abstract class SelectNodeToolAction extends SelectNodeAction -{ - protected NodeManager nodeManager_; - protected Tool selectedTool_; - - public SelectNodeToolAction(Controller controller,NodeManager nodeManager) - { - super(controller,nodeManager); - nodeManager_ = nodeManager; - selectedTool_ = null; - } - - public final NodeManager getNodeManager() - { - return nodeManager_; - } - - // ...jsp?nodeId=...&toolId=...<&viewId=...&viewToolId=...><&isHistory=1> - protected boolean processLinkParameters(HttpServletRequest request) - { - boolean result = super.processLinkParameters(request); - String toolIdString = request.getParameter(ActionInputs.TOOLID); - String viewIdString = request.getParameter(ActionInputs.VIEWID); - String viewToolIdString = request.getParameter(ActionInputs.VIEWTOOLID); - - // Perform data validation. - try - { - Integer.parseInt(toolIdString); - } - catch (NumberFormatException e) - { - // Validation failed. - return false; - } - propertyTable_.put(ActionInputs.TOOLID,toolIdString); - - // Optional properties - try - { - int viewId = Integer.parseInt(viewIdString); - propertyTable_.put(ActionInputs.VIEWID,viewIdString); - if (viewId != ActionInputs.VIEWID_DEFAULT) - { - Integer.parseInt(viewToolIdString); - propertyTable_.put(ActionInputs.VIEWTOOLID,viewToolIdString); - } - } - catch (NumberFormatException e) - { - } - return result; - } - - public boolean run() - { - int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); - if (!isStaleNode(nodeId)) - { - // Ensure that the node is visible. - makeNodeVisible(nodeManager_.getNode(nodeId)); - setSelectedNodeId(nodeId); - selectedNode_ = nodeManager_.getSelectedNode(); - int toolId = Integer.parseInt((String)propertyTable_.get(ActionInputs.TOOLID)); - ToolManager toolManager = selectedNode_.getToolManager(); - toolManager.setSelectedToolId(toolId); - selectedTool_ = toolManager.getSelectedTool(); - String viewIdString = ((String)propertyTable_.get(ActionInputs.VIEWID)); - if (viewIdString != null) - { - int viewId = Integer.parseInt(viewIdString); - setSelectedViewId(viewId); - if (viewId != ActionInputs.VIEWID_DEFAULT) - { - String viewToolIdString = ((String)propertyTable_.get(ActionInputs.VIEWTOOLID)); - ViewTool viewTool = (ViewTool)selectedTool_; - if (viewToolIdString != null) - { - int viewToolId = Integer.parseInt(viewToolIdString); - ToolManager viewToolManager = selectedNode_.getViewToolManager(); - if (viewToolManager == null) - { - if (!isHistoryAction()) - { - viewToolManager = viewTool.createToolManager(viewId); - viewToolId = viewToolManager.getSelectedToolId(); - } - else - { - setStaleBreadCrumb(); - return false; - } - } - viewToolManager.setSelectedToolId(viewToolId); - } - } - } - else - setSelectedViewId(ActionInputs.VIEWID_DEFAULT); - addToHistory(getPerspectiveId(),getActionLinkForHistory()); - return true; - } - setStaleBreadCrumb(); - return false; - } - - public ITransformer[] getTransformers() - { - return new ITransformer[] {new CurrentNodeSelectionTransformer(controller_)}; - } - - public final Tool getSelectedViewTool() - { - if (propertyTable_.get(ActionInputs.VIEWID) != null) - return selectedNode_.getViewToolManager().getSelectedTool(); - return null; - } - - public final Tool getSelectedTool() - { - return selectedTool_; - } - - // Selecting a node tool updates the properties content. Also, in the event - // of a history switch, nodes may need to be selected resulting in changes to - // both the treeview content and the properties container. These requirements are - // covered through the base class. - public abstract String getPropertiesContentVar(); - public abstract String getPropertiesContentPage(); - public String getStatusContentVar() - { - return null; - } - - public String getStatusContentPage() - { - return null; - } - - public abstract int getPerspectiveId(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ShowPerspectiveAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ShowPerspectiveAction.java deleted file mode 100644 index da74fa08f..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ShowPerspectiveAction.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.util.HTMLUtils; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; -import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; - -public class ShowPerspectiveAction extends LinkAction -{ - public ShowPerspectiveAction(Controller controller) - { - super(controller); - } - - // actions/show_perspective.jsp?perspective=0<&isHistory=1> - UDDI (ActionInputs.PERSPECTIVE_UDDI) - // actions/show_perspective.jsp?perspective=1<&isHistory=1> - WSIL (ActionInputs.PERSPECTIVE_WSIL) - // actions/show_perspective.jsp?perspective=2<&isHistory=1> - WSDL (ActionInputs.PERSPECTIVE_WSDL) - // actions/show_perspective.jsp?perspective=3<&isHistory=1> - Favorites (ActionInputs.PERSPECTIVE_FAVORITES) - public final static String getActionLink(int newPerspective,boolean forHistory) - { - StringBuffer actionLink = new StringBuffer("actions/ShowPerspectiveActionJSP.jsp?"); - actionLink.append(ActionInputs.PERSPECTIVE).append('=').append(newPerspective); - if (forHistory) - actionLink.append('&').append(ActionInputs.ISHISTORY).append("=1"); - return actionLink.toString(); - } - - protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException - { - return true; - } - - protected final boolean processLinkParameters(HttpServletRequest request) - { - boolean result = false; - String perspectiveString = request.getParameter(ActionInputs.PERSPECTIVE); - // Perform data validation. - try - { - Integer.parseInt(perspectiveString); - propertyTable_.put(ActionInputs.PERSPECTIVE,perspectiveString); - MultipartFormDataParser parser = new MultipartFormDataParser(); - parser.parseRequest(request,HTMLUtils.UTF8_ENCODING); - result = processParsedResults(parser); - removedProperties_.removeAllElements(); - } - catch (NumberFormatException e) - { - // Validation failed! - This should not happen. - } - catch (MultipartFormDataException e) - { - } - return result; - } - - public boolean run() - { - int perspective = Integer.parseInt((String)propertyTable_.get(ActionInputs.PERSPECTIVE)); - controller_.setCurrentPerspective(perspective); - addToHistory(perspective,getActionLink(perspective,true)); - return true; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ToggleNodeAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ToggleNodeAction.java deleted file mode 100644 index 2c05b4040..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ToggleNodeAction.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.ws.internal.explorer.platform.actions; - -import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs; -import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer; -import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.NodeIdTransformer; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node; -import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; - -public abstract class ToggleNodeAction extends NodeAction -{ - protected Node toggledNode_; - public ToggleNodeAction(Controller controller,NodeManager nodeManager) - { - super(controller,nodeManager); - toggledNode_ = null; - } - - // Toggle the current node and update the selection iff the currently selected - // is a related descendant of a collapsed node. - /** - * Toggle the current node and update the selection iff the currently selected - * node is a related descendant of the current node and the current node is - * now collapsed as a result of this action. - * - * @param int The node ID of the node for which this action applies to. - * @return boolean Indicator of whether or not a selection change was necessary. - */ - public final boolean performBaseAction(int nodeId) - { - toggledNode_ = nodeManager_.getNode(nodeId); - nodeManager_.setFocusedNodeId(nodeId); - toggledNode_.setVisibilityOfChildren(!toggledNode_.isOpen()); - Node selectedNode = nodeManager_.getSelectedNode(); - if (selectedNode != null) - { - if (!selectedNode.isVisible()) - { - setSelectedNodeId(nodeId); - return true; - } - } - return false; - } - - public boolean run() - { - int nodeId = Integer.parseInt((String)propertyTable_.get(ActionInputs.NODEID)); - if (!isStaleNode(nodeId)) - { - if (performBaseAction(nodeId)) - { - // Save the selection of the toggle link in the history. - addToHistory(getPerspectiveId(),getActionLinkForHistory()); - } - // Do not save the toggle in history. - return true; - } - setStaleBreadCrumb(); - return false; - } - - public final Node getToggledNode() - { - return toggledNode_; - } - - public ITransformer[] getTransformers() - { - return new ITransformer[] {new NodeIdTransformer(controller_)}; - } - - public abstract String getTreeContentVar(); - public abstract String getTreeContentPage(); - public abstract String getPropertiesContainerVar(); - public abstract String getPropertiesContainerPage(); - public abstract int getPerspectiveId(); -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ValidateEditAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ValidateEditAction.java deleted file mode 100644 index 0094f549c..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/ValidateEditAction.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; - -public class ValidateEditAction extends Action -{ - public static final String getActionLink() - { - return "actions/ValidateEditActionJSP.jsp"; - } - - public boolean populatePropertyTable(HttpServletRequest request) - { - return true; - } - - public boolean run() - { - return true; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/WSDLFileNameHelper.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/WSDLFileNameHelper.java deleted file mode 100644 index 3624f2548..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/WSDLFileNameHelper.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -public class WSDLFileNameHelper -{ - private static final String default_ = "temp.wsdl"; - - /** - * Given a wsdl path (file, URL etc.), guess at the file name by looking for the .wsdl extension at the end of the - * path and the file that it belongs to. If this is not possible, return the default defined in this class. - * @param String The path (file, URL etc.) of this WSDL file. - * @return String The WSDL file name determined by this routine. - */ - public static final String getWSDLFileName(String wsdlPathname) - { - if (wsdlPathname != null) - { - if (wsdlPathname.endsWith(".wsdl")) - { - int lastSeparatorPos = Math.max(wsdlPathname.lastIndexOf("/"),wsdlPathname.lastIndexOf("\\")); - if (lastSeparatorPos > 0) - return wsdlPathname.substring(lastSeparatorPos+1,wsdlPathname.length()); - } - } - return default_; - } -} diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/WriteWSDLToWorkbenchAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/WriteWSDLToWorkbenchAction.java deleted file mode 100644 index 91369b203..000000000 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/actions/WriteWSDLToWorkbenchAction.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 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.ws.internal.explorer.platform.actions; - -import javax.servlet.http.HttpServletRequest; - -public class WriteWSDLToWorkbenchAction extends Action -{ - public static final String getActionLink() - { - return "actions/WriteWSDLToWorkbenchActionJSP.jsp"; - } - - public boolean populatePropertyTable(HttpServletRequest request) - { - return true; - } - - public boolean run() - { - return true; - } -} |