1 11 package org.eclipse.ui.wizards.datatransfer; 12 13 import java.util.*; 14 15 import org.eclipse.core.runtime.IProgressMonitor; 16 import org.eclipse.jface.operation.ModalContext; 17 18 22 class PopulateElementOperation extends PopulateRootOperation { 23 28 public PopulateElementOperation( 29 MinimizedFileSystemElement rootObject, 30 IImportStructureProvider structureProvider) { 31 super(rootObject, structureProvider); 32 } 33 36 private void populateElement( 37 MinimizedFileSystemElement element, 38 IProgressMonitor monitor) 39 throws InterruptedException { 40 41 Object fileSystemObject = element.getFileSystemObject(); 42 ModalContext.checkCanceled(monitor); 43 44 45 List children = provider.getChildren(fileSystemObject); 46 if (children == null) 47 children = new ArrayList(1); 48 Iterator childrenEnum = children.iterator(); 49 while (childrenEnum.hasNext()) { 50 createElement(element, childrenEnum.next(), 1); 52 } 53 element.setPopulated(); 54 } 55 58 public void run(IProgressMonitor monitor) throws InterruptedException { 59 try { 60 this.monitor = monitor; 61 monitor.beginTask(DataTransferMessages.getString("DataTransfer.scanningChildren"),IProgressMonitor.UNKNOWN); MinimizedFileSystemElement element = (MinimizedFileSystemElement) root; 63 populateElement(element,monitor); 64 65 } finally { 66 monitor.done(); 67 } 68 } 69 } 70 | Popular Tags |