From ef8791b9f216dc1d97701f57a2858139d41868db Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Thu, 17 Aug 2006 17:47:13 +0000 Subject: [PATCH] bug 153253 - formatting to facilitate debug --- .../eclipse/rse/persistence/dom/RSEDOM.java | 79 +++++++------------ 1 file changed, 29 insertions(+), 50 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOM.java b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOM.java index 77907b72bcd..22c6d38ddeb 100644 --- a/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOM.java +++ b/rse/plugins/org.eclipse.rse.ui/persistence/org/eclipse/rse/persistence/dom/RSEDOM.java @@ -22,113 +22,92 @@ import org.eclipse.rse.model.ISystemProfile; * This class is the root node of an RSE DOM. Each * RSEDOM represents the properties of a profile to persist. */ -public class RSEDOM extends RSEDOMNode -{ +public class RSEDOM extends RSEDOMNode { - /** - * + /* + * Recommended for serializable objects. This should be updated if there is a schema change. */ private static final long serialVersionUID = 1L; private boolean _saveScheduled = false; private transient ISystemProfile _profile; - - public RSEDOM(ISystemProfile profile) - { + + public RSEDOM(ISystemProfile profile) { super(null, TYPE_PROFILE, profile.getName()); _profile = profile; } - - public RSEDOM(String profileName) - { + + public RSEDOM(String profileName) { super(null, TYPE_PROFILE, profileName); _profile = null; } - - public ISystemProfile getProfile() - { + + public ISystemProfile getProfile() { return _profile; } - + /** * Indicate that this DOM needs to be saved */ - public void markForSave() - { - if (!restoring && !_needsSave) - { - //System.out.println("RSEDOM "+getName() + " needs saving"); + public void markForSave() { + if (!restoring && !_needsSave) { _needsSave = true; } } - + /** * Indicate that this DOM has been saved - * */ - public void markUpdated() - { - if (_needsSave) - { - //System.out.println("RSEDOM "+getName() + " is up to date"); - + public void markUpdated() { + if (_needsSave) { _needsSave = false; _saveScheduled = false; super.markUpdated(); } } - + /** - * Returns whether this DOM is scheduled to be saved - * @return + * @return true if this DOM is scheduled to be saved */ - public boolean saveScheduled() - { + public boolean saveScheduled() { return _saveScheduled; } - + /** * Indicate that this DOM is scheduled to be saved */ - public void markSaveScheduled() - { - if (!_saveScheduled) - { + public void markSaveScheduled() { + if (!_saveScheduled) { _saveScheduled = true; } } - - + /** - * Has the DOM changed since last update? + * @return true if this DOM has the DOM changed since last saved or restored. */ - public boolean needsSave() - { + public boolean needsSave() { return _needsSave; } - public void print(RSEDOMNode node, String indent) - { + public void print(RSEDOMNode node, String indent) { String type = node.getType(); String name = node.getName(); RSEDOMNodeAttribute[] attributes = node.getAttributes(); RSEDOMNode[] children = node.getChildren(); - + System.out.println(indent + "RSEDOMNode " + type); System.out.println(indent + "{"); String sindent = indent + " "; System.out.println(sindent + "name=" + name); - for (int i = 0; i < attributes.length; i++) - { + for (int i = 0; i < attributes.length; i++) { RSEDOMNodeAttribute attribute = attributes[i]; String key = attribute.getKey(); String value = attribute.getValue(); System.out.println(sindent + key + "=" + value); } - + String cindent = sindent + " "; - for (int c = 0; c < children.length; c++) - { + for (int c = 0; c < children.length; c++) { RSEDOMNode child = children[c]; print(child, cindent); }