diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/pages/OverviewInfoPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/pages/OverviewInfoPart.java index 026b760cc..cab7f7306 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/pages/OverviewInfoPart.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/pages/OverviewInfoPart.java @@ -20,17 +20,16 @@ import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.editors.manifest.ManifestEditor; import com.android.ide.eclipse.editors.manifest.descriptors.AndroidManifestDescriptors; import com.android.ide.eclipse.editors.ui.UiElementPart; -import com.android.ide.eclipse.editors.uimodel.UiAttributeNode; import com.android.ide.eclipse.editors.uimodel.UiElementNode; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.forms.IManagedForm; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; -import org.w3c.dom.Node; /** - * Generic info section part for overview page + * Generic info section part for overview page: it displays all the attributes from + * the manifest element. */ final class OverviewInfoPart extends UiElementPart { @@ -38,8 +37,8 @@ final class OverviewInfoPart extends UiElementPart { public OverviewInfoPart(Composite body, FormToolkit toolkit, ManifestEditor editor) { super(body, toolkit, editor, - null, // uiElementNode - "General Information", // section title + getManifestUiNode(editor), // uiElementNode + "Manifest General Attributes", // section title "Defines general information about the AndroidManifest.xml", // section description Section.TWISTIE | Section.EXPANDED); } @@ -64,22 +63,6 @@ final class OverviewInfoPart extends UiElementPart { return editor.getUiRootNode(); } - /** - * Retrieves the uses-sdk UI node. Since this is a mandatory node, it *always* - * exists, even if there is no matching XML node. - */ - private UiElementNode getUsesSdkUiNode(ManifestEditor editor) { - AndroidManifestDescriptors manifestDescriptors = editor.getManifestDescriptors(); - if (manifestDescriptors != null) { - ElementDescriptor desc = manifestDescriptors.getUsesSdkElement(); - return editor.getUiRootNode().findUiChildNode(desc.getXmlName()); - } - - // No manifest descriptor: we have a dummy UiRootNode, so we return that. - // The editor will be reloaded once we have the proper descriptors anyway. - return editor.getUiRootNode(); - } - /** * Overridden in order to capture the current managed form. * @@ -98,125 +81,7 @@ final class OverviewInfoPart extends UiElementPart { * SDK has changed. */ public void onSdkChanged() { + setUiElementNode(getManifestUiNode(getEditor())); createUiAttributes(mManagedForm); } - - /** - * Overridden to add the description and the ui attributes of both the - * manifest and uses-sdk UI nodes. - *
- * {@inheritDoc} - */ - @Override - protected void fillTable(Composite table, IManagedForm managedForm) { - int n = 0; - - UiElementNode uiNode = getManifestUiNode(getEditor()); - n += insertUiAttributes(uiNode, table, managedForm); - - uiNode = getUsesSdkUiNode(getEditor()); - n += insertUiAttributes(uiNode, table, managedForm); - - if (n == 0) { - createLabel(table, managedForm.getToolkit(), - "No attributes to display, waiting for SDK to finish loading...", - null /* tooltip */ ); - } - - layoutChanged(); - } - - /** - * Overridden to tests whether either the manifest or uses-sdk nodes parts are dirty. - * - * {@inheritDoc} - * - * @returntrue if the part is dirty, false
- * otherwise.
- */
- @Override
- public boolean isDirty() {
- boolean dirty = super.isDirty();
-
- if (!dirty) {
- UiElementNode uiNode = getManifestUiNode(getEditor());
- if (uiNode != null) {
- for (UiAttributeNode ui_attr : uiNode.getUiAttributes()) {
- if (ui_attr.isDirty()) {
- markDirty();
- dirty = true;
- break;
- }
- }
- }
- }
-
- if (!dirty) {
- UiElementNode uiNode = getUsesSdkUiNode(getEditor());
- if (uiNode != null) {
- for (UiAttributeNode ui_attr : uiNode.getUiAttributes()) {
- if (ui_attr.isDirty()) {
- markDirty();
- dirty = true;
- break;
- }
- }
- }
- }
-
- return dirty;
- }
-
- /**
- * Overridden to save both the manifest or uses-sdk nodes.
- *
- * {@inheritDoc}
- */
- @Override
- public void commit(boolean onSave) {
- final UiElementNode manifestUiNode = getManifestUiNode(getEditor());
- final UiElementNode usesSdkUiNode = getUsesSdkUiNode(getEditor());
-
- getEditor().editXmlModel(new Runnable() {
- public void run() {
- if (manifestUiNode != null && manifestUiNode.isDirty()) {
- for (UiAttributeNode ui_attr : manifestUiNode.getUiAttributes()) {
- ui_attr.commit();
- }
- }
-
- if (usesSdkUiNode != null && usesSdkUiNode.isDirty()) {
- for (UiAttributeNode ui_attr : usesSdkUiNode.getUiAttributes()) {
- ui_attr.commit();
- }
-
- if (!usesSdkUiNode.isDirty()) {
- // Remove the