diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java index 79005c668da..59c56a0da0c 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java @@ -51,11 +51,12 @@ * Rupen Mardirossian (IBM) - [210682] Copy collisions will use SystemCopyDialog now instead of renameDialog when there is a copy collision within the same connection * David McKnight (IBM) - [224377] "open with" menu does not have "other" option * David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE - * Rupen Mardirossian (IBM) - [198728] Folder being copied across systems is added to original set of files in order to extract empty (sub)folders in doDrop method + * Rupen Mardirossian (IBM) - [198728] Folder being copied across systems is added to original set of files in order to extract empty (sub)folders in doDrop method * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding * Rupen Mardirossian (IBM) - [227213] Copy and pasting to the parent folder will create a "Copy of" that resource * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService * Anna Dushistova (MontaVista) - [226550] [api] Launch Shell and Launch Terminal actions should be contributed declaratively + * Martin Oberhuber (Wind River) - [234215] improve API documentation for doDelete and doDeleteBatch *******************************************************************************/ package org.eclipse.rse.internal.files.ui.view; @@ -1668,7 +1669,7 @@ public class SystemViewRemoteFileAdapter monitor.beginTask(_downloadMessage, (int)totalByteSize); //monitor.done(); } - + //add folders to set that are being copied to the workspace in order to strip out empty folders in UniversalFileTransferUtility for (int i=0;i + * Defers request to the remote file subsystem. */ public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception { @@ -2802,7 +2805,9 @@ public class SystemViewRemoteFileAdapter } /** - * Perform the delete action. Defers request to the remote file subsystem + * {@inheritDoc} + *

+ * Defers request to the remote file subsystem */ public boolean doDeleteBatch(Shell shell, List resourceSet, IProgressMonitor monitor) throws Exception { @@ -3316,7 +3321,7 @@ public class SystemViewRemoteFileAdapter remoteFile = subsystem.getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor()); } catch (Exception e) - { + { } } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java index cd5e655638d..e1fcfada78e 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java @@ -24,6 +24,7 @@ * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core * David McKnight (IBM) - [208803] add exists() method * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread + * Martin Oberhuber (Wind River) - [234215] improve API documentation for doDelete and doDeleteBatch *******************************************************************************/ package org.eclipse.rse.ui.view; @@ -64,6 +65,7 @@ import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.view.ISystemMementoConstants; import org.eclipse.rse.internal.ui.view.SystemViewPart; import org.eclipse.rse.internal.ui.view.SystemViewResources; +import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException; import org.eclipse.rse.ui.ISystemMessages; import org.eclipse.rse.ui.ISystemPreferencesConstants; import org.eclipse.rse.ui.RSEUIPlugin; @@ -1079,10 +1081,13 @@ public abstract class AbstractSystemViewAdapter implements ISystemViewElementAda } /** - * Perform the delete action. By default does nothing. Override if your - * object is deletable. Return true if this was successful. Return false if - * it failed and you issued a message. Throw an exception if it failed and - * you want to use the generic message. + * {@inheritDoc} + *

+ * By default does nothing. Override if your object is deletable. Return + * true if this was successful. Return false if it failed and you issued a + * message. Throw an exception if it failed and you want to use the generic + * message. In case of cancellation, either return false or + * throw a {@link SystemOperationCancelledException}. *

* Overridable by subclasses, and usually is.
* @@ -1095,11 +1100,16 @@ public abstract class AbstractSystemViewAdapter implements ISystemViewElementAda } /** - * Perform the delete action. By default just calls the doDelete method for - * each item in the resourceSet. Override if you wish to perform some sort - * of optimization for the batch delete. Return true if this was successful. - * Return false if ANY delete op failed and a message was issued. Throw an - * exception if ANY failed and you want to use the generic message. + * {@inheritDoc} + *

+ * By default just calls the doDelete method for each item in the + * resourceSet. Override if you wish to perform some sort of optimization + * for the batch delete. Return true if this was successful. Return false if + * ANY delete operation failed and a message was issued. Throw an exception + * if ANY failed and you want to use the generic message. + *

+ * In case of cancellation, either return false or throw a + * {@link SystemOperationCancelledException}. *

* Overridable by subclasses, and usually is.
*/ diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java index 8bcdba38617..a11ee2862d3 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java @@ -32,8 +32,8 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.rse.core.model.ISystemViewInputProvider; import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter; -import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; +import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException; import org.eclipse.rse.ui.ISystemContextMenuConstants; import org.eclipse.rse.ui.SystemMenuManager; import org.eclipse.rse.ui.validators.ISystemValidator; @@ -313,16 +313,31 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD /** - * Perform the delete action on single item. - * Implement if the object is deletable. - * If the operation is cancelled, the progress monitor will indicate this and a - * {@link SystemMessageException} with a message id of {@link ICommonMessageIds#MSG_OPERATION_CANCELLED} - * should be thrown if the generic message is desired. - * @param shell The shell that can act as a parent for an adapter-issued message dialog. + * Perform the delete action on single item. Implement if the object is + * deletable. + *

+ * Implementers have two choices of dealing with error conditions: + * handle the error themselves (for example, by showing an error dialog) and returning + * false; or by throwing an Exception and having the framework + * handle the error. + *

+ * If the operation is cancelled, the implementation is free to either + * return false or throw a + * {@link SystemOperationCancelledException}, since in both cases the + * framework will refresh the element to see whether it has + * actually been deleted or not, but not show any other message. + * + * @param shell The shell that can act as a parent for an adapter-issued + * message dialog. * @param element The element that should be deleted. - * @param monitor The progress monitor for progress and cancellation. May be null. - * @return true indicates that the deletion succeeded, false indicates that the deletion failed and that a message dialog has been shown. - * @throws Exception if the deletion failed and the adapter did not show a message dialog. + * @param monitor The progress monitor for progress and cancellation. May be + * null. + * @return true indicates that the deletion succeeded, + * false indicates that the deletion failed but no user + * feedback is required by the framework because the implementation + * has already handled the error or cancellation. + * @throws Exception if the deletion failed and the adapter did not show a + * message dialog. * @see #showDelete(Object) * @see #canDelete(Object) */ @@ -330,15 +345,24 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD /** * Perform the delete on the given set of items. - * If the operation is cancelled, the progress monitor will indicate this and a - * {@link SystemMessageException} with a message id of {@link ICommonMessageIds#MSG_OPERATION_CANCELLED} - * should be thrown if the generic message is desired. - * @param shell the shell that can act as a parent for an adapter-issued message dialog. + *

+ * See {@link #doDelete(Shell, Object, IProgressMonitor)} for semantics of + * error handling and cancellation. + * + * @param shell the shell that can act as a parent for an adapter-issued + * message dialog. * @param resourceSet a list of resources that should be deleted. - * @param monitor The progress monitor for progress and cancellation. May be null. - * @return true if all deletions were successful, false if any deletion was not successful and that a message dialog has been shown. - * @throws Exception if any deletion was not successful and the adapter did not show a message dialog. - * If this is a {@link SystemMessageException} then the caller should examine the results and fire any necessary events. + * @param monitor The progress monitor for progress and cancellation. May be + * null. + * @return true if all deletions were successful, + * false if any deletion was not successful but proper + * error reporting has been done by the adapter already. The + * framework will only refresh the items to see which ones have + * actually been deleted. + * @throws Exception if any deletion was not successful and the adapter did + * not perform any error reporting. If this is a + * {@link SystemMessageException} then the caller should examine + * the results and fire any necessary events. */ public boolean doDeleteBatch(Shell shell, List resourceSet, IProgressMonitor monitor) throws Exception;