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 monitor)
Deprecated.
As of 3.3, the work is performed in the undoable operation
created in
getUndoableCopyOrMoveOperation(IResource[], IPath) |
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.
|
void |
copyOrLinkFiles(String[] fileNames,
IContainer destination,
int dropOperation)
Depending on the 'Linked Resources' preferences it copies the given files and folders to the
destination or creates links or shows a dialog that lets the user choose.
|
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.
|
void |
createVirtualFoldersAndLinks(String[] fileNames,
IContainer destination)
Create virtual folders and links of the given files and folders to the
destination.
|
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.
As of 3.3, this method is no 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 AbstractWorkspaceOperation |
getUndoableCopyOrMoveOperation(IResource[] resources,
IPath destinationPath)
Returns an AbstractWorkspaceOperation suitable for performing the move or
copy operation that will move or copy the given resources to the given
destination path.
|
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 |
linkFiles(String[] fileNames,
IContainer destination)
Create links of the given files and folders to the destination.
|
void |
setCreateLinks(boolean value)
Set whether or not links will be created under the destination container.
|
void |
setModelProviderIds(String[] modelProviderIds)
Sets the model provider ids that are known to the client that
instantiated this operation.
|
void |
setRelativeVariable(String variable)
Set a variable relative to which the links are created
|
void |
setVirtualFolders(boolean value)
Set whether or not virtual folders and links will be created under the destination
container.
|
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 for@Deprecated protected void copy(IResource[] resources, IPath destination, IProgressMonitor monitor) throws CoreException
getUndoableCopyOrMoveOperation(IResource[], IPath)
resources
- the resources to copydestination
- destination to which resources will be copiedmonitor
- 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 copiedWorkspaceModifyOperation
,
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 copyOrLinkFiles(String[] fileNames, IContainer destination, int dropOperation)
WorkspaceModifyOperation
. This
method should be called from the UI Thread.fileNames
- names of the files to copydestination
- destination to which files will be copieddropOperation
- the drop operation (DND.DROP_NONE
, DND.DROP_MOVE
DND.DROP_COPY
, DND.DROP_LINK
, DND.DROP_DEFAULT
)WorkspaceModifyOperation
,
Display.getThread()
,
Thread.currentThread()
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 IFile@Deprecated protected 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.public void createVirtualFoldersAndLinks(String[] fileNames, IContainer destination)
fileNames
- names of the files to copydestination
- destination to which files will be copiedWorkspaceModifyOperation
,
Display.getThread()
,
Thread.currentThread()
public void linkFiles(String[] fileNames, IContainer destination)
fileNames
- names of the files to copydestination
- destination to which files will be copiedWorkspaceModifyOperation
,
Display.getThread()
,
Thread.currentThread()
public void setVirtualFolders(boolean value)
value
- public void setCreateLinks(boolean value)
value
- public void setRelativeVariable(String variable)
variable
- protected AbstractWorkspaceOperation getUndoableCopyOrMoveOperation(IResource[] resources, IPath destinationPath)
resources
- the resources to be moved or copieddestinationPath
- the destination path to which the resources should be moved
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.