]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/jface/ActiveSelectionProvider.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / jface / ActiveSelectionProvider.java
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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.utils.ui.jface;\r
13 \r
14 import org.eclipse.jface.viewers.ISelection;\r
15 import org.eclipse.jface.viewers.ISelectionProvider;\r
16 \r
17 /**\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
21  * \r
22  * <p>\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
26  * </p>\r
27  * \r
28  * @author Tuukka Lehtonen\r
29  */\r
30 public class ActiveSelectionProvider extends BaseSelectionProvider {\r
31 \r
32     /**\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
36      */\r
37     public ActiveSelectionProvider() {\r
38         super();\r
39     }\r
40 \r
41     /**\r
42      * Overrides default {@link BaseSelectionProvider#setSelection(ISelection)}\r
43      * behaviour with the behaviour of\r
44      * {@link BaseSelectionProvider#setAndFireNonEqualSelection(ISelection)}.\r
45      */\r
46     @Override\r
47     public void setSelection(ISelection selection) {\r
48         super.setAndFireNonEqualSelection(selection);\r
49     }\r
50 \r
51 }\r