| /******************************************************************************* |
| * Copyright (c) 2006, 2007 IBM Corporation 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: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.jface.databinding.viewers; |
| |
| import org.eclipse.core.databinding.observable.value.IObservableValue; |
| import org.eclipse.jface.databinding.swt.SWTObservables; |
| import org.eclipse.jface.internal.databinding.internal.viewers.SelectionProviderSingleSelectionObservableValue; |
| import org.eclipse.jface.viewers.ISelectionProvider; |
| import org.eclipse.swt.widgets.Display; |
| |
| /** |
| * @since 3.3 |
| * |
| */ |
| public class ViewersObservables { |
| |
| /** |
| * @param selectionProvider |
| * @return the observable value tracking the (single) selection of the given |
| * selection provider |
| */ |
| public static IObservableValue observeSingleSelection( |
| ISelectionProvider selectionProvider) { |
| return new SelectionProviderSingleSelectionObservableValue( |
| SWTObservables.getRealm(Display.getDefault()), |
| selectionProvider); |
| } |
| |
| } |