Methods Summary |
---|
protected void | createFormPages()Create the various form pages.
try {
addPage(new MenuTreePage(this));
} catch (PartInitException e) {
AdtPlugin.log(e, "Error creating nested page"); //$NON-NLS-1$
}
|
public com.android.ide.eclipse.editors.uimodel.UiElementNode | getUiRootNode()Returns the root node of the UI element hierarchy, which here is
the "menu" node.
return mUiRootNode;
|
protected void | initUiRootNode(boolean force)Creates the initial UI Root Node, including the known mandatory elements.
// The root UI node is always created, even if there's no corresponding XML node.
if (mUiRootNode == null || force) {
Document doc = null;
if (mUiRootNode != null) {
doc = mUiRootNode.getXmlDocument();
}
// get the target data from the opened file (and its project)
AndroidTargetData data = getTargetData();
ElementDescriptor desc;
if (data == null) {
desc = new ElementDescriptor("temp", null /*children*/);
} else {
desc = data.getMenuDescriptors().getDescriptor();
}
mUiRootNode = desc.createUiNode();
mUiRootNode.setEditor(this);
onDescriptorsChanged(doc);
}
|
public boolean | isSaveAsAllowed()Returns whether the "save as" operation is supported by this editor.
Save-As is a valid operation for the ManifestEditor since it acts on a
single source file.
return true;
|
private void | onDescriptorsChanged(org.w3c.dom.Document document)Reloads the UI manifest node from the XML, and calls the pages to update.
if (document != null) {
mUiRootNode.loadFromXmlNode(document);
} else {
mUiRootNode.reloadFromXmlNode(mUiRootNode.getXmlNode());
}
|
protected void | setInput(org.eclipse.ui.IEditorInput input)
super.setInput(input);
if (input instanceof FileEditorInput) {
FileEditorInput fileInput = (FileEditorInput) input;
IFile file = fileInput.getFile();
setPartName(String.format("%1$s", file.getName()));
}
|
protected void | xmlModelChanged(org.w3c.dom.Document xml_doc)Processes the new XML Model, which XML root node is given.
// init the ui root on demand
initUiRootNode(false /*force*/);
mUiRootNode.setXmlDocument(xml_doc);
if (xml_doc != null) {
ElementDescriptor root_desc = mUiRootNode.getDescriptor();
try {
XPath xpath = AndroidXPathFactory.newXPath();
Node node = (Node) xpath.evaluate("/" + root_desc.getXmlName(), //$NON-NLS-1$
xml_doc,
XPathConstants.NODE);
if (node == null && root_desc.isMandatory()) {
// Create the root element if it doesn't exist yet (for empty new documents)
node = mUiRootNode.createXmlNode();
}
// Refresh the manifest UI node and all its descendants
mUiRootNode.loadFromXmlNode(node);
// TODO ? startMonitoringMarkers();
} catch (XPathExpressionException e) {
AdtPlugin.log(e, "XPath error when trying to find '%s' element in XML.", //$NON-NLS-1$
root_desc.getXmlName());
}
}
super.xmlModelChanged(xml_doc);
|