mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 04:45:38 +02:00
[234215] [apidoc] Improve API Docs of ISystemViewElementAdapter#doDelete*
https://bugs.eclipse.org/bugs/show_bug.cgi?id=234215
This commit is contained in:
parent
2510538058
commit
ba701b5ac4
3 changed files with 83 additions and 44 deletions
|
@ -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<set.size();i++)
|
||||
{
|
||||
|
@ -1679,7 +1680,7 @@ public class SystemViewRemoteFileAdapter
|
|||
flatSet.addResource(remoteFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
//SystemWorkspaceResourceSet flatResult = UniversalFileTransferUtility.copyRemoteResourcesToWorkspace(flatSet, monitor);
|
||||
|
@ -2158,9 +2159,9 @@ public class SystemViewRemoteFileAdapter
|
|||
String originalName = srcFileOrFolder.getName();
|
||||
int count = 1;
|
||||
boolean go = true;
|
||||
|
||||
|
||||
// same systemfor
|
||||
if (sameSystem)
|
||||
if (sameSystem)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -2169,7 +2170,7 @@ public class SystemViewRemoteFileAdapter
|
|||
//Handle resources being copied to their parent folder. Name = "Copy of " + name
|
||||
if(targetFolder.getAbsolutePath().equals(srcFileOrFolder.getParentRemoteFile().getAbsolutePath()))
|
||||
{
|
||||
name = MessageFormat.format(FileResources.RESID_CONFLICT_COPY_PATTERN, new Object[] {
|
||||
name = MessageFormat.format(FileResources.RESID_CONFLICT_COPY_PATTERN, new Object[] {
|
||||
new Integer(count), originalName });
|
||||
while(go)
|
||||
{
|
||||
|
@ -2177,7 +2178,7 @@ public class SystemViewRemoteFileAdapter
|
|||
if (existingFileOrFolder.exists())
|
||||
{
|
||||
count++;
|
||||
name = MessageFormat.format(FileResources.RESID_CONFLICT_COPY_PATTERN, new Object[] {
|
||||
name = MessageFormat.format(FileResources.RESID_CONFLICT_COPY_PATTERN, new Object[] {
|
||||
new Integer(count), originalName });
|
||||
}
|
||||
else
|
||||
|
@ -2200,7 +2201,7 @@ public class SystemViewRemoteFileAdapter
|
|||
*/
|
||||
existing.add(existingFileOrFolder);
|
||||
}
|
||||
|
||||
|
||||
if (name != null)
|
||||
{
|
||||
toCopy.add(srcFileOrFolder);
|
||||
|
@ -2232,12 +2233,12 @@ public class SystemViewRemoteFileAdapter
|
|||
Display.getDefault().syncExec(rr);
|
||||
overwrite = rr.getOk();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Following code used originally with the rename dialog which no longer exists
|
||||
//Resources will be copied with same names if an overwrite is desired from the user
|
||||
//Resources that are copied to their parent will be renamed to "Copy of " + name of source
|
||||
//Resources that are copied to their parent will be renamed to "Copy of " + name of source
|
||||
if(existing.size()==0 || overwrite)
|
||||
{
|
||||
for (int x = 0; x < toCopy.size(); x++)
|
||||
|
@ -2587,7 +2588,7 @@ public class SystemViewRemoteFileAdapter
|
|||
}
|
||||
else
|
||||
{
|
||||
// Not sure how we can get here since if the source and target subsystems are different, then a doDrag() needs to
|
||||
// Not sure how we can get here since if the source and target subsystems are different, then a doDrag() needs to
|
||||
// occur, resulting in a local resource (i.e. IFile) rather than a remote resource (i.e. IRemoteFile).
|
||||
// TODO investigate to see if we can get rid of this code
|
||||
if (srcFileOrFolder.isFile())
|
||||
|
@ -2615,7 +2616,7 @@ public class SystemViewRemoteFileAdapter
|
|||
String newPath = newPathBuf.toString();
|
||||
|
||||
monitor.subTask(copyMessage.getLevelOneText());
|
||||
|
||||
|
||||
targetFS.upload(srcFileOrFolder.getAbsolutePath(), SystemEncodingUtil.ENCODING_UTF_8, newPath, System.getProperty("file.encoding"), monitor); //$NON-NLS-1$
|
||||
|
||||
result = targetFS.getRemoteFileObject(targetFolder, name, monitor);
|
||||
|
@ -2731,7 +2732,9 @@ public class SystemViewRemoteFileAdapter
|
|||
|
||||
|
||||
/**
|
||||
* Perform the delete action. Defers request to the remote file subsystem
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
* 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}
|
||||
* <p>
|
||||
* 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)
|
||||
{
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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}
|
||||
* <p>
|
||||
* 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 <code>false</code> or
|
||||
* throw a {@link SystemOperationCancelledException}.
|
||||
* <p>
|
||||
* <i><b>Overridable</b> by subclasses, and usually is.</i> <br>
|
||||
*
|
||||
|
@ -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}
|
||||
* <p>
|
||||
* 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.
|
||||
* <p>
|
||||
* In case of cancellation, either return <code>false</code> or throw a
|
||||
* {@link SystemOperationCancelledException}.
|
||||
* <p>
|
||||
* <i><b>Overridable</b> by subclasses, and usually is.</i> <br>
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
* <p>
|
||||
* Implementers have two choices of dealing with error conditions:
|
||||
* handle the error themselves (for example, by showing an error dialog) and returning
|
||||
* <code>false</code>; or by throwing an Exception and having the framework
|
||||
* handle the error.
|
||||
* <p>
|
||||
* If the operation is cancelled, the implementation is free to either
|
||||
* return <code>false</code> 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 <code>null</code>.
|
||||
* @return <code>true</code> indicates that the deletion succeeded, <code>false</code> 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
|
||||
* <code>null</code>.
|
||||
* @return <code>true</code> indicates that the deletion succeeded,
|
||||
* <code>false</code> 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.
|
||||
* <p>
|
||||
* 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 <code>null</code>.
|
||||
* @return <code>true</code> if all deletions were successful, <code>false</code> 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
|
||||
* <code>null</code>.
|
||||
* @return <code>true</code> if all deletions were successful,
|
||||
* <code>false</code> 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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue