sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.wizards/src/com/nokia/carbide/cpp/internal/pi/wizards/ui/util/PkgEntryList.java
changeset 2 b9ab3b238396
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.wizards/src/com/nokia/carbide/cpp/internal/pi/wizards/ui/util/PkgEntryList.java	Thu Feb 11 15:32:31 2010 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: 
+ *
+ */
+
+package com.nokia.carbide.cpp.internal.pi.wizards.ui.util;
+
+import java.util.ArrayList;
+
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+
+public class PkgEntryList {
+	private static ArrayList<IPkgEntry> entries = new ArrayList<IPkgEntry>();
+	private static PkgEntryList instance = null;
+	
+	//PKG file and their SDK_ID or EPOCROOT
+	private final class PkgEntry implements IPkgEntry {
+		private String pkgFile;
+		private ISymbianSDK sdk;
+		
+		private PkgEntry(String myPkg, ISymbianSDK mySdk) {
+			pkgFile = myPkg;
+			sdk = mySdk;
+		}
+		
+		public String getPkgFile() {
+			return pkgFile;
+		}
+			
+		public ISymbianSDK getSdk() {
+			return sdk;
+		}
+	}
+
+	private PkgEntryList() {
+		// singleton
+	}
+	
+	public static PkgEntryList getInstance() {
+		if (instance == null) {
+			instance = new PkgEntryList();
+		}
+		return instance;
+	}
+	
+	public IPkgEntry getPkgEntry(String myPkg, ISymbianSDK mySdk) {
+		IPkgEntry found = null;
+		for (IPkgEntry entry : entries) {
+			if (entry.getPkgFile().equals(myPkg) &&
+					entry.getSdk().equals(mySdk)) {
+				found = entry;
+				break;
+			}
+		}
+		if (found == null) {
+			found = new PkgEntry(myPkg, mySdk);
+			entries.add(found);
+		}
+		return found;
+	}
+}