1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2011 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.db.management;
\r
15 * @see ISessionContextChangedListener
\r
16 * @see SessionContextChangedEvent
\r
17 * @see ISessionContext
\r
19 * @author Tuukka Lehtonen
\r
21 public interface ISessionContextProvider {
\r
24 * Adds a listener for selection changes in this selection provider.
\r
25 * Has no effect if an identical listener is already registered.
\r
27 * @param listener a session context changed listener
\r
29 public void addContextChangedListener(ISessionContextChangedListener listener);
\r
32 * Returns the current selection for this provider.
\r
34 * @return the current session context
\r
36 public ISessionContext getSessionContext();
\r
39 * Removes the given selection change listener from this selection provider.
\r
40 * Has no affect if an identical listener is not registered.
\r
42 * @param listener a session context changed listener
\r
44 public void removeContextChangedListener(ISessionContextChangedListener listener);
\r
47 * Sets the current selection for this selection provider. The operation
\r
48 * must only fire {@link ISessionContextChangedListener}s if the
\r
49 * ISessionContext actually changed in the {@link #equals(Object)} sense.
\r
51 * @param context the new session context
\r
52 * @return the old ISessionContext or <code>null</code> there was no
\r
55 public ISessionContext setSessionContext(ISessionContext context);
\r