1 /*******************************************************************************2 * Copyright (c) 2006, 2007 IBM Corporation and others.3 * All rights reserved. This program and the accompanying materials4 * are made available under the terms of the Eclipse Public License v1.05 * which accompanies this distribution, and is available at6 * http://www.eclipse.org/legal/epl-v10.html7 *8 * Contributors:9 * IBM Corporation - initial API and implementation10 *******************************************************************************/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.122 * 23 */24 public class ViewersObservables {25 26 /**27 * @param selectionProvider28 * @return the observable value tracking the (single) selection of the given29 * selection provider30 */31 public static IObservableValue observeSingleSelection(32 ISelectionProvider selectionProvider) {33 return new SelectionProviderSingleSelectionObservableValue(34 SWTObservables.getRealm(Display.getDefault()),35 selectionProvider);36 }37 38 }39