01: /*******************************************************************************
02: * Copyright (c) 2004, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.presentations;
11:
12: /**
13: * This interface is given to a StackPresentation when it is loading or saving
14: * its state.
15: *
16: * Not intended to be implemented by clients
17: *
18: * @since 3.0
19: */
20: public interface IPresentationSerializer {
21: /**
22: * Returns a unique identifier for the given part. The identifier can later
23: * be used to restore the original part by calling getPart(...). This identifier
24: * is guaranteed to be unique within a particular StackPresentation. However,
25: * the same part may be assigned a different ID each time the presentation is saved.
26: *
27: * @param part a part to be identified (not null)
28: * @return a unique identifier for the part (not null)
29: */
30: public String getId(IPresentablePart part);
31:
32: /**
33: * Returns a presentable part, given an id that was generated when the presentation
34: * was saved.
35: *
36: * @param id an ID that was generated by getId(IPresentablePart) when the presentation
37: * was saved
38: * @return the presentable part associated with the given id, or null if none. Note
39: * that even if the ID was valid when the presentation was saved, it may not
40: * be valid when the presentation is restored. Callers must be prepared
41: * to handle a null result.
42: */
43: public IPresentablePart getPart(String id);
44: }
|