1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.utils.ui.jface;
14 import org.eclipse.jface.viewers.ISelection;
15 import org.eclipse.jface.viewers.ISelectionProvider;
18 * A base implementation of ISelectionProvider that fires selection events on
19 * {@link #setSelection(ISelection)} <strong>only if</strong> the selection
20 * differs from the previous selection.
23 * Contains an empty StructuredSelection by default. This version provides an
24 * implementation that by default notifies of all selection changes that
25 * actually changed the selection contents.
28 * @author Tuukka Lehtonen
30 public class ActiveSelectionProvider extends BaseSelectionProvider {
33 * Create new ActiveSelectionProvider. Selection change notifications will
34 * run synchronously in the thread that invoked
35 * {@link ISelectionProvider#setSelection(ISelection)}.
37 public ActiveSelectionProvider() {
42 * Overrides default {@link BaseSelectionProvider#setSelection(ISelection)}
43 * behaviour with the behaviour of
44 * {@link BaseSelectionProvider#setAndFireNonEqualSelection(ISelection)}.
47 public void setSelection(ISelection selection) {
48 super.setAndFireNonEqualSelection(selection);