Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 21756 | Differences between
and this patch

Collapse All | Expand All

(-)IPropertySource.java (-4 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2003 IBM Corporation and others.
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-12 Link Here
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Gunnar Wagenknecht - fix for bug 21756 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=21756)
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.ui.views.properties;
12
package org.eclipse.ui.views.properties;
12
13
Lines 29-34 Link Here
29
 * @see org.eclipse.core.runtime.IAdaptable
30
 * @see org.eclipse.core.runtime.IAdaptable
30
 * @see org.eclipse.core.runtime.Platform#getAdapterManager()
31
 * @see org.eclipse.core.runtime.Platform#getAdapterManager()
31
 * @see org.eclipse.ui.views.properties.PropertySheetPage
32
 * @see org.eclipse.ui.views.properties.PropertySheetPage
33
 * @see org.eclipse.ui.views.properties.IPropertySourceExtension
32
 */
34
 */
33
public interface IPropertySource {
35
public interface IPropertySource {
34
36
Lines 99-111 Link Here
99
public Object getPropertyValue(Object id);
101
public Object getPropertyValue(Object id);
100
/**
102
/**
101
 * Returns whether the value of the property with the given id has changed from
103
 * Returns whether the value of the property with the given id has changed from
102
 * its default value. Returns <code>false</code> if the notion of default value
104
 * its default value. Returns <code>false</code> if this source does not have
103
 * is not meaningful for the specified property, or if this source does not have
104
 * the specified property.
105
 * the specified property.
106
 * <p>
107
 * If the notion of default value is not meaningful for the specified property
108
 * than <code>true</code> is returned. 
109
 * </p>
105
 * 
110
 * 
106
 * @param id the id of the property 
111
 * @param id the id of the property 
107
 * @return <code>true</code> if the value of the specified property has changed
112
 * @return <code>true</code> if the value of the specified property has changed
108
 *   from its original default value, and <code>false</code> otherwise
113
 *   from its original default value or if the specified property does not have 
114
 *   a meaningfull default value, and <code>false</code> otherwise
115
 * @see IPropertySourceExtension#isPropertyResettable(Object)
109
 */
116
 */
110
public boolean isPropertySet(Object id);
117
public boolean isPropertySet(Object id);
111
/**
118
/**
(-)PropertySheetEntry.java (-1 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2003 IBM Corporation and others.
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-12 Link Here
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Gunnar Wagenknecht - fix for bug 21756 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=21756)
10
 *******************************************************************************/
11
 *******************************************************************************/
11
12
12
package org.eclipse.ui.views.properties;
13
package org.eclipse.ui.views.properties;
Lines 512-517 Link Here
512
	for (int i = 0; i < objects.length; i++){
513
	for (int i = 0; i < objects.length; i++){
513
		IPropertySource source = getPropertySource(objects[i]);
514
		IPropertySource source = getPropertySource(objects[i]);
514
		if (source.isPropertySet(descriptor.getId())) {
515
		if (source.isPropertySet(descriptor.getId())) {
516
            // fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=21756
517
            if(source instanceof IPropertySourceExtension) {
518
                IPropertySourceExtension extendedSource = (IPropertySourceExtension) source;
519
                // continue with next if property id not resettable
520
                if (!extendedSource.isPropertyResettable(descriptor.getId()))
521
                    continue;
522
            }
515
			source.resetPropertyValue(descriptor.getId());
523
			source.resetPropertyValue(descriptor.getId());
516
			change = true;
524
			change = true;
517
		}
525
		}
(-)src/org/eclipse/ui/views/properties/IPropertySourceExtension.java (+36 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     Gunnar Wagenknecht - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.ui.views.properties;
12
13
/**
14
 * Extension to the standard <code>IPropertySource</code> interface.
15
 * <p>
16
 * This interface provides extended API to <code>IPropertySource</code>
17
 * to allow an easier indication of properties that have a default value
18
 * and can be resetted. 
19
 * </p>
20
 * 
21
 * @since 3.0
22
 * @see org.eclipse.ui.views.properties.IPropertySource
23
 */
24
public interface IPropertySourceExtension extends IPropertySource
25
{
26
    /**
27
     * Returns whether the value of the property with the specified id
28
     * is resettable to a default value. 
29
     * 
30
     * @param id the id of the property
31
     * @return <code>true</code> if the property with the specified id has
32
     *    a meaningfull default value to which it can be resetted to, and 
33
     *    <code>false</code> otherwise
34
     */
35
    boolean isPropertyResettable(Object id);
36
}

Return to bug 21756