FileDocCategorySizeDatePackage
OverviewPage.javaAPI DocAndroid 1.5 API6147Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.editors.manifest.pages

OverviewPage

public final class OverviewPage extends org.eclipse.ui.forms.editor.FormPage
Page for overview settings, part of the AndroidManifest form editor.

Useful reference: http://www.eclipse.org/articles/Article-Forms/article.html

Fields Summary
static final String
PAGE_ID
Page id used for switching tabs programmatically
com.android.ide.eclipse.editors.manifest.ManifestEditor
mEditor
Container editor
private OverviewInfoPart
mOverviewPart
Overview part (attributes for manifest)
private OverviewLinksPart
mOverviewLinkPart
Overview link part
private com.android.ide.eclipse.editors.ui.tree.UiTreeBlock
mTreeBlock
Constructors Summary
public OverviewPage(com.android.ide.eclipse.editors.manifest.ManifestEditor editor)

    
       
        super(editor, PAGE_ID, "Manifest");  // tab's label, user visible, keep it short
        mEditor = editor;
    
Methods Summary
private com.android.ide.eclipse.editors.descriptors.ElementDescriptor[]computeManifestExtraFilters()

        UiElementNode manifest = mEditor.getUiRootNode();
        AndroidManifestDescriptors manifestDescriptor = mEditor.getManifestDescriptors();

        if (manifestDescriptor == null) {
            return null;
        }

        // get the elements we want to exclude
        HashSet<ElementDescriptor> excludes = new HashSet<ElementDescriptor>();
        excludes.add(manifestDescriptor.getApplicationElement());
        excludes.add(manifestDescriptor.getInstrumentationElement());
        excludes.add(manifestDescriptor.getPermissionElement());
        excludes.add(manifestDescriptor.getPermissionGroupElement());
        excludes.add(manifestDescriptor.getPermissionTreeElement());
        excludes.add(manifestDescriptor.getUsesPermissionElement());

        // walk through the known children of the manifest descriptor and keep what's not excluded
        ArrayList<ElementDescriptor> descriptorFilters = new ArrayList<ElementDescriptor>();
        for (ElementDescriptor child : manifest.getDescriptor().getChildren()) {
            if (!excludes.contains(child)) {
                descriptorFilters.add(child);
            }
        }

        if (descriptorFilters.size() == 0) {
            return null;
        }
        return descriptorFilters.toArray(new ElementDescriptor[descriptorFilters.size()]);
    
protected voidcreateFormContent(org.eclipse.ui.forms.IManagedForm managedForm)
Creates the content in the form hosted in this page.

param
managedForm the form hosted in this page.

        super.createFormContent(managedForm);
        ScrolledForm form = managedForm.getForm();
        form.setText("Android Manifest");
        form.setImage(AdtPlugin.getAndroidLogo());
        
        Composite body = form.getBody();
        FormToolkit toolkit = managedForm.getToolkit();
        
        // Usually we would set a ColumnLayout on body here. However the presence of the
        // UiTreeBlock forces a GridLayout with one column so we comply with it.

        mOverviewPart = new OverviewInfoPart(body, toolkit, mEditor);
        mOverviewPart.getSection().setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
        managedForm.addPart(mOverviewPart);
        
        newManifestExtrasPart(managedForm);
        
        OverviewExportPart exportPart = new OverviewExportPart(this, body, toolkit, mEditor);
        exportPart.getSection().setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
        managedForm.addPart(exportPart);
        
        mOverviewLinkPart = new OverviewLinksPart(body, toolkit, mEditor);
        mOverviewLinkPart.getSection().setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
        managedForm.addPart(mOverviewLinkPart);
    
private voidnewManifestExtrasPart(org.eclipse.ui.forms.IManagedForm managedForm)

        UiElementNode manifest = mEditor.getUiRootNode();
        mTreeBlock = new UiTreeBlock(mEditor, manifest,
                true /* autoCreateRoot */,
                computeManifestExtraFilters(),
                "Manifest Extras",
                "Extra manifest elements");
        mTreeBlock.createContent(managedForm);
    
public voidrefreshUiApplicationNode()
Changes and refreshes the Application UI node handle by the sub parts.

        if (mOverviewPart != null) {
            mOverviewPart.onSdkChanged();
        }
        
        if (mOverviewLinkPart != null) {
            mOverviewLinkPart.onSdkChanged();
        }

        if (mTreeBlock != null) {
            UiElementNode manifest = mEditor.getUiRootNode();
            mTreeBlock.changeRootAndDescriptors(manifest,
                    computeManifestExtraFilters(),
                    true /* refresh */);
        }