am b1e9793d: ADT GLE: change error display to a separate sash.
Merge commit 'b1e9793d6620ef973552f4d8672578f1276d68c2' into eclair-plus-aosp * commit 'b1e9793d6620ef973552f4d8672578f1276d68c2': ADT GLE: change error display to a separate sash.
This commit is contained in:
@@ -58,12 +58,12 @@ import org.eclipse.gef.ui.parts.SelectionSynchronizer;
|
|||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.SashForm;
|
import org.eclipse.swt.custom.SashForm;
|
||||||
import org.eclipse.swt.custom.StackLayout;
|
import org.eclipse.swt.custom.StyledText;
|
||||||
import org.eclipse.swt.dnd.Clipboard;
|
import org.eclipse.swt.dnd.Clipboard;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.ui.IEditorInput;
|
import org.eclipse.ui.IEditorInput;
|
||||||
import org.eclipse.ui.IEditorSite;
|
import org.eclipse.ui.IEditorSite;
|
||||||
import org.eclipse.ui.PartInitException;
|
import org.eclipse.ui.PartInitException;
|
||||||
@@ -112,7 +112,8 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
private ConfigurationComposite mConfigComposite;
|
private ConfigurationComposite mConfigComposite;
|
||||||
|
|
||||||
/** The sash that splits the palette from the canvas. */
|
/** The sash that splits the palette from the canvas. */
|
||||||
private SashForm mSash;
|
private SashForm mSashPalette;
|
||||||
|
private SashForm mSashError;
|
||||||
|
|
||||||
/** The palette displayed on the left of the sash. */
|
/** The palette displayed on the left of the sash. */
|
||||||
private PaletteComposite mPalette;
|
private PaletteComposite mPalette;
|
||||||
@@ -120,6 +121,8 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
/** The layout canvas displayed o the right of the sash. */
|
/** The layout canvas displayed o the right of the sash. */
|
||||||
private LayoutCanvas mLayoutCanvas;
|
private LayoutCanvas mLayoutCanvas;
|
||||||
|
|
||||||
|
private StyledText mErrorLabel;
|
||||||
|
|
||||||
/** The {@link FolderConfiguration} being edited. */
|
/** The {@link FolderConfiguration} being edited. */
|
||||||
private FolderConfiguration mEditedConfig;
|
private FolderConfiguration mEditedConfig;
|
||||||
|
|
||||||
@@ -135,14 +138,9 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
|
|
||||||
private ConfigListener mConfigListener;
|
private ConfigListener mConfigListener;
|
||||||
|
|
||||||
private Composite mCanvasOrErrorStack;
|
|
||||||
|
|
||||||
private StackLayout mCanvasOrErrorStackLayout;
|
|
||||||
|
|
||||||
private Label mErrorLabel;
|
|
||||||
|
|
||||||
private ReloadListener mReloadListener;
|
private ReloadListener mReloadListener;
|
||||||
|
|
||||||
|
|
||||||
public GraphicalEditorPart(LayoutEditor layoutEditor) {
|
public GraphicalEditorPart(LayoutEditor layoutEditor) {
|
||||||
mLayoutEditor = layoutEditor;
|
mLayoutEditor = layoutEditor;
|
||||||
setPartName("Graphical Layout");
|
setPartName("Graphical Layout");
|
||||||
@@ -202,7 +200,8 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
@Override
|
@Override
|
||||||
public void createPartControl(Composite parent) {
|
public void createPartControl(Composite parent) {
|
||||||
|
|
||||||
mClipboard = new Clipboard(parent.getDisplay());
|
Display d = parent.getDisplay();
|
||||||
|
mClipboard = new Clipboard(d);
|
||||||
|
|
||||||
GridLayout gl = new GridLayout(1, false);
|
GridLayout gl = new GridLayout(1, false);
|
||||||
parent.setLayout(gl);
|
parent.setLayout(gl);
|
||||||
@@ -213,33 +212,28 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
mConfigComposite = new ConfigurationComposite(mConfigListener, parent, SWT.BORDER);
|
mConfigComposite = new ConfigurationComposite(mConfigListener, parent, SWT.BORDER);
|
||||||
mConfigComposite.updateUIFromResources();
|
mConfigComposite.updateUIFromResources();
|
||||||
|
|
||||||
mSash = new SashForm(parent, SWT.HORIZONTAL);
|
mSashPalette = new SashForm(parent, SWT.HORIZONTAL);
|
||||||
mSash.setLayoutData(new GridData(GridData.FILL_BOTH));
|
mSashPalette.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
|
||||||
mPalette = new PaletteComposite(mSash);
|
mPalette = new PaletteComposite(mSashPalette);
|
||||||
|
|
||||||
mCanvasOrErrorStack = new Composite(mSash, SWT.NONE);
|
mSashError = new SashForm(mSashPalette, SWT.VERTICAL | SWT.BORDER);
|
||||||
mCanvasOrErrorStackLayout = new StackLayout();
|
mSashError.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
mCanvasOrErrorStack.setLayout(mCanvasOrErrorStackLayout);
|
|
||||||
|
|
||||||
mLayoutCanvas = new LayoutCanvas(mCanvasOrErrorStack);
|
mLayoutCanvas = new LayoutCanvas(mSashError, SWT.NONE);
|
||||||
mErrorLabel = new Label(mCanvasOrErrorStack, SWT.NONE);
|
mErrorLabel = new StyledText(mSashError, SWT.READ_ONLY);
|
||||||
mCanvasOrErrorStackLayout.topControl = mLayoutCanvas;
|
mErrorLabel.setEditable(false);
|
||||||
|
mErrorLabel.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
||||||
|
mErrorLabel.setForeground(d.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||||
|
|
||||||
mSash.setWeights(new int[] { 20, 80 });
|
mSashPalette.setWeights(new int[] { 20, 80 });
|
||||||
|
mSashError.setWeights(new int[] { 80, 20 });
|
||||||
|
mSashError.setMaximizedControl(mLayoutCanvas);
|
||||||
|
|
||||||
// Initialize the state
|
// Initialize the state
|
||||||
reloadPalette();
|
reloadPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Switches the stack to display the canvas and hide the error label. */
|
|
||||||
private void displayCanvas() {
|
|
||||||
if (mCanvasOrErrorStackLayout.topControl != mLayoutCanvas) {
|
|
||||||
mCanvasOrErrorStackLayout.topControl = mLayoutCanvas;
|
|
||||||
mCanvasOrErrorStack.layout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switches the stack to display the error label and hide the canvas.
|
* Switches the stack to display the error label and hide the canvas.
|
||||||
* @param errorFormat The new error to display if not null.
|
* @param errorFormat The new error to display if not null.
|
||||||
@@ -249,10 +243,12 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
if (errorFormat != null) {
|
if (errorFormat != null) {
|
||||||
mErrorLabel.setText(String.format(errorFormat, parameters));
|
mErrorLabel.setText(String.format(errorFormat, parameters));
|
||||||
}
|
}
|
||||||
if (mCanvasOrErrorStackLayout.topControl != mErrorLabel) {
|
mSashError.setMaximizedControl(null);
|
||||||
mCanvasOrErrorStackLayout.topControl = mErrorLabel;
|
}
|
||||||
mCanvasOrErrorStack.layout();
|
|
||||||
}
|
/** Displays the canvas and hides the error label. */
|
||||||
|
private void hideError() {
|
||||||
|
mSashError.setMaximizedControl(mLayoutCanvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -275,6 +271,10 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listens to changes from the Configuration UI banner and triggers layout rendering when
|
||||||
|
* changed. Also provide the Configuration UI with the list of resources/layout to display.
|
||||||
|
*/
|
||||||
private class ConfigListener implements IConfigListener {
|
private class ConfigListener implements IConfigListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -542,6 +542,9 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listens to target changed in the current project, to trigger a new layout rendering.
|
||||||
|
*/
|
||||||
private class TargetListener implements ITargetChangeListener {
|
private class TargetListener implements ITargetChangeListener {
|
||||||
|
|
||||||
public void onProjectTargetChange(IProject changedProject) {
|
public void onProjectTargetChange(IProject changedProject) {
|
||||||
@@ -861,19 +864,13 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
configuredProjectRes, frameworkResources, mProjectCallback,
|
configuredProjectRes, frameworkResources, mProjectCallback,
|
||||||
mLogger);
|
mLogger);
|
||||||
|
|
||||||
|
mLayoutCanvas.setResult(result);
|
||||||
|
|
||||||
// update the UiElementNode with the layout info.
|
// update the UiElementNode with the layout info.
|
||||||
if (result.getSuccess() == ILayoutResult.SUCCESS) {
|
if (result.getSuccess() == ILayoutResult.SUCCESS) {
|
||||||
|
hideError();
|
||||||
// Update the image and make sure we're displaying the canvas.
|
|
||||||
mLayoutCanvas.setImage(result.getImage());
|
|
||||||
displayCanvas();
|
|
||||||
|
|
||||||
updateNodeWithBounds(result.getRootView());
|
|
||||||
} else {
|
} else {
|
||||||
displayError(result.getErrorMessage());
|
displayError(result.getErrorMessage());
|
||||||
|
|
||||||
// Reset the edit data for all the nodes.
|
|
||||||
resetNodeBounds(model);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model.refreshUi();
|
model.refreshUi();
|
||||||
@@ -957,6 +954,7 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
return mConfigComposite.getScreenBounds();
|
return mConfigComposite.getScreenBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @deprecated for GLE2 */
|
||||||
private void resetNodeBounds(UiElementNode node) {
|
private void resetNodeBounds(UiElementNode node) {
|
||||||
node.setEditData(null);
|
node.setEditData(null);
|
||||||
|
|
||||||
@@ -966,6 +964,7 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @deprecated for GLE2 */
|
||||||
private void updateNodeWithBounds(ILayoutViewInfo r) {
|
private void updateNodeWithBounds(ILayoutViewInfo r) {
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
// update the node itself, as the viewKey is the XML node in this implementation.
|
// update the node itself, as the viewKey is the XML node in this implementation.
|
||||||
|
|||||||
@@ -16,11 +16,8 @@
|
|||||||
|
|
||||||
package com.android.ide.eclipse.adt.internal.editors.layout;
|
package com.android.ide.eclipse.adt.internal.editors.layout;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import com.android.layoutlib.api.ILayoutResult;
|
||||||
import java.awt.image.DataBufferInt;
|
|
||||||
import java.awt.image.Raster;
|
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.events.PaintEvent;
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
import org.eclipse.swt.events.PaintListener;
|
import org.eclipse.swt.events.PaintListener;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
@@ -30,6 +27,10 @@ import org.eclipse.swt.graphics.PaletteData;
|
|||||||
import org.eclipse.swt.widgets.Canvas;
|
import org.eclipse.swt.widgets.Canvas;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.DataBufferInt;
|
||||||
|
import java.awt.image.Raster;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the image rendered by the {@link GraphicalEditorPart} and handles
|
* Displays the image rendered by the {@link GraphicalEditorPart} and handles
|
||||||
* the interaction with the widgets.
|
* the interaction with the widgets.
|
||||||
@@ -50,8 +51,8 @@ public class LayoutCanvas extends Canvas {
|
|||||||
|
|
||||||
private Image mImage;
|
private Image mImage;
|
||||||
|
|
||||||
public LayoutCanvas(Composite parent) {
|
public LayoutCanvas(Composite parent, int style) {
|
||||||
super(parent, SWT.BORDER);
|
super(parent, style);
|
||||||
|
|
||||||
addPaintListener(new PaintListener() {
|
addPaintListener(new PaintListener() {
|
||||||
public void paintControl(PaintEvent e) {
|
public void paintControl(PaintEvent e) {
|
||||||
@@ -60,7 +61,13 @@ public class LayoutCanvas extends Canvas {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImage(BufferedImage awtImage) {
|
public void setResult(ILayoutResult result) {
|
||||||
|
if (result.getSuccess() == ILayoutResult.SUCCESS) {
|
||||||
|
setImage(result.getImage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setImage(BufferedImage awtImage) {
|
||||||
// Convert the AWT image into an SWT image.
|
// Convert the AWT image into an SWT image.
|
||||||
int width = awtImage.getWidth();
|
int width = awtImage.getWidth();
|
||||||
int height = awtImage.getHeight();
|
int height = awtImage.getHeight();
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ import java.util.Map.Entry;
|
|||||||
* an element is selected. The {@link AttributeDescriptor} are used property descriptors.
|
* an element is selected. The {@link AttributeDescriptor} are used property descriptors.
|
||||||
*/
|
*/
|
||||||
public class UiElementNode implements IPropertySource {
|
public class UiElementNode implements IPropertySource {
|
||||||
|
|
||||||
/** List of prefixes removed from android:id strings when creating short descriptions. */
|
/** List of prefixes removed from android:id strings when creating short descriptions. */
|
||||||
private static String[] ID_PREFIXES = {
|
private static String[] ID_PREFIXES = {
|
||||||
"@android:id/", //$NON-NLS-1$
|
"@android:id/", //$NON-NLS-1$
|
||||||
"@+id/", "@id/", "@+", "@" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
"@+id/", "@id/", "@+", "@" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
|
|
||||||
/** The element descriptor for the node. Always present, never null. */
|
/** The element descriptor for the node. Always present, never null. */
|
||||||
private ElementDescriptor mDescriptor;
|
private ElementDescriptor mDescriptor;
|
||||||
/** The parent element node in the UI model. It is null for a root element or until
|
/** The parent element node in the UI model. It is null for a root element or until
|
||||||
@@ -117,17 +117,17 @@ public class UiElementNode implements IPropertySource {
|
|||||||
private boolean mHasError;
|
private boolean mHasError;
|
||||||
/** Temporary data used by the editors. This data is not sync'ed with the XML */
|
/** Temporary data used by the editors. This data is not sync'ed with the XML */
|
||||||
private Object mEditData;
|
private Object mEditData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link UiElementNode} described by a given {@link ElementDescriptor}.
|
* Creates a new {@link UiElementNode} described by a given {@link ElementDescriptor}.
|
||||||
*
|
*
|
||||||
* @param elementDescriptor The {@link ElementDescriptor} for the XML node. Cannot be null.
|
* @param elementDescriptor The {@link ElementDescriptor} for the XML node. Cannot be null.
|
||||||
*/
|
*/
|
||||||
public UiElementNode(ElementDescriptor elementDescriptor) {
|
public UiElementNode(ElementDescriptor elementDescriptor) {
|
||||||
mDescriptor = elementDescriptor;
|
mDescriptor = elementDescriptor;
|
||||||
clearContent();
|
clearContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the {@link UiElementNode} by resetting the children list and
|
* Clears the {@link UiElementNode} by resetting the children list and
|
||||||
* the {@link UiAttributeNode}s list.
|
* the {@link UiAttributeNode}s list.
|
||||||
@@ -168,7 +168,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* When the descriptor derives from ViewElementDescriptor, this list depends on the
|
* When the descriptor derives from ViewElementDescriptor, this list depends on the
|
||||||
* current UiParent node.
|
* current UiParent node.
|
||||||
*
|
*
|
||||||
* @return A new set of {@link UiAttributeNode} that matches the expected
|
* @return A new set of {@link UiAttributeNode} that matches the expected
|
||||||
* attributes for this node.
|
* attributes for this node.
|
||||||
*/
|
*/
|
||||||
@@ -190,7 +190,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* Computes a short string describing the UI node suitable for tree views.
|
* Computes a short string describing the UI node suitable for tree views.
|
||||||
* Uses the element's attribute "android:name" if present, or the "android:label" one
|
* Uses the element's attribute "android:name" if present, or the "android:label" one
|
||||||
* followed by the element's name.
|
* followed by the element's name.
|
||||||
*
|
*
|
||||||
* @return A short string describing the UI node suitable for tree views.
|
* @return A short string describing the UI node suitable for tree views.
|
||||||
*/
|
*/
|
||||||
public String getShortDescription() {
|
public String getShortDescription() {
|
||||||
@@ -200,7 +200,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
// so we don't bother trying to differentiate their strings and we fall back to
|
// so we don't bother trying to differentiate their strings and we fall back to
|
||||||
// just using the UI name below.
|
// just using the UI name below.
|
||||||
Element elem = (Element) mXmlNode;
|
Element elem = (Element) mXmlNode;
|
||||||
|
|
||||||
String attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES,
|
String attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES,
|
||||||
AndroidManifestDescriptors.ANDROID_NAME_ATTR);
|
AndroidManifestDescriptors.ANDROID_NAME_ATTR);
|
||||||
if (attr == null || attr.length() == 0) {
|
if (attr == null || attr.length() == 0) {
|
||||||
@@ -234,11 +234,11 @@ public class UiElementNode implements IPropertySource {
|
|||||||
|
|
||||||
return String.format("%1$s", mDescriptor.getUiName());
|
return String.format("%1$s", mDescriptor.getUiName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes a "breadcrumb trail" description for this node.
|
* Computes a "breadcrumb trail" description for this node.
|
||||||
* It will look something like "Manifest > Application > .myactivity (Activity) > Intent-Filter"
|
* It will look something like "Manifest > Application > .myactivity (Activity) > Intent-Filter"
|
||||||
*
|
*
|
||||||
* @param include_root Whether to include the root (e.g. "Manifest") or not. Has no effect
|
* @param include_root Whether to include the root (e.g. "Manifest") or not. Has no effect
|
||||||
* when called on the root node itself.
|
* when called on the root node itself.
|
||||||
* @return The "breadcrumb trail" description for this node.
|
* @return The "breadcrumb trail" description for this node.
|
||||||
@@ -254,15 +254,15 @@ public class UiElementNode implements IPropertySource {
|
|||||||
}
|
}
|
||||||
sb.insert(0, String.format("%1$s > ", ui_node.getShortDescription())); //$NON-NLS-1$
|
sb.insert(0, String.format("%1$s > ", ui_node.getShortDescription())); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the XML {@link Document}.
|
* Sets the XML {@link Document}.
|
||||||
* <p/>
|
* <p/>
|
||||||
* The XML {@link Document} is initially null. The XML {@link Document} must be set only on the
|
* The XML {@link Document} is initially null. The XML {@link Document} must be set only on the
|
||||||
* UI root element node (this method takes care of that.)
|
* UI root element node (this method takes care of that.)
|
||||||
*/
|
*/
|
||||||
public void setXmlDocument(Document xml_doc) {
|
public void setXmlDocument(Document xml_doc) {
|
||||||
if (mUiParent == null) {
|
if (mUiParent == null) {
|
||||||
@@ -277,7 +277,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* The value is initially null until the UI node is attached to its UI parent -- the value
|
* The value is initially null until the UI node is attached to its UI parent -- the value
|
||||||
* of the document is then propagated.
|
* of the document is then propagated.
|
||||||
*
|
*
|
||||||
* @return the XML {@link Document} or the parent's XML {@link Document} or null.
|
* @return the XML {@link Document} or the parent's XML {@link Document} or null.
|
||||||
*/
|
*/
|
||||||
public Document getXmlDocument() {
|
public Document getXmlDocument() {
|
||||||
@@ -295,7 +295,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* Some {@link ElementDescriptor} are declared as being "mandatory". This means the
|
* Some {@link ElementDescriptor} are declared as being "mandatory". This means the
|
||||||
* corresponding UI node will exist even if there is no corresponding XML node. Such structure
|
* corresponding UI node will exist even if there is no corresponding XML node. Such structure
|
||||||
* is created and enforced by the parent of the tree, not the element themselves. However
|
* is created and enforced by the parent of the tree, not the element themselves. However
|
||||||
* such nodes will likely not have an XML node associated, so getXmlNode() can return null.
|
* such nodes will likely not have an XML node associated, so getXmlNode() can return null.
|
||||||
*
|
*
|
||||||
* @return The associated XML node. Can be null for mandatory nodes.
|
* @return The associated XML node. Can be null for mandatory nodes.
|
||||||
*/
|
*/
|
||||||
@@ -317,7 +317,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* Returns the {@link AttributeDescriptor} array for the descriptor of this node.
|
* Returns the {@link AttributeDescriptor} array for the descriptor of this node.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Use this instead of getDescriptor().getAttributes() -- derived classes can override
|
* Use this instead of getDescriptor().getAttributes() -- derived classes can override
|
||||||
* this to manipulate the attribute descriptor list depending on the current UI node.
|
* this to manipulate the attribute descriptor list depending on the current UI node.
|
||||||
*/
|
*/
|
||||||
public AttributeDescriptor[] getAttributeDescriptors() {
|
public AttributeDescriptor[] getAttributeDescriptors() {
|
||||||
return mDescriptor.getAttributes();
|
return mDescriptor.getAttributes();
|
||||||
@@ -337,7 +337,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
for (AttributeDescriptor attr_desc : getAttributeDescriptors()) {
|
for (AttributeDescriptor attr_desc : getAttributeDescriptors()) {
|
||||||
if (attr_desc instanceof XmlnsAttributeDescriptor) {
|
if (attr_desc instanceof XmlnsAttributeDescriptor) {
|
||||||
mCachedHiddenAttributes.put(
|
mCachedHiddenAttributes.put(
|
||||||
((XmlnsAttributeDescriptor) attr_desc).getXmlNsName(),
|
((XmlnsAttributeDescriptor) attr_desc).getXmlNsName(),
|
||||||
attr_desc);
|
attr_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -362,7 +362,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
public UiElementNode getUiParent() {
|
public UiElementNode getUiParent() {
|
||||||
return mUiParent;
|
return mUiParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns The root {@link UiElementNode}.
|
* Returns The root {@link UiElementNode}.
|
||||||
*/
|
*/
|
||||||
@@ -371,13 +371,13 @@ public class UiElementNode implements IPropertySource {
|
|||||||
while (root.mUiParent != null) {
|
while (root.mUiParent != null) {
|
||||||
root = root.mUiParent;
|
root = root.mUiParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the previous UI sibling of this UI node.
|
* Returns the previous UI sibling of this UI node.
|
||||||
* If the node does not have a previous sibling, returns null.
|
* If the node does not have a previous sibling, returns null.
|
||||||
*/
|
*/
|
||||||
public UiElementNode getUiPreviousSibling() {
|
public UiElementNode getUiPreviousSibling() {
|
||||||
if (mUiParent != null) {
|
if (mUiParent != null) {
|
||||||
@@ -392,7 +392,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the next UI sibling of this UI node.
|
* Returns the next UI sibling of this UI node.
|
||||||
* If the node does not have a next sibling, returns null.
|
* If the node does not have a next sibling, returns null.
|
||||||
*/
|
*/
|
||||||
public UiElementNode getUiNextSibling() {
|
public UiElementNode getUiNextSibling() {
|
||||||
if (mUiParent != null) {
|
if (mUiParent != null) {
|
||||||
@@ -426,13 +426,13 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* The value is initially null until the node is attached to its parent -- the value
|
* The value is initially null until the node is attached to its parent -- the value
|
||||||
* of the root node is then propagated.
|
* of the root node is then propagated.
|
||||||
*
|
*
|
||||||
* @return The embedding {@link AndroidEditor} or null.
|
* @return The embedding {@link AndroidEditor} or null.
|
||||||
*/
|
*/
|
||||||
public AndroidEditor getEditor() {
|
public AndroidEditor getEditor() {
|
||||||
return mUiParent == null ? mEditor : mUiParent.getEditor();
|
return mUiParent == null ? mEditor : mUiParent.getEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Android target data for the file being edited.
|
* Returns the Android target data for the file being edited.
|
||||||
*/
|
*/
|
||||||
@@ -467,7 +467,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
public Collection<UiAttributeNode> getUnknownUiAttributes() {
|
public Collection<UiAttributeNode> getUnknownUiAttributes() {
|
||||||
return Collections.unmodifiableCollection(mUnknownUiAttributes);
|
return Collections.unmodifiableCollection(mUnknownUiAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the error flag value.
|
* Sets the error flag value.
|
||||||
* @param errorFlag the error flag
|
* @param errorFlag the error flag
|
||||||
@@ -475,7 +475,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
public final void setHasError(boolean errorFlag) {
|
public final void setHasError(boolean errorFlag) {
|
||||||
mHasError = errorFlag;
|
mHasError = errorFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this node, its attributes, or one of the children nodes (and attributes)
|
* Returns whether this node, its attributes, or one of the children nodes (and attributes)
|
||||||
* has errors.
|
* has errors.
|
||||||
@@ -530,7 +530,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* F.ex. "node1/node2" would find a child "node1" that contains a child "node2" and
|
* F.ex. "node1/node2" would find a child "node1" that contains a child "node2" and
|
||||||
* returns the latter. If there are multiple nodes with the same name at the same
|
* returns the latter. If there are multiple nodes with the same name at the same
|
||||||
* level, always uses the first one found.
|
* level, always uses the first one found.
|
||||||
*
|
*
|
||||||
* @param path The path like expression to select a child node.
|
* @param path The path like expression to select a child node.
|
||||||
* @return The ui node found or null.
|
* @return The ui node found or null.
|
||||||
*/
|
*/
|
||||||
@@ -556,7 +556,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/**
|
/**
|
||||||
* Finds an {@link UiElementNode} which contains the give XML {@link Node}.
|
* Finds an {@link UiElementNode} which contains the give XML {@link Node}.
|
||||||
* Looks recursively in all children UI nodes.
|
* Looks recursively in all children UI nodes.
|
||||||
*
|
*
|
||||||
* @param xmlNode The XML node to look for.
|
* @param xmlNode The XML node to look for.
|
||||||
* @return The {@link UiElementNode} that contains xmlNode or null if not found,
|
* @return The {@link UiElementNode} that contains xmlNode or null if not found,
|
||||||
*/
|
*/
|
||||||
@@ -567,21 +567,21 @@ public class UiElementNode implements IPropertySource {
|
|||||||
if (getXmlNode() == xmlNode) {
|
if (getXmlNode() == xmlNode) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (UiElementNode uiChild : mUiChildren) {
|
for (UiElementNode uiChild : mUiChildren) {
|
||||||
UiElementNode found = uiChild.findXmlNode(xmlNode);
|
UiElementNode found = uiChild.findXmlNode(xmlNode);
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link UiAttributeNode} matching this attribute descriptor or
|
* Returns the {@link UiAttributeNode} matching this attribute descriptor or
|
||||||
* null if not found.
|
* null if not found.
|
||||||
*
|
*
|
||||||
* @param attr_desc The {@link AttributeDescriptor} to match.
|
* @param attr_desc The {@link AttributeDescriptor} to match.
|
||||||
* @return the {@link UiAttributeNode} matching this attribute descriptor or null
|
* @return the {@link UiAttributeNode} matching this attribute descriptor or null
|
||||||
* if not found.
|
* if not found.
|
||||||
@@ -592,13 +592,13 @@ public class UiElementNode implements IPropertySource {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate this element node with all values from the given XML node.
|
* Populate this element node with all values from the given XML node.
|
||||||
*
|
*
|
||||||
* This fails if the given XML node has a different element name -- it won't change the
|
* This fails if the given XML node has a different element name -- it won't change the
|
||||||
* type of this ui node.
|
* type of this ui node.
|
||||||
*
|
*
|
||||||
* This method can be both used for populating values the first time and updating values
|
* This method can be both used for populating values the first time and updating values
|
||||||
* after the XML model changed.
|
* after the XML model changed.
|
||||||
*
|
*
|
||||||
* @param xml_node The XML node to mirror
|
* @param xml_node The XML node to mirror
|
||||||
* @return Returns true if the XML structure has changed (nodes added, removed or replaced)
|
* @return Returns true if the XML structure has changed (nodes added, removed or replaced)
|
||||||
*/
|
*/
|
||||||
@@ -623,7 +623,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* This is used in the special case where the ElementDescriptor structure has changed.
|
* This is used in the special case where the ElementDescriptor structure has changed.
|
||||||
* Rather than try to diff inflated UI nodes (as loadFromXmlNode does), we don't bother
|
* Rather than try to diff inflated UI nodes (as loadFromXmlNode does), we don't bother
|
||||||
* and reload everything. This is not subtle and should be used very rarely.
|
* and reload everything. This is not subtle and should be used very rarely.
|
||||||
*
|
*
|
||||||
* @param xml_node The XML node or document to reload. Can be null.
|
* @param xml_node The XML node or document to reload. Can be null.
|
||||||
*/
|
*/
|
||||||
public void reloadFromXmlNode(Node xml_node) {
|
public void reloadFromXmlNode(Node xml_node) {
|
||||||
@@ -648,7 +648,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* </br>
|
* </br>
|
||||||
* For non-mandatory nodes, simply return the underlying XML node, which
|
* For non-mandatory nodes, simply return the underlying XML node, which
|
||||||
* must always exists.
|
* must always exists.
|
||||||
*
|
*
|
||||||
* @return The XML node matching this {@link UiElementNode} or null.
|
* @return The XML node matching this {@link UiElementNode} or null.
|
||||||
*/
|
*/
|
||||||
public Node prepareCommit() {
|
public Node prepareCommit() {
|
||||||
@@ -669,7 +669,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
for (UiAttributeNode ui_attr : getInternalUiAttributes().values()) {
|
for (UiAttributeNode ui_attr : getInternalUiAttributes().values()) {
|
||||||
ui_attr.commit();
|
ui_attr.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (UiAttributeNode ui_attr : mUnknownUiAttributes) {
|
for (UiAttributeNode ui_attr : mUnknownUiAttributes) {
|
||||||
ui_attr.commit();
|
ui_attr.commit();
|
||||||
}
|
}
|
||||||
@@ -685,7 +685,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (UiAttributeNode ui_attr : mUnknownUiAttributes) {
|
for (UiAttributeNode ui_attr : mUnknownUiAttributes) {
|
||||||
if (ui_attr.isDirty()) {
|
if (ui_attr.isDirty()) {
|
||||||
return true;
|
return true;
|
||||||
@@ -698,7 +698,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/**
|
/**
|
||||||
* Creates the underlying XML element node for this UI node if it doesn't already
|
* Creates the underlying XML element node for this UI node if it doesn't already
|
||||||
* exists.
|
* exists.
|
||||||
*
|
*
|
||||||
* @return The new value of getXmlNode() (can be null if creation failed)
|
* @return The new value of getXmlNode() (can be null if creation failed)
|
||||||
*/
|
*/
|
||||||
public Node createXmlNode() {
|
public Node createXmlNode() {
|
||||||
@@ -732,7 +732,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mXmlNode = doc.createElement(element_name);
|
mXmlNode = doc.createElement(element_name);
|
||||||
|
|
||||||
Node xmlNextSibling = null;
|
Node xmlNextSibling = null;
|
||||||
|
|
||||||
UiElementNode uiNextSibling = getUiNextSibling();
|
UiElementNode uiNextSibling = getUiNextSibling();
|
||||||
@@ -746,7 +746,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
Text sep = doc.createTextNode("\n");
|
Text sep = doc.createTextNode("\n");
|
||||||
parentXmlNode.appendChild(sep);
|
parentXmlNode.appendChild(sep);
|
||||||
|
|
||||||
// Set all initial attributes in the XML node if they are not empty.
|
// Set all initial attributes in the XML node if they are not empty.
|
||||||
// Iterate on the descriptor list to get the desired order and then use the
|
// Iterate on the descriptor list to get the desired order and then use the
|
||||||
// internal values, if any.
|
// internal values, if any.
|
||||||
for (AttributeDescriptor attr_desc : getAttributeDescriptors()) {
|
for (AttributeDescriptor attr_desc : getAttributeDescriptors()) {
|
||||||
@@ -762,7 +762,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
commitAttributeToXml(ui_attr, ui_attr.getCurrentValue());
|
commitAttributeToXml(ui_attr, ui_attr.getCurrentValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
invokeUiUpdateListeners(UiUpdateState.CREATED);
|
invokeUiUpdateListeners(UiUpdateState.CREATED);
|
||||||
return mXmlNode;
|
return mXmlNode;
|
||||||
}
|
}
|
||||||
@@ -770,8 +770,8 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/**
|
/**
|
||||||
* Removes the XML node corresponding to this UI node if it exists
|
* Removes the XML node corresponding to this UI node if it exists
|
||||||
* and also removes all mirrored information in this UI node (i.e. children, attributes)
|
* and also removes all mirrored information in this UI node (i.e. children, attributes)
|
||||||
*
|
*
|
||||||
* @return The removed node or null if it didn't exist in the firtst place.
|
* @return The removed node or null if it didn't exist in the firtst place.
|
||||||
*/
|
*/
|
||||||
public Node deleteXmlNode() {
|
public Node deleteXmlNode() {
|
||||||
if (mXmlNode == null) {
|
if (mXmlNode == null) {
|
||||||
@@ -783,7 +783,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
// revisited via loadFromXmlNode).
|
// revisited via loadFromXmlNode).
|
||||||
Node old_xml_node = mXmlNode;
|
Node old_xml_node = mXmlNode;
|
||||||
clearContent();
|
clearContent();
|
||||||
|
|
||||||
Node xml_parent = old_xml_node.getParentNode();
|
Node xml_parent = old_xml_node.getParentNode();
|
||||||
if (xml_parent == null) {
|
if (xml_parent == null) {
|
||||||
xml_parent = getXmlDocument();
|
xml_parent = getXmlDocument();
|
||||||
@@ -810,7 +810,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* removed unless they are mandatory ui nodes.
|
* removed unless they are mandatory ui nodes.
|
||||||
* </ul>
|
* </ul>
|
||||||
* Note that only the first case is used when populating the ui list the first time.
|
* Note that only the first case is used when populating the ui list the first time.
|
||||||
*
|
*
|
||||||
* @param xml_node The XML node to mirror
|
* @param xml_node The XML node to mirror
|
||||||
* @return True when the XML structure has changed.
|
* @return True when the XML structure has changed.
|
||||||
*/
|
*/
|
||||||
@@ -925,9 +925,9 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/**
|
/**
|
||||||
* Internal helper to remove an UI child node given by its index in the
|
* Internal helper to remove an UI child node given by its index in the
|
||||||
* internal child list.
|
* internal child list.
|
||||||
*
|
*
|
||||||
* Also invokes the update listener on the node to be deleted.
|
* Also invokes the update listener on the node to be deleted.
|
||||||
*
|
*
|
||||||
* @param ui_index The index of the UI child to remove, range 0 .. mUiChildren.size()-1
|
* @param ui_index The index of the UI child to remove, range 0 .. mUiChildren.size()-1
|
||||||
* @return True if the structure has changed
|
* @return True if the structure has changed
|
||||||
* @throws IndexOutOfBoundsException if index is out of mUiChildren's bounds. Of course you
|
* @throws IndexOutOfBoundsException if index is out of mUiChildren's bounds. Of course you
|
||||||
@@ -941,7 +941,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
|
|
||||||
// A mandatory node with no XML means it doesn't really exist, so it can't be
|
// A mandatory node with no XML means it doesn't really exist, so it can't be
|
||||||
// deleted.
|
// deleted.
|
||||||
boolean xml_exists = (ui_node.getXmlNode() != null);
|
boolean xml_exists = (ui_node.getXmlNode() != null);
|
||||||
|
|
||||||
ui_node.clearContent();
|
ui_node.clearContent();
|
||||||
return xml_exists;
|
return xml_exists;
|
||||||
@@ -954,7 +954,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/**
|
/**
|
||||||
* Creates a new {@link UiElementNode} from the given {@link ElementDescriptor}
|
* Creates a new {@link UiElementNode} from the given {@link ElementDescriptor}
|
||||||
* and appends it to the end of the element children list.
|
* and appends it to the end of the element children list.
|
||||||
*
|
*
|
||||||
* @param descriptor The {@link ElementDescriptor} that knows how to create the UI node.
|
* @param descriptor The {@link ElementDescriptor} that knows how to create the UI node.
|
||||||
* @return The new UI node that has been appended
|
* @return The new UI node that has been appended
|
||||||
*/
|
*/
|
||||||
@@ -970,7 +970,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/**
|
/**
|
||||||
* Creates a new {@link UiElementNode} from the given {@link ElementDescriptor}
|
* Creates a new {@link UiElementNode} from the given {@link ElementDescriptor}
|
||||||
* and inserts it in the element children list at the specified position.
|
* and inserts it in the element children list at the specified position.
|
||||||
*
|
*
|
||||||
* @param index The position where to insert in the element children list.
|
* @param index The position where to insert in the element children list.
|
||||||
* @param descriptor The {@link ElementDescriptor} that knows how to create the UI node.
|
* @param descriptor The {@link ElementDescriptor} that knows how to create the UI node.
|
||||||
* @return The new UI node.
|
* @return The new UI node.
|
||||||
@@ -994,14 +994,14 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* For each attribute declared in this {@link UiElementNode}, get
|
* For each attribute declared in this {@link UiElementNode}, get
|
||||||
* the corresponding XML attribute. It may not exist, in which case the
|
* the corresponding XML attribute. It may not exist, in which case the
|
||||||
* value will be null. We don't really know if a value has changed, so
|
* value will be null. We don't really know if a value has changed, so
|
||||||
* the updateValue() is called on the UI sattribute in all cases.
|
* the updateValue() is called on the UI sattribute in all cases.
|
||||||
*
|
*
|
||||||
* @param xmlNode The XML node to mirror
|
* @param xmlNode The XML node to mirror
|
||||||
*/
|
*/
|
||||||
protected void updateAttributeList(Node xmlNode) {
|
protected void updateAttributeList(Node xmlNode) {
|
||||||
NamedNodeMap xmlAttrMap = xmlNode.getAttributes();
|
NamedNodeMap xmlAttrMap = xmlNode.getAttributes();
|
||||||
HashSet<Node> visited = new HashSet<Node>();
|
HashSet<Node> visited = new HashSet<Node>();
|
||||||
|
|
||||||
// For all known (i.e. expected) UI attributes, find an existing XML attribute of
|
// For all known (i.e. expected) UI attributes, find an existing XML attribute of
|
||||||
// same (uri, local name) and update the internal Ui attribute value.
|
// same (uri, local name) and update the internal Ui attribute value.
|
||||||
for (UiAttributeNode uiAttr : getInternalUiAttributes().values()) {
|
for (UiAttributeNode uiAttr : getInternalUiAttributes().values()) {
|
||||||
@@ -1022,23 +1022,23 @@ public class UiElementNode implements IPropertySource {
|
|||||||
|
|
||||||
// We need to ignore hidden attributes.
|
// We need to ignore hidden attributes.
|
||||||
Map<String, AttributeDescriptor> hiddenAttrDesc = getHiddenAttributeDescriptors();
|
Map<String, AttributeDescriptor> hiddenAttrDesc = getHiddenAttributeDescriptors();
|
||||||
|
|
||||||
// Traverse the actual XML attribute list to find unknown attributes
|
// Traverse the actual XML attribute list to find unknown attributes
|
||||||
if (xmlAttrMap != null) {
|
if (xmlAttrMap != null) {
|
||||||
for (int i = 0; i < xmlAttrMap.getLength(); i++) {
|
for (int i = 0; i < xmlAttrMap.getLength(); i++) {
|
||||||
Node xmlAttr = xmlAttrMap.item(i);
|
Node xmlAttr = xmlAttrMap.item(i);
|
||||||
// Ignore attributes which have actual descriptors
|
// Ignore attributes which have actual descriptors
|
||||||
if (visited.contains(xmlAttr)) {
|
if (visited.contains(xmlAttr)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String xmlFullName = xmlAttr.getNodeName();
|
String xmlFullName = xmlAttr.getNodeName();
|
||||||
|
|
||||||
// Ignore attributes which are hidden (based on the prefix:localName key)
|
// Ignore attributes which are hidden (based on the prefix:localName key)
|
||||||
if (hiddenAttrDesc.containsKey(xmlFullName)) {
|
if (hiddenAttrDesc.containsKey(xmlFullName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String xmlAttrLocalName = xmlAttr.getLocalName();
|
String xmlAttrLocalName = xmlAttr.getLocalName();
|
||||||
String xmlNsUri = xmlAttr.getNamespaceURI();
|
String xmlNsUri = xmlAttr.getNamespaceURI();
|
||||||
|
|
||||||
@@ -1065,10 +1065,10 @@ public class UiElementNode implements IPropertySource {
|
|||||||
uiAttr = desc.createUiNode(this);
|
uiAttr = desc.createUiNode(this);
|
||||||
mUnknownUiAttributes.add(uiAttr);
|
mUnknownUiAttributes.add(uiAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
uiAttr.updateValue(xmlAttr);
|
uiAttr.updateValue(xmlAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove from the internal list unknown attributes that have been deleted from the xml
|
// Remove from the internal list unknown attributes that have been deleted from the xml
|
||||||
for (UiAttributeNode a : deleted) {
|
for (UiAttributeNode a : deleted) {
|
||||||
mUnknownUiAttributes.remove(a);
|
mUnknownUiAttributes.remove(a);
|
||||||
@@ -1100,15 +1100,18 @@ public class UiElementNode implements IPropertySource {
|
|||||||
protected void setXmlNode(Node xml_node) {
|
protected void setXmlNode(Node xml_node) {
|
||||||
mXmlNode = xml_node;
|
mXmlNode = xml_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the temporary data used by the editors.
|
* Sets the temporary data used by the editors.
|
||||||
* @param data the data.
|
* @param data the data.
|
||||||
|
*
|
||||||
|
* @since GLE1
|
||||||
|
* @deprecated Used by GLE1. Should be deprecated for GLE2.
|
||||||
*/
|
*/
|
||||||
public void setEditData(Object data) {
|
public void setEditData(Object data) {
|
||||||
mEditData = data;
|
mEditData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the temporary data used by the editors for this object.
|
* Returns the temporary data used by the editors for this object.
|
||||||
* @return the data, or <code>null</code> if none has been set.
|
* @return the data, or <code>null</code> if none has been set.
|
||||||
@@ -1116,14 +1119,14 @@ public class UiElementNode implements IPropertySource {
|
|||||||
public Object getEditData() {
|
public Object getEditData() {
|
||||||
return mEditData;
|
return mEditData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshUi() {
|
public void refreshUi() {
|
||||||
invokeUiUpdateListeners(UiUpdateState.ATTR_UPDATED);
|
invokeUiUpdateListeners(UiUpdateState.ATTR_UPDATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------- Helpers
|
// ------------- Helpers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to commit a single attribute value to XML.
|
* Helper method to commit a single attribute value to XML.
|
||||||
* <p/>
|
* <p/>
|
||||||
@@ -1133,9 +1136,9 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* Note that the caller MUST ensure that modifying the underlying XML model is
|
* Note that the caller MUST ensure that modifying the underlying XML model is
|
||||||
* safe and must take care of marking the model as dirty if necessary.
|
* safe and must take care of marking the model as dirty if necessary.
|
||||||
*
|
*
|
||||||
* @see AndroidEditor#editXmlModel(Runnable)
|
* @see AndroidEditor#editXmlModel(Runnable)
|
||||||
*
|
*
|
||||||
* @param uiAttr The attribute node to commit. Must be a child of this UiElementNode.
|
* @param uiAttr The attribute node to commit. Must be a child of this UiElementNode.
|
||||||
* @param newValue The new value to set.
|
* @param newValue The new value to set.
|
||||||
* @return True if the XML attribute was modified or removed, false if nothing changed.
|
* @return True if the XML attribute was modified or removed, false if nothing changed.
|
||||||
@@ -1146,7 +1149,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
if (element != null && uiAttr != null) {
|
if (element != null && uiAttr != null) {
|
||||||
String attrLocalName = uiAttr.getDescriptor().getXmlLocalName();
|
String attrLocalName = uiAttr.getDescriptor().getXmlLocalName();
|
||||||
String attrNsUri = uiAttr.getDescriptor().getNamespaceUri();
|
String attrNsUri = uiAttr.getDescriptor().getNamespaceUri();
|
||||||
|
|
||||||
NamedNodeMap attrMap = element.getAttributes();
|
NamedNodeMap attrMap = element.getAttributes();
|
||||||
if (newValue == null || newValue.length() == 0) {
|
if (newValue == null || newValue.length() == 0) {
|
||||||
// Remove attribute if it's empty
|
// Remove attribute if it's empty
|
||||||
@@ -1155,7 +1158,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Add or replace an attribute
|
// Add or replace an attribute
|
||||||
Document doc = element.getOwnerDocument();
|
Document doc = element.getOwnerDocument();
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
Attr attr = doc.createAttributeNS(attrNsUri, attrLocalName);
|
Attr attr = doc.createAttributeNS(attrNsUri, attrLocalName);
|
||||||
@@ -1179,16 +1182,16 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* Note that the caller MUST ensure that modifying the underlying XML model is
|
* Note that the caller MUST ensure that modifying the underlying XML model is
|
||||||
* safe and must take care of marking the model as dirty if necessary.
|
* safe and must take care of marking the model as dirty if necessary.
|
||||||
*
|
*
|
||||||
* @see AndroidEditor#editXmlModel(Runnable)
|
* @see AndroidEditor#editXmlModel(Runnable)
|
||||||
*
|
*
|
||||||
* @return True if one or more values were actually modified or removed,
|
* @return True if one or more values were actually modified or removed,
|
||||||
* false if nothing changed.
|
* false if nothing changed.
|
||||||
*/
|
*/
|
||||||
public boolean commitDirtyAttributesToXml() {
|
public boolean commitDirtyAttributesToXml() {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
||||||
|
|
||||||
for (Entry<AttributeDescriptor, UiAttributeNode> entry : attributeMap.entrySet()) {
|
for (Entry<AttributeDescriptor, UiAttributeNode> entry : attributeMap.entrySet()) {
|
||||||
UiAttributeNode ui_attr = entry.getValue();
|
UiAttributeNode ui_attr = entry.getValue();
|
||||||
if (ui_attr.isDirty()) {
|
if (ui_attr.isDirty()) {
|
||||||
@@ -1202,7 +1205,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/**
|
/**
|
||||||
* Returns the namespace prefix matching the requested namespace URI.
|
* Returns the namespace prefix matching the requested namespace URI.
|
||||||
* If no such declaration is found, returns the default "android" prefix.
|
* If no such declaration is found, returns the default "android" prefix.
|
||||||
*
|
*
|
||||||
* @param node The current node. Must not be null.
|
* @param node The current node. Must not be null.
|
||||||
* @param nsUri The namespace URI of which the prefix is to be found,
|
* @param nsUri The namespace URI of which the prefix is to be found,
|
||||||
* e.g. SdkConstants.NS_RESOURCES
|
* e.g. SdkConstants.NS_RESOURCES
|
||||||
@@ -1217,15 +1220,15 @@ public class UiElementNode implements IPropertySource {
|
|||||||
if (nsUri == null) {
|
if (nsUri == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// per XML specification, the "xmlns" URI is reserved
|
// per XML specification, the "xmlns" URI is reserved
|
||||||
if (XmlnsAttributeDescriptor.XMLNS_URI.equals(nsUri)) {
|
if (XmlnsAttributeDescriptor.XMLNS_URI.equals(nsUri)) {
|
||||||
return "xmlns"; //$NON-NLS-1$
|
return "xmlns"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
HashSet<String> visited = new HashSet<String>();
|
HashSet<String> visited = new HashSet<String>();
|
||||||
Document doc = node == null ? null : node.getOwnerDocument();
|
Document doc = node == null ? null : node.getOwnerDocument();
|
||||||
|
|
||||||
for (; node != null && node.getNodeType() == Node.ELEMENT_NODE;
|
for (; node != null && node.getNodeType() == Node.ELEMENT_NODE;
|
||||||
node = node.getParentNode()) {
|
node = node.getParentNode()) {
|
||||||
NamedNodeMap attrs = node.getAttributes();
|
NamedNodeMap attrs = node.getAttributes();
|
||||||
@@ -1242,7 +1245,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use a sensible default prefix if we can't find one.
|
// Use a sensible default prefix if we can't find one.
|
||||||
// We need to make sure the prefix is not one that was declared in the scope
|
// We need to make sure the prefix is not one that was declared in the scope
|
||||||
// visited above. Use a default namespace prefix "android" for the Android resource
|
// visited above. Use a default namespace prefix "android" for the Android resource
|
||||||
@@ -1252,7 +1255,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
for (int i = 1; visited.contains(prefix); i++) {
|
for (int i = 1; visited.contains(prefix); i++) {
|
||||||
prefix = base + Integer.toString(i);
|
prefix = base + Integer.toString(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also create & define this prefix/URI in the XML document as an attribute in the
|
// Also create & define this prefix/URI in the XML document as an attribute in the
|
||||||
// first element of the document.
|
// first element of the document.
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
@@ -1267,7 +1270,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
node.getAttributes().setNamedItemNS(attr);
|
node.getAttributes().setNamedItemNS(attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1275,16 +1278,16 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* Utility method to internally set the value of a text attribute for the current
|
* Utility method to internally set the value of a text attribute for the current
|
||||||
* UiElementNode.
|
* UiElementNode.
|
||||||
* <p/>
|
* <p/>
|
||||||
* This method is a helper. It silently ignores the errors such as the requested
|
* This method is a helper. It silently ignores the errors such as the requested
|
||||||
* attribute not being present in the element or attribute not being settable.
|
* attribute not being present in the element or attribute not being settable.
|
||||||
* It accepts inherited attributes (such as layout).
|
* It accepts inherited attributes (such as layout).
|
||||||
* <p/>
|
* <p/>
|
||||||
* This does not commit to the XML model. It does mark the attribute node as dirty.
|
* This does not commit to the XML model. It does mark the attribute node as dirty.
|
||||||
* This is up to the caller.
|
* This is up to the caller.
|
||||||
*
|
*
|
||||||
* @see #commitAttributeToXml(UiAttributeNode, String)
|
* @see #commitAttributeToXml(UiAttributeNode, String)
|
||||||
* @see #commitDirtyAttributesToXml()
|
* @see #commitDirtyAttributesToXml()
|
||||||
*
|
*
|
||||||
* @param attrXmlName The XML name of the attribute to modify
|
* @param attrXmlName The XML name of the attribute to modify
|
||||||
* @param value The new value for the attribute. If set to null, the attribute is removed.
|
* @param value The new value for the attribute. If set to null, the attribute is removed.
|
||||||
* @param override True if the value must be set even if one already exists.
|
* @param override True if the value must be set even if one already exists.
|
||||||
@@ -1292,11 +1295,11 @@ public class UiElementNode implements IPropertySource {
|
|||||||
*/
|
*/
|
||||||
public UiAttributeNode setAttributeValue(String attrXmlName, String value, boolean override) {
|
public UiAttributeNode setAttributeValue(String attrXmlName, String value, boolean override) {
|
||||||
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
||||||
|
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value = ""; //$NON-NLS-1$ -- this removes an attribute
|
value = ""; //$NON-NLS-1$ -- this removes an attribute
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<AttributeDescriptor, UiAttributeNode> entry : attributeMap.entrySet()) {
|
for (Entry<AttributeDescriptor, UiAttributeNode> entry : attributeMap.entrySet()) {
|
||||||
AttributeDescriptor ui_desc = entry.getKey();
|
AttributeDescriptor ui_desc = entry.getKey();
|
||||||
if (ui_desc.getXmlLocalName().equals(attrXmlName)) {
|
if (ui_desc.getXmlLocalName().equals(attrXmlName)) {
|
||||||
@@ -1325,13 +1328,13 @@ public class UiElementNode implements IPropertySource {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* Note that this retrieves the *field* value if the attribute has some UI, and
|
* Note that this retrieves the *field* value if the attribute has some UI, and
|
||||||
* not the actual XML value. They may differ if the attribute is dirty.
|
* not the actual XML value. They may differ if the attribute is dirty.
|
||||||
*
|
*
|
||||||
* @param attrXmlName The XML name of the attribute to modify
|
* @param attrXmlName The XML name of the attribute to modify
|
||||||
* @return The current internal value for the attribute or null in case of error.
|
* @return The current internal value for the attribute or null in case of error.
|
||||||
*/
|
*/
|
||||||
public String getAttributeValue(String attrXmlName) {
|
public String getAttributeValue(String attrXmlName) {
|
||||||
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
||||||
|
|
||||||
for (Entry<AttributeDescriptor, UiAttributeNode> entry : attributeMap.entrySet()) {
|
for (Entry<AttributeDescriptor, UiAttributeNode> entry : attributeMap.entrySet()) {
|
||||||
AttributeDescriptor ui_desc = entry.getKey();
|
AttributeDescriptor ui_desc = entry.getKey();
|
||||||
if (ui_desc.getXmlLocalName().equals(attrXmlName)) {
|
if (ui_desc.getXmlLocalName().equals(attrXmlName)) {
|
||||||
@@ -1351,7 +1354,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
|
* @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
|
||||||
*
|
*
|
||||||
* Returns the property descriptor for this node. Since the descriptors are not linked to the
|
* Returns the property descriptor for this node. Since the descriptors are not linked to the
|
||||||
* data, the AttributeDescriptor are used directly.
|
* data, the AttributeDescriptor are used directly.
|
||||||
*/
|
*/
|
||||||
@@ -1361,22 +1364,22 @@ public class UiElementNode implements IPropertySource {
|
|||||||
// get the standard descriptors
|
// get the standard descriptors
|
||||||
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
||||||
Set<AttributeDescriptor> keys = attributeMap.keySet();
|
Set<AttributeDescriptor> keys = attributeMap.keySet();
|
||||||
|
|
||||||
|
|
||||||
// we only want the descriptor that do implement the IPropertyDescriptor interface.
|
// we only want the descriptor that do implement the IPropertyDescriptor interface.
|
||||||
for (AttributeDescriptor key : keys) {
|
for (AttributeDescriptor key : keys) {
|
||||||
if (key instanceof IPropertyDescriptor) {
|
if (key instanceof IPropertyDescriptor) {
|
||||||
propDescs.add((IPropertyDescriptor)key);
|
propDescs.add((IPropertyDescriptor)key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now get the descriptor from the unknown attributes
|
// now get the descriptor from the unknown attributes
|
||||||
for (UiAttributeNode unknownNode : mUnknownUiAttributes) {
|
for (UiAttributeNode unknownNode : mUnknownUiAttributes) {
|
||||||
if (unknownNode.getDescriptor() instanceof IPropertyDescriptor) {
|
if (unknownNode.getDescriptor() instanceof IPropertyDescriptor) {
|
||||||
propDescs.add((IPropertyDescriptor)unknownNode.getDescriptor());
|
propDescs.add((IPropertyDescriptor)unknownNode.getDescriptor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO cache this maybe, as it's not going to change (except for unknown descriptors)
|
// TODO cache this maybe, as it's not going to change (except for unknown descriptors)
|
||||||
return propDescs.toArray(new IPropertyDescriptor[propDescs.size()]);
|
return propDescs.toArray(new IPropertyDescriptor[propDescs.size()]);
|
||||||
}
|
}
|
||||||
@@ -1384,13 +1387,13 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
|
* @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
|
||||||
*
|
*
|
||||||
* Returns the value of a given property. The id is the result of IPropertyDescriptor.getId(),
|
* Returns the value of a given property. The id is the result of IPropertyDescriptor.getId(),
|
||||||
* which return the AttributeDescriptor itself.
|
* which return the AttributeDescriptor itself.
|
||||||
*/
|
*/
|
||||||
public Object getPropertyValue(Object id) {
|
public Object getPropertyValue(Object id) {
|
||||||
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
||||||
|
|
||||||
UiAttributeNode attribute = attributeMap.get(id);
|
UiAttributeNode attribute = attributeMap.get(id);
|
||||||
|
|
||||||
if (attribute == null) {
|
if (attribute == null) {
|
||||||
@@ -1401,56 +1404,56 @@ public class UiElementNode implements IPropertySource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return attribute;
|
return attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
|
* @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
|
||||||
*
|
*
|
||||||
* Returns whether the property is set. In our case this is if the string is non empty.
|
* Returns whether the property is set. In our case this is if the string is non empty.
|
||||||
*/
|
*/
|
||||||
public boolean isPropertySet(Object id) {
|
public boolean isPropertySet(Object id) {
|
||||||
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
||||||
|
|
||||||
UiAttributeNode attribute = attributeMap.get(id);
|
UiAttributeNode attribute = attributeMap.get(id);
|
||||||
|
|
||||||
if (attribute != null) {
|
if (attribute != null) {
|
||||||
return attribute.getCurrentValue().length() > 0;
|
return attribute.getCurrentValue().length() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for the id in the unknown attributes.
|
// look for the id in the unknown attributes.
|
||||||
for (UiAttributeNode unknownAttr : mUnknownUiAttributes) {
|
for (UiAttributeNode unknownAttr : mUnknownUiAttributes) {
|
||||||
if (id == unknownAttr.getDescriptor()) {
|
if (id == unknownAttr.getDescriptor()) {
|
||||||
return unknownAttr.getCurrentValue().length() > 0;
|
return unknownAttr.getCurrentValue().length() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
|
* @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
|
||||||
*
|
*
|
||||||
* Reset the property to its default value. For now we simply empty it.
|
* Reset the property to its default value. For now we simply empty it.
|
||||||
*/
|
*/
|
||||||
public void resetPropertyValue(Object id) {
|
public void resetPropertyValue(Object id) {
|
||||||
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
||||||
|
|
||||||
UiAttributeNode attribute = attributeMap.get(id);
|
UiAttributeNode attribute = attributeMap.get(id);
|
||||||
if (attribute != null) {
|
if (attribute != null) {
|
||||||
// TODO: reset the value of the attribute
|
// TODO: reset the value of the attribute
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for the id in the unknown attributes.
|
// look for the id in the unknown attributes.
|
||||||
for (UiAttributeNode unknownAttr : mUnknownUiAttributes) {
|
for (UiAttributeNode unknownAttr : mUnknownUiAttributes) {
|
||||||
if (id == unknownAttr.getDescriptor()) {
|
if (id == unknownAttr.getDescriptor()) {
|
||||||
// TODO: reset the value of the attribute
|
// TODO: reset the value of the attribute
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1459,15 +1462,15 @@ public class UiElementNode implements IPropertySource {
|
|||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
|
* @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
|
||||||
*
|
*
|
||||||
* Set the property value. id is the result of IPropertyDescriptor.getId(), which is the
|
* Set the property value. id is the result of IPropertyDescriptor.getId(), which is the
|
||||||
* AttributeDescriptor itself. Value should be a String.
|
* AttributeDescriptor itself. Value should be a String.
|
||||||
*/
|
*/
|
||||||
public void setPropertyValue(Object id, Object value) {
|
public void setPropertyValue(Object id, Object value) {
|
||||||
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
|
||||||
|
|
||||||
UiAttributeNode attribute = attributeMap.get(id);
|
UiAttributeNode attribute = attributeMap.get(id);
|
||||||
|
|
||||||
if (attribute == null) {
|
if (attribute == null) {
|
||||||
// look for the id in the unknown attributes.
|
// look for the id in the unknown attributes.
|
||||||
for (UiAttributeNode unknownAttr : mUnknownUiAttributes) {
|
for (UiAttributeNode unknownAttr : mUnknownUiAttributes) {
|
||||||
@@ -1483,7 +1486,7 @@ public class UiElementNode implements IPropertySource {
|
|||||||
// get the current value and compare it to the new value
|
// get the current value and compare it to the new value
|
||||||
String oldValue = attribute.getCurrentValue();
|
String oldValue = attribute.getCurrentValue();
|
||||||
final String newValue = (String)value;
|
final String newValue = (String)value;
|
||||||
|
|
||||||
if (oldValue.equals(newValue)) {
|
if (oldValue.equals(newValue)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user