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