Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst')
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/Choice.java103
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/EnvironmentException.java60
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/EnvironmentService.java89
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/IEnvironment.java52
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/ILog.java130
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/IStatusHandler.java54
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/NullStatusHandler.java70
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/StatusException.java74
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURI.java227
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIFactory.java52
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIFilter.java31
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIScheme.java75
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIVisitor.java29
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/SimpleURIFactory.java130
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/URIException.java83
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/ConsoleEclipseEnvironment.java67
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseLog.java165
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseScheme.java197
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseURI.java518
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/FileResourceOutputStream.java145
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/FileResourceUtils.java550
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/Messages.java39
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/environment.properties40
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/plugin/EnvironmentPlugin.java45
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/relative/RelativeScheme.java87
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/relative/RelativeURI.java271
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/uri/file/FileScheme.java106
-rw-r--r--plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/uri/file/FileURI.java297
28 files changed, 0 insertions, 3786 deletions
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/Choice.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/Choice.java
deleted file mode 100644
index dcd58e4e6..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/Choice.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment;
-
-/**
- *
- * This class is used by the IStatusHandler interface.
- * It allows code that is reporting status to specify choices to the user
- * which this reporting code can react to.
- *
- * @since 1.0
- */
-public class Choice {
-
- private char shortcut = ' ';
- private String label = null;
- private String description = null;
-
- /**
- * Constructor for Choice.
- */
- public Choice() {
- }
-
- /**
- * Constructor for Choice.
- * @param shortcut the single letter shortcut for this choice.
- * @param label the label to be displayed to the user for this choice.
- */
- public Choice(char shortcut, String label) {
- this.shortcut = shortcut;
- this.label = label;
- }
-
- /**
- * Constructor for Choice.
- * @param shortcut the single letter shortcut for this choice.
- * @param label the label to be displayed to the user for this choice.
- * @param description the description for this choice.
- */
- 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/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/EnvironmentException.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/EnvironmentException.java
deleted file mode 100644
index 3d32d384b..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/EnvironmentException.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * This is the exception class for conditions raised by the IEnvironment.
- *
- * @since 1.0
- */
-public class EnvironmentException extends Exception
-{
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 3978983275899402036L;
-
- /**
- * The status for this exception.
- */
- protected IStatus status = null;
-
- /**
- * Creates a new EnvironmentException.
- */
- public EnvironmentException ()
- {
- super();
- }
-
- /**
- * Creates a new EnvironmentException.
- *
- * @param status the status for this exception.
- */
- public EnvironmentException ( IStatus status )
- {
- super(status == null ? null : status.getMessage());
- this.status = status;
- }
-
- /**
- * Returns the Status object.
- *
- * @return the status for this exception.
- */
- public IStatus getStatus()
- {
- return status;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/EnvironmentService.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/EnvironmentService.java
deleted file mode 100644
index 5663fec34..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/EnvironmentService.java
+++ /dev/null
@@ -1,89 +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.common.environment;
-
-import org.eclipse.wst.common.environment.uri.IURIScheme;
-import org.eclipse.wst.common.environment.uri.URIException;
-import org.eclipse.wst.common.internal.environment.eclipse.ConsoleEclipseEnvironment;
-
-/**
- *
- * This class creates a console environment. It also contains static
- * conviences methods for creating an ILog object as well as an Eclipse and
- * File Scheme.
- *
- * @since 1.0
- *
- */
-public class EnvironmentService
-{
- static private IEnvironment environment;
-
- /**
- *
- * @return returns an Eclipse console environment.
- */
- public static IEnvironment getEclipseConsoleEnvironment()
- {
- if( environment == null ) environment = new ConsoleEclipseEnvironment();
-
- return environment;
- }
-
- /**
- *
- * @return returns an Eclipse logger.
- */
- public static ILog getEclipseLog()
- {
- IEnvironment environment = getEclipseConsoleEnvironment();
-
- return environment.getLog();
- }
-
- /**
- *
- * @return returns an Eclipse scheme.
- */
- public static IURIScheme getEclipseScheme()
- {
- IEnvironment environment = getEclipseConsoleEnvironment();
- IURIScheme scheme = null;
-
- try
- {
- scheme = environment.getURIFactory().newURIScheme( "platform" );
- }
- catch( URIException exc )
- {
- }
-
- return scheme;
- }
-
- /**
- *
- * @return returns a File scheme.
- */
- public static IURIScheme getFileScheme()
- {
- IEnvironment environment = getEclipseConsoleEnvironment();
- IURIScheme scheme = null;
-
- try
- {
- scheme = environment.getURIFactory().newURIScheme( "file" );
- }
- catch( URIException exc )
- {
- }
-
- return scheme;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/IEnvironment.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/IEnvironment.java
deleted file mode 100644
index 39503be2c..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/IEnvironment.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment;
-
-import org.eclipse.wst.common.environment.uri.IURIFactory;
-
-
-/**
- * An IEnvironment provides the means for getting 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>
- *
- * @since 1.0
- */
-public interface IEnvironment
-{
- /**
- * Returns a logging facility.
- *
- * @return returns a logging facility.
- */
- public ILog getLog ();
-
- /**
- * Returns a status handler.
- *
- * @return returns a status handler.
- */
- public IStatusHandler getStatusHandler ();
-
- /**
- * Returns a IURI factory.
- * Hint: Implementers should insure that the Factory they return
- * has a reference to this IEnvironment so that IURI objects can
- * report progress and announce status.
- *
- * @return returns a URI factory.
- */
- public IURIFactory getURIFactory ();
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/ILog.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/ILog.java
deleted file mode 100644
index 291fcabad..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/ILog.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * ILog objects provide a means for logging information for FFDC etc.
- *
- * @since 1.0
- */
-public interface ILog
-{
- /**
- * This constant indicates that a logging message is Ok.
- */
- public static final int OK = 0;
-
- /**
- * This constant indicates that a logging message is informational.
- */
- public static final int INFO = 1;
-
- /**
- * This constant indicates that a logging message is warning.
- */
- public static final int WARNING = 2;
-
- /**
- * This constant indicates that a logging message is an error.
- */
- 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 this debug option is set to true.
- *
- * @param option this debug option string.
- * @return returns true if this 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 option this debug option string.
- * @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 option this debug option string.
- * @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 option this debug option string.
- * @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/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/IStatusHandler.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/IStatusHandler.java
deleted file mode 100644
index 4492a99af..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/IStatusHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment;
-
-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.
- *
- * @since 1.0
- */
-public interface IStatusHandler
-{
- /**
- * Reports the given Status and set of possible responses.
- *
- * @param status the status to report.
- * @param choices the choices that will be displayed to the user.
- * @return returns the choice made by the user/handler.
- */
- public Choice report ( IStatus status, Choice[] choices );
-
- /**
- * Reports the given Status with implied options to either
- * continue or abort.
- * @param status the status to report.
- * @throws StatusException 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 the error status to report.
- */
- public void reportError( IStatus status );
-
- /**
- * Report the given Info Status. No user feedback is provided.
- * @param status the info status to report.
- */
- public void reportInfo( IStatus status );
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/NullStatusHandler.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/NullStatusHandler.java
deleted file mode 100644
index af1f1de71..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/NullStatusHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- *
- * This class provides a default implementation of the IStatusHandler interface.
- *
- * @since 1.0
- *
- */
-public class NullStatusHandler implements IStatusHandler
-{
-
- /**
- * @see org.eclipse.env.common.IStatusHandler#report(org.eclipse.core.runtime.IStatus, 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.IStatusHandler#report(org.eclipse.core.runtime.IStatus)
- */
- public void report(IStatus status) throws StatusException
- {
- }
-
- /*
- * Report and error.
- */
- private boolean reportErrorStatus(IStatus status)
- {
- return false;
- }
-
- /**
- * @see org.eclipse.wst.common.environment.IStatusHandler#reportError(org.eclipse.core.runtime.IStatus)
- */
- public void reportError(IStatus status)
- {
- reportErrorStatus( status );
- }
-
- /**
- * @see org.eclipse.wst.common.environment.IStatusHandler#reportInfo(org.eclipse.core.runtime.IStatus)
- */
- public void reportInfo(IStatus status)
- {
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/StatusException.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/StatusException.java
deleted file mode 100644
index b01b8ca7a..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/StatusException.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * This is the exception class used by StatusHandlers to tell their
- * callers that processing should stop.
- *
- * @since 1.0
- */
-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.
- * @param status the status for this exception.
- */
- public StatusException( IStatus status )
- {
- super( status );
- }
-
- /**
- * Creates a new StatusException with the given Choice.
- * The Choice may be null.
- * @param choice the choice for this exception.
- */
- public StatusException ( Choice choice )
- {
- super();
- this.choice = choice;
- }
-
- /**
- * Creates a new StatusException with the given Choice
- * and status object. The Choice may be null.
- *
- * @param status the status for this exception.
- * @param choice the choice for this exception.
- */
- public StatusException ( IStatus status, Choice choice )
- {
- super(status);
- this.choice = choice;
- }
-
- /**
- * @return Returns the Choice object inside this exception.
- */
- public Choice getChoice ()
- {
- return choice;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURI.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURI.java
deleted file mode 100644
index 28a63bd4d..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURI.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment.uri;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-
-/**
- * A IURI represents a Univeral Resource Identifer.
- *
- * @since 1.0
- */
-public interface IURI
-{
- /**
- * @return Returns the string form of the IURI.
- * The resource need not exist.
- */
- public String toString ();
-
- /**
- * @return Returns the IURIScheme for the scheme of this IURI.
- * The resource need not exist.
- */
- public IURIScheme getURIScheme ();
-
- /**
- * @return Returns true iff the resource identified by this IURI exists.
- */
- public boolean isPresent ();
-
- /**
- * @return Returns true iff the resource identified by this IURI exists
- * and is a leaf. Returns true always for non-hierarchical schemes.
- */
- public boolean isLeaf ();
-
- /**
- * @return Returns true iff the resource identified by this IURI 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 ();
-
- /**
- * @return Returns true iff the resource identified by this IURI 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 ();
-
- /**
- * @return Returns true iff this IURI belongs to a hierarchical scheme.
- * The resource need not exist.
- * this.isHierarchical() == this.getURIScheme().isHierarchical().
- */
- public boolean isHierarchical ();
-
- /**
- * @return Returns true iff this IURI is a relative IURI.
- * The resource need not exist.
- */
- public boolean isRelative ();
-
- /**
- * @return Returns the IURI of the folder containing this IURI.
- * The resource need not exist.
- * @throws URIException if there is no parent URI.
- */
- public IURI parent () throws URIException;
-
- /**
- * @param relativeURI a relative URI.
- * @return Returns a new, normalized IURI formed by appending the given
- * relative IURI to this IURI. Both URIs must be hierarchical.
- * The resulting IURI will always be hierarchical. The given
- * IURI must be relative. This IURI can be relative or absolute.
- * the resulting IURI will be equivalently relative or absolute.
- * @throws URIException if relativeURI is not relative.
- */
- public IURI append ( IURI relativeURI ) throws URIException;
-
- /**
- * @return Gets an InputStream for reading from the resource
- * identified by this leaf or non-hierarchical IURI.
- *
- * @throws URIException if a stream for this URI can not be created.
- */
- public InputStream getInputStream () throws URIException;
-
- /**
- * @return Gets an OutputStream for writing to the resource
- * identified by this leaf or non-hierarchical IURI.
- * @throws URIException if a stream for this URI can not be created.
- */
- public OutputStream getOutputStream () throws URIException;
-
- /**
- * Creates a new, empty resource at the location identified by
- * the IURI. On completion, this.isLeaf() == true. If a leaf
- * resource already exists, this method does nothing. If a
- * non-leaf resource already exists under this IURI, creation
- * will fail and an exception will be thrown.
- * @throws URIException if an error occurs touching this leaf resource.
- */
- public void touchLeaf () throws URIException;
-
- /**
- * Creates a new folder resource at the location identified by
- * the IURI. The scheme of the IURI 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 IURI, creation will fail and an
- * exception will be thrown.
- * @throws URIException if an error occurs touching this folder resource.
- */
- public void touchFolder () throws URIException;
-
- /**
- * Erases the resource identified by this IURI.
- * @throws URIException if an error occurs erasing this resource.
- */
- public void erase () throws URIException;
-
- /**
- * Renames or moves the resource identified by this IURI
- * to the new IURI.
- * @param newURI the new URI name for this URI.
- * @throws URIException if an error occurs renaming this resource.
- */
- public void rename ( IURI newURI ) throws URIException;
-
- /**
- * Visits this resource and its decendants in pre-order fashion.
- * For each resource, whether a folder or a leaf, the given
- * IURIVisitor's visit() method is called with the IURI of the
- * resource. If IURIVisitor.visit() returns false, the visiting
- * algorithm will "prune" the decendants of the resource and
- * carry on visiting the rest of the tree. If IURIVisitor.visit()
- * returns true, the visiting algorithm will continue its walk
- * down the resource's descendants.
- * @param uriVisitor the visitor that will be called for each resource visited.
- * @throws URIException if an error occurs visiting this resource and its children.
- */
- public void visit ( IURIVisitor uriVisitor ) throws URIException;
-
- /**
- * As for visit(IURIVisitor), 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.
- * @param uriVisitor the visitor that will be called for each resource visited.
- * @param uriFilter the resource filter.
- * @throws URIException if an error occurs visiting this resource and its children.
- */
- public void visit ( IURIVisitor uriVisitor, IURIFilter uriFilter ) throws URIException;
-
- /**
- * Returns a list of URIs for the immediate children of the given
- * hierarchical, non-leaf IURI. This method never returns null,
- * though it may return a zero length array.
- * @return returns the children for this URI.
- * @throws URIException if an error occurs locating the children for this URI.
- */
- public IURI[] 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.
- * @param uriFilter the child filter.
- * @return returns the filtered children for this URI.
- * @throws URIException if an error occurs locating the children for this URI.
- */
- public IURI[] list ( IURIFilter uriFilter ) throws URIException;
-
- /**
- * @return Returns true if the asURL() method is fair game,
- * in other words, if this IURI can be converted into a URL.
- */
- public boolean isAvailableAsURL ();
-
- /**
- * @return Returns a URL object for the resource under this IURI.
- * 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.
- * @throws URIException if an error occurs returning this URL.
- */
- public URL asURL () throws URIException;
-
- /**
- * @return Returns true if the asFile() method is fair game,
- * in other words, if this IURI can be converted into a File.
- */
- public boolean isAvailableAsFile ();
-
- /**
- * @return Returns a File object for the resource under this IURI.
- * 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.
- * @throws URIException if an error occurs returning this File.
- */
- public File asFile () throws URIException;
-
- /**
- * @return Returns the IURI as a string.
- * Equivalent to toString().
- */
- public String asString ();
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIFactory.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIFactory.java
deleted file mode 100644
index 9d8734d95..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment.uri;
-
-import java.net.URL;
-
-/**
- * This is a factory for creating new IURI and IURIScheme objects.
- *
- * @since 1.0
- */
-public interface IURIFactory
-{
- /**
- * Creates and returns a new IURI for the given string.
- * @param uri the uri to be created.
- * @return the new URI.
- * @throws URIException if the uri parameter is not a valid URI.
- */
- public IURI newURI ( String uri ) throws URIException;
-
- /**
- * Creates and returns a new IURI for the given URL.
- * @param url the url to use to create this URI
- * @return the new URI.
- * @throws URIException if the url parameter is not a valid url.
- */
- public IURI newURI ( URL url ) throws URIException;
-
- /**
- * Creates and returns a new IURIScheme 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 IURI string in
- * order to get a IURIScheme object.
- *
- * @param schemeOrURI the scheme or URI from which to create the scheme.
- * @return the new Scheme.
- * @throws URIException if schemeOrUri parameter does not contain
- * a valid scheme or URI name.
- */
- public IURIScheme newURIScheme ( String schemeOrURI ) throws URIException;
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIFilter.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIFilter.java
deleted file mode 100644
index 5985c2e58..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIFilter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment.uri;
-
-/**
- * This interface is implemented by classes that visit or list URIs.
- * Refer to {@link IURI#getChildren}.
- *
- * @since 1.0
- */
-public interface IURIFilter
-{
- /**
- * Filters the given IURI.
- * @param uri The resource to filter.
- * @return True if the resource matches the filter,
- * false if it does not.
- * @param uri the uri that will be accepted or rejected.
- * @return returns true if this uri is accepted.
- * @throws URIException If the filter fails to analyze the resource.
- */
- public boolean accepts ( IURI uri ) throws URIException;
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIScheme.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIScheme.java
deleted file mode 100644
index 7b8760824..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIScheme.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment.uri;
-
-import java.net.URL;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * A IURIScheme represents a single scheme for some a family of
- * Univeral Resource Identifiers. Examples include "file", "http"
- * and "platform" (Eclipse).
- *
- * @since 1.0
- */
-public interface IURIScheme
-{
- /**
- * @param uri the URI to be created.
- * @return Returns a new IURI.
- * @throws URIException if the uri specified is not valid or
- * can not be created.
- */
- public IURI newURI ( String uri ) throws URIException;
-
- /**
- * @param url the url used to create the URI.
- * @return Returns a new IURI.
- * @throws URIException if the url specified is not valid or
- * can not be created.
- */
- public IURI newURI ( URL url ) throws URIException;
-
- /**
- * @param uri the URI to be created.
- * @return Returns a new IURI.
- * @throws URIException if the uri specified is not valid or
- * can not be created.
- */
- public IURI newURI ( IURI uri ) throws URIException;
-
- /**
- * @return Returns the proper name of the scheme.
- */
- public String toString ();
-
- /**
- * @return Returns true if and only if this is a hierarchical scheme.
- */
- public boolean isHierarchical ();
-
- /**
- * @param uri the uri to check for validity.
- * @return Returns true if and only if the given IURI 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 ( IURI uri );
-
- /**
- * @param uri the uri to check for validity.
- * @return Returns a Status object indicating whether or not the given
- * IURI is valid. The severity and message of the Status object
- * will describe this.
- */
- public IStatus validate ( IURI uri );
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIVisitor.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIVisitor.java
deleted file mode 100644
index 586a3d73a..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/IURIVisitor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment.uri;
-
-/**
- * This interface is implemented by classes that visit URIs.
- * Refer to {@link IURI#visit}.
- *
- * @since 1.0
- */
-public interface IURIVisitor
-{
- /**
- * Visits the given IURI.
- * @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 ( IURI uri ) throws URIException;
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/SimpleURIFactory.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/SimpleURIFactory.java
deleted file mode 100644
index bccb2e057..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/SimpleURIFactory.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment.uri;
-
-import java.net.URL;
-import java.util.Hashtable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.internal.environment.eclipse.Messages;
-import org.eclipse.wst.common.internal.environment.relative.RelativeScheme;
-
-/**
- *
- * This class provides a default implementation of the IURIFactory interface.
- *
- * @since 1.0
- */
-public class SimpleURIFactory implements IURIFactory
-{
- private Hashtable schemes_ = new Hashtable();
-
- /**
- * @param uri the uri to be created.
- * @return Creates and returns a new IURI for the given string.
- * @throws URIException if an error occurs creating this URI.
- */
- public IURI newURI(String uri) throws URIException
- {
- IURIScheme scheme = newURIScheme( uri, false );
-
- return scheme.newURI( uri );
- }
-
- /**
- * @param url the url to use to create this uri.
- * @return Creates and returns a new IURI for the given URL.
- * @throws URIException if an error occurs creating this URI.
- */
- public IURI newURI(URL url) throws URIException
- {
- IURIScheme scheme = newURIScheme( url.toString(), false );
-
- return scheme.newURI( url );
- }
-
- /**
- * @param schemeOrURI the scheme name or URI from which this scheme is
- * to be created.
- * @return Creates and returns a new IURIScheme 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 IURI string in
- * order to get a IURIScheme object.
- * @throws URIException if an error occurs creating this URI scheme.
- */
- public IURIScheme newURIScheme(String schemeOrURI) throws URIException
- {
- return newURIScheme( schemeOrURI, true );
- }
-
- /**
- * This method registers a scheme for a particular protocol.
- *
- * @param protocol the protocol.
- * @param scheme the scheme.
- */
- public void registerScheme( String protocol, IURIScheme scheme )
- {
- schemes_.put( protocol, scheme );
- }
-
- private IURIScheme newURIScheme(String schemeOrURI, boolean checkForScheme ) throws URIException
- {
- IURIScheme newScheme = null;
-
- if( schemeOrURI == null )
- {
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_NULL_ARG_SPECIFIED, "newURIScheme"), null ) );
- }
-
- 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 IURI.
- if( ( checkForScheme && colon == -1 ) ||
- ( colon != -1 && slash == -1) ||
- ( colon != -1 && colon < slash ) )
- {
- // If colon is -1 then we will treat the entire input parameter as the protocol.
- if( colon == -1 ) colon = schemeOrURI.length();
-
- String protocol = schemeOrURI.substring(0, colon );
- newScheme = (IURIScheme)schemes_.get( protocol );
-
- if( newScheme == null )
- {
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_SCHEME_NOT_FOUND, schemeOrURI ), null ) );
-
- }
- }
- else if( schemeOrURI.startsWith( "/") )
- {
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_ABSOLUTE_PATH_WITHOUT_SCHEME, schemeOrURI ), null ) );
-
- }
- else
- {
- newScheme = new RelativeScheme();
- }
-
- return newScheme;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/URIException.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/URIException.java
deleted file mode 100644
index ccb754316..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/environment/uri/URIException.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.environment.uri;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * This is the base class for most exceptions thrown by IURI classes.
- * Every URIException carries a IURI 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.
- *
- * @since 1.0
- */
-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 IURI for which the exception occured,
- * if applicable.
- */
- protected IURI uri;
-
- /**
- * Creates a new URIException with the given Status.
- * The status may be null.
- *
- * @param status the staus for this exception.
- */
- public URIException ( IStatus status )
- {
- super();
- this.status = status;
- }
-
- /**
- * Creates a new URIException for the given Status and IURI,
- * each of which may be null.
- *
- * @param status the status for this exception.
- * @param uri the uri that caused this exception.
- */
- public URIException ( IStatus status, IURI uri )
- {
- super(status != null ? status.getMessage() : null);
- this.status = status;
- this.uri = uri;
- }
-
- /**
- * @return returns the Status object inside this exception.
- */
- public IStatus getStatus ()
- {
- return status;
- }
-
- /**
- * @return returns the IURI inside this exception.
- */
- public IURI getURI ()
- {
- return uri;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/ConsoleEclipseEnvironment.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/ConsoleEclipseEnvironment.java
deleted file mode 100644
index 0c9c95e57..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/ConsoleEclipseEnvironment.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.eclipse;
-
-import org.eclipse.wst.common.environment.IEnvironment;
-import org.eclipse.wst.common.environment.ILog;
-import org.eclipse.wst.common.environment.NullStatusHandler;
-import org.eclipse.wst.common.environment.IStatusHandler;
-import org.eclipse.wst.common.environment.uri.SimpleURIFactory;
-import org.eclipse.wst.common.environment.uri.IURIFactory;
-import org.eclipse.wst.common.internal.environment.uri.file.FileScheme;
-
-
-/**
- * This class is intended for use in a headless Eclipse environment.
- */
-public class ConsoleEclipseEnvironment implements IEnvironment
-{
- private SimpleURIFactory uriFactory_ = null;
- private IStatusHandler statusHandler_ = null;
-
- public ConsoleEclipseEnvironment()
- {
- this( new NullStatusHandler() );
- }
-
- public ConsoleEclipseEnvironment( IStatusHandler statusHandler )
- {
- uriFactory_ = new SimpleURIFactory();
- statusHandler_ = statusHandler;
-
- uriFactory_.registerScheme( "platform", new EclipseScheme( this ) );
- uriFactory_.registerScheme( "file", new FileScheme() );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.environment.IEnvironment#getLog()
- */
- public ILog getLog()
- {
- return new EclipseLog();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.environment.IEnvironment#getStatusHandler()
- */
- public IStatusHandler getStatusHandler()
- {
- return statusHandler_;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.environment.IEnvironment#getURIFactory()
- */
- public IURIFactory getURIFactory()
- {
- return uriFactory_;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseLog.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseLog.java
deleted file mode 100644
index e1d75e629..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseLog.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060221 100364 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.eclipse;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.common.environment.ILog;
-import org.eclipse.wst.common.internal.environment.plugin.EnvironmentPlugin;
-
-public class EclipseLog implements org.eclipse.wst.common.environment.ILog
-{
- private org.eclipse.core.runtime.ILog logger;
-
- public EclipseLog()
- {
- Plugin plugin = EnvironmentPlugin.getInstance();
-
- logger = plugin.getLog();
- }
-
- /**
- * @see org.eclipse.wst.common.environment.ILog#isEnabled()
- */
- public boolean isEnabled()
- {
- return Platform.inDebugMode();
- }
-
- /**
- * @see org.eclipse.wst.common.Environment.ILog#isEnabled(java.lang.String)
- */
- public boolean isEnabled(String option) {
- return "true".equals(Platform.getDebugOption("org.eclipse.wst.common.environment/trace/"
- + option));
- }
-
- /**
- * @see org.eclipse.wst.common.environment.ILog#log(int, int, java.lang.Object, java.lang.String, java.lang.Object)
- */
- public void log(int severity, int messageNum, Object caller,
- String method, Object object)
- {
-
- if (isEnabled()) {
- switch (severity) {
- case ILog.ERROR :
- {
- if (isEnabled("error"))
- {
- String message = getMessageNumString(messageNum) + "E "
- + caller + "::" + method + ": object="
- + object;
- log( severity, message, null );
- }
- break;
- }
-
- case ILog.WARNING :
- {
- if (isEnabled("warning"))
- {
- String message = getMessageNumString(messageNum)
- + "W " + caller + "::" + method
- + ": object=" + object;
- log( severity, message, null );
- }
- break;
- }
-
- case ILog.INFO :
- {
- if (isEnabled("info"))
- {
- String message = getMessageNumString(messageNum) + "I "
- + caller + "::" + method + ": object="
- + object;
- log( severity, message, null );
- }
- break;
- }
- }
- }
-
- }
-
- /**
- * @see org.eclipse.wst.common.environment.ILog#log(int, int, java.lang.Object, java.lang.String, org.eclipse.core.runtime.IStatus)
- */
- public void log(int severity, int messageNum, Object caller,
- String method, IStatus status) {
- log(severity, messageNum, caller, method, (Object)status);
- }
-
- /**
- * @see org.eclipse.wst.common.environment.ILog#log(int, int, java.lang.Object, java.lang.String, java.lang.Throwable)
- */
- public void log(int severity, int messageNum, Object caller,
- String method, Throwable throwable) {
- log( severity, messageNum, caller, method, (Object)null );
- }
-
- /**
- * @see org.eclipse.wst.common.environment.ILog#log(int, java.lang.String, int, java.lang.Object, java.lang.String, java.lang.Object)
- */
- public void log(int severity, String option, int messageNum,
- Object caller, String method, Object object)
- {
- if (isEnabled(option))
- {
- String message = getMessageNumString(messageNum) + "I " + caller
- + "::" + method + ": object=" + object;
- log(severity, message, null );
- }
- }
-
- /**
- * @see org.eclipse.wst.common.environment.ILog#log(int, java.lang.String, int, java.lang.Object, java.lang.String, java.lang.Throwable)
- */
- public void log(int severity, String option, int messageNum,
- Object caller, String method, Throwable throwable)
- {
- if (isEnabled(option))
- {
- String message = getMessageNumString(messageNum) + "I " + caller
- + "::" + method;
- log( severity, message, throwable );
- }
- }
-
- /**
- * @see org.eclipse.wst.common.environment.ILog#log(int, java.lang.String, int, java.lang.Object, java.lang.String, org.eclipse.core.runtime.IStatus)
- */
- public void log(int severity, String option, int messageNum,
- Object caller, String method, IStatus status)
- {
- logger.log( status );
- }
-
- private String getMessageNumString(int messageNum) {
- String messageNumString = "IWAB";
- if (messageNum > 9999 || messageNum < 0)
- messageNum = 9999; //default message number
- messageNumString += (new Integer(messageNum)).toString();
- return messageNumString;
- }
-
- private void log( int severity, String message, Throwable exc )
- {
- Status status = new Status( severity, "id", 0, message, exc );
- logger.log( status );
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseScheme.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseScheme.java
deleted file mode 100644
index 0042c4d1d..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseScheme.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.eclipse;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.environment.IEnvironment;
-import org.eclipse.wst.common.environment.uri.IURI;
-import org.eclipse.wst.common.environment.uri.IURIScheme;
-import org.eclipse.wst.common.environment.uri.URIException;
-import org.eclipse.wst.common.internal.environment.relative.RelativeURI;
-
-
-public class EclipseScheme implements IURIScheme
-{
- private IEnvironment environment_;
-
- public EclipseScheme( IEnvironment environment )
- {
- environment_ = environment;
- }
-
- public String toString()
- {
- return "platform";
- }
-
- /**
- */
- public boolean isHierarchical()
- {
- return true;
- }
-
- /**
- */
- public boolean isValid(IURI uri)
- {
- boolean result = true;
-
- if( uri == null ) return false;
-
- try
- {
- IURIScheme scheme = uri.getURIScheme();
-
- if( scheme.toString().equals( "relative") ) return scheme.isValid( uri );
-
- getPathFromPlatformURI( uri.toString() );
- }
- catch( URIException exc )
- {
- result = false;
- }
-
- return result;
- }
-
- /**
- */
- public IURI newURI(String uri) throws URIException
- {
- String newURI = null;
-
- if( uri != null && uri.startsWith( "platform:") )
- {
- // The platform has been specified so keep it as is.
- newURI = uri;
- }
- else if( uri == null || uri.indexOf( ":") != -1 )
- {
- // The platform uri is not allowed to contain some other protocol.
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_INVALID_PLATFORM_URL,uri), null ) );
-
- }
- else if( uri.startsWith( "/") )
- {
- // The platform scheme has not been specified so we will add it.
- newURI = "platform:/resource" + uri;
- }
-
- if( newURI == null )
- {
- return new RelativeURI( uri );
- }
- else
- {
- return new EclipseURI( newURI, environment_ );
- }
- }
-
- /**
- */
- public IURI newURI(IURI uri) throws URIException
- {
- return newURI( uri == null ? null : uri.toString() );
- }
-
- /**
- */
- public IURI newURI(URL url) throws URIException
- {
- return newURI( url == null ? null : url.toString() );
- }
-
- /**
- */
- public IStatus validate(IURI uri)
- {
- IStatus status = null;
-
- try
- {
- IURIScheme scheme = uri.getURIScheme();
-
- if( scheme.toString().equals( "relative") ) return scheme.validate( uri );
-
- getPathFromPlatformURI( uri.toString() );
- status = Status.OK_STATUS;
- }
- catch( URIException exc )
- {
- status = exc.getStatus();
- }
-
- return status;
- }
-
- /**
- * Gets the "platform:/resource" IPath given a url
- *
- */
- public String getPathFromPlatformURI(String uri) throws URIException
- {
- String resourceFile = null;
- URL url = null;
-
- try
- {
- url = new URL( uri );
- }
- catch( MalformedURLException exc )
- {
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_INVALID_PLATFORM_URL, uri ), exc ) );
- }
-
- if( url == null )
- {
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_INVALID_PLATFORM_URL, uri ), null ) );
- }
- if( url.getProtocol().equals("platform") )
- {
- String resourceURL = url.getFile();
-
- if (resourceURL.startsWith("/resource"))
- {
- resourceFile = resourceURL.substring(10); // omit the "/resource" portion
- }
- }
- else
- {
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_INVALID_PLATFORM_URL,url.getFile() ), null ) );
- }
-
- return resourceFile;
- }
-
- /**
- *
- * @param absolutePath an absolute IPath
- * @return returns the platform IURI for this path.
- */
- public String getURLFromPath( IPath absolutePath )
- {
- return "platform:/resource" + absolutePath;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseURI.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseURI.java
deleted file mode 100644
index d062a53d9..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseURI.java
+++ /dev/null
@@ -1,518 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.eclipse;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Vector;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.environment.IEnvironment;
-import org.eclipse.wst.common.environment.uri.IURI;
-import org.eclipse.wst.common.environment.uri.IURIFilter;
-import org.eclipse.wst.common.environment.uri.IURIScheme;
-import org.eclipse.wst.common.environment.uri.URIException;
-import org.eclipse.wst.common.internal.environment.relative.RelativeURI;
-
-
-public class EclipseURI extends RelativeURI
-{
- private IEnvironment environment_;
- private EclipseScheme scheme_;
- private File file_;
-
- public EclipseURI( String uri, IEnvironment environment )
- {
- super( uri );
-
- environment_ = environment;
- scheme_ = new EclipseScheme( environment );
- file_ = getFile();
- }
-
- public String toString()
- {
- return uri_;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#erase()
- */
- public void erase() throws URIException
- {
- try
- {
- IResource file = getResource();
-
- if( file != null && file.exists() )
- {
- if( file instanceof IFile )
- {
- FileResourceUtils.deleteFile( (IFile)file,
- environment_.getStatusHandler() );
- }
- else if( file instanceof IFolder )
- {
- FileResourceUtils.deleteFolder( (IFolder)file,
- environment_.getStatusHandler() );
- }
- }
-
- }
- catch( Exception exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#getInputStream()
- */
- public InputStream getInputStream() throws URIException
- {
- try
- {
- // If a class cast exception is throw it will be propogated as
- // a URIException.
- IFile file = (IFile)getResource();
-
- //call getContents on the eclipse File object
- if( file != null )
- {
- return file.getContents();
- }
- }
- catch( Throwable exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
-
- return null;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#getOutputStream()
- */
- public OutputStream getOutputStream() throws URIException
- {
- // Ensure that the parent folder exists.
- IURI parent = parent();
-
- if( !parent.isPresent() )
- {
- parent().touchFolder();
- }
-
- return getOutStream();
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#getURIScheme()
- */
- public IURIScheme getURIScheme()
- {
- return scheme_;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#isLeaf()
- */
- public boolean isLeaf()
- {
- boolean result = false;
-
- try
- {
- IResource resource = getResource();
-
- if( resource != null &&
- resource.exists() &&
- resource.getType() == IResource.FILE )
- {
- result = true;
- }
- }
- catch( URIException exc )
- {
- // This IURI does not exist.
- result = false;
- }
-
- return result;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#isPresent()
- */
- public boolean isPresent()
- {
- boolean result = false;
-
- try
- {
- IResource resource = getResource();
-
- if( resource != null && resource.exists() )
- {
- result = true;
- }
- }
- catch( URIException exc )
- {
- // This IURI does not exist.
- result = false;
- }
-
- return result;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#isReadable()
- */
- public boolean isReadable()
- {
- boolean result = false;
-
- try
- {
- IResource resource = getResource();
-
- if( resource != null && resource.isAccessible() )
- {
- result = true;
- }
- }
- catch( URIException exc )
- {
- // This IURI does not exist.
- result = false;
- }
-
- return result;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#isRelative()
- */
- public boolean isRelative()
- {
- return false;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#isWritable()
- */
- public boolean isWritable()
- {
- boolean result = false;
-
- try
- {
- IResource resource = getResource();
-
- if( resource != null &&
- resource.isAccessible() &&
- !resource.getResourceAttributes().isReadOnly() )
- {
- result = true;
- }
- }
- catch( URIException exc )
- {
- // This IURI does not exist.
- result = false;
- }
-
- return result;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#list()
- */
- public IURI[] list() throws URIException
- {
- IResource resource = getResource();
- IURI[] uriChildren = new IURI[0];
-
- if( resource.getType() == IResource.FOLDER )
- {
- IFolder folder = (IFolder)resource;
-
- try
- {
- IResource[] children = folder.members();
-
- uriChildren = new IURI[children.length];
-
- for( int index = 0; index < children.length; index++ )
- {
- IPath path = children[index].getFullPath();
- uriChildren[index] = new EclipseURI( scheme_.getURLFromPath(path), environment_ );
- }
- }
- catch( CoreException exc )
- {
- }
- }
-
- return uriChildren;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#list(org.eclipse.env.uri.IURIFilter)
- */
- public IURI[] list(IURIFilter uriFilter) throws URIException
- {
- IResource resource = getResource();
- IURI[] result = new IURI[0];
-
- if( resource.getType() == IResource.FOLDER )
- {
- IFolder folder = (IFolder)resource;
-
- try
- {
- IResource[] children = folder.members();
- Vector uriChildren = new Vector();
-
- for( int index = 0; index < children.length; index++ )
- {
- IPath path = children[index].getFullPath();
- IURI uri = new EclipseURI( scheme_.getURLFromPath(path), environment_ );
-
- if( uriFilter.accepts( uri ) )
- {
- uriChildren.add( uri );
- }
- }
-
- result = (IURI[])uriChildren.toArray( new IURI[0] );
- }
- catch( CoreException exc )
- {
- }
- }
-
- return result;
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#rename(org.eclipse.env.uri.IURI)
- */
- public void rename(IURI newURI ) throws URIException
- {
- if( newURI == null || !(newURI instanceof EclipseURI) ) return;
-
- try
- {
- EclipseURI newEclipseURI = (EclipseURI)newURI;
- IPath newPath = new Path( scheme_.getPathFromPlatformURI( newEclipseURI.uri_ ) ).makeAbsolute();
- IResource resource = getResource();
-
- if( resource != null )
- {
- resource.move( newPath, true, null );
- }
- }
- catch( CoreException exc )
- {
- exc.printStackTrace();
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ) );
- }
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#touchFolder()
- */
- public void touchFolder() throws URIException
- {
- IResource resource = getResource();
-
- if( resource != null )
- {
- if( resource.getType() == IResource.FOLDER )
- {
- IFolder folder = (IFolder)resource;
-
- try
- {
- if( folder.members().length > 0 )
- {
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_ERROR_FOLDER_HAS_CHILDREN, folder.toString() ), null ),
- this );
-
- }
- }
- catch( CoreException exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
- }
- else
- {
- //??? Not sure what to do if touching a folder and the IURI exists and it is not a folder.
- }
- }
- else
- {
- IPath newPath = new Path( scheme_.getPathFromPlatformURI( uri_ ) ).makeAbsolute();
-
- try
- {
- FileResourceUtils.makeFolderPath( newPath,
- environment_.getStatusHandler() );
- }
- catch( CoreException exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
- }
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#touchLeaf()
- */
- public void touchLeaf() throws URIException
- {
- IResource resource = getResource();
-
- if( resource != null )
- {
- // The resource already exists so do nothing.
- }
- else
- {
- // Get the parent for this leaf and create it if required.
- IURI parent = parent();
-
- if( !parent.isPresent() )
- {
- parent().touchFolder();
- }
-
- try
- {
- // Get an output stream to the specified file and immediately close it.
- // This should create a 0 byte file.
- getOutStream().close();
- }
- catch( IOException exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
- }
-
- }
-
- private IResource getResource() throws URIException
- {
- IPath path = new Path( scheme_.getPathFromPlatformURI(uri_) );
- String absolutePathname = path.makeAbsolute().toString();
-
- return FileResourceUtils.findResource(absolutePathname);
- }
-
- /**
- * @see org.eclipse.env.uri.IURI#getOutputStream()
- */
- private OutputStream getOutStream() throws URIException
- {
- IPath file = new Path( scheme_.getPathFromPlatformURI( uri_ ) ).makeAbsolute();
- OutputStream stream = null;
-
- stream = FileResourceUtils.newFileOutputStream ( file,
- environment_.getStatusHandler() );
- return stream;
- }
-
- /**
- * Returns a File object for the resource under this IURI.
- * 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 ()
- {
- return file_;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.environment.uri.IURI#isAvailableAsFile()
- */
- public boolean isAvailableAsFile()
- {
- return file_ != null;
- }
-
- /* (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( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
-
- return url;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#isAvailableAsURL()
- */
- public boolean isAvailableAsURL()
- {
- URL theURL = null;
-
- try
- {
- theURL = asURL();
- }
- catch( URIException exc )
- {
- }
-
- return theURL != null ;
- }
-
- private File getFile()
- {
- String platformRes = "platform:/resource";
- File result = null;
-
- if (uri_.startsWith(platformRes))
- {
- result = new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().removeTrailingSeparator().append(uri_.substring(platformRes.length(), uri_.length())).toString());
- }
-
- return result;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/FileResourceOutputStream.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/FileResourceOutputStream.java
deleted file mode 100644
index 8cfebb511..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/FileResourceOutputStream.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.eclipse;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.common.environment.IStatusHandler;
-
-
-
-/**
-* This class defines an output stream that writes to an
-* {@link org.eclipse.core.resources.IFile IFile}.
-*/
-public class FileResourceOutputStream extends OutputStream
-{
-
- IPath fFilePath;
- IStatusHandler fStatusHandler;
- ByteArrayOutputStream fByteArrayOutputStream;
- boolean fOpen;
-
- /**
- * Constructs an output stream that can be used to write to the
- * given <code>file</code>. The workspace is neither examined nor
- * altered during construction. All resource creation is deferred
- * until later in the stream's lifecycle, such as during writing
- * or closure.
- * <b>Note:</b> The preferred mechanism for creating a stream that
- * writes to an IFile is to call the static factory method
- * {@link FileResourceUtils#newFileOutputStream FileResourceUtils.newFileOutputStream()}
- * and work with the resulting <code>OutputStream</code>.
- * Direct construction of a FileResourceOutputStream is not recommended.
- * @param file The {@link org.eclipse.core.resources.IFile IFile}
- * handle of the file resource to create. The project implied by the
- * pathname of the file must already exist,
- * that is, this method cannot be used to create projects.
- * @param progressMonitor The progress monitor for the operation, or null.
- */
- public FileResourceOutputStream (
- IPath filePath,
- IStatusHandler statusHandler
- )
- {
- fFilePath = filePath;
- fStatusHandler = statusHandler;
- fByteArrayOutputStream = new ByteArrayOutputStream();
- fOpen = true;
- }
-
- /**
- * Closes the stream.
- * @throws IOException If an error occurs while closing the stream.
- * For example, if this stream was constructed with overwriteFile = false
- * and a file of the same name already exists, then an IOException will
- * be thrown either now or during an earlier {@link #write write}.
- */
- public void close ()
- throws IOException
- {
- if (!fOpen) return;
- fOpen = false;
- fByteArrayOutputStream.close();
- byte[] buffer = fByteArrayOutputStream.toByteArray();
- ByteArrayInputStream tempInputStream = new ByteArrayInputStream(buffer);
- try
- {
- FileResourceUtils.createFile(fFilePath, tempInputStream, fStatusHandler);
- }
- catch (CoreException e)
- {
- throw new IOException(e.getMessage());
- }
- }
-
- /**
- * Flushes the stream. This does not imply the File resource
- * will be created or become visible within the workbench.
- * @throws IOException If an error occurs. For example, if this
- * stream was constructed with overwriteFile = false and a file of the
- * same name already exists, then an IOException may be thrown at
- * this point.
- */
- public void flush ()
- throws IOException
- {
- fByteArrayOutputStream.flush();
- }
-
- /**
- * Writes all bytes from the given array to the stream.
- * @param b The array of bytes to write.
- * @throws IOException If an error occurs. For example, if this
- * stream was constructed with overwriteFile = false and a file of the
- * same name already exists, then an IOException may be thrown at
- * this point.
- */
- public void write ( byte[] b )
- throws IOException
- {
- fByteArrayOutputStream.write(b);
- }
-
- /**
- * Writes bytes from the given array beginning at some offset
- * and continuing for some number of bytes (len) to the stream.
- * @param b The array of bytes to write.
- * @param off The offset into the array to begin writing.
- * @param len The number of bytes to write.
- * @throws IOException If an error occurs. For example, if this
- * stream was constructed with overwriteFile = false and a file of the
- * same name already exists, then an IOException may be thrown at
- * this point.
- */
- public void write ( byte[] b, int off, int len )
- {
- fByteArrayOutputStream.write(b,off,len);
- }
-
- /**
- * Writes a single byte to the stream.
- * @param b The byte to write.
- * @throws IOException If an error occurs. For example, if this
- * stream was constructed with overwriteFile = false and a file of the
- * same name already exists, then an IOException may be thrown at
- * this point.
- */
- public void write ( int b )
- {
- fByteArrayOutputStream.write(b);
- }
-}
-
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/FileResourceUtils.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/FileResourceUtils.java
deleted file mode 100644
index 240f43f64..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/FileResourceUtils.java
+++ /dev/null
@@ -1,550 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.eclipse;
-
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Vector;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.environment.Choice;
-import org.eclipse.wst.common.environment.StatusException;
-import org.eclipse.wst.common.environment.IStatusHandler;
-
-
-
-/**
-* This class contains useful methods for working with Eclipse resources.
-*/
-public final class FileResourceUtils
-{
- //
- // Keeps the IWorkspace hanging around. See getWorkspace().
- //
- private static IWorkspace workspace_ = null;
- //
- // Keeps the IWorkspaceRoot hanging around. See getWorkspaceRoot().
- //
- private static IWorkspaceRoot root_ = null;
-
- /**
- * Returns the IWorkspaceRoot object.
- * @return The IWorkspaceRoot object.
- */
- public static IWorkspaceRoot getWorkspaceRoot ()
- {
- if (root_ == null)
- {
- root_ = ResourcesPlugin.getWorkspace().getRoot();
- }
- return root_;
- }
-
- /**
- * Returns the IWorkspace object.
- * @return The IWorkspace object.
- */
- public static IWorkspace getWorkspace ()
- {
- if (workspace_ == null)
- {
- if (root_ == null)
- {
- root_ = ResourcesPlugin.getWorkspace().getRoot();
- }
-
- workspace_ = root_.getWorkspace();
- }
-
- return workspace_;
- }
-
- /**
- *
- * @return returns an array of three common choices. (ie. Yes, yes all, and cancel )
- */
- public static Choice[] getThreeStateFileOptions()
- {
- Vector choices = new Vector();
-
- choices.add(new Choice( 'Y', Messages.LABEL_YES ));
- choices.add(new Choice( 'A', Messages.LABEL_YES_TO_ALL ));
- choices.add(new Choice( 'C', Messages.LABEL_CANCEL ));
-
- return (Choice[])choices.toArray(new Choice[choices.size()]);
- }
-
- /**
- * Returns an
- * {@link org.eclipse.core.resources.IResource IResource}
- * of the given absolute pathname or null if no such resource exists.
- * @param absolutePathname The absolute path of the resource.
- * @return The <code>IResource</code>.
- */
- public static IResource findResource ( String absolutePathname )
- {
- if (absolutePathname == null)
- {
- return null;
- }
-
- return findResource(new Path(absolutePathname));
- }
-
- /**
- * Returns an
- * {@link org.eclipse.core.resources.IResource IResource}
- * of the given absolute path or null if no such resource exists.
- * @param absolutePath The absolute <code>IPath</code> of the resource.
- * @return The <code>IResource</code>.
- */
- public static IResource findResource ( IPath absolutePath )
- {
- if (absolutePath == null)
- {
- return null;
- }
-
- return FileResourceUtils.getWorkspaceRoot().findMember(absolutePath);
- }
-
- /**
- * Copies a file from a plugin's installation location
- * to an Eclipse folder.
- * @param plugin The plugin containing the files to copy.
- * Must not be null.
- * @param sourcePath The path, relative to the <code>plugin</code>
- * install location, containing the files to copy.
- * If null, then the plugin install location is the source path
- * (ie. null is equivalent to ".").
- * @param pathname The pathname of the file to copy.
- * The pathname is relative to the <code>plugin sourcePath</code>.
- * Must not be null.
- * @param targetPath The absolute Eclipse path of the folder to
- * which the file will be copied. The relative pathname of the
- * file is preserved.
- * Must not be null.
- * @param createFolders The intermediate folder creation policy, one of
- * {@link #CREATE CREATE} or {@link #DONT_CREATE DONT_CREATE}.
- * <ul>
- * <li><code>CREATE</code> -
- * If any intermediate folders in the given <code>absolutePath</code>
- * do not exist, they will be created.
- * <li><code>DONT_CREATE</code> -
- * If any intermediate folders in the given <code>absolutePath</code>
- * do not exist, the method will throw a <code>CoreException</code>.
- * </ul>
- * @param overwriteFile The policy for existing files, one of
- * {@link #OVERWRITE OVERWRITE} or {@link #DONT_OVERWRITE DONT_OVERWRITE}.
- * <ul>
- * <li><code>OVERWRITE</code> -
- * If a resource of the same name as the given
- * <code>absolutePath</code> already exists and is a file,
- * it will be replaced.
- * If the resource already exists and it is not a file,
- * then no file will be created and
- * a <code>CoreException</code> will be thrown.
- * <li><code>DONT_OVERWRITE</code> -
- * If any resource of the same name as the given
- * <code>absolutePath</code> already exists,
- * then no file will be created and
- * a <code>CoreException</code> will be thrown.
- * </ul>
- * @param progressMonitor The progress monitor for the operation, or null.
- * @throws CoreException An exception containing an
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * with a severity of <code>IStatus.ERROR</code> and a
- * locale-specific description of the cause.
- */
- static public void copyFile( Plugin plugin,
- IPath sourcePath,
- IPath pathname,
- IPath targetPath,
- IStatusHandler statusMonitor )
- throws CoreException
- {
- try
- {
- IPath target = targetPath.append(pathname);
- IPath source = sourcePath == null ? pathname : sourcePath.append(pathname);
- InputStream input = plugin.openStream(source);
- createFile(target, input, statusMonitor);
- }
- catch (IOException e)
- {
- throw new CoreException(new Status(IStatus.ERROR,
- plugin.getBundle().getSymbolicName(),
- 0,
- Messages.MSG_ERROR_IO,e));
- }
- }
-
- /**
- * Deletes a file under a container.
- * The container must already exist.
- * @param file - the IFile to be deleted
- * @param progressMonitor
- * @param statusMonitor
- * @return True if the file does not exist or if it exists and is successfully deleted. False otherwise.
- */
- public static boolean deleteFile( IFile file,
- IStatusHandler statusMonitor)
- throws CoreException
- {
- if (file.exists())
- {
- //We have permission to overwrite so check if file is read-only
- if (file.isReadOnly())
- {
- IFile[] files = new IFile[1];
- files[0] = file;
- IStatus status = getWorkspace().validateEdit(files, null);
-
- if( status.getSeverity() == IStatus.ERROR )
- {
- statusMonitor.reportError( status );
- return false;
- }
- }
-
- file.delete(true, null);
- }
- //At this point, either the file did not exist or we successfully deleted
- // it. Return success.
- return true;
- }
-
- /**
- * Deletes a folder under a container.
- * @param folder - the IFolder to be deleted
- * @param progressMonitor
- * @param statusMonitor
- * @return True if the folder does not exist or if it exists and is successfully deleted along with its members. False otherwise.
- */
- public static boolean deleteFolder( IFolder folder,
- IStatusHandler statusMonitor )
- throws CoreException
- {
- if (!folder.exists()) return true;
-
- boolean deleted = true;
- IResource[] resources = folder.members();
-
- for (int i=0; i<resources.length; i++)
- {
- IResource resource = resources[i];
- if (resource instanceof IFile)
- {
- deleted = deleteFile((IFile)resource, statusMonitor);
- }
- if (resource instanceof IFolder)
- {
- deleted = deleteFolder( (IFolder)resource, statusMonitor);
- }
-
- if( !deleted ) break;
- }
-
- if( deleted )
- {
- folder.delete(true, true, null);
- return true;
- }
- else
- return false;
- }
-
- /**
- * Creates a file of the given <code>absolutePath</code>
- * and returns its handle as an <code>IFile</code>.
- * If the file cannot be created, a
- * <code>CoreException</code> containing an
- * <code>IStatus</code> object is thrown.
- * @param absolutePath The absolute path of the file to create.
- * The project at the beginning of the path must already exist,
- * that is, this method cannot be used to create projects.
- * @param progressMonitor The progress monitor for the operation, or null.
- * @return The {@link org.eclipse.core.resources.IFile IFile}
- * handle of the file.
- * @throws CoreException An exception containing an
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * with a severity of <code>IStatus.ERROR</code> and a
- * locale-specific description of the cause.
- */
- public static IFile createFile (
- IPath absolutePath,
- InputStream inputStream,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- if (!absolutePath.isAbsolute())
- {
- throw new CoreException(new Status(IStatus.ERROR, "ResourceUtils",0, NLS.bind( Messages.MSG_ERROR_PATH_NOT_ABSOLUTE, absolutePath.toString() ),null));
- }
- if (absolutePath.segmentCount() < 1)
- {
- throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind( Messages.MSG_ERROR_PATH_EMPTY, absolutePath.toString() ),null));
- }
- if (absolutePath.segmentCount() < 2)
- {
- throw new CoreException(new Status(IStatus.ERROR,"ResourceUtils",0,NLS.bind( Messages.MSG_ERROR_PATH_NOT_FOLDER, absolutePath.toString() ),null));
- }
- IContainer parent = makeFolderPath(absolutePath.removeLastSegments(1), statusHandler);
- String fileName = absolutePath.lastSegment();
-
- return makeFile(parent, fileName, inputStream, statusHandler);
- }
-
- /**
- * Creates under the given <code>project</code>
- * a file of the given <code>relativePath</code>
- * and returns its handle as an <code>IFile</code>.
- * If the file cannot be created, a
- * <code>CoreException</code> containing an
- * <code>IStatus</code> object is thrown.
- * @param absolutePath The absolute path of the file to create.
- * The project at the beginning of the path must already exist,
- * that is, this method cannot be used to create projects.
- * @param createFolders The intermediate folder creation policy, one of
- * {@link #CREATE CREATE} or {@link #DONT_CREATE DONT_CREATE}.
- * <ul>
- * <li><code>CREATE</code> -
- * If any intermediate folders in the given <code>absolutePath</code>
- * do not exist, they will be created.
- * <li><code>DONT_CREATE</code> -
- * If any intermediate folders in the given <code>absolutePath</code>
- * do not exist, the method will throw a <code>CoreException</code>.
- * </ul>
- * @param overwriteFile The policy for existing files, one of
- * {@link #OVERWRITE OVERWRITE} or {@link #DONT_OVERWRITE DONT_OVERWRITE}.
- * <ul>
- * <li><code>OVERWRITE</code> -
- * If a resource of the same name as the given
- * <code>absolutePath</code> already exists and is a file,
- * it will be replaced.
- * If the resource already exists and it is not a file,
- * then no file will be created and
- * a <code>CoreException</code> will be thrown.
- * <li><code>DONT_OVERWRITE</code> -
- * If any resource of the same name as the given
- * <code>absolutePath</code> already exists,
- * then no file will be created and
- * a <code>CoreException</code> will be thrown.
- * </ul>
- * @param progressMonitor The progress monitor for the operation, or null.
- * @return The {@link org.eclipse.core.resources.IFile IFile}
- * handle of the file.
- * @throws CoreException An exception containing an
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * with a severity of <code>IStatus.ERROR</code> and a
- * locale-specific description of the cause.
- */
- public static IFile createFile (
- IProject project,
- IPath relativePath,
- InputStream inputStream,
- IStatusHandler statusMonitor )
-
- throws CoreException
- {
- IPath absolutePath = project.getFullPath().append(relativePath);
- return createFile(absolutePath, inputStream, statusMonitor);
- }
-
- /**
- * Creates an output stream that can be used to write to the
- * given <code>file</code>. Actual changes to the workspace
- * may occur during creation of the stream, while writing to
- * the stream, or when the stream is closed.
- * A <code>CoreException</code> containing
- * an <code>IStatus</code> will be thrown
- * at some point in the lifecycle of the stream
- * if the file resource cannot be created.
- * @param file The {@link org.eclipse.core.resources.IFile IFile}
- * handle of the file resource to create. The project implied by the
- * pathname of the file must already exist,
- * that is, this method cannot be used to create projects.
- * @param progressMonitor The progress monitor for the operation, or null.
- * @return An <code>OutputStream</code> tied to the file resource.
- * Actual checks of or changes to the workspace may occur as early during
- * stream creation, closure, or any time in between.
- * @throws CoreException An exception containing an
- * {@link org.eclipse.core.runtime.IStatus IStatus}
- * with a severity of <code>IStatus.ERROR</code> and a
- * locale-specific description of the cause.
- * Reasons include:
- * <ol>
- * <li>The project of the given file's path does not exist.
- * <li>A non-file resource of the same name of the given file
- * already exists.
- * <li>A file resource of the same name of the given file
- * already exists, and <code>overwriteFile</code> is false.
- * <li>One or more intermediate folders to the given file
- * do not exist, and <code>createFolders</code> is false.
- * </ol>
- */
-
- public static OutputStream newFileOutputStream (
- IPath file,
- IStatusHandler statusHandler )
-
- {
- return new FileResourceOutputStream(file, statusHandler);
- }
-
- //----------------------------------------------------------------------
- // Naughty bits...
- //----------------------------------------------------------------------
-
- //
- // Creates a path of folders.
- // Do not call with an absolutePath of less than one segment.
- //
- /**
- * Creates a path of folders.
- * Do not call with an absolutePath of less than one segment.
- * @param resourceContext the resource context for making folders.
- * @param absolutePath the path of folders that will be created.
- * @param progressMonitor the progress monitor to be used.
- * @param statusHandler the status handler.
- * @return returns the IContainer of the created folder.
- */
- public static IContainer makeFolderPath (
- IPath absolutePath,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- if (absolutePath.segmentCount() <= 1)
- {
- return getWorkspaceRoot().getProject(absolutePath.segment(0));
- }
- else
- {
- IContainer parent = makeFolderPath(absolutePath.removeLastSegments(1), statusHandler );
- String folderName = absolutePath.lastSegment();
-
- return makeFolder(parent,folderName, statusHandler );
- }
- }
- //
- // Creates a folder under a container.
- // The container must already exist.
- //
- private static IFolder makeFolder (
- IContainer parent,
- String folderName,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- IResource child = parent.findMember(folderName);
-
- if( child == null )
- {
- IFolder folder = parent.getFolder(new Path(folderName));
- folder.create(true,true,null);
- return folder;
- }
- else if( child.getType() == IResource.FOLDER )
- {
- return (IFolder)child;
- }
- else
- {
- throw new CoreException(
- new Status( IStatus.ERROR,
- "ResourceUtils",
- 0,
- NLS.bind( Messages.MSG_ERROR_RESOURCE_NOT_FOLDER, parent.getFullPath().append(folderName).toString()),
- null ) );
- }
- }
-
- //
- // Creates a file under a container.
- // The container must already exist.
- //
- private static IFile makeFile (
- IContainer parent,
- String fileName,
- InputStream inputStream,
- IStatusHandler statusHandler )
-
- throws CoreException
- {
- IResource child = parent.findMember(fileName);
-
- if( child != null )
- {
- if( child.getType() == IResource.FILE )
- {
- //We have permission to overwrite so check if file is read-only
- if( child.getResourceAttributes().isReadOnly() )
- {
- IFile[] files = new IFile[1];
- files[0] = (IFile)child;
-
- IStatus status = getWorkspace().validateEdit(files,null);
-
- try
- {
- statusHandler.report( status );
- }
- catch( StatusException exc )
- {
- return null;
- }
- }
-
- //Change the contents of the existing file.
- IFile file = parent.getFile( new Path(fileName) );
- file.setContents( inputStream, true, true, null );
-
- return file;
-
- }
- else
- {
- throw new CoreException(
- new Status( IStatus.ERROR,
- "ResourceUtils",
- 0,
- NLS.bind( Messages.MSG_ERROR_RESOURCE_NOT_FILE, parent.getFullPath().append(fileName)),
- null ) );
- }
- }
- else
- {
- //Create a new file.
- IFile file = parent.getFile( new Path(fileName) );
- file.create( inputStream, true, null);
-
- return file;
- }
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/Messages.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/Messages.java
deleted file mode 100644
index 4c08ea10b..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/Messages.java
+++ /dev/null
@@ -1,39 +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.common.internal.environment.eclipse;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS
-{
- private static final String BUNDLE_NAME = "org.eclipse.wst.common.internal.environment.eclipse.environment";
-
- public static String MSG_NULL_ARG_SPECIFIED;
- public static String MSG_SCHEME_NOT_FOUND;
- public static String MSG_ABSOLUTE_PATH_WITHOUT_SCHEME;
- public static String MSG_URI_NOT_RELATIVE;
- public static String MSG_ERROR_UNEXPECTED_ERROR;
- public static String MSG_INVALID_PLATFORM_URL;
- public static String MSG_INVALID_FILE_URL;
- public static String MSG_ERROR_PATH_NOT_ABSOLUTE;
- public static String MSG_ERROR_PATH_EMPTY;
- public static String MSG_ERROR_PATH_NOT_FOLDER;
- public static String MSG_ERROR_RESOURCE_NOT_FOLDER;
- public static String MSG_ERROR_RESOURCE_NOT_FILE;
- public static String MSG_ERROR_FOLDER_HAS_CHILDREN;
- public static String MSG_ERROR_IO;
- public static String LABEL_YES;
- public static String LABEL_YES_TO_ALL;
- public static String LABEL_CANCEL;
-
- static
- {
- NLS.initializeMessages( BUNDLE_NAME, Messages.class );
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/environment.properties b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/environment.properties
deleted file mode 100644
index 97908ad83..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/environment.properties
+++ /dev/null
@@ -1,40 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-#
-# Messages for SimpleURIFactory
-#
-MSG_NULL_ARG_SPECIFIED=Null specified as argument to {0}.
-MSG_SCHEME_NOT_FOUND=Scheme not found for URI {0}.
-MSG_ABSOLUTE_PATH_WITHOUT_SCHEME=Absolute path specified without a scheme for URI {0}.
-
-#
-# Common Messages
-#
-MSG_URI_NOT_RELATIVE=URL: {0} is not relative.
-MSG_ERROR_UNEXPECTED_ERROR=Unexpected exception occured.
-MSG_INVALID_PLATFORM_URL=Invalid URL: {0} for an Eclipse platform.
-MSG_INVALID_FILE_URL=Invalid URL: {0} for the file protocol
-
-#
-# Messages for ResouceUtils
-#
-MSG_ERROR_PATH_NOT_ABSOLUTE=Path {0} is not absolute for creating a file.
-MSG_ERROR_PATH_EMPTY=Path {0} is empty while creating a file.
-MSG_ERROR_PATH_NOT_FOLDER=Path {0} is not a folder for creating a file.
-MSG_ERROR_RESOURCE_NOT_FOLDER=Resource {0} is not a folder.
-MSG_ERROR_RESOURCE_NOT_FILE=The following path is not a resource: {0}.
-MSG_ERROR_FOLDER_HAS_CHILDREN=Can not create folder: {0} that already has children.
-MSG_ERROR_IO=An input/output error occurred while processing the resource "{0}".
-
-LABEL_YES=Yes
-LABEL_YES_TO_ALL=Yes All
-LABEL_CANCEL=Cancel
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/plugin/EnvironmentPlugin.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/plugin/EnvironmentPlugin.java
deleted file mode 100644
index 433045979..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/plugin/EnvironmentPlugin.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20060221 100364 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.plugin;
-
-
-import org.eclipse.core.runtime.Plugin;
-
-/**
-* This is the plugin class for the org.eclipse.wst.common.internal.environment.plugin.EnvironmentPlugin.
-*/
-public class EnvironmentPlugin extends Plugin
-{
- /**
- * The instance of this plugin.
- */
- private static EnvironmentPlugin instance;
-
- /**
- * Constructor for use by the Eclipse platform only.
- */
- public EnvironmentPlugin()
- {
- super();
- instance = this;
- }
-
- /**
- * Returns the instance of this plugin.
- */
- static public EnvironmentPlugin getInstance ()
- {
- return instance;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/relative/RelativeScheme.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/relative/RelativeScheme.java
deleted file mode 100644
index bb60c0ec8..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/relative/RelativeScheme.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.relative;
-
-import java.net.URL;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.common.environment.uri.IURI;
-import org.eclipse.wst.common.environment.uri.IURIScheme;
-import org.eclipse.wst.common.environment.uri.URIException;
-
-
-public class RelativeScheme implements IURIScheme
-{
-
- public String toString()
- {
- return "relative";
- }
-
- /* (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(IURI uri)
- {
- return !uri.toString().startsWith( "/" );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URIScheme#newURI(java.lang.String)
- */
- public IURI newURI(String uri) throws URIException
- {
- return new RelativeURI( uri );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URIScheme#newURI(org.eclipse.env.uri.URI)
- */
- public IURI newURI(IURI uri) throws URIException
- {
- return new RelativeURI( uri.toString() );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URIScheme#newURI(java.net.URL)
- */
- public IURI newURI(URL url) throws URIException
- {
- return new RelativeURI( url.toString() );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URIScheme#validate(org.eclipse.env.uri.URI)
- */
- public IStatus validate(IURI uri)
- {
- IStatus result = null;
-
- if( isValid( uri ) )
- {
- result = Status.OK_STATUS;
- }
- else
- {
- result = new Status( IStatus.ERROR, "id", 0, "",null );
- }
-
- return result;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/relative/RelativeURI.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/relative/RelativeURI.java
deleted file mode 100644
index 59f3d36a6..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/relative/RelativeURI.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.relative;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.environment.uri.IURI;
-import org.eclipse.wst.common.environment.uri.IURIFilter;
-import org.eclipse.wst.common.environment.uri.IURIScheme;
-import org.eclipse.wst.common.environment.uri.IURIVisitor;
-import org.eclipse.wst.common.environment.uri.URIException;
-import org.eclipse.wst.common.internal.environment.eclipse.Messages;
-
-
-public class RelativeURI implements IURI
-{
- protected String uri_;
-
- public RelativeURI( String uri )
- {
- uri_ = uri;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#append(org.eclipse.env.uri.URI)
- */
- public IURI append(IURI relativeURI) throws URIException
- {
- if( !relativeURI.isRelative())
- {
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_URI_NOT_RELATIVE, relativeURI.toString() ), null ) );
-
- }
-
- 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
- {
- return null;
- }
-
- /* (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 IURIScheme 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 false;
- }
-
- /* (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 IURI[] list() throws URIException
- {
- return new IURI[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#list(org.eclipse.env.uri.URIFilter)
- */
- public IURI[] list(IURIFilter uriFilter) throws URIException
- {
- return new IURI[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#parent()
- */
- public IURI 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(IURI 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(IURIVisitor uriVisitor, IURIFilter uriFilter)
- throws URIException
- {
- boolean continueVisit = true;
-
- // If the filter accepts this we will visit it.
- if( uriFilter.accepts( this ) )
- {
- continueVisit = uriVisitor.visit( this );
- }
-
- IURI[] 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(IURIVisitor uriVisitor) throws URIException
- {
- boolean continueVisit = uriVisitor.visit( this );
-
- IURI[] children = list();
-
- for( int index = 0; index < children.length && continueVisit; index++ )
- {
- children[index].visit( uriVisitor );
- }
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/uri/file/FileScheme.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/uri/file/FileScheme.java
deleted file mode 100644
index 3dd4f897c..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/uri/file/FileScheme.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.uri.file;
-
-import java.net.URL;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.environment.uri.IURI;
-import org.eclipse.wst.common.environment.uri.IURIScheme;
-import org.eclipse.wst.common.environment.uri.URIException;
-import org.eclipse.wst.common.internal.environment.eclipse.Messages;
-import org.eclipse.wst.common.internal.environment.relative.RelativeScheme;
-import org.eclipse.wst.common.internal.environment.relative.RelativeURI;
-
-
-public class FileScheme extends RelativeScheme
-{
- public String toString()
- {
- return "file";
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URIScheme#isValid(org.eclipse.env.uri.URI)
- */
- public boolean isValid(IURI uri)
- {
- boolean result = false;
-
- if( uri == null ) return false;
-
- IURIScheme scheme = uri.getURIScheme();
-
- if( scheme.toString().equals( "relative") ) return scheme.isValid( uri );
-
- String uriString = uri.toString();
-
- if( uriString != null && uriString.startsWith( "file:" ) )
- {
- result = true;
- }
-
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URIScheme#newURI(java.lang.String)
- */
- public IURI newURI(String uri) throws URIException
- {
- String newURI = null;
-
- if( uri != null && uri.startsWith( "file:") )
- {
- // The file protocol has been specified so keep it as is.
- newURI = uri;
- }
- else if( uri == null || uri.indexOf( ":") != -1 )
- {
- // The file uri is not allowed to contain some other protocol.
- throw new URIException(
- new Status( IStatus.ERROR, "id", 0,
- NLS.bind( Messages.MSG_INVALID_FILE_URL,uri), null ) );
-
- }
- else if( uri.startsWith( "/") )
- {
- // The file scheme has not been specified so we will add it.
- newURI = "file:" + uri;
- }
-
- if( newURI == null )
- {
- return new RelativeURI( uri );
- }
- else
- {
- return new FileURI( newURI );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URIScheme#newURI(org.eclipse.env.uri.URI)
- */
- public IURI newURI(IURI uri) throws URIException
- {
- return newURI( uri == null ? null : uri.toString() );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URIScheme#newURI(java.net.URL)
- */
- public IURI newURI(URL url) throws URIException
- {
- return newURI( url == null ? null : url.toString() );
- }
-}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/uri/file/FileURI.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/uri/file/FileURI.java
deleted file mode 100644
index ecc166411..000000000
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/uri/file/FileURI.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.environment.uri.file;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Vector;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.common.environment.uri.IURI;
-import org.eclipse.wst.common.environment.uri.URIException;
-import org.eclipse.wst.common.environment.uri.IURIFilter;
-import org.eclipse.wst.common.environment.uri.IURIScheme;
-import org.eclipse.wst.common.internal.environment.relative.RelativeURI;
-
-
-public class FileURI extends RelativeURI
-{
- private File file_ = null;
-
- public FileURI( String uri )
- {
- super( uri );
-
- if( getURIScheme().isValid( this ) )
- {
- file_ = new File( uri.substring( 5, uri.length() ) );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#asFile()
- */
- public File asFile()
- {
- return file_;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#erase()
- */
- public void erase() throws URIException
- {
- deleteFile( file_ );
- }
-
- private void deleteFile( File file )
- {
- if( file.isDirectory() )
- {
- File[] children = file.listFiles();
-
- for( int index = 0; index < children.length; index++ )
- {
- File child = children[index];
-
- if( child.isDirectory() )
- {
- deleteFile( child );
- }
- else
- {
- child.delete();
- }
- }
- }
-
- file.delete();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#getInputStream()
- */
- public InputStream getInputStream() throws URIException
- {
- FileInputStream stream = null;
-
- try
- {
- File parent = file_.getParentFile();
- parent.mkdirs();
-
- stream = new FileInputStream( file_ );
- }
- catch( IOException exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
-
- return stream;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#getOutputStream()
- */
- public OutputStream getOutputStream() throws URIException
- {
- FileOutputStream stream = null;
-
- try
- {
- File parent = file_.getParentFile();
- parent.mkdirs();
-
- stream = new FileOutputStream( file_ );
- }
- catch( IOException exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
-
- return stream;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#getURIScheme()
- */
- public IURIScheme getURIScheme()
- {
- return new FileScheme();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#isAvailableAsFile()
- */
- public boolean isAvailableAsFile()
- {
- return file_ != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#isAvailableAsURL()
- */
- public boolean isAvailableAsURL()
- {
- return file_ != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#asURL()
- */
- public URL asURL() throws URIException
- {
- URL url = null;
-
- try
- {
- url = file_ == null ? null : file_.toURL();
- }
- catch( MalformedURLException exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
-
- return url;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#isLeaf()
- */
- public boolean isLeaf()
- {
- return file_.isFile();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#isPresent()
- */
- public boolean isPresent()
- {
- return file_.exists();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#isReadable()
- */
- public boolean isReadable()
- {
- return file_.canRead();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#isWritable()
- */
- public boolean isWritable()
- {
- return file_.canWrite();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#list()
- */
- public IURI[] list() throws URIException
- {
- File[] children = file_.listFiles();
- IURI[] URIs = new IURI[0];
-
- if( children != null )
- {
- int length = children.length;
-
- URIs = new IURI[length];
-
- for( int index = 0; index < length; index++ )
- {
- URIs[index] = new FileURI( "file:" + children[index].getAbsolutePath() );
- }
- }
-
- return URIs;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#list(org.eclipse.env.uri.URIFilter)
- */
- public IURI[] list(IURIFilter uriFilter) throws URIException
- {
- File[] children = file_.listFiles();
- int length = children == null ? 0 : children.length;
- Vector URIs = new Vector();
-
- for( int index = 0; index < length; index++ )
- {
- IURI newURI = new FileURI( "file:" + children[index].getAbsolutePath() );
-
- if( uriFilter.accepts( newURI) )
- {
- URIs.add( newURI );
- }
- }
-
- return (IURI[])URIs.toArray( new IURI[0] );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#rename(org.eclipse.env.uri.URI)
- */
- public void rename(IURI newURI) throws URIException
- {
- try
- {
- uri_ = newURI.toString();
- URL newURL = new URL( uri_ );
- file_.renameTo( new File( newURL.getPath() ) );
- }
- catch( MalformedURLException exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#touchFolder()
- */
- public void touchFolder() throws URIException
- {
- file_.mkdirs();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.env.uri.URI#touchLeaf()
- */
- public void touchLeaf() throws URIException
- {
- try
- {
- // Ensure that the parent folders are created.
- File parent = file_.getParentFile();
- parent.mkdirs();
-
- file_.createNewFile();
- }
- catch( IOException exc )
- {
- throw new URIException( new Status( IStatus.ERROR, "id", 0, exc.getMessage(), exc ), this );
- }
- }
-
- public boolean isRelative()
- {
- return false;
- }
-}

Back to the top