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