Merge changes I9c844cb3,I85138cfd,I1c675863
* changes:
Bug 442660 - added accepting uri from input stream, fixed typo in test and added descriptions
QS-3259 delete-file now works with URI not path
QS-3259 Added ECL command delete-file
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.data/META-INF/MANIFEST.MF b/ecl/plugins/org.eclipse.rcptt.ecl.data/META-INF/MANIFEST.MF
index a6386a4..c868f6a 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.data/META-INF/MANIFEST.MF
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.data/META-INF/MANIFEST.MF
@@ -10,12 +10,13 @@
Export-Package: org.eclipse.rcptt.ecl.data.commands,
org.eclipse.rcptt.ecl.data.commands.impl,
org.eclipse.rcptt.ecl.data.commands.util,
+ org.eclipse.rcptt.ecl.data.internal.commands,
org.eclipse.rcptt.ecl.data.objects,
org.eclipse.rcptt.ecl.data.objects.impl,
org.eclipse.rcptt.ecl.data.objects.util
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.rcptt.ecl.core;bundle-version="1.1.0",
- org.eclipse.rcptt.ecl.data;visibility:=reexport,
- org.eclipse.core.resources;resolution:=optional
+ org.eclipse.core.resources;resolution:=optional,
+ org.eclipse.rcptt.ecl.filesystem;bundle-version="1.5.2"
Bundle-ActivationPolicy: lazy
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadCsvFileService.java b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadCsvFileService.java
index 83a90d8..4818156 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadCsvFileService.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadCsvFileService.java
@@ -26,6 +26,7 @@
import org.eclipse.rcptt.ecl.data.objects.ObjectsFactory;
import org.eclipse.rcptt.ecl.data.objects.Row;
import org.eclipse.rcptt.ecl.data.objects.Table;
+import org.eclipse.rcptt.ecl.filesystem.FileResolver;
import org.eclipse.rcptt.ecl.runtime.ICommandService;
import org.eclipse.rcptt.ecl.runtime.IProcess;
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadLinesService.java b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadLinesService.java
index 478c655..b08ab1c 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadLinesService.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadLinesService.java
@@ -22,6 +22,7 @@
import org.eclipse.rcptt.ecl.core.Command;
import org.eclipse.rcptt.ecl.data.commands.ReadLines;
import org.eclipse.rcptt.ecl.data.internal.EclDataPlugin;
+import org.eclipse.rcptt.ecl.filesystem.FileResolver;
import org.eclipse.rcptt.ecl.runtime.ICommandService;
import org.eclipse.rcptt.ecl.runtime.IProcess;
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadPropertiesService.java b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadPropertiesService.java
index 7a7d9c1..c6f22d6 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadPropertiesService.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/ReadPropertiesService.java
@@ -27,6 +27,7 @@
import org.eclipse.rcptt.ecl.core.EclMapEntry;
import org.eclipse.rcptt.ecl.data.commands.ReadProperties;
import org.eclipse.rcptt.ecl.data.internal.EclDataPlugin;
+import org.eclipse.rcptt.ecl.filesystem.FileResolver;
import org.eclipse.rcptt.ecl.runtime.BoxedValues;
import org.eclipse.rcptt.ecl.runtime.ICommandService;
import org.eclipse.rcptt.ecl.runtime.IProcess;
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/WriteCsvFileService.java b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/WriteCsvFileService.java
index 6721e02..f819615 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/WriteCsvFileService.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/WriteCsvFileService.java
@@ -24,6 +24,7 @@
import org.eclipse.rcptt.ecl.data.internal.EclDataPlugin;
import org.eclipse.rcptt.ecl.data.objects.Row;
import org.eclipse.rcptt.ecl.data.objects.Table;
+import org.eclipse.rcptt.ecl.filesystem.FileResolver;
import org.eclipse.rcptt.ecl.runtime.ICommandService;
import org.eclipse.rcptt.ecl.runtime.IProcess;
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/WriteLinesService.java b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/WriteLinesService.java
index 4e6c89c..d3ea7a5 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/WriteLinesService.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/WriteLinesService.java
@@ -21,6 +21,7 @@
import org.eclipse.rcptt.ecl.core.Command;
import org.eclipse.rcptt.ecl.data.commands.WriteLines;
import org.eclipse.rcptt.ecl.data.internal.EclDataPlugin;
+import org.eclipse.rcptt.ecl.filesystem.FileResolver;
import org.eclipse.rcptt.ecl.runtime.CoreUtils;
import org.eclipse.rcptt.ecl.runtime.ICommandService;
import org.eclipse.rcptt.ecl.runtime.IProcess;
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/META-INF/MANIFEST.MF b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/META-INF/MANIFEST.MF
index 486e5a5..4cdee80 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/META-INF/MANIFEST.MF
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/META-INF/MANIFEST.MF
@@ -14,5 +14,6 @@
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.rcptt.ecl.core;visibility:=reexport,
org.eclipse.rcptt.ecl.dispatch,
- org.eclipse.core.filesystem
+ org.eclipse.core.filesystem,
+ org.eclipse.core.resources
Bundle-ActivationPolicy: lazy
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/DeleteFile.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/DeleteFile.java
new file mode 100644
index 0000000..2635ee0
--- /dev/null
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/DeleteFile.java
@@ -0,0 +1,51 @@
+/**
+ */
+package org.eclipse.rcptt.ecl.filesystem;
+
+import org.eclipse.rcptt.ecl.core.Command;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Delete File</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.rcptt.ecl.filesystem.DeleteFile#getUri <em>Uri</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.rcptt.ecl.filesystem.FilesystemPackage#getDeleteFile()
+ * @model annotation="http://www.eclipse.org/ecl/docs description='Deletes file or folder identified by URI.\r\nCurrently supported schemes are workspace:/ for files in workspace and file:/ for files on local file system.' returns='Nothing' example='delete-file \"file:/C:/temp/1.txt\"\r\ndelete-file [uri-from-path \"C:/temp/2.txt\"]\r\nuri-from-path \"C:/temp/3.txt\" | delete-file\r\nget-file \"file:/C:/temp/4.txt\" | delete-file\r\nstr \"workspace:/MyProject/text.txt\" | delete-file\r\n\r\n'"
+ * @generated
+ */
+public interface DeleteFile extends Command {
+ /**
+ * Returns the value of the '<em><b>Uri</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Uri</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Uri</em>' attribute.
+ * @see #setUri(String)
+ * @see org.eclipse.rcptt.ecl.filesystem.FilesystemPackage#getDeleteFile_Uri()
+ * @model required="true"
+ * annotation="http://www.eclipse.org/ecl/docs description='URI of a file or directory. Can be created manually, or with uri-from-path.' example='file:/C:/temp'"
+ * @generated
+ */
+ String getUri();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.rcptt.ecl.filesystem.DeleteFile#getUri <em>Uri</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Uri</em>' attribute.
+ * @see #getUri()
+ * @generated
+ */
+ void setUri(String value);
+
+} // DeleteFile
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/FilesystemFactory.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/FilesystemFactory.java
index 1a6c865..dd65ae7 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/FilesystemFactory.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/FilesystemFactory.java
@@ -67,6 +67,15 @@
File createFile();
/**
+ * Returns a new object of class '<em>Delete File</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Delete File</em>'.
+ * @generated
+ */
+ DeleteFile createDeleteFile();
+
+ /**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/FilesystemPackage.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/FilesystemPackage.java
index 372d45f..2d6fe97 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/FilesystemPackage.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/FilesystemPackage.java
@@ -251,6 +251,53 @@
/**
+ * The meta object id for the '{@link org.eclipse.rcptt.ecl.filesystem.impl.DeleteFileImpl <em>Delete File</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rcptt.ecl.filesystem.impl.DeleteFileImpl
+ * @see org.eclipse.rcptt.ecl.filesystem.impl.FilesystemPackageImpl#getDeleteFile()
+ * @generated
+ */
+ int DELETE_FILE = 4;
+
+ /**
+ * The feature id for the '<em><b>Host</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DELETE_FILE__HOST = CorePackage.COMMAND__HOST;
+
+ /**
+ * The feature id for the '<em><b>Bindings</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DELETE_FILE__BINDINGS = CorePackage.COMMAND__BINDINGS;
+
+ /**
+ * The feature id for the '<em><b>Uri</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DELETE_FILE__URI = CorePackage.COMMAND_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Delete File</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DELETE_FILE_FEATURE_COUNT = CorePackage.COMMAND_FEATURE_COUNT + 1;
+
+
+ /**
* Returns the meta object for class '{@link org.eclipse.rcptt.ecl.filesystem.CopyFile <em>Copy File</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -357,6 +404,27 @@
EAttribute getFile_Uri();
/**
+ * Returns the meta object for class '{@link org.eclipse.rcptt.ecl.filesystem.DeleteFile <em>Delete File</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Delete File</em>'.
+ * @see org.eclipse.rcptt.ecl.filesystem.DeleteFile
+ * @generated
+ */
+ EClass getDeleteFile();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.rcptt.ecl.filesystem.DeleteFile#getUri <em>Uri</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Uri</em>'.
+ * @see org.eclipse.rcptt.ecl.filesystem.DeleteFile#getUri()
+ * @see #getDeleteFile()
+ * @generated
+ */
+ EAttribute getDeleteFile_Uri();
+
+ /**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -466,6 +534,24 @@
*/
EAttribute FILE__URI = eINSTANCE.getFile_Uri();
+ /**
+ * The meta object literal for the '{@link org.eclipse.rcptt.ecl.filesystem.impl.DeleteFileImpl <em>Delete File</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rcptt.ecl.filesystem.impl.DeleteFileImpl
+ * @see org.eclipse.rcptt.ecl.filesystem.impl.FilesystemPackageImpl#getDeleteFile()
+ * @generated
+ */
+ EClass DELETE_FILE = eINSTANCE.getDeleteFile();
+
+ /**
+ * The meta object literal for the '<em><b>Uri</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute DELETE_FILE__URI = eINSTANCE.getDeleteFile_Uri();
+
}
} //FilesystemPackage
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/DeleteFileImpl.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/DeleteFileImpl.java
new file mode 100644
index 0000000..065bee6
--- /dev/null
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/DeleteFileImpl.java
@@ -0,0 +1,164 @@
+/**
+ */
+package org.eclipse.rcptt.ecl.filesystem.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.rcptt.ecl.core.impl.CommandImpl;
+
+import org.eclipse.rcptt.ecl.filesystem.DeleteFile;
+import org.eclipse.rcptt.ecl.filesystem.FilesystemPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Delete File</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.rcptt.ecl.filesystem.impl.DeleteFileImpl#getUri <em>Uri</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class DeleteFileImpl extends CommandImpl implements DeleteFile {
+ /**
+ * The default value of the '{@link #getUri() <em>Uri</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUri()
+ * @generated
+ * @ordered
+ */
+ protected static final String URI_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getUri() <em>Uri</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUri()
+ * @generated
+ * @ordered
+ */
+ protected String uri = URI_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DeleteFileImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return FilesystemPackage.Literals.DELETE_FILE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getUri() {
+ return uri;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setUri(String newUri) {
+ String oldUri = uri;
+ uri = newUri;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, FilesystemPackage.DELETE_FILE__URI, oldUri, uri));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case FilesystemPackage.DELETE_FILE__URI:
+ return getUri();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case FilesystemPackage.DELETE_FILE__URI:
+ setUri((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case FilesystemPackage.DELETE_FILE__URI:
+ setUri(URI_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case FilesystemPackage.DELETE_FILE__URI:
+ return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (uri: ");
+ result.append(uri);
+ result.append(')');
+ return result.toString();
+ }
+
+} //DeleteFileImpl
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/FilesystemFactoryImpl.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/FilesystemFactoryImpl.java
index 7bf4b3d..8b94006 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/FilesystemFactoryImpl.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/FilesystemFactoryImpl.java
@@ -36,7 +36,7 @@
*/
public static FilesystemFactory init() {
try {
- FilesystemFactory theFilesystemFactory = (FilesystemFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/ecl/filesystem.ecore");
+ FilesystemFactory theFilesystemFactory = (FilesystemFactory)EPackage.Registry.INSTANCE.getEFactory(FilesystemPackage.eNS_URI);
if (theFilesystemFactory != null) {
return theFilesystemFactory;
}
@@ -69,6 +69,7 @@
case FilesystemPackage.URI_FROM_PATH: return createUriFromPath();
case FilesystemPackage.GET_FILE: return createGetFile();
case FilesystemPackage.FILE: return createFile();
+ case FilesystemPackage.DELETE_FILE: return createDeleteFile();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
@@ -119,6 +120,16 @@
* <!-- end-user-doc -->
* @generated
*/
+ public DeleteFile createDeleteFile() {
+ DeleteFileImpl deleteFile = new DeleteFileImpl();
+ return deleteFile;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public FilesystemPackage getFilesystemPackage() {
return (FilesystemPackage)getEPackage();
}
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/FilesystemPackageImpl.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/FilesystemPackageImpl.java
index 78a9eac..7e45b67 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/FilesystemPackageImpl.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/impl/FilesystemPackageImpl.java
@@ -21,6 +21,7 @@
import org.eclipse.rcptt.ecl.core.CorePackage;
import org.eclipse.rcptt.ecl.filesystem.CopyFile;
+import org.eclipse.rcptt.ecl.filesystem.DeleteFile;
import org.eclipse.rcptt.ecl.filesystem.File;
import org.eclipse.rcptt.ecl.filesystem.FilesystemFactory;
import org.eclipse.rcptt.ecl.filesystem.FilesystemPackage;
@@ -63,6 +64,13 @@
private EClass fileEClass = null;
/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass deleteFileEClass = null;
+
+ /**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
@@ -221,6 +229,24 @@
* <!-- end-user-doc -->
* @generated
*/
+ public EClass getDeleteFile() {
+ return deleteFileEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDeleteFile_Uri() {
+ return (EAttribute)deleteFileEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public FilesystemFactory getFilesystemFactory() {
return (FilesystemFactory)getEFactoryInstance();
}
@@ -257,6 +283,9 @@
fileEClass = createEClass(FILE);
createEAttribute(fileEClass, FILE__URI);
+
+ deleteFileEClass = createEClass(DELETE_FILE);
+ createEAttribute(deleteFileEClass, DELETE_FILE__URI);
}
/**
@@ -294,6 +323,7 @@
copyFileEClass.getESuperTypes().add(theCorePackage.getCommand());
uriFromPathEClass.getESuperTypes().add(theCorePackage.getCommand());
getFileEClass.getESuperTypes().add(theCorePackage.getCommand());
+ deleteFileEClass.getESuperTypes().add(theCorePackage.getCommand());
// Initialize classes and features; add operations and parameters
initEClass(copyFileEClass, CopyFile.class, "CopyFile", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -310,6 +340,9 @@
initEClass(fileEClass, File.class, "File", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getFile_Uri(), theEcorePackage.getEString(), "uri", null, 1, 1, File.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEClass(deleteFileEClass, DeleteFile.class, "DeleteFile", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getDeleteFile_Uri(), theEcorePackage.getEString(), "uri", null, 1, 1, DeleteFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
// Create resource
createResource(eNS_URI);
@@ -327,7 +360,7 @@
* @generated
*/
protected void createDocsAnnotations() {
- String source = "http://www.eclipse.org/ecl/docs";
+ String source = "http://www.eclipse.org/ecl/docs";
addAnnotation
(copyFileEClass,
source,
@@ -335,39 +368,39 @@
"description", "Copies <code>source</code> file or directory into <code>destination</code> directory, optionally giving it a new <code>name</code>.",
"returns", "Nothing.",
"example", "copy-file -source \"/Users/Ulik_MacAir/aut-Q7-1.3.12-B2/Project/t.test\" \n-destination \"/Users/Ulik_MacAir/aut-Q7-1.3.12-B2/Project/Folder\" -name \"Clone.test\""
- });
+ });
addAnnotation
(getCopyFile_Source(),
source,
new String[] {
"description", "Source file or directory."
- });
+ });
addAnnotation
(getCopyFile_Destination(),
source,
new String[] {
"description", "Destination directory under which the <code>source</code> file or directory will be stored."
- });
+ });
addAnnotation
(getCopyFile_Name(),
source,
new String[] {
"description", "New name for the <code>source</code> file or directory."
- });
+ });
addAnnotation
(uriFromPathEClass,
source,
new String[] {
"returns", "URI string. Platform independent (can be used on every OS).",
"example", "get-file [uri-from-path \"C:\\windows\"] | get exists"
- });
+ });
addAnnotation
(getUriFromPath_Path(),
source,
new String[] {
"description", "Platform-dependednt filesystem path.",
"example", "C:\\windows\\system32"
- });
+ });
addAnnotation
(getFileEClass,
source,
@@ -375,13 +408,28 @@
"returns", "A File object. Properties: uri, name, exists, children.",
"description", "Creates a file object by its URI.",
"example", "get-file \"file:/C:/Windows/System32\" | get exists"
- });
+ });
addAnnotation
(getGetFile_Uri(),
source,
new String[] {
"description", "URI of a file or directory. Can be created manually, or with uri-from-path.",
"example", "file:/C:/windows/system32"
+ });
+ addAnnotation
+ (deleteFileEClass,
+ source,
+ new String[] {
+ "description", "Deletes file or folder identified by URI.\r\nCurrently supported schemes are workspace:/ for files in workspace and file:/ for files on local file system.",
+ "returns", "Nothing",
+ "example", "delete-file \"file:/C:/temp/1.txt\"\r\ndelete-file [uri-from-path \"C:/temp/2.txt\"]\r\nuri-from-path \"C:/temp/3.txt\" | delete-file\r\nget-file \"file:/C:/temp/4.txt\" | delete-file\r\nstr \"workspace:/MyProject/text.txt\" | delete-file\r\n\r\n"
+ });
+ addAnnotation
+ (getDeleteFile_Uri(),
+ source,
+ new String[] {
+ "description", "URI of a file or directory. Can be created manually, or with uri-from-path.",
+ "example", "file:/C:/temp"
});
}
@@ -392,17 +440,22 @@
* @generated
*/
protected void createInputAnnotations() {
- String source = "http://www.eclipse.org/ecl/input";
+ String source = "http://www.eclipse.org/ecl/input";
addAnnotation
(getUriFromPath_Path(),
source,
new String[] {
- });
+ });
addAnnotation
(getGetFile_Uri(),
source,
new String[] {
});
+ addAnnotation
+ (getDeleteFile_Uri(),
+ source,
+ new String[] {
+ });
}
} //FilesystemPackageImpl
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/util/FilesystemAdapterFactory.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/util/FilesystemAdapterFactory.java
index 4cc27e7..6a41d49 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/util/FilesystemAdapterFactory.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/util/FilesystemAdapterFactory.java
@@ -95,6 +95,10 @@
return createFileAdapter();
}
@Override
+ public Adapter caseDeleteFile(DeleteFile object) {
+ return createDeleteFileAdapter();
+ }
+ @Override
public Adapter caseCommand(Command object) {
return createCommandAdapter();
}
@@ -175,6 +179,20 @@
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.rcptt.ecl.filesystem.DeleteFile <em>Delete File</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.rcptt.ecl.filesystem.DeleteFile
+ * @generated
+ */
+ public Adapter createDeleteFileAdapter() {
+ return null;
+ }
+
+ /**
* Creates a new adapter for an object of class '{@link org.eclipse.rcptt.ecl.core.Command <em>Command</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/util/FilesystemSwitch.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/util/FilesystemSwitch.java
index dee879f..4a10695 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/util/FilesystemSwitch.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/gen-src/org/eclipse/rcptt/ecl/filesystem/util/FilesystemSwitch.java
@@ -121,6 +121,13 @@
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case FilesystemPackage.DELETE_FILE: {
+ DeleteFile deleteFile = (DeleteFile)theEObject;
+ T result = caseDeleteFile(deleteFile);
+ if (result == null) result = caseCommand(deleteFile);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
default: return defaultCase(theEObject);
}
}
@@ -186,6 +193,21 @@
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>Delete File</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Delete File</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseDeleteFile(DeleteFile object) {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>Command</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/model/filesystem.ecore b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/model/filesystem.ecore
index 40674b5..5074d90 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/model/filesystem.ecore
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/model/filesystem.ecore
@@ -56,4 +56,18 @@
<eClassifiers xsi:type="ecore:EClass" name="File">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="DeleteFile" eSuperTypes="../../org.eclipse.rcptt.ecl.core/model/ecl.ecore#//Command">
+ <eAnnotations source="http://www.eclipse.org/ecl/docs">
+ <details key="description" value="Deletes file or folder identified by URI.
Currently supported schemes are workspace:/ for files in workspace and file:/ for files on local file system."/>
+ <details key="returns" value="Nothing"/>
+ <details key="example" value="delete-file "file:/C:/temp/1.txt"
delete-file [uri-from-path "C:/temp/2.txt"]
uri-from-path "C:/temp/3.txt" | delete-file
get-file "file:/C:/temp/4.txt" | delete-file
str "workspace:/MyProject/text.txt" | delete-file

"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString">
+ <eAnnotations source="http://www.eclipse.org/ecl/input"/>
+ <eAnnotations source="http://www.eclipse.org/ecl/docs">
+ <details key="description" value="URI of a file or directory. Can be created manually, or with uri-from-path."/>
+ <details key="example" value="file:/C:/temp"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
</ecore:EPackage>
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/model/filesystem.genmodel b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/model/filesystem.genmodel
index 312fd07..93512e7 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/model/filesystem.genmodel
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/model/filesystem.genmodel
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<genmodel:GenModel xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.rcptt.ecl.filesystem/gen-src"
- modelPluginID="org.eclipse.rcptt.ecl.filesystem" modelName="Filesystem" editPluginClass="org.eclipse.rcptt.ecl.filesystem.provider.FilesystemEditPlugin"
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.rcptt.ecl.filesystem/gen-src" modelPluginID="org.eclipse.rcptt.ecl.filesystem"
+ modelName="Filesystem" editPluginClass="org.eclipse.rcptt.ecl.filesystem.provider.FilesystemEditPlugin"
editorPluginClass="org.eclipse.rcptt.ecl.filesystem.presentation.FilesystemEditorPlugin"
testSuiteClass="org.eclipse.rcptt.ecl.filesystem.tests.FilesystemAllTests" importerID="org.eclipse.emf.importer.ecore"
complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.5" usedGenPackages="../../org.eclipse.rcptt.ecl.core/model/ecl.genmodel#//core platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
@@ -23,5 +22,8 @@
<genClasses ecoreClass="filesystem.ecore#//File">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute filesystem.ecore#//File/uri"/>
</genClasses>
+ <genClasses ecoreClass="filesystem.ecore#//DeleteFile">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute filesystem.ecore#//DeleteFile/path"/>
+ </genClasses>
</genPackages>
</genmodel:GenModel>
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/plugin.xml b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/plugin.xml
index f14ee0f..bba1635 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/plugin.xml
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/plugin.xml
@@ -27,6 +27,11 @@
name="GetFile"
namespace="http://www.eclipse.org/ecl/filesystem.ecore">
</scriptlet>
+ <scriptlet
+ class="org.eclipse.rcptt.ecl.filesystem.internal.commands.DeleteFileService"
+ name="DeleteFile"
+ namespace="http://www.eclipse.org/ecl/filesystem.ecore">
+ </scriptlet>
</extension>
<extension
point="org.eclipse.rcptt.ecl.dispatch.scriptletExtension">
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/EclFilesystemPlugin.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/EclFilesystemPlugin.java
index e6f5155..8490743 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/EclFilesystemPlugin.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/EclFilesystemPlugin.java
@@ -66,11 +66,12 @@
return plugin;
}
- public static Status createError(String message, Throwable throwable) {
- return new Status(IStatus.ERROR, EclFilesystemPlugin.PLUGIN_ID, message, throwable);
+ public static Status createError(String message, Object... args) {
+ return createError(null, message, args);
}
- public static Status createError(String message) {
- return createError(message, null);
+ public static Status createError(Throwable throwable, String message, Object... args) {
+ return new Status(IStatus.ERROR, EclFilesystemPlugin.PLUGIN_ID, String.format(message, args), throwable);
}
+
}
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/FileResolver.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/FileResolver.java
similarity index 88%
rename from ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/FileResolver.java
rename to ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/FileResolver.java
index fab58ed..ed3b085 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.data/src/org/eclipse/rcptt/ecl/data/internal/commands/FileResolver.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/FileResolver.java
@@ -8,9 +8,9 @@
* Contributors:
* Xored Software Inc - initial API and implementation and/or initial documentation
*******************************************************************************/
-package org.eclipse.rcptt.ecl.data.internal.commands;
+package org.eclipse.rcptt.ecl.filesystem;
-import static org.eclipse.rcptt.ecl.data.internal.EclDataPlugin.createErr;
+import static org.eclipse.rcptt.ecl.filesystem.EclFilesystemPlugin.createError;
import java.io.File;
import java.net.URI;
@@ -55,14 +55,14 @@
try {
return resolve(new URI(uri));
} catch (URISyntaxException e) {
- throw new CoreException(createErr(e, "Cannot parse URI %s", uri));
+ throw new CoreException(createError(e, "Cannot parse URI %s", uri));
}
}
public static File resolve(URI uri) throws CoreException {
Resolver resolver = resolvers.get(uri.getScheme());
if (resolver == null) {
- throw new CoreException(createErr("Usupported scheme %s",
+ throw new CoreException(createError("Usupported scheme %s",
uri.getScheme()));
}
return resolver.resolve(uri);
@@ -88,7 +88,7 @@
.getLocation().toFile();
} catch (NoClassDefFoundError e) {
throw new CoreException(
- createErr("Resources plugin is not available, "
+ createError("Resources plugin is not available, "
+ "cannot use 'workspace:' scheme"));
}
}
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/CopyFileService.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/CopyFileService.java
index da3137d..dc2f72f 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/CopyFileService.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/CopyFileService.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.rcptt.ecl.filesystem.internal.commands;
+import static org.eclipse.rcptt.ecl.filesystem.EclFilesystemPlugin.createError;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -35,23 +37,23 @@
String name = copyFile.getName();
if (src == null || src.length() == 0)
- return error("Source file/directory is not specified.");
+ return createError("Source file/directory is not specified.");
if (dst == null || dst.length() == 0)
- return error("Destination directory is not specified.");
+ return createError("Destination directory is not specified.");
try {
File srcFile = new File(src).getCanonicalFile();
if (!srcFile.exists())
- return error("Source file/directory \"%s\" does not exist.",
+ return createError("Source file/directory \"%s\" does not exist.",
srcFile);
File dstFile = new File(dst).getCanonicalFile();
if (dstFile.exists() && !dstFile.isDirectory())
- return error("Destination \"%s\" must be a directory.", dstFile);
+ return createError("Destination \"%s\" must be a directory.", dstFile);
if (!dstFile.exists() && !dstFile.mkdirs())
- return error(
+ return createError(
"Unable to create the destination directory \"%s\".",
dstFile);
@@ -65,19 +67,19 @@
else if (srcFile.isDirectory())
return copyDirectory(srcFile, dstFile);
else
- return error("Unsupported source type.");
+ return createError("Unsupported source type.");
} catch (Exception e) {
- return error(e.getMessage());
+ return createError(e.getMessage());
}
}
private static IStatus copyFile(File src, File dst) throws IOException {
if (dst.exists())
- return error("Destination \"%s\" already exists.", dst);
+ return createError("Destination \"%s\" already exists.", dst);
File parent = dst.getParentFile();
if (parent != null && !parent.exists() && !parent.mkdirs())
- return error("Unable to create the destination directory \"%s\".",
+ return createError("Unable to create the destination directory \"%s\".",
parent);
doCopyFile(src, dst);
@@ -120,14 +122,14 @@
private static IStatus copyDirectory(File src, File dst) throws IOException {
if (dst.exists())
- return error("Destination \"%s\" already exists.", dst);
+ return createError("Destination \"%s\" already exists.", dst);
if (isSourceIncludesDestination(dst, src))
- return error("Destination \"%s\" is nested inside source \"%s\".",
+ return createError("Destination \"%s\" is nested inside source \"%s\".",
dst, src);
if (!dst.mkdirs())
- return error("Unable to create the destination directory \"%s\".",
+ return createError("Unable to create the destination directory \"%s\".",
dst);
copyFilesAndDirectories(src, dst);
@@ -160,8 +162,4 @@
}
}
- private static Status error(String message, Object... args) {
- return new Status(Status.ERROR, EclFilesystemPlugin.PLUGIN_ID,
- String.format(message, args));
- }
}
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/DeleteFileService.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/DeleteFileService.java
new file mode 100644
index 0000000..ecf6c6b
--- /dev/null
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/DeleteFileService.java
@@ -0,0 +1,49 @@
+package org.eclipse.rcptt.ecl.filesystem.internal.commands;
+
+import static org.eclipse.rcptt.ecl.filesystem.EclFilesystemPlugin.createError;
+
+import java.io.File;
+import java.net.URI;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.rcptt.ecl.core.Command;
+import org.eclipse.rcptt.ecl.filesystem.DeleteFile;
+import org.eclipse.rcptt.ecl.filesystem.FileResolver;
+import org.eclipse.rcptt.ecl.runtime.ICommandService;
+import org.eclipse.rcptt.ecl.runtime.IProcess;
+
+public class DeleteFileService implements ICommandService {
+
+ @Override
+ public IStatus service(Command command, IProcess context) throws InterruptedException, CoreException {
+ DeleteFile deleteFile = (DeleteFile) command;
+ String uriString = deleteFile.getUri();
+
+ if (uriString == null || uriString.length() == 0)
+ return createError("No uri argument for delete-file command.");
+
+ try {
+ URI uri = new URI(uriString);
+ File file = FileResolver.resolve(uri);
+ if (file != null) {
+ uri = file.toURI();
+ }
+
+ IFileStore input = EFS.getStore(uri);
+ if (!input.fetchInfo().exists()) {
+ return createError("\"%s\" not found.", uriString);
+ }
+
+ input.delete(EFS.NONE, null);
+
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ return createError(e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/GetFileService.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/GetFileService.java
index a4f0cf8..416b109 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/GetFileService.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/GetFileService.java
@@ -38,7 +38,7 @@
try {
URIUtil.fromString(command.getUri());
} catch (URISyntaxException e) {
- throw new CoreException(createError("Failed to parse file URI: "+ command.getUri()));
+ throw new CoreException(createError("Failed to parse file URI: %s", command.getUri()));
}
rv.setUri(command.getUri());
return rv;
diff --git a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/GetFromFileService.java b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/GetFromFileService.java
index 1c6759c..279e689 100644
--- a/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/GetFromFileService.java
+++ b/ecl/plugins/org.eclipse.rcptt.ecl.filesystem/src/org/eclipse/rcptt/ecl/filesystem/internal/commands/GetFromFileService.java
@@ -71,8 +71,7 @@
CoreException {
Key key = parseKey(command.getKey());
if (key == null) {
- throw new CoreException(createError("Invalid key: "
- + command.getKey()));
+ throw new CoreException(createError("Invalid key: %s", command.getKey()));
}
String uriString = ((File) command.getInput()).getUri();
URI uri = URI.create(uriString);
@@ -87,7 +86,7 @@
case NAME:
return handleName(input);
}
- throw new CoreException(createError("Wrong key: " + key));
+ throw new CoreException(createError("Wrong key: %s", key));
}
private boolean handleIsDirectory(IFileStore input) throws CoreException {
diff --git a/rcpttTests/ECL_IDE_module/selfAUTTests/q7commands/DeleteDirectory.test b/rcpttTests/ECL_IDE_module/selfAUTTests/q7commands/DeleteDirectory.test
new file mode 100644
index 0000000..df611ce
--- /dev/null
+++ b/rcpttTests/ECL_IDE_module/selfAUTTests/q7commands/DeleteDirectory.test
@@ -0,0 +1,51 @@
+--- RCPTT testcase ---
+Format-Version: 1.0
+Contexts: _ymiyse5IEeCU6db9MgIBkA,_roqd8KekEeC8_YI4qVLWTA
+Element-Name: DeleteDerictory
+Element-Type: testcase
+Element-Version: 3.0
+External-Reference:
+Id: _Mmvu0Ck0EeSQyvXPk2B9Hw
+Runtime-Version: 1.5.0.201406020630
+Save-Time: 8/29/14 2:16 PM
+Testcase-Type: ecl
+
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa
+Content-Type: text/plain
+Entry-Name: .description
+
+Copyright (c) 2009, 2014 Xored Software Inc 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:
+ Xored Software Inc - initial creation and/or initial documentation
+--------------------------------------------------------------------------------
+
+TEST STEPS:
+
+1. Execute command "delete-file" on directory
+2. Make sure that directory is deleted
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa--
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac
+Content-Type: text/ecl
+Entry-Name: .content
+
+delete-file [concat [uri-from-path [substitute-variables "${workspace_loc}"]] "FilesForContextEditor/folder"]
+get-view "Test Explorer" | get-tree | get-item FilesForContextEditor | get-property childCount | equals 2 | verify-true
+get-view "Test Explorer" | get-tree | select FilesForContextEditor | get-menu Refresh | click
+get-view "Test Explorer" | get-tree | get-item FilesForContextEditor | get-property childCount | equals 1 | verify-true
+
+with [get-view "Test Explorer" | get-tree] {
+ get-item "FilesForContextEditor/text.txt" | get-property caption | equals text.txt | verify-true
+ verify-error {
+ get-item "FilesForContextEditor/folder"
+ }
+}
+
+verify-error {
+ delete-file [concat [uri-from-path [substitute-variables "${workspace_loc}"]] "FilesForContextEditor/folder"]
+}
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac--
diff --git a/rcpttTests/ECL_IDE_module/selfAUTTests/q7commands/DeleteFile.test b/rcpttTests/ECL_IDE_module/selfAUTTests/q7commands/DeleteFile.test
new file mode 100644
index 0000000..ee9feca
--- /dev/null
+++ b/rcpttTests/ECL_IDE_module/selfAUTTests/q7commands/DeleteFile.test
@@ -0,0 +1,57 @@
+--- RCPTT testcase ---
+Format-Version: 1.0
+Contexts: _ymiyse5IEeCU6db9MgIBkA,_roqd8KekEeC8_YI4qVLWTA
+Element-Name: DeleteFile
+Element-Type: testcase
+Element-Version: 3.0
+External-Reference:
+Id: _Ntb8ACkyEeSQyvXPk2B9Hw
+Runtime-Version: 1.5.0.201406020630
+Save-Time: 8/29/14 2:29 PM
+Testcase-Type: ecl
+
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa
+Content-Type: text/plain
+Entry-Name: .description
+
+Copyright (c) 2009, 2014 Xored Software Inc 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:
+ Xored Software Inc - initial creation and/or initial documentation
+--------------------------------------------------------------------------------
+
+TEST STEPS:
+
+1. Execute command "delete-file"
+2. Make sure that file is deleted
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa--
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac
+Content-Type: text/ecl
+Entry-Name: .content
+
+delete-file [concat [uri-from-path [substitute-variables "${workspace_loc}"]] "FilesForContextEditor/text.txt"]
+
+get-view "Test Explorer" | get-tree | get-item FilesForContextEditor | get-property childCount | equals 2 | verify-true
+get-view "Test Explorer" | get-tree | select FilesForContextEditor | get-menu Refresh | click
+get-view "Test Explorer" | get-tree | get-item FilesForContextEditor | get-property childCount | equals 1 | verify-true
+
+with [get-view "Test Explorer" | get-tree] {
+ get-item "FilesForContextEditor/folder" | get-property caption | equals folder | verify-true
+ verify-error {
+ get-item "FilesForContextEditor/text.txt"
+ }
+}
+
+verify-error {
+ delete-file [concat [uri-from-path [substitute-variables "${workspace_loc}"]] "FilesForContextEditor/text.txt"]
+}
+verify-error {
+ delete-file [substitute-variables "${workspace_loc}/FilesForContextEditor/text.txt"]
+}
+
+
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac--
diff --git a/rcpttTests/ECL_IDE_module/selfAUTTests/q7commands/DeleteFileUriInput.test b/rcpttTests/ECL_IDE_module/selfAUTTests/q7commands/DeleteFileUriInput.test
new file mode 100644
index 0000000..571e847
--- /dev/null
+++ b/rcpttTests/ECL_IDE_module/selfAUTTests/q7commands/DeleteFileUriInput.test
@@ -0,0 +1,53 @@
+--- RCPTT testcase ---
+Format-Version: 1.0
+Contexts: _ymiyse5IEeCU6db9MgIBkA,_roqd8KekEeC8_YI4qVLWTA
+Element-Name: DeleteFileUriInput
+Element-Type: testcase
+Element-Version: 3.0
+External-Reference:
+Id: __t9-sC9LEeSQ0rUJOTehDQ
+Runtime-Version: 1.5.0.201406020630
+Save-Time: 8/29/14 2:44 PM
+Testcase-Type: ecl
+
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa
+Content-Type: text/plain
+Entry-Name: .description
+
+Copyright (c) 2009, 2014 Xored Software Inc 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:
+ Xored Software Inc - initial creation and/or initial documentation
+--------------------------------------------------------------------------------
+
+TEST STEPS:
+
+1. Execute command "delete-file"
+2. Make sure that file is deleted
+------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa--
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac
+Content-Type: text/ecl
+Entry-Name: .content
+
+get-file "workspace:/FilesForContextEditor/text.txt" | delete-file
+
+get-view "Test Explorer" | get-tree | get-item FilesForContextEditor | get-property childCount | equals 2 | verify-true
+get-view "Test Explorer" | get-tree | select FilesForContextEditor | get-menu Refresh | click
+get-view "Test Explorer" | get-tree | get-item FilesForContextEditor | get-property childCount | equals 1 | verify-true
+
+with [get-view "Test Explorer" | get-tree] {
+ get-item "FilesForContextEditor/folder" | get-property caption | equals folder | verify-true
+ verify-error {
+ get-item "FilesForContextEditor/text.txt"
+ }
+}
+
+verify-error {
+ get-file "workspace:/FilesForContextEditor/text.txt" | delete-file
+}
+
+------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac--