[Title] Changed to create Git project when choosing Template or Sample
authordonghee yang <donghee.yang@samsung.com>
Thu, 8 Nov 2012 01:58:41 +0000 (10:58 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Thu, 8 Nov 2012 01:58:41 +0000 (10:58 +0900)
project

org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenPlatformProjectWizard.java

index 401b5fe..8c9bfc6 100644 (file)
@@ -10,6 +10,7 @@ import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.jgit.storage.file.FileRepository;
 
 import org.tizen.common.util.DialogUtil;
 import org.tizen.nativeappcommon.wizards.TizenProjectWizard;
@@ -48,11 +49,11 @@ public class TizenPlatformProjectWizard extends TizenProjectWizard {
        TizenPlatformTemplateModel selectedTemplate = ((TizenPlatformMainWizardPage)fMainPage).getLastSelectedTemplate();
        GitDescription desc = selectedTemplate.getDesc();       
 
+               String sshConn = PreferencesManager.getActiveGitBaseURI();
+               GitCommander commander = new GitCommander(sshConn);
        if (desc != null) {
                // this is git project
                IPath gitPath = new Path(selectedTemplate.getDesc().getProject());
-               String sshConn = PreferencesManager.getActiveGitBaseURI();
-               GitCommander commander = new GitCommander(sshConn);
                // cloning git project
                try {
                                if (!commander.CloneOperation(projectPath, gitPath, getContainer())) {
@@ -78,7 +79,16 @@ public class TizenPlatformProjectWizard extends TizenProjectWizard {
                commander.ApplySharedProject(newProject, getContainer());
        }
        else {
+
                result = super.performFinish();
+                       
+                       try {
+                               FileRepository gitRepos = new FileRepository(newProject.getLocation().toString()+"/.git");
+                               gitRepos.create();
+                       } catch (IOException e) {
+                               DialogUtil.openMessageDialog("Warning: Converting the project to Git failed!");
+                       }
+               commander.ApplySharedProject(newProject, getContainer());
        }
         
         return result;