Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine')
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/ActionDataParser.java229
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/ActionEngine.java233
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/constants/ActionDataConstants.java30
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/ActionDescriptor.java92
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/ScenarioDescriptor.java26
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/TransactionDescriptor.java26
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/CurrentNodeSelectionTransformer.java46
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/ITransformer.java19
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/MassNodeIdTransformer.java104
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/MultipartFormDataParserTransformer.java76
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/NodeIdTransformer.java134
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/NodeSelectionTransformer.java163
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/ViewSelectionTransformer.java121
13 files changed, 0 insertions, 1299 deletions
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/ActionDataParser.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/ActionDataParser.java
deleted file mode 100644
index c613f0dd7..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/ActionDataParser.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine;
-
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.wst.ws.internal.explorer.platform.engine.constants.ActionDataConstants;
-import org.eclipse.wst.ws.internal.explorer.platform.engine.data.ActionDescriptor;
-import org.eclipse.wst.ws.internal.explorer.platform.engine.data.ScenarioDescriptor;
-import org.eclipse.wst.ws.internal.explorer.platform.engine.data.TransactionDescriptor;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class ActionDataParser
-{
- private Document doc;
-
- public ScenarioDescriptor parseScenario(Element e)
- {
- ScenarioDescriptor scenarioDescriptor = new ScenarioDescriptor();
- NodeList transactions = e.getElementsByTagName(ActionDataConstants.ELEMENT_TRANSACTION);
- TransactionDescriptor[] transactionDescriptors = new TransactionDescriptor[transactions.getLength()];
- for (int i = 0; i < transactionDescriptors.length; i++)
- transactionDescriptors[i] = parseTransaction((Element) transactions.item(i));
- scenarioDescriptor.setTransactionDescriptors(transactionDescriptors);
- return scenarioDescriptor;
- }
-
- public TransactionDescriptor parseTransaction(Element e)
- {
- TransactionDescriptor transactionDescriptor = new TransactionDescriptor();
- NodeList actions = e.getElementsByTagName(ActionDataConstants.ELEMENT_ACTION);
- ActionDescriptor[] actionDescriptors = new ActionDescriptor[actions.getLength()];
- for (int i = 0; i < actionDescriptors.length; i++)
- actionDescriptors[i] = parseAction((Element) actions.item(i));
- transactionDescriptor.setActionDescriptors(actionDescriptors);
- return transactionDescriptor;
- }
-
- public ActionDescriptor parseAction(Element e)
- {
- ActionDescriptor actionDescriptor = new ActionDescriptor();
- actionDescriptor.setId(e.getAttribute(ActionDataConstants.ATTR_ID));
- try
- {
- actionDescriptor.setAttempts(Integer.parseInt(e.getAttribute(ActionDataConstants.ATTR_ATTEMPTS)));
- }
- catch (Throwable t)
- {
- actionDescriptor.setAttempts(1);
- }
- actionDescriptor.setStatusId(e.getAttribute(ActionDataConstants.ATTR_STATUS_ID));
- Hashtable propertiesTable = new Hashtable();
- NodeList properties = e.getElementsByTagName(ActionDataConstants.ELEMENT_PROPERTY);
- for (int i = 0; i < properties.getLength(); i++)
- {
- Element property = (Element) properties.item(i);
- String name = property.getAttribute(ActionDataConstants.ATTR_NAME);
- NodeList valueList = property.getElementsByTagName(ActionDataConstants.ELEMENT_VALUE);
- if (valueList.getLength() > 1)
- {
- String[] values = new String[valueList.getLength()];
- for (int j = 0; j < values.length; j++)
- {
- Element value = (Element) valueList.item(j);
- Node textNode = value.getFirstChild();
- values[j] = (textNode != null) ? textNode.getNodeValue().trim() : "";
- }
- propertiesTable.put(name, values);
- }
- else
- {
- Node textNode = ((Element) valueList.item(0)).getFirstChild();
- propertiesTable.put(name, (textNode != null) ? textNode.getNodeValue().trim() : "");
- }
- }
- actionDescriptor.setProperties(propertiesTable);
- NodeList statusList = e.getElementsByTagName(ActionDataConstants.ELEMENT_STATUS);
- for (int i = 0; i < statusList.getLength(); i++)
- {
- Element status = (Element)statusList.item(i);
- CDATASection cData = (CDATASection)status.getFirstChild();
- actionDescriptor.addStatus(cData.getData());
- }
- return actionDescriptor;
- }
-
- public Element toElement(ScenarioDescriptor scenarioDescriptor)
- {
- try
- {
- Document document = getDocument();
- Element scenarioElement = document.createElement(ActionDataConstants.ELEMENT_SCENARIO);
- TransactionDescriptor[] transactionDescriptors = scenarioDescriptor.getTransactionDescriptors();
- for (int i = 0; i < transactionDescriptors.length; i++)
- {
- Element transactionElement = toElement(transactionDescriptors[i]);
- if (transactionElement != null)
- scenarioElement.appendChild(transactionElement);
- }
- return scenarioElement;
- }
- catch (DOMException dome)
- {
- return null;
- }
- }
-
- public Element toElement(TransactionDescriptor transactionDescriptor)
- {
- try
- {
- Document document = getDocument();
- Element transactionElement = document.createElement(ActionDataConstants.ELEMENT_TRANSACTION);
- ActionDescriptor[] actionDescriptors = transactionDescriptor.getActionDescriptors();
- for (int i = 0; i < actionDescriptors.length; i++)
- {
- Element actionElement = toElement(actionDescriptors[i]);
- if (actionElement != null)
- transactionElement.appendChild(actionElement);
- }
- return transactionElement;
- }
- catch (DOMException dome)
- {
- return null;
- }
- }
-
- public Element toElement(ActionDescriptor actionDescriptor)
- {
- try
- {
- Document document = getDocument();
- Element actionElement = document.createElement(ActionDataConstants.ELEMENT_ACTION);
- actionElement.setAttribute(ActionDataConstants.ATTR_ID, actionDescriptor.getId());
- actionElement.setAttribute(ActionDataConstants.ATTR_ATTEMPTS, String.valueOf(actionDescriptor.getAttempts()));
- String statusId = actionDescriptor.getStatusId();
- if (statusId != null)
- actionElement.setAttribute(ActionDataConstants.ATTR_STATUS_ID, statusId);
- Hashtable properties = actionDescriptor.getProperties();
- if (properties != null)
- {
- for (Iterator it = properties.keySet().iterator(); it.hasNext();)
- {
- Object key = it.next();
- Object value = properties.get(key);
- Object[] values;
- if (value.getClass().isArray())
- values = (Object[])value;
- else if (value instanceof List)
- values = ((List)value).toArray();
- else
- values = new Object[] {value};
- boolean isAdded = false;
- Element propertyElement = document.createElement(ActionDataConstants.ELEMENT_PROPERTY);
- propertyElement.setAttribute(ActionDataConstants.ATTR_NAME, key.toString());
- for (int i = 0; i < values.length; i++)
- {
- if (values[i] instanceof String)
- {
- Element valueElement = document.createElement(ActionDataConstants.ELEMENT_VALUE);
- valueElement.appendChild(document.createTextNode(values[i].toString()));
- propertyElement.appendChild(valueElement);
- isAdded = true;
- }
- }
- if (isAdded)
- actionElement.appendChild(propertyElement);
- }
- }
- List status = actionDescriptor.getStatus();
- if (status != null)
- {
- for (Iterator it = status.iterator(); it.hasNext();)
- {
- Element statusElement = document.createElement(ActionDataConstants.ELEMENT_STATUS);
- CDATASection cData = document.createCDATASection(it.next().toString());
- statusElement.appendChild(cData);
- actionElement.appendChild(statusElement);
- }
- }
- return actionElement;
- }
- catch (DOMException dome)
- {
- return null;
- }
- }
-
- private Document getDocument()
- {
- try
- {
- if (doc == null)
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- doc = builder.newDocument();
- }
- return doc;
- }
- catch (FactoryConfigurationError fce)
- {
- return null;
- }
- catch (ParserConfigurationException pce)
- {
- return null;
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/ActionEngine.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/ActionEngine.java
deleted file mode 100644
index f7ae8573f..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/ActionEngine.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-import java.util.Vector;
-import org.eclipse.wst.ws.internal.explorer.platform.actions.Action;
-import org.eclipse.wst.ws.internal.explorer.platform.actions.ShowPerspectiveAction;
-import org.eclipse.wst.ws.internal.explorer.platform.constants.ActionInputs;
-import org.eclipse.wst.ws.internal.explorer.platform.engine.constants.ActionDataConstants;
-import org.eclipse.wst.ws.internal.explorer.platform.engine.data.ActionDescriptor;
-import org.eclipse.wst.ws.internal.explorer.platform.engine.data.ScenarioDescriptor;
-import org.eclipse.wst.ws.internal.explorer.platform.engine.data.TransactionDescriptor;
-import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer;
-import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller;
-
-public class ActionEngine
-{
- public static final byte MODE_DISABLED = 0x0;
- public static final byte MODE_STOP = 0x1;
- public static final byte MODE_RECORD = 0x2;
- public static final byte MODE_PLAY = 0x3;
-
- private Controller controller;
- private byte mode;
- private Vector actionDescriptors;
-
- public ActionEngine(Controller controller)
- {
- this.controller = controller;
- mode = MODE_DISABLED;
- actionDescriptors = new Vector();
- }
-
- public void executeScenario(ScenarioDescriptor scenarioDescriptor)
- {
- TransactionDescriptor[] transactionDescriptors = scenarioDescriptor.getTransactionDescriptors();
- for (int i = 0; i < transactionDescriptors.length; i++)
- executeTransaction(transactionDescriptors[i]);
- }
-
- public boolean executeTransaction(TransactionDescriptor transactionDescriptor)
- {
- boolean result = true;
- ActionDescriptor[] actionDescriptors = transactionDescriptor.getActionDescriptors();
- for (int i = 0; i < actionDescriptors.length; i++)
- {
- if (result)
- {
- if (!executeAction(actionDescriptors[i]))
- result = false;
- }
- else
- actionDescriptors[i].setStatusId(ActionDataConstants.VALUE_STATUS_ID_UNATTEMPTED);
- }
- return result;
- }
-
- public boolean executeAction(ActionDescriptor actionDescriptor)
- {
- int attempts = actionDescriptor.getAttempts();
- for (int i = 0; i < attempts; i++)
- {
- try
- {
- Class classAction = Class.forName(actionDescriptor.getId());
- if (Action.class.isAssignableFrom(classAction))
- {
- Action action = (Action) newInstance(classAction);
- if (action != null)
- {
- Hashtable properties = actionDescriptor.getProperties();
- ITransformer[] transformers = action.getTransformers();
- for (int j = 0; j < transformers.length; j++)
- properties = transformers[j].deNormalize(properties);
- action.setPropertyTable(properties);
- boolean actionResult = action.run();
- // TODO actionDescriptor.addStatus(action.getStatus());
- if (actionResult)
- {
- actionDescriptor.setStatusId(ActionDataConstants.VALUE_STATUS_ID_PASSED);
- return true;
- }
- }
- else
- throw new ClassNotFoundException(actionDescriptor.getId());
- }
- }
- catch (ClassNotFoundException cnfe)
- {
- cnfe.printStackTrace();
- StringWriter sw = new StringWriter();
- cnfe.printStackTrace(new PrintWriter(sw));
- actionDescriptor.addStatus(sw.getBuffer().toString());
- }
- catch (Throwable t)
- {
- t.printStackTrace();
- StringWriter sw = new StringWriter();
- t.printStackTrace(new PrintWriter(sw));
- actionDescriptor.addStatus(sw.getBuffer().toString());
- }
- }
- actionDescriptor.setStatusId(ActionDataConstants.VALUE_STATUS_ID_FAILED);
- return false;
- }
-
- private ScenarioDescriptor newScenarioDescriptor()
- {
- return new ScenarioDescriptor();
- }
-
- private TransactionDescriptor newTransactionDescriptor()
- {
- return new TransactionDescriptor();
- }
-
- private ActionDescriptor newActionDescriptor(Action action)
- {
- ActionDescriptor actionDescriptor = new ActionDescriptor();
- actionDescriptor.setId(action.getClass().getName());
- Hashtable properties = new Hashtable(action.getPropertyTable());
- ITransformer[] transformers = action.getTransformers();
- for (int i = 0; i < transformers.length; i++)
- properties = transformers[i].normalize(properties);
- actionDescriptor.setProperties(properties);
- return actionDescriptor;
- }
-
- private Object newInstance(Class c)
- {
- try
- {
- // instantiates the action using the constructor that takes in a
- // controller object
- Constructor constructor = c.getConstructor(new Class[]{Controller.class});
- return constructor.newInstance(new Object[]{controller});
- }
- catch (NoSuchMethodException nsme)
- {
- }
- catch (InstantiationException ie)
- {
- }
- catch (IllegalAccessException iae)
- {
- }
- catch (InvocationTargetException ite)
- {
- }
- catch (Throwable t)
- {
- }
- Object instance = null;
- try
- {
- // instantiates the action using the default constructor
- Constructor constructor = c.getConstructor(new Class[0]);
- instance = constructor.newInstance(new Object[0]);
- Method method = c.getMethod("setController", new Class[]{Controller.class});
- method.invoke(instance, new Object[]{controller});
- }
- catch (NoSuchMethodException nsme)
- {
- }
- catch (InstantiationException ie)
- {
- }
- catch (IllegalAccessException iae)
- {
- }
- catch (IllegalArgumentException iae)
- {
- }
- catch (InvocationTargetException ite)
- {
- }
- catch (Throwable t)
- {
- }
- return instance;
- }
-
- public byte getMode()
- {
- return mode;
- }
-
- public void setMode(byte mode)
- {
- this.mode = mode;
- if (mode == MODE_RECORD)
- {
- actionDescriptors = new Vector();
- ShowPerspectiveAction showPerspectiveAction = new ShowPerspectiveAction(controller);
- showPerspectiveAction.addProperty(ActionInputs.PERSPECTIVE, String.valueOf(controller.getCurrentPerspective().getPerspectiveId()));
- actionDescriptors.add(newActionDescriptor(showPerspectiveAction));
- }
- }
-
- public boolean executeAction(Action action)
- {
- if (mode == MODE_RECORD)
- {
- ActionDescriptor actionDescriptor = newActionDescriptor(action);
- actionDescriptors.add(actionDescriptor);
- }
- return action.run();
- }
-
- public ScenarioDescriptor getScenario()
- {
- ScenarioDescriptor scenarioDescriptor = newScenarioDescriptor();
- TransactionDescriptor transactionDescriptor = newTransactionDescriptor();
- ActionDescriptor[] actionDescriptorArray = (ActionDescriptor[])actionDescriptors.toArray(new ActionDescriptor[0]);
- transactionDescriptor.setActionDescriptors(actionDescriptorArray);
- scenarioDescriptor.setTransactionDescriptors(new TransactionDescriptor[] {transactionDescriptor});
- return scenarioDescriptor;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/constants/ActionDataConstants.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/constants/ActionDataConstants.java
deleted file mode 100644
index 7d53ee26b..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/constants/ActionDataConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.constants;
-
-public class ActionDataConstants
-{
- public static final String ATTR_ID = "id";
- public static final String ATTR_NAME = "name";
- public static final String ATTR_ATTEMPTS = "attempts";
- public static final String ATTR_STATUS_ID = "statusId";
-
- public static final String ELEMENT_SCENARIO = "scenario";
- public static final String ELEMENT_TRANSACTION = "transaction";
- public static final String ELEMENT_ACTION = "action";
- public static final String ELEMENT_PROPERTY = "property";
- public static final String ELEMENT_VALUE = "value";
- public static final String ELEMENT_STATUS = "status";
-
- public static final String VALUE_STATUS_ID_UNATTEMPTED = "unattempted";
- public static final String VALUE_STATUS_ID_PASSED = "passed";
- public static final String VALUE_STATUS_ID_FAILED = "failed";
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/ActionDescriptor.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/ActionDescriptor.java
deleted file mode 100644
index 85bb5b7da..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/ActionDescriptor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.data;
-
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Vector;
-
-public class ActionDescriptor
-{
- private String id;
- private Hashtable properties;
- private int attempts;
- private String statusId;
- private List statusList;
-
- public ActionDescriptor()
- {
- attempts = 1;
- }
-
- public String getId()
- {
- return id;
- }
-
- public void setId(String id)
- {
- this.id = id;
- }
-
- public Hashtable getProperties()
- {
- return properties;
- }
-
- public void setProperties(Hashtable properties)
- {
- this.properties = properties;
- }
-
- public int getAttempts()
- {
- return attempts;
- }
-
- public void setAttempts(int attempts)
- {
- this.attempts = attempts;
- }
-
- public String getStatusId()
- {
- return statusId;
- }
-
- public void setStatusId(String statusId)
- {
- this.statusId = statusId;
- }
-
- public void addStatus(Object status)
- {
- if (status != null)
- {
- if (statusList == null)
- statusList = new Vector();
- statusList.add(status);
- }
- }
-
- public boolean removeStatus(Object status)
- {
- if (status != null && statusList != null)
- return statusList.remove(status);
- else
- return false;
- }
-
- public List getStatus()
- {
- return statusList;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/ScenarioDescriptor.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/ScenarioDescriptor.java
deleted file mode 100644
index 41a3f90fe..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/ScenarioDescriptor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.data;
-
-public class ScenarioDescriptor
-{
- private TransactionDescriptor[] transactionDescriptors;
-
- public TransactionDescriptor[] getTransactionDescriptors()
- {
- return transactionDescriptors;
- }
-
- public void setTransactionDescriptors(TransactionDescriptor[] transactionDescriptors)
- {
- this.transactionDescriptors = transactionDescriptors;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/TransactionDescriptor.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/TransactionDescriptor.java
deleted file mode 100644
index 3ef67b972..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/data/TransactionDescriptor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.data;
-
-public class TransactionDescriptor
-{
- private ActionDescriptor[] actionDescriptors;
-
- public ActionDescriptor[] getActionDescriptors()
- {
- return actionDescriptors;
- }
-
- public void setActionDescriptors(ActionDescriptor[] actionDescriptors)
- {
- this.actionDescriptors = actionDescriptors;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/CurrentNodeSelectionTransformer.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/CurrentNodeSelectionTransformer.java
deleted file mode 100644
index 48a0b2768..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/CurrentNodeSelectionTransformer.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.transformer;
-
-import java.util.Hashtable;
-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;
-
-public class CurrentNodeSelectionTransformer implements ITransformer
-{
- protected Controller controller;
- protected String key;
-
- public CurrentNodeSelectionTransformer(Controller controller)
- {
- this(controller, ActionInputs.NODEID);
- }
-
- public CurrentNodeSelectionTransformer(Controller controller, String key)
- {
- this.controller = controller;
- this.key = key;
- }
-
- public Hashtable normalize(Hashtable properties)
- {
- return properties;
- }
-
- public Hashtable deNormalize(Hashtable properties)
- {
- Node currNode = controller.getCurrentPerspective().getNodeManager().getSelectedNode();
- if (currNode != null)
- properties.put(key, String.valueOf(currNode.getNodeId()));
- return properties;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/ITransformer.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/ITransformer.java
deleted file mode 100644
index 4755ffe85..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/ITransformer.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.transformer;
-
-import java.util.Hashtable;
-
-public interface ITransformer
-{
- public Hashtable normalize(Hashtable properties);
- public Hashtable deNormalize(Hashtable properties);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/MassNodeIdTransformer.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/MassNodeIdTransformer.java
deleted file mode 100644
index 521869289..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/MassNodeIdTransformer.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.transformer;
-
-import java.util.Hashtable;
-import java.util.Vector;
-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.perspective.Controller;
-
-public class MassNodeIdTransformer extends NodeIdTransformer
-{
- protected String massNodeIdKey;
-
- public MassNodeIdTransformer(Controller controller, String massNodeIdKey)
- {
- super(controller);
- this.massNodeIdKey = massNodeIdKey;
- }
-
- public Hashtable normalize(Hashtable properties)
- {
- if (!properties.containsKey(massNodeIdKey))
- return super.normalize(properties);
- Object origNodeId = properties.get(ActionInputs.NODEID);
- String[] massNodeIds = getValueAsStringArray(properties, massNodeIdKey);
- for (int i = 0; i < massNodeIds.length; i++)
- {
- properties.put(ActionInputs.NODEID, massNodeIds[i]);
- properties = super.normalize(properties);
- String[] rels = getValueAsStringArray(properties, ModelConstants.REL_ID);
- if (rels.length > 0)
- {
- StringBuffer sb = new StringBuffer(ModelConstants.REL_ID);
- sb.append(ModelConstants.REL_LOCALNAME_SEPARATOR);
- sb.append(massNodeIds[i]);
- properties.put(sb.toString(), rels);
- }
- properties.remove(ActionInputs.NODEID);
- properties.remove(ModelConstants.REL_ID);
- }
- if (origNodeId != null)
- properties.put(ActionInputs.NODEID, origNodeId);
- return properties;
- }
-
- public Hashtable deNormalize(Hashtable properties)
- {
- if (!properties.containsKey(massNodeIdKey))
- return super.deNormalize(properties);
- Vector massNodeIdVector = new Vector();
- Object origNodeId = properties.get(ActionInputs.NODEID);
- properties.remove(ActionInputs.NODEID);
- String[] massNodeIds = getValueAsStringArray(properties, massNodeIdKey);
- for (int i = 0; i < massNodeIds.length; i++)
- {
- StringBuffer sb = new StringBuffer(ModelConstants.REL_ID);
- sb.append(ModelConstants.REL_LOCALNAME_SEPARATOR);
- sb.append(massNodeIds[i]);
- Object rels = properties.get(sb.toString());
- if (rels != null)
- {
- properties.put(ModelConstants.REL_ID, rels);
- properties = super.deNormalize(properties);
- Object nodeId = properties.get(ActionInputs.NODEID);
- if (nodeId != null)
- {
- massNodeIdVector.add(nodeId);
- properties.remove(ActionInputs.NODEID);
- }
- properties.remove(ModelConstants.REL_ID);
- }
- }
- if (origNodeId != null)
- properties.put(ActionInputs.NODEID, origNodeId);
- int size = massNodeIdVector.size();
- if (size == 1)
- properties.put(massNodeIdKey, massNodeIdVector.get(0));
- else if (size > 1)
- properties.put(massNodeIdKey, massNodeIdVector.toArray(new String[0]));
- else
- properties.remove(massNodeIdKey);
- return properties;
- }
-
- private String[] getValueAsStringArray(Hashtable properties, String key)
- {
- Object values = properties.get(key);
- if (values == null)
- return new String[0];
- else if (values instanceof String[])
- return (String[])values;
- else
- return new String[] {values.toString()};
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/MultipartFormDataParserTransformer.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/MultipartFormDataParserTransformer.java
deleted file mode 100644
index 182f3e88d..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/MultipartFormDataParserTransformer.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.transformer;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-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.MultipartFormDataParser;
-
-public class MultipartFormDataParserTransformer implements ITransformer
-{
- protected Controller controller;
-
- public MultipartFormDataParserTransformer(Controller controller)
- {
- this.controller = controller;
- }
-
- public Hashtable normalize(Hashtable properties)
- {
- MultipartFormDataParser parser = (MultipartFormDataParser)properties.get(ActionInputs.MULTIPART_FORM_DATA_PARSER);
- String[] keys;
- try
- {
- keys = parser.getParameterNames();
- }
- catch (Throwable t)
- {
- keys = new String[0];
- }
- for (int i = 0; i < keys.length; i++)
- {
- StringBuffer newKey = new StringBuffer(ActionInputs.MULTIPART_FORM_DATA_PARSER);
- newKey.append(keys[i]);
- try
- {
- properties.put(newKey.toString(), parser.getParameterValues(keys[i]));
- }
- catch (Throwable t)
- {
- }
- }
- return properties;
- }
-
- public Hashtable deNormalize(Hashtable properties)
- {
- Enumeration e = properties.keys();
- while (e.hasMoreElements())
- {
- Object key = e.nextElement();
- if (key instanceof String)
- {
- if (((String)key).startsWith(ActionInputs.MULTIPART_FORM_DATA_PARSER))
- {
- String realKey = ((String)key).substring(ActionInputs.MULTIPART_FORM_DATA_PARSER.length());
- if (!properties.containsKey(realKey))
- {
- Object value = properties.remove(key);
- properties.put(realKey, value);
- }
- }
- }
- }
- return properties;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/NodeIdTransformer.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/NodeIdTransformer.java
deleted file mode 100644
index 75657d232..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/NodeIdTransformer.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.transformer;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-import org.eclipse.wst.ws.internal.datamodel.Element;
-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.Node;
-import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager;
-
-public class NodeIdTransformer implements ITransformer
-{
- protected Controller controller;
-
- public NodeIdTransformer(Controller controller)
- {
- this.controller = controller;
- }
-
- public Hashtable normalize(Hashtable properties)
- {
- Vector rels = new Vector();
- try
- {
- int nodeId = Integer.parseInt((String)properties.get(ActionInputs.NODEID));
- NodeManager nodeManager = controller.getCurrentPerspective().getNodeManager();
- Node rootNode = nodeManager.getRootNode();
- Node node = nodeManager.getNode(nodeId);
- int depth = 0;
- if (node != null)
- depth = node.getNodeDepth();
- while (rels.size() < depth && node != null && node != rootNode)
- {
- Node parentNode = node.getParent();
- Element element = node.getTreeElement();
- Rel rel = getRel(parentNode.getTreeElement(), element);
- StringBuffer relValue = new StringBuffer(rel.getName());
- relValue.append(ModelConstants.REL_LOCALNAME_SEPARATOR);
- relValue.append(element.getName());
- rels.insertElementAt(relValue.toString(), 0);
- node = parentNode;
- }
- }
- catch (NumberFormatException nfe)
- {
- }
- int numRelationships = rels.size();
- if (numRelationships == 1)
- properties.put(ModelConstants.REL_ID, rels.get(0).toString());
- else if (numRelationships > 1)
- properties.put(ModelConstants.REL_ID, (String[])rels.toArray(new String[0]));
- return properties;
- }
-
- private Rel getRel(Element sourceElement, Element targetElement)
- {
- Enumeration rels = sourceElement.getRels();
- while (rels.hasMoreElements())
- {
- Rel rel = (Rel)rels.nextElement();
- Enumeration targetElements = rel.getTargetElements();
- while (targetElements.hasMoreElements())
- {
- if (targetElements.nextElement() == targetElement)
- return rel;
- }
- }
- return null;
- }
-
- public Hashtable deNormalize(Hashtable properties)
- {
- NodeManager nodeManager = controller.getCurrentPerspective().getNodeManager();
- Node node = nodeManager.getRootNode();
- Object value = properties.get(ModelConstants.REL_ID);
- String[] relationships = null;
- if (value instanceof String[])
- relationships = (String[])value;
- else if (value != null)
- relationships = new String[] {value.toString()};
- if (relationships != null)
- {
- for (int i = 0; i < relationships.length; i++)
- {
- int index = relationships[i].indexOf(ModelConstants.REL_LOCALNAME_SEPARATOR);
- if (index == -1)
- return deNormalizeAsSelectedNode(properties);
- String rel = (index != -1) ? relationships[i].substring(0, index) : relationships[i];
- String localname = (index != -1) ? relationships[i].substring(index + 1, relationships[i].length()) : null;
- if (localname == null)
- return deNormalizeAsSelectedNode(properties);
- node = getNode(node, rel, localname);
- if (node == null)
- return deNormalizeAsSelectedNode(properties);
- }
- properties.put(ActionInputs.NODEID, String.valueOf(node.getNodeId()));
- return properties;
- }
- else
- return deNormalizeAsSelectedNode(properties);
- }
-
- private Hashtable deNormalizeAsSelectedNode(Hashtable properties)
- {
- return (new CurrentNodeSelectionTransformer(controller)).deNormalize(properties);
- }
-
- private Node getNode(Node parent, String rel, String localname)
- {
- Element parentElement = parent.getTreeElement();
- Enumeration e = parentElement.getElements(rel);
- while (e.hasMoreElements())
- {
- Element element = (Element)e.nextElement();
- if (localname.equals(element.getName()))
- return parent.getChildNode((TreeElement)element);
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/NodeSelectionTransformer.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/NodeSelectionTransformer.java
deleted file mode 100644
index 175dc03d0..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/NodeSelectionTransformer.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.transformer;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-import org.eclipse.wst.ws.internal.datamodel.Element;
-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.Node;
-import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager;
-
-public class NodeSelectionTransformer implements ITransformer
-{
- protected Controller controller;
-
- public NodeSelectionTransformer(Controller controller)
- {
- this.controller = controller;
- }
-
- public Hashtable normalize(Hashtable properties)
- {
- try
- {
- NodeManager nodeManager = controller.getCurrentPerspective().getNodeManager();
- Node nextNode = nodeManager.getNode(Integer.parseInt((String) properties.get(ActionInputs.NODEID)));
- Node currNode = nodeManager.getSelectedNode();
- if (currNode == null)
- currNode = nodeManager.getRootNode();
- Vector nextRels = new Vector();
- Vector currRels = new Vector();
- while (nextNode != null && currNode != null && (!isRootElement(nextNode.getTreeElement()) || !isRootElement(currNode.getTreeElement())) && nextNode != currNode)
- {
- if (nextNode.getNodeDepth() >= currNode.getNodeDepth())
- {
- Node parentNode = nextNode.getParent();
- Element nextElement = nextNode.getTreeElement();
- Rel rel = getRel(parentNode.getTreeElement(), nextElement);
- StringBuffer relValue = new StringBuffer(rel.getName());
- relValue.append(ModelConstants.REL_LOCALNAME_SEPARATOR);
- relValue.append(nextElement.getName());
- nextRels.insertElementAt(relValue.toString(), 0);
- nextNode = parentNode;
- }
- else
- {
- Node parentNode = currNode.getParent();
- Element parentElement = parentNode.getTreeElement();
- Rel rel = getRel(currNode.getTreeElement(), parentElement);
- StringBuffer relValue = new StringBuffer(rel.getName());
- relValue.append(ModelConstants.REL_LOCALNAME_SEPARATOR);
- relValue.append(parentElement.getName());
- currRels.add(relValue.toString());
- currNode = parentNode;
- }
- }
- currRels.addAll(nextRels);
- int numRelationships = currRels.size();
- if (numRelationships == 1)
- properties.put(ModelConstants.REL_ID, currRels.get(0).toString());
- else if (numRelationships > 1)
- properties.put(ModelConstants.REL_ID, (String[]) currRels.toArray(new String[0]));
- }
- catch (NumberFormatException nfe)
- {
- }
- return properties;
- }
-
- private boolean isRootElement(Element e)
- {
- return e.getModel().getRootElement() == e;
- }
-
- private Rel getRel(Element sourceElement, Element targetElement)
- {
- Enumeration rels = sourceElement.getRels();
- while (rels.hasMoreElements())
- {
- Rel rel = (Rel) rels.nextElement();
- Enumeration targetElements = rel.getTargetElements();
- while (targetElements.hasMoreElements())
- {
- if (targetElements.nextElement() == targetElement)
- return rel;
- }
- }
- return null;
- }
-
- public Hashtable deNormalize(Hashtable properties)
- {
- NodeManager nodeManager = controller.getCurrentPerspective().getNodeManager();
- Node rootNode = nodeManager.getRootNode();
- Node currNode = nodeManager.getSelectedNode();
- if (currNode == null)
- currNode = rootNode;
- Object value = properties.get(ModelConstants.REL_ID);
- String[] relationships = null;
- if (value instanceof String[])
- relationships = (String[]) value;
- else if (value != null)
- relationships = new String[]{value.toString()};
- if (relationships != null)
- {
- Element currElement = currNode.getTreeElement();
- for (int i = 0; i < relationships.length; i++)
- {
- int index = relationships[i].indexOf(ModelConstants.REL_LOCALNAME_SEPARATOR);
- String rel = (index != -1) ? relationships[i].substring(0, index) : relationships[i];
- String localname = (index != -1) ? relationships[i].substring(index + 1, relationships[i].length()) : null;
- Enumeration e = currElement.getElements(rel);
- Element targetElement = null;
- if (localname != null)
- {
- Element firstElement = null;
- while (e.hasMoreElements())
- {
- Element nextElement = (Element) e.nextElement();
- if (firstElement == null)
- firstElement = nextElement;
- if (localname.equals(nextElement.getName()))
- {
- targetElement = nextElement;
- break;
- }
- }
- if (targetElement == null)
- targetElement = firstElement;
- }
- else
- {
- if (e.hasMoreElements())
- targetElement = (Element) e.nextElement();
- }
- if (targetElement != null)
- {
- currElement = (Element) targetElement;
- Node parentNode = currNode.getParent();
- if (parentNode != null && parentNode.getTreeElement() == currElement)
- currNode = parentNode;
- else
- currNode = currNode.getChildNode((TreeElement) currElement);
- }
- }
- }
- properties.put(ActionInputs.NODEID, String.valueOf(currNode.getNodeId()));
- return properties;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/ViewSelectionTransformer.java b/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/ViewSelectionTransformer.java
deleted file mode 100644
index d6bd1359a..000000000
--- a/bundles/org.eclipse.wst.ws.explorer/wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/engine/transformer/ViewSelectionTransformer.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.explorer.platform.engine.transformer;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-import org.eclipse.wst.ws.internal.datamodel.Element;
-import org.eclipse.wst.ws.internal.explorer.platform.datamodel.ListElement;
-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;
-
-public class ViewSelectionTransformer implements ITransformer
-{
- protected Controller controller;
- protected String listManagerKey;
- protected String viewKey;
-
- public ViewSelectionTransformer(Controller controller, String listManagerKey, String viewKey)
- {
- this.controller = controller;
- this.listManagerKey = listManagerKey;
- this.viewKey = viewKey;
- }
-
- public Hashtable normalize(Hashtable properties)
- {
- Vector normalizedViewIds = new Vector();
- NodeManager nodeManager = controller.getCurrentPerspective().getNodeManager();
- Node currNode = nodeManager.getSelectedNode();
- TreeElement currElement = currNode.getTreeElement();
- Object listManagerObj = currElement.getPropertyAsObject(listManagerKey);
- if (listManagerObj instanceof ListManager)
- {
- ListManager listManager = (ListManager) listManagerObj;
- String[] viewIds = getViewValues(properties);
- for (int i = 0; i < viewIds.length; i++)
- {
- ListElement listElement = null;
- try
- {
- listElement = listManager.getElementWithViewId(Integer.parseInt(viewIds[i]));
- }
- catch (NumberFormatException nfe)
- {
- }
- if (listElement != null)
- {
- Object object = listElement.getObject();
- if (object != null && object instanceof Element)
- {
- Element element = (Element) object;
- normalizedViewIds.add(element.getName());
- }
- }
- }
- }
- properties.put(viewKey, normalizedViewIds.toArray(new String[0]));
- return properties;
- }
-
- public Hashtable deNormalize(Hashtable properties)
- {
- Vector viewIds = new Vector();
- Node currNode = controller.getCurrentPerspective().getNodeManager().getSelectedNode();
- if (currNode != null)
- {
- TreeElement currElement = currNode.getTreeElement();
- Object listManagerObj = currElement.getPropertyAsObject(listManagerKey);
- if (listManagerObj instanceof ListManager)
- {
- ListManager listManager = (ListManager) listManagerObj;
- String[] normalizedViewIds = getViewValues(properties);
- for (int i = 0; i < normalizedViewIds.length; i++)
- {
- Enumeration e = listManager.getListElements();
- while (e.hasMoreElements())
- {
- ListElement listElement = (ListElement) e.nextElement();
- Element element = (Element) listElement.getObject();
- if (element != null && normalizedViewIds[i].equals(element.getName()))
- {
- viewIds.add(String.valueOf(listElement.getViewId()));
- break;
- }
- }
- }
- }
- }
- int size = viewIds.size();
- if (size == 1)
- properties.put(viewKey, viewIds.get(0));
- else if (size > 1)
- properties.put(viewKey, viewIds.toArray(new String[0]));
- return properties;
- }
-
- private String[] getViewValues(Hashtable properties)
- {
- Object viewValueObj = properties.get(viewKey);
- String[] viewValues;
- if (viewValueObj == null)
- viewValues = new String[0];
- else if (viewValueObj.getClass().isArray())
- viewValues = (String[]) viewValueObj;
- else
- viewValues = new String[]{(String) viewValueObj};
- return viewValues;
- }
-} \ No newline at end of file

Back to the top