[Title] Refactored "Package Manager"
authordonghee yang <donghee.yang@samsung.com>
Fri, 16 Nov 2012 08:06:07 +0000 (17:06 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Fri, 16 Nov 2012 08:06:07 +0000 (17:06 +0900)
17 files changed:
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommander.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommands.properties
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Package.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/PackageProvider.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Repository.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRepoDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildSystemTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/ModifyRepoDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PkgMgrUIMessages.properties
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RemoveInstalledPackageDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/PlatformRootstrap.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapUIMessages.properties
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/SelectRootstrapMappingDialog.java

index 34ecd2a..7473af3 100644 (file)
 */
 package org.tizen.nativeplatform.pkgmgr;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Hashtable;
 import java.util.ResourceBundle;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import java.util.Enumeration;
+import org.tizen.common.util.FileUtil;
 import org.tizen.common.util.HostUtil;
-import org.tizen.nativecommon.build.exception.SBIException;
 import org.tizen.nativeplatform.password.SudoPasswdManager;
 import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
+import org.tizen.nativeplatform.pkgmgr.model.Package;
 import org.tizen.sdblib.IDevice;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
@@ -50,7 +56,6 @@ public class RPMPackageCommander {
        private final static int MAX_TIMEOUT = 10000;
        private static String http_proxy = "";  
        private static final String REMOVE_PKGS = "rpm-x86-arm";
-       private static final String NODEPS_OPTION = "--nodeps";
        
        private static final String BUNDLE_NAME = RPMPackageCommander.class.getPackage().getName() + ".RPMPackageCommands";
        private static ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
@@ -70,24 +75,39 @@ public class RPMPackageCommander {
                String command = getCommand(path, cmd);
                
                try {
-                       HostUtil.executeWithConsole(command, "test");           
+                       HostUtil.executeWithConsole(command, "Platform Internal");              
                } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }        
        }
        
-       public static void InstallPkgToRootstrap(String fileList, String path) {                
+       
+       public static void InstallLocalPkgToRootstrap(ArrayList<String> fileList, String path) {                
+               actionBeforeUseZypper(path);
 
-               String cmd = String.format("%s;%s", getResetDbCmd(), getInstallLocalPkgCmd(fileList));          
-               String command = getCommand(path, cmd);
-               
                try {
-                       HostUtil.executeWithConsole(command, "test");           
+                       // copy
+                       ArrayList<String> fileListOnRootstrap = new ArrayList<String>();
+               for (String filePath : fileList) {                      
+                               String filename = new File(filePath).getName();
+                               String pathOnRootstrap = "/tmp/" + filename;
+                               try {
+                                       FileUtil.copyTo(filePath, path + pathOnRootstrap);
+                               } catch (IOException e) {
+                                       //do nothing
+                               }
+                               fileListOnRootstrap.add(pathOnRootstrap);
+               }       
+
+                       // install 
+                       String cmd = String.format("%s;%s", getResetDbCmd(), getInstallLocalPkgCmd(fileListOnRootstrap));               
+                       String command = getCommand(path, cmd);
+                       HostUtil.executeWithConsole(command, "Platform Internal");              
                } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
-               }                               
+               }
        }
        
        public static Document InstallPkgWithZypperXmlOut(String path, String pkgs, boolean refresh, boolean force) {
@@ -136,24 +156,39 @@ public class RPMPackageCommander {
                return doc;
        }
        
-       public static void UninstallPkgFromRootstrap(String fileList, String option, String path) {             
+       public static void uninstallPkgFromRootstrap(CopyOnWriteArrayList<Package> pkgList, String path) {              
+
+               String cmd = String.format("%s;%s", getResetDbCmd(), getUninstallPkgCmd(pkgList));              
+               String command = getCommand(path, cmd);
+               
+               try {
+                       HostUtil.executeWithConsole(command, "Platform Internal");              
+               } catch (Exception e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               }       
+       }
+       
+       
+       public static void UninstallPkgFromRootstrapNoDeps(String fileList, String path) {              
 
-               String cmd = String.format("%s;%s", getResetDbCmd(), getUninstallPkgCmd(fileList, option));             
+               String cmd = String.format("%s;%s", getResetDbCmd(), getUninstallPkgCmdNoDeps(fileList));               
                String command = getCommand(path, cmd);
                
                try {
-                       HostUtil.executeWithConsole(command, "test");           
+                       HostUtil.executeWithConsole(command, "Platform Internal");              
                } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }       
        }
+
        
        public static void InstallPkgToDevice(String fileList, IDevice device, PackageManagerOuputReceiver rec) {               
 
                if (device != null) {
                        try {
-                               String command = String.format("%s;%s", getResetDbCmd(), getInstallLocalPkgCmd(fileList));
+                               String command = String.format("%s;%s", getResetDbCmd(), getInstallLocalPkgCmdWithRPM(fileList));
                                device.executeShellCommand(command, rec, MAX_TIMEOUT);                          
                        } catch (Exception e1) {
                                e1.printStackTrace();
@@ -289,6 +324,73 @@ public class RPMPackageCommander {
                return ret;     
        }
        
+       
+       public static ArrayList<Package> getPackageListForRootstrap(String path) {
+               ArrayList<Package> packageList = new ArrayList<Package>();
+               Hashtable<String, Package> packageHash = new Hashtable<String, Package>();
+               
+               try {
+                       // get list using zypper
+                       String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRemotePkgListCmd());
+                       String command = getCommand(path, cmd);
+                       String result = HostUtil.returnExecute(command);
+                       String[] splitStr = result.split("\n");
+                       for (String s : splitStr ) {
+                               s = s.replaceAll(" ", "");
+                               String[] part = s.split("\\|");
+                               if ( part.length == 5 && !part[1].equals("Repository")) {
+                                       String name = part[2]; 
+                                       String version = part[3]; 
+                                       String arch = part[4];
+                                       if ( part[0].equals("i") ) {
+                                               packageHash.put(name, new Package(name,version,version,arch) );
+                                       }
+                                       else if ( part[0].equals("v") ) {
+                                               Package p = packageHash.get(name);
+                                               if ( version.compareTo( p.getNewVersion() ) > 0  ) {
+                                                       p.setNewVersion(version);
+                                               }
+                                       }
+                                       else {
+                                               packageHash.put(name, new Package(name,"",version,arch) );
+                                       }
+                               }
+                       }
+
+                       // get installed packages using rpm
+                       cmd = String.format("%s;%s", getResetDbCmd(), getInstalledPkgListCmd());
+                       command = getCommand(path, cmd);
+                       result = HostUtil.returnExecute(command);
+                       splitStr = result.split("\n");
+                       for (String s : splitStr) {
+                               s = s.replaceAll(" ", "").trim();
+                               String[] part = s.split(",");
+                               if ( part.length == 3 ) {
+                                       String name = part[0]; 
+                                       String version = part[1]; 
+                                       String arch = part[2];
+                                       Package pkg = packageHash.get(name);
+                                       if ( pkg == null ) {
+                                               packageHash.put(name, new Package(name,version,"",arch));
+                                       }
+                                       else {
+                                               // do nothing
+                                       }
+                               }
+                       }
+               } catch (Exception e) {
+                       // do nothing
+               }       
+               
+               Enumeration<Package> e = packageHash.elements();
+               while(e.hasMoreElements()) {
+                       packageList.add(e.nextElement());
+               }
+               
+               return packageList;
+       }
+       
+       
        public static String getRemotePackageListForRootstrap(String path) {
                        
                String result = "";             
@@ -339,20 +441,46 @@ public class RPMPackageCommander {
                return result;
        }
        
-       public static String getRepositoryListForRootstrap(String path) {
-               
-               String result = "";
+       
+       // return (name -> url) hash table 
+       public static Hashtable<String, String> getRepositoryListForRootstrap(String path) {
+               Hashtable<String, String> reposHash = new Hashtable<String, String>();
                String cmd = String.format("%s;%s", getResetDbCmd(), getRepoListCmd());         
                String command = getCommand(path, cmd);
                
                try {
-                       result = HostUtil.returnExecute(command);               
+                       String result = HostUtil.returnExecute(command);
+                       String[] splitStr = result.split("\n");
+                       
+                       // url list starts at 3 line
+                       for (String reposStr: splitStr) {
+                               reposStr = reposStr.replaceAll(" ", "");
+                               String[] part = reposStr.split("\\|");
+                               if ( part.length == 6 && !part[0].equals("#") ) {
+                                       reposHash.put(part[1], part[5]);
+                               }
+                       }
+
                } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
+                       // do nothing
+               }
+               
+               return reposHash;
+       }
+
+       
+       public static void resetRepositoryForRootstrap(String path) {
+               String cmd = String.format("%s", getRepoResetCmd());            
+               String command = getCommand(path, cmd);
+               
+               try {
+                       HostUtil.returnExecute(command);
+
+               } catch (Exception e) {
+                       // do nothing
                }
-               return result;
        }
+
        
        public static String getRepositoryListForDevice(IDevice device, PackageManagerOuputReceiver rec) {
                
@@ -380,7 +508,7 @@ public class RPMPackageCommander {
                String command = getCommand(path, cmd);
                
        try {
-                       HostUtil.executeWithConsole(command, "test");           
+                       HostUtil.executeWithConsole(command, "Platform Internal");              
                } catch (Exception e) {
                        e.printStackTrace();
                }               
@@ -479,16 +607,16 @@ public class RPMPackageCommander {
                return result;          
        }
        
-       public static String installRemotePkgForRootstrap(String pkgList, String path) {                
+       public static String installRemotePkgForRootstrap(CopyOnWriteArrayList<Package> selectedList, String path) {            
 
                actionBeforeUseZypper(path);
                
                String result = "";     
-               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(pkgList));      
+               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(selectedList)); 
                String command = getCommand(path, cmd);
                
        try {
-                       HostUtil.executeWithConsole(command, "test");           
+                       HostUtil.executeWithConsole(command, "Platform Internal");              
                } catch (Exception e) {
                        e.printStackTrace();
                }
@@ -501,7 +629,7 @@ public class RPMPackageCommander {
                String result = "";             
                
                try {                   
-                       String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(pkgList));
+                       String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmdOld(pkgList));
                        rec.cleanLog();
                        device.executeShellCommand(command, rec, MAX_TIMEOUT);
                } catch (Exception e) {
@@ -528,7 +656,7 @@ public class RPMPackageCommander {
        
        private static void actionBeforeUseZypper(String path) {
                if (pkgInstalledSuccessfullyForRootstrap(REMOVE_PKGS, path)) {
-                       UninstallPkgFromRootstrap(REMOVE_PKGS, NODEPS_OPTION, path);
+                       UninstallPkgFromRootstrapNoDeps(REMOVE_PKGS, path);
                }
        }
        
@@ -544,18 +672,41 @@ public class RPMPackageCommander {
                return String.format(resources.getString("Command.DistUpgrade"));
        }
        
-       private static String getInstallPkgCmd(String pkgList) {
+       private static String getInstallPkgCmd(CopyOnWriteArrayList<Package> pkgList) {
+               String pkgListStr = "";
+               for( Package pkg: pkgList) {
+                       pkgListStr = pkgListStr.isEmpty() ? pkg.getName() : pkgListStr + " " + pkg.getName();
+               }
+               return String.format(resources.getString("Command.Install.Remote.Pkg"), pkgListStr);
+       }
+
+       private static String getInstallPkgCmdOld(String pkgList) {
                return String.format(resources.getString("Command.Install.Remote.Pkg"), pkgList);
        }
        
-       private static String getInstallLocalPkgCmd(String pkgList) {
-               return String.format(resources.getString("Command.Install.Local.Pkg"), pkgList);
+       private static String getInstallLocalPkgCmd(ArrayList<String> fileList) {
+               String pkgListStr = "";
+               for( String filePath: fileList) {
+                       pkgListStr = pkgListStr.isEmpty() ? filePath : pkgListStr + " " + filePath;
+               }
+               return String.format(resources.getString("Command.Install.Local.Pkg"), pkgListStr);
        }
-       
-       private static String getUninstallPkgCmd(String pkgList, String option) {
-               return String.format(resources.getString("Command.Uninstall.Pkg"), pkgList, option);
+
+       private static String getInstallLocalPkgCmdWithRPM(String pkgList) {
+               return String.format(resources.getString("Command.Install.Local.Pkg.RPM"), pkgList);
        }
 
+       private static String getUninstallPkgCmd(CopyOnWriteArrayList<Package> pkgList) {
+               String pkgListStr = "";
+               for( Package pkg: pkgList) {
+                       pkgListStr = pkgListStr.isEmpty() ? pkg.getName() : pkgListStr + " " + pkg.getName();
+               }
+               return String.format(resources.getString("Command.Uninstall.Pkg"), pkgListStr);
+       }
+
+       private static String getUninstallPkgCmdNoDeps(String pkgList) {
+               return String.format(resources.getString("Command.Uninstall.Pkg.NoDeps"), pkgList);
+       }
        
        private static String getRemoteRepoCmd(String name) {
                return String.format(resources.getString("Command.Remove.Repo"), name);
@@ -572,7 +723,11 @@ public class RPMPackageCommander {
        private static String getRepoListCmd() {
                return resources.getString("Command.List.Repo");
        }
-       
+
+       private static String getRepoResetCmd() {
+               return resources.getString("Command.Reset.Repo");
+       }
+
        private static String getRemotePkgListCmd() {
                return resources.getString("Command.List.Remote.Pkg");
        }
@@ -601,5 +756,96 @@ public class RPMPackageCommander {
        private static String getCommand(String path, String cmd) {
                String passwd = SudoPasswdManager.getSudoPassword();
                return String.format("sh -c \'echo %s | sudo -S chroot %s sh -c \"%s\"\'", passwd, path, cmd);          
-       }       
+       }
+       
+       
+       public static int compareVersion(String ver1, String ver2) {
+               ArrayList<String> tokList1 = tokenizeVersionString(ver1);
+               ArrayList<String> tokList2 = tokenizeVersionString(ver2);
+               int maxTokens = tokList1.size() > tokList2.size() ? tokList1.size() : tokList2.size();
+               
+               for( int i = 0; i < maxTokens; i++ ) {
+                       // check length
+                       if ( i == tokList1.size() ) {return -1;}
+                       if ( i == tokList2.size() ) {return 1;}
+                       
+                       String tok1 = tokList1.get(i); 
+                       String tok2 = tokList2.get(i);
+                       
+                       int value1 = -1, value2 = -1;
+                       try {
+                               value1 = Integer.parseInt(tok1);
+                       }
+                       catch ( NumberFormatException e) {
+                               // do nothing
+                       }
+                       
+                       try {
+                               value2 = Integer.parseInt(tok2);
+                       }
+                       catch ( NumberFormatException e) {
+                               // do nothing
+                       }
+                       
+                       if ( value1 > value2 ) {
+                               return 1;
+                       }
+                       else if ( value1 < value2 ) {
+                               return -1;
+                       }
+                       else {
+                               int result = tok1.compareTo(tok2);
+                               if ( result != 0 ) {
+                                       return result;
+                               }
+                       }
+               }
+               
+               return 0;
+       }
+       
+       private static ArrayList<String> tokenizeVersionString(String ver) {
+               ArrayList<String> result = new ArrayList<String>();
+               final int NUM = 0;
+               final int ALPHA = 1;
+               final int NONALPHANUM = 2;
+               int oldStatus=NONALPHANUM;
+               String buf = "";
+               for( int i = 0; i < ver.length(); i++ ) {
+                       char c = ver.charAt(i);
+                       int newStatus;
+                       if ( c >= '0' && c <= '9' ) {
+                               newStatus = NUM;
+                       }
+                       else if ( (c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z') ) {
+                               newStatus = ALPHA;
+                       }
+                       else {
+                               newStatus = NONALPHANUM;
+                       }
+                       
+                       if ( oldStatus != newStatus ) {
+                               if ( !buf.isEmpty() ) {
+                                       result.add(buf);
+                               }
+                               if ( newStatus != NONALPHANUM ) {
+                                       buf = String.valueOf(c);
+                               }
+                               else {
+                                       buf = "";
+                               }
+                               oldStatus = newStatus;
+                       }
+                       else {
+                               if ( newStatus != NONALPHANUM ) {
+                                       buf += String.valueOf(c);
+                               }
+                       }
+               }
+               if ( !buf.isEmpty() ) {
+                       result.add(buf);
+               }
+               
+               return result;
+       }
 }
index 90b51be..3b9a7ce 100644 (file)
@@ -1,14 +1,17 @@
 Command.Export.Proxy = export http_proxy=%s
 Command.Reset.Db = rm -f /var/lib/rpm/__db*
 Command.Install.Remote.Pkg = zypper --non-interactive in %s
-Command.Install.Local.Pkg = rpm -ihv %s --ignoreos --force
-Command.Uninstall.Pkg = rpm -e %s %s
+Command.Install.Local.Pkg = zypper --non-interactive in --force %s
+Command.Install.Local.Pkg.RPM = rpm -ihv %s --ignoreos --force 
+Command.Uninstall.Pkg.NoDeps = rpm -e %s --nodeps
+Command.Uninstall.Pkg = zypper --non-interactive remove %s
 Command.Remove.Repo = zypper rr %s
 Command.Add.Repo = zypper ar %s %s
 Command.Refresh.Repo = zypper refresh
 Command.List.Repo = zypper lr -u
+Command.Reset.Repo = rm -rf /etc/zypp/repos.d/*
 Command.List.Remote.Pkg = zypper pa
-Command.List.Installed.Pkg = rpm -qa 
+Command.List.Installed.Pkg = rpm -qa --qf \\\"%{NAME},%{VERSION}-%{RELEASE},%{ARCH}\\n\\\"
 Command.Show.Pkg = rpm -qa %s
 Command.Show.Info.Pkg = rpm -qi %s
 Command.Info.Pkg.File = rpm -qp --qf "%%{%s}\n" %s
index 6f148e6..26e31c8 100644 (file)
@@ -18,7 +18,20 @@ public class Package {
        private boolean checkColumn = true;
        private INSTALLINFO installInfo = INSTALLINFO.NOT_INSTALLED;    
        private PKGTYPE pkgType = PKGTYPE.LOCAL;
-
+       private boolean isChecked = false;
+       private boolean isNewlyChanged = false;
+       
+       public Package() {
+               
+       }
+       
+       public Package(String name, String installedVersion, String remoteVersion, String arch) {
+               this.name = name;
+               this.installVersion = installedVersion;
+               this.newVersion = remoteVersion;
+               this.arch = arch;
+       }
+       
        public PKGTYPE getPkgType() 
        {
                return pkgType;
@@ -82,4 +95,20 @@ public class Package {
        {
                this.checkColumn = check;
        }
+       
+       public void setChecked( boolean value ) {
+               this.isChecked = value;
+       }
+       
+       public boolean isChecked() {
+               return this.isChecked;
+       }
+       
+       public void setNewlyChanged( boolean value ) {
+               this.isNewlyChanged = value;
+       }
+       
+       public boolean isNewlyChanged() {
+               return this.isNewlyChanged;
+       }
 }
index ab62137..b6d0d21 100644 (file)
@@ -23,7 +23,27 @@ public enum PackageProvider {
        {
                return buildsystem_pkgs;
        }
-       
+
+       public CopyOnWriteArrayList<Package> getSelectedBuildsystemPkgs(boolean remove)
+       {
+               CopyOnWriteArrayList<Package> selectedList = new CopyOnWriteArrayList<Package>(); 
+               for( Package pkg: buildsystem_pkgs ) {
+                       if ( pkg.isChecked() ) {
+                               if ( remove && !pkg.getInstalledVersion().isEmpty() ) {
+                                       selectedList.add(pkg);
+                               }
+                               else if ( !remove && !pkg.getNewVersion().isEmpty() ) {
+                                       selectedList.add(pkg);
+                               }
+                               else {
+                                       // do nothing
+                               }
+                       }
+               }
+               
+               return selectedList;
+       }
+
        public CopyOnWriteArrayList<Package> getDevicePkgs()
        {
                return device_pkgs;
index 1f73604..ff1796d 100644 (file)
@@ -5,7 +5,16 @@ public class Repository {
        private String uri = "";
        private boolean dirty = false;
        private boolean checkColumn = false;
+       
+       public Repository() {
                
+       }
+       
+       public Repository( String name, String uri ) {
+               this.name = name;
+               this.uri = uri;
+       }
+       
        public String getName()
        {
                return name;
index 31ca164..f4e4093 100644 (file)
@@ -1,8 +1,6 @@
 package org.tizen.nativeplatform.pkgmgr.ui;
 
 import java.util.ResourceBundle;
-import java.util.concurrent.CopyOnWriteArrayList;
-
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Rectangle;
@@ -14,36 +12,33 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 
-import org.tizen.common.util.DialogUtil;
-import org.tizen.nativeplatform.pkgmgr.model.Repository;
-import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
-
 public class AddRepoDialog extends Dialog {
        
-       private Text nameText;
        private Text uriText;
-       private String tab;
+       private String url;
        
        private int x = 0;
        private int y = 0;
        private final int width = 500;
-       private final int height = 200;
+       private final int height = 120;
        
        private final String BUNDLE_NAME = AddRepoDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
        private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
 
+       
        protected AddRepoDialog(Shell parentShell) {
                super(parentShell);     
        }
        
+       
        public AddRepoDialog(Shell parentShell, String tab) {
                super(parentShell);
-               this.tab = tab;
                Rectangle bounds = parentShell.getBounds();
         x = bounds.x + (bounds.width - width)/2;
         y = bounds.y + (bounds.height - height)/2;
        }
        
+       
        @Override
        protected void configureShell(Shell newShell) {
                super.configureShell(newShell);         
@@ -53,6 +48,7 @@ public class AddRepoDialog extends Dialog {
                newShell.setSize(width, height);
        }
        
+       
        @Override
        protected Control createDialogArea(Composite parent) {          
                
@@ -60,61 +56,32 @@ public class AddRepoDialog extends Dialog {
                composite.setLayoutData(new GridData(GridData.FILL_BOTH));
                composite.setLayout(new GridLayout(2, false));
                
-               Label nameLabel = new Label(composite, SWT.NONE);
-               nameLabel.setText(resources.getString("AddRepo.Label.Name"));           
-               nameText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
-        GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
-        gridData.widthHint = 500;
-        nameText.setLayoutData(gridData);      
+               //Label nameLabel = new Label(composite, SWT.NONE);
+               //nameLabel.setText(resources.getString("AddRepo.Label.Name"));         
+               //nameText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+        //GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+        //gridData.widthHint = 500;
+        //nameText.setLayoutData(gridData);    
         
         Label urlLabel = new Label(composite, SWT.NONE);
         urlLabel.setText(resources.getString("AddRepo.Label.Uri"));            
                uriText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
-        gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
         gridData.widthHint = 500;
         uriText.setLayoutData(gridData);               
                                
                return null;
        }       
+
        
        @Override
        protected void okPressed() {
-               
-               CopyOnWriteArrayList<Repository> list = null;
-               Repository repo = new Repository();
-               repo.setName(nameText.getText());
-               repo.setUri(uriText.getText());
-               
-               if (resources.getString("PkgMgr.Tab.Buildsystem").equals(tab)) {
-                       list = RepositoryProvider.INSTANCE.getBuildsystemRepos();
-                       // if repository name or url already exist, then return
-                       if (checkRepoExists(list, repo)) {
-                               return;
-                       } else {
-                               repo.setCheckDirty(true);                       
-                               RepositoryProvider.INSTANCE.getBuildsystemRepos().add(repo);
-                       }
-               } else if (resources.getString("PkgMgr.Tab.Device").equals(tab)) {
-                       list = RepositoryProvider.INSTANCE.getDeviceRepos();
-                       // if repository name or url already exist, then return
-                       if (checkRepoExists(list, repo)) {
-                               return;
-                       } else {
-                               repo.setCheckDirty(true);                       
-                               RepositoryProvider.INSTANCE.getDeviceRepos().add(repo);
-                       }
-               }
-                               
+               url = uriText.getText().trim();
                super.okPressed();
        }
        
-       private boolean checkRepoExists(CopyOnWriteArrayList<Repository> list, Repository repo) {
-               for( Repository r : list) {
-                       if (r.getName().equals(repo.getName()) || r.getUri().equals(repo.getUri())) {
-                               DialogUtil.openMessageDialog(resources.getString("AddRepo.Message.AlreadyExist"));
-                               return true;
-                       }
-               }               
-               return false;
+       
+       public String getRepositoryURL() {
+               return url;
        }
 }
index c45e4b8..ef3f8df 100644 (file)
@@ -1,34 +1,37 @@
 package org.tizen.nativeplatform.pkgmgr.ui;
 
 import java.io.File;
-import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
+import java.util.ArrayList;
 import java.util.ResourceBundle;
 import java.util.concurrent.CopyOnWriteArrayList;
 
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
 import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ICheckStateProvider;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TableViewerColumn;
 import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.viewers.ViewerFilter;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
 import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.FileDialog;
@@ -40,21 +43,12 @@ import org.eclipse.swt.widgets.TabFolder;
 import org.eclipse.swt.widgets.TabItem;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
 import org.tizen.common.util.DialogUtil;
-import org.tizen.common.util.FileUtil;
-import org.tizen.nativecommon.build.CurrentEnabledProject;
 import org.tizen.nativecommon.build.SmartBuildInterface;
-import org.tizen.nativeplatform.build.PlatformConfigurationManager;
-import org.tizen.nativeplatform.build.PlatformCheckCancelJob;
 import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
-import org.tizen.nativeplatform.pkgmgr.model.InstalledPackage;
-import org.tizen.nativeplatform.pkgmgr.model.InstalledPkgProvider;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
 import org.tizen.nativeplatform.pkgmgr.model.Package;
 import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
-import org.tizen.nativeplatform.pkgmgr.model.RemotePackage;
-import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
 import org.tizen.nativeplatform.pkgmgr.model.Repository;
 import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
@@ -62,102 +56,30 @@ import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 
 public class BuildSystemTab {
 
-       private IProject project;
        private TabFolder folder = null;
        private TableViewer repoViewer = null;
-       private TableViewer pkgViewer = null;
+       private CheckboxTableViewer pkgViewer = null;
        private final Shell shell;
-       private FileDialog fd;
-       private String previousFilterPath = null;
-       private String selectedFileList;
        private PlatformRootstrap rootstrap;
-       private CopyOnWriteArrayList<Package> pkgs;
        private String rootstrapPath = "";
-       private String arch = "";
-
+       private Combo categoryCombo;
+       private Text filterText;
        private final String BUNDLE_NAME = BuildSystemTab.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
        private final ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME); 
 
+       
        public BuildSystemTab(Shell shell, TabFolder folder, PlatformRootstrap rootstrap) {
                this.shell = shell;
                this.folder = folder;
                this.rootstrap = rootstrap;
                this.rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString());              
-               this.arch = rootstrap.getArch();
-               this.project = CurrentEnabledProject.getCurrentProject();
        }
 
+       
        public void createTab() {
-               initialize();
-               
                createBuildsystemTab(folder);
        }
 
-       private void initialize() {
-               RepositoryProvider.INSTANCE.getBuildsystemRepos().clear();
-               PackageProvider.INSTANCE.getBuildsystemPkgs().clear();
-
-               String result = RPMPackageCommander.getRepositoryListForRootstrap(rootstrapPath);
-               String[] splitStr = result.split("\n");
-               // url list starts at 3 line
-               for (int i = 2 ; i < splitStr.length ; i++) {
-                       String s = splitStr[i];
-                       s = s.replaceAll(" ", "");
-                       String[] part = s.split("\\|");
-                       String name = part[1];
-                       String uri = part[5];
-
-                       Repository repo = new Repository();
-                       repo.setName(name);
-                       repo.setUri(uri);
-
-                       RepositoryProvider.INSTANCE.getBuildsystemRepos().add(repo);
-               }
-               
-               boolean dirty = false;          
-               
-               for (String r : rootstrap.getRepositoryURLs()) {
-                       if (!existRepoUrl(r.trim())) {
-                               dirty = true;
-                               RPMPackageCommander.addRepositoryForRootstrap(getAvailableRepoName(), r, rootstrapPath);
-                       }                       
-               }
-               
-               if (dirty) {
-                       initialize();
-               }
-               
-       }
-       
-       private boolean existRepoUrl(String r) {
-               for (Repository repo : RepositoryProvider.INSTANCE.getBuildsystemRepos()) {
-                       if (r.equals(repo.getUri().trim())) {
-                               return true;
-                       }
-               }
-               
-               return false;
-       }
-       
-       private boolean existRepoName(String n) {
-               for (Repository repo : RepositoryProvider.INSTANCE.getBuildsystemRepos()) {
-                       if (n.equals(repo.getName().trim())) {
-                               return true;
-                       }
-               }
-               
-               return false;
-       }
-       
-       private String getAvailableRepoName() {
-               String namePrefix = "url";
-               for (int i=0 ; ; i++) {
-                       String name = namePrefix + String.valueOf(i);
-                       if (!existRepoName(name)) {
-                               return name;
-                       }                               
-               }
-       }
 
        private void createBuildsystemTab( TabFolder parent )
        {
@@ -166,98 +88,81 @@ public class BuildSystemTab {
 
                Composite composite = new Composite(folder, SWT.NONE);
                buildsystemTab.setControl(composite);
-        composite.setLayout(new GridLayout(1, false));
         composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+        composite.setLayout(new GridLayout(1, false));
 
-               //createInfoComposite( composite );
                createRepositoryGroup( composite );
                createPackageGroup( composite );
        }
 
-       private void createInfoComposite( Composite parent )
-       {
-               Composite info_comp = new Composite( parent, SWT.NONE );
-               info_comp.setLayoutData(new GridData(GridData.BEGINNING));
-               info_comp.setLayout(new GridLayout(1, false));
-
-               Label configurationLabel = new Label(info_comp, SWT.LEFT);
-               //configurationLabel.setText(String.format("%s %s", resources.getString("PkgMgr.Label.Configuration"), conf));
-       }
 
        private void createRepositoryGroup( Composite parent )
        {
                Group grpRepo = new Group(parent, SWT.NONE);
                grpRepo.setText(resources.getString("PkgMgr.Frame.Respository"));
-               grpRepo.setLayout(new GridLayout(1, false));
-               GridData repo_gd = new GridData(GridData.FILL_BOTH);
+               GridData repo_gd = new GridData(GridData.FILL_HORIZONTAL);
+               repo_gd.heightHint = 110;
         grpRepo.setLayoutData(repo_gd);
+               grpRepo.setLayout(new GridLayout(2, false));
 
-        Composite repo_comp = new Composite( grpRepo, SWT.NONE );
-        repo_comp.setLayoutData(new GridData(GridData.FILL_BOTH));
-        repo_comp.setLayout(new GridLayout(2, false));
-
-               Composite repo_comp_table = new Composite( repo_comp, SWT.NONE );
-               repo_comp_table.setLayoutData(new GridData(GridData.FILL_BOTH));
-               repo_comp_table.setLayout(new FillLayout());
-
-               Composite repo_comp_buttons = new Composite( repo_comp, SWT.NONE );
-               repo_comp_buttons.setLayoutData(new GridData(GridData.FILL_BOTH));
-               repo_comp_buttons.setLayout(new GridLayout(1, false));
-
-        createRepositoryTable( repo_comp_table );
-        createRepositoryButtons( repo_comp_buttons );
+        createRepositoryTable( grpRepo );
+        createRepositoryButtons( grpRepo );
        }
 
-       private void createPackageGroup( Composite parent )
+       
+       private void createRepositoryTable( Composite parent)
        {
-               Group grpPkg = new Group(parent, SWT.NONE);
-               grpPkg.setText(resources.getString("PkgMgr.Frame.Package"));
-               grpPkg.setLayout(new GridLayout(1, false));
-               GridData pkgs_gd = new GridData(GridData.FILL_BOTH);
-               pkgs_gd.heightHint = shell.getBounds().height / 3;
-               grpPkg.setLayoutData(pkgs_gd);
-
-        Composite pkg_comp = new Composite( grpPkg, SWT.NONE );
-        pkg_comp.setLayoutData(new GridData(GridData.FILL_BOTH));
-        pkg_comp.setLayout(new GridLayout(2, false));
-
-               Composite pkg_comp_table = new Composite( pkg_comp, SWT.NONE );
-               pkg_comp_table.setLayoutData(new GridData(GridData.FILL_BOTH));
-               pkg_comp_table.setLayout(new FillLayout());
-
-               Composite pkg_comp_buttons = new Composite( pkg_comp, SWT.NONE );
-               pkg_comp_buttons.setLayoutData(new GridData(GridData.FILL_BOTH));
-               pkg_comp_buttons.setLayout(new GridLayout(1, false));
-
-        createPackageTable( pkg_comp_table );
-        createPackageButtons( pkg_comp_buttons );
+               Composite composite = new Composite( parent, SWT.NONE );
+               GridData gridData = new GridData(GridData.FILL_BOTH);
+               composite.setLayoutData(gridData);
+               composite.setLayout(new FillLayout());
+
+               repoViewer = new TableViewer( composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
+               createColumnsForRepoTable( composite );
+               Table reposTable = repoViewer.getTable();
+               reposTable.setHeaderVisible(true);
+               reposTable.setLinesVisible(true);
+               repoViewer.setContentProvider(new ArrayContentProvider());
+               repoViewer.setInput(RepositoryProvider.INSTANCE.getBuildsystemRepos());
        }
 
-       private void createRepositoryTable( Composite parent)
+       
+       private void createColumnsForRepoTable( Composite parent )
        {
-               repoViewer = new TableViewer( parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
-               createColumnsForRepoTable( parent );
-               Table tableForRepository = repoViewer.getTable();
-               tableForRepository.addListener( SWT.Selection, new Listener(){
+               String[] titles = {resources.getString("PkgMgr.Repo.Table.Column.1"),
+                               resources.getString("PkgMgr.Repo.Table.Column.2")};
+               int[] bounds = { 100, 600 };
 
+               TableViewerColumn colName = createTableViewerColumn( repoViewer, titles[0], bounds[0], SWT.NONE);
+               colName.setLabelProvider(new ColumnLabelProvider() {
                        @Override
-                       public void handleEvent(Event event) {
-                               if( event.detail == SWT.CHECK )
-                               {
-                                       Repository repo = (Repository)event.item.getData();
-                                       repo.setCheckColumn( !repo.getCheckColumn() );
-                               }
+                       public String getText(Object element) {
+                               Repository repo = (Repository)element;
+                               return repo.getName();
+                       }
+               });
+
+               TableViewerColumn colUrl = createTableViewerColumn( repoViewer, titles[1], bounds[1], SWT.NONE);
+               colUrl.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Repository repo = (Repository)element;
+                               return repo.getUri();
                        }
                });
-               tableForRepository.setHeaderVisible(true);
-               tableForRepository.setLinesVisible(true);
-               repoViewer.setContentProvider(new ArrayContentProvider());
-               repoViewer.setInput(RepositoryProvider.INSTANCE.getBuildsystemRepos());
        }
 
+       
        private void createRepositoryButtons( Composite parent )
        {
-               Button add_bt = new Button( parent, SWT.PUSH );
+               Composite composite = new Composite( parent, SWT.NONE );
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               RowLayout layout = new RowLayout(SWT.VERTICAL);
+               layout.pack = false;
+               composite.setLayout(layout);
+
+
+               Button add_bt = new Button( composite, SWT.PUSH );
                add_bt.setText(resources.getString("PkgMgr.Button.AddRepo"));
                add_bt.setToolTipText(resources.getString("PkgMgr.Button.AddRepo.Tooltip"));
                add_bt.addMouseListener(new MouseListener(){
@@ -270,23 +175,16 @@ public class BuildSystemTab {
                        public void mouseDown(MouseEvent e) {
 
                                AddRepoDialog dialog = new AddRepoDialog(shell, resources.getString("PkgMgr.Tab.Buildsystem"));
-                               dialog.open();
+                               if ( dialog.open() != AddRepoDialog.OK ) { 
+                                       return;
+                               }
+                               String name = String.format("url%d", repoViewer.getTable().getItemCount());
+                               String url = dialog.getRepositoryURL();
+                               RPMPackageCommander.addRepositoryForRootstrap(name, url, rootstrapPath);
+                               
+                               rootstrap.addRepositoryURL(url);
+                               updateRepositoryInfo();
                                repoViewer.refresh();
-
-                               int recentTableIndex = 0;
-                               recentTableIndex = repoViewer.getTable().getItemCount();
-
-                               for (int i = 0; i < recentTableIndex; i++) {
-                                       TableItem item = null;
-                                       item = repoViewer.getTable().getItem(i);
-                                       Repository repo = (Repository)item.getData();
-                                       item.setChecked(repo.getCheckColumn());
-
-                                       if (repo.getCheckDirty()) {                                             
-                                               RPMPackageCommander.addRepositoryForRootstrap(repo.getName(), repo.getUri(), rootstrapPath);
-                                               repo.setCheckDirty(false);
-                                       }
-                               }                               
                        }
 
                        @Override
@@ -295,7 +193,7 @@ public class BuildSystemTab {
 
         });
                
-               Button modify_bt = new Button( parent, SWT.PUSH );
+               Button modify_bt = new Button( composite, SWT.PUSH );
                modify_bt.setText(resources.getString("PkgMgr.Button.ModifyRepo"));
                modify_bt.setToolTipText(resources.getString("PkgMgr.Button.ModifyRepo.Tooltip"));
                modify_bt.addMouseListener(new MouseListener(){
@@ -306,55 +204,21 @@ public class BuildSystemTab {
 
                        @Override
                        public void mouseDown(MouseEvent e) {
-                               
-                               CopyOnWriteArrayList<Repository> list = RepositoryProvider.INSTANCE.getBuildsystemRepos();
-                               
-                               Repository selectedRepo = null;
-                               int count = 0;
-
-                               for( Repository repo : list) {                                  
-                                       if (repo.getCheckColumn()) {
-                                               count++;
-                                               selectedRepo = repo;
-                                       }
-                               }
-                               
-                               if (count != 1 ) {                                      
+                               int selectedIdx = repoViewer.getTable().getSelectionIndex();
+                               if ( selectedIdx == -1 ) {                                      
                                        DialogUtil.openMessageDialog(resources.getString("PkgMgr.Message.Select.OnePackage"));
                                        return;
                                }                               
                                
+                               Repository repos = (Repository)repoViewer.getTable().getItem(selectedIdx).getData();
                                ModifyRepoDialog dialog = new ModifyRepoDialog(shell, resources.getString("PkgMgr.Tab.Buildsystem"),
-                                               selectedRepo.getName(), selectedRepo.getUri());
-                               dialog.open();
-                               
-                               repoViewer.refresh();
-
-                               int recentTableIndex = 0;
-                               recentTableIndex = repoViewer.getTable().getItemCount();
-
-                               for (int i = 0; i < recentTableIndex; i++) {
-                                       TableItem item = null;
-                                       item = repoViewer.getTable().getItem(i);
-                                       Repository repo = (Repository)item.getData();
-                                       item.setChecked(repo.getCheckColumn());
-
-                                       if (repo.getCheckDirty()) {
-                                               list.remove(selectedRepo);                                              
-                                               RPMPackageCommander.removeRepositoryForRootstrap(selectedRepo.getName(), rootstrapPath);                                                
-                                               RPMPackageCommander.addRepositoryForRootstrap(repo.getName(), repo.getUri(), rootstrapPath);                                            
-                                               repo.setCheckDirty(false);
-                                       }
+                                               repos.getUri());
+                               if ( dialog.open() != ModifyRepoDialog.OK ) {
+                                       return;
                                }
-                               
+                               rootstrap.changeRepositoryURL(repos.getUri(), dialog.getRepositoryURL());
+                               updateRepositoryInfo();
                                repoViewer.refresh();
-                               recentTableIndex = repoViewer.getTable().getItemCount();
-
-                               for (int i = 0; i < recentTableIndex; i++) {
-                                       TableItem item = repoViewer.getTable().getItem(i);
-                                       Repository repo = (Repository)item.getData();
-                                       item.setChecked(repo.getCheckColumn());
-                               }                               
                        }
 
                        @Override
@@ -362,7 +226,7 @@ public class BuildSystemTab {
                        }
         });
 
-               Button remove_bt = new Button( parent, SWT.PUSH );
+               Button remove_bt = new Button( composite, SWT.PUSH );
                remove_bt.setText(resources.getString("PkgMgr.Button.RemoveRepo"));
                remove_bt.setToolTipText(resources.getString("PkgMgr.Button.RemoveRepo.Tooltip"));
                remove_bt.addMouseListener(new MouseListener() {
@@ -373,36 +237,82 @@ public class BuildSystemTab {
 
                        @Override
                        public void mouseDown(MouseEvent e) {
-                               CopyOnWriteArrayList<Repository> list = RepositoryProvider.INSTANCE.getBuildsystemRepos();
-
-                               for( Repository repo : list)
-                               {
-                                       boolean selected = false;
-                                       selected = repo.getCheckColumn();
-
-                                       if (selected) {
-                                               list.remove(repo);
-                                               RPMPackageCommander.removeRepositoryForRootstrap(repo.getName(), rootstrapPath);
-                                       }
-                               }
-
+                               int selectedIdx = repoViewer.getTable().getSelectionIndex();
+                               if ( selectedIdx == -1 ) {                                      
+                                       DialogUtil.openMessageDialog(resources.getString("PkgMgr.Message.Select.OnePackage"));
+                                       return;
+                               }                               
+                               Repository repos = (Repository)repoViewer.getTable().getItem(selectedIdx).getData();
+                               rootstrap.removeRepositoryURL(repos.getUri());
+                               updateRepositoryInfo();
                                repoViewer.refresh();
-                               int recentTableIndex = repoViewer.getTable().getItemCount();
-
-                               for (int i = 0; i < recentTableIndex; i++) {
-                                       TableItem item = repoViewer.getTable().getItem(i);
-                                       Repository repo = (Repository)item.getData();
-                                       item.setChecked(repo.getCheckColumn());
-                               }
-
                        }
 
                        @Override
                        public void mouseUp(MouseEvent e) {
                        }
                });
+       }
+       
+       
+       public void updateRepositoryInfo() {
+               initializeRepositoryInfo(rootstrap);
+       }
+       
+       
+       public static void initializeRepositoryInfo(PlatformRootstrap rootstrap) {
+               String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString());
+               RepositoryProvider.INSTANCE.getBuildsystemRepos().clear();
+               RPMPackageCommander.resetRepositoryForRootstrap(rootstrapPath);
+               int idx = 0;
+               for (String url : rootstrap.getRepositoryURLs()) {
+                       String name = String.format("url%d", idx++);
+                       RepositoryProvider.INSTANCE.getBuildsystemRepos()
+                               .add(new Repository(name, url ));
+                       RPMPackageCommander.addRepositoryForRootstrap(name, url, rootstrapPath);
+               }
+       }
+       
+       
+       public static void initializePackageInfo(PlatformRootstrap rootstrap) {
+               String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString());
+               PackageProvider.INSTANCE.getBuildsystemPkgs().clear();
+               PackageProvider.INSTANCE.getBuildsystemPkgs()
+                       .addAll(RPMPackageCommander.getPackageListForRootstrap(rootstrapPath));
+       }
 
-               Button refresh_bt = new Button( parent, SWT.PUSH );
+       
+       private void createPackageGroup( Composite parent )
+       {
+               Group grpPkg = new Group(parent, SWT.NONE);
+               grpPkg.setText(resources.getString("PkgMgr.Frame.Package"));
+               GridData pkgs_gd = new GridData(GridData.FILL_BOTH|GridData.GRAB_VERTICAL);
+               grpPkg.setLayoutData(pkgs_gd);
+               grpPkg.setLayout(new GridLayout(1, false));
+
+               createPackageButtonsAndFilter( grpPkg );
+        createPackageTable( grpPkg );
+       }
+
+       
+       private void createPackageButtonsAndFilter( Composite parent ) {
+               Composite composite = new Composite( parent, SWT.NONE );
+               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               composite.setLayout(new GridLayout(2, false));
+               
+               createPackageButtons( composite );
+               createPackageFilter( composite );
+       }
+       
+       
+       private void createPackageButtons( Composite parent )
+       {
+               Composite composite = new Composite( parent, SWT.NONE );
+               RowLayout layout = new RowLayout(SWT.HORIZONTAL);
+               layout.pack = false;
+               composite.setLayout(layout);
+
+               Button refresh_bt = new Button( composite, SWT.PUSH );
                refresh_bt.setText(resources.getString("PkgMgr.Button.RefreshRepo"));
                refresh_bt.setToolTipText(resources.getString("PkgMgr.Button.RefreshRepo.Tooltip"));
                refresh_bt.addMouseListener(new MouseListener(){
@@ -417,62 +327,32 @@ public class BuildSystemTab {
                                ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
 
                                try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
+                                       dialog.run(true, false, new IRunnableWithProgress() {
                                                @Override
                                                public void run(IProgressMonitor monitor) throws InvocationTargetException,
                                                                InterruptedException {
                                                        monitor.beginTask(resources.getString("PkgMgr.Message.Refreshing"), -1);                                                        
-                                                       
-                                                       //PlatformCheckCancelJob cancelJob = new PlatformCheckCancelJob(monitor, project, sbi);                                                 
-                                                       //Thread checkCancelThread = new Thread(cancelJob);
-                                                       //checkCancelThread.start();
-                                                       
                                                        RPMPackageCommander.refreshRepositoryForRootstrap(rootstrapPath);                                                       
-                                                       //cancelJob.setFinishFlag(true);
+                                                       monitor.done();                                                         
                                                }
                                        });
                                } catch (Exception e1) {
-                                       // TODO Auto-generated catch block
-                                       e1.printStackTrace();
+                       DialogUtil.openErrorDialog(
+                               resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
+                               "("+e1.toString()+")");
                                }
                        }
 
                        @Override
                        public void mouseUp(MouseEvent e) {
                        }
-        });            
-       }
-
-       private void createPackageTable( Composite parent )
-       {
-               pkgViewer = new TableViewer( parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
-        createColumns( parent );
-        Table packageTable = pkgViewer.getTable();
-        packageTable.addListener( SWT.Selection, new Listener(){
-
-                       @Override
-                       public void handleEvent(Event event) {
-                               if( event.detail == SWT.CHECK )
-                               {
-                                       Package pkg = (Package)event.item.getData();
-                                       pkg.setCheckColumn( !pkg.getCheckColumn() );
-                               }
-                       }
-               });
-
-        packageTable.setHeaderVisible(true);
-        packageTable.setLinesVisible(true);
-
-        pkgViewer.setContentProvider(new ArrayContentProvider());
-        pkgViewer.setInput(PackageProvider.INSTANCE.getBuildsystemPkgs());
-       }
-
-       private void createPackageButtons( Composite parent )
-       {
-               Button add_rtpkg_bt = new Button( parent, SWT.PUSH );
-               add_rtpkg_bt.setText(resources.getString("PkgMgr.Button.AddRPackage"));
-               add_rtpkg_bt.setToolTipText(resources.getString("PkgMgr.Button.AddRPackage.Tooltip"));
-               add_rtpkg_bt.addMouseListener(new MouseListener(){
+        });    
+               
+               
+               Button upgrade_bt = new Button( composite, SWT.PUSH );
+               upgrade_bt.setText(resources.getString("PkgMgr.Button.Upgrade"));
+               upgrade_bt.setToolTipText(resources.getString("PkgMgr.Button.Upgrade.Tooltip"));
+               upgrade_bt.addMouseListener(new MouseListener(){
 
                        @Override
                        public void mouseDoubleClick(MouseEvent e) {
@@ -480,66 +360,36 @@ public class BuildSystemTab {
 
                        @Override
                        public void mouseDown(MouseEvent e) {
-
-                               RemotePkgProvider.INSTANCE.getPkgs().clear();
-                               RemotePkgProvider.INSTANCE.getSelectedPkgs().clear();
-
+                               
                                ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-
-                               try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {
-                                                               monitor.beginTask(resources.getString("PkgMgr.Message.Getting.RemotePackage"), -1);
-                                                               genRemotePkgList();
-                                               }
-                                       });
-                               } catch (Exception e1) {
-                                       e1.printStackTrace();
-                               }
-
-                               AddRemotePackageDialog dlg = new AddRemotePackageDialog(shell);
-                               dlg.open();
-
-                               dialog = new ProgressMonitorDialog(shell);
+                               
                                try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
+                                       dialog.run(true, false, new IRunnableWithProgress() {
                                                @Override
                                                public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {
-                                                       monitor.beginTask(resources.getString("PkgMgr.Message.Adding.Package"), -1);
-                                                       for (RemotePackage p : RemotePkgProvider.INSTANCE.getSelectedPkgs()) {
-                                                               addRemotePackage(p);
-                                                       }
+                                                               InterruptedException {                                                  
+                                                       
+                                                               monitor.beginTask(resources.getString("PkgMgr.Message.Upgrade"), -1);
+                                                               RPMPackageCommander.DistUpgradeRootstrap(rootstrapPath);
+                                                               monitor.done();                                                         
                                                }
                                        });
                                } catch (Exception e1) {
-                                       e1.printStackTrace();
-                               }
-                               
-                               pkgViewer.refresh();
-                               int recentTableIndex = pkgViewer.getTable().getItemCount();
-
-                               for (int i = 0; i < recentTableIndex; i++) {
-                                       TableItem item = pkgViewer.getTable().getItem(i);
-                                       Package pkg = (Package)item.getData();
-                                       item.setChecked(pkg.getCheckColumn());
-                               }
-
+                       DialogUtil.openErrorDialog(
+                               resources.getString("PkgMgr.Msg.Error.UpgradeFailed")+
+                               "("+e1.toString()+")");
+                               }                       
                        }
 
                        @Override
                        public void mouseUp(MouseEvent e) {
                        }
-
         });
-
-               Button add_lcpkg_bt = new Button( parent, SWT.PUSH );
-               add_lcpkg_bt.setText(resources.getString("PkgMgr.Button.AddLPackage"));
-               add_lcpkg_bt.setToolTipText(resources.getString("PkgMgr.Button.AddLPackage.Tooltip"));
-               add_lcpkg_bt.addMouseListener(new MouseListener()
-        {
+               
+               Button install_bt = new Button( composite, SWT.PUSH );
+               install_bt.setText(resources.getString("PkgMgr.Button.Install"));
+               install_bt.setToolTipText(resources.getString("PkgMgr.Button.Install.Tooltip"));
+               install_bt.addMouseListener(new MouseListener(){
 
                        @Override
                        public void mouseDoubleClick(MouseEvent e) {
@@ -547,69 +397,36 @@ public class BuildSystemTab {
 
                        @Override
                        public void mouseDown(MouseEvent e) {
-
-                               int oldTableIndex = pkgViewer.getTable().getItemCount();
-
-                               fd = new FileDialog( shell, SWT.OPEN|SWT.MULTI);
-                       fd.setText(resources.getString("FileDlg.Title"));
-                       if (previousFilterPath == null)
-                               fd.setFilterPath(null);
-                       else
-                               fd.setFilterPath(previousFilterPath);
-                       String[] filterExt = { resources.getString("FileDlg.Filter.Ext") };
-                       fd.setFilterExtensions(filterExt);
-
-                       String _arch = "";
-                       if (PlatformConfigurationManager.isDeviceArch(arch)) {
-                               _arch = "armv7l";
-                       } else if (PlatformConfigurationManager.isEmulatorArch(arch)) {
-                               _arch = "i586";
-                       } else {
-                               _arch = arch;
-                       }                                       
-                               String defaultPath = rootstrapPath + resources.getString("FileDlg.Default.Path") + _arch;
-                               fd.setFilterPath(defaultPath);
-
-                       selectedFileList = fd.open();
-
-                       ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-
+                               final CopyOnWriteArrayList<Package> selectedList = 
+                                               PackageProvider.INSTANCE.getSelectedBuildsystemPkgs(false);
+                               
+                               if(selectedList.isEmpty()) {
+                                       DialogUtil.openErrorDialog( resources.getString("PkgMgr.Error.Noselected.Package"));
+                                       return;
+                               }
+                               
+                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
                                try {
                                        dialog.run(true, false, new IRunnableWithProgress() {
                                                @Override
                                                public void run(IProgressMonitor monitor) throws InvocationTargetException,
                                                                InterruptedException {
-                                                       monitor.beginTask(resources.getString("PkgMgr.Message.Adding.Package"), -1);
-                                               if( selectedFileList != null )
-                                               {
-                                                       String[] files = fd.getFileNames();
-                                                       previousFilterPath = fd.getFilterPath();
-                                                       for (int i=0, n = files.length; i<n;  i++) {
-                                                               monitor.subTask(String.format("Adding %s", files[i]));
-                                                               StringBuffer buf = new StringBuffer();
-                                                               buf.append(fd.getFilterPath());
-                                                               if (buf.charAt(buf.length() -1) != File.separatorChar) {
-                                                                       buf.append(File.separatorChar);
-                                                               }
-                                                               buf.append(files[i]);
-                                                               addLocalPackage( buf.toString());
-                                                       }
-                                               }
+                                                       
+                                                       monitor.beginTask(resources.getString("PkgMgr.Message.Installing.Package"), -1);
+                                                       RPMPackageCommander.installRemotePkgForRootstrap(selectedList, rootstrapPath);
+                                                       monitor.done();
                                                }
                                        });
-                               } catch (Exception e1) {
-                                       e1.printStackTrace();
                                }
-
-                               pkgViewer.refresh();
-
-                               int recentTableIndex = pkgViewer.getTable().getItemCount();
-
-                               for (int i = oldTableIndex; i < recentTableIndex; i++) {
-                                       TableItem item = pkgViewer.getTable().getItem(i);
-                                       Package pkg = (Package)item.getData();
-                                       item.setChecked(pkg.getCheckColumn());
+                               catch (Exception e1) {
+                       DialogUtil.openErrorDialog(
+                               resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                               "("+e1.toString()+")");
                                }
+                               
+                               // update package list
+                               updatePackageInfo(null);
+                               pkgViewer.refresh();
                        }
 
                        @Override
@@ -617,49 +434,11 @@ public class BuildSystemTab {
                        }
 
         });
-
-               Button remove_bt = new Button( parent, SWT.PUSH );
-        remove_bt.setText(resources.getString("PkgMgr.Button.RemoveList"));
-        remove_bt.setToolTipText(resources.getString("PkgMgr.Button.RemoveList.Tooltip"));
-        remove_bt.addMouseListener(new MouseListener() {
-
-               @Override
-               public void mouseDoubleClick(MouseEvent e) {
-               }
-
-               @Override
-               public void mouseDown(MouseEvent e) {
-                       CopyOnWriteArrayList<Package> pkgList = PackageProvider.INSTANCE.getBuildsystemPkgs();
-                       for( Package pkg: pkgList)
-                       {
-                               boolean selected = false;
-                                       selected = pkg.getCheckColumn();
-                               if (selected) {
-                                       pkgList.remove(pkg);
-                               }
-                       }
-                       pkgViewer.refresh();
-
-                       int recentTableIndex = pkgViewer.getTable().getItemCount();
-                       for (int i = 0; i < recentTableIndex; i++) {
-                               TableItem item = null;
-                               item = pkgViewer.getTable().getItem(i);
-                               Package pkg = (Package)item.getData();
-                               item.setChecked(pkg.getCheckColumn());
-                       }
-               }
-
-               @Override
-               public void mouseUp(MouseEvent e) {
-               }
-       });
-        
-        Label space = new Label(parent, SWT.NONE);
-        
-               Button install_bt = new Button( parent, SWT.PUSH );
-               install_bt.setText(resources.getString("PkgMgr.Button.Install"));
-               install_bt.setToolTipText(resources.getString("PkgMgr.Button.Install.Tooltip"));
-               install_bt.addMouseListener(new MouseListener(){
+               
+               Button installLocal_bt = new Button( composite, SWT.PUSH );
+               installLocal_bt.setText(resources.getString("PkgMgr.Button.InstallLocal"));
+               installLocal_bt.setToolTipText(resources.getString("PkgMgr.Button.InstallLocal.Tooltip"));
+               installLocal_bt.addMouseListener(new MouseListener() {
 
                        @Override
                        public void mouseDoubleClick(MouseEvent e) {
@@ -667,107 +446,51 @@ public class BuildSystemTab {
 
                        @Override
                        public void mouseDown(MouseEvent e) {
-
-                               pkgs = getSelectedPkg(PackageProvider.INSTANCE.getBuildsystemPkgs());
-
-                               if(pkgs.isEmpty()) {
-                                       MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Noselected.Package"));
-                                       return;
-                               }
-
-                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-
+                               FileDialog fd = new FileDialog( shell, SWT.OPEN|SWT.MULTI);
+                       fd.setText(resources.getString("FileDlg.Title"));
+                       String[] filterExt = { resources.getString("FileDlg.Filter.Ext") };
+                       fd.setFilterExtensions(filterExt);
+                       String firstFilePath = fd.open();
+                       if ( firstFilePath == null ) {  return; }
+                       
+                       String[] fileNames = fd.getFileNames();
+                       final ArrayList<String> selectedFiles = new ArrayList<String>();
+                       for( String fileName : fileNames ) {
+                               selectedFiles.add(new File(firstFilePath).getParent()+"/"+fileName);
+                       }
+                       
+                       ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
                                try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
+                                       dialog.run(true, false, new IRunnableWithProgress() {
                                                @Override
                                                public void run(IProgressMonitor monitor) throws InvocationTargetException,
                                                                InterruptedException {
-                                                       monitor.beginTask(resources.getString("PkgMgr.Message.Installing.Package"), -1);
                                                        
-                                                       //PlatformCheckCancelJob cancelJob = new PlatformCheckCancelJob(monitor, project, sbi);                                         
-
-                                                       try {
-                                                               String rpmPathList = "";
-                                                               String localPkgList = "";
-                                                               String remotePkgList = "";                                                      
-
-                                                               for (Package pkg : pkgs) {
-                                                                       if (pkg instanceof LocalPackage) {
-                                                                               LocalPackage p = (LocalPackage)pkg;
-                                                                               String filePath = p.getPath();
-                                                                               String filename = new File(filePath).getName();
-                                                                               String pathOnRootstrap = "/tmp/" + filename;
-                                                                               String copyToPath = rootstrapPath + pathOnRootstrap;
-                                                                               FileUtil.copyTo(filePath, copyToPath);
-                                                                               rpmPathList = rpmPathList.concat(pathOnRootstrap + " ");
-                                                                               localPkgList = localPkgList.concat(pkg.getName() + " ");
-                                                                       } else if (pkg instanceof RemotePackage) {
-                                                                               remotePkgList = remotePkgList.concat(pkg.getName() + " ");
-                                                                       }
-                                                               }
-                                                               
-                                                               //Thread checkCancelThread = new Thread(cancelJob);
-                                                               //checkCancelThread.start();
-
-                                                               if(!"".equals(remotePkgList)) {
-                                                                       monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), remotePkgList));
-                                                                       RPMPackageCommander.installRemotePkgForRootstrap(remotePkgList, rootstrapPath);
-                                                               }
-
-                                                               if(!"".equals(localPkgList)) {
-                                                                       monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), localPkgList));
-                                                                       RPMPackageCommander.InstallPkgToRootstrap(rpmPathList, rootstrapPath);
-                                                                       for (String p : rpmPathList.split(" ")) {
-                                                                               File f = new File(rootstrapPath + p);
-                                                                               if (f.exists()) {
-                                                                                       f.delete();
-                                                                               }
-                                                                       }
-                                                               }
-
-                                                               for (Package pkg : pkgs) {
-                                                                       String installedVer = RPMPackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), rootstrapPath);
-                                                                       pkg.setInstalledVersion(installedVer);
-                                                                       if ("".equals(installedVer)) {
-                                                                               pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
-                                                                       } else if (installedVer.equals(pkg.getNewVersion())) {
-                                                                               if (RPMPackageCommander.pkgInstalledSuccessfullyForRootstrap(pkg.getName(), rootstrapPath)) {
-                                                                                       pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
-                                                                               } else {
-                                                                                       pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
-                                                                               }
-                                                                       } else {
-                                                                               pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
-                                                                       }
-                                                               }
-
-                                                       } catch (IOException e) {
-                                                               //cancelJob.setFinishFlag(true);
-                                                               e.printStackTrace();
-                                                       }
-
-                                                       //cancelJob.setFinishFlag(true);
+                                                       monitor.beginTask(resources.getString("PkgMgr.Message.Installing.LocalPackage"), -1);
+                                                       RPMPackageCommander.InstallLocalPkgToRootstrap(selectedFiles, rootstrapPath);
                                                        monitor.done();
                                                }
                                        });
                                } catch (Exception e1) {
-                                       // TODO Auto-generated catch block
-                                       e1.printStackTrace();
+                       DialogUtil.openErrorDialog(
+                               resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                               "("+e1.toString()+")");
                                }
 
+                               // update package list
+                               updatePackageInfo(selectedFiles);
                                pkgViewer.refresh();
                        }
 
                        @Override
                        public void mouseUp(MouseEvent e) {
                        }
-
-        });
+               });
                
-               Button remove_ipkg_bt = new Button( parent, SWT.PUSH );
-               remove_ipkg_bt.setText(resources.getString("PkgMgr.Button.Uninstall"));
-               remove_ipkg_bt.setToolTipText(resources.getString("PkgMgr.Button.Uninstall.Tooltip"));
-               remove_ipkg_bt.addMouseListener(new MouseListener(){
+               Button removeBt = new Button( composite, SWT.PUSH );
+               removeBt.setText(resources.getString("PkgMgr.Button.Uninstall"));
+               removeBt.setToolTipText(resources.getString("PkgMgr.Button.Uninstall.Tooltip"));
+               removeBt.addMouseListener(new MouseListener(){
 
                        @Override
                        public void mouseDoubleClick(MouseEvent e) {
@@ -775,110 +498,207 @@ public class BuildSystemTab {
 
                        @Override
                        public void mouseDown(MouseEvent e) {
-
-                               InstalledPkgProvider.INSTANCE.getPkgs().clear();
-                               InstalledPkgProvider.INSTANCE.getSelectedPkgs().clear();
+                               final CopyOnWriteArrayList<Package> selectedList = 
+                                               PackageProvider.INSTANCE.getSelectedBuildsystemPkgs(true);
+                               if(selectedList.isEmpty()) {
+                                       DialogUtil.openErrorDialog( resources.getString("PkgMgr.Error.Noselected.Package"));
+                                       return;
+                               }
 
                                ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-                               
                                try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
+                                       dialog.run(true, false, new IRunnableWithProgress() {
                                                @Override
                                                public void run(IProgressMonitor monitor) throws InvocationTargetException,
                                                                InterruptedException {
-                                                               monitor.beginTask(resources.getString("PkgMgr.Message.Getting.InstalledPackage"), -1);
-                                                               genInstalledPkgList();
+                                                       
+                                                               monitor.beginTask(resources.getString("PkgMgr.Message.Uninstalling.Package"), -1);
+                                                               RPMPackageCommander.uninstallPkgFromRootstrap(selectedList, rootstrapPath);
+                                                               monitor.done();
                                                }
                                        });
                                } catch (Exception e1) {
-                                       e1.printStackTrace();
+                       DialogUtil.openErrorDialog(
+                               resources.getString("PkgMgr.Msg.Error.UninstallFailed")+
+                               "("+e1.toString()+")");
                                }
                                
-                               RemoveInstalledPackageDialog dlg = new RemoveInstalledPackageDialog(shell, rootstrapPath);
-                               dlg.open();
+                               // update package list
+                               updatePackageInfo(null);
+                               pkgViewer.refresh();
                        }
 
                        @Override
                        public void mouseUp(MouseEvent e) {
                        }
-
         });
+       }
+
+       
+       private void updatePackageInfo(ArrayList<String> localPackageFileList ) {
+               ArrayList<Package> fullList = RPMPackageCommander.getPackageListForRootstrap(rootstrapPath);
+               for( Package pkg: PackageProvider.INSTANCE.getBuildsystemPkgs()) {
+                       for( Package currPkg: fullList ) {
+                               if ( currPkg.getName().equals(pkg.getName())) {
+                                       // check newly install
+                                       if( !pkg.getInstalledVersion().equals(currPkg.getInstalledVersion())) {
+                                               pkg.setNewlyChanged(true);
+                                       }
+                                       
+                                       pkg.setInstalledVersion(currPkg.getInstalledVersion());
+                                       break;
+                               }
+                       }
+                       pkg.setChecked(false);
+               }
                
-               Button upgrade_bt = new Button( parent, SWT.PUSH );
-               upgrade_bt.setText(resources.getString("PkgMgr.Button.Upgrade"));
-               upgrade_bt.setToolTipText(resources.getString("PkgMgr.Button.Upgrade.Tooltip"));
-               upgrade_bt.addMouseListener(new MouseListener(){
+               // add if there is new package
+               for( Package currPkg: fullList ) {
+                       boolean found = false;
+                       for( Package pkg: PackageProvider.INSTANCE.getBuildsystemPkgs()) {
+                               if ( currPkg.getName().equals(pkg.getName())) {
+                                       found = true;
+                                       break;
+                               }
+                       }
+                       
+                       if ( !found ) {
+                               PackageProvider.INSTANCE.getBuildsystemPkgs().add(currPkg);
+                               currPkg.setNewlyChanged(true);
+                       }
+               }
+               
+               // check local package update
+               if ( localPackageFileList != null ) {
+                       ArrayList<String> localPackageNameList = new ArrayList<String>();
+                       for( String filePath: localPackageFileList) {
+                               localPackageNameList.add(RPMPackageCommander.getPkgNameForFile(filePath));
+                       }
+                       for( Package pkg: PackageProvider.INSTANCE.getBuildsystemPkgs()) {
+                               if( localPackageNameList.contains( pkg.getName() ) ) {
+                                       pkg.setNewlyChanged(true);
+                               }
+                       }
+               }
+       }
+       
+       
+       private void createPackageFilter( Composite parent ) {
+               Composite composite = new Composite( parent, SWT.NONE );
+               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL|GridData.GRAB_HORIZONTAL));
+               composite.setLayout(new GridLayout(3,false));
+
+               Label filterTextLabel = new Label(composite, SWT.NONE);
+               filterTextLabel.setText(resources.getString("PkgMgr.Label.Filter"));
+               
+               categoryCombo = new Combo(composite, SWT.READ_ONLY);
+               String[] items = {"All","Installed","Upgradable"};
+               categoryCombo.setItems(items);
+               categoryCombo.addSelectionListener( new SelectionListener() {
 
                        @Override
-                       public void mouseDoubleClick(MouseEvent e) {
+                       public void widgetSelected(SelectionEvent e) {
+                               pkgViewer.refresh();
                        }
 
                        @Override
-                       public void mouseDown(MouseEvent e) {
-                               
-                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-                               
-                               try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {                                                  
-                                                       
-                                                               monitor.beginTask(resources.getString("PkgMgr.Message.Dist.Upgrade"), -1);
-                                                               
-                                                               //PlatformCheckCancelJob cancelJob = new PlatformCheckCancelJob(monitor, project, sbi);
-                                                               //Thread checkCancelThread = new Thread(cancelJob);
-                                                               //checkCancelThread.start();
-                                                               
-                                                               RPMPackageCommander.DistUpgradeRootstrap(rootstrapPath);
-                                                               
-                                                               //cancelJob.setFinishFlag(true);
-                                                               monitor.done();                                                         
-                                               }
-                                       });
-                               } catch (Exception e1) {
-                                       e1.printStackTrace();
-                               }                       
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                               // do nothing
                        }
+               });
+               categoryCombo.select(0);
+
+
+               filterText = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+        GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+        filterText.setLayoutData(gridData);
+        filterText.addModifyListener(new ModifyListener() {
 
                        @Override
-                       public void mouseUp(MouseEvent e) {
+                       public void modifyText(ModifyEvent e) {
+                               pkgViewer.refresh();
                        }
-
         });
        }
+       
+       
 
-       private void createColumnsForRepoTable( Composite parent )
+       private void createPackageTable( Composite parent )
        {
-               String[] titles = {resources.getString("PkgMgr.Repo.Table.Column.1"),
-                               resources.getString("PkgMgr.Repo.Table.Column.2")};
-               int[] bounds = { 200, 600 };
+               Composite composite = new Composite( parent, SWT.NONE );
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new FillLayout());
 
-               TableViewerColumn colName = createTableViewerColumn( repoViewer, titles[0], bounds[0], SWT.NONE);
-               TableColumn column = colName.getColumn();
-               column.addSelectionListener(new RepoTableSelectionAdapter(repoViewer));         
+               pkgViewer = CheckboxTableViewer.newCheckList( composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
+        createColumns( composite );
+        Table packageTable = pkgViewer.getTable();
+        packageTable.addListener( SWT.Selection, new Listener(){
 
-               colName.setLabelProvider(new ColumnLabelProvider() {
                        @Override
-                       public String getText(Object element) {
-                               Repository repo = (Repository)element;
-                               return repo.getName();
+                       public void handleEvent(Event event) {
+                               if( event.detail == SWT.CHECK )
+                               {
+                                       Package pkg = (Package)event.item.getData();
+                                       pkg.setCheckColumn( !pkg.getCheckColumn() );
+                               }
                        }
                });
 
-               TableViewerColumn colUrl = createTableViewerColumn( repoViewer, titles[1], bounds[1], SWT.NONE);
-               column = colUrl.getColumn();
-               column.addSelectionListener(new RepoTableSelectionAdapter(repoViewer));
+        packageTable.setHeaderVisible(true);
+        packageTable.setLinesVisible(true);
+
+        pkgViewer.setContentProvider(new ArrayContentProvider());
+        pkgViewer.setCheckStateProvider(new ICheckStateProvider() {
 
-               colUrl.setLabelProvider(new ColumnLabelProvider() {
                        @Override
-                       public String getText(Object element) {
-                               Repository repo = (Repository)element;
-                               return repo.getUri();
+                       public boolean isChecked(Object element) {
+                               Package pkg = (Package) element;
+                               return pkg.isChecked();
                        }
-               });
+
+                       @Override
+                       public boolean isGrayed(Object element) {
+                               return false;
+                       }
+        });
+        pkgViewer.addFilter( new ViewerFilter() {
+
+                       @Override
+                       public boolean select(Viewer viewer, Object parentElement,
+                                       Object element) {
+                               Package pkg = (Package) element;
+                               if ( categoryCombo != null  ) {
+                                       if ( categoryCombo.getText().equals("Installed") && 
+                                                       pkg.getInstalledVersion().isEmpty() ) {
+                                               return false;
+                                       }
+                                       if ( categoryCombo.getText().equals("Upgradable") && 
+                                                       ( pkg.getInstalledVersion().isEmpty() ||
+                                                         pkg.getNewVersion().isEmpty() ||
+                                                         RPMPackageCommander.compareVersion(pkg.getInstalledVersion(),pkg.getNewVersion()) >= 0 )) {
+                                               return false;
+                                       }
+                               }
+                               if ( filterText != null && !pkg.getName().contains(filterText.getText()) ) {
+                                       return false;
+                               }
+                               return true;
+                       }
+               
+        });
+        pkgViewer.addCheckStateListener( new ICheckStateListener() {
+
+                       @Override
+                       public void checkStateChanged(CheckStateChangedEvent event) {
+                               Package pkg = (Package)event.getElement();
+                               pkg.setChecked(true);
+                       }
+        });
+        pkgViewer.setInput(PackageProvider.INSTANCE.getBuildsystemPkgs());
        }
 
+       
+
        private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, int Style) {
 
                final TableViewerColumn viewerColumn = new TableViewerColumn( viewer,   Style);
@@ -893,40 +713,42 @@ public class BuildSystemTab {
 
        private void createColumns( Composite parent )
        {
-               String[] titles = {"Install Type", "Package Name", "Arch", "New Version", "Installed Version", "Status"};
-               int[] bounds = { 120, 250, 60, 150, 150, 150};
+               String[] titles = {"S", "Package Name", "Installed Version", "New Version", "Arch", "Description"};
+               int[] bounds = { 24, 200, 150, 150, 60, 150};
 
-               TableViewerColumn colInstallType = createTableViewerColumn( pkgViewer, titles[0], bounds[0], SWT.NONE);
-
-               colInstallType.setLabelProvider(new ColumnLabelProvider() {
+               TableViewerColumn colSelection = createTableViewerColumn( pkgViewer, titles[0], bounds[0], SWT.NONE);
+               colSelection.setLabelProvider(new ColumnLabelProvider() {
                        @Override
                        public String getText(Object element) {
-                               Package pkg = (Package)element;
-                               return pkg.getPkgType().toString();
+                               return "";
                        }
                });
-
+               
                TableViewerColumn colPackage = createTableViewerColumn( pkgViewer, titles[1], bounds[1], SWT.NONE);
-
                colPackage.setLabelProvider(new ColumnLabelProvider() {
                        @Override
                        public String getText(Object element) {
                                Package pkg = (Package)element;
-                               return pkg.getName();
+                               if ( pkg.isNewlyChanged() ) {
+                                       return "*"+pkg.getName();
+                               } 
+                               else {
+                                       return pkg.getName();
+                               }
                        }
                });
 
-               TableViewerColumn colArch = createTableViewerColumn( pkgViewer, titles[2], bounds[2], SWT.NONE);
-
-               colArch.setLabelProvider(new ColumnLabelProvider() {
+               TableViewerColumn colInsVer = createTableViewerColumn( pkgViewer, titles[2], bounds[2], SWT.NONE);
+               colInsVer.setLabelProvider(new ColumnLabelProvider() {
                        @Override
                        public String getText(Object element) {
                                Package pkg = (Package)element;
-                               String arch = pkg.getArch();
-                               return arch;
+                               String installedVer = pkg.getInstalledVersion();
+                               return installedVer;
                        }
                });
 
+
                TableViewerColumn colNewVer = createTableViewerColumn( pkgViewer, titles[3], bounds[3], SWT.NONE);
 
                colNewVer.setLabelProvider(new ColumnLabelProvider() {
@@ -938,145 +760,23 @@ public class BuildSystemTab {
                        }
                });
 
-               TableViewerColumn colInsVer = createTableViewerColumn( pkgViewer, titles[4], bounds[4], SWT.NONE);
-               colInsVer.setLabelProvider(new ColumnLabelProvider() {
+               TableViewerColumn colArch = createTableViewerColumn( pkgViewer, titles[4], bounds[4], SWT.NONE);
+
+               colArch.setLabelProvider(new ColumnLabelProvider() {
                        @Override
                        public String getText(Object element) {
                                Package pkg = (Package)element;
-                               String installedVer = pkg.getInstalledVersion();
-                               return installedVer;
+                               String arch = pkg.getArch();
+                               return arch;
                        }
                });
 
-               TableViewerColumn colStatus = createTableViewerColumn( pkgViewer, titles[5], bounds[5], SWT.NONE);
-
-               colStatus.setLabelProvider(new ColumnLabelProvider() {
+               TableViewerColumn colDescription = createTableViewerColumn( pkgViewer, titles[5], bounds[5], SWT.NONE);
+               colDescription.setLabelProvider(new ColumnLabelProvider() {
                        @Override
                        public String getText(Object element) {
-                               Package pkg = (Package)element;
-                               String status = pkg.getInstallInfo().toString();
-                               return status;
+                               return "";
                        }
                });
        }
-       
-
-       private void genInstalledPkgList() {
-               String list = RPMPackageCommander.getInstalledPackageListForRootstrap(rootstrapPath);
-               String[] splitStr = list.split("\n");
-               
-               // Package list starts at 1 line
-               for (int i = 1 ; i < splitStr.length ; i++) {
-                       String s = splitStr[i];
-                       s = s.replaceAll(" ", "").trim();
-                       InstalledPackage pkg = new InstalledPackage();
-                       pkg.setName(s);
-                       pkg.setCheckColumn(false);
-                       
-                       InstalledPkgProvider.INSTANCE.getPkgs().add(pkg);
-               }
-       }
-
-
-       private void genRemotePkgList() {
-
-               String list = RPMPackageCommander.getRemotePackageListForRootstrap(rootstrapPath);
-               String[] splitStr = list.split("\n");
-
-               // Package list starts at 5 line
-               for (int i = 5 ; i < splitStr.length ; i++) {
-                       String s = splitStr[i];
-                       s = s.replaceAll(" ", "");
-                       String[] part = s.split("\\|");
-                       String status = part[0];
-                       String repo = part[1];
-                       String name = part[2];
-                       String version = part[3];
-                       String arch = part[4];
-
-                       RemotePackage pkg = new RemotePackage();
-                       pkg.setName(name);
-                       pkg.setArch(arch);
-                       pkg.setNewVersion(version);
-                       pkg.setRepo(repo);
-                       pkg.setCheckColumn(false);
-                       if ("i".equals(status)) {
-                               pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
-                       } else if ("v".equals(status)) {
-                               pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
-                       }
-
-                       RemotePkgProvider.INSTANCE.getPkgs().add(pkg);
-               }
-       }
-
-       private void addRemotePackage( RemotePackage p ) {
-               CopyOnWriteArrayList<Package> pkgs = PackageProvider.INSTANCE.getBuildsystemPkgs();
-               Iterator<Package> debIter = pkgs.iterator();
-
-               while( debIter.hasNext() ) {
-                       Package pkg = debIter.next();
-                       if( pkg.getName().equals(p.getName()) &&
-                                       pkg.getNewVersion().equals(p.getNewVersion()) ) {
-                               return;
-                       }
-               }
-
-               String installedVer = RPMPackageCommander.getPkgInstalledVerForRootstrap(p.getName(), rootstrapPath);
-               p.setInstalledVersion(installedVer);
-               p.setCheckColumn(true);
-               p.setPkgType(Package.PKGTYPE.REMOTE);
-               PackageProvider.INSTANCE.getBuildsystemPkgs().add(p);
-       }
-
-       private void addLocalPackage( String rpmPath )
-       {
-               CopyOnWriteArrayList<Package> pkgs = PackageProvider.INSTANCE.getBuildsystemPkgs();
-               Iterator<Package> debIter = pkgs.iterator();
-
-               String pkgName = RPMPackageCommander.getPkgNameForFile(rpmPath);
-               String newVer = RPMPackageCommander.getPkgVerForFile(rpmPath);
-
-               while( debIter.hasNext() ) {
-                       Package pkg = debIter.next();
-                       if( pkg.getName().equals(pkgName) && pkg.getNewVersion().equals(newVer)) {
-                               return;
-                       }
-               }
-
-               LocalPackage pkg = new LocalPackage();
-               pkg.setName(pkgName);
-               pkg.setPath(rpmPath);
-               pkg.setPkgType(Package.PKGTYPE.LOCAL);
-               pkg.setArch(RPMPackageCommander.getArchForFile(rpmPath));
-               pkg.setNewVersion(newVer);
-
-               String installedVerForRootstrap = RPMPackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), rootstrapPath);
-               pkg.setInstalledVersion(installedVerForRootstrap);
-
-               if ("".equals(newVer)) {
-                       pkg.setCheckColumn(false);
-               } else if (!"".equals(installedVerForRootstrap)) {
-                       if (!installedVerForRootstrap.equals(newVer)) {
-                               pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
-                       } else {
-                               if (RPMPackageCommander.pkgInstalledSuccessfullyForRootstrap(pkgName, rootstrapPath)) {
-                                       pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
-                               }
-                       }
-               }
-
-               PackageProvider.INSTANCE.getBuildsystemPkgs().add(pkg);
-       }
-
-       private CopyOnWriteArrayList<Package> getSelectedPkg(CopyOnWriteArrayList<Package> pkgs) {
-               CopyOnWriteArrayList<Package> _pkgs = new CopyOnWriteArrayList<Package>();
-               for (Package pkg : pkgs) {
-                       if(pkg.getCheckColumn()) {
-                               _pkgs.add(pkg);
-                       }
-               }
-
-               return _pkgs;
-       }
 }
index a3cb783..5314173 100644 (file)
@@ -273,7 +273,7 @@ public class DeviceTab {
                                }                               
                                
                                ModifyRepoDialog dialog = new ModifyRepoDialog(shell, resources.getString("PkgMgr.Tab.Device"),
-                                               selectedRepo.getName(), selectedRepo.getUri());
+                                               selectedRepo.getUri());
                                dialog.open();
                                
                                repoViewer.refresh();
index 27278f5..999851a 100644 (file)
@@ -13,21 +13,16 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 
-import org.tizen.nativeplatform.pkgmgr.model.Repository;
-import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
 
 public class ModifyRepoDialog extends Dialog {
        
-       private Text nameText;
        private Text uriText;
-       private String tab;
-       private String name;
        private String value;
        
        private int x = 0;
        private int y = 0;
        private final int width = 500;
-       private final int height = 200;
+       private final int height = 120;
        
        private final String BUNDLE_NAME = ModifyRepoDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
        private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
@@ -36,10 +31,8 @@ public class ModifyRepoDialog extends Dialog {
                super(parentShell);     
        }
        
-       public ModifyRepoDialog(Shell parentShell, String tab, String name, String value) {
+       public ModifyRepoDialog(Shell parentShell, String tab, String value) {
                super(parentShell);
-               this.tab = tab;
-               this.name = name;
                this.value = value;
                Rectangle bounds = parentShell.getBounds();
         x = bounds.x + (bounds.width - width)/2;
@@ -62,19 +55,10 @@ public class ModifyRepoDialog extends Dialog {
                composite.setLayoutData(new GridData(GridData.FILL_BOTH));
                composite.setLayout(new GridLayout(2, false));
                
-               Label nameLabel = new Label(composite, SWT.NONE);
-               nameLabel.setText(resources.getString("ModifyRepo.Label.Name"));                
-               nameText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
-        GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
-        gridData.widthHint = 500;
-        nameText.setLayoutData(gridData);
-        nameText.setText(name);
-        nameText.setEnabled(false);
-        
         Label urlLabel = new Label(composite, SWT.NONE);
         urlLabel.setText(resources.getString("ModifyRepo.Label.Uri"));         
                uriText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
-        gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
         gridData.widthHint = 500;
         uriText.setLayoutData(gridData);
         uriText.setText(value);
@@ -84,20 +68,12 @@ public class ModifyRepoDialog extends Dialog {
        
        @Override
        protected void okPressed() {
-               
-               Repository repo = new Repository();
-               if (!uriText.getText().equals(value)) {
-                       repo.setName(nameText.getText());
-                       repo.setUri(uriText.getText());
-                       repo.setCheckDirty(true);
-                       
-                       if (resources.getString("PkgMgr.Tab.Buildsystem").equals(tab)) {
-                               RepositoryProvider.INSTANCE.getBuildsystemRepos().add(repo);
-                       } else if (resources.getString("PkgMgr.Tab.Device").equals(tab)) {
-                               RepositoryProvider.INSTANCE.getDeviceRepos().add(repo);
-                       }
-               }
-                               
+               value = uriText.getText().trim();
                super.okPressed();
        }
+       
+       public String getRepositoryURL() {
+               return value;
+       }
+       
 }
index 8055c02..23a3f95 100644 (file)
@@ -1,5 +1,5 @@
 PkgMgr.Title = Package Manager
-PkgMgr.Frame.Description = Install packages to the build system or device.
+PkgMgr.Frame.Description = Manage packages on rootstrap or target.
 PkgMgr.Frame.Respository = Repositories
 PkgMgr.Frame.Package = Packages
 PkgMgr.Tab.Buildsystem = Build System
@@ -19,27 +19,38 @@ PkgMgr.Button.ModifyRepo.Tooltip = Modify a repository
 PkgMgr.Button.RemoveRepo = Remove
 PkgMgr.Button.RemoveRepo.Tooltip = Remove the selected repositories
 PkgMgr.Button.RefreshRepo = Refresh
-PkgMgr.Button.RefreshRepo.Tooltip = Refresh all repositories
+PkgMgr.Button.RefreshRepo.Tooltip = Refresh remote package information
+PkgMgr.Button.Upgrade = Upgrade
+PkgMgr.Button.Upgrade.Tooltip = Perform a distribution upgrade
+PkgMgr.Button.Install = Install
+PkgMgr.Button.Install.Tooltip = Install remote packages
+PkgMgr.Button.InstallLocal = Install Local
+PkgMgr.Button.InstallLocal.Tooltip = Install local packages
+PkgMgr.Button.Uninstall = Uninstall
+PkgMgr.Button.Uninstall.Tooltip = Uninstall packages
+
+PkgMgr.Label.Category = Category:
+PkgMgr.Label.Filter = Filter:
+
 PkgMgr.Button.AddRPackage = Add Remote Package
 PkgMgr.Button.AddRPackage.Tooltip = Add remote packages from repositories
 PkgMgr.Button.AddLPackage = Add Local Package
 PkgMgr.Button.AddLPackage.Tooltip = Add local packages from file system
 PkgMgr.Button.RemoveList = Remove List
 PkgMgr.Button.RemoveList.Tooltip = Remove selected packages from list
-PkgMgr.Button.Install = Install Package
-PkgMgr.Button.Install.Tooltip = Install selected packages
-PkgMgr.Button.Uninstall = Uninstall Packages
-PkgMgr.Button.Uninstall.Tooltip = Uninstall packages
-PkgMgr.Button.Upgrade = Dist Upgrade
-PkgMgr.Button.Upgrade.Tooltip = Perform a distribution upgrade
 PkgMgr.Message.Refreshing = Refreshing the repository...
+PkgMgr.Msg.Error.RefreshFailed = Refreshing repository failed!
 PkgMgr.Message.Adding.Package = Adding selected packages to the table...
 PkgMgr.Message.Getting.RemotePackage = Getting the remote package list...
-PkgMgr.Message.Getting.InstalledPackage = Getting the installed package list...
-PkgMgr.Message.Installing.Package = Installing packages...
 PkgMgr.Message.Select.OnePackage = Please select one repository
 PkgMgr.Message.Transfer.File = Transferring %s to target's %s...
-PkgMgr.Message.Dist.Upgrade = Upgrading distribution...
+PkgMgr.Message.Upgrade = Upgrading...
+PkgMgr.Msg.Error.UpgradeFailed = Upgrading failed!
+PkgMgr.Message.Installing.Package = Installing packages...
+PkgMgr.Message.Installing.LocalPackage = Installing local packages...
+PkgMgr.Msg.Error.InstallFailed = Installing failed!
+PkgMgr.Message.Uninstalling.Package = Uninstalling packages...
+PkgMgr.Msg.Error.UninstallFailed = Uninstalling failed!
 PkgMgr.Console.Remote.Install = ***** Installing a remote package *****\n
 PkgMgr.Console.Local.Install = \n***** Installing a local package *****\n
 PkgMgr.Repo.Table.Column.1 = Name
index e59a50d..bd62444 100644 (file)
@@ -38,8 +38,6 @@ import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Rectangle;
@@ -79,15 +77,16 @@ public class RPMPackageDialog extends Dialog {
        
        private int x = 0;
        private int y = 0;
-       private final int width = 1100;
-       private final int height = 800;
+       private final int width = 900;
+       private final int height = 700;
        
        private final String BUNDLE_NAME = RPMPackageDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
        private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
        
+       
        public RPMPackageDialog(Shell parentShell, PlatformRootstrap rootstrap) {
                super(parentShell);
-               setBlockOnOpen(false);          
+               //setBlockOnOpen(false);                
                this.enableRootstrapTab = true;
                
                Rectangle bounds = parentShell.getBounds();
@@ -100,9 +99,10 @@ public class RPMPackageDialog extends Dialog {
         this.rootstrap = rootstrap;
        }
        
+       
        public RPMPackageDialog(Shell parentShell, String target, boolean enableRootstrap, boolean enableTarget) {
                super(parentShell);
-               setBlockOnOpen(false);          
+               //setBlockOnOpen(false);                
                this.enableRootstrapTab = enableRootstrap;
                this.enableTargetTab = enableTarget;
                
@@ -128,12 +128,14 @@ public class RPMPackageDialog extends Dialog {
                }
        }
        
+       
        protected void setShellStyle(int newShellStyle) {
-               int newStyle = newShellStyle & ~SWT.APPLICATION_MODAL;
-               newStyle |= SWT.MODELESS;
+               int newStyle = newShellStyle;// & ~SWT.APPLICATION_MODAL;
+               //newStyle |= SWT.MODELESS;
                super.setShellStyle(newStyle);
        }
 
+       
        @Override
        public boolean close()
        {
@@ -148,6 +150,7 @@ public class RPMPackageDialog extends Dialog {
                createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
        }
        
+       
        @Override
        protected void configureShell(Shell newShell) {
                super.configureShell(newShell);
@@ -164,6 +167,7 @@ public class RPMPackageDialog extends Dialog {
                }
        }
        
+       
        @Override
        protected Control createDialogArea(Composite parent) {
                
@@ -191,49 +195,30 @@ public class RPMPackageDialog extends Dialog {
                errorLabel.setText(message);
        }
        
-   private void createDialogDescription(Composite composite)
+       
+    private void createDialogDescription(Composite composite)
     {
         Composite comp_descrip = new Composite(composite, SWT.NONE);
         Color whiteColor = new Color(composite.getDisplay(), 255, 255, 255);
-        Color warningColor = composite.getDisplay().getSystemColor(SWT.COLOR_RED);
-        Color infoColor = composite.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE);
 
         comp_descrip.setLayout(new GridLayout(1, false));
         GridData comp_descrip_gd = new GridData(GridData.FILL_HORIZONTAL);
-        comp_descrip_gd.heightHint = height/12;
+        comp_descrip_gd.heightHint = 30;
         comp_descrip.setLayoutData(comp_descrip_gd);
         comp_descrip.setBackground(whiteColor);
 
         Label label = new Label(comp_descrip, SWT.NONE);
         label.setText(resources.getString("PkgMgr.Frame.Description"));
         label.setBackground(whiteColor);
-        
-        if ("".equals(http_proxy)) {
-               Label warning_label = new Label(comp_descrip, SWT.NONE);
-               warning_label.setText(resources.getString("PkgMgr.Warn.Notset.Proxy"));
-               warning_label.setBackground(whiteColor);
-               warning_label.setForeground(warningColor);
-        } else {
-               Label info_label = new Label(comp_descrip, SWT.NONE);
-               info_label.setText(String.format(resources.getString("PkgMgr.Info.set.Proxy"), http_proxy));
-                       info_label.setBackground(whiteColor);
-                       info_label.setForeground(infoColor);
-        }
     }
-       
+
+   
        private void createTabs( Composite parent )
        {
                tabFolder = new TabFolder( parent, SWT.BORDER  );
                tabFolder.setLayoutData(new GridData( GridData.FILL_BOTH));
                tabFolder.setLayout(new GridLayout(1, false));          
                
-               tabFolder.addSelectionListener(new SelectionAdapter() {
-                       public void widgetSelected(SelectionEvent event) {
-                               // TODO:                
-                       }               
-               });
-               
-               
                if (enableRootstrapTab) {
                        BuildSystemTab tab = new BuildSystemTab(getShell(), tabFolder, rootstrap);
                        tab.createTab();
@@ -246,10 +231,19 @@ public class RPMPackageDialog extends Dialog {
                tabFolder.setSelection(tabIndex);               
        }       
        
+       
        private String getTargetID() {
                IProject project = CurrentEnabledProject.getCurrentProject();
                IConfiguration config = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
                String targetID = PlatformConfigurationManager.getBuildTargetName(config);
                return targetID;
-       }       
+       }
+       
+       
+       public void initializeDialogData() {
+               BuildSystemTab.initializeRepositoryInfo(rootstrap);
+               
+               // update package model
+               BuildSystemTab.initializePackageInfo(rootstrap);
+       }
 }
\ No newline at end of file
index a5ebe63..0a8f3c2 100644 (file)
@@ -1,6 +1,5 @@
 package org.tizen.nativeplatform.pkgmgr.ui;
 
-import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ResourceBundle;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -32,22 +31,14 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.console.MessageConsoleStream;
-
-import org.tizen.common.ui.view.console.ConsoleManager;
 import org.tizen.common.util.DialogUtil;
-import org.tizen.nativecommon.build.exception.SBIException;
-import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
 import org.tizen.nativeplatform.pkgmgr.model.InstalledPackage;
 import org.tizen.nativeplatform.pkgmgr.model.InstalledPkgProvider;
 import org.tizen.nativeplatform.pkgmgr.model.Package;
-import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
 import org.tizen.nativeplatform.pkgmgr.model.RemotePackage;
 import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
 
@@ -58,20 +49,15 @@ public class RemoveInstalledPackageDialog extends Dialog {
        private Button checkNoDeps_bt;
        private int selectedColumn = 0;
        private Display disp = null;
-       private String options = "";
        
        private int x = 0;
        private int y = 0;
        private final int width = 800;
        private final int height = 800; 
        
-       //private String targetId;
-       private String rootstrapPath;
-       
        private final String BUNDLE_NAME = RemoveInstalledPackageDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
        private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
        
-       private final String NODEP_OPTIONS = "--nodeps";
 
        protected RemoveInstalledPackageDialog(Shell parentShell, String path) {                
                super(parentShell);
@@ -81,7 +67,6 @@ public class RemoveInstalledPackageDialog extends Dialog {
         y = bounds.y + (bounds.height - height)/2;
         this.disp = parentShell.getDisplay();
         //this.targetId = targetId;
-        this.rootstrapPath = path;
        }       
        
        @Override
@@ -232,10 +217,6 @@ public class RemoveInstalledPackageDialog extends Dialog {
                                return;
                        }
 
-                               if (checkNoDeps_bt.getSelection()) {
-                                       options = NODEP_OPTIONS;
-                               }
-                               
                        ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
 
                        try {
@@ -253,7 +234,7 @@ public class RemoveInstalledPackageDialog extends Dialog {
                                                monitor.beginTask(resources.getString("UninstallPkg.Message.Uninstalling.Package") + 
                                                                "   " + list, -1);                      
 
-                                                       RPMPackageCommander.UninstallPkgFromRootstrap(list, options, rootstrapPath);
+                                                       //RPMPackageCommander.uninstallPkgFromRootstrap(list, rootstrapPath);
                                                        
                                                DialogUtil.openMessageDialog(getShell(), 
                                                                resources.getString("UninstallPkg.Uninstall.Success.Title"), 
index 5d565e8..e1457f7 100644 (file)
@@ -92,7 +92,19 @@ public class RootstrapManager {
 
                return rootstrap;
        }
+
        
+       public static void modifyRootstrap(PlatformRootstrap rootstrap) {
+               generateSBIPluginXML(rootstrap.getId(), rootstrap.getName(),
+                               rootstrap.getArch(), rootstrap.getRepositoryURLs() );
+               try {
+                       SBIModel.reinitialize();
+               } catch (SBIException e) {
+                       // nothing to do
+               }
+               RootstrapManager.notifyChangedRootstrap();
+       }
+
        
        public static boolean removeRootstrap(String id) {
                PlatformRootstrap rootstrap = getRootstrap( id );
index ece202d..8cb26d9 100644 (file)
@@ -45,7 +45,28 @@ public class PlatformRootstrap extends Rootstrap implements ICheckTreeItem {
        public ArrayList<String> getRepositoryURLs() {
                return reposURLs;
        }
+       
+       public void addRepositoryURL( String url ) {
+               reposURLs.add( url );
+       }
 
+       public void changeRepositoryURL( String fromURL, String toURL ) {
+               for( int i = 0; i < reposURLs.size(); i++ ) {
+                       String url = reposURLs.get(i);
+                       if ( url.equals(fromURL) ) {
+                               reposURLs.set(i, toURL);
+                               return;
+                       }
+               }
+               return;
+       }
+       
+       
+       public void removeRepositoryURL( String url ) {
+               reposURLs.remove(url);
+       }
+       
+       
        @Override
        public boolean isGrayed() {
                return false;
index 72f4aac..13f42aa 100644 (file)
@@ -49,6 +49,8 @@ Action.Msg.Info.NotInit = This rootstrap is not initialize.
 Action.Msg.Progress.Importing = Importing rootstrap...
 Action.Msg.Info.ImportOK = Importing rootstrap is successful!
 Action.Msg.Error.ImportFailed = Importing rootstrap failed!
+Action.Msg.Progress.Initializing.PkgMgr = Initializing Package Manager...
+Action.Msg.Error.InitFailed.PkgMgr =  Initializing Package Manager failed!
 
 FileDlg.Title.Export = Export rootstrap
 FileDlg.Title.Import = Import rootstrap
\ No newline at end of file
index 1302108..b555b20 100644 (file)
@@ -503,11 +503,11 @@ public class RootstrapView extends ViewPart {
         String[] extensions = {"*.tar"};
         fd.setFilterExtensions(extensions);
         String resultFilePath = fd.open();
-        if ( !resultFilePath.endsWith(".tar")) {
-               resultFilePath += ".tar";
-        }
-        final String selectedFilePath =  resultFilePath;
-        if (selectedFilePath != null) {
+        if (resultFilePath != null) {
+            if ( !resultFilePath.endsWith(".tar")) {
+               resultFilePath += ".tar";
+            }
+            final String selectedFilePath =  resultFilePath;
                // generate rootstrap here
                ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
                try {
@@ -601,8 +601,29 @@ public class RootstrapView extends ViewPart {
                        DialogUtil.openMessageDialog(resources.getString("Action.Msg.Info.NotInit"));
                        return;
                }
-               RPMPackageDialog dlg = new RPMPackageDialog(shell, selected);
+               final RPMPackageDialog dlg = new RPMPackageDialog(shell, selected);
+               
+                       ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+                       try {
+                               dialog.run(true, false, new IRunnableWithProgress() {
+                                       @Override
+                                       public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                               
+                                               monitor.beginTask(resources.getString("Action.Msg.Progress.Initializing.PkgMgr"), -1);
+                                               dlg.initializeDialogData();
+                                       }
+                               });                                     
+                       } catch (Exception e1) {
+                       DialogUtil.openErrorDialog(
+                                       String.format("%s\n * %s", resources.getString("Action.Msg.Error.InitFailed.PkgMgr"),
+                                                       e1.getMessage() ) );
+                       return;
+                       }
+
                dlg.open();
+               
+                RootstrapManager.modifyRootstrap( selected );
             }
 
             @Override
index 11c144d..225e7da 100644 (file)
@@ -36,7 +36,6 @@ public class SelectRootstrapMappingDialog extends Dialog {
        private int y = 0;
        private final int width = 400;
        private final int height = 400;
-       private Shell shell;
        
        private final String BUNDLE_NAME = AddRootstrapDialog.class.getPackage().getName() + ".RootstrapUIMessages";//$NON-NLS-1$
        private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
@@ -45,7 +44,6 @@ public class SelectRootstrapMappingDialog extends Dialog {
                        HashMap<Integer, HashMap<IProject, IConfiguration>> projectMap, 
                        ArrayList<PlatformRootstrap> rootstrapList) {
                super(parentShell);             
-               this.shell = parentShell;
                this.projectMap = projectMap;           
                this.rootName = rootName;
                this.rootstrapList = rootstrapList;