blob: 54435a5e751ca59c8532ac563a0a715338780b6f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*******************************************************************************
* Copyright (c) 2008, 2009 Matthew Hall 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:
* Matthew Hall - initial API and implementation (bug 194734)
******************************************************************************/
package org.eclipse.core.internal.databinding.property;
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.property.map.IMapProperty;
import org.eclipse.core.databinding.property.map.MapProperty;
import org.eclipse.core.databinding.property.value.IValueProperty;
/**
* @since 3.3
*
*/
public class ValuePropertyDetailMap extends MapProperty {
private final IValueProperty masterProperty;
private final IMapProperty detailProperty;
/**
* @param masterProperty
* @param detailProperty
*/
public ValuePropertyDetailMap(IValueProperty masterProperty,
IMapProperty detailProperty) {
this.masterProperty = masterProperty;
this.detailProperty = detailProperty;
}
public Object getKeyType() {
return detailProperty.getKeyType();
}
public Object getValueType() {
return detailProperty.getValueType();
}
public IObservableMap observe(Realm realm, Object source) {
IObservableValue masterValue = masterProperty.observe(realm, source);
IObservableMap detailMap = detailProperty.observeDetail(masterValue);
PropertyObservableUtil.cascadeDispose(detailMap, masterValue);
return detailMap;
}
public IObservableMap observeDetail(IObservableValue master) {
IObservableValue masterValue = masterProperty.observeDetail(master);
IObservableMap detailMap = detailProperty.observeDetail(masterValue);
PropertyObservableUtil.cascadeDispose(detailMap, masterValue);
return detailMap;
}
public String toString() {
return masterProperty + " => " + detailProperty; //$NON-NLS-1$
}
}
|