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

ApplicationPage

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

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

Fields Summary
public static final String
PAGE_ID
Page id used for switching tabs programmatically
com.android.ide.eclipse.editors.manifest.ManifestEditor
mEditor
Container editor
private ApplicationToggle
mTooglePart
The Application Toogle part
private ApplicationAttributesPart
mAttrPart
The Application Attributes part
private com.android.ide.eclipse.editors.ui.tree.UiTreeBlock
mTreeBlock
The tree view block
Constructors Summary
public ApplicationPage(com.android.ide.eclipse.editors.manifest.ManifestEditor editor)


       
        super(editor, PAGE_ID, "Application"); // tab's label, keep it short
        mEditor = editor;
    
Methods Summary
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 Application");
        form.setImage(AdtPlugin.getAndroidLogo());

        UiElementNode appUiNode = getUiApplicationNode();

        Composite body = form.getBody();
        FormToolkit toolkit = managedForm.getToolkit();
        
        // We usually prefer to have a ColumnLayout here. However
        // MasterDetailsBlock.createContent() below will reset the body's layout to a grid layout.
        mTooglePart = new ApplicationToggle(body, toolkit, mEditor, appUiNode);
        mTooglePart.getSection().setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
        managedForm.addPart(mTooglePart);
        mAttrPart = new ApplicationAttributesPart(body, toolkit, mEditor, appUiNode);
        mAttrPart.getSection().setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
        managedForm.addPart(mAttrPart);

        mTreeBlock = new UiTreeBlock(mEditor, appUiNode,
                false /* autoCreateRoot */,
                null /* element filters */,
                "Application Nodes",
                "List of all elements in the application");
        mTreeBlock.createContent(managedForm);
    
private com.android.ide.eclipse.editors.uimodel.UiElementNodegetUiApplicationNode()
Retrieves the application UI node. Since this is a mandatory node, it *always* exists, even if there is no matching XML node.

        AndroidManifestDescriptors manifestDescriptor = mEditor.getManifestDescriptors();
        if (manifestDescriptor != null) {
            ElementDescriptor desc = manifestDescriptor.getApplicationElement();
            return mEditor.getUiRootNode().findUiChildNode(desc.getXmlName());
        } else {
            // return the ui root node, as a dummy application root node.
            return mEditor.getUiRootNode();
        }
    
public voidrefreshUiApplicationNode()
Changes and refreshes the Application UI node handled by the sub parts.

        UiElementNode appUiNode = getUiApplicationNode();
        if (mTooglePart != null) {
            mTooglePart.setUiElementNode(appUiNode);
        }
        if (mAttrPart != null) {
            mAttrPart.setUiElementNode(appUiNode);
        }
        if (mTreeBlock != null) {
            mTreeBlock.changeRootAndDescriptors(appUiNode,
                    null /* element filters */,
                    true /* refresh */);
        }