PKGMGR: Improved in processing speed of repository management.
authordonghyuk.yang <donghyuk.yang@samsung.com>
Mon, 3 Feb 2014 01:55:21 +0000 (10:55 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Mon, 3 Feb 2014 01:55:21 +0000 (10:55 +0900)
Improved in processing speed of repository management(add,remove,move)
as applying repository changes at once. Repository change will be
applied when closing package manager or clicking "refresh" button.

Change-Id: I3489befb749b238f75e838a3e76d36e78adf2627
Signed-off-by: donghyuk.yang <donghyuk.yang@samsung.com>
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PkgMgrInitializer.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildsystemTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PkgMgrUIMessages.properties
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/repo/commander/RepoManager.java

index 552ad70..3d2e247 100644 (file)
@@ -66,6 +66,32 @@ public class PkgMgrInitializer {
         initRootstrapRepoInfo(true);
     }
 
+    public void updateRootstrapRepoInfo() {
+        if (isSetRootstrap()) {
+            RepoManager.updateRepoInfoToRootstrap(target);
+        }
+    }
+
+    public void updateRootstrapRepo() {
+        if (isSetRootstrap()) {
+            LocalRepoMounter.clearMounted(null);
+            rtCommander.resetRepo();
+            RepoManager.updateRepoToRootstrap(target);
+        }
+    }
+
+    public void updateDeviceRepoInfo(List<Repository> repos) {
+        if (isSetDevice()) {
+            RepoManager.updateRepoInfoToDevice(repos);
+        }
+    }
+
+    public void updateDeviceRepo() {
+        if (isSetDevice()) {
+            RepoManager.updateRepoToDevice(target);
+        }
+    }
+
     public void initRootstrapRepoInfo(boolean resetRepo) {
         if (isSetRootstrap()) {
             RepositoryProvider.INSTANCE.getBuildsystemRepos().clear();
index 5db3c95..669422a 100644 (file)
@@ -61,7 +61,12 @@ public class BuildsystemTab extends CommonTab {
 
     public void updateRepositoryInfo() {
         PkgMgrInitializer initializer = new PkgMgrInitializer(target);
-        initializer.initRootstrapRepoInfo();
+        initializer.updateRootstrapRepoInfo();
+    }
+
+    public void updateRepository() {
+        PkgMgrInitializer initializer = new PkgMgrInitializer(target);
+        initializer.updateRootstrapRepo();
     }
 
     public void createTab() {
@@ -78,8 +83,8 @@ public class BuildsystemTab extends CommonTab {
         String url = dialog.getRepositoryURL();
         Repository repo = target.getRootstrap().getRepository(url);
         if (repo != null) {
-            DialogUtil.openMessageDialog(
-                    String.format(resources.getString("PkgMgr.Msg.Repo.Exists"), repo.getName()));
+            DialogUtil.openMessageDialog(String.format(
+                    resources.getString("PkgMgr.Msg.Repo.Exists"), repo.getName()));
             return false;
         }
         target.getRootstrap().addRepoURL(url);
@@ -107,9 +112,8 @@ public class BuildsystemTab extends CommonTab {
             String newUrl = dialog.getRepositoryURL();
             Repository repo = target.getRootstrap().getRepository(newUrl);
             if (repo != null) {
-                DialogUtil
-                        .openMessageDialog(
-                        String.format(resources.getString("PkgMgr.Msg.Repo.Exists"), repo.getName()));
+                DialogUtil.openMessageDialog(String.format(
+                        resources.getString("PkgMgr.Msg.Repo.Exists"), repo.getName()));
                 return false;
             } else {
                 return target.getRootstrap().modifyRepoURL(selectedRepository.getUri(),
@@ -155,7 +159,10 @@ public class BuildsystemTab extends CommonTab {
 
     protected void handleUpgradeButton() {
         ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-
+        if (isRepoChanged) {
+            DialogUtil.openMessageDialog(resources.getString("PkgMgr.Info.Refresh.First"));
+            return;
+        }
         try {
             dialog.run(true, false, new IRunnableWithProgress() {
                 @Override
index dd3f453..50c6dcd 100644 (file)
@@ -36,7 +36,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IContributionItem;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.MenuManager;
@@ -65,7 +64,6 @@ 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.layout.RowLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
@@ -107,6 +105,7 @@ abstract public class CommonTab {
     protected Text logText;
     protected IOConsoleViewer logViewer;
     protected String logs = "";
+    protected boolean isRepoChanged = false;
 
     protected Action actionProperties;
     protected MenuManager menuMgr;
@@ -129,6 +128,8 @@ abstract public class CommonTab {
 
     abstract public void updateRepositoryInfo();
 
+    abstract public void updateRepository();
+
     abstract protected boolean handleAddRepositoryButton();
 
     abstract protected boolean handleModifyRepositoryButton();
@@ -356,11 +357,11 @@ abstract public class CommonTab {
                         dialog.run(true, false, new IRunnableWithProgress() {
                             @Override
                             public void run(IProgressMonitor monitor)
-                                    throws InvocationTargetException,
-                                    InterruptedException {
+                                    throws InvocationTargetException, InterruptedException {
                                 monitor.beginTask("Add repository", -1);
                                 try {
                                     updateRepositoryInfo();
+                                    isRepoChanged = true;
                                 } finally {
                                     monitor.done();
                                 }
@@ -368,12 +369,10 @@ abstract public class CommonTab {
                         });
                     } catch (InvocationTargetException e1) {
                         DialogUtil.openErrorDialog(resources.getString("PkgMgr.Msg.Error.Addrepo")
-                                + "("
-                                + e1.toString() + ")");
+                                + "(" + e1.toString() + ")");
                     } catch (InterruptedException e1) {
                         DialogUtil.openErrorDialog(resources.getString("PkgMgr.Msg.Error.Addrepo")
-                                + "("
-                                + e1.toString() + ")");
+                                + "(" + e1.toString() + ")");
                     }
                     repoViewer.refresh();
                 }
@@ -403,11 +402,11 @@ abstract public class CommonTab {
                         dialog.run(true, false, new IRunnableWithProgress() {
                             @Override
                             public void run(IProgressMonitor monitor)
-                                    throws InvocationTargetException,
-                                    InterruptedException {
+                                    throws InvocationTargetException, InterruptedException {
                                 monitor.beginTask("Remove repository", -1);
                                 try {
                                     updateRepositoryInfo();
+                                    isRepoChanged = true;
                                 } finally {
                                     monitor.done();
                                 }
@@ -415,12 +414,16 @@ abstract public class CommonTab {
                         });
                     } catch (InvocationTargetException e1) {
                         DialogUtil.openErrorDialog(resources
-                                .getString("PkgMgr.Msg.Error.Removerepo") + "("
-                                + e1.toString() + ")");
+                                .getString("PkgMgr.Msg.Error.Removerepo")
+                                + "("
+                                + e1.toString()
+                                + ")");
                     } catch (InterruptedException e1) {
                         DialogUtil.openErrorDialog(resources
-                                .getString("PkgMgr.Msg.Error.Removerepo") + "("
-                                + e1.toString() + ")");
+                                .getString("PkgMgr.Msg.Error.Removerepo")
+                                + "("
+                                + e1.toString()
+                                + ")");
                     }
                     repoViewer.refresh();
                 }
@@ -449,11 +452,11 @@ abstract public class CommonTab {
                         dialog.run(true, false, new IRunnableWithProgress() {
                             @Override
                             public void run(IProgressMonitor monitor)
-                                    throws InvocationTargetException,
-                                    InterruptedException {
+                                    throws InvocationTargetException, InterruptedException {
                                 monitor.beginTask("Modify repository", -1);
                                 try {
                                     updateRepositoryInfo();
+                                    isRepoChanged = true;
                                 } finally {
                                     monitor.done();
                                 }
@@ -461,12 +464,16 @@ abstract public class CommonTab {
                         });
                     } catch (InvocationTargetException e1) {
                         DialogUtil.openErrorDialog(resources
-                                .getString("PkgMgr.Msg.Error.Modifyrepo") + "("
-                                + e1.toString() + ")");
+                                .getString("PkgMgr.Msg.Error.Modifyrepo")
+                                + "("
+                                + e1.toString()
+                                + ")");
                     } catch (InterruptedException e1) {
                         DialogUtil.openErrorDialog(resources
-                                .getString("PkgMgr.Msg.Error.Modifyrepo") + "("
-                                + e1.toString() + ")");
+                                .getString("PkgMgr.Msg.Error.Modifyrepo")
+                                + "("
+                                + e1.toString()
+                                + ")");
                     }
                     repoViewer.refresh();
                 }
@@ -491,15 +498,16 @@ abstract public class CommonTab {
             public void mouseDown(MouseEvent e) {
                 ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
                 if (handleMoveupRepositoryButton()) {
+                    int selectedIdx = repoViewer.getTable().getSelectionIndex();
                     try {
                         dialog.run(true, false, new IRunnableWithProgress() {
                             @Override
                             public void run(IProgressMonitor monitor)
-                                    throws InvocationTargetException,
-                                    InterruptedException {
+                                    throws InvocationTargetException, InterruptedException {
                                 monitor.beginTask("Move repository up", -1);
                                 try {
                                     updateRepositoryInfo();
+                                    isRepoChanged = true;
                                 } finally {
                                     monitor.done();
                                 }
@@ -507,14 +515,23 @@ abstract public class CommonTab {
                         });
                     } catch (InvocationTargetException e1) {
                         DialogUtil.openErrorDialog(resources
-                                .getString("PkgMgr.Msg.Error.MoverepoUp") + "("
-                                + e1.toString() + ")");
+                                .getString("PkgMgr.Msg.Error.MoverepoUp")
+                                + "("
+                                + e1.toString()
+                                + ")");
                     } catch (InterruptedException e1) {
                         DialogUtil.openErrorDialog(resources
-                                .getString("PkgMgr.Msg.Error.MoverepoUp") + "("
-                                + e1.toString() + ")");
+                                .getString("PkgMgr.Msg.Error.MoverepoUp")
+                                + "("
+                                + e1.toString()
+                                + ")");
                     }
                     repoViewer.refresh();
+                    if (selectedIdx >= 1) {
+                        repoViewer.getTable().setSelection(selectedIdx - 1);
+                    } else {
+                        repoViewer.getTable().setSelection(selectedIdx);
+                    }
                 }
             }
 
@@ -537,15 +554,17 @@ abstract public class CommonTab {
             public void mouseDown(MouseEvent e) {
                 ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
                 if (handleMovedownRepositoryButton()) {
+                    int selectedIdx = repoViewer.getTable().getSelectionIndex();
+                    int totalCount = repoViewer.getTable().getItemCount();
                     try {
                         dialog.run(true, false, new IRunnableWithProgress() {
                             @Override
                             public void run(IProgressMonitor monitor)
-                                    throws InvocationTargetException,
-                                    InterruptedException {
+                                    throws InvocationTargetException, InterruptedException {
                                 monitor.beginTask("Move repository down", -1);
                                 try {
                                     updateRepositoryInfo();
+                                    isRepoChanged = true;
                                 } finally {
                                     monitor.done();
                                 }
@@ -553,14 +572,23 @@ abstract public class CommonTab {
                         });
                     } catch (InvocationTargetException e1) {
                         DialogUtil.openErrorDialog(resources
-                                .getString("PkgMgr.Msg.Error.MoverepoDown") + "("
-                                + e1.toString() + ")");
+                                .getString("PkgMgr.Msg.Error.MoverepoDown")
+                                + "("
+                                + e1.toString()
+                                + ")");
                     } catch (InterruptedException e1) {
                         DialogUtil.openErrorDialog(resources
-                                .getString("PkgMgr.Msg.Error.MoverepoDown") + "("
-                                + e1.toString() + ")");
+                                .getString("PkgMgr.Msg.Error.MoverepoDown")
+                                + "("
+                                + e1.toString()
+                                + ")");
                     }
                     repoViewer.refresh();
+                    if (selectedIdx < totalCount) {
+                        repoViewer.getTable().setSelection(selectedIdx + 1);
+                    } else {
+                        repoViewer.getTable().setSelection(selectedIdx);
+                    }
                 }
             }
 
@@ -894,6 +922,11 @@ abstract public class CommonTab {
         });
     }
 
+    protected void applyRepoChanges() {
+        updateRepository();
+        isRepoChanged = false;
+    }
+
     protected void handleRefreshRepositoryButton() {
         ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
 
@@ -903,6 +936,9 @@ abstract public class CommonTab {
                 public void run(IProgressMonitor monitor) throws InvocationTargetException,
                         InterruptedException {
                     monitor.beginTask(resources.getString("PkgMgr.Message.Refreshing"), -1);
+                    if (isRepoChanged) {
+                        applyRepoChanges();
+                    }
                     ICommandStatus status = commander.refreshRepoList();
                     if (status == null || !status.isOk()) {
                         throw new InterruptedException();
@@ -922,7 +958,12 @@ abstract public class CommonTab {
     protected void handleInstallPackageButton() {
         final List<PkgStatus> selectedList = getSelectedPkgList(false);
         if (selectedList.isEmpty()) {
-            DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package"));
+            DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package")
+                    + "\n" + resources.getString("PkgMgr.Info.Check.Pkg.NewVer"));
+            return;
+        }
+        if (isRepoChanged) {
+            DialogUtil.openMessageDialog(resources.getString("PkgMgr.Info.Refresh.First"));
             return;
         }
 
@@ -955,6 +996,10 @@ abstract public class CommonTab {
     }
 
     protected void handleInstallLocalPackageButton(final List<String> selectedFiles) {
+        if (isRepoChanged) {
+            DialogUtil.openMessageDialog(resources.getString("PkgMgr.Info.Refresh.First"));
+            return;
+        }
         ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
         try {
             dialog.run(true, false, new IRunnableWithProgress() {
@@ -984,7 +1029,12 @@ abstract public class CommonTab {
     protected void handleRemovePackageButton() {
         final List<PkgStatus> selectedList = getSelectedPkgList(true);
         if (selectedList.isEmpty()) {
-            DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package"));
+            DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package")
+                    + "\n" + resources.getString("PkgMgr.Info.Check.Pkg.Installed"));
+            return;
+        }
+        if (isRepoChanged) {
+            DialogUtil.openMessageDialog(resources.getString("PkgMgr.Info.Refresh.First"));
             return;
         }
 
@@ -1081,4 +1131,10 @@ abstract public class CommonTab {
             }
         }
     }
+
+    public void closeTab() {
+        if (isRepoChanged) {
+            applyRepoChanges();
+        }
+    }
 }
index 36d9b7e..3ecede0 100644 (file)
@@ -61,7 +61,12 @@ public class DeviceTab extends CommonTab {
 
     public void updateRepositoryInfo() {
         PkgMgrInitializer initializer = new PkgMgrInitializer(target);
-        initializer.initDeviceRepoInfo(repositories);
+        initializer.updateDeviceRepoInfo(repositories);
+    }
+
+    public void updateRepository() {
+        PkgMgrInitializer initializer = new PkgMgrInitializer(target);
+        initializer.updateDeviceRepo();
     }
 
     public boolean resetRepositoryInfo() {
@@ -112,9 +117,8 @@ public class DeviceTab extends CommonTab {
         // check to exist repository
         for (Repository repo : repositories) {
             if (repo.getUri().equals(url)) {
-                DialogUtil
-                        .openMessageDialog(
-                        String.format(resources.getString("PkgMgr.Msg.Repo.Exists"), repo.getName()));
+                DialogUtil.openMessageDialog(String.format(
+                        resources.getString("PkgMgr.Msg.Repo.Exists"), repo.getName()));
                 return false;
             }
         }
@@ -142,9 +146,8 @@ public class DeviceTab extends CommonTab {
         // check to exist repository
         for (Repository repo : repositories) {
             if (repo.getUri().equals(newUrl)) {
-                DialogUtil
-                        .openMessageDialog(
-                        String.format(resources.getString("PkgMgr.Msg.Repo.Exists"), repo.getName()));
+                DialogUtil.openMessageDialog(String.format(
+                        resources.getString("PkgMgr.Msg.Repo.Exists"), repo.getName()));
                 return false;
             }
         }
index a244145..6ee49c8 100644 (file)
@@ -6,10 +6,11 @@ PkgMgr.Tab.Buildsystem = Rootstrap
 PkgMgr.Tab.Device = Device
 PkgMgr.Console.Name = Package Manager
 PkgMgr.Error.Noselected = - No project is selected, no device is connected, or the selected project is not a Tizen project
-PkgMgr.Error.Noselected.Package = No package selected.
+PkgMgr.Info.Check.Pkg.NewVer = Check new version of the package.
+PkgMgr.Info.Check.Pkg.Installed = Check if the package is installed.
+PkgMgr.Error.Noselected.Package = Select package which you want to install.
 PkgMgr.Error.Failtransfer.File = Moving the file from %s to %s failed.
-PkgMgr.Warn.Notset.Proxy = (Warning: HTTP Proxy is not set. (Preferences -> Tizen SDK -> Platform -> HTTP Proxy)
-PkgMgr.Info.set.Proxy = (HTTP proxy : %s)
+PkgMgr.Info.Refresh.First = There is a changes for repository.\nRefresh repositories at first.
 PkgMgr.Label.Configuration = Selected configuration:
 PkgMgr.Label.Connection = Selected connection:
 PkgMgr.Button.AddRepo = Add
@@ -69,6 +70,8 @@ PkgMgr.Msg.Error.Removerepo = Failed to remove repository
 PkgMgr.Msg.Error.Modifyrepo = Failed to modify repository
 PkgMgr.Msg.Error.MoverepoUp = Failed to move repository up
 PkgMgr.Msg.Error.MoverepoDown = Failed to move repository down
+PkgMgr.Msg.Apply.Changes = Applying change about repository...
+PkgMgr.Msg.Error.Apply.Changes = Failed to apply change about repository.
 
 Action.Msg.Progress.Initializing.PkgMgr = Initializing Package Manager...
 Action.Msg.Progress.Init.BuildSystem.Repo = Intializing repositories on build system...
index 41b02e7..cd76e24 100644 (file)
@@ -31,7 +31,11 @@ import java.io.IOException;
 import java.util.ResourceBundle;
 
 import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.SWT;
@@ -48,18 +52,23 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.TabFolder;
 import org.osgi.framework.Bundle;
 import org.tizen.nativeplatform.Activator;
-
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
 import org.tizen.nativeplatform.pkg.model.PackageProvider;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.exception.SdbCommandRejectedException;
+import org.tizen.sdblib.exception.TimeoutException;
 
 public class RPMPackageDialog extends Dialog {
 
     private TabFolder tabFolder;
     private PkgCommandTarget target = null;
     private boolean enableRootstrapTab = false;
-    private boolean enableTargetTab = false;
+    private boolean enableDeviceTab = false;
     private int tabIndex = 0;
 
+    private BuildsystemTab rootstrapTab;
+    private DeviceTab deviceTab;
+
     private int x = 0;
     private int y = 0;
     private final int width = 900;
@@ -73,7 +82,8 @@ public class RPMPackageDialog extends Dialog {
         super(parentShell);
         this.target = target;
         if (target.isSetDevice()) {
-            this.enableTargetTab = true;
+            this.enableDeviceTab = true;
+            setDeviceRootOn();
         }
         if (target.isSetRootstrap()) {
             this.enableRootstrapTab = true;
@@ -84,6 +94,21 @@ public class RPMPackageDialog extends Dialog {
         y = bounds.y + (bounds.height - height) / 2;
     }
 
+    private void setDeviceRootOn() {
+        IDevice device = target.getDevice();
+        if (!device.isRoot()) {
+            try {
+                device.becomeSuperUser(true);
+            } catch (TimeoutException e) {
+                e.printStackTrace();
+            } catch (SdbCommandRejectedException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
     private void setImage(Shell parentShell) {
         Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
         try {
@@ -102,7 +127,31 @@ public class RPMPackageDialog extends Dialog {
 
     @Override
     public boolean close() {
-        PackageProvider.INSTANCE.clear();
+        Job job = new Job("Finalizing") {
+            @Override
+            protected IStatus run(IProgressMonitor monitor) {
+                int works = 0;
+                if (enableRootstrapTab) {
+                    works++;
+                }
+                if (enableDeviceTab) {
+                    works++;
+                }
+                monitor.beginTask(resources.getString("PkgMgr.Msg.Apply.Changes"), works);
+                if (enableRootstrapTab) {
+                    rootstrapTab.closeTab();
+                    monitor.worked(1);
+                }
+                if (enableDeviceTab) {
+                    deviceTab.closeTab();
+                    monitor.worked(1);
+                }
+                PackageProvider.INSTANCE.clear();
+                monitor.done();
+                return Status.OK_STATUS;
+            }
+        };
+        job.schedule();
         return super.close();
     }
 
@@ -115,7 +164,7 @@ public class RPMPackageDialog extends Dialog {
         super.configureShell(newShell);
         newShell.setText(resources.getString("PkgMgr.Title"));
 
-        if (!enableRootstrapTab && !enableTargetTab) {
+        if (!enableRootstrapTab && !enableDeviceTab) {
             newShell.setLocation(x, y);
             newShell.setSize(width / 2, height / 4);
             setImage(newShell);
@@ -133,7 +182,7 @@ public class RPMPackageDialog extends Dialog {
         container.setLayoutData(new GridData(GridData.FILL_BOTH));
         container.setLayout(new GridLayout(1, false));
 
-        if (!enableRootstrapTab && !enableTargetTab) {
+        if (!enableRootstrapTab && !enableDeviceTab) {
             createError(container, resources.getString("PkgMgr.Error.Noselected"));
         } else {
             createDialogDescription(container);
@@ -171,12 +220,12 @@ public class RPMPackageDialog extends Dialog {
         tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
         tabFolder.setLayout(new GridLayout(1, false));
         if (enableRootstrapTab) {
-            BuildsystemTab tab = new BuildsystemTab(getShell(), tabFolder, target);
-            tab.createTab();
+            rootstrapTab = new BuildsystemTab(getShell(), tabFolder, target);
+            rootstrapTab.createTab();
         }
-        if (enableTargetTab) {
-            DeviceTab tab = new DeviceTab(getShell(), tabFolder, target);
-            tab.createTab();
+        if (enableDeviceTab) {
+            deviceTab = new DeviceTab(getShell(), tabFolder, target);
+            deviceTab.createTab();
         }
         tabFolder.setSelection(tabIndex);
     }
index 75c8d49..05c71e9 100644 (file)
@@ -5,6 +5,7 @@ import java.util.List;
 
 import org.eclipse.core.runtime.IPath;
 import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
 import org.tizen.nativeplatform.repo.model.Repository;
 import org.tizen.nativeplatform.repo.model.RepositoryProvider;
@@ -74,6 +75,58 @@ public class RepoManager {
         return repoList;
     }
 
+    public static void updateRepoToRootstrap(PkgCommandTarget target) {
+        PlatformRootstrap rootstrap = target.getRootstrap();
+        String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(
+                rootstrap.getPath().toOSString());
+        int idx = 0;
+        List<Repository> repos = rootstrap.getRepoList();
+        for (Repository repo : repos) {
+            String url = repo.getUri();
+            String type = repo.getType();
+            String name = String.format("url%d", idx++);
+            if (RepoManager.isLocalType(type) && RepoManager.isLocalUrl(url)) {
+                IPath repoPath = LocalRepoMounter.mountLocalRepository(rootstrapPath, url, null);
+                if (repoPath != null) {
+                    target.getCommander(CmdTargetTypes.ROOTSTRAP).addLocalRepo(name,
+                            repoPath.toOSString());
+                }
+            } else {
+                target.getCommander(CmdTargetTypes.ROOTSTRAP).addRepo(name, url);
+            }
+        }
+    }
+
+    public static void updateRepoInfoToRootstrap(PkgCommandTarget target) {
+        RepositoryProvider.INSTANCE.getBuildsystemRepos().clear();
+        PlatformRootstrap rootstrap = target.getRootstrap();
+        int idx = 0;
+        List<Repository> repos = rootstrap.getRepoList();
+        for (Repository repo : repos) {
+            String url = repo.getUri();
+            String name = String.format("url%d", idx++);
+            RepositoryProvider.INSTANCE.getBuildsystemRepos().add(new Repository(name, url));
+        }
+    }
+
+    public static void updateRepoInfoToDevice(List<Repository> repos) {
+        RepositoryProvider.INSTANCE.getDeviceRepos().clear();
+        RepositoryProvider.INSTANCE.getDeviceRepos().addAll(repos);
+    }
+
+    public static void updateRepoToDevice(PkgCommandTarget target) {
+        IPkgCommander commander = target.getDeviceCommander();
+        if (commander != null) {
+            commander.resetRepo();
+            int idx = 0;
+            List<Repository> repos = RepositoryProvider.INSTANCE.getDeviceRepos();
+            for (Repository repo : repos) {
+                String name = String.format("url%d", idx++);
+                commander.addRepo(name, repo.getUri());
+            }
+        }
+    }
+
     public static void addReposToRootstrap(PkgCommandTarget target) {
         PlatformRootstrap rootstrap = target.getRootstrap();
         String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(
@@ -90,7 +143,8 @@ public class RepoManager {
                 if (repoPath != null) {
                     RepositoryProvider.INSTANCE.getBuildsystemRepos()
                             .add(new Repository(name, url));
-                    target.getCommander(CmdTargetTypes.ROOTSTRAP).addLocalRepo(name, repoPath.toOSString());
+                    target.getCommander(CmdTargetTypes.ROOTSTRAP).addLocalRepo(name,
+                            repoPath.toOSString());
                 }
             } else {
                 RepositoryProvider.INSTANCE.getBuildsystemRepos().add(new Repository(name, url));