/** * @param target */ public DuplexingObservableValue(IObservableList target) { this(target, target.getElementType()); }
/** * @param list */ public ListToSetAdapter(IObservableList list) { super(list.getRealm(), new HashSet(), list.getElementType()); this.list = list; wrappedSet.addAll(list); this.list.addListChangeListener(listener); }
/** * @param target * @param validationStatus */ public ValidatedObservableList(final IObservableList<E> target, final IObservableValue<IStatus> validationStatus) { super(target.getRealm(), new ArrayList<>(target), target.getElementType()); Assert.isNotNull(validationStatus, "Validation status observable cannot be null"); //$NON-NLS-1$ Assert.isTrue(target.getRealm().equals(validationStatus.getRealm()), "Target and validation status observables must be on the same realm"); //$NON-NLS-1$ this.target = target; this.validationStatus = validationStatus; target.addListChangeListener(targetChangeListener); target.addStaleListener(targetStaleListener); validationStatus.addValueChangeListener(validationStatusChangeListener); }
/** * @param target * @param validationStatus */ public ValidatedObservableList(final IObservableList target, final IObservableValue validationStatus) { super(target.getRealm(), new ArrayList(target), target.getElementType()); Assert.isNotNull(validationStatus, "Validation status observable cannot be null"); //$NON-NLS-1$ Assert .isTrue(target.getRealm().equals(validationStatus.getRealm()), "Target and validation status observables must be on the same realm"); //$NON-NLS-1$ this.target = target; this.validationStatus = validationStatus; target.addListChangeListener(targetChangeListener); target.addStaleListener(targetStaleListener); validationStatus.addValueChangeListener(validationStatusChangeListener); }
/** * * @param source * @param destination */ protected void fillDefaults(IObservableList source, IObservableList destination) { Object sourceType = source.getElementType(); Object destinationType = destination.getElementType(); if (provideDefaults && sourceType != null && destinationType != null) { if (converter == null) { setConverter(createConverter(sourceType, destinationType)); } } if (converter != null) { if (sourceType != null) { checkAssignable(converter.getFromType(), sourceType, "converter does not convert from type " + sourceType); //$NON-NLS-1$ } if (destinationType != null) { checkAssignable(destinationType, converter.getToType(), "converter does not convert to type " + destinationType); //$NON-NLS-1$ } } }
/** * @param target * @param validationStatus */ public ValidatedObservableList(final IObservableList target, final IObservableValue validationStatus) { super(target.getRealm(), new ArrayList(target), target.getElementType()); Assert.isNotNull(validationStatus, "Validation status observable cannot be null"); //$NON-NLS-1$ Assert .isTrue(target.getRealm().equals(validationStatus.getRealm()), "Target and validation status observables must be on the same realm"); //$NON-NLS-1$ this.target = target; this.validationStatus = validationStatus; target.addListChangeListener(targetChangeListener); target.addStaleListener(targetStaleListener); validationStatus.addValueChangeListener(validationStatusChangeListener); }
/** * * @param source * @param destination */ @SuppressWarnings("unchecked") protected void fillDefaults(IObservableList<? extends S> source, IObservableList<? super D> destination) { Object sourceType = source.getElementType(); Object destinationType = destination.getElementType(); if (provideDefaults && sourceType != null && destinationType != null) { if (converter == null) { setConverter((IConverter<S, D>) createConverter(sourceType, destinationType)); } } if (converter != null) { if (sourceType != null) { checkAssignable(converter.getFromType(), sourceType, "converter does not convert from type " + sourceType); //$NON-NLS-1$ } if (destinationType != null) { checkAssignable(destinationType, converter.getToType(), "converter does not convert to type " + destinationType); //$NON-NLS-1$ } } }
/** * * @param source * @param destination */ protected void fillDefaults(IObservableList source, IObservableList destination) { Object sourceType = source.getElementType(); Object destinationType = destination.getElementType(); if (provideDefaults && sourceType != null && destinationType != null) { if (converter == null) { setConverter(createConverter(sourceType, destinationType)); } } if (converter != null) { if (sourceType != null) { checkAssignable(converter.getFromType(), sourceType, "converter does not convert from type " + sourceType); //$NON-NLS-1$ } if (destinationType != null) { checkAssignable(destinationType, converter.getToType(), "converter does not convert to type " + destinationType); //$NON-NLS-1$ } } }
private void updateInnerObservableList() { if (innerObservableList != null) { innerObservableList.removeListChangeListener(innerChangeListener); innerObservableList.dispose(); } currentOuterValue = outerObservableValue.getValue(); if (currentOuterValue == null) { innerObservableList = null; wrappedList = Collections.EMPTY_LIST; } else { ObservableTracker.setIgnore(true); try { innerObservableList = (IObservableList) factory .createObservable(currentOuterValue); } finally { ObservableTracker.setIgnore(false); } DetailObservableHelper.warnIfDifferentRealms(getRealm(), innerObservableList.getRealm()); wrappedList = innerObservableList; if (detailType != null) { Object innerValueType = innerObservableList.getElementType(); Assert.isTrue(getElementType().equals(innerValueType), "Cannot change value type in a nested observable list"); //$NON-NLS-1$ } innerObservableList.addListChangeListener(innerChangeListener); } }