01: /*
02: *
03: * JMoney - A Personal Finance Manager
04: * Copyright (c) 2002 Johann Gyger <johann.gyger@switzerland.org>
05: * Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net>
06: *
07: *
08: * This program is free software; you can redistribute it and/or modify
09: * it under the terms of the GNU General Public License as published by
10: * the Free Software Foundation; either version 2 of the License, or
11: * (at your option) any later version.
12: *
13: * This program is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public License
19: * along with this program; if not, write to the Free Software
20: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: *
22: */
23:
24: package net.sf.jmoney.model2;
25:
26: import org.eclipse.ui.IMemento;
27:
28: /**
29: * A factory for re-creating sessions from a previously saved memento.
30: * <p>
31: * Plug-ins implementing a datastore should implement this interface
32: * and include the name of their class
33: * in an extension to the platform extension point named
34: * <code>"org.eclipse.ui.elementFactories"</code>.
35: * For example, the plug-in's XML markup might contain:
36: * <pre>
37: * <extension point="org.eclipse.ui.elementFactories">
38: * <factory id="com.example.myplugin.MyFactory" class="com.example.myplugin.MyFactory" />
39: * </extension>
40: * </pre>
41: * </p>
42: *
43: * @see IMemento
44: * @see org.eclipse.ui.IWorkbench#getElementFactory
45: * @author Nigel Westbury
46: */
47: public interface ISessionFactory {
48:
49: /**
50: * Re-opens a session from the state captured within the given
51: * memento.
52: * The opened session is set as the current open JMoney session.
53: * If no session can be opened then an appropriate message is
54: * displayed to the user and the previous session, if any, is
55: * left open.
56: * <P>
57: * A session may fail to open for a number of reasons. The most
58: * likely are that the plug-in that had originally created the session is not
59: * installed or an error occurred while opening the session.
60: *
61: * @param memento a memento containing the state for the object
62: * @param window the window to which message are to be displayed
63: */
64: public void openSession(IMemento memento);
65: }
|