1 11 package org.eclipse.ui.internal.presentations; 12 13 import java.util.Collections ; 14 import java.util.List ; 15 16 import org.eclipse.ui.presentations.IPresentablePart; 17 import org.eclipse.ui.presentations.IPresentationSerializer; 18 19 22 public class PresentationSerializer implements IPresentationSerializer { 23 24 private List parts = Collections.EMPTY_LIST; 25 26 public PresentationSerializer(List presentableParts) { 27 parts = presentableParts; 28 } 29 30 33 public String getId(IPresentablePart part) { 34 int index = parts.indexOf(part); 35 36 return "" + index; } 38 39 42 public IPresentablePart getPart(String id) { 43 try { 44 Integer integer = new Integer (id); 45 int index = integer.intValue(); 46 47 IPresentablePart result = (IPresentablePart) parts.get(index); 48 return result; 49 50 } catch (NumberFormatException e) { 51 } catch (IndexOutOfBoundsException e) { 52 } 53 54 return null; 55 } 56 57 62 public void dispose() { 63 parts = Collections.EMPTY_LIST; 64 } 65 66 } 67 | Popular Tags |