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

OverviewLinksPart

public final class OverviewLinksPart extends com.android.ide.eclipse.editors.ui.SectionHelper.ManifestSectionPart
Links section part for overview page.

Fields Summary
private final com.android.ide.eclipse.editors.manifest.ManifestEditor
mEditor
private org.eclipse.ui.forms.widgets.FormText
mFormText
Constructors Summary
public OverviewLinksPart(org.eclipse.swt.widgets.Composite body, org.eclipse.ui.forms.widgets.FormToolkit toolkit, com.android.ide.eclipse.editors.manifest.ManifestEditor editor)

        super(body, toolkit, Section.TWISTIE | Section.EXPANDED, true /* description */);
        mEditor = editor;
        Section section = getSection();
        section.setText("Links");
        section.setDescription("The content of the Android Manifest is made up of three sections. You can also edit the XML directly.");

        Composite table = createTableLayout(toolkit, 2 /* numColumns */);
        
        StringBuffer buf = new StringBuffer();
        buf.append(String.format("<form><li style=\"image\" value=\"app_img\"><a href=\"page:%1$s\">", // $NON-NLS-1$
                ApplicationPage.PAGE_ID));
        buf.append("Application");
        buf.append("</a>");  //$NON-NLS-1$
        buf.append(": Activities, intent filters, providers, services and receivers.");
        buf.append("</li>"); //$NON-NLS-1$

        buf.append(String.format("<li style=\"image\" value=\"perm_img\"><a href=\"page:%1$s\">", // $NON-NLS-1$
                PermissionPage.PAGE_ID));
        buf.append("Permission");
        buf.append("</a>"); //$NON-NLS-1$
        buf.append(": Permissions defined and permissions used.");
        buf.append("</li>"); //$NON-NLS-1$

        buf.append(String.format("<li style=\"image\" value=\"inst_img\"><a href=\"page:%1$s\">", // $NON-NLS-1$
                InstrumentationPage.PAGE_ID));
        buf.append("Instrumentation");
        buf.append("</a>"); //$NON-NLS-1$
        buf.append(": Instrumentation defined.");
        buf.append("</li>"); //$NON-NLS-1$

        buf.append(String.format("<li style=\"image\" value=\"android_img\"><a href=\"page:%1$s\">", // $NON-NLS-1$
                ManifestEditor.TEXT_EDITOR_ID));
        buf.append("XML Source");
        buf.append("</a>"); //$NON-NLS-1$
        buf.append(": Directly edit the AndroidManifest.xml file.");
        buf.append("</li>"); //$NON-NLS-1$

        buf.append("<li style=\"image\" value=\"android_img\">"); // $NON-NLS-1$
        buf.append("<a href=\"http://code.google.com/android/devel/bblocks-manifest.html\">Documentation</a>: Documentation from the Android SDK for AndroidManifest.xml."); // $NON-NLS-1$
        buf.append("</li>"); //$NON-NLS-1$
        buf.append("</form>"); //$NON-NLS-1$

        mFormText = createFormText(table, toolkit, true, buf.toString(),
                false /* setupLayoutData */);
        
        AndroidManifestDescriptors manifestDescriptor = editor.getManifestDescriptors();

        Image androidLogo = AdtPlugin.getAndroidLogo();
        mFormText.setImage("android_img", androidLogo); //$NON-NLS-1$
        
        if (manifestDescriptor != null) {
            mFormText.setImage("app_img", getIcon(manifestDescriptor.getApplicationElement())); //$NON-NLS-1$
            mFormText.setImage("perm_img", getIcon(manifestDescriptor.getPermissionElement())); //$NON-NLS-1$
            mFormText.setImage("inst_img", getIcon(manifestDescriptor.getInstrumentationElement())); //$NON-NLS-1$
        } else {
            mFormText.setImage("app_img", androidLogo); //$NON-NLS-1$
            mFormText.setImage("perm_img", androidLogo); //$NON-NLS-1$
            mFormText.setImage("inst_img", androidLogo); //$NON-NLS-1$
        }
        mFormText.addHyperlinkListener(editor.createHyperlinkListener());
    
Methods Summary
private org.eclipse.swt.graphics.ImagegetIcon(com.android.ide.eclipse.editors.descriptors.ElementDescriptor desc)

        if (desc != null && desc.getIcon() != null) {
            return desc.getIcon();
        }
        
        return AdtPlugin.getAndroidLogo();
    
public voidonSdkChanged()
Update the UI with information from the new descriptors.

At this point, this only refreshes the icons.

This is called by {@link OverviewPage#refreshUiApplicationNode()} when the SDK has changed.

        AndroidManifestDescriptors manifestDescriptor = mEditor.getManifestDescriptors();
        if (manifestDescriptor != null) {
            mFormText.setImage("app_img", getIcon(manifestDescriptor.getApplicationElement())); //$NON-NLS-1$
            mFormText.setImage("perm_img", getIcon(manifestDescriptor.getPermissionElement())); //$NON-NLS-1$
            mFormText.setImage("inst_img", getIcon(manifestDescriptor.getInstrumentationElement())); //$NON-NLS-1$
        }