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