KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > databinding > viewers > ViewersObservables


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.jface.databinding.viewers;
13
14 import org.eclipse.core.databinding.observable.value.IObservableValue;
15 import org.eclipse.jface.databinding.swt.SWTObservables;
16 import org.eclipse.jface.internal.databinding.internal.viewers.SelectionProviderSingleSelectionObservableValue;
17 import org.eclipse.jface.viewers.ISelectionProvider;
18 import org.eclipse.swt.widgets.Display;
19
20 /**
21  * @since 1.1
22  *
23  */

24 public class ViewersObservables {
25
26     /**
27      * @param selectionProvider
28      * @return the observable value tracking the (single) selection of the given
29      * selection provider
30      */

31     public static IObservableValue observeSingleSelection(
32             ISelectionProvider selectionProvider) {
33         return new SelectionProviderSingleSelectionObservableValue(
34                 SWTObservables.getRealm(Display.getDefault()),
35                 selectionProvider);
36     }
37
38 }
39
Popular Tags