public class CopyFilesAndFoldersOperation extends Object
This class may be instantiated; it is not intended to be subclassed.
Constructor and Description |
---|
CopyFilesAndFoldersOperation(Shell shell)
Creates a new operation initialized with a shell.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canPerformAutoRename()
Returns whether this operation is able to perform on-the-fly
auto-renaming of resources with name collisions.
|
protected void |
copy(IResource[] resources,
IPath destination,
IProgressMonitor subMonitor)
Copies the resources to the given destination.
|
void |
copyFiles(String[] fileNames,
IContainer destination)
Copies the given files and folders to the destination.
|
void |
copyFiles(URI[] uris,
IContainer destination)
Copies the given URIS and folders to the destination.
|
void |
copyFilesInCurrentThread(String[] fileNames,
IContainer destination,
IProgressMonitor monitor)
Copies the given files and folders to the destination without forking a
new Thread or blocking using a WorkspaceModifyOperation.
|
void |
copyFilesInCurrentThread(URI[] uris,
IContainer destination,
IProgressMonitor monitor)
Copies the given files and folders to the destination without forking a
new Thread or blocking using a WorkspaceModifyOperation.
|
IResource[] |
copyResources(IResource[] resources,
IContainer destination)
Copies the given resources to the destination.
|
IResource[] |
copyResourcesInCurrentThread(IResource[] resources,
IContainer destination,
IProgressMonitor monitor)
Copies the given resources to the destination in the current Thread
without forking a new Thread or blocking using a
WorkspaceModifyOperation.
|
protected String |
getDeepCheckQuestion(IResource source)
Returns the message for querying deep copy/move of a linked resource.
|
protected IFile |
getFile(IResource resource)
Returns the resource either casted to or adapted to an IFile.
|
protected File[] |
getFiles(String[] fileNames)
Deprecated.
This method is not longer in use anywhere in this class and
is only provided for backwards compatability with subclasses
of the receiver.
|
protected IFolder |
getFolder(IResource resource)
Returns the resource either casted to or adapted to an IFolder.
|
String[] |
getModelProviderIds()
Returns the model provider ids that are known to the client that
instantiated this operation.
|
protected String |
getOperationTitle()
Returns the task title for this operation's progress dialog.
|
protected String |
getProblemsMessage()
Returns the message for this operation's problems dialog.
|
protected String |
getProblemsTitle()
Returns the title for this operation's problems dialog.
|
protected boolean |
getValidateConflictSource()
Returns whether the source file in a destination collision will be
validateEdited together with the collision itself.
|
protected boolean |
homogenousResources(IResource source,
IResource destination)
Returns whether the given resources are either both linked or both
unlinked.
|
protected boolean |
isMove()
Return whether the operation is a move or a copy
|
void |
setModelProviderIds(String[] modelProviderIds)
Sets the model provider ids that are known to the client that
instantiated this operation.
|
String |
validateDestination(IContainer destination,
IResource[] sourceResources)
Checks whether the destination is valid for copying the source resources.
|
String |
validateImportDestination(IContainer destination,
String[] sourceNames)
Checks whether the destination is valid for copying the source files.
|
public CopyFilesAndFoldersOperation(Shell shell)
shell
- parent shell for error dialogsprotected boolean canPerformAutoRename()
true
if auto-rename is supported, and
false
otherwiseprotected String getDeepCheckQuestion(IResource source)
source
- resource the query is made forprotected void copy(IResource[] resources, IPath destination, IProgressMonitor subMonitor) throws CoreException
resources
- the resources to copydestination
- destination to which resources will be copiedsubMonitor
- a progress monitor for showing progress and for cancelationCoreException
public IResource[] copyResources(IResource[] resources, IContainer destination)
resources
- the resources to copydestination
- destination to which resources will be copiedIResource
[]WorkspaceModifyOperation
,
Display.getThread()
,
Thread.currentThread()
public IResource[] copyResourcesInCurrentThread(IResource[] resources, IContainer destination, IProgressMonitor monitor)
WorkspaceJob
to avoid possible deadlock.resources
- the resources to copydestination
- destination to which resources will be copiedmonitor
- the monitor that information will be sent to.IResource
[]WorkspaceModifyOperation
,
WorkspaceJob
protected boolean isMove()
public void copyFiles(URI[] uris, IContainer destination)
uris
- the URIs to copydestination
- destination to which files will be copiedWorkspaceModifyOperation
,
Display.getThread()
,
Thread.currentThread()
public void copyFilesInCurrentThread(URI[] uris, IContainer destination, IProgressMonitor monitor)
WorkspaceJob
to avoid possible deadlock.uris
- the URIs to copydestination
- destination to which URIS will be copiedmonitor
- the monitor that information will be sent to.WorkspaceModifyOperation
,
WorkspaceJob
public void copyFiles(String[] fileNames, IContainer destination)
fileNames
- names of the files to copydestination
- destination to which files will be copiedWorkspaceModifyOperation
,
Display.getThread()
,
Thread.currentThread()
public void copyFilesInCurrentThread(String[] fileNames, IContainer destination, IProgressMonitor monitor)
WorkspaceJob
to avoid possible deadlock.fileNames
- names of the files to copydestination
- destination to which files will be copiedmonitor
- the monitor that information will be sent to.WorkspaceModifyOperation
,
WorkspaceJob
protected IFile getFile(IResource resource)
resource
- resource to cast/adaptnull
if the resource does not adapt to IFileprotected File[] getFiles(String[] fileNames)
fileNames
- files to return File object for.protected IFolder getFolder(IResource resource)
resource
- resource to cast/adaptnull
if the resource does not adapt to IFolderprotected String getOperationTitle()
protected String getProblemsMessage()
protected String getProblemsTitle()
protected boolean getValidateConflictSource()
true
if the source file in a destination
collision should be validateEdited. false
if only
the destination should be validated.protected boolean homogenousResources(IResource source, IResource destination)
source
- source resourcedestination
- destination resourcetrue
if both resources are either linked
or unlinked. false
otherwise.public String validateDestination(IContainer destination, IResource[] sourceResources)
Note this method is for internal use only. It is not API.
destination
- the destination containersourceResources
- the source resourcesnull
if the path is validpublic String validateImportDestination(IContainer destination, String[] sourceNames)
Note this method is for internal use only. It is not API.
destination
- the destination containersourceNames
- the source file namesnull
if the path is validpublic String[] getModelProviderIds()
public void setModelProviderIds(String[] modelProviderIds)
modelProviderIds
- the model providers known to the client who is using this
operation.Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.