ApplicationTogglepublic final class ApplicationToggle extends com.android.ide.eclipse.editors.ui.UiElementPart Appllication Toogle section part for application page. |
Fields Summary |
---|
private org.eclipse.swt.widgets.Button | mCheckboxCheckbox indicating whether an application node is present | private AppNodeUpdateListener | mAppNodeUpdateListenerListen to changes to the UI node for and updates the checkbox | public boolean | mInternalModificationInternal flag to know where we're programmatically modifying the checkbox and we want to
avoid triggering the checkbox's callback. | private org.eclipse.ui.forms.widgets.FormText | mTooltipFormText |
Methods Summary |
---|
protected void | createFormControls(org.eclipse.ui.forms.IManagedForm managedForm)Create the controls to edit the attributes for the given ElementDescriptor.
This MUST not be called by the constructor. Instead it must be called from
initialize (i.e. right after the form part is added to the managed form.)
FormToolkit toolkit = managedForm.getToolkit();
Composite table = createTableLayout(toolkit, 1 /* numColumns */);
mTooltipFormText = createFormText(table, toolkit, true, "<form></form>",
false /* setupLayoutData */);
updateTooltip();
mCheckbox = toolkit.createButton(table,
"Define an <application> tag in the AndroidManifest.xml",
SWT.CHECK);
mCheckbox.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP));
mCheckbox.setSelection(false);
mCheckbox.addSelectionListener(new CheckboxSelectionListener());
mAppNodeUpdateListener = new AppNodeUpdateListener();
getUiElementNode().addUpdateListener(mAppNodeUpdateListener);
// Initialize the state of the checkbox
mAppNodeUpdateListener.uiElementNodeUpdated(getUiElementNode(),
UiUpdateState.CHILDREN_CHANGED);
// Tell the section that the layout has changed.
layoutChanged();
| public void | dispose()
super.dispose();
if (getUiElementNode() != null && mAppNodeUpdateListener != null) {
getUiElementNode().removeUpdateListener(mAppNodeUpdateListener);
mAppNodeUpdateListener = null;
}
| public void | setUiElementNode(com.android.ide.eclipse.editors.uimodel.UiElementNode uiElementNode)Changes and refreshes the Application UI node handle by the this part.
super.setUiElementNode(uiElementNode);
updateTooltip();
// Set the state of the checkbox
mAppNodeUpdateListener.uiElementNodeUpdated(getUiElementNode(),
UiUpdateState.CHILDREN_CHANGED);
| private void | updateTooltip()Updates the application tooltip in the form text.
If there is no tooltip, the form text is hidden.
boolean isVisible = false;
String tooltip = getUiElementNode().getDescriptor().getTooltip();
if (tooltip != null) {
tooltip = DescriptorsUtils.formatFormText(tooltip,
getUiElementNode().getDescriptor(),
Sdk.getCurrent().getDocumentationBaseUrl());
mTooltipFormText.setText(tooltip, true /* parseTags */, true /* expandURLs */);
mTooltipFormText.setImage(DescriptorsUtils.IMAGE_KEY, AdtPlugin.getAndroidLogo());
mTooltipFormText.addHyperlinkListener(getEditor().createHyperlinkListener());
isVisible = true;
}
mTooltipFormText.setVisible(isVisible);
|
|