Class ViatraObservables


  • public final class ViatraObservables
    extends java.lang.Object
    Utility class for observing VIATRA Query related objects, such as match sets, match parameters.
    • 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 given ViatraQueryMatcher.

        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 selected ViatraQueryEngine.

        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 observe
        engine - 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 selected ViatraQueryEngine.

        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 observe
        engine - the engine used with the matcher
        filter - 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 given ViatraQueryMatcher.
        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 selected ViatraQueryEngine.

        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 observe
        engine - 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 selected ViatraQueryEngine.

        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 observe
        engine - the engine used with the matcher
        filter - 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 listener
        message - 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 listener
        object - 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 object
        expression - 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 an IObservableValue 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 an IObservableValue that observes the pattern match and converts it to the given expression. The given container is also stored in the created ObservableLabelFeature.