1 9 package org.eclipse.pde.internal.build.site; 10 11 import java.io.File ; 12 import java.net.URL ; 13 import java.util.*; 14 import org.eclipse.pde.internal.build.*; 15 import org.eclipse.update.core.ISiteContentProvider; 16 import org.eclipse.update.core.SiteContentProvider; 17 18 public class BuildTimeSiteContentProvider extends SiteContentProvider implements ISiteContentProvider, IPDEBuildConstants { 19 private String installedBaseURL; 20 private String [] urls; 21 private PDEUIStateWrapper pdeUIState; 22 23 public BuildTimeSiteContentProvider(String [] urls, String installedBaseURL, PDEUIStateWrapper initialState) { 24 super(null); 25 this.installedBaseURL = installedBaseURL; 26 this.urls = urls; 27 this.pdeUIState = initialState; 28 } 29 30 34 public String getInstalledBaseURL() { 35 return installedBaseURL; 36 } 37 38 public Collection getPluginPaths() { 39 Collection pluginsToCompile = findPluginXML(Utils.asFile(urls)); 40 if (installedBaseURL != null) { 41 pluginsToCompile.addAll(Arrays.asList(PluginPathFinder.getPluginPaths(installedBaseURL))); 42 } 43 return pluginsToCompile; 44 } 45 46 public URL getURL() { 47 throw new RuntimeException (); 48 } 49 50 private Collection findPluginXML(File [] location) { 52 Collection collectedElements = new ArrayList(10); 53 for (int i = 0; i < location.length; i++) { 54 File f = new File (location[i], DEFAULT_PLUGIN_LOCATION); 55 if (f.exists()) { 56 collectedElements.addAll(Arrays.asList(f.listFiles())); 57 } else { 58 collectedElements.add(location[i]); 59 } 60 } 61 return collectedElements; 62 } 63 64 public PDEUIStateWrapper getInitialState() { 65 return pdeUIState; 66 } 67 } 68 | Popular Tags |