Class WorkbenchObservables


  • public class WorkbenchObservables
    extends Object
    Factory methods for creating observables for Workbench objects
    Since:
    3.5
    • Constructor Detail

      • WorkbenchObservables

        public WorkbenchObservables()
    • Method Detail

      • observeDetailAdaptedValue

        public static <T> IObservableValue<T> observeDetailAdaptedValue​(IObservableValue<?> master,
                                                                        Class<T> adapter)
        Returns an observable with values of the given target type. If the wrapped observable's value is of the target type, or can be adapted to the target type, this is taken as the value of the returned observable, otherwise null.
        Parameters:
        master - the observable whose value should be adapted
        adapter - the target type
        Returns:
        an observable with values of the given type, or null if the current value of the given observable does not adapt to the target type
      • observeAdaptedSingleSelection

        public static <T> IObservableValue<T> observeAdaptedSingleSelection​(IServiceLocator locator,
                                                                            Class<T> targetType)
        Returns an observable value that tracks the post selection of a selection service obtained through the given service locator, and adapts the first element of that selection to the given target type.

        This method can be used by view or editor implementers to tie into the selection service, for example as follows:

         IObservableValue<IResource> selection = WorkbenchObservables.observeAdaptedSingleSelection(getSite(),
                        IResource.class);
         
        Parameters:
        locator - a service locator with an available ISelectionService
        targetType - the target type
        Returns:
        an observable value whose value type is the given target type
      • observeActiveWorkbenchWindow

        public static IObservableValue<IWorkbenchWindow> observeActiveWorkbenchWindow​(IWorkbench workbench)
        Returns an observable value that tracks the active workbench window for the given workbench.
        Parameters:
        workbench - the workbench to get the observable for
        Returns:
        an observable value that tracks the active workbench window
        Since:
        3.110
      • observeActiveWorkbenchPage

        public static IObservableValue<IWorkbenchPage> observeActiveWorkbenchPage​(IWorkbenchWindow window)
        Returns an observable value that tracks the active workbench page for the given workbench window.
        Parameters:
        window - the workbench window to get the observable for
        Returns:
        an observable value that tracks the active workbench page
        Since:
        3.110
      • observeActivePart

        public static IObservableValue<IWorkbenchPartReference> observeActivePart​(IPartService partService)
        Returns an observable value that tracks the active workbench part for the given part service.
        Parameters:
        partService - the part service to get the observable for, e.g. a workbench page
        Returns:
        an observable value that tracks the active workbench part
        Since:
        3.110
      • observeActiveEditor

        public static IObservableValue<IEditorReference> observeActiveEditor​(IPartService partService)
        Returns an observable value that tracks the active editor for the given part service.
        Parameters:
        partService - the part service to get the observable for, e.g. a workbench page
        Returns:
        an observable value that tracks the active editor
        Since:
        3.110
      • observeEditorInput

        public static IObservableValue<IEditorInput> observeEditorInput​(IEditorPart editor)
        Returns an observable value that tracks the editor input for the given editor.
        Parameters:
        editor - the editor to get the observable for
        Returns:
        an observable value that tracks the editor input
        Since:
        3.110