Class ViatraObservables
- java.lang.Object
-
- org.eclipse.viatra.addon.databinding.runtime.api.ViatraObservables
-
public final class ViatraObservables extends java.lang.Object
Utility class for observing VIATRA Query related objects, such as match sets, match parameters.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
OBSERVABLEVALUE_ANNOTATION
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,ObservableDefinition>
calculateObservableValues(IQuerySpecification<?> query)
Calculates the list ofObservableDefinition
s from a query.static org.eclipse.core.databinding.observable.value.IObservableValue
getObservableLabelFeature(IPatternMatch match, java.lang.String expression)
Returns anIObservableValue
that observes the pattern match and converts it to the given expression.static org.eclipse.core.databinding.observable.value.IObservableValue
getObservableLabelFeature(IPatternMatch match, java.lang.String expression, java.lang.Object container)
Returns anIObservableValue
that observes the pattern match and converts it to the given expression.static org.eclipse.core.databinding.observable.value.IObservableValue
getObservableValue(IPatternMatch match, java.lang.String expression)
Returns an IObservableValue for the given match based on the given expression.static java.util.List<org.eclipse.core.databinding.observable.value.IObservableValue>
observeAllAttributes(org.eclipse.core.databinding.observable.value.IValueChangeListener changeListener, java.lang.Object object)
Registers the given change listener on the given object's all accessible fields.static java.util.List<org.eclipse.core.databinding.observable.value.IObservableValue>
observeFeatures(IPatternMatch match, org.eclipse.core.databinding.observable.value.IValueChangeListener changeListener, java.lang.String message)
Registers the given changeListener for the appropriate features of the given signature.static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>>
org.eclipse.core.databinding.observable.list.IObservableListobserveMatchesAsList(Matcher matcher)
Create an observable list of the match set of the givenViatraQueryMatcher
.static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>>
org.eclipse.core.databinding.observable.list.IObservableListobserveMatchesAsList(IQuerySpecification<Matcher> querySpecification, ViatraQueryEngine engine)
Create an observable list of the match set of the given query using a selectedViatraQueryEngine
.static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>>
org.eclipse.core.databinding.observable.list.IObservableListobserveMatchesAsList(IQuerySpecification<Matcher> querySpecification, ViatraQueryEngine engine, Match filter)
Create an observable list of the match set of the given query using a selectedViatraQueryEngine
.static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>>
org.eclipse.core.databinding.observable.set.IObservableSetobserveMatchesAsSet(Matcher matcher)
Create an observable set of the match set of the givenViatraQueryMatcher
.static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>>
org.eclipse.core.databinding.observable.set.IObservableSetobserveMatchesAsSet(IQuerySpecification<Matcher> querySpecification, ViatraQueryEngine engine)
Create an observable set of the match set of the given query using a selectedViatraQueryEngine
.static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>>
org.eclipse.core.databinding.observable.set.IObservableSetobserveMatchesAsSet(IQuerySpecification<Matcher> querySpecification, ViatraQueryEngine engine, Match filter)
Create an observable set of the match set of the given query using a selectedViatraQueryEngine
.
-
-
-
Field Detail
-
OBSERVABLEVALUE_ANNOTATION
public static final java.lang.String OBSERVABLEVALUE_ANNOTATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
observeMatchesAsList
public static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>> org.eclipse.core.databinding.observable.list.IObservableList observeMatchesAsList(Matcher matcher)
Create an observable list of the match set of the givenViatraQueryMatcher
.The matches are ordered by appearance, so a new match is always put on the end of the list.
- Parameters:
matcher
- the matcher to observe- Returns:
- an observable list of matches
-
observeMatchesAsList
public static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>> org.eclipse.core.databinding.observable.list.IObservableList observeMatchesAsList(IQuerySpecification<Matcher> querySpecification, ViatraQueryEngine engine)
Create an observable list of the match set of the given query using a selectedViatraQueryEngine
.The matches are ordered by appearance, so a new match is always put on the end of the list.
Use the generated query specifications for initialization, in the generic case, you may have to accept an unchecked invocation (or use the Generic classes if you are sure).
- Parameters:
querySpecification
- the matcher querySpecification for the query to observeengine
- the engine used with the matcher- Returns:
- an observable list of matches
-
observeMatchesAsList
public static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>> org.eclipse.core.databinding.observable.list.IObservableList observeMatchesAsList(IQuerySpecification<Matcher> querySpecification, ViatraQueryEngine engine, Match filter)
Create an observable list of the match set of the given query using a selectedViatraQueryEngine
.The matches are ordered by appearance, so a new match is always put on the end of the list.
Use the generated query specifications for initialization, in the generic case, you may have to accept an unchecked invocation (or use the Generic classes if you are sure).
- Parameters:
querySpecification
- the matcher querySpecification for the query to observeengine
- the engine used with the matcherfilter
- the partial match to be used as filter- Returns:
- an observable list of matches
-
observeMatchesAsSet
public static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>> org.eclipse.core.databinding.observable.set.IObservableSet observeMatchesAsSet(Matcher matcher)
Create an observable set of the match set of the givenViatraQueryMatcher
.- Parameters:
matcher
- the matcher to observe- Returns:
- an observable list of matches
-
observeMatchesAsSet
public static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>> org.eclipse.core.databinding.observable.set.IObservableSet observeMatchesAsSet(IQuerySpecification<Matcher> querySpecification, ViatraQueryEngine engine)
Create an observable set of the match set of the given query using a selectedViatraQueryEngine
.Use the generated query specifications for initialization, in the generic case, you may have to accept an unchecked invocation (or use the Generic classes if you are sure).
- Parameters:
querySpecification
- the matcher querySpecification for the query to observeengine
- the engine used with the matcher- Returns:
- an observable set of matches
-
observeMatchesAsSet
public static <Match extends IPatternMatch,Matcher extends ViatraQueryMatcher<Match>> org.eclipse.core.databinding.observable.set.IObservableSet observeMatchesAsSet(IQuerySpecification<Matcher> querySpecification, ViatraQueryEngine engine, Match filter)
Create an observable set of the match set of the given query using a selectedViatraQueryEngine
.Use the generated query specifications for initialization, in the generic case, you may have to accept an unchecked invocation (or use the Generic classes if you are sure).
- Parameters:
querySpecification
- the matcher querySpecification for the query to observeengine
- the engine used with the matcherfilter
- the partial match to be used as filter- Returns:
- an observable set of matches
-
observeFeatures
public static java.util.List<org.eclipse.core.databinding.observable.value.IObservableValue> observeFeatures(IPatternMatch match, org.eclipse.core.databinding.observable.value.IValueChangeListener changeListener, java.lang.String message)
Registers the given changeListener for the appropriate features of the given signature. The features will be computed based on the message parameter.- Parameters:
match
-changeListener
- the change listenermessage
- the message which can be found in the appropriate PatternUI annotation- Returns:
- the list of IObservableValue instances for which the IValueChangeListener was registered
-
observeAllAttributes
public static java.util.List<org.eclipse.core.databinding.observable.value.IObservableValue> observeAllAttributes(org.eclipse.core.databinding.observable.value.IValueChangeListener changeListener, java.lang.Object object)
Registers the given change listener on the given object's all accessible fields. This function uses Java Reflection.- Parameters:
changeListener
- the change listenerobject
- the observed object- Returns:
- the list of IObservableValue instances for which the IValueChangeListener was registered
-
getObservableValue
public static org.eclipse.core.databinding.observable.value.IObservableValue getObservableValue(IPatternMatch match, java.lang.String expression)
Returns an IObservableValue for the given match based on the given expression. If an attribute is not present in the expression than it tries with the 'name' attribute. If it is not present the returned value will be null.- Parameters:
match
- the match objectexpression
- the expression- Returns:
- IObservableValue instance or null
-
getObservableLabelFeature
public static org.eclipse.core.databinding.observable.value.IObservableValue getObservableLabelFeature(IPatternMatch match, java.lang.String expression)
Returns anIObservableValue
that observes the pattern match and converts it to the given expression.
-
getObservableLabelFeature
public static org.eclipse.core.databinding.observable.value.IObservableValue getObservableLabelFeature(IPatternMatch match, java.lang.String expression, java.lang.Object container)
Returns anIObservableValue
that observes the pattern match and converts it to the given expression. The given container is also stored in the createdObservableLabelFeature
.
-
calculateObservableValues
public static java.util.Map<java.lang.String,ObservableDefinition> calculateObservableValues(IQuerySpecification<?> query)
Calculates the list ofObservableDefinition
s from a query.- Parameters:
query
-
-
-