[Title] Supported RPM Package manager
authordonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 3 Apr 2012 16:39:11 +0000 (01:39 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 3 Apr 2012 16:39:11 +0000 (01:39 +0900)
[Type] Enhancement

Change-Id: Ifd64d47d35f67831da834313089a3114ce1d80df

23 files changed:
org.tizen.nativeplatform/plugin.xml
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/DEBPackageManager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManagerRootstrapHandler.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/RPMPackageCommander.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/RPMPackageManager.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerOuputReceiver.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerRootstrapHandler.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommander.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommands.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPackage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPkgProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Package.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/PackageProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePackage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePkgProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Repository.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RepositoryProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRemotePackageDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRepoDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildSystemTab.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PkgMgrUIMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java [new file with mode: 0644]

index 085daa0..f26a61c 100644 (file)
@@ -58,7 +58,7 @@
         point="org.eclipse.ui.handlers">
         <handler
             commandId="org.tizen.nativeplatform.pkgInstall.commandid.rootstrapmgr"
-            class="org.tizen.nativeplatform.pkgInstall.PackageManagerRootstrapHandler">
+            class="org.tizen.nativeplatform.pkgmgr.PackageManagerRootstrapHandler">
         </handler>
     </extension>
 
index e56d33d..ec3784d 100644 (file)
@@ -195,8 +195,7 @@ public class DEBPackageManager extends Dialog {
                public void mouseUp(MouseEvent e) {
                }
                
-       };
-       
+       };      
        
        protected DEBPackageManager(Shell parentShell, String target) {
                super(parentShell);
@@ -206,7 +205,7 @@ public class DEBPackageManager extends Dialog {
                this.device = ConnectionPlugin.getDefault().getCurrentDevice(); 
        }
        
-       protected DEBPackageManager(Shell parentShell, String target, boolean enableRootstrap, boolean enableTarget) {
+       public DEBPackageManager(Shell parentShell, String target, boolean enableRootstrap, boolean enableTarget) {
                super(parentShell);
                setBlockOnOpen(false);
                this.enableRootstrapTab = enableRootstrap;
index 0e6f445..dd7d3b1 100644 (file)
@@ -67,9 +67,7 @@ public class PackageManagerRootstrapHandler extends AbstractHandler {
                IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();              
                String target = null;
                boolean enableRootstrap = true;
-               boolean enableTarget = true;            
-               
-               boolean enableRpmMgr = false;
+               boolean enableTarget = true;
 
                if (device == null) {
                        enableTarget = false;
@@ -84,11 +82,7 @@ public class PackageManagerRootstrapHandler extends AbstractHandler {
                if (project == null) {                  
                        enableRootstrap = false;                        
                } else {                
-                       IConfiguration cfg =ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
-                       String targetName = PlatformConfigurationManager.getBuildTargetName(cfg);
-                       if (targetName.contains("obs")) {
-                               enableRpmMgr = true;
-                       }
+                       IConfiguration cfg =ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();                                              
                        IManagedProject managedProject = cfg.getManagedProject();
                        String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId();
                        if (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE) &&
@@ -97,13 +91,8 @@ public class PackageManagerRootstrapHandler extends AbstractHandler {
                        }
                }                       
 
-               if (enableRpmMgr) {
-                       RPMPackageManager pkgdlg = new RPMPackageManager(window.getShell(), target, enableRootstrap, enableTarget);
-                       pkgdlg.open();
-               } else {
-                       DEBPackageManager pkgdlg = new DEBPackageManager(window.getShell(), target, enableRootstrap, enableTarget);
-                       pkgdlg.open();
-               }
+               DEBPackageManager pkgdlg = new DEBPackageManager(window.getShell(), target, enableRootstrap, enableTarget);
+               pkgdlg.open();          
                
                return null;
        }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/RPMPackageCommander.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/RPMPackageCommander.java
deleted file mode 100644 (file)
index ace89fd..0000000
+++ /dev/null
@@ -1,699 +0,0 @@
-/*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
-package org.tizen.nativeplatform.pkgInstall;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-
-import org.tizen.common.util.HostUtil;
-
-import org.tizen.nativecommon.build.SmartBuildInterface;
-import org.tizen.nativecommon.build.exception.SBIException;
-import org.tizen.sdblib.IDevice;
-
-public class RPMPackageCommander {
-
-       private final static SmartBuildInterface sbi = SmartBuildInterface.getInstance();
-       private final static int MAX_TIMEOUT = 60000;
-       private final static int VERIFY_SSHCONN_TIMEOUT = 30000;
-       private final static String SUDO_COMMAND = "sudo -S";
-       
-       public RPMPackageCommander() {          
-       }       
-
-       public static String getCurrentSourceListForRootstrap(String targetID) throws SBIException {
-               
-               String result = "";     
-               
-               try {
-                       result = sbi.actionStdOut("command", 
-                                       String.format("-mode=emulate -cmd=\'cat /etc/apt/sources.list\' -path=." ),
-                                       targetID, null );
-               } catch (SBIException e) {
-                       e.printStackTrace();
-               }               
-               
-               return result.trim();
-       }
-       
-       public static String getCurrentSourceListForRealTarget(IDevice device, PackageManagerOuputReceiver rec) {
-               String command = "cat /etc/apt/sources.list";
-               String result = "";
-               
-               if (device != null) {
-                       try {
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                               for (String line : rec.getLog()) {
-                                       result = result + line + "\n";
-                               }
-
-                       } catch (Exception e) {
-                               e.printStackTrace();
-                       }
-                                               
-                       if (device.isEmulator()) {                      
-                               String[] splitResult = result.split("\n");
-                               if (splitResult.length > 1) {
-                                       result = splitResult[1];
-                               } else if (splitResult.length == 1){
-                                       result = splitResult[0];
-                               } 
-                       }
-                       
-               }
-               
-               return result.trim();
-       }
-       
-       public static void changeSourceListForRealTarget(String sourceList, IDevice device) {
-               String command = String.format("echo \"%s\" > /etc/apt/sources.list", sourceList);
-               
-               if (device != null) {
-                       try {
-                               device.executeShellCommand(command);
-                       } catch (Exception e) {
-                               // TODO Auto-generated catch block
-                               e.printStackTrace();
-                       }
-               }
-       }
-       
-       public static void changeSourceListForRootstrap(String targetID, String sourceList) {
-               if (targetID == null) {
-                       return;
-               }
-               
-               try {
-                       String rootstrapPath = sbi.getRootstrapPath(targetID);
-                       String sourcesListFile = rootstrapPath + "/etc/apt/sources.list";
-       
-       /** "echo" command is not used on shell.execute() **/ 
-       // String command = String.format("/bin/echo \"%s\" > %s/etc/apt/sources.list", sourceList, rootstrapPath);
-       
-       
-               File file = new File(sourcesListFile);
-               FileWriter writer = new FileWriter(file);
-               writer.write(sourceList);
-               writer.close();
-               } catch(SBIException e) {
-               e.printStackTrace();            
-       } catch(Exception e1) {
-               e1.printStackTrace();
-       }
-       }
-       
-       public static void resolveDpkgInterruptForRootstrap(String targetID, 
-                       OutputStream stdoutStream, OutputStream stderrStream) {
-               if (targetID == null) {
-                       return;
-               }
-               
-               String command = "dpkg --configure -a";
-               
-               try {
-                       sbi.actionStdOut("command", 
-                                       String.format("-mode=emulate -cmd=\'%s\' -path=.", command ),
-                                       targetID, null );
-               } catch (SBIException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }               
-       }
-       
-       public static void aptGetUpdateForRootstrap(String targetID, 
-                       OutputStream stdoutStream, OutputStream stderrStream) {
-               if (targetID == null) {
-                       return;
-               }
-               
-               String command = "apt-get update";
-       
-               try {
-                       sbi.actionStream("command", 
-                                       String.format("-mode=emulate -cmd=\'%s\' -path=.", command ),
-                                       targetID, null, stdoutStream, stderrStream );
-               } catch (SBIException e) {
-                       // TODO Auto-generated catch block
-                       e.setMessage("Failed to update. please check console view.");
-                       e.printStackTrace();
-                       e.showErrorDialog();
-               }       
-       }
-       
-       public static boolean verifySshConnectionForRootstrap(String targetID, String remoteAddr) {             
-               String command = "ssh -oStrictHostKeyChecking=no " + remoteAddr + " exit";
-               int result = 0;
-               
-               if (targetID == null) {
-                       return false;
-               }       
-       
-               try {
-                       result = sbi.actionReturnExitValue("command", 
-                                       String.format("-mode=emulate -cmd=\'%s\' -path=.", command ),
-                                       targetID, null );
-               } catch (SBIException e) {
-                       // TODO Auto-generated catch block
-                       e.setMessage(String.format("Failed to execute \"%s\"", command));
-                       e.printStackTrace();
-                       e.showErrorDialog();
-               }
-               
-               if (result != 0) {
-                       SBIException e = new SBIException(
-                                       String.format("Failed to connect \"%s\".", remoteAddr));
-                       e.showErrorDialog();
-                       return false;
-               } 
-               return true;
-       }
-       
-       public static void aptGetUpgradeForRootstrap(String targetID,
-                       OutputStream stdoutStream, OutputStream stderrStream) {
-               
-               if (targetID == null) {
-                       return;
-               }
-               
-               String command = "apt-get -y dist-upgrade";             
-               try {
-                       sbi.actionStream("command", 
-                                       String.format("-mode=emulate -cmd=\'%s\' -path=.", command ),
-                                       targetID, null, stdoutStream, stderrStream );
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }               
-       }
-       
-       
-       public static void aptGetInstallForRootstrap(String targetID, String pkgList,
-                       OutputStream stdoutStream, OutputStream stderrStream) {
-               if (targetID == null) {
-                       return;
-               }
-               
-               String command = String.format("apt-get -y install %s", pkgList);
-               try {
-                       sbi.actionStream("command", 
-                                       String.format("-mode=emulate -cmd=\'%s\' -path=.", command ),
-                                       targetID, null, stdoutStream, stderrStream );
-               } catch (SBIException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
-       }
-       
-       
-       public static void aptGetInstallForTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {
-               String command = String.format("apt-get -y install %s", pkgName);               
-               
-               if (device != null) {
-                       try {
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                       } catch (Exception e) {
-                               // TODO Auto-generated catch block
-                               e.printStackTrace();
-                       }
-               }               
-       }
-       
-       
-       public static void InstallPkgToRootstrap(String targetID, String fileList,
-                       OutputStream stdoutStream, OutputStream stderrStream) {         
-
-               String intallOption = String.format("rpm -ihv %s --ignoreos", fileList);
-               String options = String.format("-path=. -cmd=\"%s\"", intallOption);
-               
-               try {                   
-                       sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
-               } catch (SBIException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }               
-       }
-       
-       public static void aptGetUpdateForRealTarget(IDevice device, PackageManagerOuputReceiver rec) {
-               String command = "apt-get update";
-               
-               if (device != null) {
-                       try {
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);                          
-                       } catch (Exception e) {
-                               // TODO Auto-generated catch block
-                               e.printStackTrace();
-                       }
-               }
-       }
-       
-       public static void fixBrokenForRootstrap(String targetID, OutputStream stdoutStream, OutputStream stderrStream) {
-               
-               if (targetID == null) {
-                       return ;
-               }
-               
-               String command = "apt-get -f -y install";
-               try {
-                       sbi.actionStream("command", 
-                                       String.format("-mode=emulate -cmd=\'%s\' -path=.", command ),
-                                       targetID, null, stdoutStream, stderrStream );
-               } catch (SBIException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
-       }
-       
-       public static void fixBrokenForRealTarget(IDevice device, PackageManagerOuputReceiver rec) {
-               String command = "apt-get -f -y install";
-               
-               if (device != null) {
-                       try {
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);                          
-                       } catch (Exception e) {
-                               // TODO Auto-generated catch block
-                               e.printStackTrace();
-                       }
-               }
-       }       
-
-       public static boolean verifySshConnectionForRealTarget(IDevice device, String remoteAddr, PackageManagerOuputReceiver rec) {            
-               String command = "ssh -oStrictHostKeyChecking=no " + remoteAddr + " exit; echo $?";             
-               String log = "";
-               
-               if (device != null) {
-                       try {
-                               device.executeShellCommand(command, rec, VERIFY_SSHCONN_TIMEOUT);
-                               String[] logs = rec.getLog();
-                               log = logs[0];                          
-                       } catch (Exception e) {
-                               // TODO Auto-generated catch block
-                               e.printStackTrace();
-                       }
-               }       
-               
-               if (log.equals("0")) {
-                       return true;
-               } else {
-                       SBIException e = new SBIException(
-                                       String.format("Failed to connect \"%s\".", remoteAddr));
-                       e.showErrorDialog();
-                       return false;
-               }
-       }
-       
-       
-       public static void aptGetUpgradeForRealTarget(IDevice device, PackageManagerOuputReceiver rec) {
-               String command = "apt-get -y dist-upgrade";             
-               
-               if (device != null) {
-                       try {
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                       } catch (Exception e) {
-                               // TODO Auto-generated catch block
-                               e.printStackTrace();
-                       }
-               }
-       }
-       
-       public static String getArchForFile(String FilePath) {
-               String retStr = "";
-
-               String command = String.format("rpm -qip %s | grep \"Architecture: \"", FilePath);
-               String result = HostUtil.returnExecute(command);
-               
-               if (!result.contains("Architecture: ")) {
-                       return retStr;
-               }               
-               
-               String[] splitResult = result.split(":");
-               
-               if (splitResult.length < 2 ) {
-                       return retStr;
-               }
-               
-               retStr = splitResult[1].trim();
-               
-               return retStr;
-       }
-       
-       public static String getArchOfRemotePkgForRootstrap(String pkgName, String targetID) {
-               String retStr = "";
-               if (targetID == null) {
-                       return "";
-               }
-               
-               if (!existPkgOnRemoteForRootstrap(pkgName, targetID)) {
-                       return retStr;
-               }
-                               
-               try {
-                       String command = String.format("apt-cache show %s | grep \"Architecture: \"", pkgName);
-                       String result = sbi.actionStdOut("command", 
-                                       String.format("-mode=emulate -cmd=\'%s\' -path=.", command ),
-                                       targetID, null );
-                       
-                       if (!result.contains("Architecture: ")) {
-                               return retStr;
-                       }               
-                       
-                       result = result.split("\n")[0];
-                       String[] splitResult = result.split(":");
-                       
-                       if (splitResult.length < 2 ) {
-                               return retStr;
-                       }
-                       
-                       retStr = splitResult[1].trim();
-                       
-               } catch (SBIException e) {
-               }               
-               
-               return retStr;
-       }
-       private static String getValue(String header, String key) {
-               int s_pos = 0;
-               int e_pos = 0;
-               String ret = null;
-               s_pos = header.indexOf(key);
-               if (s_pos == -1)
-                       return "";
-               e_pos = header.indexOf("\n",s_pos);
-               if (e_pos == -1) {
-                       ret = header.substring(s_pos+key.length());
-               } else {
-                       ret = header.substring(s_pos+key.length(), e_pos).trim();
-               }
-               return ret;
-       }
-       public static String getArchOfRemotePkgForRealTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {
-               String retStr = "";
-               String archKey = "Architecture: ";
-               if (device != null) {
-                       if (!existPkgOnRemoteForRealTarget(pkgName, device, rec)) {
-                               return retStr;
-                       }
-                       
-                       try {
-                               String result = "";
-                               String command = String.format("apt-cache show %s | grep \"Architecture: \"", pkgName);
-                               rec.cleanLog();
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                               for(String line : rec.getLog()) {
-                                       result = result + line + "\n";
-                               }               
-                       
-                               retStr = getValue(result,archKey);
-                       } catch (Exception e) {
-                               e.printStackTrace();
-                       }
-               }
-               
-               return retStr;
-       }
-       
-       
-       public static String getPkgNameForFile(String filePath) {
-               String retStr = "";
-
-               String command = String.format("rpm -qip %s | grep \"Name \"", filePath);
-               String result = HostUtil.returnExecute(command);
-               
-               if (!result.contains("Name ")) {
-                       return retStr;
-               }               
-               
-               String[] splitResult = result.split(":");
-               
-               if (splitResult.length < 2 ) {
-                       return retStr;
-               }
-               
-               retStr = splitResult[1].trim();
-               
-               return retStr;
-       }
-       
-       public static String getPkgVerForFile(String filePath) {
-               String retStr = "";
-
-               String command = String.format("rpm -qip %s | grep \"Version \"", filePath);
-               String result = HostUtil.returnExecute(command);
-               
-               if (!result.contains("Version ")) {
-                       return retStr;
-               }
-               
-               String[] splitResult = result.split(":");
-               
-               if (splitResult.length < 2 ) {
-                       return retStr;
-               }
-               
-               retStr = splitResult[1].trim();
-               
-               return retStr;
-       }
-       
-       public static String getPkgNewVerForRootstrap(String pkgName, String targetID) {
-               String retStr = "";
-               if (targetID == null) {
-                       return "";
-               }
-               
-               if (!existPkgOnRemoteForRootstrap(pkgName, targetID)) {
-                       return retStr;
-               }
-
-               try {
-                       String command = String.format("apt-cache showpkg %s | grep -A 1 \"Versions:\"", pkgName);
-                       String result = sbi.actionStdOut("command", 
-                                       String.format("-mode=emulate -cmd=\'%s\' -path=.", command ),
-                                       targetID, null );
-                       
-                       if (!result.contains("Versions:")) {
-                               return retStr;
-                       }
-                       
-                       String[] splitResult = result.split("\n");
-                       
-                       if (splitResult.length < 2 ) {
-                               return retStr;
-                       }                       
-
-                       retStr = splitResult[1].split(" ")[0];
-               } catch (SBIException e) {
-                       e.printStackTrace();
-               }
-               return retStr;
-       }
-       
-       public static String getPkgNewVerForRealTarget(String pkgName,  IDevice device, PackageManagerOuputReceiver rec) {
-               String retStr = "";             
-
-               if (device != null) {
-                       if (!existPkgOnRemoteForRealTarget(pkgName, device, rec)) {
-                               return retStr;
-                       }
-                       
-                       try {                   
-                               String result = "";
-                               String command = String.format("apt-cache showpkg %s | grep -A 1 \"Versions:\"", pkgName);
-                               rec.cleanLog();
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                               
-                               for (String line : rec.getLog()) {
-                                       result = result + line + "\n";
-                               }
-
-                               if (!result.contains("Versions:")) {
-                                       return retStr;
-                               }
-                               
-                               String[] splitResult = result.split("\n");
-                               
-                               if (splitResult.length < 2 ) {
-                                       return retStr;
-                               }
-                               
-                               retStr = splitResult[1].split(" ")[0];                          
-                               
-                       } catch (Exception e1) {
-                               e1.printStackTrace();
-                       }
-               }
-               
-               return retStr;
-       }
-       
-       
-       public static String getPkgInstalledVerForRootstrap(String pkgName, String targetID) {
-               String retStr = "";
-                               
-               if (!pkgInstalledSuccessfullyForRootstrap(pkgName, targetID)) {
-                       return retStr;
-               }       
-               
-               String result = null;
-               
-               String queryOption = String.format("rpm -qi %s", pkgName);
-               String options = String.format("-path=. -cmd=\"%s\"", queryOption);
-               
-               try {                   
-                       result = sbi.actionStdOut("command", options, targetID, null);
-               } catch (SBIException e) {
-                       e.printStackTrace();
-               }       
-               
-               String[] splitResult = result.split("\n");
-               for (String r : splitResult) {
-                       if (r.trim().startsWith("Version ")) {
-                               retStr = r.split(":")[1].trim();
-                               break;
-                       }
-               }                               
-               
-               return retStr;
-       }
-       
-       public static String getPkgInstalledVerForRealTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {         
-               
-               String retStr = "";
-               if (device != null) {
-                       if (!pkgInstalledSuccessfullyForRealTarget(pkgName, device, rec)) {
-                               return retStr;
-                       }
-                       
-                       try {                           
-                               String result = "";
-                               String command = String.format("rpm -qi %s", pkgName);
-                               rec.cleanLog();
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                               for (String l : rec.getLog()) {
-                                       if (l.trim().startsWith("Version ")) {
-                                               retStr = l.split(":")[1].trim();
-                                               break;
-                                       }
-                               }                                                       
-                               
-                       } catch (Exception e1) {
-                               e1.printStackTrace();
-                       }
-               }
-               
-               return retStr;
-       }
-       
-       public static boolean pkgInstalledSuccessfullyForRootstrap(String pkgName, String targetID) {
-               boolean ret = false;    
-               String result = null;
-               
-               String queryOption = String.format("rpm -qa %s", pkgName);
-               String options = String.format("-path=. -cmd=\"%s\"", queryOption);
-               
-               try {                   
-                       result = sbi.actionStdOut("command", options, targetID, null);
-               } catch (SBIException e) {
-                       e.printStackTrace();
-               }                               
-               
-               if (!result.isEmpty() && result.contains(pkgName)) {
-                       ret = true;
-               }
-                               
-               return ret;
-       }
-       
-       public static boolean pkgInstalledSuccessfullyForRealTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {          
-               boolean ret = false;
-               if (device != null) {
-                       try {
-                               String command = String.format("rpm -qa %s", pkgName);
-                               device.executeShellCommand(command, rec, MAX_TIMEOUT);                          
-                       } catch (Exception e1) {
-                               e1.printStackTrace();
-                       }
-               }
-               
-               if (rec.getLog() == null) {
-                       return false;
-               }
-               
-               for (String l : rec.getLog()) {
-                       if (l.contains(pkgName)) {
-                               ret = true;
-                       }
-               }                       
-               
-               return ret;     
-       }
-       
-       public static boolean existPkgOnRemoteForRootstrap(String pkgName, String targetID) {
-               boolean bRet = false;
-               try {
-                       String command = String.format("apt-cache search ^%s$", pkgName);
-                       String result = sbi.actionStdOut("command", 
-                                       String.format("-mode=emulate -cmd=\'%s\' -path=.", command),
-                                       targetID, null);
-                       
-                       for (String line : result.split("\n")) {
-                               String l = line.split(" - ")[0];
-                               if (l.equals(pkgName)) {
-                                       bRet = true;
-                               }
-                       }
-               } catch (SBIException e) { 
-               }
-               
-               return bRet;
-       }
-       
-       public static boolean existPkgOnRemoteForRealTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {
-               boolean bRet = false;
-               try {
-                       String command = String.format("apt-cache search ^%s$", pkgName);
-                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
-                       
-                       for (String line : rec.getLog()) {
-                               String l = line.split(" - ")[0];
-                               if (l.equals(pkgName)) {
-                                       bRet = true;
-                               }
-                       }
-               } catch (Exception e) {                 
-               }
-               
-               return bRet;
-       }
-       
-}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/RPMPackageManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/RPMPackageManager.java
deleted file mode 100644 (file)
index b4269a2..0000000
+++ /dev/null
@@ -1,1566 +0,0 @@
-/*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
-package org.tizen.nativeplatform.pkgInstall;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-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.ColumnLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.swt.SWT;
-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.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-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.eclipse.ui.console.MessageConsoleStream;
-
-import org.osgi.framework.Bundle;
-import org.tizen.common.connection.ConnectionPlugin;
-import org.tizen.common.console.ConsoleManager;
-
-
-import org.tizen.nativecommon.build.CheckCancelJob;
-import org.tizen.nativecommon.build.CurrentEnabledProject;
-import org.tizen.nativecommon.build.SmartBuildInterface;
-import org.tizen.nativecommon.build.exception.SBIException;
-import org.tizen.nativeplatform.Activator;
-import org.tizen.nativeplatform.build.PlatformConfigurationManager;
-import org.tizen.sdblib.IDevice;
-import org.tizen.sdblib.SyncService;
-import org.tizen.sdblib.SyncService.SyncResult;
-
-
-public class RPMPackageManager extends Dialog {
-       
-       private TableViewer viewerForRootstrap = null;  
-       private TableViewer viewerForTarget = null;
-       private static TableViewer currentViewer;
-       private static String CURRENT_TAB_NAME;
-       
-       private static Table tableForRootstrap = null;
-       private static Table tableForTarget = null;
-       
-       private Button addButtonFromFile;       
-       private Button addButtonFromRemote;
-       private Button installButton;
-       private Button removeButton;
-       private Button upgradeButton;
-       private Button updateButton;
-       private Button fixBrokenButton;
-       
-       private Text repositoryText;
-       private Text packageListText;
-       
-       private static String ROOTSTRAP_TAB_NAME = "Build System";
-       private static String TARGET_TAB_NAME = "Device";
-       private static String TMP_PATH= "/tmp";
-       private static String RPM_COMMAND_INSTALL = "rpm -ihv"; 
-       private static String RPM_COMMAND_UPDATEMODE = "/bin/change-booting-mode.sh --update";  
-       
-       public Shell shell;
-       
-       public String target = null;
-       private String addPkgListForRemote;
-       private String repositoryForRemote;
-       private static String previousFilterPath = null;
-       private String selectedFileList;
-       private String configuration;   
-       
-       private IDevice device;
-       private Display display = null; 
-       private FileDialog fd;
-       private TabFolder tabFolder;
-       private CopyOnWriteArrayList<Package> pkgs = null;
-       
-       private boolean enableRootstrapTab = true;
-       private boolean enableTargetTab = true;
-       
-       private final int MAX_TIMEOUT = 60000;
-       
-       private SmartBuildInterface sbi = SmartBuildInterface.getInstance(); 
-
-       private int tabIndex = 0;
-       
-       private MouseListener removeListener = new MouseListener()
-       {
-
-               @Override
-               public void mouseDoubleClick(MouseEvent e) {
-               }
-
-               @Override
-               public void mouseDown(MouseEvent e) {
-                               CopyOnWriteArrayList<Package> pkgList = PkgModelProvider.INSTANCE.getPkgs();
-                               for( Package pkg: pkgList)
-                               {
-                                       boolean selected = false;
-                                       if (CURRENT_TAB_NAME.equals(ROOTSTRAP_TAB_NAME)) {
-                                               selected = pkg.getCheckColumn1();
-                                       } else if (CURRENT_TAB_NAME.equals(TARGET_TAB_NAME)) {
-                                               selected = pkg.getCheckColumn2();
-                                       }
-                                       if (selected) {
-                                               pkgList.remove(pkg);
-                                       }
-                               }
-                               if (viewerForRootstrap != null) {
-                                       viewerForRootstrap.refresh();
-                               } 
-                               if (viewerForTarget != null) {
-                                       viewerForTarget.refresh();
-                               }
-                               
-                               int recentTableIndex = currentViewer.getTable().getItemCount();
-                               
-                               for (int i = 0; i < recentTableIndex; i++) {
-                                       TableItem item1 = null;
-                                       TableItem item2 = null;;
-                                       
-                                       if (viewerForRootstrap != null) {
-                                               item1 = viewerForRootstrap.getTable().getItem(i);
-                                               Package pkg = (Package)item1.getData();
-                                               item1.setChecked(pkg.getCheckColumn1());
-                                       }
-                                       if (viewerForTarget != null) {
-                                               item2 = viewerForTarget.getTable().getItem(i);
-                                               Package pkg = (Package)item2.getData();
-                                               item2.setChecked(pkg.getCheckColumn2());
-                                       }
-                               }
-               }
-
-               @Override
-               public void mouseUp(MouseEvent e) {
-               }
-               
-       };
-       
-       
-       protected RPMPackageManager(Shell parentShell, String target) {
-               super(parentShell);
-               setBlockOnOpen(false);
-               this.display = parentShell.getDisplay();
-               this.target = target;
-               this.device = ConnectionPlugin.getDefault().getCurrentDevice(); 
-       }
-       
-       protected RPMPackageManager(Shell parentShell, String target, boolean enableRootstrap, boolean enableTarget) {
-               super(parentShell);
-               setBlockOnOpen(false);
-               this.enableRootstrapTab = enableRootstrap;
-               this.enableTargetTab = enableTarget;
-               this.display = parentShell.getDisplay();        
-               
-               if (enableRootstrap) {
-                       IProject _project = CurrentEnabledProject.getCurrentProject();
-                       IConfiguration config = ManagedBuildManager.getBuildInfo( _project ).getDefaultConfiguration();
-                       this.configuration = config.getName();
-               }
-               if (enableTarget) {
-                       this.target = target;
-                       this.device = ConnectionPlugin.getDefault().getCurrentDevice();
-               }
-       }       
-       
-       protected RPMPackageManager(Shell parentShell, String target, int tabIndex) {
-               super(parentShell);
-               setBlockOnOpen(false);
-               this.display = parentShell.getDisplay();
-               this.target = target;
-               this.device = ConnectionPlugin.getDefault().getCurrentDevice();
-               this.tabIndex = tabIndex;
-       }
-       
-       private void setImage(Shell parentShell) {
-               try {
-                       Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
-                       parentShell.setImage(new Image(Display.getCurrent(), FileLocator.toFileURL(bundle.getEntry("icons/package_installer.gif")).getPath()));
-               } catch (Exception e) {
-               }
-       }
-       
-       protected void setShellStyle(int newShellStyle) {
-               int newStyle = newShellStyle & ~SWT.APPLICATION_MODAL;
-               newStyle |= SWT.MODELESS;
-               super.setShellStyle(newStyle);
-       }
-
-       @Override
-       public boolean close()
-       {
-               PkgModelProvider.INSTANCE.getPkgs().clear();
-               return super.close();
-       }
-       
-       protected void createButtonsForButtonBar(Composite parent) 
-       {
-               createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
-       }
-
-       
-       @Override
-       protected void configureShell(Shell newShell) {
-               super.configureShell(newShell);
-               newShell.setText("Package Manager");
-               newShell.setLocation(100, 100);
-               newShell.setSize(960, 600);
-               setImage(newShell);
-       }
-       
-       @Override
-       protected Control createDialogArea(Composite parent) {
-               
-               
-               Composite composite = new Composite( parent, SWT.None );
-               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-               composite.setLayout(new GridLayout(1, false));
-
-               if (!enableRootstrapTab && !enableTargetTab) {
-                       createError( composite, "- Any project is not selected and any connection is not connected,\n" +
-                                       "- or project is not \"PLATFORM PROJECT\"." );
-               } else {                
-                       //2nd basement : Sourcelist + update button
-                       createTopComposite( composite );
-                       //3rd basement : Package text + +, - button
-                       createMiddleComposite( composite );
-                       //5th basement : tab (upgrade/install button + table)
-                       createBottomComposite( composite );
-               }
-                               
-               return null;
-       }
-               
-       
-       private void createError( Composite parent, String message )
-       {
-               Composite com = new Composite( parent, SWT.NONE );
-               com.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-               com.setLayout(new GridLayout(1, false));
-               
-               Label errorLabel = new Label(com, SWT.NONE);
-               errorLabel.setText(message);
-       }
-       
-       private void createTopComposite( Composite parent )
-       {       
-               Composite com = new Composite( parent, SWT.NONE );
-               com.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-               com.setLayout(new GridLayout(3, false));
-               
-           Label searchLabel = new Label( com, SWT.NONE );
-        searchLabel.setText("Source List : ");        
-
-        repositoryText = new Text(com, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
-
-        GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
-        gridData.widthHint = 500;
-        repositoryText.setLayoutData(gridData);        
-        
-        /*
-        if (enableRootstrapTab) {              
-               String targetID = getTargetID();
-            
-            try {
-                       repositoryText.setText(PackageCommander.getCurrentSourceListForRootstrap(targetID));
-               } catch (SBIException e1) {
-                       // TODO Auto-generated catch block
-                       e1.printStackTrace();
-               }               
-        } else if (enableTargetTab) {
-               //repositoryText.setText(PackageCommander.getCurrentSourceListForRealTarget(getSession()));             
-               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
-               rec.setPrintConsole(false);
-               repositoryText.setText(PackageCommander.getCurrentSourceListForRealTarget(device, rec));                                
-        } else {
-               repositoryText.setText("");
-        }
-        */
-
-        repositoryText.setText("");
-        repositoryText.setEnabled(false);
-        
-        updateButton = new Button( com, SWT.PUSH );
-        updateButton.setText("Update ");
-        updateButton.setEnabled(false);
-        /*
-        updateButton.addMouseListener(new MouseListener(){
-
-                       @Override
-                       public void mouseDoubleClick(MouseEvent e) {
-                       }
-
-                       @Override
-                       public void mouseDown(MouseEvent e) {
-                               repositoryForRemote = repositoryText.getText();
-                               
-                               if(repositoryForRemote.isEmpty()) {
-                                       MessageDialog.openError(shell, "Error", "Repository is empty.\nPlease set repository.");
-                                       return;
-                               }                               
-                               
-                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());           
-                               
-                               try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {
-                                                       monitor.beginTask("apt-get update", -1);                        
-                                                       
-                                                       CheckCancelJob cancelJob = new CheckCancelJob(monitor);
-                                                       Thread checkCancelThread = new Thread(cancelJob);
-                                                       checkCancelThread.start();
-                                                       
-                                                       ConsoleManager cm = new ConsoleManager( "Package Installer", true);
-                                                       cm.clear();
-                                                       MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
-                                                       MessageConsoleStream mcs = cm.getMessageConsoleStream(false);
-                                                       PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
-                                                       rec.setMessageConsoleStream(mcs);
-                                                       
-                                                       try {
-                                                               if (CURRENT_TAB_NAME.equals(ROOTSTRAP_TAB_NAME)) {
-                                                                       String targetID = getTargetID();
-                                                                       monitor.subTask("changing source list...");
-                                                                       PackageCommander.changeSourceListForRootstrap(targetID, repositoryForRemote);
-                                                                       
-                                                                       Thread.sleep(500);
-                                                                       
-                                                                       int s = repositoryForRemote.indexOf("ssh://");
-                                                                       if (s != -1) {                                                                          
-                                                                               String remoteAddr = repositoryForRemote.substring(s + 6);
-                                                                               int e = remoteAddr.indexOf("/");
-                                                                               
-                                                                               remoteAddr = remoteAddr.substring(0, e);
-                                                                               monitor.subTask(String.format("verifying connection %s", remoteAddr));
-                                                                               if (!PackageCommander.verifySshConnectionForRootstrap(targetID, remoteAddr)) {
-                                                                                       return;
-                                                                               }
-                                                                       }
-                                                                       
-                                                                       monitor.subTask("apt-get update...");
-                                                                       PackageCommander.aptGetUpdateForRootstrap(targetID, mcs, mcsError);
-                                                                       
-                                                               } else if(CURRENT_TAB_NAME.equals(TARGET_TAB_NAME)) {                                                                   
-                                                                       if (!device.isEmulator()) {                                                                             
-                                                                               // Change to bootmode with update
-                                                                               String command = DEB_COMMAND_UPDATEMODE;
-                                                                               device.executeShellCommand(command, rec, MAX_TIMEOUT);                                                                                  
-                                                                       }                                                                       
-                                                                                                                                               
-                                                                       monitor.subTask("changing source list...");
-                                                                       PackageCommander.changeSourceListForRealTarget(repositoryForRemote, device);                            
-                                                                       
-                                                                       Thread.sleep(500);
-                                                                       
-                                                                       if (!device.isEmulator()) {                                                                             
-                                                                               // Change to bootmode with update
-                                                                               String command = DEB_COMMAND_UPDATEMODE;
-                                                                               device.executeShellCommand(command, rec, MAX_TIMEOUT);                                                                                  
-                                                                       }
-                                                                       
-                                                                       int s = repositoryForRemote.indexOf("ssh://");
-                                                                       if (s != -1) {
-                                                                               String remoteAddr = repositoryForRemote.substring(s + 6);
-                                                                               int e = remoteAddr.indexOf("/");
-                                                                               
-                                                                               remoteAddr = remoteAddr.substring(0, e);
-                                                                               
-                                                                               if (!PackageCommander.verifySshConnectionForRealTarget(device, remoteAddr, rec)) {
-                                                                                       return;
-                                                                               }
-                                                                       }
-                                                                       
-                                                                       monitor.subTask("apt-get update...");
-                                                                       PackageCommander.aptGetUpdateForRealTarget(device, rec);
-                                                               }
-                                                               monitor.subTask("updating package informations...");                                            
-                                                               updatePkgInfoAfterAptUpdate();
-                                                                                                                       
-                                                       } catch (Exception e) {
-                                                               // TODO Auto-generated catch block
-                                                               e.printStackTrace();
-                                                       }
-                                                       
-                                                       checkCancelThread.interrupt();
-                                                       //monitor.worked(1);
-                                                       monitor.done();
-                                               }                                               
-                                       });
-                               } catch (Exception e1) {
-                                       e1.printStackTrace();                   
-                               }
-                               
-                               currentViewer.refresh();
-                       }
-
-                       @Override
-                       public void mouseUp(MouseEvent e) {
-                       }
-        
-        });
-        */
-               
-       }
-       private void createMiddleComposite( Composite parent )
-       {
-               Composite com = new Composite( parent, SWT.NONE );
-               com.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-               com.setLayout(new GridLayout(4, false));                
-               
-               Label targetLabel = new Label( com, SWT.NONE );
-               targetLabel.setText("Package Name: ");
-               
-               Listener AddPackageEventHandler = new Listener()
-               {               
-                       @Override
-                       public void handleEvent(Event event) {
-                               /*
-                               switch ( event.type )
-                               {                                               
-                                       case SWT.Traverse:
-                                               if( event.character == SWT.CR) {
-                                                       event.doit = false;
-                                               }
-                                               else {                                                  
-                                                       break;
-                                               }
-                                       case SWT.MouseDown:
-                                               
-                                               int oldTableIndex = currentViewer.getTable().getItemCount();
-                                               
-                                               addPkgListForRemote = packageListText.getText();
-                                               
-                                               if(addPkgListForRemote.isEmpty()) {
-                                                       MessageDialog.openError(shell, "Error", "Package name is empty.\nPlease input package name for installing");
-                                                       return;
-                                               } else if(addPkgListForRemote.contains("\"") || addPkgListForRemote.contains("\'") ||
-                                                               addPkgListForRemote.contains(":") || addPkgListForRemote.contains(",") ||
-                                                               addPkgListForRemote.contains(";")) {
-                                                       MessageDialog.openError(shell, "Error", "Invalid character is found. (\"  \'  ,  :  ;  . )\n" +
-                                                                       "Between package names, delimeter shoud be space character.\n" +
-                                                                       "(ex) sqlite3 sysv-rc sglib-dev perl");
-                                                       return;
-                                               }                               
-                                               
-                                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());   
-                                               
-                                               try {
-                                                       dialog.run(true, false, new IRunnableWithProgress() {
-                                                               @Override
-                                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                                               InterruptedException {
-                                                                       monitor.beginTask("Adding packages to list", -1);
-
-                                                                       if (addPkgListForRemote != "") {
-                                                                               addPkgListForRemote = addPkgListForRemote.trim();
-                                                                               String[] arrPkgs = addPkgListForRemote.split(" ");
-                                                                               for (String pkgName : arrPkgs) {
-                                                                                       if (pkgName.isEmpty()) {
-                                                                                               continue;
-                                                                                       }
-                                                                                       monitor.subTask(String.format("Adding %s", pkgName));
-                                                                                       addColumn(currentViewer, pkgName, null, Package.PKGTYPE.REMOTE);
-                                                                               }
-                                                                       }
-                                                                       
-                                                                       monitor.worked(1);
-                                                                       monitor.done();
-                                                               }                                               
-                                                       });
-                                               } catch (Exception e1) {
-                                                       e1.printStackTrace();                   
-                                               }                               
-                                               
-                                               packageListText.setText("");
-                                               
-                                               //currentViewer.refresh();
-                                               if (viewerForRootstrap != null) {
-                                                       viewerForRootstrap.refresh();
-                                               }
-                                               if (viewerForTarget != null) {
-                                                       viewerForTarget.refresh();
-                                               }
-                                               
-                                               int recentTableIndex = currentViewer.getTable().getItemCount();
-                                               
-                                               for (int i = oldTableIndex; i < recentTableIndex; i++) {
-                                                       TableItem item1 = null;
-                                                       TableItem item2 = null;;
-                                                       
-                                                       if (viewerForRootstrap != null) {
-                                                               item1 = viewerForRootstrap.getTable().getItem(i);
-                                                               Package pkg = (Package)item1.getData();
-                                                               item1.setChecked(pkg.getCheckColumn1());
-                                                       }
-                                                       if (viewerForTarget != null) {
-                                                               item2 = viewerForTarget.getTable().getItem(i);
-                                                               Package pkg = (Package)item2.getData();
-                                                               item2.setChecked(pkg.getCheckColumn2());
-                                                       }
-                                               }
-                                               break;
-                               }       
-                               */              
-                       }                                       
-               };
-               
-               packageListText = new Text(com, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
-               packageListText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
-                                       | GridData.HORIZONTAL_ALIGN_FILL));
-               packageListText.addListener(SWT.Traverse, AddPackageEventHandler);
-               packageListText.setEnabled(false);
-               
-               addButtonFromRemote = new Button( com, SWT.PUSH );
-               addButtonFromRemote.setImage(new Image(display, 
-                               Activator.getImageDescriptor("/icons/packagelist_to_table.gif").getImageData()));
-               addButtonFromRemote.setToolTipText("Add packages from remote repository");
-               addButtonFromRemote.addListener(SWT.MouseDown, AddPackageEventHandler);
-               addButtonFromRemote.setEnabled(false);
-
-               addButtonFromFile = new Button( com, SWT.PUSH );
-               addButtonFromFile.setImage(new Image(display, 
-                               Activator.getImageDescriptor("/icons/folder_search.gif").getImageData()));
-               addButtonFromFile.setToolTipText("Add packages from file system");
-               addButtonFromFile.addMouseListener(new MouseListener()
-        {
-
-                       @Override
-                       public void mouseDoubleClick(MouseEvent e) {
-                       }
-
-                       @Override
-                       public void mouseDown(MouseEvent e) {
-                               
-                               int oldTableIndex = currentViewer.getTable().getItemCount();                             
-
-                               fd = new FileDialog( getShell(), SWT.OPEN|SWT.MULTI);
-                       fd.setText("Select deb file...");
-                       if (previousFilterPath == null) 
-                               fd.setFilterPath(null);
-                       else
-                               fd.setFilterPath(previousFilterPath); 
-                       String[] filterExt = { "*.rpm" };
-                       fd.setFilterExtensions(filterExt);
-                       
-                       try {
-                                       String rootstrapPath = sbi.getRootstrapPath(getTargetID());
-                                       fd.setFilterPath(rootstrapPath);
-                               } catch (SBIException e2) {                             
-                                       e2.printStackTrace();
-                               }
-                       
-                       selectedFileList = fd.open();
-                       
-                       ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());                           
-                               
-                               try {
-                                       dialog.run(true, false, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {
-                                                       monitor.beginTask("Adding packages to list", -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]);
-                                                               addColumn( currentViewer, null, buf.toString(), Package.PKGTYPE.LOCAL);                 
-                                                       }                                                       
-                                               }
-                                               }
-                                       });
-                               } catch (Exception e1) {
-                                       e1.printStackTrace();
-                               }
-                               
-                               //currentViewer.refresh();
-                               if (viewerForRootstrap != null) {
-                                       viewerForRootstrap.refresh();
-                               }
-                               if (viewerForTarget != null) {
-                                       viewerForTarget.refresh();
-                               }
-                               
-                               int recentTableIndex = currentViewer.getTable().getItemCount();
-                               
-                               for (int i = oldTableIndex; i < recentTableIndex; i++) {
-                                       TableItem item1 = null;
-                                       TableItem item2 = null;;
-                                       
-                                       if (viewerForRootstrap != null) {
-                                               item1 = viewerForRootstrap.getTable().getItem(i);
-                                               Package pkg = (Package)item1.getData();
-                                               item1.setChecked(pkg.getCheckColumn1());
-                                       }
-                                       if (viewerForTarget != null) {
-                                               item2 = viewerForTarget.getTable().getItem(i);
-                                               Package pkg = (Package)item2.getData();
-                                               item2.setChecked(pkg.getCheckColumn2());
-                                       }
-                               }
-                       }
-
-                       @Override
-                       public void mouseUp(MouseEvent e) {
-                       }
-               
-        });                
-               
-       }
-       
-       private Control getRootstrapTabControl( TabFolder tabFolder )
-       {
-               Composite composite = new Composite( tabFolder, SWT.NONE );
-               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-               composite.setLayout(new GridLayout(1, false));
-               
-               Composite Com = new Composite( composite, SWT.NONE );
-               Com.setLayoutData(new GridData(GridData.FILL_HORIZONTAL ));
-               Com.setLayout(new GridLayout(2, false));
-               
-               Composite leftCom = new Composite( Com, SWT.NONE );
-               leftCom.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING));
-               leftCom.setLayout(new GridLayout(1, false));
-               
-               Composite rightCom = new Composite( Com, SWT.NONE );
-               rightCom.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
-               //rightCom.setLayout(new GridLayout(4, false));         
-               rightCom.setLayout(new GridLayout(3, false));
-
-               Label configurationLabel = new Label(leftCom, SWT.LEFT);                
-               configurationLabel.setText(String.format("Configuration : %s", this.configuration));
-
-               upgradeButton = new Button( rightCom, SWT.PUSH );
-               upgradeButton.setText("Upgrade");
-               upgradeButton.setEnabled(false);
-               /*
-               upgradeButton.addMouseListener(new MouseListener(){
-
-                       @Override
-                       public void mouseDoubleClick(MouseEvent e) {
-                       }
-
-                       @Override
-                       public void mouseDown(MouseEvent e) {
-                               
-                               repositoryForRemote = repositoryText.getText();
-                               
-                               if(repositoryForRemote.isEmpty()) {
-                                       MessageDialog.openError(shell, "Error", "Repository is empty.\nPlease set repository.");
-                                       return;
-                               }                               
-                               
-                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
-                               
-                               try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {
-                                                       monitor.beginTask("apt-get upgrade", -1);
-                                                       
-                                                       CheckCancelJob cancelJob = new CheckCancelJob(monitor);
-                                                       Thread checkCancelThread = new Thread(cancelJob);
-                                                       checkCancelThread.start();
-                                                       
-                                                       ConsoleManager cm = new ConsoleManager( "Package Installer", true);
-                                                       cm.clear();
-                                                       MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
-                                                       MessageConsoleStream mcs = cm.getMessageConsoleStream(false);                           
-                                                       MessageConsoleStream mcsError1 = cm.getMessageConsoleStream(true);
-                                                       MessageConsoleStream mcs1 = cm.getMessageConsoleStream(false);                                                  
-                                                       String targetID = getTargetID();                                                        
-
-                                                       monitor.subTask("apt-get -f -y install");                                                       
-                                                       PackageCommander.fixBrokenForRootstrap(targetID, mcs, mcsError);                
-
-                                                       monitor.subTask("apt-get -y dist-upgrade");
-                                                       PackageCommander.aptGetUpgradeForRootstrap(targetID, mcs1, mcsError1);                                                  
-                                                       
-                                                       //monitor.worked(1);
-                                                       checkCancelThread.interrupt();
-                                                       monitor.done();
-                                               }                                               
-                                       });
-                               } catch (Exception e1) {
-                                       e1.printStackTrace();                   
-                               }
-                       }
-
-                       @Override
-                       public void mouseUp(MouseEvent e) {
-                       }
-        
-        });
-        */
-               
-               installButton = new Button( rightCom, SWT.PUSH );
-               installButton.setText("Install");
-        installButton.addMouseListener(new MouseListener(){
-
-                       @Override
-                       public void mouseDoubleClick(MouseEvent e) {
-                       }
-
-                       @Override
-                       public void mouseDown(MouseEvent e) {
-                               pkgs = getSelectedPkg(PkgModelProvider.INSTANCE.getPkgs());
-                               
-                               if(pkgs.isEmpty()) {
-                                       MessageDialog.openError(shell, "Error", "There is no selected package.");
-                                       return;
-                               }
-                               
-                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());                           
-                               
-                               try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {
-                                                       monitor.beginTask("Installing package", -1);
-                                                       
-                                                       CheckCancelJob cancelJob = new CheckCancelJob(monitor);
-                                                       Thread checkCancelThread = new Thread(cancelJob);
-                                                       checkCancelThread.start();
-                               
-                                                       try {                                                           
-                                                               String targetID = getTargetID();
-                                                               String rpmPathList = "";
-                                                               String rpmNameList = "";
-                                                               String aptPkgList = "";
-                                                               String rootstrapPath = sbi.getRootstrapPath(targetID);
-                                                               String filePath = null;
-                                                               
-                                                               ConsoleManager cm = new ConsoleManager( "Installing packages", true);
-                                                               cm.clear();
-                                                               MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
-                                                               MessageConsoleStream mcs = cm.getMessageConsoleStream(false);
-                                                               MessageConsoleStream mcsError1 = cm.getMessageConsoleStream(true);
-                                                               MessageConsoleStream mcs1 = cm.getMessageConsoleStream(false);                                                          
-                                                               MessageConsoleStream mcsError2 = cm.getMessageConsoleStream(true);
-                                                               MessageConsoleStream mcs2 = cm.getMessageConsoleStream(false);                                                          
-                                                               
-                                                               for (Package pkg : pkgs) {                                                              
-                                                                       if (pkg.getPkgType().equals(Package.PKGTYPE.LOCAL)) {
-                                                                               filePath = pkg.getPath().replaceAll(rootstrapPath, "");
-                                                                               rpmPathList = rpmPathList.concat(filePath + " ");
-                                                                               rpmNameList = rpmNameList.concat(pkg.getName() + " ");
-                                                                       } else if (pkg.getPkgType().equals(Package.PKGTYPE.REMOTE)) {
-                                                                               aptPkgList = aptPkgList.concat(pkg.getName() + " ");
-                                                                       }
-                                                               }
-                                                               
-                                                               /*
-                                                               if(!aptPkgList.equals("")) {
-                                                                       monitor.subTask("apt-get -f -y install");                                                                       
-                                                                       PackageCommander.fixBrokenForRootstrap(targetID, mcs, mcsError);                                                        
-                                                                       monitor.subTask(String.format("apt-get install %s", aptPkgList));
-                                                                       mcs1.write("***** apt-get install *****\n");
-                                                                       PackageCommander.aptGetInstallForRootstrap(targetID, aptPkgList, mcs1, mcsError1);                                                              
-                                                               }
-                                                               */
-                                                               
-                                                               if(!cancelJob.getTerminateChecker() && !rpmNameList.equals("")) {                                                                       
-                                                                       monitor.subTask(String.format("dpkg -i %s", rpmNameList));
-                                                                       mcs2.write("\n***** rpm install *****\n");      
-                                                                       RPMPackageCommander.InstallPkgToRootstrap(targetID, rpmPathList, mcs2, mcsError2);
-                                                                       /** E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem. **/
-                                                                       //PackageCommander.resolveDpkgInterruptForRootstrap(targetID, mcs2, mcsError2);
-                                                               }                                                               
-                                                               
-                                                               for (Package pkg : pkgs) {
-                                                                       String installedVer = RPMPackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), targetID);
-                                                                       pkg.setInstalledVersion1(installedVer);                                                                 
-                                                                       
-                                                                       if (installedVer.equals("")) {
-                                                                               pkg.setInstallInfo1(Package.INSTALLINFO.NOT_INSTALLED);
-                                                                       } else if (installedVer.equals(pkg.getNewVersion1())) {
-                                                                               if (RPMPackageCommander.pkgInstalledSuccessfullyForRootstrap(pkg.getName(), targetID)) {
-                                                                                       pkg.setInstallInfo1(Package.INSTALLINFO.INSTALLED);
-                                                                               } else {
-                                                                                       pkg.setInstallInfo1(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED);
-                                                                               }
-                                                                       } else {
-                                                                               pkg.setInstallInfo1(Package.INSTALLINFO.DIFFERENT_VERSION);
-                                                                       }                                                                       
-                                                               }                                                       
-
-                                                       } catch (IOException e) {
-                                                               e.printStackTrace();
-                                                       } catch (SBIException e) {
-                                                               e.printStackTrace();
-                                                       }
-                                                       
-                                                       //checkCancelThread.interrupt();
-                                                       cancelJob.setFinishFlag(true);
-                                                       monitor.done();
-                                               }
-                                       });                                     
-                               } catch (Exception e1) {
-                                       // TODO Auto-generated catch block
-                                       e1.printStackTrace();
-                               }               
-                               
-                               currentViewer.refresh();
-                       }
-
-                       @Override
-                       public void mouseUp(MouseEvent e) {
-                       }
-        
-        });      
-        
-        removeButton = new Button( rightCom, SWT.PUSH );
-               removeButton.setToolTipText("Remove checked package from list");
-               removeButton.setImage(new Image(display, 
-                               Activator.getImageDescriptor("/icons/list-delete.gif").getImageData()));
-               removeButton.addMouseListener(removeListener);
-
-        bottomTableForRootstrap(composite);
-               
-               return composite;
-       }
-       
-       private Control getTargetTabControl( TabFolder tabFolder )
-       {
-               Composite composite = new Composite( tabFolder, SWT.NONE );
-               composite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-               composite.setLayout(new GridLayout(1, false));
-               
-               Composite com = new Composite( composite, SWT.NONE );
-               com.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-               com.setLayout(new GridLayout(2, false));
-               
-               Composite leftCom = new Composite( com, SWT.NONE );
-               leftCom.setLayoutData(new GridData( GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING));
-               leftCom.setLayout(new GridLayout(1, false));
-               
-               Composite rightCom = new Composite( com, SWT.NONE );
-               rightCom.setLayoutData(new GridData( GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
-               //rightCom.setLayout(new GridLayout(4, false));
-               rightCom.setLayout(new GridLayout(3, false));
-               
-               Label configurationLabel = new Label(leftCom, SWT.LEFT);                
-               configurationLabel.setText(String.format("Connection : %s", device.getSerialNumber()));         
-               
-               upgradeButton = new Button( rightCom, SWT.PUSH );
-               upgradeButton.setText("Upgrade");
-               upgradeButton.setEnabled(false);
-               /*
-               upgradeButton.addMouseListener(new MouseListener(){
-
-                       @Override
-                       public void mouseDoubleClick(MouseEvent e) {
-                       }
-
-                       @Override
-                       public void mouseDown(MouseEvent e) {
-                               repositoryForRemote = repositoryText.getText();
-                               
-                               if(repositoryForRemote.isEmpty()) {
-                                       MessageDialog.openError(shell, "Error", "Repository is empty.\nPlease set repository.");
-                                       return;
-                               }                               
-                               
-                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
-                               
-                               try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {
-                                                       monitor.beginTask("apt-get upgrade", -1);
-                                                       
-                                                       ConsoleManager cm = new ConsoleManager( "Package Installer", true);
-                                                       cm.clear();
-                                                       MessageConsoleStream mcs = cm.getMessageConsoleStream(false);
-                                                       PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
-                                                       rec.setMessageConsoleStream(mcs);                                                       
-
-                                                       monitor.subTask("apt-get -f -y install");                                               
-                                                       PackageCommander.fixBrokenForRealTarget(device, rec);
-                                                       
-                                                       monitor.subTask("apt-get -y dist-upgrade");
-                                                       PackageCommander.aptGetUpgradeForRealTarget(device, rec);
-
-                                                       monitor.done();
-                                               }                                               
-                                       });
-                               } catch (Exception e1) {
-                                       e1.printStackTrace();                   
-                               }
-                       }
-
-                       @Override
-                       public void mouseUp(MouseEvent e) {
-                       }
-        
-        });
-               */
-               installButton = new Button( rightCom, SWT.PUSH );
-               installButton.setText("Install");                               
-        installButton.addMouseListener(new MouseListener(){
-
-                       @Override
-                       public void mouseDoubleClick(MouseEvent e) {
-                       }
-
-                       @Override
-                       public void mouseDown(MouseEvent e) {
-                               pkgs = getSelectedPkg(PkgModelProvider.INSTANCE.getPkgs());
-                               
-                               if(pkgs.isEmpty()) {
-                                       MessageDialog.openError(shell, "Error", "Any package is not selected.");
-                                       return;
-                               }
-                               
-                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
-                               
-                               try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {
-                                                       monitor.beginTask("Installing deb package", -1);
-                                                       
-                                                       try {
-                                                               String newPath = null;
-                                                               ConsoleManager cm = new ConsoleManager( "Package Installer", true);
-                                                               cm.clear();
-                                                               MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
-                                                               MessageConsoleStream mcs = cm.getMessageConsoleStream(false);
-                                                               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
-                                                               rec.setMessageConsoleStream(mcs);
-                                                               String command = null;
-                                                               String localPkgList = "";
-                                                               String remotePkgList = "";
-
-                                                               // Step 1: transfer pkg and make pkg list
-                                                               for (Package pkg : pkgs)
-                                                               {
-                                                                       if (pkg.getPkgType().equals(Package.PKGTYPE.LOCAL)) {                                                                           
-                                                                               String file = new File(pkg.getPath()).getName();
-                                                                               newPath = TMP_PATH + "/" + file;
-                                                                               monitor.subTask(String.format("transfer %s to target's %s",pkg.getPath(), newPath));
-                                                                               if (monitor.isCanceled())
-                                                                                       throw new OperationCanceledException();
-                                                                               SyncService syncService = device.getSyncService();
-                                                                               SyncResult syncResult = syncService.pushFile(pkg.getPath(), newPath, SyncService.getNullProgressMonitor());
-                                                                               if (syncResult.getCode() != SyncService.RESULT_OK) {
-                                                                                       mcsError.println("Faild to move file from " + pkg.getPath() + " to " + newPath);
-                                                                                       pkg.setInstallInfo2( Package.INSTALLINFO.NOT_INSTALLED);
-                                                                                       //viewerForTarget.refresh();
-                                                                                       continue;
-                                                                               }
-                                                                               if (monitor.isCanceled())
-                                                                                       throw new OperationCanceledException();                                                                         
-
-                                                                               if (localPkgList == "") {
-                                                                                       localPkgList = newPath;
-                                                                               } else {
-                                                                                       localPkgList = localPkgList + " " + newPath;
-                                                                               }
-
-                                                                       } else if (pkg.getPkgType().equals(Package.PKGTYPE.REMOTE)) {
-                                                                               if (remotePkgList == "") {
-                                                                                       remotePkgList = pkg.getName();
-                                                                               } else {
-                                                                                       remotePkgList = remotePkgList + " " + pkg.getName();
-                                                                               }
-                                                                       }
-                                                               }
-                                                               
-                                                               // Step 2: set update mode on device
-                                                               if (!device.isEmulator()) {                                                                             
-                                                                       // Change to bootmode with update
-                                                                       command = RPM_COMMAND_UPDATEMODE;
-                                                                       device.executeShellCommand(command, rec, MAX_TIMEOUT);                                                                                  
-                                                               }
-                                                               
-                                                               /*
-                                                               // Step 3 : apt-get install pkg
-                                                               if (remotePkgList != "") {
-                                                                       monitor.subTask("apt-get -y -f install");
-                                                                       PackageCommander.fixBrokenForRealTarget(device, rec);
-                                                                       monitor.subTask(String.format("apt-get install %s", remotePkgList));
-                                                                       PackageCommander.aptGetInstallForTarget(remotePkgList, device, rec);                                                                    
-                                                               }
-                                                               */
-                                                               
-                                                               if (monitor.isCanceled())
-                                                                       throw new OperationCanceledException();
-                                                               
-                                                               // Step 4: install deb file
-                                                               if (localPkgList != "") {
-                                                                       command = RPM_COMMAND_INSTALL + " " + localPkgList;
-                                                                       monitor.subTask(command);
-                                                                       device.executeShellCommand(command, rec, MAX_TIMEOUT);                                                                  
-                                                               }
-                                                               
-                                                               if (monitor.isCanceled())
-                                                                       throw new OperationCanceledException();
-                                                               
-                                                               Thread.sleep(500);
-                                                               
-                                                               for (Package pkg : pkgs) {
-                                                                       if (monitor.isCanceled())
-                                                                               throw new OperationCanceledException();
-                                                                       // update status
-                                                                       rec.setPrintConsole(false);
-                                                                       String installedVer = RPMPackageCommander.getPkgInstalledVerForRealTarget(pkg.getName(), device, rec);                                                                  
-                                                                       pkg.setInstalledVersion2(installedVer);                 
-                                                                       
-                                                                       if (installedVer.equals("")) {
-                                                                               pkg.setInstallInfo2(Package.INSTALLINFO.NOT_INSTALLED);
-                                                                       } else if (installedVer.equals(pkg.getNewVersion2())) {
-                                                                               if (RPMPackageCommander.pkgInstalledSuccessfullyForRealTarget(pkg.getName(), device, rec)) {
-                                                                                       pkg.setInstallInfo2(Package.INSTALLINFO.INSTALLED);
-                                                                               } else {
-                                                                                       pkg.setInstallInfo2(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED);
-                                                                               }
-                                                                       } else {
-                                                                               pkg.setInstallInfo2(Package.INSTALLINFO.DIFFERENT_VERSION);
-                                                                       }                       
-                                                                       if (monitor.isCanceled())
-                                                                               throw new OperationCanceledException();
-                                                               }       
-                                                               
-                                                               monitor.done();
-                                                       } catch (Exception e1) {
-                                                               // TODO Auto-generated catch block
-                                                               e1.printStackTrace();
-                                                       }
-                                               }
-                                       });
-                               } catch (Exception e1) {
-                                       // TODO Auto-generated catch block
-                                       e1.printStackTrace();
-                               }
-                               
-                               viewerForTarget.refresh();
-                       }
-
-                       @Override
-                       public void mouseUp(MouseEvent e) {
-                       }
-        
-        });
-        
-        removeButton = new Button( rightCom, SWT.PUSH );
-               removeButton.setToolTipText("Remove checked package from list");
-               removeButton.setImage(new Image(display, 
-                               Activator.getImageDescriptor("/icons/list-delete.gif").getImageData()));
-               removeButton.addMouseListener(removeListener);
-               
-        bottomTableForTarget(composite);
-               
-               return composite;
-       }
-       
-       private void bottomTableForRootstrap( Composite parent ) 
-       {               
-               Composite bottom = new Composite( parent, SWT.NONE );
-               bottom.setLayoutData(new GridData(GridData.FILL_BOTH));
-               bottom.setLayout(new FillLayout());
-        
-        viewerForRootstrap = new TableViewer( bottom, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
-        createColumns( parent, viewerForRootstrap, ROOTSTRAP_TAB_NAME );
-               tableForRootstrap = viewerForRootstrap.getTable();
-               tableForRootstrap.addListener( SWT.Selection, new Listener(){
-
-                       @Override
-                       public void handleEvent(Event event) {
-                               if( event.detail == SWT.CHECK )
-                               {
-                                       Package pkg = (Package)event.item.getData();
-                                       pkg.setCheckColumn1( !pkg.getCheckColumn1() );
-                               }
-                       }
-                       
-               });
-
-               tableForRootstrap.setHeaderVisible(true);
-               tableForRootstrap.setLinesVisible(true);
-               
-               viewerForRootstrap.setContentProvider(new ArrayContentProvider());      
-               viewerForRootstrap.setInput(PkgModelProvider.INSTANCE.getPkgs());
-               
-               if (tabIndex == 0) {
-                       currentViewer = viewerForRootstrap;
-                       CURRENT_TAB_NAME = ROOTSTRAP_TAB_NAME;
-               }
-       }
-       
-       private void bottomTableForTarget( Composite parent ) 
-       {               
-               Composite bottom = new Composite( parent, SWT.NONE );
-               bottom.setLayoutData(new GridData(GridData.FILL_BOTH));
-               bottom.setLayout(new FillLayout());
-        
-               viewerForTarget = new TableViewer( bottom, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK);
-        createColumns( parent, viewerForTarget, TARGET_TAB_NAME );
-               tableForTarget = viewerForTarget.getTable();
-               tableForTarget.addListener( SWT.Selection, new Listener(){
-
-                       @Override
-                       public void handleEvent(Event event) {
-                               if( event.detail == SWT.CHECK )
-                               {
-                                       Package pkg = (Package)event.item.getData();
-                                       pkg.setCheckColumn2( !pkg.getCheckColumn2() );
-                               }
-                       }
-                       
-               });
-
-
-               tableForTarget.setHeaderVisible(true);
-               tableForTarget.setLinesVisible(true);
-               
-               viewerForTarget.setContentProvider(new ArrayContentProvider()); 
-               viewerForTarget.setInput(PkgModelProvider.INSTANCE.getPkgs());
-               
-               if (tabIndex == 1) {
-                       currentViewer = viewerForTarget;
-                       CURRENT_TAB_NAME = TARGET_TAB_NAME;
-               }
-       }
-
-       
-       private void createBottomComposite( 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) {
-                               String tabName = tabFolder.getSelection()[0].getText();
-                               if (tabName.equals(ROOTSTRAP_TAB_NAME)) {
-                                       CURRENT_TAB_NAME = ROOTSTRAP_TAB_NAME;                                          
-                                       if (enableRootstrapTab) {
-                                               String targetID = getTargetID();
-                                               currentViewer = viewerForRootstrap;
-                                               /*
-                                               String sourcelist = "";
-                                               if (!sbi.checkTargetID(targetID)) {
-                                                       MessageDialog.openError(shell, "Error", "Target does not exist. please build project first");
-                                               } else {
-                                                       sourcelist = PackageCommander.getCurrentSourceListForRootstrap(targetID);
-                                               }
-                                               repositoryText.setText(sourcelist);
-                                               */
-                                       }
-                                       
-                               } else if (tabName.equals(TARGET_TAB_NAME)) {
-                                       CURRENT_TAB_NAME = TARGET_TAB_NAME;                                             
-                                       if (enableTargetTab) {
-                                               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
-                                               rec.setPrintConsole(false);
-                                               currentViewer = viewerForTarget;
-                                               //repositoryText.setText(PackageCommander.getCurrentSourceListForRealTarget(device, rec));
-                                       }
-                               }
-                               if (currentViewer != null) {
-                                       currentViewer.refresh();
-                               }                               
-                       }               
-               });
-               
-               
-               TabItem rootstrapTab = new TabItem( tabFolder, SWT.NULL );
-               rootstrapTab.setText(ROOTSTRAP_TAB_NAME);               
-               
-               if (!enableRootstrapTab) {
-                       rootstrapTab.setControl( errorTab( tabFolder , "- Any project is not selected or project is not \"PLATFORM PROJECT\"."));
-                       tabIndex = 1;
-               } else {
-                       rootstrapTab.setControl( getRootstrapTabControl( tabFolder ));
-               }
-               
-               TabItem deviceTab = new TabItem( tabFolder, SWT.NULL );
-               deviceTab.setText(TARGET_TAB_NAME);
-               
-               if (!enableTargetTab) {
-                       deviceTab.setControl( errorTab( tabFolder, "- Any device is not connected or selected." ));
-                       tabIndex = 0;
-               } else {
-                       deviceTab.setControl( getTargetTabControl( tabFolder ));                        
-               }
-               
-               tabIndex = 0;
-               tabFolder.setSelection(tabIndex);
-       }
-       
-       private Control errorTab(TabFolder tabFolder, String msg) {
-               Composite composite = new Composite( tabFolder, SWT.NONE );
-               composite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-               composite.setLayout(new GridLayout(1, false));
-               
-               Label errorLabel = new Label(composite, SWT.LEFT);              
-               errorLabel.setText(msg);
-               
-               return composite;
-       }
-       
-       /*
-       private void updatePkgInfoAfterAptUpdate() {
-               CopyOnWriteArrayList<Package> pkgs = PkgModelProvider.INSTANCE.getPkgs();               
-               
-               for (Package pkg : pkgs) {
-                       if (pkg.getPkgType().equals(Package.PKGTYPE.REMOTE)) {
-                               if (CURRENT_TAB_NAME.equals(ROOTSTRAP_TAB_NAME)) {
-                                       String targetID = getTargetID();
-                                       String newVer = PackageCommander.getPkgNewVerForRootstrap(pkg.getName(), targetID);
-                                       if (newVer.equals("")) {
-                                               pkg.setInstallInfo1(Package.INSTALLINFO.NOT_FOUND);
-                                               pkg.setCheckColumn1(false);
-                                       } else if (pkg.getInstalledVersion1().equals("")) {
-                                               pkg.setInstallInfo1(Package.INSTALLINFO.NOT_INSTALLED);
-                                       } else if (newVer.equals(pkg.getInstalledVersion1())) {
-                                               if (PackageCommander.pkgInstalledSuccessfullyForRootstrap(pkg.getName(), targetID)) {
-                                                       pkg.setInstallInfo1(Package.INSTALLINFO.INSTALLED);
-                                               } else {
-                                                       pkg.setInstallInfo1(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED);
-                                               }
-                                       } else {
-                                               pkg.setInstallInfo1(Package.INSTALLINFO.DIFFERENT_VERSION);
-                                       }
-                                       pkg.setNewVersion1(newVer);
-                               } else if (CURRENT_TAB_NAME.equals(TARGET_TAB_NAME)) {
-                                       PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
-                                       rec.setPrintConsole(false);
-                                       String newVer = PackageCommander.getPkgNewVerForRealTarget(pkg.getName(), device, rec);
-                                       if (newVer.equals("")) {
-                                               pkg.setInstallInfo2(Package.INSTALLINFO.NOT_FOUND);
-                                               pkg.setCheckColumn2(false);
-                                       } else if (pkg.getInstalledVersion2().equals("")) {
-                                               pkg.setInstallInfo2(Package.INSTALLINFO.NOT_INSTALLED);
-                                       } else if (newVer.equals(pkg.getInstalledVersion2())) {
-                                               if (PackageCommander.pkgInstalledSuccessfullyForRealTarget(pkg.getName(), device, rec)) {
-                                                       pkg.setInstallInfo2(Package.INSTALLINFO.INSTALLED);
-                                               } else {
-                                                       pkg.setInstallInfo2(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED);
-                                               }
-                                       } else {
-                                               pkg.setInstallInfo2(Package.INSTALLINFO.DIFFERENT_VERSION);
-                                       }
-                                       pkg.setNewVersion2(newVer);
-                               }                               
-                       }
-               }               
-       }
-       */
-       
-       private boolean addColumn( TableViewer viewer, String pkgName, String rpmPath, Package.PKGTYPE type )
-       {
-               CopyOnWriteArrayList<Package> pkgs = PkgModelProvider.INSTANCE.getPkgs();
-               Iterator<Package> debIter = pkgs.iterator();
-               String targetID = null;         
-               
-               if (enableRootstrapTab) {
-                       targetID = getTargetID();
-               }
-               
-               Package pkg;
-               
-               if (pkgName == null && rpmPath != null) {
-                       pkgName = RPMPackageCommander.getPkgNameForFile(rpmPath);
-               }
-               
-               while( debIter.hasNext() )
-               {
-                       pkg = debIter.next();
-                       if( pkg.getName().equals(pkgName))                      
-                               return true;
-               }
-               
-               pkg = new Package();
-               if (rpmPath != null) {
-                       pkg.setName(RPMPackageCommander.getPkgNameForFile(rpmPath));
-               } else if (pkgName != null) {
-                       pkg.setName(pkgName);
-               }
-               
-               pkg.setTarget( this.target );
-               pkg.setPath(rpmPath);
-               
-               String newVerForRootstrap = "";
-               String newVerForTarget = "";
-               
-               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
-               rec.setPrintConsole(false);
-               
-               if (type.equals(Package.PKGTYPE.LOCAL)) {
-                       pkg.setArch1(RPMPackageCommander.getArchForFile(rpmPath));
-                       pkg.setArch2(RPMPackageCommander.getArchForFile(rpmPath));
-                       newVerForRootstrap = RPMPackageCommander.getPkgVerForFile(rpmPath);                     
-                       newVerForTarget = newVerForRootstrap;
-                       pkg.setNewVersion1(newVerForRootstrap);
-                       pkg.setNewVersion2(newVerForRootstrap);
-               } else {                        
-                       pkg.setArch1(PackageCommander.getArchOfRemotePkgForRootstrap(pkg.getName(), targetID));
-                       pkg.setArch2(PackageCommander.getArchOfRemotePkgForRealTarget(pkg.getName(), device, rec));
-                       newVerForRootstrap = PackageCommander.getPkgNewVerForRootstrap(pkg.getName(), targetID);
-                       rec.cleanLog();
-                       newVerForTarget = PackageCommander.getPkgNewVerForRealTarget(pkg.getName(), device, rec);
-                       pkg.setNewVersion1(newVerForRootstrap);
-                       pkg.setNewVersion2(newVerForTarget);
-               }               
-               String installedVerForRootstrap = RPMPackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), targetID);
-               rec.cleanLog();
-               String installedVerForRealDevice = RPMPackageCommander.getPkgInstalledVerForRealTarget(pkg.getName(), device, rec);
-               
-               pkg.setInstalledVersion1(installedVerForRootstrap);
-               pkg.setInstalledVersion2(installedVerForRealDevice);
-               //pkg.setInstalledVersion2(installedVerForRootstrap);
-               
-               if (newVerForRootstrap.equals("")) {
-                       pkg.setInstallInfo1(Package.INSTALLINFO.NOT_FOUND);
-                       pkg.setCheckColumn1(false);
-               } else if (!installedVerForRootstrap.equals("")) {
-                       if (!installedVerForRootstrap.equals(newVerForRootstrap)) {
-                               pkg.setInstallInfo1(Package.INSTALLINFO.DIFFERENT_VERSION);
-                       } else {
-                               if (RPMPackageCommander.pkgInstalledSuccessfullyForRootstrap(pkgName, targetID)) {
-                                       pkg.setInstallInfo1(Package.INSTALLINFO.INSTALLED);
-                               } else {
-                                       pkg.setInstallInfo1(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED);
-                               }
-                       }                       
-               } 
-               
-               //pkg.setInstallInfo2(Package.INSTALLINFO.NOT_FOUND);
-               
-               if (newVerForTarget.equals("")) {
-                       pkg.setInstallInfo2(Package.INSTALLINFO.NOT_FOUND);
-                       pkg.setCheckColumn2(false);
-               } else if (!installedVerForRealDevice.equals("")) {
-                       if (!installedVerForRealDevice.equals(newVerForTarget)) {
-                               pkg.setInstallInfo2(Package.INSTALLINFO.DIFFERENT_VERSION);
-                       } else {
-                               if (RPMPackageCommander.pkgInstalledSuccessfullyForRealTarget(pkg.getName(), device, rec)) {
-                                       pkg.setInstallInfo2(Package.INSTALLINFO.INSTALLED);
-                               } else {
-                                       pkg.setInstallInfo2(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED);
-                               }
-                       }                       
-               }
-               
-               pkg.setPkgType(type);
-               
-               PkgModelProvider.INSTANCE.getPkgs().add(pkg);
-               
-               /*
-               if (type.equals(Package.PKGTYPE.LOCAL)) {
-                       viewer.refresh();
-               }
-               */
-               
-               return true;
-       }
-       
-       
-       private void createColumns( Composite parent, final TableViewer viewer, final String type)
-       {
-               String[] titles = {"Install Type", "Package Name", "Arch", "New Version", "Installed Version", "Status"};
-               int[] bounds = { 120, 180, 60, 200, 200, 160};
-               
-               TableViewerColumn colInstallType = createTableViewerColumn( viewer, titles[0], bounds[0], SWT.NONE);
-               
-               colInstallType.setLabelProvider(new ColumnLabelProvider() {
-                       @Override
-                       public String getText(Object element) {
-                               Package pkg = (Package)element;                                                         
-                               return pkg.getPkgType().toString();
-                       }
-               });
-               
-               TableViewerColumn colPackage = createTableViewerColumn( viewer, titles[1], bounds[1], SWT.NONE);
-               
-               colPackage.setLabelProvider(new ColumnLabelProvider() {
-                       @Override
-                       public String getText(Object element) {
-                               Package pkg = (Package)element;
-                               return pkg.getName();
-                       }                       
-               });             
-               
-               TableViewerColumn colArch = createTableViewerColumn( viewer, titles[2], bounds[2], SWT.NONE);
-               
-               colArch.setLabelProvider(new ColumnLabelProvider() {
-                       @Override
-                       public String getText(Object element) {
-                               Package pkg = (Package)element;
-                               String arch = "";
-                               if (type.equals(ROOTSTRAP_TAB_NAME)) {                                  
-                                       arch = pkg.getArch1();
-                               } else if (type.equals(TARGET_TAB_NAME)) {                                      
-                                       arch = pkg.getArch2();
-                               }
-                               
-                               return arch;            
-                       }                       
-               });
-       
-               TableViewerColumn colNewVer = createTableViewerColumn( viewer, titles[3], bounds[3], SWT.NONE);
-               
-               colNewVer.setLabelProvider(new ColumnLabelProvider() {
-                       @Override
-                       public String getText(Object element) {
-                               Package pkg = (Package)element;
-                               String newVer = "";
-                               if (type.equals(ROOTSTRAP_TAB_NAME)) {                                  
-                                       newVer = pkg.getNewVersion1();
-                               } else if (type.equals(TARGET_TAB_NAME)) {                                      
-                                       newVer = pkg.getNewVersion2();
-                               }
-                               
-                               return newVer;                          
-                       }
-               });
-               
-               TableViewerColumn colInsVer = createTableViewerColumn( viewer, titles[4], bounds[4], SWT.NONE);
-               colInsVer.setLabelProvider(new ColumnLabelProvider() {
-                       @Override
-                       public String getText(Object element) {
-                               Package pkg = (Package)element;
-                               String installedVer = "";
-                               if (type.equals(ROOTSTRAP_TAB_NAME)) {                                  
-                                       installedVer = pkg.getInstalledVersion1();
-                               } else if (type.equals(TARGET_TAB_NAME)) {                                      
-                                       installedVer = pkg.getInstalledVersion2();
-                               }
-                               
-                               return installedVer;
-                       }
-               });     
-
-               TableViewerColumn colStatus = createTableViewerColumn( viewer, titles[5], bounds[5], SWT.NONE);
-               
-               colStatus.setLabelProvider(new ColumnLabelProvider() {
-                       @Override
-                       public String getText(Object element) {
-                               Package pkg = (Package)element;
-                               String status = "";
-                               if (type.equals(ROOTSTRAP_TAB_NAME)) {
-                                       status = pkg.getInstallInfo1().toString();
-                               } else if (type.equals(TARGET_TAB_NAME)) {
-                                       status = pkg.getInstallInfo2().toString();
-                               }
-                               
-                               return status;
-                       }
-               });             
-       }
-               
-       private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, int Style) {
-               
-               final TableViewerColumn viewerColumn = new TableViewerColumn( viewer,   Style);
-               final TableColumn column = viewerColumn.getColumn();
-               column.setText(title);
-               column.setWidth(bound);
-               column.setResizable(true);
-               column.setMoveable(true);
-               return viewerColumn;
-       }
-       
-       
-       private String getTargetID() {
-               IProject project = CurrentEnabledProject.getCurrentProject();
-               IConfiguration config = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
-               String targetID = PlatformConfigurationManager.getBuildTargetName(config);
-               return targetID;
-       }
-       
-       private CopyOnWriteArrayList<Package> getSelectedPkg(CopyOnWriteArrayList<Package> pkgs) {
-               CopyOnWriteArrayList<Package> _pkgs = new CopyOnWriteArrayList<Package>();
-               if (CURRENT_TAB_NAME.equals(ROOTSTRAP_TAB_NAME)) {
-                       for (Package pkg : pkgs) {                      
-                               if(pkg.getCheckColumn1()) {
-                                       _pkgs.add(pkg);
-                               }
-                       }
-               } else if (CURRENT_TAB_NAME.equals(TARGET_TAB_NAME)) {
-                       for (Package pkg : pkgs) {                      
-                               if(pkg.getCheckColumn2()) {
-                                       _pkgs.add(pkg);
-                               }
-                       }
-               }
-               
-               return _pkgs;
-       }
-}
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerOuputReceiver.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerOuputReceiver.java
new file mode 100644 (file)
index 0000000..e655f07
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+*  Inhouse
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Taejun Ha <taejun.ha@samsung.com>
+* Jiil Hyoun <jiil.hyoun@samsung.com>
+* Donghyuk Yang <donghyuk.yang@samsung.com>
+* Hoon Kang <h245.kang@samsung.com>  
+* DongHee Yang <donghee.yang@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.nativeplatform.pkgmgr;
+
+import org.eclipse.ui.console.MessageConsoleStream;
+
+import org.tizen.sdblib.MultiLineReceiver;
+
+public class PackageManagerOuputReceiver extends MultiLineReceiver {
+
+    public boolean isCancelled = false;
+    private boolean printConsole = true;
+    private String[] log = null; 
+    private MessageConsoleStream mcs = null;
+
+    public PackageManagerOuputReceiver() {
+        super();
+
+        setTrimLine(false);
+    }
+    
+    public void setMessageConsoleStream(MessageConsoleStream mcs) {            
+       this.mcs = mcs;
+    }
+    
+    public void setPrintConsole(boolean b) {
+       printConsole = b;
+    }
+
+    @Override
+    public void processNewLines(String[] lines) {
+        if (isCancelled == false) {
+            //processLogLines(lines);
+               log = lines;
+               if (printConsole) {
+                       for (String line : lines) {
+                               if (line.endsWith("\n")) {
+                                       mcs.print(line);
+                               } else {
+                                       mcs.println(line);
+                               }                                       
+                       }
+               }
+        }            
+    }
+    
+    public String[] getLog() {
+       return log;
+    }
+    
+    public void cleanLog() {
+       log = null;
+    }
+
+    public boolean isCancelled() {
+        return isCancelled;
+    }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerRootstrapHandler.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerRootstrapHandler.java
new file mode 100644 (file)
index 0000000..53131c3
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+*  Inhouse
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Taejun Ha <taejun.ha@samsung.com>
+* Jiil Hyoun <jiil.hyoun@samsung.com>
+* Donghyuk Yang <donghyuk.yang@samsung.com>
+* Hoon Kang <h245.kang@samsung.com>  
+* DongHee Yang <donghee.yang@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.nativeplatform.pkgmgr;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import org.tizen.common.connection.ConnectionPlugin;
+
+import org.tizen.nativeplatform.pkgInstall.DEBPackageManager;
+import org.tizen.nativeplatform.pkgmgr.ui.RPMPackageDialog;
+import org.tizen.nativecommon.build.CurrentEnabledProject;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.sdblib.IDevice;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class PackageManagerRootstrapHandler extends AbstractHandler {
+       /**
+        * The constructor.
+        */
+       public PackageManagerRootstrapHandler() {
+       }
+
+       /**
+        * the command has been executed, so extract extract the needed information
+        * from the application context.
+        */
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+               
+               IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+               IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();              
+               String target = null;
+               boolean enableRootstrap = true;
+               boolean enableTarget = true;            
+               boolean enableRpmMgr = false;
+
+               if (device == null) {
+                       enableTarget = false;
+               } else {
+                       target = device.getSerialNumber();
+                       if (target == null) {
+                               enableTarget = false;
+                       }
+               }
+               
+               IProject project = CurrentEnabledProject.getCurrentProject();
+               if (project == null) {                  
+                       enableRootstrap = false;                        
+               } else {                
+                       IConfiguration cfg =ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
+                       String targetName = PlatformConfigurationManager.getBuildTargetName(cfg);
+                       if (targetName.contains("obs")) {
+                               enableRpmMgr = true;
+                       }
+                       IManagedProject managedProject = cfg.getManagedProject();
+                       String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId();
+                       if (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE) &&
+                                       !projectArtifactType.equals(PlatformConfigurationManager.OLD_SLP_CUSTOM_DEBIAN_ARTIFACT_TYPE)) {                                
+                               enableRootstrap = false;
+                       }
+               }                       
+
+               if (enableRpmMgr) {
+                       RPMPackageDialog pkgdlg = new RPMPackageDialog(window.getShell(), target, enableRootstrap, enableTarget);
+                       pkgdlg.open();
+               } else {
+                       DEBPackageManager pkgdlg = new DEBPackageManager(window.getShell(), target, enableRootstrap, enableTarget);
+                       pkgdlg.open();
+               }
+               
+               return null;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommander.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommander.java
new file mode 100644 (file)
index 0000000..6b12cc1
--- /dev/null
@@ -0,0 +1,493 @@
+/*
+*  Inhouse
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Taejun Ha <taejun.ha@samsung.com>
+* Jiil Hyoun <jiil.hyoun@samsung.com>
+* Donghyuk Yang <donghyuk.yang@samsung.com>
+* Hoon Kang <h245.kang@samsung.com>  
+* DongHee Yang <donghee.yang@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.nativeplatform.pkgmgr;
+
+import java.io.OutputStream;
+import java.util.ResourceBundle;
+
+import org.tizen.common.util.HostUtil;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
+import org.tizen.sdblib.IDevice;
+
+public class RPMPackageCommander {
+
+       private final static SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+       private final static int MAX_TIMEOUT = 10000;
+       private static String http_proxy = "";
+       
+       private static final String BUNDLE_NAME = RPMPackageCommander.class.getPackage().getName() + ".RPMPackageCommands";
+       private static ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+       
+       public RPMPackageCommander() {          
+       }       
+       
+       public static void setHttpProxy(String proxy) {
+               http_proxy = proxy;
+       }
+       
+       public static void InstallPkgToRootstrap(String targetID, String fileList,
+                       OutputStream stdoutStream, OutputStream stderrStream) {         
+
+               String options = String.format("-path=. -cmd=\"%s;%s\"", getResetDbCmd(), getInstallLocalPkgCmd(fileList));
+               
+               try {                   
+                       sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+               } catch (SBIException e) {
+                       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));
+                               device.executeShellCommand(command, rec, MAX_TIMEOUT);                          
+                       } catch (Exception e1) {
+                               e1.printStackTrace();
+                       }
+               }       
+       }
+       
+       public static String getArchForFile(String filePath) {
+               String retStr = "";             
+               String result = HostUtil.returnExecute(getPkgFileInfoCmd(filePath));
+               
+               String[] splitResult = result.split("\n");
+               for (String r : splitResult) {
+                       if (r.trim().startsWith("Architecture")) {
+                               retStr = r.split(":")[1].trim();
+                               break;
+                       }
+               }
+               
+               return retStr;
+       }
+               
+       public static String getPkgNameForFile(String filePath) {
+               String retStr = "";
+               String result = HostUtil.returnExecute(getPkgFileInfoCmd(filePath));
+
+               String[] splitResult = result.split("\n");
+               for (String r : splitResult) {
+                       if (r.trim().startsWith("Name")) {
+                               retStr = r.split(":")[1].trim();
+                               break;
+                       }
+               }
+               
+               return retStr;
+       }
+       
+       public static String getPkgVerForFile(String filePath) {
+               String retStr = "";
+               String version = "";
+               String release = "";    
+               String result = HostUtil.returnExecute(getPkgFileInfoCmd(filePath));            
+               
+               String[] splitResult = result.split("\n");
+               for (String r : splitResult) {
+                       if (r.trim().startsWith("Version")) {
+                               version = r.split(":")[1].trim();                               
+                       } else if (r.trim().startsWith("Release")) {
+                               release = r.split(":")[1].trim();                               
+                       }
+               }
+               
+               retStr = version + "-" + release;               
+               return retStr;
+       }
+       
+       public static String getPkgInstalledVerForRootstrap(String pkgName, String targetID) {
+               String retStr = "";
+               String version = "";
+               String release = "";
+                               
+               if (!pkgInstalledSuccessfullyForRootstrap(pkgName, targetID)) {
+                       return retStr;
+               }       
+               
+               String result = null;
+               String options = String.format("-path=. -cmd=\"%s;%s\"", getResetDbCmd(), getShowPkgInfoCmd(pkgName));
+               
+               try {                   
+                       result = sbi.actionStdOut("command", options, targetID, null);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }       
+               
+               String[] splitResult = result.split("\n");
+               for (String r : splitResult) {
+                       if (r.trim().startsWith("Version")) {
+                               version = r.split(":")[1].trim();                               
+                       } else if (r.trim().startsWith("Release")) {
+                               release = r.split(":")[1].trim();                               
+                       }
+               }
+               
+               retStr = version + "-" + release;               
+               return retStr;
+       }
+       
+       public static String getPkgInstalledVerForDevice(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {             
+               String retStr = "";
+               String version = "";
+               String release = "";
+               
+               if (device != null) {
+                       if (!pkgInstalledSuccessfullyForDevice(pkgName, device, rec)) {
+                               return retStr;
+                       }
+                       
+                       try {                           
+                               String command = String.format("%s;%s", getResetDbCmd(), getShowPkgInfoCmd(pkgName));
+                               rec.cleanLog();
+                               device.executeShellCommand(command, rec, MAX_TIMEOUT);
+                               for (String l : rec.getLog()) {
+                                       if (l.trim().startsWith("Version")) {
+                                               version = l.split(":")[1].trim();                                               
+                                       } else if (l.trim().startsWith("Release")) {
+                                               release = l.split(":")[1].trim();                               
+                                       }
+                               }                                                       
+                               
+                       } catch (Exception e1) {
+                               e1.printStackTrace();
+                       }
+               }
+               
+               retStr = version + "-" + release;               
+               return retStr;
+       }
+       
+       public static boolean pkgInstalledSuccessfullyForRootstrap(String pkgName, String targetID) {
+               
+               boolean ret = false;            
+               String result = "";             
+               String options = String.format("-path=. -cmd=\"%s;%s\"", getResetDbCmd(), getShowPkgCmd(pkgName));
+               
+               try {                   
+                       result = sbi.actionStdOut("command", options, targetID, null);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }                               
+               
+               if (!result.isEmpty() && result.contains(pkgName)) {
+                       ret = true;
+               }
+                               
+               return ret;
+       }
+       
+       public static boolean pkgInstalledSuccessfullyForDevice(String pkgName, IDevice device, PackageManagerOuputReceiver rec) {              
+               
+               boolean ret = false;
+               
+               if (device != null) {
+                       try {
+                               String command = String.format("%s;%s", getResetDbCmd(), getShowPkgCmd(pkgName));
+                               device.executeShellCommand(command, rec, MAX_TIMEOUT);                          
+                       } catch (Exception e1) {
+                               e1.printStackTrace();
+                       }
+               }
+               
+               if (rec.getLog() == null) {
+                       return false;
+               }
+               
+               for (String l : rec.getLog()) {
+                       if (l.contains(pkgName)) {
+                               ret = true;
+                       }
+               }                       
+               
+               return ret;     
+       }
+       
+       public static String getRemotePackageListForRootstrap(String targetID) {
+                       
+               String result = "";             
+               
+               String options = String.format("-path=. -cmd=\"%s;%s;%s\"", getProxyCmd(), getResetDbCmd(), getRemotePkgListCmd());
+               
+               try {                   
+                       result = sbi.actionStdOut("command", options, targetID, null);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }               
+                               
+               return result;
+       }
+       
+       public static String getRemotePackageListForDevice(IDevice device, PackageManagerOuputReceiver rec) {
+               
+               String result = "";             
+               
+               try {                   
+                       String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRemotePkgListCmd());
+                       rec.cleanLog();
+                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }               
+               
+               for (String l : rec.getLog()) {
+                       result = result.concat(l + "\n");
+               }
+                               
+               return result;
+       }
+       
+       public static String getRepositoryListForRootstrap(String targetID) {
+               
+               String result = "";             
+               String options = String.format("-path=. -cmd=\"%s;%s\"", getResetDbCmd(), getRepoListCmd());
+               
+               try {                   
+                       result = sbi.actionStdOut("command", options, targetID, null);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }               
+                               
+               return result;
+       }
+       
+       public static String getRepositoryListForDevice(IDevice device, PackageManagerOuputReceiver rec) {
+               
+               String result = "";             
+               
+               try {                   
+                       String command = String.format("%s;%s", getResetDbCmd(), getRepoListCmd());
+                       rec.cleanLog();
+                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }               
+               
+               for (String l : rec.getLog()) {
+                       result = result.concat(l + "\n");
+               }
+                               
+               return result;          
+       }
+       
+       public static String refreshRepositoryForRootstrap(String targetID, OutputStream stdoutStream, OutputStream stderrStream) {
+               
+               String result = "";
+               String options = String.format("-path=. -cmd=\"%s;%s;%s\"", getProxyCmd(), getResetDbCmd(), getRefreshCmd());
+               
+               try {                   
+                       sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }               
+                               
+               return result;
+       }
+       
+       public static String refreshRepositoryForDevice(IDevice device, PackageManagerOuputReceiver rec) {
+               
+               String result = "";             
+               
+               try {                   
+                       String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getRefreshCmd());
+                       rec.cleanLog();
+                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }               
+               
+               for (String l : rec.getLog()) {
+                       result = result.concat(l + "\n");
+               }
+                               
+               return result;          
+       }
+       
+       public static String addRepositoryForRootstrap(String name, String uri, String targetID, OutputStream stdoutStream, OutputStream stderrStream) {
+               
+               String result = "";
+               String options = String.format("-path=. -cmd=\"%s;%s\"", getResetDbCmd(), getAddRepoCmd(uri, name));
+               
+               try {                   
+                       sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }               
+                               
+               return result;
+       }
+       
+       public static String addRepositoryForDevice(String name, String uri, IDevice device, PackageManagerOuputReceiver rec) {
+               
+               String result = "";             
+                               
+               try {                   
+                       String command = String.format("%s;%s", getResetDbCmd(), getAddRepoCmd(uri, name));
+                       rec.cleanLog();
+                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }               
+               
+               for (String l : rec.getLog()) {
+                       result = result.concat(l + "\n");
+               }
+                               
+               return result;          
+       }
+       
+       public static String removeRepositoryForRootstrap(String name, String targetID, OutputStream stdoutStream, OutputStream stderrStream) {
+               
+               String result = "";             
+               String options = String.format("-path=. -cmd=\"%s;%s\"", getResetDbCmd(), getRemoteRepoCmd(name));
+               
+               try {                   
+                       sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }               
+                               
+               return result;
+       }
+       
+       public static String removeRepositoryForDevice(String name, IDevice device, PackageManagerOuputReceiver rec) {
+               
+               String result = "";             
+               
+               try {                   
+                       String command = String.format("%s;%s", getResetDbCmd(), getRemoteRepoCmd(name));
+                       rec.cleanLog();
+                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }               
+               
+               for (String l : rec.getLog()) {
+                       result = result.concat(l + "\n");
+               }
+                               
+               return result;          
+       }
+       
+       public static String installRemotePkgForRootstrap(String pkgList, String targetID, OutputStream stdoutStream, OutputStream stderrStream) {
+               
+               String result = "";
+               String options = String.format("-path=. -cmd=\"%s;%s;%s\"", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(pkgList));
+               
+               try {                   
+                       sbi.actionStream("command", options, targetID, null, stdoutStream, stderrStream);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }               
+                               
+               return result;
+       }
+       
+       public static String installRemotePkgForDevice(String pkgList, IDevice device, PackageManagerOuputReceiver rec) {
+               
+               String result = "";             
+               
+               try {                   
+                       String command = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(), getInstallPkgCmd(pkgList));
+                       rec.cleanLog();
+                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }               
+               
+               for (String l : rec.getLog()) {
+                       result = result.concat(l + "\n");
+               }
+                               
+               return result;          
+       }
+       
+       public static void changeUpdateModeForDevice(IDevice device, PackageManagerOuputReceiver rec) {         
+               
+               try {                   
+                       String command = resources.getString("Command.Change.Updatemode");
+                       rec.cleanLog();
+                       device.executeShellCommand(command, rec, MAX_TIMEOUT);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }                       
+       }
+       
+       private static String getProxyCmd() {
+               return String.format(resources.getString("Command.Export.Proxy"), http_proxy);
+       }
+       
+       private static String getResetDbCmd() {
+               return String.format(resources.getString("Command.Reset.Db"));
+       }
+       
+       private static String getInstallPkgCmd(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 getRemoteRepoCmd(String name) {
+               return String.format(resources.getString("Command.Remove.Repo"), name);
+       }
+       
+       private static String getAddRepoCmd(String uri, String name) {
+               return String.format(resources.getString("Command.Add.Repo"), uri, name);
+       }
+       
+       private static String getRefreshCmd() {
+               return resources.getString("Command.Refresh.Repo");
+       }
+       
+       private static String getRepoListCmd() {
+               return resources.getString("Command.List.Repo");
+       }
+       
+       private static String getRemotePkgListCmd() {
+               return resources.getString("Command.List.Remote.Pkg");
+       }
+       
+       private static String getShowPkgCmd(String name) {
+               return String.format(resources.getString("Command.Show.Pkg"), name);
+       }
+       
+       private static String getShowPkgInfoCmd(String name) {
+               return String.format(resources.getString("Command.Show.Info.Pkg"), name);
+       }
+       
+       private static String getPkgFileInfoCmd(String name) {
+               return String.format(resources.getString("Command.Info.Pkg.File"), name);
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommands.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommands.properties
new file mode 100644 (file)
index 0000000..edd0597
--- /dev/null
@@ -0,0 +1,14 @@
+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
+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.List.Remote.Pkg = zypper pa
+Command.Show.Pkg = rpm -qa %s
+Command.Show.Info.Pkg = rpm -qi %s
+Command.Info.Pkg.File = rpm -qip %s
+Command.Change.Updatemode = /bin/change-booting-mode.sh --update
+
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPackage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPackage.java
new file mode 100644 (file)
index 0000000..5550054
--- /dev/null
@@ -0,0 +1,18 @@
+package org.tizen.nativeplatform.pkgmgr.model;
+
+public class LocalPackage extends Package {
+       
+       private String path = "";
+       
+       public LocalPackage() {
+               super();
+       }       
+       
+       public String getPath() {
+               return path;
+       }
+       
+       public void setPath(String path) {
+               this.path = path;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPkgProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPkgProvider.java
new file mode 100644 (file)
index 0000000..a3614af
--- /dev/null
@@ -0,0 +1,22 @@
+package org.tizen.nativeplatform.pkgmgr.model;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+public enum LocalPkgProvider {
+       INSTANCE;       
+       
+       private CopyOnWriteArrayList<LocalPackage> pkgs;
+       
+       private LocalPkgProvider()
+       {
+               pkgs = new CopyOnWriteArrayList <LocalPackage>();
+       }
+       
+       public void clear() {
+               pkgs.clear();
+       }
+       
+       public CopyOnWriteArrayList<LocalPackage> getPkgs()
+       {
+               return pkgs;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Package.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Package.java
new file mode 100644 (file)
index 0000000..6f148e6
--- /dev/null
@@ -0,0 +1,85 @@
+package org.tizen.nativeplatform.pkgmgr.model;
+
+public class Package {
+       public static enum INSTALLINFO
+       {
+               INSTALLED, NOT_INSTALLED, DIFFERENT_VERSION
+       }
+       
+       public static enum PKGTYPE
+       {
+               LOCAL, REMOTE
+       }
+
+       private String name = "";
+       private String arch = "";
+       private String newVersion = "";
+       private String installVersion = "";     
+       private boolean checkColumn = true;
+       private INSTALLINFO installInfo = INSTALLINFO.NOT_INSTALLED;    
+       private PKGTYPE pkgType = PKGTYPE.LOCAL;
+
+       public PKGTYPE getPkgType() 
+       {
+               return pkgType;
+       }
+       
+       public void setPkgType( PKGTYPE pkgType )
+       {
+               this.pkgType = pkgType;
+       }
+       
+       public void setArch(String arch) 
+       {
+               this.arch = arch;
+       }
+       
+       public String getArch()
+       {
+               return arch;
+       }       
+       
+       public INSTALLINFO getInstallInfo()
+       {
+               return installInfo;
+       }
+       
+       public void setInstallInfo( INSTALLINFO installInfo )
+       {
+               this.installInfo = installInfo;
+       }       
+       
+       public String getName() {
+               return name;
+       }
+       
+       public void setName(String name) {
+               this.name = name;
+       }
+               
+       public void setInstalledVersion(String ver) {
+               this.installVersion = ver;
+       }
+       
+       public String getInstalledVersion() {
+               return installVersion;
+       }
+
+       public void setNewVersion(String ver) {
+               this.newVersion = ver;
+       }
+       
+       public String getNewVersion() {
+               return newVersion;
+       }
+       
+       public boolean getCheckColumn()
+       {
+               return checkColumn;
+       }
+       
+       public void setCheckColumn( boolean check )
+       {
+               this.checkColumn = check;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/PackageProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/PackageProvider.java
new file mode 100644 (file)
index 0000000..ab62137
--- /dev/null
@@ -0,0 +1,31 @@
+package org.tizen.nativeplatform.pkgmgr.model;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public enum PackageProvider {
+       INSTANCE;
+       
+       private CopyOnWriteArrayList<Package> buildsystem_pkgs;
+       private CopyOnWriteArrayList<Package> device_pkgs;
+       
+       private PackageProvider()
+       {
+               buildsystem_pkgs = new CopyOnWriteArrayList <Package>();
+               device_pkgs = new CopyOnWriteArrayList <Package>();
+       }
+       
+       public void clear() {
+               buildsystem_pkgs.clear();
+               device_pkgs.clear();
+       }
+       
+       public CopyOnWriteArrayList<Package> getBuildsystemPkgs()
+       {
+               return buildsystem_pkgs;
+       }
+       
+       public CopyOnWriteArrayList<Package> getDevicePkgs()
+       {
+               return device_pkgs;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePackage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePackage.java
new file mode 100644 (file)
index 0000000..e0ea9e4
--- /dev/null
@@ -0,0 +1,31 @@
+package org.tizen.nativeplatform.pkgmgr.model;
+
+public class RemotePackage extends Package {
+       
+       private String repository = "";
+       private boolean checkGrayed = false;
+       
+       public RemotePackage() {
+               super();
+       }
+       
+       public void setRepo(String repository)
+       {
+               this.repository = repository;
+       }
+       
+       public String getRepo()
+       {
+               return repository;
+       }
+       
+       public boolean getCheckGrayed()
+       {
+               return checkGrayed;
+       }
+       
+       public void setCheckGrayed( boolean check )
+       {
+               this.checkGrayed = check;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePkgProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePkgProvider.java
new file mode 100644 (file)
index 0000000..ffb8ba3
--- /dev/null
@@ -0,0 +1,30 @@
+package org.tizen.nativeplatform.pkgmgr.model;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+public enum RemotePkgProvider {
+       INSTANCE;       
+       
+       private CopyOnWriteArrayList<RemotePackage> pkgs;
+       private CopyOnWriteArrayList<RemotePackage> selected_pkgs;
+       
+       private RemotePkgProvider()
+       {
+               pkgs = new CopyOnWriteArrayList <RemotePackage>();              
+               selected_pkgs = new CopyOnWriteArrayList <RemotePackage>();
+       }       
+       
+       public void clear() {
+               pkgs.clear();
+               selected_pkgs.clear();
+       }
+       
+       public CopyOnWriteArrayList<RemotePackage> getPkgs()
+       {
+               return pkgs;
+       }
+       
+       public CopyOnWriteArrayList<RemotePackage> getSelectedPkgs()
+       {
+               return selected_pkgs;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Repository.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Repository.java
new file mode 100644 (file)
index 0000000..1f73604
--- /dev/null
@@ -0,0 +1,48 @@
+package org.tizen.nativeplatform.pkgmgr.model;
+
+public class Repository {
+       private String name = "";
+       private String uri = "";
+       private boolean dirty = false;
+       private boolean checkColumn = false;
+               
+       public String getName()
+       {
+               return name;
+       }
+       
+       public void setName(String name) 
+       {
+               this.name = name;
+       }
+       
+       public String getUri()
+       {
+               return uri;
+       }
+       
+       public void setUri(String uri) 
+       {
+               this.uri = uri;
+       }
+       
+       public boolean getCheckColumn()
+       {
+               return checkColumn;
+       }
+       
+       public void setCheckColumn( boolean check )
+       {
+               this.checkColumn = check;
+       }
+       
+       public boolean getCheckDirty()
+       {
+               return dirty;
+       }
+       
+       public void setCheckDirty( boolean check )
+       {
+               this.dirty = check;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RepositoryProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RepositoryProvider.java
new file mode 100644 (file)
index 0000000..5edc939
--- /dev/null
@@ -0,0 +1,33 @@
+package org.tizen.nativeplatform.pkgmgr.model;
+
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public enum RepositoryProvider {
+
+               INSTANCE;
+                       
+               private CopyOnWriteArrayList<Repository> buildsystem_repos;
+               private CopyOnWriteArrayList<Repository> device_repos;
+               
+               private RepositoryProvider()
+               {
+                       buildsystem_repos = new CopyOnWriteArrayList <Repository>();
+                       device_repos = new CopyOnWriteArrayList <Repository>();
+               }
+               
+               public void clear()
+               {
+                       buildsystem_repos.clear();
+                       device_repos.clear();
+               }
+               
+               public CopyOnWriteArrayList<Repository> getBuildsystemRepos()
+               {
+                       return buildsystem_repos;
+               }
+               
+               public CopyOnWriteArrayList<Repository> getDeviceRepos()
+               {
+                       return device_repos;
+               }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRemotePackageDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRemotePackageDialog.java
new file mode 100644 (file)
index 0000000..e019b7f
--- /dev/null
@@ -0,0 +1,274 @@
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.swt.graphics.Color;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+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.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+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.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePackage;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
+
+public class AddRemotePackageDialog extends Dialog {   
+       
+       private TableViewer packageViewer;
+       private int selectedColumn = 0;
+       private Display disp = null;
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 800;
+       private final int height = 800;
+       
+       private final String BUNDLE_NAME = AddRemotePackageDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       protected AddRemotePackageDialog(Shell parentShell) {           
+               super(parentShell);
+               
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+        this.disp = parentShell.getDisplay();
+       }       
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);
+               
+               newShell.setText(resources.getString("AddRemotePkg.Title"));
+               newShell.setLocation(x, y);
+               newShell.setSize(width, height);
+       }
+       
+       @Override
+       protected Control createDialogArea(Composite parent) {          
+               
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(1, false));  
+               
+               createTable(composite);         
+               return null;
+       }
+       
+       private void createTable( Composite parent ) 
+       {       
+               
+               Composite bottom = new Composite( parent, SWT.NONE );
+               bottom.setLayoutData(new GridData(GridData.FILL_BOTH));
+               bottom.setLayout(new GridLayout(1, false));
+               
+               Composite b2 = new Composite( bottom, SWT.NONE );
+               b2.setLayoutData(new GridData(GridData.FILL_BOTH));
+               b2.setLayout(new FillLayout());
+        
+               packageViewer = new TableViewer( b2, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK);             
+        createColumns();
+               Table table = packageViewer.getTable();         
+               table.addListener( SWT.Selection, new Listener(){
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               if( event.detail == SWT.CHECK ) {                                       
+                                       RemotePackage pkg = (RemotePackage)event.item.getData();
+                                       pkg.setCheckColumn( !pkg.getCheckColumn() );                                    
+                               }
+                       }                       
+               });
+
+               table.setHeaderVisible(true);
+               table.setLinesVisible(true);            
+               
+               packageViewer.setContentProvider(new ArrayContentProvider());   
+               packageViewer.setInput(RemotePkgProvider.INSTANCE.getPkgs());           
+               
+               updateCheck();          
+       }
+       
+       private void createColumns()
+       {
+               String[] titles = {"Package Name", "Repository", "Arch", "Version", "Status"};
+               int[] bounds = { 250, 120, 60, 150, 160};
+               
+               TableViewerColumn colPackage = createTableViewerColumn( titles[0], bounds[0], SWT.NONE);
+               
+               colPackage.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               return pkg.getName();
+                       }                       
+               });             
+               
+               TableViewerColumn colInstallType = createTableViewerColumn( titles[1], bounds[1], SWT.NONE);
+               
+               colInstallType.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               RemotePackage pkg = (RemotePackage)element;                                                             
+                               return pkg.getRepo();
+                       }
+               });
+               
+               TableViewerColumn colArch = createTableViewerColumn( titles[2], bounds[2], SWT.NONE);
+               
+               colArch.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               RemotePackage pkg = (RemotePackage)element;
+                               String arch = "";
+                               arch = pkg.getArch();                           
+                               return arch;            
+                       }                       
+               });
+       
+               TableViewerColumn colNewVer = createTableViewerColumn( titles[3], bounds[3], SWT.NONE);
+               
+               colNewVer.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               RemotePackage pkg = (RemotePackage)element;
+                               String newVer = "";
+                               newVer = pkg.getNewVersion();                   
+                               return newVer;                          
+                       }
+               });
+
+               TableViewerColumn colStatus = createTableViewerColumn( titles[4], bounds[4], SWT.NONE);
+               
+               colStatus.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               RemotePackage pkg = (RemotePackage)element;
+                               String status = "";
+                               status = pkg.getInstallInfo().toString();                               
+                               return status;
+                       }
+               });             
+       }
+               
+       private TableViewerColumn createTableViewerColumn( String title, int bound, int Style) {
+               
+               final TableViewerColumn viewerColumn = new TableViewerColumn( packageViewer, Style);
+               final TableColumn column = viewerColumn.getColumn();
+               column.addSelectionListener(new TableSelectionAdapter());
+               column.setText(title);
+               column.setWidth(bound);
+               column.setResizable(true);
+               column.setMoveable(true);
+               return viewerColumn;
+       }
+       
+       @Override
+       protected void okPressed() {
+               
+               for(RemotePackage p : RemotePkgProvider.INSTANCE.getPkgs()) {
+                       if (p.getCheckColumn() && !Package.INSTALLINFO.INSTALLED.equals(p.getInstallInfo())) {
+                               RemotePkgProvider.INSTANCE.getSelectedPkgs().add(p);
+                       }
+               }               
+               
+               super.okPressed();
+       }
+       
+       private class TableSelectionAdapter extends SelectionAdapter
+       {
+               public void widgetSelected(SelectionEvent e) {                          
+                       selectedColumn = packageViewer.getTable().indexOf((TableColumn) e.widget);
+                       packageViewer.getTable().setSortColumn((TableColumn)e.widget);
+                       if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {                                          
+                               packageViewer.getTable().setSortDirection(SWT.UP);
+                       } else {
+                               packageViewer.getTable().setSortDirection(SWT.DOWN);
+                       }                       
+                       
+                       packageViewer.setSorter(new ViewerSorter() {
+                               public int compare(Viewer viewer, Object e1, Object e2) {
+                                       int result = 0;
+                                       
+                                       RemotePackage entry_1 = (RemotePackage)e1;
+                                       RemotePackage entry_2 = (RemotePackage)e2;
+                                       
+                                       switch (selectedColumn) {
+                                               case 0:                                                                 
+                                                       if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+                                                               result = entry_1.getName().compareTo(entry_2.getName());
+                                                       } else {
+                                                               result = entry_2.getName().compareTo(entry_1.getName());
+                                                       }
+                                                       break;
+                                               case 1:
+                                                       if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+                                                               result = entry_1.getRepo().compareTo(entry_2.getRepo());
+                                                       } else {
+                                                               result = entry_2.getRepo().compareTo(entry_1.getRepo());
+                                                       }
+                                                       break;
+                                               case 2:                                                 
+                                                       if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+                                                               result = entry_1.getArch().compareTo(entry_2.getArch());
+                                                       } else {
+                                                               result = entry_2.getArch().compareTo(entry_1.getArch());
+                                                       }
+                                                       break;
+                                               case 3:                                                 
+                                                       if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+                                                               result = entry_1.getNewVersion().compareTo(entry_2.getNewVersion());
+                                                       } else {
+                                                               result = entry_2.getNewVersion().compareTo(entry_1.getNewVersion());
+                                                       }
+                                                       break;
+                                               case 4:                                                 
+                                                       if (packageViewer.getTable().getSortDirection() == SWT.DOWN) {
+                                                               result = entry_1.getInstallInfo().toString().compareTo(entry_2.getInstallInfo().toString());
+                                                       } else {
+                                                               result = entry_2.getInstallInfo().toString().compareTo(entry_1.getInstallInfo().toString());
+                                                       }
+                                                       break;
+                                       }                                       
+                                       
+                                       return result;
+                               }
+                       });
+                       updateCheck();
+               }
+       }
+       
+       private void updateCheck() {            
+               int recentTableIndex = packageViewer.getTable().getItemCount();
+               Color gray = disp.getSystemColor(SWT.COLOR_LIST_SELECTION);
+               
+               for (int i = 0; i < recentTableIndex; i++) {
+                       TableItem item = packageViewer.getTable().getItem(i);                   
+                       RemotePackage pkg = (RemotePackage)item.getData();
+                       item.setChecked(pkg.getCheckColumn());
+                       if (Package.INSTALLINFO.INSTALLED.equals(pkg.getInstallInfo())) {
+                               item.setBackground(gray);
+                       }
+               }       
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRepoDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRepoDialog.java
new file mode 100644 (file)
index 0000000..a8906eb
--- /dev/null
@@ -0,0 +1,94 @@
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+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 AddRepoDialog extends Dialog {
+       
+       private Text nameText;
+       private Text uriText;
+       private String tab;
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 500;
+       private final int height = 200;
+       
+       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);         
+               
+               newShell.setText(resources.getString("AddRepo.Title"));         
+               newShell.setLocation(x, y);
+               newShell.setSize(width, height);
+       }
+       
+       @Override
+       protected Control createDialogArea(Composite parent) {          
+               
+               Composite composite = new Composite( parent, SWT.NONE);
+               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 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.widthHint = 500;
+        uriText.setLayoutData(gridData);               
+                               
+               return null;
+       }       
+       
+       @Override
+       protected void okPressed() {
+               
+               Repository repo = new Repository();             
+               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);
+               }
+                               
+               super.okPressed();
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildSystemTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildSystemTab.java
new file mode 100644 (file)
index 0000000..a65127b
--- /dev/null
@@ -0,0 +1,832 @@
+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.ResourceBundle;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+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.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+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.ui.console.MessageConsoleStream;
+
+import org.tizen.common.console.ConsoleManager;
+import org.tizen.nativecommon.build.CheckCancelJob;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+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;
+
+public class BuildSystemTab {
+       
+       private TabFolder folder = null;
+       private String conf = null;
+       private String target = null;
+       private TableViewer repoViewer = null;
+       private TableViewer pkgViewer = null;
+       private Shell shell;
+       private FileDialog fd;  
+       private String previousFilterPath = null;
+       private String selectedFileList;
+       private CopyOnWriteArrayList<Package> pkgs;
+       private SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+       
+       private final String BUNDLE_NAME = BuildSystemTab.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       public BuildSystemTab(Shell shell, TabFolder folder, String conf, String target) {
+               this.shell = shell;
+               this.folder = folder;
+               this.conf = conf;
+               this.target = target;
+       }
+       
+       public void createTab() {
+               initialize();
+               createBuildsystemTab(folder);           
+       }
+       
+       private void initialize() {
+               RepositoryProvider.INSTANCE.getBuildsystemRepos().clear();
+               PackageProvider.INSTANCE.getBuildsystemPkgs().clear();
+               
+               String result = RPMPackageCommander.getRepositoryListForRootstrap(target);
+               String[] splitStr = result.split("\n");
+               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);            
+               }
+       }
+       
+       private void createBuildsystemTab( TabFolder parent )
+       {
+               TabItem buildsystemTab = new TabItem( parent, SWT.NULL );
+               buildsystemTab.setText(resources.getString("PkgMgr.Tab.Buildsystem"));          
+
+               Composite composite = new Composite(folder, SWT.NONE);
+               buildsystemTab.setControl(composite);
+        composite.setLayout(new GridLayout(1, false));
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               
+               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);
+        grpRepo.setLayoutData(repo_gd);
+        
+        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 );
+       }
+       
+       private void createPackageGroup( 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 );
+       }
+       
+       private void createRepositoryTable( 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(){
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               if( event.detail == SWT.CHECK )
+                               {
+                                       Repository repo = (Repository)event.item.getData();
+                                       repo.setCheckColumn( !repo.getCheckColumn() );
+                               }
+                       }                       
+               });
+               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 );
+               add_bt.setText(resources.getString("PkgMgr.Button.AddRepo"));
+               add_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               
+                               AddRepoDialog dialog = new AddRepoDialog(shell, resources.getString("PkgMgr.Tab.Buildsystem"));
+                               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()) {
+                                               ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+                                               cm.clear();
+                                               MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
+                                               MessageConsoleStream mcs = cm.getMessageConsoleStream(false);                   
+                                               RPMPackageCommander.addRepositoryForRootstrap(repo.getName(), repo.getUri(), target, mcs, mcsError);
+                                               repo.setCheckDirty(false);
+                                       }
+                               }
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        
+        });
+               
+               Button remove_bt = new Button( parent, SWT.PUSH );
+               remove_bt.setText(resources.getString("PkgMgr.Button.RemoveRepo"));                             
+               remove_bt.addMouseListener(new MouseListener() {                
+               
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+       
+                       @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);
+                                               ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+                                               cm.clear();
+                                               MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
+                                               MessageConsoleStream mcs = cm.getMessageConsoleStream(false);
+                                               RPMPackageCommander.removeRepositoryForRootstrap(repo.getName(), target, mcs, mcsError);                                
+                                       }
+                               }
+                               
+                               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) {
+                       }
+               });
+               
+               Button refresh_bt = new Button( parent, SWT.PUSH );
+               refresh_bt.setText(resources.getString("PkgMgr.Button.RefreshRepo"));
+               refresh_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @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.Refreshing"), -1);                                
+                                                       ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+                                                       cm.clear();
+                                                       MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
+                                                       MessageConsoleStream mcs = cm.getMessageConsoleStream(false);
+                                                       RPMPackageCommander.refreshRepositoryForRootstrap(target, mcs, mcsError);
+                                               }
+                                       });
+                               } catch (Exception e1) {
+                                       // TODO Auto-generated catch block
+                                       e1.printStackTrace();
+                               }                                                               
+                       }
+
+                       @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.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @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();                             
+                               
+                               for (RemotePackage p : RemotePkgProvider.INSTANCE.getSelectedPkgs()) {
+                                       addRemotePackage(p);
+                               }
+
+                               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());                                                          
+                               }
+                       }
+
+                       @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.addMouseListener(new MouseListener()
+        {
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                                                               
+                               int oldTableIndex = pkgViewer.getTable().getItemCount();                                 
+
+                               fd = new FileDialog( shell, SWT.OPEN|SWT.MULTI);
+                       fd.setText("Select deb file...");
+                       if (previousFilterPath == null) 
+                               fd.setFilterPath(null);
+                       else
+                               fd.setFilterPath(previousFilterPath); 
+                       String[] filterExt = { "*.rpm" };
+                       fd.setFilterExtensions(filterExt);
+                       
+                       try {
+                                       String rootstrapPath = sbi.getRootstrapPath(target);
+                                       fd.setFilterPath(rootstrapPath);
+                               } catch (SBIException e2) {                             
+                                       e2.printStackTrace();
+                               }
+                       
+                       selectedFileList = fd.open();
+                       
+                       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());                       
+                                                       }                                                       
+                                               }
+                                               }
+                                       });
+                               } 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());                                  
+                               }
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+               
+        });    
+               
+               Button remove_bt = new Button( parent, SWT.PUSH );
+        remove_bt.setText(resources.getString("PkgMgr.Button.RemoveList"));        
+        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) {
+               }               
+       });
+        
+               
+               Button install_bt = new Button( parent, SWT.PUSH );
+               install_bt.setText(resources.getString("PkgMgr.Button.Install"));
+               install_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @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);                                
+                               
+                               try {
+                                       dialog.run(true, true, new IRunnableWithProgress() {
+                                               @Override
+                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                                               InterruptedException {
+                                                       monitor.beginTask(resources.getString("PkgMgr.Message.Installing.Package"), -1);
+                                                       
+                                                       CheckCancelJob cancelJob = new CheckCancelJob(monitor);
+                                                       Thread checkCancelThread = new Thread(cancelJob);
+                                                       checkCancelThread.start();
+                               
+                                                       try {
+                                                               String rpmPathList = "";
+                                                               String localPkgList = "";
+                                                               String remotePkgList = "";
+                                                               String rootstrapPath = sbi.getRootstrapPath(target);
+                                                               String filePath = null;
+                                                               
+                                                               ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+                                                               cm.clear();
+                                                               MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
+                                                               MessageConsoleStream mcs = cm.getMessageConsoleStream(false);
+                                                               MessageConsoleStream mcsError1 = cm.getMessageConsoleStream(true);
+                                                               MessageConsoleStream mcs1 = cm.getMessageConsoleStream(false);                                                          
+                                                               MessageConsoleStream mcsError2 = cm.getMessageConsoleStream(true);
+                                                               MessageConsoleStream mcs2 = cm.getMessageConsoleStream(false);                                                          
+                                                               
+                                                               for (Package pkg : pkgs) {
+                                                                       if (pkg instanceof LocalPackage) {
+                                                                               LocalPackage p = (LocalPackage)pkg;
+                                                                               filePath = p.getPath().replaceAll(rootstrapPath, "");
+                                                                               rpmPathList = rpmPathList.concat(filePath + " ");
+                                                                               localPkgList = localPkgList.concat(pkg.getName() + " ");
+                                                                       } else if (pkg instanceof RemotePackage) {
+                                                                               remotePkgList = remotePkgList.concat(pkg.getName() + " ");
+                                                                       }
+                                                               }                                                               
+                                                               
+                                                               if(!"".equals(remotePkgList)) {                                                         
+                                                                       monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), remotePkgList));
+                                                                       mcs1.write(resources.getString("PkgMgr.Console.Remote.Install"));
+                                                                       RPMPackageCommander.installRemotePkgForRootstrap(remotePkgList, target, mcs, mcsError);                                                                 
+                                                               }                                                               
+                                                               
+                                                               if(!cancelJob.getTerminateChecker() && !"".equals(localPkgList)) {                                                                      
+                                                                       monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), localPkgList));
+                                                                       mcs1.write(resources.getString("PkgMgr.Console.Local.Install"));                                                
+                                                                       RPMPackageCommander.InstallPkgToRootstrap(target, rpmPathList, mcs2, mcsError2);                                                                        
+                                                               }
+                               
+                                                               for (Package pkg : pkgs) {
+                                                                       String installedVer = RPMPackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), target);                                                                        
+                                                                       pkg.setInstalledVersion(installedVer);                                                                          
+                                                                       if ("".equals(installedVer)) {
+                                                                               pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
+                                                                       } else if (installedVer.equals(pkg.getNewVersion())) {
+                                                                               if (RPMPackageCommander.pkgInstalledSuccessfullyForRootstrap(pkg.getName(), target)) {
+                                                                                       pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+                                                                               } else {
+                                                                                       pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
+                                                                               }
+                                                                       } else {
+                                                                               pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+                                                                       }
+                                                               }
+
+                                                       } catch (IOException e) {
+                                                               e.printStackTrace();
+                                                       } catch (SBIException e) {
+                                                               e.printStackTrace();
+                                                       }                                                       
+
+                                                       cancelJob.setFinishFlag(true);
+                                                       monitor.done();
+                                               }
+                                       });                                     
+                               } catch (Exception e1) {
+                                       // TODO Auto-generated catch block
+                                       e1.printStackTrace();
+                               }               
+                               
+                               pkgViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        
+        });
+       }
+       
+       private void createColumnsForRepoTable( Composite parent )
+       {
+               String[] titles = {"Name", "Reposity URL"};
+               int[] bounds = { 200, 600 };
+               
+               TableViewerColumn colInstallType = createTableViewerColumn( repoViewer, titles[0], bounds[0], SWT.NONE);
+               
+               colInstallType.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Repository repo = (Repository)element;                                                          
+                               return repo.getName();
+                       }
+               });
+               
+               TableViewerColumn colPackage = createTableViewerColumn( repoViewer, titles[1], bounds[1], SWT.NONE);
+               
+               colPackage.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Repository repo = (Repository)element;
+                               return repo.getUri();
+                       }                       
+               });
+       }
+       
+       private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, int Style) {
+               
+               final TableViewerColumn viewerColumn = new TableViewerColumn( viewer,   Style);
+               final TableColumn column = viewerColumn.getColumn();
+               column.setText(title);
+               column.setWidth(bound);
+               column.setResizable(true);
+               column.setMoveable(true);
+               return viewerColumn;
+       }
+       
+       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};
+               
+               TableViewerColumn colInstallType = createTableViewerColumn( pkgViewer, titles[0], bounds[0], SWT.NONE);
+               
+               colInstallType.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;                                                         
+                               return pkg.getPkgType().toString();
+                       }
+               });
+               
+               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();
+                       }                       
+               });             
+               
+               TableViewerColumn colArch = createTableViewerColumn( pkgViewer, titles[2], bounds[2], SWT.NONE);
+               
+               colArch.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String arch = pkg.getArch();
+                               return arch;            
+                       }                       
+               });
+       
+               TableViewerColumn colNewVer = createTableViewerColumn( pkgViewer, titles[3], bounds[3], SWT.NONE);
+               
+               colNewVer.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String newVer = pkg.getNewVersion();                            
+                               return newVer;                          
+                       }
+               });
+               
+               TableViewerColumn colInsVer = createTableViewerColumn( pkgViewer, titles[4], bounds[4], SWT.NONE);
+               colInsVer.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String installedVer = pkg.getInstalledVersion();                                
+                               return installedVer;
+                       }
+               });     
+
+               TableViewerColumn colStatus = createTableViewerColumn( pkgViewer, titles[5], bounds[5], SWT.NONE);
+               
+               colStatus.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String status = pkg.getInstallInfo().toString();                                                                
+                               return status;
+                       }
+               });             
+       }
+       
+       private void genRemotePkgList() {
+
+               String list = RPMPackageCommander.getRemotePackageListForRootstrap(target);             
+               String[] splitStr = list.split("\n");
+               
+               for (int i = 4 ; 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(), target);
+               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(), target);    
+               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, target)) {
+                                       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;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java
new file mode 100644 (file)
index 0000000..2b79d59
--- /dev/null
@@ -0,0 +1,889 @@
+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.ResourceBundle;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+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.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+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.ui.console.MessageConsoleStream;
+
+import org.tizen.common.console.ConsoleManager;
+import org.tizen.nativecommon.build.CheckCancelJob;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+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.sdblib.IDevice;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.SyncResult;
+
+public class DeviceTab {
+       
+       private TabFolder folder = null;
+       private String targetId = null;
+       private TableViewer repoViewer = null;
+       private TableViewer pkgViewer = null;
+       private Shell shell;
+       private FileDialog fd;  
+       private String previousFilterPath = null;
+       private String selectedFileList;
+       private IDevice device;
+       private CopyOnWriteArrayList<Package> pkgs;     
+       private SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+       
+       private final String TMP_PATH= "/tmp";
+       private final String BUNDLE_NAME = DeviceTab.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       public DeviceTab(Shell shell, TabFolder folder, String targetId, IDevice dev) {
+               this.shell = shell;
+               this.folder = folder;           
+               this.targetId = targetId;
+               this.device = dev;              
+       }
+       
+       public void createTab() {
+               initialize();
+               createDeivceTab(folder);                
+       }
+       
+       private void initialize() {
+               RepositoryProvider.INSTANCE.getDeviceRepos().clear();
+               PackageProvider.INSTANCE.getDevicePkgs().clear();               
+               
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();                
+               String result = RPMPackageCommander.getRepositoryListForDevice(device, rec);
+               String[] splitStr = result.split("\n");
+               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.getDeviceRepos().add(repo);
+               }
+       }
+       
+       private void createDeivceTab( TabFolder parent )
+       {
+               TabItem deviceTab = new TabItem( parent, SWT.NULL );
+               deviceTab.setText(resources.getString("PkgMgr.Tab.Device"));            
+
+               Composite composite = new Composite(folder, SWT.NONE);
+               deviceTab.setControl(composite);
+        composite.setLayout(new GridLayout(1, false));
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               
+               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.Connection"), device.getSerialNumber()));           
+       }
+       
+       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);
+        grpRepo.setLayoutData(repo_gd);
+        
+        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 );
+       }
+       
+       private void createPackageGroup( 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 );
+       }
+       
+       private void createRepositoryTable( Composite parent) 
+       {
+               // Build System Tab             
+               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(){
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               if( event.detail == SWT.CHECK )
+                               {
+                                       Repository repo = (Repository)event.item.getData();
+                                       repo.setCheckColumn( !repo.getCheckColumn() );
+                               }
+                       }                       
+               });
+               tableForRepository.setHeaderVisible(true);
+               tableForRepository.setLinesVisible(true);                       
+               repoViewer.setContentProvider(new ArrayContentProvider());      
+               repoViewer.setInput(RepositoryProvider.INSTANCE.getDeviceRepos());                      
+       }
+       
+       private void createRepositoryButtons( Composite parent )
+       {                               
+               Button add_bt = new Button( parent, SWT.PUSH );
+               add_bt.setText(resources.getString("PkgMgr.Button.AddRepo"));
+               add_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               
+                               AddRepoDialog dialog = new AddRepoDialog(shell, resources.getString("PkgMgr.Tab.Device"));
+                               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()) {                                             
+                                               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+                                               RPMPackageCommander.addRepositoryForDevice(repo.getName(), repo.getUri(), device, rec);
+                                               repo.setCheckDirty(false);
+                                       }
+                               }
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        
+        });
+               
+               Button remove_bt = new Button( parent, SWT.PUSH );
+               remove_bt.setText(resources.getString("PkgMgr.Button.RemoveRepo"));                     
+               remove_bt.addMouseListener(new MouseListener() {                
+               
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+       
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               CopyOnWriteArrayList<Repository> list = RepositoryProvider.INSTANCE.getDeviceRepos();
+                                       
+                               for( Repository repo : list)
+                               {
+                                       boolean selected = false;
+                                       selected = repo.getCheckColumn();
+                                       
+                                       if (selected) {
+                                               list.remove(repo);
+                                               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+                                               RPMPackageCommander.removeRepositoryForDevice(repo.getName(), device, rec);
+                                       }
+                               }
+                               
+                               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) {
+                       }
+               });
+               
+               Button refresh_bt = new Button( parent, SWT.PUSH );
+               refresh_bt.setText(resources.getString("PkgMgr.Button.RefreshRepo"));
+               refresh_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @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.Refreshing"), -1);                                
+                                                       PackageManagerOuputReceiver rec = getNewOuputReceiver();
+                                                       RPMPackageCommander.refreshRepositoryForDevice(device, rec);
+                                               }
+                                       });
+                               } catch (Exception e1) {
+                                       // TODO Auto-generated catch block
+                                       e1.printStackTrace();
+                               }
+                       }
+
+                       @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.getDevicePkgs());
+       }
+       
+       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.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @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();                             
+                               
+                               for (RemotePackage p : RemotePkgProvider.INSTANCE.getSelectedPkgs()) {
+                                       addRemotePackage(p);
+                               }
+
+                               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());                                                          
+                               }
+                       }
+
+                       @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.addMouseListener(new MouseListener()
+        {
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                                                               
+                               int oldTableIndex = pkgViewer.getTable().getItemCount();                                 
+
+                               fd = new FileDialog( shell, SWT.OPEN|SWT.MULTI);
+                       fd.setText("Select deb file...");
+                       if (previousFilterPath == null) 
+                               fd.setFilterPath(null);
+                       else
+                               fd.setFilterPath(previousFilterPath); 
+                       String[] filterExt = { "*.rpm" };
+                       fd.setFilterExtensions(filterExt);
+                       
+                       try {
+                                       String rootstrapPath = sbi.getRootstrapPath(targetId);
+                                       fd.setFilterPath(rootstrapPath);
+                               } catch (SBIException e2) {                             
+                                       e2.printStackTrace();
+                               }
+                       
+                       selectedFileList = fd.open();
+                       
+                       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());                       
+                                                       }                                                       
+                                               }
+                                               }
+                                       });
+                               } catch (Exception e1) {
+                                       e1.printStackTrace();
+                               }
+                               
+                               pkgViewer.refresh();                            
+                               
+                               int recentTableIndex = pkgViewer.getTable().getItemCount();
+                               
+                               for (int i = oldTableIndex; 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) {
+                       }
+               
+        });
+               
+               Button remove_bt = new Button( parent, SWT.PUSH );
+        remove_bt.setText(resources.getString("PkgMgr.Button.RemoveList"));        
+        remove_bt.addMouseListener(new MouseListener() {
+
+               @Override
+               public void mouseDoubleClick(MouseEvent e) {
+               }
+
+               @Override
+               public void mouseDown(MouseEvent e) {
+                       CopyOnWriteArrayList<Package> pkgList = PackageProvider.INSTANCE.getDevicePkgs();
+                       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) {
+               }               
+       });
+               
+               Button install_bt = new Button( parent, SWT.PUSH );
+               install_bt.setText(resources.getString("PkgMgr.Button.Install"));
+               install_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               
+                               pkgs = getSelectedPkg(PackageProvider.INSTANCE.getDevicePkgs());
+                               
+                               if(pkgs.isEmpty()) {
+                                       MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Noselected.Package"));
+                                       return;
+                               }
+                               
+                               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.Installing.Package"), -1);
+                                                       
+                                                       CheckCancelJob cancelJob = new CheckCancelJob(monitor);
+                                                       Thread checkCancelThread = new Thread(cancelJob);
+                                                       checkCancelThread.start();
+                               
+                                                       try {                                                   
+                                                               String newPath = null;
+                                                               ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+                                                               cm.clear();
+                                                               MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
+                                                               MessageConsoleStream mcs = cm.getMessageConsoleStream(false);
+                                                               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
+                                                               rec.setMessageConsoleStream(mcs);                                                               
+                                                               String localPkgList = "";
+                                                               String remotePkgList = "";
+                                                               
+                                                               // Step 1: transfer pkg and make pkg list
+                                                               for (Package pkg : pkgs)
+                                                               {
+                                                                       if (pkg instanceof LocalPackage) {      
+                                                                               LocalPackage p = (LocalPackage)pkg;
+                                                                               String file = new File(p.getPath()).getName();
+                                                                               newPath = TMP_PATH + "/" + file;
+                                                                               monitor.subTask(String.format(resources.getString("PkgMgr.Message.Transfer.File"), p.getPath(), newPath));
+                                                                               if (monitor.isCanceled()) {
+                                                                                       throw new OperationCanceledException();
+                                                                               }
+                                                                               SyncService syncService = device.getSyncService();
+                                                                               SyncResult syncResult = syncService.pushFile(p.getPath(), newPath, SyncService.getNullProgressMonitor());
+                                                                               if (syncResult.getCode() != SyncService.RESULT_OK) {
+                                                                                       mcsError.println(String.format(resources.getString("PkgMgr.Error.Failtransfer.File"), p.getPath(), newPath));
+                                                                                       p.setInstallInfo( Package.INSTALLINFO.NOT_INSTALLED);
+                                                                                       continue;
+                                                                               }
+                                                                               if (monitor.isCanceled()) {
+                                                                                       throw new OperationCanceledException();
+                                                                               }
+                                                                               if (localPkgList == "") {
+                                                                                       localPkgList = newPath;
+                                                                               } else {
+                                                                                       localPkgList = localPkgList + " " + newPath;
+                                                                               }
+
+                                                                       } else if (pkg instanceof RemotePackage) {
+                                                                               if (remotePkgList == "") {
+                                                                                       remotePkgList = pkg.getName();
+                                                                               } else {
+                                                                                       remotePkgList = remotePkgList + " " + pkg.getName();
+                                                                               }
+                                                                       }
+                                                               }
+                                                               
+                                                               
+                                                               // Step 2: set update mode on device
+                                                               if (!device.isEmulator()) {                                                                     
+                                                                       RPMPackageCommander.changeUpdateModeForDevice(device, rec);
+                                                               }                                                               
+
+                                                               if (remotePkgList != "") {
+                                                                       monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), remotePkgList));
+                                                                       RPMPackageCommander.installRemotePkgForDevice(remotePkgList, device, rec);
+                                                               }
+                                                               
+                                                               if (monitor.isCanceled()) {
+                                                                       throw new OperationCanceledException();
+                                                               }                                                               
+
+                                                               if (localPkgList != "") {
+                                                                       monitor.subTask(String.format("%s %s", resources.getString("PkgMgr.Message.Installing.Package"), localPkgList));                                                                        
+                                                                       RPMPackageCommander.InstallPkgToDevice(localPkgList, device, rec);
+                                                               }
+                                                               
+                                                               if (monitor.isCanceled())
+                                                                       throw new OperationCanceledException();
+                                                               
+                                                               Thread.sleep(500);
+                                                               
+                                                               for (Package pkg : pkgs) {
+                                                                       if (monitor.isCanceled()) {
+                                                                               throw new OperationCanceledException();
+                                                                       }
+                                                                       // update status
+                                                                       rec.setPrintConsole(false);
+                                                                       String installedVer = RPMPackageCommander.getPkgInstalledVerForDevice(pkg.getName(), device, rec);
+                                                                       pkg.setInstalledVersion(installedVer);                  
+                                                                       
+                                                                       if ("".equals(installedVer)) {
+                                                                               pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
+                                                                       } else if (installedVer.equals(pkg.getNewVersion())) {
+                                                                               if (RPMPackageCommander.pkgInstalledSuccessfullyForDevice(pkg.getName(), device, rec)) {
+                                                                                       pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+                                                                               } else {
+                                                                                       pkg.setInstallInfo(Package.INSTALLINFO.NOT_INSTALLED);
+                                                                               }
+                                                                       } else {
+                                                                               pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+                                                                       }                       
+                                                                       if (monitor.isCanceled()) {
+                                                                               throw new OperationCanceledException();
+                                                                       }
+                                                               }
+                                                       } catch (IOException e) {
+                                                               e.printStackTrace();
+                                                       }                                                       
+
+                                                       cancelJob.setFinishFlag(true);
+                                                       monitor.done();
+                                               }
+                                       });                                     
+                               } catch (Exception e1) {
+                                       // TODO Auto-generated catch block
+                                       e1.printStackTrace();
+                               }               
+                               
+                               pkgViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        
+        });       
+       }
+       
+       private void createColumnsForRepoTable( Composite parent )
+       {
+               String[] titles = {"Name", "Reposity URL"};
+               int[] bounds = { 200, 600 };
+               
+               TableViewerColumn colInstallType = createTableViewerColumn( repoViewer, titles[0], bounds[0], SWT.NONE);
+               
+               colInstallType.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Repository repo = (Repository)element;                                                          
+                               return repo.getName();
+                       }
+               });
+               
+               TableViewerColumn colPackage = createTableViewerColumn( repoViewer, titles[1], bounds[1], SWT.NONE);
+               
+               colPackage.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Repository repo = (Repository)element;
+                               return repo.getUri();
+                       }                       
+               });
+       }
+       
+       private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, int Style) {
+               
+               final TableViewerColumn viewerColumn = new TableViewerColumn( viewer,   Style);
+               final TableColumn column = viewerColumn.getColumn();
+               column.setText(title);
+               column.setWidth(bound);
+               column.setResizable(true);
+               column.setMoveable(true);
+               return viewerColumn;
+       }
+       
+       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};
+               
+               TableViewerColumn colInstallType = createTableViewerColumn( pkgViewer, titles[0], bounds[0], SWT.NONE);
+               
+               colInstallType.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;                                                         
+                               return pkg.getPkgType().toString();
+                       }
+               });
+               
+               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();
+                       }                       
+               });             
+               
+               TableViewerColumn colArch = createTableViewerColumn( pkgViewer, titles[2], bounds[2], SWT.NONE);
+               
+               colArch.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String arch = pkg.getArch();
+                               return arch;            
+                       }                       
+               });
+       
+               TableViewerColumn colNewVer = createTableViewerColumn( pkgViewer, titles[3], bounds[3], SWT.NONE);
+               
+               colNewVer.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String newVer = pkg.getNewVersion();                            
+                               return newVer;                          
+                       }
+               });
+               
+               TableViewerColumn colInsVer = createTableViewerColumn( pkgViewer, titles[4], bounds[4], SWT.NONE);
+               colInsVer.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String installedVer = pkg.getInstalledVersion();                                
+                               return installedVer;
+                       }
+               });     
+
+               TableViewerColumn colStatus = createTableViewerColumn( pkgViewer, titles[5], bounds[5], SWT.NONE);
+               
+               colStatus.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String status = pkg.getInstallInfo().toString();                                                                
+                               return status;
+                       }
+               });             
+       }
+       
+       private void genRemotePkgList() {
+               
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+               String list = RPMPackageCommander.getRemotePackageListForDevice(device, rec);
+               
+               String[] splitStr = list.split("\n");
+               
+               for (int i = 4 ; 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);
+                       if ("i".equals(status)) {
+                               pkg.setCheckColumn(true);
+                               pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+                       } else if ("v".equals(status)) {
+                               pkg.setCheckColumn(false);
+                               pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+                       } else {
+                               pkg.setCheckColumn(false);
+                       }
+                       
+                       RemotePkgProvider.INSTANCE.getPkgs().add(pkg);                                                          
+               }
+       }
+       
+       private void addRemotePackage( RemotePackage p ) {
+               CopyOnWriteArrayList<Package> pkgs = PackageProvider.INSTANCE.getDevicePkgs();
+               Iterator<Package> debIter = pkgs.iterator();    
+               
+               while( debIter.hasNext() ) {
+                       Package pkg = debIter.next();
+                       if( pkg.getName().equals(p.getName()) &&
+                                       pkg.getNewVersion().equals(p.getNewVersion()) ) {
+                               return;
+                       }
+               }
+               
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+               String installedVer = RPMPackageCommander.getPkgInstalledVerForDevice(p.getName(), device, rec); 
+               
+               p.setInstalledVersion(installedVer);
+               p.setCheckColumn(true);
+               p.setPkgType(Package.PKGTYPE.REMOTE);
+               PackageProvider.INSTANCE.getDevicePkgs().add(p);        
+       }
+       
+       private void addLocalPackage( String rpmPath )
+       {
+               CopyOnWriteArrayList<Package> pkgs = PackageProvider.INSTANCE.getDevicePkgs();
+               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);
+               
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();        
+               String installedVerForRootstrap = RPMPackageCommander.getPkgInstalledVerForDevice(pkg.getName(), device, rec);
+               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.pkgInstalledSuccessfullyForDevice(pkgName, device, rec)) {
+                                       pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+                               }
+                       }                       
+               }               
+
+               PackageProvider.INSTANCE.getDevicePkgs().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;
+       }
+       
+       private PackageManagerOuputReceiver getNewOuputReceiver() {
+               ConsoleManager cm = new ConsoleManager(resources.getString("PkgMgr.Console.Name"), true);
+               cm.clear();
+               MessageConsoleStream mcsError = cm.getMessageConsoleStream(true);
+               MessageConsoleStream mcs = cm.getMessageConsoleStream(false);
+               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
+               rec.setMessageConsoleStream(mcs);
+               
+               return rec;     
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PkgMgrUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PkgMgrUIMessages.properties
new file mode 100644 (file)
index 0000000..7895406
--- /dev/null
@@ -0,0 +1,33 @@
+PkgMgr.Title = Package Manager
+PkgMgr.Frame.Description = Install package(s) to build system or device.
+PkgMgr.Frame.Respository = Repositories
+PkgMgr.Frame.Package = Packages
+PkgMgr.Tab.Buildsystem = Build System
+PkgMgr.Tab.Device = Device
+PkgMgr.Console.Name = Package Manager
+PkgMgr.Error.Noselected = - Any project is not selected and any device is not connected,\n- or project is not \"PLATFORM PROJECT\"
+PkgMgr.Error.Noselected.Package = There is no selected package.
+PkgMgr.Error.Failtransfer.File = Failed to move file from %s to %s
+PkgMgr.Label.Configuration = Selected Configuration:
+PkgMgr.Label.Connection = Selected Connection:
+PkgMgr.Button.AddRepo = Add
+PkgMgr.Button.RemoveRepo = Remove
+PkgMgr.Button.RefreshRepo = Refresh
+PkgMgr.Button.AddRPackage = Add Remote Package
+PkgMgr.Button.AddLPackage = Add Local Package
+PkgMgr.Button.RemoveList = Remove List
+PkgMgr.Button.Install = Install Package
+PkgMgr.Message.Refreshing = Refreshing repository...
+PkgMgr.Message.Adding.Package = Adding packages to list...
+PkgMgr.Message.Getting.RemotePackage = Getting remote package list...
+PkgMgr.Message.Installing.Package = Installing package(s)...
+PkgMgr.Message.Transfer.File = Transfer %s to target's %s...
+PkgMgr.Console.Remote.Install = ***** Install remote package *****\n
+PkgMgr.Console.Local.Install = \n***** Install local package *****\n
+
+AddRepo.Title = Add Package Repository
+AddRepo.Label.Name = Name:
+AddRepo.Label.Uri = URI: 
+
+AddRemotePkg.Title = Add Remote Package(s)
+
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java
new file mode 100644 (file)
index 0000000..e371be3
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+*  Inhouse
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Taejun Ha <taejun.ha@samsung.com>
+* Jiil Hyoun <jiil.hyoun@samsung.com>
+* Donghyuk Yang <donghyuk.yang@samsung.com>
+* Hoon Kang <h245.kang@samsung.com>  
+* DongHee Yang <donghee.yang@samsung.com>
+* 
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.nativeplatform.pkgmgr.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.FileLocator;
+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;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+
+import org.osgi.framework.Bundle;
+import org.tizen.common.connection.ConnectionPlugin;
+
+import org.tizen.nativecommon.build.CurrentEnabledProject;
+import org.tizen.nativeplatform.Activator;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.sdblib.IDevice;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPkgProvider;
+import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
+
+public class RPMPackageDialog extends Dialog { 
+       
+       
+       private String configuration;   
+       private IDevice device;
+       private IProject project;
+       private TabFolder tabFolder;    
+       
+       private boolean enableRootstrapTab = true;
+       private boolean enableTargetTab = true;
+       private int tabIndex = 0;       
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 1100;
+       private final int height = 800;
+       
+       private final String BUNDLE_NAME = RPMPackageDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+       
+       public RPMPackageDialog(Shell parentShell, String target, boolean enableRootstrap, boolean enableTarget) {
+               super(parentShell);
+               setBlockOnOpen(false);          
+               this.enableRootstrapTab = enableRootstrap;
+               this.enableTargetTab = enableTarget;
+               
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+               
+               if (enableRootstrap) {
+                       IProject _project = CurrentEnabledProject.getCurrentProject();
+                       IConfiguration config = ManagedBuildManager.getBuildInfo( _project ).getDefaultConfiguration();
+                       this.configuration = config.getName();  
+                       RPMPackageCommander.setHttpProxy(getHttpProxy(_project));
+               }
+               if (enableTarget) {
+                       this.device = ConnectionPlugin.getDefault().getCurrentDevice();
+               }
+       }
+       
+       private String getHttpProxy(IProject project) {
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project ) ;
+               IConfiguration cfg = info.getDefaultConfiguration();
+               ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(cfg);
+               IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
+
+               // append "OBS_HTTP_PROXY"
+               IEnvironmentVariable var = mngr.getVariable("OBS_HTTP_PROXY", cfgDes, true);
+               if ( var != null ) {
+                       return var.getValue();
+               }
+               return "";
+       }
+
+       private void setImage(Shell parentShell) {
+               try {
+                       Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
+                       parentShell.setImage(new Image(Display.getCurrent(), FileLocator.toFileURL(bundle.getEntry("icons/package_installer.gif")).getPath()));
+               } catch (Exception e) {
+               }
+       }
+       
+       protected void setShellStyle(int newShellStyle) {
+               int newStyle = newShellStyle & ~SWT.APPLICATION_MODAL;
+               newStyle |= SWT.MODELESS;
+               super.setShellStyle(newStyle);
+       }
+
+       @Override
+       public boolean close()
+       {
+               RemotePkgProvider.INSTANCE.clear();
+               LocalPkgProvider.INSTANCE.clear();
+               PackageProvider.INSTANCE.clear();
+               return super.close();
+       }
+       
+       protected void createButtonsForButtonBar(Composite parent) 
+       {
+               createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
+       }
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);
+               newShell.setText(resources.getString("PkgMgr.Title"));
+               
+               if (!enableRootstrapTab && !enableTargetTab) {
+                       newShell.setLocation(x, y);
+                       newShell.setSize(width/2, height/4);
+                       setImage(newShell);                     
+               } else {
+                       newShell.setLocation(x, y);
+                       newShell.setSize(width, height);
+                       setImage(newShell);
+               }
+       }
+       
+       @Override
+       protected Control createDialogArea(Composite parent) {
+               
+               Composite container = new Composite( parent, SWT.None );
+               container.setLayoutData(new GridData(GridData.FILL_BOTH));
+               container.setLayout(new GridLayout(1, false));
+
+               if (!enableRootstrapTab && !enableTargetTab) {
+                       createError( container, resources.getString("PkgMgr.Error.Noselected"));
+               } else {
+                       createDialogDescription ( container );
+                       createTabs ( container );
+               }                               
+               return null;
+       }
+               
+       
+       private void createError( Composite parent, String message )
+       {
+               Composite com = new Composite( parent, SWT.NONE );
+               com.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+               com.setLayout(new GridLayout(1, false));
+               
+               Label errorLabel = new Label(com, SWT.NONE);
+               errorLabel.setText(message);
+       }
+       
+   private void createDialogDescription(Composite composite)
+    {
+        Composite comp_descrip = new Composite(composite, SWT.NONE);
+        Color whiteColor = new Color(composite.getDisplay(), 255, 255, 255);
+
+        comp_descrip.setLayout(new GridLayout(1, false));
+        GridData comp_descrip_gd = new GridData(GridData.FILL_HORIZONTAL);
+        comp_descrip_gd.heightHint = height/12;
+        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);
+    }
+       
+       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, configuration, getTargetID());
+                       tab.createTab();
+               } 
+               if (enableTargetTab) {
+                       DeviceTab tab = new DeviceTab(getShell(), tabFolder, getTargetID(), device);
+                       tab.createTab();
+               }
+               
+               tabFolder.setSelection(tabIndex);               
+       }       
+       
+       private String getTargetID() {
+               IProject project = CurrentEnabledProject.getCurrentProject();
+               IConfiguration config = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
+               String targetID = PlatformConfigurationManager.getBuildTargetName(config);
+               return targetID;
+       }
+
+}
\ No newline at end of file