Index: src/org/eclipse/ui/views/properties/IPropertySheetEntry.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java,v retrieving revision 1.3 diff -u -r1.3 IPropertySheetEntry.java --- src/org/eclipse/ui/views/properties/IPropertySheetEntry.java 10 Mar 2003 22:09:05 -0000 1.3 +++ src/org/eclipse/ui/views/properties/IPropertySheetEntry.java 3 May 2004 17:03:41 -0000 @@ -13,135 +13,158 @@ import org.eclipse.jface.viewers.CellEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; + /** * IPropertySheetEntry describes the model interface for the * property sheet. *

- * May be implemented when supplying a custom root entry - * to a property page. + * May be implemented when supplying a custom root entry to a property page. *

*/ public interface IPropertySheetEntry { - /** - * The filter id for expert properties - */ - public String FILTER_ID_EXPERT = "org.eclipse.ui.views.properties.expert"; //$NON-NLS-1$ -/** - * Adds the given listener to this entry's collection - * of listeners. - * - * @param listener the listener to add - */ -public void addPropertySheetEntryListener(IPropertySheetEntryListener listener); -/** - * Apply the current cell editor value. - */ -public void applyEditorValue(); -/** - * Called when the entry is no longer needed - */ -public void dispose(); -/** - * Returns the entry's category. - * - * @return the entry's category - */ -public String getCategory(); -/** - * Returns the child entries for this entry. - * - * @return the child entries for this entry - */ -public IPropertySheetEntry[] getChildEntries(); -/** - * Return a short description of the property sheet entry. - * Typically this description is shown in a status line - * when the entry is selected. - * - * @return the entry's description - */ -public String getDescription(); -/** - * Returns the name used to display the property. - * - * @return the name used to display the property - */ -public String getDisplayName(); -/** - * Return the CellEditor used to edit the property. - * - * @param parent the parent widget for the editor - * @return the CellEditor used to edit the property - */ -CellEditor getEditor(Composite parent); -/** - * Returns the error text to display if the value is invalid. - * - * @return the error text to display when the value is invalid - * or null - */ -public String getErrorText(); -/** - * Return the filter ids used to group entries into levels such as Expert. - * Valid values are defined as constants on this interface. - * - * @return the filter ids used to group entries into levels such as Expert. - */ -public String[] getFilters(); -/** - * Returns the help context id for this entry, - * or null if this entry has no help context id. - *

- * NOTE: Help support system API's changed since 2.0 and arrays - * of contexts are no longer supported. - *

- *

- * Thus the only valid non-null return type for this method - * is a String representing a context id. The previously - * valid return types are deprecated. The plural name for this method - * is unfortunate. - *

- * - * @return the help context id for this entry - */ -public Object getHelpContextIds(); -/** - * Returns the image for the property value, if there is one. - * This image is managed by the entry it came from. Callers - * of this method must never dispose the returned image. - * - * @return the image for this property value or null - */ -public Image getImage(); -/** - * Returns the value of the objects expressed as a String. - * - * @return the value of the objects expressed as a String - */ -public String getValueAsString(); -/** - * Returns true if the entry has children. - * - * @return true if the entry has children - */ -public boolean hasChildEntries(); -/** - * Removes the given listener from this entry's collection - * of listeners. - * - * @param listener the listener to remove - */ -public void removePropertySheetEntryListener(IPropertySheetEntryListener listener); -/** - * Resets the property value to its default value if it has been changed. - */ -void resetPropertyValue(); -/* - * Sets the objects which represent the property values for - * this entry. In the case of the root entry these objects - * are the input to the viewer. - * - * @param values the values for this entry - */ -public void setValues(Object[] values); -} + + /** + * The filter id for expert properties + */ + public String FILTER_ID_EXPERT = "org.eclipse.ui.views.properties.expert"; //$NON-NLS-1$ + + /** + * Adds the given listener to this entry's collection of listeners. + * + * @param listener + * the listener to add + */ + public void addPropertySheetEntryListener( + IPropertySheetEntryListener listener); + + /** + * Apply the current cell editor value. + */ + public void applyEditorValue(); + + /** + * Called when the entry is no longer needed + */ + public void dispose(); + + /** + * Returns the entry's category. + * + * @return the entry's category + */ + public String getCategory(); + + /** + * Returns the child entries for this entry. + * + * @return the child entries for this entry + */ + public IPropertySheetEntry[] getChildEntries(); + + /** + * Return a short description of the property sheet entry. Typically this + * description is shown in a status line when the entry is selected. + * + * @return the entry's description + */ + public String getDescription(); + + /** + * Returns the name used to display the property. + * + * @return the name used to display the property + */ + public String getDisplayName(); + + /** + * Return the CellEditor used to edit the property. + * + * @param parent + * the parent widget for the editor + * @return the CellEditor used to edit the property + */ + CellEditor getEditor(Composite parent); + + /** + * Returns the error text to display if the value is invalid. + * + * @return the error text to display when the value is invalid or + * null + */ + public String getErrorText(); + + /** + * Return the filter ids used to group entries into levels such as Expert. + * Valid values are defined as constants on this interface. + * + * @return the filter ids used to group entries into levels such as Expert. + */ + public String[] getFilters(); + + /** + * Returns the help context id for this entry, or null if + * this entry has no help context id. + *

+ * NOTE: Help support system API's changed since 2.0 and arrays of contexts + * are no longer supported. + *

+ *

+ * Thus the only valid non- null return type for this method + * is a String representing a context id. The previously + * valid return types are deprecated. The plural name for this method is + * unfortunate. + *

+ * + * @return the help context id for this entry + */ + public Object getHelpContextIds(); + + /** + * Returns the image for the property value, if there is one. This image is + * managed by the entry it came from. Callers of this method must never + * dispose the returned image. + * + * @return the image for this property value or null + */ + public Image getImage(); + + /** + * Returns the value of the objects expressed as a String. + * + * @return the value of the objects expressed as a String + */ + public String getValueAsString(); + + /** + * Returns true if the entry has children. + * + * @return true if the entry has children + */ + public boolean hasChildEntries(); + + /** + * Removes the given listener from this entry's collection of listeners. + * + * @param listener + * the listener to remove + */ + public void removePropertySheetEntryListener( + IPropertySheetEntryListener listener); + + /** + * Resets the property value to its default value if it has been changed. + *

+ * Does nothing if the notion of a default value is not meaningful for + * the property. + *

+ */ + void resetPropertyValue(); + + /** + * Sets the objects which represent the property values for this entry. In + * the case of the root entry these objects are the input to the viewer. + * + * @param values the values for this entry + */ + public void setValues(Object[] values); +} \ No newline at end of file Index: src/org/eclipse/ui/views/properties/IPropertySource.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySource.java,v retrieving revision 1.6 diff -u -r1.6 IPropertySource.java --- src/org/eclipse/ui/views/properties/IPropertySource.java 24 Jun 2003 14:52:54 -0000 1.6 +++ src/org/eclipse/ui/views/properties/IPropertySource.java 3 May 2004 17:03:41 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. + * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Gunnar Wagenknecht - fix for bug 21756 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=21756) *******************************************************************************/ package org.eclipse.ui.views.properties; @@ -29,6 +30,7 @@ * @see org.eclipse.core.runtime.IAdaptable * @see org.eclipse.core.runtime.Platform#getAdapterManager() * @see org.eclipse.ui.views.properties.PropertySheetPage + * @see org.eclipse.ui.views.properties.IPropertySource2 */ public interface IPropertySource { @@ -99,22 +101,38 @@ public Object getPropertyValue(Object id); /** * Returns whether the value of the property with the given id has changed from - * its default value. Returns false if the notion of default value - * is not meaningful for the specified property, or if this source does not have + * its default value. Returns false if this source does not have * the specified property. + *

+ * If the notion of default value is not meaningful for the specified property + * than true is returned. + *

* * @param id the id of the property * @return true if the value of the specified property has changed - * from its original default value, and false otherwise + * from its original default value or if the specified property does not have + * a meaningfull default value, and false otherwise + * @see IPropertySource2#isPropertyResettable(Object) + * @see #resetPropertyValue(Object) */ public boolean isPropertySet(Object id); /** * Resets the property with the given id to its default value if possible. - * Does nothing if the notion of default value is not meaningful for + *

+ * Does nothing if the notion of a default value is not meaningful for * the specified property, or if the property's value cannot be changed, * or if this source does not have the specified property. + *

+ *

+ * Callers will check if this IPropertySource + * implements IPropertySource2 and this method will + * only be called if IPropertySource2#isPropertyResettable(Object) + * returns true for the property with the given id. + *

* * @param id the id of the property being reset + * @see #isPropertySet(Object) + * @see IPropertySource2#isPropertyResettable(Object) */ public void resetPropertyValue(Object id); /** Index: src/org/eclipse/ui/views/properties/PropertySheetEntry.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java,v retrieving revision 1.7 diff -u -r1.7 PropertySheetEntry.java --- src/org/eclipse/ui/views/properties/PropertySheetEntry.java 10 Mar 2003 22:09:05 -0000 1.7 +++ src/org/eclipse/ui/views/properties/PropertySheetEntry.java 3 May 2004 17:03:49 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. + * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Gunnar Wagenknecht - fix for bug 21756 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=21756) *******************************************************************************/ package org.eclipse.ui.views.properties; @@ -512,6 +513,13 @@ for (int i = 0; i < objects.length; i++){ IPropertySource source = getPropertySource(objects[i]); if (source.isPropertySet(descriptor.getId())) { + // fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=21756 + if(source instanceof IPropertySource2) { + IPropertySource2 extendedSource = (IPropertySource2) source; + // continue with next if property is not resettable + if (!extendedSource.isPropertyResettable(descriptor.getId())) + continue; + } source.resetPropertyValue(descriptor.getId()); change = true; } Index: src/org/eclipse/ui/views/properties/IPropertySource2.java =================================================================== RCS file: src/org/eclipse/ui/views/properties/IPropertySource2.java diff -N src/org/eclipse/ui/views/properties/IPropertySource2.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/ui/views/properties/IPropertySource2.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * Gunnar Wagenknecht - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.views.properties; + +/** + * Extension to the standard IPropertySource interface. + *

+ * This interface provides extended API to IPropertySource to + * allow an easier indication of properties that have a default value and can be + * resetted. + *

+ * + * @since 3.0 + * @see org.eclipse.ui.views.properties.IPropertySource + */ +public interface IPropertySource2 extends IPropertySource { + + /** + * Returns whether the value of the property with the specified id is + * resettable to a default value. + * + * @param id + * the id of the property + * @return true if the property with the specified id has a + * meaningfull default value to which it can be resetted to, and + * false otherwise + * @see IPropertySource#resetPropertyValue(Object) + * @see IPropertySource#isPropertySet(Object) + */ + boolean isPropertyResettable(Object id); +}