Index: src/org/eclipse/ui/views/properties/PropertySheetEntry.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java,v retrieving revision 1.25 diff -u -r1.25 PropertySheetEntry.java --- src/org/eclipse/ui/views/properties/PropertySheetEntry.java 12 Sep 2006 18:58:38 -0000 1.25 +++ src/org/eclipse/ui/views/properties/PropertySheetEntry.java 10 May 2007 20:03:05 -0000 @@ -139,8 +139,13 @@ } } else if (!editValue.equals(newValue)) { changed = true; + } else if (editValue instanceof IPropertySourceContainer) { + Object lastValue = ((IPropertySourceContainer)editValue).getLastValue(); + Object theValue = ((IPropertySourceContainer)newValue).getValue(); + if (!lastValue.equals(theValue)) + changed = true; } - + // Set the editor value if (changed) { setValue(newValue); Index: src/org/eclipse/ui/views/properties/PropertyDescriptorInfo.java =================================================================== RCS file: src/org/eclipse/ui/views/properties/PropertyDescriptorInfo.java diff -N src/org/eclipse/ui/views/properties/PropertyDescriptorInfo.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/ui/views/properties/PropertyDescriptorInfo.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,15 @@ +package org.eclipse.ui.views.properties; + +import org.eclipse.ui.views.properties.PropertyDescriptor; + +public class PropertyDescriptorInfo { + public PropertyDescriptorInfo(PropertyDescriptor descriptor, Object defaultValue) { + fID = descriptor.getId(); + fDescriptor = descriptor; + fValue = defaultValue; + } + + PropertyDescriptor fDescriptor; + Object fValue; + Object fID; +} Index: src/org/eclipse/ui/views/properties/PropertyContainer.java =================================================================== RCS file: src/org/eclipse/ui/views/properties/PropertyContainer.java diff -N src/org/eclipse/ui/views/properties/PropertyContainer.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/ui/views/properties/PropertyContainer.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,160 @@ +package org.eclipse.ui.views.properties; + +import java.util.ArrayList; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.IPropertySource; +import org.eclipse.ui.views.properties.IPropertySource2; +import org.eclipse.ui.views.properties.IPropertySourceContainer; + +public class PropertyContainer implements IAdaptable, IPropertySource2, IPropertySourceContainer { + private Object fLastValue = new Object(); + private Object fValue; + //private ArrayList fDescriptorInfo = new ArrayList(); + private ArrayList fDescriptorInfo = new ArrayList(); + private IPropertyDescriptor[] fPropertyDescriptor; + + public PropertyContainer() { + } + + public PropertyContainer(Object defaultValue) { + fValue = defaultValue; + } + + public PropertyContainer(PropertyContainer container) { + fValue = container.fValue; + fDescriptorInfo = container.fDescriptorInfo; + fPropertyDescriptor = container.fPropertyDescriptor; + } + + /** + * Add the descriptor info into the collection. + * @param info the descriptor info object. + */ + public void addDescriptorInfo(PropertyDescriptorInfo info) { + fDescriptorInfo.add(info); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.views.properties.IPropertySourceContainer#setValue(java.lang.Object) + */ + public void setValue(Object value) { + fLastValue = fValue; + fValue = value; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.views.properties.IPropertySourceContainer#getValue() + */ + public Object getValue() { + return fValue; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.views.properties.IPropertySourceContainer#getLastValue() + */ + public Object getLastValue() { + return fLastValue; + } + + /** + * Return the string value. + */ + public String toString() { + if (fValue != null) + return fValue.toString(); + else + return ""; //$NON-NLS-1$ + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors() + */ + public IPropertyDescriptor[] getPropertyDescriptors() { + if (fPropertyDescriptor == null) { + fPropertyDescriptor = new IPropertyDescriptor[fDescriptorInfo.size()]; + for (int i = 0; i < fPropertyDescriptor.length; ++i) + fPropertyDescriptor[i] = ((PropertyDescriptorInfo)fDescriptorInfo.get(i)).fDescriptor; + } + return fPropertyDescriptor; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object) + */ + public Object getPropertyValue(Object id) { + for (int i = 0; i < fDescriptorInfo.size(); ++i) + if (((PropertyDescriptorInfo)fDescriptorInfo.get(i)).fID.equals(id)) { + return ((PropertyDescriptorInfo)fDescriptorInfo.get(i)).fValue; + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object) + */ + public void setPropertyValue(Object id, Object value) { + for (int i = 0; i < fDescriptorInfo.size(); ++i) + if (((PropertyDescriptorInfo)fDescriptorInfo.get(i)).fID.equals(id)) { + ((PropertyDescriptorInfo)fDescriptorInfo.get(i)).fValue = value; + break; + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) + */ + public Object getAdapter(Class adapter) { + if (adapter.equals(IPropertySource.class) || adapter.equals(IPropertySource2.class)) { + return this; + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertyResettable(java.lang.Object) + */ + public boolean isPropertyResettable(Object id) { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertySet(java.lang.Object) + */ + public boolean isPropertySet(Object id) { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue() + */ + public Object getEditableValue() { + return this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object) + */ + public void resetPropertyValue(Object id) { + } +} Index: src/org/eclipse/ui/views/properties/IPropertySourceContainer.java =================================================================== RCS file: src/org/eclipse/ui/views/properties/IPropertySourceContainer.java diff -N src/org/eclipse/ui/views/properties/IPropertySourceContainer.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/ui/views/properties/IPropertySourceContainer.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +// TI_FIX [pchuong] : new interface to support having a combo-box and checkbox +// at the parent node of the property viewer. + +package org.eclipse.ui.views.properties; + +/** + * @since 3.2 + * + */ +public interface IPropertySourceContainer { + /** + * Get the last value for the source container. + * @return the last value. + */ + Object getLastValue(); + + /** + * Get the current value for the source container. + * @return the current value. + */ + Object getValue(); + + /** + * Set the current value for the source container. + * @param value the new value. + */ + void setValue(Object value); +}