]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/jface/ActiveSelectionProvider.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / jface / ActiveSelectionProvider.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.utils.ui.jface;
13
14 import org.eclipse.jface.viewers.ISelection;
15 import org.eclipse.jface.viewers.ISelectionProvider;
16
17 /**
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.
21  * 
22  * <p>
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.
26  * </p>
27  * 
28  * @author Tuukka Lehtonen
29  */
30 public class ActiveSelectionProvider extends BaseSelectionProvider {
31
32     /**
33      * Create new ActiveSelectionProvider. Selection change notifications will
34      * run synchronously in the thread that invoked
35      * {@link ISelectionProvider#setSelection(ISelection)}.
36      */
37     public ActiveSelectionProvider() {
38         super();
39     }
40
41     /**
42      * Overrides default {@link BaseSelectionProvider#setSelection(ISelection)}
43      * behaviour with the behaviour of
44      * {@link BaseSelectionProvider#setAndFireNonEqualSelection(ISelection)}.
45      */
46     @Override
47     public void setSelection(ISelection selection) {
48         super.setAndFireNonEqualSelection(selection);
49     }
50
51 }