diff options
Diffstat (limited to 'bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env')
41 files changed, 0 insertions, 2770 deletions
diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/CommandFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/CommandFactory.java deleted file mode 100644 index f02674e35..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/CommandFactory.java +++ /dev/null @@ -1,24 +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.provisional.env.core; - -/** - * This interface is used to create Command objects. - * - */ -public interface CommandFactory -{ - /** - * - * @return returns a created Command object. - */ - public EnvironmentalOperation create(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/CommandManager.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/CommandManager.java deleted file mode 100644 index 873a376cd..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/CommandManager.java +++ /dev/null @@ -1,33 +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.provisional.env.core; - -import org.eclipse.wst.command.internal.provisional.env.core.data.DataMappingRegistry; - -/** - * CommandManagers help manage the lifecycle of Commands. - */ -public interface CommandManager -{ - /** - * Returns true if this CommandManager is capable of undoing - * Commands. Some CommandManagers and Environments may be of - * a sort that will never undo() Commands. Command.execute() - * methods should take advantage of this method to optimize - * out any caching logic whenever this method returns false. - */ - public boolean isUndoEnabled (); - - // There's probably more, like factory methods for creating - // Undo/Redo stacks and stuff like that. - - public DataMappingRegistry getMappingRegistry(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/EnvironmentalOperation.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/EnvironmentalOperation.java deleted file mode 100644 index 6af52b281..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/EnvironmentalOperation.java +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.provisional.env.core; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.provisional.env.core.common.Environment; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; - -public abstract class EnvironmentalOperation extends AbstractDataModelOperation -{ - private Environment environment_; - - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - return Status.OK_STATUS; - } - - public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - return Status.OK_STATUS; - } - - public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - return Status.OK_STATUS; - } - - public Environment getEnvironment() - { - return environment_; - } - - public void setEnvironment( Environment environment ) - { - environment_ = environment; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/ICommandFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/ICommandFactory.java deleted file mode 100644 index 45fd0b2ea..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/ICommandFactory.java +++ /dev/null @@ -1,29 +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.provisional.env.core; - -import java.util.Iterator; - - -/** - * - * This class is used to return a sequence of Commands. - * - */ -public interface ICommandFactory extends Iterator -{ - /** - * - * @return returns the next Command in the sequence. - */ - public EnvironmentalOperation getNextCommand(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/SimpleCommandFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/SimpleCommandFactory.java deleted file mode 100644 index 7897bf15c..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/SimpleCommandFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.eclipse.wst.command.internal.provisional.env.core; - -import java.util.Vector; - - -public class SimpleCommandFactory implements ICommandFactory -{ - private Vector commands_; - private int index_; - - public SimpleCommandFactory( Vector commands ) - { - commands_ = commands; - index_ = 0; - } - - public EnvironmentalOperation getNextCommand() - { - return (EnvironmentalOperation)next(); - } - - public void remove() - { - throw new UnsupportedOperationException(); - } - - public boolean hasNext() - { - return index_ < commands_.size(); - } - - public Object next() - { - return commands_.elementAt(index_++); - } - -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Choice.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Choice.java deleted file mode 100644 index 71b9379a6..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Choice.java +++ /dev/null @@ -1,95 +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.provisional.env.core.common; - -public class Choice { - - protected char shortcut = ' '; - protected String label = null; - protected String description = null; - - /** - * Constructor for Choice. - */ - public Choice() { - } - - /** - * Constructor for Choice. - * @param shortcut - * @param label - */ - public Choice(char shortcut, String label) { - this.shortcut = shortcut; - this.label = label; - } - - /** - * Constructor for Choice. - * @param shortcut - * @param label - * @param description - */ - public Choice(char shortcut, String label, String description) { - this.shortcut = shortcut; - this.label = label; - this.description = description; - } - - /** - * Gets the label. - * @return Returns a String - */ - public String getLabel() { - return label; - } - - /** - * Sets the label. - * @param label The label to set - */ - public void setLabel(String label) { - this.label = label; - } - - /** - * Gets the description. - * @return Returns a String - */ - public String getDescription() { - return description; - } - - /** - * Sets the description. - * @param description The description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the shortcut. - * @return Returns a char - */ - public char getShortcut() { - return shortcut; - } - - /** - * Sets the shortcut. - * @param shortcut The shortcut to set - */ - public void setShortcut(char shortcut) { - this.shortcut = shortcut; - } - -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Condition.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Condition.java deleted file mode 100644 index 35058af0c..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Condition.java +++ /dev/null @@ -1,22 +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.provisional.env.core.common; - -/** - * This interface defines a boolean condition that can be evaluated for any object. - */ -public interface Condition -{ - /** - * This returns whether the given object passes this condition. - */ - public boolean evaluate(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Environment.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Environment.java deleted file mode 100644 index 1eeb1349e..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Environment.java +++ /dev/null @@ -1,50 +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.provisional.env.core.common; - -import org.eclipse.wst.command.internal.provisional.env.core.CommandManager; -import org.eclipse.wst.command.internal.provisional.env.core.uri.URIFactory; - - -/** - * An Environment provides the means for a - * <ol> - * <li>A log for writing messages to a logging facility,</li> - * <li>A progress monitor for receiving progress information,</li> - * <li>A status handler for receiving and processing status reports,</li> - * <li>A factory for the handling of URIs (resources).</li> - * </ol> - */ -public interface Environment -{ - /** - * Returns a logging facility. - */ - public Log getLog (); - - /** - * Returns a status handler. - */ - public StatusHandler getStatusHandler (); - - /** - * Returns a URI factory. - * Hint: Implementers should insure that the Factory they return - * has a reference to this Environment so that URI objects can - * report progress and announce status. - */ - public URIFactory getURIFactory (); - - /** - * Returns an object that helps manage execution/undoing of Commands. - */ - public CommandManager getCommandManager (); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/EnvironmentException.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/EnvironmentException.java deleted file mode 100644 index 3d11d2db7..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/EnvironmentException.java +++ /dev/null @@ -1,51 +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.provisional.env.core.common; - -import org.eclipse.core.runtime.IStatus; - -/** - * This is the exception class for conditions raised by the Environment. - */ -public class EnvironmentException extends Exception -{ - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3978983275899402036L; - - protected IStatus status = null; - - /** - * Creates a new EnvironmentException. - */ - public EnvironmentException () - { - super(); - } - - /** - * Creates a new EnvironmentException. - */ - public EnvironmentException ( IStatus status ) - { - super(status == null ? null : status.getMessage()); - this.status = status; - } - - /** - * Returns the Status object. - */ - public IStatus getStatus() - { - return status; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Evaluate.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Evaluate.java deleted file mode 100644 index 255a81f01..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Evaluate.java +++ /dev/null @@ -1,22 +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.provisional.env.core.common; - -/** - * This interface can be used when a conditional object needs to be returned. -**/ -public interface Evaluate -{ - /** - * @return returns an object based on some evaluated condition. - **/ - public Object evaluate(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Log.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Log.java deleted file mode 100644 index cfbd2475e..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Log.java +++ /dev/null @@ -1,110 +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.provisional.env.core.common; - -import org.eclipse.core.runtime.IStatus; - -/** - * Log objects provide a means for logging information for FFDC etc. - */ -public interface Log -{ - public static final int OK = 0; - public static final int INFO = 1; - public static final int WARNING = 2; - public static final int ERROR = 4; - - /** - * Returns true if logging is enabled. - * There is no requirement to call this method before attempting - * a call to one of the <code>log</code> methods, as they will - * quietly do nothing if logging is disabled. This method can be - * useful, however, anywhere the cost of building up the parameters - * to a log method might be high and best avoided except when logging - * is enabled. - * @return True if logging is enabled, and false otherwise. - */ - public boolean isEnabled (); - - /** - * Returns true if the the debug option is set to true. - */ - public boolean isEnabled (String option); - - /** - * Logs a <code>Throwable</code>. - * @param severity The severity of the logging entry. - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param throwable The Throwable to log. - */ - public void log ( int severity, int messageNum, Object caller, String method, Throwable throwable ); - - /** - * Logs a <code>Throwable</code>. - * @param severity The severity of the logging entry. - * @param debug option - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param throwable The Throwable to log. - */ - public void log ( int severity, String option, int messageNum, Object caller, String method, Throwable throwable ); - - /** - * Logs a <code>Status</code>. - * @param severity The severity of the logging entry. - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param status The Status to log. - */ - public void log ( int severity, int messageNum, Object caller, String method, IStatus status ); - - /** - * Logs a <code>Status</code>. - * @param severity The severity of the logging entry. - * @param debug option - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param status The Status to log. - */ - public void log ( int severity, String option, int messageNum, Object caller, String method, IStatus status ); - - /** - * Logs an <code>Object</code>. - * @param severity The severity of the logging entry. - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param object The Object to log. - */ - public void log ( int severity, int messageNum, Object caller, String method, Object object ); - - /** - * Logs an <code>Object</code>. - * @param severity The severity of the logging entry. - * @param debug option - * @param messageNum The message number. - * @param caller The object (for non-static methods) or class (for - * static methods) doing the logging. - * @param method The simple name of the method doing the loging. - * @param object The Object to log. - */ - public void log ( int severity, String option, int messageNum, Object caller, String method, Object object ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/MessageUtils.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/MessageUtils.java deleted file mode 100644 index 8dbf18289..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/MessageUtils.java +++ /dev/null @@ -1,88 +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.provisional.env.core.common; - -import java.text.MessageFormat; -import java.util.Hashtable; -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * This class provides a convienent way to access resource bundles and - * retieve translated strings. - * - * - */ -public class MessageUtils -{ - private ResourceBundle resource_; - - private static Hashtable bundles_ = new Hashtable(); - - /** - * - * @param bundleId the resource bundle ID. - * @param object the class loader for this object will be used to retrieve - * the resource bundle. - */ - public MessageUtils( String bundleId, Object object ) - { - this( bundleId, object.getClass().getClassLoader() ); - } - - /** - * - * @param bundleId the resource bundle ID. - * @param loader the class loader that will be used to retrieve - * the resource bundle. - */ - public MessageUtils( String bundleId, ClassLoader loader ) - { - resource_ = (ResourceBundle)bundles_.get( bundleId ); - - if( resource_ == null ) - { - resource_ = ResourceBundle.getBundle( bundleId, Locale.getDefault(), loader ); - bundles_.put( bundleId, resource_ ); - } - } - - /** - * - * @param key the key for the string to retrieve. - * @return returns the translated string. - */ - public String getMessage ( String key ) - { - String value = key; - - try - { - value = resource_.getString( key ); - } - catch( Throwable exc ) - { - } - - return value; - } - - /** - * - * @param key the key for the string to retrieve. - * @param args These arguments will be substituted into the translated string. - * @return returns the translated string with any substitutions. - */ - public String getMessage ( String key, Object[] args ) - { - return MessageFormat.format( getMessage(key),args ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/NullStatusHandler.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/NullStatusHandler.java deleted file mode 100644 index 238ca419f..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/NullStatusHandler.java +++ /dev/null @@ -1,63 +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.provisional.env.core.common; - -import org.eclipse.core.runtime.IStatus; - -public class NullStatusHandler implements StatusHandler -{ - - /** - * @see org.eclipse.env.common.StatusHandler#report(org.eclipse.env.common.Status, org.eclipse.env.common.Choice[]) - */ - public Choice report(IStatus status, Choice[] choices) - { - Choice result = null; - - // Always take the first choice if available. - if( choices != null && choices.length > 0 ) - { - result = choices[0]; - } - - return result; - } - - /** - * @see org.eclipse.env.common.StatusHandler#report(org.eclipse.env.common.Status) - */ - public void report(IStatus status) throws StatusException - { - } - - /* - * Report and error. - */ - private boolean reportErrorStatus(IStatus status) - { - return false; - } - - /** - * @see org.eclipse.wst.command.internal.provisional.env.core.common.StatusHandler#reportError(org.eclipse.wst.command.internal.provisional.env.core.common.Status) - */ - public void reportError(IStatus status) - { - reportErrorStatus( status ); - } - - /** - * @see org.eclipse.wst.command.internal.provisional.env.core.common.StatusHandler#reportInfo(org.eclipse.wst.command.internal.provisional.env.core.common.Status) - */ - public void reportInfo(IStatus status) - { - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/ProgressUtils.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/ProgressUtils.java deleted file mode 100644 index 1ca1aa14d..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/ProgressUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.provisional.env.core.common; - -import org.eclipse.core.runtime.IProgressMonitor; - -public class ProgressUtils -{ - static public void report( IProgressMonitor monitor, String message ) - { - if( monitor != null ) - { - monitor.beginTask( message, IProgressMonitor.UNKNOWN ); - } - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Range.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Range.java deleted file mode 100644 index 75ff51c0c..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/Range.java +++ /dev/null @@ -1,62 +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.provisional.env.core.common; - -import org.eclipse.wst.command.internal.provisional.env.core.uri.URI; - -/** - * Carries position information within a resource. - */ -public interface Range -{ - public static final int UNKNOWN = -1; - - /** - * Returns the identifier of the resource the range applies to. - */ - public URI getURI (); - - /** - * Returns the index, zero-indexed, of the first line - * of the range. - */ - public int getStartingLineNumber (); - - /** - * Returns the index, zero-indexed, of the first character - * of the range relative to the beginning of the line. - */ - public int getStartingCharNumberInLine (); - - /** - * Returns the index, zero-indexed, of the first character - * of the range relative to the beginning of the file. - */ - public int getStartingCharNumberInURI (); - - /** - * Returns the index, zero-indexed, of the last line - * of the range. - */ - public int getEndingLineNumber (); - - /** - * Returns the offset, zero-indexed, of the last character - * of the range relative to the beginning of the line. - */ - public int getEndingCharNumberInLine (); - - /** - * Returns the index, zero-indexed, of the last character - * of the range relative to the beginning of the file. - */ - public int getEndingCharNumberInURI (); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/RangeVector.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/RangeVector.java deleted file mode 100644 index ee3c52a02..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/RangeVector.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.provisional.env.core.common; - -import java.util.Vector; - -/** - * This Vector makes the protected method removeRange public. - * - */ -public class RangeVector extends Vector -{ - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 4048793476659230773L; - - public void removeRange( int start, int end ) - { - super.removeRange( start, end ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/StatusException.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/StatusException.java deleted file mode 100644 index 7a095e05c..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/StatusException.java +++ /dev/null @@ -1,67 +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.provisional.env.core.common; - -import org.eclipse.core.runtime.IStatus; - -/** - * This is the exception class used by StatusHandlers to tell their - * callers that processing should stop. - */ -public class StatusException extends EnvironmentException -{ - /** - * Comment for <code>serialVersionUID</code> - * */ - private static final long serialVersionUID = 3618141160322119992L; - - /** - * The Choice that lead to the exception being thrown, - * if any (ie. may be null). - */ - protected Choice choice; - - /** - * Creates a new StatusException with the given Status. - */ - public StatusException( IStatus status ) - { - super( status ); - } - - /** - * Creates a new StatusException with the given Choice. - * The Choice may be null. - */ - public StatusException ( Choice choice ) - { - super(); - this.choice = choice; - } - - /** - * Creates a new StatusException with the given Choice - * and status object. The Choice may be null. - */ - public StatusException ( IStatus status, Choice choice ) - { - super(status); - this.choice = choice; - } - - /** - * Returns the Choice object inside this exception. - */ - public Choice getChoice () - { - return choice; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/StatusHandler.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/StatusHandler.java deleted file mode 100644 index 37f088cb9..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/StatusHandler.java +++ /dev/null @@ -1,48 +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.provisional.env.core.common; - -import org.eclipse.core.runtime.IStatus; - -/** - * Processes status events raised by the caller and returns an - * indication of choices made by the recipient of the status and - * may raise an exception against the caller to have them abort - * procesing. - */ -public interface StatusHandler -{ - /** - * Reports the given Status and set of possible responses. - * Returns the choice made by the handler. - */ - public Choice report ( IStatus status, Choice[] choices ); - - /** - * Reports the given Status with implied options to either - * continue or abort. - * Throws an exception if the handler decides the caller - * should stop processing. - */ - public void report ( IStatus status ) throws StatusException; - - /** - * Report the given Error Status. No user feedback is provided. - * @param status - */ - public void reportError( IStatus status ); - - /** - * Report the given Info Status. No user feedback is provided. - * @param status - */ - public void reportInfo( IStatus status ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/StatusUtils.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/StatusUtils.java deleted file mode 100644 index 3927873db..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/common/StatusUtils.java +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************************************** - * Copyright (c) 2003, 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.provisional.env.core.common; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; - -public class StatusUtils -{ - public static IStatus errorStatus( String errorMessage ) - { - return new Status( IStatus.ERROR, "id", 0, errorMessage, null ); - } - - public static IStatus errorStatus( Throwable exc ) - { - String message = exc.getMessage(); - - return new Status( IStatus.ERROR, "id", 0, message == null ? "" : message, exc ); - } - - public static IStatus errorStatus( String message, Throwable exc ) - { - return new Status( IStatus.ERROR, "id", 0, message, exc ); - } - - public static MultiStatus multiStatus( String message, IStatus[] children, Throwable exc ) - { - return new MultiStatus( "id", 0, children, message, exc ); - } - - public static MultiStatus multiStatus( String message, IStatus[] children ) - { - return new MultiStatus( "id", 0, children, message, null ); - } - - public static IStatus warningStatus( String warningMessage ) - { - return new Status( IStatus.WARNING, "id", 0, warningMessage, null ); - } - - public static IStatus warningStatus( String warningMessage, Throwable exc ) - { - return new Status( IStatus.WARNING, "id", 0, warningMessage, exc ); - } - - public static IStatus infoStatus( String infoMessage ) - { - return new Status( IStatus.INFO, "id", 0, infoMessage, null ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/Context.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/Context.java deleted file mode 100644 index af278b9ff..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/Context.java +++ /dev/null @@ -1,87 +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.provisional.env.core.context; - -/** - * This interface provides a way to get and set preference information. - * - */ -public interface Context -{ - /** - * Loads the preference data into this Context object. - * - */ - public void load(); - - /** - * Sets the default for a boolean preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setDefault (String name, boolean 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); - - /** - * Sets the default for a int preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setDefault (String name, int 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); - - /** - * Sets the value for a boolean preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setValue (String name, boolean value); - - /** - * Sets the value for a int preference. - * @param name the preference name. - * @param value the preference value. - */ - public void setValue (String name, int value); - - /** - * Gets the value for a string preference. - * @param name the preference name. - * @return the preference value. - */ - public String getValueAsString ( String name); - - /** - * Gets the value for a boolean preference. - * @param name the preference name. - * @return the preference value. - */ - public boolean getValueAsBoolean ( String name); - - /** - * Gets the value for a int preference. - * @param name the preference name. - * @return the preference value. - */ - public int getValueAsInt ( String name); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/ResourceContext.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/ResourceContext.java deleted file mode 100644 index 9faff0041..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/ResourceContext.java +++ /dev/null @@ -1,74 +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.provisional.env.core.context; - -public interface ResourceContext -{ - /** - * This constant string is used to lookup the overwrite files general preference from - * the plugins local preferences store. - **/ - public static final String PREFERENCE_OVERWRITE = "filesOverwrite"; - - /** - * This constant string is used to lookup the create folders general preference from - * the plugins local preferences store. - **/ - public static final String PREFERENCE_CREATE_FOLDERS = "createFolders"; - - /** - * This constant string is used to lookup the checkout files general preference from - * the plugins local preferences store. - **/ - public static final String PREFERENCE_CHECKOUT = "filesCheckout"; - - /** - * - * @param enable set whether overwriting of files is enabled. - */ - public void setOverwriteFilesEnabled ( boolean enable); - - /** - * - * @return returns whether overwriting of files is enabled. - */ - public boolean isOverwriteFilesEnabled(); - - /** - * - * @param enable set whether creation of folders is enabled. - */ - public void setCreateFoldersEnabled( boolean enable); - - /** - * - * @return returns whether creation of folders is enabled. - */ - public boolean isCreateFoldersEnabled(); - - /** - * - * @param enable sets whether automatic checkout of files is enabled. - */ - public void setCheckoutFilesEnabled( boolean enable); - - /** - * - * @return returns whether automatic checkout of files is enabled. - */ - public boolean isCheckoutFilesEnabled(); - - /** - * - * @return returns a copy of this ResourceContext. - */ - public ResourceContext copy(); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/ResourceDefaults.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/ResourceDefaults.java deleted file mode 100644 index 7a22a287b..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/ResourceDefaults.java +++ /dev/null @@ -1,45 +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.provisional.env.core.context; - -public class ResourceDefaults -{ - private static final boolean PREFERENCE_OVERWRITE_DEFAULT = false; - private static final boolean PREFERENCE_CREATE_FOLDERS_DEFAULT = true; - private static final boolean PREFERENCE_CHECKOUT_DEFAULT = false; - - /** - * - * @return returns the default setting for overwriting files. - */ - public static boolean getOverwriteFilesDefault () - { - return PREFERENCE_OVERWRITE_DEFAULT; - } - - /** - * - * @return returns the default setting ofr creating folders. - */ - public static boolean getCreateFoldersDefault () - { - return PREFERENCE_CREATE_FOLDERS_DEFAULT; - } - - /** - * - * @return returns the default setting for checking out files. - */ - public static boolean getCheckoutFilesDefault() - { - return PREFERENCE_CHECKOUT_DEFAULT; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/TransientResourceContext.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/TransientResourceContext.java deleted file mode 100644 index 791aa959c..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/context/TransientResourceContext.java +++ /dev/null @@ -1,82 +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.provisional.env.core.context; - -/** - * This class implements a ResourceContext interface where the state - * of the context data is transient. - * - */ -public class TransientResourceContext implements ResourceContext -{ - private boolean overWriteFiles; - private boolean createFolders; - private boolean checkOutFiles; - - public TransientResourceContext() { - setOverwriteFilesEnabled(ResourceDefaults.getOverwriteFilesDefault()); - setCreateFoldersEnabled(ResourceDefaults.getCreateFoldersDefault()); - setCheckoutFilesEnabled(ResourceDefaults.getCheckoutFilesDefault()); - } - - /** - * @see org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext#setOverwriteFilesEnabled(boolean) - */ - public void setOverwriteFilesEnabled(boolean enable) { - overWriteFiles = enable; - } - - /** - * @see org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext#isOverwriteFilesEnabled() - */ - public boolean isOverwriteFilesEnabled() { - return overWriteFiles; - } - - /** - * @see org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext#setCreateFoldersEnabled(boolean) - */ - public void setCreateFoldersEnabled(boolean enable) { - createFolders = enable; - } - - /** - * @see org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext#isCreateFoldersEnabled() - */ - public boolean isCreateFoldersEnabled() { - return createFolders; - } - - /** - * @see org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext#setCheckoutFilesEnabled(boolean) - */ - public void setCheckoutFilesEnabled(boolean enable) { - checkOutFiles = enable; - } - - /** - * @see org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext#isCheckoutFilesEnabled() - */ - public boolean isCheckoutFilesEnabled() { - return checkOutFiles; - } - - /** - * @see org.eclipse.wst.command.internal.provisional.env.core.context.ResourceContext#copy() - */ - 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.core/src/org/eclipse/wst/command/internal/provisional/env/core/data/DataMappingRegistry.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/data/DataMappingRegistry.java deleted file mode 100644 index b34a8748b..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/data/DataMappingRegistry.java +++ /dev/null @@ -1,47 +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.provisional.env.core.data; - -public interface DataMappingRegistry -{ - /** - * This method adds a data mapping from a source object to a target - * object. When the sourceObject is encountered by the framework the - * sourceProperty will be called and the data will be passed to the - * targetProperty in the targetObject. If a transformer object is - * specified the sourceObject is transformed before being passed to - * the target object. - * - * @param sourceType The source object. - * @param sourceProperty The source property. - * @param targetType The target object. - * @param targetProperty The target property. - * @param transformer The transformer object that transforms the - * the source object. - */ - public void addMapping( Class sourceType, - String sourceProperty, - Class targetType, - String targetProperty, - Transformer transformer ); - - /** - * This method is equivalent to the above with targetProperty the same - * as the sourceProperty and with the transformer set to null. - * - * @param sourceType The source object. - * @param sourceProperty The source property. - * @param targetType The target object. - */ - public void addMapping( Class sourceType, - String sourceProperty, - Class targetType ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/data/Transformer.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/data/Transformer.java deleted file mode 100644 index 1c2bdb2e6..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/data/Transformer.java +++ /dev/null @@ -1,23 +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.provisional.env.core.data; - -/** - * This interface is used to transform an object from one class to another. - * - */ -public interface Transformer -{ - /* - * @return returns a transformed object based on the input value. - */ - public Object transform( Object value ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/BooleanSelection.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/BooleanSelection.java deleted file mode 100644 index 13865219c..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/BooleanSelection.java +++ /dev/null @@ -1,45 +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 - *******************************************************************************/ -/** - * This class combines a string with a boolean value. This is - * useful for storing the state data for a boolean selection list. - */ -package org.eclipse.wst.command.internal.provisional.env.core.selection; - -public class BooleanSelection -{ - private String value_; - private boolean selected_; - - public BooleanSelection( String value, boolean selected ) - { - value_ = value; - selected_ = selected; - } - - /** - * - * @return Get the string value. - */ - public String getValue() - { - return value_; - } - - /** - * - * @return Get the boolean value for this string. - */ - public boolean isSelected() - { - return selected_; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/ChoicesToString.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/ChoicesToString.java deleted file mode 100644 index 5f39b4e83..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/ChoicesToString.java +++ /dev/null @@ -1,47 +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.provisional.env.core.selection; - -import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer; - -/** - * This transformer class selects a string at a particular level - * in a SelectionListChoices class. - */ -public class ChoicesToString implements Transformer -{ - private int level_; - - public ChoicesToString( int level ) - { - level_ = level; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.command.internal.provisional.env.core.data.Transformer#transform(java.lang.Object) - */ - public Object transform( Object value ) - { - SelectionListChoices choices = (SelectionListChoices)value; - - for( int index = 0; index < level_; index++ ) - { - choices = choices.getChoice(); - } - - return choices.getList().getSelection(); - } - - public SelectionList transform( SelectionListChoices choices ) - { - return (SelectionList)transform( (Object)choices ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/DynamicList.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/DynamicList.java deleted file mode 100644 index a76b04b76..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/DynamicList.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.provisional.env.core.selection; - -import java.util.Vector; - -/** - * This is a Dynamic version of the SelectionListChoices class. - */ -public class DynamicList -{ - private Vector stringList_ = new Vector(); - private Vector dynamicListVectorList_ = new Vector(); - - /** - * Adds an entry into the dynamic list. - * - * @param values the string values that lead to the target. - * @param target the target. - */ - public void add( String[] values, Object target ) - { - DynamicList currentList = this; - - for( int index = 0; index < values.length; index++ ) - { - String value = values[index]; - int length = currentList.stringList_.size(); - int foundIndex = -1; - - // Find the string in the current list. - for( int searchIndex = 0; searchIndex < length; searchIndex++ ) - { - String string = (String)currentList.stringList_.elementAt( searchIndex ); - - if( string.equals( value ) ) - { - foundIndex = searchIndex; - break; - } - } - - if( foundIndex == -1 ) - { - // We have a new string so add it to the list. - currentList.stringList_.add( value ); - currentList.dynamicListVectorList_.add( new DynamicList() ); - foundIndex = length; - } - - currentList = (DynamicList)currentList.dynamicListVectorList_.elementAt( foundIndex ); - } - - currentList.dynamicListVectorList_.add( target ); - } - - /** - * - * @return returns a SelectionListChoices object from this DynamicList - * object. - */ - public SelectionListChoices toListChoices() - { - SelectionList list = new SelectionList( (String[])stringList_.toArray( new String[0] ), 0); - int length = dynamicListVectorList_.size(); - Vector vector = new Vector(); - - for( int index = 0; index < length; index++ ) - { - Object obj = dynamicListVectorList_.elementAt(index); - - if( obj instanceof DynamicList ) - { - vector.add( ((DynamicList)obj).toListChoices() ); - } - else - { - vector.add( obj ); - } - } - - return new SelectionListChoices( list, vector ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/SelectionList.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/SelectionList.java deleted file mode 100644 index d6354dbb1..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/SelectionList.java +++ /dev/null @@ -1,96 +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.provisional.env.core.selection; - -/** - * This class stores a list strings along with a selectionIndex which - * stores the current string that selected. There is also a selection - * value. If this value is one of the strings in the the string list - * then selectionIndex will contain the index of this string. If it - * is not in the list then the selectionValue string will contain this - * value and selectionIndex will be set to -1. This class can be - * used to store the state data for a Combo box. - */ -public class SelectionList -{ - private int selectionIndex_; - private String[] list_; - private String selectionValue_; - - public SelectionList( String[] list, int selectionIndex ) - { - list_ = list; - selectionIndex_ = selectionIndex; - } - - /** - * Sets the selection value for this object. - * - * @param value the value. - */ - public void setSelectionValue( String value ) - { - selectionValue_ = value; - selectionIndex_ = -1; - - for( int index = 0; index < list_.length; index++ ) - { - if( value.equals( list_[index] ) ) - { - selectionIndex_ = index; - break; - } - } - } - - /* - * @return returns the string list. - */ - public String[] getList() - { - return list_; - } - - /* - * Sets the currently selected string in the list. - */ - public void setIndex( int index ) - { - selectionIndex_ = index; - selectionValue_ = null; - } - - /* - * @return returns the index of the current string. The value - * will be -1 if the selection value is not in the string list. - */ - public int getIndex() - { - return selectionIndex_; - } - - /* - * @return returns the current string selection for this object. - */ - public String getSelection() - { - if( selectionValue_ != null ) return selectionValue_; - - if( selectionIndex_ == -1 || selectionIndex_ > list_.length-1 ) - { - return ""; - } - else - { - return list_[ selectionIndex_ ]; - } - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/SelectionListChoices.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/SelectionListChoices.java deleted file mode 100644 index 04b0d72fa..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/selection/SelectionListChoices.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.provisional.env.core.selection; - -import java.util.Vector; - -/* - * This class can be used to store a hierarchy of SelectionList - * objects. - */ -public class SelectionListChoices -{ - private SelectionList selectionList_; - private Vector choices_; - private SelectionList newValueSelectionList_; - - /** - * - * @param list The selection list. - * @param choices This is a vector of SelectionListChoies and can be - * null if there are no choices. This index of list - * is used to index into choices. If index is -1 then - * the newValueSelectionList is used. - */ - public SelectionListChoices( SelectionList list, Vector choices ) - { - selectionList_ = list; - choices_ = choices; - - newValueSelectionList_ = new SelectionList( new String[0], -1 ); - } - - public SelectionListChoices( SelectionList list, Vector choices, SelectionList newList ) - { - this( list, choices ); - newValueSelectionList_ = newList; - } - - /** - * @return returns the current Selection list. - */ - public SelectionList getList() - { - return selectionList_; - } - - /** - * - * @return returns the choices for this object. - */ - public Vector getChoices() - { - return choices_; - } - - /** - * - * @param level the level in the hierarchy where we want to get the choices. - * @return returns a vector of SelectionListChoices. - */ - public Vector getChoicesAtLevel( int level ) - { - SelectionListChoices choices = this; - - for( int index = 0; index < level; index++ ) - { - choices = choices.getChoice(); - } - - return choices.getChoices(); - } - - /** - * - * @return returns the current SelectionListChoice - */ - public SelectionListChoices getChoice() - { - int selectionIndex = selectionList_.getIndex(); - SelectionListChoices result = null; - - if( selectionIndex == -1 ) - { - result = new SelectionListChoices( newValueSelectionList_, null ); - } - else if( choices_ != null && choices_.size() != 0 ) - { - result = (SelectionListChoices)choices_.elementAt( selectionIndex ); - } - - return result; - } - - /** - * - * @param index the index of the choice we want. - * @return returns the SelectionListChoice at the index specified. - */ - public SelectionListChoices getChoice(int index) - { - SelectionListChoices result = null; - if (index < 0 || index >= getList().getList().length) - { - result = new SelectionListChoices( newValueSelectionList_, null ); - } - else - { - result = (SelectionListChoices)choices_.elementAt( index ); - } - - return result; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/NativeFileCommand.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/NativeFileCommand.java deleted file mode 100644 index c0f6e2335..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/NativeFileCommand.java +++ /dev/null @@ -1,115 +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.provisional.env.core.uri; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.wst.command.internal.provisional.env.core.EnvironmentalOperation; - -public abstract class NativeFileCommand extends EnvironmentalOperation -{ - protected String name; - - protected String description; - - protected URI[] urisToRead; - - protected URI[] urisToWrite; - - protected NativeFileCommand () - { - this(null,null); - } - - protected NativeFileCommand ( String name, String description ) - { - this.name = name; - this.description = description; - } - - public String getName () - { - return name; - } - - public String getDescription () - { - return description; - } - - public void setURIsToRead ( URI[] urisToRead ) - { - this.urisToRead = urisToRead; - } - - public URI[] getURIsToRead () - { - return urisToRead; - } - - public void setURIsToWrite ( URI[] urisToWrite ) - { - this.urisToWrite = urisToWrite; - } - - public URI[] getURIsToWrite () - { - return urisToWrite; - } - - public IStatus execute ( IProgressMonitor monitor, IAdaptable adaptable ) - { - File[] filesToRead = getFiles(urisToRead); - File[] filesToWrite = getFiles(urisToWrite); - preProcess(filesToRead,filesToWrite); - IStatus status = execute(filesToRead,filesToWrite); - postProcess(filesToRead,filesToWrite); - return status; - } - - public abstract IStatus execute ( File[] filesToRead, File[] filesToWrite ); - - private void preProcess ( File[] filesToRead, File[] filesToWrite ) - { - // TBD. - } - - private void postProcess ( File[] filesToRead, File[] filesToWrite ) - { - // TBD. - } - - private File[] getFiles ( URI[] uris ) - { - List list = new LinkedList(); - if (uris != null) - { - for (int i=0; i<uris.length; i++) - { - if (uris[i].isAvailableAsFile()) - { - try - { - list.add(uris[i].asFile()); - } - catch (URIException e) - { - } - } - } - } - return (File[])list.toArray(new File[0]); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/RelativeScheme.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/RelativeScheme.java deleted file mode 100644 index 618fc12a4..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/RelativeScheme.java +++ /dev/null @@ -1,80 +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.provisional.env.core.uri; - -import java.net.URL; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; - - -public class RelativeScheme implements URIScheme -{ - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#isHierarchical() - */ - public boolean isHierarchical() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#isValid(org.eclipse.env.uri.URI) - */ - public boolean isValid(URI uri) - { - return !uri.toString().startsWith( "/" ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#newURI(java.lang.String) - */ - public URI newURI(String uri) - { - return new RelativeURI( uri ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#newURI(org.eclipse.env.uri.URI) - */ - public URI newURI(URI uri) - { - return new RelativeURI( uri.toString() ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#newURI(java.net.URL) - */ - public URI newURI(URL url) - { - return new RelativeURI( url.toString() ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URIScheme#validate(org.eclipse.env.uri.URI) - */ - public IStatus validate(URI uri) - { - IStatus result = null; - - if( isValid( uri ) ) - { - result = Status.OK_STATUS; - } - else - { - result = StatusUtils.errorStatus( "" ); - } - - return result; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/RelativeURI.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/RelativeURI.java deleted file mode 100644 index f00e01ffa..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/RelativeURI.java +++ /dev/null @@ -1,282 +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.provisional.env.core.uri; - -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; - - -public class RelativeURI implements URI -{ - protected String uri_; - - public RelativeURI( String uri ) - { - uri_ = uri; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#append(org.eclipse.env.uri.URI) - */ - public URI append(URI relativeURI) throws URIException - { - if( !relativeURI.isRelative()) - { - MessageUtils msg = new MessageUtils( "org.eclipse.wst.command.env.core.environment", new Dummy() ); - - throw new URIException( - StatusUtils.errorStatus( - msg.getMessage( "MSG_URI_NOT_RELATIVE", new Object[]{ relativeURI.toString() }) ) ); - - } - - String newURI = uri_ + "/" + relativeURI.toString(); - - return getURIScheme().newURI( newURI ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#asFile() - */ - public File asFile() - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#asString() - */ - public String asString() - { - return uri_; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#toString() - */ - public String toString() - { - return uri_; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#asURL() - */ - public URL asURL() throws URIException - { - URL url = null; - - try - { - url = new URL( uri_ ); - } - catch( MalformedURLException exc ) - { - throw new URIException( StatusUtils.errorStatus( exc ), this ); - } - - return url; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#erase() - */ - public void erase() throws URIException - { - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#getInputStream() - */ - public InputStream getInputStream() throws URIException - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#getOutputStream() - */ - public OutputStream getOutputStream() throws URIException - { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#getURIScheme() - */ - public URIScheme getURIScheme() - { - return new RelativeScheme(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isAvailableAsFile() - */ - public boolean isAvailableAsFile() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isAvailableAsURL() - */ - public boolean isAvailableAsURL() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isHierarchical() - */ - public boolean isHierarchical() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isLeaf() - */ - public boolean isLeaf() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isPresent() - */ - public boolean isPresent() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isReadable() - */ - public boolean isReadable() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isRelative() - */ - public boolean isRelative() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#isWritable() - */ - public boolean isWritable() - { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#list() - */ - public URI[] list() throws URIException - { - return new URI[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#list(org.eclipse.env.uri.URIFilter) - */ - public URI[] list(URIFilter uriFilter) throws URIException - { - return new URI[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#parent() - */ - public URI parent() throws URIException - { - int lastSlash = uri_.lastIndexOf( '/' ); - int firstSlash = uri_.indexOf( '/' ); - - // If there is a parent, then it must start with a slash - // and end with a slash. - if( lastSlash == -1 || firstSlash == -1 ) return null; - - return getURIScheme().newURI( uri_.substring(0, lastSlash ) ); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#rename(org.eclipse.env.uri.URI) - */ - public void rename(URI newURI) throws URIException - { - uri_ = newURI.toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#touchFolder() - */ - public void touchFolder() throws URIException - { - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#touchLeaf() - */ - public void touchLeaf() throws URIException - { - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#visit(org.eclipse.env.uri.URIVisitor, org.eclipse.env.uri.URIFilter) - */ - public void visit(URIVisitor uriVisitor, URIFilter uriFilter) - throws URIException - { - boolean continueVisit = true; - - // If the filter accepts this we will visit it. - if( uriFilter.accepts( this ) ) - { - continueVisit = uriVisitor.visit( this ); - } - - URI[] children = list(); - - for( int index = 0; index < children.length && continueVisit; index++ ) - { - children[index].visit( uriVisitor, uriFilter ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.env.uri.URI#visit(org.eclipse.env.uri.URIVisitor) - */ - public void visit(URIVisitor uriVisitor) throws URIException - { - boolean continueVisit = uriVisitor.visit( this ); - - URI[] children = list(); - - for( int index = 0; index < children.length && continueVisit; index++ ) - { - children[index].visit( uriVisitor ); - } - } - - private class Dummy - { - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/SimpleURIFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/SimpleURIFactory.java deleted file mode 100644 index 198a7e30e..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/SimpleURIFactory.java +++ /dev/null @@ -1,93 +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.provisional.env.core.uri; - -import java.net.URL; -import java.util.Hashtable; -import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils; -import org.eclipse.wst.command.internal.provisional.env.core.common.StatusUtils; - - -public class SimpleURIFactory implements URIFactory -{ - private Hashtable schemes_ = new Hashtable(); - private MessageUtils msg_ = new MessageUtils( "org.eclipse.wst.command.env.core.environment", this ); - - - /* (non-Javadoc) - */ - public URI newURI(String uri) throws URIException - { - URIScheme scheme = newURIScheme( uri ); - - return scheme.newURI( uri ); - } - - /* (non-Javadoc) - */ - public URI newURI(URL url) throws URIException - { - URIScheme scheme = newURIScheme( url.toString() ); - - return scheme.newURI( url ); - } - - /* (non-Javadoc) - */ - public URIScheme newURIScheme(String schemeOrURI) throws URIException - { - URIScheme newScheme = null; - - if( schemeOrURI == null ) - { - throw new URIException( - StatusUtils.errorStatus( - msg_.getMessage( "MSG_NULL_ARG_SPECIFIED", new Object[]{"newURIScheme"}) ) ); - } - - int colon = schemeOrURI.indexOf(':'); - int slash = schemeOrURI.indexOf('/'); - - // A protocol was specified. Note: a colon appearing after a path is not - // considered part of the protocol for this URI. - if( (colon != -1 && slash == -1) || ( colon != -1 && colon < slash ) ) - { - String protocol = schemeOrURI.substring(0, colon ); - newScheme = (URIScheme)schemes_.get( protocol ); - - if( newScheme == null ) - { - throw new URIException( - StatusUtils.errorStatus( - msg_.getMessage( "MSG_SCHEME_NOT_FOUND", new Object[]{ schemeOrURI }) ) ); - - } - } - else if( schemeOrURI.startsWith( "/") ) - { - throw new URIException( - StatusUtils.errorStatus( - msg_.getMessage( "MSG_ABSOLUTE_PATH_WITHOUT_SCHEME", new Object[]{ schemeOrURI }) ) ); - - } - else - { - newScheme = new RelativeScheme(); - } - - return newScheme; - } - - public void registerScheme( String protocol, URIScheme scheme ) - { - schemes_.put( protocol, scheme ); - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URI.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URI.java deleted file mode 100644 index 04e04842d..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URI.java +++ /dev/null @@ -1,202 +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.provisional.env.core.uri; - -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; - -/** - * A URI represents a Univeral Resource Identifer. - */ -public interface URI -{ - /** - * Returns the string form of the URI. - * The resource need not exist. - */ - public String toString (); - - /** - * Returns the URIScheme for the scheme of this URI. - * The resource need not exist. - */ - public URIScheme getURIScheme (); - - /** - * Returns true iff the resource identified by this URI exists. - */ - public boolean isPresent (); - - /** - * Returns true iff the resource identified by this URI exists - * and is a leaf. Returns true always for non-hierarchical schemes. - */ - public boolean isLeaf (); - - /** - * Returns true iff the resource identified by this URI exists - * and is readable. A readable leaf resource indicates that an - * input stream can be opened on the resource. A readable folder - * resource indicates that the children of the folder, if any, - * can be determined via the list() or visit() methods. - */ - public boolean isReadable (); - - /** - * Returns true iff the resource identified by this URI exists - * and is writable. A writable leaf resource indicates that an - * output stream can be opened on the resource. A writable folder - * resource indicates that new resources can be created in the folder. - */ - public boolean isWritable (); - - /** - * Returns true iff this URI belongs to a hierarchical scheme. - * The resource need not exist. - * this.isHierarchical() == this.getURIScheme().isHierarchical(). - */ - public boolean isHierarchical (); - - /** - * Returns true iff this URI is a relative URI. - * The resource need not exist. - */ - public boolean isRelative (); - - /** - * Returns the URI of the folder containing this URI. - * The resource need not exist. - */ - public URI parent () throws URIException; - - /** - * Returns a new, normalized URI formed by appending the given - * relative URI to this URI. Both URIs must be hierarchical. - * The resulting URI will always be hierarchical. The given - * URI must be relative. This URI can be relative or absolute. - * the resulting URI will be equivalently relative or absolute. - */ - public URI append ( URI relativeURI ) throws URIException; - - /** - * Gets an InputStream for reading from the resource - * identified by this leaf or non-hierarchical URI. - */ - public InputStream getInputStream () throws URIException; - - /** - * Gets an OutputStream for writing to the resource - * identified by this leaf or non-hierarchical URI. - */ - public OutputStream getOutputStream () throws URIException; - - /** - * Creates a new, empty resource at the location identified by - * the URI. On completion, this.isLeaf() == true. If a leaf - * resource already exists, this method does nothing. If a - * non-leaf resource already exists under this URI, creation - * will fail and an exception will be thrown. - */ - public void touchLeaf () throws URIException; - - /** - * Creates a new folder resource at the location identified by - * the URI. The scheme of the URI must be hierarchical. - * On completion, this.isLeaf() == false. If a folder resource - * already exists, this method does nothing. If a leaf resource - * already exists under this URI, creation will fail and an - * exception will be thrown. - */ - public void touchFolder () throws URIException; - - /** - * Erases the resource identified by this URI. - */ - public void erase () throws URIException; - - /** - * Renames or moves the resource identified by this URI - * to the new URI. - */ - public void rename ( URI newURI ) throws URIException; - - /** - * Visits this resource and its decendants in pre-order fashion. - * For each resource, whether a folder or a leaf, the given - * URIVisitor's visit() method is called with the URI of the - * resource. If URIVisitor.visit() returns false, the visiting - * algorithm will "prune" the decendants of the resource and - * carry on visiting the rest of the tree. If URIVisitor.visit() - * returns true, the visiting algorithm will continue its walk - * down the resource's descendants. - */ - public void visit ( URIVisitor uriVisitor ) throws URIException; - - /** - * As for visit(URIVisitor), except only resource URIs that are - * accepted by the given filter are visited. If a folder resource - * fails to be accepted by the filter, this will not prevent the - * visiting algorithm from walking the resource's descendants. - * It remains the job of the visitor to choose whether or not to - * prune a branch by returning false or true. - */ - public void visit ( URIVisitor uriVisitor, URIFilter uriFilter ) throws URIException; - - /** - * Returns a list of URIs for the immediate children of the given - * hierarchical, non-leaf URI. This method never returns null, - * though it may return a zero length array. - */ - public URI[] list () throws URIException; - - /** - * As for list(), except only URIs that are accepted by the given - * filter are returned in the array. This method never returns null, - * though it may return a zero length array. - */ - public URI[] list ( URIFilter uriFilter ) throws URIException; - - /** - * Returns true if the asURL() method is fair game, - * in other words, if this URI can be converted into a URL. - */ - public boolean isAvailableAsURL (); - - /** - * Returns a URL object for the resource under this URI. - * There are many URIs and URISchemes for which this method - * will fail and throw an exception. It should be used only - * in cases where URIs are known to be representable as URLs. - */ - public URL asURL () throws URIException; - - /** - * Returns true if the asFile() method is fair game, - * in other words, if this URI can be converted into a File. - */ - public boolean isAvailableAsFile (); - - /** - * Returns a File object for the resource under this URI. - * There are many URIs and URISchemes for which this method - * will fail and throw an exception. It should be used only - * in cases where URIs are known to be backed by physical files. - */ - public File asFile () throws URIException; - - /** - * Returns the URI as a string. - * Equivalent to toString(). - */ - public String asString (); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIException.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIException.java deleted file mode 100644 index feab1948c..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIException.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.command.internal.provisional.env.core.uri; - -import org.eclipse.core.runtime.IStatus; - -/** - * This is the base class for most exceptions thrown by URI classes. - * Every URIException carries a URI and a Status, each of which may - * be null. The getMessage() method as inherited from Exception will - * return the message from the URIExceptin's Status object, if any. - */ -public class URIException extends Exception -{ - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 3258130271424756018L; - - /** - * A Status object containing details about the exception, - * if applicable. - */ - protected IStatus status; - - /** - * The URI for which the exception occured, - * if applicable. - */ - protected URI uri; - - /** - * Creates a new URIException with the given Status. - * The status may be null. - */ - public URIException ( IStatus status ) - { - super(); - this.status = status; - } - - /** - * Creates a new URIException for the given Status and URI, - * each of which may be null. - */ - public URIException ( IStatus status, URI uri ) - { - super(status != null ? status.getMessage() : null); - this.status = status; - this.uri = uri; - } - - /** - * Returns the Status object inside this exception. - */ - public IStatus getStatus () - { - return status; - } - - /** - * Returns the URI inside this exception. - */ - public URI getURI () - { - return uri; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIFactory.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIFactory.java deleted file mode 100644 index 63815f0a6..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIFactory.java +++ /dev/null @@ -1,39 +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.provisional.env.core.uri; - -import java.net.URL; - -/** - * This is a factory for creating new URI and URIScheme objects. - */ -public interface URIFactory -{ - /** - * Creates and returns a new URI for the given string. - */ - public URI newURI ( String uri ) throws URIException; - - /** - * Creates and returns a new URI for the given URL. - */ - public URI newURI ( URL url ) throws URIException; - - /** - * Creates and returns a new URIScheme for the given scheme string. - * If the string contains no colons, the entire string is interpretted - * as the name of the scheme. If the string contains a colon, then the - * substring up to but excluding the first colon is interpretted as the - * name of the scheme, meaning the caller can pass in any URI string in - * order to get a URIScheme object. - */ - public URIScheme newURIScheme ( String schemeOrURI ) throws URIException; -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIFilter.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIFilter.java deleted file mode 100644 index 80e1118a5..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIFilter.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.provisional.env.core.uri; - -/** - * This interface is implemented by classes that visit or list URIs. - * Refer to {@link URI#getChildren}. - */ -public interface URIFilter -{ - /** - * Filters the given URI. - * @param uri The resource to filter. - * @return True if the resource matches the filter, - * false if it does not. - * @throws URIException If the filter fails to analyze the resource. - */ - public boolean accepts ( URI uri ) throws URIException; -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIScheme.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIScheme.java deleted file mode 100644 index 424ce2b1f..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIScheme.java +++ /dev/null @@ -1,62 +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.provisional.env.core.uri; - -import java.net.URL; -import org.eclipse.core.runtime.IStatus; - -/** - * A URIScheme represents a single scheme for some a family of - * Univeral Resource Identifiers. Examples include "file", "http" - * and "platform" (Eclipse). - */ -public interface URIScheme -{ - /** - * Returns a new URI. - */ - public URI newURI ( String uri ) throws URIException; - - /** - * Returns a new URI. - */ - public URI newURI ( URL url ) throws URIException; - - /** - * Returns a new URI. - */ - public URI newURI ( URI uri ) throws URIException; - - /** - * Returns the proper name of the scheme. - */ - public String toString (); - - /** - * Returns true if and only if this is a hierarchical scheme. - */ - public boolean isHierarchical (); - - /** - * Returns true if and only if the given URI satisfies the - * grammatical requirements of the scheme. Absolute URIs must - * begin with "<scheme>:". Relative URIs must either not contain - * a colon, ":", or it must begin with "./". - */ - public boolean isValid ( URI uri ); - - /** - * Returns a Status object indicating whether or not the given - * URI is valid. The severity and message of the Status object - * will describe this. - */ - public IStatus validate ( URI uri ); -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIUtils.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIUtils.java deleted file mode 100644 index 59e7ef5fb..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIUtils.java +++ /dev/null @@ -1,50 +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.provisional.env.core.uri; - -/** - * This class contains several static utility methods for - * working with URIs. - */ -public class URIUtils -{ - /** - * Copies all bytes from the old URI to the new URI. - */ - public static void copy ( URI oldUri, URI newUri ) throws URIException - { - } - - /** - * Moves one URI to another. - */ - public static void move ( URI oldUri, URI newUri ) throws URIException - { - } - - /** - * Constructs a new, temporary leaf URI. - * The scheme of the URI may be, but is not guaranteed to be, "file:". - */ - public static URI getTemporaryLeafURI () throws URIException - { - return null; - } - - /** - * Constructs a new, temporary folder URI. - * The scheme of the URI may be, but is not guaranteed to be, "file:". - */ - public static URI getTemporaryFolderURI () throws URIException - { - return null; - } -} diff --git a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIVisitor.java b/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIVisitor.java deleted file mode 100644 index 830162429..000000000 --- a/bundles/org.eclipse.wst.command.env.core/src/org/eclipse/wst/command/internal/provisional/env/core/uri/URIVisitor.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.provisional.env.core.uri; - -/** - * This interface is implemented by classes that visit URIs. - * Refer to {@link URI#visit}. - */ -public interface URIVisitor -{ - /** - * Visits the given URI. - * @param uri The resource to visit. - * @return True if the resource's descendants should be visited, - * or false if they should not be visited. - * @throws URIException If the visit method fails. - */ - public boolean visit ( URI uri ) throws URIException; -} |