Merge "SDK/Cygwin: add propertysheet to things we can build on windows"
diff --git a/anttargetprint/.classpath b/anttargetprint/.classpath
new file mode 100644
index 0000000..901231a
--- /dev/null
+++ b/anttargetprint/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="var" path="ANDROID_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_SRC/dalvik/libcore/xml/src/main/java"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/anttargetprint/.project b/anttargetprint/.project
new file mode 100644
index 0000000..10b95ef
--- /dev/null
+++ b/anttargetprint/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>anttargetprint</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/anttargetprint/.settings/org.eclipse.jdt.core.prefs b/anttargetprint/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..8470dc5
--- /dev/null
+++ b/anttargetprint/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Thu Mar 29 19:40:52 PDT 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/anttargetprint/src/com/android/anttargetprint/BuildXmlHandler.java b/anttargetprint/src/com/android/anttargetprint/BuildXmlHandler.java
new file mode 100644
index 0000000..e9bc4f3
--- /dev/null
+++ b/anttargetprint/src/com/android/anttargetprint/BuildXmlHandler.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.anttargetprint;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class BuildXmlHandler extends DefaultHandler {
+
+    private Map<String, String> mTargets = new HashMap<String, String>();
+    private int mLevel = 0;
+
+    @Override
+    public void startElement(String uri, String localName, String qName, Attributes attributes)
+            throws SAXException {
+
+        mLevel++;
+
+        if (mLevel == 2 && "target".equals(qName)) {
+            String name = attributes.getValue("name");
+            String depends = attributes.getValue("depends");
+
+            if (name != null) {
+                if (depends == null) {
+                    depends = "";
+                }
+
+                mTargets.put(name, depends);
+            }
+        }
+
+        super.startElement(uri, localName, qName, attributes);
+    }
+
+    @Override
+    public void endElement(String uri, String localName, String qName) throws SAXException {
+        mLevel--;
+        super.endElement(uri, localName, qName);
+    }
+
+    Map<String, List<String>> processTargets() {
+        HashMap<String, List<String>> result = new HashMap<String, List<String>>();
+
+        for (Entry<String, String> entry : mTargets.entrySet()) {
+            process(entry.getKey(), entry.getValue(), result);
+        }
+
+        return result;
+    }
+
+    private List<String> process(String targetName, String targetDepends,
+            Map<String, List<String>> resultMap) {
+
+        // first check if this was already processed.
+        List<String> resultList = resultMap.get(targetName);
+        if (resultList != null) {
+            return resultList;
+        }
+
+        resultList = new ArrayList<String>();
+
+        if (targetDepends.length() > 0) {
+            String[] dependencies = targetDepends.split(",");
+
+            for (String dependency : dependencies) {
+                String dependencyTrim = dependency.trim();
+                // get all the dependencies for this targets.
+                List<String> dependencyList = resultMap.get(dependencyTrim);
+                if (dependencyList == null) {
+                    dependencyList = process(dependencyTrim, mTargets.get(dependencyTrim),
+                            resultMap);
+                }
+
+                // add those to the new result list
+                resultList.addAll(dependencyList);
+
+                // and add this dependency as well
+                resultList.add(dependencyTrim);
+            }
+        }
+
+        resultMap.put(targetName, resultList);
+
+        return resultList;
+    }
+
+}
diff --git a/anttargetprint/src/com/android/anttargetprint/Main.java b/anttargetprint/src/com/android/anttargetprint/Main.java
new file mode 100644
index 0000000..e270d97
--- /dev/null
+++ b/anttargetprint/src/com/android/anttargetprint/Main.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.anttargetprint;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map.Entry;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+
+public class Main {
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+
+        if (args.length != 1) {
+            System.err.println("USAGE: <prog> [FILE]");
+            System.exit(1);
+        }
+
+        try {
+            SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+            BuildXmlHandler handler = new BuildXmlHandler();
+            parser.parse(new File(args[0]), handler);
+
+            for (Entry<String, List<String>> entry : handler.processTargets().entrySet()) {
+                String name = entry.getKey();
+                if (name.charAt(0) != '-') {
+                    System.out.print(entry.getKey());
+                    System.out.print(" : ");
+                    for (String v : entry.getValue()) {
+                        System.out.print(v);
+                        System.out.print(" > ");
+                    }
+                    System.out.println();
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/apps/SdkController/.settings/org.eclipse.jdt.core.prefs b/apps/SdkController/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..5b174be
--- /dev/null
+++ b/apps/SdkController/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Fri Apr 06 22:06:54 PDT 2012

+eclipse.preferences.version=1

+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled

+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6

+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve

+org.eclipse.jdt.core.compiler.compliance=1.6

+org.eclipse.jdt.core.compiler.debug.lineNumber=generate

+org.eclipse.jdt.core.compiler.debug.localVariable=generate

+org.eclipse.jdt.core.compiler.debug.sourceFile=generate

+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

+org.eclipse.jdt.core.compiler.source=1.6

diff --git a/common/src/com/android/io/FileWrapper.java b/common/src/com/android/io/FileWrapper.java
index 84a1f3e..8be7859 100644
--- a/common/src/com/android/io/FileWrapper.java
+++ b/common/src/com/android/io/FileWrapper.java
@@ -90,7 +90,7 @@
         try {
             return new FileInputStream(this);
         } catch (FileNotFoundException e) {
-            throw new StreamException(e);
+            throw new StreamException(e, this, StreamException.Error.FILENOTFOUND);
         }
     }
 
@@ -106,13 +106,13 @@
                 fos.write(buffer, 0, count);
             }
         } catch (IOException e) {
-            throw new StreamException(e);
+            throw new StreamException(e, this);
         } finally {
             if (fos != null) {
                 try {
                     fos.close();
                 } catch (IOException e) {
-                    throw new StreamException(e);
+                    throw new StreamException(e, this);
                 }
             }
         }
@@ -123,7 +123,7 @@
         try {
             return new FileOutputStream(this);
         } catch (FileNotFoundException e) {
-            throw new StreamException(e);
+            throw new StreamException(e, this);
         }
     }
 
diff --git a/common/src/com/android/io/StreamException.java b/common/src/com/android/io/StreamException.java
index f67c7a8..9f632f4 100644
--- a/common/src/com/android/io/StreamException.java
+++ b/common/src/com/android/io/StreamException.java
@@ -16,13 +16,35 @@
 
 package com.android.io;
 
+
 /**
  * Exception thrown when {@link IAbstractFile#getContents()} fails.
  */
 public class StreamException extends Exception {
     private static final long serialVersionUID = 1L;
 
-    public StreamException(Exception e) {
+    public static enum Error {
+        DEFAULT, OUTOFSYNC, FILENOTFOUND;
+    }
+
+    private final  Error mError;
+    private final IAbstractFile mFile;
+
+    public StreamException(Exception e, IAbstractFile file) {
+        this(e, file, Error.DEFAULT);
+    }
+
+    public StreamException(Exception e, IAbstractFile file, Error error) {
         super(e);
+        mFile = file;
+        mError = error;
+    }
+
+    public Error getError() {
+        return mError;
+    }
+
+    public IAbstractFile getFile() {
+        return mFile;
     }
 }
diff --git a/ddms/app/etc/ddms b/ddms/app/etc/ddms
index b0e529b..d698ec3 100755
--- a/ddms/app/etc/ddms
+++ b/ddms/app/etc/ddms
@@ -88,7 +88,7 @@
     vmarch=`${javaCmd} -jar "${frameworkdir}"/archquery.jar`
     if [ -n "$ANDROID_BUILD_TOP" ]; then
         osname=`uname -s | tr A-Z a-z`
-        swtpath="${ANDROID_BUILD_TOP}/prebuilt/${osname}-${vmarch}/swt"
+        swtpath="${ANDROID_BUILD_TOP}/prebuilts/tools/${osname}-${vmarch}/swt"
     else
         swtpath="${frameworkdir}/${vmarch}"
     fi
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java
index d0c8a2f..b0f885a 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java
@@ -321,6 +321,10 @@
             // the value the dialog was initialized with. It does however return
             // the full path as its return value, so just pick the path from
             // there.
+            if (!fileName.endsWith(".png")) {
+                fileName = fileName + ".png";
+            }
+
             String saveDir = new File(fileName).getParent();
             if (saveDir != null) {
                 DdmUiPreferences.getStore().setValue("lastImageSaveDir", saveDir);
diff --git a/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java b/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java
index e0aa026..7c719b4 100644
--- a/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java
+++ b/draw9patch/src/com/android/draw9patch/ui/ImageEditorPanel.java
@@ -74,6 +74,11 @@
     private static final int DEFAULT_ZOOM = 8;
     private static final float DEFAULT_SCALE = 2.0f;
 
+    // For stretch regions and padding
+    private static final int BLACK_TICK = 0xFF000000;
+    // For Layout Bounds
+    private static final int RED_TICK = 0xFFFF0000;
+
     private String name;
     private BufferedImage image;
     private boolean is9Patch;
@@ -317,21 +322,21 @@
         int height = image.getHeight();
         for (int i = 0; i < width; i++) {
             int pixel = image.getRGB(i, 0);
-            if (pixel != 0 && pixel != 0xFF000000) {
+            if (pixel != 0 && pixel != BLACK_TICK && pixel != RED_TICK) {
                 image.setRGB(i, 0, 0);
             }
             pixel = image.getRGB(i, height - 1);
-            if (pixel != 0 && pixel != 0xFF000000) {
+            if (pixel != 0 && pixel != BLACK_TICK && pixel != RED_TICK) {
                 image.setRGB(i, height - 1, 0);
             }
         }
         for (int i = 0; i < height; i++) {
             int pixel = image.getRGB(0, i);
-            if (pixel != 0 && pixel != 0xFF000000) {
+            if (pixel != 0 && pixel != BLACK_TICK && pixel != RED_TICK) {
                 image.setRGB(0, i, 0);
             }
             pixel = image.getRGB(width - 1, i);
-            if (pixel != 0 && pixel != 0xFF000000) {
+            if (pixel != 0 && pixel != BLACK_TICK && pixel != RED_TICK) {
                 image.setRGB(width - 1, i, 0);
             }
         }
@@ -685,7 +690,8 @@
             helpPanel = new JPanel(new BorderLayout());
             helpPanel.setBorder(new EmptyBorder(0, 6, 0, 6));
             helpPanel.setBackground(HELP_COLOR);
-            helpLabel = new JLabel("Press Shift to erase pixels");
+            helpLabel = new JLabel("Press Shift to erase pixels."
+                    + " Press Control to draw layout bounds");
             helpLabel.putClientProperty("JComponent.sizeVariant", "small");            
             helpPanel.add(helpLabel, BorderLayout.WEST);
             checkButton = new JButton("Show bad patches");
@@ -727,6 +733,7 @@
                     // event returns 0, which appears to be technically correct (no button
                     // changed state).
                     currentButton = event.isShiftDown() ? MouseEvent.BUTTON3 : event.getButton();
+                    currentButton = event.isControlDown() ? MouseEvent.BUTTON2 : currentButton;
                     paint(event.getX(), event.getY(), currentButton);
                 }
             });
@@ -843,7 +850,8 @@
                 if (eraseMode) {
                     helpLabel.setText("Release Shift to draw pixels");
                 } else {
-                    helpLabel.setText("Press Shift to erase pixels");
+                    helpLabel.setText("Press Shift to erase pixels."
+                                      + " Press Control to draw layout bounds");
                 }
             }
         }
@@ -852,7 +860,10 @@
             int color;
             switch (button) {
                 case MouseEvent.BUTTON1:
-                    color = 0xFF000000;
+                    color = BLACK_TICK;
+                    break;
+                case MouseEvent.BUTTON2:
+                    color = RED_TICK;
                     break;
                 case MouseEvent.BUTTON3:
                     color = 0;
@@ -1154,7 +1165,7 @@
             for (int i = 1; i < pixels.length - 1; i++) {
                 int pixel = pixels[i];
                 if (pixel != lastPixel) {
-                    if (lastPixel == 0xFF000000) {
+                    if (lastPixel == BLACK_TICK) {
                         if (first) startWithPatch[0] = true;
                         patches.add(new Pair<Integer>(lastIndex, i));
                     } else {
@@ -1166,7 +1177,7 @@
                     lastPixel = pixel;
                 }
             }
-            if (lastPixel == 0xFF000000) {
+            if (lastPixel == BLACK_TICK) {
                 if (first) startWithPatch[0] = true;
                 patches.add(new Pair<Integer>(lastIndex, pixels.length - 1));
             } else {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.overlay/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt.overlay/META-INF/MANIFEST.MF
index c7ed760..734e8e1 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt.overlay/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.overlay/META-INF/MANIFEST.MF
@@ -16,3 +16,4 @@
  com.android.ide.eclipse.adt
 Bundle-ActivationPolicy: lazy
 Import-Package: org.eclipse.jface.text.formatter
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
index dcef3c9..9388d69 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
@@ -128,5 +128,6 @@
  org.kxml2.wap.wml;x-friends:="com.android.ide.eclipse.tests",
  org.kxml2.wap.wv;x-friends:="com.android.ide.eclipse.tests",
  org.xmlpull.v1;x-friends:="com.android.ide.eclipse.tests"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 
 
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java
index fde0a1c..8b9492d 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java
@@ -26,6 +26,9 @@
 import com.android.ide.eclipse.adt.internal.project.XmlErrorHandler;
 import com.android.ide.eclipse.adt.internal.project.XmlErrorHandler.XmlErrorListener;
 import com.android.ide.eclipse.adt.internal.sdk.Sdk;
+import com.android.ide.eclipse.adt.io.IFileWrapper;
+import com.android.io.IAbstractFile;
+import com.android.io.StreamException;
 import com.android.sdklib.IAndroidTarget;
 
 import org.eclipse.core.resources.IContainer;
@@ -343,6 +346,53 @@
     }
 
     /**
+     * Handles a {@link StreamException} by logging the info and marking the project.
+     * This should generally be followed by exiting the build process.
+     *
+     * @param e the exception
+     */
+    protected void handleStreamException(StreamException e) {
+        IAbstractFile file = e.getFile();
+
+        String msg;
+
+        IResource target = getProject();
+        if (file instanceof IFileWrapper) {
+            target = ((IFileWrapper) file).getIFile();
+
+            if (e.getError() == StreamException.Error.OUTOFSYNC) {
+                msg = "File is Out of sync";
+            } else {
+                msg = "Error reading file. Read log for details";
+            }
+
+        } else {
+            if (e.getError() == StreamException.Error.OUTOFSYNC) {
+                msg = String.format("Out of sync file: %s", file.getOsLocation());
+            } else {
+                msg = String.format("Error reading file %s. Read log for details",
+                        file.getOsLocation());
+            }
+        }
+
+        AdtPlugin.logAndPrintError(e, getProject().getName(), msg);
+        BaseProjectHelper.markResource(target, AdtConstants.MARKER_ADT, msg,
+                IMarker.SEVERITY_ERROR);
+    }
+
+    /**
+     * Handles a generic {@link Throwable} by logging the info and marking the project.
+     * This should generally be followed by exiting the build process.
+     *
+     * @param t the {@link Throwable}.
+     * @param message the message to log and to associate with the marker.
+     */
+    protected void handleException(Throwable t, String message) {
+        AdtPlugin.logAndPrintError(t, getProject().getName(), message);
+        markProject(AdtConstants.MARKER_ADT, message, IMarker.SEVERITY_ERROR);
+    }
+
+    /**
      * Recursively delete all the derived resources from a root resource. The root resource is not
      * deleted.
      * @param rootResource the root resource
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java
index 7639338..c213005 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java
@@ -37,6 +37,7 @@
 import com.android.ide.eclipse.adt.internal.sdk.Sdk;
 import com.android.ide.eclipse.adt.io.IFileWrapper;
 import com.android.ide.eclipse.adt.io.IFolderWrapper;
+import com.android.io.StreamException;
 import com.android.sdklib.AndroidVersion;
 import com.android.sdklib.IAndroidTarget;
 import com.android.sdklib.SdkConstants;
@@ -57,6 +58,7 @@
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.JavaCore;
+import org.xml.sax.SAXException;
 
 import java.io.File;
 import java.io.IOException;
@@ -64,6 +66,8 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.xml.parsers.ParserConfigurationException;
+
 /**
  * Pre Java Compiler.
  * This incremental builder performs 2 tasks:
@@ -364,27 +368,60 @@
             // resource delta visitor yet.
             if (dv == null || dv.getCheckedManifestXml() == false) {
                 BasicXmlErrorListener errorListener = new BasicXmlErrorListener();
-                ManifestData parser = AndroidManifestHelper.parse(new IFileWrapper(manifestFile),
-                        true /*gather data*/,
-                        errorListener);
+                try {
+                    ManifestData parser = AndroidManifestHelper.parseUnchecked(
+                            new IFileWrapper(manifestFile),
+                            true /*gather data*/,
+                            errorListener);
 
-                if (errorListener.mHasXmlError == true) {
-                    // There was an error in the manifest, its file has been marked
-                    // by the XmlErrorHandler. The stopBuild() call below will abort
-                    // this with an exception.
-                    String msg = String.format(Messages.s_Contains_Xml_Error,
-                            SdkConstants.FN_ANDROID_MANIFEST_XML);
-                    AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, project, msg);
+                    if (errorListener.mHasXmlError == true) {
+                        // There was an error in the manifest, its file has been marked
+                        // by the XmlErrorHandler. The stopBuild() call below will abort
+                        // this with an exception.
+                        String msg = String.format(Messages.s_Contains_Xml_Error,
+                                SdkConstants.FN_ANDROID_MANIFEST_XML);
+                        AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, project, msg);
+                        markProject(AdtConstants.MARKER_ADT, msg, IMarker.SEVERITY_ERROR);
+
+                        return result;
+                    }
+
+                    // Get the java package from the parser.
+                    // This can be null if the parsing failed because the resource is out of sync,
+                    // in which case the error will already have been logged anyway.
+                    if (parser != null) {
+                        javaPackage = parser.getPackage();
+                        minSdkVersion = parser.getMinSdkVersionString();
+                    }
+                } catch (StreamException e) {
+                    handleStreamException(e);
 
                     return result;
-                }
+                } catch (ParserConfigurationException e) {
+                    String msg = String.format(
+                            "Bad parser configuration for %s: %s",
+                            manifestFile.getFullPath(),
+                            e.getMessage());
 
-                // Get the java package from the parser.
-                // This can be null if the parsing failed because the resource is out of sync,
-                // in which case the error will already have been logged anyway.
-                if (parser != null) {
-                    javaPackage = parser.getPackage();
-                    minSdkVersion = parser.getMinSdkVersionString();
+                    handleException(e, msg);
+                    return result;
+
+                } catch (SAXException e) {
+                    String msg = String.format(
+                            "Parser exception for %s: %s",
+                            manifestFile.getFullPath(),
+                            e.getMessage());
+
+                    handleException(e, msg);
+                    return result;
+                } catch (IOException e) {
+                    String msg = String.format(
+                            "I/O error for %s: %s",
+                            manifestFile.getFullPath(),
+                            e.getMessage());
+
+                    handleException(e, msg);
+                    return result;
                 }
             }
 
@@ -519,8 +556,7 @@
             try {
                 handleBuildConfig(args);
             } catch (IOException e) {
-                AdtPlugin.log(e, "Failed to create BuildConfig class for project %s",
-                        getProject().getName());
+                handleException(e, "Failed to create BuildConfig class");
                 return result;
             }
 
@@ -531,7 +567,10 @@
                     processorStatus |= processor.compileFiles(this,
                             project, projectTarget, minSdkValue, sourceFolderPathList, monitor);
                 } catch (Throwable t) {
-                    AdtPlugin.log(t, "Failed to run one of the source processor");
+                    handleException(t, String.format(
+                            "Failed to run %s. Check workspace log for detail.",
+                            processor.getClass().getName()));
+                    return result;
                 }
             }
 
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidManifestHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidManifestHelper.java
index ba47c7a..bf76699 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidManifestHelper.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidManifestHelper.java
@@ -52,24 +52,54 @@
      * @param errorListener an optional error listener. If non null, then the parser will also
      * look for XML errors.
      * @return an {@link ManifestData} or null if the parsing failed.
+     * @throws ParserConfigurationException
+     * @throws StreamException
+     * @throws IOException
+     * @throws SAXException
+     */
+    public static ManifestData parseUnchecked(
+            IAbstractFile manifestFile,
+            boolean gatherData,
+            XmlErrorListener errorListener) throws SAXException, IOException,
+            StreamException, ParserConfigurationException {
+        if (manifestFile != null) {
+            IFile eclipseFile = null;
+            if (manifestFile instanceof IFileWrapper) {
+                eclipseFile = ((IFileWrapper)manifestFile).getIFile();
+            }
+            XmlErrorHandler errorHandler = null;
+            if (errorListener != null) {
+                errorHandler = new XmlErrorHandler(eclipseFile, errorListener);
+            }
+
+            return AndroidManifestParser.parse(manifestFile, gatherData, errorHandler);
+        }
+
+        return null;
+    }
+
+    /**
+     * Parses the Android Manifest, and returns an object containing the result of the parsing.
+     * <p/>
+     * This method can also gather XML error during the parsing. This is done by using an
+     * {@link XmlErrorHandler} to mark the files in case of error, as well as a given
+     * {@link XmlErrorListener}. To use a different error handler, consider using
+     * {@link AndroidManifestParser#parse(IAbstractFile, boolean, com.android.sdklib.xml.AndroidManifestParser.ManifestErrorHandler)}
+     * directly.
+     *
+     * @param manifestFile the {@link IFile} representing the manifest file.
+     * @param gatherData indicates whether the parsing will extract data from the manifest. If null,
+     * the method will always return null.
+     * @param errorListener an optional error listener. If non null, then the parser will also
+     * look for XML errors.
+     * @return an {@link ManifestData} or null if the parsing failed.
      */
     public static ManifestData parse(
             IAbstractFile manifestFile,
             boolean gatherData,
             XmlErrorListener errorListener) {
         try {
-            if (manifestFile != null) {
-                IFile eclipseFile = null;
-                if (manifestFile instanceof IFileWrapper) {
-                    eclipseFile = ((IFileWrapper)manifestFile).getIFile();
-                }
-                XmlErrorHandler errorHandler = null;
-                if (errorListener != null) {
-                    errorHandler = new XmlErrorHandler(eclipseFile, errorListener);
-                }
-
-                return AndroidManifestParser.parse(manifestFile, gatherData, errorHandler);
-            }
+            return parseUnchecked(manifestFile, gatherData, errorListener);
         } catch (ParserConfigurationException e) {
             AdtPlugin.logAndPrintError(e, AndroidManifestHelper.class.getCanonicalName(),
                     "Bad parser configuration for %s: %s",
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/io/IFileWrapper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/io/IFileWrapper.java
index babee35..b030f07 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/io/IFileWrapper.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/io/IFileWrapper.java
@@ -48,7 +48,11 @@
         try {
             return mFile.getContents();
         } catch (CoreException e) {
-            throw new StreamException(e);
+            StreamException.Error error = StreamException.Error.DEFAULT;
+            if (mFile.isSynchronized(IResource.DEPTH_ZERO) == false) {
+                error = StreamException.Error.OUTOFSYNC;
+            }
+            throw new StreamException(e, this, error);
         }
     }
 
@@ -57,7 +61,7 @@
         try {
             mFile.setContents(source, IResource.FORCE, null);
         } catch (CoreException e) {
-            throw new StreamException(e);
+            throw new StreamException(e, this);
         }
     }
 
diff --git a/eclipse/plugins/com.android.ide.eclipse.base/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.base/META-INF/MANIFEST.MF
index 7c2bfc8..ba15622 100644
--- a/eclipse/plugins/com.android.ide.eclipse.base/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.base/META-INF/MANIFEST.MF
@@ -100,3 +100,4 @@
  org.apache.http.params,
  org.apache.http.protocol,
  org.apache.http.util
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
index 8f38856..47c8265 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
@@ -36,3 +36,4 @@
  libs/jcommon-1.0.12.jar,
  libs/jfreechart-1.0.9.jar,
  libs/jfreechart-1.0.9-swt.jar
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF
index 884b4b6..cbd95da 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF
@@ -21,3 +21,4 @@
  com.android.ide.eclipse.gltrace;x-friends:="com.android.ide.eclipse.gldebugger.tests",
  com.android.ide.eclipse.gltrace.format;x-friends:="com.android.ide.eclipse.gldebugger.tests",
  com.android.ide.eclipse.gltrace.model;x-friends:="com.android.ide.eclipse.gldebugger.tests"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF
index 931cb30..b7b284a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF
@@ -14,3 +14,4 @@
 Bundle-ClassPath: .,
  libs/hierarchyviewerlib.jar
 Export-Package: com.android.ide.eclipse.hierarchyviewer
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/eclipse/plugins/com.android.ide.eclipse.monitor/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.monitor/META-INF/MANIFEST.MF
index 28fb55f..b0ffa36 100644
--- a/eclipse/plugins/com.android.ide.eclipse.monitor/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.monitor/META-INF/MANIFEST.MF
@@ -12,3 +12,4 @@
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %Bundle-Vendor
 Bundle-ClassPath: .
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/eclipse/plugins/com.android.ide.eclipse.pdt/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.pdt/META-INF/MANIFEST.MF
index a388a3e..0ecba08 100644
--- a/eclipse/plugins/com.android.ide.eclipse.pdt/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.pdt/META-INF/MANIFEST.MF
@@ -18,3 +18,4 @@
  org.eclipse.ui.ide
 Bundle-Activator: com.android.ide.eclipse.pdt.PdtPlugin
 Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/eclipse/plugins/com.android.ide.eclipse.traceview/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.traceview/META-INF/MANIFEST.MF
index 456e8b6..f047c0b 100644
--- a/eclipse/plugins/com.android.ide.eclipse.traceview/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.traceview/META-INF/MANIFEST.MF
@@ -14,3 +14,4 @@
 Bundle-ClassPath: .,
  libs/traceview.jar
 Bundle-Vendor: The Android Open Source Project
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/hierarchyviewer2/app/etc/hierarchyviewer b/hierarchyviewer2/app/etc/hierarchyviewer
index 82304dc..bc52c6e 100755
--- a/hierarchyviewer2/app/etc/hierarchyviewer
+++ b/hierarchyviewer2/app/etc/hierarchyviewer
@@ -89,7 +89,7 @@
     vmarch=`${javaCmd} -jar "${frameworkdir}"/archquery.jar`
     if [ -n "$ANDROID_BUILD_TOP" ]; then
         osname=`uname -s | tr A-Z a-z`
-        swtpath="${ANDROID_BUILD_TOP}/prebuilt/${osname}-${vmarch}/swt"
+        swtpath="${ANDROID_BUILD_TOP}/prebuilts/tools/${osname}-${vmarch}/swt"
     else
         swtpath="${frameworkdir}/${vmarch}"
     fi
diff --git a/lint/libs/lint_checks/src/com/android/tools/lint/checks/ApiDetector.java b/lint/libs/lint_checks/src/com/android/tools/lint/checks/ApiDetector.java
index 05b640d..43ea4ef 100644
--- a/lint/libs/lint_checks/src/com/android/tools/lint/checks/ApiDetector.java
+++ b/lint/libs/lint_checks/src/com/android/tools/lint/checks/ApiDetector.java
@@ -18,7 +18,6 @@
 
 import static com.android.tools.lint.detector.api.LintConstants.ANDROID_RESOURCE_PREFIX;
 import static com.android.tools.lint.detector.api.LintConstants.TARGET_API;
-import static com.android.tools.lint.detector.api.LintConstants.VALUE_MATCH_PARENT;
 
 import com.android.annotations.NonNull;
 import com.android.resources.ResourceFolderType;
@@ -135,20 +134,6 @@
 
         String value = attribute.getValue();
 
-        if (value.equals(VALUE_MATCH_PARENT)) {
-            int minSdk = getMinSdk(context);
-            // minSdk != -1: Avoid warning about this in library projects where
-            // no uses-sdk has been specified
-            if (minSdk != -1 && minSdk < 8 && context.getFolderVersion() < 8) {
-                Location location = context.getLocation(attribute);
-                String message = String.format(
-                        "\"match_parent\" requires API level 8 (current min is %1$d), " +
-                        "use \"fill_parent\" instead",
-                        minSdk);
-                context.report(UNSUPPORTED, attribute, location, message, null);
-            }
-        }
-
         if (value.startsWith(ANDROID_RESOURCE_PREFIX)) {
             // Convert @android:type/foo into android/R$type and "foo"
             int index = value.indexOf('/', ANDROID_RESOURCE_PREFIX.length());
diff --git a/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/ApiDetectorTest.java b/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/ApiDetectorTest.java
index 01ab449..667c34a 100644
--- a/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/ApiDetectorTest.java
+++ b/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/ApiDetectorTest.java
@@ -32,7 +32,6 @@
                 "layout.xml:21: Error: View requires API level 14 (current min is 1): <GridLayout>\n" +
                 "layout.xml:22: Error: @android:attr/actionBarSplitStyle requires API level 14 (current min is 1)\n" +
                 "layout.xml:23: Error: @android:color/holo_red_light requires API level 14 (current min is 1)\n" +
-                "layout.xml:4: Error: \"match_parent\" requires API level 8 (current min is 1), use \"fill_parent\" instead\n" +
                 "layout.xml:9: Error: View requires API level 5 (current min is 1): <QuickContactBadge>\n" +
                 "themes.xml:9: Error: @android:color/holo_red_light requires API level 14 (current min is 1)",
 
diff --git a/traceview/etc/traceview b/traceview/etc/traceview
index 7035791..81e0b15 100755
--- a/traceview/etc/traceview
+++ b/traceview/etc/traceview
@@ -86,7 +86,7 @@
     vmarch=`${javaCmd} -jar "${frameworkdir}"/archquery.jar`
     if [ -n "$ANDROID_BUILD_TOP" ]; then
         osname=`uname -s | tr A-Z a-z`
-        swtpath="${ANDROID_BUILD_TOP}/prebuilt/${osname}-${vmarch}/swt"
+        swtpath="${ANDROID_BUILD_TOP}/prebuilts/tools/${osname}-${vmarch}/swt"
     else
         swtpath="${frameworkdir}/${vmarch}"
     fi