Class ImportOperation
- java.lang.Object
-
- org.eclipse.ui.actions.WorkspaceModifyOperation
-
- org.eclipse.ui.wizards.datatransfer.ImportOperation
-
- All Implemented Interfaces:
IRunnableWithProgress,IThreadListener
public class ImportOperation extends WorkspaceModifyOperation
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.
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
Fields Modifier and Type Field Description protected IOverwriteQueryoverwriteCallback
-
Constructor Summary
Constructors Constructor Description 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.ImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport)Creates a new operation that imports specific file system objects.ImportOperation(IPath containerPath, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport)Creates a new operation that imports specific file system objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidexecute(IProgressMonitor progressMonitor)Performs the steps that are to be treated as a single logical workspace change.IStatusgetStatus()Returns the status of the import operation.voidsetContext(Shell shell)Sets the context for use by the VCM provider to prompt the user for check-out of files.voidsetCreateContainerStructure(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.voidsetCreateLinks(boolean links)Set Whether links will be created instead of files and foldersvoidsetFilesToImport(List filesToImport)Sets the file system objects to import.voidsetOverwriteResources(boolean value)Sets whether imported file system objects should automatically overwrite existing workbench resources when a conflict occurs.voidsetRelativeVariable(String variable)Set a variable relative to which the links are createdvoidsetVirtualFolders(boolean virtualFolders)Set Whether groups and links will be created instead of files and folders-
Methods inherited from class org.eclipse.ui.actions.WorkspaceModifyOperation
getRule, run, threadChange
-
-
-
-
Field Detail
-
overwriteCallback
protected IOverwriteQuery overwriteCallback
-
-
Constructor Detail
-
ImportOperation
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
sourceparameter represents the root file system object to import. All contents of this object are imported. Valid types for this parameter are determined by the suppliedIImportStructureProvider.The
providerparameter 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
setCreateContainerStructureis 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 the workspacesource- the root file system object to importprovider- the file system structure provider to useoverwriteImplementor- the overwrite strategy to use
-
ImportOperation
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
sourceparameter represents the root file system object to import. Valid types for this parameter are determined by the suppliedIImportStructureProvider. The contents of the source which are to be imported are specified in thefilesToImportparameter.The
providerparameter 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
filesToImportparameter 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
setCreateContainerStructureis set tofalse, 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 the workspacesource- the root file system object to import fromprovider- the file system structure provider to useoverwriteImplementor- the overwrite strategy to usefilesToImport- the list of file system objects to be imported (element type:Object)
-
ImportOperation
public ImportOperation(IPath containerPath, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport)
Creates a new operation that imports specific file system objects.The
providerparameter 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
filesToImportparameter 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
setCreateContainerStructureis set tofalse, then no container structure is created for each of the file system objects.- Parameters:
containerPath- the full path of the destination container within the workspaceprovider- the file system structure provider to useoverwriteImplementor- the overwrite strategy to usefilesToImport- the list of file system objects to be imported (element type:Object)
-
-
Method Detail
-
execute
protected void execute(IProgressMonitor progressMonitor)
Description copied from class:WorkspaceModifyOperationPerforms the steps that are to be treated as a single logical workspace change.Subclasses must implement this method.
- Specified by:
executein classWorkspaceModifyOperation- Parameters:
progressMonitor- the progress monitor to use to display progress and field user requests to cancel
-
getStatus
public IStatus getStatus()
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 codeOK.- Returns:
- the status
-
setContext
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 user for check-out. The user will not be prompted if set tonull.- Since:
- 2.1
- See Also:
IWorkspace.validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
-
setCreateContainerStructure
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.- Parameters:
value-trueif containers should be created, andfalseotherwise
-
setFilesToImport
public void setFilesToImport(List filesToImport)
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)
Sets whether imported file system objects should automatically overwrite existing workbench resources when a conflict occurs.- Parameters:
value-trueto automatically overwrite, andfalseotherwise
-
setVirtualFolders
public void setVirtualFolders(boolean virtualFolders)
Set Whether groups and links will be created instead of files and folders- Parameters:
virtualFolders-- Since:
- 3.6
-
setCreateLinks
public void setCreateLinks(boolean links)
Set Whether links will be created instead of files and folders- Parameters:
links-- Since:
- 3.6
-
setRelativeVariable
public void setRelativeVariable(String variable)
Set a variable relative to which the links are created- Parameters:
variable-- Since:
- 3.6
-
-