1 11 package org.eclipse.ui.wizards.datatransfer; 12 13 import java.util.*; 14 import org.eclipse.ui.model.AdaptableList; 15 import org.eclipse.ui.dialogs.FileSystemElement; 16 17 21 class MinimizedFileSystemElement extends FileSystemElement { 22 private boolean populated = false; 23 29 MinimizedFileSystemElement(String name, FileSystemElement parent, boolean isDirectory) { 30 super(name, parent, isDirectory); 31 } 32 37 public AdaptableList getFiles(IImportStructureProvider provider) { 38 if (!populated) { 39 populate(provider); 40 } 41 return super.getFiles(); 42 } 43 48 public AdaptableList getFolders(IImportStructureProvider provider) { 49 if (!populated) { 50 populate(provider); 51 } 52 return super.getFolders(); 53 } 54 57 boolean isPopulated() { 58 return this.populated; 59 } 60 63 boolean notPopulated() { 64 return !this.populated; 65 } 66 70 private void populate(IImportStructureProvider provider) { 71 72 Object fileSystemObject = getFileSystemObject(); 73 74 List children = provider.getChildren(fileSystemObject); 75 if (children == null) { 76 children = new ArrayList(1); 77 } 78 Iterator childrenEnum = children.iterator(); 79 while (childrenEnum.hasNext()) { 80 Object child = childrenEnum.next(); 81 82 String elementLabel = provider.getLabel(child); 83 MinimizedFileSystemElement result = 85 new MinimizedFileSystemElement(elementLabel, this, provider.isFolder(child)); 86 result.setFileSystemObject(child); 87 } 88 setPopulated(); 89 } 90 93 void setPopulated() { 94 this.populated = true; 95 } 96 } 97 | Popular Tags |