1 11 package org.eclipse.debug.internal.ui.views.memory; 12 13 import java.util.ArrayList ; 14 15 19 public class MemoryViewIdRegistry{ 20 21 private static ArrayList fgRegistry; 22 23 public static void registerView(String secondaryId) 24 { 25 ArrayList registry = getRegistry(); 26 27 if (!registry.contains(secondaryId)) 28 { 29 registry.add(secondaryId); 30 } 31 } 32 33 public static void deregisterView(String secondaryId) 34 { 35 ArrayList registry = getRegistry(); 36 37 if (registry.contains(secondaryId)) 38 { 39 registry.remove(secondaryId); 40 } 41 } 42 43 public static String getUniqueSecondaryId(String viewId) 44 { 45 int cnt = 0; 46 String id = viewId + "." + cnt; ArrayList registry = getRegistry(); 48 while (registry.contains(id)) 49 { 50 cnt ++; 51 id = viewId + "." + cnt; } 53 return id; 54 } 55 56 private static ArrayList getRegistry() 57 { 58 if (fgRegistry == null) 59 fgRegistry = new ArrayList (); 60 61 return fgRegistry; 62 } 63 } 64 | Popular Tags |