Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 2121 Details for
Bug 2909
[Examples]: propertysheet - Restore Default Values does not work (1GKO8D0)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Update examples to illustrate more/proper behaviour
2909_part2_patch (text/plain), 9.90 KB, created by
Andrew Irvine
on 2002-10-08 11:16:42 EDT
(
hide
)
Description:
Update examples to illustrate more/proper behaviour
Filename:
MIME Type:
Creator:
Andrew Irvine
Created:
2002-10-08 11:16:42 EDT
Size:
9.90 KB
patch
obsolete
>Index: Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java,v >retrieving revision 1.2 >diff -u -r1.2 Address.java >--- Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java 14 Aug 2001 20:38:52 -0000 1.2 >+++ Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java 8 Oct 2002 15:15:27 -0000 >@@ -37,7 +37,7 @@ > > > //default values >- private static final StreetAddress STREET_DEFAULT = new StreetAddress(); >+ private static StreetAddress STREET_DEFAULT = new StreetAddress(); > private static final String CITY_DEFAULT = MessageUtil.getString("unspecified_city"); //$NON-NLS-1$ > private static final Integer PROVINCE_DEFAULT = new Integer(0); > private static final String POSTALCODE_DEFAULT = "A1B2C3"; //$NON-NLS-1$ >@@ -86,8 +86,7 @@ > > //check for proper length > if (testPostalCode.length() != 6) { >- //fail >- return MessageUtil.format("_is_an_invalid_format_for_a_postal_code", new Object[] {testPostalCode}); //$NON-NLS-1$ >+ return MessageUtil.getString("postal_code_is_incomplete"); //$NON-NLS-1$ > } > > //check for proper format >@@ -203,13 +202,21 @@ > */ > public StreetAddress getStreet() { > if(street == null) >- street = STREET_DEFAULT; >+ street = new StreetAddress(); > return street; > } > /* (non-Javadoc) > * Method declared on IPropertySource > */ > public boolean isPropertySet(Object property) { >+ if (property.equals(P_ID_PROVINCE)) >+ return getProvince() != PROVINCE_DEFAULT; >+ if (property.equals(P_ID_STREET)) >+ return getStreet() != STREET_DEFAULT; >+ if (property.equals(P_ID_CITY)) >+ return getCity() != CITY_DEFAULT; >+ if (property.equals(P_ID_POSTALCODE)) >+ return getPostalCode() != POSTALCODE_DEFAULT; > return false; > } > /* (non-Javadoc) >@@ -229,6 +236,7 @@ > return; > }; > if (P_ID_STREET.equals(property)) { >+ STREET_DEFAULT = new StreetAddress(); > setStreet(STREET_DEFAULT); > return; > } >@@ -270,7 +278,7 @@ > return; > } > if (P_ID_STREET.equals(name)) { >- //setStreet((StreetAddress) value); >+ setStreet(getStreet()); > return; > } > >@@ -288,7 +296,7 @@ > street = newStreet; > } > /** >- * The value as displayed in the Property Sheet. Will not print default values >+ * The value as displayed in the Property Sheet. > * @return java.lang.String > */ > public String toString() { >@@ -299,17 +307,13 @@ > outStringBuffer.append(getStreet()); > outStringBuffer.append(comma_space); > } >- if (!getCity().equals(CITY_DEFAULT)) { >- outStringBuffer.append(getCity()); >- outStringBuffer.append(space); >- } >- if (!getProvince().equals(PROVINCE_DEFAULT)) { >- outStringBuffer.append(provinceValues[getProvince().intValue()]); >- } >- if (!getPostalCode().equals(POSTALCODE_DEFAULT)) { >- outStringBuffer.append(comma_space); >- outStringBuffer.append(getPostalCode()); >- } >+ >+ outStringBuffer.append(getCity()); >+ outStringBuffer.append(space); >+ outStringBuffer.append(provinceValues[getProvince().intValue()]); >+ outStringBuffer.append(comma_space); >+ outStringBuffer.append(getPostalCode()); >+ > return outStringBuffer.toString(); > } > } >Index: Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java,v >retrieving revision 1.2 >diff -u -r1.2 Birthday.java >--- Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java 14 Aug 2001 20:38:52 -0000 1.2 >+++ Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java 8 Oct 2002 15:15:27 -0000 >@@ -151,6 +151,12 @@ > * Method declared on IPropertySource > */ > public boolean isPropertySet(Object property) { >+ if (P_ID_DAY.equals(property)) >+ return getDay() != DAY_DEFAULT; >+ if (P_ID_MONTH.equals(property)) >+ return getMonth() != MONTH_DEFAULT; >+ if (P_ID_YEAR.equals(property)) >+ return getYear() != YEAR_DEFAULT; > return false; > } > /* (non-Javadoc) >@@ -216,7 +222,7 @@ > year = newYear; > } > /** >- * The value as displayed in the Property Sheet. Will not print default values >+ * The value as displayed in the Property Sheet. > * @return java.lang.String > */ > public String toString() { >Index: Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java,v >retrieving revision 1.2 >diff -u -r1.2 EmailAddress.java >--- Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java 14 Aug 2001 20:38:52 -0000 1.2 >+++ Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java 8 Oct 2002 15:15:27 -0000 >@@ -10,7 +10,7 @@ > > /** > * Example IPropertySource is editable and whose childern properties are itself not editable. >- * The values of "userid" and "mailserver" are parsed from seting "email" >+ * The values of "userid" and "mailserver" are parsed from setting "email" > */ > public class EmailAddress implements IPropertySource { > >@@ -117,14 +117,6 @@ > * Method declared on IPropertySource > */ > public void resetPropertyValue(Object property) { >- if (property.equals(P_ID_USERID)) { >- setUserid(USERID_DEFAULT); >- return; >- } >- if (property.equals(P_ID_DOMAIN)) { >- setDomain(DOMAIN_DEFAULT); >- return; >- } > return; > } > /** >@@ -177,7 +169,7 @@ > userid = newUserid; > } > /** >- * The value as displayed in the Property Sheet. Will not print default values >+ * The value as displayed in the Property Sheet. > * @return java.lang.String > */ > public String toString() { >Index: Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java,v >retrieving revision 1.2 >diff -u -r1.2 Name.java >--- Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java 14 Aug 2001 20:38:52 -0000 1.2 >+++ Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java 8 Oct 2002 15:15:27 -0000 >@@ -27,6 +27,12 @@ > public static String P_LASTNAME = MessageUtil.getString("LastName"); //$NON-NLS-1$ > public static String P_MIDDLENAME = MessageUtil.getString("Middle"); //$NON-NLS-1$ > >+ // default values >+ // >+ private static final String FIRSTNAME_DEFAULT = null; >+ private static final String LASTNAME_DEFAULT = null; >+ private static final String MIDDLENAME_DEFAULT = null; >+ > public static final String P_DESCRIPTORS = "properties"; //$NON-NLS-1$ > static private Vector descriptors; > static >@@ -113,6 +119,12 @@ > * Method declared on IPropertySource > */ > public boolean isPropertySet(Object key) { >+ if (key.equals(P_ID_FIRSTNAME)) >+ return getFirstName() != FIRSTNAME_DEFAULT; >+ if (key.equals(P_ID_LASTNAME)) >+ return getLastName() != LASTNAME_DEFAULT; >+ if (key.equals(P_ID_MIDDLENAME)) >+ return getInitial() != MIDDLENAME_DEFAULT; > return false; > } > /** >@@ -124,15 +136,15 @@ > */ > public void resetPropertyValue(Object property) { > if (P_ID_FIRSTNAME.equals(property)) { >- setFirstName(null); >+ setFirstName(FIRSTNAME_DEFAULT); > return; > } > if (P_ID_LASTNAME.equals(property)) { >- setLastName(null); >+ setLastName(LASTNAME_DEFAULT); > return; > } > if (P_ID_MIDDLENAME.equals(property)) { >- setInitial(null); >+ setInitial(MIDDLENAME_DEFAULT); > return; > } > } >@@ -175,7 +187,7 @@ > setLastName((String) val); > return; > } >- if (P_ID_MIDDLENAME.equals(propName)){ >+ if (P_ID_MIDDLENAME.equals(propName)) { > setInitial((String) val); > return; > } >@@ -186,16 +198,16 @@ > */ > public String toString(){ > StringBuffer outStringBuffer = new StringBuffer(); >- if(getFirstName()!=null) >- { outStringBuffer.append(getFirstName()); >+ if(getFirstName()!=FIRSTNAME_DEFAULT) { >+ outStringBuffer.append(getFirstName()); > outStringBuffer.append(" "); //$NON-NLS-1$ >- if(getInitial()!=null) >- { outStringBuffer.append(getInitial()); >- outStringBuffer.append(" "); //$NON-NLS-1$ >- } > } >- if(getLastName()!=null) >- { outStringBuffer.append(getLastName()); >+ if(getInitial()!=MIDDLENAME_DEFAULT) { >+ outStringBuffer.append(getInitial()); >+ outStringBuffer.append(" "); //$NON-NLS-1$ >+ } >+ if(getLastName()!=LASTNAME_DEFAULT) { >+ outStringBuffer.append(getLastName()); > } > > return outStringBuffer.toString(); >Index: Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java,v >retrieving revision 1.2 >diff -u -r1.2 StreetAddress.java >--- Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java 14 Aug 2001 20:38:52 -0000 1.2 >+++ Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java 8 Oct 2002 15:15:27 -0000 >@@ -140,6 +140,12 @@ > * Method declared on IPropertySource > */ > public boolean isPropertySet(Object property) { >+ if (property.equals(P_ID_BUILD_NO)) >+ return getBuildNo() != BUILD_NO_DEFAULT; >+ if (property.equals(P_ID_APTBOX)) >+ return getAptBox() != APTBOX_DEFAULT; >+ if (property.equals(P_ID_STREET)) >+ return getStreetName() != STREETNAME_DEFAULT; > return false; > } > /* (non-Javadoc)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2909
:
2120
| 2121