]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.management/src/org/simantics/db/management/ISessionContextProvider.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.management / src / org / simantics / db / management / ISessionContextProvider.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 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.db.management;
13
14 /**
15  * @see ISessionContextChangedListener
16  * @see SessionContextChangedEvent
17  * @see ISessionContext
18  * 
19  * @author Tuukka Lehtonen
20  */
21 public interface ISessionContextProvider {
22
23     /**
24      * Adds a listener for selection changes in this selection provider.
25      * Has no effect if an identical listener is already registered.
26      *
27      * @param listener a session context changed listener
28      */
29     public void addContextChangedListener(ISessionContextChangedListener listener);
30
31     /**
32      * Returns the current selection for this provider.
33      * 
34      * @return the current session context
35      */
36     public ISessionContext getSessionContext();
37
38     /**
39      * Removes the given selection change listener from this selection provider.
40      * Has no affect if an identical listener is not registered.
41      *
42      * @param listener a session context changed listener
43      */
44     public void removeContextChangedListener(ISessionContextChangedListener listener);
45
46     /**
47      * Sets the current selection for this selection provider. The operation
48      * must only fire {@link ISessionContextChangedListener}s if the
49      * ISessionContext actually changed in the {@link #equals(Object)} sense.
50      * 
51      * @param context the new session context
52      * @return the old ISessionContext or <code>null</code> there was no
53      *         previous context
54      */
55     public ISessionContext setSessionContext(ISessionContext context);
56
57 }