Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.command.env/src/org/eclipse/wst')
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/Environment.properties39
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/EnvironmentMessages.java48
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntController.java164
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntEnvironment.java587
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntOperationManager.java63
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntStatusHandler.java41
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/PropertyDataHolder.java33
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/String2BooleanTransformer.java28
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/CommandLine.java855
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/FlagMessages.java73
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/commandline.properties34
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/ClassPath.java90
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceOutputStream.java153
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java778
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/StringUtils.java296
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/WaitForAutoBuildCommand.java40
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/ActionDialogPreferenceTypeRegistry.java99
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentActionDialogsContext.java94
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentContext.java192
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentResourceContext.java86
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseEclipseEnvironment.java27
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EclipseEnvironment.java111
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EnvironmentManager.java28
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/plugin/EnvPlugin.java43
-rw-r--r--bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/preferences/ActionDialogPreferenceType.java205
25 files changed, 0 insertions, 4207 deletions
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/Environment.properties b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/Environment.properties
deleted file mode 100644
index 413d70071..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/Environment.properties
+++ /dev/null
@@ -1,39 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 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
-###############################################################################
-
-#
-# Messages for ResouceUtils
-#
-MSG_ERROR_PATH_NOT_ABSOLUTE=IWAB0003E Path {0} is not absolute for creating a file.
-MSG_ERROR_PATH_EMPTY=IWAB0004E Path {0} is empty while creating a file.
-MSG_ERROR_PATH_NOT_FOLDER=IWAB0005E Path {0} is not a folder for creating a file.
-MSG_ERROR_FOLDER_CREATION_DISABLED=IWAB0007E Folder creation has been disabled for parent folder {0} and child {1}.
-MSG_ERROR_RESOURCE_NOT_FOLDER=IWAB0008E Resource {0} is not a folder.
-MSG_WARN_FILE_OVERWRITE_DISABLED=IWAB0009W Cannot overwrite file {1} in folder {0}.
-MSG_ERROR_FILE_CHECKOUT_DISABLED=IWAB0010E Cannot checkout file {1} in folder {0}.
-MSG_ERROR_RESOURCE_NOT_FILE=IWAB0011E The following path is not a resource: {0}.
-MSG_ERROR_FOLDER_HAS_CHILDREN=IWAB0012E Cannot create folder: {0} that already has children.
-MSG_ERROR_IO=IWAB0006E An input/output error occurred while processing the resource "{0}".
-MSG_ERROR_FILE_OVERWRITE_DISABLED=IWAB0164E Cannot create the file "{1}" relative to the path "{0}" because automatic file overwriting has not been enabled. Do you want to enable it for this file?
-MSG_ERROR_UNEXPECTED_ERROR=IWAB0014E Unexpected exception occured.
-MSG_ERROR_ANT_DATA_TRANSFORM=Exception transforming Ant property key {0} using transformation {1}.
-MSG_ERROR_ANT_CALL_SETTER=Exception invoking setter method {0} for Ant property.
-MSG_ERROR_ANT_CMD_FRAGMENT=Exception retrieving Ant command fragment from registry.
-MSG_ERROR_ANT_SCENARIO_TYPE=Cannot determine scenario type. Please ensure ScenarioType Ant property is set.
-MSG_ERROR_ANT_REQUIRED_PROPERTY=Required property {0} was not set in the Ant property file.
-MSG_INFO_ANT__PROPERTY_DEFAULT=Property {0} was not set in the Ant property file. A default value will be used.
-
-LABEL_YES=Yes
-LABEL_YES_TO_ALL=Yes All
-LABEL_CANCEL=Cancel
-
-
-
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/EnvironmentMessages.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/EnvironmentMessages.java
deleted file mode 100644
index 2c738163f..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/EnvironmentMessages.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.command.internal.env;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class EnvironmentMessages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.wst.command.internal.env.Environment";//$NON-NLS-1$
-
- private EnvironmentMessages() {
- // Do not instantiate
- }
-
- public static String MSG_ERROR_PATH_NOT_ABSOLUTE;
- public static String MSG_ERROR_PATH_EMPTY;
- public static String MSG_ERROR_PATH_NOT_FOLDER;
- public static String MSG_ERROR_FOLDER_CREATION_DISABLED;
- public static String MSG_ERROR_RESOURCE_NOT_FOLDER;
- public static String MSG_WARN_FILE_OVERWRITE_DISABLED;
- public static String MSG_ERROR_FILE_CHECKOUT_DISABLED;
- public static String MSG_ERROR_RESOURCE_NOT_FILE;
- public static String MSG_ERROR_FOLDER_HAS_CHILDREN;
- public static String MSG_ERROR_IO;
- public static String MSG_ERROR_FILE_OVERWRITE_DISABLED;
- public static String MSG_ERROR_UNEXPECTED_ERROR;
- public static String MSG_ERROR_ANT_DATA_TRANSFORM;
- public static String MSG_ERROR_ANT_CALL_SETTER;
- public static String MSG_ERROR_ANT_CMD_FRAGMENT;
- public static String MSG_ERROR_ANT_SCENARIO_TYPE;
- public static String MSG_ERROR_ANT_REQUIRED_PROPERTY;
- public static String MSG_INFO_ANT__PROPERTY_DEFAULT;
- public static String LABEL_YES;
- public static String LABEL_YES_TO_ALL;
- public static String LABEL_CANCEL;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, EnvironmentMessages.class);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntController.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntController.java
deleted file mode 100644
index 87c72f38b..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntController.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060726 151614 pmoogk@ca.ibm.com - Peter Moogk
- * 20061011 159283 makandre@ca.ibm.com - Andrew Mak, project not associated to EAR when using ant on command-line
- *******************************************************************************/
-
-package org.eclipse.wst.command.internal.env.ant;
-
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.command.internal.env.EnvironmentMessages;
-import org.eclipse.wst.command.internal.env.context.PersistentResourceContext;
-import org.eclipse.wst.command.internal.env.core.CommandManager;
-import org.eclipse.wst.command.internal.env.core.context.TransientResourceContext;
-import org.eclipse.wst.command.internal.env.core.data.DataFlowManager;
-import org.eclipse.wst.command.internal.env.core.data.DataMappingRegistryImpl;
-import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment;
-import org.eclipse.wst.command.internal.env.core.fragment.FragmentListener;
-
-/**
- *
- * Central point of control for web service Ant tasks.
- * Constructs Ant environment, root fragment and command manager. Starts execution of the command stack.
- *
- * @author joan
- *
- */
-
-public class AntController {
-
-
- private AntOperationManager operationManager_;
-
- public AntController(Hashtable properties)
- {
- // construct the environment - passing in the property table
- // --maintains link to property table plus any other environment properties
- // --code to access extension point mappings for operations to retrieve data from property table
- TransientResourceContext resourceContext = (TransientResourceContext)PersistentResourceContext.getInstance().copy();
- AntStatusHandler handler = new AntStatusHandler();
- AntEnvironment environment = new AntEnvironment(this, resourceContext, handler, properties);
-
- // construct data manager for maintaining state across operations
- DataFlowManager dataManager = new DataFlowManager( new DataMappingRegistryImpl(), environment);
-
- // set up operation fragments - conditional on options by user... service or client
- // also need to initialize the "selection" or input file (WSDL, Java) here
-
- CommandFragment rootFragment = environment.getRootCommandFragment();
-
- if (rootFragment != null)
- {
- //construct the engine - manages execution of operations
- createOperationManager(rootFragment, dataManager, environment);
-
- DataMappingRegistryImpl dataRegistry_ = new DataMappingRegistryImpl();
- rootFragment.registerDataMappings(dataRegistry_);
- }
- else //problem getting the root fragment - scenario type is likely missing
- {
- handler.reportError(new Status(IStatus.ERROR, "ws_ant", 9999, EnvironmentMessages.MSG_ERROR_ANT_SCENARIO_TYPE, null));
- return;
- }
-
- //ready to start running operations
- ((AntOperationManager)getOperationManager()).moveForwardToNextStop(new NullProgressMonitor());
-
- if (!operationManager_.getLastStatus().isOK())
- operationManager_.undoToLastStop();
- }
-
- private void createOperationManager(CommandFragment frag, DataFlowManager mgr, AntEnvironment env)
- {
- operationManager_ = new AntOperationManager(frag, mgr, env);
-
- operationManager_.setPeekFragmentListener(
- new FragmentListener()
- {
- public boolean notify( CommandFragment fragment )
- {
- return peekFragment( fragment );
- }
- } );
-
- operationManager_.setNextFragmentListener(
- new FragmentListener()
- {
- public boolean notify( CommandFragment fragment )
- {
- return nextFragment( fragment );
- }
- } );
-
- operationManager_.setUndoFragmentListener(
- new FragmentListener()
- {
- public boolean notify( CommandFragment fragment )
- {
- return undoFragment( fragment );
- }
- } );
- }
-
- protected CommandManager getOperationManager()
- {
- return operationManager_;
- }
-
- /**
- * The CommandFragmentEngine calls this method when it is peeking forward
- * in the fragments. When peeking forward the command stack state in the
- * engine is not changes.
- *
- *
- * @param fragment the fragment that it is peeking at.
- * @return Indicates whether peeking should stop or not.
- */
- protected boolean peekFragment( CommandFragment fragment )
- {
- return true;
- }
-
- /**
- * The CommandFragmentEngine calls this method when it is moving forward
- * in the fragments. When moving forward the command stack state is saved
- * at each fragment is traversed.
- *
- * @param fragment the fragment that is being traversed.
- * @return indicates if the forward traversal should continue.
- */
- protected boolean nextFragment( CommandFragment fragment )
- {
- return true;
- }
-
- /**
- * This method is called for each fragment when the command engine is unwinding
- * its stack during an undo operation.
- *
- * @param fragment the fragment being undone.
- * @return returns true if the undo process should continue.
- */
- protected boolean undoFragment( CommandFragment fragment )
- {
- return true;
- }
-
-
-
-
-
- }
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntEnvironment.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntEnvironment.java
deleted file mode 100644
index b0c7666e2..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntEnvironment.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060523 133714 joan@ca.ibm.com - Joan Haggarty
- * 20060726 151614 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-package org.eclipse.wst.command.internal.env.ant;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.command.internal.env.EnvironmentMessages;
-import org.eclipse.wst.command.internal.env.core.CommandManager;
-import org.eclipse.wst.command.internal.env.core.context.TransientResourceContext;
-import org.eclipse.wst.command.internal.env.core.data.BeanModifier;
-import org.eclipse.wst.command.internal.env.core.data.ClassEntry;
-import org.eclipse.wst.command.internal.env.core.data.Transformer;
-import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment;
-import org.eclipse.wst.command.internal.env.eclipse.EclipseEnvironment;
-import org.eclipse.wst.command.internal.env.plugin.EnvPlugin;
-import org.eclipse.wst.common.environment.ILog;
-import org.eclipse.wst.common.environment.IStatusHandler;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-
-/**
- *
- * Access to status handler, log, resource context and command manager.
- * Initializes data for commands from Ant property files based on antDataMapping extensions.
- *
- * @author joan
- *
- */
-
-public class AntEnvironment extends EclipseEnvironment{
-
- private Hashtable antProperties_;
- private Hashtable operationDataRecord_ = new Hashtable();
- private boolean mappingComplete_;
- private ClassEntry classEntry;
-
- // extensionPoint names and namespace
- private static String MAPPER_EXT_PT = "antDataMapping"; //$NON-NLS-1$
- private static String SCENARIO_EXT_PT = "antScenario"; //$NON-NLS-1$
- private static String EXT_PT_NAMESPACE = "org.eclipse.wst.command.env"; ////$NON-NLS-1$
-
- // antDataMapping extension point attributes
- private static final String MAPPER_OPERATION_ATTRIBUTE= "operation"; //$NON-NLS-1$
- private static final String MAPPER_KEY_ATTRIBUTE= "key"; //$NON-NLS-1$
- private static final String MAPPER_PROPERTY_ATTRIBUTE= "property"; //$NON-NLS-1$
- private static final String MAPPER_TRANSFORM_ATTRIBUTE= "transform"; //$NON-NLS-1$
- private static final String MAPPER_REQUIRED_ATTRIBUTE= "required"; //$NON-NLS-1$
-
- // antScenario extension point attributes
- private static final String SCENARIO_TYPE_ATTRIBUTE = "scenarioType"; //$NON-NLS-1$
- private static final String SCENARIO_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
-
- // Ant property IDs
- private static final String VERBOSE_PROPERTY = "Verbose"; //$NON-NLS-1$
- private static final String OVERWRITE_PROPERTY = "OverwriteFilesEnabled"; //$NON-NLS-1$
- private static final String CREATEFOLDER_PROPERTY = "CreateFoldersEnabled"; //$NON-NLS-1$
- private static final String CHECKOUT_PROPERTY = "CheckoutFilesEnabled"; //$NON-NLS-1$
- private static final String SCENARIO_TYPE_PROPERTY = "ScenarioType"; //$NON-NLS-1$
-
- private AntController controller_;
-
- public AntEnvironment(AntController controller, TransientResourceContext context, IStatusHandler handler, Hashtable properties)
- {
- super(controller.getOperationManager(), context, handler);
- antProperties_ = properties;
- controller_ = controller;
- setContext( context );
- }
-
- private void setContext(TransientResourceContext context)
- {
- Boolean overwriteSet = getBooleanProperty( OVERWRITE_PROPERTY );
- Boolean createfolderSet = getBooleanProperty( CREATEFOLDER_PROPERTY );
- Boolean checkoutSet = getBooleanProperty( CHECKOUT_PROPERTY );
-
- if( overwriteSet != null ) context.setOverwriteFilesEnabled( overwriteSet.booleanValue() );
- if( createfolderSet != null ) context.setCreateFoldersEnabled( createfolderSet.booleanValue() );
- if( checkoutSet != null ) context.setCheckoutFilesEnabled( checkoutSet.booleanValue() );
- }
-
- public boolean verbose()
- {
- Boolean result = getBooleanProperty( VERBOSE_PROPERTY );
-
- return result == null ? false : result.booleanValue();
- }
-
- public Boolean getBooleanProperty( String property )
- {
- String value = getProperty( property );
- Boolean result = null;
-
- if( value != null )
- {
- value = value.toLowerCase();
- result = new Boolean( value.equals( "true") );
- }
-
- return result;
- }
-
- // returns String since the property table built by Ant is property value pairs where the value is a String
- private String getProperty(String key)
- {
- Object property = antProperties_.get(key);
- if (property != null && (!property.toString().equals("")))
- return property.toString().trim();
- return null;
- }
-
- // call from engine prior to executing the operation
- public IStatus initOperationData(AbstractDataModelOperation op)
- {
- //check to see if data has already been primed for this operation
- String qualifiedClassName = op.getClass().getName();
- if (operationDataRecord_.get(qualifiedClassName) == null)
- {
- classEntry = new ClassEntry();
-
- try {
- //extension lookup for the bean - may be more than one property for it
- Enumeration operationData = getMappingExtensions(op);
- classEntry.setterList_= getSetterList(op);
- while (operationData.hasMoreElements())
- {
- PropertyDataHolder mapping = (PropertyDataHolder)operationData.nextElement();
-
- mappingComplete_ = false;
- String property = mapping.property_;
- String setterMethodName = createSetterName(property);
-
- int step = 1;
- while (!mappingComplete_)
- {
- switch (step) {
- case 1:
- mappingComplete_ = transformAndSet(mapping, setterMethodName);
- break;
- case 2:
- mappingComplete_ = callSetter(mapping.operation_, mapping.value_, setterMethodName);
- break;
-
- case 3:
- mappingComplete_ = callPrimitiveSetter(mapping);
- break;
-
- case 4:
- mappingComplete_ = callSetterConstructor(mapping);
- break;
-
- default:
- mappingComplete_ = true;
- break;
- }
- step++;
- }
- }
- //add operation to the record - no need to initialize again...
- operationDataRecord_.put(qualifiedClassName, "");
- }
- catch (Exception e)
- {
- throw new IllegalArgumentException(e.getMessage());
- }
-
- }
- return Status.OK_STATUS;
- }
-
- /**
- * Creates setter name based on the property passed in. If the
- * property has any leading qualifiers they are stripped off.
- * The property is capitalized and set is prepended.
- * @param property The name of the property that requires a setter.
- * @return
- */
- private String createSetterName(String property)
- {
- while (property.indexOf(".")>=0)
- {
- property=property.substring(property.indexOf(".")+1);
- }
- String firstChar = property.substring(0,1);
- firstChar = firstChar.toUpperCase();
- property = firstChar + property.substring(1);
- String setterName = "set" + property;
- return setterName;
- }
-
- /**
- * Retrieves extensions for the org.eclipse.wst.command.env antDataMapping
- * extension point. Extracts those that with class attribute values that match operationName.
- * All mappings are converted to PropertyDataHolder objects.
- * Any m:1 Ant key to property mappings are collected into a key-value map within
- * a single PropertyDataHolder.
- * @param operationName The name of the operation that is being initialized.
- * @return A collection of PropertyDataHolder objects. Returns null if there are no extensions matching the operationName.
- */
- private Enumeration getMappingExtensions(AbstractDataModelOperation operation) throws CoreException
- {
- String operationName = operation.getClass().getName();
- //go to ext registry and get all antMapping extensions
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IExtensionPoint extPt = reg.getExtensionPoint(EXT_PT_NAMESPACE, MAPPER_EXT_PT);
- Hashtable dataTable = new Hashtable(25);
-
- IConfigurationElement[] elements = extPt.getConfigurationElements();
-
- for (int i = 0; i < elements.length; i++) {
-
- IConfigurationElement ce = elements[i];
- Object obj = ce.getAttribute(MAPPER_OPERATION_ATTRIBUTE);
- // look for mappings for this operation
- if (obj.equals(operationName))
- {
- String key = ce.getAttribute(MAPPER_KEY_ATTRIBUTE);
- String value = getProperty(key);
-
- //check to see if the property for this extension is already in the data table
- // if so, there is a m:1 mapping
- if (value != null) //only do a mapping if there is an Ant property value passed in...
- {
-
- String property = ce.getAttribute(MAPPER_PROPERTY_ATTRIBUTE);
- Object transform = null;
- try
- {
- //check to make sure there is an transform attribute provided
- // if so, get the class to do the transformation
- if (ce.getAttribute(MAPPER_TRANSFORM_ATTRIBUTE)!= null)
- transform = ce.createExecutableExtension(MAPPER_TRANSFORM_ATTRIBUTE);
- }
- catch (CoreException cex) {
- Status errorStatus = new Status(Status.ERROR, "ws_ant", 5092, cex.getMessage(), cex);
- getStatusHandler().reportError(errorStatus);
- getLog().log(ILog.ERROR, "ws_ant", 5092, this, "getMappingExtensions", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_DATA_TRANSFORM, key, transform));
- throw new CoreException(errorStatus);
- }
-
- if (transform != null && transform instanceof BeanModifier/*dataTable.containsKey(property)*/)
- {
- //get the PropertyDataHolder from the table
- PropertyDataHolder holder = (PropertyDataHolder)dataTable.get(property);
- if (holder == null)
- {
- holder = new PropertyDataHolder();
- holder.key_ = "";
- holder.value_ = "";
- holder.transform_ = transform;
- holder.operation_ = operation;
- holder.property_ = property;
- holder.map_ = new HashMap();
- holder.map_.put(key, value);
- dataTable.put(property, holder);
- }
- else
- {
- holder.map_.put(key, value);
- }
- }
- else //plain property mapping not a bean
- {
- PropertyDataHolder holder = new PropertyDataHolder();
- holder.operation_ = operation;
- holder.key_ = key;
- holder.property_ = property;
- holder.transform_ = transform;
- holder.value_ = value;
- dataTable.put(property, holder);
- }
- }
- else if(ce.getAttribute(MAPPER_REQUIRED_ATTRIBUTE)!=null && ce.getAttribute(MAPPER_REQUIRED_ATTRIBUTE).equals("true"))
- {
- String msg = EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_REQUIRED_PROPERTY, key.toString());
- Status statusObj = new Status(IStatus.ERROR,
- EnvPlugin.ID,
- IStatus.ERROR,
- msg,
- null);
- getStatusHandler().reportError(statusObj);
- getLog().log(ILog.ERROR, "ws_ant", 9999, this, "getMappingExtensions", msg);
- }
- else if (verbose())
- {
- String msg = EnvironmentMessages.bind(EnvironmentMessages.MSG_INFO_ANT__PROPERTY_DEFAULT, key.toString());
- Status statusObj = new Status(IStatus.INFO,
- EnvPlugin.ID,
- IStatus.INFO,
- msg,
- null);
- getStatusHandler().reportInfo(statusObj);
- getLog().log(ILog.INFO, "ws_ant", 9999, this, "getMappingExtensions", msg);
- }
- }
- }
- return dataTable.elements();
- }
-
- private boolean transformAndSet(PropertyDataHolder mapping, String setterMethodName)
- {
- Object transform = mapping.transform_;
- if (transform != null)
- {
- // get transform class & create setter parameters
- try
- {
- //Object classObject = Class.forName(transform).newInstance();
- Object param = new Object();
- if (transform instanceof Transformer)
- {
- Transformer transformer = (Transformer)transform;
- // transform the property value
- param = transformer.transform(mapping.value_);
- }
- else if (mapping.map_ != null && transform instanceof BeanModifier)
- {
- BeanModifier modifier = (BeanModifier)transform;
- Method getter = getGetterMethod(mapping);
- param = getter.invoke(mapping.operation_, new Object[]{});
- modifier.modify(param, mapping.map_);
- }
- return callSetter(mapping.operation_, param, setterMethodName);
-
- }
- catch (Exception exc)
- {
- getStatusHandler().reportError(new Status(Status.ERROR, "ws_ant", 5093, exc.getMessage(), exc));
- getLog().log(ILog.ERROR, "ws_ant", 5093, this, "transformAndSet", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_DATA_TRANSFORM, mapping.key_, mapping.transform_));
- throw new IllegalArgumentException(exc.getMessage());
- }
- }
- return false;
- }
-
- private Vector getSetterList(Object op)
- {
- Vector result = new Vector();
- Method[] methods = op.getClass().getMethods();
- for( int index = 0; index < methods.length; index++ )
- {
- Method method = methods[index];
- boolean isPublic = Modifier.isPublic( method.getModifiers() );
- Class returnType = method.getReturnType();
-
- if( isPublic &&
- returnType == Void.TYPE &&
- method.getParameterTypes().length == 1 &&
- method.getName().startsWith( "set" ))
- {
- method.setAccessible( true );
- result.add( method );
- }
- }
-
- return result;
- }
-
- private Method getGetterMethod(PropertyDataHolder mapping)
- {
- Method getterFound = null;
-
- if (classEntry.getterList_ == null)
- {
- classEntry.getterList_ = getGetterList(mapping.operation_);
- }
-
- for( int index = 0; index < classEntry.getterList_.size(); index++ )
- {
- Method getter = (Method)classEntry.getterList_.elementAt( index );
-
- if( getter.getName().equals( "get" + mapping.property_ ))
- {
- getterFound = getter;
- break;
- }
- }
- return getterFound;
- }
-
- private Vector getGetterList( Object object )
- {
- Vector result = new Vector();
- Method[] methods = object.getClass().getMethods();
-
- for( int index = 0; index < methods.length; index++ )
- {
- Method method = methods[index];
- boolean isPublic = Modifier.isPublic( method.getModifiers() );
- Class returnType = method.getReturnType();
-
- if( isPublic &&
- returnType != Void.TYPE &&
- method.getParameterTypes().length == 0 &&
- method.getName().startsWith( "get" ))
- {
- method.setAccessible( true );
- result.add( method );
- }
- }
-
- return result;
- }
-
- private boolean callSetter(AbstractDataModelOperation op, Object param, String setterMethodName) throws CoreException
- {
- for (Iterator iterator = classEntry.setterList_.iterator(); iterator.hasNext();)
- {
- Method method = (Method) iterator.next();
- if (method.getName().equals(setterMethodName))
- {
- Class[] paramTypes = method.getParameterTypes();
- if (paramTypes.length == 1 && param != null)
- {
- try{
- method.invoke(op, new Object[]{param});
- return true;
- }
- catch(Exception cex){
- Status errorStatus = new Status(Status.ERROR, "ws_ant", 5094, cex.getMessage(), cex);
- getStatusHandler().reportError(errorStatus);
- getLog().log(ILog.ERROR, "ws_ant", 5094, this, "callSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, setterMethodName));
- throw new CoreException(errorStatus);
- }
- }
- }
- }
- return false;
- }
-
-
- // look for setter with primitive type parameter - if find one, convert String propertyValue and call it
- private boolean callPrimitiveSetter(PropertyDataHolder mapping) throws CoreException
- {
- for (Iterator iterator = classEntry.setterList_.iterator(); iterator.hasNext();) {
- Method element = (Method) iterator.next();
- Class[] parmTypes = element.getParameterTypes();
- if (parmTypes.length==1 && parmTypes[0].isPrimitive())
- {
- Class parmType = parmTypes[0].getClass();
- Object setterParm = null;
- if (parmType.equals(Integer.class))
- {
- setterParm = Integer.valueOf(mapping.value_);
- }
- else if (parmType.equals(Boolean.class))
- {
- setterParm = Boolean.valueOf(mapping.value_);
- }
- else if (parmType.equals(Character.class) && mapping.value_.length() == 1)
- {
- setterParm = new Character(mapping.value_.charAt(0));
- }
- else if (parmType.equals(Byte.class))
- {
- setterParm = Byte.valueOf(mapping.value_);
- }
- else if (parmType.equals(Short.class))
- {
- setterParm = Short.valueOf(mapping.value_);
- }
- else if (parmType.equals(Long.class))
- {
- setterParm = Long.valueOf(mapping.value_);
- }
- else if (parmType.equals(Float.class))
- {
- setterParm = Float.valueOf(mapping.value_);
- }
- else if (parmType.equals(Double.class))
- {
- setterParm = Double.valueOf(mapping.value_);
- }
-
- if (setterParm != null)
- {
- try
- {
- element.invoke(mapping.operation_, new Object[]{setterParm});
- return true;
- }
- catch(Exception e){
- Status errorStatus = new Status(Status.ERROR, "ws_ant", 5095, e.getMessage(), e);
- getStatusHandler().reportError(errorStatus);
- getLog().log(ILog.ERROR, "ws_ant", 5095, this, "callPrimitiveSetter", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, element.getName()));
- throw new CoreException(errorStatus);
- }
- }
- }
- }
- return false;
- }
-
- //check for setter with parameter type that takes a String to construct
- // construct the parameter using String & call the setter
- private boolean callSetterConstructor(PropertyDataHolder mapping) throws CoreException
- {
- for (Iterator iterator = classEntry.setterList_.iterator(); iterator.hasNext();) {
- Method element = (Method) iterator.next();
- Class[] parmTypes = element.getParameterTypes();
- Class[] stringParm = new Class[]{String.class};
- if (parmTypes.length==1)
- {
- try
- {
- Constructor ctor = parmTypes.getClass().getConstructor(stringParm);
- Object parameter = ctor.newInstance(new Object[]{mapping.value_});
- element.invoke(mapping.operation_, new Object[]{parameter});
- }
- catch (Exception exc)
- {
- Status errorStatus = new Status(Status.ERROR, "ws_ant", 5096, exc.getMessage(), exc);
- getStatusHandler().reportError(errorStatus);
- getLog().log(ILog.ERROR, "ws_ant", 5096, this, "callSetterConstructor", EnvironmentMessages.bind(EnvironmentMessages.MSG_ERROR_ANT_CALL_SETTER, element.getName()));
- throw new CoreException(errorStatus);
- }
- }
- }
- return false;
- }
-
- /**
- * Returns an object that helps manage execution/undoing of Commands.
- */
- public CommandManager getCommandManager (){
- return controller_.getOperationManager();
- }
-
- public CommandFragment getRootCommandFragment()
- {
-
- //look up the commandFragment in the scenarioRegistry extension point with an ID corresponding to the scenario property in the propertytable
- String scenarioProperty = (String)getProperty(SCENARIO_TYPE_PROPERTY);
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IExtensionPoint extPt = reg.getExtensionPoint(EXT_PT_NAMESPACE, SCENARIO_EXT_PT);
-
- IConfigurationElement[] elements = extPt.getConfigurationElements();
-
- for (int i = 0; i < elements.length; i++) {
-
- IConfigurationElement configElement = elements[i];
- if (configElement.getAttribute(SCENARIO_TYPE_ATTRIBUTE).equals(scenarioProperty))
- {
- try
- {
- Object obj = configElement.createExecutableExtension(SCENARIO_CLASS_ATTRIBUTE);
-
- if (obj instanceof org.eclipse.wst.command.internal.env.core.fragment.CommandFragment)
- {
- return (org.eclipse.wst.command.internal.env.core.fragment.CommandFragment)obj;
- }
- }
- catch (Exception exception)
- {
- Status errorStatus = new Status(Status.ERROR, "ws_ant", 5097, exception.getMessage(), exception);
- getStatusHandler().reportError(errorStatus);
- getLog().log(ILog.ERROR, "ws_ant", 5097, this, "getRootCommandFragment", EnvironmentMessages.MSG_ERROR_ANT_CMD_FRAGMENT);
- }
- }
- }
- return null;
- }
- }
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntOperationManager.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntOperationManager.java
deleted file mode 100644
index 189861203..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntOperationManager.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.command.internal.env.ant;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.command.internal.env.core.data.DataFlowManager;
-import org.eclipse.wst.command.internal.env.core.fragment.CommandFragment;
-import org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine;
-import org.eclipse.wst.common.environment.ILog;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-
-/**
- * Manages the execution of commands in the root fragment passed to the constructor.
- *
- * @author joan
- *
- */
-
-public class AntOperationManager extends CommandFragmentEngine
-{
- private AntEnvironment environment_;
-
- protected IStatus initBeforeExecute( AbstractDataModelOperation operation )
- {
- environment_.getLog().log(ILog.INFO, "ws_ant", 5098, this, "initBeforeExecute", "Initializing data for: " + operation.getClass().getName());
- IStatus initStatus = Status.OK_STATUS;
- try
- {
- initStatus = environment_.initOperationData( operation );
- }
- catch (Exception e)
- {
- throw new IllegalArgumentException(e.getMessage());
- }
- return initStatus;
- }
-
- /**
- * Creates a CommandFragmentEngine.
- *
- * @param startFragment the root fragment where traversal will begin.
- * @param dataManager the data manager containing all of the data mappings.
- * @param environment the environment.
- */
- public AntOperationManager( CommandFragment startFragment, DataFlowManager dataManager, AntEnvironment environment )
- {
- super( startFragment, dataManager, environment );
-
- environment_ = environment;
- }
-}
-
-
-
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntStatusHandler.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntStatusHandler.java
deleted file mode 100644
index aa4c6c884..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/AntStatusHandler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.command.internal.env.ant;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.common.environment.Choice;
-import org.eclipse.wst.common.environment.IStatusHandler;
-import org.eclipse.wst.common.environment.StatusException;
-
-public class AntStatusHandler implements IStatusHandler {
-
- public Choice report(IStatus status, Choice[] choices) {
- // TODO
- return null;
- }
-
- public void report(IStatus status) throws StatusException {
- if (status.getSeverity() == IStatus.ERROR)
- reportError(status);
- else
- reportInfo(status);
-
- }
-
- public void reportError(IStatus status) {
- System.err.println(status.getMessage());
- }
-
- public void reportInfo(IStatus status) {
- System.out.println(status.getMessage());
- }
-
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/PropertyDataHolder.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/PropertyDataHolder.java
deleted file mode 100644
index 509ab6bb0..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/PropertyDataHolder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.command.internal.env.ant;
-
-/**
- * Simple class to hold data mapping information once retrieved from Ant property file.
- * Map is used for many to one mappings involving mapping of multiple properties to a bean.
- * In this case, the key_ and value_ should be set to an empty string and all key value pairs
- * for properties put into the map instead. The transformation for this case would be a modifier
- * which will set the properties onto the bean.
- */
-
-import java.util.Map;
-
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-
-public class PropertyDataHolder {
- public AbstractDataModelOperation operation_;
- public Object transform_;
- public String key_;
- public String property_;
- public String value_;
- public Map map_;
-}
-
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/String2BooleanTransformer.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/String2BooleanTransformer.java
deleted file mode 100644
index 783e54cac..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/ant/String2BooleanTransformer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.command.internal.env.ant;
-
-import org.eclipse.wst.command.internal.env.core.data.Transformer;
-
-public class String2BooleanTransformer implements Transformer {
-
- public Object transform(Object value) {
- String str = (String)value;
- str = str.toLowerCase();
- if (str.equals("true"))
- {
- return new Boolean(true);
- }
- else return new Boolean(false);
-
- }
-
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/CommandLine.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/CommandLine.java
deleted file mode 100644
index c35982acf..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/CommandLine.java
+++ /dev/null
@@ -1,855 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.command.internal.env.commandline;
-
-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.BitSet;
-import java.util.ResourceBundle;
-import java.util.Vector;
-import org.eclipse.wst.command.internal.env.common.StringUtils;
-
-
-/**
- * <p>This is a generic command line parsing class. The programmer need only specify
- * the characteristics of their command line(ie. positional parameters, flags, etc)
- * and this class will perform the rest of the parsing work. As an added bonus this
- * class will also create formated help text that displays the syntax of this
- * command line.
- *
- * <p>The main parameter to the CommandLine constructor is a two dimensional String
- * array. There are 5 columns in this array and as many rows as needed for each
- * flag or positional parameter. The five columns are:
- *
- * <ol>
- * <li>The name of the flag(eg. "help" or "a", etc)
- * Note: no dash should be in the name here. The user would specify "-help" on the
- * command line though.
- * <li>The name of the flag parameter(if any)
- * <li>A string indicating whether this flag can appear more than once on the
- * command line.
- * <li>A string indicating whether this flag must be specified on the command line.
- * <li>A help text string which describes this particular flag or positional parameter.
- * </ol>
- *
- * <p>Each row in the string array is associate with either a positional parameter
- * or with a flag. For example, consider this command line:
- * <ul>
- * <li>My_prog required_parm1 -ab parm_for_ab required_parm2 -help optional_parms
- * </ul>
- *
- * <p>In this example My_prog is the name of the program. required_parm1 and
- * required_parm2 must be specified on the command line. Notice that they do not
- * have to be adjacent to each other on the command line. optional_parms may optionally
- * specified. optional_parms can be 0 or more parameters. They does not need to be
- * adjacent to the required parameters, but they do need to follow the required
- * parameters. Two flags are specified "-ab" and "-help". The "-ab" flag has a
- * parameter "parm_for_ab" associated with it. Note: a flag can not have an optional
- * parameter. (ie. a flag either never have a parameter or it always has a parameter)
- * In this example, the first two rows in the string array would describe required_parm1
- * and required_parm2. The third entry would describe optional_parms. The fourth and
- * fifth rows would describe "-ab" and "-help". For this command line the string array
- * would look like this:
- *
- * <ul>
- * <li>{ { CommandLine.POSITIONAL, "parm1", CommandLine.NO_DUPS,
- * CommandLine.REQUIRED, "parm1 help text" },
- * <li>{ CommandLine.POSITIONAL, "parm2", CommandLine.NO_DUPS,
- * CommandLine.REQUIRED, "parm2 help text" },
- * <li>{ CommandLine.POSITIONAL, "optional_parms", CommandLine.DUPS_OK,
- * CommandLine.REQUIRED, "optional help text" },
- * <li>{ "ab", "parm_for_ab", CommandLine.NO_DUPS,
- * CommandLine.OPTIONAL, "ab help text" },
- * <li>{ "help", CommandLine.NO_PARM, CommandLine.NO_DUPS,
- * CommandLine.OPTIONAL, "displays this help text" } }
- * </ul>
- *
- * <p>String array rules:
- *
- * <ol>
- * <li>Positional rows must always come first in the array. These rows must
- * have a name specified in column 2, except for one case. If you want to indicate that
- * there are no optional positional parameters you would put CommandLine.NO_PARM
- * in column 2 of the positional row. You would also need to put CommandLine.OPTIONAL
- * in column 4 since this row is for optional parameters(or the non-existence of
- * optional parameters as the case may be)
- * <li>Once a positional row specifies that it is optional, no further positional rows
- * may be specified.
- * <li>At least one positional row must be specified, even if it is to just to specify that
- * there are no optional parameters.
- * <li>Flag names must be in lower case. Note: the user can specify upper or lower case
- * on the command line.
- * <li>If a flag has a parameter the name of the parameter should be put into column 2.
- * otherwise CommandLine.NO_PARM should be put in column 2.
- * <li>If a flag is allowed to appear more than once on the command line then
- * CommandLine.DUPS_OK should be put into column 3, otherwise CommandLine.NO_DUPS
- * should be put into column 3.
- * <li>If a flag must be specified on the command line then CommandLine.REQUIRED should
- * be specified in column 4, otherwise CommandLine.OPTIONAL should be specified.
- * <li>A help flag must be specified.
- * <li>The strings specified in the flags column, the parameter name column, and the
- * help column are always translated using the resource bundle specified. Of
- * course the special string values such as POSITIONAL and NO_PARM are not
- * translated.
- * </ol>
- *
- * <p> Flag matching rules:
- * <ol>
- * <li>The parser will attempt to match a user specified flag with the minimum number
- * of programmer specified flag characters. For example, if the programmer has
- * specified that the flag is "help" the user could specify "-h", "-he", "-hel", or
- * "-help". If the programmer has also specified a flag called "hello", the
- * user would get an error message for specifing either "-h", "-he" or "-hel", since
- * it is ambiguous which flag is being refered to. Both "-hell" and "-hello"
- * would be ok for the user to specify the hello flag on the command line.
- * <li>If a flag has a parameter, the parameter may be immediately adjacent to the flag.
- * For example if "abcd" is specified as a flag with a parameter, the user could
- * specify the following assuming there are no other ambiguous flags. "-abcdparm",
- * "-abcparm", "-abparm", or "-aparm" where parm is the parameter for the flag.
- * (Of course the user can always put a white space between the flag and the
- * parameter.)
- * <li>If a flag does not have a parameter and a parameter is adjacent to it then this
- * parameter is interpreted as a positional parameter. For example if "abcb" is
- * specified as a flag and the user specifies "-abhello", then the first "ab" will be
- * interpreted as the flag and "hello" will be interpreted as a positional
- * parameter.
- * </ol>
- *
- * @author Peter Moogk
- * @date July 13, 2000
-**/
-
-public class CommandLine
-{
- // Constant strings that the user should use in their flags_info input array.
- /**
- * Specifies that this flag or positional parameter is required.
- **/
- public static final String REQUIRED = "required";
- /**
- * Specifies that this flag or positional parameter is optional.
- **/
- public static final String OPTIONAL = "optional";
- /**
- * Specifies that this flag may be specified more than once on the command line.
- * Note: This string has no meaning for positional parameters.
- **/
- public static final String DUPS_OK = "dups_ok";
- /**
- * Specifies that this flag may not be specified more than once on the command line.
- * Note: This string has no meaning for positional parameters.
- **/
- public static final String NO_DUPS = "no_dups";
- /**
- * Specifies that a row is a positional parameter row.
- **/
- public static final String POSITIONAL = "";
- /**
- * Specifies that a flag has no parameter. For positional parameters this
- * string indicates that there are no optional parameters.
- **/
- public static final String NO_PARM = "";
-
- /**
- * @param flags_info This parameter specifies the characteristics of the
- * command line parser. See the class description for a
- * definition of what this string array should look like.
- * @param help_flag This string indicates which flag in the flags_info
- * array is the help flag.
- * @param tool_name This string indicates the name of the tool that this
- * command line parser is being used for. This string
- * is only used when creating the help text.
- **/
- public CommandLine( String[][] flags_info,
- String help_flag,
- String tool_name,
- ResourceBundle flagMessages )
-
- throws InternalErrorExc
- {
- this.flags_info = flags_info;
- this.help_flag = help_flag;
- this.tool_name = tool_name;
- this.flagMessages = flagMessages;
-
- messages = ResourceBundle.getBundle( "org.eclipse.wst.command.internal.env.commandline.commandline" );
- verify_flags_info();
- }
-
- /**
- * Call this method to parse a command line.
- * @param args This is the string array from the command line.
- * @throws Flag_error If the user has specified the command line incorrectly
- * a Flag_error exception will be thrown. Use getMessage
- * to get a description of the user error.
- *
- * @throws Help_specified If the user specifies the help flag this exception
- * will be thrown. Use getMessage to get a fully
- * formatted syntax description of this command line.
- **/
- public void check_flags( String[] args ) throws Flag_error
- {
- flags_specified = new Vector[flags_info.length];
-
- for( int index = 0; index < args.length; index++ )
- {
- boolean processed_the_next_arg = process_arg( args, index );
- if( processed_the_next_arg == true ) index++;
- }
-
- // If help was specified we will not check the regular rules.
- if( !flag_specified( help_flag ) )
- {
- // Check for flags breaking the rules specified in flags_info.
- check_rules();
-
- // Call subclassed method to see if more processing is required.
- more_processing();
- }
- }
-
- /**
- * This method is for subclasses of this class. This method is called at
- * the very end of check_flags method. It is intended that subclasses would
- * perform additional command line checking here.
- **/
- protected void more_processing() throws Flag_error, InternalErrorExc
- {
- }
-
- /**
- * Once the command line has been parsed by calling check_flags a
- * call can be made to this method to get the parameters for this flag.
- * If the flag was not specified on the command line null will be returned.
- * If the flag was specified, but has no parameters a valid vector will be
- * returned containing a null.
- **/
- public String[] get_flag_parms( String flag )
- {
- int row = 0;
- boolean flag_found = false;
-
- while( flag_found == false && row < flags_info.length )
- {
- if( flags_info[row][FLAG_COL].equals( flag ) )
- {
- flag_found = true;
- }
- else
- {
- row++;
- }
- }
-
- if( flag_found == true )
- {
- Vector parms = flags_specified[row];
- return parms == null ? null : (String[])(parms.toArray( new String[0] ));
- }
-
- return null;
- }
-
- /**
- * Call this method to get all of the positional parameters.
- * This method returns both the required positionals and the
- * optional positionals in that order. If no positional parameters
- * were specified null will be returned.
- **/
- public String[] get_positionals()
- {
- return (String[])flags_specified[POSITIONAL_ROW].toArray( new String[0] );
- }
-
- /**
- * This method returns true if this flag was specified by the user
- * otherwise false is returned.
- **/
- public boolean flag_specified( String flag )
- {
- return get_flag_parms( flag ) != null;
- }
-
- /**
- * This method returns fully formated help text syntax for this
- * command line.
- **/
- public String get_help_text()
- {
- StringBuffer help_text = new StringBuffer(400);
- int help_width = HELP_LINE_LEN -
- 2 - // blanks
- 1 - // dash
- max_flag_size - // flag field
- 1 - // blank
- max_name_size - // name field
- 1; // blank
-
- help_text.append( messages.getString( FlagMessages.PARSER_INFO_SYNTAX ) +
- ": " + tool_name + " " );
-
- // Display the required positionals if any.
- for( int index = 0; index < required_positionals; index++ )
- {
- help_text.append( flagMessages.getString( flags_info[index][NAME_COL] ) +
- " " );
- }
-
- help_text.append( "[" + messages.getString( FlagMessages.PARSER_FLAGS ) +
- "] " );
-
- if( optional_positionals_allowed == true )
- {
- help_text.append( flagMessages.getString( flags_info[optional_list_index][NAME_COL] ) );
- }
-
- help_text.append( "\n " + messages.getString( FlagMessages.PARSER_INFO_WHERE ) + "\n" );
-
- // Create one line of description for each parameter
- for( int row = 0; row < flags_info.length; row++ )
- {
- String columnId = flags_info[row][NAME_COL];
- String columnName = columnId == NO_PARM ? "" : flagMessages.getString( columnId );
-
- String flagId = flags_info[row][FLAG_COL];
- String flagName = flagId == POSITIONAL ? POSITIONAL : flagMessages.getString(flagId);
-
- int flag_padding = max_flag_size - flagName.length();
- int name_padding = max_name_size - columnName.length();
-
- // Skip this row if this is a marker for no optional positionals.
- if( flags_info[row][FLAG_COL] == POSITIONAL &&
- flags_info[row][NAME_COL] == NO_PARM ) continue;
-
- if( flagName == POSITIONAL )
- {
- help_text.append( getBlanks(3 ) );
- }
- else
- {
- help_text.append( " -" + flagName );
- }
-
- help_text.append( getBlanks( flag_padding + 1 ) );
- help_text.append( columnName );
- help_text.append( getBlanks( name_padding + 1 ) );
-
- String columnHelp = flagMessages.getString( flags_info[row][HELP_COL] );
- String[] split_help_text
- = StringUtils.splitter( columnHelp, help_width );
-
- if( split_help_text.length > 0 )
- help_text.append( split_help_text[0] + "\n" );
- else
- help_text.append( "\n" );
-
- for( int index = 1; index < split_help_text.length; index++ )
- {
- help_text.append( getBlanks( HELP_LINE_LEN - help_width ) );
- help_text.append( split_help_text[index] + "\n" );
- }
-
- help_text.append( "\n" );
- }
-
- return "" + help_text;
- }
-
- /**
- * Return a string with the specified number of blanks.
- */
- private String getBlanks( int count )
- {
- char[] blanks = new char[count];
- Arrays.fill( blanks, 0, count, ' ' );
-
- return new String( blanks );
- }
-
- /**
- * This class is the base for all command line exception classes.
- **/
- static public class ErrorExc extends Exception
- {
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 3257567317259793720L;
-
- public ErrorExc( String message, String[] args )
- {
- super( MessageFormat.format( message, args ) );
- }
- }
-
- /**
- * This class will be thrown when an internal error is detected.
- * This usually happens if the flag description information was
- * specified incorrectly.
- **/
- static public class InternalErrorExc extends IllegalArgumentException
- {
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 3258410621136614450L;
-
- public InternalErrorExc( String message, String[] args )
- {
- super( MessageFormat.format( message, args ) );
- }
-
- public InternalErrorExc( String message )
- {
- this( message, (String[])null );
- }
-
- public InternalErrorExc( String message, String arg )
- {
- this( message, new String[]{ arg } );
- }
- }
-
- /**
- * This class will be thrown if a user error occurs while parsing the command line.
- **/
- static public class Flag_error extends ErrorExc
- {
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 3832621776877663537L;
-
- public Flag_error( String message, String[] args )
- {
- super( message, args );
- }
-
- public Flag_error( String message, String arg )
- {
- super( message, new String[]{ arg } );
- }
-
- public Flag_error( String message )
- {
- super( message, null );
- }
- }
-
- /**
- * Tries to process a single flag on the command line.
- * @param args All the command line parameters.
- * @param arg_index This is the index of the argument that is to be processed.
- * @return returns true if the argument we are processing is a flag that has a
- * parameter and the parameter is specified in the next argument.
- **/
- private boolean process_arg( String[] args, int arg_index ) throws Flag_error
- {
- boolean processed_next_arg = false;
-
- if( args[arg_index].charAt(0) == '-' )
- {
- // This is the start of a flag.
- int flag_index = 1;
- int info_index = get_info_index( args[arg_index], flag_index );
- int max_index = get_max_index( args[arg_index], flag_index, info_index );
-
- if( flags_info[info_index][NAME_COL] != NO_PARM )
- {
- // This flag takes a parameter so check if it is stuck to this
- // arg.
- if( max_index < args[arg_index].length() )
- {
- add_flag_parm( info_index,
- args[arg_index].substring( max_index,
- args[arg_index].length() ) );
- }
- else
- {
- // This flag has a parameter and it wasn't stuck to the flag,
- // so we will try to get it from the next arg.
- if( arg_index+1 < args.length &&
- args[arg_index+1].charAt(0) != '-' )
- {
- // We found an parameter in the next string so we will use this
- // one as a parameter for this flag. Note: if was no parameter
- // after the flag at all, the error will be caught in the
- // check_rules method.
- add_flag_parm( info_index, args[arg_index+1] );
- processed_next_arg = true;
- }
- else
- {
- // Error missing paramater. This error is caught by check_rules.
- add_flag_parm( info_index, null );
- }
- }
- }
- else
- {
- // The flag does not have a parameter so we will add a null.
- add_flag_parm( info_index, null );
-
- // Check to see if a positional parameter is stuck to this flag.
- if( max_index < args[arg_index].length() )
- {
- add_positional( args[arg_index].substring( max_index,
- args[arg_index].length() ) );
- }
- }
- }
- else
- {
- // This is a positional parameter.
- add_positional( args[arg_index] );
- }
-
- return processed_next_arg;
- }
-
- /**
- * Finds the row for the flag that uniquely matched this flag str.
- * @return returns the flags_info index of the matching flag.
- **/
- private int get_info_index( String flag_str, int start_index )
- throws Flag_error
- {
- //int info_start = 1;
- //int info_end = flags_info.length;
- int info_index;
- int found_count = 0;
- int info_col_index = 0;
- int last_info_index = 0;
-
- BitSet flags_rejected = new BitSet();
-
- // Loop over each char in flag_str. Note: we will probably bail early.
- for( int flag_col_index = start_index; flag_col_index < flag_str.length(); flag_col_index++ )
- {
- // Loop over each flag in flag_info
- for( info_index = 0; info_index < flags_info.length; info_index++ )
- {
- String flagId = flags_info[info_index][FLAG_COL];
- String flagName = flagId == POSITIONAL ? POSITIONAL : flagMessages.getString( flagId );
-
- if( flags_rejected.get( info_index ) == false &&
- info_col_index < flagName.length() &&
- Character.toLowerCase(flag_str.charAt(flag_col_index)) ==
- flagName.charAt(info_col_index) )
- {
- found_count++;
- last_info_index = info_index;
- }
- else
- {
- flags_rejected.set( info_index );
- }
- }
-
- if( found_count == 1 )
- {
- // We have a match.
- return last_info_index;
- }
- else if( found_count == 0 )
- {
- // Flag not found at all.
- throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_FLAG_NOT_FOUND ),
- flag_str.substring( start_index ) );
- }
- else
- {
- // More than one flag was found with this char so we will go to the
- // next char to uniquely match it.
- info_col_index++;
- //info_start = last_info_index - found_count + 1;
- //info_end = last_info_index + 1;
- found_count = 0;
- }
- }
-
- // The only way to get to this code is if the loop exited with
- // the found_count greater than 1. Therefore, the flag specified is
- // ambiguous.
- throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_AMBIGUOUS_FLAG ),
- flag_str.substring( start_index) );
- }
-
- /**
- * This method tries to match as many characters as possible of the user
- * specified flag with the matched flag string.
- * @return returns the position of the last matching flag chararacter.
- **/
- private int get_max_index( String flag_str, int flag_start, int info_index )
- {
- int flag_col_index = flag_start;
- int info_col_index = 0;
-
- String info_str = flagMessages.getString( flags_info[info_index][FLAG_COL] );
-
- while( flag_col_index < flag_str.length() &&
- info_col_index < info_str.length() )
- {
- if( Character.toLowerCase( flag_str.charAt(flag_col_index) ) !=
- info_str.charAt(info_col_index) )
- break;
-
- flag_col_index++;
- info_col_index++;
- }
-
- return flag_col_index;
- }
-
- /**
- * Adds a positional parameter to flags_specified.
- **/
- private void add_positional( String positional_parm )
- {
- if( flags_specified[POSITIONAL_ROW] == null )
- flags_specified[POSITIONAL_ROW] = new Vector(3);
-
- flags_specified[POSITIONAL_ROW].add( positional_parm );
- }
-
- /**
- * Adds a flag and its parameter to flags_specified. If only the
- * flag was specified, then a null should be passed to flag_parm.
- **/
- private void add_flag_parm( int flag_index, String flag_parm )
- throws Flag_error
- {
- if( flags_info[flag_index][DUP_COL] == NO_DUPS &&
- flags_specified[flag_index] != null )
- throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED ),
- flagMessages.getString( flags_info[flag_index][FLAG_COL] ) );
-
- if( flags_specified[flag_index] == null )
- flags_specified[flag_index] = new Vector(3);
-
- flags_specified[flag_index].add( flag_parm );
- }
-
- /**
- * Checks that the user hasn't broken any command line rules.
- **/
- private void check_rules() throws Flag_error
- {
- // Check that all of the required positionals were specified.
- int positional_count = 0;
-
- if( flags_specified[POSITIONAL_ROW] != null )
- {
- positional_count = flags_specified[POSITIONAL_ROW].size();
- }
-
- if( required_positionals > positional_count )
- throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_MISSING_POSITIONAL ),
- flagMessages.getString( flags_info[required_positionals-1][NAME_COL] ) );
-
- else if( required_positionals < positional_count &&
- optional_positionals_allowed == false )
- throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_TOO_MANY_POSITIONALS ) );
-
- for( int row = 0; row < flags_info.length; row++ )
- {
- if( flags_info[row][FLAG_COL] == POSITIONAL ) continue;
-
- if( flags_specified[row] == null &&
- flags_info[row][REQUIRED_COL] == REQUIRED )
- throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_MISSING_REQUIRED_FLAG ),
- flagMessages.getString( flags_info[row][FLAG_COL] ) );
-
- int parm_count = 0;
-
- if( flags_specified[row] != null ) parm_count = flags_specified[row].size();
-
- // Check for too many flag parameters.
- if( flags_info[row][DUP_COL] == NO_DUPS && parm_count > 1 )
- throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED ),
- flagMessages.getString( flags_info[row][FLAG_COL] ) );
-
- // Check for missing flag parameter.
- if( parm_count > 0 && flags_info[row][NAME_COL] != NO_PARM )
- {
- for( int index = 0; index < flags_specified[row].size(); index++ )
- {
- if( flags_specified[row].elementAt(index) == null )
- throw new Flag_error( messages.getString( FlagMessages.PARSER_ERROR_MISSING_FLAG_PARAMETER ),
- new String[]
- { flagMessages.getString( flags_info[row][FLAG_COL] ),
- flagMessages.getString( flags_info[row][NAME_COL] ) } );
-
- }
- }
- }
- }
-
- /**
- * This method verifies that a proper flags_info string array was passed
- * to us by the programmer.
- **/
- private void verify_flags_info() throws InternalErrorExc
- {
- boolean done_positionals = false;
- boolean help_specified = false;
-
- required_positionals = 0;
- optional_positionals_allowed = false;
- optional_list_index = -1;
- max_flag_size = 0;
- max_name_size = 0;
-
- if( flags_info == null || flags_info.length == 0 )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_NO_FLAGS_DATA_SPECIFIED ) );
-
- if( flags_info[POSITIONAL_ROW] != null &&
- flags_info[POSITIONAL_ROW].length > 0 &&
- flags_info[POSITIONAL_ROW][FLAG_COL] != POSITIONAL )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_FIRST_FLAG_NOT_POSITIONAL ) );
-
- for( int row = 0; row < flags_info.length; row++ )
- {
- if( flags_info[row] == null )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_NULL_FLAG_ROW ) );
-
- if( flags_info[row].length != 5 )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_INCORRECT_ROW_SIZE ) );
-
- if( flags_info[row][FLAG_COL] == null ||
- flags_info[row][NAME_COL] == null ||
- flags_info[row][HELP_COL] == null )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_NULL_IN_ROW ) );
-
- if( flags_info[row][FLAG_COL].equals( help_flag ) ) help_specified = true;
-
- String flagId = flags_info[row][FLAG_COL];
- String nameId = flags_info[row][NAME_COL];
-
- String flag_col = flagId == POSITIONAL ? POSITIONAL : flagMessages.getString( flagId );
- String name_col = nameId == NO_PARM ? NO_PARM : flagMessages.getString( nameId );
-
- if( flag_col.length() > max_flag_size )
- max_flag_size = flag_col.length();
-
- if( name_col != NO_PARM && name_col.length() > max_name_size )
- max_name_size = name_col.length();
-
- // Ensure that flags are all in lowercase.
- if( !flag_col.equals( flag_col.toLowerCase() ) )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_FLAG_NOT_LOWERCASE ),
- flag_col );
-
- // Ensure that only the predefined dup strings are used.
- // Note: it's ok to use != when comparing constant strings literals.
- if( flags_info[row][DUP_COL] == null ||
- ( flags_info[row][DUP_COL] != NO_DUPS &&
- flags_info[row][DUP_COL] != DUPS_OK ) )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_INCORRECT_DUP_STRING ),
- flags_info[row][DUP_COL] );
-
- // Ensure that only the predefined required strings are used.
- if( flags_info[row][REQUIRED_COL] == null ||
- ( flags_info[row][REQUIRED_COL] != REQUIRED &&
- flags_info[row][REQUIRED_COL] != OPTIONAL ) )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_INCORRECT_REQUIRED_STRING ),
- flags_info[row][REQUIRED_COL] );
-
- // Count the number of required positionals.
- if( flags_info[row][FLAG_COL] == POSITIONAL )
- {
- if( flags_info[row][REQUIRED_COL] == REQUIRED )
- {
- if( flags_info[row][NAME_COL] == NO_PARM )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_REQUIRED_POSITIONAL_NEEDS_NAME ) );
-
- required_positionals++;
- }
- else if( flags_info[row][NAME_COL] != NO_PARM )
- {
- // We use the NAME_COL field for an optional positional to denote
- // whether additional positionals are allowed or not.
- optional_positionals_allowed = true;
- optional_list_index = row;
- }
- }
-
- // Ensure that positionals are at the beginning of the info.
- if( flags_info[row][FLAG_COL] != POSITIONAL ||
- ( done_positionals == false &&
- flags_info[row][FLAG_COL] == POSITIONAL &&
- flags_info[row][REQUIRED_COL] == OPTIONAL ) )
- {
- done_positionals = true;
- }
- else if( done_positionals == true )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_POSITIONAL_NOT_AT_BEGINNING ) );
- }
-
- // Ensure that a help flag was specified in the info list.
- if( help_specified == false )
- throw new InternalErrorExc( messages.getString( FlagMessages.PARSER_ERROR_HELP_FLAG_NOT_SPECIFIED ) );
- }
-
- /**
- * This method is used to dump internal information about a parsed
- * command line.
- **/
- public String toString()
- {
- StringBuffer b = new StringBuffer(100);
-
- for( int row = 0; row < flags_info.length; row++ )
- {
- b.append( "\n" );
-
- if( flags_info[row][FLAG_COL] == POSITIONAL )
- b.append( "Positional:" );
- else
- b.append( flagMessages.getString( flags_info[row][FLAG_COL] ) + ":" );
-
-
- if( flags_specified[row] == null )
- b.append( "no parameters" );
- else
- for( int parm_index = 0; parm_index < flags_specified[row].size(); parm_index++ )
- {
- String parm = (String)flags_specified[row].elementAt(parm_index);
- b.append( parm + ":" );
- }
- b.append( "\n" );
- }
-
- return ""+b;
- }
-
- private static final int FLAG_COL = 0;
- private static final int NAME_COL = 1;
- private static final int DUP_COL = 2;
- private static final int REQUIRED_COL = 3;
- private static final int HELP_COL = 4;
-
- private static final int POSITIONAL_ROW = 0;
- private static final int HELP_LINE_LEN = 75;
-
- private String[][] flags_info;
- private String help_flag;
- private String tool_name;
- private Vector[] flags_specified;
- private int required_positionals;
- private boolean optional_positionals_allowed;
- private int optional_list_index;
- private int max_flag_size;
- private int max_name_size;
-
- protected ResourceBundle messages;
- private ResourceBundle flagMessages;
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/FlagMessages.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/FlagMessages.java
deleted file mode 100644
index 1c56797c7..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/FlagMessages.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.command.internal.env.commandline;
-
-/**
- * This class is used to store constant string error messages
- * generated by CommandLine.java
- *
- *
- * @author Peter Moogk
- * @date July 13, 2000
- * @see org.eclipse.wst.command.internal.env.commandline.CommandLine
-**/
-
-public final class FlagMessages
-{
-
- public static final String PARSER_ERROR_FLAG_NOT_FOUND = "PARSER_ERROR_FLAG_NOT_FOUND";
-
- public static final String PARSER_ERROR_AMBIGUOUS_FLAG = "PARSER_ERROR_AMBIGUOUS_FLAG";
-
- public static final String PARSER_ERROR_MISSING_POSITIONAL = "PARSER_ERROR_MISSING_POSITIONAL";
-
- public static final String PARSER_ERROR_TOO_MANY_POSITIONALS = "PARSER_ERROR_TOO_MANY_POSITIONALS";
-
- public static final String PARSER_ERROR_MISSING_REQUIRED_FLAG = "PARSER_ERROR_MISSING_REQUIRED_FLAG";
-
- public static final String PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED = "PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED";
-
- public static final String PARSER_ERROR_MISSING_FLAG_PARAMETER = "PARSER_ERROR_MISSING_FLAG_PARAMETER";
-
- // Error internal error messages.
- public static final String PARSER_ERROR_MESSAGE_MISSING_ARG = "PARSER_ERROR_MESSAGE_MISSING_ARG";
-
- // Internal command line error messages.
- public static final String PARSER_ERROR_NO_FLAGS_DATA_SPECIFIED = "PARSER_ERROR_NO_FLAGS_DATA_SPECIFIED";
-
- public static final String PARSER_ERROR_FIRST_FLAG_NOT_POSITIONAL = "PARSER_ERROR_FIRST_FLAG_NOT_POSITIONAL";
-
- public static final String PARSER_ERROR_NULL_FLAG_ROW = "PARSER_ERROR_NULL_FLAG_ROW";
-
- public static final String PARSER_ERROR_INCORRECT_ROW_SIZE = "PARSER_ERROR_INCORRECT_ROW_SIZE";
-
- public static final String PARSER_ERROR_NULL_IN_ROW = "PARSER_ERROR_NULL_IN_ROW";
-
- public static final String PARSER_ERROR_INCORRECT_DUP_STRING = "PARSER_ERROR_INCORRECT_DUP_STRING";
-
- public static final String PARSER_ERROR_INCORRECT_REQUIRED_STRING = "PARSER_ERROR_INCORRECT_REQUIRED_STRING";
-
- public static final String PARSER_ERROR_POSITIONAL_NOT_AT_BEGINNING = "PARSER_ERROR_POSITIONAL_NOT_AT_BEGINNING";
-
- public static final String PARSER_ERROR_HELP_FLAG_NOT_SPECIFIED = "PARSER_ERROR_HELP_FLAG_NOT_SPECIFIED";
-
- public static final String PARSER_ERROR_FLAGS_NOT_ORDERED = "PARSER_ERROR_FLAGS_NOT_ORDERED";
-
- public static final String PARSER_ERROR_FLAG_NOT_LOWERCASE = "PARSER_ERROR_FLAG_NOT_LOWERCASE";
-
- public static final String PARSER_ERROR_REQUIRED_POSITIONAL_NEEDS_NAME = "PARSER_ERROR_REQUIRED_POSITIONAL_NEEDS_NAME";
-
- public static final String PARSER_INFO_SYNTAX = "PARSER_SYNTAX";
-
- public static final String PARSER_FLAGS = "PARSER_FLAGS";
-
- public static final String PARSER_INFO_WHERE = "PARSER_WHERE";
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/commandline.properties b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/commandline.properties
deleted file mode 100644
index 78529810d..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/commandline/commandline.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 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
-###############################################################################
-
-PARSER_ERROR_FLAG_NOT_FOUND=IWAB0123E Flag -{0} is not valid.
-PARSER_ERROR_AMBIGUOUS_FLAG=IWAB0284E Flag -{0} is ambiguous.
-PARSER_ERROR_MISSING_POSITIONAL=IWAB0285E Missing {0} parameter.
-PARSER_ERROR_TOO_MANY_POSITIONALS=IWAB0286E Too many positional parameters specified.
-PARSER_ERROR_MISSING_REQUIRED_FLAG=IWAB0288E Flag -{0} is missing.
-PARSER_ERROR_DUPLICATE_FLAGS_NOT_ALLOWED=IWAB0293E Flag -{0} has been specified more than once.
-PARSER_ERROR_MISSING_FLAG_PARAMETER=IWAB0294E Flag -{0} is missing parameter {1}.
-PARSER_ERROR_MESSAGE_MISSING_ARG=IWAB0319E Error message {0} is missing an argument.
-PARSER_ERROR_NO_FLAGS_DATA_SPECIFIED=IWAB0345E Specify flag information.
-PARSER_ERROR_FIRST_FLAG_NOT_POSITIONAL=IWAB0346E The first flag must be positional.
-PARSER_ERROR_NULL_FLAG_ROW=IWAB0347E Null flag row.
-PARSER_ERROR_INCORRECT_ROW_SIZE=IWAB0348E Flag row must have 5 strings.
-PARSER_ERROR_NULL_IN_ROW=IWAB0349E Flag information contains a null string.
-PARSER_ERROR_INCORRECT_DUP_STRING=IWAB0350E Duplicate string {0} is not valid.
-PARSER_ERROR_INCORRECT_REQUIRED_STRING=IWAB0351E Required string {0} is not valid.
-PARSER_ERROR_POSITIONAL_NOT_AT_BEGINNING=IWAB0352E Positional flag is not at the beginning.
-PARSER_ERROR_HELP_FLAG_NOT_SPECIFIED=IWAB0353E Help flag is not specified in information array.
-PARSER_ERROR_FLAGS_NOT_ORDERED=IWAB0354E Flags are not in lexical order.
-PARSER_ERROR_FLAG_NOT_LOWERCASE=IWAB0355E Flag {0} is not lowercase.
-PARSER_ERROR_REQUIRED_POSITIONAL_NEEDS_NAME=IWAB0356E Required positional parameters must have a name specified.
-PARSER_SYNTAX=Syntax
-PARSER_FLAGS=Flags
-PARSER_WHERE=Where
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/ClassPath.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/ClassPath.java
deleted file mode 100644
index fa1923e7b..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/ClassPath.java
+++ /dev/null
@@ -1,90 +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.command.internal.env.common;
-
-import java.io.File;
-
-/**
- *
- * The class provides and easy way to build classpaths.
- *
- */
-public class ClassPath
-{
- private StringBuffer path = new StringBuffer();
-
- /**
- *
- * @param newPath appends this new path to the end of the classpath.
- */
- public void appendPath( String newPath )
- {
- // No value to put on path, so just return
- if( newPath.equals( "" ) ) return;
-
- // If this is the first path in the string then we don't need a path
- // separator.
- if( path.length() == 0 )
- {
- path.append( newPath );
- }
- else
- {
- path.append( File.pathSeparatorChar + newPath );
- }
- }
-
- /**
- * This method appends all jar and zip files in a particular directory to
- * the classpath.
- *
- * @param directory specifies a directory contains jar and zip files.
- */
- public void appendDir( String directory )
- {
- File dir = new File( directory );
-
- if( !dir.isDirectory() ) return;
-
- File[] files = dir.listFiles();
-
- for( int index = 0; index < files.length; index++ )
- {
- File file = files[index];
- String name = file.getName();
-
- if( file.isFile() &&
- ( name.endsWith( ".jar" ) ||
- name.endsWith( ".zip" ) ) )
- {
- appendPath( file.getAbsolutePath() );
- }
-
- }
- }
-
- /**
- *
- * @param newPath appends a new classpath to the end of this classpath.
- */
- public void appendPath( ClassPath newPath )
- {
- appendPath( newPath.path.toString() );
- }
-
- /**
- * @return returns the full string classpath with separators.
- */
- public String toString()
- {
- return path.toString();
- }
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceOutputStream.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceOutputStream.java
deleted file mode 100644
index 0960ac613..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceOutputStream.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.command.internal.env.common;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
-import org.eclipse.wst.common.environment.IStatusHandler;
-
-
-
-/**
-* This class defines an output stream that writes to an
-* {@link org.eclipse.core.resources.IFile IFile}.
-*/
-public class FileResourceOutputStream extends OutputStream
-{
-
- IPath fFilePath;
- ResourceContext fResourceContext;
- IProgressMonitor fMonitor;
- IStatusHandler fStatusHandler;
- ByteArrayOutputStream fByteArrayOutputStream;
- boolean fOpen;
-
- /**
- * Constructs an output stream that can be used to write to the
- * given <code>file</code>. The workspace is neither examined nor
- * altered during construction. All resource creation is deferred
- * until later in the stream's lifecycle, such as during writing
- * or closure.
- * <b>Note:</b> The preferred mechanism for creating a stream that
- * writes to an IFile is to call the static factory method
- * {@link FileResourceUtils#newFileOutputStream FileResourceUtils.newFileOutputStream()}
- * and work with the resulting <code>OutputStream</code>.
- * Direct construction of a FileResourceOutputStream is not recommended.
- * @param file The {@link org.eclipse.core.resources.IFile IFile}
- * handle of the file resource to create. The project implied by the
- * pathname of the file must already exist,
- * that is, this method cannot be used to create projects.
- * @param progressMonitor The progress monitor for the operation, or null.
- */
- public FileResourceOutputStream (
- ResourceContext resourceContext,
- IPath filePath,
- IProgressMonitor monitor,
- IStatusHandler statusHandler
- )
- {
- fFilePath = filePath;
- fResourceContext = resourceContext;
- fMonitor = monitor;
- fStatusHandler = statusHandler;
- fByteArrayOutputStream = new ByteArrayOutputStream();
- fOpen = true;
- }
-
- /**
- * Closes the stream.
- * @throws IOException If an error occurs while closing the stream.
- * For example, if this stream was constructed with overwriteFile = false
- * and a file of the same name already exists, then an IOException will
- * be thrown either now or during an earlier {@link #write write}.
- */
- public void close ()
- throws IOException
- {
- if (!fOpen) return;
- fOpen = false;
- fByteArrayOutputStream.close();
- byte[] buffer = fByteArrayOutputStream.toByteArray();
- ByteArrayInputStream tempInputStream = new ByteArrayInputStream(buffer);
- try
- {
- FileResourceUtils.createFile(fResourceContext, fFilePath, tempInputStream, fMonitor, fStatusHandler);
- }
- catch (CoreException e)
- {
- throw new IOException(e.getMessage());
- }
- }
-
- /**
- * Flushes the stream. This does not imply the File resource
- * will be created or become visible within the workbench.
- * @throws IOException If an error occurs. For example, if this
- * stream was constructed with overwriteFile = false and a file of the
- * same name already exists, then an IOException may be thrown at
- * this point.
- */
- public void flush ()
- throws IOException
- {
- fByteArrayOutputStream.flush();
- }
-
- /**
- * Writes all bytes from the given array to the stream.
- * @param b The array of bytes to write.
- * @throws IOException If an error occurs. For example, if this
- * stream was constructed with overwriteFile = false and a file of the
- * same name already exists, then an IOException may be thrown at
- * this point.
- */
- public void write ( byte[] b )
- throws IOException
- {
- fByteArrayOutputStream.write(b);
- }
-
- /**
- * Writes bytes from the given array beginning at some offset
- * and continuing for some number of bytes (len) to the stream.
- * @param b The array of bytes to write.
- * @param off The offset into the array to begin writing.
- * @param len The number of bytes to write.
- * @throws IOException If an error occurs. For example, if this
- * stream was constructed with overwriteFile = false and a file of the
- * same name already exists, then an IOException may be thrown at
- * this point.
- */
- public void write ( byte[] b, int off, int len )
- {
- fByteArrayOutputStream.write(b,off,len);
- }
-
- /**
- * Writes a single byte to the stream.
- * @param b The byte to write.
- * @throws IOException If an error occurs. For example, if this
- * stream was constructed with overwriteFile = false and a file of the
- * same name already exists, then an IOException may be thrown at
- * this point.
- */
- public void write ( int b )
- {
- fByteArrayOutputStream.write(b);
- }
-}
-
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java
deleted file mode 100644
index 81142a30e..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java
+++ /dev/null
@@ -1,778 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060112 121199 jesper@selskabet.org - Jesper Møller
- *******************************************************************************/
-package org.eclipse.wst.command.internal.env.common;
-
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.command.internal.env.EnvironmentMessages;
-import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
-import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
-import org.eclipse.wst.common.environment.Choice;
-import org.eclipse.wst.common.environment.IStatusHandler;
-import org.eclipse.wst.common.environment.StatusException;
-
-
-
-/**
-* This class contains useful methods for working with Eclipse resources.
-*/
-public final class FileResourceUtils
-{
- //
- // Keeps the IWorkspace hanging around. See getWorkspace().
- //
- private static IWorkspace workspace_ = null;
- //
- // Keeps the IWorkspaceRoot hanging around. See getWorkspaceRoot().
- //
- private static IWorkspaceRoot root_ = null;
-
-// private static MessageUtils msg_ = new MessageUtils( "org.eclipse.wst.command.internal.env.common.environment", new FileResourceUtils() );
-
-
- /**
- * Returns the IWorkspaceRoot object.
- * @return The IWorkspaceRoot object.
- */
- public static IWorkspaceRoot getWorkspaceRoot ()
- {
- if (root_ == null)
- {
- root_ = ResourcesPlugin.getWorkspace().getRoot();
- }
- return root_;
- }
-
- /**
- * Returns the IWorkspace object.
- *
- * @return The IWorkspace object.
- */
- public static IWorkspace getWorkspace ()
- {
- if (workspace_ == null)
- {
- if (root_ == null)
- {
- root_ = ResourcesPlugin.getWorkspace().getRoot();
- }
-
- workspace_ = root_.getWorkspace();
- }
-
- return workspace_;
- }
-
- /**
- *
- * @return returns an array of three common choices. (ie. Yes, yes all, and cancel )
- */
- public static Choice[] getThreeStateFileOptions()
- {
- Vector choices = new Vector();
-
- choices.add(new Choice( 'Y', EnvironmentMessages.LABEL_YES));
- choices.add(new Choice( 'A', EnvironmentMessages.LABEL_YES_TO_ALL));
- choices.add(new Choice( 'C', EnvironmentMessages.LABEL_CANCEL));
-
- return (Choice[])choices.toArray(new Choice[choices.size()]);
- }
-
- /**
- * Returns an
- * {@link org.eclipse.core.resources.IResource IResource}
- * of the given absolute pathname or null if no such resource exists.
- * @param absolutePathname The absolute path of the resource.
- * @return The <code>IResource</code>.
- */
- public static IResource findResource ( String absolutePathname )
- {
- if (absolutePathname == null)
- {
- return null;
- }
-
- return findResource(new Path(absolutePathname));
- }
-
- /**
- * Returns an
- * {@link org.eclipse.core.resources.IResource IResource}
- * of the given absolute path or null if no such resource exists.
- * @param absolutePath The absolute <code>IPath</code> of the resource.
- * @return The <code>IResource</code>.
- */
- public static IResource findResource ( IPath absolutePath )
- {
- if (absolutePath == null)
- {
- return null;
- }
-
- return FileResourceUtils.getWorkspaceRoot().findMember(absolutePath);
- }
-
- /**
- * Copies a file from a plugin's installation location
- * to an Eclipse folder.
- * @param plugin The plugin containing the files to copy.
- * Must not be null.
- * @param sourcePath The path, relative to the <code>plugin</code>
- * install location, containing the files to copy.
- * If null, then the plugin install location is the source path
- * (ie. null is equivalent to ".").
- * @param pathname The pathname of the file to copy.
- * The pathname is relative to the <code>plugin sourcePath</code>.
- * Must not be null.
- * @param targetPath The absolute Eclipse path of the folder to
- * which the file will be copied. The relative pathname of the
- * file is preserved.
- * Must not be null.
- * @param createFolders The intermediate folder creation policy, one of
- * {@link #CREATE CREATE} or {@link #DONT_CREATE DONT_CREATE}.
- * <ul>
- * <li><code>CREATE</code> -
- * If any intermediate folders in the given <code>absolutePath</code>
- * do not exist, they will be created.
- * <li><code>DONT_CREATE</code> -
- * If any intermediate folders in the given <code>absolutePath</code>
- * do not exist, the method will throw a <code>CoreException</code>.
- * </ul>
- * @param overwriteFile The policy for existing files, one of
- * {@link #OVERWRITE OVERWRITE} or {@link #DONT_OVERWRITE DONT_OVERWRITE}.
- * <ul>
- * <li><code>OVERWRITE</code> -
- * If a resource of the same name as the given
- * <code>absolutePath</code> already exists and is a file,
- * it will be replaced.
- * If the resource already exists and it is not a file,
- * then no file will be created and
- * a <code>CoreException</code> will be thrown.
- * <li><code>DONT_OVERWRITE</code> -
- * If any resource of the same name as the given
- * <code>absolutePath</code> already exists,
- * then no file will be created and
- * a <code>CoreException</code> will be thrown.
- * </ul>
- * @param progressMonitor The progress monitor for the operation, or null.
- * @throws CoreException An exception containing an
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * with a severity of <code>IStatus.ERROR</code> and a
- * locale-specific description of the cause.
- */
- static public void copyFile( ResourceContext resourceContext,
- Plugin plugin,
- IPath sourcePath,
- IPath pathname,
- IPath targetPath,
- IProgressMonitor progressMonitor,
- IStatusHandler statusMonitor )
- throws CoreException
- {
- try
- {
- IPath target = targetPath.append(pathname);
- IPath source = sourcePath == null ? pathname : sourcePath.append(pathname);
- InputStream input = plugin.openStream(source);
- createFile(resourceContext, target, input, progressMonitor, statusMonitor);
- }
- catch (IOException e)
- {
- throw new CoreException(new Status(IStatus.ERROR,
- plugin.getBundle().getSymbolicName(),
- 0,
- EnvironmentMessages.MSG_ERROR_IO,e));
- }
- }
-
- /**
- * Deletes a file under a container.
- * The container must already exist.
- * @param file - the IFile to be deleted
- * @param progressMonitor
- * @param statusMonitor
- * @return True if the file does not exist or if it exists and is successfully deleted. False otherwise.
- */
- public static boolean deleteFile( ResourceContext resourceContext,
- IFile file,
- IProgressMonitor progressMonitor,
- IStatusHandler statusMonitor)
- throws CoreException
- {
- if (file.exists())
- {
- if (!resourceContext.isOverwriteFilesEnabled())
- {
- IStatus status
- = StatusUtils.warningStatus( NLS.bind(EnvironmentMessages.MSG_ERROR_FILE_OVERWRITE_DISABLED,
- new Object[]{ file.getParent().getFullPath().toString(),
- file.getName()}) );
-
-
- Choice choice = statusMonitor.report( status, getThreeStateFileOptions() );
-
- if( choice.getShortcut() == 'C' ) return false;
-
- if( choice.getShortcut() == 'A' ) resourceContext.setOverwriteFilesEnabled(true);
- }
-
- //We have permission to overwrite so check if file is read-only
- if (file.isReadOnly())
- {
- if (!resourceContext.isCheckoutFilesEnabled())
- {
- IStatus status
- = StatusUtils.warningStatus( NLS.bind(EnvironmentMessages.MSG_ERROR_FILE_CHECKOUT_DISABLED,
- new Object[]{ file.getParent().getFullPath().toString(),
- file.getName()}) );
-
- Choice choice = statusMonitor.report( status, getThreeStateFileOptions() );
-
- if( choice.getShortcut() == 'C' ) return false;
-
- if( choice.getShortcut() == 'A' ) resourceContext.setCheckoutFilesEnabled(true);
- }
-
- IFile[] files = new IFile[1];
- files[0] = file;
- IStatus status = getWorkspace().validateEdit(files, null);
-
- if( status.getSeverity() == IStatus.ERROR )
- {
- statusMonitor.reportError( status );
- return false;
- }
- }
-
- file.delete(true, null);
- }
- //At this point, either the file did not exist or we successfully deleted
- // it. Return success.
- return true;
- }
-
- /**
- * Deletes a folder under a container.
- * @param folder - the IFolder to be deleted
- * @param progressMonitor
- * @param statusMonitor
- * @return True if the folder does not exist or if it exists and is successfully deleted along with its members. False otherwise.
- */
- public static boolean deleteFolder( ResourceContext resourceContext,
- IFolder folder,
- IProgressMonitor progressMonitor,
- IStatusHandler statusMonitor )
- throws CoreException
- {
- if (!folder.exists()) return true;
-
- boolean deleted = true;
- IResource[] resources = folder.members();
-
- for (int i=0; i<resources.length; i++)
- {
- IResource resource = resources[i];
- if (resource instanceof IFile)
- {
- deleted = deleteFile(resourceContext, (IFile)resource, progressMonitor, statusMonitor);
- }
- if (resource instanceof IFolder)
- {
- deleted = deleteFolder( resourceContext, (IFolder)resource, progressMonitor, statusMonitor);
- }
-
- if( !deleted ) break;
- }
-
- if( deleted )
- {
- folder.delete(true, true, null);
- return true;
- }
- else
- return false;
- }
-
- /**
- * Creates a file of the given <code>absolutePath</code>
- * and returns its handle as an <code>IFile</code>.
- * If the file cannot be created, a
- * <code>CoreException</code> containing an
- * <code>IStatus</code> object is thrown.
- * @param absolutePath The absolute path of the file to create.
- * The project at the beginning of the path must already exist,
- * that is, this method cannot be used to create projects.
- * @param progressMonitor The progress monitor for the operation, or null.
- * @return The {@link org.eclipse.core.resources.IFile IFile}
- * handle of the file.
- * @throws CoreException An exception containing an
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * with a severity of <code>IStatus.ERROR</code> and a
- * locale-specific description of the cause.
- */
- public static IFile createFile (
- ResourceContext resourceContext,
- IPath absolutePath,
- InputStream inputStream,
- IProgressMonitor progressMonitor,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- if (!absolutePath.isAbsolute())
- {
- throw new CoreException(new Status(IStatus.ERROR, "ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_NOT_ABSOLUTE,new Object[] {absolutePath.toString()}),null));
- }
- if (absolutePath.segmentCount() < 1)
- {
- throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_EMPTY,new Object[] {absolutePath.toString()}),null));
- }
- if (absolutePath.segmentCount() < 2)
- {
- throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_NOT_FOLDER,new Object[] {absolutePath.toString()}),null));
- }
- IContainer parent = makeFolderPath(resourceContext, absolutePath.removeLastSegments(1), progressMonitor, statusHandler);
- String fileName = absolutePath.lastSegment();
-
- return makeFile(resourceContext, parent, fileName, inputStream, progressMonitor, statusHandler);
- }
-
- /**
- * Creates under the given <code>project</code>
- * a file of the given <code>relativePath</code>
- * and returns its handle as an <code>IFile</code>.
- * If the file cannot be created, a
- * <code>CoreException</code> containing an
- * <code>IStatus</code> object is thrown.
- * @param absolutePath The absolute path of the file to create.
- * The project at the beginning of the path must already exist,
- * that is, this method cannot be used to create projects.
- * @param createFolders The intermediate folder creation policy, one of
- * {@link #CREATE CREATE} or {@link #DONT_CREATE DONT_CREATE}.
- * <ul>
- * <li><code>CREATE</code> -
- * If any intermediate folders in the given <code>absolutePath</code>
- * do not exist, they will be created.
- * <li><code>DONT_CREATE</code> -
- * If any intermediate folders in the given <code>absolutePath</code>
- * do not exist, the method will throw a <code>CoreException</code>.
- * </ul>
- * @param overwriteFile The policy for existing files, one of
- * {@link #OVERWRITE OVERWRITE} or {@link #DONT_OVERWRITE DONT_OVERWRITE}.
- * <ul>
- * <li><code>OVERWRITE</code> -
- * If a resource of the same name as the given
- * <code>absolutePath</code> already exists and is a file,
- * it will be replaced.
- * If the resource already exists and it is not a file,
- * then no file will be created and
- * a <code>CoreException</code> will be thrown.
- * <li><code>DONT_OVERWRITE</code> -
- * If any resource of the same name as the given
- * <code>absolutePath</code> already exists,
- * then no file will be created and
- * a <code>CoreException</code> will be thrown.
- * </ul>
- * @param progressMonitor The progress monitor for the operation, or null.
- * @return The {@link org.eclipse.core.resources.IFile IFile}
- * handle of the file.
- * @throws CoreException An exception containing an
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * with a severity of <code>IStatus.ERROR</code> and a
- * locale-specific description of the cause.
- */
- public static IFile createFile (
- ResourceContext resourceContext,
- IProject project,
- IPath relativePath,
- InputStream inputStream,
- IProgressMonitor progressMonitor,
- IStatusHandler statusMonitor )
-
- throws CoreException
- {
- IPath absolutePath = project.getFullPath().append(relativePath);
- return createFile(resourceContext, absolutePath, inputStream, progressMonitor, statusMonitor);
- }
-
- /**
- * Creates an output stream that can be used to write to the
- * given <code>file</code>. Actual changes to the workspace
- * may occur during creation of the stream, while writing to
- * the stream, or when the stream is closed.
- * A <code>CoreException</code> containing
- * an <code>IStatus</code> will be thrown
- * at some point in the lifecycle of the stream
- * if the file resource cannot be created.
- * @param file The {@link org.eclipse.core.resources.IFile IFile}
- * handle of the file resource to create. The project implied by the
- * pathname of the file must already exist,
- * that is, this method cannot be used to create projects.
- * @param progressMonitor The progress monitor for the operation, or null.
- * @return An <code>OutputStream</code> tied to the file resource.
- * Actual checks of or changes to the workspace may occur as early during
- * stream creation, closure, or any time in between.
- * @throws CoreException An exception containing an
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * with a severity of <code>IStatus.ERROR</code> and a
- * locale-specific description of the cause.
- * Reasons include:
- * <ol>
- * <li>The project of the given file's path does not exist.
- * <li>A non-file resource of the same name of the given file
- * already exists.
- * <li>A file resource of the same name of the given file
- * already exists, and <code>overwriteFile</code> is false.
- * <li>One or more intermediate folders to the given file
- * do not exist, and <code>createFolders</code> is false.
- * </ol>
- */
-
- public static OutputStream newFileOutputStream (
- ResourceContext context,
- IPath file,
- IProgressMonitor progressMonitor,
- IStatusHandler statusHandler )
-
- {
- return new FileResourceOutputStream(context, file, progressMonitor, statusHandler);
- }
-
- //----------------------------------------------------------------------
- // Naughty bits...
- //----------------------------------------------------------------------
-
- //
- // Creates a path of folders.
- // Do not call with an absolutePath of less than one segment.
- //
- /**
- * Creates a path of folders.
- * Do not call with an absolutePath of less than one segment.
- * @param resourceContext the resource context for making folders.
- * @param absolutePath the path of folders that will be created.
- * @param progressMonitor the progress monitor to be used.
- * @param statusHandler the status handler.
- * @return returns the IContainer of the created folder.
- */
- public static IContainer makeFolderPath (
- ResourceContext resourceContext,
- IPath absolutePath,
- IProgressMonitor progressMonitor,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- if (absolutePath.segmentCount() <= 1)
- {
- return getWorkspaceRoot().getProject(absolutePath.segment(0));
- }
- else
- {
- IContainer parent = makeFolderPath(resourceContext, absolutePath.removeLastSegments(1), progressMonitor, statusHandler );
- String folderName = absolutePath.lastSegment();
-
- return makeFolder(resourceContext, parent,folderName, progressMonitor , statusHandler );
- }
- }
- //
- // Creates a folder under a container.
- // The container must already exist.
- //
- private static IFolder makeFolder (
- ResourceContext resourceContext,
- IContainer parent,
- String folderName,
- IProgressMonitor progressMonitor,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- IResource child = parent.findMember(folderName);
- Choice result = null;
-
- if( child == null )
- {
- if (!resourceContext.isCreateFoldersEnabled())
- {
- result = statusHandler.report(
- StatusUtils.warningStatus(
- NLS.bind(EnvironmentMessages.MSG_ERROR_FOLDER_CREATION_DISABLED,
- new Object[]{ parent.getFullPath().toString(), folderName} ) ),
- getThreeStateFileOptions() );
-
- if( result == null || result.getShortcut() == 'C' )
- {
- return null;
- }
- else if( result.getShortcut() == 'A' )
- {
- resourceContext.setCreateFoldersEnabled(true);
- }
- }
-
- IFolder folder = parent.getFolder(new Path(folderName));
- folder.create(true,true,null);
- return folder;
- }
- else if( child.getType() == IResource.FOLDER )
- {
- return (IFolder)child;
- }
- else
- {
- throw new CoreException(
- new Status( IStatus.ERROR,
- "ResourceUtils",
- 0,
- NLS.bind(EnvironmentMessages.MSG_ERROR_RESOURCE_NOT_FOLDER,
- new Object[]{ parent.getFullPath().append(folderName).toString() }),
- null ) );
- }
- }
-
- //
- // Creates a file under a container.
- // The container must already exist.
- //
- private static IFile makeFile (
- ResourceContext resourceContext,
- IContainer parent,
- String fileName,
- InputStream inputStream,
- IProgressMonitor progressMonitor,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- IResource child = parent.findMember(fileName);
- Choice result = null;
-
- if( child != null )
- {
- if( child.getType() == IResource.FILE )
- {
- if( !resourceContext.isOverwriteFilesEnabled() )
- {
- result = statusHandler.report(
- StatusUtils.warningStatus( NLS.bind(EnvironmentMessages.MSG_ERROR_FILE_OVERWRITE_DISABLED,
- new Object[] {parent.getFullPath().toString(),fileName}) ),
- getThreeStateFileOptions() );
-
- if( result == null || result.getShortcut() == 'C' )
- {
- return null;
- }
- else if( result.getShortcut() == 'A' )
- {
- resourceContext.setOverwriteFilesEnabled(true);
- }
- }
-
- //We have permission to overwrite so check if file is read-only
- if( child.getResourceAttributes().isReadOnly() )
- {
- if( !resourceContext.isCheckoutFilesEnabled() )
- {
- result = statusHandler.report(
- StatusUtils.errorStatus( NLS.bind(EnvironmentMessages.MSG_ERROR_FILE_CHECKOUT_DISABLED,
- new Object[]{ parent.getFullPath().toString(),fileName} ) ),
- getThreeStateFileOptions() );
-
- if( result == null || result.getShortcut() == 'C' )
- {
- return null;
- }
- else if( result.getShortcut() == 'A' )
- {
- resourceContext.setCheckoutFilesEnabled(true);
- }
- }
-
- IFile[] files = new IFile[1];
- files[0] = (IFile)child;
-
- IStatus status = getWorkspace().validateEdit(files,null);
-
- try
- {
- statusHandler.report( status );
- }
- catch( StatusException exc )
- {
- return null;
- }
- }
-
- //Change the contents of the existing file.
- IFile file = parent.getFile( new Path(fileName) );
- file.setContents( inputStream, true, true, null );
-
- return file;
-
- }
- else
- {
- throw new CoreException(
- new Status( IStatus.ERROR,
- "ResourceUtils",
- 0,
- NLS.bind(EnvironmentMessages.MSG_ERROR_RESOURCE_NOT_FILE,
- new Object[] {parent.getFullPath().append(fileName)}),
- null ) );
- }
- }
- else
- {
- //Create a new file.
- IFile file = parent.getFile( new Path(fileName) );
- file.create( inputStream, true, null);
-
- return file;
- }
- }
-
-
- /**
- * Creates a file of the given <code>absolutePath</code>
- * and returns its handle as an <code>IFile</code>.
- * If the file cannot be created, a
- * <code>CoreException</code> containing an
- * <code>IStatus</code> object is thrown.
- * @param absolutePath The absolute path of the file to create.
- * The project at the beginning of the path must already exist,
- * that is, this method cannot be used to create projects.
- * @param progressMonitor The progress monitor for the operation, or null.
- * @return The {@link org.eclipse.core.resources.IFile IFile}
- * handle of the file.
- * @throws CoreException An exception containing an
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * with a severity of <code>IStatus.ERROR</code> and a
- * locale-specific description of the cause.
- */
- public static IFile createFileAtLocation (
- ResourceContext resourceContext,
- IPath absolutePath,
- InputStream inputStream,
- IProgressMonitor progressMonitor,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- if (!absolutePath.isAbsolute())
- {
- throw new CoreException(new Status(IStatus.ERROR, "ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_NOT_ABSOLUTE,new Object[] {absolutePath.toString()}),null));
- }
- if (absolutePath.segmentCount() < 1)
- {
- throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_EMPTY,new Object[] {absolutePath.toString()}),null));
- }
- if (absolutePath.segmentCount() < 2)
- {
- throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind(EnvironmentMessages.MSG_ERROR_PATH_NOT_FOLDER,new Object[] {absolutePath.toString()}),null));
- }
- IContainer parent = makeFolderPathAtLocation(resourceContext, absolutePath.removeLastSegments(1), progressMonitor, statusHandler);
- String fileName = absolutePath.lastSegment();
-
- return makeFile(resourceContext, parent, fileName, inputStream, progressMonitor, statusHandler);
- }
-
-/**
- * Creates a path of folders using absolute filenames.
- * Do not call with an absolutePath of less than one segment.
- * @param resourceContext the resource context for making folders.
- * @param resource the resource that will be created.
- * @param progressMonitor the progress monitor to be used.
- * @param statusHandler the status handler.
- * @return returns the IContainer of the created folder.
- */
- public static IContainer makeFolderPathAtLocation (
- ResourceContext resourceContext,
- IContainer resource,
- IProgressMonitor progressMonitor,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- if (resource.exists())
- {
- if (resource instanceof IContainer)
- {
- return (IContainer) resource;
- }
- else
- {
- throw new CoreException(
- new Status( IStatus.ERROR,
- "ResourceUtils",
- 0,
- NLS.bind(EnvironmentMessages.MSG_ERROR_RESOURCE_NOT_FOLDER,
- new Object[]{ resource.getFullPath().toString() }),
- null ) );
- }
- }
- else
- {
- IContainer parent = makeFolderPathAtLocation(resourceContext, resource.getParent(), progressMonitor, statusHandler );
- String folderName = resource.getName();
-
- return makeFolder(resourceContext, parent, folderName, progressMonitor , statusHandler );
- }
- }
-
- /**
- * Creates a path of folders.
- * Do not call with an absolutePath of less than one segment.
- * @param resourceContext the resource context for making folders.
- * @param absolutePath the path of folders that will be created.
- * @param progressMonitor the progress monitor to be used.
- * @param statusHandler the status handler.
- * @return returns the IContainer of the created folder.
- */
- public static IContainer makeFolderPathAtLocation (
- ResourceContext resourceContext,
- IPath absolutePath,
- IProgressMonitor progressMonitor,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- return makeFolderPathAtLocation(resourceContext,
- getWorkspaceRoot().getContainerForLocation(absolutePath),
- progressMonitor, statusHandler);
- }
-
-
-
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/StringUtils.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/StringUtils.java
deleted file mode 100644
index 601e15a2b..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/StringUtils.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.command.internal.env.common;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Enumeration;
-import java.util.Vector;
-
-/**
- * This class contains some useful string utilities that are not provided by
- * either String or StringBuffer.
- *
- * @author Peter Moogk
- * @date July 13, 2000
-**/
-public final class StringUtils
-{
- /**
- * The platform-specific line separator.
- */
- public static final String NEWLINE = System.getProperty("line.separator");
-
- private StringUtils(){};
-
- /**
- * This method splits a single line of text into multiple lines
- * based on a maximum line length. The method will try to fit as
- * many words as possible onto a line without exceeding the maximum
- * line length. Note: the only case where a line might exceed the
- * maximum is if a single word is longer than the maximum.
- * @param text a single line a text that is to be split.
- * @param max_length the maximum length of each split line.
- * @return a string array of the split lines.
- **/
- public static String[] splitter( String text, int max_length )
- {
- Vector return_text = new Vector(20);
- String[] return_str;
- int index = 0;
-
- while( index < text.length() )
- {
- String str = text.substring( index, Math.min( max_length + index,
- text.length() ) );
- int space_index = str.lastIndexOf( " " );
-
- if( index + str.length() < text.length() &&
- text.charAt( index + str.length() - 1 ) != ' ' &&
- text.charAt( index + str.length() ) != ' ' &&
- space_index != -1 )
- {
- return_text.addElement( str.substring( 0, space_index ) );
- index += space_index + 1;
- }
- else
- {
- return_text.addElement( str.trim() );
- index += str.length();
- }
- }
-
- return_str = new String[return_text.size()];
-
- for( index = 0; index < return_text.size(); index++ )
- {
- return_str[index] = (String)(return_text.elementAt(index));
- }
-
- return return_str;
- }
-
- /**
- * This method returns a string with a repeated number of characters.
- * @param the_char the character to be repeated.
- * @param count the number of time this character should be repeated.
- * @return the resulting string of repeated characters.
- **/
- static public String repeat( char the_char, int count )
- {
- StringBuffer buf = new StringBuffer( count );
-
- for( int index = 0; index < count; index++ )
- {
- buf.append( the_char );
- }
-
- return buf.toString();
- }
-
- /**
- * This method flattens an array of arguments to a string.
- * The method respects embedded whitespace and quotes.
- * <ul>
- * <li>Any argument with embedded whitespace will be flattened out
- * with enclosing quotes. For example, the single argument
- * <u>Hello World</u>
- * will be returned as
- * <u>"Hello World"</u>.
- * <li>Any argument with quotes will be flattened out with the
- * quotes escaped. For example, the single argument
- * <u>"Happy days"</u>
- * will be returned as
- * <u>\"Happy days\"</u>.
- * </ul>
- * @param arguments The array of strings to flatten.
- * @return the flattened string.
- */
- static public String flattenArguments ( String[] arguments )
- {
- StringBuffer buf = new StringBuffer();
-
- for (int i=0; i<arguments.length; i++)
- {
- //
- // Append a separator (except the first time).
- //
- if (i > 0) buf.append(' ');
-
- //
- // Look for whitespace.
- //
- boolean whitespace = false;
- char[] chars = arguments[i].toCharArray();
- for (int j=0; !whitespace && j<chars.length; j++)
- {
- if (Character.isWhitespace(chars[j]))
- {
- whitespace = true;
- }
- }
-
- //
- // Append the argument, quoted as necessary.
- //
- if (whitespace) buf.append('"');
- for (int j=0; j<chars.length; j++)
- {
- if (chars[j] == '"') buf.append('\\');
- buf.append(chars[j]);
- }
- if (whitespace) buf.append('"');
- }
-
- return buf.toString();
- }
-
- /**
- * This method parses whitespace-delimitted filenames from
- * the given <code>input</code> stream. <b>Limitation:</b>
- * Quoted filenames or filenames with embedded whitespace
- * are not currently supported.
- * @param input The input stream.
- * @return An enumeration of filenames from the stream.
- */
- static public Enumeration parseFilenamesFromStream ( InputStream input )
- throws IOException
- {
- Vector filenames = new Vector(64,64);
- StringBuffer buffer = null;
- byte state = STATE_WS;
- int ic = input.read();
- while (ic >= 0)
- {
- char c = (char)ic;
- switch (state)
- {
- case STATE_WS:
- if (!Character.isWhitespace(c))
- {
- buffer = new StringBuffer();
- buffer.append(c);
- state = STATE_NWS;
- }
- break;
- case STATE_NWS:
- if (!Character.isWhitespace(c))
- {
- buffer.append(c);
- }
- else
- {
- String filename = buffer.toString();
- filenames.add(filename);
- buffer = null;
- state = STATE_WS;
- }
- break;
- default:
- break;
- }
- ic = input.read();
- }
- return filenames.elements();
- }
-
- private static final byte STATE_WS = 0;
- private static final byte STATE_NWS = 1;
-
-
- /**
- * Returns true is the type passed in is a primtive java type
- * @param class name String
- * @return true is primitive type
- */
- public static boolean isPrimitiveType(String typeName)
- {
-
- if (typeName.equalsIgnoreCase("boolean") ||
- typeName.equalsIgnoreCase("byte") ||
- typeName.equalsIgnoreCase("double") ||
- typeName.equalsIgnoreCase("float") ||
- typeName.equalsIgnoreCase("int") ||
- typeName.equalsIgnoreCase("long") ||
- typeName.equalsIgnoreCase("short") ||
- typeName.equalsIgnoreCase("char"))
- return true;
- return false;
-
- }
-
- /**
- * The method replace the characters that are allowed in URIs
- * and not allowed in Java class names to an underscore ('_')
- * @param URI String
- * @return valid Java class name String
- */
- public static String URI2ClassName( String uri ) {
- String className = uri;
- for ( int i = 0; i < URI_SYMBOLS.length; i++ ) {
- className = className.replace ( URI_SYMBOLS[i], UNDERSCORE );
- }
- return className;
- }
-
- /**
- * Creates and array of strings containing the exception traceback information of
- * a Throwable. This is the same traceback data that is displayed by exc.printStackTrace().
- * @param exc the exception
- * @return a string array of the traceback information.
- */
- public static String[] getStackTrace( Throwable exc )
- {
- Vector lines = new Vector();
- StringWriter stringWriter = new StringWriter();
- PrintWriter printWriter = new PrintWriter( stringWriter );
-
- exc.printStackTrace( printWriter );
-
- try
- {
- printWriter.close();
- stringWriter.close();
- }
- catch( Exception nestedExc )
- {
- return new String[0];
- }
-
- StringReader stringReader = new StringReader( stringWriter.toString() );
- BufferedReader reader = new BufferedReader( stringReader );
- String line = null;
-
- try
- {
- line = reader.readLine();
-
- while( line != null )
- {
- lines.add( line.trim() );
- line = reader.readLine();
- }
- }
- catch( Exception nestedExc )
- {
- return new String[0];
- }
-
- return (String[])lines.toArray( new String[0] );
- }
-
- private static final char[] URI_SYMBOLS = {'-', '~', '#', '/', '.'};
- private static final char UNDERSCORE = '_';
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/WaitForAutoBuildCommand.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/WaitForAutoBuildCommand.java
deleted file mode 100644
index 0d8a1843c..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/WaitForAutoBuildCommand.java
+++ /dev/null
@@ -1,40 +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.command.internal.env.common;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-
-
-public class WaitForAutoBuildCommand extends AbstractDataModelOperation
-{
- public IStatus execute( IProgressMonitor montitor, IAdaptable adaptable )
- {
- IStatus status = Status.OK_STATUS;
-
- try
- {
- Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
- }
- catch( InterruptedException exc )
- {
- // UISynchronizer.syncExec seems to interrupt the UI tread when the autobuilder is done. Not sure, why.
- // I'm assuming here that the autobuilder has actually completed its stuff.
- }
-
- return status;
- }
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/ActionDialogPreferenceTypeRegistry.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/ActionDialogPreferenceTypeRegistry.java
deleted file mode 100644
index ff6a2c522..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/ActionDialogPreferenceTypeRegistry.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.command.internal.env.context;
-
-import java.util.Vector;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.command.internal.env.preferences.ActionDialogPreferenceType;
-
-
-public class ActionDialogPreferenceTypeRegistry
-{
- private Vector preferences_;
-
- private static ActionDialogPreferenceTypeRegistry registry_;
-
- private ActionDialogPreferenceTypeRegistry()
- {
- preferences_ = new Vector();
-
- loadDialogsPreferences();
- }
-
- static public ActionDialogPreferenceTypeRegistry getInstance()
- {
- if( registry_ == null )
- {
- registry_ = new ActionDialogPreferenceTypeRegistry();
- }
-
- return registry_;
- }
-
- //
- private void loadDialogsPreferences ()
- {
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IConfigurationElement[] config = reg.getConfigurationElementsFor( "org.eclipse.wst.command.env",
- "actionDialogPreferenceType");
-
- for(int idx=0; idx<config.length; idx++)
- {
- IConfigurationElement elem = config[idx];
- ActionDialogPreferenceType dialog = new ActionDialogPreferenceType();
-
- dialog.setId( elem.getAttribute("id") );
- dialog.setName( elem.getAttribute("name") );
- dialog.setInfopop( elem.getAttribute("infopop") );
- dialog.setTooltip( elem.getAttribute("tooltip") );
- dialog.setCategory( elem.getAttribute("category") );
-
- String showCheckbox = elem.getAttribute( "showcheckbox" );
- String alwaysHide = elem.getAttribute( "alwayshide" );
-
- dialog.setShowCheckbox( showCheckbox == null ? true : showCheckbox.equals( "true" ) );
- dialog.setAlwaysHide( alwaysHide == null ? false : alwaysHide.equals( "true" ) );
-
- preferences_.add(dialog);
- }
- }
-
- /**
- * Returns all registered <code>WebServiceType</code> objects.
- * @return All registered <code>WebServiceType</code> objects.
- */
- public ActionDialogPreferenceType[] getActionDialogsPrefrences ()
- {
- return (ActionDialogPreferenceType[])preferences_.toArray( new ActionDialogPreferenceType[0]);
- }
-
- public ActionDialogPreferenceType getActionDialogsPrefrence( String id )
- {
- int length = preferences_.size();
- ActionDialogPreferenceType result = null;
-
- for( int index = 0; index < length; index++ )
- {
- ActionDialogPreferenceType preference = (ActionDialogPreferenceType)preferences_.elementAt( index );
-
- if( preference.getId().equals( id ) )
- {
- result = preference;
- break;
- }
- }
-
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentActionDialogsContext.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentActionDialogsContext.java
deleted file mode 100644
index 2293f8cd4..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentActionDialogsContext.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.command.internal.env.context;
-
-import org.eclipse.wst.command.internal.env.plugin.EnvPlugin;
-import org.eclipse.wst.command.internal.env.preferences.ActionDialogPreferenceType;
-
-
-public class PersistentActionDialogsContext extends PersistentContext
-{
- private ActionDialogPreferenceTypeRegistry registry;
-
- private static PersistentActionDialogsContext instance_ = null;
-
- private PersistentActionDialogsContext()
- {
- super(EnvPlugin.getInstance());
- }
-
- static public PersistentActionDialogsContext getInstance()
- {
- if( instance_ == null )
- {
- instance_ = new PersistentActionDialogsContext();
- instance_.load();
- }
-
- return instance_;
- }
-
- public void load()
- {
- registry = ActionDialogPreferenceTypeRegistry.getInstance();
- ActionDialogPreferenceType[] dialogs = registry.getActionDialogsPrefrences();
-
- for (int i = 0; i < dialogs.length; i++)
- {
- setDefault(dialogs[i].getId(), false);
- }
- }
-
- public ActionDialogPreferenceType[] getDialogs()
- {
- return registry.getActionDialogsPrefrences();
- }
-
- public void setActionDialogEnabled(String id, boolean value)
- {
- setValue(id, value);
- }
-
- public boolean isActionDialogEnabled(String id)
- {
- if (id == null) return true;
- return getValueAsBoolean(id);
- }
-
- public boolean showDialog( String id )
- {
- ActionDialogPreferenceType dialog = registry.getActionDialogsPrefrence( id );
-
- // We are trying to determine if the popup wizard should be displayed
- // or not with this logic. If the dialog variable is null then
- // there was no popup extension point point defined for this wizard. In
- // this case we will assume that the popup should always be displayed.
- // In the case where the extension says that the show check box control
- // should be displayed we need to ensure that wizard should not always
- // be hidden, as well we need to check the current setting of the check
- // box via the isActionDialogEnabled call. If the show check box state
- // defined in the extension is false, but always hide is also false then
- // we will display the pop wizard.
- return dialog == null ||
- ( ( dialog.getShowCheckbox() &&
- !dialog.getAlwaysHide() &&
- !isActionDialogEnabled( id ) ) ||
- ( !dialog.getShowCheckbox() &&
- !dialog.getAlwaysHide() ) );
- }
-
- public boolean showCheckbox( String id )
- {
- ActionDialogPreferenceType dialog = registry.getActionDialogsPrefrence( id );
-
- return dialog == null ? false : dialog.getShowCheckbox();
- }
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentContext.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentContext.java
deleted file mode 100644
index 5852c9083..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentContext.java
+++ /dev/null
@@ -1,192 +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.command.internal.env.context;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.wst.command.internal.env.core.context.Context;
-
-/**
- * This class is used as the base class for types that what to persist preference
- * data in the plugin preferences area.
- *
- *
- */
-public abstract class PersistentContext implements Context
-{
- protected Preferences preferences_;
- protected Plugin plugin_;
-
- public PersistentContext ( Plugin plugin)
- {
- plugin_ = plugin;
- preferences_ = plugin.getPluginPreferences();
- }
-
- /**
- * Sets the default for a boolean preference.
- * @param name the preference name.
- * @param value the preference value.
- */
- public void setDefault (String name, boolean value) {
- preferences_.setDefault(name, value);
- }
-
- /**
- * Sets the default for a string preference.
- * @param name the preference name.
- * @param value the preference value.
- */
- public void setDefault (String name, String value) {
- preferences_.setDefault(name,value);
- }
-
- /**
- * Sets the default for a int preference.
- * @param name the preference name.
- * @param value the preference value.
- */
- public void setDefault (String name, int value) {
- preferences_.setDefault(name,value);
- }
-
- /**
- * Sets the value for a string preference.
- * @param name the preference name.
- * @param value the preference value.
- */
- public void setValue (String name, String value) {
- preferences_.setValue(name,value);
- plugin_.savePluginPreferences();
- }
-
- /**
- * Sets the value for a boolean preference.
- * @param name the preference name.
- * @param value the preference value.
- */
- public void setValue (String name, boolean value) {
- preferences_.setValue(name, value);
- plugin_.savePluginPreferences();
- }
-
- /**
- * Sets the value for a int preference.
- * @param name the preference name.
- * @param value the preference value.
- */
- public void setValue (String name, int value) {
- preferences_.setValue(name, value);
- plugin_.savePluginPreferences();
- }
-
- /**
- * Gets the value for a string preference.
- * @param name the preference name.
- * @return the preference value.
- */
- public String getValueAsString ( String name) {
- return preferences_.getString(name);
- }
-
- /**
- * Gets the value for a boolean preference.
- * @param name the preference name.
- * @return the preference value.
- */
- public boolean getValueAsBoolean ( String name) {
- return preferences_.getBoolean(name);
- }
-
- /**
- * Gets the value for a int preference.
- * @param name the preference name.
- * @return the preference value.
- */
- public int getValueAsInt( String name) {
- return preferences_.getInt(name);
- }
-
- /**
- * Gets the default value for a string preference.
- * @param name the preference name.
- * @return the default preference value.
- */
- public String getDefaultString(String name)
- {
- return preferences_.getDefaultString(name);
- }
-
- /**
- * Gets the default value for a boolean preference.
- * @param name the preference name.
- * @return the default preference value.
- */
- public boolean getDefaultBoolean(String name)
- {
- return preferences_.getDefaultBoolean(name);
- }
-
- /**
- * Gets the default value for a int preference.
- * @param name the preference name.
- * @return the default preference value.
- */
- public int getDefaultInt(String name)
- {
- return preferences_.getDefaultInt(name);
- }
-
- /**
- * Sets the default value for a string preference if a default value has
- * not already been set.
- * @param name the preference name.
- * @param value the default preference value
- */
- public void setDefaultStringIfNoDefault( String key, String value )
- {
- // If the key already has a default value we don't want to override it.
- if( preferences_.getDefaultString( key ).equals("") )
- {
- preferences_.setDefault( key, value );
- }
- }
-
- /**
- * Sets the default value for a boolean preference if a default value has
- * not already been set.
- * @param name the preference name.
- * @param value the default preference value
- */
- public void setDefaultBooleanIfNoDefault( String key, boolean value )
- {
- // If the key already has a default value we don't want to override it.
- if( preferences_.getDefaultString( key ).equals("") )
- {
- preferences_.setDefault( key, value );
- }
- }
-
- /**
- * Sets the default value for a int preference if a default value has
- * not already been set.
- * @param name the preference name.
- * @param value the default preference value
- */
- public void setDefaultIntIfNoDefault( String key, int value )
- {
- // If the key already has a default value we don't want to override it.
- if( preferences_.getDefaultString( key ).equals("") )
- {
- preferences_.setDefault( key, value );
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentResourceContext.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentResourceContext.java
deleted file mode 100644
index a0675c409..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/context/PersistentResourceContext.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.command.internal.env.context;
-
-import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
-import org.eclipse.wst.command.internal.env.core.context.ResourceDefaults;
-import org.eclipse.wst.command.internal.env.core.context.TransientResourceContext;
-import org.eclipse.wst.command.internal.env.plugin.EnvPlugin;
-
-
-public class PersistentResourceContext extends PersistentContext implements ResourceContext
-{
- private static PersistentResourceContext context_ = null;
-
- public static PersistentResourceContext getInstance()
- {
- if( context_ == null )
- {
- context_ = new PersistentResourceContext();
- context_.load();
- }
-
- return context_;
- }
-
- private PersistentResourceContext()
- {
- super(EnvPlugin.getInstance());
- }
-
- public void load()
- {
- setDefault(PREFERENCE_OVERWRITE, ResourceDefaults
- .getOverwriteFilesDefault());
- setDefault(PREFERENCE_CREATE_FOLDERS, ResourceDefaults
- .getCreateFoldersDefault());
- setDefault(PREFERENCE_CHECKOUT, ResourceDefaults.getCheckoutFilesDefault());
- }
-
- public void setOverwriteFilesEnabled(boolean enable)
- {
- setValue(PREFERENCE_OVERWRITE, enable);
- }
-
- public boolean isOverwriteFilesEnabled()
- {
- return getValueAsBoolean(PREFERENCE_OVERWRITE);
- }
-
- public void setCreateFoldersEnabled(boolean enable)
- {
- setValue(PREFERENCE_CREATE_FOLDERS, enable);
- }
-
- public boolean isCreateFoldersEnabled()
- {
- return getValueAsBoolean(PREFERENCE_CREATE_FOLDERS);
- }
-
- public void setCheckoutFilesEnabled(boolean enable)
- {
- setValue(PREFERENCE_CHECKOUT, enable);
- }
-
- public boolean isCheckoutFilesEnabled()
- {
- return getValueAsBoolean(PREFERENCE_CHECKOUT);
- }
-
- public ResourceContext copy()
- {
- ResourceContext cc = new TransientResourceContext();
- cc.setOverwriteFilesEnabled(isOverwriteFilesEnabled());
- cc.setCreateFoldersEnabled(isCreateFoldersEnabled());
- cc.setCheckoutFilesEnabled(isCheckoutFilesEnabled());
- return cc;
- }
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseEclipseEnvironment.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseEclipseEnvironment.java
deleted file mode 100644
index 4f59f6ca6..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/BaseEclipseEnvironment.java
+++ /dev/null
@@ -1,27 +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.command.internal.env.eclipse;
-
-import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
-import org.eclipse.wst.common.environment.IEnvironment;
-
-
-/**
- * This interface adds resources to the base IEnvironment.
- */
-public interface BaseEclipseEnvironment extends IEnvironment
-{
- /**
- *
- * @return returns a ResourceContext object for this environment.
- */
- public ResourceContext getResourceContext();
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EclipseEnvironment.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EclipseEnvironment.java
deleted file mode 100644
index 20766b93c..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EclipseEnvironment.java
+++ /dev/null
@@ -1,111 +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.command.internal.env.eclipse;
-
-import org.eclipse.wst.command.internal.env.core.CommandManager;
-import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
-import org.eclipse.wst.common.environment.EnvironmentService;
-import org.eclipse.wst.common.environment.ILog;
-import org.eclipse.wst.common.environment.IStatusHandler;
-import org.eclipse.wst.common.environment.uri.SimpleURIFactory;
-import org.eclipse.wst.common.environment.uri.IURIFactory;
-import org.eclipse.wst.common.environment.uri.IURIScheme;
-
-
-/**
- * This class implements an IEnvironment class for the Eclipse IEnvironment.
- * This IEnvironment currently supports the "platform" protocol and the "file"
- * protocol.
- *
- */
-public class EclipseEnvironment implements BaseEclipseEnvironment
-{
- private CommandManager commandManager_ = null;
- private SimpleURIFactory uriFactory_ = null;
- private ResourceContext resourceContext_ = null;
- private IStatusHandler statusHandler_ = null;
- private ILog logger_ = null;
-
- public EclipseEnvironment( CommandManager commandManager,
- ResourceContext resourceContext,
- IStatusHandler statusHandler )
- {
- IURIScheme eclipseScheme = EnvironmentService.getEclipseScheme();
- IURIScheme fileScheme = EnvironmentService.getFileScheme();
-
- commandManager_ = commandManager;
- resourceContext_ = resourceContext;
- uriFactory_ = new SimpleURIFactory();
- statusHandler_ = statusHandler;
-
- uriFactory_.registerScheme( "platform", eclipseScheme );
- uriFactory_.registerScheme( "file", fileScheme );
- }
-
- /**
- * @see org.eclipse.wst.command.internal.env.core.common.IEnvironment#getCommandManager()
- */
- public CommandManager getCommandManager()
- {
- return commandManager_;
- }
-
- /**
- * @see org.eclipse.wst.command.internal.env.core.common.IEnvironment#getLog()
- */
- public ILog getLog()
- {
- if( logger_ == null )
- {
- logger_ = EnvironmentService.getEclipseLog();
- };
-
- return logger_;
- }
-
- /**
- *
- * @param logger the new logger for this environment.
- */
- public void setLog( ILog logger )
- {
- logger_ = logger;
- }
-
- /**
- * @see org.eclipse.wst.command.internal.env.core.common.IEnvironment#getStatusHandler()
- */
- public IStatusHandler getStatusHandler()
- {
- return statusHandler_;
- }
-
- /** (non-Javadoc)
- * @see org.eclipse.wst.command.internal.env.core.common.IEnvironment#getURIFactory()
- */
- public IURIFactory getURIFactory()
- {
- return uriFactory_;
- }
-
- /**
- * @return returns a ResourceContext for this IEnvironment.
- */
- public ResourceContext getResourceContext()
- {
- return resourceContext_;
- }
-
- public void setCommandManager( CommandManager manager )
- {
- commandManager_ = manager;
- }
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EnvironmentManager.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EnvironmentManager.java
deleted file mode 100644
index ed691d68a..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/eclipse/EnvironmentManager.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.wst.command.internal.env.eclipse;
-
-import org.eclipse.wst.command.internal.env.context.PersistentResourceContext;
-import org.eclipse.wst.common.environment.IStatusHandler;
-import org.eclipse.wst.common.environment.NullStatusHandler;
-
-public class EnvironmentManager
-{
- /**
- * Returns a new instance of an IEnvironment for the Eclipse non-GUI.
- */
- public static BaseEclipseEnvironment getNewEnvironment()
- {
- PersistentResourceContext context = PersistentResourceContext.getInstance();
- IStatusHandler handler = new NullStatusHandler();
- EclipseEnvironment environment = new EclipseEnvironment( null, context, handler );
-
- return environment;
- }
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/plugin/EnvPlugin.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/plugin/EnvPlugin.java
deleted file mode 100644
index 6eb1c424b..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/plugin/EnvPlugin.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.wst.command.internal.env.plugin;
-
-import org.eclipse.core.runtime.Plugin;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class EnvPlugin extends Plugin {
-
- //The shared instance.
- private static EnvPlugin instance;
-
- /**
- * The identifier of the descriptor of this plugin in plugin.xml.
- */
- public static final String ID = "org.eclipse.wst.command.env";
-
- /**
- * The constructor.
- */
- public EnvPlugin() {
- super();
- instance = this;
- }
-
- /**
- * Returns the shared instance.
- */
- public static EnvPlugin getInstance() {
- return instance;
- }
-}
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/preferences/ActionDialogPreferenceType.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/preferences/ActionDialogPreferenceType.java
deleted file mode 100644
index d1a551e53..000000000
--- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/preferences/ActionDialogPreferenceType.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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.command.internal.env.preferences;
-
-/**
- * This class is used to define preference ids. It corresponds to information
- * specified by a actionDialogPreferenceType extension point.
- * Each actionDialogPreferenceType entry will result in an entry in the
- * action dialogs preference page if the showcheckbox field is true.
- *
- * Here is an example of this extension point.
- *
- * <pre>
- * &lt;extension
- * point="org.eclipse.wst.command.env.actionDialogPreferenceType"&gt;
- * &lt;actionDialogPreferenceType
- * showcheckbox="true"
- * name="%CHECKBOX_SHOW_GENERATE_JAVA_PROXY_DIALOG"
- * category="org.eclipse.jst.wss.popup.category"
- * tooltip="%TOOLTIP_PPAD_CHECKBOX_WSDL2PROXY"
- * infopop="org.eclipse.jst.ws.consumption.ui.PPAD0004"
- * alwayshide="false"
- * id="org.eclipse.jst.ws.consumption.ui.wizard.client.clientwizard"&gt;
- * &lt;/actionDialogPreferenceType&gt;
- * </pre>
- *
- * This actionDialogPreferenceType extension point is associated with an ObjectContribution
- * extension point. For example:
- *
- * <objectContribution
- * objectClass="org.eclipse.core.resources.IFile"
- * nameFilter="*.wsdl"
- * id="org.eclipse.jst.ws.consumption.ui.wizard.client.clientwizard">
- * <!-- WSDL To Java Bean Proxy -->
- * <action
- * label="%ACTION_GENERATE_JAVA_PROXY"
- * class="org.eclipse.wst.command.env.ui.widgets.popup.DynamicPopupWizard"
- * menubarPath="org.eclipse.jst.ws.atk.ui.webservice.category.popupMenu/popupActions"
- * id="org.eclipse.jst.ws.consumption.ui.wizard.client.clientwizard">
- * </action>
- * </objectContribution>
- *
- * The ObjectContribution entry is linked with the actionDialogPreferenceType entry
- * via the id attribute of the ObjectContirbution and the id attribute of actionDialogPreferenceType.
- * Note: the id in the action entry is always associated with the dynamic wizard that
- * should be popuped up. In the example above the ObjectionContribution id and the
- * action ids are the same, but this need not be the case.
- */
-public class ActionDialogPreferenceType
-{
- private String id_;
- private String name_;
- private String infopop_;
- private String tooltip_;
- private boolean showCheckbox_;
- private boolean alwaysHide_;
- private String category_;
-
- /**
- * Sets the id for this popup action. This id link the actionDialogPreference
- * with an ObjectContribution.
- * @param id the id.
- */
- public void setId(String id)
- {
- id_ = id;
- }
-
- /**
- * Gets the id for this popup action.
- * @return the id.
- */
- public String getId()
- {
- return id_;
- }
-
- /**
- * Sets the name for this popup action. This name is displayed on the
- * dialog preferences page and must be translated.
- * @param name the name of the popup check box.
- */
- public void setName(String name)
- {
- name_ = name;
- }
-
- /**
- * Gets the display value for this popup check box.
- * Note: this value may be null if the getShowCheckBox method returns false.
- * @return the name.
- */
- public String getName()
- {
- return name_;
- }
-
- /**
- * Sets the info pop value for this popup check box.
- * @param infopop
- */
- public void setInfopop(String infopop)
- {
- infopop_ = infopop;
- }
-
- /**
- * Gets the info pop value for this popup check box.
- * Note: this value may be null if the getShowCheckBox method returns false.
- *
- * @return the infopop value.
- */
- public String getInfopop()
- {
- return infopop_;
- }
-
- /**
- * Sets the tooltip value for this popup check box.
- * @param tooltip
- */
- public void setTooltip(String tooltip)
- {
- tooltip_ = tooltip;
- }
-
- /**
- * Gets the tooltip value for this popup check box.
- * Note: this value may be null if the getShowCheckBox method returns false.
- *
- * @return the tooltip value.
- */
- public String getTooltip()
- {
- return tooltip_;
- }
-
- /**
- * Sets the show check box value for this popup. If the value is true then
- * this popup will appear on an action dialogs preference page. Also if this
- * value is true and the always hide value is false then a check box will be displayed
- * on the first page of this popup which asks the user if they want the popup
- * to be displayed the next time are to just execute the popup action.
- * @param value the show check box value.
- */
- public void setShowCheckbox( boolean value )
- {
- showCheckbox_ = value;
- }
-
- /**
- * Gets the show check box value.
- * @return the show check box value.
- */
- public boolean getShowCheckbox()
- {
- return showCheckbox_;
- }
-
- /**
- * Sets the always hide value. This value specifies that the popup should always
- * be executed without bringing up the popup wizard.
- * @param value the always hide value.
- */
- public void setAlwaysHide( boolean value )
- {
- alwaysHide_ = value;
- }
-
- /**
- *
- * @return returns the always hide value.
- */
- public boolean getAlwaysHide()
- {
- return alwaysHide_;
- }
-
- /**
- * Sets the category id for popup action. All popup actions with the same
- * category id will be grouped together on the same popup action preference page.
- * @param value the category.
- */
- public void setCategory( String value )
- {
- category_ = value;
- }
-
- /**
- *
- * @return the category id.
- */
- public String getCategory()
- {
- return category_;
- }
-}

Back to the top