| java.lang.Object org.eclipse.ui.actions.WorkspaceModifyOperation org.eclipse.ui.wizards.datatransfer.ImportOperation
ImportOperation | public class ImportOperation extends WorkspaceModifyOperation (Code) | | An operation which does the actual work of copying objects from the local file
system into the workspace.
This class may be instantiated; it is not intended to be subclassed.
|
Constructor Summary | |
public | ImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor) Creates a new operation that recursively imports the entire contents of the
specified root file system object.
The source parameter represents the root file system object to
import. | public | ImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport) Creates a new operation that imports specific file system objects.
In this usage context, the specified source file system object is used by the
operation solely to determine the destination container structure of the file system
objects being imported.
The source parameter represents the root file system object to
import. | public | ImportOperation(IPath containerPath, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport) Creates a new operation that imports specific file system objects.
The provider parameter allows this operation to deal with the
source object in an abstract way. |
Method Summary | |
void | collectExistingReadonlyFiles(IPath sourceStart, List sources, ArrayList noOverwrite, ArrayList overwriteReadonly, int policy) Prompts if existing resources should be overwritten. | IContainer | createContainersFor(IPath path) Creates the folders that appear in the specified resource path. | void | deleteResource(IResource resource) Deletes the given resource. | protected void | execute(IProgressMonitor progressMonitor) | IContainer | getDestinationContainerFor(Object fileSystemObject) Returns the container resource that the passed file system object should be
imported into. | IFile | getFile(IResource resource) Returns the resource either casted to or adapted to an IFile. | IFolder | getFolder(IResource resource) Returns the resource either casted to or adapted to an IFolder. | ArrayList | getRejectedFiles(IStatus multiStatus, IFile[] files) Returns the rejected files based on the given multi status.
Parameters: multiStatus - multi status to use to determine file rejection Parameters: files - source files list of rejected files as absolute paths. | public IStatus | getStatus() Returns the status of the import operation. | void | importFile(Object fileObject, int policy) Imports the specified file system object into the workspace. | void | importFileSystemObjects(List filesToImport) Imports the specified file system objects into the workspace. | int | importFolder(Object folderObject, int policy) Imports the specified file system container object into the workspace. | void | importRecursivelyFrom(Object fileSystemObject, int policy) Imports the specified file system object recursively into the workspace. | boolean | queryOverwrite(IPath resourcePath) Queries the user whether the resource with the specified path should be
overwritten by a file system object that is being imported. | boolean | queryOverwriteFile(IFile targetFile, int policy) Returns whether the given file should be overwritten. | public void | setContext(Shell shell) Sets the context for use by the VCM provider to prompt the user
for check-out of files.
Parameters: shell - context for use by the VCM provider to prompt userfor check-out. | public void | setCreateContainerStructure(boolean value) Sets whether the containment structures that are implied from the full paths
of file system objects being imported should be duplicated in the workbench. | public void | setFilesToImport(List filesToImport) Sets the file system objects to import. | public void | setOverwriteResources(boolean value) Sets whether imported file system objects should automatically overwrite
existing workbench resources when a conflict occurs. | ArrayList | validateEdit(List existingFiles) Validates that the given source resources can be copied to the
destination as decided by the VCM provider.
Parameters: existingFiles - existing files to validate list of rejected files as absolute paths. | void | validateFiles(List sourceFiles) Validates the given file system objects. |
overwriteCallback | protected IOverwriteQuery overwriteCallback(Code) | | |
ImportOperation | public ImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor)(Code) | | Creates a new operation that recursively imports the entire contents of the
specified root file system object.
The source parameter represents the root file system object to
import. All contents of this object are imported. Valid types for this parameter
are determined by the supplied IImportStructureProvider .
The provider parameter allows this operation to deal with the
source object in an abstract way. This operation calls methods on the provider
and the provider in turn calls specific methods on the source object.
The default import behavior is to recreate the complete container structure
for the contents of the root file system object in their destination.
If setCreateContainerStructure is set to false then the container
structure created is relative to the root file system object.
Parameters: containerPath - the full path of the destination container within theworkspace Parameters: source - the root file system object to import Parameters: provider - the file system structure provider to use Parameters: overwriteImplementor - the overwrite strategy to use |
ImportOperation | public ImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport)(Code) | | Creates a new operation that imports specific file system objects.
In this usage context, the specified source file system object is used by the
operation solely to determine the destination container structure of the file system
objects being imported.
The source parameter represents the root file system object to
import. Valid types for this parameter are determined by the supplied
IImportStructureProvider . The contents of the source which
are to be imported are specified in the filesToImport
parameter.
The provider parameter allows this operation to deal with the
source object in an abstract way. This operation calls methods on the provider
and the provider in turn calls specific methods on the source object.
The filesToImport parameter specifies what contents of the root
file system object are to be imported.
The default import behavior is to recreate the complete container structure
for the file system objects in their destination. If setCreateContainerStructure
is set to false , then the container structure created for each of
the file system objects is relative to the supplied root file system object.
Parameters: containerPath - the full path of the destination container within theworkspace Parameters: source - the root file system object to import from Parameters: provider - the file system structure provider to use Parameters: overwriteImplementor - the overwrite strategy to use Parameters: filesToImport - the list of file system objects to be imported(element type: Object ) |
ImportOperation | public ImportOperation(IPath containerPath, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport)(Code) | | Creates a new operation that imports specific file system objects.
The provider parameter allows this operation to deal with the
source object in an abstract way. This operation calls methods on the provider
and the provider in turn calls specific methods on the source object.
The filesToImport parameter specifies what file system objects
are to be imported.
The default import behavior is to recreate the complete container structure
for the file system objects in their destination. If setCreateContainerStructure
is set to false , then no container structure is created for each of
the file system objects.
Parameters: containerPath - the full path of the destination container within theworkspace Parameters: provider - the file system structure provider to use Parameters: overwriteImplementor - the overwrite strategy to use Parameters: filesToImport - the list of file system objects to be imported(element type: Object ) |
collectExistingReadonlyFiles | void collectExistingReadonlyFiles(IPath sourceStart, List sources, ArrayList noOverwrite, ArrayList overwriteReadonly, int policy)(Code) | | Prompts if existing resources should be overwritten. Recursively collects
existing read-only files to overwrite and resources that should not be
overwritten.
Parameters: sourceStart - destination path to check for existing files Parameters: sources - file system objects that may exist in the destination Parameters: noOverwrite - files that were selected to be skipped (don't overwrite).object type IPath Parameters: overwriteReadonly - the collected existing read-only files to overwrite.object type IPath Parameters: policy - on of the POLICY constants defined in theclass. |
createContainersFor | IContainer createContainersFor(IPath path) throws CoreException(Code) | | Creates the folders that appear in the specified resource path.
These folders are created relative to the destination container.
Parameters: path - the relative path of the resource the container resource coresponding to the given path exception: CoreException - if this method failed |
deleteResource | void deleteResource(IResource resource)(Code) | | Deletes the given resource. If the resource fails to be deleted, adds a
status object to the list to be returned by getResult .
Parameters: resource - the resource |
execute | protected void execute(IProgressMonitor progressMonitor)(Code) | | |
getDestinationContainerFor | IContainer getDestinationContainerFor(Object fileSystemObject) throws CoreException(Code) | | Returns the container resource that the passed file system object should be
imported into.
Parameters: fileSystemObject - the file system object being imported the container resource that the passed file system object should beimported into exception: CoreException - if this method failed |
getFile | IFile getFile(IResource resource)(Code) | | Returns the resource either casted to or adapted to an IFile.
Parameters: resource - resource to cast/adapt the resource either casted to or adapted to an IFile.null if the resource does not adapt to IFile |
getFolder | IFolder getFolder(IResource resource)(Code) | | Returns the resource either casted to or adapted to an IFolder.
Parameters: resource - resource to cast/adapt the resource either casted to or adapted to an IFolder.null if the resource does not adapt to IFolder |
getRejectedFiles | ArrayList getRejectedFiles(IStatus multiStatus, IFile[] files)(Code) | | Returns the rejected files based on the given multi status.
Parameters: multiStatus - multi status to use to determine file rejection Parameters: files - source files list of rejected files as absolute paths. Object type IPath. |
getStatus | public IStatus getStatus()(Code) | | Returns the status of the import operation.
If there were any errors, the result is a status object containing
individual status objects for each error.
If there were no errors, the result is a status object with error code OK .
the status |
importFile | void importFile(Object fileObject, int policy)(Code) | | Imports the specified file system object into the workspace.
If the import fails, adds a status object to the list to be returned by
getResult .
Parameters: fileObject - the file system object to be imported Parameters: policy - determines how the file object is imported |
importFileSystemObjects | void importFileSystemObjects(List filesToImport)(Code) | | Imports the specified file system objects into the workspace.
If the import fails, adds a status object to the list to be returned by
getStatus .
Parameters: filesToImport - the list of file system objects to import(element type: Object ) exception: OperationCanceledException - if canceled |
importFolder | int importFolder(Object folderObject, int policy)(Code) | | Imports the specified file system container object into the workspace.
If the import fails, adds a status object to the list to be returned by
getResult .
Parameters: folderObject - the file system container object to be imported Parameters: policy - determines how the folder object and children are imported the policy to use to import the folder's children |
importRecursivelyFrom | void importRecursivelyFrom(Object fileSystemObject, int policy)(Code) | | Imports the specified file system object recursively into the workspace.
If the import fails, adds a status object to the list to be returned by
getStatus .
Parameters: fileSystemObject - the file system object to be imported Parameters: policy - determines how the file system object and children are imported exception: OperationCanceledException - if canceled |
queryOverwrite | boolean queryOverwrite(IPath resourcePath) throws OperationCanceledException(Code) | | Queries the user whether the resource with the specified path should be
overwritten by a file system object that is being imported.
Parameters: resourcePath - the workspace path of the resource that needs to be overwritten true to overwrite, false to not overwrite exception: OperationCanceledException - if canceled |
queryOverwriteFile | boolean queryOverwriteFile(IFile targetFile, int policy)(Code) | | Returns whether the given file should be overwritten.
Parameters: targetFile - the file to ask to overwrite Parameters: policy - determines if the user is queried for overwrite true if the file should be overwritten, andfalse if not. |
setContext | public void setContext(Shell shell)(Code) | | Sets the context for use by the VCM provider to prompt the user
for check-out of files.
Parameters: shell - context for use by the VCM provider to prompt userfor check-out. The user will not be prompted if set to null . See Also: IWorkspace.validateEdit(org.eclipse.core.resources.IFile[]java.lang.Object) since: 2.1 |
setCreateContainerStructure | public void setCreateContainerStructure(boolean value)(Code) | | Sets whether the containment structures that are implied from the full paths
of file system objects being imported should be duplicated in the workbench.
Parameters: value - true if containers should be created, andfalse otherwise |
setFilesToImport | public void setFilesToImport(List filesToImport)(Code) | | Sets the file system objects to import.
Parameters: filesToImport - the list of file system objects to be imported(element type: Object ) |
setOverwriteResources | public void setOverwriteResources(boolean value)(Code) | | Sets whether imported file system objects should automatically overwrite
existing workbench resources when a conflict occurs.
Parameters: value - true to automatically overwrite, and false otherwise |
validateEdit | ArrayList validateEdit(List existingFiles)(Code) | | Validates that the given source resources can be copied to the
destination as decided by the VCM provider.
Parameters: existingFiles - existing files to validate list of rejected files as absolute paths. Object type IPath. |
validateFiles | void validateFiles(List sourceFiles)(Code) | | Validates the given file system objects.
The user is prompted to overwrite existing files.
Existing read-only files are validated with the VCM provider.
Parameters: sourceFiles - files to validate |
|
|