/** * Return a list of all files in the project * * @param files * @param provider * The provider for the parent file * @param entry * The root directory of the project * @return A list of all files in the project */ @SuppressWarnings({ "rawtypes", "unchecked" }) protected boolean getFilesForProject(Collection files, IImportStructureProvider provider, Object entry) { List children = provider.getChildren(entry); Iterator childrenEnum = children.iterator(); while (childrenEnum.hasNext()) { Object child = childrenEnum.next(); // Add the child, this way we get every files except the project // folder itself which we don't want files.add(child); // We don't have isDirectory for tar so must check for children // instead if (provider.isFolder(child)) { getFilesForProject(files, provider, child); } } return true; }
/** * Creates and returns a <code>FileSystemElement</code> if the specified * file system object merits one. The criteria for this are: * Also create the children. */ protected MinimizedFileSystemElement createRootElement( Object fileSystemObject, IImportStructureProvider provider) { boolean isContainer = provider.isFolder(fileSystemObject); String elementLabel = provider.getLabel(fileSystemObject); // Use an empty label so that display of the element's full name // doesn't include a confusing label MinimizedFileSystemElement dummyParent = new MinimizedFileSystemElement( "", null, true);//$NON-NLS-1$ dummyParent.setPopulated(); MinimizedFileSystemElement result = new MinimizedFileSystemElement( elementLabel, dummyParent, isContainer); result.setFileSystemObject(fileSystemObject); //Get the files for the element so as to build the first level result.getFiles(provider); return dummyParent; }
/** * Invokes a file selection operation using the specified file system and * structure provider. If the user specifies files to be imported then * this selection is cached for later retrieval and is returned. */ protected MinimizedFileSystemElement selectFiles( final Object rootFileSystemObject, final IImportStructureProvider structureProvider) { final MinimizedFileSystemElement[] results = new MinimizedFileSystemElement[1]; BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { public void run() { //Create the root element from the supplied file system object results[0] = createRootElement(rootFileSystemObject, structureProvider); } }); return results[0]; }
/** * Creates a new operation that recursively imports the entire contents of the * specified root file system object. * <p> * The <code>source</code> 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 <code>IImportStructureProvider</code>. * </p> * <p> * The <code>provider</code> 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. * </p> * <p> * The default import behavior is to recreate the complete container structure * for the contents of the root file system object in their destination. * If <code>setCreateContainerStructure</code> is set to false then the container * structure created is relative to the root file system object. * </p> * * @param containerPath the full path of the destination container within the * workspace * @param source the root file system object to import * @param provider the file system structure provider to use * @param overwriteImplementor the overwrite strategy to use */ public OwlImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor) { super(); this.destinationPath = containerPath; this.source = source; this.provider = provider; overwriteCallback = overwriteImplementor; }
/** * 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. * <p> * The <code>source</code> parameter represents the root file system object to * import. Valid types for this parameter are determined by the supplied * <code>IImportStructureProvider</code>. The contents of the source which * are to be imported are specified in the <code>filesToImport</code> * parameter. * </p> * <p> * The <code>provider</code> 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. * </p> * <p> * The <code>filesToImport</code> parameter specifies what contents of the root * file system object are to be imported. * </p> * <p> * The default import behavior is to recreate the complete container structure * for the file system objects in their destination. If <code>setCreateContainerStructure</code> * is set to <code>false</code>, then the container structure created for each of * the file system objects is relative to the supplied root file system object. * </p> * * @param containerPath the full path of the destination container within the * workspace * @param source the root file system object to import from * @param provider the file system structure provider to use * @param overwriteImplementor the overwrite strategy to use * @param filesToImport the list of file system objects to be imported * (element type: <code>Object</code>) */ public OwlImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport) { this(containerPath, source, provider, overwriteImplementor); setFilesToImport(filesToImport); }
/** * Creates a new operation that imports specific file system objects. * <p> * The <code>provider</code> 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. * </p> * <p> * The <code>filesToImport</code> parameter specifies what file system objects * are to be imported. * </p> * <p> * The default import behavior is to recreate the complete container structure * for the file system objects in their destination. If <code>setCreateContainerStructure</code> * is set to <code>false</code>, then no container structure is created for each of * the file system objects. * </p> * * @param containerPath the full path of the destination container within the * workspace * @param provider the file system structure provider to use * @param overwriteImplementor the overwrite strategy to use * @param filesToImport the list of file system objects to be imported * (element type: <code>Object</code>) */ public OwlImportOperation(IPath containerPath, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport) { this(containerPath, null, provider, overwriteImplementor); setFilesToImport(filesToImport); }