public Object getEditableValue() { return _innerSource.getEditableValue(); }
@Override public String getText(Object object) { IPropertySource propertySource = propertySourceProvider .getPropertySource(object); IPropertyDescriptor[] propertyDescriptors = propertySource .getPropertyDescriptors(); for (IPropertyDescriptor propertyDescriptor : propertyDescriptors) { if (propertyID.equals(propertyDescriptor.getId())) { return propertyDescriptor.getLabelProvider().getText( propertySource.getPropertyValue(propertyID)); } } return ""; //$NON-NLS-1$ }
public boolean isPropertySet(Object id) { return _innerSource.isPropertySet(id); }
@Override protected Object getValue(Object object) { IPropertySource propertySource = propertySourceProvider .getPropertySource(object); Object value = propertySource.getPropertyValue(propertyID); IPropertySource valuePropertySource = propertySourceProvider .getPropertySource(value); if (valuePropertySource != null) { value = valuePropertySource.getEditableValue(); } return value; }
@Override public void resetPropertyValue() { if (parent == null) { // root does not have a default value return; } // Use our parent's values to reset our values. boolean change = false; Object[] objects = parent.getValues(); for (Object object : objects) { IPropertySource source = getPropertySource(object); 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; } } if (change) { refreshFromRoot(); } }
/** * Returns an map of property descriptors (keyed on id) for the given * property source. * * @param source * a property source for which to obtain descriptors * @return a table of descriptors keyed on their id */ private Map computePropertyDescriptorsFor(IPropertySource source) { IPropertyDescriptor[] descriptors = source.getPropertyDescriptors(); Map result = new HashMap(descriptors.length * 2 + 1); for (IPropertyDescriptor desc : descriptors) { result.put(desc.getId(), desc); } return result; }
@Override protected void setValue(Object object, Object value) { IPropertySource propertySource = propertySourceProvider .getPropertySource(object); propertySource.setPropertyValue(propertyID, value); } }
public void resetPropertyValue(Object id) { _innerSource.resetPropertyValue(id); }
/** * Update our value objects. We ask our parent for the property values based * on our descriptor. */ private void refreshValues() { // get our parent's value objects Object[] currentSources = parent.getValues(); // loop through the objects getting our property value from each Object[] newValues = new Object[currentSources.length]; for (int i = 0; i < currentSources.length; i++) { IPropertySource source = parent.getPropertySource(currentSources[i]); newValues[i] = source.getPropertyValue(descriptor.getId()); } // set our new values setValues(newValues); }
public void resetPropertyValue() { if (parent == null) { // root does not have a default value return; } // Use our parent's values to reset our values. boolean change = false; Object[] objects = parent.getValues(); 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; } } if (change) { refreshFromRoot(); } }
/** * Returns an map of property descritptors (keyed on id) for the given * property source. * * @param source * a property source for which to obtain descriptors * @return a table of decriptors keyed on their id */ private Map computePropertyDescriptorsFor(IPropertySource source) { IPropertyDescriptor[] descriptors = source.getPropertyDescriptors(); Map result = new HashMap(descriptors.length * 2 + 1); for (int i = 0; i < descriptors.length; i++) { result.put(descriptors[i].getId(), descriptors[i]); } return result; }
@Override protected Object getValue(Object object) { IPropertySource propertySource = propertySourceProvider .getPropertySource(object); Object value = propertySource.getPropertyValue(propertyID); IPropertySource valuePropertySource = propertySourceProvider .getPropertySource(value); if (valuePropertySource != null) { value = valuePropertySource.getEditableValue(); } return value; }
@Override protected void setValue(Object object, Object value) { IPropertySource propertySource = propertySourceProvider .getPropertySource(object); propertySource.setPropertyValue(propertyID, value); } }
/** * Update our value objects. We ask our parent for the property values based * on our descriptor. */ private void refreshValues() { // get our parent's value objects Object[] currentSources = parent.getValues(); // loop through the objects getting our property value from each Object[] newValues = new Object[currentSources.length]; for (int i = 0; i < currentSources.length; i++) { IPropertySource source = parent .getPropertySource(currentSources[i]); newValues[i] = source.getPropertyValue(descriptor.getId()); } // set our new values setValues(newValues); }
@Override public Image getImage(Object object) { IPropertySource propertySource = propertySourceProvider .getPropertySource(object); IPropertyDescriptor[] propertyDescriptors = propertySource .getPropertyDescriptors(); for (IPropertyDescriptor propertyDescriptor : propertyDescriptors) { if (propertyID.equals(propertyDescriptor.getId())) { return propertyDescriptor.getLabelProvider().getImage( propertySource.getPropertyValue(propertyID)); } } return null; } }
@Override public void resetPropertyValue() { if (parent == null) { // root does not have a default value return; } // Use our parent's values to reset our values. boolean change = false; Object[] objects = parent.getValues(); for (Object object : objects) { IPropertySource source = getPropertySource(object); 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; } } if (change) { refreshFromRoot(); } }
/** * Returns an map of property descriptors (keyed on id) for the given * property source. * * @param source * a property source for which to obtain descriptors * @return a table of descriptors keyed on their id */ private Map<Object, IPropertyDescriptor> computePropertyDescriptorsFor(IPropertySource source) { IPropertyDescriptor[] descriptors = source.getPropertyDescriptors(); Map<Object, IPropertyDescriptor> result = new HashMap<>(descriptors.length * 2 + 1); for (IPropertyDescriptor desc : descriptors) { result.put(desc.getId(), desc); } return result; }
/** * Returns the edit value for the object at the given index. * * @param index * the value object index * @return the edit value for the object at the given index */ protected Object getEditValue(int index) { Object value = values[index]; IPropertySource source = getPropertySource(value); if (source != null) { value = source.getEditableValue(); } return value; }
/** * The value of the given child entry has changed. Therefore we must set * this change into our value objects. * <p> * We must inform our parent so that it can update its value objects * </p> * <p> * Subclasses may override to set the property value in some custom way. * </p> * * @param child * the child entry that changed its value */ protected void valueChanged(PropertySheetEntry child) { for (int i = 0; i < values.length; i++) { IPropertySource source = getPropertySource(values[i]); source.setPropertyValue(child.getDescriptor().getId(), child.getEditValue(i)); } // inform our parent if (parent != null) { parent.valueChanged(this); } }
/** * Update our value objects. We ask our parent for the property values based * on our descriptor. */ private void refreshValues() { // get our parent's value objects Object[] currentSources = parent.getValues(); // loop through the objects getting our property value from each Object[] newValues = new Object[currentSources.length]; for (int i = 0; i < currentSources.length; i++) { IPropertySource source = parent .getPropertySource(currentSources[i]); newValues[i] = source.getPropertyValue(descriptor.getId()); } // set our new values setValues(newValues); }