### Eclipse Workspace Patch 1.0 #P org.eclipse.pde.api.tools Index: src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java =================================================================== RCS file: /cvsroot/eclipse/pde/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java,v retrieving revision 1.95 diff -u -r1.95 BaseApiAnalyzer.java --- src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java 6 Apr 2009 21:19:24 -0000 1.95 +++ src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java 7 Apr 2009 18:21:45 -0000 @@ -669,8 +669,9 @@ if(ignoreInvalidTagCheck()) { return; } + SubMonitor localMonitor = null; try { - SubMonitor localMonitor = SubMonitor.convert(monitor, BuilderMessages.BaseApiAnalyzer_validating_javadoc_tags, 1 + (typenames == null ? component.getApiTypeContainers().length : typenames.length)); + localMonitor = SubMonitor.convert(monitor, BuilderMessages.BaseApiAnalyzer_validating_javadoc_tags, 1 + (typenames == null ? component.getApiTypeContainers().length : typenames.length)); if(typenames == null) { try { IPackageFragmentRoot[] roots = fJavaProject.getPackageFragmentRoots(); @@ -698,8 +699,8 @@ ApiPlugin.log(e); } finally { - if(monitor != null) { - monitor.done(); + if(localMonitor != null) { + localMonitor.done(); } } } Index: src/org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder.java =================================================================== RCS file: /cvsroot/eclipse/pde/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder.java,v retrieving revision 1.101 diff -u -r1.101 ApiAnalysisBuilder.java --- src/org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder.java 6 Apr 2009 21:19:24 -0000 1.101 +++ src/org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder.java 7 Apr 2009 18:21:45 -0000 @@ -203,9 +203,7 @@ System.out.println("\nStarting build of " + this.currentproject.getName() + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ //$NON-NLS-2$ } updateMonitor(monitor, 0); - SubMonitor localMonitor = SubMonitor.convert(monitor, BuilderMessages.api_analysis_builder, 2); - final IProject[] projects = getRequiredProjects(true); - IApiBaseline baseline = ApiPlugin.getDefault().getApiBaselineManager().getDefaultApiBaseline(); + SubMonitor localMonitor = SubMonitor.convert(monitor, BuilderMessages.api_analysis_builder, 8); IApiBaseline wbaseline = ApiPlugin.getDefault().getApiBaselineManager().getWorkspaceBaseline(); if (wbaseline == null) { if (DEBUG) { @@ -213,6 +211,8 @@ } return NO_PROJECTS; } + final IProject[] projects = getRequiredProjects(true); + IApiBaseline baseline = ApiPlugin.getDefault().getApiBaselineManager().getDefaultApiBaseline(); try { switch(kind) { case FULL_BUILD : { @@ -284,13 +284,15 @@ this.analyzer.dispose(); this.analyzer = null; } - if(baseline != null) { - baseline.close(); - } - wbaseline.close(); - if(monitor != null) { - monitor.done(); + if(projects.length < 1) { + //if this build cycle indicates that more projects need to be built do not close + //the baselines yet, they might be re-read by another build cycle + if(baseline != null) { + baseline.close(); + } + wbaseline.close(); } + updateMonitor(monitor, 0); if (this.buildstate != null) { for(int i = 0, max = projects.length; i < max; i++) { IProject project = projects[i]; @@ -300,6 +302,10 @@ } BuildState.saveBuiltState(this.currentproject, this.buildstate); this.buildstate = null; + updateMonitor(monitor, 0); + } + if(monitor != null) { + monitor.done(); } } if (DEBUG) { Index: src/org/eclipse/pde/api/tools/internal/model/DirectoryApiTypeContainer.java =================================================================== RCS file: /cvsroot/eclipse/pde/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/DirectoryApiTypeContainer.java,v retrieving revision 1.3 diff -u -r1.3 DirectoryApiTypeContainer.java --- src/org/eclipse/pde/api/tools/internal/model/DirectoryApiTypeContainer.java 7 Mar 2009 00:00:04 -0000 1.3 +++ src/org/eclipse/pde/api/tools/internal/model/DirectoryApiTypeContainer.java 7 Apr 2009 18:21:45 -0000 @@ -42,21 +42,18 @@ */ static class LocalApiTypeRoot extends AbstractApiTypeRoot implements Comparable { - /** - * Associated file - */ - private File fFile; + String fLocation = null; /** * Constructs a class file on the given file * @param directory the parent {@link IApiElement} directory - * @param file file + * @param location * @param qualified type name * @param component owning API component */ - public LocalApiTypeRoot(DirectoryApiTypeContainer directory, File file, String typeName) { + public LocalApiTypeRoot(DirectoryApiTypeContainer directory, String location, String typeName) { super(directory, typeName); - fFile = file; + fLocation = location; } /* (non-Javadoc) @@ -95,18 +92,13 @@ */ public InputStream getInputStream() throws CoreException { try { - return new FileInputStream(fFile); + return new FileInputStream(new File(fLocation)); } catch (FileNotFoundException e) { abort("File not found", e); //$NON-NLS-1$ } return null; // never reaches here } } - - /** - * Root directory of the class file container - */ - private File fRoot; /** * Map of package names to associated directory (file) @@ -126,7 +118,6 @@ */ public DirectoryApiTypeContainer(IApiElement parent, String location) { super(parent, IApiElement.API_TYPE_CONTAINER, location); - this.fRoot = new File(location); } /** @@ -138,7 +129,14 @@ for (int i = 0; i < packageNames.length; i++) { String pkg = packageNames[i]; if (visitor.visitPackage(pkg)) { - File dir = (File) fPackages.get(pkg); + String location = (String) fPackages.get(pkg); + if(location == null) { + continue; + } + File dir = new File(location); + if(!dir.exists()) { + continue; + } File[] files = dir.listFiles(new FileFilter() { public boolean accept(File file) { return file.isFile() && file.getName().endsWith(Util.DOT_CLASS_SUFFIX); @@ -147,13 +145,12 @@ if (files != null) { List classFiles = new ArrayList(); for (int j = 0; j < files.length; j++) { - File file = files[j]; - String name = file.getName(); + String name = files[j].getName(); String typeName = name.substring(0, name.length() - 6); if (pkg.length() > 0) { typeName = pkg + "." + typeName; //$NON-NLS-1$ } - classFiles.add(new LocalApiTypeRoot(this, file, typeName)); + classFiles.add(new LocalApiTypeRoot(this, files[j].getAbsolutePath(), typeName)); } Collections.sort(classFiles); Iterator cfIterator = classFiles.iterator(); @@ -197,11 +194,11 @@ pkg = qualifiedName.substring(0, index); cfName = qualifiedName.substring(index + 1); } - File dir = (File) fPackages.get(pkg); - if (dir != null) { - File file = new File(dir, cfName + Util.DOT_CLASS_SUFFIX); + String location = (String) fPackages.get(pkg); + if(location != null) { + File file = new File(location, cfName + Util.DOT_CLASS_SUFFIX); if (file.exists()) { - return new LocalApiTypeRoot(this, file, qualifiedName); + return new LocalApiTypeRoot(this, file.getAbsolutePath(), qualifiedName); } } return null; @@ -229,7 +226,7 @@ private synchronized void init() { if (fPackages == null) { fPackages = new HashMap(); - processDirectory(Util.DEFAULT_PACKAGE_NAME, fRoot); + processDirectory(Util.DEFAULT_PACKAGE_NAME, new File(getName())); } } @@ -248,10 +245,10 @@ for (int i = 0; i < files.length; i++) { File file = files[i]; if (file.isDirectory()) { - dirs.add(file); + dirs.add(file.getAbsoluteFile()); } else if (!hasClassFiles) { if (file.getName().endsWith(Util.DOT_CLASS_SUFFIX)) { - fPackages.put(packageName, dir); + fPackages.put(packageName, dir.getAbsolutePath()); hasClassFiles = true; } }