Fix ADT to use the new sdklib API

ManifestConstants got renamed AndroidManifest but I
forgot to update ADT.

Change-Id: I60d40c63a67968c31789e91f14020c61114907ca
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/PreCompilerBuilder.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/PreCompilerBuilder.java
index af0960c..5b6293c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/PreCompilerBuilder.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/PreCompilerBuilder.java
@@ -27,7 +27,7 @@
 import com.android.sdklib.AndroidVersion;
 import com.android.sdklib.IAndroidTarget;
 import com.android.sdklib.SdkConstants;
-import com.android.sdklib.xml.ManifestConstants;
+import com.android.sdklib.xml.AndroidManifest;
 
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
@@ -336,7 +336,7 @@
                         // integer minSdk when the target is a preview => fatal error
                         String msg = String.format(
                                 "Platform %1$s is a preview and requires appication manifest to set %2$s to '%1$s'",
-                                codename, ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION);
+                                codename, AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION);
                         AdtPlugin.printErrorToConsole(project, msg);
                         BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
                                 IMarker.SEVERITY_ERROR);
@@ -345,7 +345,7 @@
                         // integer minSdk is not high enough for the target => warning
                         String msg = String.format(
                                 "Attribute %1$s (%2$d) is lower than the project target API level (%3$d)",
-                                ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION,
+                                AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
                                 minSdkValue, projectVersion.getApiLevel());
                         AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project, msg);
                         BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
@@ -354,7 +354,7 @@
                         // integer minSdk is too high for the target => warning
                         String msg = String.format(
                                 "Attribute %1$s (%2$d) is higher than the project target API level (%3$d)",
-                                ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION,
+                                AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
                                 minSdkValue, projectVersion.getApiLevel());
                         AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project, msg);
                         BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
@@ -368,7 +368,7 @@
                         // platform is not a preview => fatal error
                         String msg = String.format(
                                 "Manifest attribute '%1$s' is set to '%2$s'. Integer is expected.",
-                                ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION, minSdkVersion);
+                                AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION, minSdkVersion);
                         AdtPlugin.printErrorToConsole(project, msg);
                         BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
                                 IMarker.SEVERITY_ERROR);
@@ -377,7 +377,7 @@
                         // platform and manifest codenames don't match => fatal error.
                         String msg = String.format(
                                 "Value of manifest attribute '%1$s' does not match platform codename '%2$s'",
-                                ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION, codename);
+                                AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION, codename);
                         AdtPlugin.printErrorToConsole(project, msg);
                         BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
                                 IMarker.SEVERITY_ERROR);
@@ -390,7 +390,7 @@
                 String codename = projectTarget.getVersion().getCodename();
                 String msg = String.format(
                         "Platform %1$s is a preview and requires appication manifests to set %2$s to '%1$s'",
-                        codename, ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION);
+                        codename, AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION);
                 AdtPlugin.printErrorToConsole(project, msg);
                 BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
                         IMarker.SEVERITY_ERROR);
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiClassAttributeNode.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiClassAttributeNode.java
index 3119b70..d5abc09 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiClassAttributeNode.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiClassAttributeNode.java
@@ -25,8 +25,8 @@
 import com.android.ide.eclipse.adt.internal.editors.ui.SectionHelper;
 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiTextAttributeNode;
-import com.android.ide.eclipse.adt.internal.project.AndroidManifestParser;
 import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
+import com.android.sdklib.xml.AndroidManifest;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
@@ -94,9 +94,9 @@
     private IPostTypeCreationAction mPostCreationAction;
     private boolean mMandatory;
     private final boolean mDefaultToProjectOnly;
-    
+
     private class HierarchyTypeSelection extends TypeSelectionExtension {
-        
+
         private IJavaProject mJavaProject;
         private IType mReferenceType;
         private Button mProjectOnly;
@@ -112,13 +112,13 @@
         public ITypeInfoFilterExtension getFilterExtension() {
             return new ITypeInfoFilterExtension() {
                 public boolean select(ITypeInfoRequestor typeInfoRequestor) {
-                    
+
                     boolean projectOnly = mUseProjectOnly;
-                    
+
                     String packageName = typeInfoRequestor.getPackageName();
                     String typeName = typeInfoRequestor.getTypeName();
                     String enclosingType = typeInfoRequestor.getEnclosingName();
-                    
+
                     // build the full class name.
                     StringBuilder sb = new StringBuilder(packageName);
                     sb.append('.');
@@ -127,9 +127,9 @@
                         sb.append('.');
                     }
                     sb.append(typeName);
-                    
+
                     String className = sb.toString();
-                    
+
                     try {
                         IType type = mJavaProject.findType(className);
 
@@ -150,11 +150,11 @@
                                 return false;
                             }
                         }
-                        
+
                         // get the type hierarchy and reference type is one of the super classes.
                         ITypeHierarchy hierarchy = type.newSupertypeHierarchy(
                                 new NullProgressMonitor());
-                        
+
                         IType[] supertypes = hierarchy.getAllSupertypes(type);
                         int n = supertypes.length;
                         for (int i = 0; i < n; i++) {
@@ -165,12 +165,12 @@
                         }
                     } catch (JavaModelException e) {
                     }
-                    
+
                     return false;
                 }
             };
         }
-        
+
         @Override
         public Control createContentArea(Composite parent) {
 
@@ -178,10 +178,10 @@
             mProjectOnly.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
             mProjectOnly.setText(String.format("Display classes from sources of project '%s' only",
                     mJavaProject.getProject().getName()));
-            
+
             mUseProjectOnly = mDefaultToProjectOnly;
             mProjectOnly.setSelection(mUseProjectOnly);
-            
+
             mProjectOnly.addSelectionListener(new SelectionAdapter() {
                 @Override
                 public void widgetSelected(SelectionEvent e) {
@@ -190,7 +190,7 @@
                     getTypeSelectionComponent().triggerSearch();
                 }
             });
-            
+
             return super.createContentArea(parent);
         }
     }
@@ -216,13 +216,13 @@
      * @param mandatory indicates if the class value is mandatory
      * @param attributeDescriptor the {@link AttributeDescriptor} object linked to the Ui Node.
      * @param defaultToProjectOnly When true display classes of this project only by default.
-     *         When false any class path will be considered. The user can always toggle this. 
+     *         When false any class path will be considered. The user can always toggle this.
      */
     public UiClassAttributeNode(String referenceClass, IPostTypeCreationAction postCreationAction,
             boolean mandatory, AttributeDescriptor attributeDescriptor, UiElementNode uiParent,
             boolean defaultToProjectOnly) {
         super(attributeDescriptor, uiParent);
-        
+
         mReferenceClass = referenceClass;
         mPostCreationAction = postCreationAction;
         mMandatory = mandatory;
@@ -256,7 +256,7 @@
         });
         formText.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE));
         SectionHelper.addControlTooltip(formText, desc.getTooltip());
-        
+
         Composite composite = toolkit.createComposite(parent);
         composite.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.MIDDLE));
         GridLayout gl = new GridLayout(2, false);
@@ -265,13 +265,13 @@
         // Fixes missing text borders under GTK... also requires adding a 1-pixel margin
         // for the text field below
         toolkit.paintBordersFor(composite);
-        
+
         final Text text = toolkit.createText(composite, getCurrentValue());
         GridData gd = new GridData(GridData.FILL_HORIZONTAL);
         gd.horizontalIndent = 1;  // Needed by the fixed composite borders under GTK
         text.setLayoutData(gd);
         Button browseButton = toolkit.createButton(composite, "Browse...", SWT.PUSH);
-        
+
         setTextWidget(text);
 
         browseButton.addSelectionListener(new SelectionAdapter() {
@@ -282,9 +282,9 @@
             }
         });
     }
-    
+
     /* (non-java doc)
-     * 
+     *
      * Add a modify listener that will check the validity of the class
      */
     @Override
@@ -305,12 +305,12 @@
                     String javaPackage = getManifestPackage();
 
                     // build the fully qualified name of the class
-                    String className = AndroidManifestParser.combinePackageAndClassName(
+                    String className = AndroidManifest.combinePackageAndClassName(
                             javaPackage, textValue);
-                    
+
                     // only test the vilibility for activities.
                     boolean testVisibility = AndroidConstants.CLASS_ACTIVITY.equals(
-                            mReferenceClass); 
+                            mReferenceClass);
 
                     // test the class
                     setErrorMessage(BaseProjectHelper.testClassForManifest(
@@ -339,11 +339,11 @@
 
     private void handleBrowseClick() {
         Text text = getTextWidget();
-        
+
         // we need to get the project of the manifest.
         IProject project = getProject();
         if (project != null) {
-            
+
             // Create a search scope including only the source folder of the current
             // project.
             IPackageFragmentRoot[] packageFragmentRoots = getPackageFragmentRoots(project,
@@ -365,7 +365,7 @@
                 if (dlg instanceof ITypeSelectionComponent) {
                     ((ITypeSelectionComponent)dlg).triggerSearch();
                 }
-                
+
                 if (dlg.open() == Window.OK) {
                     Object[] results = dlg.getResult();
                     if (results.length == 1) {
@@ -384,7 +384,7 @@
 
         // get the package name from the manifest.
         String packageName = getManifestPackage();
-        
+
         if (className.length() == 0) {
             createNewClass(packageName, null /* className */);
         } else {
@@ -398,10 +398,10 @@
                     fullClassName = packageName + "." + className; //$NON-NLS-1$
                 }
             }
-            
+
             // in case the type is enclosed, we need to replace the $ with .
             fullClassName = fullClassName.replaceAll("\\$", "\\."); //$NON-NLS-1$ //$NON-NLS2$
-            
+
             // now we try to find the file that contains this class and we open it in the editor.
             IProject project = getProject();
             IJavaProject javaProject = JavaCore.create(project);
@@ -427,7 +427,7 @@
             }
         }
     }
-    
+
     private IProject getProject() {
         UiElementNode uiNode = getUiParent();
         AndroidEditor editor = uiNode.getEditor();
@@ -437,7 +437,7 @@
             IFile file = ((IFileEditorInput)input).getFile();
             return file.getProject();
         }
-        
+
         return null;
     }
 
@@ -449,7 +449,7 @@
     private String getManifestPackage() {
         // get the root uiNode to get the 'package' attribute value.
         UiElementNode rootNode = getUiParent().getUiRoot();
-                  
+
         Element xmlElement = (Element) rootNode.getXmlNode();
 
         if (xmlElement != null) {
@@ -485,20 +485,20 @@
 
         return result.toArray(new IPackageFragmentRoot[result.size()]);
     }
-    
+
     private void handleNewType(IType type) {
         Text text = getTextWidget();
 
         // get the fully qualified name with $ to properly detect the enclosing types.
         String name = type.getFullyQualifiedName('$');
-        
+
         String packageValue = getManifestPackage();
-        
+
         // check if the class doesn't start with the package.
         if (packageValue.length() > 0 && name.startsWith(packageValue)) {
             // if it does, we remove the package and the first dot.
             name = name.substring(packageValue.length() + 1);
-            
+
             // look for how many segments we have left.
             // if one, just write it that way.
             // if more than one, write it with a leading dot.
@@ -512,14 +512,14 @@
             text.setText(name);
         }
     }
-    
+
     private void createNewClass(String packageName, String className) {
         // create the wizard page for the class creation, and configure it
         NewClassWizardPage page = new NewClassWizardPage();
-        
+
         // set the parent class
         page.setSuperClass(mReferenceClass, true /* canBeModified */);
-        
+
         // get the source folders as java elements.
         IPackageFragmentRoot[] roots = getPackageFragmentRoots(getProject(),
                 true /*include_containers*/);
@@ -527,7 +527,7 @@
         IPackageFragmentRoot currentRoot = null;
         IPackageFragment currentFragment = null;
         int packageMatchCount = -1;
-        
+
         for (IPackageFragmentRoot root : roots) {
             // Get the java element for the package.
             // This method is said to always return a IPackageFragment even if the
@@ -564,7 +564,7 @@
                 }
             }
         }
-        
+
         ArrayList<IPackageFragment> createdFragments = null;
 
         if (currentRoot != null) {
@@ -578,7 +578,7 @@
                 // know what to delete in case of a cancel.
                 try {
                     createdFragments = new ArrayList<IPackageFragment>();
-                    
+
                     int totalCount = packageName.split("\\.").length; //$NON-NLS-1$
                     int count = 0;
                     int index = -1;
@@ -587,7 +587,7 @@
                         index = packageName.indexOf('.', index+1);
                         count++;
                     }
-                    
+
                     // create the rest of the segments, except for the last one as indexOf will
                     // return -1;
                     while (count < totalCount - 1) {
@@ -597,11 +597,11 @@
                                 packageName.substring(0, index),
                                 true /* force*/, new NullProgressMonitor()));
                     }
-                    
+
                     // create the last package
                     createdFragments.add(currentRoot.createPackageFragment(
                             packageName, true /* force*/, new NullProgressMonitor()));
-                    
+
                     // set the root and fragment in the Wizard page
                     page.setPackageFragmentRoot(currentRoot, true /* canBeModified*/);
                     page.setPackageFragment(createdFragments.get(createdFragments.size()-1),
@@ -626,27 +626,27 @@
             // if we haven't found a valid fragment, we set the root to the first source folder.
             page.setPackageFragmentRoot(roots[0], true /* canBeModified*/);
         }
-        
+
         // if we have a starting class name we use it
         if (className != null) {
             page.setTypeName(className, true /* canBeModified*/);
         }
-        
+
         // create the action that will open it the wizard.
         OpenNewClassWizardAction action = new OpenNewClassWizardAction();
         action.setConfiguredWizardPage(page);
         action.run();
         IJavaElement element = action.getCreatedElement();
-        
+
         if (element != null) {
             if (element.getElementType() == IJavaElement.TYPE) {
-                    
+
                 IType type = (IType)element;
-                
+
                 if (mPostCreationAction != null) {
                     mPostCreationAction.processNewType(type);
                 }
-                
+
                 handleNewType(type);
             }
         } else {
@@ -663,7 +663,7 @@
             }
         }
     }
-    
+
     /**
      * Sets the error messages. If message is <code>null</code>, the message is removed.
      * @param message the message to set, or <code>null</code> to remove the current message
@@ -679,7 +679,7 @@
             getManagedForm().getMessageManager().removeMessage(textWidget, textWidget);
         }
     }
-    
+
     @Override
     public String[] getPossibleValues(String prefix) {
         // TODO: compute a list of existing classes for content assist completion