[Title] Refactoring
authordonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 2 Jul 2013 11:34:41 +0000 (20:34 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 2 Jul 2013 11:34:41 +0000 (20:34 +0900)
101 files changed:
org.tizen.nativeplatform/src/org/tizen/nativeplatform/PlatformProjectNature.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildPackageObjectAction.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformConfigurationEnvVarSupplier.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformConfigurationManager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformExternalBuildRunner.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformMakeGenerator.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitCommander.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformLaunchDelegate.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformLaunchDelegateForAttach.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/PlatformMainAttachTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/PlatformMainTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/PlatformProjectCommonLaunchShortcut.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/PlatformProjectCoredumpLaunchShortcut.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/PlatformProjectLaunchShortcut.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/PlatformPropertyTester.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingAppPage.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingProcPage.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformAttachLaunchWizard.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizard.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizardDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/ShowPackageStatusDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/manifest/PlatformManifestXMLStore.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPackager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgCommander.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgFilter.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgModelMaker.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgStatusUpdater.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgType.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/PkgCommandTarget.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/PkgCommanderFactory.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/PkgVersionComparerFactory.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PackagerFactory.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/PackagerFactory.java with 51% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgFilterFactory.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgModelMakerFactory.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgStatusUpdaterFactory.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgVersionComparerFactory.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderCommon.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderDevice.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderHost.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmCommanderRootstrap.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmModelMaker.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmPackageFilter.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmPackager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmStatusUpdater.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmVersionComparer.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/IPackage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/Package.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/PackageProvider.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/PackageProvider.java with 57% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/PkgStatus.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/tools/PkgcmdTool.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/tools/RpmTool.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/tools/ZypperTool.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/tools/ZypperXmlParser.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PkgMgrInitializer.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/InstalledPackage.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/InstalledPkgProvider.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPackage.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPkgProvider.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Package.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePackage.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePkgProvider.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRemotePackageDialog.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRepoDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildsystemTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/ModifyRepoDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PackageTableSelectionAdapter.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RemoveInstalledPackageDialog.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RepoTableSelectionAdapter.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/PreferencesManager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/SiteConfigurationDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/repo/commander/IRepoValidator.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/repository/IRepoValidator.java with 71% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/repo/commander/LocalRepoMounter.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/repository/LocalRepoMounter.java with 99% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/repo/commander/LocalRepoValidator.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/repository/LocalRepoValidator.java with 97% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/repo/commander/RemoteRepoValidator.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/repository/RemoteRepoValidator.java with 87% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/repo/commander/RepoManager.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/repository/RepoManager.java with 88% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/repo/model/Repository.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Repository.java with 97% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/repo/model/RepositoryProvider.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RepositoryProvider.java with 97% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/BaseFileSystemGenerator.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/XMLPluginGenerator.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/templateengine/process/SetDefaultIncludePaths.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/types/CmdTargetTypes.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/types/PkgInstallTypes.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/types/PkgTypes.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/CharacterStripper.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/CommandLauncher.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/CommandLauncherOnDevice.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/CommandLauncherOnRootstrap.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PlatformLaunchUtils.java [moved from org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java with 58% similarity]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/PlatformProjectUtil.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/ProcessSelector.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/RootstrapUtil.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/PlatformRootstrap.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/LocalRepoTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapUIMessages.properties
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/PlatformMainWizardPage.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenPlatformMainWizardPage.java

index d8eb101..32c8d00 100644 (file)
@@ -83,8 +83,9 @@ public class PlatformProjectNature extends MakeProjectNature {
                IProjectDescription description = project.getDescription();
                String[] prevNatures = description.getNatureIds();
                for (String prevNature : prevNatures) {
-                       if (natureId.equals(prevNature))
+                       if (natureId.equals(prevNature)) {
                                return;
+                       }
                }
                String[] newNatures = new String[prevNatures.length + 1];
                System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
index afef737..5c1d25d 100644 (file)
@@ -51,7 +51,8 @@ import org.eclipse.ui.PlatformUI;
 import org.tizen.nativecommon.build.CommonBuildMessages;
 import org.tizen.nativecommon.build.CommonBuildPackageFile;
 import org.tizen.nativeplatform.pkg.commander.IPackager;
-import org.tizen.nativeplatform.pkg.commander.PackagerFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PackagerFactory;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
 
 public class PlatformBuildPackageObjectAction implements IWorkbenchWindowActionDelegate,
         IObjectActionDelegate {
@@ -81,7 +82,8 @@ public class PlatformBuildPackageObjectAction implements IWorkbenchWindowActionD
                         InterruptedException {
                     IConfiguration config = ManagedBuildManager.getBuildInfo(project)
                             .getDefaultConfiguration();
-                    IPackager packager = PackagerFactory.getPackager(project, config);
+                    IPackager packager = PackagerFactory.getPackager(
+                            PlatformProjectUtil.getPkgType(), project, config);
                     packagingResult = packager.packaging(monitor);
 
                 }
@@ -110,8 +112,9 @@ public class PlatformBuildPackageObjectAction implements IWorkbenchWindowActionD
 
     protected File findFirstFilebyExtension(File searchPath, String ext) {
         File[] allFiles = searchPath.listFiles(new ExtFilter(ext));
-        if (allFiles == null || allFiles.length == 0)
+        if (allFiles == null || allFiles.length == 0) {
             return null;
+        }
         return allFiles[0];
     }
 
index d75f2d3..f434c59 100644 (file)
@@ -46,8 +46,9 @@ public class PlatformConfigurationEnvVarSupplier implements
         // set "SBI_SYSROOT" variable
         String basePath = PlatformConfigurationManager.getRootstrapPath(configuration);
         String sysrootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(basePath);
-        if (sysrootPath == null)
+        if (sysrootPath == null) {
             sysrootPath = "";
+        }
         return new BuildEnvVar("SBI_SYSROOT", sysrootPath,
                 IBuildEnvironmentVariable.ENVVAR_REPLACE, null);
     }
@@ -61,8 +62,9 @@ public class PlatformConfigurationEnvVarSupplier implements
         // set "SBI_SYSROOT" variable
         String basePath = PlatformConfigurationManager.getRootstrapPath(configuration);
         String sysrootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(basePath);
-        if (sysrootPath == null)
+        if (sysrootPath == null) {
             sysrootPath = "";
+        }
         list.add(new BuildEnvVar("SBI_SYSROOT", sysrootPath,
                 IBuildEnvironmentVariable.ENVVAR_REPLACE, null));
         return list.toArray(new IBuildEnvironmentVariable[0]);
index a9c86f1..4650cca 100644 (file)
@@ -214,9 +214,9 @@ public class PlatformConfigurationManager extends CommonConfigurationManager {
     protected static boolean isCPPProject(IConfiguration config) {
         try {
             IProject project = (IProject) config.getOwner();
-
-            if (project.hasNature(CCProjectNature.CC_NATURE_ID))
+            if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
                 return true;
+            }
         } catch (CoreException e1) {
             e1.printStackTrace();
         }
index 00e92be..5697579 100644 (file)
@@ -138,8 +138,9 @@ public class PlatformExternalBuildRunner extends ExternalBuildRunner {
                                // remove all markers for this project
                                IWorkspace workspace = project.getWorkspace();
                                IMarker[] markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
-                               if (markers != null)
+                               if (markers != null) {
                                        workspace.deleteMarkers(markers);
+                               }
 
                                URI workingDirectoryURI = ManagedBuildManager.getBuildLocationURI(configuration, builder);
                                final String pathFromURI = EFSExtensionManager.getDefault().getPathFromURI(workingDirectoryURI);
@@ -150,8 +151,9 @@ public class PlatformExternalBuildRunner extends ExternalBuildRunner {
                                IPath workingDirectory = new Path(pathFromURI);
 
                                String[] targets = getTargets(kind, builder);
-                               if (targets.length != 0 && targets[targets.length - 1].equals(builder.getCleanBuildTarget()))
+                               if (targets.length != 0 && targets[targets.length - 1].equals(builder.getCleanBuildTarget())) {
                                        isClean = true;
+                               }
 
                                String errMsg = null;
                                ICommandLauncher launcher = builder.getCommandLauncher();
@@ -197,8 +199,9 @@ public class PlatformExternalBuildRunner extends ExternalBuildRunner {
                                        // Before launching give visual cues via the monitor
                                        monitor.subTask(ManagedMakeMessages.getResourceString("MakeBuilder.Invoking_Command") + launcher.getCommandLine()); //$NON-NLS-1$
                                        if (launcher.waitAndRead(consoleOut, consoleErr, new SubProgressMonitor(monitor, 0))
-                                               != ICommandLauncher.OK)
+                                               != ICommandLauncher.OK) {
                                                errMsg = launcher.getErrorMessage();
+                                       }
                                        monitor.subTask(ManagedMakeMessages.getResourceString("MakeBuilder.Updating_project")); //$NON-NLS-1$
 
                                        try {
index ace14f7..7b019ce 100644 (file)
@@ -42,7 +42,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.MultiStatus;
 import org.eclipse.core.runtime.Path;
-import org.tizen.nativecommon.build.exception.SBIException;
 
 
 public class PlatformMakeGenerator implements IManagedBuilderMakefileGenerator2 {
@@ -62,8 +61,9 @@ public class PlatformMakeGenerator implements IManagedBuilderMakefileGenerator2
                
                // if Makefile does not  exist, regenerate "Makefile"
                IFolder configDir = project.getFolder( config.getName() );
-               if ( !configDir.exists() ) 
+               if ( !configDir.exists() ) 
                        return regenerateMakefiles();
+               }
 
                return new MultiStatus(
                                ManagedBuilderCorePlugin.getUniqueIdentifier(),
index d41aacb..aace450 100644 (file)
@@ -113,13 +113,16 @@ public class GitCommander {
                        Ref head = null;
                        for (final Ref r : listRemoteOp.getRemoteRefs()) {
                                final String n = r.getName();
-                               if (!n.startsWith(Constants.R_HEADS))
+                               if (!n.startsWith(Constants.R_HEADS)) {
                                        continue;
+                               }
                                availableRefs.add(r);
-                               if (idHEAD == null || head != null)
+                               if (idHEAD == null || head != null) {
                                        continue;
-                               if (r.getObjectId().equals(idHEAD.getObjectId()))
+                               }
+                               if (r.getObjectId().equals(idHEAD.getObjectId())) {
                                        head = r;
+                               }
                        }
                        Collections.sort(availableRefs, new Comparator<Ref>() {
                                public int compare(final Ref o1, final Ref o2) {
@@ -193,8 +196,9 @@ public class GitCommander {
                                                                        public void run() {
                                                                                Set<File> filesToAdd = new HashSet<File>();
                                                                                // collect all files first
-                                                                               for (Entry<IProject, File> entry : ret.entrySet())
+                                                                               for (Entry<IProject, File> entry : ret.entrySet()) {
                                                                                        filesToAdd.add(entry.getValue());
+                                                                               }
                                                                                // add the files to the repository view
                                                                                for (File file : filesToAdd) {
                                                                                        addConfiguredRepository(file);
@@ -233,9 +237,9 @@ public class GitCommander {
                        throws IllegalArgumentException {
                synchronized (prefs) {
 
-                       if (!FileKey.isGitRepository(repositoryDir, FS.DETECTED))
+                       if (!FileKey.isGitRepository(repositoryDir, FS.DETECTED)) {
                                throw new IllegalArgumentException();
-
+                       }
                        String dirString;
                        try {
                                dirString = repositoryDir.getCanonicalPath();
index c0abea6..0b5cb05 100644 (file)
@@ -96,14 +96,22 @@ import org.tizen.nativecommon.launch.TizenLaunchMessages;
 import org.tizen.nativecommon.launch.TizenUIThreadForConfirmMessage;
 import org.tizen.nativeplatform.Activator;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
 import org.tizen.nativeplatform.launch.wizards.ShowPackageStatusDialog;
 import org.tizen.nativeplatform.pkg.commander.IPackager;
 import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
-import org.tizen.nativeplatform.pkg.commander.PackagerFactory;
+import org.tizen.nativeplatform.pkg.commander.IPkgFilter;
+import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
+import org.tizen.nativeplatform.pkg.commander.IPkgStatusUpdater;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkg.commander.factories.PackagerFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgFilterFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgModelMakerFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgStatusUpdaterFactory;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.util.PlatformLaunchUtils;
 import org.tizen.nativeplatform.util.PlatformProjectUtil;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 import org.tizen.sdblib.Arch;
@@ -134,8 +142,9 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
     public void launch(ILaunchConfiguration config, String mode, ILaunch launch,
             IProgressMonitor monitor) throws CoreException {
         shell = LaunchUIPlugin.getShell();
-        if (monitor == null)
+        if (monitor == null) {
             monitor = new NullProgressMonitor();
+        }
         try {
             monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 20);
             monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
@@ -180,8 +189,7 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
     }
 
     protected void setConfiguration(ILaunchConfiguration config, String mode,
-            IProgressMonitor monitor)
-            throws CoreException {
+            IProgressMonitor monitor) throws CoreException {
         installPackages(config, mode, monitor);
     }
 
@@ -239,7 +247,8 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
     protected boolean packagingProject(IProject targetProj, IConfiguration config,
             IProgressMonitor monitor) {
         boolean packagingResult = false;
-        IPackager packager = PackagerFactory.getPackager(targetProj, config);
+        IPackager packager = PackagerFactory.getPackager(PlatformProjectUtil.getPkgType(),
+                targetProj, config);
         packagingResult = packager.packaging(monitor);
 
         if (packagingResult) {
@@ -258,6 +267,11 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
         IProject platformProject = getProject(config);
         IProject appProject = null;
         final PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(target);
+        final IPkgModelMaker modelMaker = PkgModelMakerFactory.getMaker(PlatformProjectUtil
+                .getPkgType());
+        final IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
+        final IPkgStatusUpdater pkgUpdater = PkgStatusUpdaterFactory.getUpdater(
+                PlatformProjectUtil.getPkgType(), target);
 
         boolean reinstallOp = config.getAttribute(
                 ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, true);
@@ -270,21 +284,24 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
                 .getAttribute(ITizenLaunchConfigurationConstants.ATTR_EXTRA_PACKAGE_LIST,
                         new ArrayList<String>());
 
-        List<LocalPackage> appPkgs = null;
-        List<LocalPackage> packages = new ArrayList<LocalPackage>();
+        List<IPackage> appPkgs = null;
+        List<IPackage> packages = new ArrayList<IPackage>();
 
         String buildConfigName = getBuildConfigName(config);
         IConfiguration buildConfig = getBuildConfiguration(buildConfigName, platformProject);
-        final List<LocalPackage> platformPkgs = launchUtils.getProjectPackages(platformProject,
-                buildConfigName);
+        IPackager packager = PackagerFactory.getPackager(PlatformProjectUtil.getPkgType(),
+                platformProject, buildConfig);
+        List<String> pkgPaths = packager.getProjectPackages();
+        final List<IPackage> platformPkgs = modelMaker.makeModels(pkgPaths);
+
         if (platformPkgs.isEmpty()) {
             String msg = String.format(PlatformLaunchMessages.QUESTION_PACKAGING,
                     platformProject.getName());
             if (64 == DialogUtil.openQuestionDialog(msg)) {
                 if (packagingProject(platformProject, buildConfig, new SubProgressMonitor(monitor,
                         1))) {
-                    platformPkgs.addAll(launchUtils.getProjectPackages(platformProject,
-                            buildConfigName));
+                    pkgPaths = packager.getProjectPackages();
+                    platformPkgs.addAll(modelMaker.makeModels(pkgPaths));
                 } else {
                     if (64 != DialogUtil
                             .openQuestionDialog(PlatformLaunchMessages.QUESTION_CONTINUE)) {
@@ -298,7 +315,10 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
 
         if (!appProjectName.isEmpty()) {
             appProject = launchUtils.getProjectInstance(appProjectName);
-            appPkgs = launchUtils.getProjectPackages(appProject, buildConfigName);
+            IPackager appPackager = PackagerFactory.getPackager(PlatformProjectUtil.getPkgType(),
+                    appProject, buildConfig);
+            List<String> appPkgPaths = appPackager.getProjectPackages();
+            appPkgs = modelMaker.makeModels(appPkgPaths);
 
             if (appPkgs.isEmpty()) {
                 String msg = String.format(PlatformLaunchMessages.QUESTION_PACKAGING,
@@ -306,7 +326,8 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
                 if (64 == DialogUtil.openQuestionDialog(msg)) {
                     if (packagingProject(appProject, buildConfig,
                             new SubProgressMonitor(monitor, 1))) {
-                        appPkgs.addAll(launchUtils.getProjectPackages(appProject, buildConfigName));
+                        appPkgPaths = appPackager.getProjectPackages();
+                        appPkgs.addAll(modelMaker.makeModels(appPkgPaths));
                     } else {
                         if (64 != DialogUtil
                                 .openQuestionDialog(PlatformLaunchMessages.QUESTION_CONTINUE)) {
@@ -320,11 +341,13 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
         }
 
         if (!extraPkgs.isEmpty()) {
-            packages.addAll(launchUtils.getLocalPackages(extraPkgs));
+            List<IPackage> extra = modelMaker.makeModels(extraPkgs);
+            packages.addAll(extra);
+            // packages.addAll(launchUtils.getLocalPackages(extraPkgs));
         }
 
-        final List<LocalPackage> BuildSystemPkgs = new ArrayList<LocalPackage>();
-        final List<LocalPackage> DevicePkgs = new ArrayList<LocalPackage>();
+        List<PkgStatus> buildSystemPkgStatus = new ArrayList<PkgStatus>();
+        List<PkgStatus> devicePkgStatus = new ArrayList<PkgStatus>();
 
         if (mode.equals(ILaunchManager.DEBUG_MODE)) {
             if (!launchUtils.validateRootstrap(rootstrap.getId())) {
@@ -332,22 +355,27 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
                         rootstrap.getId());
                 newCoreException(msg, null);
             }
-            launchUtils.filterBuildsystemPkgs(packages, BuildSystemPkgs, reinstallOp);
+            List<IPackage> buildSystemPkgs = pkgFilter.filter(CmdTargetTypes.ROOTSTRAP, packages);
+            buildSystemPkgStatus = pkgUpdater.updateStatus(CmdTargetTypes.ROOTSTRAP,
+                    buildSystemPkgs);
+            launchUtils.applyReinstallOp(buildSystemPkgStatus, reinstallOp);
         }
-        launchUtils.filterDevicePackages(packages, DevicePkgs, reinstallOp);
+        List<IPackage> devicePkgs = pkgFilter.filter(CmdTargetTypes.DEVICE, packages);
+        devicePkgStatus = pkgUpdater.updateStatus(CmdTargetTypes.DEVICE, devicePkgs);
+        launchUtils.applyReinstallOp(devicePkgStatus, reinstallOp);
 
         try {
             monitor.beginTask(PlatformLaunchMessages.INSTALL_PACKAGE, 4);
             monitor.subTask(PlatformLaunchMessages.CHECK_PKG_STATUS);
 
             if (selectPkgOp) {
-                if (!openPkgStatusDialog(BuildSystemPkgs, DevicePkgs)) {
+                if (!openPkgStatusDialog(buildSystemPkgStatus, devicePkgStatus)) {
                     newCoreException(PlatformLaunchMessages.CANCELED_LAUNCH, null);
                 }
             }
 
-            List<LocalPackage> selecteBsPkgs = launchUtils.getSelectedPackages(BuildSystemPkgs);
-            List<LocalPackage> selecteDvPkgs = launchUtils.getSelectedPackages(DevicePkgs);
+            List<IPackage> selecteBsPkgs = launchUtils.getSelectedPackages(buildSystemPkgStatus);
+            List<IPackage> selecteDvPkgs = launchUtils.getSelectedPackages(devicePkgStatus);
 
             monitor.worked(1);
             monitor.subTask(PlatformLaunchMessages.INSTALL_PACKAGES_TO_BUILDSYSTEM);
@@ -378,11 +406,12 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
                 .getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
         IPath hostPath = getHostPath(appPath, config);
         if (hostPath != null) {
-            if (hostPath.toFile().exists())
+            if (hostPath.toFile().exists()) {
                 return;
-            else
+            } else {
                 newCoreException(PlatformLaunchMessages.CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP,
                         null);
+            }
         } else {
             newCoreException(PlatformLaunchMessages.CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP,
                     null);
@@ -402,11 +431,13 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
         IConfiguration configuration = getBuildConfiguration(buildConfigName, project);
         String buildTargetArchitecture = CommonConfigurationManager.getArchitecture(configuration);
         if (currentDevice.isEmulator() && currentDevice.getArch() == Arch.X86) {
-            if (!PlatformConfigurationManager.isEmulatorArch(buildTargetArchitecture))
+            if (!PlatformConfigurationManager.isEmulatorArch(buildTargetArchitecture)) {
                 resolveProblematicConfiguration(config, "i386");
+            }
         } else {
-            if (!PlatformConfigurationManager.isDeviceArch(buildTargetArchitecture))
+            if (!PlatformConfigurationManager.isDeviceArch(buildTargetArchitecture)) {
                 resolveProblematicConfiguration(config, "armel");
+            }
         }
         monitor.done();
     }
@@ -420,10 +451,11 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
             }
         });
 
-        if (selectedConfig == null)
+        if (selectedConfig == null) {
             newCoreException(
                     TizenLaunchMessages.BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE,
                     null);
+        }
 
         ICProjectDescription projDes = CDTPropertyManager.getProjectDescription(project);
         ICConfigurationDescription cDesc = projDes.getConfigurationByName(selectedConfig.getName());
@@ -484,10 +516,11 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
                 break;
             }
         }
-        if (configuration == null)
+        if (configuration == null) {
             newCoreException(
                     TizenLaunchMessages.BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE,
                     null);
+        }
 
         return configuration;
     }
@@ -502,8 +535,9 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
             IConfiguration configuration = ManagedBuildManager.getBuildInfo(project)
                     .getDefaultConfiguration();
             return configuration.getName();
-        } else
+        } else {
             return buildConfigName;
+        }
     }
 
     protected boolean resolveProblematicConfiguration(IProject project,
@@ -625,23 +659,26 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
             TizenDebugger debugger = new TizenDebugger();
             debugSession = ((ICDIDebugger2) debugger).createSession(launch,
                     getGDBClientArgument(exeFile), new SubProgressMonitor(monitor, 1));
-            if (debugSession == null)
+            if (debugSession == null) {
                 newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null);
+            }
 
             boolean attrDebuggerStopAtMain = config.getAttribute(
                     ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
             String attrDebuggerStopAtMainSymbol = null;
-            if (attrDebuggerStopAtMain)
+            if (attrDebuggerStopAtMain) {
                 attrDebuggerStopAtMainSymbol = launch.getLaunchConfiguration().getAttribute(
                         ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
                         ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
+            }
 
             ICDITarget[] targetArray = debugSession.getTargets();
             for (int i = 0; i < targetArray.length; i++) {
                 Process proc = targetArray[i].getProcess();
                 IProcess iproc = null;
-                if (proc != null)
+                if (proc != null) {
                     iproc = DebugPlugin.newProcess(launch, proc, exeFile.getName(), null);
+                }
                 IProject project = getProject(config);
                 CDIDebugModel.newDebugTarget(launch, project, targetArray[i], "Tizen debugger",
                         iproc, exeFile, true, false, attrDebuggerStopAtMainSymbol, true);
@@ -683,8 +720,9 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
                 ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
         try {
             localDebugPort = getDebugPort();
-            if (localDebugPort < 0)
+            if (localDebugPort < 0) {
                 newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, null);
+            }
             currentDevice.createForward(localDebugPort, Integer.parseInt(gdbserverPort));
             String localPort = Integer.valueOf(localDebugPort).toString();
             wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort);
@@ -704,27 +742,30 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
 
     protected int getDebugPort() {
         int debugPortBase = -1;
-        if (currentDevice.isEmulator())
+        if (currentDevice.isEmulator()) {
             debugPortBase = 26102;
-        else
+        } else {
             debugPortBase = 26202;
+        }
 
         int port = debugPortBase;
         while ((port < 65535) && !LocalPortChecker.isPortAvailable(port)) {
             port += 10;
         }
 
-        if (LocalPortChecker.isPortAvailable(port))
+        if (LocalPortChecker.isPortAvailable(port)) {
             return port;
-        else
+        } else {
             return -1;
+        }
     }
 
     protected String setEnvironments(ILaunchConfiguration config) throws Exception {
         String envs = "";
         String[] envArray = getEnvironment(config);
-        for (String env : envArray)
+        for (String env : envArray) {
             envs = TizenPlatformConstants.ENVIRONMENT_SETTING_CMD + env + " && ";
+        }
         return envs;
     }
 
@@ -734,10 +775,11 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
         String arguments = config.getAttribute(
                 ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "");
         String executableWithArguments = "";
-        if (!arguments.equals(""))
+        if (!arguments.equals("")) {
             executableWithArguments = appPath + " " + arguments;
-        else
+        } else {
             executableWithArguments = appPath;
+        }
         return executableWithArguments;
     }
 
@@ -756,9 +798,9 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
 
     protected File findFirstFilebyExtension(File searchPath, String ext) {
         File[] allFiles = searchPath.listFiles(new ExtFilter(ext));
-        if (allFiles == null || allFiles.length == 0)
+        if (allFiles == null || allFiles.length == 0) {
             return null;
-
+        }
         return allFiles[0];
     }
 
@@ -780,8 +822,9 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
     }
 
     protected void refreshResources(IProject project) throws CoreException {
-        if (!project.isSynchronized(IResource.DEPTH_INFINITE))
+        if (!project.isSynchronized(IResource.DEPTH_INFINITE)) {
             project.refreshLocal(IResource.DEPTH_INFINITE, null);
+        }
     }
 
     protected IBinaryObject getBinaryObject(ILaunchConfiguration config) throws CoreException {
@@ -795,8 +838,9 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
     protected IProject getProject(ILaunchConfiguration config) throws CoreException {
         String projectName = config.getAttribute(
                 ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
-        if (projectName == null || projectName.equals(""))
+        if (projectName == null || projectName.equals("")) {
             newCoreException(PlatformLaunchMessages.CANNOT_FIND_PROJECT_NAME, null);
+        }
         return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
     }
 
@@ -813,18 +857,18 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
         }
 
         String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(path);
-        if (!rootstrapPath.equals(""))
+        if (!rootstrapPath.equals("")) {
             rootstrapPath = rootstrapPath.concat(exePath);
-
+        }
         return new Path(rootstrapPath);
     }
 
-    protected boolean openPkgStatusDialog(final List<LocalPackage> BuildSystemPkgs,
-            final List<LocalPackage> DevicePkgs) {
+    protected boolean openPkgStatusDialog(final List<PkgStatus> buildSystemPkgStatus,
+            final List<PkgStatus> devicePkgStatus) {
         SWTUtil.syncExec(new Runnable() {
             public void run() {
                 ShowPackageStatusDialog statusDlg = new ShowPackageStatusDialog(shell,
-                        BuildSystemPkgs, DevicePkgs);
+                        buildSystemPkgStatus, devicePkgStatus);
                 if (Window.OK == statusDlg.open()) {
                     result = true;
                 } else {
@@ -849,6 +893,6 @@ public class PlatformLaunchDelegate extends AbstractCLaunchDelegate {
     }
 
     protected void setPkgCommandTarget() {
-        target = new PkgCommandTarget(currentDevice, rootstrap);
+        target = new PkgCommandTarget(PlatformProjectUtil.getPkgType(), currentDevice, rootstrap);
     }
 }
index 48ef236..5b27a17 100644 (file)
@@ -34,8 +34,8 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-import org.eclipse.cdt.core.IProcessInfo;
 import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.cdt.core.IProcessInfo;
 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
 import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
 import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
@@ -56,12 +56,23 @@ import org.tizen.common.util.DialogUtil;
 import org.tizen.common.util.StringUtil;
 import org.tizen.nativecommon.ProjectUtil;
 import org.tizen.nativecommon.build.SmartBuildInterface;
-import org.tizen.nativecommon.build.exception.SBIException;
 import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
 import org.tizen.nativecommon.launch.TizenLaunchMessages;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkg.commander.IPackager;
+import org.tizen.nativeplatform.pkg.commander.IPkgFilter;
+import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
+import org.tizen.nativeplatform.pkg.commander.IPkgStatusUpdater;
+import org.tizen.nativeplatform.pkg.commander.factories.PackagerFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgFilterFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgModelMakerFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgStatusUpdaterFactory;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.util.PlatformLaunchUtils;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
+import org.tizen.nativeplatform.util.ProcessSelector;
 import org.tizen.sdblib.exception.SdbCommandRejectedException;
 import org.tizen.sdblib.exception.TimeoutException;
 
@@ -87,8 +98,9 @@ public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
                 ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
         try {
             int localDebugPort = getDebugPort();
-            if (localDebugPort < 0)
+            if (localDebugPort < 0) {
                 newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, null);
+            }
             currentDevice.createForward(localDebugPort, Integer.parseInt(gdbserverPort));
             String localPort = Integer.valueOf(localDebugPort).toString();
             wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort);
@@ -245,7 +257,8 @@ public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
         String processName = config.getAttribute(
                 ITizenLaunchConfigurationConstants.ATTR_PROCESSNAME_OPTION, "");
 
-        IProcessInfo procInfo = launchUtils.getProcess(shell, currentDevice, processName);
+        ProcessSelector selector = new ProcessSelector(currentDevice);
+        IProcessInfo procInfo = selector.getProcess(shell, processName);
         if (procInfo == null) {
             newCoreException("Canceled", null);
         }
@@ -263,29 +276,38 @@ public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
             IProgressMonitor monitor) throws CoreException {
         IProject platformProject = getProject(config);
         final PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(target);
+        final IPkgModelMaker modelMaker = PkgModelMakerFactory.getMaker(PlatformProjectUtil.getPkgType());
+        final IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
+        final IPkgStatusUpdater pkgUpdater = PkgStatusUpdaterFactory.getUpdater(PlatformProjectUtil.getPkgType(), target);
 
         boolean reinstallOp = config.getAttribute(
                 ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, true);
         boolean selectPkgOp = config.getAttribute(
                 ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);
 
-        List<LocalPackage> packages = new ArrayList<LocalPackage>();
+        List<IPackage> packages = new ArrayList<IPackage>();
 
         String buildConfigName = getBuildConfigName(config);
         IConfiguration buildConfig = getBuildConfiguration(buildConfigName, platformProject);
         String targetID = PlatformConfigurationManager.getBuildTargetName(buildConfig);
         String rootstrapId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetID);
-
+        IPackager packager = PackagerFactory.getPackager(PlatformProjectUtil.getPkgType(),
+                platformProject, buildConfig);
+        List<String> pkgPaths = packager.getProjectPackages();
+        final List<IPackage> platformPkgs = modelMaker.makeModels(pkgPaths);
+        //final List<LocalPackage> platformPkgs = packager.getProjectPackages();
+        /*
         final List<LocalPackage> platformPkgs = launchUtils.getProjectPackages(platformProject,
                 buildConfigName);
+        */
         if (platformPkgs.isEmpty()) {
             String msg = String.format(PlatformLaunchMessages.QUESTION_PACKAGING,
                     platformProject.getName());
             if (64 == DialogUtil.openQuestionDialog(msg)) {
                 if (packagingProject(platformProject, buildConfig, new SubProgressMonitor(monitor,
                         1))) {
-                    platformPkgs.addAll(launchUtils.getProjectPackages(platformProject,
-                            buildConfigName));
+                    pkgPaths = packager.getProjectPackages();
+                    platformPkgs.addAll(modelMaker.makeModels(pkgPaths));
                 } else {
                     if (64 != DialogUtil
                             .openQuestionDialog(PlatformLaunchMessages.QUESTION_CONTINUE)) {
@@ -297,18 +319,19 @@ public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
 
         packages.addAll(platformPkgs);
 
-        final List<LocalPackage> BuildSystemPkgs = new ArrayList<LocalPackage>();
-        final List<LocalPackage> DevicePkgs = new ArrayList<LocalPackage>();
-
+        List<PkgStatus> buildSystemPkgStatus = new ArrayList<PkgStatus>();
+        List<PkgStatus> devicePkgStatus = new ArrayList<PkgStatus>();
+        
         if (mode.equals(ILaunchManager.DEBUG_MODE)) {
             if (!launchUtils.validateRootstrap(rootstrapId)) {
                 String msg = String.format(PlatformLaunchMessages.IS_NOT_INITIALIZED_ROOTSTRAP,
                         rootstrapId);
                 newCoreException(msg, null);
             }
-            // launchUtils.filterBuildsystemPkgs(packages, BuildSystemPkgs,
-            // rootstrapPath, reinstallOp);
-            launchUtils.filterBuildsystemPkgs(packages, BuildSystemPkgs, reinstallOp);
+            //launchUtils.filterBuildsystemPkgs(packages, BuildSystemPkgs, reinstallOp);
+            List<IPackage> buildSystemPkgs = pkgFilter.filter(CmdTargetTypes.ROOTSTRAP, packages);
+            buildSystemPkgStatus = pkgUpdater.updateStatus(CmdTargetTypes.ROOTSTRAP, buildSystemPkgs);
+            launchUtils.applyReinstallOp(buildSystemPkgStatus, reinstallOp);
         }
 
         try {
@@ -316,18 +339,16 @@ public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
             monitor.subTask(PlatformLaunchMessages.CHECK_PKG_STATUS);
 
             if (selectPkgOp) {
-                if (!openPkgStatusDialog(BuildSystemPkgs, DevicePkgs)) {
+                if (!openPkgStatusDialog(buildSystemPkgStatus, devicePkgStatus)) {
                     newCoreException(PlatformLaunchMessages.CANCELED_LAUNCH, null);
                 }
             }
 
-            List<LocalPackage> selectedBsPkgs = launchUtils.getSelectedPackages(BuildSystemPkgs);
+            List<IPackage> selectedBsPkgs = launchUtils.getSelectedPackages(buildSystemPkgStatus);
 
             monitor.worked(1);
             monitor.subTask(PlatformLaunchMessages.INSTALL_PACKAGES_TO_BUILDSYSTEM);
             if (selectedBsPkgs != null && !selectedBsPkgs.isEmpty()) {
-                // launchUtils.installPkgsToRootstrap(selectedBsPkgs,
-                // rootstrapPath, new SubProgressMonitor(monitor, 1));
                 launchUtils.installPkgsToRootstrap(selectedBsPkgs, monitor);
             }
             monitor.subTask(PlatformLaunchMessages.INSTALL_PACKAGES_TO_DEVICE);
index a3a73cf..ee1615b 100644 (file)
@@ -50,7 +50,6 @@ import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -74,9 +73,7 @@ import org.tizen.common.connection.ui.TizenRemoteFileDialog;
 import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult;
 import org.tizen.nativecommon.launch.TizenLaunchMessages;
 import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
-import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.util.ProcessSelector;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.service.FileEntry;
 
@@ -92,18 +89,12 @@ public class PlatformMainAttachTab extends CMainTab {
     private Button fProcButton;
     private Button fReinstallOp;
     private Button fSelectPkgOp;
-    private TableViewer tableViewer;
     private boolean fSpecifyCoreFile;
     private IDevice device;
-    private ArrayList<LocalPackage> packages = new ArrayList<LocalPackage>();
     private String filePath = "";
-    private String selectedFileList = "";
-
-    private PkgCommandTarget target = null;
 
     public PlatformMainAttachTab() {
         this(false);
-        target = new PkgCommandTarget();
     }
 
     public PlatformMainAttachTab(boolean specifyCoreFile) {
@@ -132,10 +123,11 @@ public class PlatformMainAttachTab extends CMainTab {
     @Override
     protected String handleBrowseButtonSelected() {
         FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE);
-        if (fProgText != null)
+        if (fProgText != null) {
             fileDialog.setFileName(fProgText.getText());
-        else if (fCoreText != null)
+        } else if (fCoreText != null) {
             fileDialog.setFileName(fCoreText.getText());
+        }
         return fileDialog.open();
     }
 
@@ -168,20 +160,6 @@ public class PlatformMainAttachTab extends CMainTab {
         });
     }
 
-    private void createTableTitleComposite(Composite parent) {
-        Label tableLabel = new Label(parent, SWT.NONE);
-        tableLabel.setText(resources.getString("Label.AdditionPkgs"));
-    }
-
-    private boolean existsPkg(LocalPackage pkg) {
-        for (LocalPackage p : packages) {
-            if (pkg.getPath().equals(p.getPath())) {
-                return true;
-            }
-        }
-        return false;
-    }
-
     private void createProcessGroup(Composite parent, int colSpan) {
         Composite projComp = new Composite(parent, SWT.NONE);
         GridLayout projLayout = new GridLayout();
@@ -217,8 +195,8 @@ public class PlatformMainAttachTab extends CMainTab {
         fProcButton.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent evt) {
-                PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(target);
-                IProcessInfo procInfo = launchUtils.getProcess(getShell(), device);
+                ProcessSelector selector = new ProcessSelector(device);
+                IProcessInfo procInfo = selector.getProcess(getShell());
                 if (procInfo != null) {
                     IPath ppath = new Path(procInfo.getName());
                     String name = ppath.lastSegment().trim();
@@ -366,8 +344,9 @@ public class PlatformMainAttachTab extends CMainTab {
         configuration.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);
         ICElement cElement = null;
         cElement = getContext(configuration, getPlatform(configuration));
-        if (cElement != null)
+        if (cElement != null) {
             initializeCProject(cElement, configuration);
+        }
     }
 
     @Override
@@ -376,8 +355,9 @@ public class PlatformMainAttachTab extends CMainTab {
         updateProcessFromConfig(configuration);
         updateReinstallOpFromConfig(configuration);
         updateSelectPkgOpFromConfig(configuration);
-        if (fSpecifyCoreFile)
+        if (fSpecifyCoreFile) {
             updateCoreFromConfig(configuration);
+        }
     }
 
     @Override
@@ -399,11 +379,6 @@ public class PlatformMainAttachTab extends CMainTab {
         String procName = fProcText.getText().trim();
         boolean reinstallOp = fReinstallOp.getSelection();
         boolean selectPkgOp = fSelectPkgOp.getSelection();
-        ArrayList<String> pkgs = new ArrayList<String>();
-
-        for (LocalPackage p : packages) {
-            pkgs.add(p.getPath());
-        }
 
         config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, name);
         config.setAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSNAME_OPTION, procName);
index e40a5b6..f75255b 100644 (file)
@@ -92,10 +92,11 @@ import org.tizen.common.util.ImageUtil;
 import org.tizen.nativecommon.launch.TizenLaunchMessages;
 import org.tizen.nativeplatform.Activator;
 import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
-import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgModelMakerFactory;
+import org.tizen.nativeplatform.pkg.model.IPackage;
 import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.service.FileEntry;
 
@@ -114,15 +115,12 @@ public class PlatformMainTab extends CMainTab {
     private Button fSelectPkgOp;
     private TableViewer tableViewer;
     private boolean fSpecifyCoreFile;
-    private List<LocalPackage> packages = new ArrayList<LocalPackage>();
+    private List<IPackage> packages = new ArrayList<IPackage>();
     private String filePath = "";
     private String selectedFileList = "";
 
-    private PkgCommandTarget target = null;
-
     public PlatformMainTab() {
         this(false);
-        target = new PkgCommandTarget();
     }
 
     public PlatformMainTab(boolean specifyCoreFile) {
@@ -144,18 +142,20 @@ public class PlatformMainTab extends CMainTab {
         createExtraTableGroup(comp);
         createOptionGroupComposite(comp);
 
-        if (fSpecifyCoreFile)
+        if (fSpecifyCoreFile) {
             createCoreFileGroup(comp, 1);
+        }
         createVerticalSpacer(comp, 1);
     }
 
     @Override
     protected String handleBrowseButtonSelected() {
         FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE);
-        if (fProgText != null)
+        if (fProgText != null) {
             fileDialog.setFileName(fProgText.getText());
-        else if (fCoreText != null)
+        } else if (fCoreText != null) {
             fileDialog.setFileName(fCoreText.getText());
+        }
         return fileDialog.open();
     }
 
@@ -280,14 +280,17 @@ public class PlatformMainTab extends CMainTab {
                 String[] filterExt = { "*.rpm" };
                 fd.setFilterExtensions(filterExt);
                 selectedFileList = fd.open();
-                System.out.println(selectedFileList);
-                PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(target);
+                // System.out.println(selectedFileList);
+                // PlatformLaunchUtils launchUtils = new
+                // PlatformLaunchUtils(target);
                 if (selectedFileList != null) {
                     String[] files = fd.getFileNames();
                     String path = fd.getFilterPath();
                     for (String f : files) {
                         String filePath = new Path(path).append(f).toOSString();
-                        LocalPackage p = launchUtils.getLocalPackage(filePath);
+                        IPkgModelMaker maker = PkgModelMakerFactory.getMaker(PlatformProjectUtil
+                                .getPkgType());
+                        IPackage p = maker.makeModel(filePath);
                         if (!existsPkg(p)) {
                             packages.add(p);
                         }
@@ -324,8 +327,8 @@ public class PlatformMainTab extends CMainTab {
         createTableGroupComposite(composite);
     }
 
-    private boolean existsPkg(LocalPackage pkg) {
-        for (LocalPackage p : packages) {
+    private boolean existsPkg(IPackage pkg) {
+        for (IPackage p : packages) {
             if (pkg.getPath().equals(p.getPath())) {
                 return true;
             }
@@ -523,8 +526,9 @@ public class PlatformMainTab extends CMainTab {
         configuration.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);
         ICElement cElement = null;
         cElement = getContext(configuration, getPlatform(configuration));
-        if (cElement != null)
+        if (cElement != null) {
             initializeCProject(cElement, configuration);
+        }
     }
 
     @Override
@@ -535,8 +539,9 @@ public class PlatformMainTab extends CMainTab {
         updateExtraTableFromConfig(configuration);
         updateReinstallOpFromConfig(configuration);
         updateSelectPkgOpFromConfig(configuration);
-        if (fSpecifyCoreFile)
+        if (fSpecifyCoreFile) {
             updateCoreFromConfig(configuration);
+        }
     }
 
     @Override
@@ -560,7 +565,7 @@ public class PlatformMainTab extends CMainTab {
         boolean selectPkgOp = fSelectPkgOp.getSelection();
         ArrayList<String> pkgs = new ArrayList<String>();
 
-        for (LocalPackage p : packages) {
+        for (IPackage p : packages) {
             pkgs.add(p.getPath());
         }
 
@@ -612,7 +617,7 @@ public class PlatformMainTab extends CMainTab {
 
     @SuppressWarnings("unchecked")
     protected void updateExtraTableFromConfig(ILaunchConfiguration config) {
-        ArrayList<String> pkgs = null;
+        List<String> pkgs = null;
         try {
             pkgs = (ArrayList<String>) config.getAttribute(
                     ITizenLaunchConfigurationConstants.ATTR_EXTRA_PACKAGE_LIST,
@@ -620,9 +625,8 @@ public class PlatformMainTab extends CMainTab {
         } catch (CoreException ce) {
             LaunchUIPlugin.log(ce);
         }
-        PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(target);
-        // packages.addAll(launchUtils.getLocalPackages(pkgs));
-        packages = launchUtils.getLocalPackages(pkgs);
+        IPkgModelMaker maker = PkgModelMakerFactory.getMaker(PlatformProjectUtil.getPkgType());
+        packages = maker.makeModels(pkgs);
         tableViewer.setInput(packages);
     }
 
@@ -661,8 +665,8 @@ public class PlatformMainTab extends CMainTab {
 
             tableViewer.setSorter(new ViewerSorter() {
                 public int compare(Viewer viewer, Object e1, Object e2) {
-                    LocalPackage pkg_1 = (LocalPackage) e1;
-                    LocalPackage pkg_2 = (LocalPackage) e2;
+                    IPackage pkg_1 = (IPackage) e1;
+                    IPackage pkg_2 = (IPackage) e2;
 
                     String fileName_1 = new Path(pkg_1.getPath()).lastSegment();
                     String fileName_2 = new Path(pkg_2.getPath()).lastSegment();
@@ -693,8 +697,8 @@ public class PlatformMainTab extends CMainTab {
 
         @Override
         public String getColumnText(Object element, int columnIndex) {
-            if (element instanceof LocalPackage) {
-                LocalPackage pkg = (LocalPackage) element;
+            if (element instanceof IPackage) {
+                IPackage pkg = (IPackage) element;
                 String file = pkg.getPath();
                 String name = new Path(file).lastSegment();
 
@@ -735,7 +739,7 @@ public class PlatformMainTab extends CMainTab {
                     tip = new Shell(getShell(), SWT.ON_TOP | SWT.TOOL);
                     tip.setLayout(new FillLayout());
                     label = new Label(tip, SWT.NONE);
-                    LocalPackage pkg = (LocalPackage) item.getData();
+                    IPackage pkg = (IPackage) item.getData();
 
                     label.setForeground(getShell().getDisplay().getSystemColor(
                             SWT.COLOR_INFO_FOREGROUND));
index d5301b6..c8f363b 100644 (file)
@@ -68,9 +68,10 @@ import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.launch.TizenLaunchMessages;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
 import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.util.PlatformLaunchUtils;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 import org.tizen.sdblib.IDevice;
 
@@ -209,7 +210,7 @@ abstract public class PlatformProjectCommonLaunchShortcut extends CApplicationLa
         String targetId = PlatformConfigurationManager.getBuildTargetName(defaultConfig);
         String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
         PlatformRootstrap rootstrap = RootstrapManager.getRootstrap(rootId);
-        target = new PkgCommandTarget(device, rootstrap);
+        target = new PkgCommandTarget(PlatformProjectUtil.getPkgType(), device, rootstrap);
     }
 
     abstract protected ILaunchConfiguration createConfiguration(IProject project,
index 669de34..55fcf51 100644 (file)
@@ -63,8 +63,9 @@ public class PlatformProjectCoredumpLaunchShortcut extends PlatformProjectCommon
             ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager()
                     .generateLaunchConfigurationName(project.getName()));
             String programName = getProgramName();
-            if (programName != null)
+            if (programName != null) {
                 wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName);
+            }
 
             wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
             wc.setMappedResources(new IResource[] { project });
@@ -111,10 +112,11 @@ public class PlatformProjectCoredumpLaunchShortcut extends PlatformProjectCommon
 
         TizenPathInputDialog dlg = new TizenPathInputDialog(shell,
                 APPLICATION_PATH_INPUT_DIALOG_TITLE, APPLICATION_PATH_INPUT_DIALOG_TEXT, null);
-        if (Window.OK == dlg.open())
+        if (Window.OK == dlg.open()) {
             return dlg.getValue();
-        else
+        } else {
             newCoreException(PlatformLaunchMessages.OPERATION_CANCELED, null);
+        }
 
         return null;
     }
index 8a8c8e6..26ca3af 100644 (file)
@@ -52,11 +52,11 @@ import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
 import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
 import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizard;
 import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizardDialog;
 import org.tizen.nativeplatform.launch.wizards.SelectItemDialog;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.util.PlatformLaunchUtils;
 import org.tizen.nativeplatform.util.PlatformProjectUtil;
 
 @SuppressWarnings("restriction")
@@ -65,7 +65,7 @@ public class PlatformProjectLaunchShortcut extends PlatformProjectCommonLaunchSh
     private static final String APP_PROJ_DEFAULT_SELECTION = "[Not required]";
 
     private String appProjectName = null;
-    private List<LocalPackage> packages = null;
+    private List<IPackage> packages = null;
 
     protected ILaunchConfiguration createConfiguration(IProject project,
             ICDebugConfiguration debugConfig, String mode) {
@@ -92,7 +92,7 @@ public class PlatformProjectLaunchShortcut extends PlatformProjectCommonLaunchSh
 
             if (packages != null) {
                 List<String> strs = new ArrayList<String>();
-                for (LocalPackage p : packages) {
+                for (IPackage p : packages) {
                     strs.add(p.getPath());
                 }
                 wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_EXTRA_PACKAGE_LIST, strs);
index 0c47516..1a53882 100644 (file)
@@ -61,8 +61,9 @@ public class PlatformPropertyTester extends PropertyTester {
 
     private boolean testProject(IProject project) {
         IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
-        if (info == null)
+        if (info == null) {
             return false;
+        }
         IConfiguration cfg = info.getDefaultConfiguration();
         IManagedProject managedProject = cfg.getManagedProject();
         if (managedProject != null && managedProject.getProjectType() != null) {
index c9d12db..37f55ed 100644 (file)
@@ -80,11 +80,13 @@ import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativeplatform.Activator;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
 import org.tizen.nativeplatform.pkg.commander.IPackager;
-import org.tizen.nativeplatform.pkg.commander.PackagerFactory;
+import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkg.commander.factories.PackagerFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgModelMakerFactory;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 
 public class PlatformLaunchSettingAppPage extends WizardPage {
@@ -107,12 +109,14 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
     private PkgCommandTarget target = null;
     private String rootPath = "";
     private boolean packagingResult;
-    private List<LocalPackage> platformPackages = new ArrayList<LocalPackage>();
-    private List<LocalPackage> appPackages = new ArrayList<LocalPackage>();
-    private List<LocalPackage> extraPackages = new ArrayList<LocalPackage>();
-    private List<LocalPackage> packages = new ArrayList<LocalPackage>();
+    private List<IPackage> platformPackages = new ArrayList<IPackage>();
+    private List<IPackage> appPackages = new ArrayList<IPackage>();
+    private List<IPackage> extraPackages = new ArrayList<IPackage>();
+    private List<IPackage> packages = new ArrayList<IPackage>();
     private List<String> projectNames = new ArrayList<String>();
     private Map<String, IProject> projectMap = new HashMap<String, IProject>();
+    private IPkgModelMaker modelMaker = PkgModelMakerFactory.getMaker(PlatformProjectUtil
+            .getPkgType());
 
     private static final String APP_PROJ_DEFAULT_SELECTION = "[Not required]";
 
@@ -132,15 +136,16 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
         this.rootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(
                 rootstrap.getPath().toOSString());
 
-        setPlatformPackages();
         setProjectMap();
+        setPlatformPackages();
     }
 
     public void setPlatformPackages() {
         platformPackages.clear();
-        PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(target);
-        platformPackages = launchUtils.getProjectPackages(platformProject, config.getName());
-
+        IPackager packager = PackagerFactory.getPackager(PlatformProjectUtil.getPkgType(),
+                platformProject, config);
+        List<String> pkgPaths = packager.getProjectPackages();
+        platformPackages = modelMaker.makeModels(pkgPaths);
         if (platformPackages.isEmpty()) {
             String msg = String.format(PlatformLaunchMessages.QUESTION_PACKAGING,
                     platformProject.getName());
@@ -156,8 +161,10 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
 
     private void setAppPackages(IProject appProj) {
         appPackages.clear();
-        PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(target);
-        appPackages = launchUtils.getProjectPackages(appProj, config.getName());
+        IPackager packager = PackagerFactory.getPackager(PlatformProjectUtil.getPkgType(), appProj,
+                config);
+        List<String> pkgPaths = packager.getProjectPackages();
+        appPackages = modelMaker.makeModels(pkgPaths);
         if (appPackages.isEmpty()) {
             String msg = String
                     .format(PlatformLaunchMessages.QUESTION_PACKAGING, appProj.getName());
@@ -313,8 +320,6 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
             tableColumn.setText(columnNames[i]);
             tableColumn.setWidth(columnWidths[i]);
             tableColumn.setResizable(true);
-            // tableColumn.addSelectionListener(new
-            // TooltableSelectionAdapter());
         }
 
         tableViewer.setLabelProvider(new TableViewerProvider());
@@ -369,14 +374,10 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
                     String[] files = fd.getFileNames();
                     String path = fd.getFilterPath();
                     for (String f : files) {
-                        LocalPackage p = new LocalPackage();
-                        p.setPath(new Path(path).append(f).toOSString());
-                        String name = target.getHostCommander().getNameFromFile(p.getPath());
-                        p.setName(name);
+                        String filePath = new Path(path).append(f).toOSString();
+                        IPackage p = modelMaker.makeModel(filePath);
                         extraPackages.add(p);
-                        // rpmFiles.add(f);
                     }
-                    // tableViewer.refresh();
                     packages.clear();
                     packages.addAll(platformPackages);
                     packages.addAll(appPackages);
@@ -420,7 +421,8 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
                     @Override
                     public void run(IProgressMonitor monitor) throws InvocationTargetException,
                             InterruptedException {
-                        IPackager packager = PackagerFactory.getPackager(targetProj, config);
+                        IPackager packager = PackagerFactory.getPackager(
+                                PlatformProjectUtil.getPkgType(), targetProj, config);
                         packagingResult = packager.packaging(monitor);
                     }
                 });
@@ -428,7 +430,8 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
                 getContainer().run(true, true, new IRunnableWithProgress() {
                     public void run(IProgressMonitor monitor) throws InvocationTargetException,
                             InterruptedException {
-                        IPackager packager = PackagerFactory.getPackager(targetProj, config);
+                        IPackager packager = PackagerFactory.getPackager(
+                                PlatformProjectUtil.getPkgType(), targetProj, config);
                         packagingResult = packager.packaging(monitor);
                     }
                 });
@@ -465,8 +468,8 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
 
         @Override
         public String getColumnText(Object element, int columnIndex) {
-            if (element instanceof LocalPackage) {
-                LocalPackage p = (LocalPackage) element;
+            if (element instanceof IPackage) {
+                IPackage p = (IPackage) element;
                 String name = new Path(p.getPath()).lastSegment();
 
                 switch (columnIndex) {
@@ -480,11 +483,11 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
         }
     }
 
-    public List<LocalPackage> getPackages() {
+    public List<IPackage> getPackages() {
         return packages;
     }
 
-    public List<LocalPackage> getExtraPackages() {
+    public List<IPackage> getExtraPackages() {
         return extraPackages;
     }
 
@@ -530,7 +533,7 @@ public class PlatformLaunchSettingAppPage extends WizardPage {
                     tip = new Shell(getShell(), SWT.ON_TOP | SWT.TOOL);
                     tip.setLayout(new FillLayout());
                     label = new Label(tip, SWT.NONE);
-                    LocalPackage pkg = (LocalPackage) item.getData();
+                    IPackage pkg = (IPackage) item.getData();
 
                     label.setForeground(getShell().getDisplay().getSystemColor(
                             SWT.COLOR_INFO_FOREGROUND));
index fea60d0..36bc2b8 100644 (file)
@@ -56,12 +56,15 @@ import org.tizen.common.util.DialogUtil;
 import org.tizen.nativecommon.build.CommonBuildMessages;
 import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
 import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizard;
 import org.tizen.nativeplatform.pkg.commander.IPackager;
-import org.tizen.nativeplatform.pkg.commander.PackagerFactory;
+import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkg.commander.factories.PackagerFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgModelMakerFactory;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
+import org.tizen.nativeplatform.util.ProcessSelector;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 import org.tizen.sdblib.IDevice;
 
@@ -88,8 +91,10 @@ public class PlatformLaunchSettingProcPage extends WizardPage {
     private IDevice device;
     private PkgCommandTarget target = null;
     private boolean packagingResult;
-    private List<LocalPackage> platformPackages = new ArrayList<LocalPackage>();
-    private List<LocalPackage> packages = new ArrayList<LocalPackage>();
+    private List<IPackage> platformPackages = new ArrayList<IPackage>();
+    private List<IPackage> packages = new ArrayList<IPackage>();
+    private IPkgModelMaker modelMaker = PkgModelMakerFactory.getMaker(PlatformProjectUtil
+            .getPkgType());
 
     public PlatformLaunchSettingProcPage(PlatformLaunchWizard wizard, Shell shell, String pageName,
             IProject project, IConfiguration config, PkgCommandTarget target) {
@@ -114,9 +119,10 @@ public class PlatformLaunchSettingProcPage extends WizardPage {
 
     public void setPlatformPackages() {
         platformPackages.clear();
-        PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(target);
-        platformPackages = launchUtils.getProjectPackages(platformProject, config.getName());
-
+        IPackager packager = PackagerFactory.getPackager(PlatformProjectUtil.getPkgType(),
+                platformProject, config);
+        List<String> pkgPaths = packager.getProjectPackages();
+        platformPackages = modelMaker.makeModels(pkgPaths);
         if (platformPackages.isEmpty()) {
             String msg = String.format(PlatformLaunchMessages.QUESTION_PACKAGING,
                     platformProject.getName());
@@ -183,8 +189,8 @@ public class PlatformLaunchSettingProcPage extends WizardPage {
         findBt.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent evt) {
-                PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(target);
-                procInfo = launchUtils.getProcess(shell, device);
+                ProcessSelector selector = new ProcessSelector(device);
+                procInfo = selector.getProcess(getShell());
                 if (procInfo != null) {
                     IPath ppath = new Path(procInfo.getName());
                     pid = procInfo.getPid();
@@ -236,7 +242,7 @@ public class PlatformLaunchSettingProcPage extends WizardPage {
         return procName;
     }
 
-    public List<LocalPackage> getPackages() {
+    public List<IPackage> getPackages() {
         return packages;
     }
 
@@ -259,7 +265,8 @@ public class PlatformLaunchSettingProcPage extends WizardPage {
                     @Override
                     public void run(IProgressMonitor monitor) throws InvocationTargetException,
                             InterruptedException {
-                        IPackager packager = PackagerFactory.getPackager(targetProj, config);
+                        IPackager packager = PackagerFactory.getPackager(
+                                PlatformProjectUtil.getPkgType(), targetProj, config);
                         packagingResult = packager.packaging(monitor);
                     }
                 });
@@ -267,7 +274,8 @@ public class PlatformLaunchSettingProcPage extends WizardPage {
                 getContainer().run(true, true, new IRunnableWithProgress() {
                     public void run(IProgressMonitor monitor) throws InvocationTargetException,
                             InterruptedException {
-                        IPackager packager = PackagerFactory.getPackager(targetProj, config);
+                        IPackager packager = PackagerFactory.getPackager(
+                                PlatformProjectUtil.getPkgType(), targetProj, config);
                         packagingResult = packager.packaging(monitor);
                     }
                 });
index 2642530..7abd194 100644 (file)
@@ -34,7 +34,6 @@ import java.util.List;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.wizard.IWizardContainer;
 import org.eclipse.jface.wizard.WizardDialog;
@@ -45,8 +44,16 @@ import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
 import org.tizen.nativeplatform.launch.wizard.pages.PlatformLaunchSettingProcPage;
+import org.tizen.nativeplatform.pkg.commander.IPkgFilter;
+import org.tizen.nativeplatform.pkg.commander.IPkgStatusUpdater;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgFilterFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgStatusUpdaterFactory;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.util.PlatformLaunchUtils;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
 
 public class PlatformAttachLaunchWizard extends PlatformLaunchWizard {
 
@@ -87,11 +94,12 @@ public class PlatformAttachLaunchWizard extends PlatformLaunchWizard {
         PlatformLaunchSettingProcPage page = (PlatformLaunchSettingProcPage) getPage(SETTING_PROC_PAGE);
         programPath = page.getProgramPath();
         pid = page.getPid();
-
-        final String rootstrapPath = page.getRootstrapPath();
         packages = page.getPackages();
         IWizardContainer container = getContainer();
         final PlatformLaunchUtils launchUtil = new PlatformLaunchUtils(target);
+        final IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
+        final IPkgStatusUpdater pkgUpdater = PkgStatusUpdaterFactory.getUpdater(
+                PlatformProjectUtil.getPkgType(), target);
         reinstallOp = page.getReinstallOp();
         selectPkgOp = page.getSelectPkgOp();
         procName = page.getProcName();
@@ -110,8 +118,8 @@ public class PlatformAttachLaunchWizard extends PlatformLaunchWizard {
                     monitor.beginTask(PlatformLaunchMessages.INSTALL_PACKAGE, 2);
                     monitor.subTask(PlatformLaunchMessages.CHECK_PKG_STATUS);
 
-                    final ArrayList<LocalPackage> BuildSystemPkgs = new ArrayList<LocalPackage>();
-                    final ArrayList<LocalPackage> DevicePkgs = new ArrayList<LocalPackage>();
+                    List<PkgStatus> buildSystemPkgStatus = new ArrayList<PkgStatus>();
+                    List<PkgStatus> devicePkgStatus = new ArrayList<PkgStatus>();
 
                     if (!launchUtil.validateRootstrap(rootstrapId)) {
                         String msg = String.format(
@@ -119,16 +127,19 @@ public class PlatformAttachLaunchWizard extends PlatformLaunchWizard {
                         openErrorDialog(msg);
                         return;
                     }
-                    launchUtil.filterBuildsystemPkgs(packages, BuildSystemPkgs, reinstallOp);
-
+                    List<IPackage> buildSystemPkgs = pkgFilter.filter(CmdTargetTypes.ROOTSTRAP,
+                            packages);
+                    buildSystemPkgStatus = pkgUpdater.updateStatus(CmdTargetTypes.ROOTSTRAP,
+                            buildSystemPkgs);
+                    launchUtil.applyReinstallOp(buildSystemPkgStatus, reinstallOp);
                     if (selectPkgOp) {
-                        if (!openPkgStatusDialog(BuildSystemPkgs, DevicePkgs)) {
+                        if (!openPkgStatusDialog(buildSystemPkgStatus, devicePkgStatus)) {
                             return;
                         }
                     }
 
-                    List<LocalPackage> selecteBsPkgs = launchUtil
-                            .getSelectedPackages(BuildSystemPkgs);
+                    List<IPackage> selecteBsPkgs = launchUtil
+                            .getSelectedPackages(buildSystemPkgStatus);
 
                     monitor.worked(1);
                     monitor.subTask(PlatformLaunchMessages.INSTALL_PACKAGES_TO_BUILDSYSTEM);
index e66a94f..67facef 100644 (file)
@@ -54,8 +54,15 @@ import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
 import org.tizen.nativeplatform.launch.wizard.pages.PlatformLaunchSettingAppPage;
 import org.tizen.nativeplatform.launch.wizard.pages.PlatformLaunchSettingBinPage;
 import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
+import org.tizen.nativeplatform.pkg.commander.IPkgFilter;
+import org.tizen.nativeplatform.pkg.commander.IPkgStatusUpdater;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgFilterFactory;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgStatusUpdaterFactory;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.util.PlatformLaunchUtils;
 import org.tizen.nativeplatform.util.PlatformProjectUtil;
 import org.tizen.sdblib.IDevice;
 
@@ -71,8 +78,8 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene
     protected String appProjectName = "";
     protected boolean reinstallOp;
     protected boolean selectPkgOp;
-    protected List<LocalPackage> packages = new ArrayList<LocalPackage>();
-    protected List<LocalPackage> extraPackages = new ArrayList<LocalPackage>();
+    protected List<IPackage> packages = new ArrayList<IPackage>();
+    protected List<IPackage> extraPackages = new ArrayList<IPackage>();
     protected String appProject = "";
     protected String mode = "";
     protected boolean result;
@@ -126,11 +133,11 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene
         return programPath;
     }
 
-    public List<LocalPackage> getPackages() {
+    public List<IPackage> getPackages() {
         return packages;
     }
 
-    public List<LocalPackage> getExtraPackages() {
+    public List<IPackage> getExtraPackages() {
         return extraPackages;
     }
 
@@ -172,6 +179,8 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene
             packages = page.getPackages();
             IWizardContainer container = getContainer();
             final PlatformLaunchUtils launchUtil = new PlatformLaunchUtils(target);
+            final IPkgFilter pkgFilter = PkgFilterFactory.getFilter(PlatformProjectUtil.getPkgType());
+            final IPkgStatusUpdater pkgUpdater = PkgStatusUpdaterFactory.getUpdater(PlatformProjectUtil.getPkgType(), target);
             reinstallOp = page.getReinstallOp();
             selectPkgOp = page.getSelectPkgOp();
 
@@ -187,9 +196,9 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene
                             InterruptedException {
                         monitor.beginTask(PlatformLaunchMessages.INSTALL_PACKAGE, 3);
                         monitor.subTask(PlatformLaunchMessages.CHECK_PKG_STATUS);
-
-                        final ArrayList<LocalPackage> BuildSystemPkgs = new ArrayList<LocalPackage>();
-                        final ArrayList<LocalPackage> DevicePkgs = new ArrayList<LocalPackage>();
+                        
+                        List<PkgStatus> buildSystemPkgStatus = new ArrayList<PkgStatus>();
+                        List<PkgStatus> devicePkgStatus = new ArrayList<PkgStatus>();
 
                         if (mode.equals(ILaunchManager.DEBUG_MODE)) {
                             if (!launchUtil.validateRootstrap(rootstrapId)) {
@@ -200,22 +209,23 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene
                                 cancelChanging(event);
                                 return;
                             }
-                            launchUtil
-                                    .filterBuildsystemPkgs(packages, BuildSystemPkgs, reinstallOp);
+                            List<IPackage> buildSystemPkgs = pkgFilter.filter(CmdTargetTypes.ROOTSTRAP, packages);
+                            buildSystemPkgStatus = pkgUpdater.updateStatus(CmdTargetTypes.ROOTSTRAP, buildSystemPkgs);
+                            launchUtil.applyReinstallOp(buildSystemPkgStatus, reinstallOp);
                         }
-                        launchUtil.filterDevicePackages(packages, DevicePkgs, reinstallOp);
+                        List<IPackage> devicePkgs = pkgFilter.filter(CmdTargetTypes.DEVICE, packages);
+                        devicePkgStatus = pkgUpdater.updateStatus(CmdTargetTypes.DEVICE, devicePkgs);
+                        launchUtil.applyReinstallOp(devicePkgStatus, reinstallOp);
 
                         if (selectPkgOp) {
-                            if (!openPkgStatusDialog(BuildSystemPkgs, DevicePkgs)) {
+                            if (!openPkgStatusDialog(buildSystemPkgStatus, devicePkgStatus)) {
                                 cancelChanging(event);
                                 return;
                             }
                         }
 
-                        List<LocalPackage> selecteBsPkgs = launchUtil
-                                .getSelectedPackages(BuildSystemPkgs);
-                        List<LocalPackage> selecteDvPkgs = launchUtil
-                                .getSelectedPackages(DevicePkgs);
+                        List<IPackage> selecteBsPkgs = launchUtil.getSelectedPackages(buildSystemPkgStatus);
+                        List<IPackage> selecteDvPkgs = launchUtil.getSelectedPackages(devicePkgStatus);
 
                         monitor.worked(1);
                         monitor.subTask(PlatformLaunchMessages.INSTALL_PACKAGES_TO_BUILDSYSTEM);
@@ -271,12 +281,12 @@ public class PlatformLaunchWizard extends Wizard implements IPageChangingListene
         });
     }
 
-    public boolean openPkgStatusDialog(final ArrayList<LocalPackage> BuildSystemPkgs,
-            final ArrayList<LocalPackage> DevicePkgs) {
+    public boolean openPkgStatusDialog(final List<PkgStatus> BuildSystemPkgStatus,
+            final List<PkgStatus> DevicePkgStatus) {
         SWTUtil.syncExec(new Runnable() {
             public void run() {
                 ShowPackageStatusDialog statusDlg = new ShowPackageStatusDialog(shell,
-                        BuildSystemPkgs, DevicePkgs);
+                        BuildSystemPkgStatus, DevicePkgStatus);
                 if (Window.OK == statusDlg.open()) {
                     result = true;
                 } else {
index e43eb6a..a3b83af 100644 (file)
@@ -31,7 +31,7 @@ import java.util.List;
 
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.widgets.Shell;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkg.model.IPackage;
 
 public class PlatformLaunchWizardDialog extends WizardDialog {
 
@@ -60,7 +60,7 @@ public class PlatformLaunchWizardDialog extends WizardDialog {
         }
     }
 
-    public List<LocalPackage> getExtraPackages() {
+    public List<IPackage> getExtraPackages() {
         if (wizard != null) {
             return wizard.getExtraPackages();
         } else {
index c04a83f..2444fdf 100644 (file)
@@ -51,8 +51,7 @@ 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.LocalPackage;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 
 public class ShowPackageStatusDialog extends Dialog {
 
@@ -67,13 +66,13 @@ public class ShowPackageStatusDialog extends Dialog {
 
     private TableViewer bsViewer;
     private TableViewer dvViewer;
-    private List<LocalPackage> bsPackages = new ArrayList<LocalPackage>();
-    private List<LocalPackage> dvPackages = new ArrayList<LocalPackage>();
-    private List<LocalPackage> selectedBsPackages = new ArrayList<LocalPackage>();
-    private List<LocalPackage> selectedDvPackages = new ArrayList<LocalPackage>();
+    private List<PkgStatus> bsPackages = new ArrayList<PkgStatus>();
+    private List<PkgStatus> dvPackages = new ArrayList<PkgStatus>();
+    private List<PkgStatus> selectedBsPackages = new ArrayList<PkgStatus>();
+    private List<PkgStatus> selectedDvPackages = new ArrayList<PkgStatus>();
 
-    public ShowPackageStatusDialog(Shell parentShell, List<LocalPackage> bsPkgs,
-            List<LocalPackage> dvPkgs) {
+    public ShowPackageStatusDialog(Shell parentShell, List<PkgStatus> bsPkgs,
+            List<PkgStatus> dvPkgs) {
         super(parentShell);
         Rectangle bounds = parentShell.getBounds();
         x = bounds.x + (bounds.width - width) / 2;
@@ -128,9 +127,9 @@ public class ShowPackageStatusDialog extends Dialog {
         for (int i = 0; i < recentTableIndex; i++) {
             TableItem item = null;
             item = bsViewer.getTable().getItem(i);
-            LocalPackage pkg = (LocalPackage) item.getData();
-            if (pkg.getCheckColumn()) {
-                selectedBsPackages.add(pkg);
+            PkgStatus pkgStatus = (PkgStatus) item.getData();
+            if (pkgStatus.isChecked()) {
+                selectedBsPackages.add(pkgStatus);
             }
         }
 
@@ -138,9 +137,9 @@ public class ShowPackageStatusDialog extends Dialog {
         for (int i = 0; i < recentTableIndex; i++) {
             TableItem item = null;
             item = dvViewer.getTable().getItem(i);
-            LocalPackage pkg = (LocalPackage) item.getData();
-            if (pkg.getCheckColumn()) {
-                selectedDvPackages.add(pkg);
+            PkgStatus pkgStatus = (PkgStatus) item.getData();
+            if (pkgStatus.isChecked()) {
+                selectedDvPackages.add(pkgStatus);
             }
         }
 
@@ -152,11 +151,11 @@ public class ShowPackageStatusDialog extends Dialog {
         super.cancelPressed();
     }
 
-    public List<LocalPackage> getSelectedBsPkgs() {
+    public List<PkgStatus> getSelectedBsPkgs() {
         return selectedBsPackages;
     }
 
-    public List<LocalPackage> getSelectedDvPkgs() {
+    public List<PkgStatus> getSelectedDvPkgs() {
         return selectedDvPackages;
     }
 
@@ -183,8 +182,8 @@ public class ShowPackageStatusDialog extends Dialog {
             @Override
             public void handleEvent(Event event) {
                 if (event.detail == SWT.CHECK) {
-                    Package pkg = (Package) event.item.getData();
-                    pkg.setCheckColumn(!pkg.getCheckColumn());
+                    PkgStatus pkgStatus = (PkgStatus) event.item.getData();
+                    pkgStatus.setChecked(!pkgStatus.isChecked());
                 }
             }
         });
@@ -219,8 +218,8 @@ public class ShowPackageStatusDialog extends Dialog {
             @Override
             public void handleEvent(Event event) {
                 if (event.detail == SWT.CHECK) {
-                    Package pkg = (Package) event.item.getData();
-                    pkg.setCheckColumn(!pkg.getCheckColumn());
+                    PkgStatus pkgStatus = (PkgStatus) event.item.getData();
+                    pkgStatus.setChecked(!pkgStatus.isChecked());
                 }
             }
         });
@@ -247,8 +246,8 @@ public class ShowPackageStatusDialog extends Dialog {
         colPackage.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
-                Package pkg = (Package) element;
-                return pkg.getName();
+                PkgStatus pkgStatus = (PkgStatus) element;
+                return pkgStatus.getPackage().getName();
             }
         });
 
@@ -257,9 +256,8 @@ public class ShowPackageStatusDialog extends Dialog {
         colArch.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
-                Package pkg = (Package) element;
-                String arch = pkg.getArch();
-                return arch;
+                PkgStatus pkgStatus = (PkgStatus) element;
+                return pkgStatus.getPackage().getArch();
             }
         });
 
@@ -269,9 +267,8 @@ public class ShowPackageStatusDialog extends Dialog {
         colNewVer.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
-                Package pkg = (Package) element;
-                String newVer = pkg.getNewVersion();
-                return newVer;
+                PkgStatus pkgStatus = (PkgStatus) element;
+                return pkgStatus.getNewVer();
             }
         });
 
@@ -280,9 +277,8 @@ public class ShowPackageStatusDialog extends Dialog {
         colInsVer.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
-                Package pkg = (Package) element;
-                String installedVer = pkg.getInstalledVersion();
-                return installedVer;
+                PkgStatus pkgStatus = (PkgStatus) element;
+                return pkgStatus.getInstalledVer();
             }
         });
 
@@ -292,8 +288,8 @@ public class ShowPackageStatusDialog extends Dialog {
         colStatus.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
-                Package pkg = (Package) element;
-                String status = pkg.getInstallInfo().toString();
+                PkgStatus pkgStatus = (PkgStatus) element;
+                String status = pkgStatus.getInstallInfo().toString();
                 return status;
             }
         });
@@ -316,16 +312,16 @@ public class ShowPackageStatusDialog extends Dialog {
         for (int i = 0; i < recentTableIndex; i++) {
             TableItem item = null;
             item = bsViewer.getTable().getItem(i);
-            Package pkg = (Package) item.getData();
-            item.setChecked(pkg.getCheckColumn());
+            PkgStatus pkgStatus = (PkgStatus) item.getData();
+            item.setChecked(pkgStatus.isChecked());
         }
 
         recentTableIndex = dvViewer.getTable().getItemCount();
         for (int i = 0; i < recentTableIndex; i++) {
             TableItem item = null;
             item = dvViewer.getTable().getItem(i);
-            Package pkg = (Package) item.getData();
-            item.setChecked(pkg.getCheckColumn());
+            PkgStatus pkgStatus = (PkgStatus) item.getData();
+            item.setChecked(pkgStatus.isChecked());
         }
     }
 
index adb9318..3289327 100644 (file)
@@ -178,8 +178,9 @@ public class PlatformManifestXMLStore implements IPlatformXMLStore {
        }
        
        private static String getChildValue(Node node) {
-               if (node.getFirstChild() != null)
+               if (node.getFirstChild() != null) {
                        return node.getFirstChild().getNodeValue();
+               }
                return null;
        }
 
index 7f322bb..7373cf6 100644 (file)
@@ -1,9 +1,10 @@
 package org.tizen.nativeplatform.pkg.commander;
 
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.core.resources.IProject;
+import java.util.List;
+
 import org.eclipse.core.runtime.IProgressMonitor;
 
 public interface IPackager {
     boolean packaging(IProgressMonitor monitor);
+    List<String> getProjectPackages();
 }
index 7a5f586..9e605c4 100644 (file)
@@ -31,8 +31,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
 
 public interface IPkgCommander {
     
@@ -72,13 +72,13 @@ public interface IPkgCommander {
 
     ICommandStatus copyFiles(String[] fileList);
 
-    List<Package> getAllPkgList();
+    List<PkgStatus> getAllPkgList();
 
-    Map<String, Package> getAllPkgMap();
+    Map<String, PkgStatus> getAllPkgMap();
 
-    Map<String, Package> getRemotePkgList();
+    Map<String, PkgStatus> getRemotePkgList();
 
-    Map<String, Package> getLocalPkgList();
+    Map<String, PkgStatus> getLocalPkgList();
 
     Map<String, String> getRepoList();
 
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgFilter.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgFilter.java
new file mode 100644 (file)
index 0000000..ccbf381
--- /dev/null
@@ -0,0 +1,10 @@
+package org.tizen.nativeplatform.pkg.commander;
+
+import java.util.List;
+
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+
+public interface IPkgFilter {
+    List<IPackage> filter(CmdTargetTypes type, final List<IPackage> list);
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgModelMaker.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgModelMaker.java
new file mode 100644 (file)
index 0000000..c81c368
--- /dev/null
@@ -0,0 +1,10 @@
+package org.tizen.nativeplatform.pkg.commander;
+
+import java.util.List;
+
+import org.tizen.nativeplatform.pkg.model.IPackage;
+
+public interface IPkgModelMaker {
+    IPackage makeModel(String filePath);
+    List<IPackage> makeModels(List<String> filePaths);
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgStatusUpdater.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgStatusUpdater.java
new file mode 100644 (file)
index 0000000..956d729
--- /dev/null
@@ -0,0 +1,11 @@
+package org.tizen.nativeplatform.pkg.commander;
+
+import java.util.List;
+
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+
+public interface IPkgStatusUpdater {
+    List<PkgStatus> updateStatus(CmdTargetTypes type, final List<IPackage> list);
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgType.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/IPkgType.java
deleted file mode 100644 (file)
index 8d21c1e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.tizen.nativeplatform.pkg.commander;
-
-public interface IPkgType {
-    enum PKGTYPE {
-        RPM("rpm");
-
-        final String ext;
-
-        private PKGTYPE(String ext) {
-            this.ext = ext;
-        }
-
-        public String getExe() {
-            return ext;
-        }
-    }
-}
index 9bee388..e919480 100644 (file)
@@ -1,7 +1,14 @@
 package org.tizen.nativeplatform.pkg.commander;
 
-import org.tizen.nativeplatform.pkg.commander.PkgCommanderFactory;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativeplatform.pkg.commander.rpm.RpmCommanderDevice;
+import org.tizen.nativeplatform.pkg.commander.rpm.RpmCommanderHost;
+import org.tizen.nativeplatform.pkg.commander.rpm.RpmCommanderRootstrap;
 import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.types.PkgTypes;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 import org.tizen.sdblib.IDevice;
 
@@ -12,26 +19,35 @@ public class PkgCommandTarget {
     private IPkgCommander dvCommander = null;
     private IPkgCommander rtCommander = null;
     private String http_proxy = "";
+    private PkgTypes type;
 
-    public PkgCommandTarget() {
+    public PkgCommandTarget(PkgTypes type) {
+        setPkgType(type);
         http_proxy = PreferencesManager.getHttpProxyURL();
     }
 
-    public PkgCommandTarget(IDevice device) {
+    public PkgCommandTarget(PkgTypes type, IDevice device) {
+        setPkgType(type);
         setDevice(device);
         http_proxy = PreferencesManager.getHttpProxyURL();
     }
 
-    public PkgCommandTarget(PlatformRootstrap rootstrap) {
+    public PkgCommandTarget(PkgTypes type, PlatformRootstrap rootstrap) {
+        setPkgType(type);
         setRootstrap(rootstrap);
         http_proxy = PreferencesManager.getHttpProxyURL();
     }
 
-    public PkgCommandTarget(IDevice device, PlatformRootstrap rootstrap) {
+    public PkgCommandTarget(PkgTypes type, IDevice device, PlatformRootstrap rootstrap) {
+        setPkgType(type);
         setDevice(device);
         setRootstrap(rootstrap);
         http_proxy = PreferencesManager.getHttpProxyURL();
     }
+    
+    public void setPkgType(PkgTypes type) {
+        this.type = type;
+    }
 
     public void setDevice(IDevice device) {
         this.device = device;
@@ -48,28 +64,50 @@ public class PkgCommandTarget {
     public PlatformRootstrap getRootstrap() {
         return rootstrap;
     }
+    
+    public IPkgCommander getCommander(CmdTargetTypes type) {
+        if (type.equals(CmdTargetTypes.HOST)) {
+            return getHostCommander();
+        } else if (type.equals(CmdTargetTypes.DEVICE)) {
+            return getDeviceCommander();
+        } else if (type.equals(CmdTargetTypes.ROOTSTRAP)) {
+            return getRootstrapCommander();
+        }
+        return null;
+    }
 
-    public IPkgCommander getHostCommander() {
+    private IPkgCommander getHostCommander() {
         if (hsCommander == null) {
-            hsCommander = PkgCommanderFactory.getHostCommander();
+            if (type.equals(PkgTypes.RPM)) {
+                hsCommander = new RpmCommanderHost();
+            }
             hsCommander.setHttpProxy(http_proxy);
         }
-
         return hsCommander;
     }
 
-    public IPkgCommander getDeviceCommander() {
+    private IPkgCommander getDeviceCommander() {
         if (dvCommander == null) {
-            dvCommander = PkgCommanderFactory.getDeviceCommander(this);
+            if (type.equals(PkgTypes.RPM)) {
+                if (isSetDevice()) {
+                    dvCommander = new RpmCommanderDevice(device);
+                }
+            }
             dvCommander.setHttpProxy(http_proxy);
         }
-
         return dvCommander;
     }
 
-    public IPkgCommander getRootstrapCommander() {
+    private IPkgCommander getRootstrapCommander() {
         if (rtCommander == null) {
-            rtCommander = PkgCommanderFactory.getRootstrapCommander(this);
+            if (type.equals(PkgTypes.RPM)) {
+                if (isSetRootstrap()) {
+                    IPath basePath = rootstrap.getPath();
+                    String rootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(
+                            basePath);
+                    rtCommander = new RpmCommanderRootstrap(new Path(rootPath));
+                }
+            }
             rtCommander.setHttpProxy(http_proxy);
         }
 
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/PkgCommanderFactory.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/PkgCommanderFactory.java
deleted file mode 100644 (file)
index eebc367..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.tizen.nativeplatform.pkg.commander;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.tizen.nativecommon.build.SmartBuildInterface;
-import org.tizen.nativeplatform.pkg.commander.rpm.RpmCommanderDevice;
-import org.tizen.nativeplatform.pkg.commander.rpm.RpmCommanderHost;
-import org.tizen.nativeplatform.pkg.commander.rpm.RpmCommanderRootstrap;
-
-public class PkgCommanderFactory {
-
-    public static IPkgCommander getDeviceCommander(PkgCommandTarget target) {
-        return getDeviceCommander(IPkgType.PKGTYPE.RPM, target);
-    }
-
-    public static IPkgCommander getRootstrapCommander(PkgCommandTarget target) {
-        return getRootstrapCommander(IPkgType.PKGTYPE.RPM, target);
-    }
-
-    public static IPkgCommander getHostCommander() {
-        return getHostCommander(IPkgType.PKGTYPE.RPM);
-    }
-
-    public static IPkgCommander getHostCommander(IPkgType.PKGTYPE type) {
-        if (type.equals(IPkgType.PKGTYPE.RPM)) {
-            return new RpmCommanderHost();
-        } else {
-            return null;
-        }
-    }
-
-    public static IPkgCommander getDeviceCommander(IPkgType.PKGTYPE type, PkgCommandTarget target) {
-        if (type.equals(IPkgType.PKGTYPE.RPM)) {
-            if (target.isSetDevice()) {
-                return new RpmCommanderDevice(target.getDevice());
-            } else {
-                return null;
-            }
-        } else {
-            return null;
-        }
-    }
-
-    public static IPkgCommander getRootstrapCommander(IPkgType.PKGTYPE type, PkgCommandTarget target) {
-        if (type.equals(IPkgType.PKGTYPE.RPM)) {
-            if (target.isSetRootstrap()) {
-                IPath basePath = target.getRootstrap().getPath();
-                String rootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(
-                        basePath);
-                return new RpmCommanderRootstrap(new Path(rootPath));
-            } else {
-                return null;
-            }
-        } else {
-            return null;
-        }
-    }
-}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/PkgVersionComparerFactory.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/PkgVersionComparerFactory.java
deleted file mode 100644 (file)
index 770d711..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.tizen.nativeplatform.pkg.commander;
-
-import org.tizen.nativeplatform.pkg.commander.rpm.RpmVersionComparer;
-
-public class PkgVersionComparerFactory {
-
-    public static IPkgVersionComparer getComparer() {
-        return getComparer(IPkgType.PKGTYPE.RPM);
-    }
-
-    public static IPkgVersionComparer getComparer(IPkgType.PKGTYPE type) {
-        if (type.equals(IPkgType.PKGTYPE.RPM)) {
-            return new RpmVersionComparer();
-        } else {
-            return null;
-        }
-    }
-}
@@ -1,18 +1,16 @@
-package org.tizen.nativeplatform.pkg.commander;
+package org.tizen.nativeplatform.pkg.commander.factories;
 
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.core.resources.IProject;
+import org.tizen.nativeplatform.pkg.commander.IPackager;
 import org.tizen.nativeplatform.pkg.commander.rpm.RpmPackager;
+import org.tizen.nativeplatform.types.PkgTypes;
 
 public class PackagerFactory {
 
-    public static IPackager getPackager(IProject project, IConfiguration config) {
-        return getPackager(IPkgType.PKGTYPE.RPM, project, config);
-    }
-
-    public static IPackager getPackager(IPkgType.PKGTYPE type, IProject project,
+    public static IPackager getPackager(PkgTypes type, IProject project,
             IConfiguration config) {
-        if (type.equals(IPkgType.PKGTYPE.RPM)) {
+        if (type.equals(PkgTypes.RPM)) {
             return new RpmPackager(project, config);
         } else {
             return null;
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgFilterFactory.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgFilterFactory.java
new file mode 100644 (file)
index 0000000..c82d19b
--- /dev/null
@@ -0,0 +1,15 @@
+package org.tizen.nativeplatform.pkg.commander.factories;
+
+import org.tizen.nativeplatform.pkg.commander.IPkgFilter;
+import org.tizen.nativeplatform.pkg.commander.rpm.RpmPackageFilter;
+import org.tizen.nativeplatform.types.PkgTypes;
+
+public class PkgFilterFactory {
+    public static IPkgFilter getFilter(PkgTypes type) {
+        if (type.equals(PkgTypes.RPM)) {
+            IPkgFilter filter = new RpmPackageFilter();
+            return filter;
+        }
+        return null;
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgModelMakerFactory.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgModelMakerFactory.java
new file mode 100644 (file)
index 0000000..e9e46f3
--- /dev/null
@@ -0,0 +1,15 @@
+package org.tizen.nativeplatform.pkg.commander.factories;
+
+import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
+import org.tizen.nativeplatform.pkg.commander.rpm.RpmModelMaker;
+import org.tizen.nativeplatform.types.PkgTypes;
+
+public class PkgModelMakerFactory {
+    public static IPkgModelMaker getMaker(PkgTypes type) {
+        if (type.equals(PkgTypes.RPM)) {
+            IPkgModelMaker maker = new RpmModelMaker();
+            return maker;
+        }
+        return null;
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgStatusUpdaterFactory.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgStatusUpdaterFactory.java
new file mode 100644 (file)
index 0000000..7ed62fa
--- /dev/null
@@ -0,0 +1,16 @@
+package org.tizen.nativeplatform.pkg.commander.factories;
+
+import org.tizen.nativeplatform.pkg.commander.IPkgStatusUpdater;
+import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
+import org.tizen.nativeplatform.pkg.commander.rpm.RpmStatusUpdater;
+import org.tizen.nativeplatform.types.PkgTypes;
+
+public class PkgStatusUpdaterFactory {
+    public static IPkgStatusUpdater getUpdater(PkgTypes type, PkgCommandTarget target) {
+        if (type.equals(PkgTypes.RPM)) {
+            IPkgStatusUpdater updater = new RpmStatusUpdater(target);
+            return updater;
+        }
+        return null;
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgVersionComparerFactory.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/factories/PkgVersionComparerFactory.java
new file mode 100644 (file)
index 0000000..5f8cfbc
--- /dev/null
@@ -0,0 +1,16 @@
+package org.tizen.nativeplatform.pkg.commander.factories;
+
+import org.tizen.nativeplatform.pkg.commander.IPkgVersionComparer;
+import org.tizen.nativeplatform.pkg.commander.rpm.RpmVersionComparer;
+import org.tizen.nativeplatform.types.PkgTypes;
+
+public class PkgVersionComparerFactory {
+
+    public static IPkgVersionComparer getComparer(PkgTypes type) {
+        if (type.equals(PkgTypes.RPM)) {
+            return new RpmVersionComparer();
+        } else {
+            return null;
+        }
+    }
+}
index 0d53126..e7539b5 100644 (file)
@@ -41,12 +41,14 @@ import org.slf4j.LoggerFactory;
 import org.tizen.common.ui.view.console.ConsoleManager;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
 import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
+import org.tizen.nativeplatform.pkg.model.Package;
 import org.tizen.nativeplatform.pkg.tools.PkgcmdTool;
 import org.tizen.nativeplatform.pkg.tools.RpmTool;
 import org.tizen.nativeplatform.pkg.tools.ZypperTool;
 import org.tizen.nativeplatform.pkg.tools.ZypperXmlParser;
 import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.types.PkgInstallTypes;
 import org.tizen.nativeplatform.util.CharacterStripper;
 import org.tizen.nativeplatform.util.CommandLauncher;
 
@@ -75,7 +77,7 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
      */
     abstract protected PackageManagerOuputReceiver getNewOuputReceiver();
 
-    abstract public Map<String, Package> getLocalPkgList();
+    abstract public Map<String, PkgStatus> getLocalPkgList();
 
     abstract public ICommandStatus copyFiles(String[] fileList);
 
@@ -342,21 +344,21 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
         return uninstallPkg(pkgs, monitor);
     }
 
-    public List<Package> getAllPkgList() {
-        Map<String, Package> pkgMap = getAllPkgMap();
-        List<Package> list = new ArrayList<Package>();
+    public List<PkgStatus> getAllPkgList() {
+        Map<String, PkgStatus> pkgMap = getAllPkgMap();
+        List<PkgStatus> list = new ArrayList<PkgStatus>();
         if (pkgMap != null && !pkgMap.isEmpty()) {
-            for (Entry<String, Package> set : pkgMap.entrySet()) {
+            for (Entry<String, PkgStatus> set : pkgMap.entrySet()) {
                 list.add(set.getValue());
             }
         }
         return list;
     }
 
-    public Map<String, Package> getAllPkgMap() {
-        Map<String, Package> allPkgs = new HashMap<String, Package>();
-        Map<String, Package> localPkgs = getLocalPkgList();
-        Map<String, Package> remotePkgs = getRemotePkgList();
+    public Map<String, PkgStatus> getAllPkgMap() {
+        Map<String, PkgStatus> allPkgs = new HashMap<String, PkgStatus>();
+        Map<String, PkgStatus> localPkgs = getLocalPkgList();
+        Map<String, PkgStatus> remotePkgs = getRemotePkgList();
 
         if (remotePkgs != null) {
             allPkgs.putAll(remotePkgs);
@@ -364,15 +366,15 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
 
         if (localPkgs != null) {
             if (!allPkgs.isEmpty()) {
-                for (Entry<String, Package> e : localPkgs.entrySet()) {
+                for (Entry<String, PkgStatus> e : localPkgs.entrySet()) {
                     String name = e.getKey();
                     // if remote list has the package and it is not installed,
                     // set install version and put it.
                     if (remotePkgs.containsKey(name)) {
-                        Package pkg = remotePkgs.get(name);
+                        PkgStatus pkg = remotePkgs.get(name);
                         if (!pkg.isInstalled()) {
-                            Package lpkg = e.getValue();
-                            pkg.setInstalledVersion(lpkg.getInstalledVersion());
+                            PkgStatus lpkg = e.getValue();
+                            pkg.setInstalledVer(lpkg.getInstalledVer());
                             allPkgs.remove(name);
                             allPkgs.put(name, pkg);
                         }
@@ -390,7 +392,7 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
         return allPkgs;
     }
 
-    public Map<String, Package> getRemotePkgList() {
+    public Map<String, PkgStatus> getRemotePkgList() {
         String command = makeCommand(getProxyCommand(), getResetRpmDb(),
                 ZypperTool.remotePkgListCommandWithXmlOut());
         PackageManagerOuputReceiver hrec = getNewOuputReceiver();
@@ -400,7 +402,7 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
             return null;
         }
 
-        Map<String, Package> result = null;
+        Map<String, PkgStatus> result = null;
         List<String> value = status.getValues();
         if (value != null && value.size() > 0) {
             String xml = makeNewlineString(value);
@@ -418,7 +420,7 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
         return result;
     }
 
-    public Map<String, Package> getLocalPkgList(String tag) {
+    public Map<String, PkgStatus> getLocalPkgList(String tag) {
         String command = makeCommand(getResetRpmDb(), RpmTool.pkgListByTagCommand(tag));
         PackageManagerOuputReceiver hrec = getNewOuputReceiver();
         ICommandStatus status = execute(command, hrec, null);
@@ -427,7 +429,7 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
             return null;
         }
 
-        Map<String, Package> pkgMap = new HashMap<String, Package>();
+        Map<String, PkgStatus> pkgMap = new HashMap<String, PkgStatus>();
         List<String> value = status.getValues();
         String content = "";
         if (value != null && value.size() > 0) {
@@ -448,6 +450,18 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
                 String name = part[0];
                 String version = part[1];
                 String arch = part[2];
+                Package pkg = new Package(name, version, arch);
+                PkgStatus origStatus = pkgMap.get(name);
+                if (origStatus == null) {
+                    PkgStatus newStatus = new PkgStatus(pkg);
+                    newStatus.setInstalledVer(version);
+                    newStatus.setInstallInfo(PkgInstallTypes.INSTALLED);
+                    pkgMap.put(name, newStatus);
+                } else {
+                    origStatus.setInstalledVer(version);
+                    origStatus.setInstallInfo(PkgInstallTypes.INSTALLED);
+                }
+                /*
                 Package pkg = pkgMap.get(name);
                 if (pkg == null) {
                     pkgMap.put(name, new Package(name, version, Package.INSTALLINFO.INSTALLED, "",
@@ -456,6 +470,7 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
                     pkg.setInstalledVersion(version);
                     pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
                 }
+                */
             }
         }
 
@@ -784,8 +799,9 @@ public abstract class RpmCommanderCommon implements IPkgCommander {
         for (int i = 0; i < size; i++) {
             String cmd = cmds[i];
             cmd = cmd.trim();
-            if (cmd.isEmpty())
+            if (cmd.isEmpty()) {
                 continue;
+            }
             if (i != size - 1) {
                 cmd = (cmd.endsWith(";")) ? cmd : cmd + CMD_DELIMITER;
             }
index 6851360..5b88cb8 100644 (file)
@@ -14,8 +14,8 @@ import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
 import org.tizen.nativeplatform.pkg.commander.CommandStatus;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
 import org.tizen.nativeplatform.util.CommandLauncherOnDevice;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.exception.SdbCommandRejectedException;
@@ -69,7 +69,7 @@ public class RpmCommanderDevice extends RpmCommanderCommon {
     }
 
     @Override
-    public Map<String, Package> getLocalPkgList() {
+    public Map<String, PkgStatus> getLocalPkgList() {
         String tag = "\\<pkg\\>%{NAME},%{VERSION}-%{RELEASE},%{ARCH}\\<\\/pkg\\>";
         return getLocalPkgList(tag);
     }
index ac2f407..453b8fa 100644 (file)
@@ -4,8 +4,8 @@ import java.util.Map;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
 
 public class RpmCommanderHost extends RpmCommanderCommon {
 
@@ -19,7 +19,7 @@ public class RpmCommanderHost extends RpmCommanderCommon {
     }
 
     @Override
-    public Map<String, Package> getLocalPkgList() {
+    public Map<String, PkgStatus> getLocalPkgList() {
         return null;
     }
 
index 209a7bc..d21a785 100644 (file)
@@ -13,8 +13,8 @@ import org.eclipse.core.runtime.Path;
 import org.tizen.common.util.FileUtil;
 import org.tizen.nativeplatform.pkg.commander.CommandStatus;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
 import org.tizen.nativeplatform.util.CommandLauncherOnRootstrap;
 
 public class RpmCommanderRootstrap extends RpmCommanderCommon {
@@ -32,7 +32,9 @@ public class RpmCommanderRootstrap extends RpmCommanderCommon {
 
     protected void actionBeforeUsingZypper() {
         /*
-         * (with --nodeps --force) Error: Subprocess failed. Error: RPM failed:
+         * (with --nodeps --force) 
+         * Error: Subprocess failed. 
+         * Error: RPM failed:
          * error: db4 error(-30971) from dbenv->open: DB_VERSION_MISMATCH:
          * Database environment version mismatch error: cannot open Packages
          * index using db4 - (-30971) error: cannot open Packages database in
@@ -62,7 +64,7 @@ public class RpmCommanderRootstrap extends RpmCommanderCommon {
     }
 
     @Override
-    public Map<String, Package> getLocalPkgList() {
+    public Map<String, PkgStatus> getLocalPkgList() {
         String tag = "\\\\<pkg\\\\>%{NAME},%{VERSION}-%{RELEASE},%{ARCH}\\\\<\\\\/pkg\\\\>";
         return getLocalPkgList(tag);
     }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmModelMaker.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmModelMaker.java
new file mode 100644 (file)
index 0000000..ed40597
--- /dev/null
@@ -0,0 +1,51 @@
+package org.tizen.nativeplatform.pkg.commander.rpm;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.nativeplatform.pkg.commander.IPkgModelMaker;
+import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.pkg.model.Package;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.types.PkgTypes;
+
+public class RpmModelMaker implements IPkgModelMaker {
+    protected final Logger logger = LoggerFactory.getLogger(RpmModelMaker.class);
+    
+    private PkgCommandTarget target;
+    
+    public RpmModelMaker() {
+        target = new PkgCommandTarget(PkgTypes.RPM);
+    }
+    
+    public IPackage makeModel(String filePath) {
+        File file = new File(filePath);
+        if (!file.exists()) {
+            logger.error(String.format("File not found: %s", filePath));
+            return null;
+        }
+        Package pkg = new Package();
+        String name = target.getCommander(CmdTargetTypes.HOST).getNameFromFile(filePath);
+        String ver = target.getCommander(CmdTargetTypes.HOST).getVerFromFile(filePath);
+        String arch = target.getCommander(CmdTargetTypes.HOST).getArchFromFile(filePath);
+        pkg.setPath(filePath);
+        pkg.setName(name);
+        pkg.setArch(arch);
+        pkg.setVer(ver);
+        return pkg;
+    }
+    
+    public List<IPackage> makeModels(List<String> filePaths) {
+        List<IPackage> pkgs = new ArrayList<IPackage>();
+        for (String path : filePaths) {
+            IPackage pkg = makeModel(path);
+            pkgs.add(pkg);
+        }
+        return pkgs;
+    }
+    
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmPackageFilter.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmPackageFilter.java
new file mode 100644 (file)
index 0000000..c396886
--- /dev/null
@@ -0,0 +1,49 @@
+package org.tizen.nativeplatform.pkg.commander.rpm;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.nativeplatform.pkg.commander.IPkgFilter;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+
+public class RpmPackageFilter implements IPkgFilter {
+    private final String POSTFIX_DEBUGSOURCE_PKG = "-debugsource";
+    private final String POSTFIX_DEBUGINFO_PKG = "-debuginfo";
+    private final String POSTFIX_DEVEL_PKG = "-devel";
+
+    public RpmPackageFilter() {
+    }
+
+    public List<IPackage> filter(CmdTargetTypes type, final List<IPackage> list) {
+        if (type.equals(CmdTargetTypes.DEVICE)) {
+            return filterDevicePkg(list);
+        } else if (type.equals(CmdTargetTypes.ROOTSTRAP)) {
+            return filterRootstrapPkg(list);
+        } else {
+            return filterRootstrapPkg(list);
+        }
+    }
+
+    private List<IPackage> filterDevicePkg(final List<IPackage> list) {
+        List<IPackage> result = new ArrayList<IPackage>();
+        for (IPackage pkg : list) {
+            String name = pkg.getName();
+            if (name.contains(POSTFIX_DEBUGSOURCE_PKG) || name.contains(POSTFIX_DEBUGINFO_PKG)
+                    || name.contains(POSTFIX_DEVEL_PKG)) {
+                continue;
+            } else {
+                result.add(pkg.clone());
+            }
+        }
+        return result;
+    }
+
+    private List<IPackage> filterRootstrapPkg(final List<IPackage> list) {
+        List<IPackage> result = new ArrayList<IPackage>();
+        for (IPackage pkg : list) {
+            result.add(pkg.clone());
+        }
+        return result;
+    }
+}
index 3dcedf7..14820e7 100644 (file)
@@ -1,20 +1,23 @@
 package org.tizen.nativeplatform.pkg.commander.rpm;
 
+import java.io.File;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
 import org.tizen.nativecommon.build.CommonProjectDependentPackager;
 import org.tizen.nativecommon.build.ProjectTypeManager;
 import org.tizen.nativecommon.build.exception.SBIException;
 import org.tizen.nativeplatform.build.PlatformCheckCancelJob;
-import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
+import org.tizen.nativeplatform.filefilter.RpmFileFilter;
 import org.tizen.nativeplatform.pkg.commander.IPackager;
-import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
 
 public class RpmPackager implements IPackager {
 
@@ -57,8 +60,7 @@ public class RpmPackager implements IPackager {
         monitor.worked(1);
         cancelJob.setFinishFlag(true);
         monitor.subTask("Refreshing project...");
-        PlatformLaunchUtils launchUtils = new PlatformLaunchUtils(new PkgCommandTarget());
-        List<LocalPackage> pkgfiles = launchUtils.getProjectPackages(project, config.getName());
+        List<String> pkgfiles = getProjectPackages();
         try {
             project.refreshLocal(IResource.DEPTH_INFINITE, null);
         } catch (CoreException e) {
@@ -69,4 +71,18 @@ public class RpmPackager implements IPackager {
         monitor.done();
         return result;
     }
+
+    public List<String> getProjectPackages() {
+        List<String> pkgs = new ArrayList<String>();
+        IFolder folder = project.getFolder(config.getName());
+        File dir = new File(folder.getLocation().toOSString());
+        if (dir.exists()) {
+            String[] files = dir.list(new RpmFileFilter());
+            for (String file : files) {
+                IPath pkgPath = new Path(dir.getPath()).append(file);
+                pkgs.add(pkgPath.toOSString());
+            }
+        }
+        return pkgs;
+    }
 }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmStatusUpdater.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/commander/rpm/RpmStatusUpdater.java
new file mode 100644 (file)
index 0000000..916283f
--- /dev/null
@@ -0,0 +1,56 @@
+package org.tizen.nativeplatform.pkg.commander.rpm;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
+import org.tizen.nativeplatform.pkg.commander.IPkgStatusUpdater;
+import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.types.PkgInstallTypes;
+
+public class RpmStatusUpdater implements IPkgStatusUpdater {
+    private PkgCommandTarget target;
+    
+    public RpmStatusUpdater(PkgCommandTarget target) {
+        this.target = target;
+    }
+
+    public List<PkgStatus> updateStatus(CmdTargetTypes type, final List<IPackage> list) {
+        return updateStatus(target.getCommander(type), list);
+    }
+    
+    private List<PkgStatus> updateStatus(IPkgCommander commander, final List<IPackage> list) {
+        if (commander == null) {
+            return null;
+        }
+        List<PkgStatus> result = new ArrayList<PkgStatus>();
+        for (IPackage pkg : list) {
+            PkgStatus status = new PkgStatus(pkg);
+            String[] installedVer = commander.getVer(pkg.getName());
+            String newVer = pkg.getVer();
+            status.setNewVer(newVer);
+            status.setChecked(true);
+            if (newVer == null || newVer.isEmpty()) {
+                status.setChecked(false);
+            }
+
+            if (installedVer == null || installedVer.length <= 0) {
+                status.setInstallInfo(PkgInstallTypes.NOT_INSTALLED);
+            } else {
+                status.setInstalledVer(installedVer[0]);
+                if (installedVer[0].equals(newVer)) {
+                    if (commander.checkPkgInstalled(pkg.getName())) {
+                        status.setInstallInfo(PkgInstallTypes.INSTALLED);
+                    }
+                } else {
+                    status.setInstallInfo(PkgInstallTypes.DIFFERENT_VERSION);
+                }
+            }
+            result.add(status);
+        }
+        return result;
+    }
+}
index 77cbd17..97e652c 100644 (file)
@@ -33,14 +33,14 @@ public class RpmVersionComparer implements IPkgVersionComparer {
                 value1 = Integer.parseInt(tok1);
             } catch (NumberFormatException e) {
                 // do nothing
-                // e.printStackTrace();
+                e.printStackTrace();
             }
 
             try {
                 value2 = Integer.parseInt(tok2);
             } catch (NumberFormatException e) {
                 // do nothing
-                // e.printStackTrace();
+                e.printStackTrace();
             }
 
             if (value1 > value2) {
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/IPackage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/IPackage.java
new file mode 100644 (file)
index 0000000..5dab4e2
--- /dev/null
@@ -0,0 +1,12 @@
+package org.tizen.nativeplatform.pkg.model;
+
+import org.tizen.nativeplatform.types.PkgTypes;
+
+public interface IPackage {
+    String getName();
+    String getVer();
+    String getArch();
+    String getPath();
+    PkgTypes getType();
+    IPackage clone();
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/Package.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/Package.java
new file mode 100644 (file)
index 0000000..a2f3411
--- /dev/null
@@ -0,0 +1,77 @@
+package org.tizen.nativeplatform.pkg.model;
+
+import org.tizen.nativeplatform.types.PkgTypes;
+
+public class Package implements IPackage {
+    private String name = "";
+    private String ver = "";
+    private String arch = "";
+    private String path = "";
+
+    public Package() {
+    }
+    
+    public Package(String name, String ver, String arch, String path) {
+        setName(name);
+        setVer(ver);
+        setArch(arch);
+        setPath(path);
+    }
+    
+    public Package(String name, String ver, String arch) {
+        setName(name);
+        setVer(ver);
+        setArch(arch);
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+    public void setVer(String ver) {
+        this.ver = ver;
+    }
+    
+    public void setArch(String arch) {
+        this.arch = arch;
+    }
+    
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getVer() {
+        return ver;
+    }
+
+    @Override
+    public String getArch() {
+        return arch;
+    }
+
+    @Override
+    public String getPath() {
+        return path;
+    }
+
+    @Override
+    public PkgTypes getType() {
+        return PkgTypes.RPM;
+    }
+    
+    public IPackage clone() {
+        Package newPkg = new Package();
+        newPkg.setArch(getArch());
+        newPkg.setName(getName());
+        newPkg.setVer(getVer());
+        newPkg.setPath(getPath());
+        return newPkg;
+    }
+
+}
  *
  */
 
-package org.tizen.nativeplatform.pkgmgr.model;
+package org.tizen.nativeplatform.pkg.model;
 
 import java.util.concurrent.CopyOnWriteArrayList;
 
+
 public enum PackageProvider {
        INSTANCE;
        
-       private CopyOnWriteArrayList<Package> buildsystem_pkgs;
-       private CopyOnWriteArrayList<Package> device_pkgs;
+       private CopyOnWriteArrayList<PkgStatus> buildsystem_pkgs;
+       private CopyOnWriteArrayList<PkgStatus> device_pkgs;
        
        private PackageProvider()
        {
-               buildsystem_pkgs = new CopyOnWriteArrayList <Package>();
-               device_pkgs = new CopyOnWriteArrayList <Package>();
+               buildsystem_pkgs = new CopyOnWriteArrayList <PkgStatus>();
+               device_pkgs = new CopyOnWriteArrayList <PkgStatus>();
        }
        
        public void clear() {
@@ -46,20 +47,20 @@ public enum PackageProvider {
                device_pkgs.clear();
        }
        
-       public CopyOnWriteArrayList<Package> getBuildsystemPkgs()
+       public CopyOnWriteArrayList<PkgStatus> getBuildsystemPkgs()
        {
                return buildsystem_pkgs;
        }
 
-       public CopyOnWriteArrayList<Package> getSelectedBuildsystemPkgs(boolean remove)
+       public CopyOnWriteArrayList<PkgStatus> getSelectedBuildsystemPkgs(boolean remove)
        {
-               CopyOnWriteArrayList<Package> selectedList = new CopyOnWriteArrayList<Package>(); 
-               for( Package pkg: buildsystem_pkgs ) {
+               CopyOnWriteArrayList<PkgStatus> selectedList = new CopyOnWriteArrayList<PkgStatus>(); 
+               for( PkgStatus pkg: buildsystem_pkgs ) {
                        if ( pkg.isChecked() ) {
-                               if ( remove && !pkg.getInstalledVersion().isEmpty() ) {
+                               if ( remove && !pkg.getInstalledVer().isEmpty() ) {
                                        selectedList.add(pkg);
                                }
-                               else if ( !remove && !pkg.getNewVersion().isEmpty() ) {
+                               else if ( !remove && !pkg.getNewVer().isEmpty() ) {
                                        selectedList.add(pkg);
                                }
                        }
@@ -68,21 +69,21 @@ public enum PackageProvider {
                return selectedList;
        }
 
-       public CopyOnWriteArrayList<Package> getDevicePkgs()
+       public CopyOnWriteArrayList<PkgStatus> getDevicePkgs()
        {
                return device_pkgs;
        }
 
        
-       public CopyOnWriteArrayList<Package> getSelectedDevicePkgs(boolean remove)
+       public CopyOnWriteArrayList<PkgStatus> getSelectedDevicePkgs(boolean remove)
        {
-               CopyOnWriteArrayList<Package> selectedList = new CopyOnWriteArrayList<Package>(); 
-               for( Package pkg: device_pkgs ) {
+               CopyOnWriteArrayList<PkgStatus> selectedList = new CopyOnWriteArrayList<PkgStatus>(); 
+               for( PkgStatus pkg: device_pkgs ) {
                        if ( pkg.isChecked() ) {
-                               if ( remove && !pkg.getInstalledVersion().isEmpty() ) {
+                               if ( remove && !pkg.getInstalledVer().isEmpty() ) {
                                        selectedList.add(pkg);
                                }
-                               else if ( !remove && !pkg.getNewVersion().isEmpty() ) {
+                               else if ( !remove && !pkg.getNewVer().isEmpty() ) {
                                        selectedList.add(pkg);
                                }
                        }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/PkgStatus.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkg/model/PkgStatus.java
new file mode 100644 (file)
index 0000000..8cfaee3
--- /dev/null
@@ -0,0 +1,69 @@
+package org.tizen.nativeplatform.pkg.model;
+
+import org.tizen.nativeplatform.types.PkgInstallTypes;
+
+
+public class PkgStatus {
+    private String installedVer = "";
+    private String newVer = "";
+    private PkgInstallTypes installType = PkgInstallTypes.NOT_INSTALLED;
+    private IPackage pkg;
+    private boolean checked = false;
+    private boolean isNewlyChanged = false;
+    
+    public PkgStatus(IPackage pkg) {
+        this.pkg = pkg;
+    }
+    
+    public IPackage getPkg() {
+        return pkg;
+    }
+    
+    public void setInstalledVer(String ver) {
+        this.installedVer = ver;
+    }
+    
+    public void setNewVer(String  ver) {
+        this.newVer = ver;
+    }
+    
+    public void setInstallInfo(PkgInstallTypes info) {
+        this.installType = info;
+    }
+    
+    public void setChecked(boolean check) {
+        this.checked = check;
+    }
+    
+    public void setNewlyChanged(boolean changed) {
+        this.isNewlyChanged = changed;
+    }
+
+    public String getInstalledVer() {
+        return installedVer;
+    }
+
+    public String getNewVer() {
+        return newVer;
+    }
+
+    public boolean isInstalled() {
+        return !(installedVer == null || installedVer.isEmpty());
+    }
+
+    public PkgInstallTypes getInstallInfo() {
+        return installType;
+    }
+
+    public boolean isChecked() {
+        return checked;
+    }
+
+    public IPackage getPackage() {
+        return pkg;
+    }
+
+    public boolean isNewlyChanged() {
+        return isNewlyChanged;
+    }
+}
index 7bb052c..b6116aa 100644 (file)
@@ -50,8 +50,9 @@ public class PkgcmdTool {
         String command = TOOL + WS;
         for (String op : options) {
             op = op.trim();
-            if (op.isEmpty())
+            if (op.isEmpty()) {
                 continue;
+            }
             command += op + WS;
         }
         return command.trim();
index 21e7a90..2bd9714 100644 (file)
@@ -151,8 +151,9 @@ public class RpmTool {
         String command = TOOL + WS;
         for (String op : options) {
             op = op.trim();
-            if (op.isEmpty())
+            if (op.isEmpty()) {
                 continue;
+            }
             command += op + WS;
         }
         return command.trim();
index d219e8c..c6c930d 100644 (file)
@@ -179,8 +179,9 @@ public class ZypperTool {
         String command = TOOL + WS;
         for (String op : options) {
             op = op.trim();
-            if (op.isEmpty())
+            if (op.isEmpty()) {
                 continue;
+            }
             command += op + WS;
         }
         return command.trim();
index d86670e..e808e96 100644 (file)
@@ -3,7 +3,6 @@ package org.tizen.nativeplatform.pkg.tools;
 import java.io.IOException;
 import java.io.StringReader;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Map;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -12,7 +11,9 @@ import javax.xml.parsers.ParserConfigurationException;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
+import org.tizen.nativeplatform.pkg.model.Package;
+import org.tizen.nativeplatform.types.PkgInstallTypes;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
@@ -111,16 +112,17 @@ public class ZypperXmlParser {
         if (streamNodes.getLength() > 0) {
             // <stream> node length should be one.
             Node node = streamNodes.item(0).getLastChild();
-            if (node == null)
+            if (node == null) {
                 return "";
+            }
             content = node.getNodeValue();
         }
         return content;
     }
 
-    public Map<String, Package> getPkgList() {
+    public Map<String, PkgStatus> getPkgList() {
         String list = getPkgListFromStreams();
-        Map<String, Package> pkgMap = new HashMap<String, Package>();
+        Map<String, PkgStatus> pkgMap = new HashMap<String, PkgStatus>();
 
         if (!list.isEmpty()) {
             for (String s : list.split(NEW_LINE)) {
@@ -130,19 +132,22 @@ public class ZypperXmlParser {
                     String name = part[2];
                     String version = part[3];
                     String arch = part[4];
+                    Package pkg = new Package(name, version, arch);
+                    PkgStatus newStatus = new PkgStatus(pkg);
+                    newStatus.setNewVer(version);
                     if (part[0].equals("i")) {
-                        pkgMap.put(name, new Package(name, version, Package.INSTALLINFO.INSTALLED,
-                                version, arch));
+                        newStatus.setInstalledVer(version);
+                        newStatus.setInstallInfo(PkgInstallTypes.INSTALLED);
                         /*
-                         * } else if (part[0].equals("v")) { Package p =
-                         * pkgMap.get(name); if (p != null &&
-                         * version.compareTo(p.getNewVersion()) > 0) {
-                         * p.setNewVersion(version); } else { pkgMap.put(name,
-                         * new Package(name, "", version, arch)); }
+                         * pkgMap.put(name, new Package(name, version,
+                         * Package.INSTALLINFO.INSTALLED, version, arch));
                          */
-                    } else {
-                        pkgMap.put(name, new Package(name, "", version, arch));
                     }
+                    pkgMap.put(name, newStatus);
+                    /*
+                     * else { pkgMap.put(name, new Package(name, "", version,
+                     * arch)); }
+                     */
                 }
             }
         }
@@ -203,11 +208,13 @@ public class ZypperXmlParser {
                 for (String value : attrValue) {
                     if (type.equals(value)) {
                         Node fChild = ii.getFirstChild();
-                        if (fChild == null)
+                        if (fChild == null) {
                             continue;
+                        }
                         String str = fChild.getNodeValue();
-                        if (str == null || str.isEmpty())
+                        if (str == null || str.isEmpty()) {
                             continue;
+                        }
                         result += "[" + value + "] " + str
                                 + ((str.endsWith(NEW_LINE)) ? "" : NEW_LINE);
                     }
index 385aadc..4bb8c96 100644 (file)
@@ -1,18 +1,18 @@
 package org.tizen.nativeplatform.pkgmgr;
 
-import java.util.Enumeration;
-import java.util.Hashtable;
 import java.util.Map;
 import java.util.Map.Entry;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
-import org.tizen.nativeplatform.pkgmgr.model.Repository;
-import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
-import org.tizen.nativeplatform.repository.LocalRepoMounter;
-import org.tizen.nativeplatform.repository.RepoManager;
+import org.tizen.nativeplatform.pkg.model.PackageProvider;
+import org.tizen.nativeplatform.repo.commander.LocalRepoMounter;
+import org.tizen.nativeplatform.repo.commander.RepoManager;
+import org.tizen.nativeplatform.repo.model.Repository;
+import org.tizen.nativeplatform.repo.model.RepositoryProvider;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.types.PkgTypes;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 import org.tizen.sdblib.IDevice;
 
@@ -25,15 +25,15 @@ public class PkgMgrInitializer {
     private IPkgCommander dvCommander = null;
 
     public PkgMgrInitializer(PkgCommandTarget target) {
-        this.target = target;
+        this.target = target;        
 
         if (target.isSetDevice()) {
             this.device = target.getDevice();
-            this.dvCommander = target.getDeviceCommander();
+            this.dvCommander = target.getCommander(CmdTargetTypes.DEVICE);
         }
         if (target.isSetRootstrap()) {
             this.rootstrap = target.getRootstrap();
-            this.rtCommander = target.getRootstrapCommander();
+            this.rtCommander = target.getCommander(CmdTargetTypes.ROOTSTRAP);
         }
     }
 
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/InstalledPackage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/InstalledPackage.java
deleted file mode 100644 (file)
index 56124a5..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>  
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@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.model;
-
-public class InstalledPackage extends Package {
-       
-       public InstalledPackage() {
-               super();
-       }
-}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/InstalledPkgProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/InstalledPkgProvider.java
deleted file mode 100644 (file)
index 8b8151f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>  
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@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.model;
-
-import java.util.concurrent.CopyOnWriteArrayList;
-public enum InstalledPkgProvider {
-       INSTANCE;       
-       
-       private CopyOnWriteArrayList<InstalledPackage> pkgs;
-       private CopyOnWriteArrayList<InstalledPackage> selected_pkgs;
-       
-       private InstalledPkgProvider()
-       {
-               pkgs = new CopyOnWriteArrayList <InstalledPackage>();           
-               selected_pkgs = new CopyOnWriteArrayList <InstalledPackage>();
-       }       
-       
-       public void clear() {
-               pkgs.clear();
-               selected_pkgs.clear();
-       }
-       
-       public CopyOnWriteArrayList<InstalledPackage> getPkgs()
-       {
-               return pkgs;
-       }
-       
-       public CopyOnWriteArrayList<InstalledPackage> getSelectedPkgs()
-       {
-               return selected_pkgs;
-       }
-}
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
deleted file mode 100644 (file)
index 5873c01..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>  
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@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.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;
-       }
-       
-       public LocalPackage clone() {
-               LocalPackage newPkg = new LocalPackage();
-               newPkg.setArch(this.getArch());
-               newPkg.setCheckColumn(this.getCheckColumn());
-               newPkg.setInstalledVersion(this.getInstalledVersion());
-               newPkg.setInstallInfo(this.getInstallInfo());
-               newPkg.setName(this.getName());
-               newPkg.setNewVersion(this.getNewVersion());
-               newPkg.setPath(this.getPath());
-               newPkg.setPkgType(this.getPkgType());
-               return newPkg;
-       }
-}
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
deleted file mode 100644 (file)
index 742fcc4..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>  
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@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.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
deleted file mode 100644 (file)
index 969bb4c..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>  
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@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.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 = false;
-    private INSTALLINFO installInfo = INSTALLINFO.NOT_INSTALLED;
-    private PKGTYPE pkgType = PKGTYPE.LOCAL;
-    private boolean isChecked = false;
-    private boolean isNewlyChanged = false;
-
-    public Package() {
-
-    }
-
-    public Package(String name, String installedVersion, String remoteVersion, String arch) {
-        this.name = name;
-        this.installVersion = installedVersion;
-        this.newVersion = remoteVersion;
-        this.arch = arch;
-    }
-
-    public Package(String name, String installedVersion, INSTALLINFO installInfo,
-            String remoteVersion, String arch) {
-        this.name = name;
-        this.installVersion = installedVersion;
-        this.installInfo = installInfo;
-        this.newVersion = remoteVersion;
-        this.arch = arch;
-    }
-
-    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;
-    }
-
-    public void setChecked(boolean value) {
-        this.isChecked = value;
-    }
-
-    public boolean isChecked() {
-        return this.isChecked;
-    }
-
-    public boolean isInstalled() {
-        return (installInfo == INSTALLINFO.INSTALLED);
-    }
-
-    public void setNewlyChanged(boolean value) {
-        this.isNewlyChanged = value;
-    }
-
-    public boolean isNewlyChanged() {
-        return this.isNewlyChanged;
-    }
-}
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
deleted file mode 100644 (file)
index ee02bd3..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>  
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@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.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
deleted file mode 100644 (file)
index e244cde..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>  
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@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.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/ui/AddRemotePackageDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRemotePackageDialog.java
deleted file mode 100644 (file)
index 5d91bbf..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>  
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@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.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;
-                                               default:
-                                                       break;
-                                       }                                       
-                                       
-                                       return result;
-                               }
-                       });
-                       updateCheck();
-               }
-       }
-       
-       private void updateCheck() {            
-               int recentTableIndex = packageViewer.getTable().getItemCount();
-               Color installedColor = 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(installedColor);
-                       }
-               }       
-       }
-}
index 152e02c..dc1307d 100644 (file)
@@ -51,7 +51,7 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.tizen.common.util.DialogUtil;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
-import org.tizen.nativeplatform.repository.RepoManager;
+import org.tizen.nativeplatform.repo.commander.RepoManager;
 
 public class AddRepoDialog extends Dialog {
        
index c3fc642..b9c89be 100644 (file)
@@ -39,18 +39,19 @@ import org.eclipse.swt.widgets.TabFolder;
 import org.tizen.common.util.DialogUtil;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
+import org.tizen.nativeplatform.pkg.model.PackageProvider;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 import org.tizen.nativeplatform.pkgmgr.PkgMgrInitializer;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
-import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
-import org.tizen.nativeplatform.pkgmgr.model.Repository;
-import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
+import org.tizen.nativeplatform.repo.model.Repository;
+import org.tizen.nativeplatform.repo.model.RepositoryProvider;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
 
 public class BuildsystemTab extends CommonTab {
 
     private PkgCommandTarget target = null;
 
     public BuildsystemTab(Shell shell, TabFolder folder, PkgCommandTarget target) {
-        super(shell, folder, target.getRootstrapCommander());
+        super(shell, folder, target.getCommander(CmdTargetTypes.ROOTSTRAP));
         this.target = target;
     }
 
@@ -137,12 +138,12 @@ public class BuildsystemTab extends CommonTab {
         }
     }
 
-    protected List<Package> getSelectedPkgList(boolean remove) {
-        List<Package> selectedList = PackageProvider.INSTANCE.getSelectedBuildsystemPkgs(remove);
+    protected List<PkgStatus> getSelectedPkgList(boolean remove) {
+        List<PkgStatus> selectedList = PackageProvider.INSTANCE.getSelectedBuildsystemPkgs(remove);
         return selectedList;
     }
 
-    protected List<Package> getPackageList() {
+    protected List<PkgStatus> getPackageList() {
         return PackageProvider.INSTANCE.getBuildsystemPkgs();
     }
 }
index 38aee1d..d554262 100644 (file)
@@ -52,6 +52,7 @@ import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.FillLayout;
@@ -61,11 +62,9 @@ import org.eclipse.swt.layout.RowLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.FileDialog;
 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;
@@ -78,11 +77,12 @@ import org.tizen.common.util.DialogUtil;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
 import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
 import org.tizen.nativeplatform.pkg.commander.IPkgVersionComparer;
-import org.tizen.nativeplatform.pkg.commander.PkgVersionComparerFactory;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
-import org.tizen.nativeplatform.pkgmgr.model.Repository;
-import org.tizen.nativeplatform.util.CharacterStripper;
+import org.tizen.nativeplatform.pkg.commander.factories.PkgVersionComparerFactory;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
+import org.tizen.nativeplatform.repo.model.Repository;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
 
+@SuppressWarnings("restriction")
 abstract public class CommonTab {
 
     protected TableViewer repoViewer = null;
@@ -109,8 +109,6 @@ abstract public class CommonTab {
 
     abstract protected CopyOnWriteArrayList<Repository> getRepositoryList();
 
-    abstract protected List<Package> getSelectedPkgList(boolean remove);
-
     abstract public void updateRepositoryInfo();
 
     abstract protected boolean handleAddRepositoryButton();
@@ -121,7 +119,9 @@ abstract public class CommonTab {
 
     abstract protected void handleUpgradeButton();
 
-    abstract protected List<Package> getPackageList();
+    abstract protected List<PkgStatus> getPackageList();
+
+    abstract protected List<PkgStatus> getSelectedPkgList(boolean remove);
 
     protected void createCommonTab(String title) {
         TabItem tab = new TabItem(folder, SWT.NULL);
@@ -191,7 +191,8 @@ abstract public class CommonTab {
                 resources.getString("PkgMgr.Repo.Table.Column.2") };
         int[] bounds = { 100, 600 };
 
-        TableViewerColumn colName = createTableViewerColumn(repoViewer, titles[0], bounds[0],
+        SelectionAdapter adapter = new RepoTableSelectionAdapter(repoViewer);
+        TableViewerColumn colName = createTableViewerColumn(repoViewer, adapter, titles[0], bounds[0],
                 SWT.NONE);
         colName.setLabelProvider(new ColumnLabelProvider() {
             @Override
@@ -201,7 +202,7 @@ abstract public class CommonTab {
             }
         });
 
-        TableViewerColumn colUrl = createTableViewerColumn(repoViewer, titles[1], bounds[1],
+        TableViewerColumn colUrl = createTableViewerColumn(repoViewer, adapter, titles[1], bounds[1],
                 SWT.NONE);
         colUrl.setLabelProvider(new ColumnLabelProvider() {
             @Override
@@ -212,12 +213,12 @@ abstract public class CommonTab {
         });
     }
 
-    private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound,
-            int Style) {
+    private TableViewerColumn createTableViewerColumn(TableViewer viewer, SelectionAdapter adapter, 
+            String title, int bound, int Style) {
 
         final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, Style);
         final TableColumn column = viewerColumn.getColumn();
-        column.addSelectionListener(new PackageTableSelectionAdapter(pkgViewer));
+        column.addSelectionListener(adapter);
         column.setText(title);
         column.setWidth(bound);
         column.setResizable(true);
@@ -497,16 +498,15 @@ abstract public class CommonTab {
                 | SWT.V_SCROLL | SWT.CHECK);
         createPackageTableColumns(composite);
         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.addListener(SWT.Selection, new Listener() {
+         * 
+         * @Override public void handleEvent(Event event) { if (event.detail ==
+         * SWT.CHECK) { PkgStatus pkg = (PkgStatus) event.item.getData();
+         * pkg.setChecked(!pkg.isChecked()); }
+         * 
+         * } });
+         */
 
         packageTable.setHeaderVisible(true);
         packageTable.setLinesVisible(true);
@@ -516,7 +516,7 @@ abstract public class CommonTab {
 
             @Override
             public boolean isChecked(Object element) {
-                Package pkg = (Package) element;
+                PkgStatus pkg = (PkgStatus) element;
                 return pkg.isChecked();
             }
 
@@ -529,22 +529,23 @@ abstract public class CommonTab {
 
             @Override
             public boolean select(Viewer viewer, Object parentElement, Object element) {
-                Package pkg = (Package) element;
+                PkgStatus pkg = (PkgStatus) element;
                 if (categoryCombo != null) {
                     if (categoryCombo.getText().equals("Installed")
-                            && pkg.getInstalledVersion().isEmpty()) {
+                            && pkg.getInstalledVer().isEmpty()) {
                         return false;
                     }
                     if (categoryCombo.getText().equals("Upgradable")) {
-                        IPkgVersionComparer comp = PkgVersionComparerFactory.getComparer();
-                        if (pkg.getInstalledVersion().isEmpty()
-                                || pkg.getNewVersion().isEmpty()
-                                || comp.compare(pkg.getInstalledVersion(), pkg.getNewVersion()) >= 0) {
+                        IPkgVersionComparer comp = PkgVersionComparerFactory
+                                .getComparer(PlatformProjectUtil.getPkgType());
+                        if (pkg.getInstalledVer().isEmpty() || pkg.getNewVer().isEmpty()
+                                || comp.compare(pkg.getInstalledVer(), pkg.getNewVer()) >= 0) {
                             return false;
                         }
                     }
                 }
-                if (filterText != null && !pkg.getName().contains(filterText.getText())) {
+                String name = pkg.getPackage().getName();
+                if (filterText != null && !name.contains(filterText.getText())) {
                     return false;
                 }
                 return true;
@@ -555,8 +556,8 @@ abstract public class CommonTab {
 
             @Override
             public void checkStateChanged(CheckStateChangedEvent event) {
-                Package pkg = (Package) event.getElement();
-                pkg.setChecked(true);
+                PkgStatus pkg = (PkgStatus) event.getElement();
+                pkg.setChecked(!pkg.isChecked());
             }
         });
         pkgViewer.setInput(getPackageList());
@@ -566,7 +567,8 @@ abstract public class CommonTab {
         String[] titles = { "S", "Package Name", "Installed Version", "New Version", "Arch", };
         int[] bounds = { 24, 250, 200, 200, 60 };
 
-        TableViewerColumn colSelection = createTableViewerColumn(pkgViewer, titles[0], bounds[0],
+        SelectionAdapter adapter = new PackageTableSelectionAdapter(pkgViewer);
+        TableViewerColumn colSelection = createTableViewerColumn(pkgViewer, adapter, titles[0], bounds[0],
                 SWT.NONE);
         colSelection.setLabelProvider(new ColumnLabelProvider() {
             @Override
@@ -575,61 +577,54 @@ abstract public class CommonTab {
             }
         });
 
-        TableViewerColumn colPackage = createTableViewerColumn(pkgViewer, titles[1], bounds[1],
+        TableViewerColumn colPackage = createTableViewerColumn(pkgViewer, adapter, titles[1], bounds[1],
                 SWT.NONE);
         colPackage.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
-                Package pkg = (Package) element;
+                PkgStatus pkg = (PkgStatus) element;
                 if (pkg.isNewlyChanged()) {
-                    return "*" + pkg.getName();
+                    return "*" + pkg.getPackage().getName();
                 } else {
-                    return pkg.getName();
+                    return pkg.getPackage().getName();
                 }
             }
         });
 
-        TableViewerColumn colInsVer = createTableViewerColumn(pkgViewer, titles[2], bounds[2],
+        TableViewerColumn colInsVer = createTableViewerColumn(pkgViewer, adapter, titles[2], bounds[2],
                 SWT.NONE);
         colInsVer.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
-                Package pkg = (Package) element;
-                String installedVer = pkg.getInstalledVersion();
+                PkgStatus pkg = (PkgStatus) element;
+                String installedVer = pkg.getInstalledVer();
                 return installedVer;
             }
         });
 
-        TableViewerColumn colNewVer = createTableViewerColumn(pkgViewer, titles[3], bounds[3],
+        TableViewerColumn colNewVer = createTableViewerColumn(pkgViewer, adapter, titles[3], bounds[3],
                 SWT.NONE);
 
         colNewVer.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
-                Package pkg = (Package) element;
-                String newVer = pkg.getNewVersion();
+                PkgStatus pkg = (PkgStatus) element;
+                String newVer = pkg.getNewVer();
                 return newVer;
             }
         });
 
-        TableViewerColumn colArch = createTableViewerColumn(pkgViewer, titles[4], bounds[4],
+        TableViewerColumn colArch = createTableViewerColumn(pkgViewer, adapter, titles[4], bounds[4],
                 SWT.NONE);
 
         colArch.setLabelProvider(new ColumnLabelProvider() {
             @Override
             public String getText(Object element) {
-                Package pkg = (Package) element;
-                String arch = pkg.getArch();
+                PkgStatus pkg = (PkgStatus) element;
+                String arch = pkg.getPackage().getArch();
                 return arch;
             }
         });
-        /*
-         * TableViewerColumn colDescription = createTableViewerColumn(pkgViewer,
-         * titles[5], bounds[5], SWT.NONE); colDescription.setLabelProvider(new
-         * ColumnLabelProvider() {
-         * 
-         * @Override public String getText(Object element) { return ""; } });
-         */
     }
 
     protected void handleRefreshRepositoryButton() {
@@ -658,7 +653,7 @@ abstract public class CommonTab {
     }
 
     protected void handleInstallPackageButton() {
-        final List<Package> selectedList = getSelectedPkgList(false);
+        final List<PkgStatus> selectedList = getSelectedPkgList(false);
         if (selectedList.isEmpty()) {
             DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package"));
             return;
@@ -672,8 +667,8 @@ abstract public class CommonTab {
                         InterruptedException {
                     monitor.beginTask(resources.getString("PkgMgr.Message.Installing.Package"), -1);
                     List<String> lists = new ArrayList<String>();
-                    for (Package pkg : selectedList) {
-                        lists.add(pkg.getName());
+                    for (PkgStatus pkg : selectedList) {
+                        lists.add(pkg.getPackage().getName());
                     }
                     ICommandStatus status = commander.installRemotePkg(
                             lists.toArray(new String[0]), monitor);
@@ -720,7 +715,7 @@ abstract public class CommonTab {
     }
 
     protected void handleRemovePackageButton() {
-        final List<Package> selectedList = getSelectedPkgList(true);
+        final List<PkgStatus> selectedList = getSelectedPkgList(true);
 
         if (selectedList.isEmpty()) {
             DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package"));
@@ -736,8 +731,8 @@ abstract public class CommonTab {
                     monitor.beginTask(resources.getString("PkgMgr.Message.Uninstalling.Package"),
                             -1);
                     List<String> lists = new ArrayList<String>();
-                    for (Package pkg : selectedList) {
-                        lists.add(pkg.getName());
+                    for (PkgStatus pkg : selectedList) {
+                        lists.add(pkg.getPackage().getName());
                     }
                     ICommandStatus status = commander.uninstallPkg(lists.toArray(new String[0]),
                             monitor);
@@ -757,21 +752,23 @@ abstract public class CommonTab {
     }
 
     protected void updatePackageInfo(List<String> localPackageFileList) {
-        List<Package> fullList = commander.getAllPkgList();
-        List<Package> removeList = new ArrayList<Package>();
-        for (Package pkg : getPackageList()) {
+        List<PkgStatus> fullList = commander.getAllPkgList();
+        List<PkgStatus> removeList = new ArrayList<PkgStatus>();
+        for (PkgStatus pkg : getPackageList()) {
             boolean found = false;
-            for (Package currPkg : fullList) {
-                if (currPkg.getName().equals(pkg.getName())) {
+            for (PkgStatus currPkg : fullList) {
+                String currPkgName = currPkg.getPackage().getName();
+                String pkgName = pkg.getPackage().getName();
+                if (currPkgName.equals(pkgName)) {
                     // check newly install
-                    if (!pkg.getInstalledVersion().equals(currPkg.getInstalledVersion())) {
+                    if (!pkg.getInstalledVer().equals(currPkg.getInstalledVer())) {
                         pkg.setNewlyChanged(true);
                     }
-                    if (!pkg.getNewVersion().equals(currPkg.getNewVersion())) {
-                        pkg.setNewVersion(currPkg.getNewVersion());
+                    if (!pkg.getNewVer().equals(currPkg.getNewVer())) {
+                        pkg.setNewVer(currPkg.getNewVer());
                         pkg.setNewlyChanged(true);
                     }
-                    pkg.setInstalledVersion(currPkg.getInstalledVersion());
+                    pkg.setInstalledVer(currPkg.getInstalledVer());
                     found = true;
                     break;
                 }
@@ -783,15 +780,17 @@ abstract public class CommonTab {
         }
 
         // remove
-        for (Package pkg : removeList) {
+        for (PkgStatus pkg : removeList) {
             getPackageList().remove(pkg);
         }
 
         // add if there is new package
-        for (Package currPkg : fullList) {
+        for (PkgStatus currPkg : fullList) {
             boolean found = false;
-            for (Package pkg : getPackageList()) {
-                if (currPkg.getName().equals(pkg.getName())) {
+            for (PkgStatus pkg : getPackageList()) {
+                String currPkgName = currPkg.getPackage().getName();
+                String pkgName = pkg.getPackage().getName();
+                if (currPkgName.equals(pkgName)) {
                     found = true;
                     break;
                 }
@@ -808,8 +807,9 @@ abstract public class CommonTab {
             for (String filePath : localPackageFileList) {
                 localPackageNameList.add(commander.getNameFromFile(filePath));
             }
-            for (Package pkg : getPackageList()) {
-                if (localPackageNameList.contains(pkg.getName())) {
+            for (PkgStatus pkg : getPackageList()) {
+                String pkgName = pkg.getPackage().getName();
+                if (localPackageNameList.contains(pkgName)) {
                     pkg.setNewlyChanged(true);
                 }
             }
index f239570..ccc9f6c 100644 (file)
@@ -37,18 +37,19 @@ import org.eclipse.swt.widgets.TabFolder;
 import org.tizen.common.util.DialogUtil;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
+import org.tizen.nativeplatform.pkg.model.PackageProvider;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 import org.tizen.nativeplatform.pkgmgr.PkgMgrInitializer;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
-import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
-import org.tizen.nativeplatform.pkgmgr.model.Repository;
-import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
+import org.tizen.nativeplatform.repo.model.Repository;
+import org.tizen.nativeplatform.repo.model.RepositoryProvider;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
 
 public class DeviceTab extends CommonTab {
 
     private PkgCommandTarget target = null;
 
     public DeviceTab(Shell shell, TabFolder folder, PkgCommandTarget target) {
-        super(shell, folder, target.getDeviceCommander());
+        super(shell, folder, target.getCommander(CmdTargetTypes.DEVICE));
         this.target = target;
     }
 
@@ -138,12 +139,12 @@ public class DeviceTab extends CommonTab {
         return;
     }
 
-    protected List<Package> getSelectedPkgList(boolean remove) {
-        List<Package> selectedList = PackageProvider.INSTANCE.getSelectedDevicePkgs(remove);
+    protected List<PkgStatus> getSelectedPkgList(boolean remove) {
+        List<PkgStatus> selectedList = PackageProvider.INSTANCE.getSelectedDevicePkgs(remove);
         return selectedList;
     }
 
-    protected List<Package> getPackageList() {
+    protected List<PkgStatus> getPackageList() {
         return PackageProvider.INSTANCE.getDevicePkgs();
     }
 }
index c690dc9..050d3f2 100644 (file)
@@ -49,7 +49,7 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.tizen.common.util.DialogUtil;
-import org.tizen.nativeplatform.repository.RepoManager;
+import org.tizen.nativeplatform.repo.commander.RepoManager;
 
 
 public class ModifyRepoDialog extends Dialog {
index a024486..fb4302a 100644 (file)
@@ -35,93 +35,89 @@ import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
-
-import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 
 public class PackageTableSelectionAdapter extends SelectionAdapter {
-       private TableViewer repoViewer;
-       private int selectedColumn = 0;
-       public PackageTableSelectionAdapter(TableViewer v) {
-               super();
-               this.repoViewer = v;                    
-       }
-       
-       public void widgetSelected(SelectionEvent e) {                          
-               selectedColumn = repoViewer.getTable().indexOf((TableColumn) e.widget);
-               repoViewer.getTable().setSortColumn((TableColumn)e.widget);
-               if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {                                             
-                       repoViewer.getTable().setSortDirection(SWT.UP);
-               } else {
-                       repoViewer.getTable().setSortDirection(SWT.DOWN);
-               }                       
-               
-               repoViewer.setSorter(new ViewerSorter() {
-                       public int compare(Viewer viewer, Object e1, Object e2) {
-                               int result = 0;
-                               
-                               Package entry_1 = (Package)e1;
-                               Package entry_2 = (Package)e2;
-                               
-                               switch (selectedColumn) {
-                                       case 0:                                                                 
-                                               if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
-                                                       result = entry_1.getPkgType().compareTo(entry_2.getPkgType());
-                                               } else {
-                                                       result = entry_2.getPkgType().compareTo(entry_1.getPkgType());
-                                               }
-                                               break;
-                                       case 1:
-                                               if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
-                                                       result = entry_1.getName().compareTo(entry_2.getName());
-                                               } else {
-                                                       result = entry_2.getName().compareTo(entry_1.getName());
-                                               }
-                                               break;                                          
-                                       case 2:
-                                               if (repoViewer.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 (repoViewer.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 (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
-                                                       result = entry_1.getInstalledVersion().compareTo(entry_2.getInstalledVersion());
-                                               } else {
-                                                       result = entry_2.getInstalledVersion().compareTo(entry_1.getInstalledVersion());
-                                               }
-                                               break;
-                                       case 5:
-                                               if (repoViewer.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;                                          
-                                       default:
-                                               break;
-                               }                                       
-                               
-                               return result;
-                       }
-               });
-               updateCheck();
-       }
-       
-       private void updateCheck() {            
-               int recentTableIndex = repoViewer.getTable().getItemCount();            
-               
-               for (int i = 0; i < recentTableIndex; i++) {
-                       TableItem item = repoViewer.getTable().getItem(i);                      
-                       Package pkg = (Package)item.getData();
-                       item.setChecked(pkg.getCheckColumn());                  
-               }       
-       }
+    private TableViewer pkgViewer;
+    private int selectedColumn = 0;
+
+    public PackageTableSelectionAdapter(TableViewer v) {
+        super();
+        this.pkgViewer = v;
+    }
+
+    public void widgetSelected(SelectionEvent e) {
+        selectedColumn = pkgViewer.getTable().indexOf((TableColumn) e.widget);
+        pkgViewer.getTable().setSortColumn((TableColumn) e.widget);
+        if (pkgViewer.getTable().getSortDirection() == SWT.DOWN) {
+            pkgViewer.getTable().setSortDirection(SWT.UP);
+        } else {
+            pkgViewer.getTable().setSortDirection(SWT.DOWN);
+        }
+
+        pkgViewer.setSorter(new ViewerSorter() {
+            public int compare(Viewer viewer, Object e1, Object e2) {
+                int result = 0;
+
+                PkgStatus status_1 = (PkgStatus) e1;
+                PkgStatus status_2 = (PkgStatus) e2;
+                IPackage pkg_1 = status_1.getPackage();
+                IPackage pkg_2 = status_2.getPackage();
+
+                switch (selectedColumn) {
+                /*
+                 * case 0: if (repoViewer.getTable().getSortDirection() ==
+                 * SWT.DOWN) { result =
+                 * entry_1.getPkgType().compareTo(entry_2.getPkgType()); } else
+                 * { result =
+                 * entry_2.getPkgType().compareTo(entry_1.getPkgType()); }
+                 * break;
+                 */
+                case 1:
+                    if (pkgViewer.getTable().getSortDirection() == SWT.DOWN) {
+                        result = pkg_1.getName().compareTo(pkg_2.getName());
+                    } else {
+                        result = pkg_2.getName().compareTo(pkg_1.getName());
+                    }
+                    break;
+                case 2:
+                    if (pkgViewer.getTable().getSortDirection() == SWT.DOWN) {
+                        result = status_1.getInstalledVer().compareTo(status_2.getInstalledVer());
+                    } else {
+                        result = status_2.getInstalledVer().compareTo(status_1.getInstalledVer());
+                    }
+                    break;
+                case 3:
+                    if (pkgViewer.getTable().getSortDirection() == SWT.DOWN) {
+                        result = status_1.getNewVer().compareTo(status_2.getNewVer());
+                    } else {
+                        result = status_2.getNewVer().compareTo(status_1.getNewVer());
+                    }
+                    break;
+                case 4:
+                    if (pkgViewer.getTable().getSortDirection() == SWT.DOWN) {
+                        result = pkg_1.getArch().compareTo(pkg_2.getArch());
+                    } else {
+                        result = pkg_2.getArch().compareTo(pkg_1.getArch());
+                    }
+                    break;
+                default:
+                    break;
+                }
+                return result;
+            }
+        });
+        updateCheck();
+    }
+
+    private void updateCheck() {
+        int recentTableIndex = pkgViewer.getTable().getItemCount();
+
+        for (int i = 0; i < recentTableIndex; i++) {
+            TableItem item = pkgViewer.getTable().getItem(i);
+            PkgStatus pkg = (PkgStatus) item.getData();
+            item.setChecked(pkg.isChecked());
+        }
+    }
 }
index eec57a6..1834de1 100644 (file)
@@ -50,9 +50,7 @@ import org.osgi.framework.Bundle;
 import org.tizen.nativeplatform.Activator;
 
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPkgProvider;
-import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
-import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
+import org.tizen.nativeplatform.pkg.model.PackageProvider;
 
 public class RPMPackageDialog extends Dialog {
 
@@ -104,8 +102,6 @@ public class RPMPackageDialog extends Dialog {
 
     @Override
     public boolean close() {
-        RemotePkgProvider.INSTANCE.clear();
-        LocalPkgProvider.INSTANCE.clear();
         PackageProvider.INSTANCE.clear();
         return super.close();
     }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RemoveInstalledPackageDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RemoveInstalledPackageDialog.java
deleted file mode 100644 (file)
index fa7398d..0000000
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * Native Platform
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Donghyuk Yang <donghyuk.yang@samsung.com>  
- * DongHee Yang <donghee.yang@samsung.com>
- * Kangho Kim <kh5325.kim@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.lang.reflect.InvocationTargetException;
-import java.util.ResourceBundle;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.eclipse.swt.graphics.Color;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-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.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-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.Rectangle;
-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.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.common.util.DialogUtil;
-import org.tizen.nativeplatform.pkgmgr.model.InstalledPackage;
-import org.tizen.nativeplatform.pkgmgr.model.InstalledPkgProvider;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
-import org.tizen.nativeplatform.pkgmgr.model.RemotePackage;
-import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
-
-public class RemoveInstalledPackageDialog extends Dialog {     
-       
-       private TableViewer packageViewer;
-       private TableViewer selectedPackageViewer;
-       private Button checkNoDeps_bt;
-       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 = RemoveInstalledPackageDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
-       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
-       
-
-       protected RemoveInstalledPackageDialog(Shell parentShell, String path) {                
-               super(parentShell);
-               
-               Rectangle bounds = parentShell.getBounds();
-        x = bounds.x + (bounds.width - width)/2;
-        y = bounds.y + (bounds.height - height)/2;
-        this.disp = parentShell.getDisplay();
-        //this.targetId = targetId;
-       }       
-       
-       @Override
-       protected void configureShell(Shell newShell) {
-               super.configureShell(newShell);
-               
-               newShell.setText(resources.getString("UninstallPkg.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));  
-               
-               createTable(composite);
-               createSelectedTable(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 ) {                                       
-                                       InstalledPackage pkg = (InstalledPackage)event.item.getData();
-                                       boolean checked = pkg.getCheckColumn();
-                                       pkg.setCheckColumn( !checked);
-                                       if (!checked) {
-                                               InstalledPkgProvider.INSTANCE.getSelectedPkgs().add(pkg);
-                                       } else {
-                                               InstalledPkgProvider.INSTANCE.getSelectedPkgs().remove(pkg);
-                                       }
-                                       
-                                       selectedPackageViewer.refresh();
-                               }
-                       }                       
-               });
-
-               table.setHeaderVisible(true);
-               table.setLinesVisible(true);            
-               
-               packageViewer.setContentProvider(new ArrayContentProvider());   
-               packageViewer.setInput(InstalledPkgProvider.INSTANCE.getPkgs());                
-               
-               updateCheck();          
-       }
-       
-       private void createSelectedTable( 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());
-        
-               selectedPackageViewer = new TableViewer( b2, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);         
-               createSelectedColumns();
-               Table table = selectedPackageViewer.getTable();         
-               table.addListener( SWT.Selection, new Listener(){
-
-                       @Override
-                       public void handleEvent(Event event) {
-                       }                       
-               });
-
-               table.setHeaderVisible(true);
-               table.setLinesVisible(true);            
-               
-               selectedPackageViewer.setContentProvider(new ArrayContentProvider());           
-               selectedPackageViewer.setInput(InstalledPkgProvider.INSTANCE.getSelectedPkgs());
-               
-               createOptionComposite(bottom);
-               createButtonsComposite(bottom);
-       }
-       
-       private void createOptionComposite(Composite parent) {
-               checkNoDeps_bt = new Button(parent, SWT.CHECK);
-               checkNoDeps_bt.setText(resources.getString("UninstallPkg.Label.Nodeps.Op"));
-       }
-       
-       private void createButtonsComposite(Composite parent) {
-               
-               Composite composite = new Composite( parent, SWT.NONE );
-               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
-               composite.setLayout(new GridLayout(2, false));          
-               
-               Button deselect_bt = new Button(composite, SWT.PUSH);           
-               deselect_bt.setText(resources.getString("UninstallPkg.Button.DeselectAll"));
-               
-               deselect_bt.addMouseListener(new MouseListener() {
-
-                       @Override
-                       public void mouseDoubleClick(MouseEvent e) {                    
-                       }
-
-                       @Override
-                       public void mouseDown(MouseEvent e) {
-                               for(InstalledPackage p : InstalledPkgProvider.INSTANCE.getSelectedPkgs()) {
-                                       p.setCheckColumn(false);                                        
-                               }
-                               
-                               InstalledPkgProvider.INSTANCE.getSelectedPkgs().clear();
-                               updateCheck();
-                               refreshTable();
-                       }
-
-                       @Override
-                       public void mouseUp(MouseEvent e) {
-                       }
-               
-               });
-               
-               Button uninstall_bt = new Button(composite, SWT.PUSH);          
-               uninstall_bt.setText(resources.getString("UninstallPkg.Button.Uninstall"));             
-               
-               uninstall_bt.addMouseListener(new MouseListener() {
-
-               @Override
-               public void mouseDoubleClick(MouseEvent e) {
-               }
-
-               @Override
-               public void mouseDown(MouseEvent e) {
-                       final CopyOnWriteArrayList<InstalledPackage> pkgList = InstalledPkgProvider.INSTANCE.getSelectedPkgs();
-                       if (pkgList.isEmpty()) {
-                               DialogUtil.openErrorDialog(resources.getString("PkgMgr.Error.Noselected.Package"));
-                               return;
-                       }
-
-                       ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
-
-                               try {
-                                       dialog.run(true, true, new IRunnableWithProgress() {
-                                               @Override
-                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                                               InterruptedException {
-
-                                                       String list = "";                                               
-                                                       for( Package pkg: pkgList) {
-                                                               list = list.concat(pkg.getName() + " ");
-                                                       }
-
-
-                                                       monitor.beginTask(resources.getString("UninstallPkg.Message.Uninstalling.Package") + 
-                                                                       "   " + list, -1);                      
-
-                                                       //RPMPackageCommander.uninstallPkgFromRootstrap(list, rootstrapPath);
-                                                               
-                                                       DialogUtil.openMessageDialog(getShell(), 
-                                                                       resources.getString("UninstallPkg.Uninstall.Success.Title"), 
-                                                                       list.replaceAll(" ", "\n"));
-                                                       monitor.beginTask(resources.getString("UninstallPkg.Message.Refreshing.Table"), -1);
-                                                       afterUninstallPkgs(pkgList);
-                                               }
-                                       });
-                               } catch (InvocationTargetException e1) {
-                                       e1.printStackTrace();
-                               } catch (InterruptedException e1) {
-                                       e1.printStackTrace();
-                               }                               
-                       
-                       refreshTable();
-               }
-
-               @Override
-               public void mouseUp(MouseEvent e) {
-               }
-       });
-
-       }
-       
-       private void createColumns()
-       {
-               String[] titles = {"Installed Package Name"};
-               int[] bounds = { 250 };
-               
-               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();
-                       }                       
-               });     
-       }
-               
-       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;
-       }
-       
-       private void createSelectedColumns()
-       {
-               String[] titles = {"Selected Package Name"};
-               int[] bounds = { 250 };
-               
-               TableViewerColumn colPackage = createSelectedTableViewerColumn( titles[0], bounds[0], SWT.NONE);
-               
-               colPackage.setLabelProvider(new ColumnLabelProvider() {
-                       @Override
-                       public String getText(Object element) {
-                               Package pkg = (Package)element;
-                               return pkg.getName();
-                       }                       
-               });     
-       }
-               
-       private TableViewerColumn createSelectedTableViewerColumn( String title, int bound, int Style) {
-               
-               final TableViewerColumn viewerColumn = new TableViewerColumn( selectedPackageViewer, Style);
-               final TableColumn column = viewerColumn.getColumn();
-               column.addSelectionListener(new SelectedTableSelectionAdapter());
-               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;
-                                       
-                                       InstalledPackage entry_1 = (InstalledPackage)e1;
-                                       InstalledPackage entry_2 = (InstalledPackage)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;
-                                               default:
-                                                       break;
-                                       }                                       
-                                       
-                                       return result;
-                               }
-                       });
-                       updateCheck();
-               }
-       }
-       
-       private class SelectedTableSelectionAdapter extends SelectionAdapter
-       {
-               public void widgetSelected(SelectionEvent e) {                          
-                       selectedColumn = selectedPackageViewer.getTable().indexOf((TableColumn) e.widget);
-                       selectedPackageViewer.getTable().setSortColumn((TableColumn)e.widget);
-                       if (selectedPackageViewer.getTable().getSortDirection() == SWT.DOWN) {                                          
-                               selectedPackageViewer.getTable().setSortDirection(SWT.UP);
-                       } else {
-                               selectedPackageViewer.getTable().setSortDirection(SWT.DOWN);
-                       }                       
-                       
-                       selectedPackageViewer.setSorter(new ViewerSorter() {
-                               public int compare(Viewer viewer, Object e1, Object e2) {
-                                       int result = 0;
-                                       
-                                       InstalledPackage entry_1 = (InstalledPackage)e1;
-                                       InstalledPackage entry_2 = (InstalledPackage)e2;
-                                       
-                                       switch (selectedColumn) {
-                                               case 0:                                                                 
-                                                       if (selectedPackageViewer.getTable().getSortDirection() == SWT.DOWN) {
-                                                               result = entry_1.getName().compareTo(entry_2.getName());
-                                                       } else {
-                                                               result = entry_2.getName().compareTo(entry_1.getName());
-                                                       }
-                                                       break;                                          
-                                               default:
-                                                       break;
-                                       }                                       
-                                       
-                                       return result;
-                               }
-                       });
-               }
-       }
-       
-       private void updateCheck() {            
-               int recentTableIndex = packageViewer.getTable().getItemCount();
-               Color installedColor = disp.getSystemColor(SWT.COLOR_LIST_SELECTION);
-               
-               for (int i = 0; i < recentTableIndex; i++) {
-                       TableItem item = packageViewer.getTable().getItem(i);                   
-                       InstalledPackage pkg = (InstalledPackage)item.getData();
-                       item.setChecked(pkg.getCheckColumn());
-                       if (Package.INSTALLINFO.INSTALLED.equals(pkg.getInstallInfo())) {
-                               item.setBackground(installedColor);
-                       }
-               }       
-       }
-
-       private void afterUninstallPkgs(CopyOnWriteArrayList<InstalledPackage> list) {
-               for (Package p : list) {
-                       InstalledPkgProvider.INSTANCE.getPkgs().remove(p);
-                       InstalledPkgProvider.INSTANCE.getSelectedPkgs().remove(p);
-               }               
-       }
-       
-       private void refreshTable() {
-               packageViewer.refresh();
-               selectedPackageViewer.refresh();
-       }
-}
index ed586ab..5beec84 100644 (file)
@@ -34,7 +34,7 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.widgets.TableColumn;
-import org.tizen.nativeplatform.pkgmgr.model.Repository;
+import org.tizen.nativeplatform.repo.model.Repository;
 
 public class RepoTableSelectionAdapter extends SelectionAdapter {
        private TableViewer repoViewer;
index 19cb195..b057512 100644 (file)
@@ -33,7 +33,6 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
 import java.net.Proxy;
 import java.net.URL;
 import java.net.URLConnection;
@@ -47,612 +46,563 @@ import org.eclipse.core.net.proxy.IProxyService;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.util.tracker.ServiceTracker;
 
-
 public class PreferencesManager {
-       public static final String PASSWORD_KEY = "org.tizen.nativeplatform.sudo.password";
-
-       private static final String GIT_ACTIVE_CONFIG = "org.tizen.nativeplatform.git.active.config";
-       private static final String GIT_CONFIG_NAME = "org.tizen.nativeplatform.site.config.name";
-       private static final String GIT_BASE_URI = "org.tizen.nativeplatform.git.base.uri";
-       private static final String GIT_LIST_TYPE = "org.tizen.nativeplatform.git.list.type";
-       private static final String GIT_LIST_LOCATION = "org.tizen.nativeplatform.git.list.location";
-       private static final String USE_SITE_PROXY = "org.tizen.nativeplatform.site.use.proxy";
-       private static final String PROXY_URL = "rg.tizen.nativeplatform.site.use.proxy.url";
-       private static final String GIT_CONFIG_DELIMITER = "|";
-       public static final String GIT_LIST_WEB = "GITWEB";
-       public static final String GIT_LIST_LOCAL = "LOCAL";
-       private static final String DEFAULT_GIT_CONFIG_NAME = "Tizen-Public";
-       private static final String DEFAULT_GIT_BASE_URI = "review.tizen.org";
-       private static final String DEFAULT_GIT_LIST_TYPE = GIT_LIST_WEB;
-       private static final String DEFAULT_GIT_LIST_LOCATION = "https://review.tizen.org/git/";
-       private static final boolean DEFAULT_USE_SITE_PROXY = false;
-       private static final String DEFAULT_PROXY_URL = "";
-       private static final String GIT_LIST_CACHE_FILE_FORMAT = ".%s.index.html";
-       
-       private static IPreferenceStore prefStore = org.tizen.nativecommon.Activator.getDefault().getPreferenceStore();
-       private static ServiceTracker<IProxyService,IProxyService> proxyTracker;
-       
-       public static void setDefaultValues() {
-               if ( !prefStore.contains(GIT_CONFIG_NAME) ) {
-                       addSiteConfiguration(DEFAULT_GIT_CONFIG_NAME, 
-                                       DEFAULT_GIT_BASE_URI, 
-                                       DEFAULT_GIT_LIST_TYPE, 
-                                       DEFAULT_GIT_LIST_LOCATION,
-                                       DEFAULT_USE_SITE_PROXY,
-                                       DEFAULT_PROXY_URL);
-               }
-       }
-       
-       
-       public static void setPassword(String p) {
-               prefStore.setValue(PASSWORD_KEY, p);
-       }
-       
-
-       
-       public static boolean isProxyUsed() {
-               if ( isSiteProxyUsed() ) return true;
-               if ( isSystemProxyUsed() ) return true;
-               return false;
-       }
-
-
-       public static Proxy getProxy() {
-               if ( isProxyUsed() ) {
-                       String host = getProxyHost();
-                       int port = getProxyPort();
-                       String protocol = getProxyProtocol();
-                       Proxy.Type proxyType;
-                       if ( protocol.equals("http") || protocol.equals("https")) {
-                               proxyType = Proxy.Type.HTTP;
-                       }
-                       else {
-                               proxyType = Proxy.Type.SOCKS;
-                       }
-                       
-                       return new Proxy(proxyType, new InetSocketAddress(host, port));
-               }
-               else {
-                       return null;
-               }
-       }
-       
-
-       public static String getProxyURL() {
-               String proxyURL =  getSiteProxyURL();
-               if ( proxyURL == null ) {
-                       proxyURL = getSystemProxyURL();
-               }
-               
-               return proxyURL;
-       }
-       
-       public static String[] getProxyParsedURL() {
-               String[] proxyURL =  getSiteProxyParsedURL();
-               if ( proxyURL == null ) {
-                       proxyURL = getSystemProxyParsedURL();
-               }
-               
-               return proxyURL;
-       }
-       
-       public static String getProxyProtocol() {
-               String[] proxyURL = getProxyParsedURL();
-               if ( proxyURL == null ) return null;
-               return proxyURL[ProxyURLParser.PROXY_TYPE];             
-       }
-
-       
-       public static String getProxyHost() {
-               String[] proxyURL = getProxyParsedURL();
-               if ( proxyURL == null ) return null;
-               return proxyURL[ProxyURLParser.PROXY_HOST];
-       }
-
-       
-       public static int getProxyPort() {
-               String[] proxyURL = getProxyParsedURL();
-               if ( proxyURL == null ) return -1;
-               return Integer.parseInt(proxyURL[ProxyURLParser.PROXY_PORT]);
-       }
-       
-       private static boolean isSiteProxyUsed() {
-               SiteConfiguration activeConf = loadActiveSiteConfiguration();
-               if ( activeConf == null ) return false;
-               
-               return activeConf.isSiteProxyUsed;
-       }
-       
-
-       private static String getSiteProxyURL() {
-               SiteConfiguration activeConf = loadActiveSiteConfiguration();
-               if ( activeConf == null ) return null;
-               
-               if ( activeConf.isSiteProxyUsed ) {
-                       return activeConf.proxyURL;
-               }
-               else {
-                       return null;
-               }
-       }
-       
-       private static String[] getSiteProxyParsedURL() {
-               SiteConfiguration activeConf = loadActiveSiteConfiguration();
-               if ( activeConf == null ) return null;
-               
-               if ( activeConf.isSiteProxyUsed ) {
-                       return ProxyURLParser.getParsedUrl(activeConf.proxyURL);
-               }
-               else {
-                       return null;
-               }
-       }
-       
-
-       private static boolean isSystemProxyUsed() {
-               return  getSystemProxyURL() != null ? true:false;
-       }
-
-       
-       private static String getSystemProxyURL() {
-               IProxyData data = getProxyData(IProxyData.SOCKS_PROXY_TYPE);
-               if ( data != null ) {
-                       return String.format("socks://%s:%d", data.getHost(), data.getPort());
-               }
-               
-               data = getProxyData(IProxyData.HTTP_PROXY_TYPE);
-               if ( data != null ) {
-                       return String.format("http://%s:%d", data.getHost(), data.getPort());
-               }
-
-               data = getProxyData(IProxyData.HTTPS_PROXY_TYPE);
-               if ( data != null ) {
-                       return String.format("https://%s:%d", data.getHost(), data.getPort());
-               }
-
-               return null;
-       }
-       
-       private static String[] getSystemProxyParsedURL() {
-               String[] parsedUrl = {"", "", ""};
-               
-               IProxyData data = getProxyData(IProxyData.SOCKS_PROXY_TYPE);
-               if ( data != null ) {
-                       parsedUrl[0] = IProxyData.SOCKS_PROXY_TYPE.toLowerCase();
-                       parsedUrl[1] = data.getHost();
-                       parsedUrl[2] = Integer.toString(data.getPort());
-                       return parsedUrl;
-               }
-               
-               data = getProxyData(IProxyData.HTTP_PROXY_TYPE);
-               if ( data != null ) {
-                       parsedUrl[0] = IProxyData.HTTP_PROXY_TYPE.toLowerCase();
-                       parsedUrl[1] = data.getHost();
-                       parsedUrl[2] = Integer.toString(data.getPort());
-                       return parsedUrl;
-               }
-
-               data = getProxyData(IProxyData.HTTPS_PROXY_TYPE);
-               if ( data != null ) {
-                       parsedUrl[0] = IProxyData.HTTPS_PROXY_TYPE.toLowerCase();
-                       parsedUrl[1] = data.getHost();
-                       parsedUrl[2] = Integer.toString(data.getPort());
-                       return parsedUrl;
-               }
-               
-               return null;            
-       }
-
-       
-       public static String getHttpProxyURL() {
-               String proxyURL = getSiteProxyURL();
-               if ( proxyURL != null && proxyURL.split(":")[0].equals("http") ) {
-                       return proxyURL;
-               }
-               else {
-                       IProxyData data = getProxyData(IProxyData.HTTP_PROXY_TYPE);
-                       if ( data != null ) {
-                               return String.format("http://%s:%d", data.getHost(), data.getPort());
-                       }
-               }
-               
-               return "";
-       }
-       
-       
-    private static IProxyData getProxyData( String proxyType ) {
-       if ( proxyTracker == null ) {
-               proxyTracker = new ServiceTracker<IProxyService,IProxyService>(FrameworkUtil.getBundle(
-                               PreferencesManager.class).getBundleContext(), IProxyService.class
-                    .getName(), null);
-               proxyTracker.open();
-       }
-       
-       IProxyService service = proxyTracker.getService();
-               if ( service.isProxiesEnabled() ) {
-                       IProxyData data = service.getProxyData( proxyType );
-                       if ( data != null && data.getHost() != null  && !data.getHost().isEmpty()) {
-                               return data;
-                       } 
-               }
-               
-               return null;
-    }
-
-    
-       public static String getPassword() {
-               return prefStore.getString(PASSWORD_KEY);
-       }
-
-       
-       // Return current active base URI. 
-       // and if no active one, return empty string
-       public static String getActiveGitBaseURI() {
-               ArrayList<String> baseURIs = loadGitBaseURI();
-               int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
-               if (baseURIs.size() > 0 && activeId >= 0) {
-                       return baseURIs.get(activeId);
-               }
-               else {
-                       return "";
-               }
-       }
-
-       
-       // Return current active git list type. 
-       // and if no active one, return empty string
-       public static String getActiveGitListType() {
-               ArrayList<String> listTypes = loadGitListType();
-               int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
-               if (listTypes.size() > 0 && activeId >= 0) {
-                       return listTypes.get(activeId);
-               }
-               else {
-                       return "";
-               }
-       }
-
-       
-       // Return current active git list location. 
-       // and if no active one, return empty string
-       public static String getActiveGitListLocation() {
-               ArrayList<String> listLocations = loadGitListLocation();
-               int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
-               if (listLocations.size() > 0 && activeId >= 0) {
-                       return listLocations.get(activeId);
-               }
-               else {
-                       return "";
-               }
-       }
-       
-       
-       public static synchronized SiteConfiguration loadActiveSiteConfiguration() { 
-               ArrayList<String> names = loadSiteConfigName();
-               ArrayList<String> baseURIs  = loadGitBaseURI();
-               ArrayList<String> listTypes  = loadGitListType();
-               ArrayList<String> listLocations  = loadGitListLocation();
-               ArrayList<String> listUseSiteProxies  = loadUseSiteProxies();
-               ArrayList<String> listProxyURLs = loadProxyURLs();
-               
-               int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
-               if ( activeId == -1 ) {
-                       return null;
-               }
-               
-               SiteConfiguration newConfig = new SiteConfiguration(
-                               names.get(activeId),
-                               baseURIs.get(activeId), 
-                               listTypes.get(activeId), 
-                               listLocations.get(activeId),
-                               listUseSiteProxies.get(activeId).equals("YES") ? true:false,
-                               listProxyURLs.get(activeId));
-               newConfig.setActive(true);
-               
-               return newConfig;               
-       }
-
-       
-       public static synchronized ArrayList<SiteConfiguration> loadSiteConfigurations() { 
-               ArrayList<String> names = loadSiteConfigName();
-               ArrayList<String> baseURIs  = loadGitBaseURI();
-               ArrayList<String> listTypes  = loadGitListType();
-               ArrayList<String> listLocations  = loadGitListLocation();
-               ArrayList<String> listUseSiteProxies  = loadUseSiteProxies();
-               ArrayList<String> listProxyURLs = loadProxyURLs();
-               int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
-               
-               ArrayList<SiteConfiguration> list = new ArrayList<SiteConfiguration>();
-               for( int idx = 0; idx < names.size(); idx++ ) {
-                       SiteConfiguration newConfig = new SiteConfiguration( names.get(idx),
-                                       baseURIs.get(idx), 
-                                       listTypes.get(idx), 
-                                       listLocations.get(idx),
-                                       listUseSiteProxies.get(idx).equals("YES") ? true:false,
-                                       listProxyURLs.get(idx) );
-                       if ( activeId == idx ) {
-                               newConfig.setActive(true);
-                       }
-                       list.add( newConfig );
-               }
-               
-               return list;            
-       }
-
-       
-       public static synchronized void addSiteConfiguration( String name, String baseURI, 
-                       String listType, String location, boolean useSiteProxy, String proxyURL ) {
-               
-               ArrayList<String> newList = loadSiteConfigName();
-               newList.add(name);
-               saveGitConfigName( newList );
-               
-               newList = loadGitBaseURI();
-               newList.add(baseURI);
-               saveGitBaseURI( newList );
-
-               newList = loadGitListType();
-               newList.add(listType);
-               saveGitListType( newList );
-
-               newList = loadGitListLocation();
-               newList.add(location);
-               saveGitListLocation( newList );
-
-               newList = loadUseSiteProxies();
-               newList.add(useSiteProxy ? "YES": "NO");
-               saveUseSiteProxies( newList );
-
-               newList = loadProxyURLs();
-               newList.add(proxyURL);
-               saveProxyURLs( newList );
-
-               if (newList.size() == 1 )
-                       setActiveSiteConfiguration( 0 );
-       }
-       
-       
-       public static synchronized void updateSiteConfiguration( int id, String name, String baseURI, 
-                       String listType, String location, boolean useSiteProxy, String proxyURL ) {
-               
-               ArrayList<String> newList = loadSiteConfigName();
-               newList.set(id, name);
-               saveGitConfigName( newList );
-               
-               newList = loadGitBaseURI();
-               newList.set(id, baseURI);
-               saveGitBaseURI( newList );
-
-               newList = loadGitListType();
-               newList.set(id, listType);
-               saveGitListType( newList );
-
-               newList = loadGitListLocation();
-               newList.set(id, location);
-               saveGitListLocation( newList );
-
-               newList = loadUseSiteProxies();
-               newList.set(id, useSiteProxy ? "YES":"NO");
-               saveUseSiteProxies( newList );
-               
-               newList = loadProxyURLs();
-               newList.set(id, proxyURL);
-               saveProxyURLs( newList );
-       }
-       
-       
-       public static synchronized void setActiveSiteConfiguration( int id ) {
-               prefStore.setValue(GIT_ACTIVE_CONFIG, id);
-       }
-       
-       
-       public static synchronized void removeSiteConfiguration( int id ) {
-               ArrayList<String> newList = loadSiteConfigName();
-               newList.remove(id);
-               saveGitConfigName( newList );
-               
-               newList = loadGitBaseURI();
-               newList.remove(id);
-               saveGitBaseURI( newList );
-
-               newList = loadGitListType();
-               newList.remove(id);
-               saveGitListType( newList );
-
-               newList = loadGitListLocation();
-               newList.remove(id);
-               saveGitListLocation( newList );
-               
-               int prevActiveId = prefStore.getInt(GIT_ACTIVE_CONFIG);
-               if ( prevActiveId == id ) {
-                       if (newList.size() == 0 ) {
-                               setActiveSiteConfiguration( -1 );
-                       }
-                       else {
-                               setActiveSiteConfiguration( 0 );
-                       }
-               }
-               else if ( prevActiveId > id ) {
-                       setActiveSiteConfiguration( id - 1 );
-               }
-       }
-       
-       
-       public static synchronized void refreshGitWebConfiguration( int idx ) throws IOException {
-               String name = loadSiteConfigName().get(idx);
-               String path  = loadGitListLocation().get(idx);
-               
-               URL u = new URL(path);
-               String cacheFile = ResourcesPlugin.getWorkspace().getRoot().getLocation()
-                               .append(String.format(GIT_LIST_CACHE_FILE_FORMAT, name)).toString();
-               URLConnection yc = u.openConnection();
-               BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
-               BufferedWriter out = new BufferedWriter( new FileWriter( cacheFile ) );
-               String line = null;
-               while ((line = in.readLine()) != null) {
-                       out.write(line+"\n");
-               }
-       }
-       
-       
-       private static ArrayList<String> loadSiteConfigName() {
-               String values = prefStore.getString(GIT_CONFIG_NAME);
-               if ( !values.isEmpty() ) {
-                       return new ArrayList<String>(Arrays.asList( values.split("[|]") ) );
-               }
-               else {
-                       return new ArrayList<String>();
-               }
-       }
-       
-       
-       private static void saveGitConfigName(ArrayList<String> list) {
-               prefStore.setValue(GIT_CONFIG_NAME, generateListString( list ));
-       }
-       
-       
-       private static ArrayList<String> loadGitBaseURI() {
-               String values = prefStore.getString(GIT_BASE_URI);
-               if ( !values.isEmpty() ) {
-                       return new ArrayList<String>(Arrays.asList( values.split("[|]") ) );
-               }
-               else {
-                       return new ArrayList<String>();
-               }
-       }
-
-       
-       private static void saveGitBaseURI( ArrayList<String> list ) {
-               prefStore.setValue(GIT_BASE_URI, generateListString( list ));
-       }
-
-       
-       private static ArrayList<String> loadGitListType() {
-               String values = prefStore.getString(GIT_LIST_TYPE);
-               if ( !values.isEmpty() ) {
-               return new ArrayList<String>(Arrays.asList( values.split("[|]") ) );
-               }
-               else {
-                       return new ArrayList<String>();
-               }
-       }
-       
-       
-       private static void saveGitListType( ArrayList<String> list ) {
-               prefStore.setValue(GIT_LIST_TYPE, generateListString( list ));
-       }
-       
-       
-       private static ArrayList<String> loadGitListLocation() {
-               String values = prefStore.getString(GIT_LIST_LOCATION);
-               if ( !values.isEmpty() ) {
-                       return new ArrayList<String>(Arrays.asList( values.split("[|]") ) );
-               }
-               else {
-                       return new ArrayList<String>();
-               }
-       }
-       
-       
-       private static void saveGitListLocation( ArrayList<String> list ) {
-               prefStore.setValue(GIT_LIST_LOCATION, generateListString( list ));
-       }
-       
-       
-       private static ArrayList<String> loadUseSiteProxies() {
-               String values = prefStore.getString(USE_SITE_PROXY);
-               if ( !values.isEmpty() ) {
-                       return new ArrayList<String>(Arrays.asList( values.split("[|]") ) );
-               }
-               else {
-                       return new ArrayList<String>();
-               }
-       }
-
-       
-       private static void saveUseSiteProxies( ArrayList<String> list ) {
-               prefStore.setValue(USE_SITE_PROXY, generateListString( list ));
-       }
-       
-       
-       private static ArrayList<String> loadProxyURLs() {
-               String values = prefStore.getString(PROXY_URL);
-               if ( !values.isEmpty() ) {
-                       ArrayList<String> newList = new ArrayList<String>();
-                       for( String url: values.split("[|]") ) {
-                               if ( url.equals("EMPTY") ) {
-                                       newList.add("");
-                               }
-                               else {
-                                       newList.add(url);
-                               }
-                       }
-                       
-                       return newList;
-               }
-               else {
-                       return new ArrayList<String>();
-               }
-       }
-
-       
-       private static void saveProxyURLs( ArrayList<String> list ) {
-               ArrayList<String> newList = new ArrayList<String>();
-               for( String url: list ) {
-                       if ( url.isEmpty() ) {
-                               newList.add("EMPTY");
-                       }
-                       else {
-                               newList.add(url);
-                       }
-               }
-               
-               prefStore.setValue(PROXY_URL, generateListString( newList ));
-       }
-
-       
-       private static String generateListString( ArrayList<String> list ) {
-               String newList = "";
-               for( String item : list ) {
-                       if ( newList.length() != 0 ) newList += GIT_CONFIG_DELIMITER;
-                       newList += item;
-               }
-               
-               return newList;
-       }
-       
-       
-       public static class SiteConfiguration {
-               public String name;
-               public String baseURI;
-               public String listType;
-               public String listLocation;
-               public boolean isActive;
-               public boolean isSiteProxyUsed;
-               public String proxyURL;
-               
-               public SiteConfiguration(String name1, String baseURI1, String listType1, String listLocation1,
-                               boolean isSiteProxyUsed1, String proxyURL1 ) {
-                       name = name1;
-                       baseURI = baseURI1;
-                       listType = listType1;
-                       listLocation = listLocation1;
-                       isSiteProxyUsed = isSiteProxyUsed1;
-                       proxyURL = proxyURL1;
-                       
-                       isActive = false;
-               }
-               
-               public void setActive( boolean value ) {
-                       isActive = value;
-               }
-               
-               
-               public String getListCacheFile() {
-                       return ResourcesPlugin.getWorkspace().getRoot().getLocation()
-                                       .append(String.format(GIT_LIST_CACHE_FILE_FORMAT, name)).toString();
-               }
-       }
-
-       
+    public static final String PASSWORD_KEY = "org.tizen.nativeplatform.sudo.password";
+
+    private static final String GIT_ACTIVE_CONFIG = "org.tizen.nativeplatform.git.active.config";
+    private static final String GIT_CONFIG_NAME = "org.tizen.nativeplatform.site.config.name";
+    private static final String GIT_BASE_URI = "org.tizen.nativeplatform.git.base.uri";
+    private static final String GIT_LIST_TYPE = "org.tizen.nativeplatform.git.list.type";
+    private static final String GIT_LIST_LOCATION = "org.tizen.nativeplatform.git.list.location";
+    private static final String USE_SITE_PROXY = "org.tizen.nativeplatform.site.use.proxy";
+    private static final String PROXY_URL = "rg.tizen.nativeplatform.site.use.proxy.url";
+    private static final String GIT_CONFIG_DELIMITER = "|";
+    public static final String GIT_LIST_WEB = "GITWEB";
+    public static final String GIT_LIST_LOCAL = "LOCAL";
+    private static final String DEFAULT_GIT_CONFIG_NAME = "Tizen-Public";
+    private static final String DEFAULT_GIT_BASE_URI = "review.tizen.org";
+    private static final String DEFAULT_GIT_LIST_TYPE = GIT_LIST_WEB;
+    private static final String DEFAULT_GIT_LIST_LOCATION = "https://review.tizen.org/git/";
+    private static final boolean DEFAULT_USE_SITE_PROXY = false;
+    private static final String DEFAULT_PROXY_URL = "";
+    private static final String GIT_LIST_CACHE_FILE_FORMAT = ".%s.index.html";
+
+    private static IPreferenceStore prefStore = org.tizen.nativecommon.Activator.getDefault()
+            .getPreferenceStore();
+    private static ServiceTracker<IProxyService, IProxyService> proxyTracker;
+
+    public static void setDefaultValues() {
+        if (!prefStore.contains(GIT_CONFIG_NAME)) {
+            addSiteConfiguration(DEFAULT_GIT_CONFIG_NAME, DEFAULT_GIT_BASE_URI,
+                    DEFAULT_GIT_LIST_TYPE, DEFAULT_GIT_LIST_LOCATION, DEFAULT_USE_SITE_PROXY,
+                    DEFAULT_PROXY_URL);
+        }
+    }
+
+    public static void setPassword(String p) {
+        prefStore.setValue(PASSWORD_KEY, p);
+    }
+
+    public static boolean isProxyUsed() {
+        if (isSiteProxyUsed()) {
+            return true;
+        }
+        if (isSystemProxyUsed()) {
+            return true;
+        }
+        return false;
+    }
+
+    public static Proxy getProxy() {
+        if (isProxyUsed()) {
+            String host = getProxyHost();
+            int port = getProxyPort();
+            String protocol = getProxyProtocol();
+            Proxy.Type proxyType;
+            if (protocol.equals("http") || protocol.equals("https")) {
+                proxyType = Proxy.Type.HTTP;
+            } else {
+                proxyType = Proxy.Type.SOCKS;
+            }
+
+            return new Proxy(proxyType, new InetSocketAddress(host, port));
+        } else {
+            return null;
+        }
+    }
+
+    public static String getProxyURL() {
+        String proxyURL = getSiteProxyURL();
+        if (proxyURL == null) {
+            proxyURL = getSystemProxyURL();
+        }
+
+        return proxyURL;
+    }
+
+    public static String[] getProxyParsedURL() {
+        String[] proxyURL = getSiteProxyParsedURL();
+        if (proxyURL == null) {
+            proxyURL = getSystemProxyParsedURL();
+        }
+
+        return proxyURL;
+    }
+
+    public static String getProxyProtocol() {
+        String[] proxyURL = getProxyParsedURL();
+        if (proxyURL == null) {
+            return null;
+        }
+        return proxyURL[ProxyURLParser.PROXY_TYPE];
+    }
+
+    public static String getProxyHost() {
+        String[] proxyURL = getProxyParsedURL();
+        if (proxyURL == null) {
+            return null;
+        }
+        return proxyURL[ProxyURLParser.PROXY_HOST];
+    }
+
+    public static int getProxyPort() {
+        String[] proxyURL = getProxyParsedURL();
+        if (proxyURL == null) {
+            return -1;
+        }
+        return Integer.parseInt(proxyURL[ProxyURLParser.PROXY_PORT]);
+    }
+
+    private static boolean isSiteProxyUsed() {
+        SiteConfiguration activeConf = loadActiveSiteConfiguration();
+        if (activeConf == null) {
+            return false;
+        }
+
+        return activeConf.isSiteProxyUsed;
+    }
+
+    private static String getSiteProxyURL() {
+        SiteConfiguration activeConf = loadActiveSiteConfiguration();
+        if (activeConf == null) {
+            return null;
+        }
+
+        if (activeConf.isSiteProxyUsed) {
+            return activeConf.proxyURL;
+        } else {
+            return null;
+        }
+    }
+
+    private static String[] getSiteProxyParsedURL() {
+        SiteConfiguration activeConf = loadActiveSiteConfiguration();
+        if (activeConf == null) {
+            return null;
+        }
+
+        if (activeConf.isSiteProxyUsed) {
+            return ProxyURLParser.getParsedUrl(activeConf.proxyURL);
+        } else {
+            return null;
+        }
+    }
+
+    private static boolean isSystemProxyUsed() {
+        return getSystemProxyURL() != null ? true : false;
+    }
+
+    private static String getSystemProxyURL() {
+        IProxyData data = getProxyData(IProxyData.SOCKS_PROXY_TYPE);
+        if (data != null) {
+            return String.format("socks://%s:%d", data.getHost(), data.getPort());
+        }
+
+        data = getProxyData(IProxyData.HTTP_PROXY_TYPE);
+        if (data != null) {
+            return String.format("http://%s:%d", data.getHost(), data.getPort());
+        }
+
+        data = getProxyData(IProxyData.HTTPS_PROXY_TYPE);
+        if (data != null) {
+            return String.format("https://%s:%d", data.getHost(), data.getPort());
+        }
+
+        return null;
+    }
+
+    private static String[] getSystemProxyParsedURL() {
+        String[] parsedUrl = { "", "", "" };
+
+        IProxyData data = getProxyData(IProxyData.SOCKS_PROXY_TYPE);
+        if (data != null) {
+            parsedUrl[0] = IProxyData.SOCKS_PROXY_TYPE.toLowerCase();
+            parsedUrl[1] = data.getHost();
+            parsedUrl[2] = Integer.toString(data.getPort());
+            return parsedUrl;
+        }
+
+        data = getProxyData(IProxyData.HTTP_PROXY_TYPE);
+        if (data != null) {
+            parsedUrl[0] = IProxyData.HTTP_PROXY_TYPE.toLowerCase();
+            parsedUrl[1] = data.getHost();
+            parsedUrl[2] = Integer.toString(data.getPort());
+            return parsedUrl;
+        }
+
+        data = getProxyData(IProxyData.HTTPS_PROXY_TYPE);
+        if (data != null) {
+            parsedUrl[0] = IProxyData.HTTPS_PROXY_TYPE.toLowerCase();
+            parsedUrl[1] = data.getHost();
+            parsedUrl[2] = Integer.toString(data.getPort());
+            return parsedUrl;
+        }
+
+        return null;
+    }
+
+    public static String getHttpProxyURL() {
+        String proxyURL = getSiteProxyURL();
+        if (proxyURL != null && proxyURL.split(":")[0].equals("http")) {
+            return proxyURL;
+        } else {
+            IProxyData data = getProxyData(IProxyData.HTTP_PROXY_TYPE);
+            if (data != null) {
+                return String.format("http://%s:%d", data.getHost(), data.getPort());
+            }
+        }
+
+        return "";
+    }
+
+    private static IProxyData getProxyData(String proxyType) {
+        if (proxyTracker == null) {
+            proxyTracker = new ServiceTracker<IProxyService, IProxyService>(FrameworkUtil
+                    .getBundle(PreferencesManager.class).getBundleContext(),
+                    IProxyService.class.getName(), null);
+            proxyTracker.open();
+        }
+
+        IProxyService service = proxyTracker.getService();
+        if (service.isProxiesEnabled()) {
+            IProxyData data = service.getProxyData(proxyType);
+            if (data != null && data.getHost() != null && !data.getHost().isEmpty()) {
+                return data;
+            }
+        }
+
+        return null;
+    }
+
+    public static String getPassword() {
+        return prefStore.getString(PASSWORD_KEY);
+    }
+
+    // Return current active base URI.
+    // and if no active one, return empty string
+    public static String getActiveGitBaseURI() {
+        ArrayList<String> baseURIs = loadGitBaseURI();
+        int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
+        if (baseURIs.size() > 0 && activeId >= 0) {
+            return baseURIs.get(activeId);
+        } else {
+            return "";
+        }
+    }
+
+    // Return current active git list type.
+    // and if no active one, return empty string
+    public static String getActiveGitListType() {
+        ArrayList<String> listTypes = loadGitListType();
+        int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
+        if (listTypes.size() > 0 && activeId >= 0) {
+            return listTypes.get(activeId);
+        } else {
+            return "";
+        }
+    }
+
+    // Return current active git list location.
+    // and if no active one, return empty string
+    public static String getActiveGitListLocation() {
+        ArrayList<String> listLocations = loadGitListLocation();
+        int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
+        if (listLocations.size() > 0 && activeId >= 0) {
+            return listLocations.get(activeId);
+        } else {
+            return "";
+        }
+    }
+
+    public static synchronized SiteConfiguration loadActiveSiteConfiguration() {
+        ArrayList<String> names = loadSiteConfigName();
+        ArrayList<String> baseURIs = loadGitBaseURI();
+        ArrayList<String> listTypes = loadGitListType();
+        ArrayList<String> listLocations = loadGitListLocation();
+        ArrayList<String> listUseSiteProxies = loadUseSiteProxies();
+        ArrayList<String> listProxyURLs = loadProxyURLs();
+
+        int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
+        if (activeId == -1) {
+            return null;
+        }
+
+        SiteConfiguration newConfig = new SiteConfiguration(names.get(activeId),
+                baseURIs.get(activeId), listTypes.get(activeId), listLocations.get(activeId),
+                listUseSiteProxies.get(activeId).equals("YES") ? true : false,
+                listProxyURLs.get(activeId));
+        newConfig.setActive(true);
+
+        return newConfig;
+    }
+
+    public static synchronized ArrayList<SiteConfiguration> loadSiteConfigurations() {
+        ArrayList<String> names = loadSiteConfigName();
+        ArrayList<String> baseURIs = loadGitBaseURI();
+        ArrayList<String> listTypes = loadGitListType();
+        ArrayList<String> listLocations = loadGitListLocation();
+        ArrayList<String> listUseSiteProxies = loadUseSiteProxies();
+        ArrayList<String> listProxyURLs = loadProxyURLs();
+        int activeId = prefStore.getInt(GIT_ACTIVE_CONFIG);
+
+        ArrayList<SiteConfiguration> list = new ArrayList<SiteConfiguration>();
+        for (int idx = 0; idx < names.size(); idx++) {
+            SiteConfiguration newConfig = new SiteConfiguration(names.get(idx), baseURIs.get(idx),
+                    listTypes.get(idx), listLocations.get(idx), listUseSiteProxies.get(idx).equals(
+                            "YES") ? true : false, listProxyURLs.get(idx));
+            if (activeId == idx) {
+                newConfig.setActive(true);
+            }
+            list.add(newConfig);
+        }
+
+        return list;
+    }
+
+    public static synchronized void addSiteConfiguration(String name, String baseURI,
+            String listType, String location, boolean useSiteProxy, String proxyURL) {
+
+        ArrayList<String> newList = loadSiteConfigName();
+        newList.add(name);
+        saveGitConfigName(newList);
+
+        newList = loadGitBaseURI();
+        newList.add(baseURI);
+        saveGitBaseURI(newList);
+
+        newList = loadGitListType();
+        newList.add(listType);
+        saveGitListType(newList);
+
+        newList = loadGitListLocation();
+        newList.add(location);
+        saveGitListLocation(newList);
+
+        newList = loadUseSiteProxies();
+        newList.add(useSiteProxy ? "YES" : "NO");
+        saveUseSiteProxies(newList);
+
+        newList = loadProxyURLs();
+        newList.add(proxyURL);
+        saveProxyURLs(newList);
+
+        if (newList.size() == 1)
+            setActiveSiteConfiguration(0);
+    }
+
+    public static synchronized void updateSiteConfiguration(int id, String name, String baseURI,
+            String listType, String location, boolean useSiteProxy, String proxyURL) {
+
+        ArrayList<String> newList = loadSiteConfigName();
+        newList.set(id, name);
+        saveGitConfigName(newList);
+
+        newList = loadGitBaseURI();
+        newList.set(id, baseURI);
+        saveGitBaseURI(newList);
+
+        newList = loadGitListType();
+        newList.set(id, listType);
+        saveGitListType(newList);
+
+        newList = loadGitListLocation();
+        newList.set(id, location);
+        saveGitListLocation(newList);
+
+        newList = loadUseSiteProxies();
+        newList.set(id, useSiteProxy ? "YES" : "NO");
+        saveUseSiteProxies(newList);
+
+        newList = loadProxyURLs();
+        newList.set(id, proxyURL);
+        saveProxyURLs(newList);
+    }
+
+    public static synchronized void setActiveSiteConfiguration(int id) {
+        prefStore.setValue(GIT_ACTIVE_CONFIG, id);
+    }
+
+    public static synchronized void removeSiteConfiguration(int id) {
+        ArrayList<String> newList = loadSiteConfigName();
+        newList.remove(id);
+        saveGitConfigName(newList);
+
+        newList = loadGitBaseURI();
+        newList.remove(id);
+        saveGitBaseURI(newList);
+
+        newList = loadGitListType();
+        newList.remove(id);
+        saveGitListType(newList);
+
+        newList = loadGitListLocation();
+        newList.remove(id);
+        saveGitListLocation(newList);
+
+        int prevActiveId = prefStore.getInt(GIT_ACTIVE_CONFIG);
+        if (prevActiveId == id) {
+            if (newList.size() == 0) {
+                setActiveSiteConfiguration(-1);
+            } else {
+                setActiveSiteConfiguration(0);
+            }
+        } else if (prevActiveId > id) {
+            setActiveSiteConfiguration(id - 1);
+        }
+    }
+
+    public static synchronized void refreshGitWebConfiguration(int idx) throws IOException {
+        String name = loadSiteConfigName().get(idx);
+        String path = loadGitListLocation().get(idx);
+
+        URL u = new URL(path);
+        String cacheFile = ResourcesPlugin.getWorkspace().getRoot().getLocation()
+                .append(String.format(GIT_LIST_CACHE_FILE_FORMAT, name)).toString();
+        URLConnection yc = u.openConnection();
+        BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
+        BufferedWriter out = new BufferedWriter(new FileWriter(cacheFile));
+        String line = null;
+        while ((line = in.readLine()) != null) {
+            out.write(line + "\n");
+        }
+    }
+
+    private static ArrayList<String> loadSiteConfigName() {
+        String values = prefStore.getString(GIT_CONFIG_NAME);
+        if (!values.isEmpty()) {
+            return new ArrayList<String>(Arrays.asList(values.split("[|]")));
+        } else {
+            return new ArrayList<String>();
+        }
+    }
+
+    private static void saveGitConfigName(ArrayList<String> list) {
+        prefStore.setValue(GIT_CONFIG_NAME, generateListString(list));
+    }
+
+    private static ArrayList<String> loadGitBaseURI() {
+        String values = prefStore.getString(GIT_BASE_URI);
+        if (!values.isEmpty()) {
+            return new ArrayList<String>(Arrays.asList(values.split("[|]")));
+        } else {
+            return new ArrayList<String>();
+        }
+    }
+
+    private static void saveGitBaseURI(ArrayList<String> list) {
+        prefStore.setValue(GIT_BASE_URI, generateListString(list));
+    }
+
+    private static ArrayList<String> loadGitListType() {
+        String values = prefStore.getString(GIT_LIST_TYPE);
+        if (!values.isEmpty()) {
+            return new ArrayList<String>(Arrays.asList(values.split("[|]")));
+        } else {
+            return new ArrayList<String>();
+        }
+    }
+
+    private static void saveGitListType(ArrayList<String> list) {
+        prefStore.setValue(GIT_LIST_TYPE, generateListString(list));
+    }
+
+    private static ArrayList<String> loadGitListLocation() {
+        String values = prefStore.getString(GIT_LIST_LOCATION);
+        if (!values.isEmpty()) {
+            return new ArrayList<String>(Arrays.asList(values.split("[|]")));
+        } else {
+            return new ArrayList<String>();
+        }
+    }
+
+    private static void saveGitListLocation(ArrayList<String> list) {
+        prefStore.setValue(GIT_LIST_LOCATION, generateListString(list));
+    }
+
+    private static ArrayList<String> loadUseSiteProxies() {
+        String values = prefStore.getString(USE_SITE_PROXY);
+        if (!values.isEmpty()) {
+            return new ArrayList<String>(Arrays.asList(values.split("[|]")));
+        } else {
+            return new ArrayList<String>();
+        }
+    }
+
+    private static void saveUseSiteProxies(ArrayList<String> list) {
+        prefStore.setValue(USE_SITE_PROXY, generateListString(list));
+    }
+
+    private static ArrayList<String> loadProxyURLs() {
+        String values = prefStore.getString(PROXY_URL);
+        if (!values.isEmpty()) {
+            ArrayList<String> newList = new ArrayList<String>();
+            for (String url : values.split("[|]")) {
+                if (url.equals("EMPTY")) {
+                    newList.add("");
+                } else {
+                    newList.add(url);
+                }
+            }
+            return newList;
+        } else {
+            return new ArrayList<String>();
+        }
+    }
+
+    private static void saveProxyURLs(ArrayList<String> list) {
+        ArrayList<String> newList = new ArrayList<String>();
+        for (String url : list) {
+            if (url.isEmpty()) {
+                newList.add("EMPTY");
+            } else {
+                newList.add(url);
+            }
+        }
+
+        prefStore.setValue(PROXY_URL, generateListString(newList));
+    }
+
+    private static String generateListString(ArrayList<String> list) {
+        String newList = "";
+        for (String item : list) {
+            if (newList.length() != 0) {
+                newList += GIT_CONFIG_DELIMITER;
+            }
+            newList += item;
+        }
+
+        return newList;
+    }
+
+    public static class SiteConfiguration {
+        public String name;
+        public String baseURI;
+        public String listType;
+        public String listLocation;
+        public boolean isActive;
+        public boolean isSiteProxyUsed;
+        public String proxyURL;
+
+        public SiteConfiguration(String name1, String baseURI1, String listType1,
+                String listLocation1, boolean isSiteProxyUsed1, String proxyURL1) {
+            name = name1;
+            baseURI = baseURI1;
+            listType = listType1;
+            listLocation = listLocation1;
+            isSiteProxyUsed = isSiteProxyUsed1;
+            proxyURL = proxyURL1;
+
+            isActive = false;
+        }
+
+        public void setActive(boolean value) {
+            isActive = value;
+        }
+
+        public String getListCacheFile() {
+            return ResourcesPlugin.getWorkspace().getRoot().getLocation()
+                    .append(String.format(GIT_LIST_CACHE_FILE_FORMAT, name)).toString();
+        }
+    }
+
 }
index 5bbcaf2..dc0f49b 100644 (file)
@@ -332,7 +332,9 @@ public class SiteConfigurationDialog extends Dialog {
         gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
                proxyURLText.setLayoutData(gridData);
                proxyURLText.setText(proxyURL);
-               if ( !useSiteProxy ) proxyURLText.setEnabled(false);
+               if ( !useSiteProxy ) {
+                   proxyURLText.setEnabled(false);
+               }
                
         new Label( group, SWT.NONE );
         
@@ -383,7 +385,9 @@ public class SiteConfigurationDialog extends Dialog {
                                        return;
                                }
                                // use default port
-                               if ( port == -1 ) port = 8080;
+                               if ( port == -1 ) {
+                                   port = 8080;
+                               }
                                
                                // make new URL
                                proxyURL = String.format("%s://%s:%d", protocol, host, port);
@@ -1,4 +1,4 @@
-package org.tizen.nativeplatform.repository;
+package org.tizen.nativeplatform.repo.commander;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -7,8 +7,9 @@ import java.util.Iterator;
 import org.eclipse.core.runtime.IPath;
 import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
-import org.tizen.nativeplatform.pkgmgr.model.Repository;
-import org.tizen.nativeplatform.pkgmgr.model.RepositoryProvider;
+import org.tizen.nativeplatform.repo.model.Repository;
+import org.tizen.nativeplatform.repo.model.RepositoryProvider;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 
 public class RepoManager {
@@ -90,11 +91,11 @@ public class RepoManager {
                 if (repoPath != null) {
                     RepositoryProvider.INSTANCE.getBuildsystemRepos()
                             .add(new Repository(name, url));
-                    target.getRootstrapCommander().addLocalRepo(name, repoPath.toOSString());
+                    target.getCommander(CmdTargetTypes.ROOTSTRAP).addLocalRepo(name, repoPath.toOSString());
                 }
             } else {
                 RepositoryProvider.INSTANCE.getBuildsystemRepos().add(new Repository(name, url));
-                target.getRootstrapCommander().addRepo(name, url);
+                target.getCommander(CmdTargetTypes.ROOTSTRAP).addRepo(name, url);
             }
         }
     }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/BaseFileSystemGenerator.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/BaseFileSystemGenerator.java
new file mode 100644 (file)
index 0000000..786fab8
--- /dev/null
@@ -0,0 +1,122 @@
+package org.tizen.nativeplatform.rootstrap;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.tizen.common.core.application.InstallPathConfig;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.tizen.nativeplatform.util.CommandLauncher;
+import org.tizen.nativeplatform.util.RootstrapUtil;
+
+public class BaseFileSystemGenerator {
+
+    public static boolean generate(String rootstrapPath, String arch, ArrayList<String> reposURLs,
+            IPath confFile, IProgressMonitor monitor) throws InterruptedException {
+        File rootstrapDir = new File(rootstrapPath);
+        String id = rootstrapDir.getName();
+        String tempDirPath = null;
+        try {
+            // make temp directory
+            tempDirPath = RootstrapUtil.makeTempDirectory();
+
+            // use rogen
+            String rogen = InstallPathConfig.getSDKPath() + "/tools/rogen/bin/rogen.rb";
+            String baseArch = RootstrapUtil.getBaseArchitecture(arch);
+            String urlData = "";
+            for (String url : reposURLs) {
+                urlData += (urlData.isEmpty() ? url : "," + url);
+            }
+
+            String command;
+            Map<String, String> env = null;
+            if (PreferencesManager.isProxyUsed()) {
+                String protocol = PreferencesManager.getProxyProtocol();
+                String host = PreferencesManager.getProxyHost();
+                int port = PreferencesManager.getProxyPort();
+                SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+                String envKey = String.format("%s_proxy", protocol);
+                String envValue = String.format("%s://%s:%d", protocol, host, port);
+                env = sbi.addEnvironmentVariable(envKey, envValue);
+            }
+
+            command = String.format("%s -n %s -a %s -u %s -p rpm --ctrl GBS -g TizenPlatform",
+                    rogen, id, baseArch, urlData);
+
+            if (confFile != null) {
+                command += String.format(" -d %s", confFile.toOSString());
+            }
+
+            if (rootstrapDir.exists()) {
+                if (!CommandLauncher.executeSudo(command, rootstrapDir.getParent(), env,
+                        "Platform Internal", monitor)) {
+                    return false;
+                }
+            } else {
+                if (!CommandLauncher.executeSudo(command, tempDirPath, env, "Platform Internal",
+                        monitor)) {
+                    return false;
+                }
+
+                // copy
+                String rootstrapBasePath = rootstrapDir.getParent();
+                CommandLauncher.execute(String.format("mkdir -p %s", rootstrapBasePath));
+                CommandLauncher.executeSudo(String.format("sudo -S mv %s/%s %s/", tempDirPath, id,
+                        rootstrapBasePath));
+            }
+        } finally {
+            if (new File(tempDirPath).exists()) {
+                // check sub-directory
+                String checkDir = String.format("%s/%s/local/BUILD-ROOTS/scratch.%s.0/proc",
+                        tempDirPath, id, arch);
+                if (new File(checkDir).exists()) {
+                    CommandLauncher.executeSudo(String.format("sudo -S umount %s", checkDir));
+                }
+                checkDir = String.format("%s/%s/local/BUILD-ROOTS/scratch.%s.0/dev/pts",
+                        tempDirPath, id, arch);
+                if (new File(checkDir).exists()) {
+                    CommandLauncher.executeSudo(String.format("sudo -S umount %s", checkDir));
+                }
+
+                // remove
+                CommandLauncher.executeSudo(String.format("sudo -S rm -rf %s", tempDirPath));
+            }
+        }
+
+        return true;
+    }
+
+    public static boolean generate(String rootstrapPath, String arch,
+            HashMap<String, String> reposURLs, IPath confFile, IProgressMonitor monitor)
+            throws InterruptedException {
+        ArrayList<String> repos = new ArrayList<String>();
+        Iterator<String> keySet = reposURLs.keySet().iterator();
+
+        while (keySet.hasNext()) {
+            repos.add(keySet.next());
+        }
+
+        return generate(rootstrapPath, arch, repos, confFile, monitor);
+    }
+
+    public static void remove(String id, String arch) throws InterruptedException {
+        String path = RootstrapUtil.getUserRootstrapPath(id);
+        // check sub-directory
+        String checkDir = String.format("%s/local/BUILD-ROOTS/scratch.%s.0/proc", path, arch);
+        if (new File(checkDir).exists()) {
+            CommandLauncher.executeSudo(String.format("sudo -S umount %s", checkDir));
+        }
+        checkDir = String.format("%s/local/BUILD-ROOTS/scratch.%s.0/dev/pts", path, arch);
+        if (new File(checkDir).exists()) {
+            CommandLauncher.executeSudo(String.format("sudo -S umount %s", checkDir));
+        }
+
+        CommandLauncher.executeSudo(String.format("sudo -S rm -rf %s", path), null);
+    }
+
+}
index 9a5ce03..fabc014 100644 (file)
 package org.tizen.nativeplatform.rootstrap;
 
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.FilenameFilter;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.tizen.common.core.application.InstallPathConfig;
 import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.build.exception.SBIException;
 import org.tizen.nativecommon.build.model.Rootstrap;
 import org.tizen.nativecommon.build.model.SBIModel;
-import org.tizen.nativecommon.build.model.Target;
-import org.tizen.nativeplatform.build.PlatformConfigurationManager;
-import org.tizen.nativeplatform.preferences.PreferencesManager;
-import org.tizen.nativeplatform.repository.RepoManager;
+import org.tizen.nativeplatform.repo.commander.RepoManager;
 import org.tizen.nativeplatform.util.CommandLauncher;
-import org.tizen.nativeplatform.util.InstallerUtil;
+import org.tizen.nativeplatform.util.RootstrapUtil;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
 
 public class RootstrapManager {
 
@@ -79,9 +57,7 @@ public class RootstrapManager {
     public static Set<IRootstrapChangedListener> changedListener = new HashSet<IRootstrapChangedListener>();
 
     private static boolean init;
-    private static final String URL_SEP = "|";
     private static final String URL_SEP_REGEXP = "[|]";
-    private static final String USER_ROOSTRAP_BASE_DIR_NAME = "user-rootstraps";
 
     protected static final Logger logger = LoggerFactory.getLogger(RootstrapManager.class);
 
@@ -140,14 +116,16 @@ public class RootstrapManager {
         PlatformRootstrap rootstrap = getRootstrap(id);
         if (rootstrap != null) {
             try {
-                removeBaseFileSystem(rootstrap.getId(), rootstrap.getArch());
+                // removeBaseFileSystem(rootstrap.getId(), rootstrap.getArch());
+                BaseFileSystemGenerator.remove(rootstrap.getId(), rootstrap.getArch());
             } catch (InterruptedException e) {
                 logger.error(String.format("Failed to rootstrap: [%s]", id), e);
                 e.printStackTrace();
                 return false;
             }
             rootstraps.remove(rootstrap);
-            removeSBIPluginXML(rootstrap);
+            // removeSBIPluginXML(rootstrap);
+            XMLPluginGenerator.remove(rootstrap.getId());
             SBIModel.removeRootstrap(rootstrap);
             RootstrapManager.notifyChangedRootstrap();
             return true;
@@ -160,7 +138,7 @@ public class RootstrapManager {
             IProgressMonitor monitor) throws InterruptedException {
 
         // make temp directory
-        String tempDirPath = makeTempDirectory();
+        String tempDirPath = RootstrapUtil.makeTempDirectory();
 
         try {
             // rootstrapPath = /home/sdk/tizen-sdk-data/user-rootstraps/latest
@@ -224,7 +202,7 @@ public class RootstrapManager {
         String rootstrapPath = null;
 
         // make temp directory
-        String tempDirPath = makeTempDirectory();
+        String tempDirPath = RootstrapUtil.makeTempDirectory();
 
         try {
             // extract "tar" archive
@@ -325,26 +303,6 @@ public class RootstrapManager {
         }
     }
 
-    private static String makeTempDirectory() {
-        final File temp;
-
-        try {
-            temp = File.createTempFile("temp", Long.toString(System.nanoTime()));
-            if (!(temp.delete())) {
-                throw new IOException("Could not delete temp file: " + temp.getAbsolutePath());
-            }
-
-            if (!(temp.mkdir())) {
-                throw new IOException("Could not create temp directory: " + temp.getAbsolutePath());
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-            return null;
-        }
-
-        return temp.getPath();
-    }
-
     public static List<PlatformRootstrap> getRootstraps() {
         checkInit();
         return rootstraps;
@@ -382,9 +340,10 @@ public class RootstrapManager {
     public static void updateRootstrap(PlatformRootstrap rootstrap) {
         if (rootstrap != null) {
             try {
-                generateSBIPluginXML(rootstrap.getId(), rootstrap.getName(), rootstrap.getArch(),
-                        rootstrap.getPath().toOSString(), rootstrap.getJustRepoURLs(),
-                        rootstrap.getConfFile());
+                XMLPluginGenerator
+                        .generate(rootstrap.getId(), rootstrap.getName(), rootstrap.getArch(),
+                                rootstrap.getPath().toOSString(), rootstrap.getJustRepoURLs(),
+                                rootstrap.getConfFile(), rootstrap.isDefault());
                 SBIModel.updateRootstrap(rootstrap);
                 RootstrapManager.notifyChangedRootstrap();
             } catch (SBIException e) {
@@ -453,8 +412,9 @@ public class RootstrapManager {
         Iterator<IRootstrapChangedListener> ite = changedListener.iterator();
         while (ite.hasNext()) {
             IRootstrapChangedListener tl = ite.next();
-            if (tl != null)
+            if (tl != null) {
                 tl.rootstrapChanged();
+            }
         }
     }
 
@@ -463,8 +423,9 @@ public class RootstrapManager {
         Iterator<IRootstrapChangedListener> ite = changedListener.iterator();
         while (ite.hasNext()) {
             IRootstrapChangedListener tl = ite.next();
-            if (tl != null)
+            if (tl != null) {
                 tl.selectionChanged(rootName);
+            }
         }
     }
 
@@ -474,14 +435,6 @@ public class RootstrapManager {
         }
     }
 
-    private static boolean isRemoteRepo(String repoType) {
-        return (RepoManager.REMOTE_REPO_TYPE.equals(repoType)) ? true : false;
-    }
-
-    private static boolean isLocalRepo(String repoType) {
-        return (RepoManager.LOCAL_REPO_TYPE.equals(repoType)) ? true : false;
-    }
-
     public static PlatformRootstrap generate(String name, String arch,
             HashMap<String, String> reposURLs, boolean immediateGen, IPath confFile,
             IProgressMonitor monitor) throws InterruptedException {
@@ -489,7 +442,13 @@ public class RootstrapManager {
         boolean initialized = false;
         String id = name;
         if (immediateGen) {
-            if (generateBaseFileSystem(getUserRootstrapPath(id), arch, reposURLs, confFile, monitor)) {
+            /*
+             * if (generateBaseFileSystem(getUserRootstrapPath(id), arch,
+             * reposURLs, confFile, monitor)) { initialized = true; } else {
+             * return null; }
+             */
+            if (BaseFileSystemGenerator.generate(RootstrapUtil.getUserRootstrapPath(id), arch,
+                    reposURLs, confFile, monitor)) {
                 initialized = true;
             } else {
                 return null;
@@ -497,275 +456,18 @@ public class RootstrapManager {
         }
 
         // generate SBI plugins
-        if (generateSBIPluginXML(id, name, arch, null, reposURLs, confFile)) {
-            return new PlatformRootstrap(id, name, arch, getUserRootstrapPath(id), reposURLs,
-                    confFile, initialized, false);
+        if (XMLPluginGenerator.generate(id, name, arch, null, reposURLs, confFile)) {
+            return new PlatformRootstrap(id, name, arch, RootstrapUtil.getUserRootstrapPath(id),
+                    reposURLs, confFile, initialized, false);
         } else {
             if (immediateGen) {
-                removeBaseFileSystem(id, arch);
+                // removeBaseFileSystem(id, arch);
+                BaseFileSystemGenerator.remove(id, arch);
             }
             return null;
         }
     }
 
-    public static boolean generateBaseFileSystem(String rootstrapPath, String arch,
-            ArrayList<String> reposURLs, IPath confFile, IProgressMonitor monitor)
-            throws InterruptedException {
-        File rootstrapDir = new File(rootstrapPath);
-        String id = rootstrapDir.getName();
-        String tempDirPath = null;
-        try {
-            // make temp directory
-            tempDirPath = makeTempDirectory();
-
-            // use rogen
-            String rogen = InstallPathConfig.getSDKPath() + "/tools/rogen/bin/rogen.rb";
-            String baseArch = getBaseArchitecture(arch);
-            String urlData = "";
-            for (String url : reposURLs) {
-                urlData += (urlData.isEmpty() ? url : "," + url);
-            }
-
-            String command;
-            Map<String, String> env = null;
-            if (PreferencesManager.isProxyUsed()) {
-                String protocol = PreferencesManager.getProxyProtocol();
-                String host = PreferencesManager.getProxyHost();
-                int port = PreferencesManager.getProxyPort();
-                SmartBuildInterface sbi = SmartBuildInterface.getInstance();
-                String envKey = String.format("%s_proxy", protocol);
-                String envValue = String.format("%s://%s:%d", protocol, host, port);
-                env = sbi.addEnvironmentVariable(envKey, envValue);
-            }
-
-            command = String.format("%s -n %s -a %s -u %s -p rpm --ctrl GBS -g TizenPlatform",
-                    rogen, id, baseArch, urlData);
-
-            if (confFile != null) {
-                command += String.format(" -d %s", confFile.toOSString());
-            }
-
-            if (rootstrapDir.exists()) {
-                if (!CommandLauncher.executeSudo(command, rootstrapDir.getParent(), env,
-                        "Platform Internal", monitor)) {
-                    return false;
-                }
-            } else {
-                if (!CommandLauncher.executeSudo(command, tempDirPath, env, "Platform Internal",
-                        monitor)) {
-                    return false;
-                }
-
-                // copy
-                String rootstrapBasePath = rootstrapDir.getParent();
-                CommandLauncher.execute(String.format("mkdir -p %s", rootstrapBasePath));
-                CommandLauncher.executeSudo(String.format("sudo -S mv %s/%s %s/", tempDirPath, id,
-                        rootstrapBasePath));
-            }
-        } finally {
-            if (new File(tempDirPath).exists()) {
-                // check sub-directory
-                String checkDir = String.format("%s/%s/local/BUILD-ROOTS/scratch.%s.0/proc",
-                        tempDirPath, id, arch);
-                if (new File(checkDir).exists()) {
-                    CommandLauncher.executeSudo(String.format("sudo -S umount %s", checkDir));
-                }
-                checkDir = String.format("%s/%s/local/BUILD-ROOTS/scratch.%s.0/dev/pts",
-                        tempDirPath, id, arch);
-                if (new File(checkDir).exists()) {
-                    CommandLauncher.executeSudo(String.format("sudo -S umount %s", checkDir));
-                }
-
-                // remove
-                CommandLauncher.executeSudo(String.format("sudo -S rm -rf %s", tempDirPath));
-            }
-        }
-
-        return true;
-    }
-
-    public static boolean generateBaseFileSystem(String rootstrapPath, String arch,
-            HashMap<String, String> reposURLs, IPath confFile, IProgressMonitor monitor)
-            throws InterruptedException {
-        ArrayList<String> repos = new ArrayList<String>();
-        Iterator<String> keySet = reposURLs.keySet().iterator();
-
-        while (keySet.hasNext()) {
-            repos.add(keySet.next());
-        }
-
-        return generateBaseFileSystem(rootstrapPath, arch, repos, confFile, monitor);
-    }
-
-    private static void removeBaseFileSystem(String id, String arch) throws InterruptedException {
-        String path = getUserRootstrapPath(id);
-        // check sub-directory
-        String checkDir = String.format("%s/local/BUILD-ROOTS/scratch.%s.0/proc", path, arch);
-        if (new File(checkDir).exists()) {
-            CommandLauncher.executeSudo(String.format("sudo -S umount %s", checkDir));
-        }
-        checkDir = String.format("%s/local/BUILD-ROOTS/scratch.%s.0/dev/pts", path, arch);
-        if (new File(checkDir).exists()) {
-            CommandLauncher.executeSudo(String.format("sudo -S umount %s", checkDir));
-        }
-
-        CommandLauncher.executeSudo(String.format("sudo -S rm -rf %s", path), null);
-    }
-
-    public static String getBaseArchitecture(String arch) {
-        if (arch.contains("arm")) {
-            return "arm";
-        } else {
-            return "i386";
-        }
-    }
-
-    public static boolean generateSBIPluginXML(String id, String name, String arch, String path,
-            ArrayList<String> reposURLs) {
-        return generateSBIPluginXML(id, name, arch, path, reposURLs, null);
-    }
-
-    public static boolean generateSBIPluginXML(String id, String name, String arch, String path,
-            HashMap<String, String> reposURLs, IPath confFile) {
-
-        ArrayList<String> repos = new ArrayList<String>();
-        Iterator<String> keySet = reposURLs.keySet().iterator();
-
-        while (keySet.hasNext()) {
-            repos.add(keySet.next());
-        }
-
-        return generateSBIPluginXML(id, name, arch, path, repos, confFile);
-    }
-
-    public static boolean generateSBIPluginXML(String id, String name, String arch, String path,
-            ArrayList<String> reposURLs, IPath confFile) {
-
-        IPath pluginPath = new Path(SmartBuildInterface.getInstance().getPluginPath());
-        IPath filePath = pluginPath.append(id + ".xml");
-
-        try {
-            DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
-
-            // root element
-            Document doc = docBuilder.newDocument();
-            Element rootElement = doc.createElement("extension");
-            doc.appendChild(rootElement);
-
-            Attr attr = doc.createAttribute("point");
-            attr.setValue("rootstrapDefinition");
-            rootElement.setAttributeNode(attr);
-
-            Element firstnode = doc.createElement("rootstrap");
-            rootElement.appendChild(firstnode);
-
-            Attr attrId = doc.createAttribute("id");
-            attrId.setValue(id);
-            Attr attrName = doc.createAttribute("name");
-            attrName.setValue(name);
-            Attr attrArch = doc.createAttribute("architecture");
-            attrArch.setValue(arch);
-            Attr attrPath = doc.createAttribute("path");
-            if (path == null) {
-                attrPath.setValue(getUserRootstrapPathOfXml(name));
-            } else {
-                attrPath.setValue(getRootstrapPathOfXml(path));
-            }
-            Attr attrType = doc.createAttribute("supportToolchainType");
-            attrType.setValue(PlatformRootstrap.SUPPORTED_TOOLCHAIN_TYPE);
-
-            firstnode.setAttributeNode(attrId);
-            firstnode.setAttributeNode(attrName);
-            firstnode.setAttributeNode(attrArch);
-            firstnode.setAttributeNode(attrPath);
-            firstnode.setAttributeNode(attrType);
-
-            String reposURLString = "";
-            for (String URL : reposURLs) {
-                if (!reposURLString.isEmpty()) {
-                    reposURLString += URL_SEP;
-                }
-                reposURLString += URL;
-            }
-
-            Element secondnode = doc.createElement("property");
-            firstnode.appendChild(secondnode);
-
-            Attr attrKey = doc.createAttribute("key");
-            attrKey.setValue(PlatformRootstrap.PROPERTY_REPO_URLS);
-            Attr attrValue = doc.createAttribute("value");
-            attrValue.setValue(reposURLString);
-
-            secondnode.setAttributeNode(attrKey);
-            secondnode.setAttributeNode(attrValue);
-
-            Element thirdnode = doc.createElement("property");
-            firstnode.appendChild(thirdnode);
-
-            attrKey = doc.createAttribute("key");
-            attrKey.setValue(PlatformRootstrap.PROPERTY_CONFIGURATION_FILE);
-            attrValue = doc.createAttribute("value");
-            if (confFile == null) {
-                attrValue.setValue("");
-            } else {
-                attrValue.setValue(confFile.toOSString());
-            }
-
-            thirdnode.setAttributeNode(attrKey);
-            thirdnode.setAttributeNode(attrValue);
-
-            TransformerFactory transformerFactory = TransformerFactory.newInstance();
-            Transformer transformer = transformerFactory.newTransformer();
-
-            transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
-            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-
-            DOMSource source = new DOMSource(doc);
-            StreamResult result = new StreamResult(new FileOutputStream(new File(
-                    filePath.toOSString())));
-
-            transformer.transform(source, result);
-
-        } catch (ParserConfigurationException e) {
-            logger.error(String.format("Failed to generate XML file: [%s]", e), e);
-            e.printStackTrace();
-            return false;
-        } catch (TransformerConfigurationException e) {
-            logger.error(String.format("Failed to generate XML file: [%s]", e), e);
-            e.printStackTrace();
-            return false;
-        } catch (FileNotFoundException e) {
-            logger.error(String.format("Failed to generate XML file: [%s]", e), e);
-            e.printStackTrace();
-            return false;
-        } catch (TransformerException e) {
-            logger.error(String.format("Failed to generate XML file: [%s]", e), e);
-            e.printStackTrace();
-            return false;
-        }
-
-        return true;
-    }
-
-    public static void removeSBIPluginXML(PlatformRootstrap rootstrap) {
-        // remove related targets
-        ArrayList<Target> targetList = SBIModel.getTargetList();
-        ArrayList<Target> removeList = new ArrayList<Target>();
-        for (Target target : targetList) {
-            if (target.getRootstrap().getId().equals(rootstrap.getId())) {
-                removeList.add(target);
-            }
-        }
-        for (Target target : removeList) {
-            SBIModel.removeTarget(target);
-            new File(getPluginXML(target.getId())).delete();
-        }
-
-        // remove model/file
-        new File(getPluginXML(rootstrap.getId())).delete();
-    }
-
     private static PlatformRootstrap createRootstrapFromSBIPlugin(String id) {
         Rootstrap rootstrap = SBIModel.getRootstrapById(id);
         if (rootstrap == null) {
@@ -789,37 +491,4 @@ public class RootstrapManager {
         return new PlatformRootstrap(id, rootstrap.getName(), rootstrap.getArch(), rootstrap
                 .getPath().toOSString(), reposURLs, confFile, true, rootstrap.isDefault());
     }
-
-    private static String getPluginXML(String id) {
-        IPath pluginPath = new Path(SmartBuildInterface.getInstance().getPluginPath());
-        return pluginPath.append(id + ".xml").toOSString();
-    }
-
-    private static String getBaseUserRootstrapPath() {
-        return new Path(InstallPathConfig.getUserDataPath()).append(USER_ROOSTRAP_BASE_DIR_NAME)
-                .toOSString();
-    }
-
-    private static String getUserRootstrapPath(String id) {
-        return new Path(getBaseUserRootstrapPath()).append(id).toOSString();
-    }
-
-    private static String getUserRootstrapPathOfXml(String id) {
-        String rootstrapPath = getUserRootstrapPath(id);
-
-        return getRootstrapPathOfXml(rootstrapPath);
-    }
-
-    private static String getRootstrapPathOfXml(String path) {
-        if (InstallerUtil.isSupportedMultipleSDK()) {
-            return path.replaceAll(String.format("%s/", InstallPathConfig.getSDKPath()),
-                    "#{SDK_INSTALLED_PATH}/").replaceAll(
-                    String.format("%s/", InstallPathConfig.getUserDataPath()), "#{SDK_DATA_PATH}/");
-        } else {
-            return path.replaceAll(String.format("%s/", InstallPathConfig.getSDKPath()),
-                    "#{SBI_HOME}/../../").replaceAll(
-                    String.format("%s/", InstallPathConfig.getUserDataPath()),
-                    "#{HOME}/tizen-sdk-data/");
-        }
-    }
 }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/XMLPluginGenerator.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/XMLPluginGenerator.java
new file mode 100644 (file)
index 0000000..6036884
--- /dev/null
@@ -0,0 +1,216 @@
+package org.tizen.nativeplatform.rootstrap;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.model.SBIModel;
+import org.tizen.nativecommon.build.model.Target;
+import org.tizen.nativeplatform.util.RootstrapUtil;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class XMLPluginGenerator {
+
+    private static final String URL_SEP = "|";
+
+    private static final String ELEMENT_EXTENSION = "extension";
+    private static final String ELEMENT_ROOTSTRAP = "rootstrap";
+    private static final String ELEMENT_PROPERTY = "property";
+
+    private static final String ATTR_POINT = "point";
+    private static final String ATTR_ID = "id";
+    private static final String ATTR_NAME = "name";
+    private static final String ATTR_ARCH = "architecture";
+    private static final String ATTR_PATH = "path";
+    private static final String ATTR_TOOLTYPE = "supportToolchainType";
+    private static final String ATTR_KEY = "key";
+    private static final String ATTR_VALUE = "value";
+
+    protected static final Logger logger = LoggerFactory.getLogger(XMLPluginGenerator.class);
+
+    public static boolean generate(String id, String name, String arch, String path,
+            ArrayList<String> reposURLs) {
+        return generate(id, name, arch, path, reposURLs, null);
+    }
+
+    public static boolean generate(String id, String name, String arch, String path,
+            HashMap<String, String> reposURLs, IPath confFile) {
+
+        ArrayList<String> repos = new ArrayList<String>();
+        Iterator<String> keySet = reposURLs.keySet().iterator();
+
+        while (keySet.hasNext()) {
+            repos.add(keySet.next());
+        }
+
+        return generate(id, name, arch, path, repos, confFile);
+    }
+
+    public static boolean generate(String id, String name, String arch, String path,
+            ArrayList<String> reposURLs, IPath confFile) {
+        return generate(id, name, arch, path, reposURLs, confFile, false);
+    }
+
+    public static boolean generate(String id, String name, String arch, String path,
+            ArrayList<String> reposURLs, IPath confFile, boolean isDefault) {
+
+        IPath pluginPath = new Path(SmartBuildInterface.getInstance().getPluginPath());
+        IPath filePath = pluginPath.append(id + ".xml");
+
+        try {
+            DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+
+            // root element
+            Document doc = docBuilder.newDocument();
+            Element rootElement = doc.createElement(ELEMENT_EXTENSION);
+            doc.appendChild(rootElement);
+
+            Attr attr = doc.createAttribute(ATTR_POINT);
+            attr.setValue("rootstrapDefinition");
+            rootElement.setAttributeNode(attr);
+
+            Element firstnode = doc.createElement(ELEMENT_ROOTSTRAP);
+            rootElement.appendChild(firstnode);
+
+            Attr attrId = doc.createAttribute(ATTR_ID);
+            attrId.setValue(id);
+            Attr attrName = doc.createAttribute(ATTR_NAME);
+            attrName.setValue(name);
+            Attr attrArch = doc.createAttribute(ATTR_ARCH);
+            attrArch.setValue(arch);
+            Attr attrPath = doc.createAttribute(ATTR_PATH);
+            if (path == null) {
+                attrPath.setValue(RootstrapUtil.getUserRootstrapPathOfXml(name));
+            } else {
+                attrPath.setValue(RootstrapUtil.getRootstrapPathOfXml(path));
+            }
+            Attr attrType = doc.createAttribute(ATTR_TOOLTYPE);
+            attrType.setValue(PlatformRootstrap.SUPPORTED_TOOLCHAIN_TYPE);
+
+            firstnode.setAttributeNode(attrId);
+            firstnode.setAttributeNode(attrName);
+            firstnode.setAttributeNode(attrArch);
+            firstnode.setAttributeNode(attrPath);
+            firstnode.setAttributeNode(attrType);
+
+            String reposURLString = "";
+            for (String URL : reposURLs) {
+                if (!reposURLString.isEmpty()) {
+                    reposURLString += URL_SEP;
+                }
+                reposURLString += URL;
+            }
+
+            Element secondnode = doc.createElement(ELEMENT_PROPERTY);
+            firstnode.appendChild(secondnode);
+
+            Attr attrKey = doc.createAttribute(ATTR_KEY);
+            attrKey.setValue(PlatformRootstrap.PROPERTY_REPO_URLS);
+            Attr attrValue = doc.createAttribute(ATTR_VALUE);
+            attrValue.setValue(reposURLString);
+
+            secondnode.setAttributeNode(attrKey);
+            secondnode.setAttributeNode(attrValue);
+
+            Element thirdnode = doc.createElement(ELEMENT_PROPERTY);
+            firstnode.appendChild(thirdnode);
+
+            attrKey = doc.createAttribute(ATTR_KEY);
+            attrKey.setValue(PlatformRootstrap.PROPERTY_CONFIGURATION_FILE);
+            attrValue = doc.createAttribute(ATTR_VALUE);
+            if (confFile == null) {
+                attrValue.setValue("");
+            } else {
+                attrValue.setValue(confFile.toOSString());
+            }
+
+            thirdnode.setAttributeNode(attrKey);
+            thirdnode.setAttributeNode(attrValue);
+
+            // if it is default rootstrap, set default property.
+            if (isDefault) {
+                Element fourthnode = doc.createElement(ELEMENT_PROPERTY);
+                firstnode.appendChild(fourthnode);
+                attrKey = doc.createAttribute(ATTR_KEY);
+                attrKey.setValue(PlatformRootstrap.PROPERTY_DEFAULT);
+                attrValue = doc.createAttribute(ATTR_VALUE);
+                attrValue.setValue("true");
+                fourthnode.setAttributeNode(attrKey);
+                fourthnode.setAttributeNode(attrValue);
+            }
+
+            TransformerFactory transformerFactory = TransformerFactory.newInstance();
+            Transformer transformer = transformerFactory.newTransformer();
+
+            transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+            DOMSource source = new DOMSource(doc);
+            StreamResult result = new StreamResult(new FileOutputStream(new File(
+                    filePath.toOSString())));
+
+            transformer.transform(source, result);
+
+        } catch (ParserConfigurationException e) {
+            logger.error(String.format("Failed to generate XML file: [%s]", e), e);
+            e.printStackTrace();
+            return false;
+        } catch (TransformerConfigurationException e) {
+            logger.error(String.format("Failed to generate XML file: [%s]", e), e);
+            e.printStackTrace();
+            return false;
+        } catch (FileNotFoundException e) {
+            logger.error(String.format("Failed to generate XML file: [%s]", e), e);
+            e.printStackTrace();
+            return false;
+        } catch (TransformerException e) {
+            logger.error(String.format("Failed to generate XML file: [%s]", e), e);
+            e.printStackTrace();
+            return false;
+        }
+
+        return true;
+    }
+
+    public static void remove(String id) {
+        // remove related targets
+        ArrayList<Target> targetList = SBIModel.getTargetList();
+        ArrayList<Target> removeList = new ArrayList<Target>();
+        for (Target target : targetList) {
+            if (target.getRootstrap().getId().equals(id)) {
+                removeList.add(target);
+            }
+        }
+        for (Target target : removeList) {
+            SBIModel.removeTarget(target);
+            new File(RootstrapUtil.getPluginXML(target.getId())).delete();
+        }
+
+        // remove model/file
+        new File(RootstrapUtil.getPluginXML(id)).delete();
+    }
+
+}
index 4172940..c6b5285 100644 (file)
@@ -29,6 +29,7 @@ package org.tizen.nativeplatform.templateengine.process;
 
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -38,6 +39,7 @@ import java.util.Map;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 
 import org.eclipse.cdt.core.model.CoreModel;
 import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
@@ -99,9 +101,8 @@ public class SetDefaultIncludePaths extends ProcessRunner {
             return;
         }
         /*
-         * Codes are from CDT source (import include path settings) -
-         * org.eclipse
-         * .cdt.internal.ui.wizards.settingswizards.ProjectSettingsImportStrategy
+         * Codes are from CDT source (import include path settings) 
+         * - org.eclipse.cdt.internal.ui.wizards.settingswizards.ProjectSettingsImportStrategy
          * - org.eclipse.cdt.internal.ui.wizards.settingswizards.
          * ProjectSettingsWizardPage
          */
@@ -157,8 +158,9 @@ public class SetDefaultIncludePaths extends ProcessRunner {
 
                 // if there is an importer available for the section then
                 // delegate to it
-                if (importer != null)
+                if (importer != null) {
                     pairs.add(new ImporterSectionPair(importer, section));
+                }
             }
         }
         return pairs;
@@ -195,8 +197,14 @@ public class SetDefaultIncludePaths extends ProcessRunner {
             InputSource input = new InputSource(in);
             Document doc = parser.parse(input);
             return doc;
-
-        } catch (Exception e) {
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+            throw new SettingsImportExportException(e);
+        } catch (SAXException e) {
+            e.printStackTrace();
+            throw new SettingsImportExportException(e);
+        } catch (IOException e) {
+            e.printStackTrace();
             throw new SettingsImportExportException(e);
         }
     }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/types/CmdTargetTypes.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/types/CmdTargetTypes.java
new file mode 100644 (file)
index 0000000..fd15f0e
--- /dev/null
@@ -0,0 +1,17 @@
+package org.tizen.nativeplatform.types;
+
+public enum CmdTargetTypes {
+    HOST("host"),
+    DEVICE("device"),
+    ROOTSTRAP("rootstrap");
+    
+    final String type;
+
+    private CmdTargetTypes(String type) {
+        this.type = type;
+    }
+
+    public String getType() {
+        return type;
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/types/PkgInstallTypes.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/types/PkgInstallTypes.java
new file mode 100644 (file)
index 0000000..85ec945
--- /dev/null
@@ -0,0 +1,17 @@
+package org.tizen.nativeplatform.types;
+
+public enum PkgInstallTypes {
+    INSTALLED("Installed"),
+    NOT_INSTALLED("Not Installed"),
+    DIFFERENT_VERSION("Different Version");
+    
+    final String type;
+
+    private PkgInstallTypes(String type) {
+        this.type = type;
+    }
+
+    public String toString() {
+        return type;
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/types/PkgTypes.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/types/PkgTypes.java
new file mode 100644 (file)
index 0000000..12b496b
--- /dev/null
@@ -0,0 +1,15 @@
+package org.tizen.nativeplatform.types;
+
+public enum PkgTypes {
+    RPM("rpm");
+    
+    final String ext;
+
+    private PkgTypes(String ext) {
+        this.ext = ext;
+    }
+
+    public String getExt() {
+        return ext;
+    }
+}
index 74f71c5..be6bfbb 100644 (file)
@@ -1,36 +1,38 @@
 package org.tizen.nativeplatform.util;
 
-public class CharacterStripper {       
-       /**
-     * This method ensures that the output String has only
-     * valid XML unicode characters as specified by the
-     * XML 1.0 standard. For reference, please see
-     * <a href="http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char">the
-     * standard</a>. This method will return an empty
-     * String if the input is null or empty.
-     *
-     * @param in The String whose non-valid characters we want to remove.
+public class CharacterStripper {
+    /**
+     * This method ensures that the output String has only valid XML unicode
+     * characters as specified by the XML 1.0 standard. For reference, please
+     * see <a href="http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char">the
+     * standard</a>. This method will return an empty String if the input is
+     * null or empty.
+     * 
+     * @param in
+     *            The String whose non-valid characters we want to remove.
      * @return The in String, stripped of non-valid characters.
      */
     public static String stripNonValidXMLCharacters(String in) {
         StringBuffer out = new StringBuffer(); // Used to hold the output.
         char current; // Used to reference the current character.
-        if (in == null || ("".equals(in))) return ""; // vacancy test.
+
+        if (in == null || ("".equals(in))) {
+            return ""; // vacancy test.
+        }
         for (int i = 0; i < in.length(); i++) {
-            current = in.charAt(i); // NOTE: No IndexOutOfBoundsException caught here; it should not happen.
-            if ((current == 0x9) ||
-                (current == 0xA) ||
-                (current == 0xD) ||
-                ((current >= 0x20) && (current <= 0xD7FF)) ||
-                ((current >= 0xE000) && (current <= 0xFFFD)) ||
-                ((current >= 0x10000) && (current <= 0x10FFFF)))
+            current = in.charAt(i); // NOTE: No IndexOutOfBoundsException caught
+                                    // here; it should not happen.
+            if ((current == 0x9) || (current == 0xA) || (current == 0xD)
+                    || ((current >= 0x20) && (current <= 0xD7FF))
+                    || ((current >= 0xE000) && (current <= 0xFFFD))
+                    || ((current >= 0x10000) && (current <= 0x10FFFF))) {
                 out.append(current);
+            }
         }
         return out.toString();
     }
-    
+
     public static String stripShellEscapseSequence(String in) {
-       return in.replace("[?1034h", "");
+        return in.replace("[?1034h", "");
     }
 }
index 10e36f5..88db135 100644 (file)
@@ -85,7 +85,7 @@ public class CommandLauncher {
     }
     
     
-    public static boolean execute(String command, String workingDir, Map<String, String> newEnv, 
+    public static synchronized boolean execute(String command, String workingDir, Map<String, String> newEnv, 
                String consoleViewName, IProgressMonitor monitor ) throws InterruptedException {
        
        // start process
@@ -113,7 +113,9 @@ public class CommandLauncher {
                                e.printStackTrace();
                        }
                finally{
-                       if ( input != null ) tryClose( input );
+                       if ( input != null ) {
+                           tryClose( input );
+                       }
             }
        }
        
@@ -144,7 +146,7 @@ public class CommandLauncher {
                return createProcess(command, workingDir, null, includeStdErr);
     }
     
-    public static Process createProcess(String command, String workingDir,
+    public static synchronized Process createProcess(String command, String workingDir,
                Map<String, String> newEnv, boolean includeStdErr ) throws InterruptedException {
        // start process
         String[] fullCommand = HostUtil.getCommand(command);
@@ -198,7 +200,7 @@ public class CommandLauncher {
     }
     
 
-    public static String executeOutput(String command, String workingDir,
+    public static synchronized String executeOutput(String command, String workingDir,
                boolean includeStdErr, IProgressMonitor monitor) throws InterruptedException {
        
        // start process
@@ -237,7 +239,9 @@ public class CommandLauncher {
                throw new InterruptedException("Reading process standard output failed!");
                }
        finally{
-               if ( input != null ) tryClose( input );
+               if ( input != null ) {
+                   tryClose( input );
+               }
         }
         
         return contents.toString().trim();
@@ -245,7 +249,7 @@ public class CommandLauncher {
 
     
        // return generate script and return script path
-       private static String genSudoExecuteScript(String command) {
+       private static synchronized String genSudoExecuteScript(String command) {
                String passwd = SudoPasswdManager.getSudoPassword();
                File shellScript = null;
                
@@ -292,7 +296,7 @@ public class CommandLauncher {
                
        
        // return generate script and return script path
-       private static String genSudoKillProcessScript(Process process) {
+       private static synchronized String genSudoKillProcessScript(Process process) {
                String passwd = SudoPasswdManager.getSudoPassword();
                File shellScript = null;
 
@@ -361,7 +365,7 @@ public class CommandLauncher {
        }
        
        // generate interrupt script for platform debugging and return script path
-       public static String genDebugginInterruptScript(Process process) {
+       public static synchronized String genDebugginInterruptScript(Process process) {
                String passwd = SudoPasswdManager.getSudoPassword();
 
                try {
index 5377f4f..30caff3 100644 (file)
@@ -17,7 +17,7 @@ public class CommandLauncherOnDevice {
 
     private final static int MAX_TIMEOUT = 10000;
 
-    public static ICommandStatus execute(IDevice device, String command,
+    public static synchronized ICommandStatus execute(IDevice device, String command,
             PackageManagerOuputReceiver rec) {
         String[] prevLog = {};
         if (rec.getLog() != null) {
index 4ff7e40..2cac480 100644 (file)
@@ -83,7 +83,7 @@ public class CommandLauncherOnRootstrap {
         return execute(command, workingDir, null, rec, monitor);
     }
 
-    public static ICommandStatus execute(String command, String workingDir,
+    public static synchronized ICommandStatus execute(String command, String workingDir,
             Map<String, String> newEnv, String consoleViewName, IProgressMonitor monitor) {
 
         CommandStatus status = null;
@@ -116,8 +116,9 @@ public class CommandLauncherOnRootstrap {
                     e.printStackTrace();
                     status = new CommandStatus(IStatus.ERROR, command, e.getMessage(), log, e);
                 } finally {
-                    if (input != null)
+                    if (input != null) {
                         tryClose(input);
+                    }
                 }
             }
 
@@ -143,7 +144,7 @@ public class CommandLauncherOnRootstrap {
         return status;
     }
 
-    public static ICommandStatus execute(String command, String workingDir,
+    public static synchronized ICommandStatus execute(String command, String workingDir,
             Map<String, String> newEnv, PackageManagerOuputReceiver rec, IProgressMonitor monitor) {
 
         CommandStatus status = null;
@@ -161,25 +162,21 @@ public class CommandLauncherOnRootstrap {
             }
 
             BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
-            /*
-             * ProgressMonitorInputStream progressIn = new
-             * ProgressMonitorInputStream( null, "Analysis",
-             * proc.getInputStream()); BufferedReader input = new
-             * BufferedReader(new InputStreamReader(progressIn));
-             */
             String line = null;
             try {
                 while ((line = input.readLine()) != null) {
                     log.add(line);
-                    if (rec != null && rec.getMsgConsoleStream() != null)
+                    if (rec != null && rec.getMsgConsoleStream() != null) {
                         rec.processNewLine(line);
+                    }
                 }
             } catch (IOException e) {
                 e.printStackTrace();
                 status = new CommandStatus(IStatus.ERROR, command, e.getMessage(), log, e);
             } finally {
-                if (input != null)
+                if (input != null) {
                     tryClose(input);
+                }
             }
 
             // wait for process finish
@@ -210,7 +207,7 @@ public class CommandLauncherOnRootstrap {
         return createProcess(command, workingDir, null, includeStdErr);
     }
 
-    public static Process createProcess(String command, String workingDir,
+    public static synchronized Process createProcess(String command, String workingDir,
             Map<String, String> newEnv, boolean includeStdErr) throws InterruptedException {
         // start process
         String[] fullCommand = HostUtil.getCommand(command);
@@ -236,7 +233,7 @@ public class CommandLauncherOnRootstrap {
     }
 
     // return generate script and return script path
-    private static String genSudoExecuteScript(String command) {
+    private static synchronized String genSudoExecuteScript(String command) {
         String passwd = SudoPasswdManager.getSudoPassword();
         File shellScript = null;
 
@@ -300,7 +297,7 @@ public class CommandLauncherOnRootstrap {
     }
 
     // return generate script and return script path
-    private static String genSudoKillProcessScript(Process process) {
+    private static synchronized String genSudoKillProcessScript(Process process) {
         String passwd = SudoPasswdManager.getSudoPassword();
         File shellScript = null;
 
@@ -25,7 +25,7 @@
  *
  */
 
-package org.tizen.nativeplatform.launch.wizards;
+package org.tizen.nativeplatform.util;
 
 import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
 import static org.tizen.sdblib.util.DeviceUtil.isOnline;
@@ -38,9 +38,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.eclipse.cdt.core.IProcessInfo;
-import org.eclipse.cdt.core.IProcessList;
-import org.eclipse.cdt.launch.internal.ui.LaunchImages;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
 import org.eclipse.cdt.managedbuilder.core.IManagedProject;
@@ -53,49 +50,39 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.window.Window;
 import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.TwoPaneElementSelector;
 import org.tizen.common.TizenPlatformConstants;
 import org.tizen.nativecommon.TizenNativeException;
 import org.tizen.nativecommon.launch.LaunchUtils;
-import org.tizen.nativecommon.launch.TizenDeviceProcessList;
 import org.tizen.nativecommon.launch.TizenLaunchCommand;
 import org.tizen.nativecommon.launch.TizenLaunchMessages;
 import org.tizen.nativeplatform.IPlatformXMLStore;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
-import org.tizen.nativeplatform.filefilter.RpmFileFilter;
 import org.tizen.nativeplatform.launch.PlatformLaunchMessages;
 import org.tizen.nativeplatform.pkg.commander.ICommandStatus;
 import org.tizen.nativeplatform.pkg.commander.IPkgCommander;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
+import org.tizen.nativeplatform.pkg.model.IPackage;
+import org.tizen.nativeplatform.pkg.model.PkgStatus;
 import org.tizen.nativeplatform.pkgmgr.PkgMgrInitializer;
-import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
-import org.tizen.nativeplatform.pkgmgr.model.Package;
 import org.tizen.nativeplatform.rootstrap.RootstrapManager;
-import org.tizen.nativeplatform.util.PlatformProjectUtil;
+import org.tizen.nativeplatform.types.CmdTargetTypes;
+import org.tizen.nativeplatform.types.PkgInstallTypes;
 import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.exception.SdbCommandRejectedException;
 import org.tizen.sdblib.exception.TimeoutException;
 import org.tizen.sdblib.service.SyncResult;
 import org.tizen.sdblib.util.DeviceUtil;
 
-@SuppressWarnings("restriction")
 public class PlatformLaunchUtils {
 
     private PkgCommandTarget target;
-    private IProcessInfo procInfo;
 
     public PlatformLaunchUtils(PkgCommandTarget target) {
         this.target = target;
     }
 
-    public boolean installPkgsToRootstrap(List<LocalPackage> packages, IProgressMonitor monitor)
+    public boolean installPkgsToRootstrap(List<IPackage> packages, IProgressMonitor monitor)
             throws InterruptedException {
         if (!target.getRootstrap().checkInitialized()) {
             newException(String.format(PlatformLaunchMessages.IS_NOT_INITIALIZED_ROOTSTRAP, target
@@ -104,11 +91,11 @@ public class PlatformLaunchUtils {
             PkgMgrInitializer initializer = new PkgMgrInitializer(target);
             initializer.initRootstrapRepoInfo();
         }
-        return installPkgs(target.getRootstrapCommander(), IPkgCommander.TOOL.ZYPPER, packages,
+        return installPkgs(target.getCommander(CmdTargetTypes.ROOTSTRAP), IPkgCommander.TOOL.ZYPPER, packages,
                 monitor);
     }
 
-    public boolean installPkgsToDevice(List<LocalPackage> packages, IProgressMonitor monitor)
+    public boolean installPkgsToDevice(List<IPackage> packages, IProgressMonitor monitor)
             throws InterruptedException {
         if (!isOnline(target.getDevice())) {
             newException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
@@ -118,11 +105,11 @@ public class PlatformLaunchUtils {
             PkgMgrInitializer initializer = new PkgMgrInitializer(target);
             initializer.initDeviceRepoInfo();
         }
-        return installPkgs(target.getDeviceCommander(), IPkgCommander.TOOL.ZYPPER, packages,
+        return installPkgs(target.getCommander(CmdTargetTypes.DEVICE), IPkgCommander.TOOL.ZYPPER, packages,
                 monitor);
     }
 
-    public boolean installPkgsToDevice(List<LocalPackage> packages, IPkgCommander.TOOL type,
+    public boolean installPkgsToDevice(List<IPackage> packages, IPkgCommander.TOOL type,
             IProgressMonitor monitor) throws InterruptedException {
         if (!DeviceUtil.isOnline(target.getDevice())) {
             newException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
@@ -132,16 +119,16 @@ public class PlatformLaunchUtils {
             PkgMgrInitializer initializer = new PkgMgrInitializer(target);
             initializer.initDeviceRepoInfo();
         }
-        return installPkgs(target.getDeviceCommander(), type, packages, monitor);
+        return installPkgs(target.getCommander(CmdTargetTypes.DEVICE), type, packages, monitor);
     }
 
     private boolean installPkgs(IPkgCommander commander, IPkgCommander.TOOL type,
-            List<LocalPackage> packages, IProgressMonitor monitor) throws InterruptedException {
+            List<IPackage> packages, IProgressMonitor monitor) throws InterruptedException {
         monitor.beginTask("Installing packages to rootstrap", 2);
 
         List<String> paths = new ArrayList<String>();
 
-        for (LocalPackage p : packages) {
+        for (IPackage p : packages) {
             String filePath = p.getPath();
             paths.add(filePath.trim());
         }
@@ -164,7 +151,7 @@ public class PlatformLaunchUtils {
 
         monitor.subTask("Checking installed successfully..");
         String failedInstallPkgs = "";
-        for (LocalPackage p : packages) {
+        for (IPackage p : packages) {
             String name = p.getName();
             if (!commander.checkPkgInstalled(name)) {
                 failedInstallPkgs = failedInstallPkgs + "   - " + name + newline();
@@ -218,201 +205,16 @@ public class PlatformLaunchUtils {
         return result;
     }
 
-    public List<LocalPackage> getProjectPackages(IProject project, String configName) {
-        List<LocalPackage> pkgs = new ArrayList<LocalPackage>();
-        IFolder folder = project.getFolder(configName);
-        File dir = new File(folder.getLocation().toOSString());
-        if (dir.exists()) {
-            // get ".rpm" file list
-            String[] files = dir.list(new RpmFileFilter());
-            for (String file : files) {
-                IPath pkgPath = new Path(dir.getPath()).append(file);
-                LocalPackage pkg = getLocalPackage(pkgPath.toOSString());
-                pkgs.add(pkg);
+    public List<IPackage> getSelectedPackages(List<PkgStatus> pkgStatus) {
+        List<IPackage> selectedPkgs = new ArrayList<IPackage>();
+        for (PkgStatus status : pkgStatus) {
+            if (status.isChecked()) {
+                selectedPkgs.add(status.getPackage());
             }
         }
-
-        return pkgs;
-    }
-
-    public LocalPackage getLocalPackage(String pkgfilePath) {
-        LocalPackage pkg = new LocalPackage();
-        pkg.setPath(pkgfilePath);
-        String name = target.getHostCommander().getNameFromFile(pkg.getPath());
-        pkg.setName(name);
-        return pkg;
-    }
-
-    public List<LocalPackage> getLocalPackages(List<String> pkgPaths) {
-        List<LocalPackage> pkgs = new ArrayList<LocalPackage>();
-        for (String path : pkgPaths) {
-            LocalPackage pkg = getLocalPackage(path);
-            pkgs.add(pkg);
-        }
-
-        return pkgs;
-    }
-
-    public void filterBuildsystemPkgs(List<LocalPackage> totalPackages,
-            List<LocalPackage> buildsystePkgs, boolean reinstallOp) {
-
-        for (LocalPackage pkg : totalPackages) {
-            buildsystePkgs.add(pkg.clone());
-        }
-        updatePkgs(target.getRootstrapCommander(), buildsystePkgs, reinstallOp);
-    }
-
-    public void filterDevicePackages(List<LocalPackage> totalPackages,
-            List<LocalPackage> devicePkgs, boolean reinstallOp) {
-
-        for (LocalPackage pkg : totalPackages) {
-            String name = pkg.getName();
-            if (name.contains("-debugsource") || name.contains("-debuginfo")
-                    || name.contains("-devel")) {
-                continue;
-            } else {
-                devicePkgs.add(pkg.clone());
-            }
-        }
-        updatePkgs(target.getDeviceCommander(), devicePkgs, reinstallOp);
-    }
-
-    private void updatePkgs(IPkgCommander commander, List<LocalPackage> pkgs, boolean reinstallOp) {
-        for (LocalPackage pkg : pkgs) {
-            String newVer = commander.getVerFromFile(pkg.getPath());
-            String arch = commander.getArchFromFile(pkg.getPath());
-            String[] installedVer = commander.getVer(pkg.getName());
-
-            pkg.setCheckColumn(true);
-            pkg.setNewVersion(newVer);
-            pkg.setArch(arch);
-            if (installedVer.length > 0) {
-                pkg.setInstalledVersion(installedVer[0]);
-            } else {
-                continue;
-            }
-            if ("".equals(newVer)) {
-                pkg.setCheckColumn(false);
-            } else if (!"".equals(installedVer)) {
-                if (!installedVer[0].equals(newVer)) {
-                    pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
-                } else {
-                    if (commander.checkPkgInstalled(pkg.getName())) {
-                        pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
-                        if (!reinstallOp) {
-                            pkg.setCheckColumn(false);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    public List<LocalPackage> getSelectedPackages(List<LocalPackage> pkgs) {
-        List<LocalPackage> selectedPkgs = new ArrayList<LocalPackage>();
-        for (LocalPackage pkg : pkgs) {
-            if (pkg.getCheckColumn()) {
-                selectedPkgs.add(pkg);
-            }
-        }
-
         return selectedPkgs;
     }
 
-    public IProcessInfo getProcess(final Shell shell, final IDevice device) {
-        Display.getDefault().syncExec(new Runnable() {
-            public void run() {
-                procInfo = selectProcess(shell, device, null);
-            }
-        });
-
-        return procInfo;
-    }
-
-    public IProcessInfo getProcess(final Shell shell, final IDevice device, final String procName) {
-        Display.getDefault().syncExec(new Runnable() {
-            public void run() {
-                procInfo = selectProcess(shell, device, procName);
-            }
-        });
-
-        return procInfo;
-    }
-
-    private IProcessInfo selectProcess(Shell shell, IDevice device, String procName) {
-        if (shell == null) {
-            return null;
-        }
-
-        IProcessList processList = null;
-        processList = new TizenDeviceProcessList(device);
-
-        IProcessInfo pInfos[] = null;
-        IProcessInfo resultInfo = null;
-        pInfos = processList.getProcessList();
-
-        if (pInfos == null) {
-            return null;
-        }
-
-        int count = 0;
-        if (procName != null) {
-            for (IProcessInfo info : pInfos) {
-                String name = new Path(info.getName()).lastSegment().trim();
-                if (procName.equals(name)) {
-                    resultInfo = info;
-                    count++;
-                }
-            }
-        }
-
-        if (count == 1) {
-            return resultInfo;
-        }
-
-        ILabelProvider topprovider = new LabelProvider() {
-            public String getText(Object element) {
-                IProcessInfo pinfo = (IProcessInfo) element;
-                IPath ppath = new Path(pinfo.getName());
-                return ppath.lastSegment().trim() + " [" + String.valueOf(pinfo.getPid()) + "]"; //$NON-NLS-1$
-            }
-
-            public Image getImage(Object element) {
-                return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
-            }
-        };
-
-        ILabelProvider downprovider = new LabelProvider() {
-            public String getText(Object element) {
-                IProcessInfo info = (IProcessInfo) element;
-                return info.getName();
-            }
-
-            public Image getImage(Object element) {
-                return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
-            }
-        };
-
-        TwoPaneElementSelector dlg = new TwoPaneElementSelector(shell, topprovider, downprovider);
-        dlg.setTitle(String.format("Select Process [%s]", device.getDeviceName())); //$NON-NLS-1$
-        String dlgMsg = "";
-        if (procName != null && count == 0) {
-            dlgMsg = String.format("There is no \"%s\" process.\n", procName);
-        } else if (procName != null && count > 1) {
-            dlgMsg = String.format("There are some \"%s\" processes.\n", procName);
-        }
-        dlgMsg = dlgMsg + "Select a Process to attach debugger to:";
-        dlg.setMessage(dlgMsg); //$NON-NLS-1$
-        dlg.setElements(pInfos);
-
-        if (dlg.open() == Window.OK) {
-            resultInfo = (IProcessInfo) dlg.getFirstResult();
-            return resultInfo;
-        }
-
-        return null;
-    }
-
     public String[] getProjectInfo(IProject project) {
         String[] infos = new String[2];
         String name = null;
@@ -542,4 +344,13 @@ public class PlatformLaunchUtils {
             return null;
         }
     }
+    
+    public void applyReinstallOp(List<PkgStatus> list, boolean reinstallOp) {
+        for (PkgStatus status : list) {
+            if (status.getInstallInfo().equals(PkgInstallTypes.INSTALLED) &&
+                    !reinstallOp) {
+                status.setChecked(false);
+            }
+        }
+    }
 }
index 79dc18d..43e09e6 100644 (file)
@@ -1,56 +1,64 @@
 package org.tizen.nativeplatform.util;
 
 import org.eclipse.core.resources.IProject;
-import org.tizen.nativecommon.ProjectUtil;
 import org.tizen.nativeplatform.IPlatformProject;
 import org.tizen.nativeplatform.IPlatformXMLStore;
 import org.tizen.nativeplatform.manifest.PlatformManifestXMLStore;
+import org.tizen.nativeplatform.types.PkgTypes;
 
 public class PlatformProjectUtil {
     /**
      * Returns {@link IPlatformProject} object for the project.
-     * @param project 
+     * 
+     * @param project
      * @return {@link IPlatformProject}
      */
     public static IPlatformProject getTizenPlatformProject(IProject project, Class adapter) {
-        if (project == null)
+        if (project == null) {
             throw new IllegalArgumentException("Project can not be null");
+        }
         Object obj = project.getAdapter(adapter);
-        if (obj == null || !(obj instanceof IPlatformProject))
-            throw new IllegalArgumentException("Project can not be adapted (obj - " + obj + ", adapter - " + adapter + ")");
+        if (obj == null || !(obj instanceof IPlatformProject)) {
+            throw new IllegalArgumentException("Project can not be adapted (obj - " + obj
+                    + ", adapter - " + adapter + ")");
+        }
         return (IPlatformProject) obj;
     }
-    
-    
+
     /**
      * Checks whether project is for Tizen platform or not.
-     * @param project 
+     * 
+     * @param project
      * @return {@code true} if it is Tizen platform project
      */
     public static boolean isTizenPlatformProject(IProject project) {
         IPlatformProject adapter = getTizenPlatformProject(project, IPlatformProject.class);
-        return (adapter.getTizenProjectType() == null) ? false : adapter.getTizenProjectType().isPlatformProject();
+        return (adapter.getTizenProjectType() == null) ? false : adapter.getTizenProjectType()
+                .isPlatformProject();
     }
-    
+
     public static boolean isEFLApplication(IProject project) {
-       if (isTizenPlatformProject(project)) {
-               IPlatformProject adapter = getTizenPlatformProject(project, IPlatformProject.class);
-               return (adapter.getTizenProjectType() == null) ? false : adapter.isEFLApplication();
-       }
-       
-       return false;
+        if (isTizenPlatformProject(project)) {
+            IPlatformProject adapter = getTizenPlatformProject(project, IPlatformProject.class);
+            return (adapter.getTizenProjectType() == null) ? false : adapter.isEFLApplication();
+        }
+        return false;
     }
-    
-    
+
     /**
-     * Returns <code>IPlatformXMLStore</code>. This is to get the manifest store in case of Tizen platform project.
+     * Returns <code>IPlatformXMLStore</code>. This is to get the manifest store
+     * in case of Tizen platform project.
      * 
      * @param project
      * @return IPlatformXMLStore
      */
     public static IPlatformXMLStore getManifestXmlStore(IProject project) {
-       PlatformManifestXMLStore store = new PlatformManifestXMLStore();
-       store.setProject(project);
-       return store;        
+        PlatformManifestXMLStore store = new PlatformManifestXMLStore();
+        store.setProject(project);
+        return store;
+    }
+
+    public static PkgTypes getPkgType() {
+        return PkgTypes.RPM;
     }
 }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/ProcessSelector.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/ProcessSelector.java
new file mode 100644 (file)
index 0000000..6113a49
--- /dev/null
@@ -0,0 +1,119 @@
+package org.tizen.nativeplatform.util;
+
+import org.eclipse.cdt.core.IProcessInfo;
+import org.eclipse.cdt.core.IProcessList;
+import org.eclipse.cdt.launch.internal.ui.LaunchImages;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.TwoPaneElementSelector;
+import org.tizen.nativecommon.launch.TizenDeviceProcessList;
+import org.tizen.sdblib.IDevice;
+
+public class ProcessSelector {
+    private IDevice device;
+    private IProcessInfo procInfo;
+
+    public ProcessSelector(IDevice device) {
+        this.device = device;
+    }
+
+    public IProcessInfo getProcess(final Shell shell) {
+        Display.getDefault().syncExec(new Runnable() {
+            public void run() {
+                procInfo = selectProcess(shell, null);
+            }
+        });
+        return procInfo;
+    }
+
+    public IProcessInfo getProcess(final Shell shell, final String procName) {
+        Display.getDefault().syncExec(new Runnable() {
+            public void run() {
+                procInfo = selectProcess(shell, procName);
+            }
+        });
+        return procInfo;
+    }
+
+    private IProcessInfo selectProcess(final Shell shell, final String procName) {
+        if (shell == null) {
+            return null;
+        }
+
+        IProcessList processList = null;
+        processList = new TizenDeviceProcessList(device);
+
+        IProcessInfo pInfos[] = null;
+        IProcessInfo resultInfo = null;
+        pInfos = processList.getProcessList();
+
+        if (pInfos == null) {
+            return null;
+        }
+
+        int count = 0;
+        if (procName != null) {
+            for (IProcessInfo info : pInfos) {
+                String name = new Path(info.getName()).lastSegment().trim();
+                if (procName.equals(name)) {
+                    resultInfo = info;
+                    count++;
+                }
+            }
+        }
+
+        if (count == 1) {
+            return resultInfo;
+        }
+
+        ILabelProvider topprovider = new LabelProvider() {
+            public String getText(Object element) {
+                IProcessInfo pinfo = (IProcessInfo) element;
+                IPath ppath = new Path(pinfo.getName());
+                return ppath.lastSegment().trim() + " [" + String.valueOf(pinfo.getPid()) + "]"; //$NON-NLS-1$
+            }
+
+            @SuppressWarnings("restriction")
+            public Image getImage(Object element) {
+                return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
+            }
+        };
+
+        ILabelProvider downprovider = new LabelProvider() {
+            public String getText(Object element) {
+                IProcessInfo info = (IProcessInfo) element;
+                return info.getName();
+            }
+
+            @SuppressWarnings("restriction")
+            public Image getImage(Object element) {
+                return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
+            }
+        };
+
+        TwoPaneElementSelector dlg = new TwoPaneElementSelector(shell, topprovider, downprovider);
+        dlg.setTitle(String.format("Select Process [%s]", device.getDeviceName())); //$NON-NLS-1$
+        String dlgMsg = "";
+        if (procName != null && count == 0) {
+            dlgMsg = String.format("There is no \"%s\" process.\n", procName);
+        } else if (procName != null && count > 1) {
+            dlgMsg = String.format("There are some \"%s\" processes.\n", procName);
+        }
+        dlgMsg = dlgMsg + "Select a Process to attach debugger to:";
+        dlg.setMessage(dlgMsg); //$NON-NLS-1$
+        dlg.setElements(pInfos);
+
+        if (dlg.open() == Window.OK) {
+            resultInfo = (IProcessInfo) dlg.getFirstResult();
+            return resultInfo;
+        }
+        return null;
+    }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/RootstrapUtil.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/RootstrapUtil.java
new file mode 100644 (file)
index 0000000..234cddc
--- /dev/null
@@ -0,0 +1,75 @@
+package org.tizen.nativeplatform.util;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.tizen.common.core.application.InstallPathConfig;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+
+public class RootstrapUtil {
+
+    private static final String USER_ROOSTRAP_BASE_DIR_NAME = "user-rootstraps";
+
+    public static String makeTempDirectory() {
+        final File temp;
+
+        try {
+            temp = File.createTempFile("temp", Long.toString(System.nanoTime()));
+            if (!(temp.delete())) {
+                throw new IOException("Could not delete temp file: " + temp.getAbsolutePath());
+            }
+
+            if (!(temp.mkdir())) {
+                throw new IOException("Could not create temp directory: " + temp.getAbsolutePath());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+
+        return temp.getPath();
+    }
+    
+    public static String getBaseArchitecture(String arch) {
+        if (arch.contains("arm")) {
+            return "arm";
+        } else {
+            return "i386";
+        }
+    }
+    
+    public static String getUserRootstrapPath(String id) {
+        return new Path(getBaseUserRootstrapPath()).append(id).toOSString();
+    }
+    
+    public static String getBaseUserRootstrapPath() {
+        return new Path(InstallPathConfig.getUserDataPath()).append(USER_ROOSTRAP_BASE_DIR_NAME)
+                .toOSString();
+    }
+    
+    public static String getUserRootstrapPathOfXml(String id) {
+        String rootstrapPath = getUserRootstrapPath(id);
+
+        return getRootstrapPathOfXml(rootstrapPath);
+    }
+    
+    public static String getRootstrapPathOfXml(String path) {
+        if (InstallerUtil.isSupportedMultipleSDK()) {
+            return path.replaceAll(String.format("%s/", InstallPathConfig.getSDKPath()),
+                    "#{SDK_INSTALLED_PATH}/").replaceAll(
+                    String.format("%s/", InstallPathConfig.getUserDataPath()), "#{SDK_DATA_PATH}/");
+        } else {
+            return path.replaceAll(String.format("%s/", InstallPathConfig.getSDKPath()),
+                    "#{SBI_HOME}/../../").replaceAll(
+                    String.format("%s/", InstallPathConfig.getUserDataPath()),
+                    "#{HOME}/tizen-sdk-data/");
+        }
+    }
+    
+    public static String getPluginXML(String id) {
+        IPath pluginPath = new Path(SmartBuildInterface.getInstance().getPluginPath());
+        return pluginPath.append(id + ".xml").toOSString();
+    }
+}
index 6dcf438..2c56d5b 100644 (file)
@@ -35,8 +35,8 @@ import java.util.Iterator;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.tizen.nativecommon.build.model.Rootstrap;
-import org.tizen.nativeplatform.repository.LocalRepoMounter;
-import org.tizen.nativeplatform.repository.RepoManager;
+import org.tizen.nativeplatform.repo.commander.LocalRepoMounter;
+import org.tizen.nativeplatform.repo.commander.RepoManager;
 
 public class PlatformRootstrap extends Rootstrap implements ICheckTreeItem {
     private String http_proxy;
@@ -47,6 +47,7 @@ public class PlatformRootstrap extends Rootstrap implements ICheckTreeItem {
     private IPath confFile = null;
     public static final String PROPERTY_REPO_URLS = "REPOSITORY_URLS";
     public static final String PROPERTY_CONFIGURATION_FILE = "CONFIGURATION_FILE";
+    public static final String PROPERTY_DEFAULT = "DEFAULT";
 
     public static final String SUPPORTED_TOOLCHAIN_TYPE = "tizen.platform";
     private static final String VERSION = "1.0";
index 394799c..cef9474 100644 (file)
@@ -53,7 +53,7 @@ import org.eclipse.swt.widgets.TabFolder;
 import org.eclipse.swt.widgets.TabItem;
 import org.eclipse.swt.widgets.Text;
 import org.tizen.common.util.DialogUtil;
-import org.tizen.nativeplatform.repository.RepoManager;
+import org.tizen.nativeplatform.repo.commander.RepoManager;
 
 public class LocalRepoTab implements IRepositoryTab {
 
index a227efb..0235afb 100644 (file)
@@ -91,6 +91,7 @@ Action.Msg.Progress.Refresh.rootstrap = Refreshing rootstrap...
 Action.Msg.Error.Failed.Umount = Failed to unmount local repository from rootstrap!
 Action.Msg.Progress.Removing = Removing rootstrap...
 Action.Msg.Error.RemoveFailed = Removing rootstrap failed!
+Action.Msg.Error.DefaultRootstrap.Not.Existed = There is no default rootstrap.
 
 FileDlg.Title.Export = Export rootstrap
 FileDlg.Title.Import = Import rootstrap
\ No newline at end of file
index b197bd3..cc2f561 100644 (file)
@@ -100,10 +100,12 @@ import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.pkg.commander.PkgCommandTarget;
 import org.tizen.nativeplatform.pkgmgr.PkgMgrInitializer;
 import org.tizen.nativeplatform.pkgmgr.ui.RPMPackageDialog;
-import org.tizen.nativeplatform.repository.LocalRepoMounter;
-import org.tizen.nativeplatform.repository.RepoManager;
+import org.tizen.nativeplatform.repo.commander.LocalRepoMounter;
+import org.tizen.nativeplatform.repo.commander.RepoManager;
 import org.tizen.nativeplatform.rootstrap.IRootstrapChangedListener;
+import org.tizen.nativeplatform.rootstrap.BaseFileSystemGenerator;
 import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.util.PlatformProjectUtil;
 import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 import org.tizen.sdblib.IDevice;
 
@@ -133,7 +135,7 @@ public class RootstrapView extends ViewPart {
     private final String BUNDLE_NAME = AddRootstrapDialog.class.getPackage().getName()
             + ".RootstrapUIMessages";//$NON-NLS-1$
     private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
-    
+
     protected final Logger logger = LoggerFactory.getLogger(RootstrapView.class);
 
     private IRootstrapChangedListener cListener = new IRootstrapChangedListener() {
@@ -347,13 +349,13 @@ public class RootstrapView extends ViewPart {
         column.setResizable(true);
         column.setText(resources.getString("View.Table.Column.Rootstrap"));
         column.setWidth(240);
-        column.addSelectionListener(new TooltableSelectionAdapter());
+        column.addSelectionListener(new RootstraptableSelectionAdapter());
 
         column = new TableColumn(table, SWT.NONE);
         column.setResizable(true);
         column.setText(resources.getString("View.Table.Column.Arch"));
         column.setWidth(50);
-        column.addSelectionListener(new TooltableSelectionAdapter());
+        column.addSelectionListener(new RootstraptableSelectionAdapter());
 
         tableViewer.setLabelProvider(new TableViewerProvider());
         tableViewer.setContentProvider(new ArrayContentProvider());
@@ -718,22 +720,24 @@ public class RootstrapView extends ViewPart {
                                 monitor.beginTask(
                                         resources.getString("GenRootDlg.Progress.Msg.Generating"),
                                         -1);
-                                if (!RootstrapManager.generateBaseFileSystem(selected.getPath()
-                                        .toString(), selected.getArch(),
-                                        selected.getJustRepoURLs(), selected.getConfFile(), monitor)) {
+                                if (!BaseFileSystemGenerator.generate(selected.getPath().toString(),
+                                        selected.getArch(), selected.getJustRepoURLs(),
+                                        selected.getConfFile(), monitor)) {
                                     throw new InterruptedException(
                                             "Generating base file system failed!");
                                 }
                             }
                         });
                     } catch (InvocationTargetException e) {
-                        logger.error(resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"), e);
+                        logger.error(resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
+                                e);
                         DialogUtil.openErrorDialog(String.format("%s\n * %s",
                                 resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
                                 e.getMessage()));
                         return;
                     } catch (InterruptedException e) {
-                        logger.error(resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"), e);
+                        logger.error(resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
+                                e);
                         DialogUtil.openErrorDialog(String.format("%s\n * %s",
                                 resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
                                 e.getMessage()));
@@ -744,7 +748,8 @@ public class RootstrapView extends ViewPart {
 
                 // launch package manager
                 IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
-                final PkgCommandTarget cmdTarget = new PkgCommandTarget(device, selected);
+                final PkgCommandTarget cmdTarget = new PkgCommandTarget(
+                        PlatformProjectUtil.getPkgType(), device, selected);
                 final RPMPackageDialog dlg = new RPMPackageDialog(shell, cmdTarget);
                 ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
                 try {
@@ -808,9 +813,6 @@ public class RootstrapView extends ViewPart {
                             resources.getString("Action.Msg.Error.FiniFailed.PkgMgr"),
                             e.getMessage()));
                     return;
-                } finally {
-                    //RootstrapManager.modifyRootstrap(selected);
-                    
                 }
             }
 
@@ -858,6 +860,13 @@ public class RootstrapView extends ViewPart {
                 // default rootstrap cannot be removed!
                 PlatformRootstrap defaultRootstrap = RootstrapManager.getDefaultRootstrap(selected
                         .getArch());
+                if (defaultRootstrap == null) {
+                    String msg = String.format("%s %s",
+                            resources.getString("Action.Msg.Error.RemoveDefault"),
+                            resources.getString("Action.Msg.Error.DefaultRootstrap.Not.Existed"));
+                    DialogUtil.openErrorDialog(msg);
+                    return;
+                }
                 if (defaultRootstrap.getId().equals(selected.getId())) {
                     DialogUtil.openErrorDialog(resources
                             .getString("Action.Msg.Error.RemoveDefault"));
@@ -868,18 +877,21 @@ public class RootstrapView extends ViewPart {
                 IProject[] projs = works.getRoot().getProjects();
                 for (IProject proj : projs) {
                     IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(proj);
-                    if (info == null)
+                    if (info == null) {
                         continue;
+                    }
                     IConfiguration config = info.getDefaultConfiguration();
-                    if (config == null)
+                    if (config == null) {
                         continue;
+                    }
                     IManagedProject managedProject = config.getManagedProject();
                     String projectArtifactType = managedProject.getProjectType() != null ? managedProject
                             .getProjectType().getBuildArtefactType().getId()
                             : null;
                     if (managedProject == null
-                            || projectArtifactType != PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE)
+                            || projectArtifactType != PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE) {
                         continue;
+                    }
 
                     setActiveRootstrap(proj, defaultRootstrap);
                 }
@@ -887,15 +899,15 @@ public class RootstrapView extends ViewPart {
                 // umount repository
                 final List<IPath> failedPaths = LocalRepoMounter.umountLocalRepository(selected,
                         null);
-             // generate rootstrap here
+                // generate rootstrap here
                 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("Action.Msg.Progress.Removing"), -1);
+                        public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                InterruptedException {
+                            monitor.beginTask(resources.getString("Action.Msg.Progress.Removing"),
+                                    -1);
                             if (failedPaths.size() == 0) {
                                 // remove
                                 RootstrapManager.removeRootstrap(selected.getId());
@@ -907,14 +919,12 @@ public class RootstrapView extends ViewPart {
                 } catch (InvocationTargetException e) {
                     logger.error(resources.getString("Action.Msg.Error.RemoveFailed"), e);
                     DialogUtil.openErrorDialog(String.format("%s\n * %s",
-                            resources.getString("Action.Msg.Error.RemoveFailed"),
-                            e.getMessage()));
+                            resources.getString("Action.Msg.Error.RemoveFailed"), e.getMessage()));
                     return;
                 } catch (InterruptedException e) {
                     logger.error(resources.getString("Action.Msg.Error.RemoveFailed"), e);
                     DialogUtil.openErrorDialog(String.format("%s\n * %s",
-                            resources.getString("Action.Msg.Error.RemoveFailed"),
-                            e.getMessage()));
+                            resources.getString("Action.Msg.Error.RemoveFailed"), e.getMessage()));
                     return;
                 }
             }
@@ -1008,7 +1018,7 @@ public class RootstrapView extends ViewPart {
         void doAction();
     }
 
-    private class TooltableSelectionAdapter extends SelectionAdapter {
+    private class RootstraptableSelectionAdapter extends SelectionAdapter {
         public void widgetSelected(SelectionEvent e) {
 
             final int column = tableViewer.getTable().indexOf((TableColumn) e.widget);
index 5e4d560..9d3e6ce 100644 (file)
@@ -50,8 +50,9 @@ public class PlatformMainWizardPage extends CDTMainWizardPage {
                 EntryDescriptor e = (EntryDescriptor) item;
 
                 // remove default empty project
-                if (e.getName() != null && e.getName().equals("Empty Project"))
+                if (e.getName() != null && e.getName().equals("Empty Project")) {
                     continue;
+                }
 
                 if (e.getId().equals("org.tizen.nativeide.buildArtefactType.platform")
                         || (e.getParentId() != null && e.getParentId().equals(
index 85d9c06..bac1a22 100644 (file)
@@ -56,10 +56,11 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.PlatformUI;
 import org.mihalis.opal.preferenceWindow.PWTab;
 import org.mihalis.opal.preferenceWindow.PreferenceWindow;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.tizen.common.TizenHelpContextIds;
 import org.tizen.common.util.ImageUtil;
 import org.tizen.common.util.SWTUtil;
-import org.tizen.common.util.log.Logger;
 import org.tizen.nativeappcommon.Activator;
 import org.tizen.nativeappcommon.templateengine.TizenTemplateProcessParser;
 import org.tizen.nativeappcommon.wizards.TemplateTizenNewWizard;
@@ -70,6 +71,7 @@ import org.tizen.nativeappcommon.wizards.model.TizenNativeTreeGroupModel;
 import org.tizen.nativeappcommon.wizards.model.TizenNativeTreeRootModel;
 import org.tizen.nativecommon.templateengine.TizenTemplateEngine;
 import org.tizen.nativeplatform.git.GitDescManager;
+import org.tizen.nativeplatform.views.ui.RootstrapView;
 import org.tizen.nativeplatform.wizards.model.TizenPlatformTemplateModel;
 import org.tizen.nativeplatform.wizards.ui.TizenPlatformPWComposite;
 
@@ -77,72 +79,82 @@ import org.w3c.dom.Element;
 
 @SuppressWarnings("unchecked")
 public class TizenPlatformMainWizardPage extends TizenMainWizardPage {
-       
-       protected final String[] TAB_NAMES = {Messages.TizenMainWizardPage_Category_App};
-    protected final String[] TAB_ICON = {"icons/wizard/App_template.png", "icons/wizard/Uncategorized.png"};
 
-    public static final String NAME_PATTERN = "^[a-zA-Z]+[a-zA-Z0-9]{" + (WizardConstants.NAME_MIN_LENGTH -1 ) + "," + (WizardConstants.NAME_MAX_LENGTH-1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    private boolean pageError = false;    
-    
+    protected final String[] TAB_NAMES = { Messages.TizenMainWizardPage_Category_App };
+    protected final String[] TAB_ICON = { "icons/wizard/App_template.png",
+            "icons/wizard/Uncategorized.png" };
+
+    public static final String NAME_PATTERN = "^[a-zA-Z]+[a-zA-Z0-9]{" + (WizardConstants.NAME_MIN_LENGTH - 1) + "," + (WizardConstants.NAME_MAX_LENGTH - 1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    private boolean pageError = false;
+
+    protected final Logger logger = LoggerFactory.getLogger(TizenPlatformMainWizardPage.class);
+
     public TizenPlatformMainWizardPage() {
         super("");
     }
-    
+
     public TizenPlatformMainWizardPage(String pageName) {
         super(pageName);
     }
 
-       @Override
+    @Override
     public void createControl(Composite parent) {
         setMinimumSize(parent);
         mainComposite = new Composite(parent, SWT.NONE);
         this.setControl(mainComposite);
         mainComposite.setLayout(new GridLayout());
         mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-        
+
         toolchainComposite = new Composite(mainComposite, SWT.None);
         SWTUtil.setGridLayoutData(toolchainComposite, 0, 0, -1, -1, SWT.NONE);
-        
+
         List<EntryDescriptor> eds = updateData(toolchainComposite, this, getWizard());
         List<TizenNativeTreeRootModel> modelRoots = createModelRoot(eds);
-        
+
         PreferenceWindow window = PreferenceWindow.create(new HashMap<String, Object>());
-        
-        for (TizenNativeTreeRootModel root: modelRoots) {
+
+        for (TizenNativeTreeRootModel root : modelRoots) {
             String name = root.getName();
-            
+
             String iconPath = root.getIconPath();
             Image tabImage = null;
-            if(iconPath != null) {
+            if (iconPath != null) {
                 tabImage = ImageUtil.getImage(Activator.PLUGIN_ID, root.getIconPath());
             }
             PWTab documentTab = window.addTab(tabImage, name);
             TizenPlatformPWComposite pwComposite = new TizenPlatformPWComposite(name, root, this);
             documentTab.add(pwComposite);
         }
-        
-        window.buildTabs(mainComposite, new Color(SWTUtil.getDisplay(), this.selectedTabColor[0], this.selectedTabColor[1], this.selectedTabColor[2]));
-        
+
+        window.buildTabs(mainComposite, new Color(SWTUtil.getDisplay(), this.selectedTabColor[0],
+                this.selectedTabColor[1], this.selectedTabColor[2]));
+
         this.newProjectChecker.createGroupComposite(mainComposite);
-        
+
         setPageComplete(validatePage());
         setErrorMessage(null);
         setMessage(null);
-        
-        PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, TizenHelpContextIds.HELP_NATIVE_PROJECT_WIZARD_CONTEXT);
+
+        PlatformUI.getWorkbench().getHelpSystem()
+                .setHelp(parent, TizenHelpContextIds.HELP_NATIVE_PROJECT_WIZARD_CONTEXT);
     }
-    
+
     @Override
-    protected List<EntryDescriptor> updateData(Composite right,  IWizardItemsListListener ls, IWizard wizard) {
-        
-        IExtensionPoint extensionPoint =
-                Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID);
-        if (extensionPoint == null) return null;
+    protected List<EntryDescriptor> updateData(Composite right, IWizardItemsListListener ls,
+            IWizard wizard) {
+
+        IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
+                EXTENSION_POINT_ID);
+        if (extensionPoint == null) {
+            return null;
+        }
         IExtension[] extensions = extensionPoint.getExtensions();
-        if (extensions == null) return null;
-        
+        if (extensions == null) {
+            return null;
+        }
+
         List<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
-        for (int i = 0; i < extensions.length; ++i)    {
+        for (int i = 0; i < extensions.length; ++i) {
             IConfigurationElement[] elements = extensions[i].getConfigurationElements();
             for (IConfigurationElement element : elements) {
                 if (element.getName().equals(ELEMENT_NAME)) {
@@ -150,42 +162,43 @@ public class TizenPlatformMainWizardPage extends TizenMainWizardPage {
                     try {
                         w = (CNewWizard) element.createExecutableExtension(CLASS_NAME);
                     } catch (CoreException e) {
-                        Logger.error(Messages.EXCEPTION_WHILE_PROJECT_CREATION_2, e);
+                        logger.error(Messages.EXCEPTION_WHILE_PROJECT_CREATION_2, e);
                     }
-                    if (w == null) return null;
-                    
-                    if(w instanceof ManagedBuildWizard) {
+                    if (w == null) {
+                        return null;
+                    }
+
+                    if (w instanceof ManagedBuildWizard) {
                         w.setDependentControl(right, ls);
-                        for (EntryDescriptor ed : w.createItems(true, wizard))
+                        for (EntryDescriptor ed : w.createItems(true, wizard)) {
                             items.add(ed);
-                    }
-                    else if(w instanceof TemplateTizenPlatformNewWizard) {
+                        }
+                    } else if (w instanceof TemplateTizenPlatformNewWizard) {
                         w.setDependentControl(right, ls);
-                        EntryDescriptor[] eds = ((TemplateTizenPlatformNewWizard)(w)).createItems(true, wizard);
-                        
-                        
-                        for (EntryDescriptor ed : eds)
+                        EntryDescriptor[] eds = ((TemplateTizenPlatformNewWizard) (w)).createItems(
+                                true, wizard);
+                        for (EntryDescriptor ed : eds) {
                             items.add(ed);
+                        }
                     }
                 }
             }
         }
-        
-        //remove empty templates
-        for (int i = 0; i < items.size(); ++i)
-        {
+
+        // remove empty templates
+        for (int i = 0; i < items.size(); ++i) {
             EntryDescriptor ed = items.get(i);
-            if (ed.isDefaultForCategory())
-            {
+            if (ed.isDefaultForCategory()) {
                 items.remove(i);
                 i--;
             }
         }
-        
+
         // bug # 211935 : allow items filtering.
-        if (ls != null) // NULL means call from prefs
+        if (ls != null) {
+            // NULL means call from prefs
             items = ls.filterItems(items);
-        
+        }
         return items;
     }
 
@@ -193,125 +206,134 @@ public class TizenPlatformMainWizardPage extends TizenMainWizardPage {
     protected IPath getTemplatePath() {
         return TemplateTizenPlatformNewWizard.templatePath;
     }
-    
+
     @Override
     protected List<TizenNativeTreeRootModel> createModelRoot(List<EntryDescriptor> eds) {
-        
+
         List<TizenNativeTreeRootModel> rootModels = new ArrayList<TizenNativeTreeRootModel>();
         Hashtable<String, String> testedEntryDescriptors = new Hashtable<String, String>();
-        
-        for(int i=0; i<TAB_NAMES.length; i++) {
-            rootModels.add(new TizenNativeTreeRootModel(TAB_NAMES[i], new ArrayList<TizenNativeTreeGroupModel>(), TAB_ICON[i]));
+
+        for (int i = 0; i < TAB_NAMES.length; i++) {
+            rootModels.add(new TizenNativeTreeRootModel(TAB_NAMES[i],
+                    new ArrayList<TizenNativeTreeGroupModel>(), TAB_ICON[i]));
         }
-        
+
         boolean found3 = false;
-        
-        for(EntryDescriptor ed: eds) {
-            
-            if(ed.getParentId() != null) {
-                
+
+        for (EntryDescriptor ed : eds) {
+
+            if (ed.getParentId() != null) {
+
                 boolean found1 = false;
                 String tempPath = ed.getPath();
-                for(EntryDescriptor ed2: eds) {
-                    if(ed2.getId().equals(ed.getParentId())) {
+                for (EntryDescriptor ed2 : eds) {
+                    if (ed2.getId().equals(ed.getParentId())) {
                         found3 = true;
                         found1 = true;
                         ed.setParentId(null);
                         ed.setPath(ed2.getId() + "/" + ed.getId());
                         ed.setParent(ed2);
-                        // Do Not check the applicability when the same type is already checked
-                               if ( ed2.getHandler() != null && 
-                                               testedEntryDescriptors.containsKey(ed.getId()) &&
-                                               testedEntryDescriptors.get(ed.getId()).equals(ed2.getId()) ) {
-                                       
-                               ed.setHandler(ed2.getHandler());
-                               }
-                               else if ( ed2.getHandler() != null &&
-                                               ed2.getHandler().isApplicable(ed) ) {
-                                       
-                                       testedEntryDescriptors.put(ed.getId(), ed2.getId());
-                                       ed.setHandler(ed2.getHandler());
-                               }
-                               break;
+                        // Do Not check the applicability when the same type is
+                        // already checked
+                        if (ed2.getHandler() != null
+                                && testedEntryDescriptors.containsKey(ed.getId())
+                                && testedEntryDescriptors.get(ed.getId()).equals(ed2.getId())) {
+
+                            ed.setHandler(ed2.getHandler());
+                        } else if (ed2.getHandler() != null && ed2.getHandler().isApplicable(ed)) {
+
+                            testedEntryDescriptors.put(ed.getId(), ed2.getId());
+                            ed.setHandler(ed2.getHandler());
+                        }
+                        break;
                     }
                 }
-                if(found1 == false) continue;
-                
+                if (found1 == false) {
+                    continue;
+                }
+
                 List<String> categories = null;
                 IPath descPath = null;
-                if(tempPath == null) {
+                if (tempPath == null) {
                     categories = new ArrayList<String>();
                     categories.add(DEFAULT_TAB);
                     categories.add(DEFAULT_CATEGORY);
                     descPath = this.getTemplatePath().append("").append(ed.getName());
-                }
-                else {
+                } else {
                     categories = Arrays.asList(tempPath.split("/"));
                     descPath = this.getTemplatePath().append(tempPath).append(ed.getName());
                 }
-                
+
                 if (categories.get(0).equals("Git")) {
-                       descPath = new Path(tempPath.substring(4) + "/" + ed.getName());
-                       TizenNativeTreeGroupModel entry = addChildEntry(rootModels, categories);
-                       TizenPlatformTemplateModel template = new TizenPlatformTemplateModel(
-                                       ed.getName(), ed, null, null, null, 
-                                       GitDescManager.getDesc(descPath.toString()));
-                       entry.addTemplate(template);
-                } else {    
-                       IPath samplePath = descPath.append(TizenTemplateEngine.FILE_NAME_SAMPLE);
-                       File sampleFile = samplePath.toFile();
-                       IPath iconPath = null;
-                       
-                       TemplateDescriptor templateDesc = TizenTemplateProcessParser.createTemplateDesc(sampleFile);                    
-                       
-                       Element root = templateDesc.getRootElement();
-                       Element slpPropertyElement = TizenTemplateProcessParser.getElementFromTag(root, TizenTemplateProcessParser.TAG_SLPPROPERTY);
-                       slpPropertyElement = TizenTemplateProcessParser.getElementFromTag(slpPropertyElement, TizenTemplateProcessParser.TAG_PROPERTYGROUP);
-                       
-                       String projDesc = TizenTemplateProcessParser.getTextContextFromElement(slpPropertyElement, TizenTemplateProcessParser.TAG_DESC);
-                       String label = TizenTemplateProcessParser.getTextContextFromElement(slpPropertyElement, TizenTemplateProcessParser.TAG_SAMPLE);
-                       String icon = TizenTemplateProcessParser.getTextContextFromElement(slpPropertyElement, TizenTemplateProcessParser.TAG_WIZARD_ICON);
-                       
-                       if(icon != null) {
-                           iconPath = descPath.append(icon);
-                       }                
-                       
-                       TizenNativeTreeGroupModel entry = addChildEntry(rootModels, categories);
-                       
-                       if(projDesc != null) {
-                           descPath = descPath.append(projDesc);
-                       }
-                       else {
-                           descPath = this.getTemplatePath().append(TemplateTizenNewWizard.FILE_DESC);
-                       }
-                       
-                       //TizenNativeTemplateModel template = new TizenNativeTemplateModel(label, ed, descPath, samplePath, iconPath);
-                       TizenPlatformTemplateModel template = new TizenPlatformTemplateModel(label, ed, descPath, samplePath, iconPath, null);
-                       entry.addTemplate(template);
+                    descPath = new Path(tempPath.substring(4) + "/" + ed.getName());
+                    TizenNativeTreeGroupModel entry = addChildEntry(rootModels, categories);
+                    TizenPlatformTemplateModel template = new TizenPlatformTemplateModel(
+                            ed.getName(), ed, null, null, null, GitDescManager.getDesc(descPath
+                                    .toString()));
+                    entry.addTemplate(template);
+                } else {
+                    IPath samplePath = descPath.append(TizenTemplateEngine.FILE_NAME_SAMPLE);
+                    File sampleFile = samplePath.toFile();
+                    IPath iconPath = null;
+
+                    TemplateDescriptor templateDesc = TizenTemplateProcessParser
+                            .createTemplateDesc(sampleFile);
+
+                    Element root = templateDesc.getRootElement();
+                    Element slpPropertyElement = TizenTemplateProcessParser.getElementFromTag(root,
+                            TizenTemplateProcessParser.TAG_SLPPROPERTY);
+                    slpPropertyElement = TizenTemplateProcessParser.getElementFromTag(
+                            slpPropertyElement, TizenTemplateProcessParser.TAG_PROPERTYGROUP);
+
+                    String projDesc = TizenTemplateProcessParser.getTextContextFromElement(
+                            slpPropertyElement, TizenTemplateProcessParser.TAG_DESC);
+                    String label = TizenTemplateProcessParser.getTextContextFromElement(
+                            slpPropertyElement, TizenTemplateProcessParser.TAG_SAMPLE);
+                    String icon = TizenTemplateProcessParser.getTextContextFromElement(
+                            slpPropertyElement, TizenTemplateProcessParser.TAG_WIZARD_ICON);
+
+                    if (icon != null) {
+                        iconPath = descPath.append(icon);
+                    }
+
+                    TizenNativeTreeGroupModel entry = addChildEntry(rootModels, categories);
+
+                    if (projDesc != null) {
+                        descPath = descPath.append(projDesc);
+                    } else {
+                        descPath = this.getTemplatePath().append(TemplateTizenNewWizard.FILE_DESC);
+                    }
+
+                    // TizenNativeTemplateModel template = new
+                    // TizenNativeTemplateModel(label, ed, descPath, samplePath,
+                    // iconPath);
+                    TizenPlatformTemplateModel template = new TizenPlatformTemplateModel(label, ed,
+                            descPath, samplePath, iconPath, null);
+                    entry.addTemplate(template);
                 }
             }
         }
 
-        if(!found3) {
-            Logger.error(Messages.EXCEPTION_WHILE_PROJECT_CREATION_1);
+        if (!found3) {
+            logger.error(Messages.EXCEPTION_WHILE_PROJECT_CREATION_1);
         }
         return rootModels;
     }
-    
+
     public TizenPlatformTemplateModel getLastSelectedTemplate() {
-        return (TizenPlatformTemplateModel)lastSelectedTemplate;
+        return (TizenPlatformTemplateModel) lastSelectedTemplate;
     }
-    
+
     public void setPageError(boolean value) {
-       this.pageError = value;
+        this.pageError = value;
     }
 
     @Override
     public boolean validatePage() {
-       if (pageError) {
-               return false;
-       } else {
-               return super.validatePage();
-       }
+        if (pageError) {
+            return false;
+        } else {
+            return super.validatePage();
+        }
     }
 }