]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/StatePersistor.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui / src / org / simantics / browsing / ui / StatePersistor.java
1 /*******************************************************************************\r
2  * Copyright (c) 2012 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  *     Semantum Oy - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.browsing.ui;\r
13 \r
14 import java.io.File;\r
15 \r
16 /**\r
17  * @author Antti Villberg\r
18  * @see GraphExplorer#setPersistor(StatePersistor)\r
19  */\r
20 public interface StatePersistor {\r
21 \r
22         /**\r
23          * Deserializes a possibly stored state for the specified input from the\r
24          * specified location. The locality of the restored state is up to the\r
25          * implementation to decide (i.e. input-specific or more global).\r
26          * \r
27          * @param stateLocation\r
28          *            the base location to deserialize the possible state from\r
29          * @param root\r
30          *            the current input to deserialize the state for or\r
31          *            <code>null</code> if no input is defined\r
32          * @return the deserialized state, may not be <code>null</code>.\r
33          *         Implementations may return {@link ExplorerState#EMPTY} if there's\r
34          *         no state to restore.\r
35          * @see ExplorerState#EMPTY\r
36          */\r
37         ExplorerState deserialize(File stateLocation, NodeContext root);\r
38 \r
39         /**\r
40          * Serializes the specified explorer state for the specified input to the\r
41          * specified location. The locality of the stored state is up to the\r
42          * implementation to decide (i.e. input-specific or more global).\r
43          * \r
44          * @param stateLocation\r
45          *            the base location to serialize the state to\r
46          * @param root\r
47          *            the current input to serialize the state for or\r
48          *            <code>null</code> if no input is defined\r
49          * @param state\r
50          *            the state to serialize\r
51          */\r
52         void serialize(File stateLocation, NodeContext root, ExplorerState state);\r
53 \r
54 }\r