Tizen 2.0 Release tizen_2.0 submit/tizen_2.0/20130215.192342
authorHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:58:47 +0000 (00:58 +0900)
committerHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:58:47 +0000 (00:58 +0900)
153 files changed:
AUTHORS
LICENSE.APLv2 [new file with mode: 0644]
NOTICE
org.tizen.nativeplatform.feature/feature.xml
org.tizen.nativeplatform.feature/rootfiles/resources/tools/snippets/Comments/File Comment.xml [new file with mode: 0644]
org.tizen.nativeplatform.feature/rootfiles/resources/tools/snippets/Comments/Project Comment.xml [new file with mode: 0644]
org.tizen.nativeplatform.feature/rootfiles/resources/tools/snippets/keyCombos.properties [new file with mode: 0644]
org.tizen.nativeplatform/META-INF/MANIFEST.MF
org.tizen.nativeplatform/OSGI-INF/l10n/bundle.properties [new file with mode: 0644]
org.tizen.nativeplatform/build.properties
org.tizen.nativeplatform/icons/rootstrap/add.gif [new file with mode: 0644]
org.tizen.nativeplatform/icons/rootstrap/breakpoint.gif [new file with mode: 0644]
org.tizen.nativeplatform/icons/rootstrap/delete.gif [new file with mode: 0644]
org.tizen.nativeplatform/icons/rootstrap/edit.gif [new file with mode: 0644]
org.tizen.nativeplatform/icons/rootstrap/filesyst.gif [new file with mode: 0644]
org.tizen.nativeplatform/icons/rootstrap/import.gif [new file with mode: 0644]
org.tizen.nativeplatform/icons/rootstrap/refresh.gif [new file with mode: 0644]
org.tizen.nativeplatform/icons/rootstrap/remove.gif [new file with mode: 0644]
org.tizen.nativeplatform/icons/rootstrap/server.gif [new file with mode: 0644]
org.tizen.nativeplatform/icons/rootstrap/successed.png [new file with mode: 0644]
org.tizen.nativeplatform/plugin.xml
org.tizen.nativeplatform/plugin_customization.ini [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/Activator.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildCommandLauncher.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildPackageObjectAction.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformCheckCancelJob.java [new file with mode: 0644]
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/PlatformMakeGenerator.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectConverter.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectDependentBuilder.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectDependentPackager.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectPackaging.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/ui/GBSBuildConfigurationTab.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOption.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOptionManager.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/CachedGitEntries.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/FileGitIndexParser.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitCommander.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitCommanderMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitDescManager.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitIndexParserFactory.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/IGitIndexParser.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/WebGitIndexParser.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/model/GitConfiguration.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/model/GitDescription.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ITizenLaunchConfigurationConstants.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformCommandFactory.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformMIProcessAdapter.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegate.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForAttach.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForCore.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchMessages.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchMessages.properties
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/LaunchTabUIMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationForAttachTabGroup.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationForCoreTabGroup.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationTabGroup.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainAttachTab.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainCoreTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectAttachLaunchShortcut.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectCoredumpLaunchShortcut.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectLaunchShortcut.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianPropertyTester.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenPathInputDialog.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/LaunchWizardPageUIMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingAppPage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingBinPage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingProcPage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/LaunchWizardUIMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformAttachLaunchWizard.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizard.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizardDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/ShowLogDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/ShowPackageStatusDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/password/PasswdDialogMessage.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/password/PasswordInputDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/password/SudoPasswdManager.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/DialogActionDelegate.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerHandler.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerOuputReceiver.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommander.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommands.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/InstalledPackage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/InstalledPkgProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPackage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/LocalPkgProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Package.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/PackageProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePackage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePkgProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Repository.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RepositoryProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRemotePackageDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRepoDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildSystemTab.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/ModifyRepoDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PackageTableSelectionAdapter.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PkgMgrUIMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RemoveInstalledPackageDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RepoTableSelectionAdapter.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/PreferencesManager.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/GitConfUIMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/PasswdConfDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/PlatformPreferencePage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/PlatformUIMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/SiteConfigurationDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/SiteConfigurationPreferencePage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/IRootstrapChangedListener.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/SnapshotURLParser.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/templateengine/TizenTemplateProcess.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/templateengine/process/SetDefaultBuildOptions.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/CommandLauncher.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/Architecture.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/ICheckTreeItem.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/PlatformRootstrap.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/Snapshot.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/provider/RootstrapContentProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/provider/RootstrapLabelProvider.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/AddRootstrapDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapUIMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/SelectRootstrapMappingDialog.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TemplateTizenPlatformNewWizard.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenDebianMainWizardPage.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenDebianProjectWizard.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenPlatformMainWizardPage.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenPlatformProjectWizard.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/WizardUIMessages.properties [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/model/TizenPlatformTemplateModel.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/Messages.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/TizenPlatformPWComposite.java [new file with mode: 0644]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/messages.properties [new file with mode: 0644]
org.tizen.nativeplatform/templates/CustomDebianPackages/EmptyProject/template.properties
org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/template.xml
org.tizen.nativeplatform/templates/InhouseFrameworkPackages/EmptyProject/template.properties
org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/changelog
org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/control
org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/rules
org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/packaging/hello.spec [new file with mode: 0644]
org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/template.xml
org.tizen.nativeplatform/templates/InhouseFrameworkPackages/PlatformProject/.buildproperties.xml [new file with mode: 0644]
org.tizen.nativeplatform/templates/InhouseFrameworkPackages/PlatformProject/template.properties [new file with mode: 0644]
org.tizen.nativeplatform/templates/InhouseFrameworkPackages/PlatformProject/template.xml [new file with mode: 0644]
package/build.linux
package/changelog [new file with mode: 0644]
package/pkginfo.manifest

diff --git a/AUTHORS b/AUTHORS
index acaf5c7..d932f3b 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,6 @@
 Kangho Kim <kh5325.kim@samsung.com>
+Donghee Yang <donghee.yang@samsung.com>
+Donghyuk Yang <donghyuk.yang@samsung.com>
 Namkoong Ho <ho.namkoong@samsung.com>
 YoonKi Park <yoonki.park@samsung.com>
 Taeyoung Son <taeyoung2.son@samsung.com>
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/NOTICE b/NOTICE
index 4297ee3..901a81c 100644 (file)
--- a/NOTICE
+++ b/NOTICE
@@ -1 +1,3 @@
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
index ef8f9fc..1c2ed1a 100644 (file)
@@ -2,8 +2,8 @@
 <feature
       id="org.tizen.nativeplatform.feature"
       label="Tizen Native Platform"
-      version="0.20.0.qualifier"
-      provider-name="Samsung"
+      version="1.0.0.qualifier"
+      provider-name="The Linux Foundation"
       plugin="org.tizen.base.platform"
       license-feature="org.tizen.base.feature">
 
    </description>
 
    <copyright>
-      Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+      Copyright (c)
    </copyright>
 
    <license url="http://www.example.com/license">
       [Enter License Description here.]
    </license>
 
+   <includes
+         id="org.tizen.nativeappcommon.feature"
+         version="0.0.0"/>
+
    <plugin
          id="org.tizen.nativeplatform"
          download-size="0"
diff --git a/org.tizen.nativeplatform.feature/rootfiles/resources/tools/snippets/Comments/File Comment.xml b/org.tizen.nativeplatform.feature/rootfiles/resources/tools/snippets/Comments/File Comment.xml
new file mode 100644 (file)
index 0000000..b64316f
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<snippet filetemplate="false" extension="cfm">
+<name>File Comment</name>
+<help>describe file information</help>
+<starttext><![CDATA[/**
+ * @file               $${CURRENTFILE}
+ * @brief              $${file information}
+ *
+ * @author             $${name} ($${e-mail})
+ * @version            $${Revision}
+ */]]></starttext>
+<endtext><![CDATA[]]></endtext>
+</snippet>
\ No newline at end of file
diff --git a/org.tizen.nativeplatform.feature/rootfiles/resources/tools/snippets/Comments/Project Comment.xml b/org.tizen.nativeplatform.feature/rootfiles/resources/tools/snippets/Comments/Project Comment.xml
new file mode 100644 (file)
index 0000000..c0175f1
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<snippet filetemplate="false" extension="cfm">
+<name>Project Comment</name>
+<help>describe project information</help>
+<starttext><![CDATA[/*
+ * $${project name}
+ *
+ * $${lisence information}
+ *
+ * $${supplementary information}
+ */]]></starttext>
+<endtext><![CDATA[]]></endtext>
+</snippet>
\ No newline at end of file
diff --git a/org.tizen.nativeplatform.feature/rootfiles/resources/tools/snippets/keyCombos.properties b/org.tizen.nativeplatform.feature/rootfiles/resources/tools/snippets/keyCombos.properties
new file mode 100644 (file)
index 0000000..212a7f8
--- /dev/null
@@ -0,0 +1,10 @@
+#These key combos are used by the cfeclipse plugin.
+#Tue Jul 26 16:12:05 KST 2011
+fc=/Comments/File Comment.xml
+lim=/Log/Log INFO message.xml
+clm=/Localization/Create a localized message.xml
+lwm=/Log/Log WARNING message.xml
+lem=/Log/Log ERROR message.xml
+lvm=/Log/Log VERBOSE message.xml
+pc=/Comments/Project Comment.xml
+ldm=/Log/Log DEBUG message.xml
index a6686e1..b532ef7 100644 (file)
@@ -1,38 +1,57 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
-Bundle-Name: Tizen Native Inhouse
+Bundle-Name: %Bundle-Name
 Bundle-SymbolicName: org.tizen.nativeplatform;singleton:=true
 Bundle-Version: 1.0.0
 Bundle-Activator: org.tizen.nativeplatform.Activator
-Bundle-Vendor: Samsung
+Bundle-Vendor: %Bundle-Vendor
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.cdt.managedbuilder.core;bundle-version="7.0.2",
  org.eclipse.core.resources;bundle-version="3.6.1",
  org.eclipse.cdt.core;bundle-version="5.2.1",
  org.eclipse.cdt.managedbuilder.ui;bundle-version="7.0.0",
- org.tizen.common;bundle-version="1.3.20",
+ org.tizen.common,
  org.eclipse.ui.console;bundle-version="3.5.0",
  org.eclipse.cdt.ui;bundle-version="5.2.2",
  org.eclipse.debug.ui,
  org.tizen.common.connection,
- org.tizen.nativecommon;bundle-version="1.0.0"
+ org.tizen.nativecommon
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Import-Package: org.eclipse.cdt.debug.core,
  org.eclipse.cdt.debug.core.cdi,
  org.eclipse.cdt.debug.core.cdi.model,
+ org.eclipse.cdt.debug.core.sourcelookup,
+ org.eclipse.cdt.debug.internal.core.sourcelookup,
  org.eclipse.cdt.debug.internal.ui.launch,
  org.eclipse.cdt.debug.mi.core,
+ org.eclipse.cdt.debug.mi.core.cdi,
+ org.eclipse.cdt.debug.mi.core.command.factories,
  org.eclipse.cdt.debug.ui,
  org.eclipse.cdt.launch,
  org.eclipse.cdt.launch.internal.ui,
  org.eclipse.cdt.launch.ui,
  org.eclipse.core.expressions,
+ org.eclipse.core.net.proxy,
  org.eclipse.debug.core,
  org.eclipse.debug.core.model,
  org.eclipse.debug.ui,
  org.eclipse.debug.ui.sourcelookup,
+ org.eclipse.egit.core;version="0.12.1",
+ org.eclipse.egit.core.op;version="0.12.1",
+ org.eclipse.egit.ui.internal.sharing;version="0.12.1",
+ org.eclipse.jgit.lib;version="0.12.1",
+ org.eclipse.jgit.storage.file;version="0.12.1",
+ org.eclipse.jgit.transport;version="0.12.1",
+ org.eclipse.jgit.util;version="0.12.1",
  org.eclipse.ui,
  org.eclipse.ui.dialogs,
- org.tizen.common.connection
+ org.mihalis.opal.preferenceWindow,
+ org.mihalis.opal.preferenceWindow.widgets,
+ org.tizen.common.connection,
+ org.tizen.nativeappcommon,
+ org.tizen.nativeappcommon.templateengine,
+ org.tizen.nativeappcommon.wizards,
+ org.tizen.nativeappcommon.wizards.model,
+ org.tizen.sdblib
diff --git a/org.tizen.nativeplatform/OSGI-INF/l10n/bundle.properties b/org.tizen.nativeplatform/OSGI-INF/l10n/bundle.properties
new file mode 100644 (file)
index 0000000..1dba912
--- /dev/null
@@ -0,0 +1,9 @@
+Bundle-Vendor = The Linux Foundation
+Bundle-Name = Tizen Platform Development Tools
+
+org.tizen.nativeplatform.gitconfig.label=Site Configuration
+org.tizen.nativeplatform.proxyconfig.label=HTTP Proxy
+org.tizen.nativeplatform.password.label=Password
+org.tizen.nativeplatform.page.name=Platform
+
+view.rootstrap = Rootstrap View
index 3b87492..86d1871 100644 (file)
@@ -3,8 +3,10 @@ output.. = bin/
 bin.includes = plugin.xml,\
                META-INF/,\
                .,\
+               plugin_customization.ini,\
                icons/,\
                templates/,\
                plugin.properties,\
                about.html,\
-               about_files/
+               about_files/,\
+               OSGI-INF/
diff --git a/org.tizen.nativeplatform/icons/rootstrap/add.gif b/org.tizen.nativeplatform/icons/rootstrap/add.gif
new file mode 100644 (file)
index 0000000..4ccf050
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/add.gif differ
diff --git a/org.tizen.nativeplatform/icons/rootstrap/breakpoint.gif b/org.tizen.nativeplatform/icons/rootstrap/breakpoint.gif
new file mode 100644 (file)
index 0000000..1eaff5a
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/breakpoint.gif differ
diff --git a/org.tizen.nativeplatform/icons/rootstrap/delete.gif b/org.tizen.nativeplatform/icons/rootstrap/delete.gif
new file mode 100644 (file)
index 0000000..ec91cad
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/delete.gif differ
diff --git a/org.tizen.nativeplatform/icons/rootstrap/edit.gif b/org.tizen.nativeplatform/icons/rootstrap/edit.gif
new file mode 100644 (file)
index 0000000..b740410
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/edit.gif differ
diff --git a/org.tizen.nativeplatform/icons/rootstrap/filesyst.gif b/org.tizen.nativeplatform/icons/rootstrap/filesyst.gif
new file mode 100644 (file)
index 0000000..13ce11b
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/filesyst.gif differ
diff --git a/org.tizen.nativeplatform/icons/rootstrap/import.gif b/org.tizen.nativeplatform/icons/rootstrap/import.gif
new file mode 100644 (file)
index 0000000..99d3f9a
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/import.gif differ
diff --git a/org.tizen.nativeplatform/icons/rootstrap/refresh.gif b/org.tizen.nativeplatform/icons/rootstrap/refresh.gif
new file mode 100644 (file)
index 0000000..b2df6a8
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/refresh.gif differ
diff --git a/org.tizen.nativeplatform/icons/rootstrap/remove.gif b/org.tizen.nativeplatform/icons/rootstrap/remove.gif
new file mode 100644 (file)
index 0000000..73f5554
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/remove.gif differ
diff --git a/org.tizen.nativeplatform/icons/rootstrap/server.gif b/org.tizen.nativeplatform/icons/rootstrap/server.gif
new file mode 100644 (file)
index 0000000..87da5a7
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/server.gif differ
diff --git a/org.tizen.nativeplatform/icons/rootstrap/successed.png b/org.tizen.nativeplatform/icons/rootstrap/successed.png
new file mode 100644 (file)
index 0000000..7fe467b
Binary files /dev/null and b/org.tizen.nativeplatform/icons/rootstrap/successed.png differ
index 643c46c..dd361e0 100644 (file)
@@ -1,91 +1,52 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <plugin>
 <!-- build start -->
-    <extension
-        point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
-        <toolChain
-            configurationEnvironmentSupplier="org.tizen.nativeplatform.build.PlatformConfigurationEnvVarSupplier"
-            id="com.samsung.slp.toolchain.custom.debian.base"
-            isAbstract="true"
-            osList="linux,win32"
-            superClass="com.samsung.slp.toolchain.gnu.base.common">
-            <builder
-                autoBuildTarget="build"
-                buildfileGenerator="org.tizen.nativeplatform.build.PlatformMakeGenerator"
-                cleanBuildTarget="clean"
-                command="sbi-make"
-                commandLauncher="org.tizen.nativecommon.build.CommonBuildCommandLauncher"
-                id="com.samsung.slp.builder.custom.debian"
-                incrementalBuildTarget="build"
-                name="SLP Custom Debian builder">
-            </builder>
-        </toolChain>
-        <toolChain
-            id="com.samsung.slp.toolchain.custom.debian"
-            isAbstract="false"
-            name="GCC-4.5(SBOX2)"
-            osList="linux,win32"
-            superClass="com.samsung.slp.toolchain.custom.debian.base">
-            <supportedProperties>
-                <property
-                    id="org.eclipse.cdt.build.core.buildArtefactType">
-                    <value
-                        id="com.samsung.slp.buildArtefactType.custom.debian">
-                    </value>
-                </property>
-            </supportedProperties>
-        </toolChain>
-        <projectType
-            buildArtefactType="com.samsung.slp.buildArtefactType.custom.debian"
-            id="com.samsung.slp.project.custom.debian"
-            isAbstract="true"
-            isTest="false">
-            <configuration
-                cleanCommand="rm -f"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.config.custom.debian.emulator"
-                name="Tizen-Emulator">
-                <toolChain
-                    id="com.samsung.slp.toolchain.custom.debian.emulator"
-                    superClass="com.samsung.slp.toolchain.custom.debian">
-                </toolChain>
-            </configuration>
-            <configuration
-                cleanCommand="rm -f"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.config.custom.debian.device"
-                name="Tizen-Device">
-                <toolChain
-                    id="com.samsung.slp.toolchain.custom.debian.device"
-                    superClass="com.samsung.slp.toolchain.custom.debian">
-                </toolChain>
-            </configuration>
-        </projectType>
-    </extension>
 
-    <extension
-        id="com.samsung.slp.build.info.custom.debian"
-        point="org.eclipse.cdt.managedbuilder.core.buildProperties">
-        <propertyValue
-            id="com.samsung.slp.buildArtefactType.custom.debian"
-            name="SLP Custom Debian Package"
-            property="org.eclipse.cdt.build.core.buildArtefactType">
-        </propertyValue>
+       <extension
+        id="org.tizen.nativeplatform.gdbserver"
+            name="org.tizen.nativeplatform.gdbserver"
+            point="org.tizen.common.connection.tools">
+        <tools
+            packagename="gdbserver-platform"
+            sourcepath="/on-demand">
+        </tools>
     </extension>
 
+       <extension
+        point="org.eclipse.cdt.debug.mi.core.commandFactories">
+        <commandFactory
+            class="org.tizen.nativeplatform.launch.PlatformCommandFactory"
+            debuggerID="org.tizen.nativecommon.launch.TizenDebugger"
+            id="org.tizen.nativeplatform.launch.PlatformCommandFactory"
+            miVersions="mi,mi1,mi2"
+            name="Tizen Platform Command Set"
+            platforms="*"/>
+       </extension>
+    
+    <extension point="org.eclipse.core.contenttype.contentTypes">
+               <file-association
+                       content-type="org.eclipse.cdt.make.core.makefile"
+                       file-extensions="spec"/>    
+    </extension>
+    
     <extension
         point="org.eclipse.cdt.core.templates">
         <template
-            filterPattern=".*"
-            id="org.tizen.nativeapp.templates.custom.debian.EmptyProject"
+               filterPattern=".*"
+            id="EmptyProject"
             location="templates/InhouseFrameworkPackages/EmptyProject/template.xml"
-            projectType="com.samsung.slp.nativeide.buildArtefactType.cdeb">
+            projectType="org.tizen.nativeide.buildArtefactType.platform">
         </template>
         <template
-            filterPattern=".*"
-            id="org.tizen.nativeapp.templates.custom.debian.HelloWorldProject"
+               filterPattern=".*"
+            id="HelloWorldProject"
             location="templates/InhouseFrameworkPackages/HelloWorldProject/template.xml"
-            projectType="com.samsung.slp.nativeide.buildArtefactType.cdeb">
+            projectType="org.tizen.nativeide.buildArtefactType.platform">
+        </template>
+        <template
+            id="PlatformProject"
+            location="templates/InhouseFrameworkPackages/PlatformProject/template.xml"
+            projectType="org.tizen.nativeide.buildArtefactType.platform">
         </template>
         <template
             filterPattern=".*"
             </toolChain>
         </template>
     </extension>
-
+<!--
     <extension
         point="org.eclipse.ui.commands">
         <command
         point="org.eclipse.ui.handlers">
         <handler
             commandId="org.tizen.nativeplatform.pkgInstall.commandid.rootstrapmgr"
-            class="org.tizen.nativeplatform.pkgInstall.PackageManagerRootstrapHandler">
+            class="org.tizen.nativeplatform.pkgmgr.PackageManagerHandler">
         </handler>
     </extension>
-<!--
-    <extension
-        point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
-        <toolChain
-            id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base"
-            isAbstract="false"
-            name="[SBOX2] GCC-4.5"
-            osList="linux"
-            superClass="com.samsung.slp.nativeide.toolchain.sbi.gnu.slp.base">
-        </toolChain>
-
-        <projectType
-            buildArtefactType="com.samsung.slp.nativeide.buildArtefactType.app"
-            id="com.samsung.slp.nativeide.target.sbi.gcc45sbox2.app"
-            isAbstract="true"
-            isTest="false">
-            <configuration
-                buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
-                cleanCommand="rm -rf"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.app.debug.emulator"
-                name="Debug-Tizen-Emulator">
-                <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.app.debug.emulator"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
-                </toolChain>
-            </configuration>
-            <configuration
-                buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
-                cleanCommand="rm -rf"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.app.debug.device"
-                name="Debug-Tizen-Device">
-                <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.app.debug.device"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
-                </toolChain>
-            </configuration>
-            <configuration
-                buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release"
-                cleanCommand="rm -rf"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.app.release"
-                name="Release">
-                <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.app.release"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
-                </toolChain>
-            </configuration>
-        </projectType>
-
-        <projectType
-            buildArtefactType="com.samsung.slp.nativeide.buildArtefactType.sharedLib"
-            id="com.samsung.slp.nativeide.target.sbi.gcc45sbox2.so"
-            isAbstract="true"
-            isTest="false">
-            <configuration
-                buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
-                cleanCommand="rm -f"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.so.debug.emulator"
-                name="Debug-Tizen-Emulator">
-                <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.so.debug.emulator"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
-                </toolChain>
-            </configuration>
-            <configuration
-                buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
-                cleanCommand="rm -f"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.so.debug.device"
-                name="Debug-Tizen-Device">
-                <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.so.debug.device"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
-                </toolChain>
-            </configuration>
-            <configuration
-                buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release"
-                cleanCommand="rm -f"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.so.release"
-                name="Release">
-                <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.so.release"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
-                </toolChain>
-            </configuration>
-        </projectType>
-
-        <projectType
-            buildArtefactType="com.samsung.slp.nativeide.buildArtefactType.staticLib"
-            id="com.samsung.slp.nativeide.target.sbi.gcc45sbox2.lib"
-            isAbstract="true"
-            isTest="false">
-            <configuration
-                buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
-                cleanCommand="rm -f"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.lib.debug.emulator"
-                name="Debug-Tizen-Emulator">
-                <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.lib.debug.emulator"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
-                </toolChain>
-            </configuration>
-            <configuration
-                buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug"
-                cleanCommand="rm -f"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.lib.debug.device"
-                name="Debug-Tizen-Device">
-                <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.lib.debug.device"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
-                </toolChain>
-            </configuration>
-            <configuration
-                buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release"
-                cleanCommand="rm -f"
-                errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.lib.release"
-                name="Release">
-                <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.lib.release"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.slp.base">
-                </toolChain>
-            </configuration>
-        </projectType>
-    </extension>
 -->
-
     <extension
         point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
         <toolChain
             configurationEnvironmentSupplier="org.tizen.nativeplatform.build.PlatformConfigurationEnvVarSupplier"
-            id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.base"
+            id="org.tizen.nativeide.toolchain.sbi.gcc45.platform.base"
             isAbstract="false"
-            name="[SBOX2] GCC-4.5 Custom Debian"
+            name="Tizen Platform Toolchain"
             osList="linux"
-            superClass="com.samsung.slp.nativeide.toolchain.sbi.gnu.base">
+            superClass="org.tizen.nativeide.toolchain.sbi.gnu.base">
             <builder
                 autoBuildTarget="build"
                 buildfileGenerator="org.tizen.nativeplatform.build.PlatformMakeGenerator"
                 cleanBuildTarget="clean"
                 command="sbi-make"
-                commandLauncher="org.tizen.nativecommon.build.CommonBuildCommandLauncher"
-                id="org.tizen.nativeapp.target.sbi.gcc45sbox2.builder.cdeb"
+                commandLauncher="org.tizen.nativeplatform.build.PlatformBuildCommandLauncher"
+                id="org.tizen.nativeide.target.sbi.gcc45.platform.builder"
                 incrementalBuildTarget="build"
-                name="Tizen Custom Debian Builder">
+                name="Tizen Platform Builder">
             </builder>
                <tool
-               id="com.samsung.slp.nativeide.tool.sbi.gnu.archiver.cdeb.base"                  
-                       superClass="com.samsung.slp.nativeide.tool.sbi.gnu.archiver.base">
+               id="org.tizen.nativeide.tool.sbi.gnu.archiver.platform.base"                    
+                       superClass="org.tizen.nativeide.tool.sbi.gnu.archiver.base">
                        <enablement
                                type="ALL">
                                <false/>
                        </enablement>                           
                </tool>
                <tool
-                       id="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.compiler.cdeb.base"               
-                       superClass="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.compiler.base">
+                       id="org.tizen.nativeide.tool.sbi.gnu.cpp.compiler.platform.base"               
+                       superClass="org.tizen.nativeide.tool.sbi.gnu.cpp.compiler.base">
+                               <option
+                                       id="sbi.gnu.cpp.compiler.option.gbs.platform"
+                                       name="Tizen Platform GBS Options"
+                                       valueType="stringList">
+                               </option>
                        <enablement
                                type="ALL">
                                <false/>
                        </enablement>                           
                </tool>
                <tool
-                       id="com.samsung.slp.nativeide.tool.sbi.gnu.c.compiler.cdeb.base"                
-                       superClass="com.samsung.slp.nativeide.tool.sbi.gnu.c.compiler.base">
+                       id="org.tizen.nativeide.tool.sbi.gnu.c.compiler.platform.base"                  
+                       superClass="org.tizen.nativeide.tool.sbi.gnu.c.compiler.base">
                        <enablement
                                type="ALL">
                                <false/>
                        </enablement>                           
             </tool>
                <tool
-                       id="com.samsung.slp.nativeide.tool.sbi.gnu.c.linker.cdeb.base"                  
-                       superClass="com.samsung.slp.nativeide.tool.sbi.gnu.c.linker.base">
+                       id="org.tizen.nativeide.tool.sbi.gnu.c.linker.platform.base"                    
+                       superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base">
                        <enablement
                                type="ALL">
                                <false/>
                        </enablement>
                </tool>
                <tool
-                       id="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.linker.cdeb.base"                
-                       superClass="com.samsung.slp.nativeide.tool.sbi.gnu.cpp.linker.base">
+                       id="org.tizen.nativeide.tool.sbi.gnu.cpp.linker.platform.base"                  
+                       superClass="org.tizen.nativeide.tool.sbi.gnu.cpp.linker.base">
                        <enablement
                                type="ALL">
                                <false/>
                        </enablement>
                </tool>
                <tool
-                       id="com.samsung.tizen.nativeapp.tool.sbi.gnu.assembler.cdeb.base"
-                       superClass="com.samsung.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+                       id="org.tizen.nativeapp.tool.sbi.gnu.assembler.platform.base"
+                       superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
                        <enablement
                                type="ALL">
                                <false/>
         </toolChain>
 
         <projectType
-            buildArtefactType="com.samsung.slp.nativeide.buildArtefactType.cdeb"
-            id="com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb"
+            buildArtefactType="org.tizen.nativeide.buildArtefactType.platform"
+            id="org.tizen.nativebuild.target.sbi.gcc45.platform"
             isAbstract="false"
             isTest="false">
             <configuration
                 cleanCommand="rm -f"
                 errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.cdeb.emulator"
+                id="org.tizen.nativeide.config.sbi.gcc45.platform.emulator"
                 name="Tizen-Emulator">
                 <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.emulator"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.base">
+                    id="org.tizen.nativeide.toolchain.sbi.gcc45.platform.emulator"
+                    superClass="org.tizen.nativeide.toolchain.sbi.gcc45.platform.base">
                 </toolChain>
             </configuration>
             <configuration
                 cleanCommand="rm -f"
                 errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;"
-                id="com.samsung.slp.nativeide.config.sbi.gcc45sbox2.cdeb.device"
+                id="org.tizen.nativeide.config.sbi.gcc45.platform.device"
                 name="Tizen-Device">
                 <toolChain
-                    id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.device"
-                    superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.base">
+                    id="org.tizen.nativeide.toolchain.sbi.gcc45.platform.device"
+                    superClass="org.tizen.nativeide.toolchain.sbi.gcc45.platform.base">
                 </toolChain>
             </configuration>          
         </projectType>
     <extension
           point="org.eclipse.cdt.managedbuilder.core.buildProperties">
        <propertyValue
-             id="com.samsung.slp.nativeide.buildArtefactType.cdeb"
-             name="Tizen Custom Debian Project"
+             id="org.tizen.nativeide.buildArtefactType.platform"
+             name="Tizen Platform Project"
              property="org.eclipse.cdt.build.core.buildArtefactType">
        </propertyValue>
     </extension>    
         point="org.eclipse.cdt.managedbuilder.core.projectConverter">
         <converter
             class="org.tizen.nativeplatform.build.PlatformProjectConverter"
-            fromId="com.samsung.slp.project.custom.debian"
-            id="com.samsung.tizen.nativeapp.converter.cdeb"
+            fromId="com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb"
+            id="org.tizen.nativeapp.converter.platform"
             mbsVersion="4.0.0"
-            name="Upgrade Tizen Custom Debian Project, GCC-4.5(SBOX2)"
-            toId="com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb">
+            name="Upgrade Tizen Platform Project, GCC-4.5"
+            toId="org.tizen.nativebuild.target.sbi.gcc45.platform">
         </converter>
     </extension>
 <!-- build end -->        
         point="org.eclipse.ui.newWizards">
                <wizard
             category="org.tizen.nativeapp.newCategory"
-            class="org.tizen.nativeplatform.wizards.TizenDebianProjectWizard"
-            finalPerspective="org.tizen.nativeapp.perspective"
+            class="org.tizen.nativeplatform.wizards.TizenPlatformProjectWizard"
+            finalPerspective="org.tizen.nativeplatform.perspective"
             icon="icons/newc_app.gif"
             id="org.tizen.nativeapp.newCategory.customWizard"
-            name="Tizen Custom Debian Project"
-            preferredPerspectives="org.tizen.nativeapp.perspective"
+            name="Tizen Platform Project"
+            preferredPerspectives="org.tizen.nativeplatform.perspective"
             project="true">
         </wizard>
     </extension>
-<!-- wizard end -->
-
-<!-- launching & debugging start -->
     <extension
-        id="org.tizen.nativeapp.elmscaletool"
-            name="org.tizen.nativeapp.elmscaletool"
-            point="org.tizen.common.connection.tools">
-        <tools
-            packagename="elmscalegetter"
-            sourcepath="/SDK/develop-tool">
-        </tools>
+        point="org.eclipse.cdt.ui.CDTWizard">
+        <wizard
+            class="org.tizen.nativeplatform.wizards.TemplateTizenPlatformNewWizard"
+            name="template platform new wizard">
+        </wizard>
     </extension>
+<!-- wizard end -->
 
+<!-- launching & debugging start -->
     <extension
         point="org.eclipse.debug.core.launchConfigurationTypes">
         <launchConfigurationType
             delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegate"
             id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType"
-            name="Tizen Custom Debian Project"
+            name="Tizen Platform Project"
             public="true"/>
 
         <launchConfigurationType
             delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForAttach"
             id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach"
-            name="Tizen Custom Debian Project - Attach"
+            name="Tizen Platform Project - Attach"
             public="true"/>
-
+               <!--
         <launchConfigurationType
             delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore"
             id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore"
-            name="Tizen Custom Debian Project - Coredump"
+            name="Tizen Platform Project - Coredump"
             public="true"/>
+               -->            
     </extension>
 
     <extension
             delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegate"
             id="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegate"
             modes="run,debug"
-            name="Tizen Custom Debian Project"
-            delegateDescription="The Tizen Custom Debian Project Launcher supports running Tizen application on device"
+            name="Tizen Platform Project"
+            delegateDescription="The Tizen Platform Project Launcher supports running Tizen application on device"
             sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
             sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
             type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType"/>
             delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForAttach"
             id="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForAttach"
             modes="debug"
-            name="Tizen Custom Debian Project - Attach"
-            delegateDescription="The Tizen Custom Debian Project Launcher supports attach debugging Tizen process on device"
+            name="Tizen Platform Project - Attach"
+            delegateDescription="The Tizen Platform Project Launcher supports attach debugging Tizen process on device"
             sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
             sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
             type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach"/>
-
+               <!--
         <launchDelegate
             delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore"
             id="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore"
             modes="debug"
-            name="Tizen Custom Debian Project - Coredump"
-            delegateDescription="The Tizen Custom Debian Project Launcher supports coredump debugging"
+            name="Tizen Platform Project - Coredump"
+            delegateDescription="The Tizen Platform Project Launcher supports coredump debugging"
             sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
             sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
             type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore"/>
+               -->            
     </extension>
 
     <extension
         <tab
             id="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab"
             group="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationTabGroup"
-            name="Tizen Custom Debian Project Main Tab"
+            name="Tizen Platform Project Main Tab"
             class="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab">
             <associatedDelegate delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegate"/>
         </tab>
 
         <tab
-            id="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab"
+            id="org.tizen.nativeplatform.launch.ui.TizenDebianMainAttachTab"
             group="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationForAttachTabGroup"
-            name="Tizen Custom Debian Project Main Tab"
-            class="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab">
+            name="Tizen Platform Project Main Tab"
+            class="org.tizen.nativeplatform.launch.ui.TizenDebianMainAttachTab">
             <associatedDelegate delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForAttach"/>
         </tab>
 
+               <!--
         <tab
             id="org.tizen.nativeplatform.launch.ui.TizenDebianMainCoreTab"
             group="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationForCoreTabGroup"
-            name="Tizen Custom Debian Project main tab for coredump"
+            name="Tizen Platform Project main tab for coredump"
             class="org.tizen.nativeplatform.launch.ui.TizenDebianMainCoreTab">
             <associatedDelegate delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore"/>
         </tab>
+        -->
     </extension>
     
     <extension
     <extension
         point="org.eclipse.debug.ui.launchShortcuts">
         <shortcut
-            label="Tizen Custom Debian Project"
+            label="Tizen Platform Project"
             icon="icons/Tizen_Custom_Debian_ConfigurationType_Image.gif"
             modes="run,debug"
             class="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianProjectLaunchShortcut"
             id="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianProjectLaunchShortcut">
         <contextualLaunch>
-            <enablement>
-                <with variable="selection">
-                    <count value="1"/>
-                    <iterate>
-                        <or>
-                            <and>
-                                <instanceof value="org.eclipse.ui.IFileEditorInput"/>
-                                <adapt type="org.eclipse.core.resources.IResource">
-                                       <test
-                                    forcePluginActivation="true"
-                                   property="org.tizen.nativeplatform.launch.ui.shortcut.belongTizenCustomDebianProject"/>
-                                </adapt>
-                            </and>
-                            <and>
-                                <instanceof value="org.eclipse.core.resources.IProject"/>
-                                <test
-                                    forcePluginActivation="true"
-                                    property="org.tizen.nativeplatform.launch.ui.shortcut.isTizenCustomDebianProject"/>
-                            </and>
-                        </or>
-                    </iterate>
-                </with>
-            </enablement>
+                       <enablement>
+                               <and>                   
+                       <with variable="selection">
+                           <count value="1"/>
+                           <iterate>
+                               <or>
+                                   <and>
+                                       <instanceof value="org.eclipse.ui.IFileEditorInput"/>
+                                       <adapt type="org.eclipse.core.resources.IResource">
+                                                                       <test
+                                                                               forcePluginActivation="true"
+                                                                               property="org.tizen.nativeplatform.launch.ui.shortcut.belongTizenCustomDebianProject"/>
+                                       </adapt>
+                                   </and>
+                                   <and>
+                                       <instanceof value="org.eclipse.core.resources.IProject"/>
+                                       <test
+                                           forcePluginActivation="true"
+                                           property="org.tizen.nativeplatform.launch.ui.shortcut.isTizenCustomDebianProject"/>
+                                   </and>
+                               </or>
+                           </iterate>
+                       </with>
+                                       <with variable="activeWorkbenchWindow.activePerspective">
+                                               <equals value="org.tizen.nativeplatform.perspective"/>                    
+                                       </with>
+                               </and>                                                                                  
+                       </enablement>                                       
         </contextualLaunch>
         <description
             mode="run"
-            description="Runs a Tizen Custom Debian Project"/>
+            description="Runs a Tizen Platform Project"/>
         <description
             mode="debug"
-            description="Debugs a Tizen Custom Debian Project"/>
+            description="Debugs a Tizen Platform Project"/>
         <configurationType
             id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType">
         </configurationType>
         </shortcut>
 
         <shortcut
-            label="Tizen Custom Debian Project - Attach"
+            label="Tizen Platform Project - Attach"
             icon="icons/Tizen_Custom_Debian_ConfigurationType_Image_Attach.gif"
             modes="debug"
             class="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianProjectAttachLaunchShortcut"
             id="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianProjectAttachLaunchShortcut">
         <contextualLaunch>
-            <enablement>
-                <with variable="selection">
-                    <count value="1"/>
-                    <iterate>
-                        <or>
-                            <and>
-                                <instanceof value="org.eclipse.ui.IFileEditorInput"/>
-                                <adapt type="org.eclipse.core.resources.IResource">
-                                       <test
-                                    forcePluginActivation="true"
-                                    property="org.tizen.nativeplatform.launch.ui.shortcut.belongTizenCustomDebianProject"/>
-                                </adapt>
-                            </and>
-                            <and>
-                                <instanceof value="org.eclipse.core.resources.IProject"/>
-                                <test
-                                    forcePluginActivation="true"
-                                    property="org.tizen.nativeplatform.launch.ui.shortcut.isTizenCustomDebianProject"/>
-                            </and>
-                        </or>
-                    </iterate>
-                </with>
-            </enablement>
+                       <enablement>
+                               <and>
+                       <with variable="selection">
+                           <count value="1"/>
+                           <iterate>
+                               <or>
+                                   <and>
+                                       <instanceof value="org.eclipse.ui.IFileEditorInput"/>
+                                       <adapt type="org.eclipse.core.resources.IResource">
+                                                                       <test
+                                                                               forcePluginActivation="true"
+                                                                               property="org.tizen.nativeplatform.launch.ui.shortcut.belongTizenCustomDebianProject"/>
+                                       </adapt>
+                                   </and>
+                                   <and>
+                                       <instanceof value="org.eclipse.core.resources.IProject"/>
+                                       <test
+                                           forcePluginActivation="true"
+                                           property="org.tizen.nativeplatform.launch.ui.shortcut.isTizenCustomDebianProject"/>
+                                   </and>
+                               </or>
+                           </iterate>
+                       </with>
+                       <with variable="activeWorkbenchWindow.activePerspective">
+                           <equals value="org.tizen.nativeplatform.perspective"/>                    
+                       </with>
+                               </and>                  
+            </enablement>                  
         </contextualLaunch>
         <description
             mode="debug"
-            description="Attach Debugs a Tizen Custom Debian Project"/>
+            description="Attach Debugs a Tizen Platform Project"/>
         <configurationType
             id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach">
         </configurationType>
         </shortcut>
-
+               <!--
         <shortcut
-            label="Tizen Custom Debian Project - Coredump"
+            label="Tizen Platform Project - Coredump"
             icon="icons/Tizen_Custom_Debian_ConfigurationType_Image_Core.gif"
             modes="debug"
             class="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianProjectCoredumpLaunchShortcut"
             id="org.tizen.nativeapp.launch.ui.shortcut.TizenDebianProjectCoredumpLaunchShortcut">
         <contextualLaunch>
             <enablement>
-                <with variable="selection">
-                    <count value="1"/>
-                    <iterate>
-                        <or>
-                            <and>
-                                <instanceof value="org.eclipse.ui.IFileEditorInput"/>
-                                <adapt type="org.eclipse.core.resources.IResource">
-                                       <test
-                                    forcePluginActivation="true"
-                                    property="org.tizen.nativeplatform.launch.ui.shortcut.belongTizenCustomDebianProject"/>
-                                </adapt>
-                            </and>
-                            <and>
-                                <instanceof value="org.eclipse.core.resources.IProject"/>
-                                <test
-                                    forcePluginActivation="true"
-                                    property="org.tizen.nativeplatform.launch.ui.shortcut.isTizenCustomDebianProject"/>
-                            </and>
-                        </or>
-                    </iterate>
-                </with>
+                               <and>            
+                       <with variable="selection">
+                           <count value="1"/>
+                           <iterate>
+                               <or>
+                                   <and>
+                                       <instanceof value="org.eclipse.ui.IFileEditorInput"/>
+                                       <adapt type="org.eclipse.core.resources.IResource">
+                                              <test
+                                           forcePluginActivation="true"
+                                           property="org.tizen.nativeplatform.launch.ui.shortcut.belongTizenCustomDebianProject"/>
+                                       </adapt>
+                                   </and>
+                                   <and>
+                                       <instanceof value="org.eclipse.core.resources.IProject"/>
+                                       <test
+                                           forcePluginActivation="true"
+                                           property="org.tizen.nativeplatform.launch.ui.shortcut.isTizenCustomDebianProject"/>
+                                   </and>
+                               </or>
+                           </iterate>
+                       </with>
+                                       <with variable="activeWorkbenchWindow.activePerspective">
+                                               <equals value="org.tizen.nativeplatform.perspective"/>                    
+                                       </with>
+                               </and>                                  
             </enablement>
         </contextualLaunch>
         <description
             mode="debug"
-            description="Coredump Debugs a Tizen Custom Debian Project"/>
+            description="Coredump Debugs a Tizen Platform Project"/>
         <configurationType
             id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore">
         </configurationType>
         </shortcut>
+        -->
     </extension>
 <!-- launching & debugging end -->
 
 <!-- package manager start -->
+<!--
     <extension
         point="org.eclipse.ui.menus">
         <menuContribution
             locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
             <toolbar
-                id="org.tizen.nativeplatform.pkgInstall.pkgtoolbar">
+                id="org.tizen.nativecommon.manager.mgrtoolbar">
                 <command
                     commandId="org.tizen.nativeplatform.pkgInstall.commandid.rootstrapmgr"
                     icon="icons/package_installer.gif"
                     <visibleWhen
                         checkEnabled="false">
                         <with variable="activeWorkbenchWindow.activePerspective">
-                            <equals value="org.tizen.nativeapp.perspective"/>
+                            <equals value="org.tizen.nativeplatform.perspective"/>
                         </with>
                     </visibleWhen>
                 </command>
             </toolbar>
         </menuContribution>
     </extension>
-
+-->    
+<!--
     <extension
         point="org.eclipse.ui.actionSets">
         <actionSet
-            label="Package Manager ActionSet"
+            label="Manager ActionSet"
             visible="true"
-            id="org.tizen.nativeplatform.pkginstall.actionset">
+            id="org.tizen.nativecommon.actionset">
             <menu
-                label="Package Manager"
-                path="additions"
-                id="org.tizen.nativeplatform.pkginstall.menuid">
-            </menu>
+                label="Tizen Native Manager"
+                path="window/additions"
+                id="org.tizen.nativecommon.manager">
+                <separator name="slot"/>
+            </menu>        
             <action
                 id="org.tizen.nativeplatform.pkginstall.action"
                 label="Package Manager"
-                menubarPath="window/additions"
-                class="org.tizen.nativeplatform.pkgInstall.DialogActionDelegate">
+                menubarPath="window/org.tizen.nativecommon.manager/slot"
+                class="org.tizen.nativeplatform.pkgmgr.DialogActionDelegate"
+                icon="icons/package_installer.gif">
             </action>
+            
         </actionSet>
     </extension>
+-->    
+    <extension
+          point="org.eclipse.ui.popupMenus">
+
+        <objectContribution
+            adaptable="false"
+            id="org.tizen.nativeplatform.build.BuildPackageObjectContribution"
+            objectClass="org.eclipse.core.resources.IProject">
+            <action
+                  class="org.tizen.nativeplatform.build.PlatformBuildPackageObjectAction"
+                  enablesFor="+"
+                  id="org.tizen.nativeplatform.buildPackage.deb"
+                  label="Build Package"
+                  menubarPath="buildGroup">
+            </action>
+            <enablement>
+               <adapt
+                     type="org.eclipse.core.resources.IResource">
+                  <test
+                        property="org.tizen.nativecommon.projectBuildArtefactType"
+                        value="org.tizen.nativeide.buildArtefactType.platform">
+                  </test>
+               </adapt>
+            </enablement>
+        </objectContribution>          
+    </extension>
+       <extension
+       point="org.eclipse.cdt.core.templateProcessTypes">
+        <processType
+                       name="TizenTemplateProcess"
+                       processRunner="org.tizen.nativeplatform.templateengine.TizenTemplateProcess">
+                       <simple
+                               name="projectName">
+               </simple>
+            <simple
+               name="projType">
+                       </simple>
+               </processType>
+               <processType
+                       name="SetDefaultBuildOptions"
+                       processRunner="org.tizen.nativeplatform.templateengine.process.SetDefaultBuildOptions">
+                       <simple
+                               name="projectName">
+                       </simple>
+                       <complexArray
+                               name="optionList">
+                               <baseType>
+                                       <simple
+                                               name="buildOption">
+                                       </simple>
+                               </baseType>
+                       </complexArray>
+               </processType>
+       </extension>
+       
+       <extension
+               point="org.eclipse.ui.preferencePages">
+               <page
+                       category="org.tizen.common.preferences.tizencommon"
+                       class="org.tizen.nativeplatform.preferences.ui.PlatformPreferencePage"
+                       id="org.tizen.nativeplatform.preferences"
+                       name="%org.tizen.nativeplatform.page.name">
+               </page>
+       </extension>
+      
+       <extension
+               point="org.eclipse.ui.preferencePages">
+               <page
+                       category="org.tizen.nativeplatform.preferences"
+                       class="org.tizen.nativeplatform.preferences.ui.SiteConfigurationPreferencePage"
+                       id="org.tizen.nativeplatform.gitconfig"
+                       name="%org.tizen.nativeplatform.gitconfig.label">
+               </page>
+       </extension>
+       
+       <extension
+         point="org.eclipse.ui.perspectiveExtensions">
+      <perspectiveExtension
+            targetID="org.tizen.nativeplatform.perspective">
+         <newWizardShortcut
+               id="org.tizen.nativeplatform.newCategory.newWizard.feature">
+         </newWizardShortcut>
+               <!-- Needed for menu Project > Build Configurations -->
+               <actionSet id="org.eclipse.cdt.ui.buildConfigActionSet"/>
+      </perspectiveExtension>
+    </extension>   
+    
+       <extension
+         point="org.eclipse.ui.perspectiveExtensions">      
+      <perspectiveExtension
+            targetID="org.tizen.nativeplatform.perspective">
+         <view
+               ratio="1"
+               relationship="bottom"
+               relative="org.eclipse.ui.navigator.ProjectExplorer"
+               id="org.tizen.common.connection.ui.ConnectionExplorer">
+         </view>
+         <viewShortcut
+               id="org.tizen.common.connection.ui.ConnectionExplorer">
+         </viewShortcut>
+      </perspectiveExtension>
+       </extension>
+       
+       <extension
+         point="org.eclipse.ui.perspectiveExtensions">
+       
+      <perspectiveExtension
+            targetID="org.tizen.nativeplatform.perspective">
+         <view
+               id="org.tizen.common.connection.ui.LogView"
+               ratio="1"
+               relationship="stack"
+               relative="org.eclipse.ui.views.TaskList">
+         </view>
+         <viewShortcut
+               id="org.tizen.common.connection.ui.LogView">
+         </viewShortcut>
+      </perspectiveExtension>
+   </extension>
+   
+       <extension
+         point="org.eclipse.ui.perspectiveExtensions">  
+      <perspectiveExtension
+            targetID="org.tizen.nativeplatform.perspective">
+         <view
+               id="org.tizen.nativeplatform.views.ui.RootstrapView"
+               ratio="1"
+               relationship="bottom"
+               relative="org.eclipse.ui.views.ContentOutline">
+         </view>
+         <viewShortcut
+               id="org.tizen.nativeplatform.views.ui.RootstrapView">
+         </viewShortcut>
+      </perspectiveExtension>
+       </extension>
+   
+       <extension
+         point="org.eclipse.ui.views">
+               <view
+               category="org.tizen.nativeapp.viewCategory"
+            class="org.tizen.nativeplatform.views.ui.RootstrapView"           
+            icon="icons/rootstrap/server.gif"                        
+            id="org.tizen.nativeplatform.views.ui.RootstrapView"
+            name="%view.rootstrap"
+            restorable="true">
+      </view>
+       </extension>
+       
+               <extension
+         point="org.eclipse.ui.contexts">
+      <context
+            id="org.tizen.common.rootstrap.setdefault.context"
+            name="Select"
+            parentId="org.eclipse.ui.contexts.window">
+      </context>    
+      <context
+            id="org.tizen.common.rootstrap.lauchpkgmgr.context"
+            name="Manage packages"
+            parentId="org.eclipse.ui.contexts.window">
+      </context>
+            <context
+            id="org.tizen.common.rootstrap.remove.context"
+            name="Remove"
+            parentId="org.eclipse.ui.contexts.window">
+      </context>            
+      <context
+            id="org.tizen.common.rootstrap.export.context"
+            name="Export"
+            parentId="org.eclipse.ui.contexts.window">
+      </context>
+       </extension>
+       
+       <extension
+               point="org.eclipse.cdt.ui.cPropertyTab">
+               <tab
+                       class="org.tizen.nativeplatform.build.ui.GBSBuildConfigurationTab"
+                       name="GBS Options"
+                       parent="org.tizen.nativecommon.build.ui.TizenSettingsPage"
+                       weight="20">
+               </tab>
+       </extension>
+
 <!-- package manager end -->
 </plugin>
diff --git a/org.tizen.nativeplatform/plugin_customization.ini b/org.tizen.nativeplatform/plugin_customization.ini
new file mode 100644 (file)
index 0000000..9e6b5ea
--- /dev/null
@@ -0,0 +1,67 @@
+#org.eclipse.ui.ide/SAVE_ALL_BEFORE_BUILD=true
+#org.eclipse.core.resources/refresh.enabled=true
+#org.eclipse.core.resources/description.autobuilding=true
+org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true
+org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false
+org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight
+org.eclipse.ui/defaultPerspectiveId=org.tizen.nativeplatform.perspective
+
+org.eclipse.ui.workbench/SHOW_BUILDID_ON_STARTUP=true
+
+# CDT related preferences
+org.eclipse.cdt.ui/lineNumberRuler=true
+org.eclipse.cdt.ui/useQuickDiffPrefPage=true
+org.eclipse.cdt.ui/useAnnotationsPrefPage=true
+org.eclipse.cdt.ui/spelling_locale_initialized=true
+org.eclipse.cdt.ui/c_keyword_bold=false
+org.eclipse.cdt.ui/c_type=48,87,69
+org.eclipse.cdt.ui/semanticHighlighting.functionDeclaration.color=34,34,139
+org.eclipse.cdt.ui/semanticHighlighting.label.enabled=true
+org.eclipse.cdt.ui/semanticHighlighting.externalSDK.color=46,46,75
+org.eclipse.cdt.ui/c_string=47,44,64
+org.eclipse.cdt.ui/semanticHighlighting.staticMethod.color=40,72,32
+org.eclipse.cdt.ui/c_single_line_comment=39,39,194
+org.eclipse.cdt.ui/semanticHighlighting.macroSubstitution.color=34,55,18
+org.eclipse.cdt.ui/c_type_bold=false
+org.eclipse.cdt.ui/semanticHighlighting.method.enabled=true
+org.eclipse.cdt.ui/semanticHighlighting.enumerator.italic=false
+org.eclipse.cdt.ui/semanticHighlighting.globalVariable.italic=false
+org.eclipse.cdt.ui/semanticHighlighting.localVariableDeclaration.enabled=true
+org.eclipse.cdt.ui/semanticHighlighting.namespace.enabled=true
+org.eclipse.cdt.ui/semanticHighlighting.globalVariable.enabled=true
+org.eclipse.cdt.ui/semanticHighlighting.macroDefinition.color=43,43,89
+org.eclipse.cdt.ui/semanticHighlighting.enumerator.color=160,32,240
+org.eclipse.cdt.ui/properties.manage.config.disable=true
+org.eclipse.cdt.ui/semanticHighlighting.macroSubstitution.enabled=true
+org.eclipse.cdt.ui/c_keyword=130,21,21
+org.eclipse.cdt.ui/semanticHighlighting.function.color=43,43,89
+org.eclipse.cdt.ui/c_multi_line_comment=39,39,194
+org.eclipse.cdt.ui/semanticHighlighting.function.enabled=true
+org.eclipse.cdt.ui/semanticHighlighting.method.color=22,22,73
+org.eclipse.cdt.ui/semanticHighlighting.methodDeclaration.color=22,22,73
+org.eclipse.cdt.ui/pp_directive_bold=false
+org.eclipse.cdt.ui/semanticHighlighting.localVariableDeclaration.color=65,65,107
+org.eclipse.cdt.ui/semanticHighlighting.externalSDK.bold=false
+org.eclipse.cdt.ui/semanticHighlighting.macroDefinition.enabled=true
+org.eclipse.cdt.ui/semanticHighlighting.staticMethod.italic=false
+org.eclipse.cdt.ui/pp_directive=26,106,30
+org.eclipse.cdt.ui/eclipse.preferences.version=1
+org.eclipse.cdt.ui/editor_folding_enabled=true
+org.eclipse.cdt.ui/sourceHoverBackgroundColor.SystemDefault=false
+org.eclipse.cdt.ui/sourceHoverBackgroundColor=245,245,181
+
+# Help Browsing
+org.eclipse.help.base/always_external_browser=false
+
+# Proxy Settings
+org.eclipse.core.net/systemProxiesEnabled=false
+org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.core.net/nonProxiedHosts=localhost|127.0.0.1|192.168.129.*
+
+# Default text file encoding  
+#org.eclipse.core.resources/encoding=UTF-8 
+
+# Tizen Keybinding
+# org.eclipse.ui/KEY_CONFIGURATION_ID=org.eclipse.ui.slpAcceleratorConfiguration
+
+
index 27866a9..141d262 100644 (file)
@@ -1,41 +1,41 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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;
 
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 import org.tizen.nativecommon.build.ProjectTypeManager;
-import org.tizen.nativeplatform.build.CustomDebianProjectDependentBuilderOld;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 import org.tizen.nativeplatform.build.PlatformProjectDependentBuilder;
 import org.tizen.nativeplatform.build.PlatformProjectDependentPackager;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
 
 
 /**
@@ -44,10 +44,11 @@ import org.tizen.nativeplatform.build.PlatformProjectDependentPackager;
 public class Activator extends AbstractUIPlugin {
 
        // The plug-in ID
-       public static final String PLUGIN_ID = "org.tizen.nativeplatform"; //$NON-NLS-1$
+       public static final String PLUGIN_ID = "org.tizen.nativeplatform"; //$NON-NLS-1$        
 
        // The shared instance
        private static Activator plugin;
+       private IPreferenceStore prefStore;
        
        /**
         * The constructor
@@ -61,22 +62,15 @@ public class Activator extends AbstractUIPlugin {
         */
        public void start(BundleContext context) throws Exception {
                super.start(context);
-               plugin = this;
-               
-               ProjectTypeManager.registerProjectArtifactType(
-                               PlatformConfigurationManager.OLD_SLP_CUSTOM_DEBIAN_ARTIFACT_TYPE, 
-                               CustomDebianProjectDependentBuilderOld.getInstance(),
-                               PlatformProjectDependentPackager.getInstance(),
-                               false);
+               plugin = this;          
                
                ProjectTypeManager.registerProjectArtifactType(
-                               PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE, 
+                               PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE, 
                                PlatformProjectDependentBuilder.getInstance(),
                                PlatformProjectDependentPackager.getInstance(),
                                true);
                
-               //SLPProjectTypeManager.registerBuilder("SLP Custom Debian Package", CustomDebianProjectDependentBuilder.getInstance() );
-               //SLPProjectTypeManager.registerBuilder("SLP Inhouse Framework Package", InhouseFrameworkProjectDependentBuilder.getInstance() );
+               PreferencesManager.setDefaultValues();
        }
 
        /*
@@ -107,5 +101,12 @@ public class Activator extends AbstractUIPlugin {
        public static ImageDescriptor getImageDescriptor(String path) {
                return imageDescriptorFromPlugin(PLUGIN_ID, path);
        }
+       
+       /**
+        * @return the name of this plugin
+        */
+       public static String getPluginId() {
+               return getDefault().getBundle().getSymbolicName();
+       }
 }
 
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildCommandLauncher.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildCommandLauncher.java
new file mode 100644 (file)
index 0000000..24b7166
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * 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.build;
+
+import org.eclipse.cdt.core.CommandLauncher;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+
+import org.tizen.common.util.ProcessMonitorThread;
+import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
+import org.tizen.nativecommon.build.ProjectTypeManager;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+
+
+public class PlatformBuildCommandLauncher extends CommandLauncher {    
+       @Override
+       public Process execute(IPath commandPath, String[] args, String[] env,
+                       IPath changeToDirectory, IProgressMonitor monitor) throws CoreException {
+
+               Process proc = null;
+
+               if ( commandPath.toString().contains( "sbi-make") ) {
+                       IProject proj = getProject();
+                       CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(proj);
+                       SmartBuildInterface sbi = SmartBuildInterface.getInstance(proj);                
+                       
+                       String targetID = builder.getTargetID();                        
+                       String toolchainID = sbi.getToolchainIDFromTargetID(targetID);
+                       String rootstrapID = sbi.getRootstrapIDFromTargetID(targetID);                  
+
+                       try {
+                               if (!sbi.checkRootstrapID(rootstrapID) || !sbi.checkToolchainID(toolchainID)) {
+                                       String message = String.format(
+                                                       "Current build system does not support '%s' toolchain or '%s' rootstrap\n" +
+                                                       "Please select toolchain supported by current build system.",
+                                                       toolchainID, rootstrapID);
+                                       
+                                       throw new SBIException(message);
+                               }
+                               if (!sbi.checkTargetID(targetID)) {
+                                       sbi.writeTargetCfgFile(targetID);
+                               }                       
+                       } catch (SBIException e) {
+                               e.printStackTrace();
+                               e.showErrorDialog();
+                       }
+
+                       String options = args[0];
+                       for( int i = 1 ; i < args.length ; i++  ) {
+                               options = options + " " + args[i];
+                       }
+                       String cmd =  String.format( "%s action %s -- make -options=\"%s\"",  sbi.getSBICommandPath("sbi"),  targetID, options );
+
+                       // command parsing using SBI
+                       String[] cmds = sbi.parseCommandString( cmd );
+                       String[] newArgs = new String[ cmds.length - 1];
+                       for( int i = 0; i < cmds.length - 1; i ++ ) {
+                               newArgs[i]= cmds[i+1];
+                       }
+                       proc = super.execute( new Path(cmds[0]), newArgs, sbi.getEnvironmentVariables(), changeToDirectory, monitor);
+               } else {
+                       proc =  super.execute(commandPath, args, env, changeToDirectory, monitor);
+               }
+               
+               ProcessMonitorThread pmt = new ProcessMonitorThread(proc, monitor);
+               pmt.start();
+
+               return proc;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildPackageObjectAction.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformBuildPackageObjectAction.java
new file mode 100644 (file)
index 0000000..1779274
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * 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.build;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+
+import org.tizen.nativecommon.build.CommonBuildMessages;
+import org.tizen.nativecommon.build.CommonBuildPackageFile;
+
+public class PlatformBuildPackageObjectAction implements IWorkbenchWindowActionDelegate, IObjectActionDelegate {
+    protected IProject project;
+    protected IWorkbenchWindow window;
+    private boolean packagingResult = false;
+    private final String PKGTYPE = "RPM";
+
+    public PlatformBuildPackageObjectAction() {
+    }
+
+    public PlatformBuildPackageObjectAction(IProject project) {
+        this.project = project;
+    }
+
+    @Override
+    public void run(IAction action) {
+
+        CommonBuildPackageFile.setPackageType(project, PKGTYPE);
+        window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+        ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
+
+        try {
+                       dialog.run(true, true, new IRunnableWithProgress() {
+                           @Override
+                           public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                           InterruptedException {  
+                               IConfiguration config = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
+                               packagingResult = PlatformProjectPackaging.RPMPackaging(project, config, monitor);
+                           }
+                       });
+               } catch (InvocationTargetException e1) {
+                       e1.printStackTrace();
+               } catch (InterruptedException e1) {
+                       e1.printStackTrace();
+               }
+        
+        if (packagingResult) {
+               MessageDialog.openInformation(window.getShell(), CommonBuildMessages.BUILD_RESULT, 
+                               CommonBuildMessages.SUCCESS_TO_BUILD_PACKAGE);
+       } else {
+               MessageDialog.openError(window.getShell(), CommonBuildMessages.BUILD_RESULT, 
+                               CommonBuildMessages.FAIL_TO_BUILD_PACKAGE);
+       }
+
+        // refresh the project explorer
+        try {
+            project.refreshLocal(IResource.DEPTH_INFINITE, null );
+        } catch (CoreException e) {
+            e.printStackTrace();
+        }
+    }
+
+    protected File findFirstFilebyExtension(File searchPath, String ext) {
+        File[] allFiles = searchPath.listFiles(new ExtFilter(ext));
+        if (allFiles == null || allFiles.length == 0)
+            return null;
+        return allFiles[0];
+    }
+
+    protected class ExtFilter implements FilenameFilter {
+        protected String ext;
+
+        public ExtFilter(String ext) {
+            this.ext = ext;
+        }
+
+        public boolean accept(File dir, String name) {
+            return name.endsWith(ext);
+        }
+    }
+
+    @Override
+    public void selectionChanged(IAction action, ISelection selection) {
+        Object obj = null;
+
+        if (selection instanceof TreeSelection) {
+            TreeSelection _selection = (TreeSelection)selection;
+
+            if (_selection != null) {
+                obj = _selection.getFirstElement();
+            }
+        }
+
+        if (obj != null) {
+            if (obj instanceof IProject) {
+                project = (IProject) obj;
+            }
+        }
+    }
+
+    @Override
+    public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+        // do nothing
+    }
+
+    @Override
+    public void dispose() {
+        // do nothing
+    }
+
+    @Override
+    public void init(IWorkbenchWindow window) {
+        // do nothing
+    }
+}
+
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformCheckCancelJob.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformCheckCancelJob.java
new file mode 100644 (file)
index 0000000..608ebe0
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * 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.build;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.password.SudoPasswdManager;
+
+
+public class PlatformCheckCancelJob implements Runnable {
+       private IProgressMonitor monitor;
+       private String targetId;        
+    private SmartBuildInterface target_sbi;
+    private SmartBuildInterface command_sbi;
+    private boolean terminateChecker;
+    private boolean isFinished;    
+    private Process proc;
+      
+    public PlatformCheckCancelJob(IProgressMonitor _monitor, IProject proj, SmartBuildInterface target_sbi) {
+               this.target_sbi = target_sbi;
+               this.command_sbi = SmartBuildInterface.getInstance(proj);
+               this.monitor = _monitor;
+               this.proc = null;
+               IConfiguration cfg = ManagedBuildManager.getBuildInfo(proj).getDefaultConfiguration();           
+               this.targetId = PlatformConfigurationManager.getBuildTargetName(cfg);
+       }
+     
+     @Override
+     public void run() {
+        this.terminateChecker = false;
+        this.isFinished = false;
+
+        try {
+                while(!isFinished) {                    
+                               Thread.sleep(100);      
+                        if (monitor.isCanceled()) {
+                                try {
+                                        proc = target_sbi.getProcess();
+                                       
+                                       String passwd = SudoPasswdManager.getSudoPassword();
+                                       if (passwd == null) {
+                                               passwd = "";
+                                       }                                                                       
+                                       String pid = "";
+                                       try {
+                                               Field f = proc.getClass().getDeclaredField("pid");
+                                               f.setAccessible(true);
+                                               pid = f.get(proc).toString();                                                           
+                                       } catch (IllegalArgumentException e) {                                  
+                                               e.printStackTrace();
+                                       } catch (IllegalAccessException e) {                                    
+                                               e.printStackTrace();
+                                       } catch (SecurityException e) {                                 
+                                               e.printStackTrace();
+                                       } catch (NoSuchFieldException e) {                                      
+                                               e.printStackTrace();
+                                       }                               
+                                               
+                                               String option = String.format("-pid=%s -passwd=%s", pid, passwd);
+                                               command_sbi.actionReturnExitValue("kill", option, targetId, null);                              
+
+                                       proc.destroy();                                                 
+                                        
+                                } catch (SBIException e) {
+                                        setFinishFlag(true);
+                                        e.printStackTrace();
+                                }
+                                setFinishFlag(true);
+                        }
+                }
+        } catch (InterruptedException e1) {                    
+                       e1.printStackTrace();
+               }
+     }
+
+     public void setFinishFlag(boolean value) {
+        this.isFinished = value;
+     }
+}
\ No newline at end of file
index eaf3639..b43775d 100644 (file)
@@ -1,31 +1,30 @@
 /*
-* Native Platform
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.build;
 
 import java.util.ArrayList;
index 66360c7..aafdd51 100644 (file)
@@ -1,50 +1,42 @@
 /*
-* Native Platform
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.build;
 
 import java.util.ArrayList;
 
 import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.settings.model.ICResourceDescription;
 import org.eclipse.cdt.managedbuilder.core.BuildException;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IFileInfo;
-import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
-import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
+import org.eclipse.cdt.managedbuilder.core.IOption;
 import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.IToolChain;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
-import org.eclipse.cdt.managedbuilder.tcmodification.IFolderInfoModification;
-import org.eclipse.cdt.managedbuilder.tcmodification.IToolChainModificationManager;
-import org.eclipse.cdt.managedbuilder.tcmodification.IToolListModification;
-import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
+import org.eclipse.cdt.managedbuilder.internal.core.MultiConfiguration;
+import org.eclipse.cdt.managedbuilder.internal.core.Tool;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
 import org.tizen.nativecommon.build.CommonConfigurationManager;
@@ -52,51 +44,36 @@ import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.build.exception.SBIException;
 
 
-
-
 @SuppressWarnings("restriction")
 public class PlatformConfigurationManager extends CommonConfigurationManager
 {
        // ProjectInfo
        public static final String CURRENT_SLP_PROJECT_VERSION = "1.0.0";
-       public static final String TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE = "com.samsung.slp.nativeide.buildArtefactType.cdeb";
+       public static final String TIZEN_PLATFORM_ARTIFACT_TYPE = "org.tizen.nativeide.buildArtefactType.platform";     
        public static final String OLD_SLP_CUSTOM_DEBIAN_ARTIFACT_TYPE = "com.samsung.slp.project.custom.debian";
 
-       // SBI Compatibility
-       public static  final String SBI_PROJECT_TYPE_ID = "com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb";
-       public static  final String SBI_DEFAULT_I386_CONFIGRATION_ID = "com.samsung.slp.nativeide.config.sbi.gcc45sbox2.cdeb.emulator";
-       public static  final String SBI_DEFAULT_ARM_CONFIGRATION_ID = "com.samsung.slp.nativeide.config.sbi.gcc45sbox2.cdeb.device";
-       public static  final String SBI_DEFAULT_TARGET_NAME = "tizen-device-1.0.sb2_gcc45sbox2.armel.cdeb";
-       public static  final String SBI_ARM_TOOLCHAIN_NAME = "gcc45sbox2.armel.cdeb";
-       public static  final String SBI_ARM_SBOX2_TOOLCHAIN_NAME = "gcc45sbox2.armel.cdeb";
-       public static  final String SBI_ARM_ROOTSTRAP_NAME = "tizen-device-1.0.sb2";
-       public static  final String SBI_I386_TOOLCHAIN_NAME = "gcc45sbox2.i386.cdeb";
-       public static  final String SBI_I386_SBOX2_TOOLCHAIN_NAME = "gcc45sbox2.i386.cdeb";
-       public static  final String SBI_I386_ROOTSTRAP_NAME = "tizen-emulator-1.0.sb2";
-
+       // SBI Compatibility    
+       public static  final String SBI_PROJECT_TYPE_ID = "org.tizen.nativebuild.target.sbi.gcc45.platform";
+       public static  final String SBI_DEFAULT_I386_CONFIGRATION_ID = "org.tizen.nativeide.config.sbi.gcc45.platform.emulator";
+       public static  final String SBI_DEFAULT_ARM_CONFIGRATION_ID = "org.tizen.nativeide.config.sbi.gcc45.platform.device";
+       
+       static final String SBI_PLATFORM_CPP_COMPILER_TOOL_ID = "org.tizen.nativeide.tool.sbi.gnu.cpp.compiler.platform.base";
+       static final String SBI_PLATFORM_CPP_COMPILER_GBS_OPTION_ID = "sbi.gnu.cpp.compiler.option.gbs.platform";
+           
        // get compiler flags
        public static String getAllCFlags( IConfiguration config )
        {
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       return CustomDebianConfigurationOld.getAllCFlags(config);
-               }
-
-               return getAllCompilerFlags( config, SBI_BASE_C_COMPILER_TOOL_ID );      
-       }       
-
+               String c_compiler_id = SBI_BASE_C_COMPILER_TOOL_ID;
+               return getAllCompilerFlags( config, c_compiler_id );    
+       }
        
        public static String getAllCPPFlags( IConfiguration config ) 
        {
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       return CustomDebianConfigurationOld.getAllCPPFlags(config);
-               }
-
-               return getAllCompilerFlags( config, SBI_BASE_CPP_COMPILER_TOOL_ID );    
-       }       
-
-
+               String cpp_compiler_id = SBI_BASE_CPP_COMPILER_TOOL_ID;
+               return getAllCompilerFlags( config, cpp_compiler_id );  
+       }
+       
+       @SuppressWarnings("deprecation")
        protected static String getAllCompilerFlags( IConfiguration config, String compilerId ) {
                
                ITool compilerTool = config.getToolsBySuperClassId(compilerId)[0];              
@@ -124,178 +101,177 @@ public class PlatformConfigurationManager extends CommonConfigurationManager
                
                compilerFlags = compilerFlags.trim();
                return compilerFlags;
-       }       
-       
-       
-       
-       
-       protected static boolean isCPPProject( IConfiguration config )
-       {
-               try {
-                       IProject project = (IProject)config.getOwner();
-
-                       if ( project.hasNature(  CCProjectNature.CC_NATURE_ID ) ) 
-                               return true;
-               } catch (CoreException e1) {
-                       e1.printStackTrace();
-               }
-
-               return false;
        }
        
-       
-       
-       public static void changeToolchain( IConfiguration config, ICResourceDescription cfgd, String toolchainNameInCfg) {              
-               // TODO: should be removed
-               if ( isOldConfiguration(config) ) {
-                       CustomDebianConfigurationOld.changeToolchain(config, cfgd, toolchainNameInCfg );
+       public static void setGBSOptions(  IConfiguration config, Tool tool, ArrayList<String> optionList  ) 
+       {               
+               String tool_id = tool.getBaseId();
+               String option_id = "";
+               
+               if (tool_id.contains(SBI_PLATFORM_CPP_COMPILER_TOOL_ID)) {
+                       option_id = SBI_PLATFORM_CPP_COMPILER_GBS_OPTION_ID;
+               } else {
                        return;
                }
-
-               IToolChainModificationManager tcmmgr = ManagedBuildManager.getToolChainModificationManager();
-               IToolChain[] r_tcs = ManagedBuildManager.getRealToolChains();
-               IToolChain[] v_tcs;
                
-               IResourceInfo ri = config.getResourceInfo(cfgd.getPath(), false);
-               IToolListModification mod;
-               
-               if (ri instanceof IFolderInfo) {
-                       mod = tcmmgr.createModification((IFolderInfo)ri);
+               ITool cpp_linkerTool =config.getToolsBySuperClassId(tool_id)[0];
+               IOption dynamicAnalysisOption = cpp_linkerTool.getOptionBySuperClassId(option_id);
+               ManagedBuildManager.setOption( config, cpp_linkerTool, dynamicAnalysisOption, optionList.toArray( new String[0] ));     
+       }
+       
+       public static void setGBSOptions( IConfiguration config, ArrayList<String> optionList ) {
+               if (config instanceof MultiConfiguration) {                     
+                       Object o[] = ((MultiConfiguration) config).getItems();
+                       for (IConfiguration c : (IConfiguration[])o) {
+                               internalSetGBSOptions(c, optionList);
+                       }
                } else {
-                       mod =  tcmmgr.createModification((IFileInfo)ri);
-               }               
-               
-               IToolChain realToolChain = null;
-               if (ri instanceof IFolderInfo) {
-                       IToolChain toolChainInstance = ((IFolderInfoModification)mod).getToolChain();
-                       realToolChain = ManagedBuildManager.getRealToolChain(toolChainInstance);
-                       if (realToolChain==null)
-                               realToolChain = toolChainInstance;
+                       internalSetGBSOptions(config, optionList);
                }
-               
-               boolean isMng = config.getBuilder().isManagedBuildOn();
-               ArrayList<IToolChain> list = new ArrayList<IToolChain>();
-
-               IToolChain[] tcs = r_tcs;
-               IFolderInfoModification fim = (IFolderInfoModification)mod;
-               tcs = fim.getCompatibleToolChains();            
-               IToolChain[] tcs1 = new IToolChain[tcs.length + 1];
-               System.arraycopy(tcs, 0, tcs1, 0, tcs.length);
-               tcs1[tcs.length] = realToolChain; // add existing toolchain
-               tcs = tcs1;             
+       }
+       
+       private static void internalSetGBSOptions( IConfiguration config, ArrayList<String> optionList )
+       {
+               String cpp_compiler_id = SBI_PLATFORM_CPP_COMPILER_TOOL_ID;
+               String option_id = SBI_PLATFORM_CPP_COMPILER_GBS_OPTION_ID;
 
-               for (IToolChain tc : tcs) {
-                       if ( tc.isSystemObject() && !(((ToolChain)tc).isPreferenceToolChain() && !isMng) ) {
-                               // NO TOOLCHAIN
-                               continue;
+               // cpp compiler
+               ITool tool =config.getToolsBySuperClassId(cpp_compiler_id)[0];
+               IOption gbsOption = tool.getOptionBySuperClassId(option_id);
+               ManagedBuildManager.setOption( config, tool, gbsOption, optionList.toArray( new String[0] ));
+       }
+       
+       public static void addGBSOptions(IConfiguration config, String newOption)
+       {                       
+               if (config instanceof MultiConfiguration) {                     
+                       Object o[] = ((MultiConfiguration) config).getItems();
+                       for (IConfiguration c : (IConfiguration[])o) {
+                               internalAddGBSOption(c, newOption);
                        }
-                       list.add(tc);
+               } else {
+                       internalAddGBSOption(config, newOption);
                }
-               
-               v_tcs = list.toArray(new IToolChain[list.size()]);
-               int x = 0;              
-               IFolderInfoModification foim = (IFolderInfoModification)mod;            
+       }
        
-               for (int i = 0 ; i < v_tcs.length ; i++) {
-                       if (v_tcs[i].getName().equals(toolchainNameInCfg)) {
-                               x = i;
-                               break;
+       private static void internalAddGBSOption(IConfiguration config, String newOption) {
+               String cpp_compiler_id = SBI_PLATFORM_CPP_COMPILER_TOOL_ID;
+               String option_id = SBI_PLATFORM_CPP_COMPILER_GBS_OPTION_ID;
+               
+               // cpp compiler
+               ITool tool =config.getToolsBySuperClassId(cpp_compiler_id)[0];
+               IOption gbsOption = tool.getOptionBySuperClassId(option_id);
+               ArrayList<String> oldOptions = getGBSOptions(config);
+               
+               for(String op : oldOptions) {
+                       if (newOption.equals(op)) {
+                               return;
                        }
                }
                
-               IToolChain tc = v_tcs[x];
-               if (tc == null) return;
-               
-                               
-               foim.setToolChain(tc);
-                               
-               try {
-                       mod.apply();
-               } catch (CoreException e) {
-                       ManagedBuilderUIPlugin.log(e);
-               }               
+               oldOptions.add(newOption);
+               ManagedBuildManager.setOption( config, tool, gbsOption, oldOptions.toArray( new String[0] ));
        }
-
        
-       public static String updateBuildTargetConfiguration( IConfiguration config ) throws SBIException {
-
-               // get target name
-               String targetID = getBuildTargetName( config );
-
-               // if targetID is null, set default target name
-               if ( targetID == null ) {
-                       targetID = SBI_DEFAULT_TARGET_NAME;
-               }
-
-               SmartBuildInterface sbi = SmartBuildInterface.getInstance();
-
-               // if target exist , just return
-               if ( sbi.checkTargetID(targetID)) {
-                       return targetID;
-               }
-
-               String rootstrapID = sbi.getRootstrapIDFromTargetID(targetID);
-               String toolchainID = sbi.getToolchainIDFromTargetID(targetID);
        
-               // check rootstrap name
-               if ( !sbi.checkRootstrapID(rootstrapID) ) {
-                       // set default
-                       if ( config.getName().contains(SBI_DEVICE_CONFIG_SUFFIX) ) {
-                               rootstrapID = SBI_ARM_ROOTSTRAP_NAME;
-                       } else {
-                               rootstrapID = SBI_I386_ROOTSTRAP_NAME;
+       public static void removeGBSOptions( IConfiguration config, String option )
+       {
+               if (config instanceof MultiConfiguration) {                     
+                       Object o[] = ((MultiConfiguration) config).getItems();
+                       for (IConfiguration c : (IConfiguration[])o) {
+                               internalRemoveGBSOption(c, option);
                        }
+               } else {
+                       internalRemoveGBSOption(config, option);
                }
+       }
+       
+       private static void internalRemoveGBSOption(IConfiguration config, String option) {
+               String cpp_compiler_id = SBI_PLATFORM_CPP_COMPILER_TOOL_ID;
+               String option_id = SBI_PLATFORM_CPP_COMPILER_GBS_OPTION_ID;
 
-               // check toolchain name
-               if ( !sbi.checkToolchainID(toolchainID) ) {
-                       // change "gcc-4.5.3-i386.sb2" , "gcc-4.5-i386.cdeb.sb2"
-                       if ( ( toolchainID.equals("gcc-4.5.3-i386.sb2") || toolchainID.equals("gcc-4.5-i386.cdeb.sb2") ) && 
-                                       sbi.checkToolchainID( SBI_I386_SBOX2_TOOLCHAIN_NAME ) ) {
-                               toolchainID = SBI_I386_SBOX2_TOOLCHAIN_NAME;
-                       } 
-                       // change "gcc-4.5.3-armel.sb2" , "gcc-4.5-armel.cdeb.sb2"
-                       else if ( ( toolchainID.equals("gcc-4.5.3-armel.sb2") || toolchainID.equals("gcc-4.5-armel.cdeb.sb2") )  &&
-                                       sbi.checkToolchainID( SBI_ARM_SBOX2_TOOLCHAIN_NAME ) ) {
-                               toolchainID = SBI_ARM_SBOX2_TOOLCHAIN_NAME;
+               // cpp compiler
+               ITool tool =config.getToolsBySuperClassId(cpp_compiler_id)[0];
+               IOption gbsOption = tool.getOptionBySuperClassId(option_id);
+               ArrayList<String> oldOptions = getGBSOptions(config);
+               ArrayList<String> newOptions = new ArrayList<String>();
+               String removeKey = option.split("=")[0];
+               for(String op : oldOptions) {
+                       String key = op.split("=")[0];
+                       if (removeKey.equals(key)) {
+                               continue;
                        } else {
-                               // set default
-                               if ( config.getName().contains(SBI_DEVICE_CONFIG_SUFFIX)  ) {
-                                       toolchainID = SBI_ARM_TOOLCHAIN_NAME;
-                               } else {
-                                       toolchainID = SBI_I386_TOOLCHAIN_NAME;
-                               }
+                               newOptions.add(op);
                        }
                }
+               
+               ManagedBuildManager.setOption( config, tool, gbsOption, newOptions.toArray( new String[0] ));
+       }
+       
+       public static void replaceGBSOptions( IConfiguration config, String option )
+       {
+               removeGBSOptions(config, option);
+               addGBSOptions(config, option);
+       }
+       
+       public static ArrayList<String> getGBSOptions( IConfiguration config )
+       {
+               String cpp_compiler_id = SBI_PLATFORM_CPP_COMPILER_TOOL_ID;
+               String option_id = SBI_PLATFORM_CPP_COMPILER_GBS_OPTION_ID;     
+
+               ArrayList<String> flags = new ArrayList<String>();
 
-               // create target name && update configuration
-               targetID = sbi.makeTargetID( rootstrapID, toolchainID );
-               setBuildTargetName(config, targetID);
+               // c compiler
+               ITool tool =config.getToolsBySuperClassId(cpp_compiler_id)[0];
+               IOption gbsOption = tool.getOptionBySuperClassId(option_id);
                
-               // if target exist, create
-               if ( !sbi.checkTargetID(targetID)) {
-                       sbi.writeTargetCfgFile(targetID);
+               
+               try {
+                       for ( String f: gbsOption.getStringListValue() ) {
+                               flags.add( f );
+                       }
+               } catch (BuildException e) {
+                       e.printStackTrace();
                }
 
-               return targetID;
+               return flags;
        }
        
+       protected static boolean isCPPProject( IConfiguration config )
+       {
+               try {
+                       IProject project = (IProject)config.getOwner();
 
+                       if ( project.hasNature(  CCProjectNature.CC_NATURE_ID ) ) 
+                               return true;
+               } catch (CoreException e1) {
+                       e1.printStackTrace();
+               }
+
+               return false;
+       }
+       
+       public static void changeToolchain(IConfiguration config, String targetId) {            
+               setBuildTargetName(config, targetId);           
+               setToolCommand(config);
+       }
        
        public static String getRootstrapPath( IConfiguration config ) {
                
                try {
-                       
-                       // if not exist, update target configuration
-                       String targetID = updateBuildTargetConfiguration( config );
-
-                       // return rootstrap
+                       String targetID = getBuildTargetName(config);                   
+                       if (targetID == null) {
+                               targetID = getDefaultBuildTargetName(config);
+                       }
                        SmartBuildInterface sbi = SmartBuildInterface.getInstance();
-                       return sbi.getRootstrapPath(targetID);
-                       
+                       String path = sbi.getRootstrapPath(targetID);
+                       if (path == null) {
+                               return "";
+                       } else {
+                               return sbi.getRootstrapPath(targetID);
+                       }                       
                } catch (SBIException e) {
                        e.printStackTrace();
                        return "/";
                }
-       }       
+       }
 }
index 2276e20..ace14f7 100644 (file)
@@ -1,31 +1,30 @@
 /*
-* Native Platform
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.build;
 import org.eclipse.cdt.managedbuilder.core.IBuilder;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@@ -51,15 +50,6 @@ public class PlatformMakeGenerator implements IManagedBuilderMakefileGenerator2
        private IProject project;
        private IPath topBuildDir;      
        private IConfiguration config;
-       
-       public final static String SBI_MESSAGE_NEED_PROJECT_CONVERSION = 
-                       "Old project type detected!\nPlease upgrade your project.\n" +
-                       " 1. Open the popup-menu by clicking right mouse button on your project\n" +
-                       " 2. Select \"Convert To...\" menu item to open a project converter dialog.\n" + 
-                       " 3. Select \"Upgrade Tizen .....\" item on the dialog.\n" +
-                       " 4. Check if all project options are set correctly.\n" + 
-                       "     (Some options may not be transferred automatically)";
-
 
        @Override
        public void generateDependencies() throws CoreException {
@@ -68,21 +58,8 @@ public class PlatformMakeGenerator implements IManagedBuilderMakefileGenerator2
 
        @Override
        public MultiStatus generateMakefiles(IResourceDelta delta)
-                       throws CoreException {
-
-               if (  PlatformConfigurationManager.isOldConfiguration( config ) ) {
-                       
-                       //SBIException ex =  new SBIException(SLPApplicationProjectConverter.SBI_MESSAGE_NEED_PROJECT_CONVERSION);
-                       SBIException ex =  new SBIException(SBI_MESSAGE_NEED_PROJECT_CONVERSION);
-                       ex.showErrorDialog();
-                       
-                       throw new CoreException( new MultiStatus(
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       IStatus.ERROR,
-                                       new String(String.format("Build failed! Please upgrade project!" )),
-                                       null) );
-               }
-
+                       throws CoreException {          
+               
                // if Makefile does not  exist, regenerate "Makefile"
                IFolder configDir = project.getFolder( config.getName() );
                if ( !configDir.exists() ) 
@@ -130,20 +107,7 @@ public class PlatformMakeGenerator implements IManagedBuilderMakefileGenerator2
        }
 
        @Override
-       public MultiStatus regenerateMakefiles() throws CoreException {
-               
-               if ( PlatformConfigurationManager.isOldConfiguration( config ) ) {
-                       
-                       //SBIException ex =  new SBIException(SLPApplicationProjectConverter.SBI_MESSAGE_NEED_PROJECT_CONVERSION);
-                       SBIException ex =  new SBIException(SBI_MESSAGE_NEED_PROJECT_CONVERSION);
-                       ex.showErrorDialog();
-       
-                       throw new CoreException( new MultiStatus(
-                                       ManagedBuilderCorePlugin.getUniqueIdentifier(),
-                                       IStatus.ERROR,
-                                       new String(String.format("Build failed! Please upgrade project!" )),
-                                       null) );
-               }
+       public MultiStatus regenerateMakefiles() throws CoreException {         
 
                // Check topdir folder exist
                topBuildDir = createDirectory(config.getName());
index 819f040..7024520 100644 (file)
@@ -1,31 +1,30 @@
 /*
-* Native Platform
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.build;
 
 import org.eclipse.cdt.core.model.CoreModel;
@@ -89,7 +88,8 @@ public class PlatformProjectConverter implements IConvertManagedBuildObject {
                        }
                        
                        Configuration newConfig = createNewConfiguration( config , toId );
-                       String newTargetName = getNewBuildTargetName( config , toId );
+                       //String newTargetName = getNewBuildTargetName( config , toId );
+                       String newTargetName = PlatformConfigurationManager.getBuildTargetName(config);
                                
                                // target name
                                        if (!sbi.checkTargetID(newTargetName)) {                                        
@@ -131,9 +131,9 @@ public class PlatformProjectConverter implements IConvertManagedBuildObject {
                
                Configuration parentConfig = null;
                if ( toId.equals(PlatformConfigurationManager.SBI_PROJECT_TYPE_ID) ) {
-                       if ( config.getParent().getId().contains("custom.debian.emulator") ) {
+                       if ( config.getParent().getId().contains("emulator") ) {
                                parentConfig =  (Configuration)ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_I386_CONFIGRATION_ID );
-                       } else if ( config.getParent().getId().contains("custom.debian.device") ) {
+                       } else if ( config.getParent().getId().contains("device") ) {
                                parentConfig = (Configuration) ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_ARM_CONFIGRATION_ID );
                        } else {
                                parentConfig =  (Configuration)ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_ARM_CONFIGRATION_ID );
@@ -157,7 +157,7 @@ public class PlatformProjectConverter implements IConvertManagedBuildObject {
                return newConfig;
        }
 
-       
+       /*
        protected String getNewBuildTargetName( IConfiguration config , String toId ) {
                String newTargetName = null;
                
@@ -179,5 +179,6 @@ public class PlatformProjectConverter implements IConvertManagedBuildObject {
                
                return newTargetName;
        }
+       */ 
 
 }
index bf5ce7a..171f674 100644 (file)
@@ -1,38 +1,39 @@
 /*
-* Native Platform
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.build;
 
-import org.eclipse.cdt.core.settings.model.ICResourceDescription;
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Path;
 import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
 import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.password.SudoPasswdManager;
+
 
 
 public class PlatformProjectDependentBuilder extends CommonProjectDependentBuilder {
@@ -95,20 +96,52 @@ public class PlatformProjectDependentBuilder extends CommonProjectDependentBuild
 
        @Override
        protected String getDebugOption(String[] arrOption) {
-               String gdbOptions = "-gdb-options=\'";
-               for (int i = 0 ; i < arrOption.length ; i++) {
-                       gdbOptions = gdbOptions.concat(arrOption[i] + " ");
-               }
-               gdbOptions = gdbOptions.concat("\' ");
+               String options = "";
                
-               String sysroot="";
-               try {
-                       sysroot = String.format("-sysroot=%s", getSbi().getRootstrapPath(getTargetID()) );
-               } catch (SBIException e) {
-                       e.printStackTrace();
-               }
+               String targetId = getTargetID();                
                
-               return gdbOptions + sysroot;
+               if (targetId.contains("obs")) {
+                       String passwd = SudoPasswdManager.getSudoPassword();
+                       options = String.format("-passwd=%s -gdb-options=\'", passwd);
+                       String path = "";
+                       try {
+                               path = new Path(getSbi().getRootstrapPath(getTargetID())).makeAbsolute().toOSString();
+                       } catch (SBIException e) {
+                               e.printStackTrace();
+                       }
+                       String rootstrapPath = getSbi().getPlatformRootstrapPath(path);
+                       for (int i = 0 ; i < arrOption.length ; i++) {
+                               if (arrOption[i] == null) {
+                                       break;
+                               } else if (arrOption[i].startsWith("--cd")) {
+                                       continue;
+                               } else if (arrOption[i].contains(rootstrapPath)) {
+                                       String op = arrOption[i].replaceAll(rootstrapPath, "");
+                                       options = options.concat(op + " ");
+                               } else {
+                                       options = options.concat(arrOption[i] + " ");                           
+                               }
+                       }                       
+                       options = String.format("-rootpath=%s ", rootstrapPath).concat(options); 
+                       options = options.concat("\' ");                        
+                       return options;
+                       
+               } else {
+                       options = "-gdb-options=\'";
+                       for (int i = 0 ; i < arrOption.length ; i++) {
+                               options = options.concat(arrOption[i] + " ");
+                       }
+                       options = options.concat("\' ");
+            String sysroot="";
+            String rootstrapPath = "";
+            try {
+               rootstrapPath = getSbi().getRootstrapPath(getTargetID());
+               sysroot = String.format("-sysroot=%s", rootstrapPath );
+                       } catch (SBIException e) {
+                               e.printStackTrace();
+                       }
+                       return options.concat(sysroot);
+               }
        }
 
        @Override
@@ -117,14 +150,12 @@ public class PlatformProjectDependentBuilder extends CommonProjectDependentBuild
        }
 
        @Override
-       public void setToolCommand(IConfiguration config, String rootstrapCfgName) {
-               PlatformConfigurationManager.setToolCommand(config, rootstrapCfgName);          
+       public void setToolCommand(IConfiguration config) {
+               PlatformConfigurationManager.setToolCommand(config);            
        }
 
        @Override
-       public void changeToolchain(IConfiguration config,
-                       ICResourceDescription cfgd, String toolchainNameInCfg) {
-               PlatformConfigurationManager.changeToolchain(config, cfgd, toolchainNameInCfg);         
+       public void changeToolchain(IConfiguration config, String targetId) {
+               PlatformConfigurationManager.changeToolchain(config, targetId);         
        }
-
 }
index fb248c3..e2c814c 100644 (file)
@@ -1,38 +1,43 @@
 /*
-* Native Platform
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.build;
 
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
 import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
 import org.tizen.nativecommon.build.CommonProjectDependentPackager;
+import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.password.SudoPasswdManager;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 
 
 public class PlatformProjectDependentPackager extends CommonProjectDependentPackager {
@@ -56,77 +61,129 @@ public class PlatformProjectDependentPackager extends CommonProjectDependentPack
                super(project);
        }
 
-       @Override
-       public String getPackageOption() {
-               String workingDir = getWorkingDir();
-
-               String options = String.format(
-                               "-WORKING_DIR=%s",
-                               workingDir );
 
-               return options;
-       }
-       
        @Override
-       public String getPackageOption(IConfiguration config) {
+       public String getPackageOption(IConfiguration config, String pkgType) {
                String workingDir = getWorkingDir(config);
+               String options = "";
+               String passwd = SudoPasswdManager.getSudoPassword();
+               if (passwd == null) {
+                       return null;
+               }
 
-               String options = String.format(
-                               "-WORKING_DIR=%s",
-                               workingDir );
+               if (RPM.equals(pkgType)) {                              
+                       options = String.format(
+                                       "-PASSWD=%s " +
+                                       "-WORKING_DIR=%s " +
+                                       "-PKG_TYPE=%s" ,
+                                       passwd,
+                                       workingDir,
+                                       pkgType );
+               } else {
+                       options = String.format(                                        
+                                       "-WORKING_DIR=%s " +
+                                       "-PKG_TYPE=%s" ,                                        
+                                       workingDir,
+                                       pkgType );
+               }
 
                return options;
        }
        
-       public void buildPackage() throws SBIException {
+       public String getPackageOption(IConfiguration config, PlatformRootstrap rootstrap) {
+               String workingDir = getWorkingDir(config);      
+               String passwd = SudoPasswdManager.getSudoPassword();            
+               String snapshots = "";
+               for (String s : rootstrap.getRepositoryURLs()) {
+                       snapshots =  snapshots + " " + s;
+               }
                
-               String targetID = getTargetID();
-               String projectDir = getProjectPath();
-               String options = getPackageOption();                            
+               String gbsOptions = "";
+               for(String op : PlatformConfigurationManager.getGBSOptions(config)) {
+                       gbsOptions = gbsOptions + " " + op;
+               }
                
-               sbi.actionConsole("buildpackage", options, targetID, projectDir, "Packaging" ); 
-       }
-       
-       
-       public void buildPackage(String configName) throws SBIException {
+               gbsOptions = gbsOptions.trim();         
+               
+               String options = String.format(
+                               "-PASSWD=%s " +
+                               "-WORKING_DIR=%s " +
+                               "-SNAPSHOTS=\"%s\" " + 
+                               "-OPTIONS=\"%s\" ",
+                               passwd,
+                               workingDir,             
+                               snapshots.trim(),
+                               gbsOptions
+                               );                      
                
+               return options;
+       }
+
+       public void buildPackage(String pkgType) throws SBIException {
+       IConfiguration config = getCurrentConfiguration();
+
+       buildPackage(config, pkgType);
+       }
+
+
+       public void buildPackage(String configName, String pkgType) throws SBIException {
                IConfiguration[] configurations = ManagedBuildManager.getBuildInfo(project).getManagedProject().getConfigurations();
                IConfiguration config = null;
-               
+
                for (IConfiguration c : configurations) {
                        if (c.getName().equals(configName) ) {
                                config = c;
                                break;
                        }
-               }
-               
-               String targetID = getTargetID(config);
-               String projectDir = getProjectPath();
-               String options = getPackageOption(config);
+               }       
 
-               sbi.actionConsole("buildpackage", options, targetID, projectDir, "Packaging" ); 
+       buildPackage(config, pkgType);
        }
+
        
-       public void buildPackageDependencyCheck() throws SBIException {         
+    // command "build package" from specified configuration and pkgType
+    private  void buildPackage(IConfiguration config, String pkgType) throws SBIException {
+        String targetId = getTargetID(config);
+        String projectDir = getProjectPath();
+               String rootId = sbi.getRootstrapIDFromTargetID(targetId);
+               PlatformRootstrap rt = RootstrapManager.getRootstrap(rootId);
                
-               String targetID = getTargetID();
+               String options = getPackageOption(config, rt);
+        
+        if (options == null) {
+               return;
+        }
+        
+        String[] new_envs = 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);
+                       new_envs = sbi.addEnvironmentVariableArray(envKey, envValue);
+               } 
+               sbi.actionConsole("buildpackage", options, targetId, projectDir, new_envs, "Packaging" ); //$NON-NLS-1$ //$NON-NLS-2$           
+    }
+
+       
+       public void buildPackageDependencyCheck() throws SBIException {
+
+       IConfiguration config = getCurrentConfiguration();
+               String targetID = getTargetID(config);
                String projectDir = getProjectPath();
                String options = getPackageDependencyCheckOption();
-               
-               sbi.actionConsole("checkbuilddeps", options, targetID, projectDir, "Packaging" ); 
-       }
 
-       @Override
-       public String getTargetID() {
-               IConfiguration config = getConfiguration();
-               return PlatformConfigurationManager.getBuildTargetName(config);
+               sbi.actionConsole("checkbuilddeps", options, targetID, projectDir, "Packaging" );
        }
-       
+
+
        @Override
-       public String getTargetID(IConfiguration config) {              
+       public String getTargetID(IConfiguration config) {
                return PlatformConfigurationManager.getBuildTargetName(config);
        }
-       
+
        @Override
        public boolean isDependencyCheckSuppoted() {
                return true;
@@ -135,7 +192,7 @@ public class PlatformProjectDependentPackager extends CommonProjectDependentPack
        @Override
        protected String getPackageDependencyCheckOption() {
                return "";
-       }       
+       }
 
        @Override
        public boolean isPackageCheckSuppoted() {
@@ -143,7 +200,19 @@ public class PlatformProjectDependentPackager extends CommonProjectDependentPack
        }
 
        @Override
-       public boolean checkPackageFile() {     
+       public boolean checkPackageFile(String pkgType) {
                return false;
        }
+
+    @Override
+    public void buildPackage(String configName, String pkgType, boolean signApp)
+            throws SBIException, CoreException {
+        buildPackage(configName, pkgType);
+    }
+
+    @Override
+    public void buildPackage(String pkgType, boolean signApp)
+            throws SBIException, CoreException {
+        buildPackage(pkgType);
+    }
 }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectPackaging.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectPackaging.java
new file mode 100644 (file)
index 0000000..c421341
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * 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.build;
+
+import java.util.ArrayList;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.tizen.nativecommon.build.CommonBuildMessages;
+import org.tizen.nativecommon.build.CommonProjectDependentPackager;
+import org.tizen.nativecommon.build.ProjectTypeManager;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.Activator;
+import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+
+public class PlatformProjectPackaging {
+       public static boolean RPMPackaging(final IProject targetProj, IConfiguration config, IProgressMonitor monitor) {
+               String PKGTYPE = "RPM";
+        monitor.beginTask("Packaging", 1);
+
+        CommonProjectDependentPackager packager = ProjectTypeManager.getProjectPackagerInstance(targetProj);
+        PlatformCheckCancelJob cancelJob = new PlatformCheckCancelJob(monitor, targetProj, packager.getSbi());
+        Thread checkCancelThread = new Thread(cancelJob);
+        checkCancelThread.start();
+
+        try {
+            monitor.subTask("Packaging " + targetProj.getName());
+            packager.buildPackage(PKGTYPE);
+        } catch (SBIException e) {
+            e.printStackTrace();
+            cancelJob.setFinishFlag(true);
+            monitor.done();
+            return false;
+        } catch (CoreException e) {
+            cancelJob.setFinishFlag(true);
+            monitor.done();
+            return false;
+        }
+
+        cancelJob.setFinishFlag(true);
+        monitor.done();
+        
+       PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+       ArrayList<LocalPackage> pkgfiles = launchUtils.getProjectPackages(targetProj, config.getName());
+
+       try {
+               targetProj.refreshLocal(IResource.DEPTH_INFINITE, null );
+        } catch (CoreException e) {
+            e.printStackTrace();
+        }
+       
+       return !pkgfiles.isEmpty();
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/ui/GBSBuildConfigurationTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/ui/GBSBuildConfigurationTab.java
new file mode 100644 (file)
index 0000000..51ff10c
--- /dev/null
@@ -0,0 +1,461 @@
+/*
+ * 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.build.ui;
+
+
+import java.util.ArrayList;
+
+import org.eclipse.cdt.core.settings.model.ICResourceDescription;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.internal.core.MultiConfiguration;
+import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
+import org.eclipse.cdt.ui.newui.ICPropertyProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.Label;
+import org.eclipse.swt.widgets.Text;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.gbs.GBSOption;
+import org.tizen.nativeplatform.gbs.GBSOptionManager;
+
+@SuppressWarnings("restriction")
+public class GBSBuildConfigurationTab extends AbstractCBuildPropertyTab {
+       protected boolean checked;
+       private Button option_clean;
+       private Button option_ccache;
+       private Button option_overwrite;
+       private Button option_includeall;
+       private Button option_skipRepos;
+       private Button option_noConfigure;
+       private Button option_commit;
+       private Button option_extraPacks;
+       private Button option_threads;
+       private Button option_exclude;
+       private Button option_keepPacks;
+       private Button option_noinit;
+       private Button option_incremental;
+       private Text text_extraPacks;
+       private Text text_exclude;
+       private Text text_threads;
+       private Text text_commit;       
+
+       private final String EMPTY_STRING = "";
+       private final String PREFIX_DESC = ": ";
+       private final String ERROR_LABEL = "Check if GBS(>= %s) is installed."; 
+       
+       private String[] avaiableOptions = {
+                       "--clean",
+                       "--ccache",
+                       "--overwrite",
+                       "--include-all",
+                       "--skip-conf-repos",
+                       "--no-configure",
+                       "--threads",
+                       "--commit",
+                       "--exclude",
+                       "--extra-packs",                        
+                       "--keep-packs",                 
+                       "--noinit",                     
+                       "--incremental"                 
+               };
+       
+       private boolean[] checkOptions = {
+                       false,
+                       false,
+                       false,
+                       false,
+                       false,
+                       false,
+                       false,
+                       false,
+                       false,
+                       false,
+                       false,
+                       false,
+                       false
+       };
+       
+       private Button[] buttons = {
+                       option_clean, 
+                       option_ccache, 
+                       option_overwrite, 
+                       option_includeall,
+                       option_skipRepos,
+                       option_noConfigure,
+                       option_threads,
+                       option_commit,
+                       option_exclude,
+                       option_extraPacks,
+                       option_keepPacks,
+                       option_noinit,
+                       option_incremental
+                       
+               };
+       
+       private Text[] texts = {
+                       null,
+                       null,
+                       null,
+                       null,
+                       null,
+                       null,
+                       text_threads,
+                       text_commit,
+                       text_exclude,
+                       text_extraPacks,
+                       null,
+                       null,
+                       null                    
+               };
+       
+       public void createControls(Composite _parent, ICPropertyProvider _provider) {
+               page = _provider;
+               if (canBeVisible()) {
+                       createControls(_parent);
+               }
+       }
+
+       @Override
+       protected void createControls(Composite parent) {
+               super.createControls(parent);
+               usercomp.setLayout(new GridLayout(1, false));
+               
+               if (!GBSOptionManager.isInitialized()) {
+                       GBSOptionManager.initOptions();
+               }
+               
+               if (GBSOptionManager.getOptions().isEmpty()) {
+                       createErrorComposite(usercomp);
+                       return;
+               }
+               
+               Composite composite = new Composite(usercomp, SWT.NONE);
+               GridLayout gridLayout = new GridLayout(2,false);
+               gridLayout.marginBottom = 0;
+               gridLayout.marginTop = 0;
+               gridLayout.marginLeft = 0;
+               gridLayout.marginRight = 0;
+               GridData gd = new GridData(GridData.BEGINNING, GridData.FILL, false, false);            
+               gd.widthHint = 800;
+               composite.setLayout(gridLayout);
+               composite.setLayoutData(gd);
+               
+               createCleanOption(composite, 0);
+               createCcacheOption(composite, 1);
+               createOverwriteOption(composite, 2);
+               createIncludeAllOption(composite, 3);
+               createSkipReposOption(composite, 4);
+               createNoConfigureOption(composite, 5);
+               createThreadsOption(composite, 6);
+               createCommitOption(composite, 7);
+               createExcludeOption(composite, 8);
+               createExtraPacksOption(composite, 9);           
+               createKeepPacksOption(composite, 10);           
+               createNoInitOption(composite, 11);              
+               createIncrementalOption(composite, 12);         
+       }
+       
+       private void createErrorComposite(Composite parent) {
+               Composite composite = new Composite(usercomp, SWT.NONE);
+               GridLayout gridLayout = new GridLayout(1,false);
+               gridLayout.marginBottom = 0;
+               gridLayout.marginTop = 0;
+               gridLayout.marginLeft = 0;
+               gridLayout.marginRight = 0;
+               GridData gd = new GridData(GridData.BEGINNING, GridData.FILL, false, false);            
+               gd.widthHint = 800;
+               composite.setLayout(gridLayout);
+               composite.setLayoutData(gd);
+               
+               Label errorLabel = new Label(composite, SWT.NONE);
+               errorLabel.setText(String.format(ERROR_LABEL, Double.toString(GBSOptionManager.MIN_GBS_VERSION)));
+       }
+       
+       private void createCcacheOption(Composite parent, int index) {
+               createOption(parent, index);
+       }
+       
+       private void createCleanOption(Composite parent, int index) {
+               createOption(parent, index);
+       }
+       
+       private void createOverwriteOption(Composite parent, int index) {
+               createOption(parent, index);
+       }
+       
+       private void createIncludeAllOption(Composite parent, int index) {
+               createOption(parent, index);
+       }
+       
+       private void createSkipReposOption(Composite parent, int index) {
+               createOption(parent, index);
+       }
+       
+       private void createNoConfigureOption(Composite parent, int index) {
+               createOption(parent, index);
+       }
+       
+       private void createExtraPacksOption(Composite parent, int index) {
+               createOptionWithText(parent, index);
+       }
+       
+       private void createExcludeOption(Composite parent, int index) {
+               createOptionWithText(parent, index);
+       }
+       
+       private void createCommitOption(Composite parent, int index) {
+               createOptionWithText(parent, index);
+       }
+       
+       private void createThreadsOption(Composite parent, final int index) {
+               createOptionWithText(parent, index);    
+       }
+       
+       private void createKeepPacksOption(Composite parent, int index) {
+               createOption(parent, index);
+       }
+
+       private void createNoInitOption(Composite parent, int index) {
+               createOption(parent, index);
+       }
+
+       private void createIncrementalOption(Composite parent, int index) {
+               createOption(parent, index);
+       }
+
+       private void createOptionWithText(Composite parent, final int index) {          
+               
+               GBSOption op = GBSOptionManager.getOption(avaiableOptions[index]);
+               if (op == null) {
+                       return;
+               }
+
+               buttons[index] = new Button(parent, SWT.CHECK);
+               buttons[index].setText(op.getOption());
+               buttons[index].setSelection(checkOptions[index]);
+               
+               buttons[index].addSelectionListener(new SelectionAdapter() {
+                       public void widgetSelected(SelectionEvent event) {                              
+                               Button button = (Button) event.widget;
+                               if (button.getSelection()) {
+                                       texts[index].setEnabled(true);
+                                       checkOptions[index] = true;                                     
+                                       if (!isMultiConfiguration()) {
+                                               String value = texts[index].getText();
+                                               String option = String.format("%s=%s", avaiableOptions[index], value);
+                                               PlatformConfigurationManager.addGBSOptions(getCfg(), option);
+                                       }
+                               } else {
+                                       texts[index].setEnabled(false);
+                                       checkOptions[index] = false;
+                                       if (!isMultiConfiguration()) {
+                                               PlatformConfigurationManager.removeGBSOptions(getCfg(), avaiableOptions[index]);
+                                       }
+                               }
+                       }
+               });
+               
+               Label desc = new Label(parent, SWT.NONE);
+               desc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               desc.setText(getDesc(op));
+               
+               texts[index] = new Text(parent, SWT.BORDER);
+               GridData gd = new GridData(GridData.FILL_BOTH);
+               gd.horizontalSpan = 2;
+               texts[index].setLayoutData(gd);
+               texts[index].setEnabled(checkOptions[index]);
+               texts[index].addModifyListener(new ModifyListener() {
+                       public void modifyText(ModifyEvent event) {
+                               Text text = (Text)event.widget;
+                               String value = text.getText();
+                               if (value.isEmpty()) {
+                                       return;
+                               }                               
+                               if (!isMultiConfiguration()) {
+                                       String option = String.format("%s=%s", avaiableOptions[index], value);
+                                       PlatformConfigurationManager.replaceGBSOptions(getCfg(), option);
+                               }
+                       }
+               });
+               
+       }
+       
+       private void createOption(Composite parent, final int index) {
+               
+               GBSOption op = GBSOptionManager.getOption(avaiableOptions[index]);
+               if (op == null) {
+                       return;
+               }
+               buttons[index] = new Button(parent, SWT.CHECK);
+               buttons[index].setText(op.getOption());
+               buttons[index].setSelection(checkOptions[index]);               
+               buttons[index].addSelectionListener(new SelectionAdapter() {
+                       public void widgetSelected(SelectionEvent event) {                              
+                               Button button = (Button) event.widget;
+                               if (button.getSelection()) {                                    
+                                       if (!isMultiConfiguration()) {
+                                               PlatformConfigurationManager.addGBSOptions(getCfg(), avaiableOptions[index]);
+                                       }
+                                       checkOptions[index] = true;
+                               } else {
+                                       if (!isMultiConfiguration()) {
+                                               PlatformConfigurationManager.removeGBSOptions(getCfg(), avaiableOptions[index]);
+                                       }
+                                       checkOptions[index] = false;                                            
+                               }
+                       }
+               });
+               
+               GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
+               buttons[index].setLayoutData(gd);       
+               
+               Label desc = new Label(parent, SWT.NONE);
+               desc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               desc.setText(getDesc(op));              
+       }       
+
+       @Override
+       protected void performOK() {
+               // if multi configuration, set new gbs options. 
+               if (isMultiConfiguration()) {
+                       ArrayList<String> newOptions = new ArrayList<String>();
+                       for (int i = 0 ; i < avaiableOptions.length ; i++) {
+                               boolean checked = checkOptions[i];
+                               if (checked) {
+                                       String option = EMPTY_STRING;
+                                       if (texts[i] != null) {
+                                               String value = texts[i].getText();
+                                               option = String.format("%s=%s", avaiableOptions[i], value); 
+                                       } else {
+                                               option = avaiableOptions[i];
+                                       }
+                                       newOptions.add(option);
+                               }                       
+                       }
+                       PlatformConfigurationManager.setGBSOptions(getCfg(), newOptions);
+               }
+       }
+       
+       @Override
+       public boolean canBeVisible() {
+               IManagedProject managedProject =  getCfg().getManagedProject();
+               String projectArtifactType = managedProject.getProjectType() != null ? 
+                               managedProject.getProjectType().getBuildArtefactType().getId() : null;
+               if (    projectArtifactType != null &&
+                               projectArtifactType.equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE)) {
+                       return true;
+               }
+               
+               return false;
+       }
+
+       @Override
+       protected void performApply(ICResourceDescription src,
+                       ICResourceDescription dst) { 
+       }
+
+       @Override
+       protected void performDefaults() {              
+       }
+
+       @Override
+       protected void updateData(ICResourceDescription cfg) {
+
+               // if multi configuration, just do initialize.
+               if (isMultiConfiguration()) {
+                       for (int i = 0 ; i < avaiableOptions.length ; i++) {
+                               initControl(i);
+                       }
+               } else {
+                       IConfiguration conf = getCfg();
+                       ArrayList<String> options = PlatformConfigurationManager.getGBSOptions(conf);
+                       for (int i = 0 ; i < avaiableOptions.length ; i++) {
+                               initControl(i);
+                               String op = avaiableOptions[i];                 
+                               for (String s : options) {
+                                       String[] strs = s.split("=");                           
+                                       s = strs[0].trim();
+                                       if (s.equals(op)) {
+                                               checkOptions[i] = true;
+                                               buttons[i].setSelection(true);                                  
+                                               if (texts[i] != null) {
+                                                       texts[i].setEnabled(true);
+                                                       if (strs.length == 2) {
+                                                               texts[i].setText(strs[1]);
+                                                       }
+                                               }                                       
+                                       }
+                               }
+                       }               
+               }
+       }
+       
+       private void initControl(int index) {
+               checkOptions[index] = false;
+               buttons[index].setSelection(false);
+               if (texts[index] != null) {
+                       texts[index].setEnabled(false);
+                       texts[index].setText(EMPTY_STRING);
+               }
+       }
+       
+       private boolean isMultiConfiguration() {
+               IConfiguration config = getCfg();
+               return (config instanceof MultiConfiguration);
+       }
+       
+       private String getDesc(GBSOption op) {
+               return PREFIX_DESC + filterDesc(op.getDesc());
+       }
+
+
+       @Override
+       protected void updateButtons() {                
+       }
+       
+       private String filterDesc(String desc) {
+               if (desc.length() > 85) {
+                       int index = desc.indexOf(" ", 85);
+                       if (index < 85) {
+                               return desc;
+                       }
+                       String desc1 = desc.substring(0, index);
+                       String desc2 = desc.substring(index).trim();
+                       return desc1 + "\n  " + filterDesc(desc2);
+               }
+               return desc;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOption.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOption.java
new file mode 100644 (file)
index 0000000..7516fb6
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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.gbs;
+
+import java.util.ArrayList;
+
+public class GBSOption {
+       private String option;
+       private String desc;
+       private boolean checked;
+       
+       public GBSOption(String op, String desc, boolean checked) {
+               for (String s : op.split(",")) {
+                       s = s.trim();
+                       if (s.startsWith("--")) {
+                               option = s;
+                               break;
+                       }
+                       
+               }               
+               this.desc = desc;
+               this.checked = checked;
+       }
+       
+       public String getOption() {
+               return option.split(" ")[0];            
+       }       
+       
+       public void setDesc(String d) {
+               desc = d;
+       }
+       
+       public String getDesc() {
+               return desc;            
+       }
+       
+       public boolean getChecked() {
+               return checked;
+       }
+       
+       
+       
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOptionManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOptionManager.java
new file mode 100644 (file)
index 0000000..545c766
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * 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.gbs;
+
+import java.util.ArrayList;
+
+import org.tizen.nativeplatform.util.CommandLauncher;
+
+public class GBSOptionManager {
+       private static ArrayList<GBSOption> options = new ArrayList<GBSOption>();
+       private static boolean initialized = false;
+       public static double MIN_GBS_VERSION = 0.12;
+       
+       public static void addOption(GBSOption op) {
+               options.add(op);
+       }
+       
+       public static boolean isInitialized() {
+               return initialized;
+       }
+       
+       @SuppressWarnings("unchecked")
+       public static ArrayList<GBSOption> getOptions() {
+               return (ArrayList<GBSOption>)options.clone();
+       }
+       
+       public static GBSOption getOption(String op) {
+               for (GBSOption o : options) {   
+                       if (o.getOption().startsWith(op)) {
+                               return o;
+                       }
+               }
+               
+               return null;
+       }
+       
+       private static boolean checkGBSTool() {
+               
+               // check GBS command
+               try {
+                       if ( !CommandLauncher.execute("which gbs") ) {
+                               return false;
+                       }
+                       String result = CommandLauncher.executeOutput("gbs --version", null, true, null);
+                       
+                       // result format : gbs [version]
+                       String[] results = result.trim().split(" ");
+                       if (results.length != 2) {
+                               return false;
+                       }
+                       String command = results[0];
+                       double ver = Double.parseDouble(results[1]);            
+                       
+                       if ( !command.equals("gbs") || ver < MIN_GBS_VERSION) {
+                               return false;
+                       }
+                       
+                       return true;
+
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+                       return false;
+               }
+       }
+       
+       public static void initOptions() {
+               options.clear();
+               if (!checkGBSTool()) {
+                       return;
+               }
+               String command = "gbs build --help";
+               String output = "";
+               try {
+                       output = CommandLauncher.executeOutput(command);
+               } catch (InterruptedException e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               }
+               boolean startArgs = false;
+               for (String s : output.split("\n")) {
+                       if (startArgs) {
+                               s = s.trim();
+                               String[] values = s.split("  +");
+                               if (values.length > 1) {
+                                       String option = values[0].trim();
+                                       String desc = values[1].trim();                                 
+                                       GBSOption op = new GBSOption(option, desc, false);
+                                       options.add(op);
+                               } else if (values.length == 1 && !values[0].trim().startsWith("-")) {
+                                       GBSOption op = options.get(options.size() - 1);
+                                       String desc = values[0].trim();
+                                       String newDesc = "";
+                                       if (!op.getDesc().isEmpty()) {
+                                               newDesc = op.getDesc() + " " + desc;
+                                       } else {
+                                               newDesc = desc;
+                                       }
+                                       op.setDesc(newDesc);
+                               } else if (values.length == 1 && values[0].trim().startsWith("-")) {
+                                       String option = values[0].trim();
+                                       GBSOption op = new GBSOption(option, "", false);
+                                       options.add(op);
+                               }
+                               //System.out.print(values[1]);
+                       }
+                       if (s.startsWith("optional arguments:")) {
+                               startArgs = true;
+                       }
+               }
+               initialized = true;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/CachedGitEntries.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/CachedGitEntries.java
new file mode 100644 (file)
index 0000000..1a0ee93
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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.git;
+
+import java.util.List;
+
+import org.eclipse.cdt.ui.wizards.EntryDescriptor; 
+
+public class CachedGitEntries {
+       private static List<EntryDescriptor> gitEnties;
+       
+       public static void setGitEntries(List<EntryDescriptor> g) {
+               gitEnties = g;
+       }
+       
+       public static List<EntryDescriptor> getGitEntries() {
+               return gitEnties;
+       }       
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/FileGitIndexParser.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/FileGitIndexParser.java
new file mode 100644 (file)
index 0000000..e183fc3
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * 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.git;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.tizen.nativeplatform.git.model.GitDescription;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+
+public class FileGitIndexParser implements IGitIndexParser {
+       
+       ArrayList<GitDescription> GitDescs = new ArrayList<GitDescription>();
+
+       @Override
+       public ArrayList<GitDescription> parse(PreferencesManager.SiteConfiguration config) {
+               BufferedReader reader = null;
+               try {
+                       reader = new BufferedReader(new FileReader(config.listLocation));                       
+                       while(true) {
+                               String str = reader.readLine();                         
+                               if (str == null || str.isEmpty()) {
+                                       break;
+                               }
+                               GitDescription gitDesc = new GitDescription();                          
+                               gitDesc.setProject(str.trim());
+                               GitDescs.add(gitDesc);
+                       }
+               } catch (FileNotFoundException e) {
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+               
+               return GitDescs;
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitCommander.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitCommander.java
new file mode 100644 (file)
index 0000000..d41aacb
--- /dev/null
@@ -0,0 +1,301 @@
+/*
+ * 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.git;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Map.Entry;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.egit.core.Activator;
+import org.eclipse.egit.core.op.CloneOperation;
+import org.eclipse.egit.core.op.ConnectProviderOperation;
+import org.eclipse.egit.core.op.ListRemoteOperation;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.RepositoryCache.FileKey;
+import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.transport.URIish;
+import org.eclipse.jgit.util.FS;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.service.prefs.BackingStoreException;
+
+public class GitCommander {
+       private final String GITPATH_DELIMITER = "/";
+       private final String GITPATH_DELIMITER2 = ":";
+       private final String REMOTE_NAME = "origin";
+       @SuppressWarnings("deprecation")
+       private final IEclipsePreferences prefs = new InstanceScope().getNode(Activator.getPluginId());
+       
+       /** The preferences to store the directories known to the Git Repositories view */
+       public static final String PREFS_DIRECTORIES = "GitRepositoriesView.GitDirectories"; //$NON-NLS-1$
+       private String sshConn;
+       
+       public GitCommander(String sshConn) {
+               this.sshConn = sshConn;
+       }
+       
+       public List<Ref> getAvailableRefs(IPath gitPath, IWizardContainer container) 
+                       throws InvocationTargetException, URISyntaxException, IOException {
+               
+               if (sshConn == "" || sshConn == null) {
+                       return null;
+               }
+               
+               final ListRemoteOperation listRemoteOp;
+               final List<Ref> availableRefs = new ArrayList<Ref>();
+        try {          
+               URIish uri = new URIish(sshConn + GITPATH_DELIMITER + gitPath);
+                       int timeout = 0;
+                       
+                       Repository db = new FileRepository(new File("/tmp"));
+                       listRemoteOp = new ListRemoteOperation(db, uri, timeout);
+                       
+                       if (container != null) {
+                               container.run(true, true, new IRunnableWithProgress() {
+                                       public void run(IProgressMonitor monitor)
+                                                       throws InvocationTargetException, InterruptedException {
+                                               listRemoteOp.run(monitor);
+                                       }
+                               });
+                       } else {
+                               listRemoteOp.run(null);
+                       }
+                       
+                       final Ref idHEAD = listRemoteOp.getRemoteRef(Constants.HEAD);
+                       Ref head = null;
+                       for (final Ref r : listRemoteOp.getRemoteRefs()) {
+                               final String n = r.getName();
+                               if (!n.startsWith(Constants.R_HEADS))
+                                       continue;
+                               availableRefs.add(r);
+                               if (idHEAD == null || head != null)
+                                       continue;
+                               if (r.getObjectId().equals(idHEAD.getObjectId()))
+                                       head = r;
+                       }
+                       Collections.sort(availableRefs, new Comparator<Ref>() {
+                               public int compare(final Ref o1, final Ref o2) {
+                                       return o1.getName().compareTo(o2.getName());
+                               }
+                       });
+                       if (idHEAD != null && head == null) {
+                               head = idHEAD;
+                               availableRefs.add(0, idHEAD);
+                       }               
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+               }
+        
+        return availableRefs; 
+       }
+       
+       public boolean CloneOperation(IPath projectPath, IPath gitPath, IWizardContainer container) 
+                                       throws InvocationTargetException, URISyntaxException, IOException {
+               
+               if (sshConn == "" || sshConn == null) {
+                       return false;
+               }                               
+               
+        try {
+               
+               URIish uri = new URIish(sshConn + GITPATH_DELIMITER + gitPath);
+               if ( uri.getScheme() == null ) {
+               uri = new URIish(sshConn + GITPATH_DELIMITER2 + gitPath);
+               }
+                       File workdir = new File(projectPath.toOSString());
+                       int timeout = 0;
+                       boolean allSelected = true;
+
+                       final CloneOperation op = new CloneOperation(uri, allSelected,
+                                       null, workdir, null, REMOTE_NAME, timeout);
+                       
+                       container.run(true, true,
+                               new IRunnableWithProgress() {
+                                       public void run(IProgressMonitor monitor)
+                                                       throws InvocationTargetException,
+                                                       InterruptedException {
+                                               op.run(monitor);
+                                       }
+                       });             
+                       
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+                       return false;
+               }
+        
+        return true;
+       }
+       
+       public void ApplySharedProject(IProject project, IWizardContainer container) {
+        // Applied shared project
+        final Map<IProject, File> ret = new HashMap<IProject, File>(1);
+        IPath selectedRepo = Path.fromOSString(".git");
+        IPath localPathToRepo = project.getLocation().append(selectedRepo);
+        ret.put(project, localPathToRepo.toFile());
+        final ConnectProviderOperation op = new ConnectProviderOperation(ret);
+        
+       try {
+                       container.run(true, false, new IRunnableWithProgress() {
+                               public void run(final IProgressMonitor monitor)
+                                               throws InvocationTargetException {
+                                       try {
+                                               op.execute(monitor);
+                                               PlatformUI.getWorkbench().getDisplay()
+                                                               .syncExec(new Runnable() {
+                                                                       public void run() {
+                                                                               Set<File> filesToAdd = new HashSet<File>();
+                                                                               // collect all files first
+                                                                               for (Entry<IProject, File> entry : ret.entrySet())
+                                                                                       filesToAdd.add(entry.getValue());
+                                                                               // add the files to the repository view
+                                                                               for (File file : filesToAdd) {
+                                                                                       addConfiguredRepository(file);
+                                                                               }
+                                                                       }
+                                                               });
+                                       } catch (CoreException ce) {
+                                               //throw new InvocationTargetException(ce);
+                                           ce.printStackTrace();
+                                       }
+                               }
+                       });
+               } catch (InvocationTargetException e1) {
+                       e1.printStackTrace();
+                       //e1 = e1.getCause();
+                       //if (e1 instanceof CoreException) {
+                       //      IStatus status = ((CoreException) e1).getStatus();
+                       //      e1 = status.getException();
+                       //}
+                       //Activator.handleError(UIText.SharingWizard_failed, e1, true);         
+               } catch (InterruptedException e1) {
+                       e1.printStackTrace();
+                       //Activator.handleError(UIText.SharingWizard_failed, e1, true);         
+               }
+       }
+       
+       /**
+        *
+        * @param repositoryDir
+        *            the Repository path
+        * @return <code>true</code> if the repository path was not yet configured
+        * @throws IllegalArgumentException
+        *             if the path does not "look" like a Repository
+        */
+       public boolean addConfiguredRepository(File repositoryDir)
+                       throws IllegalArgumentException {
+               synchronized (prefs) {
+
+                       if (!FileKey.isGitRepository(repositoryDir, FS.DETECTED))
+                               throw new IllegalArgumentException();
+
+                       String dirString;
+                       try {
+                               dirString = repositoryDir.getCanonicalPath();
+                       } catch (IOException e) {
+                               dirString = repositoryDir.getAbsolutePath();
+                       }
+
+                       List<String> dirStrings = getConfiguredRepositories();
+                       if (dirStrings.contains(dirString)) {
+                               return false;
+                       } else {
+                               Set<String> dirs = new HashSet<String>();
+                               dirs.addAll(dirStrings);
+                               dirs.add(dirString);
+                               saveDirs(dirs);
+                               return true;
+                       }
+               }
+       }
+       
+       
+       /**
+        *
+        * @return the list of configured Repository paths; will be sorted
+        */
+       public List<String> getConfiguredRepositories() {
+               synchronized (prefs) {
+                       Set<String> configuredStrings = new HashSet<String>();
+
+                       String dirs = prefs.get(PREFS_DIRECTORIES, ""); //$NON-NLS-1$
+                       if (dirs != null && dirs.length() > 0) {
+                               StringTokenizer tok = new StringTokenizer(dirs,
+                                               File.pathSeparator);
+                               while (tok.hasMoreTokens()) {
+                                       String dirName = tok.nextToken();
+                                       configuredStrings.add(dirName);
+                               }
+                       }
+                       List<String> result = new ArrayList<String>();
+                       result.addAll(configuredStrings);
+                       Collections.sort(result);
+                       return result;
+               }
+       }
+       
+       
+       private void saveDirs(Set<String> gitDirStrings) {
+               StringBuilder sb = new StringBuilder();
+               for (String gitDirString : gitDirStrings) {
+                       sb.append(gitDirString);
+                       sb.append(File.pathSeparatorChar);
+               }
+
+               prefs.put(PREFS_DIRECTORIES, sb.toString());
+               try {
+                       prefs.flush();
+               } catch (BackingStoreException e) {
+                       IStatus error = new Status(IStatus.ERROR, Activator.getPluginId(),
+                                       e.getMessage(), e);
+                       Activator.getDefault().getLog().log(error);
+               }
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitCommanderMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitCommanderMessages.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitDescManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitDescManager.java
new file mode 100644 (file)
index 0000000..e8ed0b0
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * 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.git;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.tizen.nativeplatform.git.model.GitDescription;
+
+public class GitDescManager {
+       private static Hashtable<String, GitDescription> gitDescs;
+       
+       public static void setDescs(ArrayList<GitDescription> descs) {
+               gitDescs = new Hashtable<String, GitDescription>();
+               
+               for( GitDescription desc: descs ) {
+                       gitDescs.put(desc.getProject(), desc);
+               }
+       }
+       
+       public static ArrayList<GitDescription> getDescs() {
+               ArrayList<GitDescription> result = new ArrayList<GitDescription>();
+               
+               Iterator<GitDescription> it = gitDescs.values().iterator();
+               
+               while( it.hasNext() ) {
+                       result.add( it.next() );
+               }
+               
+               return result;
+       }       
+
+       
+       public static GitDescription getDesc( String projectName ) {
+               return gitDescs.get(projectName);
+       }       
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitIndexParserFactory.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/GitIndexParserFactory.java
new file mode 100644 (file)
index 0000000..7b90fdf
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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.git;
+
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+
+public class GitIndexParserFactory {
+       public static IGitIndexParser getIndexParser(PreferencesManager.SiteConfiguration config)  {
+               if ( config.listType.equals(PreferencesManager.GIT_LIST_WEB)) {
+                       return new WebGitIndexParser();
+               } 
+               else if ( config.listType.equals(PreferencesManager.GIT_LIST_LOCAL) ){
+                       return new FileGitIndexParser();
+               }
+               else {
+                       return null;
+               }
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/IGitIndexParser.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/IGitIndexParser.java
new file mode 100644 (file)
index 0000000..11a7012
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.git;
+
+import java.util.ArrayList;
+
+import org.tizen.nativeplatform.git.model.GitDescription;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+
+public interface IGitIndexParser {
+       public ArrayList<GitDescription> parse(PreferencesManager.SiteConfiguration config);
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/WebGitIndexParser.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/WebGitIndexParser.java
new file mode 100644 (file)
index 0000000..d02e460
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * 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.git;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+
+import org.tizen.common.util.DialogUtil;
+import org.tizen.nativeplatform.git.model.GitDescription;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+
+public class WebGitIndexParser implements IGitIndexParser {
+
+       @Override
+       public ArrayList<GitDescription> parse(PreferencesManager.SiteConfiguration config) {
+               boolean startTable = false;
+               boolean startTr = false;
+               boolean getProjectName = false;
+               boolean getDescription = false;
+               boolean getOwner = false;
+               String cacheFile = config.getListCacheFile();
+               
+               ArrayList<GitDescription> GitDescs = new ArrayList<GitDescription>();
+               if ( !(new File( cacheFile )).exists() ) {
+                       GitDescription gitDesc = new GitDescription();
+                       gitDesc.setProject("no_category/no_project.git");
+                       gitDesc.setDesc("No Git information! Update Git Configuration in \"Windows->Preferences->Tizen SDK->Platform->Git Configuration\" ");                                                   
+                       gitDesc.setOwner("None");
+
+                       GitDescs.add(gitDesc);
+                       return GitDescs;
+               }
+               
+               try {
+                       BufferedReader in = new BufferedReader(new FileReader(cacheFile));
+                       GitDescription gitDesc = null;
+                       String str;
+                       while ((str = in.readLine()) != null) {
+                               str = str.trim();
+                               if (startTable) {
+                                       if (str.startsWith("<tr")) {
+                                               startTr = true;
+                                               gitDesc = new GitDescription();
+                                               continue;
+                                       } else if (str.startsWith("</tr")) {
+                                               startTr = false;
+                                               if (getProjectName) {
+                                                       GitDescs.add(gitDesc);
+                                               }
+                                               getProjectName = false;
+                                               getDescription = false;
+                                               getOwner = false;
+                                               continue;
+                                       }
+                                       
+                                       if (startTr && !getProjectName) {
+                                               if (str.startsWith("<td")) {
+                                                       String project = str.replaceAll("<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>", "");
+                                                       getProjectName = true;
+                                                       gitDesc.setProject(project);
+                                               }
+                                       } else if (startTr && !getDescription) {
+                                               if (str.startsWith("<td")) {
+                                                       String desc = str.replaceAll("<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>", "");
+                                                       getDescription = true;
+                                                       gitDesc.setDesc(desc);                                                  
+                                               }
+                                       } else if (startTr && !getOwner) {
+                                               if (str.startsWith("<td")) {
+                                                       String owner = str.replaceAll("<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>", "");
+                                                       getOwner = true;
+                                                       gitDesc.setOwner(owner);                                                        
+                                               }
+                                       } 
+                                       
+                               }
+                               if (!startTable && str.equals("<table class=\"project_list\">")) {
+                                       startTable = true;
+                                       continue;
+                               }
+                               
+                               if (startTable && str.equals("</table>")) {
+                                       startTable = false;
+                                       break;
+                               }                       
+                       }
+               } catch (MalformedURLException e) {
+                       DialogUtil.openErrorDialog(e.toString());
+                       e.printStackTrace();
+                       return null;
+               } catch (IOException e) {
+                       DialogUtil.openErrorDialog(e.toString());
+                       e.printStackTrace();
+                       return null;
+               }
+               return GitDescs;                
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/model/GitConfiguration.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/model/GitConfiguration.java
new file mode 100644 (file)
index 0000000..ac3d60c
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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.git.model;
+
+public class GitConfiguration {
+       private String name = "";
+       private String gitWeb = "";
+       private String sshConn = "";
+       
+       public GitConfiguration(String name, String gitWeb, String sshConn) {
+               this.name = name;
+               this.gitWeb = gitWeb;
+               this.sshConn = sshConn;
+       }
+       
+       public String getName() {
+               return name;            
+       }
+       
+       public String getGitWeb() {
+               return gitWeb;
+       }
+       
+       public String getSshConn() {
+               return sshConn;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/model/GitDescription.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/git/model/GitDescription.java
new file mode 100644 (file)
index 0000000..b24e0cb
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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.git.model;
+
+public class GitDescription {
+       private String project = "";
+       private String desc = "";
+       private String owner = "";
+       
+       public GitDescription() {
+               
+       }
+       
+       public String getProject() {
+               return project;
+       }
+       
+       public String getDesc() {
+               return desc;
+       }
+       
+       public String getOwner() {
+               return owner;           
+       }
+       
+       public void setProject(String project) {
+               this.project = project;
+       }
+       
+       public void setDesc(String desc) {
+               this.desc = desc;
+       }
+       
+       public void setOwner(String owner) {
+               this.owner = owner;     
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ITizenLaunchConfigurationConstants.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ITizenLaunchConfigurationConstants.java
new file mode 100644 (file)
index 0000000..c5434f1
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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.launch;
+
+public interface ITizenLaunchConfigurationConstants {
+       public static final String DEBUGGER_ID = "org.tizen.nativeplatform.launch.TizenPlatformDebugger";
+       public static final String COMMAND_FACTORY_ID = "org.tizen.nativeplatform.launch.PlatformCommandFactory";
+       
+       public static final String PLATFORM_LAUNCH_ID = "org.tizen.platform.launch"; //$NON-NLS-1$
+       public static final String ATTR_APP_PROJECT_NAME = PLATFORM_LAUNCH_ID + ".APP_PROJECT_ATTR"; //$NON-NLS-1$
+       public static final String ATTR_EXTRA_PACKAGE_LIST = PLATFORM_LAUNCH_ID + ".EXTRA_PACKAGE_LIST_ATTR"; //$NON-NLS-1$
+       public static final String ATTR_REINSTALL_OPTION = PLATFORM_LAUNCH_ID + ".REINSTALL_OP_ATTR"; //$NON-NLS-1$
+       public static final String ATTR_SELECTPKG_OPTION = PLATFORM_LAUNCH_ID + ".SELECTPKG_OP_ATTR"; //$NON-NLS-1$
+       public static final String ATTR_FROM_SHORTCUT = PLATFORM_LAUNCH_ID + ".FROM_SHORTCUT_ATTR"; //$NON-NLS-1$
+       public static final String ATTR_PROCESSNAME_OPTION = PLATFORM_LAUNCH_ID + ".PROCESS_NAME_ATTR"; //$NON-NLS-1$
+       public static final String ATTR_PROCESSID_OPTION = PLATFORM_LAUNCH_ID + ".PROCESS_ID_ATTR"; //$NON-NLS-1$
+       
+       
+       
+
+}
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformCommandFactory.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformCommandFactory.java
new file mode 100644 (file)
index 0000000..ff0434b
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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.launch;
+
+import java.io.IOException;
+
+import org.eclipse.cdt.debug.mi.core.MIProcess;
+import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class PlatformCommandFactory extends StandardCommandFactory {
+       @Override
+       public MIProcess createMIProcess(String[] args, int launchTimeout, IProgressMonitor monitor) throws IOException {
+               return new PlatformMIProcessAdapter(args, launchTimeout, monitor);
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformMIProcessAdapter.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformMIProcessAdapter.java
new file mode 100644 (file)
index 0000000..7d18672
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * 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.launch;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.PushbackInputStream;
+
+import org.eclipse.cdt.debug.mi.core.MIInferior;
+import org.eclipse.cdt.debug.mi.core.MIPlugin;
+import org.eclipse.cdt.debug.mi.core.MIProcessAdapter;
+import org.eclipse.cdt.utils.spawner.Spawner;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
+import org.tizen.nativecommon.build.ProjectTypeManager;
+import org.tizen.nativeplatform.util.CommandLauncher;
+
+
+public class PlatformMIProcessAdapter extends MIProcessAdapter {
+
+       private static final int ONE_SECOND = 1000;
+
+       private Process gdbProcess;
+       InputStream gdbInputStream;
+
+       public PlatformMIProcessAdapter(String[] args, int launchTimeout, IProgressMonitor monitor) throws IOException {
+               super(args, launchTimeout, monitor);
+       }
+
+       public PlatformMIProcessAdapter(String[] args, IProgressMonitor monitor) throws IOException {
+               super(args, monitor);
+       }
+       
+       @Override
+       public boolean canInterrupt(MIInferior inferior) {
+               return true;
+       }
+
+       @Override
+       public void interrupt(MIInferior inferior) {
+               if (gdbProcess instanceof Spawner) {
+                       String interruptCmd = CommandLauncher.genDebugginInterruptScript(gdbProcess);
+                       Process shellProcess;
+                       try {
+                               shellProcess = CommandLauncher.createProcess( interruptCmd, null, false );
+                               shellProcess.waitFor();
+                       } catch (InterruptedException e) {                              
+                               e.printStackTrace();
+                               super.interrupt(inferior);
+                               return;
+                       }
+                                               
+                       inferior.setSuspended();
+                       waitForInterrupt(inferior);             
+                       
+                       //super.interrupt(inferior);                    
+               } else {
+                       BufferedWriter bw;
+                       bw = new BufferedWriter(new OutputStreamWriter(gdbProcess.getOutputStream()));
+                       char c = 0x03; //standard code representing "Ctrl-C" sequence
+                       try {
+                               bw.write(c);
+                               bw.newLine();
+                               bw.flush();
+                               inferior.setSuspended();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       @Override
+       public InputStream getInputStream() {
+               return gdbInputStream;
+       }
+
+       private IProject getProjectName(String[] args) {
+               String projectPathString = null;
+               for (int i = 0; i < args.length; i++) {
+                       if (args[i].contains("--cd")) {
+                               projectPathString = args[i];
+                               break;
+                       }
+               }
+               String[] pathTokens = projectPathString.split("=");
+               projectPathString = pathTokens[pathTokens.length - 1];
+               IPath projectPath = new Path(projectPathString);
+               String projectName = projectPath.lastSegment();
+               IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+               return project;
+       }
+       
+       @Override
+       protected Process getGDBProcess(String[] args, int launchTimeout, IProgressMonitor monitor) throws IOException {
+           
+               IProject project = getProjectName(args);
+               CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(project);
+               
+               String[] newArgs = new String[args.length-1];
+               System.arraycopy(args, 1, newArgs, 0, args.length-1);
+
+               gdbProcess = builder.debug(newArgs);
+               
+//             gdbProcess = createGDBProcess(newArgs);
+               
+               Thread syncStartup = new Thread("GDB Start") { //$NON-NLS-1$
+                       public void run() {
+                               PushbackInputStream pb = new PushbackInputStream(gdbProcess.getInputStream());
+                               gdbInputStream = pb;
+                               try {
+                                       pb.unread(pb.read());
+                               } catch (IOException e) {
+                                       e.printStackTrace();
+                               }  
+                               // actually read something, then return it
+                       }
+               };
+               syncStartup.start();
+
+               int timepass = 0;
+               if (launchTimeout <= 0) {
+                       // Simulate we are waiting forever.
+                       launchTimeout = Integer.MAX_VALUE;
+               }
+
+               // To respect the IProgressMonitor we can not use wait/notify
+               // instead we have to loop and check for the monitor to allow to cancel the thread.
+               // The monitor is check every 1 second delay;
+               for (timepass = 0; timepass < launchTimeout; timepass += ONE_SECOND) {
+                       if (syncStartup.isAlive() && !monitor.isCanceled()) {
+                               try {
+                                       Thread.sleep(ONE_SECOND);
+                               } catch (InterruptedException e) {
+                                       e.printStackTrace();
+                               }
+                       } else {
+                               break;
+                       }
+               }
+               try {
+                       syncStartup.interrupt();
+                       syncStartup.join(ONE_SECOND);
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+               }
+               if (monitor.isCanceled()) {
+                       gdbProcess.destroy();
+                       throw new OperationCanceledException();
+               } else if (timepass >= launchTimeout) {
+                       gdbProcess.destroy();
+                       String message = MIPlugin.getResourceString("src.GDBDebugger.Error_launch_timeout"); //$NON-NLS-1$
+                       throw new IOException(message);
+               }
+
+               return gdbProcess;
+       }
+}
\ No newline at end of file
index ef01062..002f619 100644 (file)
@@ -1,35 +1,35 @@
 /*
-*  NativeCommon
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch;
 
 import java.io.File;
 import java.io.FilenameFilter;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -39,6 +39,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
 import org.eclipse.cdt.debug.core.CDIDebugModel;
 import org.eclipse.cdt.debug.core.ICDIDebugger2;
 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.core.cdi.CDIException;
 import org.eclipse.cdt.debug.core.cdi.ICDISession;
 import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
 import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
@@ -59,6 +60,7 @@ import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
@@ -73,57 +75,73 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.TwoPaneElementSelector;
-
+import org.tizen.common.TizenPlatformConstants;
 import org.tizen.common.connection.ConnectionPlugin;
-import org.tizen.common.connection.debugtools.DebugTool;
+import org.tizen.common.util.DialogUtil;
 import org.tizen.common.util.LocalPortChecker;
-
+import org.tizen.common.util.SWTUtil;
+import org.tizen.nativecommon.build.CommonBuildMessages;
 import org.tizen.nativecommon.build.CommonConfigurationManager;
 import org.tizen.nativecommon.build.CommonProjectDependentBuilder;
 import org.tizen.nativecommon.build.ProjectTypeManager;
 import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.build.exception.SBIException;
 import org.tizen.nativecommon.launch.TizenDebugger;
+import org.tizen.nativecommon.launch.TizenLaunchCommand;
 import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
 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.build.PlatformProjectPackaging;
+import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
+import org.tizen.nativeplatform.launch.wizards.ShowPackageStatusDialog;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
 import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.IDevice.Arch;
+import org.tizen.sdblib.SdbCommandRejectedException;
+import org.tizen.sdblib.SdbShellProcess;
+import org.tizen.sdblib.TimeoutException;
 
+@SuppressWarnings("restriction")
 public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
-    protected static final String PACKAGE_EXTENSION = ".deb";
-    protected static final String CMD_RESULT_CHECK  = "; echo $?;";
-    protected static final String GDBSERVER_DIR = "gdbserver";
-    protected static final String GDBSERVER_BIN = "gdbserver";
     protected IConfiguration selectedConfig;
     protected IDevice currentDevice;
+    protected SdbShellProcess serverProc = null;
     protected String executeResult = "";
-    protected static final String LOCALHOST = "127.0.0.1";
-    protected static final String ENVIRONMENT_SETTING_CMD = "export ";
     protected int localDebugPort = -1;
     protected ICDISession debugSession;
-    protected static final String ELM_SCALE_GETTER = "/home/developer/sdk_tools/elm_scale_getter/get_elm_scale ";
     protected static final int defaultTimeOut = 60000;
+    protected Shell shell;
+    private boolean result;    
+    protected TizenLaunchCommand tizenCommand = null;
 
     protected String getPluginID() {
         return Activator.PLUGIN_ID;
     }
 
-    public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+       public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+       shell = LaunchUIPlugin.getShell();
         if (monitor == null)
             monitor = new NullProgressMonitor();
         try {
             monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 20);
-            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);            
+
+            tizenCommand = new TizenLaunchCommand(currentDevice, null);          
 
             activateProgressView();
 
             verifyDeviceReachability(getProject(config), new SubProgressMonitor(monitor, 8));
             verifyBuildConfiguration(config, mode, new SubProgressMonitor(monitor, 1));
+            
+            if (!fromShortcut(config)) {
+               setConfigIfNotFromShortcut(config, mode, new SubProgressMonitor(monitor, 1));
+               }            
 
-            if (mode.equals(ILaunchManager.DEBUG_MODE)) {
-                verifyTizenDebianProjectSettings(config);
+            if (mode.equals(ILaunchManager.DEBUG_MODE)) {                               
                 setDebugConfigAttributes(config);
+                verifyTizenDebianProjectSettings(config);
                 setDefaultSourceLocator(launch, config);
                 IBinaryObject exeFile = getBinaryObject(config);
                 launchApplicationForDebug(launch, config, exeFile, new SubProgressMonitor(monitor, 10));
@@ -139,30 +157,188 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
                 ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
                 launchManager.removeLaunch(launch);
             }
-            monitor.done();
+            monitor.done();        
+            if (serverProc != null) {
+               serverProc.destroy();
+            }
         }
     }
+    
+    protected void setConfigIfNotFromShortcut(ILaunchConfiguration config, String mode, IProgressMonitor monitor) 
+               throws CoreException {
+       installPackages(config, mode, monitor);
+    }
+    
+    private boolean fromShortcut(ILaunchConfiguration config) {
+       boolean result = false;
+               try {
+                       ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+                       result = wc.getAttribute(ITizenLaunchConfigurationConstants.ATTR_FROM_SHORTCUT, false);
+                       if (result) {
+                               wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_FROM_SHORTCUT, !result);
+                               wc.doSave();
+                       }
+               } catch (CoreException e) {
+                       e.printStackTrace();
+               }               
+               return result;         
+    }
 
     protected void processPostDebug(ILaunchConfiguration config)
             throws CoreException {
         if (debugSession != null) {
-            try {
-                Process process = debugSession.getSessionProcess();
-                if (process != null)
-                    process.waitFor();
-            } catch (Exception e) {
-                // do nothing
+            Process process;
+                       try {
+                               process = debugSession.getSessionProcess();
+                       } catch (CDIException e) {
+                               e.printStackTrace();
+                               process = null;
+                       }
+            if (process != null) {
+                               try {
+                                       process.waitFor();
+                               } catch (InterruptedException e) {
+                                       e.printStackTrace();
+                               }
             }
         }
         ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
         String gdbserverPort = wc.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
         if (localDebugPort != -1) {
-            try {
-                currentDevice.removeForward(localDebugPort, Integer.parseInt(gdbserverPort));
-            } catch (Exception e) {
-                // do nothing
-            }
+               try {
+                               currentDevice.removeForward(localDebugPort, Integer.parseInt(gdbserverPort));
+                       } catch (NumberFormatException e) {
+                               e.printStackTrace();
+                       } catch (TimeoutException e) {
+                               e.printStackTrace();
+                       } catch (SdbCommandRejectedException e) {
+                               e.printStackTrace();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       }
+        }
+    }
+    
+    protected boolean packagingProject(IProject targetProj, IConfiguration config, IProgressMonitor monitor) {
+       boolean packagingResult = false;
+       
+               packagingResult = PlatformProjectPackaging.RPMPackaging(targetProj, config, monitor);
+               
+       if (packagingResult) {
+               DialogUtil.openMessageDialog(shell, CommonBuildMessages.BUILD_RESULT, 
+                               CommonBuildMessages.SUCCESS_TO_BUILD_PACKAGE);                  
+       } else {
+               DialogUtil.openErrorDialog(shell, CommonBuildMessages.BUILD_RESULT, 
+                               CommonBuildMessages.FAIL_TO_BUILD_PACKAGE);
+       }
+        
+        return packagingResult;
+    }
+    
+    protected void installPackages(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
+       IProject platformProject = getProject(config);
+       IProject appProject = null;
+       final PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+       
+               boolean reinstallOp = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, true);              
+               boolean selectPkgOp = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);
+       String appProjectName = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_APP_PROJECT_NAME, "");      
+       @SuppressWarnings("unchecked")
+               ArrayList<String> extraPkgs = 
+                       (ArrayList<String>) config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_EXTRA_PACKAGE_LIST, new ArrayList<String>());
+       
+       ArrayList<LocalPackage> appPkgs = null;
+       ArrayList<LocalPackage> packages = new ArrayList<LocalPackage>();       
+       
+       String buildConfigName = getBuildConfigName(config);
+       IConfiguration buildConfig = getBuildConfiguration(buildConfigName, platformProject);
+               String targetID = PlatformConfigurationManager.getBuildTargetName(buildConfig);
+               
+       final ArrayList<LocalPackage> platformPkgs = launchUtils.getProjectPackages(platformProject, buildConfigName);          
+               if (platformPkgs.isEmpty()) {
+                       String msg = String.format(TizenDebianLaunchMessages.QUESTION_PACKAGING, platformProject.getName());
+               if (64 == DialogUtil.openQuestionDialog(msg)) {
+                       if (packagingProject(platformProject, buildConfig, new SubProgressMonitor(monitor, 1))) {
+                               platformPkgs.addAll(launchUtils.getProjectPackages(platformProject, buildConfigName));
+                       } else {
+                               if (64 != DialogUtil.openQuestionDialog(TizenDebianLaunchMessages.QUESTION_CONTINUE)) {
+                                       newCoreException(TizenDebianLaunchMessages.CANCELED_LAUNCH, null);
+                               }                                       
+                       }
+               }
+               }
+               
+               packages.addAll(platformPkgs);
+               
+               if (!appProjectName.isEmpty()) {
+                       appProject = launchUtils.getProjectInstance(appProjectName);
+                       appPkgs = launchUtils.getProjectPackages(appProject, buildConfigName);
+                       
+                       if (appPkgs.isEmpty()) {
+                               String msg = String.format(TizenDebianLaunchMessages.QUESTION_PACKAGING, appProject.getName());
+                       if (64 == DialogUtil.openQuestionDialog(msg)) {
+                               if (packagingProject(appProject, buildConfig, new SubProgressMonitor(monitor, 1))) {
+                                       appPkgs.addAll(launchUtils.getProjectPackages(appProject, buildConfigName));
+                               } else {
+                                       if (64 != DialogUtil.openQuestionDialog(TizenDebianLaunchMessages.QUESTION_CONTINUE)) {
+                                               newCoreException(TizenDebianLaunchMessages.CANCELED_LAUNCH, null);
+                                       }                                       
+                               }
+                       }
+                       }
+                       
+                       packages.addAll(appPkgs);
+       }
+
+               if (!extraPkgs.isEmpty()) {
+                       packages.addAll(launchUtils.getLocalPackages(extraPkgs));
+               }       
+
+        String path = "";
+        try {
+               path = SmartBuildInterface.getInstance().getRootstrapPath(targetID);
+        } catch (SBIException e) {
+            newCoreException(TizenDebianLaunchMessages.CANNOT_FIND_HOST_ROOTSTRAP_PATH, e);
+        }
+        
+        final String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(path);
+        
+               final ArrayList<LocalPackage> BuildSystemPkgs = new ArrayList<LocalPackage>();
+               final ArrayList<LocalPackage> DevicePkgs = new ArrayList<LocalPackage>();
+               
+        if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+               launchUtils.filterBuildsystemPkgs(packages, BuildSystemPkgs, rootstrapPath, reinstallOp);
         }
+               launchUtils.filterDevicePackages(packages, DevicePkgs, currentDevice, reinstallOp);
+
+               try {                   
+                       monitor.beginTask(TizenDebianLaunchMessages.INSTALL_PACKAGE, 4);                        
+                       monitor.subTask(TizenDebianLaunchMessages.CHECK_PKG_STATUS);
+
+                       if (selectPkgOp) {
+                               if (!openPkgStatusDialog(BuildSystemPkgs, DevicePkgs)) {
+                                       newCoreException(TizenDebianLaunchMessages.CANCELED_LAUNCH, null);
+                               }
+                       }
+                       
+                       ArrayList<LocalPackage> selecteBsPkgs = launchUtils.getSelectedPackages(BuildSystemPkgs);
+                       ArrayList<LocalPackage> selecteDvPkgs = launchUtils.getSelectedPackages(DevicePkgs);
+                       
+                       monitor.worked(1);
+                       monitor.subTask(TizenDebianLaunchMessages.INSTALL_PACKAGES_TO_BUILDSYSTEM);
+                       if (selecteBsPkgs != null && !selecteBsPkgs.isEmpty()) {
+                               launchUtils.installPkgsToRootstrap(selecteBsPkgs, rootstrapPath, new SubProgressMonitor(monitor, 1));
+                       }
+
+                       monitor.subTask(TizenDebianLaunchMessages.INSTALL_PACKAGES_TO_DEVICE);
+                       if (selecteDvPkgs != null && !selecteDvPkgs.isEmpty()) {
+                               launchUtils.installPkgsToDevice(selecteDvPkgs, currentDevice, new SubProgressMonitor(monitor, 1));
+                       }
+
+                       monitor.done(); 
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+               }               
     }
 
     protected void verifyTizenDebianProjectSettings(ILaunchConfiguration config) throws CoreException {
@@ -179,6 +355,10 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
     }
     
     protected void verifyBuildConfiguration(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
+       
+       monitor.beginTask("Verifying build configuration", 2);
+        monitor.subTask(TizenLaunchMessages.PREPARE_TO_LAUNCH);
+        
         // FIXME : Match by deviceType, not buildTargetArchitecture.
         IProject project = getProject(config);
         String buildConfigName = getBuildConfigName(config);
@@ -187,13 +367,14 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
         //String buildTargetArchitecture = SLPConfigurationManager.getArchitecture(configuration);
         //String buildTargetArchitecture = CommonConfigurationOld.getArchitecture(configuration);
         String buildTargetArchitecture = CommonConfigurationManager.getArchitecture(configuration);
-        if (currentDevice.isEmulator()) {
-            if(!buildTargetArchitecture.equals("i386"))
+        if (currentDevice.isEmulator() && currentDevice.getArch() == Arch.X86) {
+               if(!PlatformConfigurationManager.isEmulatorArch(buildTargetArchitecture))
                 resolveProblematicConfiguration(config, "i386");
         } else {            
-            if(!buildTargetArchitecture.equals("armel"))
+            if(!PlatformConfigurationManager.isDeviceArch(buildTargetArchitecture))
                 resolveProblematicConfiguration(config, "armel");
         }
+        monitor.done();
     }
 
     protected void resolveProblematicConfiguration(ILaunchConfiguration config, final String arch) throws CoreException {
@@ -215,7 +396,7 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
     }
 
     protected IConfiguration selectBuildConfiguration(IProject project, String arch) {
-        Shell shell = LaunchUIPlugin.getShell();
+               Shell shell = LaunchUIPlugin.getShell();
 
         ILabelProvider topprovider = new LabelProvider() {
             public String getText(Object element) {
@@ -296,7 +477,7 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
 
     protected void verifyDeviceReachability(IProject project, IProgressMonitor monitor) throws CoreException {
         try {
-            monitor.beginTask(TizenLaunchMessages.PREPARE_TO_LAUNCH, 1);
+            monitor.beginTask(TizenLaunchMessages.PREPARE_TO_LAUNCH, 2);
             monitor.subTask(TizenLaunchMessages.PREPARE_TO_LAUNCH);
 
             currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
@@ -312,23 +493,26 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
     protected void launchApplicationForRun(ILaunchConfiguration config, ILaunch launch,
             IProgressMonitor monitor) throws CoreException {
         try {
-            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 10);
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 2);
             monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
             String envCmd = setEnvironments(config);
             String execArg = setArguments(config);
             currentDevice.executeShellCommand(envCmd + execArg);
+        } catch (IOException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e);
         } finally {
+               monitor.worked(1);
             monitor.done();
         }
     }
 
     protected void launchApplicationForDebug(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
         try {
-            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 10);
+            monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 1);
             monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION);
-            launchApplicationWithGDBServer(launch, config, new SubProgressMonitor(monitor, 1));
+            launchApplicationWithGDBServer(launch, config, new SubProgressMonitor(monitor, 1));            
             launchApplicationWithGDBClient(launch, config, exeFile, new SubProgressMonitor(monitor, 1));
         } finally {
             monitor.done();
@@ -338,13 +522,26 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
     protected void launchApplicationWithGDBServer(ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
         try {
             monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER, 1);
-            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);
-            String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
-            String gdbserverCmd = DebugTool.TOOLS_TARGET_PATH + "/" + GDBSERVER_DIR + "/" + GDBSERVER_BIN + " :" + gdbserverPort;
+            monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);            
+            
+               IPath path = getHostPath(TizenPlatformConstants.HOST_GDBSERVER_PATH, config);
+               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();                    
+               launchUtils.readyGdbServer(currentDevice, tizenCommand, path);
+               
+            String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);           
+            String gdbserverCmd = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " :" + gdbserverPort;
             String execArg = setArguments(config);
             String envCmd = setEnvironments(config);
             String command = envCmd + gdbserverCmd + " " + execArg;
-            currentDevice.executeShellCommand(command);
+            serverProc = currentDevice.executeShellCommand(command);
+               } catch (TimeoutException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+               } catch (SdbCommandRejectedException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } catch (IOException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
         } finally {
@@ -378,6 +575,10 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
                         "Tizen debugger",
                         iproc, exeFile, true, false, attrDebuggerStopAtMainSymbol, true);
             }
+        } catch (DebugException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
         } finally {
@@ -388,7 +589,7 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
     protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
         ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
         wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
-        wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, LOCALHOST);
+        wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, TizenPlatformConstants.LOCALHOST);
         String gdbserverPort = wc.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
         wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
         try {
@@ -399,7 +600,15 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
             String localPort = Integer.valueOf(localDebugPort).toString();
             wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort);
             wc.doSave();
-        } catch (Exception e) {
+               } catch (TimeoutException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+               } catch (SdbCommandRejectedException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (IOException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (NumberFormatException e) {
             newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
         }
     }
@@ -426,7 +635,7 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
         String envs = "";
         String[] envArray = getEnvironment(config);
         for (String env : envArray)
-            envs = ENVIRONMENT_SETTING_CMD + env + " && ";
+            envs = TizenPlatformConstants.ENVIRONMENT_SETTING_CMD + env + " && ";
         return envs;
     }
 
@@ -501,16 +710,32 @@ public class TizenDebianLaunchDelegate extends AbstractCLaunchDelegate {
         CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(getProject(config));        
         String targetID = builder.getTargetID();
 
-        String rootstrapPath = "";
+        String path = "";
         try {
-            rootstrapPath = SmartBuildInterface.getInstance().getRootstrapPath(targetID);
+            path = SmartBuildInterface.getInstance().getRootstrapPath(targetID);
         } catch (SBIException e) {
             newCoreException(TizenDebianLaunchMessages.CANNOT_FIND_HOST_ROOTSTRAP_PATH, e);
         }
 
+        String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(path);
         if (!rootstrapPath.equals(""))
             rootstrapPath = rootstrapPath.concat(exePath);
 
         return new Path(rootstrapPath);
     }
-}
\ No newline at end of file
+    
+       protected boolean openPkgStatusDialog(final ArrayList<LocalPackage> BuildSystemPkgs, final ArrayList<LocalPackage> DevicePkgs) {                
+               SWTUtil.syncExec(new Runnable() {
+            public void run() {
+               ShowPackageStatusDialog statusDlg = new ShowPackageStatusDialog(shell, BuildSystemPkgs, DevicePkgs);
+                               if (Window.OK  == statusDlg.open()) {
+                                       result = true;
+                               } else {
+                                       result = false;
+                               }
+            }
+        });
+               
+               return result;
+       }
+}
index 444ec90..d79d57e 100644 (file)
@@ -1,68 +1,72 @@
 /*
-* Native Platform
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch;
 
+import java.io.IOException;
+import java.util.ArrayList;
+
 import org.eclipse.cdt.core.IProcessInfo;
-import org.eclipse.cdt.core.IProcessList;
 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
 import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
-import org.eclipse.cdt.launch.internal.ui.LaunchImages;
-import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IProject;
 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.core.runtime.SubProgressMonitor;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-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.common.connection.debugtools.DebugTool;
-import org.tizen.nativecommon.launch.TizenDeviceProcessList;
+import org.eclipse.debug.core.ILaunchManager;
+import org.tizen.common.TizenPlatformConstants;
+import org.tizen.common.util.DialogUtil;
+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.sdblib.SdbCommandRejectedException;
+import org.tizen.sdblib.TimeoutException;
 
 public class TizenDebianLaunchDelegateForAttach extends TizenDebianLaunchDelegate {
-    protected Integer pid = Integer.valueOf(-1);
-    protected final String ATTACH_OPTION = " --attach ";
+
+       protected Integer pid = Integer.valueOf(-1);    
+       protected IProcessInfo procInfo = null;
 
     @Override
     protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException {
         ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+
+        pid = wc.getAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSID_OPTION, -1);
         wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true);
-        wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, LOCALHOST);
+        wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, TizenPlatformConstants.LOCALHOST);
         String gdbserverPort = wc.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);
         wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
         try {
@@ -73,27 +77,52 @@ public class TizenDebianLaunchDelegateForAttach extends TizenDebianLaunchDelegat
             String localPort = Integer.valueOf(localDebugPort).toString();
             wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort);
             wc.doSave();
-        } catch (Exception e) {
+               } catch (TimeoutException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+               } catch (SdbCommandRejectedException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
+        } catch (IOException e) {
             newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e);
         }
     }
     
     @Override
+    protected void setConfigIfNotFromShortcut(ILaunchConfiguration config, String mode, IProgressMonitor monitor) 
+               throws CoreException {
+       setAttachProcess(config);
+       installPackages(config, mode, monitor);
+    }
+    
+    @Override
     protected void launchApplicationWithGDBServer(ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {        
         try {
             monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER, 1);
             monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBSERVER);
+            
+               IPath path = getHostPath(TizenPlatformConstants.HOST_GDBSERVER_PATH, config);
+               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();                    
+               launchUtils.readyGdbServer(currentDevice, tizenCommand, path);
 
-            setPID();
-            if (pid.equals(Integer.valueOf(-1)) || pid.equals(Integer.valueOf(0)))
+            if (pid.equals(Integer.valueOf(-1)) || pid.equals(Integer.valueOf(0))) {
                 newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER + ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID, null);
+            }
 
             String gdbserverPort = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT, TizenLaunchConfigurationConstants.ATTR_GDBSERVER_PORT_DEFAULT);            
-            String commandArguments =  ":" + gdbserverPort + ATTACH_OPTION + pid;
-            String gdbserverCmd = DebugTool.TOOLS_TARGET_PATH + "/" + GDBSERVER_DIR + "/" + GDBSERVER_BIN + " " + commandArguments;
+            String commandArguments =  ":" + gdbserverPort + TizenPlatformConstants.ATTACH_OPTION + pid;
+            String gdbserverCmd = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " " + commandArguments;
             String envCmd = setEnvironments(config);
             String command = envCmd + gdbserverCmd;
-            currentDevice.executeShellCommand(command);
+            serverProc = currentDevice.executeShellCommand(command);
+               } catch (TimeoutException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+               } catch (SdbCommandRejectedException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
+        } catch (IOException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
         } finally {
@@ -101,71 +130,91 @@ public class TizenDebianLaunchDelegateForAttach extends TizenDebianLaunchDelegat
         }
     }
     
-    private void setPID() {
-        Display.getDefault().syncExec(new Runnable() {
-            public void run() {
-                pid = promptForProcessID();
-            }
-        }); 
-    }
-
-    private Integer promptForProcessID() {
-        try {
-            return selectProcess();
-        } catch (CoreException e) {
-            return Integer.valueOf(-1);
-        }
-    }
+    private void setAttachProcess(ILaunchConfiguration config) throws CoreException {
+       final PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+       String processName = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSNAME_OPTION, "");
+       
+       IProcessInfo procInfo = launchUtils.getProcess(shell, currentDevice, processName);
+       if (procInfo == null) {
+               newCoreException("Canceled", null);
+       }
+       
+       String programPath = procInfo.getName().trim();
+       int pid = procInfo.getPid();
+       
+       ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+       wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programPath);
+       wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSID_OPTION, pid);
+       wc.doSave();
+    }    
     
-    private Integer selectProcess() throws CoreException {
-        Shell shell = LaunchUIPlugin.getShell();
-        if (shell == null)
-            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, null);
-
-        ILabelProvider topprovider = new LabelProvider() {
-            public String getText(Object element) {
-                IProcessInfo pinfo = (IProcessInfo)element;
-                IPath ppath = new Path(pinfo.getName());
-                return ppath.lastSegment() + " - " + pinfo.getPid(); //$NON-NLS-1$
-            }
+    protected void installPackages(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException {
+               IProject platformProject = getProject(config);
+               final PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+               
+               boolean reinstallOp = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, true);              
+               boolean selectPkgOp = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);              
+               
+               ArrayList<LocalPackage> packages = new ArrayList<LocalPackage>();       
+               
+               String buildConfigName = getBuildConfigName(config);
+               IConfiguration buildConfig = getBuildConfiguration(buildConfigName, platformProject);
+               String targetID = PlatformConfigurationManager.getBuildTargetName(buildConfig);
+               
+               final ArrayList<LocalPackage> platformPkgs = launchUtils.getProjectPackages(platformProject, buildConfigName);          
+               if (platformPkgs.isEmpty()) {
+                       String msg = String.format(TizenDebianLaunchMessages.QUESTION_PACKAGING, platformProject.getName());
+               if (64 == DialogUtil.openQuestionDialog(msg)) {
+                       if (packagingProject(platformProject, buildConfig, new SubProgressMonitor(monitor, 1))) {
+                               platformPkgs.addAll(launchUtils.getProjectPackages(platformProject, buildConfigName));
+                       } else {
+                               if (64 != DialogUtil.openQuestionDialog(TizenDebianLaunchMessages.QUESTION_CONTINUE)) {
+                                       newCoreException(TizenDebianLaunchMessages.CANCELED_LAUNCH, null);
+                               }                                       
+                       }
+               }
+               }
+               
+               packages.addAll(platformPkgs);
 
-            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();
+            String path = "";
+            try {
+               path = SmartBuildInterface.getInstance().getRootstrapPath(targetID);
+            } catch (SBIException e) {
+                newCoreException(TizenDebianLaunchMessages.CANNOT_FIND_HOST_ROOTSTRAP_PATH, e);
             }
-
-            public Image getImage(Object element) {
-                return LaunchImages.get(LaunchImages.IMG_OBJS_EXEC);
+            
+            final String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(path);
+            
+               final ArrayList<LocalPackage> BuildSystemPkgs = new ArrayList<LocalPackage>();
+               final ArrayList<LocalPackage> DevicePkgs = new ArrayList<LocalPackage>();
+               
+            if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+               launchUtils.filterBuildsystemPkgs(packages, BuildSystemPkgs, rootstrapPath, reinstallOp);
             }
-        };
-        
-        TwoPaneElementSelector dlg = new TwoPaneElementSelector(shell, topprovider, downprovider);
-        dlg.setTitle("Select Process"); //$NON-NLS-1$
-        dlg.setMessage("Select a Process to attach debugger to:"); //$NON-NLS-1$
-        
-        IProcessList processList = null;
-        processList = new TizenDeviceProcessList(currentDevice);    
             
-        IProcessInfo pInfos[] = null;
-        pInfos = processList.getProcessList();
+               try {                   
+                       monitor.beginTask(TizenDebianLaunchMessages.INSTALL_PACKAGE, 4);                        
+                       monitor.subTask(TizenDebianLaunchMessages.CHECK_PKG_STATUS);
 
-        if(pInfos == null)
-            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, null);
-
-        dlg.setElements(pInfos);
-        
-        if (dlg.open() == Window.OK) {
-            IProcessInfo info = (IProcessInfo)dlg.getFirstResult();
-            if (info != null)
-                return Integer.valueOf(info.getPid());
-        }
-
-        return Integer.valueOf(-1);
-    }
+                       if (selectPkgOp) {
+                               if (!openPkgStatusDialog(BuildSystemPkgs, DevicePkgs)) {
+                                       newCoreException(TizenDebianLaunchMessages.CANCELED_LAUNCH, null);
+                               }
+                       }
+                       
+                       ArrayList<LocalPackage> selecteBsPkgs = launchUtils.getSelectedPackages(BuildSystemPkgs);
+                       
+                       monitor.worked(1);
+                       monitor.subTask(TizenDebianLaunchMessages.INSTALL_PACKAGES_TO_BUILDSYSTEM);
+                       if (selecteBsPkgs != null && !selecteBsPkgs.isEmpty()) {
+                               launchUtils.installPkgsToRootstrap(selecteBsPkgs, rootstrapPath, new SubProgressMonitor(monitor, 1));
+                       }
+                       monitor.subTask(TizenDebianLaunchMessages.INSTALL_PACKAGES_TO_DEVICE);
+                       // Nothing to do for device
+                       monitor.done(); 
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+               }               
+    } 
 }
\ No newline at end of file
index de15700..9bcdd81 100644 (file)
@@ -1,31 +1,30 @@
 /*
-* Native Platform
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch;
 
 import java.io.File;
@@ -48,6 +47,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
@@ -57,7 +57,7 @@ import org.eclipse.debug.core.model.IProcess;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
-
+import org.tizen.common.TizenPlatformConstants;
 import org.tizen.common.connection.ui.TizenRemoteFileDialog;
 import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult;
 import org.tizen.nativecommon.launch.TizenLaunchMessages;
@@ -67,7 +67,6 @@ import org.tizen.sdblib.SyncService;
 import org.tizen.sdblib.SyncService.SyncResult;
 
 public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate {
-    protected final static String DEFAULT_CORE_DIR = "/opt/bs/core";
     private FileEntry coreDir = null;
 
     @Override
@@ -76,7 +75,7 @@ public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate
         wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
         wc.doSave();
     }
-    
+
     @Override
     protected void launchApplicationForDebug(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
         try {
@@ -94,7 +93,7 @@ public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate
         try {
             monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBCLIENT, 2);
             monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBCLIENT);
-            
+
             ICDebugConfiguration debugConfiguration = getDebugConfig(config);
             String strPath = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, "");
 
@@ -105,13 +104,13 @@ public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate
                     newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null);
                 String projectPath = project.getLocation().toOSString();
                 String coreFilePath = projectPath + "/core." + project.getName();
-                boolean isSuccess = false;                 
+                boolean isSuccess = false;
                 try {
                     isSuccess = downloadCoreFile(remotePath, coreFilePath, new SubProgressMonitor(monitor, 1));
                 } catch (IOException e) {
                     newCoreException(TizenLaunchMessages.CANNOT_FIND_CORE_FILE, e);
                 }
-                
+
                 if(isSuccess == false)
                     newCoreException(TizenLaunchMessages.CANNOT_FIND_CORE_FILE, null);
 
@@ -133,7 +132,7 @@ public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate
             }
             String appPath = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
             IPath hostPath = getHostPath(appPath, config);
-    
+
             GDBCDIDebugger2 debugger = new GDBCDIDebugger2();
             ICDISession debugSession = ((ICDIDebugger2)debugger).createSession(launch, hostPath.toFile(), new SubProgressMonitor(monitor, 1));
             if(debugSession == null)
@@ -154,6 +153,10 @@ public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate
                         iproc, exeFile, true, false, "false", true);
                 monitor.worked(1);
             }
+        } catch (DebugException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
+        } catch (CoreException e) {
+            newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
         } catch (Exception e) {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e);
         } finally {
@@ -164,19 +167,19 @@ public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate
             monitor.done();
         }
     }
-    
+
     private FileEntry promptForCoreFilePath(final IProject project, ICDebugConfiguration debugConfig) throws CoreException {
         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
         if (window == null) {
             IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
             window = windows[0];
         }
-        
+
         final Shell shell = window.getShell();
         if (shell != null) {
             shell.getDisplay().syncExec(new Runnable() {
                 public void run() {
-                    TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, "Select a directory where exist coredump file", currentDevice, true, DEFAULT_CORE_DIR);
+                    TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, "Select a directory where exist coredump file", currentDevice, true, TizenPlatformConstants.PUBICL_PLATFORM_CORE_PATH);
                     if (dlg.open() == TizenRemoteFileDialogResult.OK)
                         coreDir = dlg.getSelectedFileEntry();
                     else
@@ -217,9 +220,9 @@ public class TizenDebianLaunchDelegateForCore extends TizenDebianLaunchDelegate
 
         if (found == null)
             return false;
-        
+
         SyncResult result = currentDevice.getSyncService().pullFile(found.getFullPath(), destFilePath, true, SyncService.getNullProgressMonitor());
-        
+
         if (result.getCode() == SyncService.RESULT_OK)
             return  true;
         else
index 35705c8..f65e233 100644 (file)
@@ -1,31 +1,30 @@
 /*
-* Native Platform
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch;
 
 import org.eclipse.osgi.util.NLS;
@@ -58,4 +57,11 @@ public class TizenDebianLaunchMessages extends NLS {
        public static String CREATE_PACKAGE;
        public static String TRANSFER_PACKAGE;
        public static String INSTALL_PACKAGE;
+       public static String INSTALL_PACKAGES_TO_BUILDSYSTEM;
+       public static String INSTALL_PACKAGES_TO_DEVICE;
+       public static String CHECK_PKG_STATUS;
+       public static String CANCELED_LAUNCH;
+       public static String QUESTION_PACKAGING;
+       public static String QUESTION_CONTINUE;
+       public static String FAILED_INSTALL_PKGS;
 }
index 831e591..431df9e 100644 (file)
@@ -1,23 +1,30 @@
-CANNOT_FIND_PROJECT_NAME = Cannot find a project name.
-CANNOT_CONNECT_TO_DEVICE = Cannot connect to a device.
-CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP = Cannot find binary file in a host rootstrap.
-CANNOT_CREATE_PACKAGE = Cannot create package.
-CANNOT_TRANSFER_FILE = Cannot transfer file.
-CANNOT_INSTALL = Cannot install application.
-CANNOT_LAUNCH = Cannot launch application.
-CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER = Cannot launch application with GDBServer.
-CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT = Cannot launch application with GDBClient.
-BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE = Build configuration does not match with current device type. Select correct device or build configuration.
-CANNOT_FIND_HOST_ROOTSTRAP_PATH = Cannot find host rootstrap path.
-CANNOT_FIND_DEBIAN_CONTROL_FILE = Cannot find debian control file.
-CANNOT_FIND_PACKAGE_SECTION_IN_CONTROL_FILE = Cannot find package section in control file.
+CANNOT_FIND_PROJECT_NAME = Project name not found.
+CANNOT_CONNECT_TO_DEVICE = Device connection failed.
+CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP = Binary file not found in the host rootstrap.
+CANNOT_CREATE_PACKAGE = Package creation failed.
+CANNOT_TRANSFER_FILE = File transfer failed.
+CANNOT_INSTALL = Application installation failed.
+CANNOT_LAUNCH = Application launch failed.
+CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER = Application launch with GDBServer failed.
+CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT = Application launch with GDBClient failed.
+BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE = Build configuration does not match the current device type. Select the correct device or build configuration.
+CANNOT_FIND_HOST_ROOTSTRAP_PATH = Host rootstrap path not found.
+CANNOT_FIND_DEBIAN_CONTROL_FILE = Debian control file not found.
+CANNOT_FIND_PACKAGE_SECTION_IN_CONTROL_FILE = Package section not found in the control file.
 OPERATION_CANCELED = Operation canceled.
 
-LAUNCH_APPLICATION = Launching Application...
-LAUNCH_APPLICATION_WITH_GDBSERVER = Launching application with GDBServer...
-LAUNCH_APPLICATION_WITH_GDBCLIENT = Launching application with GDBClient...
+LAUNCH_APPLICATION = Launching the application...
+LAUNCH_APPLICATION_WITH_GDBSERVER = Launching the application with GDBServer...
+LAUNCH_APPLICATION_WITH_GDBCLIENT = Launching the application with GDBClient...
 PREPARE_TO_LAUNCH = Preparing to launch...
-START_DEPLOY_PROCESS = Start deploy process...
-CREATE_PACKAGE = Creating package...
-TRANSFER_PACKAGE = Transferring package...
-INSTALL_PACKAGE = Installing package...
+START_DEPLOY_PROCESS = Starting the deployment process...
+CREATE_PACKAGE = Creating the package...
+TRANSFER_PACKAGE = Transferring the package...
+INSTALL_PACKAGE = Installing the package...
+INSTALL_PACKAGES_TO_BUILDSYSTEM = Installing packages to buildsystem  
+INSTALL_PACKAGES_TO_DEVICE = Installing packages to device
+CHECK_PKG_STATUS = Checking package status
+CANCELED_LAUNCH = Canceled launching
+QUESTION_PACKAGING = "%s" project does not have package files(*.rpm)\nDo you want packaging now ?\n
+QUESTION_CONTINUE = Do you want to continue ?
+FAILED_INSTALL_PKGS = Failed to install packages. See below logs
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/LaunchTabUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/LaunchTabUIMessages.properties
new file mode 100644 (file)
index 0000000..d4b36e6
--- /dev/null
@@ -0,0 +1,25 @@
+AppPage.Title = Setting Tizen Application
+AppPage.Desc = Please select a tizen application or add RPM files for testing
+Label.AdditionPkgs = Additional Packages:
+Label.App.Project = Tizen Application Project:
+Label.App.Path = Tizen Application Path:
+Label.Proc.Name = Attach Process:
+File.Dialog.Title.File = Select RPM files
+
+BinPage.Title = Setting binary path
+BinPage.Desc = Please set a path for test binary
+Button.Browse = Remote Browse...
+Button.Find = Find
+Remote.Dialog.Title = Select an Application
+
+ProcPage.Title = Select Process
+ProcPage.Desc = Please select a process for attach debugging
+
+PkgDialog.Title = Select packages to be installed
+PkgDialog.Desc = Checked packages will be installed to buildsystem and device
+PkgDialog.Label.Buildsystem = To Buildsystem:
+PkgDialog.Label.Device = To Device:
+
+Button.Reinstall.Op = Reinstall if the package is already present
+Button.SelectPkg.Op = Select packages to be installed manually
\ No newline at end of file
index ef937a5..852164d 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui;
 
 import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
index 2ba3d04..c5a1732 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui;
 
 import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
index 0412fb5..18b5245 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui;
 
 import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainAttachTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainAttachTab.java
new file mode 100644 (file)
index 0000000..f5b5e2a
--- /dev/null
@@ -0,0 +1,471 @@
+/*
+ * 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.launch.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.core.IProcessInfo;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
+import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.cdt.launch.ui.CMainTab;
+import org.eclipse.cdt.ui.CElementLabelProvider;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+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.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.connection.ui.TizenRemoteFileDialog;
+import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult;
+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.pkgmgr.RPMPackageCommander;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+
+import org.tizen.sdblib.FileListingService.FileEntry;
+import org.tizen.sdblib.IDevice;
+
+public class TizenDebianMainAttachTab extends CMainTab {
+       
+       private final String BUNDLE_NAME = TizenDebianMainAttachTab.class.getPackage().getName() + ".LaunchTabUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       private Label fProcLabel;
+       private Text fProgText;
+       private Text fProcText;
+       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 static final String DEFAULT_APP_PATH = "/opt/apps/";
+       private String filePath = "";
+       private String selectedFileList = "";
+       
+       public TizenDebianMainAttachTab() {
+               this(false);
+       }
+       
+       public TizenDebianMainAttachTab(boolean specifyCoreFile) {
+               fSpecifyCoreFile = specifyCoreFile;
+               device = ConnectionPlugin.getDefault().getCurrentDevice();
+       }
+       
+       @Override
+       public void createControl(Composite parent) {
+               Composite comp = new Composite(parent, SWT.NONE);
+               setControl(comp);
+
+               GridLayout topLayout = new GridLayout();
+               comp.setLayout(topLayout);
+
+               createVerticalSpacer(comp, 1);          
+               createProjectGroup(comp, 1);
+               createProcessGroup(comp, 1);
+               createOptionGroupComposite(comp);
+               
+               if (fSpecifyCoreFile)
+                       createCoreFileGroup(comp, 1);
+               createVerticalSpacer(comp, 1);
+       }
+
+
+       @Override
+       protected String handleBrowseButtonSelected() {
+               FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE);
+               if (fProgText != null)
+                       fileDialog.setFileName(fProgText.getText());
+               else if (fCoreText != null)
+                       fileDialog.setFileName(fCoreText.getText());
+               return fileDialog.open();
+       }
+       
+       private void createOptionGroupComposite(Composite parent) {
+               Composite composite = new Composite(parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_END));
+               GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 1;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);
+               
+               fReinstallOp = new Button(composite, SWT.CHECK);
+               fReinstallOp.setText(resources.getString("Button.Reinstall.Op"));
+               fSelectPkgOp = new Button(composite, SWT.CHECK);
+               fSelectPkgOp.setText(resources.getString("Button.SelectPkg.Op"));
+               
+               fReinstallOp.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent evt) {
+                updateLaunchConfigurationDialog();
+            }
+        });
+               
+               fSelectPkgOp.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent evt) {
+                updateLaunchConfigurationDialog();
+            }
+        });
+       }
+       
+       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();
+               projLayout.numColumns = 2;
+               projLayout.marginHeight = 0;
+               projLayout.marginWidth = 0;
+               projComp.setLayout(projLayout);
+               GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+               gd.horizontalSpan = colSpan;
+               projComp.setLayoutData(gd);
+
+               fProcLabel = new Label(projComp, SWT.NONE);
+               fProcLabel.setText(resources.getString("Label.Proc.Name")); 
+               gd = new GridData();
+               gd.horizontalSpan = 2;
+               fProcLabel.setLayoutData(gd);
+
+               fProcText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
+               gd = new GridData(GridData.FILL_HORIZONTAL);
+               fProcText.setLayoutData(gd);
+               fProcText.addModifyListener(new ModifyListener() {
+
+                       public void modifyText(ModifyEvent evt) {
+                               // if project changes, invalidate program name cache
+                               fPreviouslyCheckedProgram = null;
+                               
+                               updateBuildConfigCombo(""); //$NON-NLS-1$
+                               updateLaunchConfigurationDialog();
+                       }
+               });
+
+               fProcButton = createPushButton(projComp, resources.getString("Button.Find"), null);
+               fProcButton.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent evt) {
+                               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+                               IProcessInfo procInfo = launchUtils.getProcess(getShell(), device);
+                               if (procInfo != null) {
+                                       IPath ppath = new Path(procInfo.getName());
+                                       String name = ppath.lastSegment().trim();
+                                       fProcText.setText(name);
+                                       updateLaunchConfigurationDialog();
+                               }
+                       }
+               });
+       }
+       
+       protected ICProject chooseCAppProject(String currentProjectName) {
+               
+               try {
+                       ICProject[] projects = getCProjects(currentProjectName);                        
+
+                       ILabelProvider labelProvider = new CElementLabelProvider();
+                       ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
+                       dialog.setTitle(LaunchMessages.CMainTab_Project_Selection); 
+                       dialog.setMessage(LaunchMessages.CMainTab_Choose_project_to_constrain_search_for_program); 
+                       dialog.setElements(projects);
+
+                       ICProject cProject = getCProject();
+                       if (cProject != null) {
+                               dialog.setInitialSelections(new Object[] { cProject });
+                       }
+                       if (dialog.open() == Window.OK) {
+                               return (ICProject)dialog.getFirstResult();
+                       }
+               } catch (CModelException e) {
+                       LaunchUIPlugin.errorDialog("Launch UI internal error", e); //$NON-NLS-1$                        
+               }
+               return null;
+       }
+       
+       protected ICProject[] getCProjects(String currentProjectName) throws CModelException {
+               ICProject cproject[] = CoreModel.getDefault().getCModel().getCProjects();
+               ArrayList<ICProject> list = new ArrayList<ICProject>(cproject.length);
+
+               for (int i = 0; i < cproject.length; i++) {
+                       if (currentProjectName.length() != 0 &&
+                                       cproject[i].getProject().getName().equals(currentProjectName)) {
+                               continue;
+                       }
+                       ICDescriptor cdesciptor = null;
+                       try {
+                               cdesciptor = CCorePlugin.getDefault().getCProjectDescription((IProject) cproject[i].getResource(), false);
+                               if (cdesciptor != null) {
+                                       String projectPlatform = cdesciptor.getPlatform();
+                                       if (filterPlatform.equals("*") //$NON-NLS-1$
+                                                       || projectPlatform.equals("*") //$NON-NLS-1$
+                                                       || filterPlatform.equalsIgnoreCase(projectPlatform) == true) {
+                                               list.add(cproject[i]);
+                                       }
+                               } else {
+                                       list.add(cproject[i]);
+                               }
+                       } catch (CoreException e) {
+                               list.add(cproject[i]);
+                       }
+               }
+               return list.toArray(new ICProject[list.size()]);
+       }
+       
+       private void createExeFileField(Composite parent, int colSpan) {
+               Composite mainComp = new Composite(parent, SWT.NONE);
+               GridLayout mainLayout = new GridLayout();
+               mainLayout.numColumns = 3;
+               mainLayout.marginHeight = 0;
+               mainLayout.marginWidth = 0;
+               mainComp.setLayout(mainLayout);
+               GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+               gd.horizontalSpan = colSpan;
+               mainComp.setLayoutData(gd);
+               fProgLabel = new Label(mainComp, SWT.NONE);
+               fProgLabel.setText(resources.getString("Label.App.Path")); // $NON-NLS-1$
+               gd = new GridData();
+               gd.horizontalSpan = 3;
+               fProgLabel.setLayoutData(gd);
+               fProgText = new Text(mainComp, SWT.SINGLE | SWT.BORDER);
+               gd = new GridData(GridData.FILL_HORIZONTAL);
+               fProgText.setLayoutData(gd);
+               fProgText.addModifyListener(new ModifyListener() {
+                       public void modifyText(ModifyEvent evt) {
+                               updateLaunchConfigurationDialog();
+                       }
+               });
+               
+               Button fBrowseForBinaryButton;
+               fBrowseForBinaryButton = createPushButton(mainComp, resources.getString("Button.Browse"), null); //$NON-NLS-1$
+               fBrowseForBinaryButton.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent evt) {
+                               handleRemoteBrowseButtonSelected();
+                               updateLaunchConfigurationDialog();
+                       }
+               });
+       }
+       
+       protected void handleRemoteBrowseButtonSelected() {
+               IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+               if (window == null) {
+                       IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
+                       window = windows[0];
+               }
+
+               final Shell shell = window.getShell();
+               if (shell != null) {
+                       IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+                       if (device == null) {
+                               MessageBox msgBox = new MessageBox(shell, SWT.ICON_INFORMATION);
+                               msgBox.setMessage(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
+                               msgBox.open();
+                               return;
+                       }
+
+                       shell.getDisplay().syncExec( new Runnable() {
+                               public void run() {
+                                       IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+                                       TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, 
+                                                       resources.getString("Remote.Dialog.Title"), device, false, DEFAULT_APP_PATH);
+                                       if(dlg.open() == TizenRemoteFileDialogResult.OK) {
+                                               FileEntry selectedFile = dlg.getSelectedFileEntry();
+                                               filePath = selectedFile.getFullPath();
+                                               fProgText.setText(filePath);
+                                       } else
+                                               filePath = null;
+                               }
+                       });
+               }
+               return;
+       }
+
+       
+       @Override
+       public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+               configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true);
+               configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
+               configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
+               configuration.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, true);
+               configuration.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);
+               ICElement cElement = null;
+               cElement = getContext(configuration, getPlatform(configuration));
+               if (cElement != null)
+                       initializeCProject(cElement, configuration);
+       }
+
+       @Override
+       public void initializeFrom(ILaunchConfiguration configuration) {
+               updateProjectFromConfig(configuration);
+               updateProcessFromConfig(configuration);
+               updateReinstallOpFromConfig(configuration);
+               updateSelectPkgOpFromConfig(configuration);
+               if (fSpecifyCoreFile)
+                       updateCoreFromConfig(configuration);
+       }
+
+       @Override
+       public boolean isValid(ILaunchConfiguration config) {
+               return true;
+       }       
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.cdt.launch.ui.CMainTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+        */
+       @Override
+       public void performApply(ILaunchConfigurationWorkingCopy config) {
+               //String programPath = fProgText.getText().trim();
+               String name = fProjText.getText().trim();
+               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);
+               config.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, reinstallOp);
+               config.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, selectPkgOp);
+       }
+
+       @Override
+       protected void updateProjectFromConfig(ILaunchConfiguration config) {
+               String projectName = EMPTY_STRING;
+               try {
+                       projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, EMPTY_STRING);
+               } catch (CoreException ce) {
+                       LaunchUIPlugin.log(ce);
+               }
+               fProjText.setText(projectName);
+       }
+       
+       protected void updateProcessFromConfig(ILaunchConfiguration config) {
+               String procName = EMPTY_STRING;
+               try {
+                       procName = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSNAME_OPTION, EMPTY_STRING);
+               } catch (CoreException ce) {
+                       LaunchUIPlugin.log(ce);
+               }
+               fProcText.setText(procName);
+       }
+       
+       protected void updateReinstallOpFromConfig(ILaunchConfiguration config) {               
+               boolean option = true;
+               try {
+                       option = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, true);
+               } catch (CoreException ce) {
+                       LaunchUIPlugin.log(ce);
+               }
+               fReinstallOp.setSelection(option);
+       }
+       
+       protected void updateSelectPkgOpFromConfig(ILaunchConfiguration config) {               
+               boolean option = true;
+               try {
+                       option = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);
+               } catch (CoreException ce) {
+                       LaunchUIPlugin.log(ce);         
+               }
+               fSelectPkgOp.setSelection(option);
+       }       
+}
\ No newline at end of file
index 3aa804b..95e523a 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui;
 
 public class TizenDebianMainCoreTab extends TizenDebianMainTab {
index 9fab253..93fdf19 100644 (file)
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui;
 
+import java.util.ArrayList;
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
 import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ICProject;
 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
 import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
+import org.eclipse.cdt.launch.internal.ui.LaunchMessages;
 import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
 import org.eclipse.cdt.launch.ui.CMainTab;
+import org.eclipse.cdt.ui.CElementLabelProvider;
 import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+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.Event;
 import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
 
 import org.tizen.common.connection.ConnectionPlugin;
 import org.tizen.common.connection.ui.TizenRemoteFileDialog;
 import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult;
+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.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
 
 import org.tizen.sdblib.FileListingService.FileEntry;
 import org.tizen.sdblib.IDevice;
 
+@SuppressWarnings({ "deprecation", "restriction" })
 public class TizenDebianMainTab extends CMainTab {
+       
+       private final String BUNDLE_NAME = TizenDebianMainTab.class.getPackage().getName() + ".LaunchTabUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
        private Label fProgLabel;
        private Text fProgText;
+       private Text fAppProjText;
+       private Button fAppProjButton;
+       private Button fReinstallOp;
+       private Button fSelectPkgOp;
+       private TableViewer tableViewer;
        private boolean fSpecifyCoreFile;
-       private static final String LABEL_TEXT = "Tizen Application Path :";
+       private ArrayList<LocalPackage> packages = new ArrayList<LocalPackage>();
        private static final String DEFAULT_APP_PATH = "/opt/apps/";
-       private static final String REMOTE_BROWSE = "Remote Browse...";
-       private static final String SELECT_AN_APPLICATION = "Select an Application";
        private String filePath = "";
+       private String selectedFileList = "";
        
        public TizenDebianMainTab() {
                this(false);
@@ -89,14 +134,19 @@ public class TizenDebianMainTab extends CMainTab {
                GridLayout topLayout = new GridLayout();
                comp.setLayout(topLayout);
 
-               createVerticalSpacer(comp, 1);
-               createExeFileField(comp, 1);
+               createVerticalSpacer(comp, 1);          
                createProjectGroup(comp, 1);
+               createAppProjectGroup(comp, 1);
+               createExeFileField(comp, 1);
+               createExtraTableGroup(comp);
+               createOptionGroupComposite(comp);
+               
                if (fSpecifyCoreFile)
                        createCoreFileGroup(comp, 1);
                createVerticalSpacer(comp, 1);
        }
-       
+
+
        @Override
        protected String handleBrowseButtonSelected() {
                FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE);
@@ -107,6 +157,286 @@ public class TizenDebianMainTab extends CMainTab {
                return fileDialog.open();
        }
        
+       private void createOptionGroupComposite(Composite parent) {
+               Composite composite = new Composite(parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 1;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);
+               
+               fReinstallOp = new Button(composite, SWT.CHECK);
+               fReinstallOp.setText(resources.getString("Button.Reinstall.Op"));
+               fSelectPkgOp = new Button(composite, SWT.CHECK);
+               fSelectPkgOp.setText(resources.getString("Button.SelectPkg.Op"));
+               
+               fReinstallOp.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent evt) {
+                updateLaunchConfigurationDialog();
+            }
+        });
+               
+               fSelectPkgOp.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent evt) {
+                updateLaunchConfigurationDialog();
+            }
+        });
+       }
+       
+       private void createTableTitleComposite(Composite parent) {
+               Label tableLabel = new Label(parent, SWT.NONE);
+               tableLabel.setText(resources.getString("Label.AdditionPkgs"));
+       }
+       
+       private void createTableGroupComposite(Composite parent) {
+               Composite composite = new Composite(parent, SWT.NONE);
+               //composite.setLayout(new GridLayout(2, false));
+        GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 2;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+        GridData gridData = new GridData(GridData.FILL_BOTH);        
+        gridData.minimumHeight = 100;
+        gridData.minimumWidth = 300;
+
+        composite.setLayout(gridLayout);
+        composite.setLayoutData(gridData);
+        
+        createTableComposite(composite);
+        createTableButtonComposite(composite);
+       }
+       
+       private void createTableComposite(Composite parent) {
+               Composite composite = new Composite(parent, SWT.NONE);
+               composite.setLayout(new FillLayout());
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               
+               tableViewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);             
+               Table table = tableViewer.getTable();           
+               table.setHeaderVisible(true);
+               table.setLinesVisible(true);            
+               
+               String[] columnNames = new String[] {"File Name"};                              
+               
+               int[] columnWidths = new int[] {300};
+               for (int i = 0; i < columnNames.length ; i++) {
+                       TableColumn tableColumn = new TableColumn(table, SWT.LEFT);                     
+                       
+                       tableColumn.setText(columnNames[i]);
+                       tableColumn.setWidth(columnWidths[i]);
+                       tableColumn.setResizable(true);                 
+                       tableColumn.addSelectionListener(new TooltableSelectionAdapter());
+               }               
+                               
+               tableViewer.setLabelProvider(new TableViewerProvider());                
+               tableViewer.setContentProvider(new ArrayContentProvider());
+               tableViewer.setInput(RootstrapManager.getRootstraps());         
+               tableViewer.getTable().addSelectionListener(new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {                          
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {                           
+                       }
+                       
+               });
+               
+               table.addListener(SWT.Dispose, tableListener);
+               table.addListener(SWT.KeyDown, tableListener);
+               table.addListener(SWT.MouseMove, tableListener);
+               table.addListener(SWT.MouseHover, tableListener);
+       }
+       
+       private void createTableButtonComposite(Composite parent) {
+               
+               Composite composite = new Composite(parent, SWT.NONE);
+               GridLayout gridLayout = new GridLayout();
+               gridLayout.numColumns = 1;
+               gridLayout.marginWidth = 0;
+               gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);
+        composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));       
+        
+               Button addBt = new Button(composite, SWT.PUSH);
+               Image addIcon = ImageUtil.getImage(Activator.PLUGIN_ID, "icons/rootstrap/add.gif");
+               addBt.setImage(addIcon);
+               addBt.addMouseListener(new MouseListener() {
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {                    
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               FileDialog fd = new FileDialog(getShell(), SWT.OPEN|SWT.MULTI);
+                       fd.setText(resources.getString("File.Dialog.Title.File"));                      
+                       String[] filterExt = { "*.rpm" };
+                       fd.setFilterExtensions(filterExt);
+                       selectedFileList = fd.open();                   
+                       System.out.println(selectedFileList);
+                       PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+                       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);
+                                       if (!existsPkg(p)) {
+                                               packages.add(p);
+                                       }
+                               }
+
+                               tableViewer.refresh();
+                               updateLaunchConfigurationDialog();
+                       }
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {                             
+                       }
+                       
+               });             
+               
+               Button removeBt = new Button(composite, SWT.PUSH);
+               Image removeIcon = ImageUtil.getImage(Activator.PLUGIN_ID, "icons/rootstrap/remove.gif");
+               removeBt.setImage(removeIcon);
+       }
+       
+       private void createExtraTableGroup(Composite parent) {  
+               
+               Composite composite = new Composite(parent, SWT.NONE);          
+               GridLayout projLayout = new GridLayout();
+               projLayout.numColumns = 1;
+               projLayout.marginHeight = 0;
+               projLayout.marginWidth = 0;
+               GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+               composite.setLayout(projLayout);
+               composite.setLayoutData(gd);
+               
+               createTableTitleComposite(composite);
+               createTableGroupComposite(composite);           
+       }
+       
+       private boolean existsPkg(LocalPackage pkg) {
+               for (LocalPackage p : packages) {
+                       if (pkg.getPath().equals(p.getPath())) {
+                               return true;                            
+                       }
+               }
+               return false;
+       }
+       
+       private void createAppProjectGroup(Composite parent, int colSpan) {
+               Composite projComp = new Composite(parent, SWT.NONE);
+               GridLayout projLayout = new GridLayout();
+               projLayout.numColumns = 2;
+               projLayout.marginHeight = 0;
+               projLayout.marginWidth = 0;
+               projComp.setLayout(projLayout);
+               GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+               gd.horizontalSpan = colSpan;
+               projComp.setLayoutData(gd);
+
+               fProjLabel = new Label(projComp, SWT.NONE);
+               fProjLabel.setText(resources.getString("Label.App.Project")); 
+               gd = new GridData();
+               gd.horizontalSpan = 2;
+               fProjLabel.setLayoutData(gd);
+
+               fAppProjText = new Text(projComp, SWT.SINGLE | SWT.BORDER);
+               gd = new GridData(GridData.FILL_HORIZONTAL);
+               fAppProjText.setLayoutData(gd);
+               fAppProjText.addModifyListener(new ModifyListener() {
+
+                       public void modifyText(ModifyEvent evt) {
+                               // if project changes, invalidate program name cache
+                               fPreviouslyCheckedProgram = null;
+                               
+                               updateBuildConfigCombo(""); //$NON-NLS-1$
+                               updateLaunchConfigurationDialog();
+                       }
+               });
+
+               fAppProjButton = createPushButton(projComp, LaunchMessages.Launch_common_Browse_1, null); 
+               fAppProjButton.addSelectionListener(new SelectionAdapter() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent evt) {
+                               handleAppProjectButtonSelected();
+                               updateLaunchConfigurationDialog();
+                       }
+               });
+       }
+       
+       protected void handleAppProjectButtonSelected() {
+               String currentProjectName = fProjText.getText();
+               ICProject project = chooseCAppProject(currentProjectName);
+               if (project == null) {
+                       return;
+               }
+
+               String projectName = project.getElementName();
+               fAppProjText.setText(projectName);
+       }
+       
+       protected ICProject chooseCAppProject(String currentProjectName) {
+               
+               try {
+                       ICProject[] projects = getCProjects(currentProjectName);                        
+
+                       ILabelProvider labelProvider = new CElementLabelProvider();
+                       ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
+                       dialog.setTitle(LaunchMessages.CMainTab_Project_Selection); 
+                       dialog.setMessage(LaunchMessages.CMainTab_Choose_project_to_constrain_search_for_program); 
+                       dialog.setElements(projects);
+
+                       ICProject cProject = getCProject();
+                       if (cProject != null) {
+                               dialog.setInitialSelections(new Object[] { cProject });
+                       }
+                       if (dialog.open() == Window.OK) {
+                               return (ICProject)dialog.getFirstResult();
+                       }
+               } catch (CModelException e) {
+                       LaunchUIPlugin.errorDialog("Launch UI internal error", e); //$NON-NLS-1$                        
+               }
+               return null;
+       }
+       
+       protected ICProject[] getCProjects(String currentProjectName) throws CModelException {
+               ICProject cproject[] = CoreModel.getDefault().getCModel().getCProjects();
+               ArrayList<ICProject> list = new ArrayList<ICProject>(cproject.length);
+
+               for (int i = 0; i < cproject.length; i++) {
+                       if (currentProjectName.length() != 0 &&
+                                       cproject[i].getProject().getName().equals(currentProjectName)) {
+                               continue;
+                       }
+                       ICDescriptor cdesciptor = null;
+                       try {
+                               cdesciptor = CCorePlugin.getDefault().getCProjectDescription((IProject) cproject[i].getResource(), false);
+                               if (cdesciptor != null) {
+                                       String projectPlatform = cdesciptor.getPlatform();
+                                       if (filterPlatform.equals("*") //$NON-NLS-1$
+                                                       || projectPlatform.equals("*") //$NON-NLS-1$
+                                                       || filterPlatform.equalsIgnoreCase(projectPlatform) == true) {
+                                               list.add(cproject[i]);
+                                       }
+                               } else {
+                                       list.add(cproject[i]);
+                               }
+                       } catch (CoreException e) {
+                               list.add(cproject[i]);
+                       }
+               }
+               return list.toArray(new ICProject[list.size()]);
+       }
+       
        private void createExeFileField(Composite parent, int colSpan) {
                Composite mainComp = new Composite(parent, SWT.NONE);
                GridLayout mainLayout = new GridLayout();
@@ -118,7 +448,7 @@ public class TizenDebianMainTab extends CMainTab {
                gd.horizontalSpan = colSpan;
                mainComp.setLayoutData(gd);
                fProgLabel = new Label(mainComp, SWT.NONE);
-               fProgLabel.setText(LABEL_TEXT); // $NON-NLS-1$
+               fProgLabel.setText(resources.getString("Label.App.Path")); // $NON-NLS-1$
                gd = new GridData();
                gd.horizontalSpan = 3;
                fProgLabel.setLayoutData(gd);
@@ -132,7 +462,7 @@ public class TizenDebianMainTab extends CMainTab {
                });
                
                Button fBrowseForBinaryButton;
-               fBrowseForBinaryButton = createPushButton(mainComp, REMOTE_BROWSE, null); //$NON-NLS-1$
+               fBrowseForBinaryButton = createPushButton(mainComp, resources.getString("Button.Browse"), null); //$NON-NLS-1$
                fBrowseForBinaryButton.addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent evt) {
@@ -162,7 +492,8 @@ public class TizenDebianMainTab extends CMainTab {
                        shell.getDisplay().syncExec( new Runnable() {
                                public void run() {
                                        IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
-                                       TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, SELECT_AN_APPLICATION, device, false, DEFAULT_APP_PATH);
+                                       TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, 
+                                                       resources.getString("Remote.Dialog.Title"), device, false, DEFAULT_APP_PATH);
                                        if(dlg.open() == TizenRemoteFileDialogResult.OK) {
                                                FileEntry selectedFile = dlg.getSelectedFileEntry();
                                                filePath = selectedFile.getFullPath();
@@ -181,6 +512,8 @@ public class TizenDebianMainTab extends CMainTab {
                configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true);
                configuration.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
                configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
+               configuration.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, true);
+               configuration.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);
                ICElement cElement = null;
                cElement = getContext(configuration, getPlatform(configuration));
                if (cElement != null)
@@ -191,54 +524,43 @@ public class TizenDebianMainTab extends CMainTab {
        public void initializeFrom(ILaunchConfiguration configuration) {
                updateProgramFromConfig(configuration);
                updateProjectFromConfig(configuration);
+               updateAppProjectFromConfig(configuration);
+               updateExtraTableFromConfig(configuration);
+               updateReinstallOpFromConfig(configuration);
+               updateSelectPkgOpFromConfig(configuration);
                if (fSpecifyCoreFile)
                        updateCoreFromConfig(configuration);
        }
 
        @Override
        public boolean isValid(ILaunchConfiguration config) {
-               setErrorMessage(null);
-               setMessage(null);
-
+               return true;
+       }       
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.cdt.launch.ui.CMainTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+        */
+       @Override
+       public void performApply(ILaunchConfigurationWorkingCopy config) {
+               String programPath = fProgText.getText().trim();
                String name = fProjText.getText().trim();
-               if (name.length() == 0) {
-                       setErrorMessage(TizenLaunchMessages.TizenMainTab_Project_not_specified);
-                       return false;
-               }
-               if (!ResourcesPlugin.getWorkspace().getRoot().getProject(name).exists()) {
-                       setErrorMessage(TizenLaunchMessages.Launch_common_Project_does_not_exist);
-                       return false;
-               }
-               IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
-               if (!project.isOpen()) {
-                       setErrorMessage(TizenLaunchMessages.TizenMainTab_Project_must_be_opened);
-                       return false;
-               }
-
-               if (fProgText != null)
-                       name = fProgText.getText().trim();
+               String appProj = fAppProjText.getText().trim();
+               boolean reinstallOp = fReinstallOp.getSelection();
+               boolean selectPkgOp = fSelectPkgOp.getSelection();
+               ArrayList<String> pkgs = new ArrayList<String>();
                
-               if (name.length() == 0) {
-                       setErrorMessage(TizenLaunchMessages.TizenMainTab_Program_not_specified);
-                       return false;
-               }
-               if (name.equals(".") || name.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
-                       setErrorMessage(TizenLaunchMessages.TizenMainTab_Program_does_not_exist);
-                       return false;
-               }
-
-               //FIXME:: For enabling apply button. but the button is enabled when change more than 2 characters. 
-               try {
-                       ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
-                       wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, name);
-                       wc.doSave();
-               } catch (CoreException ce) {
-                       LaunchUIPlugin.log(ce);
-               }
+               for (LocalPackage p : packages) {
+                       pkgs.add(p.getPath());
+               }       
                
-               return true;
+               config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programPath);
+               config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, name);
+               config.setAttribute(ITizenLaunchConfigurationConstants.ATTR_APP_PROJECT_NAME, appProj);
+               config.setAttribute(ITizenLaunchConfigurationConstants.ATTR_EXTRA_PACKAGE_LIST, pkgs);
+               config.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, reinstallOp);
+               config.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, selectPkgOp);
        }
-       
+
        @Override
        protected void updateProjectFromConfig(ILaunchConfiguration config) {
                String projectName = EMPTY_STRING;
@@ -254,8 +576,9 @@ public class TizenDebianMainTab extends CMainTab {
        protected void updateProgramFromConfig(ILaunchConfiguration config) {
                if (fProgText != null)
                {
-                       String programName = EMPTY_STRING;
+                       String programName = EMPTY_STRING;                      
                        try {
+                               
                                programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING);
                        } catch (CoreException ce) {
                                LaunchUIPlugin.log(ce);
@@ -263,4 +586,182 @@ public class TizenDebianMainTab extends CMainTab {
                        fProgText.setText(programName);
                }
        }
+       
+       protected void updateAppProjectFromConfig(ILaunchConfiguration config) {
+               String projectName = EMPTY_STRING;
+               try {
+                       projectName = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_APP_PROJECT_NAME, EMPTY_STRING);
+               } catch (CoreException ce) {
+                       LaunchUIPlugin.log(ce);
+               }
+               fAppProjText.setText(projectName);
+       }
+       
+       @SuppressWarnings("unchecked")
+       protected void updateExtraTableFromConfig(ILaunchConfiguration config) {                
+               ArrayList<String> pkgs = null;
+               try {
+                       pkgs = (ArrayList<String>) config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_EXTRA_PACKAGE_LIST, new ArrayList<String>());
+               } catch (CoreException ce) {
+                       LaunchUIPlugin.log(ce);
+               }
+               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+               //packages.addAll(launchUtils.getLocalPackages(pkgs));
+               packages = launchUtils.getLocalPackages(pkgs);
+               tableViewer.setInput(packages);
+       }
+       
+       protected void updateReinstallOpFromConfig(ILaunchConfiguration config) {               
+               boolean option = true;
+               try {
+                       option = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, true);
+               } catch (CoreException ce) {
+                       LaunchUIPlugin.log(ce);
+               }
+               fReinstallOp.setSelection(option);
+       }
+       
+       protected void updateSelectPkgOpFromConfig(ILaunchConfiguration config) {               
+               boolean option = true;
+               try {
+                       option = config.getAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, true);
+               } catch (CoreException ce) {
+                       LaunchUIPlugin.log(ce);         
+               }
+               fSelectPkgOp.setSelection(option);
+       }
+       
+       private class TooltableSelectionAdapter extends SelectionAdapter
+       {
+               public void widgetSelected(SelectionEvent e) {          
+
+                       final int column = tableViewer.getTable().indexOf((TableColumn) e.widget);
+                       tableViewer.getTable().setSortColumn((TableColumn)e.widget);
+                       if (tableViewer.getTable().getSortDirection() == SWT.DOWN) {                                            
+                               tableViewer.getTable().setSortDirection(SWT.UP);
+                       } else {
+                               tableViewer.getTable().setSortDirection(SWT.DOWN);
+                       }                                       
+                       
+                       tableViewer.setSorter(new ViewerSorter() {
+                               public int compare(Viewer viewer, Object e1, Object e2) {                                       
+                                       LocalPackage pkg_1 = (LocalPackage)e1;
+                                       LocalPackage pkg_2 = (LocalPackage)e2;
+                                       
+                                       String fileName_1 = new Path(pkg_1.getPath()).lastSegment();
+                                       String fileName_2 = new Path(pkg_2.getPath()).lastSegment();
+                                       
+                                       switch (column) {
+                                               case 1:                                                                 
+                                                       if (tableViewer.getTable().getSortDirection() == SWT.DOWN) {
+                                                               return fileName_1.compareTo(fileName_2);
+                                                       } else {
+                                                               return fileName_2.compareTo(fileName_1);
+                                                       }
+                                               default:
+                                                   break;
+                                       }
+                                       return fileName_1.compareTo(fileName_2);
+                               }
+                       });             
+                       
+               }
+       }
+       
+       /* selected package table provider */
+       private class TableViewerProvider extends LabelProvider implements ITableLabelProvider 
+       {
+               @Override
+               public Image getColumnImage(Object element, int columnIndex) {  
+                       return null;
+               }
+
+               @Override
+               public String getColumnText(Object element, int columnIndex) {
+                       if ( element instanceof LocalPackage) {
+                               LocalPackage pkg = (LocalPackage)element;
+                               String file = pkg.getPath();            
+                               String name = new Path(file).lastSegment();
+                               
+                               switch(columnIndex) {
+                               case 0 :
+                                       return name;
+                               default:
+                                       break;
+                               }
+                       }
+                       return null;
+               }
+       }
+       
+       Listener tableListener = new Listener() {
+               Shell tip = null;
+               Label label = null;
+
+               public void handleEvent(Event event) {
+                       switch (event.type) {
+                               case SWT.Dispose:
+                               case SWT.KeyDown:
+                               case SWT.MouseMove: {
+                                       if (tip == null) {
+                                               break;
+                                       }
+                                       tip.dispose();
+                                       tip = null;
+                                       label = null;
+                                       break;
+                               }
+                               case SWT.MouseHover: {
+                                       TableItem item = tableViewer.getTable().getItem(new Point(event.x, event.y));
+                                       if (item != null) {
+                                               if (tip != null && !tip.isDisposed()) {
+                                                       tip.dispose();
+                                               }
+                                               tip = new Shell(getShell(), SWT.ON_TOP | SWT.TOOL);
+                                               tip.setLayout(new FillLayout());
+                                               label = new Label(tip, SWT.NONE);
+                                               LocalPackage pkg = (LocalPackage)item.getData();              
+                     
+                                               label.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+                                               label.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+                     
+                                               label.setData("_TABLEITEM", item);
+                                               label.setText(pkg.getPath());
+                                               label.addListener(SWT.MouseExit, labelListener);
+                                               label.addListener(SWT.MouseDown, labelListener);
+                                               Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+                                               Rectangle rect = item.getBounds(0);
+                                               Point pt = tableViewer.getTable().toDisplay(rect.x, rect.y);
+                                               tip.setBounds(pt.x + 50, pt.y + 10, size.x, size.y);
+                                               tip.setVisible(true);
+                                       }
+                               }
+                               default:
+                                       break;
+                       }
+               }
+       };
+      
+      // Implement a "fake" tooltip
+       final Listener labelListener = new Listener() {
+               public void handleEvent(Event event) {
+                       Label label = (Label) event.widget;
+                       Shell shell = label.getShell();
+                       switch (event.type) {
+                               case SWT.MouseDown:
+                                       Event e = new Event();
+                                       e.item = (TableItem) label.getData("_TABLEITEM");
+                                       // Assuming table is single select, set the selection as if
+                                       // the mouse down event went through to the table
+                                       tableViewer.getTable().setSelection(new TableItem[] { (TableItem) e.item });
+                                       tableViewer.getTable().notifyListeners(SWT.Selection, e);
+                                       // fall through
+                               case SWT.MouseExit:
+                                       shell.dispose();
+                                       break;
+                               default:
+                                       break;
+                       }
+               }
+       };
 }
\ No newline at end of file
index 45891f5..2ef0070 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui.shortcut;
 
 import java.util.ArrayList;
@@ -38,19 +37,28 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
 import org.eclipse.cdt.debug.core.CDebugCorePlugin;
 import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
 import org.eclipse.cdt.debug.core.ICDebugConfiguration;
+import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
+import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
 import org.eclipse.cdt.debug.internal.ui.launch.CApplicationLaunchShortcut;
 import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
 import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
 import org.eclipse.cdt.debug.ui.ICDebuggerPage;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
 import org.eclipse.debug.ui.DebugUITools;
 import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.ISelection;
@@ -62,16 +70,29 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
-import org.tizen.nativeplatform.Activator;
-import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
+import org.tizen.nativeplatform.launch.wizards.PlatformAttachLaunchWizard;
+import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
+import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizardDialog;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
 
 
 
 
+@SuppressWarnings("restriction")
 public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchShortcut {
-       private static final String APPLICATION_PATH_INPUT_DIALOG_TITLE = "Input Tizen Application Path";
-       private static final String APPLICATION_PATH_INPUT_DIALOG_TEXT = "Input Tizen Application Path : ";
+       
+       private String programPath = null;
+       private boolean reinstallOp = true;
+       private boolean selectPkgOp = true;
+       private String procName = "";
+       private int pid;
+       
+       private ISourceLookupDirector fLocator;
        
        public void launch(IProject project, String mode) {
                searchAndLaunch(new Object[] {project}, mode);
@@ -133,11 +154,9 @@ public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchSh
 
                if ( debugConfig == null ) {
                        // Prompt the user if more then 1 debugger.
-                       String os = Platform.getOS();
                        debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
                        List<ICDebugConfiguration> debugList = new ArrayList<ICDebugConfiguration>(debugConfigs.length);
                        for (int i = 0; i < debugConfigs.length; i++) {
-                               String platform = debugConfigs[i].getPlatform();
                                if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
                                        if (debugConfigs[i].getName().contains("Tizen")) //$NON-NLS-1$
                                                debugList.add(debugConfigs[i]);
@@ -182,13 +201,20 @@ public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchSh
        protected ILaunchConfiguration createConfiguration(IProject project, ICDebugConfiguration debugConfig, String mode) {
                ILaunchConfiguration config = null;
                try {
-                       String projectName = project.getProjectRelativePath().toString();
                        ILaunchConfigurationType configType = getCLaunchConfigType();
                        ILaunchConfigurationWorkingCopy wc =
                                configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(project.getName()));
-                       String programName = getProgramName();
-                       if (programName != null)
-                               wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName);
+                       
+                       if (!setLaunchConfiguration(project, mode)) {
+                               return null;
+                       }
+                       
+                       wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programPath);                       
+                       wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, reinstallOp);
+                       wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, selectPkgOp);
+                       wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSNAME_OPTION, procName);
+                       wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_PROCESSID_OPTION, pid);
+                       wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_FROM_SHORTCUT, true);
                        
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
                        wc.setMappedResources(new IResource[] {project});
@@ -196,7 +222,7 @@ public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchSh
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, TizenLaunchConfigurationConstants.DEBUGGER_ID);
-                       wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, TizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
+                       wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, ITizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
                        wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true);
                        wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
@@ -211,6 +237,7 @@ public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchSh
                        // Load up the debugger page to set the defaults. There should probably be a separate
                        // extension point for this.
                        ICDebuggerPage page = CDebugUIPlugin.getDefault().getDebuggerPage(debugConfig.getID());
+                       setSourceContainer(project, wc);
                        page.setDefaults(wc);
                        
                        config = wc.doSave();
@@ -220,7 +247,10 @@ public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchSh
                return config;
        }
        
-       private String getProgramName() throws CoreException {
+       private boolean setLaunchConfiguration(IProject project, String mode) {
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project ) ;
+        IConfiguration defaultConfig = info.getDefaultConfiguration();
+        
                IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                if (window == null) {
                        IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
@@ -228,23 +258,108 @@ public class TizenDebianProjectAttachLaunchShortcut extends CApplicationLaunchSh
                }
                final Shell shell = window.getShell();
                
-               TizenPathInputDialog dlg = new TizenPathInputDialog(shell,
-                                                  APPLICATION_PATH_INPUT_DIALOG_TITLE,
-                                                  APPLICATION_PATH_INPUT_DIALOG_TEXT,
-                                                  null);
-               if (Window.OK == dlg.open())
-                       return dlg.getValue();
-               else
-                       newCoreException(TizenDebianLaunchMessages.OPERATION_CANCELED, null);
-               
-               return null;
+               PlatformAttachLaunchWizard wizard = new PlatformAttachLaunchWizard(shell, project, defaultConfig, mode);
+               PlatformLaunchWizardDialog dlg = new PlatformLaunchWizardDialog(shell, wizard);
+               dlg.create();
+               if (Window.OK == dlg.open()) {
+                       programPath = dlg.getProgramPath();
+                       reinstallOp = dlg.getReinstallOp();
+                       selectPkgOp = dlg.getSelectPkgOp();
+                       procName = dlg.getProcName(); 
+                       pid = dlg.getProcId();
+                       return true;
+               } else {
+                       return false;
+               }
        }
        
-       private void newCoreException(String message, Throwable exception) throws CoreException {
-               Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message, exception);
-               throw new CoreException(status);
+       private void setSourceContainer(IProject project, ILaunchConfigurationWorkingCopy configuration) {
+               
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project ) ;
+        IConfiguration config = info.getDefaultConfiguration();
+        String targetId = PlatformConfigurationManager.getBuildTargetName(config);
+        String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
+        PlatformRootstrap rootstrap = RootstrapManager.getRootstrap(rootId);
+        
+               String basePath = rootstrap.getPath().toOSString();
+               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+               String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(basePath);
+               DirectorySourceContainer container = new DirectorySourceContainer(new Path(rootstrapPath), true);
+               MappingSourceContainer mappingContainer = new MappingSourceContainer("Source mapping");
+               MapEntrySourceContainer entry = new MapEntrySourceContainer();
+               String[] infos = launchUtils.getProjectInfo(project);
+               String backend = String.format("/usr/src/debug/%s-%s", infos[0], infos[1]);
+               String local = project.getLocation().toOSString();
+               
+               entry.setBackendPath(new Path(backend));
+               entry.setLocalPath(new Path(local));
+               mappingContainer.addMapEntry(entry);            
+               
+               if (fLocator != null) {
+                       fLocator.dispose();
+                       fLocator = null;                
+               }
+               
+               String memento = null;  
+               String type = null;
+               try{
+                       memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
+                       type = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null);
+                       if (type == null) {
+                               type = configuration.getType().getSourceLocatorId();
+                       }
+               } catch(CoreException e){
+                       return;
+               }       
+               
+               if(type == null) { 
+                       return;
+               }       
+
+               try {
+                       ISourceLocator locator = getLaunchManager().newSourceLocator(type);
+                       if(!(locator instanceof AbstractSourceLookupDirector)) {
+                               // migrate to the new source lookup infrastructure
+                               memento = null; // don't use old memento
+                               type = configuration.getType().getSourceLocatorId();
+                               if(type == null) { 
+                                       return;
+                               }
+                               locator = getLaunchManager().newSourceLocator(type);
+                               if (!(locator instanceof AbstractSourceLookupDirector)) { 
+                                       return;
+                               }               
+                       }
+                       fLocator = (AbstractSourceLookupDirector)locator;                       
+                       if (memento == null) {
+                               fLocator.initializeDefaults(configuration);
+                       } else {                                
+                               fLocator.initializeFromMemento(memento, configuration);                          
+                       }                       
+               } catch (CoreException e) {
+                       return;
+               }               
+               
+               configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
+               configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null);
+
+               int length = fLocator.getSourceContainers().length;
+               ISourceContainer[] containers = new ISourceContainer[length + 2];
+               containers[0] = mappingContainer;
+               containers[1] = container;
+               containers[2] = fLocator.getSourceContainers()[0];      
+               
+               fLocator.setSourceContainers(containers);               
+
+               try {
+                       configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, fLocator.getMemento());
+                       configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, fLocator.getId());
+               } catch (CoreException e) {
+                       e.printStackTrace();
+               }               
        }
        
+
        @Override
        protected ILaunchConfigurationType getCLaunchConfigType() {
                return getLaunchManager().getLaunchConfigurationType("org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach");
index f9f594e..103cfff 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui.shortcut;
 
 import java.util.ArrayList;
@@ -46,7 +45,6 @@ import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
@@ -64,11 +62,13 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.ElementListSelectionDialog;
 import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
 import org.tizen.nativeplatform.Activator;
+import org.tizen.nativeplatform.launch.ITizenLaunchConfigurationConstants;
 import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages;
 
 
 
 
+@SuppressWarnings("restriction")
 public class TizenDebianProjectCoredumpLaunchShortcut extends CApplicationLaunchShortcut {
        private static final String APPLICATION_PATH_INPUT_DIALOG_TITLE = "Input Tizen Application Path";
        private static final String APPLICATION_PATH_INPUT_DIALOG_TEXT = "Input Tizen Application Path : ";
@@ -133,11 +133,9 @@ public class TizenDebianProjectCoredumpLaunchShortcut extends CApplicationLaunch
 
                if ( debugConfig == null ) {
                        // Prompt the user if more then 1 debugger.
-                       String os = Platform.getOS();
                        debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
                        List<ICDebugConfiguration> debugList = new ArrayList<ICDebugConfiguration>(debugConfigs.length);
                        for (int i = 0; i < debugConfigs.length; i++) {
-                               String platform = debugConfigs[i].getPlatform();
                                if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
                                        if (debugConfigs[i].getName().contains("Tizen")) //$NON-NLS-1$
                                                debugList.add(debugConfigs[i]);
@@ -182,7 +180,6 @@ public class TizenDebianProjectCoredumpLaunchShortcut extends CApplicationLaunch
        protected ILaunchConfiguration createConfiguration(IProject project, ICDebugConfiguration debugConfig, String mode) {
                ILaunchConfiguration config = null;
                try {
-                       String projectName = project.getProjectRelativePath().toString();
                        ILaunchConfigurationType configType = getCLaunchConfigType();
                        ILaunchConfigurationWorkingCopy wc =
                                configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(project.getName()));
@@ -196,7 +193,7 @@ public class TizenDebianProjectCoredumpLaunchShortcut extends CApplicationLaunch
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, TizenLaunchConfigurationConstants.DEBUGGER_ID);
-                       wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, TizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
+                       wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, ITizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
                        wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true);
                        wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
index ee1847f..d84b87e 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui.shortcut;
 
 import java.util.ArrayList;
@@ -42,15 +41,24 @@ import org.eclipse.cdt.debug.internal.ui.launch.CApplicationLaunchShortcut;
 import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
 import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
 import org.eclipse.cdt.debug.ui.ICDebuggerPage;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.sourcelookup.containers.DirectorySourceContainer;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
+import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
 import org.eclipse.debug.ui.DebugUITools;
 import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.ISelection;
@@ -62,16 +70,33 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.nativecommon.build.SmartBuildInterface;
 import org.tizen.nativecommon.launch.TizenLaunchConfigurationConstants;
-import org.tizen.nativeplatform.Activator;
-import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages;
-
-
-
+import org.tizen.nativecommon.launch.TizenLaunchMessages;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+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.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+import org.tizen.sdblib.IDevice;
 
+@SuppressWarnings("restriction")
 public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut {
-       private static final String APPLICATION_PATH_INPUT_DIALOG_TITLE = "Input Tizen Application Path";
-       private static final String APPLICATION_PATH_INPUT_DIALOG_TEXT = "Input Tizen Application Path : ";
+       
+       private static final String APP_PROJ_DEFAULT_SELECTION = "[Not required]";
+       
+       private String programPath = null;
+       private String appProjectName = null;
+       private ArrayList<LocalPackage> packages = null;
+       private boolean reinstallOp = true;
+       private boolean selectPkgOp = true;
+       
+       private ISourceLookupDirector fLocator;
        
        public void launch(IProject project, String mode) {
                searchAndLaunch(new Object[] {project}, mode);
@@ -90,6 +115,12 @@ public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut
        }
        
        private void searchAndLaunch(final Object[] elements, String mode) {
+               IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+               if (device == null) {
+                       DialogUtil.openErrorDialog(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
+                       return;
+               }
+               
                if (elements != null && elements.length > 0) {
                        int nElements = elements.length;
                        for (int i = 0; i < nElements; i++) {
@@ -133,11 +164,9 @@ public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut
 
                if ( debugConfig == null ) {
                        // Prompt the user if more then 1 debugger.
-                       String os = Platform.getOS();
                        debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations();
                        List<ICDebugConfiguration> debugList = new ArrayList<ICDebugConfiguration>(debugConfigs.length);
                        for (int i = 0; i < debugConfigs.length; i++) {
-                               String platform = debugConfigs[i].getPlatform();
                                if (debugConfigs[i].supportsMode(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
                                        if (debugConfigs[i].getName().contains("Tizen")) //$NON-NLS-1$
                                                debugList.add(debugConfigs[i]);
@@ -180,23 +209,43 @@ public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut
        }               
 
        protected ILaunchConfiguration createConfiguration(IProject project, ICDebugConfiguration debugConfig, String mode) {
+               
                ILaunchConfiguration config = null;
                try {
-                       String projectName = project.getProjectRelativePath().toString();
                        ILaunchConfigurationType configType = getCLaunchConfigType();
                        ILaunchConfigurationWorkingCopy wc =
                                configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(project.getName()));
-                       String programName = getProgramName();
-                       if (programName != null)
-                               wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programName);
                        
+                       if (!setLaunchConfiguration(project, mode)) {
+                               return null;
+                       }
+                       
+                       if (programPath != null) {
+                               wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, programPath);
+                       }
+                       
+                       if (appProjectName != null && !APP_PROJ_DEFAULT_SELECTION.equals(appProjectName)) {
+                               wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_APP_PROJECT_NAME, appProjectName);
+                       }
+                       
+                       if (packages != null) {
+                               ArrayList<String> strs = new ArrayList<String>();
+                               for (LocalPackage p : packages) {
+                                       strs.add(p.getPath());
+                               }
+                               wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_EXTRA_PACKAGE_LIST, strs);                              
+                       }               
+                       
+                       wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_REINSTALL_OPTION, reinstallOp);
+                       wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_SELECTPKG_OPTION, selectPkgOp);
+                       wc.setAttribute(ITizenLaunchConfigurationConstants.ATTR_FROM_SHORTCUT, true);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
                        wc.setMappedResources(new IResource[] {project});
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, TizenLaunchConfigurationConstants.DEBUGGER_ID);
-                       wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, TizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
+                       wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_COMMAND_FACTORY, ITizenLaunchConfigurationConstants.COMMAND_FACTORY_ID);
                        wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true);
                        wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false);
                        wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_BUILD_BEFORE_LAUNCH, ICDTLaunchConfigurationConstants.BUILD_BEFORE_LAUNCH_DISABLED);
@@ -210,6 +259,7 @@ public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut
                        // Load up the debugger page to set the defaults. There should probably be a separate
                        // extension point for this.
                        ICDebuggerPage page = CDebugUIPlugin.getDefault().getDebuggerPage(debugConfig.getID());
+                       setSourceContainer(project, wc);
                        page.setDefaults(wc);
                        
                        config = wc.doSave();
@@ -219,7 +269,16 @@ public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut
                return config;
        }
        
-       private String getProgramName() throws CoreException {
+       @Override
+       protected ILaunchConfigurationType getCLaunchConfigType() {
+               return getLaunchManager().getLaunchConfigurationType("org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType");
+       }
+       
+       
+       private boolean setLaunchConfiguration(IProject project, String mode) {
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project ) ;
+        IConfiguration defaultConfig = info.getDefaultConfiguration();
+        
                IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                if (window == null) {
                        IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
@@ -227,25 +286,105 @@ public class TizenDebianProjectLaunchShortcut extends CApplicationLaunchShortcut
                }
                final Shell shell = window.getShell();
                
-               TizenPathInputDialog dlg = new TizenPathInputDialog(shell,
-                                                  APPLICATION_PATH_INPUT_DIALOG_TITLE,
-                                                  APPLICATION_PATH_INPUT_DIALOG_TEXT,
-                                                  null);
-               if (Window.OK == dlg.open())
-                       return dlg.getValue();
-               else
-                       newCoreException(TizenDebianLaunchMessages.OPERATION_CANCELED, null);
-               
-               return null;
-       }
-       
-       private void newCoreException(String message, Throwable exception) throws CoreException {
-               Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message, exception);
-               throw new CoreException(status);
+               PlatformLaunchWizard wizard = new PlatformLaunchWizard(shell, project, defaultConfig, mode);
+               PlatformLaunchWizardDialog dlg = new PlatformLaunchWizardDialog(shell, wizard);
+               dlg.create();
+               if (Window.OK == dlg.open()) {
+                       appProjectName = dlg.getAppProjectName();
+                       programPath = dlg.getProgramPath();
+                       packages = dlg.getExtraPackages();
+                       reinstallOp = dlg.getReinstallOp();
+                       selectPkgOp = dlg.getSelectPkgOp();
+                       return true;
+               } else {
+                       return false;
+               }
        }
        
-       @Override
-       protected ILaunchConfigurationType getCLaunchConfigType() {
-               return getLaunchManager().getLaunchConfigurationType("org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType");
+       private void setSourceContainer(IProject project, ILaunchConfigurationWorkingCopy configuration) {
+               
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project ) ;
+        IConfiguration config = info.getDefaultConfiguration();
+        String targetId = PlatformConfigurationManager.getBuildTargetName(config);
+        String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
+        PlatformRootstrap rootstrap = RootstrapManager.getRootstrap(rootId);
+        
+               String basePath = rootstrap.getPath().toOSString();
+               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+               String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(basePath);
+               DirectorySourceContainer container = new DirectorySourceContainer(new Path(rootstrapPath), true);
+               MappingSourceContainer mappingContainer = new MappingSourceContainer("Source mapping");
+               MapEntrySourceContainer entry = new MapEntrySourceContainer();
+               String[] infos = launchUtils.getProjectInfo(project);
+               String backend = String.format("/usr/src/debug/%s-%s", infos[0], infos[1]);
+               String local = project.getLocation().toOSString();
+               
+               entry.setBackendPath(new Path(backend));
+               entry.setLocalPath(new Path(local));
+               mappingContainer.addMapEntry(entry);            
+               
+               if (fLocator != null) {
+                       fLocator.dispose();
+                       fLocator = null;                
+               }
+               
+               String memento = null;  
+               String type = null;
+               try{
+                       memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
+                       type = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null);
+                       if (type == null) {
+                               type = configuration.getType().getSourceLocatorId();
+                       }
+               } catch(CoreException e){
+                       return;
+               }       
+               
+               if(type == null) { 
+                       return;
+               }       
+
+               try {
+                       ISourceLocator locator = getLaunchManager().newSourceLocator(type);
+                       if(!(locator instanceof AbstractSourceLookupDirector)) {
+                               // migrate to the new source lookup infrastructure
+                               memento = null; // don't use old memento
+                               type = configuration.getType().getSourceLocatorId();
+                               if(type == null) { 
+                                       return;
+                               }
+                               locator = getLaunchManager().newSourceLocator(type);
+                               if (!(locator instanceof AbstractSourceLookupDirector)) { 
+                                       return;
+                               }               
+                       }
+                       fLocator = (AbstractSourceLookupDirector)locator;                       
+                       if (memento == null) {
+                               fLocator.initializeDefaults(configuration);
+                       } else {                                
+                               fLocator.initializeFromMemento(memento, configuration);                          
+                       }                       
+               } catch (CoreException e) {
+                       return;
+               }               
+               
+               configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
+               configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null);
+
+               int length = fLocator.getSourceContainers().length;
+               ISourceContainer[] containers = new ISourceContainer[length + 2];
+               containers[0] = mappingContainer;
+               containers[1] = container;
+               containers[2] = fLocator.getSourceContainers()[0];      
+               
+               fLocator.setSourceContainers(containers);               
+
+               try {
+                       configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, fLocator.getMemento());
+                       configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, fLocator.getId());
+               } catch (CoreException e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               }               
        }
 }
index 8d72e61..264d8cb 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui.shortcut;
 
 import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@@ -37,38 +36,44 @@ import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 
-
-
-
+/**
+ * 
+ * @deprecated It is not used anymore (commented out in plugin.xml).
+ */
+@Deprecated
 public class TizenDebianPropertyTester extends PropertyTester {
-       @Override
-       public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
-               if ("isTizenCustomDebianProject".equals(property)) {
-                       if (receiver instanceof IProject) {
-                               IProject project = (IProject)receiver;
-                               return testProject(project); 
-                       }
-               } else if ("belongTizenCustomDebianProject".equals(property)) {
-                       if (receiver instanceof IResource) {
-                               IResource r = (IResource)receiver;
-                               IProject project = r.getProject();
-                               return testProject(project);
-                       }
-               }
-               return false;
-       }
-       
-       private boolean testProject(IProject project) {
-               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
-               if (info == null)
-                       return false;
-               IConfiguration cfg = info.getDefaultConfiguration();
-               IManagedProject managedProject = cfg.getManagedProject();
-               String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId();
-               if (projectArtifactType.equals(PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE) ||
-                               projectArtifactType.equals(PlatformConfigurationManager.OLD_SLP_CUSTOM_DEBIAN_ARTIFACT_TYPE))
-                       return true;
-               else
-                       return false;
-       }
-}
\ No newline at end of file
+    @Override
+    public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+        if ("isTizenCustomDebianProject".equals(property)) {
+            if (receiver instanceof IProject) {
+                IProject project = (IProject)receiver;
+                return testProject(project);
+            }
+        } else if ("belongTizenCustomDebianProject".equals(property)) {
+            if (receiver instanceof IResource) {
+                IResource r = (IResource)receiver;
+                IProject project = r.getProject();
+                return testProject(project);
+            }
+        }
+        return false;
+    }
+
+    private boolean testProject(IProject project) {
+        IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+        if (info == null)
+            return false;
+        IConfiguration cfg = info.getDefaultConfiguration();
+        IManagedProject managedProject = cfg.getManagedProject();
+        if (managedProject != null && managedProject.getProjectType() != null) {
+            String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId();
+            if (projectArtifactType.equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE) ||
+                    projectArtifactType.equals(PlatformConfigurationManager.OLD_SLP_CUSTOM_DEBIAN_ARTIFACT_TYPE))
+                return true;
+            else
+                return false;
+        } else {
+            return false;
+        }
+    }
+}
index b790439..6f456c7 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.launch.ui.shortcut;
 
 import org.eclipse.jface.dialogs.Dialog;
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/LaunchWizardPageUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/LaunchWizardPageUIMessages.properties
new file mode 100644 (file)
index 0000000..ad532e9
--- /dev/null
@@ -0,0 +1,25 @@
+AppPage.Title = Setting Tizen Application
+AppPage.Desc = Please select a tizen application or add RPM files for testing
+AppPage.Label.AdditionPkgs = Additional Packages:
+AppPage.Label.Project = Tizen Application Project:
+AppPage.Dialog.Title.File = Select RPM files
+
+BinPage.Title = Setting binary path
+BinPage.Desc = Please set a path for test binary
+BinPage.Button.Browse = Remote Browse...
+BinPage.Remote.Dialog.Title = Select an Application
+
+ProcPage.Title = Select Process
+ProcPage.Desc = Please select a process for attach debugging
+ProcPage.Label.ProcName = Process:
+ProcPage.Label.ProcPath = Path:
+ProcPage.Button.Browse = Browse
+
+PkgDialog.Title = Select packages to be installed
+PkgDialog.Desc = Checked packages will be installed to buildsystem and device
+PkgDialog.Label.Buildsystem = To Buildsystem:
+PkgDialog.Label.Device = To Device:
+
+Button.Reinstall.Op = Reinstall if the package is already present
+Button.SelectPkg.Op = Select packages to be installed manually
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingAppPage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingAppPage.java
new file mode 100644 (file)
index 0000000..5e16afa
--- /dev/null
@@ -0,0 +1,579 @@
+/*
+ * 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.launch.wizard.pages;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.ImageUtil;
+import org.tizen.nativecommon.build.CommonBuildMessages;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativeplatform.Activator;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.build.PlatformProjectPackaging;
+import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages;
+import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+
+public class PlatformLaunchSettingAppPage extends WizardPage {
+       
+       private final String BUNDLE_NAME = PlatformLaunchSettingAppPage.class.getPackage().getName() + ".LaunchWizardPageUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+       
+       private TableViewer tableViewer;
+       private FileDialog fd;
+       private Combo projectCombo;
+       private Button reinstallOp;
+       private Button selectPkgOp;
+       private String selectedFileList = "";
+       private Shell shell;
+       
+       private IConfiguration config;
+       private IProject platformProject;
+       private PlatformRootstrap rootstrap;
+       private String rootPath = "";
+       private boolean packagingResult;
+       private ArrayList<LocalPackage> platformPackages = new ArrayList<LocalPackage>();
+       private ArrayList<LocalPackage> appPackages = new ArrayList<LocalPackage>();
+       private ArrayList<LocalPackage> extraPackages = new ArrayList<LocalPackage>();
+       private ArrayList<LocalPackage> packages = new ArrayList<LocalPackage>();
+       private ArrayList<String> projectNames = new ArrayList<String>();
+       private HashMap<String, IProject> projectMap = new HashMap<String, IProject>();
+       
+       private static final String APP_PROJ_DEFAULT_SELECTION = "[Not required]";
+
+       public PlatformLaunchSettingAppPage(Shell shell, String pageName, IProject project, IConfiguration config) {
+               super(pageName);
+               
+               setTitle(resources.getString("AppPage.Title"));
+               setDescription(resources.getString("AppPage.Desc"));
+               setPageComplete(true);
+       
+        this.platformProject = project;
+        this.config = config;
+        this.shell = shell;
+        String targetId = PlatformConfigurationManager.getBuildTargetName(config);
+        String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
+        this.rootstrap = RootstrapManager.getRootstrap(rootId);
+        this.rootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString());       
+        
+        setPlatformPackages();
+        setProjectMap();
+       }       
+
+       public void setPlatformPackages() {
+               platformPackages.clear();
+               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+               platformPackages = launchUtils.getProjectPackages(platformProject, config.getName());
+               
+        if (platformPackages.isEmpty()) {
+               String msg = String.format(TizenDebianLaunchMessages.QUESTION_PACKAGING, platformProject.getName());
+               if (64 == DialogUtil.openQuestionDialog(msg)) {
+                       if (packagingProject(platformProject)) {
+                               setPlatformPackages();
+                       }
+               }
+        } else {
+               packages.addAll(platformPackages);
+        }      
+       }
+
+       private void setAppPackages(IProject appProj) {
+               appPackages.clear();
+               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+               appPackages = launchUtils.getProjectPackages(appProj, config.getName());
+               if (appPackages.isEmpty()) {
+               String msg = String.format(TizenDebianLaunchMessages.QUESTION_PACKAGING, appProj.getName());
+               if (64 == DialogUtil.openQuestionDialog(msg)) {
+                       if (packagingProject(appProj)) {
+                               setAppPackages(appProj);
+                       }
+               }
+        }
+       }
+       
+       private void setProjectMap() {
+               IWorkspace works = ResourcesPlugin.getWorkspace();
+       IProject[] projs = works.getRoot().getProjects();
+       projectNames.add(APP_PROJ_DEFAULT_SELECTION);
+       for (IProject p : projs) {
+                IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(p);
+             if( info == null) {
+                 continue;
+             }
+             IConfiguration cfg = info.getDefaultConfiguration();
+             if( cfg == null) {
+                 continue;
+             }
+             IManagedProject managedProject = cfg.getManagedProject();
+             if( managedProject == null) {
+                 continue;
+             }
+             String projectArtifactType = managedProject.getProjectType() != null ? managedProject.getProjectType().getBuildArtefactType().getId() : null;
+             if (projectArtifactType != null && 
+                        projectArtifactType.equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE) &&
+                        !platformProject.getName().equals(p.getName())) {
+                String name = p.getName();
+                projectMap.put(name, p);                
+                projectNames.add(name);
+             }
+       }
+       }
+
+       @Override
+       public void createControl(Composite parent) {
+       Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(1, false));
+               GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.minimumHeight = 0;
+               composite.setLayoutData(gridData);      
+       
+               createProjectsComposite(composite);
+               createTableTitleComposite(composite);
+               createTableGroupComposite(composite);
+               createOptionGroupComposite(composite);
+               
+               setControl(composite);  
+       }       
+       
+       private void createOptionGroupComposite(Composite parent) {
+               Composite composite = new Composite(parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 1;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);
+               
+               reinstallOp = new Button(composite, SWT.CHECK);
+               reinstallOp.setText(resources.getString("Button.Reinstall.Op"));
+               reinstallOp.setSelection(true);
+               selectPkgOp = new Button(composite, SWT.CHECK);
+               selectPkgOp.setText(resources.getString("Button.SelectPkg.Op"));
+               selectPkgOp.setSelection(false);
+       }
+       
+       private void createTableTitleComposite(Composite parent) {
+               Label tableLabel = new Label(parent, SWT.NONE);
+               tableLabel.setText(resources.getString("AppPage.Label.AdditionPkgs"));
+       }
+    
+    private void createProjectsComposite(Composite parent) {
+       Composite composite = new Composite(parent, SWT.NONE);
+       composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+       GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 2;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);  
+       Label projectLabel = new Label(composite, SWT.NONE);
+       projectLabel.setText(resources.getString("AppPage.Label.Project"));
+       
+       GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);            
+               composite.setLayoutData(gridData);
+               
+       projectCombo = new Combo(composite, SWT.READ_ONLY);
+       projectCombo.setLayoutData(gridData);
+       projectCombo.setItems(projectNames.toArray(new String[0]));
+       projectCombo.addSelectionListener(new SelectionListener() {
+               
+            @Override
+            public void widgetSelected(SelectionEvent e)
+            {
+               String selected = projectCombo.getText().trim();
+               if (APP_PROJ_DEFAULT_SELECTION.equals(selected)) {
+                       packages.clear();
+                       packages.addAll(platformPackages);
+                       packages.addAll(extraPackages);
+               } else {
+                       IProject proj = projectMap.get(selected);
+                       setAppPackages(proj);
+                               packages.clear();
+                               packages.addAll(platformPackages);
+                               packages.addAll(appPackages);
+                               packages.addAll(extraPackages);                 
+               }
+            }
+
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e)
+            {}
+        });
+       
+       projectCombo.select(0);
+    }
+    
+    private void createTableComposite(Composite parent) {
+       Composite composite = new Composite(parent, SWT.NONE);          
+       GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 1;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);  
+               GridData gridData = new GridData(GridData.FILL_BOTH);
+               gridData.minimumWidth = 350;
+               gridData.minimumHeight = 200;
+               composite.setLayoutData(gridData);
+               
+               Composite t_composite = new Composite(composite, SWT.NONE);
+               t_composite.setLayout(new FillLayout());
+               t_composite.setLayoutData(new GridData(GridData.FILL_BOTH));    
+        
+               tableViewer = new TableViewer(t_composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);           
+               Table table = tableViewer.getTable();
+               
+               table.setHeaderVisible(true);
+               table.setLinesVisible(true);            
+               
+               String[] columnNames = new String[] {"RPM files"};
+               
+               int[] columnWidths = new int[] {450};
+               for (int i = 0; i < columnNames.length ; i++) {
+                       TableColumn tableColumn = new TableColumn(table, SWT.LEFT);                     
+                       
+                       tableColumn.setText(columnNames[i]);
+                       tableColumn.setWidth(columnWidths[i]);
+                       tableColumn.setResizable(true);                 
+                       //tableColumn.addSelectionListener(new TooltableSelectionAdapter());
+               }               
+                               
+               tableViewer.setLabelProvider(new TableViewerProvider());                
+               tableViewer.setContentProvider(new ArrayContentProvider());
+               packages.addAll(extraPackages);
+               tableViewer.setInput(extraPackages);            
+               tableViewer.getTable().addSelectionListener(new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {                          
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {                           
+                       }
+                       
+               });
+               
+               table.addListener(SWT.Dispose, tableListener);
+               table.addListener(SWT.KeyDown, tableListener);
+               table.addListener(SWT.MouseMove, tableListener);
+               table.addListener(SWT.MouseHover, tableListener);
+    }
+
+
+       private void createTableButtonsComposite(Composite parent) {
+       Composite composite = new Composite(parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+               GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 1;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);  
+               
+               Button addBt = new Button(composite, SWT.PUSH);
+               Image addIcon = ImageUtil.getImage(Activator.PLUGIN_ID, "icons/rootstrap/add.gif");
+               addBt.setImage(addIcon);        
+               addBt.addMouseListener(new MouseListener() {
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {                    
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               fd = new FileDialog(shell, SWT.OPEN|SWT.MULTI);
+                       fd.setText(resources.getString("AppPage.Dialog.Title.File"));                   
+                       String[] filterExt = { "*.rpm" };
+                       fd.setFilterExtensions(filterExt);
+                       selectedFileList = fd.open();                   
+                       System.out.println(selectedFileList);
+                       if (selectedFileList != null) {
+                               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 = RPMPackageCommander.getPkgNameForFile(p.getPath());
+                                               p.setName(name);
+                                       extraPackages.add(p);                                           
+                                       //rpmFiles.add(f);
+                               }
+                               //tableViewer.refresh();
+                               packages.clear();
+                               packages.addAll(platformPackages);
+                               packages.addAll(appPackages);     
+                               packages.addAll(extraPackages);
+                               tableViewer.refresh();
+                       }
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {                             
+                       }
+                       
+               });             
+               
+               
+               Button removeBt = new Button(composite, SWT.PUSH);
+               Image removeIcon = ImageUtil.getImage(Activator.PLUGIN_ID, "icons/rootstrap/remove.gif");
+               removeBt.setImage(removeIcon);  
+    }
+    
+
+
+       private void createTableGroupComposite(Composite parent) {
+       
+       Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 2;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);        
+               
+               createTableComposite(composite);
+               createTableButtonsComposite(composite); 
+    }
+    
+    private boolean packagingProject(final IProject targetProj) {
+       boolean result = false;
+       
+       try {           
+               if (getContainer() == null) {           
+                       ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);        
+                   
+                           dialog.run(true, true, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                               InterruptedException {
+                                       packagingResult = PlatformProjectPackaging.RPMPackaging(targetProj, config, monitor);
+                               }
+                           });             
+               } else {        
+                               getContainer().run(true, true,
+                                       new IRunnableWithProgress() {
+                                               public void run(IProgressMonitor monitor)
+                                                               throws InvocationTargetException,
+                                                               InterruptedException {
+                                                       packagingResult = PlatformProjectPackaging.RPMPackaging(targetProj, config, monitor);
+                                               }
+                               });
+               }
+       } catch (InvocationTargetException e) {
+                       e.printStackTrace();
+                       MessageDialog.openError(shell, CommonBuildMessages.BUILD_RESULT, 
+                               e.getMessage());
+                       return false;
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+                       MessageDialog.openError(shell, CommonBuildMessages.BUILD_RESULT, 
+                               e.getMessage());
+                       return false;
+               }
+       
+       if (packagingResult) {
+               MessageDialog.openInformation(shell, CommonBuildMessages.BUILD_RESULT, 
+                               CommonBuildMessages.SUCCESS_TO_BUILD_PACKAGE);                  
+            result = true;
+       } else {
+               MessageDialog.openError(shell, CommonBuildMessages.BUILD_RESULT, 
+                               CommonBuildMessages.FAIL_TO_BUILD_PACKAGE);             
+            result = false;
+       }
+        
+        return result;
+    }
+
+       /* selected package table provider */
+       private class TableViewerProvider extends LabelProvider implements ITableLabelProvider 
+       {
+               @Override
+               public Image getColumnImage(Object element, int columnIndex) {                  
+                       return null;
+               }
+
+               @Override
+               public String getColumnText(Object element, int columnIndex) {
+                       if ( element instanceof LocalPackage) {
+                               LocalPackage p = (LocalPackage)element;                         
+                               String name = new Path(p.getPath()).lastSegment();                              
+                               
+                               switch(columnIndex) {
+                               case 0:
+                                       return name;
+                               default:
+                                       break;
+                               }
+                       }
+                       return null;
+               }
+       }       
+       
+       public ArrayList<LocalPackage> getPackages() {
+               return packages;
+       }       
+       
+       public ArrayList<LocalPackage> getExtraPackages() {
+               return extraPackages;
+       }
+       
+       public String getRootstrapPath() {
+               return rootPath;
+       }
+       
+       public String getAppProjectName() {
+               return projectCombo.getText().trim();
+       }
+       
+       public boolean getReinstallOp() {
+               return reinstallOp.getSelection();
+       }
+       
+       public boolean getSelectPkgOp() {
+               return selectPkgOp.getSelection();
+       }
+       
+       Listener tableListener = new Listener() {
+               Shell tip = null;
+               Label label = null;
+
+               public void handleEvent(Event event) {
+                       switch (event.type) {
+                               case SWT.Dispose:
+                               case SWT.KeyDown:
+                               case SWT.MouseMove: {
+                                       if (tip == null) {
+                                               break;
+                                       }
+                                       tip.dispose();
+                                       tip = null;
+                                       label = null;
+                                       break;
+                               }
+                               case SWT.MouseHover: {
+                                       TableItem item = tableViewer.getTable().getItem(new Point(event.x, event.y));
+                                       if (item != null) {
+                                               if (tip != null && !tip.isDisposed()) {
+                                                       tip.dispose();
+                                               }
+                                               tip = new Shell(getShell(), SWT.ON_TOP | SWT.TOOL);
+                                               tip.setLayout(new FillLayout());
+                                               label = new Label(tip, SWT.NONE);
+                                               LocalPackage pkg = (LocalPackage)item.getData();              
+                     
+                                               label.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+                                               label.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+                     
+                                               label.setData("_TABLEITEM", item);
+                                               label.setText(pkg.getPath());
+                                               label.addListener(SWT.MouseExit, labelListener);
+                                               label.addListener(SWT.MouseDown, labelListener);
+                                               Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+                                               Rectangle rect = item.getBounds(0);
+                                               Point pt = tableViewer.getTable().toDisplay(rect.x, rect.y);
+                                               tip.setBounds(pt.x + 50, pt.y + 10, size.x, size.y);
+                                               tip.setVisible(true);
+                                       }
+                               }
+                               default:
+                                       break;
+                       }
+               }
+       };
+      
+      // Implement a "fake" tooltip
+       final Listener labelListener = new Listener() {
+               public void handleEvent(Event event) {
+                       Label label = (Label) event.widget;
+                       Shell shell = label.getShell();
+                       switch (event.type) {
+                               case SWT.MouseDown:
+                                       Event e = new Event();
+                                       e.item = (TableItem) label.getData("_TABLEITEM");
+                                       // Assuming table is single select, set the selection as if
+                                       // the mouse down event went through to the table
+                                       tableViewer.getTable().setSelection(new TableItem[] { (TableItem) e.item });
+                                       tableViewer.getTable().notifyListeners(SWT.Selection, e);
+                                       // fall through
+                               case SWT.MouseExit:
+                                       shell.dispose();
+                                       break;
+                               default:
+                                       break;
+                       }
+               }
+       };
+       
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingBinPage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingBinPage.java
new file mode 100644 (file)
index 0000000..383cc14
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * 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.launch.wizard.pages;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.tizen.common.connection.ConnectionPlugin;
+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.wizards.PlatformLaunchWizard;
+import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizardDialog;
+import org.tizen.nativeplatform.views.ui.AddRootstrapDialog;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.FileListingService.FileEntry;
+
+public class PlatformLaunchSettingBinPage extends WizardPage {
+       
+       private final String BUNDLE_NAME = PlatformLaunchSettingBinPage.class.getPackage().getName() + ".LaunchWizardPageUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+       private PlatformLaunchWizard wizard;
+       
+       private Text text;
+       private String filePath = "";
+       private static final String DEFAULT_APP_PATH = "/opt/apps/";
+       
+       public PlatformLaunchSettingBinPage(PlatformLaunchWizard wizard, String pageName) {
+               super(pageName);
+               this.wizard = wizard;
+               setTitle(resources.getString("BinPage.Title"));
+               setDescription(resources.getString("BinPage.Desc"));
+               setPageComplete(true);          
+       }
+
+       @Override
+       public void createControl(Composite parent) {
+               // TODO Auto-generated method stub
+               Composite composite = new Composite(parent, SWT.NULL);
+               composite.setLayout(new GridLayout(2, false));          
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+        text = new Text(composite,  SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+        text.setLayoutData(data);        
+        
+               Button browseButton = new Button(composite, SWT.PUSH);
+               browseButton.setText(resources.getString("BinPage.Button.Browse"));
+               browseButton.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent evt) {
+                               String path = handleBrowseButtonSelected();
+                               if (path != null) {
+                                       text.setText(path);
+                                       wizard.setEnableFinish(true);
+                                       wizard.getContainer().updateButtons();
+                               } else {
+                                       wizard.setEnableFinish(false);
+                                       wizard.getContainer().updateButtons();
+                               }
+                       }
+               });
+               
+               setControl(composite);
+       }
+       
+       protected String handleBrowseButtonSelected() {
+               IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+               if (window == null) {
+                       IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
+                       window = windows[0];
+               }
+
+               final Shell shell = window.getShell();
+               if (shell != null) {
+                       IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+                       if (device == null) {
+                               MessageBox msgBox = new MessageBox(shell, SWT.ICON_INFORMATION);
+                               msgBox.setMessage(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE);
+                               msgBox.open();
+                               return null;
+                       }
+
+                       shell.getDisplay().syncExec( new Runnable() {
+                               public void run() {
+                                       IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+                                       TizenRemoteFileDialog dlg = new TizenRemoteFileDialog(shell, 
+                                                       resources.getString("BinPage.Remote.Dialog.Title"), device, false, DEFAULT_APP_PATH);
+                                       if(dlg.open() == TizenRemoteFileDialogResult.OK) {
+                                               FileEntry selectedFile = dlg.getSelectedFileEntry();
+                                               filePath = selectedFile.getFullPath().trim();
+                                       } else
+                                               filePath = null;
+                               }
+                       });
+               }
+               return filePath;
+       }
+       
+       
+       public String getPath() {
+               return text.getText().trim();
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingProcPage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizard/pages/PlatformLaunchSettingProcPage.java
new file mode 100644 (file)
index 0000000..366db5c
--- /dev/null
@@ -0,0 +1,300 @@
+/*
+ * 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.launch.wizard.pages;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.core.IProcessInfo;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.nativecommon.build.CommonBuildMessages;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.build.PlatformProjectPackaging;
+import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages;
+import org.tizen.nativeplatform.launch.wizards.PlatformLaunchUtils;
+import org.tizen.nativeplatform.launch.wizards.PlatformLaunchWizard;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+
+import org.tizen.sdblib.IDevice;
+
+public class PlatformLaunchSettingProcPage extends WizardPage {        
+       
+       private final String BUNDLE_NAME = PlatformLaunchSettingProcPage.class.getPackage().getName() + ".LaunchWizardPageUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+       
+       private Button reinstallOp;
+       private Button selectPkgOp;     
+       private Text processText;       
+       private Text pathText;
+       private int pid;
+       private IProcessInfo procInfo;
+       private Shell shell;
+       private String rootPath = "";
+       private String procName = ""; 
+       private PlatformLaunchWizard wizard;
+                       
+       
+       private IConfiguration config;
+       private IProject platformProject;
+       private PlatformRootstrap rootstrap;    
+       private IDevice device;         
+       private boolean packagingResult;
+       private ArrayList<LocalPackage> platformPackages = new ArrayList<LocalPackage>();       
+       private ArrayList<LocalPackage> packages = new ArrayList<LocalPackage>();
+
+       public PlatformLaunchSettingProcPage(PlatformLaunchWizard wizard, Shell shell, String pageName, IProject project, IConfiguration config) {
+               super(pageName);
+               
+               setTitle(resources.getString("ProcPage.Title"));
+               setDescription(resources.getString("ProcPage.Desc"));
+               setPageComplete(true);
+       
+               this.wizard = wizard;
+        this.platformProject = project;
+        this.config = config;
+        this.shell = shell;
+        this.device = ConnectionPlugin.getDefault().getCurrentDevice();
+        String targetId = PlatformConfigurationManager.getBuildTargetName(config);
+        String rootId = SmartBuildInterface.getInstance().getRootstrapIDFromTargetID(targetId);
+        this.rootstrap = RootstrapManager.getRootstrap(rootId);
+        this.rootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString());
+        
+        setPlatformPackages();
+       }       
+
+       public void setPlatformPackages() {
+               platformPackages.clear();
+               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+               platformPackages = launchUtils.getProjectPackages(platformProject, config.getName());
+               
+        if (platformPackages.isEmpty()) {
+               String msg = String.format(TizenDebianLaunchMessages.QUESTION_PACKAGING, platformProject.getName());
+               if (64 == DialogUtil.openQuestionDialog(msg)) {
+                       if (packagingProject(platformProject)) {
+                               setPlatformPackages();
+                       }
+               }
+        } else {
+               packages.addAll(platformPackages);
+        }      
+       }
+
+       @Override
+       public void createControl(Composite parent) {
+       Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(1, false));
+               GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.minimumHeight = 0;
+               composite.setLayoutData(gridData);      
+       
+               createProcessComposite(composite);
+               createProcessInfoComposite(composite);
+               createOptionGroupComposite(composite);
+               
+               setControl(composite);  
+       }       
+       
+       private void createOptionGroupComposite(Composite parent) {
+               Composite composite = new Composite(parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_END));
+               GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 1;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);
+               
+               reinstallOp = new Button(composite, SWT.CHECK);
+               reinstallOp.setText(resources.getString("Button.Reinstall.Op"));
+               reinstallOp.setSelection(true);
+               selectPkgOp = new Button(composite, SWT.CHECK);
+               selectPkgOp.setText(resources.getString("Button.SelectPkg.Op"));
+               selectPkgOp.setSelection(false);
+       }
+    
+    private void createProcessComposite(Composite parent) {
+       Composite composite = new Composite(parent, SWT.NONE);
+       GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 3;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);
+               GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);            
+               composite.setLayoutData(gridData);
+               
+       Label procLabel = new Label(composite, SWT.NONE);
+       procLabel.setText(resources.getString("ProcPage.Label.ProcName"));      
+               
+       processText = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
+       processText.setLayoutData(gridData);
+       Button findBt = new Button(composite, SWT.PUSH);
+       findBt.setText(resources.getString("ProcPage.Button.Browse"));
+       findBt.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent evt) {
+                               PlatformLaunchUtils launchUtils = new PlatformLaunchUtils();
+                               procInfo = launchUtils.getProcess(shell, device);
+                               if (procInfo != null) {
+                                       IPath ppath = new Path(procInfo.getName());
+                                       pid = procInfo.getPid();
+                                       String name = ppath.lastSegment().trim();
+                                       String value = name + " [" + String.valueOf(pid) + "]";
+                                       processText.setText(value);
+                                       procName = name;
+                                       pathText.setText(procInfo.getName());
+                                       wizard.setEnableFinish(true);
+                                       wizard.getContainer().updateButtons();                          
+                               } else {
+                                       wizard.setEnableFinish(false);
+                                       wizard.getContainer().updateButtons();
+                               }
+                       }
+               });
+    }
+    
+    private void createProcessInfoComposite(Composite parent) {
+       Composite composite = new Composite(parent, SWT.NONE);
+       GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 2;
+        gridLayout.marginWidth = 0;
+        gridLayout.marginHeight = 0;
+               composite.setLayout(gridLayout);
+               GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);            
+               composite.setLayoutData(gridData);
+               
+       Label procPath = new Label(composite, SWT.NONE);
+       procPath.setText(resources.getString("ProcPage.Label.ProcPath"));       
+               
+       pathText = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
+       pathText.setLayoutData(gridData);               
+    }
+    
+    public String getProgramPath() {
+       return pathText.getText().trim();
+    }
+    
+    public int getPid() {
+       return pid;
+    }
+    
+       public String getRootstrapPath() {
+               return rootPath;
+       }
+       
+       public String getProcName() {
+               return procName;
+       }
+       
+       public ArrayList<LocalPackage> getPackages() {
+               return packages;
+       }
+       
+       public boolean getReinstallOp() {
+               return reinstallOp.getSelection();
+       }
+       
+       public boolean getSelectPkgOp() {
+               return selectPkgOp.getSelection();
+       }
+       
+    private boolean packagingProject(final IProject targetProj) {
+       boolean result = false;
+       
+       try {           
+               if (getContainer() == null) {           
+                       ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);        
+                   
+                           dialog.run(true, true, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                               InterruptedException {
+                                       packagingResult = PlatformProjectPackaging.RPMPackaging(targetProj, config, monitor);
+                               }
+                           });             
+               } else {        
+                               getContainer().run(true, true,
+                                       new IRunnableWithProgress() {
+                                               public void run(IProgressMonitor monitor)
+                                                               throws InvocationTargetException,
+                                                               InterruptedException {
+                                                       packagingResult = PlatformProjectPackaging.RPMPackaging(targetProj, config, monitor);
+                                               }
+                               });
+               }
+       } catch (InvocationTargetException e) {
+                       e.printStackTrace();
+                       MessageDialog.openError(shell, CommonBuildMessages.BUILD_RESULT, 
+                               e.getMessage());
+                       return false;
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+                       MessageDialog.openError(shell, CommonBuildMessages.BUILD_RESULT, 
+                               e.getMessage());
+                       return false;
+               }
+       
+       if (packagingResult) {
+               MessageDialog.openInformation(shell, CommonBuildMessages.BUILD_RESULT, 
+                               CommonBuildMessages.SUCCESS_TO_BUILD_PACKAGE);                  
+            result = true;
+       } else {
+               MessageDialog.openError(shell, CommonBuildMessages.BUILD_RESULT, 
+                               CommonBuildMessages.FAIL_TO_BUILD_PACKAGE);             
+            result = false;
+       }
+        
+        return result;
+    }  
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/LaunchWizardUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/LaunchWizardUIMessages.properties
new file mode 100644 (file)
index 0000000..2b4cdcb
--- /dev/null
@@ -0,0 +1,4 @@
+PkgDialog.Title = Select packages to be installed
+PkgDialog.Desc = Checked packages will be installed to buildsystem and device
+PkgDialog.Label.Buildsystem = To Buildsystem:
+PkgDialog.Label.Device = To Device:
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformAttachLaunchWizard.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformAttachLaunchWizard.java
new file mode 100644 (file)
index 0000000..209779d
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * 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.launch.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.ResourceBundle;
+
+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;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages;
+import org.tizen.nativeplatform.launch.wizard.pages.PlatformLaunchSettingProcPage;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.views.ui.AddRootstrapDialog;
+
+
+public class PlatformAttachLaunchWizard extends PlatformLaunchWizard {
+       
+       private int pid;
+       private String procName;
+       
+       private final String SETTING_PROC_PAGE = "setting_proc";
+       
+       public PlatformAttachLaunchWizard(Shell shell, IProject project, IConfiguration config, String mode) {
+               super(shell, project, config, mode);
+       }
+       
+       @Override
+       public void addPages() {
+               addPage(new PlatformLaunchSettingProcPage(this, shell, SETTING_PROC_PAGE, project, config));            
+               
+               WizardDialog dialog = (WizardDialog)getContainer();
+               dialog.addPageChangedListener(this);
+               dialog.addPageChangingListener(this);
+       }
+       
+       public String getProgramPath() {
+               return programPath;
+       }
+       
+       public int getPid() {
+               return pid;
+       }
+       
+       public String getProcName() {
+               return procName;
+       }
+       
+       @Override
+       public boolean performFinish() {
+               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();
+               reinstallOp = page.getReinstallOp();
+               selectPkgOp = page.getSelectPkgOp();            
+               procName = page.getProcName();
+               pid = page.getPid();
+               
+               //container.run(fork, cancelable, runnable)                     
+               
+               try {
+                       container.run(true, true,
+                               new IRunnableWithProgress() {
+                                       public void run(IProgressMonitor monitor)
+                                                       throws InvocationTargetException,
+                                                       InterruptedException {
+                                               monitor.beginTask(TizenDebianLaunchMessages.INSTALL_PACKAGE, 2);
+                                               monitor.subTask(TizenDebianLaunchMessages.CHECK_PKG_STATUS);
+                                               
+                                               final ArrayList<LocalPackage> BuildSystemPkgs = new ArrayList<LocalPackage>();
+                                               final ArrayList<LocalPackage> DevicePkgs = new ArrayList<LocalPackage>();
+                                               
+                                               launchUtil.filterBuildsystemPkgs(packages, BuildSystemPkgs, rootstrapPath, reinstallOp);
+                                               
+                                               if (selectPkgOp) {
+                                                       if (!openPkgStatusDialog(BuildSystemPkgs, DevicePkgs)) {
+                                                               return;
+                                                       }
+                                               }
+                                               
+                                               ArrayList<LocalPackage> selecteBsPkgs = launchUtil.getSelectedPackages(BuildSystemPkgs);                                                
+                                               
+                                               monitor.worked(1);                      
+                                               monitor.subTask(TizenDebianLaunchMessages.INSTALL_PACKAGES_TO_BUILDSYSTEM);
+                                                 
+                                               if (selecteBsPkgs != null && !selecteBsPkgs.isEmpty()) {                                                        
+                                                       launchUtil.installPkgsToRootstrap(selecteBsPkgs, rootstrapPath, new SubProgressMonitor(monitor, 1));
+                                               }                                       
+
+                                               monitor.done();                                         
+                                       }                                       
+                       });
+               } catch (InvocationTargetException e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               } catch (InterruptedException e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();                                    
+                       openLogDialog(TizenDebianLaunchMessages.FAILED_INSTALL_PKGS, e.getMessage());           
+               }
+               
+               return true;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchUtils.java
new file mode 100644 (file)
index 0000000..24de4c4
--- /dev/null
@@ -0,0 +1,594 @@
+/*
+ * 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.launch.wizards;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+
+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;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+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.console.MessageConsoleStream;
+import org.eclipse.ui.dialogs.TwoPaneElementSelector;
+import org.tizen.common.TizenPlatformConstants;
+import org.tizen.common.ui.view.console.ConsoleManager;
+import org.tizen.common.util.FileUtil;
+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.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.SdbCommandRejectedException;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.SyncResult;
+import org.tizen.sdblib.TimeoutException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+@SuppressWarnings("restriction")
+public class PlatformLaunchUtils {
+       
+       private IProcessInfo procInfo;
+       
+       public PlatformLaunchUtils() {
+               
+       }
+       
+       public boolean installPkgsToRootstrap(ArrayList<LocalPackage> packages, String rootPath, 
+                       IProgressMonitor monitor) throws InterruptedException {
+               
+               monitor.beginTask("Installing packages to rootstrap", 3);
+               
+               String rpmPathList = "";
+               String localPkgList = "";
+               
+       for (LocalPackage p : packages) {                       
+               String filePath = p.getPath();
+                       String filename = new File(filePath).getName();
+                       String pathOnRootstrap = "/tmp/" + filename;
+                       String copyToPath = rootPath + pathOnRootstrap;
+                       try {
+                               FileUtil.copyTo(filePath, copyToPath);
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       }
+                       rpmPathList = rpmPathList.concat(pathOnRootstrap + " ");
+                       localPkgList = localPkgList.concat(p.getName() + " ");                          
+       }       
+
+       boolean error = false;
+       String log = "";
+       
+       //monitor.subTask("Installing packages..");
+       
+
+       String proxy = PreferencesManager.getProxyURL();
+       RPMPackageCommander.setHttpProxy(proxy);
+       Document doc = RPMPackageCommander.InstallPkgWithZypperXmlOut(rootPath, rpmPathList, true, true);
+       
+               doc.getDocumentElement().normalize();           
+               NodeList messageNodes = doc.getElementsByTagName("message");
+               
+               
+               for (int i = 0; i < messageNodes.getLength() ; i++) {
+                       Node ii = messageNodes.item(i);                 
+                       NamedNodeMap map = ii.getAttributes();          
+                       Node node = map.getNamedItem("type");
+                       if (node != null) {
+                               String type = node.getNodeValue();
+                               if (type.equals("error")) {
+                                       error = true;
+                                       log = log + "[ERROR] " + ii.getFirstChild().getNodeValue() + "\n";
+                               } else {
+                                       log = log + "[INFO] " + ii.getFirstChild().getNodeValue() + "\n";
+                               }
+                       }                       
+               }               
+       
+               if (error) {
+                       newException(log);                      
+               }               
+               monitor.worked(1);
+               
+               monitor.subTask("Checking installed successfully..");
+               String failedInstallPkgs = "";
+               for (LocalPackage p : packages) {
+                       String name = p.getName();
+                       if(!RPMPackageCommander.pkgInstalledSuccessfullyForRootstrap(name, rootPath)) {
+                               failedInstallPkgs = failedInstallPkgs + "   - " + name + newline();
+                       }
+               }    
+               
+               if (failedInstallPkgs != "") {
+                       newException(log);
+               }
+               monitor.worked(2);
+               monitor.done();
+
+       return true;            
+       }
+       
+       public boolean installPkgsToDevice(ArrayList<LocalPackage> packages, IDevice device, IProgressMonitor monitor) 
+                       throws InterruptedException {
+               
+               monitor.beginTask("Installing packages to rootstrap", 3);
+               
+               ArrayList<LocalPackage> packagesForDevice = new ArrayList<LocalPackage>();
+       ConsoleManager cm = new ConsoleManager("package manager", true);
+               //cm.clear();
+               MessageConsoleStream mcs = cm.getMessageConsoleStream();
+               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
+               rec.setMessageConsoleStream(mcs);
+               
+       ArrayList<String> localPkgList = new ArrayList<String>();       
+       
+       for (LocalPackage p : packages) {
+               String file = new File(p.getPath()).getName();
+               
+               if (file.contains("-debugsource") || file.contains("-debuginfo") ||
+                               file.contains("-devel")) {
+                       continue;
+               }
+               
+               packagesForDevice.add(p);
+               localPkgList.add(p.getPath());
+       }
+       
+       //monitor.subTask("Installing packages..");     
+       RPMPackageCommander.InstallLocalPkgToDevice(localPkgList, device);      
+       monitor.worked(1);
+       
+       // check to install successfully
+       monitor.subTask("Checking installed successfully..");
+       String failedInstallPkgs = "";
+               for (LocalPackage p : packagesForDevice) {
+                       String name = p.getName();
+                       if(!RPMPackageCommander.pkgInstalledSuccessfullyForDevice(name, device, rec)) {
+                               failedInstallPkgs = failedInstallPkgs + "   - " + name + newline();
+                       }
+               }    
+               
+               if (failedInstallPkgs != "") {
+                       String msg = String.format("Follow package does not installed successfully.\n\n" +
+                                       "%s\n" +
+                                       "You can install package through package manager manually.", failedInstallPkgs);
+                       newException(msg);
+                       return false;
+               }
+               monitor.worked(2);
+               monitor.done();
+       
+       return true;
+       }
+       
+       private String newline() {              
+               return "\n";
+       }
+
+    protected void newException(String message) throws InterruptedException {
+        //Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message, exception);
+        //throw new CoreException(status);
+       throw new InterruptedException(message);
+    }
+    
+    public IProject getProjectInstance(String projectName) {
+       IWorkspace works = ResourcesPlugin.getWorkspace();
+       IProject[] projs = works.getRoot().getProjects();
+       IProject result = null;
+       for (IProject p : projs) {
+                IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(p);
+             if( info == null) {
+                 continue;
+             }
+             IConfiguration cfg = info.getDefaultConfiguration();
+             if( cfg == null) {
+                 continue;
+             }
+             IManagedProject managedProject = cfg.getManagedProject();
+             if( managedProject == null) {
+                 continue;
+             }
+             String projectArtifactType = managedProject.getProjectType() != null ? managedProject.getProjectType().getBuildArtefactType().getId() : null;
+             if (projectArtifactType != null && 
+                        projectArtifactType.equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE) &&
+                        projectName.equals(p.getName())) {
+                result = p;
+                break;
+             }
+       }
+       
+       return result;
+    }
+    
+    public ArrayList<LocalPackage> getProjectPackages(IProject project, String configName) {
+       ArrayList<LocalPackage> pkgs = new ArrayList<LocalPackage>();
+       IFolder folder = project.getFolder(configName);
+               File dir = new File(folder.getLocation().toOSString());
+               if (dir.exists()) {                     
+                       for (File f : dir.listFiles()) {
+                               if (f.isFile() && f.getName().endsWith(".rpm")) {       
+                                       IPath pkgPath = new Path(dir.getPath()).append(f.getName());
+                                       LocalPackage pkg = getLocalPackage(pkgPath.toOSString());                                                                       
+                                       pkgs.add(pkg);
+                               }
+                       }
+               }
+               
+               return pkgs;
+    }
+    
+    public LocalPackage getLocalPackage(String pkgfilePath) {          
+       LocalPackage pkg = new LocalPackage();          
+               pkg.setPath(pkgfilePath);                                                       
+               String name = RPMPackageCommander.getPkgNameForFile(pkg.getPath());
+               pkg.setName(name);                                                      
+               return pkg;
+    }
+    
+    public ArrayList<LocalPackage> getLocalPackages(ArrayList<String> pkgPaths) {
+       ArrayList<LocalPackage> pkgs = new ArrayList<LocalPackage>();
+       for (String path : pkgPaths) {
+               LocalPackage pkg = getLocalPackage(path);
+               pkgs.add(pkg);
+       }
+                                                               
+               return pkgs;
+    }
+    
+       public void filterBuildsystemPkgs(ArrayList<LocalPackage> totalPackages,
+                       ArrayList<LocalPackage> buildsystePkgs, String rootstrapPath, boolean reinstallOp) {
+               for (LocalPackage pkg : totalPackages) {                
+                       buildsystePkgs.add(pkg.clone());
+               }               
+               
+               updateBuildsystemPkgs(buildsystePkgs, rootstrapPath, reinstallOp);              
+       }
+       
+       public void filterDevicePackages(ArrayList<LocalPackage> totalPackages,
+                       ArrayList<LocalPackage> devicePkgs, IDevice device, 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());
+               }
+               }
+
+               updateDevicePkgs(devicePkgs, device, reinstallOp);
+       }
+       
+       private void updateBuildsystemPkgs(ArrayList<LocalPackage> pkgs, String rootstrapPath,
+                        boolean reinstallOp) {
+               for (LocalPackage pkg : pkgs) {
+                       String newVer = RPMPackageCommander.getPkgVerForFile(pkg.getPath());
+                       String arch = RPMPackageCommander.getArchForFile(pkg.getPath());
+                       String installedVerForRootstrap = RPMPackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), rootstrapPath);
+                       
+                       pkg.setNewVersion(newVer);
+                       pkg.setArch(arch);
+                       pkg.setInstalledVersion(installedVerForRootstrap);
+                       
+                       pkg.setCheckColumn(true);
+                       
+                       if ("".equals(newVer)) {
+                               pkg.setCheckColumn(false);
+                       } else if (!"".equals(installedVerForRootstrap)) {
+                               if (!installedVerForRootstrap.equals(newVer)) {
+                                       pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+                               } else {
+                                       if (RPMPackageCommander.pkgInstalledSuccessfullyForRootstrap(pkg.getName(), rootstrapPath)) {
+                                               pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+                                               if (!reinstallOp) {
+                                                       pkg.setCheckColumn(false);
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+       
+       private void updateDevicePkgs(ArrayList<LocalPackage> pkgs, IDevice device,
+                        boolean reinstallOp) {
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+               
+               for (LocalPackage pkg : pkgs) {
+                       String newVer = RPMPackageCommander.getPkgVerForFile(pkg.getPath());
+                       String arch = RPMPackageCommander.getArchForFile(pkg.getPath());
+                       String installedVer = RPMPackageCommander.getPkgInstalledVerForDevice(pkg.getName(), device, rec);
+                       
+                       pkg.setNewVersion(newVer);
+                       pkg.setArch(arch);
+                       pkg.setInstalledVersion(installedVer);
+                       
+                       pkg.setCheckColumn(true);
+                       
+                       if ("".equals(newVer)) {
+                               pkg.setCheckColumn(false);
+                       } else if (!"".equals(installedVer)) {
+                               if (!installedVer.equals(newVer)) {
+                                       pkg.setInstallInfo(Package.INSTALLINFO.DIFFERENT_VERSION);
+                               } else {
+                                       if (RPMPackageCommander.pkgInstalledSuccessfullyForDevice(pkg.getName(), device, rec)) {
+                                               pkg.setInstallInfo(Package.INSTALLINFO.INSTALLED);
+                                               if (!reinstallOp) {
+                                                       pkg.setCheckColumn(false);
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+       
+       public ArrayList<LocalPackage> getSelectedPackages(ArrayList<LocalPackage> pkgs) {
+               ArrayList<LocalPackage> selectedPkgs = new ArrayList<LocalPackage>();
+               for (LocalPackage pkg : pkgs) {
+                       if (pkg.getCheckColumn()) {
+                               selectedPkgs.add(pkg);
+                       }
+               }
+               
+               return selectedPkgs;
+       }
+       
+       
+       private PackageManagerOuputReceiver getNewOuputReceiver() {
+               ConsoleManager cm = new ConsoleManager("debug launch", true);
+               cm.clear();
+               MessageConsoleStream mcs = cm.getMessageConsoleStream();
+               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
+               rec.setMessageConsoleStream(mcs);
+
+               return rec;
+       }
+
+    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;
+               String version = null;
+               IFolder folder = project.getFolder("packaging");
+               File dir = new File(folder.getLocation().toOSString());
+               File specfile = null;
+               if (dir.exists()) {                     
+                       for (File f : dir.listFiles()) {
+                               if (f.isFile() && f.getName().endsWith(".spec")) {
+                                       specfile = f;
+                                       break;
+                               }
+                       }
+               }
+               
+               try {
+                       BufferedReader in = new BufferedReader(new FileReader(specfile.getPath()));
+                       String s;
+                       
+                       while ((s = in.readLine()) != null ) { 
+                               s = s.trim();
+                               if (s.trim().startsWith("Name:")) {
+                                       String[] arrStr = s.split(":");
+                                       if (arrStr.length == 2) {
+                                               name = arrStr[1].trim();
+                                               continue;
+                                       }
+                               } else if (s.trim().startsWith("Version:")) {
+                                       String[] arrStr = s.split(":");
+                                       if (arrStr.length == 2) {
+                                               version = arrStr[1].trim();
+                                               continue;
+                                       }
+                               }
+                               
+                               if (name != null && version != null) {
+                                       break;
+                               }
+                       }
+               } catch (FileNotFoundException e) {
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+               
+               if (name != null && version != null) {
+                       infos[0] = name;
+                       infos[1] = version;
+                       return infos;                   
+               } else {
+                       return null;
+               }               
+       }
+       
+       public boolean checkGdbServerInDevice(IDevice device, TizenLaunchCommand command) throws CoreException {
+               String resultCommand = TizenPlatformConstants.GDBSERVER_PLATFORM_CMD + " --version"
+                + TizenPlatformConstants.CMD_RESULT_CHECK;
+               try {
+                       command.run(resultCommand, "0");
+               } catch (Exception e) {
+            //LaunchUtils.newCoreException(NLS.bind(TizenLaunchMessages.CANNOT_FIND_GDBSERVER, device.getDeviceName()), e);
+               return false;
+               }
+        
+        return true;
+       }
+       
+       public void readyGdbServer(IDevice device, TizenLaunchCommand command, IPath srcPath) 
+                       throws CoreException, TimeoutException, SdbCommandRejectedException, IOException {
+               File gdbserver = new File(srcPath.toOSString());
+               
+               if (!gdbserver.exists()) {
+                       LaunchUtils.newCoreException(NLS.bind(TizenLaunchMessages.CANNOT_FIND_GDBSERVER, device.getDeviceName()), null);
+               }
+               
+               if (!checkGdbServerInDevice(device, command)) {
+                       copyFileToDevice(device, srcPath.toOSString(), TizenPlatformConstants.GDBSERVER_PLATFORM_CMD);
+                       device.executeShellCommand(String.format("chmod +x %s", TizenPlatformConstants.GDBSERVER_PLATFORM_CMD));                
+               }       
+       }
+       
+       public void copyFileToDevice(IDevice device, String srcPath, String descPath) throws CoreException, TimeoutException, SdbCommandRejectedException, IOException {
+               SyncResult syncSuccess = device.getSyncService().pushFile(srcPath,
+                               descPath, SyncService.getNullProgressMonitor());
+
+        if (syncSuccess.getCode() != SyncService.RESULT_OK) {
+            LaunchUtils.newCoreException(TizenLaunchMessages.CANNOT_TRANSFER_FILE, null);
+        }
+       }
+       
+       public boolean checkGdbServerInBuildSystem(String rootstrapPath) {
+               IPath path = new Path(rootstrapPath).append("usr").append("bin").append("gdbserver");
+               File gdbserver = new File(path.toOSString());
+               
+               return gdbserver.exists();
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizard.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizard.java
new file mode 100644 (file)
index 0000000..ad7c0c3
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ * 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.launch.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
+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.debug.core.ILaunchManager;
+import org.eclipse.jface.dialogs.IPageChangedListener;
+import org.eclipse.jface.dialogs.IPageChangingListener;
+import org.eclipse.jface.dialogs.PageChangedEvent;
+import org.eclipse.jface.dialogs.PageChangingEvent;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.util.SWTUtil;
+import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages;
+import org.tizen.nativeplatform.launch.wizard.pages.PlatformLaunchSettingAppPage;
+import org.tizen.nativeplatform.launch.wizard.pages.PlatformLaunchSettingBinPage;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+import org.tizen.sdblib.IDevice;
+
+public class PlatformLaunchWizard extends Wizard implements IPageChangingListener, IPageChangedListener {
+       
+       protected IProject project;
+       protected IConfiguration config;
+       protected IDevice device;       
+       protected Shell shell;
+       protected String programPath = "";
+       protected String appProjectName = "";
+       protected boolean reinstallOp;
+       protected boolean selectPkgOp;
+       protected ArrayList<LocalPackage> packages =  new ArrayList<LocalPackage>();
+       protected ArrayList<LocalPackage> extraPackages =  new ArrayList<LocalPackage>();
+       protected String appProject = "";       
+       protected String mode = "";
+       protected boolean result;
+       protected boolean canFinish = false;
+       
+       private final String SETTING_APP_PAGE = "setting_app";
+       private final String SETTING_BIN_PAGE = "setting_bin";
+       
+       public PlatformLaunchWizard() {                         
+       }
+       
+       public PlatformLaunchWizard(Shell shell, IProject project, IConfiguration config, String mode) {
+               this.project = project;
+               this.config = config;
+               this.shell = shell;
+               this.device = ConnectionPlugin.getDefault().getCurrentDevice();
+               this.mode = mode;
+               setWindowTitle("Launch Configuration");
+               setNeedsProgressMonitor(true);          
+       }
+
+       @Override
+       public boolean needsProgressMonitor() {
+               return true;
+       }       
+
+       @Override
+       public boolean canFinish() {
+               return canFinish;
+       }
+       
+       public void setEnableFinish(boolean value) {
+               canFinish = value;
+       }
+
+       @Override
+       public boolean performFinish() {
+               PlatformLaunchSettingBinPage binPage = (PlatformLaunchSettingBinPage)getPage(SETTING_BIN_PAGE);
+               programPath = binPage.getPath();
+               
+               PlatformLaunchSettingAppPage appPage = (PlatformLaunchSettingAppPage)getPage(SETTING_APP_PAGE);
+               appProjectName = appPage.getAppProjectName();
+               extraPackages = appPage.getExtraPackages();             
+               
+               return true;
+       }
+       
+       public String getProgramPath() {
+               return programPath;
+       }
+       
+       public ArrayList<LocalPackage> getPackages() {
+               return packages;
+       }
+       
+       public ArrayList<LocalPackage> getExtraPackages() {
+               return extraPackages; 
+       }
+       
+       public String getAppProjectName() {
+               return appProjectName;
+       }
+       
+       public boolean getReinstallOp() {
+               return reinstallOp;
+       }
+       
+       public boolean getSelectPkgOp() {
+               return selectPkgOp;
+       }
+       
+       @Override
+       public void addPages() {
+               addPage(new PlatformLaunchSettingAppPage(shell, SETTING_APP_PAGE, project, config));
+               addPage(new PlatformLaunchSettingBinPage(this, SETTING_BIN_PAGE));
+               
+               WizardDialog dialog = (WizardDialog)getContainer();
+               dialog.addPageChangedListener(this);
+               dialog.addPageChangingListener(this);
+       }
+
+       @Override
+       public void pageChanged(PageChangedEvent event) {               
+
+               WizardPage selectedPage = (WizardPage)event.getSelectedPage();          
+       }
+
+       @Override
+       public void handlePageChanging(final PageChangingEvent event) {
+               // TODO Auto-generated method stub
+               WizardPage currentPage = (WizardPage)event.getCurrentPage();
+               WizardPage targetPage = (WizardPage)event.getTargetPage();
+               
+               if (currentPage.getName().equals(SETTING_APP_PAGE) && targetPage.getName().equals(SETTING_BIN_PAGE)) {
+                       PlatformLaunchSettingAppPage page = (PlatformLaunchSettingAppPage)currentPage;
+                       final String rootstrapPath = page.getRootstrapPath();                   
+                       packages = page.getPackages();
+                       IWizardContainer container = getContainer();
+                       final PlatformLaunchUtils launchUtil = new PlatformLaunchUtils();
+                       final IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+                       reinstallOp = page.getReinstallOp();
+                       selectPkgOp = page.getSelectPkgOp();            
+                       
+                       //container.run(fork, cancelable, runnable)                     
+                       
+                       try {
+                               container.run(true, true,
+                                       new IRunnableWithProgress() {
+                                               public void run(IProgressMonitor monitor)
+                                                               throws InvocationTargetException,
+                                                               InterruptedException {
+                                                       monitor.beginTask(TizenDebianLaunchMessages.INSTALL_PACKAGE, 3);
+                                                       monitor.subTask(TizenDebianLaunchMessages.CHECK_PKG_STATUS);
+                                                       
+                                                       final ArrayList<LocalPackage> BuildSystemPkgs = new ArrayList<LocalPackage>();
+                                                       final ArrayList<LocalPackage> DevicePkgs = new ArrayList<LocalPackage>();
+                                                       
+                                                       if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+                                                               launchUtil.filterBuildsystemPkgs(packages, BuildSystemPkgs, rootstrapPath, reinstallOp);
+                                                       }
+                                                       launchUtil.filterDevicePackages(packages, DevicePkgs, device, reinstallOp);
+                                                       
+                                                       if (selectPkgOp) {
+                                                               if (!openPkgStatusDialog(BuildSystemPkgs, DevicePkgs)) {
+                                                                       cancelChanging(event);
+                                                                       return;
+                                                               }
+                                                       }
+                                                       
+                                                       ArrayList<LocalPackage> selecteBsPkgs = launchUtil.getSelectedPackages(BuildSystemPkgs);
+                                                       ArrayList<LocalPackage> selecteDvPkgs = launchUtil.getSelectedPackages(DevicePkgs);
+                                                       
+                                                       monitor.worked(1);                      
+                                                       monitor.subTask(TizenDebianLaunchMessages.INSTALL_PACKAGES_TO_BUILDSYSTEM);
+                                                         
+                                                       if (selecteBsPkgs != null && !selecteBsPkgs.isEmpty()) {                                                        
+                                                               launchUtil.installPkgsToRootstrap(selecteBsPkgs, rootstrapPath, new SubProgressMonitor(monitor, 1));
+                                                       }                                                       
+
+                                                       monitor.subTask(TizenDebianLaunchMessages.INSTALL_PACKAGES_TO_DEVICE);
+                                                       if (selecteDvPkgs != null && !selecteDvPkgs.isEmpty()) {
+                                                               launchUtil.installPkgsToDevice(selecteDvPkgs, device, new SubProgressMonitor(monitor, 1));
+                                                       }
+                                                       monitor.done();                                         
+                                               }                                       
+                               });
+                       } catch (InvocationTargetException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       } catch (InterruptedException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();                            
+                               openLogDialog(TizenDebianLaunchMessages.FAILED_INSTALL_PKGS, e.getMessage());                                           
+                               cancelChanging(event);
+                       }
+               }               
+       }
+       
+       public void cancelChanging(PageChangingEvent event) {           
+               event.doit = false;
+       }
+
+       public void openLogDialog(final String desc, final String log) {
+               SWTUtil.syncExec(new Runnable() {
+            public void run() {
+               ShowLogDialog dialog = new ShowLogDialog(shell, desc, log);
+                dialog.open();
+            }
+        });
+       }
+               
+       public boolean openPkgStatusDialog(final ArrayList<LocalPackage> BuildSystemPkgs, final ArrayList<LocalPackage> DevicePkgs) {           
+               SWTUtil.syncExec(new Runnable() {
+            public void run() {
+               ShowPackageStatusDialog statusDlg = new ShowPackageStatusDialog(shell, BuildSystemPkgs, DevicePkgs);
+                               if (Window.OK  == statusDlg.open()) {
+                                       result = true;
+                               } else {
+                                       result = false;
+                               }
+            }
+        });
+               
+               return result;
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizardDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/PlatformLaunchWizardDialog.java
new file mode 100644 (file)
index 0000000..6a367f3
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * 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.launch.wizards;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPackage;
+
+public class PlatformLaunchWizardDialog extends WizardDialog {
+       
+       private PlatformLaunchWizard wizard = null;
+       private PlatformAttachLaunchWizard attachWizard = null;
+       
+       public PlatformLaunchWizardDialog(Shell shell, PlatformLaunchWizard wizard) {   
+               super(shell, wizard);   
+               
+               this.wizard = wizard;   
+       }
+       
+       public PlatformLaunchWizardDialog(Shell shell, PlatformAttachLaunchWizard wizard) {     
+               super(shell, wizard);   
+               
+               this.attachWizard = wizard;     
+       }
+       
+       
+       
+       public String getProgramPath() {
+               if (wizard != null) {
+                       return wizard.getProgramPath();
+               } else if (attachWizard != null) {
+                       return attachWizard.getProgramPath();
+               } else {
+                       return null;
+               }
+       }
+       
+       public ArrayList<LocalPackage> getExtraPackages() {
+               if (wizard != null) {
+                       return wizard.getExtraPackages();
+               } else {
+                       return null;
+               }
+       }
+       
+       public String getAppProjectName() {
+               if (wizard != null) {
+                       return wizard.getAppProjectName();
+               } else {
+                       return null;
+               }
+       }
+       
+       public boolean getReinstallOp() {
+               if (wizard != null) {
+                       return wizard.getReinstallOp();
+               } else if (attachWizard != null) {
+                       return attachWizard.getReinstallOp();
+               } else {
+                       return true;
+               }
+       }
+       
+       public boolean getSelectPkgOp() {
+               if (wizard != null) {
+                       return wizard.getSelectPkgOp();
+               } else if (attachWizard != null) {
+                       return attachWizard.getSelectPkgOp();
+               } else {
+                       return true;
+               }
+       }
+       
+       public String getProcName() {
+               if (attachWizard != null) {
+                       return attachWizard.getProcName();
+               } else {
+                       return null;
+               }
+       }
+       
+       public int getProcId() {
+               if (attachWizard != null) {
+                       return attachWizard.getPid();
+               } else {
+                       return -1;
+               }
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/ShowLogDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/ShowLogDialog.java
new file mode 100644 (file)
index 0000000..2298a2f
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * 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.launch.wizards;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class ShowLogDialog extends Dialog {
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 700;
+       private final int height = 500;
+       private Shell shell;
+       private String desc = "";
+       private String log = "";
+
+       protected ShowLogDialog(Shell parentShell, String desc, String log) {
+               super(parentShell);
+               this.shell = parentShell;
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+        
+        this.desc = desc;
+        this.log = log;
+       }
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);         
+               
+               newShell.setText("Show Log");           
+               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));       
+
+        createDescComposite(composite);      
+        createTextAreaComposite(composite);                
+               return null;
+       }
+       
+       private void createDescComposite(Composite parent) {
+               
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+               composite.setLayout(new GridLayout(1, false));
+               
+               Label message = new Label(composite, SWT.NONE);
+               message.setText(desc);
+       }
+       
+       private void createTextAreaComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(1, false));
+               
+               Text text = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL);
+               GridData gridData = new GridData(GridData.FILL_BOTH);        
+               text.setLayoutData(gridData);
+               text.setText(log);
+       }
+       
+       protected void createButtonsForButtonBar(Composite parent) 
+       {
+               createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/ShowPackageStatusDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/wizards/ShowPackageStatusDialog.java
new file mode 100644 (file)
index 0000000..6dc6db7
--- /dev/null
@@ -0,0 +1,326 @@
+/*
+ * 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.launch.wizards;
+
+import java.util.ArrayList;
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.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.Event;
+import org.eclipse.swt.widgets.Label;
+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.LocalPackage;
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+
+public class ShowPackageStatusDialog extends Dialog {
+       
+       private final String BUNDLE_NAME = ShowPackageStatusDialog.class.getPackage().getName() + ".LaunchWizardUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+               
+       private int x = 0;
+       private int y = 0;
+       private final int width = 800;
+       private final int height = 700;
+               
+       private TableViewer bsViewer;
+       private TableViewer dvViewer;
+       private ArrayList<LocalPackage> bsPackages = new ArrayList<LocalPackage>();
+       private ArrayList<LocalPackage> dvPackages = new ArrayList<LocalPackage>();
+       private ArrayList<LocalPackage> selectedBsPackages = new ArrayList<LocalPackage>();
+       private ArrayList<LocalPackage> selectedDvPackages = new ArrayList<LocalPackage>();
+
+       public ShowPackageStatusDialog(Shell parentShell, 
+                       ArrayList<LocalPackage> bsPkgs, ArrayList<LocalPackage> dvPkgs) {
+               super(parentShell);
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+
+        this.bsPackages = bsPkgs;
+        this.dvPackages = dvPkgs;
+       }
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);         
+               
+               newShell.setText(resources.getString("PkgDialog.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));  
+
+        createDescComposite(composite);      
+        createBuildSystemLabelComposite(composite);
+        createBuildSystemComposite(composite);
+        createDeviceLabelComposite(composite);
+        createDeviceComposite(composite);
+        tableRefresh();
+               return null;
+       }
+       
+       private void createDescComposite(Composite parent) {
+               
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+               composite.setLayout(new GridLayout(1, false));
+               
+               Label message = new Label(composite, SWT.NONE);
+               message.setText(resources.getString("PkgDialog.Desc"));
+       }
+       
+       @Override
+       protected void okPressed() {
+               selectedBsPackages.clear();
+               selectedDvPackages.clear();
+               
+               int recentTableIndex = bsViewer.getTable().getItemCount();
+               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);
+                       }
+               }
+               
+               recentTableIndex = dvViewer.getTable().getItemCount();
+               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);
+                       }
+               }               
+               
+               super.okPressed();
+       }
+
+       @Override
+       protected void cancelPressed() {
+               super.cancelPressed();
+       }
+       
+       public ArrayList<LocalPackage> getSelectedBsPkgs() {
+               return selectedBsPackages;
+       }
+       
+       public ArrayList<LocalPackage> getSelectedDvPkgs() {
+               return selectedDvPackages;
+       }
+
+       private void createBuildSystemLabelComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+               composite.setLayout(new GridLayout(1, false));
+               
+               Label tableDesc = new Label(composite, SWT.NONE);
+               tableDesc.setText(resources.getString("PkgDialog.Label.Buildsystem"));
+       }
+       
+       private void createBuildSystemComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new FillLayout());
+               
+               bsViewer = new TableViewer( composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
+        createColumns( composite, bsViewer);
+        Table packageTable = bsViewer.getTable();
+        packageTable.addListener( SWT.Selection, new Listener(){
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               if( event.detail == SWT.CHECK )
+                               {
+                                       Package pkg = (Package)event.item.getData();
+                                       pkg.setCheckColumn( !pkg.getCheckColumn() );
+                               }
+                       }
+               });
+
+        packageTable.setHeaderVisible(true);
+        packageTable.setLinesVisible(true);
+
+        bsViewer.setContentProvider(new ArrayContentProvider());
+        bsViewer.setInput(bsPackages);
+       }
+
+       private void createDeviceLabelComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+               composite.setLayout(new GridLayout(1, false));
+               
+               Label tableDesc = new Label(composite, SWT.NONE);
+               tableDesc.setText(resources.getString("PkgDialog.Label.Device"));
+       }
+       
+       private void createDeviceComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new FillLayout());
+               
+               dvViewer = new TableViewer( composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK );
+        createColumns( composite, dvViewer);
+        Table packageTable = dvViewer.getTable();
+        packageTable.addListener( SWT.Selection, new Listener(){
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               if( event.detail == SWT.CHECK )
+                               {
+                                       Package pkg = (Package)event.item.getData();
+                                       pkg.setCheckColumn( !pkg.getCheckColumn() );
+                               }
+                       }
+               });
+
+        packageTable.setHeaderVisible(true);
+        packageTable.setLinesVisible(true);
+
+        dvViewer.setContentProvider(new ArrayContentProvider());
+        dvViewer.setInput(dvPackages);
+       }
+       
+       protected void createButtonsForButtonBar(Composite parent) 
+       {
+               createButton(parent, IDialogConstants.OK_ID, "Continue", true);
+               createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+       }       
+       
+       private void createColumns( Composite parent, TableViewer viewer )
+       {
+               String[] titles = {"Package Name", "Arch", "New Version", "Installed Version", "Status"};
+               int[] bounds = {250, 60, 150, 150, 150};
+
+               TableViewerColumn colPackage = createTableViewerColumn( viewer, titles[0], bounds[0], SWT.NONE);
+
+               colPackage.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               return pkg.getName();
+                       }
+               });
+
+               TableViewerColumn colArch = createTableViewerColumn( viewer, titles[1], bounds[1], SWT.NONE);
+
+               colArch.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String arch = pkg.getArch();
+                               return arch;
+                       }
+               });
+
+               TableViewerColumn colNewVer = createTableViewerColumn( viewer, titles[2], bounds[2], SWT.NONE);
+
+               colNewVer.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String newVer = pkg.getNewVersion();
+                               return newVer;
+                       }
+               });
+
+               TableViewerColumn colInsVer = createTableViewerColumn( viewer, titles[3], bounds[3], SWT.NONE);
+               colInsVer.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String installedVer = pkg.getInstalledVersion();
+                               return installedVer;
+                       }
+               });
+
+               TableViewerColumn colStatus = createTableViewerColumn( viewer, titles[4], bounds[4], SWT.NONE);
+
+               colStatus.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String status = pkg.getInstallInfo().toString();
+                               return status;
+                       }
+               });
+       }
+       
+       private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, int Style) {
+
+               final TableViewerColumn viewerColumn = new TableViewerColumn( viewer,   Style);
+               final TableColumn column = viewerColumn.getColumn();
+               column.setText(title);
+               column.setWidth(bound);
+               column.setResizable(true);
+               column.setMoveable(true);
+               return viewerColumn;
+       }
+       
+       private void tableRefresh() {
+               int recentTableIndex = bsViewer.getTable().getItemCount();
+               for (int i = 0; i < recentTableIndex; i++) {
+                       TableItem item = null;
+                       item = bsViewer.getTable().getItem(i);
+                       Package pkg = (Package)item.getData();
+                       item.setChecked(pkg.getCheckColumn());
+               }
+               
+               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());
+               }
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/password/PasswdDialogMessage.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/password/PasswdDialogMessage.properties
new file mode 100644 (file)
index 0000000..a0a5cd4
--- /dev/null
@@ -0,0 +1,3 @@
+PwInputDialog.Desc=RPM packaging requires super-user authority.\nPlease enter your password to perform administrative tasks.\n(You can edit it on "Windows -> Preferences -> Tizen SDK -> Platform")
+PwInputDialog.InputLabel=Password: 
+PwInputDialog.CheckSave=Remember this and do not ask again.
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/password/PasswordInputDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/password/PasswordInputDialog.java
new file mode 100644 (file)
index 0000000..1d02e2d
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * 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.password;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+public class PasswordInputDialog extends Dialog {
+       private Text textPass;
+       private Button checkPass;
+       private String title = null;
+       private String password = null;
+       private boolean isSavePass;
+
+       private static final String BUNDLE_NAME = PasswordInputDialog.class.getPackage().getName() + ".PasswdDialogMessage";//$NON-NLS-1$
+       public static ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       public PasswordInputDialog(Shell parentShell, String title) {
+               super(parentShell);
+               this.title = title;
+       }
+
+       @Override
+       protected void configureShell(Shell shell) {
+               super.configureShell(shell);
+               if (title != null) {
+                       shell.setText(title);
+               }
+       }
+
+       @Override
+       protected Control createDialogArea(Composite parent) {
+               // create composite
+               Composite composite = (Composite) super.createDialogArea(parent);
+
+               // create message
+               Label labelDesc = new Label(composite, SWT.WRAP);
+               labelDesc.setText(resources.getString("PwInputDialog.Desc"));
+               GridData data = new GridData(GridData.GRAB_HORIZONTAL
+                               | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
+                               | GridData.VERTICAL_ALIGN_CENTER);
+               data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+               labelDesc.setLayoutData(data);
+               labelDesc.setFont(parent.getFont());
+
+               Composite compositeInpu = new Composite(composite, SWT.NONE);
+               compositeInpu.setLayout(new GridLayout(2,false));
+               compositeInpu.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+               Label labelPass = new Label(compositeInpu, SWT.WRAP);
+               labelPass.setText(resources.getString("PwInputDialog.InputLabel"));
+               GridData passLabelGD = new GridData( GridData.GRAB_VERTICAL
+                               | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
+               data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+               labelPass.setLayoutData(passLabelGD);
+               labelPass.setFont(parent.getFont());
+
+               textPass = new Text(compositeInpu,SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
+               textPass.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+               Text textEmpty = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
+               textEmpty.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+               textEmpty.setVisible(false);
+
+               applyDialogFont(composite);
+               return composite;
+       }
+
+       /**
+        * Adds buttons to this dialog's button bar.
+        * <p>
+        * The <code>Dialog</code> implementation of this framework method adds
+        * standard ok and cancel buttons using the <code>createButton</code>
+        * framework method. These standard buttons will be accessible from
+        * <code>getCancelButton</code>, and <code>getOKButton</code>.
+        * Subclasses may override.
+        * </p>
+        *
+        * @param parent
+        *            the button bar composite
+        */
+       @Override
+       protected void createButtonsForButtonBar(Composite parent) {
+               ((GridData) parent.getLayoutData()).horizontalAlignment = SWT.FILL;
+               ((GridData) parent.getLayoutData()).grabExcessHorizontalSpace = true;
+               ((GridLayout) parent.getLayout()).numColumns++;
+               ((GridLayout) parent.getLayout()).makeColumnsEqualWidth = false;
+
+               checkPass = new Button(parent, SWT.CHECK);
+               checkPass.setText(resources.getString("PwInputDialog.CheckSave"));
+               checkPass.setFont(JFaceResources.getDialogFont());
+               checkPass.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true));
+
+               // create OK and Cancel buttons by default
+               createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+               createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+       }
+
+       /**
+        * Set the layout data of the button to a GridData with appropriate heights
+        * and widths.
+        *
+        * @param button
+        */
+       @Override
+       protected void setButtonLayoutData(Button button) {
+               GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+               int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+               Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+               data.widthHint = Math.max(widthHint, minSize.x);
+               button.setLayoutData(data);
+       }
+
+       @Override
+       protected void okPressed() {
+               password = textPass.getText();
+               isSavePass = checkPass.getSelection();
+               super.okPressed();
+       }
+
+       @Override
+       protected void cancelPressed() {
+               password = null;
+               isSavePass = false;
+               super.cancelPressed();
+       }
+
+       public String getPassword() {
+               return password;
+       }
+       public boolean isSavePassword(){
+               return isSavePass;
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/password/SudoPasswdManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/password/SudoPasswdManager.java
new file mode 100644 (file)
index 0000000..3305070
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * 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.password;
+
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+
+public class SudoPasswdManager {
+       private SudoPasswdManager() {           
+       }
+       
+       public static String getSudoPassword() {
+               if (PreferencesManager.getPassword().isEmpty() || PreferencesManager.getPassword() == null) {
+                       openPasswordDialog();                   
+               }
+               
+               return PreferencesManager.getPassword();
+       }
+       
+       public static void openPasswordDialog(){
+               
+               Display display = PlatformUI.getWorkbench().getDisplay();
+               display.syncExec(new Runnable() {
+                       @Override
+                       public void run() {
+                               Shell shell = PlatformUI.getWorkbench().getDisplay().getShells()[0];
+                               PasswordInputDialog passwordDialog = new PasswordInputDialog(shell, "Input password");
+                               if( passwordDialog.open() == Window.OK){
+                                       PreferencesManager.setPassword(passwordDialog.getPassword());
+                               }                               
+                       }
+               });             
+       }
+}
+
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/DialogActionDelegate.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/DialogActionDelegate.java
new file mode 100644 (file)
index 0000000..0c4c989
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * 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;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.nativecommon.build.CurrentEnabledProject;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.pkgmgr.ui.RPMPackageDialog;
+import org.tizen.sdblib.IDevice;
+
+public class DialogActionDelegate implements IWorkbenchWindowActionDelegate {
+       
+       private IWorkbenchWindow window;
+       
+       private SmartBuildInterface sbi = null;
+       private final String BUNDLE_NAME = DialogActionDelegate.class.getPackage().getName() + ".RPMPackageCommands";
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);       
+
+       @Override
+       public void run(IAction action) {
+               IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();              
+               String target = null;
+               boolean enableRootstrap = true;
+               boolean enableTarget = true;
+               
+               IProject project = CurrentEnabledProject.getCurrentProject();
+               Shell shell = window.getShell();
+               if (project == null) {                  
+                       MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Noselected.Project"));
+                       return;
+               }
+               sbi = SmartBuildInterface.getInstance(project);
+               
+               IConfiguration cfg = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();             
+               String targetName = PlatformConfigurationManager.getBuildTargetName(cfg);               
+               
+               IManagedProject managedProject = cfg.getManagedProject();
+               String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId();
+               if (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE)) {                           
+                       MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Not.Platformproject"));
+                       return;
+               }               
+
+               if (device == null) {
+                       enableTarget = false;
+               } else {
+                       target = device.getSerialNumber();
+                       if (target == null) {
+                               enableTarget = false;
+                       }
+               }
+
+               String result = "";
+               try {
+                       result = sbi.queryStdOut("command", targetName, null);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }
+               if (!result.contains("passwd")) {
+                       MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Not.SupportedRpm"));
+                       return;
+               }
+               RPMPackageDialog pkgdlg = new RPMPackageDialog(window.getShell(), target, enableRootstrap, enableTarget);
+               pkgdlg.open();
+       }
+
+       @Override
+       public void selectionChanged(IAction action, ISelection selection) {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void dispose() {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void init(IWorkbenchWindow window) {
+               this.window = window;
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerHandler.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerHandler.java
new file mode 100644 (file)
index 0000000..11a3efc
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * 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;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import org.tizen.common.connection.ConnectionPlugin;
+
+import org.tizen.nativeplatform.pkgmgr.ui.RPMPackageDialog;
+import org.tizen.nativecommon.build.CurrentEnabledProject;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.sdblib.IDevice;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class PackageManagerHandler extends AbstractHandler {
+       
+       private SmartBuildInterface sbi = null;
+       
+       private final String BUNDLE_NAME = PackageManagerHandler.class.getPackage().getName() + ".RPMPackageCommands";
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);       
+       
+       /**
+        * The constructor.
+        */
+       public PackageManagerHandler() {
+       }
+
+       /**
+        * the command has been executed, so extract extract the needed information
+        * from the application context.
+        */
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+               
+               IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+               IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();              
+               String target = null;
+               boolean enableRootstrap = true;
+               boolean enableTarget = true;
+               
+               IProject project = CurrentEnabledProject.getCurrentProject();           
+               Shell shell = window.getShell();
+               if (project == null) {                  
+                       MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Noselected.Project"));
+                       return null;
+               }
+               sbi = SmartBuildInterface.getInstance(project);
+               
+               IConfiguration cfg = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();             
+               String targetName = PlatformConfigurationManager.getBuildTargetName(cfg);               
+               
+               IManagedProject managedProject = cfg.getManagedProject();
+               String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId();
+               if (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE)) {                           
+                       MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Not.Platformproject"));
+                       return null;
+               }               
+
+               if (device == null) {
+                       enableTarget = false;
+               } else {
+                       target = device.getSerialNumber();
+                       if (target == null) {
+                               enableTarget = false;
+                       }
+               }
+               
+               String result = "";
+               try {
+                       result = sbi.queryStdOut("command", targetName, null);
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }
+               if (!result.contains("passwd")) {
+                       MessageDialog.openError(shell, "Error", resources.getString("PkgMgr.Error.Not.SupportedRpm"));
+                       return null;
+               }
+               RPMPackageDialog pkgdlg = new RPMPackageDialog(window.getShell(), target, enableRootstrap, enableTarget);
+               pkgdlg.open();
+       
+               return null;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerOuputReceiver.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/PackageManagerOuputReceiver.java
new file mode 100644 (file)
index 0000000..45d5a4f
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+
+import org.eclipse.ui.console.MessageConsoleStream;
+
+import org.tizen.sdblib.MultiLineReceiver;
+
+public class PackageManagerOuputReceiver extends MultiLineReceiver {
+
+    public boolean isCancelled = false;
+    private boolean printConsole = true;
+    private ArrayList<String> log = null; 
+    private MessageConsoleStream mcs = null;
+
+    public PackageManagerOuputReceiver() {
+        super();
+
+        setTrimLine(false);
+    }
+    
+    public void setMessageConsoleStream(MessageConsoleStream mcs) {            
+       this.mcs = mcs;
+    }
+    
+    public void setPrintConsole(boolean b) {
+       printConsole = b;
+    }
+
+    @Override
+    public void processNewLines(String[] lines) {
+        if (isCancelled == false) {
+            //processLogLines(lines);
+               for( String line: lines ) {
+                       if ( log == null ) {
+                               log = new ArrayList<String>();
+                       }
+                               log.add(line);
+               }
+               if (printConsole) {
+                       for (String line : lines) {
+                               if (line.endsWith("\n")) {
+                                       mcs.print(line);
+                               } else {
+                                       mcs.println(line);
+                               }                                       
+                       }
+               }
+        }            
+    }
+    
+    public String[] getLog() {
+       return log.toArray(new String[0]);
+    }
+    
+    public void cleanLog() {
+       log = null;
+    }
+
+    public boolean isCancelled() {
+        return isCancelled;
+    }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommander.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommander.java
new file mode 100644 (file)
index 0000000..ab7169a
--- /dev/null
@@ -0,0 +1,915 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.ResourceBundle;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import java.util.Enumeration;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.tizen.common.ui.view.console.ConsoleManager;
+import org.tizen.common.util.FileUtil;
+import org.tizen.nativeplatform.pkgmgr.PackageManagerOuputReceiver;
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.util.CommandLauncher;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.IShellOutputReceiver;
+import org.tizen.sdblib.SdbCommandRejectedException;
+import org.tizen.sdblib.ShellCommandUnresponsiveException;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.SyncResult;
+import org.tizen.sdblib.TimeoutException;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class RPMPackageCommander {
+
+       private final static int MAX_TIMEOUT = 10000;
+       private static String http_proxy = "";
+       private static final String REMOVE_PKGS = "rpm-x86-arm";
+
+       private static final String BUNDLE_NAME = RPMPackageCommander.class
+                       .getPackage().getName() + ".RPMPackageCommands";
+       private static ResourceBundle resources = ResourceBundle
+                       .getBundle(BUNDLE_NAME);
+
+       public RPMPackageCommander() {
+       }
+
+       public static void setHttpProxy(String proxy) {
+               http_proxy = proxy;
+       }
+
+       public static void DistUpgradeRootstrap(String path,
+                       IProgressMonitor monitor) throws InterruptedException {
+
+               actionBeforeUseZypper(path);
+
+               String command = getChrootedCommand(path, String.format("%s;%s;%s",
+                               getProxyCmd(), getResetDbCmd(), getDistUpgradeCmd()));
+
+               CommandLauncher
+                               .executeSudo(command, null, "Platform Internal", monitor);
+       }
+
+       public static void InstallLocalPkgToRootstrap(ArrayList<String> fileList,
+                       String path, IProgressMonitor monitor) throws InterruptedException {
+
+               actionBeforeUseZypper(path);
+
+               // copy
+               ArrayList<String> fileListOnRootstrap = new ArrayList<String>();
+               for (String filePath : fileList) {
+                       String filename = new File(filePath).getName();
+                       String pathOnRootstrap = "/tmp/" + filename;
+                       try {
+                               FileUtil.copyTo(filePath, path + pathOnRootstrap);
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                               continue;
+                       }
+                       fileListOnRootstrap.add(pathOnRootstrap);
+               }
+
+               // install
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getInstallLocalPkgCmd(fileListOnRootstrap));
+               String command = getChrootedCommand(path, cmd);
+               CommandLauncher
+                               .executeSudo(command, null, "Platform Internal", monitor);
+       }
+
+       public static void InstallLocalPkgToDevice(ArrayList<String> fileList,
+                       IDevice device) {
+               actionBeforeUseZypperDevice(device);
+
+               // copy
+               ArrayList<String> fileListOnDevice = new ArrayList<String>();
+               for (String filePath : fileList) {
+                       String filename = new File(filePath).getName();
+                       String pathOnDevice = "/tmp/" + filename;
+                       SyncService syncService;
+                       try {
+                               syncService = device.getSyncService();
+                       } catch (TimeoutException e) {
+                               e.printStackTrace();
+                               continue;
+                       } catch (SdbCommandRejectedException e) {
+                               e.printStackTrace();
+                               continue;
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                               continue;
+                       }
+                       SyncResult syncResult = syncService.pushFile(filePath,
+                                       pathOnDevice, SyncService.getNullProgressMonitor());
+                       if (syncResult.getCode() != SyncService.RESULT_OK) {
+                               continue;
+                       }
+                       fileListOnDevice.add(pathOnDevice);
+               }
+
+               // set update mode
+               PackageManagerOuputReceiver rec = getNewOuputReceiverWithConsole();
+               //rec.cleanLog();
+               if (!device.isEmulator()) {
+                       RPMPackageCommander.changeUpdateModeForDevice(device, rec);
+               }
+
+               // install
+               String command = String.format("%s;%s", getResetDbCmd(),
+                               getInstallLocalPkgCmdWithRPM(fileListOnDevice));
+               executeDeviceShellCommand(device, command, rec);
+       }
+
+       
+       private static void executeDeviceShellCommand( IDevice device, 
+                       String command, IShellOutputReceiver rec ) {
+               try {
+                       device.executeShellCommand(command, rec, MAX_TIMEOUT );                 
+               } catch (TimeoutException e) {
+                       e.printStackTrace();
+               } catch (SdbCommandRejectedException e) {
+                       e.printStackTrace();
+               } catch (ShellCommandUnresponsiveException e) {
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+       
+       
+       public static Document InstallPkgWithZypperXmlOut(String path, String pkgs,
+                       boolean refresh, boolean force) {
+               String log = "";
+               if (refresh) {
+                       refreshRepositoryForRootstrap(path);
+               }
+               String basicOp = "--xmlout --non-interactive";
+               String additionOp = "";
+               if (force) {
+                       additionOp = "--force";
+               }
+               String cmd = String.format("%s;%s", getProxyCmd(),
+                               getInstallPkgWithZypper(basicOp, additionOp, pkgs));
+               String command = getChrootedCommand(path, cmd);
+
+               log = executeSudoOutputCommand(command, null, true);
+
+               if (log.contains("<?xml")) {
+                       int index = log.indexOf("<?xml");
+                       log = log.substring(index);
+               }
+
+               Document doc = null;
+               StringReader sr = new StringReader(log);
+               InputSource is = new InputSource(sr);
+               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+               DocumentBuilder db;
+               try {
+                       db = dbf.newDocumentBuilder();
+                       doc = db.parse(is);
+               } catch (ParserConfigurationException e) {
+                       e.printStackTrace();
+               } catch (SAXException e) {
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+
+               return doc;
+       }
+
+       
+       private static String executeSudoOutputCommand( String command ) {
+               try {
+                       return CommandLauncher.executeSudoOutput(command, null, false, null);
+               } catch (InterruptedException e1) {
+                       return "";
+               }
+       }
+       
+
+       private static String executeSudoOutputCommand( String command, String workingDir,
+               boolean includeStdErr ) {
+               try {
+                       return CommandLauncher.executeSudoOutput(command, workingDir, includeStdErr, null);
+               } catch (InterruptedException e1) {
+                       return "";
+               }
+       }
+
+       
+       public static void uninstallPkgFromRootstrap(
+                       CopyOnWriteArrayList<Package> pkgList, String path,
+                       IProgressMonitor monitor) throws InterruptedException {
+
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getUninstallPkgCmd(pkgList));
+               String command = getChrootedCommand(path, cmd);
+
+               CommandLauncher
+                               .executeSudo(command, null, "Platform Internal", monitor);
+       }
+
+       public static void uninstallPkgFromDevice(
+                       CopyOnWriteArrayList<Package> pkgList, IDevice device) {
+                       PackageManagerOuputReceiver rec = getNewOuputReceiverWithConsole();
+                       String command = String.format("%s;%s;%s", getProxyCmd(),
+                                       getResetDbCmd(), getUninstallPkgCmd(pkgList));
+                       //rec.cleanLog();
+                       executeDeviceShellCommand(device, command, rec);
+       }
+
+       public static void UninstallPkgFromRootstrapNoDeps(String fileList,
+                       String path) {
+
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getUninstallPkgCmdNoDeps(fileList));
+               String command = getChrootedCommand(path, cmd);
+
+               try {
+                       CommandLauncher.executeSudo(command, null, "Platform Internal",
+                                       null);
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static String getArchForFile(String filePath) {
+               try {
+                       return CommandLauncher.executeOutput(getQueryInfoCmd("ARCH",
+                                       filePath));
+               } catch (InterruptedException e) {
+                       return "";
+               }
+       }
+
+       public static String getPkgNameForFile(String filePath) {
+               try {
+                       return CommandLauncher.executeOutput(getQueryInfoCmd("NAME",
+                                       filePath));
+               } catch (InterruptedException e) {
+                       return "";
+               }
+       }
+
+       public static String getPkgVerForFile(String filePath) {
+               String version;
+               String release;
+               try {
+                       version = CommandLauncher.executeOutput(getQueryInfoCmd("VERSION",
+                                       filePath));
+                       release = CommandLauncher.executeOutput(getQueryInfoCmd("RELEASE",
+                                       filePath));
+               } catch (InterruptedException e) {
+                       return "";
+               }
+
+               return version + "-" + release;
+       }
+
+       public static String getPkgInstalledVerForRootstrap(String pkgName,
+                       String path) {
+               String retStr = "";
+               String version = "";
+               String release = "";
+
+               if (!pkgInstalledSuccessfullyForRootstrap(pkgName, path)) {
+                       return retStr;
+               }
+
+               String result = null;
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getShowPkgInfoCmd(pkgName));
+               String command = getChrootedCommand(path, cmd);
+
+               result = executeSudoOutputCommand(command);
+
+               String[] splitResult = result.split("\n");
+               for (String r : splitResult) {
+                       if (r.trim().startsWith("Version")) {
+                               version = r.split(":")[1].trim();
+                       } else if (r.trim().startsWith("Release")) {
+                               release = r.split(":")[1].trim();
+                       }
+               }
+
+               retStr = version + "-" + release;
+               return retStr;
+       }
+
+       public static String getPkgInstalledVerForDevice(String pkgName,
+                       IDevice device, PackageManagerOuputReceiver rec) {
+               String retStr = "";
+               String version = "";
+               String release = "";
+
+               if (device != null) {
+                       if (!pkgInstalledSuccessfullyForDevice(pkgName, device, rec)) {
+                               return retStr;
+                       }
+
+                       String command = String.format("%s;%s", getResetDbCmd(),
+                                       getShowPkgInfoCmd(pkgName));
+                       rec.cleanLog();
+                       executeDeviceShellCommand(device, command, rec);
+                       for (String l : rec.getLog()) {
+                               if (l.trim().startsWith("Version")) {
+                                       version = l.split(":")[1].trim();
+                               } else if (l.trim().startsWith("Release")) {
+                                       release = l.split(":")[1].trim();
+                               }
+                       }
+               }
+
+               retStr = version + "-" + release;
+               return retStr;
+       }
+
+       public static boolean pkgInstalledSuccessfullyForRootstrap(String pkgName,
+                       String path) {
+
+               boolean ret = false;
+               String result = "";
+
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getShowPkgCmd(pkgName));
+               String command = getChrootedCommand(path, cmd);
+
+               result = executeSudoOutputCommand(command);
+
+               if (!result.isEmpty() && result.contains(pkgName)) {
+                       ret = true;
+               }
+
+               return ret;
+       }
+
+       public static boolean pkgInstalledSuccessfullyForDevice(String pkgName,
+                       IDevice device, PackageManagerOuputReceiver rec) {
+
+               boolean ret = false;
+
+               if (device != null) {
+                       String command = String.format("%s;%s", getResetDbCmd(),
+                                       getShowPkgCmd(pkgName));
+                       executeDeviceShellCommand(device, command, rec);
+               }
+
+               if (rec.getLog() == null) {
+                       return false;
+               }
+
+               for (String l : rec.getLog()) {
+                       if (l.contains(pkgName)) {
+                               ret = true;
+                       }
+               }
+
+               return ret;
+       }
+
+       public static ArrayList<Package> getPackageListForRootstrap(String path,
+                       IProgressMonitor monitor) throws InterruptedException {
+
+               ArrayList<Package> packageList = new ArrayList<Package>();
+               Hashtable<String, Package> packageHash = new Hashtable<String, Package>();
+
+               // get list using zypper
+               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(),
+                               getRemotePkgListCmd());
+               String command = getChrootedCommand(path, cmd);
+               String result = CommandLauncher.executeSudoOutput(command, null, false,
+                               monitor);
+               String[] splitStr = result.split("\n");
+               for (String s : splitStr) {
+                       s = s.replaceAll(" ", "");
+                       String[] part = s.split("\\|");
+                       if (part.length == 5 && !part[0].equals("S")) {
+                               String name = part[2];
+                               String version = part[3];
+                               String arch = part[4];
+                               if (part[0].equals("i")) {
+                                       packageHash.put(name, new Package(name, version, version,
+                                                       arch));
+                               } else if (part[0].equals("v")) {
+                                       Package p = packageHash.get(name);
+                                       if (p != null) {
+                                               if (version.compareTo(p.getNewVersion()) > 0) {
+                                                       p.setNewVersion(version);
+                                               }
+                                       } else {
+                                               packageHash.put(name, new Package(name, version,
+                                                               version, arch));
+                                       }
+                               } else {
+                                       packageHash.put(name, new Package(name, "", version, arch));
+                               }
+                       }
+               }
+
+               // get installed packages using rpm
+               cmd = String.format("%s;%s", getResetDbCmd(), getInstalledPkgListCmd());
+               command = getChrootedCommand(path, cmd);
+               result = CommandLauncher.executeSudoOutput(command);
+               splitStr = result.split("\n");
+               for (String s : splitStr) {
+                       s = s.replaceAll(" ", "").trim();
+                       String[] part = s.split(",");
+                       if (part.length == 3) {
+                               String name = part[0];
+                               String version = part[1];
+                               String arch = part[2];
+                               Package pkg = packageHash.get(name);
+                               if (pkg == null) {
+                                       packageHash.put(name, new Package(name, version, "", arch));
+                               } else {
+                                       pkg.setInstalledVersion(version);
+                               }
+                       }
+               }
+
+               Enumeration<Package> e = packageHash.elements();
+               while (e.hasMoreElements()) {
+                       packageList.add(e.nextElement());
+               }
+
+               return packageList;
+       }
+
+       public static ArrayList<Package> getPackageListForDevice(IDevice device) {
+               actionBeforeUseZypperDevice(device);
+
+               ArrayList<Package> packageList = new ArrayList<Package>();
+               Hashtable<String, Package> packageHash = new Hashtable<String, Package>();
+               PackageManagerOuputReceiver rec = getNewOuputReceiver();
+               rec.setPrintConsole(false);
+
+               // get list using zypper
+               String command = String.format("%s;%s;%s", getProxyCmd(),
+                               getResetDbCmd(), getRemotePkgListCmd());
+               //rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+               for (String s : rec.getLog()) {
+                       s = s.replaceAll(" ", "");
+                       String[] part = s.split("\\|");
+                       if (part.length == 5 && !part[0].equals("S")) {
+                               String name = part[2];
+                               String version = part[3];
+                               String arch = part[4];
+                               if (part[0].equals("i")) {
+                                       packageHash.put(name, new Package(name, version,
+                                                       version, arch));
+                               } else if (part[0].equals("v")) {
+                                       Package p = packageHash.get(name);
+                                       if (p != null
+                                                       && version.compareTo(p.getNewVersion()) > 0) {
+                                               p.setNewVersion(version);
+                                       } else {
+                                               packageHash.put(name, new Package(name, "",
+                                                               version, arch));
+                                       }
+                               } else {
+                                       packageHash.put(name, new Package(name, "", version,
+                                                       arch));
+                               }
+                       }
+               }
+
+               // get installed packages using rpm
+               command = String.format("%s;%s", getResetDbCmd(),
+                               getInstalledPkgListCmdDevice());
+               //rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+               for (String s : rec.getLog()) {
+                       s = s.replaceAll(" ", "").trim();
+                       String[] part = s.split(",");
+                       if (part.length == 3) {
+                               String name = part[0];
+                               String version = part[1];
+                               String arch = part[2];
+                               Package pkg = packageHash.get(name);
+                               if (pkg == null) {
+                                       packageHash.put(name, new Package(name, version, "",
+                                                       arch));
+                               } else {
+                                       pkg.setInstalledVersion(version);
+                               }
+                       }
+               }
+
+               Enumeration<Package> e = packageHash.elements();
+               while (e.hasMoreElements()) {
+                       packageList.add(e.nextElement());
+               }
+
+               return packageList;
+       }
+
+       public static void resetRepositoryForRootstrap(String path) {
+               String cmd = String.format("%s", getRepoResetCmd());
+               String command = getChrootedCommand(path, cmd);
+
+               executeSudoOutputCommand(command);
+       }
+
+       public static Hashtable<String, String> getRepositoryListForDevice(
+                       IDevice device) {
+               PackageManagerOuputReceiver rec = getNewOuputReceiverWithConsole();
+               Hashtable<String, String> reposHash = new Hashtable<String, String>();
+
+               String command = String.format("%s;%s", getResetDbCmd(),
+                               getRepoListCmd());
+               //rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+
+               for (String reposStr : rec.getLog()) {
+                       reposStr = reposStr.replaceAll(" ", "");
+                       String[] part = reposStr.split("\\|");
+                       if (part.length == 6 && !part[0].equals("#")) {
+                               reposHash.put(part[1], part[5]);
+                       }
+               }
+
+               return reposHash;
+       }
+
+       public static String refreshRepositoryForRootstrap(String path) {
+
+               String result = "";
+               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(),
+                               getRefreshCmd());
+               String command = getChrootedCommand(path, cmd);
+
+               try {
+                       CommandLauncher.executeSudo(command, null, "Platform Internal", null);
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+               }
+
+               return result;
+       }
+
+       public static void refreshRepositoryForDevice(IDevice device) {
+               PackageManagerOuputReceiver rec = getNewOuputReceiverWithConsole();
+               String command = String.format("%s;%s;%s", getProxyCmd(),
+                               getResetDbCmd(), getRefreshCmd());
+               //rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+       }
+
+       public static String addRepositoryForRootstrap(String name, String uri,
+                       String path) {
+
+               String result = "";
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getAddRepoCmd(uri, name));
+               String command = getChrootedCommand(path, cmd);
+
+               result = executeSudoOutputCommand(command);
+
+               return result;
+       }
+
+       public static void addRepositoryForDevice(String name, String uri,
+                       IDevice device) {
+               PackageManagerOuputReceiver rec = getNewOuputReceiverWithConsole();
+               String command = String.format("%s;%s", getResetDbCmd(),
+                               getAddRepoCmd(uri, name));
+               //rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+       }
+
+       public static String removeRepositoryForRootstrap(String name, String path) {
+
+               String cmd = String.format("%s;%s", getResetDbCmd(),
+                               getRemoveRepoCmd(name));
+               String command = getChrootedCommand(path, cmd);
+
+               return executeSudoOutputCommand(command);
+       }
+
+       public static void removeRepositoryForDevice(String name, IDevice device) {
+
+               PackageManagerOuputReceiver rec = getNewOuputReceiverWithConsole();
+               String command = String.format("%s;%s", getResetDbCmd(),
+                               getRemoveRepoCmd(name));
+               //rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+       }
+
+       public static void installRemotePkgForRootstrap(
+                       CopyOnWriteArrayList<Package> selectedList, String path,
+                       IProgressMonitor monitor) throws InterruptedException {
+
+               actionBeforeUseZypper(path);
+
+               String cmd = String.format("%s;%s;%s", getProxyCmd(), getResetDbCmd(),
+                               getInstallPkgCmd(selectedList));
+               String command = getChrootedCommand(path, cmd);
+
+               CommandLauncher
+                               .executeSudo(command, null, "Platform Internal", monitor);
+       }
+
+       public static void installRemotePkgForDevice(
+                       CopyOnWriteArrayList<Package> selectedList, IDevice device) {
+
+               PackageManagerOuputReceiver rec = getNewOuputReceiverWithConsole();
+               String command = String.format("%s;%s;%s", getProxyCmd(),
+                               getResetDbCmd(), getInstallPkgCmd(selectedList));
+               //rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+       }
+
+       private static void changeUpdateModeForDevice(IDevice device,
+                       PackageManagerOuputReceiver rec) {
+
+               String command = resources.getString("Command.Change.Updatemode");
+               rec.cleanLog();
+               executeDeviceShellCommand(device, command, rec);
+       }
+
+       private static void actionBeforeUseZypper(String path) {
+               if (pkgInstalledSuccessfullyForRootstrap(REMOVE_PKGS, path)) {
+                       UninstallPkgFromRootstrapNoDeps(REMOVE_PKGS, path);
+               }
+       }
+
+       private static void actionBeforeUseZypperDevice(IDevice device) {
+               if (device.isEmulator()) {
+                       PackageManagerOuputReceiver rec = getNewOuputReceiver();
+                       //rec.cleanLog();
+                       String command = String
+                                       .format("sed -i \"s/# arch = s390/arch = i686/g\" /etc/zypp/zypp.conf");
+                       executeDeviceShellCommand(device, command, rec);
+               }
+       }
+
+       private static String getProxyCmd() {
+               return String.format(resources.getString("Command.Export.Proxy"),
+                               http_proxy);
+       }
+
+       private static String getResetDbCmd() {
+               return String.format(resources.getString("Command.Reset.Db"));
+       }
+
+       private static String getDistUpgradeCmd() {
+               return String.format(resources.getString("Command.DistUpgrade"));
+       }
+
+       private static String getInstallPkgCmd(CopyOnWriteArrayList<Package> pkgList) {
+               String pkgListStr = "";
+               for (Package pkg : pkgList) {
+                       pkgListStr = pkgListStr.isEmpty() ? pkg.getName() : pkgListStr
+                                       + " " + pkg.getName();
+               }
+               return String.format(resources.getString("Command.Install.Remote.Pkg"),
+                               pkgListStr);
+       }
+
+       private static String getInstallLocalPkgCmd(ArrayList<String> fileList) {
+               String pkgListStr = "";
+               for (String filePath : fileList) {
+                       pkgListStr = pkgListStr.isEmpty() ? filePath : pkgListStr + " "
+                                       + filePath;
+               }
+               return String.format(resources.getString("Command.Install.Local.Pkg"),
+                               pkgListStr);
+       }
+
+       private static String getInstallLocalPkgCmdWithRPM(
+                       ArrayList<String> fileList) {
+               String pkgListStr = "";
+               for (String filePath : fileList) {
+                       pkgListStr = pkgListStr.isEmpty() ? filePath : pkgListStr + " "
+                                       + filePath;
+               }
+               return String.format(
+                               resources.getString("Command.Install.Local.Pkg.RPM"),
+                               pkgListStr);
+       }
+
+       private static String getUninstallPkgCmd(
+                       CopyOnWriteArrayList<Package> pkgList) {
+               String pkgListStr = "";
+               for (Package pkg : pkgList) {
+                       pkgListStr = pkgListStr.isEmpty() ? pkg.getName() : pkgListStr
+                                       + " " + pkg.getName();
+               }
+               return String.format(resources.getString("Command.Uninstall.Pkg"),
+                               pkgListStr);
+       }
+
+       private static String getUninstallPkgCmdNoDeps(String pkgList) {
+               return String.format(
+                               resources.getString("Command.Uninstall.Pkg.NoDeps"), pkgList);
+       }
+
+       private static String getRemoveRepoCmd(String name) {
+               return String.format(resources.getString("Command.Remove.Repo"), name);
+       }
+
+       private static String getAddRepoCmd(String uri, String name) {
+               return String
+                               .format(resources.getString("Command.Add.Repo"), uri, name);
+       }
+
+       private static String getRefreshCmd() {
+               return resources.getString("Command.Refresh.Repo");
+       }
+
+       private static String getRepoListCmd() {
+               return resources.getString("Command.List.Repo");
+       }
+
+       private static String getRepoResetCmd() {
+               return resources.getString("Command.Reset.Repo");
+       }
+
+       private static String getRemotePkgListCmd() {
+               return resources.getString("Command.List.Remote.Pkg");
+       }
+
+       private static String getInstalledPkgListCmd() {
+               return resources.getString("Command.List.Installed.Pkg");
+       }
+
+       private static String getInstalledPkgListCmdDevice() {
+               return resources.getString("Command.List.Installed.Pkg.Device");
+       }
+
+       private static String getShowPkgCmd(String name) {
+               return String.format(resources.getString("Command.Show.Pkg"), name);
+       }
+
+       private static String getShowPkgInfoCmd(String name) {
+               return String
+                               .format(resources.getString("Command.Show.Info.Pkg"), name);
+       }
+
+       private static String getQueryInfoCmd(String tag, String name) {
+               return String.format(resources.getString("Command.Info.Pkg.File"), tag,
+                               name);
+       }
+
+       private static String getInstallPkgWithZypper(String basicOp,
+                       String additionOp, String pkgs) {
+               return String.format(
+                               resources.getString("Command.Install.Pkg.WithZypper"), basicOp,
+                               additionOp, pkgs);
+       }
+
+       private static String getChrootedCommand(String path, String cmd) {
+               return String.format("sudo -S chroot %s sh -c \\\"%s\\\"", path, cmd);
+       }
+
+       public static int compareVersion(String ver1, String ver2) {
+               ArrayList<String> tokList1 = tokenizeVersionString(ver1);
+               ArrayList<String> tokList2 = tokenizeVersionString(ver2);
+               int maxTokens = tokList1.size() > tokList2.size() ? tokList1.size()
+                               : tokList2.size();
+
+               for (int i = 0; i < maxTokens; i++) {
+                       // check length
+                       if (i == tokList1.size()) {
+                               return -1;
+                       }
+                       if (i == tokList2.size()) {
+                               return 1;
+                       }
+
+                       String tok1 = tokList1.get(i);
+                       String tok2 = tokList2.get(i);
+
+                       int value1 = -1, value2 = -1;
+                       try {
+                               value1 = Integer.parseInt(tok1);
+                       } catch (NumberFormatException e) {
+                               // do nothing
+                               e.printStackTrace();
+                       }
+
+                       try {
+                               value2 = Integer.parseInt(tok2);
+                       } catch (NumberFormatException e) {
+                               // do nothing
+                               e.printStackTrace();
+                       }
+
+                       if (value1 > value2) {
+                               return 1;
+                       } else if (value1 < value2) {
+                               return -1;
+                       } else {
+                               int result = tok1.compareTo(tok2);
+                               if (result != 0) {
+                                       return result;
+                               }
+                       }
+               }
+
+               return 0;
+       }
+
+       private static ArrayList<String> tokenizeVersionString(String ver) {
+               ArrayList<String> result = new ArrayList<String>();
+               final int NUM = 0;
+               final int ALPHA = 1;
+               final int NONALPHANUM = 2;
+               int oldStatus = NONALPHANUM;
+               String buf = "";
+               for (int i = 0; i < ver.length(); i++) {
+                       char c = ver.charAt(i);
+                       int newStatus;
+                       if (c >= '0' && c <= '9') {
+                               newStatus = NUM;
+                       } else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
+                               newStatus = ALPHA;
+                       } else {
+                               newStatus = NONALPHANUM;
+                       }
+
+                       if (oldStatus != newStatus) {
+                               if (!buf.isEmpty()) {
+                                       result.add(buf);
+                               }
+                               if (newStatus != NONALPHANUM) {
+                                       buf = String.valueOf(c);
+                               } else {
+                                       buf = "";
+                               }
+                               oldStatus = newStatus;
+                       } else {
+                               if (newStatus != NONALPHANUM) {
+                                       buf += String.valueOf(c);
+                               }
+                       }
+               }
+               if (!buf.isEmpty()) {
+                       result.add(buf);
+               }
+
+               return result;
+       }
+
+       static private PackageManagerOuputReceiver getNewOuputReceiver() {
+               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
+               return rec;
+       }
+       
+       static private PackageManagerOuputReceiver getNewOuputReceiverWithConsole() {
+               return getNewOuputReceiver("Platform Internal");                
+       }
+       
+       static private PackageManagerOuputReceiver getNewOuputReceiver(String consoleName) {
+               ConsoleManager cm = new ConsoleManager(consoleName, true);
+               //cm.clear();
+               MessageConsoleStream mcs = cm.getMessageConsoleStream();
+               PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver();
+               rec.setMessageConsoleStream(mcs);
+
+               return rec;
+       }
+       
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommands.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/RPMPackageCommands.properties
new file mode 100644 (file)
index 0000000..55498e1
--- /dev/null
@@ -0,0 +1,26 @@
+Command.Export.Proxy = export http_proxy=%s
+Command.Reset.Db = rm -f /var/lib/rpm/__db*
+Command.Install.Remote.Pkg = zypper --non-interactive in %s
+Command.Install.Local.Pkg = zypper --non-interactive in --force %s
+Command.Install.Local.Pkg.RPM = rpm -ihv %s --ignoreos --force --nodeps --ignorearch
+Command.Uninstall.Pkg.NoDeps = rpm -e %s --nodeps
+Command.Uninstall.Pkg = zypper --non-interactive remove %s
+Command.Remove.Repo = zypper --non-interactive rr %s
+Command.Add.Repo = zypper --non-interactive ar %s %s
+Command.Refresh.Repo = zypper --non-interactive refresh
+Command.List.Repo = zypper lr -u
+Command.Reset.Repo = rm -rf /etc/zypp/repos.d/*
+Command.List.Remote.Pkg = zypper --non-interactive pa
+Command.List.Installed.Pkg = rpm -qa --qf \\\"%{NAME},%{VERSION}-%{RELEASE},%{ARCH}\\n\\\"
+Command.List.Installed.Pkg.Device = rpm -qa --qf \"%{NAME},%{VERSION}-%{RELEASE},%{ARCH}\\n\"
+Command.Show.Pkg = rpm -qa %s
+Command.Show.Info.Pkg = rpm -qi %s
+Command.Info.Pkg.File = rpm -qp --qf "%%{%s}\n" %s
+Command.Change.Updatemode = /bin/change-booting-mode.sh --update
+Command.DistUpgrade = zypper --non-interactive dup
+Command.Install.Pkg.WithZypper = zypper %s in %s %s
+
+PkgMgr.Error.Noselected.Project = No project selected. Select a Tizen platform project.
+PkgMgr.Error.Not.Platformproject = The selected project is not a Tizen platform project.
+PkgMgr.Error.Not.SupportedRpm = RPM package not supported by the build system.
+PkgMgr.Error.Not.RpmProject = The project is not RPM project.
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
new file mode 100644 (file)
index 0000000..56124a5
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..8b8151f
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..5873c01
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..742fcc4
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..af70d66
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * 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 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 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/PackageProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/PackageProvider.java
new file mode 100644 (file)
index 0000000..a5054e1
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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 PackageProvider {
+       INSTANCE;
+       
+       private CopyOnWriteArrayList<Package> buildsystem_pkgs;
+       private CopyOnWriteArrayList<Package> device_pkgs;
+       
+       private PackageProvider()
+       {
+               buildsystem_pkgs = new CopyOnWriteArrayList <Package>();
+               device_pkgs = new CopyOnWriteArrayList <Package>();
+       }
+       
+       public void clear() {
+               buildsystem_pkgs.clear();
+               device_pkgs.clear();
+       }
+       
+       public CopyOnWriteArrayList<Package> getBuildsystemPkgs()
+       {
+               return buildsystem_pkgs;
+       }
+
+       public CopyOnWriteArrayList<Package> getSelectedBuildsystemPkgs(boolean remove)
+       {
+               CopyOnWriteArrayList<Package> selectedList = new CopyOnWriteArrayList<Package>(); 
+               for( Package pkg: buildsystem_pkgs ) {
+                       if ( pkg.isChecked() ) {
+                               if ( remove && !pkg.getInstalledVersion().isEmpty() ) {
+                                       selectedList.add(pkg);
+                               }
+                               else if ( !remove && !pkg.getNewVersion().isEmpty() ) {
+                                       selectedList.add(pkg);
+                               }
+                       }
+               }
+               
+               return selectedList;
+       }
+
+       public CopyOnWriteArrayList<Package> getDevicePkgs()
+       {
+               return device_pkgs;
+       }
+
+       
+       public CopyOnWriteArrayList<Package> getSelectedDevicePkgs(boolean remove)
+       {
+               CopyOnWriteArrayList<Package> selectedList = new CopyOnWriteArrayList<Package>(); 
+               for( Package pkg: device_pkgs ) {
+                       if ( pkg.isChecked() ) {
+                               if ( remove && !pkg.getInstalledVersion().isEmpty() ) {
+                                       selectedList.add(pkg);
+                               }
+                               else if ( !remove && !pkg.getNewVersion().isEmpty() ) {
+                                       selectedList.add(pkg);
+                               }
+                       }
+               }
+               
+               return selectedList;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePackage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RemotePackage.java
new file mode 100644 (file)
index 0000000..ee02bd3
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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
new file mode 100644 (file)
index 0000000..e244cde
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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/model/Repository.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/Repository.java
new file mode 100644 (file)
index 0000000..5a522d9
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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 Repository {
+       private String name = "";
+       private String uri = "";
+       private boolean dirty = false;
+       private boolean checkColumn = false;
+       
+       public Repository() {
+               
+       }
+       
+       public Repository( String name, String uri ) {
+               this.name = name;
+               this.uri = uri;
+       }
+       
+       public String getName()
+       {
+               return name;
+       }
+       
+       public void setName(String name) 
+       {
+               this.name = name;
+       }
+       
+       public String getUri()
+       {
+               return uri;
+       }
+       
+       public void setUri(String uri) 
+       {
+               this.uri = uri;
+       }
+       
+       public boolean getCheckColumn()
+       {
+               return checkColumn;
+       }
+       
+       public void setCheckColumn( boolean check )
+       {
+               this.checkColumn = check;
+       }
+       
+       public boolean getCheckDirty()
+       {
+               return dirty;
+       }
+       
+       public void setCheckDirty( boolean check )
+       {
+               this.dirty = check;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RepositoryProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/model/RepositoryProvider.java
new file mode 100644 (file)
index 0000000..1d79b4c
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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 RepositoryProvider {
+
+               INSTANCE;
+                       
+               private CopyOnWriteArrayList<Repository> buildsystem_repos;
+               private CopyOnWriteArrayList<Repository> device_repos;
+               
+               private RepositoryProvider()
+               {
+                       buildsystem_repos = new CopyOnWriteArrayList <Repository>();
+                       device_repos = new CopyOnWriteArrayList <Repository>();
+               }
+               
+               public void clear()
+               {
+                       buildsystem_repos.clear();
+                       device_repos.clear();
+               }
+               
+               public CopyOnWriteArrayList<Repository> getBuildsystemRepos()
+               {
+                       return buildsystem_repos;
+               }
+               
+               public CopyOnWriteArrayList<Repository> getDeviceRepos()
+               {
+                       return device_repos;
+               }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRemotePackageDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRemotePackageDialog.java
new file mode 100644 (file)
index 0000000..5d91bbf
--- /dev/null
@@ -0,0 +1,303 @@
+/*
+ * 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);
+                       }
+               }       
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRepoDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/AddRepoDialog.java
new file mode 100644 (file)
index 0000000..930d5af
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * 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.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class AddRepoDialog extends Dialog {
+       
+       private Text uriText;
+       private String url;
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 500;
+       private final int height = 120;
+       
+       private final String BUNDLE_NAME = AddRepoDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       
+       protected AddRepoDialog(Shell parentShell) {
+               super(parentShell);     
+       }
+       
+       
+       public AddRepoDialog(Shell parentShell, String tab) {
+               super(parentShell);
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+       }
+       
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);         
+               
+               newShell.setText(resources.getString("AddRepo.Title"));         
+               newShell.setLocation(x, y);
+               newShell.setSize(width, height);
+       }
+       
+       
+       @Override
+       protected Control createDialogArea(Composite parent) {          
+               
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(2, false));
+               
+               //Label nameLabel = new Label(composite, SWT.NONE);
+               //nameLabel.setText(resources.getString("AddRepo.Label.Name"));         
+               //nameText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+        //GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+        //gridData.widthHint = 500;
+        //nameText.setLayoutData(gridData);    
+        
+        Label urlLabel = new Label(composite, SWT.NONE);
+        urlLabel.setText(resources.getString("AddRepo.Label.Uri"));            
+               uriText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+               GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+        gridData.widthHint = 500;
+        uriText.setLayoutData(gridData);               
+                               
+               return null;
+       }       
+
+       
+       @Override
+       protected void okPressed() {
+               url = uriText.getText().trim();
+               super.okPressed();
+       }
+       
+       
+       public String getRepositoryURL() {
+               return url;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildSystemTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/BuildSystemTab.java
new file mode 100644 (file)
index 0000000..b28aed0
--- /dev/null
@@ -0,0 +1,353 @@
+/*
+ * 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.ArrayList;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+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.views.model.PlatformRootstrap;
+
+
+public class BuildSystemTab extends CommonTab {
+
+       private PlatformRootstrap rootstrap;
+       private String rootstrapPath = "";
+
+       
+       public BuildSystemTab(Shell shell, TabFolder folder, PlatformRootstrap rootstrap) {
+               super(shell, folder);
+               this.rootstrap = rootstrap;
+               this.rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString());              
+       }
+
+       
+       protected CopyOnWriteArrayList<Repository> getRepositoryList() {
+               return RepositoryProvider.INSTANCE.getBuildsystemRepos();
+       }
+       
+       
+       public void updateRepositoryInfo() {
+               initializeRepositoryInfo(rootstrap);
+       }
+       
+       
+       public static void initializeRepositoryInfo(PlatformRootstrap rootstrap) {
+               String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString());
+               RepositoryProvider.INSTANCE.getBuildsystemRepos().clear();
+               RPMPackageCommander.resetRepositoryForRootstrap(rootstrapPath);
+               int idx = 0;
+               for (String url : rootstrap.getRepositoryURLs()) {
+                       String name = String.format("url%d", idx++);
+                       RepositoryProvider.INSTANCE.getBuildsystemRepos()
+                               .add(new Repository(name, url ));
+                       //TODO
+                       RPMPackageCommander.addRepositoryForRootstrap(name, url, rootstrapPath);
+               }
+       }
+       
+       
+       public static void initializePackageInfo(PlatformRootstrap rootstrap,
+                       IProgressMonitor monitor ) throws InterruptedException {
+               
+               String rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(rootstrap.getPath().toOSString());
+               PackageProvider.INSTANCE.getBuildsystemPkgs().clear();
+               PackageProvider.INSTANCE.getBuildsystemPkgs()
+                       .addAll(RPMPackageCommander.getPackageListForRootstrap(rootstrapPath, monitor));
+       }
+
+       
+       public void createTab() {
+               createCommonTab(folder,
+                       resources.getString("PkgMgr.Tab.Buildsystem") +" [" + rootstrap.getName() +"]");
+       }
+
+
+       protected void handleAddRepositoryButton(){
+               AddRepoDialog dialog = new AddRepoDialog(shell, resources.getString("PkgMgr.Tab.Buildsystem"));
+               if ( dialog.open() != AddRepoDialog.OK ) { 
+                       return;
+               }
+               String name = String.format("url%d", repoViewer.getTable().getItemCount());
+               String url = dialog.getRepositoryURL();
+               RPMPackageCommander.addRepositoryForRootstrap(name, url, rootstrapPath);
+               
+               rootstrap.addRepositoryURL(url);
+       }
+       
+       
+       protected void handleModifyRepositoryButton() {
+               int selectedIdx = repoViewer.getTable().getSelectionIndex();
+               if ( selectedIdx == -1 ) {                                      
+                       DialogUtil.openMessageDialog(resources.getString("PkgMgr.Message.Select.OnePackage"));
+                       return;
+               }                               
+               
+               Repository repos = (Repository)repoViewer.getTable().getItem(selectedIdx).getData();
+               ModifyRepoDialog dialog = new ModifyRepoDialog(shell, resources.getString("PkgMgr.Tab.Buildsystem"),
+                               repos.getName(), repos.getUri(), false);
+               if ( dialog.open() != ModifyRepoDialog.OK ) {
+                       return;
+               }
+               rootstrap.changeRepositoryURL(repos.getUri(), dialog.getRepositoryURL());
+       }
+       
+       
+       protected void handleRemoveRepositoryButton() {
+               int selectedIdx = repoViewer.getTable().getSelectionIndex();
+               if ( selectedIdx == -1 ) {                                      
+                       DialogUtil.openMessageDialog(resources.getString("PkgMgr.Message.Select.OnePackage"));
+                       return;
+               }                               
+               Repository repos = (Repository)repoViewer.getTable().getItem(selectedIdx).getData();
+               rootstrap.removeRepositoryURL(repos.getUri());
+       }
+       
+       
+       protected void handleRefreshRepositoryButton() {
+               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+               try {
+                       dialog.run(true, false, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                       monitor.beginTask(resources.getString("PkgMgr.Message.Refreshing"), -1);                                                        
+                                       RPMPackageCommander.refreshRepositoryForRootstrap(rootstrapPath);                                                       
+                                       monitor.done();                                                         
+                               }
+                       });
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
+                       "("+e.toString()+")");
+               }
+       }
+
+
+       protected void handleUpgradeRootstrapButton() {
+               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+               
+               try {
+                       dialog.run(true, true, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {                                                  
+                                       
+                                               monitor.beginTask(resources.getString("PkgMgr.Message.Upgrade"), -1);
+                                               RPMPackageCommander.DistUpgradeRootstrap(rootstrapPath, monitor);
+                                               monitor.done();                                                         
+                               }
+                       });
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.UpgradeFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.UpgradeFailed")+
+                       "("+e.toString()+")");
+               }
+       }
+       
+       
+       protected void handleInstallPackageButton() {
+               final CopyOnWriteArrayList<Package> selectedList = 
+                               PackageProvider.INSTANCE.getSelectedBuildsystemPkgs(false);
+               
+               if(selectedList.isEmpty()) {
+                       DialogUtil.openErrorDialog( resources.getString("PkgMgr.Error.Noselected.Package"));
+                       return;
+               }
+               
+               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+               try {
+                       dialog.run(true, true, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                       
+                                       monitor.beginTask(resources.getString("PkgMgr.Message.Installing.Package"), -1);
+                                       RPMPackageCommander.installRemotePkgForRootstrap(selectedList, rootstrapPath, monitor);
+                                       monitor.done();
+                               }
+                       });
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               }
+       }
+       
+       
+       protected void handleInstallLocalPackageButton( final ArrayList<String> selectedFiles ) {
+        
+        ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+               try {
+                       dialog.run(true, true, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                       
+                                       monitor.beginTask(resources.getString("PkgMgr.Message.Installing.LocalPackage"), -1);
+                                       RPMPackageCommander.InstallLocalPkgToRootstrap(selectedFiles, rootstrapPath, monitor);
+                                       monitor.done();
+                               }
+                       });
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               }
+       }
+       
+       
+       protected void handleRemovePackageButton() {
+               final CopyOnWriteArrayList<Package> selectedList = 
+                               PackageProvider.INSTANCE.getSelectedBuildsystemPkgs(true);
+               if(selectedList.isEmpty()) {
+                       DialogUtil.openErrorDialog( resources.getString("PkgMgr.Error.Noselected.Package"));
+                       return;
+               }
+
+               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+               try {
+                       dialog.run(true, true, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                       
+                                               monitor.beginTask(resources.getString("PkgMgr.Message.Uninstalling.Package"), -1);
+                                               RPMPackageCommander.uninstallPkgFromRootstrap(selectedList, rootstrapPath, monitor);
+                                               monitor.done();
+                               }
+                       });
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.UninstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.UninstallFailed")+
+                       "("+e.toString()+")");
+               }
+       }
+
+       
+       protected CopyOnWriteArrayList<Package> getPackageList() {
+               return PackageProvider.INSTANCE.getBuildsystemPkgs();
+       }
+
+       
+       protected void updatePackageInfo(ArrayList<String> localPackageFileList ) {
+               ArrayList<Package> fullList;
+               try {
+                       fullList = RPMPackageCommander.getPackageListForRootstrap(rootstrapPath, null);
+               } catch (InterruptedException e) {
+                       fullList = new ArrayList<Package>();
+               }
+               ArrayList<Package> removeList = new ArrayList<Package>();
+               for( Package pkg: PackageProvider.INSTANCE.getBuildsystemPkgs()) {
+                       boolean found = false;
+                       for( Package currPkg: fullList ) {
+                               if ( currPkg.getName().equals(pkg.getName())) {
+                                       // check newly install
+                                       if( !pkg.getInstalledVersion().equals(currPkg.getInstalledVersion())) {
+                                               pkg.setNewlyChanged(true);
+                                       }
+                                       
+                                       pkg.setInstalledVersion(currPkg.getInstalledVersion());
+                                       found = true;
+                                       break;
+                               }
+                       }
+                       if ( !found ) {
+                               removeList.add(pkg);
+                       }
+                       pkg.setChecked(false);
+               }
+               
+               // remove
+               for( Package pkg: removeList ) {
+                       PackageProvider.INSTANCE.getBuildsystemPkgs().remove(pkg);
+               }
+               
+               // add if there is new package
+               for( Package currPkg: fullList ) {
+                       boolean found = false;
+                       for( Package pkg: PackageProvider.INSTANCE.getBuildsystemPkgs()) {
+                               if ( currPkg.getName().equals(pkg.getName())) {
+                                       found = true;
+                                       break;
+                               }
+                       }
+                       
+                       if ( !found ) {
+                               PackageProvider.INSTANCE.getBuildsystemPkgs().add(currPkg);
+                               currPkg.setNewlyChanged(true);
+                       }
+               }
+               
+               // check local package update
+               if ( localPackageFileList != null ) {
+                       ArrayList<String> localPackageNameList = new ArrayList<String>();
+                       for( String filePath: localPackageFileList) {
+                               localPackageNameList.add(RPMPackageCommander.getPkgNameForFile(filePath));
+                       }
+                       for( Package pkg: PackageProvider.INSTANCE.getBuildsystemPkgs()) {
+                               if( localPackageNameList.contains( pkg.getName() ) ) {
+                                       pkg.setNewlyChanged(true);
+                               }
+                       }
+               }
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/CommonTab.java
new file mode 100644 (file)
index 0000000..818ce21
--- /dev/null
@@ -0,0 +1,606 @@
+/*
+ * 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.io.File;
+import java.util.ArrayList;
+import java.util.ResourceBundle;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ICheckStateProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+import org.tizen.nativeplatform.pkgmgr.model.Repository;
+
+abstract public class CommonTab {
+
+       protected TableViewer repoViewer = null;
+       protected CheckboxTableViewer pkgViewer = null;
+       protected Combo categoryCombo;
+       protected Text filterText;
+       
+       protected final Shell shell;
+       protected TabFolder folder = null;
+       protected final String BUNDLE_NAME = BuildSystemTab.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+       protected final ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);       
+
+       
+       public CommonTab(Shell shell, TabFolder folder) {
+               this.shell = shell;
+               this.folder = folder;
+       }
+       
+       abstract protected CopyOnWriteArrayList<Repository> getRepositoryList();
+       abstract public void updateRepositoryInfo();
+
+       protected void createCommonTab( TabFolder parent, String title )
+       {
+               TabItem buildsystemTab = new TabItem( parent, SWT.NULL );
+               buildsystemTab.setText(title);
+
+               Composite composite = new Composite(folder, SWT.NONE);
+               buildsystemTab.setControl(composite);
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+        composite.setLayout(new GridLayout(1, false));
+
+               createRepositoryGroup( composite );
+               createPackageGroup( composite );
+       }
+
+
+       private void createRepositoryGroup( Composite parent )
+       {
+               Group grpRepo = new Group(parent, SWT.NONE);
+               grpRepo.setText(resources.getString("PkgMgr.Frame.Respository"));
+               GridData repo_gd = new GridData(GridData.FILL_HORIZONTAL);
+               repo_gd.heightHint = 110;
+        grpRepo.setLayoutData(repo_gd);
+               grpRepo.setLayout(new GridLayout(2, false));
+
+        createRepositoryTable( grpRepo );
+        createRepositoryButtons( grpRepo );
+       }
+
+       
+       private void createRepositoryTable( Composite parent)
+       {
+               Composite composite = new Composite( parent, SWT.NONE );
+               GridData gridData = new GridData(GridData.FILL_BOTH);
+               composite.setLayoutData(gridData);
+               composite.setLayout(new FillLayout());
+
+               repoViewer = new TableViewer( composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
+               createColumnsForRepoTable( composite );
+               Table reposTable = repoViewer.getTable();
+               reposTable.setHeaderVisible(true);
+               reposTable.setLinesVisible(true);
+               repoViewer.setContentProvider(new ArrayContentProvider());
+               repoViewer.setInput(getRepositoryList());
+       }
+
+       
+       private void createColumnsForRepoTable( Composite parent )
+       {
+               String[] titles = {resources.getString("PkgMgr.Repo.Table.Column.1"),
+                               resources.getString("PkgMgr.Repo.Table.Column.2")};
+               int[] bounds = { 100, 600 };
+
+               TableViewerColumn colName = createTableViewerColumn( repoViewer, titles[0], bounds[0], SWT.NONE);
+               colName.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Repository repo = (Repository)element;
+                               return repo.getName();
+                       }
+               });
+
+               TableViewerColumn colUrl = createTableViewerColumn( repoViewer, titles[1], bounds[1], SWT.NONE);
+               colUrl.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Repository repo = (Repository)element;
+                               return repo.getUri();
+                       }
+               });
+       }
+       
+       
+       private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, int Style) {
+
+               final TableViewerColumn viewerColumn = new TableViewerColumn( viewer,   Style);
+               final TableColumn column = viewerColumn.getColumn();            
+               column.addSelectionListener(new PackageTableSelectionAdapter(pkgViewer));
+               column.setText(title);
+               column.setWidth(bound);
+               column.setResizable(true);
+               column.setMoveable(true);
+               return viewerColumn;
+       }
+
+
+       private void createRepositoryButtons( Composite parent )
+       {
+               Composite composite = new Composite( parent, SWT.NONE );
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               RowLayout layout = new RowLayout(SWT.VERTICAL);
+               layout.pack = false;
+               composite.setLayout(layout);
+
+
+               Button add_bt = new Button( composite, SWT.PUSH );
+               add_bt.setText(resources.getString("PkgMgr.Button.AddRepo"));
+               add_bt.setToolTipText(resources.getString("PkgMgr.Button.AddRepo.Tooltip"));
+               add_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               handleAddRepositoryButton();
+                               updateRepositoryInfo();
+                               repoViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+
+        });
+               
+               Button modify_bt = new Button( composite, SWT.PUSH );
+               modify_bt.setText(resources.getString("PkgMgr.Button.ModifyRepo"));
+               modify_bt.setToolTipText(resources.getString("PkgMgr.Button.ModifyRepo.Tooltip"));
+               modify_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               handleModifyRepositoryButton();
+                               updateRepositoryInfo();
+                               repoViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });
+
+               Button remove_bt = new Button( composite, SWT.PUSH );
+               remove_bt.setText(resources.getString("PkgMgr.Button.RemoveRepo"));
+               remove_bt.setToolTipText(resources.getString("PkgMgr.Button.RemoveRepo.Tooltip"));
+               remove_bt.addMouseListener(new MouseListener() {
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               handleRemoveRepositoryButton();
+                               updateRepositoryInfo();
+                               repoViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+               });
+       }
+
+       
+       abstract protected void handleAddRepositoryButton();
+       abstract protected void handleModifyRepositoryButton();
+       abstract protected void handleRemoveRepositoryButton();
+       
+       
+       protected void createPackageGroup( Composite parent )
+       {
+               Group grpPkg = new Group(parent, SWT.NONE);
+               grpPkg.setText(resources.getString("PkgMgr.Frame.Package"));
+               GridData pkgs_gd = new GridData(GridData.FILL_BOTH|GridData.GRAB_VERTICAL);
+               grpPkg.setLayoutData(pkgs_gd);
+               grpPkg.setLayout(new GridLayout(1, false));
+
+               createPackageButtonsAndFilter( grpPkg );
+        createPackageTable( grpPkg );
+       }
+
+       
+       protected void createPackageButtonsAndFilter( Composite parent ) {
+               Composite composite = new Composite( parent, SWT.NONE );
+               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               composite.setLayout(new GridLayout(2, false));
+               
+               createPackageButtons( composite );
+               createPackageFilter( composite );
+       }
+       
+       
+       protected void createPackageButtons( Composite parent )
+       {
+               Composite composite = new Composite( parent, SWT.NONE );
+               RowLayout layout = new RowLayout(SWT.HORIZONTAL);
+               layout.pack = false;
+               composite.setLayout(layout);
+
+               Button refresh_bt = new Button( composite, SWT.PUSH );
+               refresh_bt.setText(resources.getString("PkgMgr.Button.RefreshRepo"));
+               refresh_bt.setToolTipText(resources.getString("PkgMgr.Button.RefreshRepo.Tooltip"));
+               refresh_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               handleRefreshRepositoryButton();
+                               updatePackageInfo(null);
+                               pkgViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });    
+               
+               
+               Button upgrade_bt = new Button( composite, SWT.PUSH );
+               upgrade_bt.setText(resources.getString("PkgMgr.Button.Upgrade"));
+               upgrade_bt.setToolTipText(resources.getString("PkgMgr.Button.Upgrade.Tooltip"));
+               upgrade_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               handleUpgradeRootstrapButton();
+                               updatePackageInfo(null);
+                               pkgViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });
+               
+               Button install_bt = new Button( composite, SWT.PUSH );
+               install_bt.setText(resources.getString("PkgMgr.Button.Install"));
+               install_bt.setToolTipText(resources.getString("PkgMgr.Button.Install.Tooltip"));
+               install_bt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               handleInstallPackageButton();
+                               updatePackageInfo(null);
+                               pkgViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+
+        });
+               
+               Button installLocal_bt = new Button( composite, SWT.PUSH );
+               installLocal_bt.setText(resources.getString("PkgMgr.Button.InstallLocal"));
+               installLocal_bt.setToolTipText(resources.getString("PkgMgr.Button.InstallLocal.Tooltip"));
+               installLocal_bt.addMouseListener(new MouseListener() {
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               FileDialog fd = new FileDialog( shell, SWT.OPEN|SWT.MULTI);
+                       fd.setText(resources.getString("FileDlg.Title"));
+                       String[] filterExt = { resources.getString("FileDlg.Filter.Ext") };
+                       fd.setFilterExtensions(filterExt);
+                       String firstFilePath = fd.open();
+                       if ( firstFilePath == null ) {  return; }
+                       
+                       String[] fileNames = fd.getFileNames();
+                       final ArrayList<String> selectedFiles = new ArrayList<String>();
+                       for( String fileName : fileNames ) {
+                               selectedFiles.add(new File(firstFilePath).getParent()+"/"+fileName);
+                       }
+
+                       handleInstallLocalPackageButton(selectedFiles);
+                               updatePackageInfo(selectedFiles);
+                               pkgViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+               });
+               
+               Button removeBt = new Button( composite, SWT.PUSH );
+               removeBt.setText(resources.getString("PkgMgr.Button.Uninstall"));
+               removeBt.setToolTipText(resources.getString("PkgMgr.Button.Uninstall.Tooltip"));
+               removeBt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               handleRemovePackageButton();
+                               updatePackageInfo(null);
+                               pkgViewer.refresh();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });
+       }
+
+       
+       abstract protected void handleRefreshRepositoryButton();
+       abstract protected void handleUpgradeRootstrapButton();
+       abstract protected void handleInstallPackageButton();
+       abstract protected void handleInstallLocalPackageButton(final ArrayList<String> selectedFiles);
+       abstract protected void handleRemovePackageButton();
+       
+       abstract protected CopyOnWriteArrayList<Package> getPackageList();
+       abstract protected void updatePackageInfo(ArrayList<String> localPackageFileList);
+
+       
+       private void createPackageFilter( Composite parent ) {
+               Composite composite = new Composite( parent, SWT.NONE );
+               composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL|GridData.GRAB_HORIZONTAL));
+               composite.setLayout(new GridLayout(3,false));
+
+               Label filterTextLabel = new Label(composite, SWT.NONE);
+               filterTextLabel.setText(resources.getString("PkgMgr.Label.Filter"));
+               
+               categoryCombo = new Combo(composite, SWT.READ_ONLY);
+               String[] items = {"All","Installed","Upgradable"};
+               categoryCombo.setItems(items);
+               categoryCombo.addSelectionListener( new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               pkgViewer.refresh();
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                               // do nothing
+                       }
+               });
+               categoryCombo.select(0);
+
+
+               filterText = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+        GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+        filterText.setLayoutData(gridData);
+        filterText.addModifyListener(new ModifyListener() {
+
+                       @Override
+                       public void modifyText(ModifyEvent e) {
+                               pkgViewer.refresh();
+                       }
+        });
+       }
+       
+       
+
+       private void createPackageTable( Composite parent )
+       {
+               Composite composite = new Composite( parent, SWT.NONE );
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new FillLayout());
+
+               pkgViewer = CheckboxTableViewer.newCheckList( composite, SWT.BORDER | SWT.H_SCROLL | 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.setHeaderVisible(true);
+        packageTable.setLinesVisible(true);
+
+        pkgViewer.setContentProvider(new ArrayContentProvider());
+        pkgViewer.setCheckStateProvider(new ICheckStateProvider() {
+
+                       @Override
+                       public boolean isChecked(Object element) {
+                               Package pkg = (Package) element;
+                               return pkg.isChecked();
+                       }
+
+                       @Override
+                       public boolean isGrayed(Object element) {
+                               return false;
+                       }
+        });
+        pkgViewer.addFilter( new ViewerFilter() {
+
+                       @Override
+                       public boolean select(Viewer viewer, Object parentElement,
+                                       Object element) {
+                               Package pkg = (Package) element;
+                               if ( categoryCombo != null  ) {
+                                       if ( categoryCombo.getText().equals("Installed") && 
+                                                       pkg.getInstalledVersion().isEmpty() ) {
+                                               return false;
+                                       }
+                                       if ( categoryCombo.getText().equals("Upgradable") && 
+                                                       ( pkg.getInstalledVersion().isEmpty() ||
+                                                         pkg.getNewVersion().isEmpty() ||
+                                                         RPMPackageCommander.compareVersion(pkg.getInstalledVersion(),pkg.getNewVersion()) >= 0 )) {
+                                               return false;
+                                       }
+                               }
+                               if ( filterText != null && !pkg.getName().contains(filterText.getText()) ) {
+                                       return false;
+                               }
+                               return true;
+                       }
+               
+        });
+        pkgViewer.addCheckStateListener( new ICheckStateListener() {
+
+                       @Override
+                       public void checkStateChanged(CheckStateChangedEvent event) {
+                               Package pkg = (Package)event.getElement();
+                               pkg.setChecked(true);
+                       }
+        });
+        pkgViewer.setInput(getPackageList());
+       }
+       
+       
+       private void createPackageTableColumns( Composite parent )
+       {
+               String[] titles = {"S", "Package Name", "Installed Version", "New Version", "Arch", "Description"};
+               int[] bounds = { 24, 200, 150, 150, 60, 150};
+
+               TableViewerColumn colSelection = createTableViewerColumn( pkgViewer, titles[0], bounds[0], SWT.NONE);
+               colSelection.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               return "";
+                       }
+               });
+               
+               TableViewerColumn colPackage = createTableViewerColumn( pkgViewer, titles[1], bounds[1], SWT.NONE);
+               colPackage.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               if ( pkg.isNewlyChanged() ) {
+                                       return "*"+pkg.getName();
+                               } 
+                               else {
+                                       return pkg.getName();
+                               }
+                       }
+               });
+
+               TableViewerColumn colInsVer = createTableViewerColumn( pkgViewer, titles[2], bounds[2], SWT.NONE);
+               colInsVer.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String installedVer = pkg.getInstalledVersion();
+                               return installedVer;
+                       }
+               });
+
+
+               TableViewerColumn colNewVer = createTableViewerColumn( pkgViewer, titles[3], bounds[3], SWT.NONE);
+
+               colNewVer.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String newVer = pkg.getNewVersion();
+                               return newVer;
+                       }
+               });
+
+               TableViewerColumn colArch = createTableViewerColumn( pkgViewer, titles[4], bounds[4], SWT.NONE);
+
+               colArch.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               Package pkg = (Package)element;
+                               String arch = pkg.getArch();
+                               return arch;
+                       }
+               });
+
+               TableViewerColumn colDescription = createTableViewerColumn( pkgViewer, titles[5], bounds[5], SWT.NONE);
+               colDescription.setLabelProvider(new ColumnLabelProvider() {
+                       @Override
+                       public String getText(Object element) {
+                               return "";
+                       }
+               });
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/DeviceTab.java
new file mode 100644 (file)
index 0000000..9c61488
--- /dev/null
@@ -0,0 +1,319 @@
+/*
+ * 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.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+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.sdblib.IDevice;
+
+
+public class DeviceTab extends CommonTab{
+
+       private final IDevice device;
+
+       public DeviceTab(Shell shell, TabFolder folder, IDevice dev) {
+               super(shell, folder);
+               this.device = dev;
+       }
+
+       
+       protected CopyOnWriteArrayList<Repository> getRepositoryList() {
+               return RepositoryProvider.INSTANCE.getDeviceRepos();
+       }
+
+       
+       public void updateRepositoryInfo() {
+               initializeRepositoryInfo(device);
+       }
+       
+       
+       public static void initializeRepositoryInfo(IDevice device) {
+               RepositoryProvider.INSTANCE.getDeviceRepos().clear();
+               Hashtable<String,String> reposHash = RPMPackageCommander.getRepositoryListForDevice(device);
+               Enumeration<String> e = reposHash.keys();
+               while(e.hasMoreElements()) {
+                       String name = e.nextElement();
+                       String url = reposHash.get(name);
+                       RepositoryProvider.INSTANCE.getDeviceRepos()
+                               .add(new Repository(name, url ));
+               }
+       }
+       
+
+       public static void initializePackageInfo(IDevice device) {
+               
+               PackageProvider.INSTANCE.getDevicePkgs().clear();
+               PackageProvider.INSTANCE.getDevicePkgs()
+                       .addAll(RPMPackageCommander.getPackageListForDevice(device));
+       }
+
+       
+       public void createTab() {
+               createCommonTab(folder, 
+                               resources.getString("PkgMgr.Tab.Device")+" ["+device.getSerialNumber()+"]");
+       }
+
+
+       protected void handleAddRepositoryButton(){
+               ModifyRepoDialog dialog = new ModifyRepoDialog(shell, resources.getString("PkgMgr.Tab.Device"));
+               if ( dialog.open() != ModifyRepoDialog.OK ) { 
+                       return;
+               }
+               String name = dialog.getRepositoryName();
+               String url = dialog.getRepositoryURL();
+               RPMPackageCommander.addRepositoryForDevice(name, url, device);
+       }
+       
+       
+       protected void handleModifyRepositoryButton() {
+               int selectedIdx = repoViewer.getTable().getSelectionIndex();
+               if ( selectedIdx == -1 ) {                                      
+                       DialogUtil.openMessageDialog(resources.getString("PkgMgr.Message.Select.OnePackage"));
+                       return;
+               }                               
+               
+               Repository repos = (Repository)repoViewer.getTable().getItem(selectedIdx).getData();
+               ModifyRepoDialog dialog = new ModifyRepoDialog(shell, resources.getString("PkgMgr.Tab.Device"),
+                               repos.getName(), repos.getUri(), true);
+               if ( dialog.open() != ModifyRepoDialog.OK ) {
+                       return;
+               }
+               RPMPackageCommander.removeRepositoryForDevice(repos.getName(), device);
+               RPMPackageCommander.addRepositoryForDevice(dialog.getRepositoryName(), dialog.getRepositoryURL(), device);
+       }
+       
+       
+       protected void handleRemoveRepositoryButton() {
+               int selectedIdx = repoViewer.getTable().getSelectionIndex();
+               if ( selectedIdx == -1 ) {                                      
+                       DialogUtil.openMessageDialog(resources.getString("PkgMgr.Message.Select.OnePackage"));
+                       return;
+               }                               
+               Repository repos = (Repository)repoViewer.getTable().getItem(selectedIdx).getData();
+               RPMPackageCommander.removeRepositoryForDevice(repos.getName(), device);
+       }
+
+       
+       protected void handleRefreshRepositoryButton() {
+               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+
+               try {
+                       dialog.run(true, false, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                       monitor.beginTask(resources.getString("PkgMgr.Message.Refreshing"), -1);                                                        
+                                       RPMPackageCommander.refreshRepositoryForDevice(device);                                                 
+                                       monitor.done();                                                         
+                               }
+                       });
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.RefreshFailed")+
+                       "("+e.toString()+")");
+               }
+       }
+       
+       
+       protected void handleUpgradeRootstrapButton() {
+       }
+       
+       
+       protected void handleInstallPackageButton() {
+               final CopyOnWriteArrayList<Package> selectedList = 
+                               PackageProvider.INSTANCE.getSelectedDevicePkgs(false);
+               
+               if(selectedList.isEmpty()) {
+                       DialogUtil.openErrorDialog( resources.getString("PkgMgr.Error.Noselected.Package"));
+                       return;
+               }
+               
+               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+               try {
+                       dialog.run(true, false, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                       
+                                       monitor.beginTask(resources.getString("PkgMgr.Message.Installing.Package"), -1);
+                                       RPMPackageCommander.installRemotePkgForDevice(selectedList, device);
+                                       monitor.done();
+                               }
+                       });
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               }
+       }
+       
+       
+       protected void handleInstallLocalPackageButton( final ArrayList<String> selectedFiles ) {
+        
+        ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+               try {
+                       dialog.run(true, false, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                       
+                                       monitor.beginTask(resources.getString("PkgMgr.Message.Installing.LocalPackage"), -1);
+                                       RPMPackageCommander.InstallLocalPkgToDevice(selectedFiles, device);
+                                       monitor.done();
+                               }
+                       });
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.InstallFailed")+
+                       "("+e.toString()+")");
+               }
+       }
+       
+       
+       protected void handleRemovePackageButton() {
+               final CopyOnWriteArrayList<Package> selectedList = 
+                               PackageProvider.INSTANCE.getSelectedDevicePkgs(true);
+               if(selectedList.isEmpty()) {
+                       DialogUtil.openErrorDialog( resources.getString("PkgMgr.Error.Noselected.Package"));
+                       return;
+               }
+
+               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+               try {
+                       dialog.run(true, false, new IRunnableWithProgress() {
+                               @Override
+                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                               InterruptedException {
+                                       
+                                               monitor.beginTask(resources.getString("PkgMgr.Message.Uninstalling.Package"), -1);
+                                               RPMPackageCommander.uninstallPkgFromDevice(selectedList, device);
+                                               monitor.done();
+                               }
+                       });
+               } catch (InvocationTargetException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.UninstallFailed")+
+                       "("+e.toString()+")");
+               } catch (InterruptedException e) {
+               DialogUtil.openErrorDialog(
+                       resources.getString("PkgMgr.Msg.Error.UninstallFailed")+
+                       "("+e.toString()+")");
+               }
+       }
+
+
+       protected CopyOnWriteArrayList<Package> getPackageList() {
+               return PackageProvider.INSTANCE.getDevicePkgs();
+       }
+       
+       
+       protected void updatePackageInfo(ArrayList<String> localPackageFileList ) {
+               ArrayList<Package> fullList = RPMPackageCommander.getPackageListForDevice(device);
+               ArrayList<Package> removeList = new ArrayList<Package>();
+               for( Package pkg: PackageProvider.INSTANCE.getDevicePkgs()) {
+                       boolean found = false;
+                       for( Package currPkg: fullList ) {
+                               if ( currPkg.getName().equals(pkg.getName())) {
+                                       // check newly install
+                                       if( !pkg.getInstalledVersion().equals(currPkg.getInstalledVersion())) {
+                                               pkg.setNewlyChanged(true);
+                                       }
+                                       
+                                       pkg.setInstalledVersion(currPkg.getInstalledVersion());
+                                       found = true;
+                                       break;
+                               }
+                       }
+                       if ( !found ) {
+                               removeList.add(pkg);
+                       }
+                       pkg.setChecked(false);
+               }
+               
+               // remove
+               for( Package pkg: removeList ) {
+                       PackageProvider.INSTANCE.getDevicePkgs().remove(pkg);
+               }
+               
+               // add if there is new package
+               for( Package currPkg: fullList ) {
+                       boolean found = false;
+                       for( Package pkg: PackageProvider.INSTANCE.getDevicePkgs()) {
+                               if ( currPkg.getName().equals(pkg.getName())) {
+                                       found = true;
+                                       break;
+                               }
+                       }
+                       
+                       if ( !found ) {
+                               PackageProvider.INSTANCE.getDevicePkgs().add(currPkg);
+                               currPkg.setNewlyChanged(true);
+                       }
+               }
+               
+               // check local package update
+               if ( localPackageFileList != null ) {
+                       ArrayList<String> localPackageNameList = new ArrayList<String>();
+                       for( String filePath: localPackageFileList) {
+                               localPackageNameList.add(RPMPackageCommander.getPkgNameForFile(filePath));
+                       }
+                       for( Package pkg: PackageProvider.INSTANCE.getDevicePkgs()) {
+                               if( localPackageNameList.contains( pkg.getName() ) ) {
+                                       pkg.setNewlyChanged(true);
+                               }
+                       }
+               }
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/ModifyRepoDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/ModifyRepoDialog.java
new file mode 100644 (file)
index 0000000..a6c22d2
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * 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.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+public class ModifyRepoDialog extends Dialog {
+       
+       private String name="";
+       private Text nameText;
+       private String value="";
+       private Text uriText;
+       private boolean canEditName = true;
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 500;
+       private final int height = 170;
+       
+       private final String BUNDLE_NAME = ModifyRepoDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       protected ModifyRepoDialog(Shell parentShell) {
+               super(parentShell);     
+       }
+       
+       public ModifyRepoDialog(Shell parentShell, String tab) {
+               super(parentShell);
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+       }
+
+       
+       public ModifyRepoDialog(Shell parentShell, String tab, String name, String value, boolean canEditName) {
+               super(parentShell);
+               this.name = name;
+               this.value = value;
+               this.canEditName = canEditName;
+               
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+       }
+       
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);         
+               
+               newShell.setText(resources.getString("ModifyRepo.Title"));              
+               newShell.setLocation(x, y);
+               newShell.setSize(width, height);
+       }
+       
+       @Override
+       protected Control createDialogArea(Composite parent) {          
+               
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(2, false));
+               
+        Label nameLabel = new Label(composite, SWT.NONE);
+        nameLabel.setText(resources.getString("ModifyRepo.Label.Name"));
+        if ( canEditName ) {
+               nameText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+        }
+        else {
+               nameText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH | SWT.READ_ONLY);
+        }
+               GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING);
+        gridData.widthHint = 100;
+        nameText.setLayoutData(gridData);
+        nameText.setText(name);
+
+        Label urlLabel = new Label(composite, SWT.NONE);
+        urlLabel.setText(resources.getString("ModifyRepo.Label.Uri"));         
+               uriText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+               gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+        gridData.widthHint = 500;
+        uriText.setLayoutData(gridData);
+        uriText.setText(value);
+                               
+               return null;
+       }       
+       
+       
+       @Override
+       protected void okPressed() {
+               name = nameText.getText().trim(); 
+               if ( name.isEmpty() ) 
+                       return;
+               
+               value = uriText.getText().trim();
+               super.okPressed();
+       }
+       
+       
+       public String getRepositoryName() {
+               return name;
+       }
+
+       
+       public String getRepositoryURL() {
+               return value;
+       }
+       
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PackageTableSelectionAdapter.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PackageTableSelectionAdapter.java
new file mode 100644 (file)
index 0000000..a024486
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * 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 org.eclipse.jface.viewers.TableViewer;
+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.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+
+import org.tizen.nativeplatform.pkgmgr.model.Package;
+
+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());                  
+               }       
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PkgMgrUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/PkgMgrUIMessages.properties
new file mode 100644 (file)
index 0000000..78edb69
--- /dev/null
@@ -0,0 +1,81 @@
+PkgMgr.Title = Package Manager
+PkgMgr.Frame.Description = Manage packages on rootstrap or target.
+PkgMgr.Frame.Respository = Repositories
+PkgMgr.Frame.Package = Packages
+PkgMgr.Tab.Buildsystem = Rootstrap
+PkgMgr.Tab.Device = Device
+PkgMgr.Console.Name = Package Manager
+PkgMgr.Error.Noselected = - No project is selected, no device is connected, or the selected project is not a Tizen project
+PkgMgr.Error.Noselected.Package = No package selected.
+PkgMgr.Error.Failtransfer.File = Moving the file from %s to %s failed.
+PkgMgr.Warn.Notset.Proxy = (Warning: HTTP Proxy is not set. (Preferences -> Tizen SDK -> Platform -> HTTP Proxy)
+PkgMgr.Info.set.Proxy = (HTTP proxy : %s)
+PkgMgr.Label.Configuration = Selected configuration:
+PkgMgr.Label.Connection = Selected connection:
+PkgMgr.Button.AddRepo = Add
+PkgMgr.Button.AddRepo.Tooltip = Add a repository
+PkgMgr.Button.ModifyRepo = Modify
+PkgMgr.Button.ModifyRepo.Tooltip = Modify a repository
+PkgMgr.Button.RemoveRepo = Remove
+PkgMgr.Button.RemoveRepo.Tooltip = Remove the selected repositories
+PkgMgr.Button.RefreshRepo = Refresh
+PkgMgr.Button.RefreshRepo.Tooltip = Refresh remote package information
+PkgMgr.Button.Upgrade = Upgrade
+PkgMgr.Button.Upgrade.Tooltip = Perform a distribution upgrade
+PkgMgr.Button.Install = Install
+PkgMgr.Button.Install.Tooltip = Install remote packages
+PkgMgr.Button.InstallLocal = Install Local
+PkgMgr.Button.InstallLocal.Tooltip = Install local packages
+PkgMgr.Button.Uninstall = Uninstall
+PkgMgr.Button.Uninstall.Tooltip = Uninstall packages
+
+PkgMgr.Label.Category = Category:
+PkgMgr.Label.Filter = Filter:
+
+PkgMgr.Button.AddRPackage = Add Remote Package
+PkgMgr.Button.AddRPackage.Tooltip = Add remote packages from repositories
+PkgMgr.Button.AddLPackage = Add Local Package
+PkgMgr.Button.AddLPackage.Tooltip = Add local packages from file system
+PkgMgr.Button.RemoveList = Remove List
+PkgMgr.Button.RemoveList.Tooltip = Remove selected packages from list
+PkgMgr.Message.Refreshing = Refreshing the repository...
+PkgMgr.Msg.Error.RefreshFailed = Refreshing repository failed!
+PkgMgr.Message.Adding.Package = Adding selected packages to the table...
+PkgMgr.Message.Getting.RemotePackage = Getting the remote package list...
+PkgMgr.Message.Select.OnePackage = Please select one repository
+PkgMgr.Message.Transfer.File = Transferring %s to target's %s...
+PkgMgr.Message.Upgrade = Upgrading...
+PkgMgr.Msg.Error.UpgradeFailed = Upgrading failed!
+PkgMgr.Message.Installing.Package = Installing packages...
+PkgMgr.Message.Installing.LocalPackage = Installing local packages...
+PkgMgr.Msg.Error.InstallFailed = Installing failed!
+PkgMgr.Message.Uninstalling.Package = Uninstalling packages...
+PkgMgr.Msg.Error.UninstallFailed = Uninstalling failed!
+PkgMgr.Console.Remote.Install = ***** Installing a remote package *****\n
+PkgMgr.Console.Local.Install = \n***** Installing a local package *****\n
+PkgMgr.Repo.Table.Column.1 = Name
+PkgMgr.Repo.Table.Column.2 = Repository URL
+
+AddRepo.Title = Add Package Repository
+AddRepo.Label.Name = Name:
+AddRepo.Label.Uri = URI:
+AddRepo.Message.AlreadyExist = The repository already exists
+
+ModifyRepo.Title = Modify Package Repository
+ModifyRepo.Label.Name = Name:
+ModifyRepo.Label.Uri = URI:
+
+AddRemotePkg.Title = Add Remote Packages
+
+FileDlg.Title = Select RPM files...
+FileDlg.Filter.Ext = *.rpm
+FileDlg.Default.Path = /home/abuild/rpmbuild/RPMS/
+
+UninstallPkg.Title = Uninstall Packages
+UninstallPkg.Label.Nodeps.Op = --nodeps (don't verify package dependencies)
+UninstallPkg.Message.Uninstalling.Package = Uninstalling packages...\n
+UninstallPkg.Message.Refreshing.Table = Refreshing tables...\n
+UninstallPkg.Uninstall.Failed.Title = Failed to uninstall
+UninstallPkg.Uninstall.Success.Title = Uninstalled successfully
+UninstallPkg.Button.Uninstall = Uninstall
+UninstallPkg.Button.DeselectAll = Deselect All
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RPMPackageDialog.java
new file mode 100644 (file)
index 0000000..12c6be0
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * 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.io.IOException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+
+import org.osgi.framework.Bundle;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.nativeplatform.Activator;
+import org.tizen.sdblib.IDevice;
+import org.tizen.nativeplatform.pkgmgr.RPMPackageCommander;
+import org.tizen.nativeplatform.pkgmgr.model.LocalPkgProvider;
+import org.tizen.nativeplatform.pkgmgr.model.PackageProvider;
+import org.tizen.nativeplatform.pkgmgr.model.RemotePkgProvider;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+
+public class RPMPackageDialog extends Dialog { 
+       
+       private IDevice device; 
+       private TabFolder tabFolder;    
+       
+       private boolean enableRootstrapTab = false;
+       private boolean enableTargetTab = false;
+       private int tabIndex = 0;       
+       private String http_proxy = ""; 
+       
+       private PlatformRootstrap rootstrap;
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 900;
+       private final int height = 700;
+       
+       private final String BUNDLE_NAME = RPMPackageDialog.class.getPackage().getName() + ".PkgMgrUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+       
+       
+       public RPMPackageDialog(Shell parentShell, PlatformRootstrap rootstrap) {
+               super(parentShell);
+               //setBlockOnOpen(false);                
+        this.rootstrap = rootstrap;
+               this.enableRootstrapTab = true;
+               this.device = ConnectionPlugin.getDefault().getCurrentDevice();
+               this.enableTargetTab =  this.device == null ? false : true;
+               
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+        
+        http_proxy = PreferencesManager.getHttpProxyURL();
+        RPMPackageCommander.setHttpProxy(PreferencesManager.getHttpProxyURL());
+       }
+       
+       
+       public RPMPackageDialog(Shell parentShell, String target, boolean enableRootstrap, boolean enableTarget) {
+               super(parentShell);
+               //setBlockOnOpen(false);                
+               this.enableRootstrapTab = enableRootstrap;
+               this.enableTargetTab = enableTarget;
+               
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+               
+               if (enableRootstrap) {
+               http_proxy = PreferencesManager.getHttpProxyURL();
+               RPMPackageCommander.setHttpProxy(http_proxy);
+               }
+               if (enableTarget) {
+                       device = ConnectionPlugin.getDefault().getCurrentDevice();
+               }       
+       }
+       
+
+       private void setImage(Shell parentShell) {
+               Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
+               try {
+                       parentShell.setImage(new Image(Display.getCurrent(), FileLocator.toFileURL(bundle.getEntry("icons/package_installer.gif")).getPath()));
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+       
+       
+       protected void setShellStyle(int newShellStyle) {
+               int newStyle = newShellStyle;// & ~SWT.APPLICATION_MODAL;
+               //newStyle |= SWT.MODELESS;
+               super.setShellStyle(newStyle);
+       }
+
+       
+       @Override
+       public boolean close()
+       {
+               RemotePkgProvider.INSTANCE.clear();
+               LocalPkgProvider.INSTANCE.clear();
+               PackageProvider.INSTANCE.clear();
+               return super.close();
+       }
+       
+       protected void createButtonsForButtonBar(Composite parent) 
+       {
+               createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
+       }
+       
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);
+               newShell.setText(resources.getString("PkgMgr.Title"));
+               
+               if (!enableRootstrapTab && !enableTargetTab) {
+                       newShell.setLocation(x, y);
+                       newShell.setSize(width/2, height/4);
+                       setImage(newShell);                     
+               } else {
+                       newShell.setLocation(x, y);
+                       newShell.setSize(width, height);
+                       setImage(newShell);
+               }
+       }
+       
+       
+       @Override
+       protected Control createDialogArea(Composite parent) {
+               
+               Composite container = new Composite( parent, SWT.None );
+               container.setLayoutData(new GridData(GridData.FILL_BOTH));
+               container.setLayout(new GridLayout(1, false));
+
+               if (!enableRootstrapTab && !enableTargetTab) {
+                       createError( container, resources.getString("PkgMgr.Error.Noselected"));
+               } else {
+                       createDialogDescription ( container );
+                       createTabs ( container );
+               }                               
+               return null;
+       }
+               
+       
+       private void createError( Composite parent, String message )
+       {
+               Composite com = new Composite( parent, SWT.NONE );
+               com.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+               com.setLayout(new GridLayout(1, false));
+               
+               Label errorLabel = new Label(com, SWT.NONE);
+               errorLabel.setText(message);
+       }
+       
+       
+    private void createDialogDescription(Composite composite)
+    {
+        Composite comp_descrip = new Composite(composite, SWT.NONE);
+        Color whiteColor = new Color(composite.getDisplay(), 255, 255, 255);
+
+        comp_descrip.setLayout(new GridLayout(1, false));
+        GridData comp_descrip_gd = new GridData(GridData.FILL_HORIZONTAL);
+        comp_descrip_gd.heightHint = 30;
+        comp_descrip.setLayoutData(comp_descrip_gd);
+        comp_descrip.setBackground(whiteColor);
+
+        Label label = new Label(comp_descrip, SWT.NONE);
+        label.setText(resources.getString("PkgMgr.Frame.Description"));
+        label.setBackground(whiteColor);
+    }
+
+   
+       private void createTabs( Composite parent )
+       {
+               tabFolder = new TabFolder( parent, SWT.BORDER  );
+               tabFolder.setLayoutData(new GridData( GridData.FILL_BOTH));
+               tabFolder.setLayout(new GridLayout(1, false));          
+               
+               if (enableRootstrapTab) {
+                       BuildSystemTab tab = new BuildSystemTab(getShell(), tabFolder, rootstrap);
+                       tab.createTab();
+               } 
+               if (enableTargetTab) {
+                       DeviceTab tab = new DeviceTab(getShell(), tabFolder, device);
+                       tab.createTab();
+               }
+               
+               tabFolder.setSelection(tabIndex);               
+       }       
+       
+       
+       public void initializeDialogData(IProgressMonitor monitor) throws InterruptedException {
+               // init data for buildSystem Tab
+               BuildSystemTab.initializeRepositoryInfo(rootstrap);
+               BuildSystemTab.initializePackageInfo(rootstrap, monitor);
+
+               // init data for device Tab if connected
+               if ( device != null ) {
+                       DeviceTab.initializeRepositoryInfo(device);
+                       DeviceTab.initializePackageInfo(device);
+               }
+       }
+}
\ No newline at end of file
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
new file mode 100644 (file)
index 0000000..fa7398d
--- /dev/null
@@ -0,0 +1,455 @@
+/*
+ * 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();
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RepoTableSelectionAdapter.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgmgr/ui/RepoTableSelectionAdapter.java
new file mode 100644 (file)
index 0000000..ed586ab
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * 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 org.eclipse.jface.viewers.TableViewer;
+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.widgets.TableColumn;
+import org.tizen.nativeplatform.pkgmgr.model.Repository;
+
+public class RepoTableSelectionAdapter extends SelectionAdapter {
+       private TableViewer repoViewer;
+       private int selectedColumn = 0;
+       public RepoTableSelectionAdapter(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;
+                               
+                               Repository entry_1 = (Repository)e1;
+                               Repository entry_2 = (Repository)e2;
+                               
+                               switch (selectedColumn) {
+                                       case 0:                                                                 
+                                               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 1:
+                                               if (repoViewer.getTable().getSortDirection() == SWT.DOWN) {
+                                                       result = entry_1.getUri().compareTo(entry_2.getUri());
+                                               } else {
+                                                       result = entry_2.getUri().compareTo(entry_1.getUri());
+                                               }
+                                               break;                                          
+                                       default:
+                                               break;
+                               }                                       
+                               
+                               return result;
+                       }
+               });                     
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/PreferencesManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/PreferencesManager.java
new file mode 100644 (file)
index 0000000..dfd9074
--- /dev/null
@@ -0,0 +1,638 @@
+/*
+ * 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.preferences;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+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;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.core.net.proxy.IProxyData;
+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 getProxyProtocol() {
+               String proxyURL = getProxyURL();
+               if ( proxyURL == null ) return null;
+               URL url;
+               
+               try {
+                       url = new URL(proxyURL);
+               } catch (MalformedURLException e) {
+                       e.printStackTrace();
+                       return null;
+               }
+               
+               return url.getProtocol();
+       }
+
+       
+       public static String getProxyHost() {
+               String proxyURL = getProxyURL();
+               if ( proxyURL == null ) return null;
+               URL url;
+               
+               try {
+                       url = new URL(proxyURL);
+               } catch (MalformedURLException e) {
+                       e.printStackTrace();
+                       return null;
+               }
+               
+               return url.getHost();
+       }
+
+       
+       public static int getProxyPort() {
+               String proxyURL = getProxyURL();
+               if ( proxyURL == null ) return -1;
+               URL url;
+               
+               try {
+                       url = new URL(proxyURL);
+               } catch (MalformedURLException e) {
+                       e.printStackTrace();
+                       return -1;
+               }
+               
+               return url.getPort();
+       }
+       
+
+       
+       
+       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 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;
+       }
+
+       
+       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();
+               }
+       }
+
+       
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/GitConfUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/GitConfUIMessages.properties
new file mode 100644 (file)
index 0000000..56bba5e
--- /dev/null
@@ -0,0 +1,45 @@
+GitConfDlg.Title.Add = Add Git Configuration
+GitConfDlg.Title.Edit = Edit Git Configuration
+GitConfDlg.Label.GitListFile = Git List File:
+GitConfDlg.Label.GitWeb = Git Web Address:
+GitConfDlg.Label.SshConn = SSH Alias:
+GitConfDlg.Group.Desc = How to get git list
+
+GitConfDlg.Info.Input.SshConn = SSH alias should be input for cloning git project
+GitConfDlg.Info.Input.GitWeb = Git web address should be input for listing git project
+GitConfDlg.Info.Input.GitListFile = Git list file should be input for listing git project
+
+SiteConfDlg.Label.ConfigName = Name:
+
+SiteConfDlg.Group.Git = Git Configuration
+SiteConfDlg.Label.GitBaseURI = Git Base URI:
+SiteConfDlg.Label.GitBaseURI.Ex = ex) ssh://myid:mypasswd@my.host.name:29418
+SiteConfDlg.Label.GitListType = Type:
+SiteConfDlg.Label.GitListLocation = Location:
+SiteConfDlg.Button.Browse = Browse
+
+SiteConfDlg.Group.Proxy = Proxy Configuration
+SiteConfDlg.Button.UseSiteProxy = Use Site Proxy
+SiteConfDlg.Label.ProxyURL = Proxy URL:
+SiteConfDlg.Label.ProxyURL.Ex = ex) http://proxy.host.name:8080
+
+GitConfPref.Button.Add = Add
+GitConfPref.Button.Edit = Edit
+GitConfPref.Button.Remove = Remove
+GitConfPref.Button.SetActive = Set Active
+GitConfPref.Button.Update = Update
+GitConfPref.Text.ConfName = Name
+GitConfPref.Text.GitList = Git List
+GitConfPref.Text.SshConn = SSH Alias
+GitConfPref.Column.Name = Name
+GitConfPref.Column.URI = URI
+GitConfPref.Column.Type = Type 
+
+FileDlg.Title = File Dialog
+FileDlg.Filter.Ext = txt
+
+GitConfDlg.Error.NoName = Must specify configuration name field!
+GitConfDlg.Error.NoBaseURI = Must specify base URI field!
+GitConfDlg.Error.NoLocation = Must specify location field!
+GitConfDlg.Error.NoProxyURL = Must specify proxy URL!
+GitConfDlg.Error.MalformedURL = Malformed URL is used!
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/PasswdConfDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/PasswdConfDialog.java
new file mode 100644 (file)
index 0000000..8068d92
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * 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.preferences.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class PasswdConfDialog extends Dialog {
+       
+       private final String BUNDLE_NAME = PasswdConfDialog.class.getPackage().getName() + ".PlatformUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       private Text passwdText;        
+       private String password = "";   
+
+       
+       public PasswdConfDialog(Shell parentShell, String password) {
+               super(parentShell);
+               
+               this.password = password;
+       }
+       
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);         
+               
+               newShell.setText(resources.getString("PasswdInputDlg.Title"));          
+               
+               Rectangle bounds = newShell.getBounds();
+               int width = 300;
+               int height = 150;
+        int x = bounds.x + (bounds.width - width)/2;
+        int y = bounds.y + (bounds.height - height)/2;
+               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));
+               
+        passwdText = new Text(composite, SWT.SINGLE|SWT.PASSWORD|SWT.BORDER );
+        GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.minimumHeight = 0;
+               passwdText.setLayoutData(gridData);
+               passwdText.setText(password);
+        
+               return parent;
+       }
+
+       
+       @Override
+       protected void okPressed() {
+               password = passwdText.getText().trim(); 
+               
+               super.okPressed();
+       }
+       
+       
+       public String getPassword() {
+               return password;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/PlatformPreferencePage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/PlatformPreferencePage.java
new file mode 100644 (file)
index 0000000..c7ba92e
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * 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.preferences.ui;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+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.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+
+public class PlatformPreferencePage extends PreferencePage     implements IWorkbenchPreferencePage {
+
+    private final String BUNDLE_NAME = PlatformPreferencePage.class.getPackage().getName() + ".PlatformUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       private String password = "";
+       Text passwdText;
+       
+       public PlatformPreferencePage() {
+               String description = "General settings for developing platform project";
+               setDescription( description ); 
+       }
+       
+       @Override
+       public void init(IWorkbench workbench) {
+               updateData();
+       }       
+
+    private void updateData() {
+       password =      PreferencesManager.getPassword();
+       if ( passwdText != null ) {
+               passwdText.setText(password);
+       }
+    }
+    
+
+       @Override
+       protected Control createContents(Composite parent) {
+        Composite composite = new Composite(parent, SWT.NONE);
+        composite.setLayout(new GridLayout(1, false));
+        composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+        
+        createSudoPasswordComposite(parent);
+               return parent;
+       }
+       
+       
+    private void createSudoPasswordComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(3, false));
+
+        Label proxyLabel = new Label(composite, SWT.NONE);
+        proxyLabel.setText(resources.getString("ConfPref.Text.Password"));
+        
+        passwdText = new Text(composite, SWT.SINGLE | SWT.READ_ONLY| SWT.PASSWORD| SWT.BORDER);
+        GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               passwdText.setLayoutData(gridData);
+               passwdText.setText(password);
+               
+        Button modifyBt = new Button(composite, SWT.PUSH);
+        modifyBt.setText(resources.getString("ConfPref.Button.Change"));
+        
+        modifyBt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               PasswdConfDialog dialog = new PasswdConfDialog(getShell(), password);
+                               if (dialog.open() == PasswdConfDialog.OK) {
+                                       PreferencesManager.setPassword(dialog.getPassword());
+                                       updateData();
+                               }
+                               
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/PlatformUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/PlatformUIMessages.properties
new file mode 100644 (file)
index 0000000..e333079
--- /dev/null
@@ -0,0 +1,6 @@
+ConfPref.Button.Add = Add
+
+ConfPref.Text.Password = Password:
+ConfPref.Button.Change = Change
+
+PasswdInputDlg.Title = Input password!
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/SiteConfigurationDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/SiteConfigurationDialog.java
new file mode 100644 (file)
index 0000000..5bbcaf2
--- /dev/null
@@ -0,0 +1,434 @@
+/*
+ * 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.preferences.ui;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+
+public class SiteConfigurationDialog extends Dialog {
+       
+       private Text siteConfigNameText;
+       private Text gitBaseURIText;
+       private Combo gitListTypeCombo;
+       private Text gitListLocationText;
+       private Button fileBrowseBt;
+       private Button useSiteProxyBt;
+       private Text proxyURLText;
+
+       private String siteConfigName = "";
+       private String gitBaseURI = "";
+       private String gitListType = "";
+       private String gitListLocation = "";
+       private boolean useSiteProxy = false;
+       private String proxyURL = "";
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 500;
+       private Shell shell;
+       
+       private final String BUNDLE_NAME = SiteConfigurationDialog.class.getPackage().getName() + ".GitConfUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       protected SiteConfigurationDialog(Shell parentShell ) {
+               super(parentShell);     
+               siteConfigName = "";
+               gitBaseURI = "";
+               gitListType = "";
+               gitListLocation = "";
+               useSiteProxy= false;
+               proxyURL = "";
+
+               this.shell = parentShell;
+       }
+
+       
+       protected SiteConfigurationDialog(Shell parentShell, 
+                       String gitConfigName1, String gitBaseURI1 , String gitListType1, String gitListLocation1,
+                       boolean useSiteProxy1, String proxyURL1 ) {
+               super(parentShell);     
+               
+               siteConfigName = gitConfigName1;
+               gitBaseURI = gitBaseURI1;
+               gitListType = gitListType1;
+               gitListLocation = gitListLocation1;
+               useSiteProxy= useSiteProxy1;
+               proxyURL = proxyURL1;
+               
+               this.shell = parentShell;
+       }
+
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);         
+               
+               if ( siteConfigName == "" ) {
+                       newShell.setText(resources.getString("GitConfDlg.Title.Add"));          
+               }
+               else {
+                       newShell.setText(resources.getString("GitConfDlg.Title.Edit"));         
+               }
+               Rectangle bounds = newShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+               newShell.setLocation(x, y);
+               newShell.setMinimumSize(width, 0);
+       }
+       
+       
+       @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));       
+
+               createSiteConfigNameComposite(composite);
+               createGitConfigGroupComposite( composite );
+               createProxyConfigGroupComposite( composite );
+        
+               return null;
+       }
+       
+
+       private void createSiteConfigNameComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(2, false));
+
+        Label configNameLabel = new Label(composite, SWT.NONE);
+        GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.widthHint = 50;
+               configNameLabel.setLayoutData(gridData);
+               configNameLabel.setAlignment(SWT.RIGHT);
+        configNameLabel.setText(resources.getString("SiteConfDlg.Label.ConfigName"));
+        
+        siteConfigNameText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+        gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.minimumWidth = 200;
+        siteConfigNameText.setLayoutData(gridData);
+        siteConfigNameText.setText(siteConfigName);
+       }
+       
+
+       private void createGitConfigGroupComposite(Composite parent) {
+               Group group = new Group(parent, SWT.NONE);
+               group.setLayout(new GridLayout(3, false));
+               group.setText(resources.getString("SiteConfDlg.Group.Git"));
+               GridData gridData = new GridData(GridData.FILL_BOTH);
+               group.setLayoutData(gridData);
+
+               createGitBaseURIComposite(group);        
+        createGitListComposite(group);
+       }
+       
+       
+       private void createGitBaseURIComposite(Composite composite) {
+               
+        Label gitBaseURILebel = new Label(composite, SWT.NONE);
+        GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.widthHint = 100;
+               gitBaseURILebel.setLayoutData(gridData);
+               gitBaseURILebel.setAlignment(SWT.RIGHT);
+               gitBaseURILebel.setText(resources.getString("SiteConfDlg.Label.GitBaseURI"));
+               
+        gitBaseURIText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+        gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.horizontalSpan = 2;
+        gitBaseURIText.setLayoutData(gridData);
+        gitBaseURIText.setText(gitBaseURI);
+        
+        new Label( composite, SWT.NONE );
+        
+        Label gitBaseURIExLabel = new Label(composite, SWT.NONE);
+        gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+               gridData.horizontalSpan = 2;
+               gitBaseURIExLabel.setLayoutData(gridData);
+               gitBaseURIExLabel.setText(resources.getString("SiteConfDlg.Label.GitBaseURI.Ex"));
+
+       }
+
+       
+       private void createGitListComposite(Composite composite) {
+
+               Label gitListTypeLebel = new Label(composite, SWT.NONE);
+        GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.widthHint = 100;
+               gitListTypeLebel.setLayoutData(gridData);
+               gitListTypeLebel.setAlignment(SWT.RIGHT);
+        gitListTypeLebel.setText(resources.getString("SiteConfDlg.Label.GitListType"));
+        
+        gitListTypeCombo = new Combo(composite, SWT.READ_ONLY);
+        gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.horizontalSpan = 2;
+               gitListTypeCombo.setLayoutData(gridData);
+               String newItems[] = { PreferencesManager.GIT_LIST_LOCAL, PreferencesManager.GIT_LIST_WEB };
+        gitListTypeCombo.setItems(newItems);
+        gitListTypeCombo.addSelectionListener( new SelectionListener(){
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               
+                               if (gitListTypeCombo.getText().equals( PreferencesManager.GIT_LIST_LOCAL ) ) {
+                                       fileBrowseBt.setEnabled(true);
+                               } 
+                               else {
+                                       fileBrowseBt.setEnabled(false);
+                               }
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                       }
+               
+        });
+        if ( gitListType.isEmpty() || gitListType.equals(PreferencesManager.GIT_LIST_LOCAL) ) {
+               gitListTypeCombo.select(0);
+        }
+        else {
+               gitListTypeCombo.select(1);
+        }
+
+               Label gitListLocationLabel = new Label(composite, SWT.NONE);
+        gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.widthHint = 100;
+               gitListLocationLabel.setLayoutData(gridData);
+               gitListLocationLabel.setAlignment(SWT.RIGHT);
+        gitListLocationLabel.setText(resources.getString("SiteConfDlg.Label.GitListLocation"));
+        
+        createGitListLocationComposite(composite);
+       }
+       
+       
+       private void createGitListLocationComposite(Composite composite) {
+
+               gitListLocationText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+               GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               gitListLocationText.setLayoutData(gridData);
+               gitListLocationText.setText(gitListLocation);
+               
+        fileBrowseBt = new Button(composite, SWT.PUSH);
+        fileBrowseBt.setText(resources.getString("SiteConfDlg.Button.Browse"));
+        
+        fileBrowseBt.addMouseListener(new MouseListener()
+        {
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               FileDialog fd = new FileDialog( shell, SWT.OPEN);
+                       fd.setText(resources.getString("FileDlg.Title"));
+                       String listPath = gitListLocationText.getText();
+
+                       if (!listPath.isEmpty()) {
+                               IPath p = new Path(listPath);
+                               listPath = p.removeLastSegments(1).toString();
+                       }
+                       
+                       fd.setFilterPath(listPath);
+
+                       String selectedFileList = fd.open();
+                       if (selectedFileList != null) {
+                               gitListLocationText.setText(selectedFileList.trim());
+                       }
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+               });
+       }
+
+       
+       private void createProxyConfigGroupComposite( Composite parent ) {
+               Group group = new Group(parent, SWT.NONE);
+               group.setLayout(new GridLayout(2, false));
+               group.setText(resources.getString("SiteConfDlg.Group.Proxy"));
+               GridData gridData = new GridData(GridData.FILL_BOTH);
+               group.setLayoutData(gridData);
+               
+               // check box
+               useSiteProxyBt = new Button(group, SWT.CHECK);
+               useSiteProxyBt.setText(resources.getString("SiteConfDlg.Button.UseSiteProxy"));
+               gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING);
+               gridData.horizontalSpan = 2;
+               useSiteProxyBt.setLayoutData(gridData);
+               useSiteProxyBt.setSelection(useSiteProxy);
+               useSiteProxyBt.addSelectionListener( new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               useSiteProxy = useSiteProxyBt.getSelection();
+                               proxyURLText.setEnabled(useSiteProxy);
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                       }
+                       
+               });
+               
+               // label , text
+        Label proxyURLLabel = new Label(group, SWT.NONE);
+        gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.widthHint = 100;
+               proxyURLLabel.setLayoutData(gridData);
+               proxyURLLabel.setAlignment(SWT.RIGHT);
+               proxyURLLabel.setText(resources.getString("SiteConfDlg.Label.ProxyURL"));
+               
+        proxyURLText = new Text(group, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+        gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               proxyURLText.setLayoutData(gridData);
+               proxyURLText.setText(proxyURL);
+               if ( !useSiteProxy ) proxyURLText.setEnabled(false);
+               
+        new Label( group, SWT.NONE );
+        
+        Label gitBaseURIExLabel = new Label(group, SWT.NONE);
+        gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+               gitBaseURIExLabel.setLayoutData(gridData);
+               gitBaseURIExLabel.setText(resources.getString("SiteConfDlg.Label.ProxyURL.Ex"));
+       }
+
+       
+       @Override
+       protected void okPressed() {
+               siteConfigName = siteConfigNameText.getText().trim();
+               gitBaseURI = gitBaseURIText.getText().trim();
+               gitListType = gitListTypeCombo.getText();
+               gitListLocation = gitListLocationText.getText().trim();
+               useSiteProxy = useSiteProxyBt.getSelection();
+               proxyURL = proxyURLText.getText().trim();
+               
+               if ( siteConfigName.isEmpty()) {
+                       DialogUtil.openErrorDialog(resources.getString("GitConfDlg.Error.NoName"));
+                       return;
+               }
+               if ( gitBaseURI.isEmpty() ) {
+                       DialogUtil.openErrorDialog(resources.getString("GitConfDlg.Error.NoBaseURI"));
+                       return;
+               }
+               if ( gitListLocation.isEmpty() ) {
+                       DialogUtil.openErrorDialog(resources.getString("GitConfDlg.Error.NoLocation"));
+                       return;
+               }
+               if ( useSiteProxy ) {
+                       if ( proxyURL.isEmpty() ) {
+                               DialogUtil.openErrorDialog(resources.getString("GitConfDlg.Error.NoProxyURL"));
+                       }
+                       
+                       try {
+                               URL url = new URL(proxyURL);
+                               String protocol = url.getProtocol();
+                               String host = url.getHost();
+                               int port = url.getPort();
+                               
+                               if ( ( protocol.compareToIgnoreCase("socks") != 0 &&
+                                               protocol.compareToIgnoreCase("http")  != 0 &&
+                                               protocol.compareToIgnoreCase("https")  != 0 ) ||
+                                               host == null ||host.isEmpty() ) {
+                                       DialogUtil.openErrorDialog(resources.getString("GitConfDlg.Error.MalformedURL"));
+                                       return;
+                               }
+                               // use default port
+                               if ( port == -1 ) port = 8080;
+                               
+                               // make new URL
+                               proxyURL = String.format("%s://%s:%d", protocol, host, port);
+                               
+                       } catch (MalformedURLException e) {
+                               DialogUtil.openErrorDialog(resources.getString("GitConfDlg.Error.MalformedURL"));
+                               return;
+                       }
+
+               }
+
+               super.okPressed();
+       }
+
+       public String getSiteConfigName() {
+               return siteConfigName;
+       }
+       
+       
+       public String getGitBaseURI() {
+               return gitBaseURI;
+       }
+       
+       
+       public String getGitListType() {
+               return gitListType;
+       }
+       
+       
+       public String getGitListLocation() {
+               return gitListLocation;
+       }
+       
+       
+       public boolean isSiteProxyUsed() {
+               return useSiteProxy;
+       }
+       
+       
+       public String getProxyURL() {
+               if ( useSiteProxy ) {
+                       return proxyURL;
+               }
+               else {
+                       return "";
+               }
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/SiteConfigurationPreferencePage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/preferences/ui/SiteConfigurationPreferencePage.java
new file mode 100644 (file)
index 0000000..60540e8
--- /dev/null
@@ -0,0 +1,413 @@
+/*
+ * 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.preferences.ui;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.graphics.Image;
+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.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+
+
+public class SiteConfigurationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage{
+
+    private ArrayList<PreferencesManager.SiteConfiguration> siteConfigList;
+    private TableViewer gitConfigTable;
+    private Button addBt;
+    private Button editBt;
+    private Button updateBt;
+    private Button setActiveBt;
+    private Button removeBt;
+    
+    private final String BUNDLE_NAME = SiteConfigurationPreferencePage.class.getPackage().getName() + ".GitConfUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+    
+    public SiteConfigurationPreferencePage() {
+       siteConfigList = new ArrayList<PreferencesManager.SiteConfiguration>();
+    }
+    
+    @Override
+    public void init(IWorkbench workbench) {
+       updateData(); 
+    }
+
+    @Override
+    public void createControl(Composite parent) {
+        super.createControl(parent);
+        Button defaultButton = getDefaultsButton();
+        if (defaultButton != null) {
+            defaultButton.setVisible(false);
+        }
+        
+        Button applyButton = getApplyButton();
+        
+        if(applyButton != null) {
+            applyButton.setVisible(false);
+        }
+    }
+    
+    @Override
+    protected Control createContents(Composite parent) {
+        initializeDialogUnits(parent);
+        
+        Composite composite = new Composite(parent, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 1;
+        layout.marginWidth = 0;
+        layout.marginHeight = 0;
+        composite.setLayout(layout);
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+        
+        createGitDetailTableComposite(composite);      
+        
+        return parent;
+    }
+    
+     private void createGitDetailTableComposite(Composite parent) {
+       
+       Composite composite = new Composite(parent, SWT.NONE);          
+               GridLayout gridLayout = new GridLayout(2, false);
+        gridLayout.marginHeight = 0;
+        gridLayout.marginWidth = 0;
+        composite.setLayout(gridLayout);
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING)); 
+        
+        createDetailTableComposite(composite);
+        createGitButtonComposite(composite);
+    }
+    
+    private void createDetailTableComposite(Composite composite) {
+       
+        gitConfigTable = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+        Table table = gitConfigTable.getTable();
+       table.setHeaderVisible(true);
+       table.setLinesVisible(true);    
+               
+       gitConfigTable.setLabelProvider(new TableViewerProvider());             
+       gitConfigTable.setContentProvider(new ArrayContentProvider());
+               
+        TableColumn column = new TableColumn(table, SWT.NONE);        
+        column.setResizable(true);
+        column.setText(resources.getString("GitConfPref.Column.Name"));
+        column.setWidth(150);        
+        
+        column = new TableColumn(table, SWT.NONE);        
+        column.setResizable(true);
+        column.setText(resources.getString("GitConfPref.Column.URI"));
+        column.setWidth(300);
+        
+        column = new TableColumn(table, SWT.NONE);        
+        column.setResizable(true);
+        column.setText(resources.getString("GitConfPref.Column.Type"));
+        column.setWidth(50);
+
+        GridData tableGridData = new GridData(GridData.FILL_HORIZONTAL|GridData.VERTICAL_ALIGN_BEGINNING);
+        tableGridData.heightHint = 200;
+        table.setLayoutData(tableGridData);     
+        
+        gitConfigTable.addSelectionChangedListener( new ISelectionChangedListener() {
+
+                       @Override
+                       public void selectionChanged(SelectionChangedEvent event) {
+                               int idx = gitConfigTable.getTable().getSelectionIndex();
+                               if ( idx != -1 ) {
+                                       String gitListType = siteConfigList.get(idx).listType;
+                                       if ( gitListType.equals(PreferencesManager.GIT_LIST_WEB) ) {
+                                               updateBt.setEnabled(true);
+                                       }
+                                       else {
+                                               updateBt.setEnabled(false);
+                                       }
+                                       editBt.setEnabled(true);
+                                       setActiveBt.setEnabled(true);
+                                       removeBt.setEnabled(true);
+                               }
+                               else {
+                                       updateBt.setEnabled(false);
+                                       editBt.setEnabled(false);
+                                       setActiveBt.setEnabled(false);
+                                       removeBt.setEnabled(false);
+                               }
+                       }
+               
+        });
+        
+        gitConfigTable.setInput(siteConfigList);
+    }
+    
+    
+    private void updateData() {
+       siteConfigList =        PreferencesManager.loadSiteConfigurations();
+       
+       if (gitConfigTable != null ) {
+               gitConfigTable.setInput(siteConfigList);
+       }
+    }
+    
+    
+    private void createGitButtonComposite(Composite parent) {
+       Composite composite = new Composite(parent, SWT.NONE);          
+               GridLayout gridLayout = new GridLayout(1, false);
+        gridLayout.marginHeight = 0;
+        gridLayout.marginWidth = 0;
+        
+        composite.setLayout(gridLayout);
+        composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING));        
+        
+        addBt = new Button(composite, SWT.PUSH);
+        addBt.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+        addBt.setText(resources.getString("GitConfPref.Button.Add"));
+        addBt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               SiteConfigurationDialog dialog = new SiteConfigurationDialog(getShell());
+                               
+                               if (dialog.open() == SiteConfigurationDialog.OK) {
+                                       PreferencesManager.addSiteConfiguration( 
+                                                       dialog.getSiteConfigName(),
+                                                       dialog.getGitBaseURI(),
+                                                       dialog.getGitListType(),
+                                                       dialog.getGitListLocation(),
+                                                       dialog.isSiteProxyUsed(),
+                                                       dialog.getProxyURL());
+
+                                       updateData();
+                               }
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });
+        
+
+        editBt = new Button(composite, SWT.PUSH);
+        editBt.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+        editBt.setEnabled(false);
+        editBt.setText(resources.getString("GitConfPref.Button.Edit"));
+        
+        editBt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {   
+                               int idx = gitConfigTable.getTable().getSelectionIndex();
+                               String siteConfigName = siteConfigList.get(idx).name; 
+                               String gitBaseURI = siteConfigList.get(idx).baseURI; 
+                               String gitListType = siteConfigList.get(idx).listType; 
+                               String gitListLocation = siteConfigList.get(idx).listLocation;
+                               boolean useSiteProxy =  siteConfigList.get(idx).isSiteProxyUsed;
+                               String proxyURL =  siteConfigList.get(idx).proxyURL;
+                               
+                               SiteConfigurationDialog dialog = new SiteConfigurationDialog(getShell(), 
+                                               siteConfigName, gitBaseURI, gitListType, gitListLocation,
+                                               useSiteProxy, proxyURL );
+                               if (dialog.open() == SiteConfigurationDialog.OK) {
+                                       PreferencesManager.updateSiteConfiguration(
+                                                       gitConfigTable.getTable().getSelectionIndex(),
+                                                       dialog.getSiteConfigName(),
+                                                       dialog.getGitBaseURI(),
+                                                       dialog.getGitListType(),
+                                                       dialog.getGitListLocation(),
+                                                       dialog.isSiteProxyUsed(),
+                                                       dialog.getProxyURL() );
+                                       updateData();
+                               }
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });
+
+        updateBt = new Button(composite, SWT.PUSH);
+        updateBt.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+        updateBt.setEnabled(false);
+        updateBt.setText(resources.getString("GitConfPref.Button.Update"));
+        updateBt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               try {
+                                       new ProgressMonitorDialog(getShell()).run(true, false,
+                                                       new RefreshGitWebOperation(gitConfigTable.getTable().getSelectionIndex()));
+                                       DialogUtil.openMessageDialog("Refreshing Git Web succeeded!");
+                               } catch (InvocationTargetException e1) {
+                                       DialogUtil.openErrorDialog( "Refreshing Git Web Failed!\n:"+e1.getMessage());
+                               } catch (InterruptedException e1) {
+                                       // do nothing
+                               }
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });
+
+        setActiveBt = new Button(composite, SWT.PUSH);
+        setActiveBt.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+        setActiveBt.setEnabled(false);
+        setActiveBt.setText(resources.getString("GitConfPref.Button.SetActive"));
+        
+        setActiveBt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {   
+                               PreferencesManager.setActiveSiteConfiguration(
+                                               gitConfigTable.getTable().getSelectionIndex());
+                               
+                               updateData();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });
+
+        removeBt = new Button(composite, SWT.PUSH);
+        removeBt.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+        removeBt.setEnabled(false);
+        removeBt.setText(resources.getString("GitConfPref.Button.Remove"));
+        
+        removeBt.addMouseListener(new MouseListener(){
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {   
+                               PreferencesManager.removeSiteConfiguration(
+                                               gitConfigTable.getTable().getSelectionIndex());
+                               updateData();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+        });
+        
+    }
+
+    @Override
+    public boolean performOk() {
+        return super.performOk();
+    }
+    
+       private class TableViewerProvider extends LabelProvider implements ITableLabelProvider 
+       {
+               @Override
+               public Image getColumnImage(Object element, int columnIndex) {
+                       return null;
+               }
+
+               @Override
+               public String getColumnText(Object element, int columnIndex) {
+                       PreferencesManager.SiteConfiguration config = (PreferencesManager.SiteConfiguration)element;
+                       
+                       switch(columnIndex) {
+                       case 0:
+                               if ( config.isActive ) {
+                                       return config.name + " (Active)";
+                               }
+                               else {
+                                       return config.name;
+                               }       
+                       case 1:
+                               return config.baseURI;
+                       case 2:
+                               return config.listType;
+                               
+                       default:
+                               return "";
+                       }
+               }
+       }
+
+
+       class RefreshGitWebOperation implements IRunnableWithProgress {
+               private int idx;
+               
+               public RefreshGitWebOperation(int idx1) {
+                       idx = idx1;
+               }
+
+               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                       InterruptedException {
+                       
+                       monitor.beginTask("Refreshing Git Web...", IProgressMonitor.UNKNOWN);
+                       try {
+                               PreferencesManager.refreshGitWebConfiguration(idx);
+                       } catch (IOException e) {
+                               throw new InvocationTargetException(e, e.getMessage());
+                       }
+                       monitor.done();
+               }
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/IRootstrapChangedListener.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/IRootstrapChangedListener.java
new file mode 100644 (file)
index 0000000..211e68f
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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.rootstrap;
+
+public interface IRootstrapChangedListener {
+       void rootstrapChanged();
+       void selectionChanged(String rootName);
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/RootstrapManager.java
new file mode 100644 (file)
index 0000000..01a6a06
--- /dev/null
@@ -0,0 +1,746 @@
+/*
+ * 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.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.HashSet;
+import java.util.Iterator;
+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.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.util.CommandLauncher;
+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 {
+       
+       private static ArrayList<PlatformRootstrap> rootstraps = new ArrayList<PlatformRootstrap>();
+       private static PlatformRootstrap selectedRootstrap;
+       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";
+       
+       private RootstrapManager() {
+       }
+       
+       private synchronized static void initialize() {
+               
+               SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+               try {
+                       ArrayList<String> lists = sbi.getRootstrapList();
+                       for (String id : lists) {
+                               String type = sbi.getSupportToolchainTypeFromRootstrapID(id);
+                               if (!type.equals(PlatformRootstrap.SUPPORTED_TOOLCHAIN_TYPE)) {
+                                       continue;
+                               }                               
+                       
+                               String rootName = sbi.getRootstrapNameFromRootstrapID(id);                              
+                               String arch = sbi.getArchitectureFromRootstrapID(id);
+                               String path = sbi.getRootstrapPathFromRootstrapID(id);
+                               ArrayList<String> reposURLs = new ArrayList<String>();
+                               String rootstrapPath = sbi.getRootstrapPropertyValue(id, "REPOSITORY_URLS");
+                               if ( rootstrapPath != null && rootstrapPath.split(URL_SEP_REGEXP).length >= 1 ) {
+                                       for ( String url : rootstrapPath.split(URL_SEP_REGEXP) ) {
+                                               reposURLs.add( url );
+                                       }
+                               }
+                               boolean initialized = new File(path).exists() ? true : false;
+                               addRootstrap( new PlatformRootstrap(id, rootName, arch, path,
+                                               reposURLs, initialized) );
+                       }
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }
+               
+               init = true;
+       }
+
+       
+       public static PlatformRootstrap addRootstrap(PlatformRootstrap rootstrap ) {
+               rootstraps.add(rootstrap);
+               //SBIModel.addRootstrap(rootstrap, false);
+               try {
+                       SBIModel.reinitialize();
+               } catch (SBIException e) {
+                       // nothing to do
+                       e.printStackTrace();
+               }
+               RootstrapManager.notifyChangedRootstrap();
+
+               return rootstrap;
+       }
+
+       
+       public static void modifyRootstrap(PlatformRootstrap rootstrap) {
+               generateSBIPluginXML(rootstrap.getId(), rootstrap.getName(),
+                               rootstrap.getArch(), rootstrap.getPath().toOSString(), rootstrap.getRepositoryURLs() );
+               try {
+                       SBIModel.reinitialize();
+                       reinitialize();
+               } catch (SBIException e) {
+                       // nothing to do
+                       e.printStackTrace();
+               }
+               RootstrapManager.notifyChangedRootstrap();
+       }
+
+       
+       public static boolean removeRootstrap(String id) {
+               PlatformRootstrap rootstrap = getRootstrap( id );
+               
+               if ( rootstrap != null ) {
+                       rootstraps.remove( rootstrap );
+                       removeSBIPluginXML( rootstrap );
+                       try {
+                               removeBaseFileSystem( rootstrap.getId() , rootstrap.getArch());
+                       } catch (InterruptedException e) {
+                               // nothing to do
+                               e.printStackTrace();
+                       }
+                       try {
+                               SBIModel.reinitialize();
+                       } catch (SBIException e) {
+                               // nothing to do
+                               e.printStackTrace();
+                       }
+                       RootstrapManager.notifyChangedRootstrap();
+                       return true;
+               }
+               else {
+                       return false;
+               }
+       }
+       
+
+       public static boolean exportRootstrap(
+                       PlatformRootstrap rootstrap, String exportFilePath, 
+                       IProgressMonitor monitor) throws InterruptedException {
+
+               // make temp directory
+               String tempDirPath = makeTempDirectory();
+
+               try {
+                       // zip file-system
+                       String basePath = rootstrap.getPath().removeLastSegments(1).toOSString();
+                       File dir = new File(rootstrap.getPath().append("local").toOSString());
+                       String scratchName = "";
+                       String list[] = dir.list();
+                       for (String s : list) {
+                               if (s.startsWith("scratch.")) {
+                                       scratchName = s;
+                               }
+                       }
+                       
+                       String rootstrapID = rootstrap.getId();
+
+                       if( !CommandLauncher.execute( String.format("tar cvzf %s/rootstrap1.tar.gz %s --exclude=local/%s",
+                                       tempDirPath, rootstrapID, scratchName), basePath, "Platform Internal", monitor ) ) {
+                               return false;
+                       }               
+                       
+                       if( !CommandLauncher.executeSudo( String.format("sudo -S tar cvzf %s/rootstrap2.tar.gz %s/local/%s --exclude=home/abuild --exclude=etc/passwd",
+                                       tempDirPath, rootstrapID, scratchName), basePath, "Platform Internal", monitor ) ) {
+                               return false;
+                       }
+                       
+                       // copy xml
+                       String pluginFileName = rootstrap.getId() + ".xml";
+                       String pluginPath = new Path(SmartBuildInterface.getInstance().getPluginPath())
+                               .append(pluginFileName).toOSString();
+                       if ( !CommandLauncher.execute( String.format("cp %s %s/", pluginPath, tempDirPath )) )  {
+                               return false;
+                       }
+                       
+                       // zip them together
+                       if ( !CommandLauncher.execute( String.format("tar cvf %s rootstrap1.tar.gz rootstrap2.tar.gz %s",
+                                       exportFilePath, pluginFileName), tempDirPath, "Platform Internal", monitor ) )  {
+                               return false;
+                       }
+                       
+                       return true;
+               }
+               finally {
+                       // remove temporary directory
+                       CommandLauncher.executeSudo( String.format("sudo -S rm -rf %s",tempDirPath) );
+               }
+       }
+
+       
+       public static PlatformRootstrap importRootstrap( String importFilePath, 
+                       IProgressMonitor monitor) throws InterruptedException {
+               
+               PlatformRootstrap result = null;
+               String pluginPath = null;
+               String rootstrapPath = null;
+               
+               // make temp directory
+               String tempDirPath = makeTempDirectory();
+
+               try {
+                       // extract "tar" archive
+                       if( !CommandLauncher.execute( String.format("tar xvf %s",
+                                       importFilePath), tempDirPath, "Platform Internal", monitor ) ) {
+                           cleanUpRootstrap(pluginPath, rootstrapPath);
+                               throw new InterruptedException("Extracting rootsrap failed!");
+                       }
+                       
+                       // find rootstrap id
+                       File tempDir = new File(tempDirPath);
+                       File[] xmlFiles = tempDir.listFiles( new FilenameFilter() {
+                               @Override
+                               public boolean accept(File dir, String name) {
+                                       if( name.endsWith(".xml") ) {
+                                               return true;
+                                       }
+                                       else {
+                                               return false;
+                                       }
+                               }
+                               
+                       } );
+                       if ( xmlFiles.length == 0 ) {
+                           cleanUpRootstrap(pluginPath, rootstrapPath);
+                               throw new InterruptedException("There is no SBI plugin file(*.xml)");
+                       }
+                       String pluginFilePath = xmlFiles[0].getPath().toString();
+                       String pluginFileName = new File(pluginFilePath).getName();
+                       String pluginId = pluginFileName.split("\\.xml")[0];
+                       
+                       // check already exist?
+                       if( RootstrapManager.getRootstrap(pluginId) != null ) {
+                           cleanUpRootstrap(pluginPath, rootstrapPath);
+                               throw new InterruptedException("There already exists the rootrap with same id!");
+                       }
+                       
+                       // copy xml
+                       pluginPath = new Path(SmartBuildInterface.getInstance().getPluginPath())
+                               .append(pluginFileName).toOSString();
+                       CommandLauncher.execute( String.format("cp %s %s", pluginFilePath, pluginPath));
+                       
+                       // reload
+                       try {
+                               SBIModel.reinitialize();
+                       } catch (SBIException e) {
+                           cleanUpRootstrap(pluginPath, rootstrapPath);
+                               throw new InterruptedException("SBIModel initialization failed!");
+                       }
+                       result = createRootstrapFromSBIPlugin( pluginId );
+                       if ( result == null ) {
+                           cleanUpRootstrap(pluginPath, rootstrapPath);
+                               throw new InterruptedException("Loading SBI plugin failed!");
+                       }
+
+                       // extracting file system
+                       rootstrapPath = result.getPath().toOSString();
+                       File baseDirDir = new File(rootstrapPath).getParentFile();
+                       if ( !baseDirDir.exists() ) {
+                               baseDirDir.mkdir();
+                       }
+                       else if ( new File(rootstrapPath).exists() ) {
+                               CommandLauncher.executeSudo( String.format("sudo -S rm -rf %s", rootstrapPath), null );
+                       }
+                       
+                       if ( !CommandLauncher.execute( String.format("tar xvf %s/rootstrap1.tar.gz",
+                                       tempDirPath), baseDirDir.getPath(), "Platform Internal", monitor ) )  {
+                           cleanUpRootstrap(pluginPath, rootstrapPath);
+                               throw new InterruptedException("Extracting rootsrap failed!");
+                       }
+                       
+                       if ( !CommandLauncher.executeSudo( String.format("sudo -S tar xvf %s/rootstrap2.tar.gz",
+                                       tempDirPath), baseDirDir.getPath(), "Platform Internal", monitor ) )  {
+                           cleanUpRootstrap(pluginPath, rootstrapPath);
+                               throw new InterruptedException("Extracting rootsrap failed!");
+                       }
+                       
+                       return result;
+               }
+               finally {
+                       // remove temporary directory
+                       CommandLauncher.executeSudo( String.format("sudo -S rm -rf %s",tempDirPath), null );
+               }
+       }
+       
+       private static void cleanUpRootstrap(String pluginPath, String rootstrapPath) 
+               throws InterruptedException{
+           if ( pluginPath != null ) {
+            CommandLauncher.execute( String.format("rm -rf %s", pluginPath) );
+            try {
+                SBIModel.reinitialize();
+            } catch (SBIException e1) {
+                throw new InterruptedException(e1.getMessage());
+            }
+        }
+        if ( rootstrapPath != null ) {
+            CommandLauncher.executeSudo( String.format("sudo -S rm -rf %s", rootstrapPath), null );
+        }
+       }
+       
+       
+       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 ArrayList<PlatformRootstrap> getRootstraps() {
+               checkInit();
+               
+               return rootstraps;
+       }
+
+       
+       public static PlatformRootstrap getRootstrap(String id) {
+               checkInit();
+               
+               for (PlatformRootstrap r : rootstraps) {
+                       if (r.getId().equals(id)) {
+                               return r;
+                       }
+               }
+               
+               return null;
+       }
+       
+       
+       public static PlatformRootstrap getDefaultRootstrap( String arch ) {
+               String defaultRootstrapID = null;
+               if (PlatformConfigurationManager.isEmulatorArch(arch)) {
+                       defaultRootstrapID = PlatformRootstrap.DEFAULT_ROOTSTRAP_I386_ID;
+               } else if (PlatformConfigurationManager.isDeviceArch(arch)) {
+                       defaultRootstrapID = PlatformRootstrap.DEFAULT_ROOTSTRAP_ARM_ID;
+               }
+               
+       return RootstrapManager.getRootstrap( defaultRootstrapID );
+       }
+       
+       
+       public static void reinitialize() {
+               init = false;
+               rootstraps.clear();
+               initialize();
+       }
+
+       
+       public static void setSelectedRootstrap(PlatformRootstrap selected) {
+               for (PlatformRootstrap r : rootstraps) {
+               if(r.isChecked()) {
+                       r.setChecked(false);                                    
+               }
+       }               
+               selected.setChecked(true);
+               selectedRootstrap = selected;
+       }
+       
+       
+       public static void setSelectedRootstrap(String id) {
+               for(PlatformRootstrap r : RootstrapManager.getRootstraps()) {           
+                       if (id.equals(r.getId())) {
+                               setSelectedRootstrap(r);
+                               break;
+                       }
+               }
+       }
+       
+       
+       public static void resetSelectedRootstrap() {
+               for (PlatformRootstrap r : rootstraps) {
+               if(r.isChecked()) {
+                       r.setChecked(false);                                    
+               }
+       }
+       }
+       
+       
+       public static PlatformRootstrap getSelectedRootstrap() {
+               return selectedRootstrap;
+       }
+       
+       
+       public static synchronized void addListener(IRootstrapChangedListener listener) {
+               changedListener.add(listener);
+       }
+       
+       
+       public static synchronized void removeListener(IRootstrapChangedListener listener) {
+               changedListener.remove(listener);
+       }
+       
+       
+       public static synchronized void notifyChangedRootstrap() {
+               
+               Iterator<IRootstrapChangedListener> ite = changedListener.iterator();
+               while (ite.hasNext()) {
+                       IRootstrapChangedListener tl = ite.next();
+                       if(tl!=null)
+                               tl.rootstrapChanged();
+               }
+       }       
+
+       
+       public static synchronized void notifyChangedSelectionListener(String rootName) {
+                               
+               Iterator<IRootstrapChangedListener> ite = changedListener.iterator();
+               while (ite.hasNext()) {
+                       IRootstrapChangedListener tl = ite.next();
+                       if(tl!=null)
+                               tl.selectionChanged(rootName);
+               }
+       }
+       
+       
+       private static void checkInit() {
+               if (!init) {
+                       initialize();
+               }
+       }
+       
+       
+       public static PlatformRootstrap generate(String name, String arch,
+                       ArrayList<String> reposURLs, boolean immediateGen,
+                       IProgressMonitor monitor) throws InterruptedException {
+
+               boolean initialized = false;
+               String id = name;
+               if ( immediateGen ) {
+                       if ( generateBaseFileSystem(getUserRootstrapPath(id), arch, reposURLs, monitor) ) {
+                               initialized = true;
+                       }
+                       else {
+                               return null;
+                       }
+               }
+               
+               // generate SBI plugins
+               if ( generateSBIPluginXML(id, name, arch, null, reposURLs) ) {
+                       return new PlatformRootstrap(id, name, arch, getUserRootstrapPath(id), 
+                                       reposURLs, initialized);
+               }
+               else {
+                       if ( immediateGen ) {
+                               removeBaseFileSystem(id, arch);
+                       }
+                       return null;
+               }
+
+       }
+
+       
+       public static boolean generateBaseFileSystem(String rootstrapPath, String arch,
+                       ArrayList<String> reposURLs, IProgressMonitor monitor) throws InterruptedException {
+               
+               String id = new File(rootstrapPath).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 ( !CommandLauncher.executeSudo( command, tempDirPath, env, "Platform Internal", monitor) ) {
+                               return false;
+                       }
+                       
+                       // copy
+                       String rootstrapBasePath = new File(rootstrapPath).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/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/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;
+       }
+
+       
+       private static void removeBaseFileSystem( String id, String arch ) throws InterruptedException {
+               String path = getUserRootstrapPath( id );               
+               // check sub-directory
+               String checkDir = String.format("%s/local/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/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) {
+               
+               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("tizen.obs");
+                       
+                       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("REPOSITORY_URLS");
+                       Attr attrValue = doc.createAttribute("value");
+                       attrValue.setValue(reposURLString);
+                               
+                       secondnode.setAttributeNode(attrKey);
+                       secondnode.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) {
+                       e.printStackTrace();
+                       return false;
+               } catch (TransformerConfigurationException e) {
+                       e.printStackTrace();
+                       return false;
+               } catch (FileNotFoundException e) {
+                       e.printStackTrace();
+                       return false;
+               } catch (TransformerException 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 ) {
+                       return null;
+               }
+               
+               ArrayList<String> reposURLs = new ArrayList<String>();
+               String urlStr = rootstrap.getPropertyValue("REPOSITORY_URLS");
+               if ( urlStr != null ) {
+                       for( String url : urlStr.split(URL_SEP_REGEXP) ) {
+                               reposURLs.add(url);
+                       }
+               }
+               
+               return new PlatformRootstrap(id, rootstrap.getName(), rootstrap.getArch(),
+                               rootstrap.getPath().toOSString(), 
+                               reposURLs, true);
+       }
+       
+       
+       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 ) {
+               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/SnapshotURLParser.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/rootstrap/SnapshotURLParser.java
new file mode 100644 (file)
index 0000000..589f82f
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * 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.rootstrap;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.Proxy;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.tizen.nativeplatform.views.model.Architecture;
+import org.tizen.nativeplatform.views.model.ICheckTreeItem;
+import org.tizen.nativeplatform.views.model.Snapshot;
+
+public class SnapshotURLParser {
+       public SnapshotURLParser() {
+               
+       }
+       
+       public ArrayList<ICheckTreeItem> parse(String url) 
+                       throws MalformedURLException, IOException {
+               
+               if (url.endsWith("/")) {
+                       url = url.substring(0, url.length() - 1);                       
+               }
+
+               String repoPath = url + "/repos";
+               boolean startBody = false;
+
+               ArrayList<ICheckTreeItem> archs = new ArrayList<ICheckTreeItem>();
+                       
+               URL u = new URL(repoPath);                      
+               URLConnection yc;
+               Proxy p = PreferencesManager.getProxy();
+               if (p == null) {
+                       yc = u.openConnection();                                
+               } else {
+                       yc = u.openConnection(p);
+               }               
+               
+               BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
+               
+               String str;                     
+               while ((str = in.readLine()) != null) {
+                       str = str.trim();
+                       if (startBody) {
+                               if (str.startsWith("<img src")) {
+                                       String item = str.replaceAll("<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>", "").trim();
+                                       item = item.split("/")[0];
+                                       
+                                       parseArch(repoPath, item, archs, p);                                            
+                                       continue;
+                               } 
+                       }
+                       if (!startBody && str.startsWith("<pre><img src")) {
+                               startBody = true;
+                               continue;
+                       }
+                       
+                       if (startBody && str.startsWith("<hr></pre>")) {
+                               startBody = false;
+                               break;
+                       }
+               }
+               
+               return archs;           
+       }
+       
+       
+       public ArrayList<ICheckTreeItem> parseArch(String path, String name, 
+                       ArrayList<ICheckTreeItem> archs, Proxy p) 
+                       throws MalformedURLException, IOException {
+               String repoPath = path + "/" + name;
+               boolean startBody = false;
+
+               URL u = new URL(repoPath);
+               URLConnection yc;
+               if (p == null) {
+                       yc = u.openConnection();
+               } else {
+                       yc = u.openConnection(p);
+               }
+               BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
+               String str;                     
+               while ((str = in.readLine()) != null) {
+                       str = str.trim();
+                       if (startBody) {
+                               if (str.startsWith("<img src")) {
+                                       String item = str.replaceAll("<(/)?([a-zA-Z]*)(\\s[a-zA-Z]*=[^>]*)?(\\s)*(/)?>", "").trim();
+                                       item = item.split("/")[0];
+                                       String packagePath = repoPath + "/" + item + "/" + "packages";
+                                       if (checkValidPath(packagePath, p)) {
+                                               Snapshot s = new Snapshot(packagePath);
+                                               boolean exists = false;
+                                               for (ICheckTreeItem arch : archs) {
+                                                       if (arch.getText().equals(item)) {
+                                                               arch.getChildren().add(s);
+                                                               exists = true;
+                                                               break;
+                                                       }
+                                               }
+                                               
+                                               if (!exists) {
+                                                       Architecture a = new Architecture(item);
+                                                       a.getChildren().add(s);
+                                                       archs.add(a);
+                                               }                                               
+                                       }                                                                                                                               
+                                       
+                                       continue;
+                               } 
+                       }
+                       if (!startBody && str.startsWith("<pre><img src")) {
+                               startBody = true;
+                               continue;
+                       }
+                       
+                       if (startBody && str.startsWith("<hr></pre>")) {
+                               startBody = false;
+                               break;
+                       }                       
+               }
+
+               
+               return archs;
+       }
+       
+       
+       public boolean checkValidPath(String path, Proxy p) {
+               try {
+                       URL u = new URL(path);          
+                       URLConnection yc;
+               
+                       if (p == null) {
+                               yc = u.openConnection();
+                       } else {
+                               yc = u.openConnection(p);
+                       }                       
+                       // For exception
+                       new BufferedReader(new InputStreamReader(yc.getInputStream()));                 
+               } catch (MalformedURLException e) {
+                       return false;
+               } catch (IOException e) {
+                       return false;
+               }
+
+               return true;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/templateengine/TizenTemplateProcess.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/templateengine/TizenTemplateProcess.java
new file mode 100644 (file)
index 0000000..b0da531
--- /dev/null
@@ -0,0 +1,111 @@
+/*\r
+ * Native Platform\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Donghyuk Yang <donghyuk.yang@samsung.com>  \r
+ * DongHee Yang <donghee.yang@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ *\r
+ */\r
+\r
+package org.tizen.nativeplatform.templateengine;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import org.eclipse.cdt.core.templateengine.TemplateCore;\r
+import org.eclipse.cdt.core.templateengine.TemplateDescriptor;\r
+import org.eclipse.cdt.core.templateengine.process.Process;\r
+import org.eclipse.cdt.core.templateengine.process.ProcessArgument;\r
+import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;\r
+import org.eclipse.cdt.core.templateengine.process.ProcessRunner;\r
+\r
+import org.eclipse.core.runtime.IPath;\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.IStatus;\r
+\r
+import org.tizen.nativeappcommon.templateengine.TizenTemplateProcessParser;\r
+import org.tizen.nativeappcommon.wizards.TemplateTizenNewWizard;\r
+\r
+import org.w3c.dom.Element;\r
+\r
+\r
+public class TizenTemplateProcess extends ProcessRunner{\r
+    public static final String MANIFEST_APP_ID = "manifestAppId";\r
+\r
+    @Override\r
+    public void process(TemplateCore template, ProcessArgument[] args,\r
+            String processId, IProgressMonitor monitor)\r
+            throws ProcessFailureException {\r
+        // TODO Auto-generated method stub\r
+        List<Process> processes = new ArrayList<Process>();\r
+\r
+        String id = null;\r
+        List<Element> processElement = null;\r
+        IPath samplePath = TizenTemplateProcessParser.getSelectedSampleLocationFromMainPage(TemplateTizenNewWizard.DIR_CPP);\r
+        \r
+        // just return if project is git project\r
+        if (samplePath == null) {\r
+               return;\r
+        }\r
+\r
+        TemplateDescriptor desc = TizenTemplateProcessParser.createTemplateDesc(samplePath.toFile());\r
+\r
+        Element root = desc.getRootElement();\r
+        processElement = TizenTemplateProcessParser.getElementsFromTag(root, TizenTemplateProcessParser.TAG_PROCESS);\r
+\r
+        int i = 0;\r
+        for(Element element: processElement) {\r
+            id = "No Condition" + "--> Process " + (i+1) + " (" + element.getAttribute(TizenTemplateProcessParser.TAG_TYPE) + ")";\r
+            processes.add(new Process(template, element, id));\r
+            i++;\r
+        }\r
+\r
+        // Pre-process for C++ specifics\r
+        /*\r
+        Map<String, String> valueStore = template.getValueStore();\r
+        // location=D:\works\runtime-EclipseApplication\r
+        // baseNameUpper=FORM3\r
+        // baseName=form3\r
+        // projectType=org.tizen.nativecpp.buildArtefactType.app\r
+        // baseNameLower=form3\r
+        // projectName=form3\r
+        // So, add $(manifestAppId) and set to generated appId for manifest.xml\r
+        String appId = "93bt1p123e";\r
+        try {\r
+            IXMLStore xmlStore = (IXMLStore)PluginUtil.loadClass(IXMLStore.EXSD_STORE_EXTENSION_POINT_ID, IXMLStore.EXSD_APP_XML_STORE_CLASS_ID);\r
+            appId = xmlStore.generateAppId();\r
+        } catch (CoreException e) {\r
+            Logger.error("Problem occurred while generating application id", e);\r
+        }\r
+        valueStore.put(MANIFEST_APP_ID, appId);\r
+        */\r
+\r
+        List<IStatus> statuses = new ArrayList<IStatus>(processes.size());\r
+        for(Process process : processes) {\r
+            try {\r
+                statuses.add(process.process(monitor));\r
+            } catch (ProcessFailureException e) {\r
+                throw new ProcessFailureException(e.getMessage(), e, statuses);\r
+            }\r
+        }\r
+\r
+        //makePackageModel(projName, projType);\r
+    }\r
+}\r
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/templateengine/process/SetDefaultBuildOptions.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/templateengine/process/SetDefaultBuildOptions.java
new file mode 100644 (file)
index 0000000..ddda2e2
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * 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.templateengine.process;
+
+import java.util.ArrayList;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
+import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
+import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.QualifiedName;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+
+public class SetDefaultBuildOptions extends ProcessRunner {
+       int i = 0;
+       ProcessArgument[][] optionArray;
+       public static QualifiedName DEFAULTFRAMEWORK_KEY = new QualifiedName("RegistDefaultFw", "RegistDefaultFw"); 
+       boolean alreadyRegist = false;
+       
+       @Override
+       public void process(TemplateCore template, ProcessArgument[] args,
+                       String processId, IProgressMonitor monitor)
+                       throws ProcessFailureException {
+               
+               String value = "";
+               // project name
+               String projectName = args[0].getSimpleValue();
+
+               try {                   
+                       IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);                              
+                       value = projectHandle.getPersistentProperty(DEFAULTFRAMEWORK_KEY);              
+               
+                       if (value == null) {
+                               projectHandle.setPersistentProperty(DEFAULTFRAMEWORK_KEY, "true");                                      
+                       } else if (value.equals("true")) {
+                               return;
+                       }                       
+               } catch (CoreException e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               }
+               IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+
+               // frameworks
+               ProcessArgument optionList = args[1];
+               optionArray = optionList.getComplexArrayValue();
+               
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( projectHandle ) ;
+               IConfiguration defaultConfig = info.getDefaultConfiguration();
+               
+               ArrayList<String> options = new ArrayList<String>();
+               for( ProcessArgument[] op: optionArray ) {
+                       options.add( op[0].getSimpleValue() );
+               }
+
+               for( IConfiguration config: defaultConfig.getManagedProject().getConfigurations() ) {                   
+                       PlatformConfigurationManager.setGBSOptions(config, options);                    
+               }
+               // Apply to project file
+               ManagedBuildManager.saveBuildInfo(projectHandle, true);
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/CommandLauncher.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/util/CommandLauncher.java
new file mode 100644 (file)
index 0000000..10e36f5
--- /dev/null
@@ -0,0 +1,437 @@
+/*
+ * 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.util;
+
+import static org.tizen.common.util.IOUtil.tryClose;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.reflect.Field;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.tizen.common.ui.view.console.ConsoleManager;
+import org.tizen.common.util.HostUtil;
+import org.tizen.nativeplatform.password.SudoPasswdManager;
+
+public class CommandLauncher {
+    public static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
+
+    public static boolean executeSudo(String command ) throws InterruptedException {
+       return executeSudo( command, null, null, null );
+    }
+
+    
+    public static boolean executeSudo(String command, String workingDir ) throws InterruptedException {
+       return executeSudo( command, workingDir, null, null );
+    }
+
+    
+    public static boolean executeSudo(String command, String workingDir, 
+               String consoleViewName, IProgressMonitor monitor ) throws InterruptedException {
+       
+       return executeSudo(command, workingDir, null, consoleViewName, monitor);
+    }
+    
+    public static boolean executeSudo(String command, String workingDir, Map<String, String> newEnv,
+               String consoleViewName, IProgressMonitor monitor ) throws InterruptedException {
+       
+       // generate script
+       String scriptCmd = genSudoExecuteScript(command);
+       if ( scriptCmd == null ) {
+               throw new InterruptedException("Generating execution script failed!");
+       }
+       
+       return execute(scriptCmd, workingDir, newEnv, consoleViewName, monitor );
+    }
+       
+
+    public static boolean execute(String command) throws InterruptedException {
+       return execute( command, null, null, null);
+    }
+    
+    public static boolean execute(String command, String workingDir, 
+               String consoleViewName, IProgressMonitor monitor ) throws InterruptedException {
+       return execute( command, workingDir, null, consoleViewName, monitor);
+    }
+    
+    
+    public static boolean execute(String command, String workingDir, Map<String, String> newEnv, 
+               String consoleViewName, IProgressMonitor monitor ) throws InterruptedException {
+       
+       // start process
+       Process proc = createProcess( command, workingDir, newEnv, false );
+        
+       // create monitor process
+       ProcessMonitorThread monitorThread = null;
+       if ( monitor != null ) {
+               monitorThread = new ProcessMonitorThread(proc, monitor);
+               monitorThread.start();
+       }
+        
+       // handle console
+       if( consoleViewName != null ) {
+               ConsoleManager cm = new ConsoleManager( consoleViewName, true );
+            cm.clear();
+            BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+            String line = null;
+            try {
+                               while((line=input.readLine())!=null){
+                                   cm.println(line);
+                               }
+                       } catch (IOException e) {
+                               // do nothing
+                               e.printStackTrace();
+                       }
+               finally{
+                       if ( input != null ) tryClose( input );
+            }
+       }
+       
+       // wait for process finish
+        proc.waitFor();
+        
+        // wait for monitor thread finish
+       if ( monitor != null ) {
+               monitorThread.join();
+               if ( monitor.isCanceled() ) {
+                       throw new InterruptedException("Command execution is canceled!");
+               }
+       }
+       
+        // abnormal termination
+        if (proc.exitValue() != 0) {
+               return false;
+        }
+        else {
+               return true;
+        }
+    }
+    
+    
+    public static Process createProcess(String command, String workingDir,
+               boolean includeStdErr ) throws InterruptedException {
+       // start process        
+               return createProcess(command, workingDir, null, includeStdErr);
+    }
+    
+    public static Process createProcess(String command, String workingDir,
+               Map<String, String> newEnv, boolean includeStdErr ) throws InterruptedException {
+       // start process
+        String[] fullCommand = HostUtil.getCommand(command);
+        ProcessBuilder pb = new ProcessBuilder();
+        pb.redirectErrorStream(includeStdErr);            
+        pb.command(fullCommand);        
+        if (newEnv != null) {
+               pb.environment().clear();
+               pb.environment().putAll(newEnv);
+        }
+        if(workingDir != null) {
+            pb.directory(new File(workingDir));
+        }
+        Process proc;
+               try {
+                       proc = pb.start();
+               } catch (IOException e) {
+                       throw new InterruptedException(String.format("Creating process failed! : %s => %s", command, e.getMessage()));
+               }
+               
+               return proc;
+    }
+               
+    
+    public static String executeSudoOutput(String command ) throws InterruptedException {
+       return executeSudoOutput( command, null, false, null );
+    }
+
+
+    public static String executeSudoOutput(String command, String workingDir,
+               boolean includeStdErr ) throws InterruptedException {
+       return executeSudoOutput( command, workingDir, includeStdErr, null );
+    }
+
+    
+    public static String executeSudoOutput(String command, String workingDir,
+               boolean includeStdErr, IProgressMonitor monitor ) throws InterruptedException {
+       
+       // generate script
+       String scriptCmd = genSudoExecuteScript(command);
+       if ( scriptCmd == null ) {
+               throw new InterruptedException("Generating execution script failed!");
+       }
+       
+       return executeOutput(scriptCmd, workingDir, includeStdErr, monitor );
+    }
+       
+    
+    public static String executeOutput(String command ) throws InterruptedException {
+       return executeOutput(command, null, false, null );
+    }
+    
+
+    public static String executeOutput(String command, String workingDir,
+               boolean includeStdErr, IProgressMonitor monitor) throws InterruptedException {
+       
+       // start process
+       Process proc = null;
+       BufferedReader input = null;
+       StringBuilder contents = null;
+       try {
+               proc = createProcess( command, workingDir, includeStdErr );
+               
+               // create monitor process
+               ProcessMonitorThread monitorThread = null;
+               if ( monitor != null ) {
+                       monitorThread = new ProcessMonitorThread(proc, monitor);
+                       monitorThread.start();
+               }
+               
+               contents = new StringBuilder();
+               input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+               String line = null;
+               while((line=input.readLine())!=null){
+                   contents.append(line);
+                   contents.append(LINE_SEPARATOR);
+               }
+       
+               // wait for process finish
+               proc.waitFor();
+
+               // wait for monitor thread finish
+               if ( monitor != null ) {
+                       monitorThread.join();
+                       if ( monitor.isCanceled() ) {
+                               throw new InterruptedException("Command execution is canceled!");
+                       }
+               }
+       } catch (IOException e) {
+               throw new InterruptedException("Reading process standard output failed!");
+               }
+       finally{
+               if ( input != null ) tryClose( input );
+        }
+        
+        return contents.toString().trim();
+    }
+
+    
+       // return generate script and return script path
+       private static String genSudoExecuteScript(String command) {
+               String passwd = SudoPasswdManager.getSudoPassword();
+               File shellScript = null;
+               
+               try {
+                       // create expect script file
+                       File expectScript = new File("/tmp/run_sudo.exp");
+                       expectScript.createNewFile();
+                       BufferedWriter bw = new BufferedWriter(new FileWriter(expectScript));
+                       bw.write("#!/usr/bin/expect --");bw.newLine();
+                       bw.write(String.format("spawn sh -c \"%s;echo \\$? > /tmp/exit-status\"",command));bw.newLine();
+                       bw.write("while (1) {");bw.newLine();
+                       bw.write("  expect {");bw.newLine();
+                       bw.write("    \"password for\" {");bw.newLine();
+                       bw.write(String.format("send \"%s\\r\"", passwd));bw.newLine();
+                       bw.write("    }");bw.newLine();
+                       bw.write("    eof {");bw.newLine();
+                       bw.write("      return");bw.newLine();
+                       bw.write("    }");bw.newLine();
+                       bw.write("  }");bw.newLine();
+                       bw.write("}");bw.newLine();
+                       bw.close();
+                       expectScript.setExecutable(true);
+                       
+                       shellScript = new File("/tmp/run_sudo.sh");
+                       shellScript.createNewFile();
+                       bw = new BufferedWriter(new FileWriter(shellScript));
+                       bw.write("#!/bin/sh -ee");bw.newLine();
+                       bw.write("/tmp/run_sudo.exp");bw.newLine();
+                       bw.write("EXIT_CODE=`cat /tmp/exit-status`");bw.newLine();
+                       bw.write("if [ \"$EXIT_CODE\" != \"0\" ]; then");bw.newLine();
+                       bw.write(" echo \"EXIT CODE=${EXIT_CODE}\" >&2");bw.newLine();
+                       bw.write(" exit 1");bw.newLine();
+                       bw.write("fi");bw.newLine();
+                       bw.close();
+                       shellScript.setExecutable(true);
+               }
+               catch (IOException e ) {
+                       return null;
+               }
+               
+               // execute script
+               return shellScript.getPath();
+       }
+               
+       
+       // return generate script and return script path
+       private static String genSudoKillProcessScript(Process process) {
+               String passwd = SudoPasswdManager.getSudoPassword();
+               File shellScript = null;
+
+               try {
+                       // get process id
+                       Field f = process.getClass().getDeclaredField("pid");
+                       f.setAccessible(true);
+                       String pid = f.get(process).toString();                                                         
+
+                       // create killtree script file
+                       File killScript = new File("/tmp/killtree.sh");
+                       killScript.createNewFile();
+                       BufferedWriter bw = new BufferedWriter(new FileWriter(killScript));
+                       bw.write("#!/bin/sh");bw.newLine();
+                       bw.write("killtree() {");bw.newLine();
+                       bw.write("  local _pid=$1");bw.newLine();
+                       bw.write("  sudo kill -STOP ${_pid}");bw.newLine();
+                       bw.write("  for _child in $(ps -o pid --no-headers --ppid ${_pid}); do");bw.newLine();
+                       bw.write("    killtree ${_child}");bw.newLine();
+                       bw.write("  done");bw.newLine();
+                       bw.write("  sudo kill -KILL ${_pid}");bw.newLine();
+                       bw.write("}");bw.newLine();
+                       bw.write("killtree $1");bw.newLine();
+                       bw.close();
+                       killScript.setExecutable(true);
+
+                       // create expect script file
+                       File expectScript = new File("/tmp/run_sudo2.exp");
+                       expectScript.createNewFile();
+                       bw = new BufferedWriter(new FileWriter(expectScript));
+                       bw.write("#!/usr/bin/expect --");bw.newLine();
+                       bw.write(String.format("spawn sh -c \"/tmp/killtree.sh %s\"",pid ));bw.newLine();
+                       bw.write("while (1) {");bw.newLine();
+                       bw.write("  expect {");bw.newLine();
+                       bw.write("    \"password for\" {");bw.newLine();
+                       bw.write(String.format("send \"%s\\r\"", passwd));bw.newLine();
+                       bw.write("    }");bw.newLine();
+                       bw.write("    eof {");bw.newLine();
+                       bw.write("      return");bw.newLine();
+                       bw.write("    }");bw.newLine();
+                       bw.write("  }");bw.newLine();
+                       bw.write("}");bw.newLine();
+                       bw.close();
+                       expectScript.setExecutable(true);
+                       
+                       shellScript = new File("/tmp/run_sudo2.sh");
+                       shellScript.createNewFile();
+                       bw = new BufferedWriter(new FileWriter(shellScript));
+                       bw.write("#!/bin/sh -ee");bw.newLine();
+                       bw.write("/tmp/run_sudo2.exp");bw.newLine();
+                       bw.close();
+                       shellScript.setExecutable(true);
+
+                       return shellScript.getPath();
+               } catch (SecurityException e) {
+                       return null;
+               } catch (NoSuchFieldException e) {
+                       return null;
+               } catch (IllegalArgumentException e) {
+                       return null;
+               } catch (IllegalAccessException e) {
+                       return null;
+               } catch (IOException e ) {
+                       return null;
+               }
+       }
+       
+       // generate interrupt script for platform debugging and return script path
+       public static String genDebugginInterruptScript(Process process) {
+               String passwd = SudoPasswdManager.getSudoPassword();
+
+               try {
+                       // get process id
+                       Field f = process.getClass().getDeclaredField("pid");
+                       f.setAccessible(true);
+                       String pid = f.get(process).toString();                                                         
+
+                       // create interrupt script file
+                       File interruptScript = new File("/tmp/interruptProc.sh");
+                       interruptScript.createNewFile();
+                       BufferedWriter bw = new BufferedWriter(new FileWriter(interruptScript));
+                       bw.write("#!/bin/sh");bw.newLine();
+                       bw.write("proctree() {");bw.newLine();
+                       bw.write("  local _pid=$1");bw.newLine();                       
+                       bw.write("  for _child in $(ps -o pid --no-headers --ppid ${_pid}); do");bw.newLine();
+                       bw.write("    proctree ${_child}");bw.newLine();
+                       bw.write("  done");bw.newLine();
+                       bw.write("  user=`ps -o user --no-headers --pid ${_pid}`");bw.newLine();
+                       bw.write("  if [ \"x${user}\" = \"xroot\" ]; then");bw.newLine();
+                       bw.write(String.format("    echo \"%s\" | sudo -S kill -SIGINT ${_pid}", passwd));bw.newLine();
+                       bw.write("    exit 0");bw.newLine();
+                       bw.write("  fi");bw.newLine();                                          
+                       bw.write("}");bw.newLine();
+                       bw.write(String.format("proctree %s", pid));bw.newLine();
+                       bw.write("exit -1");bw.newLine();
+                       bw.close();
+                       interruptScript.setExecutable(true);
+                       
+                       return interruptScript.getPath();
+               } catch (SecurityException e) {
+                       return null;
+               } catch (NoSuchFieldException e) {
+                       return null;
+               } catch (IllegalArgumentException e) {
+                       return null;
+               } catch (IllegalAccessException e) {
+                       return null;
+               } catch (IOException e ) {
+                       return null;
+               }
+       }
+       
+       
+       static class ProcessMonitorThread extends Thread {
+               private Process process;
+               private IProgressMonitor monitor;
+               public ProcessMonitorThread(Process process, IProgressMonitor monitor) {
+                       this.process = process;
+                       this.monitor = monitor;
+               }
+
+               
+               public void run() {
+                       boolean sendSignal = false;
+                       while( true ) {
+                               try {
+                                       Thread.sleep(1000); // wait 1 sec
+                                       if ( !sendSignal && monitor.isCanceled() ) {
+                                               String killCmd = genSudoKillProcessScript( process );
+                                               Process killProcess = createProcess( killCmd, null, false );
+                                               killProcess.waitFor();
+                                               sendSignal = true;
+                                       }
+                                       break;
+                               }
+                               catch(InterruptedException e) {
+                                       continue;
+                               }
+                       }
+               }
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/Architecture.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/Architecture.java
new file mode 100644 (file)
index 0000000..202f25b
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * 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.views.model;
+
+import java.util.ArrayList;
+
+public class Architecture implements ICheckTreeItem {
+       private String name;
+       private ArrayList<ICheckTreeItem> repos = new ArrayList<ICheckTreeItem>();
+       private boolean checked;
+       
+       public Architecture(String name) {
+               this.name = name;               
+       }
+       
+       public Architecture(String name, ArrayList<ICheckTreeItem> repos) {
+               this.name = name;
+               this.repos = repos;
+       }
+       
+       public String getName() {
+               return name;
+       }
+       
+       public void setSnapshots(ArrayList<ICheckTreeItem> s) {
+               this.repos = s;
+       }
+       
+       public ArrayList<ICheckTreeItem> getChildren() {
+               return repos; 
+       }
+       
+       public boolean hasChildren() {
+               return !repos.isEmpty();
+       }
+       
+       public boolean isChecked() {
+               return checked;
+       }
+       
+       public void setChecked(boolean isChecked) {
+               checked = isChecked;
+               if (hasChildren()) {
+                       for (ICheckTreeItem item : getChildren()) {
+                               item.setChecked(isChecked);
+                       }
+               }
+       }
+
+       @Override
+       public boolean isGrayed() {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public String getText() {
+               return name;
+       }
+        
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/ICheckTreeItem.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/ICheckTreeItem.java
new file mode 100644 (file)
index 0000000..32217a9
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.views.model;
+
+import java.util.ArrayList;
+
+public interface ICheckTreeItem {
+       public boolean isChecked();
+       public boolean isGrayed();
+       public String getText();
+       public void setChecked(boolean isChecked);      
+       public ArrayList<ICheckTreeItem> getChildren();
+       public boolean hasChildren();
+       
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/PlatformRootstrap.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/PlatformRootstrap.java
new file mode 100644 (file)
index 0000000..9ece06a
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * 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.views.model;
+
+import java.util.ArrayList;
+import org.eclipse.core.runtime.Path;
+import org.tizen.nativecommon.build.model.Rootstrap;
+
+public class PlatformRootstrap extends Rootstrap implements ICheckTreeItem {
+       private String http_proxy;
+       private boolean checked;
+       private boolean initialized;
+       private ArrayList<String> reposURLs;
+       public static final String SUPPORTED_TOOLCHAIN_TYPE = "tizen.obs";
+       public static final String DEFAULT_ROOTSTRAP_ARM_ID = "tizen-device-2.0.platform";
+       public static final String DEFAULT_ROOTSTRAP_I386_ID = "tizen-emulator-2.0.platform";
+       private static final String VERSION = "1.0";
+
+       public PlatformRootstrap(String id, String name, String arch, String rootstrapPath,
+                       ArrayList<String> reposURLs, boolean initialized) {
+               super(id, name, SUPPORTED_TOOLCHAIN_TYPE, VERSION, arch, new Path(rootstrapPath));
+               this.reposURLs = reposURLs;
+               this.initialized = initialized;
+       }
+       
+       
+       public String getText() {
+               return name;
+       }       
+       
+       public String getProxy() {
+               return http_proxy;
+       }
+       
+       public boolean isChecked() {
+               return checked;
+       }
+
+       public void setChecked(boolean isChecked) {
+               checked = isChecked;
+       }
+
+       public void setInitialized(boolean isInitialized) {
+               this.initialized = isInitialized;
+       }
+
+       public boolean isInitialized() {
+               return initialized;
+       }
+
+       public ArrayList<String> getRepositoryURLs() {
+               return reposURLs;
+       }
+       
+       public void addRepositoryURL( String url ) {
+               reposURLs.add( url );
+       }
+
+       public void changeRepositoryURL( String fromURL, String toURL ) {
+               for( int i = 0; i < reposURLs.size(); i++ ) {
+                       String url = reposURLs.get(i);
+                       if ( url.equals(fromURL) ) {
+                               reposURLs.set(i, toURL);
+                               return;
+                       }
+               }
+               return;
+       }
+       
+       
+       public void removeRepositoryURL( String url ) {
+               reposURLs.remove(url);
+       }
+       
+       
+       @Override
+       public boolean isGrayed() {
+               return false;
+       }
+
+       @Override
+       public ArrayList<ICheckTreeItem> getChildren() {
+               return null;
+       }
+
+       @Override
+       public boolean hasChildren() {
+               return false;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/Snapshot.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/model/Snapshot.java
new file mode 100644 (file)
index 0000000..b77168a
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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.views.model;
+
+import java.util.ArrayList;
+
+import org.tizen.nativeplatform.views.model.ICheckTreeItem;
+
+public class Snapshot implements ICheckTreeItem {
+       private String url;
+       private boolean checked;
+       
+       public Snapshot(String url) {
+               this.url = url;
+       }
+       
+       public String getAddr() {
+               return url.toString();
+       }
+
+       public boolean isChecked() {
+               return checked;
+       }
+
+       public void setChecked(boolean isChecked) {
+               checked = isChecked;            
+       }
+
+       @Override
+       public boolean isGrayed() {
+               return false;
+       }
+
+       @Override
+       public String getText() {       
+               return url;
+       }
+
+       @Override
+       public ArrayList<ICheckTreeItem> getChildren() {
+               return null;
+       }
+
+       @Override
+       public boolean hasChildren() {
+               return false;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/provider/RootstrapContentProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/provider/RootstrapContentProvider.java
new file mode 100644 (file)
index 0000000..ca4f4b5
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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.views.provider;
+
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.tizen.nativeplatform.views.model.ICheckTreeItem;
+
+
+public class RootstrapContentProvider extends ArrayContentProvider implements ITreeContentProvider {
+
+       @Override
+       public Object[] getChildren(Object parentElement) {
+               if (parentElement instanceof ICheckTreeItem) {
+                       ICheckTreeItem parent = (ICheckTreeItem) parentElement;
+                       return parent.getChildren().toArray();
+               } else {
+                       return null;
+               }
+       }
+
+       @Override
+       public Object getParent(Object element) {               
+               return null;
+       }
+
+       @Override
+       public boolean hasChildren(Object element) {
+               if (element instanceof ICheckTreeItem) {
+                       ICheckTreeItem item = (ICheckTreeItem) element;
+                       return item.hasChildren();
+               } else {
+                       return false;
+               }
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/provider/RootstrapLabelProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/provider/RootstrapLabelProvider.java
new file mode 100644 (file)
index 0000000..cf4a52c
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.views.provider;
+
+import org.eclipse.jface.viewers.LabelProvider;
+
+import org.tizen.nativeplatform.views.model.ICheckTreeItem;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+
+
+public class RootstrapLabelProvider extends LabelProvider {
+       public String getText(Object element) {
+               if (element instanceof PlatformRootstrap) {                     
+                       PlatformRootstrap item = (PlatformRootstrap) element;
+                       return "[" + item.getArch() + "] " + item.getText();
+                       
+               }
+               if (element instanceof ICheckTreeItem) {
+                       ICheckTreeItem item = (ICheckTreeItem) element;
+                       return item.getText();
+               } else {
+                       return null;
+               }
+       }
+       
+}
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/AddRootstrapDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/AddRootstrapDialog.java
new file mode 100644 (file)
index 0000000..ae4ad84
--- /dev/null
@@ -0,0 +1,426 @@
+/*
+ * 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.views.ui;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.ResourceBundle;
+
+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.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.SWTUtil;
+import org.tizen.nativeplatform.rootstrap.SnapshotURLParser;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+import org.tizen.nativeplatform.views.model.ICheckTreeItem;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+
+public class AddRootstrapDialog extends Dialog {
+       
+       private Text rootstrapText;
+       private Text snapshotUrlText;
+       private TableViewer reposURLViewer;
+       private Combo archCombo;
+       private Button generateImmediateBt;
+
+       ArrayList<ICheckTreeItem> snapshotInfos;
+       private PlatformRootstrap generatedRootstrap;
+       private String rootstrapName;
+       private String architecture;
+       private ArrayList<String> repositoryURLs;
+       boolean isImmediateGenerateChecked;
+       
+       private final static int COL_REPOS_NAME = 0;
+       private final static int COL_REPOS_URL = 1;
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 800;
+       private final int height = 550;
+       private Shell shell;
+       
+       private final String BUNDLE_NAME = AddRootstrapDialog.class.getPackage().getName() + ".RootstrapUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       public AddRootstrapDialog(Shell parentShell) {
+               super(parentShell);             
+               this.shell = parentShell;
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+       }
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);         
+               
+               newShell.setText(resources.getString("GenRootDlg.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_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+               composite.setLayout(new GridLayout(1, false));       
+
+        createRootstrapNameComposite(composite);        
+        createSelectSnapshotComposite(composite);       
+        createSettingRepoComposite(composite);
+        
+        createGenButtonComposite(composite);        
+               return null;
+       }
+       
+       private void createRootstrapNameComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(2, false));
+
+        Label nameLabel = new Label(composite, SWT.NONE);
+        nameLabel.setText(resources.getString("GenRootDlg.Label.Rootstrapname"));
+        rootstrapText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.SEARCH);
+        GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.minimumHeight = 0;
+               rootstrapText.setLayoutData(gridData);
+       }
+
+       
+       private void createGenButtonComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(1, false));
+
+               generateImmediateBt = new Button(composite, SWT.CHECK);
+               generateImmediateBt.setText(resources.getString("GenRootDlg.Button.GenImmedate"));
+               GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING);
+        generateImmediateBt.setLayoutData(gridData);       
+       }
+       
+       
+       private void createSelectSnapshotComposite(Composite parent) {
+               
+               Group group = new Group(parent, SWT.NONE);
+               group.setLayout(new GridLayout(1, false));
+               group.setText(resources.getString("GenRootDlg.Group.Snapshot"));
+               GridData gridData = new GridData(GridData.FILL_BOTH);
+               group.setLayoutData(gridData);
+               
+               createSnapshotUrlComposite(group);
+               createArchitectureComposite(group);
+       }
+
+       
+       private void createSettingRepoComposite(Composite parent) {
+               
+               Group group = new Group(parent, SWT.NONE);
+               group.setLayout(new GridLayout(1, false));
+               group.setText(resources.getString("GenRootDlg.Group.Repos"));
+               GridData gridData = new GridData(GridData.FILL_BOTH);
+               group.setLayoutData(gridData);
+               
+               createTreeViewer(group);                
+       }
+       
+       
+       private void createSnapshotUrlComposite(Composite parent) {
+               Composite snapshotComp = new Composite(parent, SWT.NONE);
+               snapshotComp.setLayout(new GridLayout(3, false));
+               GridData gridData = new GridData(GridData.FILL_BOTH);
+               snapshotComp.setLayoutData(gridData);
+               
+               Label snapshotLabel = new Label(snapshotComp, SWT.NONE);
+        gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.widthHint = 100;
+               snapshotLabel.setLayoutData(gridData);
+               snapshotLabel.setAlignment(SWT.RIGHT);
+               snapshotLabel.setText(resources.getString("GenRootDlg.Label.SnapshotURL"));
+               
+               snapshotUrlText = new Text(snapshotComp, SWT.SINGLE | SWT.BORDER);
+               gridData = new GridData(GridData.FILL_HORIZONTAL);
+               snapshotUrlText.setLayoutData(gridData);
+               
+               Button searchBt = new Button(snapshotComp, SWT.PUSH);
+               searchBt.setText(resources.getString("GenRootDlg.Button.Search"));
+               
+               searchBt.addMouseListener(new MouseListener() {
+
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {                    
+                       }
+
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               
+                               final String snapshotUrl = snapshotUrlText.getText().trim();
+                               
+                               if (snapshotUrl.isEmpty()) {
+                                       DialogUtil.openErrorDialog(resources.getString("GenRootDlg.Error.Empty.Snapshot"));
+                                       return;
+                               }
+                               
+                               ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+                               try {
+                                       dialog.run(true, true, new IRunnableWithProgress() {
+                                               @Override
+                                               public void run(IProgressMonitor monitor) throws InvocationTargetException,
+                                                       InterruptedException {
+                                                       monitor.beginTask(resources.getString("GenRootDlg.Progress.Msg.Searching"), -1);
+                                                       try {
+                                                               final SnapshotURLParser c = new SnapshotURLParser();                    
+                                                               snapshotInfos = null;
+                                                               snapshotInfos = c.parse(snapshotUrl);
+                                                       } catch (final IOException e) {
+                                                               e.printStackTrace();
+                                                               SWTUtil.getDisplay().asyncExec( new Runnable() {
+                                                       @Override
+                                                       public void run() {
+                                                               DialogUtil.openErrorDialog(
+                                                                               resources.getString("GenRootDlg.Error.Snapshot.Failed")+
+                                                                               "("+e.toString()+")");
+                                                       }
+                                                   });
+                                                       }
+                                               }
+                                       });
+                               } catch (InvocationTargetException e1) {
+                                       e1.printStackTrace();
+                                       DialogUtil.openErrorDialog(e.toString());
+                                       return;
+                               } catch (InterruptedException e1) {
+                                       e1.printStackTrace();
+                                       DialogUtil.openErrorDialog(e.toString());
+                                       return;
+                               }                                       
+                               
+                               archCombo.removeAll();
+                               if (snapshotInfos == null || snapshotInfos.size() == 0 ) {
+                                       UpdateRepositoryURL();
+                                       return;
+                               }
+                               
+                               // add architecture list
+                               for ( ICheckTreeItem item: snapshotInfos ) {
+                                       archCombo.add(item.getText());
+                               }
+                               archCombo.setEnabled(true);
+                               archCombo.select(0);
+
+                               // Update repository table
+                               UpdateRepositoryURL();
+                       }
+
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                       }
+               
+               });
+       }
+       
+       
+       private void createArchitectureComposite(Composite parent) {
+               Composite composite = new Composite(parent, SWT.NONE);
+               composite.setLayout(new GridLayout(2, false));
+               GridData gridData = new GridData(GridData.FILL_BOTH);
+               composite.setLayoutData(gridData);
+
+               Label archLabel = new Label(composite, SWT.NONE);
+        gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.widthHint = 100;
+               archLabel.setLayoutData(gridData);
+               archLabel.setAlignment(SWT.RIGHT);
+        archLabel.setText(resources.getString("GenRootDlg.Label.Architecture"));
+
+        archCombo = new Combo(composite, SWT.READ_ONLY);
+        gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+               gridData.minimumHeight = 0;
+               archCombo.setLayoutData(gridData);
+               archCombo.addSelectionListener( new SelectionListener(){
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               UpdateRepositoryURL();
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                       }
+               
+        });
+               archCombo.setEnabled(false);
+       }
+       
+       
+       private void UpdateRepositoryURL() {
+               int selectIdx = archCombo.getSelectionIndex();
+               // show repository URLs
+               ArrayList<String> data = new ArrayList<String>();
+               if ( selectIdx >= 0 ) {
+                       ArrayList<ICheckTreeItem> children = snapshotInfos.get(selectIdx).getChildren();
+                       for ( int idx = 0; idx < children.size(); idx++ ) {
+                               data.add(String.format("url%d|%s", idx, children.get(idx).getText() ) );
+                       }
+               }
+               reposURLViewer.setInput(data);
+       }
+
+       
+    private void createTreeViewer(Composite parent) {
+       
+       reposURLViewer = new TableViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+        Table table = reposURLViewer.getTable();
+       table.setHeaderVisible(true);
+       table.setLinesVisible(true);    
+               
+       reposURLViewer.setLabelProvider(new TableViewerProvider());             
+       reposURLViewer.setContentProvider(new ArrayContentProvider());
+               
+        TableColumn column = new TableColumn(table, SWT.NONE);        
+        column.setResizable(true);
+        column.setText(resources.getString("GenRootDlg.Tree.Column.Name"));
+        column.setWidth(50);        
+        
+        column = new TableColumn(table, SWT.NONE);        
+        column.setResizable(true);
+        column.setText(resources.getString("GenRootDlg.Tree.Column.URL"));
+        column.setWidth(300);
+        
+        GridData tableGridData = new GridData(GridData.FILL_HORIZONTAL|GridData.VERTICAL_ALIGN_BEGINNING);
+        tableGridData.heightHint = 200;
+        table.setLayoutData(tableGridData);     
+        
+        reposURLViewer.setInput(new ArrayList<ICheckTreeItem>());
+    }
+       
+
+       @Override
+       protected void okPressed() {
+               rootstrapName = rootstrapText.getText().trim();
+               if (rootstrapName.isEmpty()) {
+                       DialogUtil.openErrorDialog(resources.getString("GenRootDlg.Error.Empty.Rootstrap"));
+                       return;
+               }
+               if ( RootstrapManager.getRootstrap(rootstrapName ) != null ) {
+                       DialogUtil.openErrorDialog("Rootstrap name ["+rootstrapName+"] already exists!");
+                       return;
+               }
+               architecture = archCombo.getText().trim();
+               repositoryURLs = new ArrayList<String>();
+               for ( TableItem item: reposURLViewer.getTable().getItems() ) {
+                       repositoryURLs.add(item.getText(COL_REPOS_URL));
+               }
+               
+               if (repositoryURLs.isEmpty()) {
+                       DialogUtil.openErrorDialog(
+                               resources.getString("GenRootDlg.Error.NoAnyRepos"));
+                       return;
+               }
+               
+               isImmediateGenerateChecked = generateImmediateBt.getSelection();
+               super.okPressed();
+       }
+
+       
+       public PlatformRootstrap getGeneratedRootstrap() {
+               return generatedRootstrap;
+       }
+       
+       
+       public String getRootstrapName() {
+               return rootstrapName;
+       }
+               
+       
+       
+       public String getArchitecture() {
+               return architecture;
+       }
+       
+       
+       public ArrayList<String> getRepositoryURLs() {
+               return repositoryURLs;
+       }
+        
+       public boolean isImmediateGenerateChecked() {
+               return isImmediateGenerateChecked;
+       }
+       
+       
+       private class TableViewerProvider extends LabelProvider implements ITableLabelProvider 
+       {
+               @Override
+               public Image getColumnImage(Object element, int columnIndex) {
+                       return null;
+               }
+
+               @Override
+               public String getColumnText(Object element, int columnIndex) {
+                       String strData = (String)element;
+                       
+                       switch(columnIndex) {
+                       case COL_REPOS_NAME:
+                               return strData.split("[|]")[COL_REPOS_NAME];
+                       case COL_REPOS_URL:
+                               return strData.split("[|]")[COL_REPOS_URL];
+                       default:
+                               return "";
+                       }
+               }
+       }
+
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapUIMessages.properties
new file mode 100644 (file)
index 0000000..95c8c15
--- /dev/null
@@ -0,0 +1,60 @@
+View.Add.Rootstrap.ToolTip = Create New Rootstrap
+View.Import.Rootstrap.ToolTip = Import Rootstrap
+
+View.Error.Init.SBIModel = Failed to initialize SBI model
+
+View.Table.Column.Rootstrap = Rootstrap Name
+View.Table.Column.Arch = Arch
+
+View.Description.Label = Description
+
+View.Contextmenu.Title = Rootstrap Context Menu
+View.Contextmenu.Select = Select
+View.Contextmenu.Manage = Manage Packages
+View.Contextmenu.Remove = Remove
+View.Contextmenu.Export = Export
+
+GenRootDlg.Title = Generate Rootstrap Dialog
+GenRootDlg.Label.Rootstrapname = Rootstrap Name :
+
+GenRootDlg.Group.Snapshot = Snapshot
+GenRootDlg.Label.SnapshotURL = Snapshot URL :
+GenRootDlg.Button.Search = Search
+GenRootDlg.Label.Architecture = Architecture :
+
+GenRootDlg.Group.Repos = Repository URL
+GenRootDlg.Tree.Column.Name = Name
+GenRootDlg.Tree.Column.URL = Repository URL
+
+GenRootDlg.Button.GenImmedate = Generate Immediately
+
+GenRootDlg.Progress.Msg.Generating = Generating rootstrap...
+GenRootDlg.Progress.Msg.Searching = Seaching repositories
+GenRootDlg.Error.Fail.Generate = Failed to generate rootstrap!
+GenRootDlg.Error.Empty.Snapshot = Snapshot URL is empty
+GenRootDlg.Error.Empty.Rootstrap = Rootstrap is empty
+GenRootDlg.Error.Snapshot.Failed = Getting snapshot information failed!\n
+GenRootDlg.Error.Gen.Rootstrap.Failed = Generating rootstrap failed!!\n
+GenRootDlg.Error.NoAnyRepos = There is no any repositories!
+
+SelectRootDlg.Title = Warning
+SelectRootDlg.Msg.LastOne = "%s [%s]" rootstrap is the last one. You can not remove it
+SelectRootDlg.Label.Desc = Follow projects use "%s" rootstrap.\nYou should set other rootstraps if you want to remove "%s" rootstrap
+
+Action.Msg.Error.SelectRootstrap = The "%s" rootstrap can not be selected at "%s" configuration because of architecture mismatch.
+Action.Msg.Error.RemoveDefault = Cannot remove basic rootstrap!  
+Action.Msg.Progress.Exporting = Exporting rootstrap...
+Action.Msg.Error.ExportUninitialzed = Cannot export uninitialized rootstrap!  
+Action.Msg.Info.ExportOK = Exporting rootstrap is successful!
+Action.Msg.Error.ExportFailed = Exporting rootstrap failed!  
+Action.Msg.Question.NotInit = This rootstrap is not initialize. Will you initialize it?
+Action.Msg.Progress.Importing = Importing rootstrap...
+Action.Msg.Info.ImportOK = Importing rootstrap is successful!
+Action.Msg.Error.ImportFailed = Importing rootstrap failed!
+Action.Msg.Progress.Initializing.PkgMgr = Initializing Package Manager...
+Action.Msg.Error.InitFailed.PkgMgr =  Initializing Package Manager failed!
+Action.Msg.Progress.Removing = Removing rootstrap...
+Action.Msg.Error.RemoveFailed = Removing rootstrap failed!
+
+FileDlg.Title.Export = Export rootstrap
+FileDlg.Title.Import = Import rootstrap
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java
new file mode 100644 (file)
index 0000000..91e298d
--- /dev/null
@@ -0,0 +1,965 @@
+/*
+ * 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.views.ui;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent;
+import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+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.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISizeProvider;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextService;
+import org.eclipse.ui.part.ViewPart;
+import org.tizen.common.TizenHelpContextIds;
+import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.ImageUtil;
+
+import org.tizen.nativecommon.ProjectUtil;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativecommon.build.exception.SBIException;
+import org.tizen.nativeplatform.Activator;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.pkgmgr.ui.RPMPackageDialog;
+import org.tizen.nativeplatform.rootstrap.IRootstrapChangedListener;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+import org.tizen.nativeplatform.rootstrap.RootstrapManager;
+
+public class RootstrapView extends ViewPart {
+       
+       private ToolBar toolBar;
+       private TableViewer tableViewer;
+       private final int COL_IDX_ROOTNAME = 0;
+       private final int COL_IDX_ARCH = 1;
+       private Text rootDescText;
+       
+       private Action actionSetDefault;
+       private Action actionPkgMgr;
+       private Action actionRemove;
+       private Action actionExport;
+       private MenuManager menuMgr;
+       
+       private PlatformRootstrap generatedRootstrap;
+       private final int MINIMUM_VIEW_WIDTH = 300;
+
+       private IProject project;
+       private Shell shell;
+       
+       private static final String PLATFORM_PERSPECTIVE_ID = "org.tizen.nativeplatform.perspective";
+       
+       private final String BUNDLE_NAME = AddRootstrapDialog.class.getPackage().getName() + ".RootstrapUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+       
+    private IRootstrapChangedListener cListener = new IRootstrapChangedListener()
+    {
+               @Override
+               public void rootstrapChanged() {
+                       Display.getDefault().syncExec(new Runnable() {
+
+                               @Override
+                               public void run() {
+                                       tableViewer.refresh();  
+                               }
+                       });
+               }
+
+               @Override
+               public void selectionChanged(String rootName) {
+                       
+               }
+    };
+    
+    private ICProjectDescriptionListener prjListner = new ICProjectDescriptionListener()
+    {
+
+        @Override
+        public void handleEvent(CProjectDescriptionEvent event)
+        {
+            final String appliedConfigName = event.getAppliedCProjectDescription()
+                    .getActiveConfiguration().getName();
+            
+            project = event.getProject();              
+            if (project != null) {
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+               IConfiguration config = info.getDefaultConfiguration();
+               IManagedProject managedProject =  config.getManagedProject();
+               
+               String projectArtifactType = managedProject.getProjectType() != null ? 
+                                       managedProject.getProjectType().getBuildArtefactType().getId() : null;          
+                       if ( projectArtifactType != null &&
+                               (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE))) {
+                               return;
+                       }
+                       
+               for (IConfiguration c : managedProject.getConfigurations()) {
+                       if (c.getName().equals(appliedConfigName)) {
+                               config = c;
+                               break;
+                       }
+               }
+               String targetId = PlatformConfigurationManager.getBuildTargetName(config);
+               if (targetId == null) {
+                       RootstrapManager.resetSelectedRootstrap();
+                       return;
+               }
+               SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+               String rootId = sbi.getRootstrapIDFromTargetID(targetId);
+               RootstrapManager.setSelectedRootstrap(rootId);
+               RootstrapManager.notifyChangedRootstrap();              
+            } else {
+               RootstrapManager.resetSelectedRootstrap();
+            }
+               
+        }
+    };
+    
+    private ISelectionListener listener = new ISelectionListener()
+    {
+
+        @Override
+        public void selectionChanged(IWorkbenchPart sourcepart, ISelection selection)
+        {
+            String perspectiveID = sourcepart.getSite().getPage().getPerspective().getId();
+            if (!perspectiveID.equals(PLATFORM_PERSPECTIVE_ID)) {
+                return;
+            }
+
+            if (!("Project Explorer".equals(sourcepart.getTitle())
+                    || "Navigator".equals(sourcepart.getTitle()) || sourcepart instanceof IEditorPart)) {
+                return;
+            }
+
+            project = ProjectUtil.getProject(sourcepart, selection);
+
+            if (project != null) {     
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+               IConfiguration config = info.getDefaultConfiguration();
+               String targetId = PlatformConfigurationManager.getBuildTargetName(config);
+               SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+               String rootId = sbi.getRootstrapIDFromTargetID(targetId);
+               RootstrapManager.setSelectedRootstrap(rootId);
+               RootstrapManager.notifyChangedRootstrap();              
+            } else {
+               RootstrapManager.resetSelectedRootstrap();
+            }
+        }
+    };
+
+       
+       @Override
+       public void createPartControl(Composite parent) {
+               
+               shell = this.getViewSite().getShell();
+               
+               RootstrapManager.addListener(cListener);
+        CoreModel.getDefault().addCProjectDescriptionListener(prjListner,
+                CProjectDescriptionEvent.DATA_APPLIED);
+        
+        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addSelectionListener(listener);
+               PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, TizenHelpContextIds.HELP_COMMON_CONNECTION_EXPLORER_CONTEXT);
+        GridLayout layout = new GridLayout(1,false);
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        parent.setLayout(layout);
+
+        createToolBar(parent);
+        createRootstrapTableComposite(parent);
+        createRootstrapDescComposite(parent);
+        
+        makeActions();
+        activateContext();
+        initContextMenu();
+
+       }
+
+       
+       // This override is for change the default/minimum size of Rootstrap view
+       @SuppressWarnings("rawtypes")
+       @Override
+       public Object getAdapter(Class adapter) {
+           if (ISizeProvider.class == adapter) {
+               return new ISizeProvider() {
+                   public int getSizeFlags(boolean width) {
+                       return SWT.MIN | SWT.MAX | SWT.FILL;
+                   }
+
+                   public int computePreferredSize(boolean width, int availableParallel, int availablePerpendicular, int preferredResult) {
+                       return width ? MINIMUM_VIEW_WIDTH : preferredResult;
+                   }
+               };
+           }
+               return super.getAdapter(adapter);
+       }
+
+       
+       @Override
+       public void setFocus() {
+       }
+       
+    private void createToolBar(Composite composite)
+    {
+       toolBar = new ToolBar(composite, SWT.NULL);     
+        GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
+        toolBar.setLayoutData(gridData);
+        new ToolItem(toolBar, SWT.SEPARATOR);   // Separator
+        
+        ToolItem addRootstrap = new ToolItem(toolBar, SWT.PUSH);        
+               Image addIcon = ImageUtil.getImage(Activator.PLUGIN_ID, "icons/rootstrap/add.gif");
+        addRootstrap.setImage(addIcon);
+        addRootstrap.setToolTipText(resources.getString("View.Add.Rootstrap.ToolTip"));
+        
+        addRootstrap.addSelectionListener(new SelectionListener() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+               showAddDialog();
+            }
+            
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                               // Nothing to do
+                       }
+        });
+        addRootstrap.setEnabled(true);
+        
+        new ToolItem(toolBar, SWT.SEPARATOR);   // Separator       
+        
+        ToolItem importRootstrap = new ToolItem(toolBar, SWT.PUSH);
+        Image editIcon = ImageUtil.getImage(Activator.PLUGIN_ID, "icons/rootstrap/import.gif");
+        importRootstrap.setImage(editIcon);
+        importRootstrap.setToolTipText(resources.getString("View.Import.Rootstrap.ToolTip"));
+        importRootstrap.addSelectionListener( new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               showImportDialog();
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                               // Nothing to do
+                       }
+               
+        });
+        
+    }
+
+    
+    
+    
+       private void createRootstrapTableComposite(Composite parent) {
+        
+        Composite composite = new Composite(parent, SWT.NONE);
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+        GridLayout layout = new GridLayout(1,false);
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        composite.setLayout(layout);
+               
+               tableViewer = new TableViewer(composite, SWT.BORDER|SWT.V_SCROLL);              
+               Table table = tableViewer.getTable();
+        GridData tableGridData = new GridData(GridData.FILL_BOTH|GridData.VERTICAL_ALIGN_BEGINNING);
+        table.setLayoutData(tableGridData);     
+
+               table.setHeaderVisible(true);
+               table.setLinesVisible(true);
+               
+        TableColumn column = new TableColumn(table, SWT.NONE);        
+        column.setResizable(true);
+        column.setText(resources.getString("View.Table.Column.Rootstrap"));
+        column.setWidth(240);        
+        column.addSelectionListener(new TooltableSelectionAdapter());
+
+        column = new TableColumn(table, SWT.NONE);        
+        column.setResizable(true);
+        column.setText(resources.getString("View.Table.Column.Arch"));
+        column.setWidth(50);        
+        column.addSelectionListener(new TooltableSelectionAdapter());
+
+               tableViewer.setLabelProvider(new TableViewerProvider());                
+               tableViewer.setContentProvider(new ArrayContentProvider());
+               tableViewer.setInput(RootstrapManager.getRootstraps()); 
+               
+               tableViewer.getTable().addSelectionListener(new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+               Table table = tableViewer.getTable();
+               TableItem[] item = table.getSelection();
+               if ( item.length > 0 ) {
+                       PlatformRootstrap selected = (PlatformRootstrap)item[0].getData();
+                       rootDescText.setText( getRootstrapDescription(selected));
+               }
+               else {
+                       rootDescText.setText("");
+               }
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {                           
+                       }
+                       
+               });
+       }
+       
+       
+       private String getRootstrapDescription( PlatformRootstrap rootstrap ) {
+               String archLine = String.format("* Architecture: %s(%s)", 
+                               getArchitectureCategory(rootstrap.getArch()),
+                               rootstrap.getArch());
+               String statusLine = String.format("* Status : %s", rootstrap.isInitialized()? "OK":"Not Intialized");
+               String urlLine = "* Repository URLs";
+               for( String url: rootstrap.getRepositoryURLs() ) {
+                       urlLine += String.format("\n  - %s", url);
+               }
+               
+               return archLine + "\n" + statusLine + "\n" + urlLine;
+       }
+       
+       
+       private void createRootstrapDescComposite(Composite parent) {
+        Composite composite = new Composite(parent, SWT.NONE);
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+        GridLayout layout = new GridLayout(1,false);
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        composite.setLayout(layout);
+        
+        Label descriptionLabel = new Label(composite, SWT.NONE);
+        GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+               descriptionLabel.setLayoutData(gridData);
+               descriptionLabel.setText(resources.getString("View.Description.Label"));
+
+        rootDescText = new Text( composite, SWT.MULTI|SWT.READ_ONLY|SWT.BORDER|SWT.H_SCROLL|SWT.V_SCROLL );
+        gridData = new GridData(GridData.FILL_BOTH);
+        gridData.heightHint = 50;
+               rootDescText.setLayoutData( gridData );
+       }
+       
+       
+    private void initContextMenu() {
+        // initalize the context menu
+        menuMgr = new MenuManager(resources.getString("View.Contextmenu.Title")); //$NON-NLS-1$
+        menuMgr.setRemoveAllWhenShown(true);
+        menuMgr.addMenuListener(new IMenuListener() {
+            @Override
+            public void menuAboutToShow(IMenuManager manager) {
+                fillContextMenu(manager);
+            }
+        });
+
+        Menu menu = menuMgr.createContextMenu(tableViewer.getTable());
+        tableViewer.getTable().setMenu(menu);
+        getSite().registerContextMenu(menuMgr, tableViewer);
+
+        menuMgr.addMenuListener(new IMenuListener() {
+            @Override
+            public void menuAboutToShow(IMenuManager manager) {
+                // Remove team menu from our menu
+                IContributionItem[] items = manager.getItems();
+                if (items != null) {
+                    for (IContributionItem item : items) {
+                        if (("team.main").equals(item.getId())) {
+                            manager.remove(item);
+                            break;
+                        }
+                    }
+                }
+            }
+        });
+    }
+          
+    private void fillContextMenu(IMenuManager manager)
+    {        
+        manager.add(new Separator());
+        manager.add(actionSetDefault);
+        manager.add(new Separator());
+        manager.add(actionExport);
+        manager.add(actionRemove);
+        manager.add(new Separator());
+        manager.add(actionPkgMgr);
+    }
+       
+       private void activateContext()
+    {
+        IContextService contextService = (IContextService) getSite().getService(IContextService.class);
+        contextService.activateContext("org.tizen.common.rootstrap.setdefault.context");
+        contextService.activateContext("org.tizen.common.rootstrap.lauchpkgmgr.context");
+        contextService.activateContext("org.tizen.common.rootstrap.remove.context");
+        contextService.activateContext("org.tizen.common.rootstrap.export.context");
+    }
+       
+       private void makeActions()
+    {
+               actionSetDefault = new Action() {
+            @Override
+            public void run() {
+               selectionBuildRoot();
+            }
+        };
+        actionSetDefault.setText(resources.getString("View.Contextmenu.Select"));
+        
+        actionPkgMgr = new Action() {
+            @Override
+            public void run() {
+               selectionPkgMgr();
+            }
+        };
+        actionPkgMgr.setText(resources.getString("View.Contextmenu.Manage"));
+        
+        actionRemove = new Action() {
+            @Override
+            public void run() {
+               removeRootstrap();
+            }
+        };
+        actionRemove.setText(resources.getString("View.Contextmenu.Remove"));
+        
+        actionExport = new Action() {
+            @Override
+            public void run() {
+               exportRootstrap();
+            }
+        };
+        actionExport.setText(resources.getString("View.Contextmenu.Export"));
+    }
+       
+       
+    private void showAddDialog() {
+       AddRootstrapDialog dlg = new AddRootstrapDialog(shell);
+       if ( dlg.open() == AddRootstrapDialog.OK ) {
+               final String rootstrapName = dlg.getRootstrapName();
+               final String arch = dlg.getArchitecture();
+               final ArrayList<String> repositoryURLs = dlg.getRepositoryURLs();
+               final boolean immediateGen = dlg.isImmediateGenerateChecked();
+               
+               // 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("GenRootDlg.Progress.Msg.Generating"), -1);
+                                               generatedRootstrap = null;
+                                               generatedRootstrap = RootstrapManager.generate(rootstrapName, arch, repositoryURLs, immediateGen, monitor);
+                                               if ( generatedRootstrap == null ) {
+                                                       throw new InterruptedException();
+                                               }
+                                       }
+                               });
+                       } catch (InvocationTargetException e) {
+                       DialogUtil.openErrorDialog(String.format("%s\n * %s", 
+                                       resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
+                                       e.getMessage()));
+                       return;
+                       } catch (InterruptedException e) {
+                       DialogUtil.openErrorDialog(String.format("%s\n * %s", 
+                                       resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
+                                       e.getMessage()));
+                       return;
+                       }                                       
+
+               RootstrapManager.addRootstrap( generatedRootstrap );
+       }
+    }
+
+    
+    private void showImportDialog() {
+       FileDialog fd = new FileDialog( shell, SWT.OPEN);
+        fd.setText(resources.getString("FileDlg.Title.Import"));
+        String[] extensions = {"*.tar"};
+        fd.setFilterExtensions(extensions);
+        String resultFilePath = fd.open();
+        generatedRootstrap = null;
+        if (resultFilePath != null) {
+            if ( !resultFilePath.endsWith(".tar")) {
+               resultFilePath += ".tar";
+            }
+            final String selectedFilePath =  resultFilePath;
+               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.Importing"), -1);
+                                               generatedRootstrap = RootstrapManager.importRootstrap( selectedFilePath, monitor );
+                                       }
+                               });
+                       } catch (InvocationTargetException e) {
+                       DialogUtil.openErrorDialog(
+                                       String.format("%s\n * %s", resources.getString("Action.Msg.Error.ImportFailed"),
+                                                       e.getMessage() ) );
+                       return;
+                       } catch (InterruptedException e) {
+                       DialogUtil.openErrorDialog(
+                                       String.format("%s\n * %s", resources.getString("Action.Msg.Error.ImportFailed"),
+                                                       e.getMessage() ) );
+                       return;
+                       }                                       
+        }
+        
+        if (generatedRootstrap == null) {
+               return;
+        }
+        RootstrapManager.addRootstrap( generatedRootstrap );
+               DialogUtil.openMessageDialog(shell,resources.getString("Action.Msg.Info.ImportOK"));
+    }
+
+    
+    public void selectionBuildRoot()
+    {
+        doActionForEntry(new IActionForEntry()
+        {
+            @Override
+            public void doAction()
+            {
+               Table table = tableViewer.getTable();
+               TableItem[] item = table.getSelection();
+               PlatformRootstrap selected = (PlatformRootstrap)item[0].getData();
+               if (project != null) {
+                       if (!verifyActiveRootstrap( project, selected)) {
+                               showErrorSelectRootstrap(project, selected);
+                               return;
+                       }
+                       setActiveRootstrap( project, selected );
+               }
+            }
+
+            @Override
+            public boolean doCheckEnable()
+            {
+                return true;
+            }
+        });
+    }
+    
+    private void showErrorSelectRootstrap(IProject project, PlatformRootstrap rootstrap) {
+       IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+       IConfiguration config = info.getDefaultConfiguration();
+       String message = String.format(resources.getString("Action.Msg.Error.SelectRootstrap"), 
+                       rootstrap.getId(), config.getName());
+       DialogUtil.openErrorDialog(message);
+    }
+    
+    
+    private void setActiveRootstrap(IProject project, PlatformRootstrap rootstrap ) {
+               String rootId = rootstrap.getId();
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+       IConfiguration config = info.getDefaultConfiguration();
+       String targetId = PlatformConfigurationManager.getBuildTargetName(config);      
+       SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+       String toolId = sbi.getToolchainIDFromTargetID(targetId);
+       String newTargetId = SmartBuildInterface.makeTargetID(rootId, toolId);
+       try {
+                       if (!sbi.checkTargetID(newTargetId)) {
+                           sbi.writeTargetCfgFile(newTargetId);
+                       }
+               } catch (SBIException e) {
+                       e.printStackTrace();
+               }
+       PlatformConfigurationManager.setBuildTargetName(config, newTargetId);
+       RootstrapManager.setSelectedRootstrap(rootstrap);
+       RootstrapManager.notifyChangedRootstrap();      
+       
+       ManagedBuildManager.saveBuildInfo( project, true );
+    }
+    
+    private boolean verifyActiveRootstrap(IProject project, PlatformRootstrap rootstrap ) {
+               IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+       IConfiguration config = info.getDefaultConfiguration();
+       String rootArch = rootstrap.getArch();
+       
+       if (PlatformConfigurationManager.isEmulatorConfiguration(config)) {
+               if (!PlatformConfigurationManager.isEmulatorArch(rootArch)) {
+                       return false;
+               }
+       } else if (PlatformConfigurationManager.isDeviceConfiguration(config)) {
+               if (!PlatformConfigurationManager.isDeviceArch(rootArch)) {
+                       return false;
+               }
+       }
+       
+       return true;
+    }
+    
+    
+    public void selectionPkgMgr()
+    {
+        doActionForEntry(new IActionForEntry()
+        {
+            @Override
+            public void doAction()
+            {
+               Table table = tableViewer.getTable();
+               TableItem[] item = table.getSelection();
+               final PlatformRootstrap selected = (PlatformRootstrap)item[0].getData();
+               boolean initialized = new File(selected.getPath().toOSString()).exists() ? true : false;
+               if (!initialized) {
+                       // ask whether user want to initialize roootstrap
+                       int ret = DialogUtil.openQuestionDialog(resources.getString("Action.Msg.Question.NotInit"));
+                       if ( ret != SWT.YES ) {
+                               return;
+                       }
+                               
+                       // generate base file system here if "YES"
+                       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("GenRootDlg.Progress.Msg.Generating"), -1);
+                                                               if( !RootstrapManager.generateBaseFileSystem(selected.getPath().toString(),
+                                                                               selected.getArch(), selected.getRepositoryURLs(), monitor) ) {
+                                                                       throw new InterruptedException("Generating base file system failed!");
+                                                               }
+                                                       }
+                                               });
+                                       } catch (InvocationTargetException e) {
+                               DialogUtil.openErrorDialog(String.format("%s\n * %s", 
+                                               resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
+                                               e.getMessage()));
+                               return;
+                                       } catch (InterruptedException e) {
+                               DialogUtil.openErrorDialog(String.format("%s\n * %s", 
+                                               resources.getString("GenRootDlg.Error.Gen.Rootstrap.Failed"),
+                                               e.getMessage()));
+                               return;
+                                       }                                       
+                       
+                                       selected.setInitialized(true);
+               }
+               
+               // launch package manager
+               final RPMPackageDialog dlg = new RPMPackageDialog(shell, selected);
+                       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.Initializing.PkgMgr"), -1);
+                                                       dlg.initializeDialogData(monitor);
+                                               }
+                                       });
+                               } catch (InvocationTargetException e) {
+                       DialogUtil.openErrorDialog(     String.format("%s\n * %s\n * %s", 
+                                       resources.getString("Action.Msg.Error.InitFailed.PkgMgr"),
+                                       e.getMessage(), "If no response for long time, check your proxy setting." ) );
+                       return;
+                               } catch (InterruptedException e) {
+                       DialogUtil.openErrorDialog(     String.format("%s\n * %s\n * %s", 
+                                       resources.getString("Action.Msg.Error.InitFailed.PkgMgr"),
+                                       e.getMessage(), "If no response for long time, check your proxy setting." ) );
+                       return;
+                               }                                       
+
+               dlg.open();
+               
+                RootstrapManager.modifyRootstrap( selected );
+            }
+
+            @Override
+            public boolean doCheckEnable()
+            {
+                return true;
+            }
+        });
+    }
+    
+    
+    public void removeRootstrap()
+    {
+        doActionForEntry(new IActionForEntry()
+        {
+            @Override
+            public void doAction()
+            {
+               Table table = tableViewer.getTable();
+               TableItem[] item = table.getSelection();
+               final PlatformRootstrap selected = (PlatformRootstrap)item[0].getData();
+               
+               // default rootstrap cannot be removed!
+               PlatformRootstrap defaultRootstrap = RootstrapManager.getDefaultRootstrap( selected.getArch() );
+               if ( defaultRootstrap.getId().equals(selected.getId()) ) {
+                       DialogUtil.openErrorDialog(resources.getString("Action.Msg.Error.RemoveDefault"));
+                       return;
+               }
+               
+               IWorkspace works = ResourcesPlugin.getWorkspace();
+               IProject[] projs = works.getRoot().getProjects();
+               for (IProject proj : projs) {
+                       IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(proj);
+                       if ( info == null ) continue;
+                       IConfiguration config = info.getDefaultConfiguration();
+                       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) continue;
+                       
+                       setActiveRootstrap( proj, defaultRootstrap );
+               }
+               
+               // remove 
+               RootstrapManager.removeRootstrap(selected.getId());
+            }
+
+            @Override
+            public boolean doCheckEnable()
+            {
+                return true;
+            }
+        });
+    }
+    
+
+    public void exportRootstrap()
+    {
+        doActionForEntry(new IActionForEntry()
+        {
+            @Override
+            public void doAction()
+            {
+                       // get rootstrap
+               Table table = tableViewer.getTable();
+               TableItem[] item = table.getSelection();
+               final PlatformRootstrap selectedRootstrap = (PlatformRootstrap)item[0].getData();
+               
+               // check whether rootstrap is initialized
+               if ( !selectedRootstrap.isInitialized() ) {
+                       DialogUtil.openErrorDialog(resources.getString("Action.Msg.Error.ExportUninitialzed"));
+                       return;
+               }
+
+                       FileDialog fd = new FileDialog( shell, SWT.SAVE);
+                       fd.setText(resources.getString("FileDlg.Title.Export"));
+                       String[] extensions = {"*.tar"};
+                       fd.setFilterExtensions(extensions);
+                       String resultFilePath = fd.open();
+                       if ( !resultFilePath.endsWith(".tar")) {
+                               resultFilePath += ".tar";
+                       }
+                       final String selectedFilePath =  resultFilePath;
+                       if (selectedFilePath != null) {
+                               // 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.Exporting"), -1);
+                                                               boolean result = RootstrapManager.exportRootstrap( selectedRootstrap, selectedFilePath, monitor );
+                                                       if ( result ) {
+                                                               DialogUtil.openMessageDialog(shell,resources.getString("Action.Msg.Info.ExportOK"));
+                                                       }
+                                                       else {
+                                                               DialogUtil.openMessageDialog(shell, resources.getString("Action.Msg.Error.ExportFailed"));
+                                                       }
+                                                       }
+                                               });
+                                       } catch (InvocationTargetException e) {
+                               DialogUtil.openErrorDialog(     String.format("%s\n * %s", 
+                                               resources.getString("Action.Msg.Error.ExportFailed"),
+                                               e.getMessage() ) );
+                               return;
+                                       } catch (InterruptedException e) {
+                               DialogUtil.openErrorDialog(     String.format("%s\n * %s", 
+                                               resources.getString("Action.Msg.Error.ExportFailed"),
+                                               e.getMessage() ) );
+                               return;
+                                       }                                       
+                       }
+            }
+
+            @Override
+            public boolean doCheckEnable()
+            {
+                return true;
+            }
+        });
+    }
+
+    
+    public void doActionForEntry(IActionForEntry action)
+    {
+        if (action.doCheckEnable())
+        {
+            action.doAction();
+        }
+    }
+    
+    private interface IActionForEntry
+    {
+        boolean  doCheckEnable();
+        void doAction();
+    }
+
+
+       
+       private class TooltableSelectionAdapter extends SelectionAdapter
+       {
+               public void widgetSelected(SelectionEvent e) {          
+
+                       final int column = tableViewer.getTable().indexOf((TableColumn) e.widget);
+                       tableViewer.getTable().setSortColumn((TableColumn)e.widget);
+                       if (tableViewer.getTable().getSortDirection() == SWT.DOWN) {                                            
+                               tableViewer.getTable().setSortDirection(SWT.UP);
+                       } else {
+                               tableViewer.getTable().setSortDirection(SWT.DOWN);
+                       }                                       
+                       
+                       tableViewer.setSorter(new ViewerSorter() {
+                               public int compare(Viewer viewer, Object e1, Object e2) {                                       
+                                       PlatformRootstrap entry_1 = (PlatformRootstrap)e1;
+                                       PlatformRootstrap entry_2 = (PlatformRootstrap)e2;
+                                       
+                                       switch (column) {
+                                               case COL_IDX_ROOTNAME:                                                                  
+                                                       if (tableViewer.getTable().getSortDirection() == SWT.DOWN) {
+                                                               return entry_1.getText().compareTo(entry_2.getText());
+                                                       } else {
+                                                               return entry_2.getText().compareTo(entry_1.getText());
+                                                       }
+                                               case COL_IDX_ARCH:
+                                                       if (tableViewer.getTable().getSortDirection() == SWT.DOWN) {
+                                                               return entry_1.getArch().compareTo(entry_2.getArch());
+                                                       } else {
+                                                               return entry_2.getArch().compareTo(entry_1.getArch());
+                                                       }
+                                               default:
+                                                   break;
+                                       }
+                                       return entry_1.getText().compareTo(entry_2.getText());
+                               }
+                       });             
+                       
+               }
+       }
+       
+       
+       /* selected package table provider */
+       private class TableViewerProvider extends LabelProvider implements ITableLabelProvider 
+       {
+               @Override
+               public Image getColumnImage(Object element, int columnIndex) {
+                       if ( element instanceof PlatformRootstrap) {
+                               PlatformRootstrap t = (PlatformRootstrap)element;
+                               boolean checked = t.isChecked();
+                               if (checked && columnIndex == COL_IDX_ROOTNAME) {                                                                               
+                                       Image checkIcon = ImageUtil.getImage(Activator.PLUGIN_ID, "icons/rootstrap/successed.png");
+                                       return checkIcon;                                       
+                               }
+                       }
+                       return null;
+               }
+
+               @Override
+               public String getColumnText(Object element, int columnIndex) {
+                       if ( element instanceof PlatformRootstrap) {
+                               PlatformRootstrap t = (PlatformRootstrap)element;                               
+                               String name = t.getText();
+                               String arch = t.getArch();
+                               
+                               switch(columnIndex) {
+                               case COL_IDX_ROOTNAME :
+                                       return name;                                    
+                               case COL_IDX_ARCH:
+                                       return getArchitectureCategory(arch);
+                               default:
+                                       break;
+                               }
+                       }
+                       return null;
+               }
+       }
+       
+       
+       private String getArchitectureCategory(String arch) {
+               if ( arch.toLowerCase().contains("arm")) {
+                       return "arm";
+               }
+               else {
+                       return "x86";
+               }
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/SelectRootstrapMappingDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/SelectRootstrapMappingDialog.java
new file mode 100644 (file)
index 0000000..f324dec
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * 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.views.ui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.Dialog;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.tizen.nativecommon.build.SmartBuildInterface;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.views.model.PlatformRootstrap;
+
+public class SelectRootstrapMappingDialog extends Dialog {
+
+       private ArrayList<PlatformRootstrap> rootstrapList = new ArrayList<PlatformRootstrap>();
+       private ArrayList<String> rootstrapNames = new ArrayList<String>();
+       private HashMap<Integer, HashMap<IProject, IConfiguration>> projectMap = new HashMap<Integer, HashMap<IProject, IConfiguration>>();
+       private HashMap<String, Combo> comboMap = new HashMap<String, Combo>();
+       private String rootName = "";
+       
+       private int x = 0;
+       private int y = 0;
+       private final int width = 400;
+       private final int height = 400;
+       
+       private final String BUNDLE_NAME = AddRootstrapDialog.class.getPackage().getName() + ".RootstrapUIMessages";//$NON-NLS-1$
+       private ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+
+       public SelectRootstrapMappingDialog(Shell parentShell, String rootName, 
+                       HashMap<Integer, HashMap<IProject, IConfiguration>> projectMap, 
+                       ArrayList<PlatformRootstrap> rootstrapList) {
+               super(parentShell);             
+               this.projectMap = projectMap;           
+               this.rootName = rootName;
+               this.rootstrapList = rootstrapList;     
+               
+               Rectangle bounds = parentShell.getBounds();
+        x = bounds.x + (bounds.width - width)/2;
+        y = bounds.y + (bounds.height - height)/2;
+        
+        for (PlatformRootstrap r : rootstrapList) {
+               rootstrapNames.add(r.getName());
+        }
+       }
+       
+       @Override
+       protected void configureShell(Shell newShell) {
+               super.configureShell(newShell);         
+               
+               newShell.setText(resources.getString("SelectRootDlg.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_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+               composite.setLayout(new GridLayout(1, false));       
+
+               createDescComposite(composite);
+        createSettingComposite(composite);
+        return null;
+       }
+       
+       private void createDescComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(1, false));
+               
+               Label descLabel = new Label(composite, SWT.NONE);       
+               descLabel.setText(String.format(resources.getString("SelectRootDlg.Label.Desc"), rootName, rootName));
+       }
+       
+       private void createSettingComposite(Composite parent) {
+               Composite composite = new Composite( parent, SWT.NONE);
+               composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+               composite.setLayout(new GridLayout(2, false));
+               
+               for (Entry<Integer, HashMap<IProject, IConfiguration>> e : projectMap.entrySet()) {                     
+                       for (Entry<IProject, IConfiguration> _e : e.getValue().entrySet()) {
+                               IProject project = _e.getKey();
+                               IConfiguration config = _e.getValue();
+                               Label nameLabel = new Label(composite, SWT.NONE);
+                       nameLabel.setText(getLabelName(project.getName(), config.getName()));
+                       GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
+                       //nameLabel.setLayoutData(gridData);
+                       Combo rootstrapCombo = new Combo(composite, SWT.READ_ONLY);
+                       rootstrapCombo.setLayoutData(gridData);
+                       rootstrapCombo.setItems(rootstrapNames.toArray(new String[0]));
+                       rootstrapCombo.addSelectionListener(new SelectionListener()
+                       {
+                           @Override
+                           public void widgetSelected(SelectionEvent e)
+                           {
+                          
+                           }
+
+                           @Override
+                           public void widgetDefaultSelected(SelectionEvent e)
+                           {}
+                       });
+                       
+                       rootstrapCombo.select(0);
+                       comboMap.put(nameLabel.getText(), rootstrapCombo);
+                       }
+               
+               }
+       }
+       
+       private String getLabelName(String project, String config) {
+               return project + " [" + config + "]";
+       }       
+
+       @Override
+       protected void okPressed() {
+               for (Entry<Integer, HashMap<IProject, IConfiguration>> e : projectMap.entrySet()) {                     
+                       for (Entry<IProject, IConfiguration> _e : e.getValue().entrySet()) {            
+                               IProject project = _e.getKey();
+                               IConfiguration config = _e.getValue();                          
+                               Combo combo = comboMap.get(getLabelName(project.getName(), config.getName()));
+                               String rootName = combo.getText();
+                               
+                               SmartBuildInterface sbi = SmartBuildInterface.getInstance();
+                               String targetId = PlatformConfigurationManager.getBuildTargetName(config);
+                               String toolId = sbi.getToolchainIDFromTargetID(targetId);                       
+                               
+                               for (PlatformRootstrap r : rootstrapList) {
+                                       if (rootName.equals(r.getName())) {
+                                               String id = r.getId();
+                                               String newTargetId = sbi.makeTargetID(id, toolId);
+                                               PlatformConfigurationManager.setBuildTargetName(config, newTargetId);
+                                               break;
+                                       }
+                               }                       
+                       }
+               }
+               
+               super.okPressed();
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TemplateTizenPlatformNewWizard.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TemplateTizenPlatformNewWizard.java
new file mode 100644 (file)
index 0000000..ccd3c47
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * 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.wizards;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
+import org.eclipse.cdt.ui.wizards.EntryDescriptor;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.osgi.util.NLS;
+import org.tizen.common.core.application.InstallPathConfig;
+import org.tizen.common.util.log.Logger;
+import org.tizen.nativeappcommon.templateengine.TizenTemplateProcessParser;
+import org.tizen.nativeappcommon.wizards.Messages;
+import org.tizen.nativeappcommon.wizards.TemplateTizenNewWizard;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.git.GitDescManager;
+import org.tizen.nativeplatform.git.GitIndexParserFactory;
+import org.tizen.nativeplatform.git.IGitIndexParser;
+import org.tizen.nativeplatform.git.model.GitDescription;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.w3c.dom.Element;
+
+public class TemplateTizenPlatformNewWizard extends TemplateTizenNewWizard {
+
+       public static final String DIR_RPM = "rpm";
+       public static final String DIR_PLATFORM = "platform";
+       public static final String DIR_GIT = "Git";
+       public static final String DIR_DELIMITER = "/";
+    public static final String[] ID_TEMPLATE = {"PlatformProject"};
+    public static final String[] ID_PROJTYPE = {PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE}; //$NON-NLS-1$ //$NON-NLS-2$
+
+    public static final IPath templatePath = new Path(InstallPathConfig.getSamplesPath()).
+            append(DIR_PLATFORM).append(DIR_RPM);
+    
+    @Override
+    public EntryDescriptor[] createItems(boolean supportedOnly, IWizard wizard) {
+
+        List<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
+        
+        Stack<IPath> fileStack = new Stack<IPath>();
+        IPath rootPath = this.getTemplatePath();
+        
+        fileStack.push(rootPath);
+        boolean found = false;
+        
+        while(!fileStack.isEmpty()) {
+            IPath templatePath = fileStack.pop();
+            
+            File templateFile = templatePath.toFile();
+            
+            if(templateFile.exists()) {
+                
+                File sampleFile = templatePath.append(FILE_SAMPLE).toFile();
+                if(sampleFile.exists() && sampleFile.isFile()) {
+                    found = true;
+                    EntryDescriptor entryDes = getEntryDesc(TizenTemplateProcessParser.createTemplateDesc(sampleFile), templatePath.lastSegment());
+                    IPath sourcePath = templatePath.removeLastSegments(1);
+                    if(sourcePath.segmentCount() != rootPath.segmentCount()) {
+                        entryDes.setPath(templatePath.removeLastSegments(1).makeRelativeTo(rootPath).toString());
+                    }
+                    else {
+                        entryDes.setPath(null);
+                    }
+                    items.add(entryDes);
+                }
+                else {
+                    for(File subFile: templateFile.listFiles()) {
+                        if(subFile.isDirectory()) {
+                            fileStack.push(new Path(subFile.getPath()));
+                        }
+                    }
+                }
+            }
+        }
+        
+        if(found == false) {
+            Logger.error(NLS.bind(Messages.EXCEPTION_WHILE_PROJECT_CREATION_3, rootPath));
+        }
+        
+        /* create git items */
+        String projTypeName = PlatformConfigurationManager.TIZEN_PLATFORM_ARTIFACT_TYPE;
+        PreferencesManager.SiteConfiguration config = PreferencesManager.loadActiveSiteConfiguration();
+        
+        if (config != null ) {
+               EntryDescriptor gitEntryDes = null;
+               ArrayList<GitDescription> gitDescs = null;
+
+               IGitIndexParser parser = GitIndexParserFactory.getIndexParser(config);
+               gitDescs = parser.parse(config);
+               if (gitDescs != null) {
+                       GitDescManager.setDescs(gitDescs);
+               }
+     
+               if (gitDescs != null) {        
+                       for (GitDescription n : gitDescs) {
+                               Path gitPath = new Path(n.getProject());
+                               String name = gitPath.lastSegment();
+                               String dir = gitPath.removeLastSegments(1).toString();
+                               dir = DIR_GIT + DIR_DELIMITER + dir;
+                               gitEntryDes = new EntryDescriptor(getTemplateID(projTypeName), projTypeName, name, false, null, null);          
+                               gitEntryDes.setPath(dir);
+                           items.add(gitEntryDes);
+                       }                       
+               }      
+        }
+
+        return items.toArray(new EntryDescriptor[items.size()]);
+    }
+    
+    private EntryDescriptor getEntryDesc(TemplateDescriptor descriptor,
+            String label) {
+        String projTypeName;
+        Element root = descriptor.getRootElement();
+        Element slpPropertyElement = TizenTemplateProcessParser.getElementFromTag(root, TizenTemplateProcessParser.TAG_SLPPROPERTY);
+        slpPropertyElement = TizenTemplateProcessParser.getElementFromTag(slpPropertyElement, TizenTemplateProcessParser.TAG_PROPERTYGROUP);
+        projTypeName = TizenTemplateProcessParser.getTextContextFromElement(slpPropertyElement, TizenTemplateProcessParser.TAG_PROJTYPE);
+        return new EntryDescriptor(getTemplateID(projTypeName), projTypeName, label, false, null, null);
+    }
+    
+    public IPath getTemplatePath() {
+        return templatePath;
+    }
+    
+    public String getTemplateID(String projTypeName) {
+        
+        for(int i=0; i<TemplateTizenPlatformNewWizard.ID_PROJTYPE.length; i++) {
+            if(TemplateTizenPlatformNewWizard.ID_PROJTYPE[i].equals(projTypeName)) {
+                return TemplateTizenPlatformNewWizard.ID_TEMPLATE[i];
+            }
+        }
+        return TemplateTizenPlatformNewWizard.ID_TEMPLATE[0];
+    }
+}
index 4456de3..8501b36 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.wizards;
 
 import java.util.ArrayList;
@@ -54,9 +53,9 @@ public class TizenDebianMainWizardPage extends CDTMainWizardPage {
                                // remove default empty project
                                if ( e.getName() != null && e.getName().equals("Empty Project") )
                                        continue;
-
-                               if(     e.getId().equals("com.samsung.slp.nativeide.buildArtefactType.cdeb") || 
-                                               (e.getParentId() != null && e.getParentId().equals("com.samsung.slp.nativeide.buildArtefactType.cdeb")) ) {
+                               
+                               if(     e.getId().equals("org.tizen.nativeide.buildArtefactType.platform") || 
+                                               (e.getParentId() != null && e.getParentId().equals("org.tizen.nativeide.buildArtefactType.platform")) ) {
                                        result.add(item);
                                }
                                
index 4e6c6e2..581db32 100644 (file)
@@ -1,31 +1,30 @@
 /*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@samsung.com>
-* 
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
+ * 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.wizards;
 
 import org.eclipse.cdt.core.CCProjectNature;
@@ -45,8 +44,8 @@ import org.tizen.nativeplatform.build.PlatformConfigurationManager;
 public class TizenDebianProjectWizard extends CDTCommonProjectWizard{
 
        public TizenDebianProjectWizard() {
-               super("Tizen Custom Debian Project",  //$NON-NLS-1$
-                 "Create a Tizen Custom Debian Project project of selected type"); //$NON-NLS-1$
+               super("Tizen Platform Project",  //$NON-NLS-1$
+                 "Create a Tizen Platform Project project of selected type"); //$NON-NLS-1$
 //             WizardConstants.isDebian = true;
        }
 
@@ -65,7 +64,10 @@ public class TizenDebianProjectWizard extends CDTCommonProjectWizard{
                        continueCreationMonitor.beginTask("Add C/C++ Project Nature", 1);
                        CProjectNature.addCNature(prj, new SubProgressMonitor(continueCreationMonitor, 1));
                        CCProjectNature.addCCNature(prj, new SubProgressMonitor(continueCreationMonitor, 1));
-               } catch (CoreException e) {}
+               } catch (CoreException e) {
+                       // nothing to do
+                       e.printStackTrace();
+               }
                finally {continueCreationMonitor.done();}
                return prj;
        }
@@ -73,8 +75,8 @@ public class TizenDebianProjectWizard extends CDTCommonProjectWizard{
        @Override
        public void addPages() {
                fMainPage= new TizenDebianMainWizardPage(CUIPlugin.getResourceString("CProjectWizard"));
-               fMainPage.setTitle("Tizen Custom Debian Project");
-               fMainPage.setDescription("Create a Tizen Custom Debian Project project of selected type");
+               fMainPage.setTitle("Tizen Platform Project");
+               fMainPage.setDescription("Create a Tizen Platform Project project of selected type");
                addPage(fMainPage);
        }
 
@@ -88,7 +90,7 @@ public class TizenDebianProjectWizard extends CDTCommonProjectWizard{
                IProject prj = super.getProject(defaults, onFinish);
 
                // Marking project version
-               PlatformConfigurationManager.setProjectVersion( prj, PlatformConfigurationManager.CURRENT_SLP_PROJECT_VERSION );
+               PlatformConfigurationManager.setProjectVersion( prj, PlatformConfigurationManager.CURRENT_SLP_PROJECT_VERSION, true);
 
                return prj;
        }
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenPlatformMainWizardPage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenPlatformMainWizardPage.java
new file mode 100644 (file)
index 0000000..1d6da7f
--- /dev/null
@@ -0,0 +1,321 @@
+/*
+ * 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.wizards;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+
+import org.eclipse.cdt.core.templateengine.TemplateDescriptor;
+import org.eclipse.cdt.managedbuilder.ui.wizards.ManagedBuildWizard;
+import org.eclipse.cdt.ui.wizards.CNewWizard;
+import org.eclipse.cdt.ui.wizards.EntryDescriptor;
+import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+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.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;
+import org.tizen.nativeappcommon.wizards.TizenMainWizardPage;
+import org.tizen.nativeappcommon.wizards.WizardConstants;
+import org.tizen.nativeappcommon.wizards.Messages;
+import org.tizen.nativeappcommon.wizards.model.TizenNativeTreeGroupModel;
+import org.tizen.nativeappcommon.wizards.model.TizenNativeTreeRootModel;
+import org.tizen.nativeplatform.git.GitDescManager;
+import org.tizen.nativeplatform.wizards.model.TizenPlatformTemplateModel;
+import org.tizen.nativeplatform.wizards.ui.TizenPlatformPWComposite;
+
+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;    
+    
+    public TizenPlatformMainWizardPage() {
+        super("");
+    }
+    
+    public TizenPlatformMainWizardPage(String pageName) {
+        super(pageName);
+    }
+
+       @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) {
+            String name = root.getName();
+            
+            String iconPath = root.getIconPath();
+            Image tabImage = 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]));
+        
+        this.newProjectChecker.createGroupComposite(mainComposite);
+        
+        setPageComplete(validatePage());
+        setErrorMessage(null);
+        setMessage(null);
+        
+        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;
+        IExtension[] extensions = extensionPoint.getExtensions();
+        if (extensions == null) return null;
+        
+        List<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
+        for (int i = 0; i < extensions.length; ++i)    {
+            IConfigurationElement[] elements = extensions[i].getConfigurationElements();
+            for (IConfigurationElement element : elements) {
+                if (element.getName().equals(ELEMENT_NAME)) {
+                    CNewWizard w = null;
+                    try {
+                        w = (CNewWizard) element.createExecutableExtension(CLASS_NAME);
+                    } catch (CoreException e) {
+                        Logger.error(Messages.EXCEPTION_WHILE_PROJECT_CREATION_2, e);
+                    }
+                    if (w == null) return null;
+                    
+                    if(w instanceof ManagedBuildWizard) {
+                        w.setDependentControl(right, ls);
+                        for (EntryDescriptor ed : w.createItems(true, wizard))
+                            items.add(ed);
+                    }
+                    else if(w instanceof TemplateTizenPlatformNewWizard) {
+                        w.setDependentControl(right, ls);
+                        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)
+        {
+            EntryDescriptor ed = items.get(i);
+            if (ed.isDefaultForCategory())
+            {
+                items.remove(i);
+                i--;
+            }
+        }
+        
+        // bug # 211935 : allow items filtering.
+        if (ls != null) // NULL means call from prefs
+            items = ls.filterItems(items);
+        
+        return items;
+    }
+
+    @Override
+    protected String getProjectNamePattern() {
+        return WizardConstants.CPP_NAME_PATTERN;
+    }
+
+    @Override
+    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]));
+        }
+        
+        boolean found3 = false;
+        
+        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())) {
+                        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;
+                    }
+                }
+                if(found1 == false) continue;
+                
+                List<String> categories = null;
+                IPath descPath = null;
+                if(tempPath == null) {
+                    categories = new ArrayList<String>();
+                    categories.add(DEFAULT_TAB);
+                    categories.add(DEFAULT_CATEGORY);
+                    descPath = this.getTemplatePath().append("").append(ed.getName());
+                }
+                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(TemplateTizenNewWizard.FILE_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);
+        }
+        return rootModels;
+    }
+    
+    public TizenPlatformTemplateModel getLastSelectedTemplate() {
+        return (TizenPlatformTemplateModel)lastSelectedTemplate;
+    }
+    
+    public void setPageError(boolean value) {
+       this.pageError = value;
+    }
+
+    @Override
+    public boolean validatePage() {
+       if (pageError) {
+               return false;
+       } else {
+               return super.validatePage();
+       }
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenPlatformProjectWizard.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenPlatformProjectWizard.java
new file mode 100644 (file)
index 0000000..47ee79a
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * 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.wizards;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.util.ResourceBundle;
+
+import org.eclipse.cdt.core.templateengine.TemplateCore;
+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;
+import org.tizen.nativeplatform.build.PlatformConfigurationManager;
+import org.tizen.nativeplatform.git.GitCommander;
+import org.tizen.nativeplatform.git.model.GitDescription;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.tizen.nativeplatform.wizards.model.TizenPlatformTemplateModel;
+
+public class TizenPlatformProjectWizard extends TizenProjectWizard {
+       
+       private final static String BUNDLE_NAME = TizenPlatformProjectWizard.class.getPackage().getName() + ".WizardUIMessages";//$NON-NLS-1$
+       private static ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+       
+       private final static String Title = resources.getString("WizardPage.Title");
+       private final static String Description = resources.getString("WizardPage.Description");
+       
+    public TizenPlatformProjectWizard() {
+        super(Title, Description);
+    }
+
+    @Override
+    public void addPages() {
+        fMainPage= new TizenPlatformMainWizardPage(resources.getString("WizardPage.Name")); //$NON-NLS-1$
+        fMainPage.setTitle(Title);
+        fMainPage.setDescription(Description);
+        addPage(fMainPage);
+    }
+    
+    @Override
+    public boolean performFinish() {
+       
+       boolean result = false;         
+
+       IPath projectPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(fMainPage.getProjectName());
+       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());
+               // cloning git project
+               try {
+                               if (!commander.CloneOperation(projectPath, gitPath, getContainer())) {
+                                       return false;
+                               }
+                       } catch (InvocationTargetException e) {
+                               DialogUtil.openErrorDialog(e.getTargetException().getMessage());                                
+                               e.printStackTrace();
+                               return false;
+                       } catch (URISyntaxException e) {
+                               DialogUtil.openErrorDialog(e.getMessage());
+                               e.printStackTrace();
+                               return false;
+                       } catch (IOException e) {
+                               DialogUtil.openErrorDialog(e.getMessage());
+                               e.printStackTrace();
+                               return false;
+                       }
+               
+               result = super.performFinish();
+               
+               // apply shared project
+               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;
+    }
+
+    @Override
+    public IProject getProject(boolean defaults, boolean onFinish) {
+        IProject prj = super.getProject(defaults, onFinish);
+        
+        // Marking project version
+               PlatformConfigurationManager.setProjectVersion( prj, PlatformConfigurationManager.CURRENT_SLP_PROJECT_VERSION, true);
+
+        return prj;
+    }
+
+    @Override
+    public String getTemplateIdFromProjectType(String projectType) {
+        return null;
+    }
+
+    @Override
+    public void setValueStoreForTemplateProcess(TemplateCore template) {
+    }
+
+    @Override
+    public void addValueStoreWithFramework(String projectType) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void initializeValueStore(String projectType) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    protected void createCDTDescriptionTemplate(TemplateCore selectedTemplate,
+            IPath projectPath, String projectType) throws IOException {
+        //Do nothing
+    }
+
+    @Override
+    protected void doTemplatePreprocess(IPath projectPath, String _projectType) {
+        //Do nothing
+    }
+    
+    @Override
+    public boolean isExpressMode() {
+        return false;
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/WizardUIMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/WizardUIMessages.properties
new file mode 100644 (file)
index 0000000..55a44ba
--- /dev/null
@@ -0,0 +1,10 @@
+WizardPage.Title = Tizen Platform Project
+WizardPage.Name = Tizen Platform Project Wizard
+WizardPage.Description = Create a Tizen Platform project of selected type
+
+WizardPage.GitInfo.Description = Description
+WizardPage.GitInfo.Owner = Owner
+WizardPage.GitInfo.LastChange = Last Change
+WizardPage.GitInfo.Error = Error
+WizardPage.GitError.FailedGet.Messsage = Failed to get git project
+WizardPage.GitError.CantCreate.Messsage = You can not create this project
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/model/TizenPlatformTemplateModel.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/model/TizenPlatformTemplateModel.java
new file mode 100644 (file)
index 0000000..fe9d15f
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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.wizards.model;
+
+import org.eclipse.cdt.ui.wizards.EntryDescriptor;
+import org.eclipse.core.runtime.IPath;
+import org.tizen.nativeappcommon.wizards.model.TizenNativeTemplateModel;
+import org.tizen.nativeplatform.git.model.GitDescription;
+
+public class TizenPlatformTemplateModel extends TizenNativeTemplateModel {
+       private GitDescription desc;
+       public TizenPlatformTemplateModel(String name, EntryDescriptor ed, IPath descPath, IPath samplePath, IPath iconPath, GitDescription desc) {             
+               super(name, ed, descPath, samplePath, iconPath);
+               this.desc = desc;
+       }
+       
+       public GitDescription getDesc() {
+               return desc;
+       }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/Messages.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/Messages.java
new file mode 100644 (file)
index 0000000..77ca880
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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.wizards.ui;
+
+import org.eclipse.osgi.util.NLS;
+import org.tizen.nativeappcommon.Activator;
+
+public class Messages extends NLS {
+
+    private static final String BUNDLE_NAME = Activator.PLUGIN_ID + ".wizards.ui.messages";//$NON-NLS-1$
+
+    private Messages() {
+        // Do not instantiate
+    }
+    
+    public static String TizenNativePWComposite_WizardToolTipText;
+    
+    static {
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/TizenPlatformPWComposite.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/TizenPlatformPWComposite.java
new file mode 100644 (file)
index 0000000..72b6857
--- /dev/null
@@ -0,0 +1,513 @@
+/*
+ * 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.wizards.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.Stack;
+
+import org.eclipse.cdt.ui.wizards.EntryDescriptor;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.OpenWindowListener;
+import org.eclipse.swt.browser.WindowEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
+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.Label;
+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.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.mihalis.opal.preferenceWindow.widgets.PWWidget;
+import org.tizen.common.util.HelpBrowser;
+import org.tizen.common.util.ImageUtil;
+import org.tizen.common.util.SWTUtil;
+import org.tizen.nativeappcommon.wizards.TizenMainWizardPage;
+import org.tizen.nativeappcommon.wizards.model.TizenNativeTemplateModel;
+import org.tizen.nativeappcommon.wizards.model.TizenNativeTreeGroupModel;
+import org.tizen.nativeappcommon.wizards.model.TizenNativeTreeRootModel;
+import org.tizen.nativeappcommon.Activator;
+import org.tizen.nativeplatform.git.model.GitDescription;
+import org.tizen.nativeplatform.preferences.PreferencesManager;
+import org.tizen.nativeplatform.wizards.TizenPlatformMainWizardPage;
+import org.tizen.nativeplatform.wizards.TizenPlatformProjectWizard;
+import org.tizen.nativeplatform.wizards.model.TizenPlatformTemplateModel;
+
+public class TizenPlatformPWComposite extends PWWidget {
+
+    private final int textMargin = 30;
+    private final int tableWidth = 250;
+    private Tree tree;
+    private Table table;
+    
+    private TizenNativeTreeRootModel modelRoot;
+    private Browser descBrowser;
+    private final TizenPlatformMainWizardPage wizardPage;
+    private TableViewer gitDescTable;
+    private int browserWidth = 418;
+    private static Color topColor = new Color(Display.getDefault(), 168, 198, 255); // Top Color
+    private static Color bottomColor = new Color(Display.getDefault(), 104, 151, 239); // Bottom Color
+    
+    private static String IMAGE_TREE_BG = "images/wizard/tree_viewer_bg.png";
+    private static String IMAGE_TABLE_BG = "images/wizard/list_viewer_bg.png";
+    private final String GIT_CATEGORY = "Git";
+    private final String TABLE_DATA_DELIMITER = "::";
+    
+    private final static String BUNDLE_NAME = TizenPlatformProjectWizard.class.getPackage().getName() + ".WizardUIMessages";//$NON-NLS-1$
+       private static ResourceBundle resources = ResourceBundle.getBundle(BUNDLE_NAME);
+    
+    public TizenPlatformPWComposite(final String label, TizenNativeTreeRootModel modelRoot, TizenPlatformMainWizardPage page) {
+        super(label, null, 1, true);
+        this.modelRoot = modelRoot;
+        this.wizardPage = page;        
+        
+        setAlignment(GridData.FILL);
+    }
+    
+    @Override
+    protected Control build(Composite parent) {
+        this.wizardPage.setLastSelectedTemplate(null);
+        this.wizardPage.h_selected = null;
+        
+        Composite composite = new Composite(parent, SWT.NONE);
+        GridLayout gridLayout = new GridLayout(3, false);
+        gridLayout.marginHeight = 0;
+        gridLayout.marginWidth = 0;
+        composite.setLayout(gridLayout);
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));        
+        
+        if (this.getLabel().equals(GIT_CATEGORY)) {
+               if ( modelRoot.getEntries().size() == 1 && 
+                               modelRoot.getEntries().get(0).getName().equals("no_category")) {
+                       createEmptyGitRepositoryComposite(composite);
+               } 
+               else {
+                createTree(composite);
+                createTable(composite);
+                       createGitDescriptionComposite(composite);
+               }
+        } else {
+            createTree(composite);
+            createTable(composite);
+               createDescriptionComposite(composite);
+        }
+        
+        
+        wizardPage.setPageComplete(wizardPage.validatePage());
+        return composite;
+    }
+
+    
+    private void createEmptyGitRepositoryComposite(Composite parent) {
+       Composite composite = new Composite(parent, SWT.NONE);          
+               GridLayout gridLayout = new GridLayout(1, false);
+        gridLayout.marginHeight = 0;
+        gridLayout.marginWidth = 0;
+        composite.setLayout(gridLayout);
+        GridData gridData = new GridData(GridData.FILL_BOTH);
+        gridData.minimumWidth = this.browserWidth;
+        composite.setLayoutData(gridData); 
+
+        Label emptyGitDescription = new Label(composite, SWT.NONE       ) ;
+        emptyGitDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL,true, true));
+        emptyGitDescription.setAlignment(SWT.CENTER);
+        emptyGitDescription.setText("No Git information! \nUpdate Git Configuration in \"Preferences->Tizen SDK->Platform->Git Configuration\"");
+        
+    }
+
+    
+    private void createTable(Composite parent) {
+        this.table = new Table(parent, SWT.FULL_SELECTION);
+        TableColumn column = new TableColumn(this.table, SWT.NONE);
+        column.setResizable(true);
+        column.setWidth(this.tableWidth);
+        
+        GridData tableGridData = new GridData(GridData.FILL_BOTH);
+        tableGridData.minimumWidth = this.tableWidth;
+        table.setLayoutData(tableGridData);
+        
+        createTableListener();
+        
+        this.table.setBackgroundImage(ImageUtil.getImage(Activator.PLUGIN_ID, IMAGE_TABLE_BG));
+    }
+
+    private void createTableListener() {
+       final String label = this.getLabel();
+        table.addSelectionListener(new SelectionListener() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+               boolean errorOccured = false;
+                if(table.getSelection() != null && table.getSelection().length > 0 ) {
+                       TizenPlatformTemplateModel templateModel = (TizenPlatformTemplateModel) table.getSelection()[0].getData();
+                    EntryDescriptor ed = templateModel.getEntryDescriptor();
+                    wizardPage.setLastSelectedTemplate(templateModel);
+                    wizardPage.switchTo(ed.getHandler(), ed);
+                    
+                    if (label.equals(GIT_CATEGORY)) {                          
+                       GitDescription desc = templateModel.getDesc();
+                       if (desc == null) {
+                               return;
+                       }
+                       String gitBaseURI = PreferencesManager.getActiveGitBaseURI();
+                       if (gitBaseURI == "") {
+                               return;
+                       }
+                       
+                       ArrayList<String> inputs = new ArrayList<String>();
+                       if (errorOccured) {
+                               inputs.add(resources.getString("WizardPage.GitInfo.Error") + 
+                                               TABLE_DATA_DELIMITER + resources.getString("WizardPage.GitError.FailedGet.Messsage"));
+                               inputs.add(" " + 
+                                               TABLE_DATA_DELIMITER + resources.getString("WizardPage.GitError.CantCreate.Messsage"));
+                       } else {
+                               inputs.add(resources.getString("WizardPage.GitInfo.Description") + 
+                                               TABLE_DATA_DELIMITER + desc.getDesc());                         
+                               inputs.add(resources.getString("WizardPage.GitInfo.Owner") + 
+                                               TABLE_DATA_DELIMITER + desc.getOwner());
+                       }
+                       gitDescTable.setInput(inputs);
+                                       
+                    } else {
+                       descBrowser.setUrl(templateModel.getDescPath().toOSString());
+                    }
+                    if (errorOccured) {
+                       wizardPage.setPageError(true);
+                    } else {
+                       wizardPage.setPageError(false);                  
+                    }
+                    wizardPage.setPageComplete(wizardPage.validatePage());
+                }
+            }
+            
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+        });
+        
+        // margin
+        table.addListener(SWT.MeasureItem, new Listener() {
+            public void handleEvent(Event event) {
+                TableItem item = (TableItem) event.item;
+                String text = item.getText(event.index);
+                Point size = event.gc.textExtent(text);
+                event.width = size.x + 2 * textMargin;
+                event.height = Math.max(event.height, size.y + textMargin);
+            }
+        });
+        // gradient
+        table.addListener(SWT.EraseItem, new Listener() {
+            public void handleEvent(Event event) {
+                event.detail &= ~SWT.HOT;
+                if ((event.detail & SWT.SELECTED) == 0) {
+                    table.drawBackground(event.gc, 0, event.y, tableWidth, event.height, 0, 0);
+                    return; /* item not selected */
+                }
+                
+                GC gc = event.gc;
+                Color oldForeground = gc.getForeground();
+                Color oldBackground = gc.getBackground();
+                gc.setForeground(topColor);
+                gc.setBackground(bottomColor);
+                gc.fillGradientRectangle(0, event.y, tableWidth, event.height, true);
+                gc.setForeground(oldForeground);
+                gc.setBackground(oldBackground);
+                event.detail &= ~SWT.SELECTED;
+            }
+        });
+    }   
+    
+    private void createDescriptionComposite(Composite parent) {
+        descBrowser = new Browser(parent, SWT.NONE);
+        initializebrowser(SWTUtil.getDisplay(), descBrowser);
+        GridData gridData = new GridData(GridData.FILL_BOTH);
+        gridData.minimumWidth = browserWidth;
+        descBrowser.setLayoutData(gridData);
+    }
+    
+
+    private void createGitDescriptionComposite(Composite parent) {
+       Composite composite = new Composite(parent, SWT.NONE);          
+               GridLayout gridLayout = new GridLayout(1, false);
+        gridLayout.marginHeight = 0;
+        gridLayout.marginWidth = 0;
+        composite.setLayout(gridLayout);
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH)); 
+        
+        createGitInfoComposite(composite);
+    }
+
+    
+    private void createGitInfoComposite(Composite parent) {            
+       gitDescTable = new TableViewer(parent, SWT.NONE);
+       
+       Table table = gitDescTable.getTable();
+       table.setLinesVisible(true);            
+               
+               gitDescTable.setLabelProvider(new TableViewerProvider());               
+               gitDescTable.setContentProvider(new ArrayContentProvider());
+               
+        TableColumn column = new TableColumn(table, SWT.NONE);        
+        column.setResizable(true);
+        //column.setWidth(this.tableWidth);
+        column.setWidth(100);           
+        
+        column = new TableColumn(table, SWT.FILL);
+        column.setResizable(true);
+        column.setWidth(318);
+        
+        GridData tableGridData = new GridData(GridData.FILL_BOTH);
+        tableGridData.minimumWidth = this.browserWidth;
+        table.setLayoutData(tableGridData);            
+    }
+    
+       private class TableViewerProvider extends LabelProvider implements ITableLabelProvider 
+       {
+               @Override
+               public Image getColumnImage(Object element, int columnIndex) {
+                       return null;
+               }
+
+               @Override
+               public String getColumnText(Object element, int columnIndex) {
+                       String[] splitValues = ((String)element).split("::");                   
+                       switch(columnIndex) {
+                       case 0:
+                               return splitValues[0];
+                       case 1:
+                               if (splitValues.length == 2) {
+                                       return splitValues[1];
+                               } else {
+                                       return "";
+                               }
+                       default:
+                               break;
+                       }
+                       return null;
+               }
+       }
+    
+    private void createTree(Composite parent) {
+        // Type Tree View
+        this.tree = new Tree(parent, SWT.NONE);
+        
+        // set layout data
+        GridData treeGridData = new GridData(GridData.FILL_BOTH);
+        treeGridData.minimumWidth = 200;
+        this.tree.setLayoutData(treeGridData);
+        
+        createTreeItem(parent, modelRoot.getEntries());
+        createTreeListener();
+        
+        makeGradientTree(this.tree);
+        if (!modelRoot.getName().equals(GIT_CATEGORY)) {
+               SWTUtil.expandTree(this.tree);
+        }
+        this.tree.setBackgroundImage(ImageUtil.getImage(Activator.PLUGIN_ID, IMAGE_TREE_BG));
+    }
+
+    private void createTreeListener() {
+        this.tree.addSelectionListener(new SelectionListener() {
+            
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                if(tree.getSelection() != null && tree.getSelection().length > 0) {
+                    TreeItem selectedItem = tree.getSelection()[0];
+                    Object data = selectedItem.getData();
+                    
+                    List<TizenNativeTemplateModel> templateList = ((TizenNativeTreeGroupModel)(data)).getTemplateList();
+                    if(templateList.size() > 0) {
+                        createTableItem(templateList);
+                    }
+                    else {
+//                        descBrowser.setVisible(false);
+                        wizardPage.setLastSelectedTemplate(null);
+                        wizardPage.h_selected = null;
+                        wizardPage.setPageComplete(wizardPage.validatePage());
+                        table.removeAll();
+                    }
+                }
+            }
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+        });
+    }
+
+    private void createTableItem(List<TizenNativeTemplateModel> templates) {
+        this.table.removeAll();
+        this.table.setLinesVisible(false);
+        
+        for(TizenNativeTemplateModel template: templates) {
+            TableItem tableItem = new TableItem(table, SWT.NONE);
+            tableItem.setText(template.getName());
+            tableItem.setData(template);
+            
+            IPath iconPath = template.getIconPath();
+            
+            Image wizardIconImage = null;
+            if(iconPath != null) {
+                wizardIconImage = ImageUtil.getImage(ImageDescriptor.createFromFile(null, iconPath.toOSString()));
+            }
+            else {
+                wizardIconImage = ImageUtil.getImage(Activator.PLUGIN_ID, TizenMainWizardPage.DEFAULT_WIZARD_ICON);
+            }
+            
+            tableItem.setImage(wizardIconImage);
+        }
+        
+        if(templates.size() > 0) {
+            Event e = new Event();
+            table.select(0);
+            e.item = this.table.getSelection()[0];
+            this.table.notifyListeners(SWT.Selection, e);
+        }
+    }
+
+    
+    private void createTreeItem(Composite parent,
+            List<TizenNativeTreeGroupModel> entries) {
+        
+        Stack<TizenNativeTreeGroupModel> entryStack = new Stack<TizenNativeTreeGroupModel>();
+        Stack<TreeItem> treeStack = new Stack<TreeItem>();
+        
+        for (TizenNativeTreeGroupModel entry : entries) {
+            TreeItem treeItem = new TreeItem(this.tree, SWT.None);
+            treeItem.setText(entry.getName());
+            treeItem.setData(entry);
+            entryStack.push(entry);
+            treeStack.push(treeItem);
+        }
+        
+        while(!entryStack.isEmpty()) {
+            TizenNativeTreeGroupModel entry = entryStack.pop();
+            TreeItem treeItem = treeStack.pop();
+            
+            for(TizenNativeTreeGroupModel subEntry: entry.getEntries()) {
+                TreeItem subTreeItem = new TreeItem(treeItem, SWT.None);
+                subTreeItem.setText(subEntry.getName());
+                subTreeItem.setData(subEntry);
+                entryStack.push(subEntry);
+                treeStack.push(subTreeItem);
+            }
+        }
+    }
+
+    @Override
+    protected void check() {
+    }
+    
+    private void initializebrowser(final Display currentDisplay, Browser pBrowser) {
+        
+        pBrowser.addOpenWindowListener(new OpenWindowListener() {
+            @Override
+            public void open(WindowEvent event) {
+                if (!event.required)
+                {
+                    return;    /* only do it if necessary */
+                }
+                Shell shell = new Shell(currentDisplay, SWT.CLOSE | SWT.MAX | SWT.MIN | SWT.RESIZE);
+                
+                GridLayout gridLayout = new GridLayout();
+                gridLayout.numColumns = 1;
+                shell.setLayout(gridLayout);
+                HelpBrowser childBrowser = new HelpBrowser(shell, SWT.BORDER, true);
+                
+                initializebrowser(currentDisplay, childBrowser.getBrowser());
+                event.browser = childBrowser.getBrowser();
+                shell.open();
+            }
+        });
+    }
+
+    public static void makeGradientTree(final Tree tree) {
+        /*
+         * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly.
+         * Therefore, it is critical for performance that these methods be
+         * as efficient as possible.
+         */
+        tree.addListener(SWT.EraseItem, new Listener() {
+            public void handleEvent(Event event) {
+                event.detail &= ~SWT.HOT;
+                if ((event.detail & SWT.SELECTED) != 0) {
+                    GC gc = event.gc;
+                    Rectangle area = tree.getClientArea();
+                    /*
+                     * If you wish to paint the selection beyond the end of
+                     * last column, you must change the clipping region.
+                     */
+                    int columnCount = tree.getColumnCount();
+                    if (event.index == columnCount - 1 || columnCount == 0) {
+                        int width = area.x + area.width - event.x;
+                        if (width > 0) {
+                            Region region = new Region();
+                            gc.getClipping(region);
+                            region.add(event.x, event.y, width, event.height);
+                            gc.setClipping(region);
+                            region.dispose();
+                        }
+                    }
+                    //gc.setAdvanced(true);
+                    //if (gc.getAdvanced()) gc.setAlpha(127);
+                    Rectangle rect = event.getBounds();
+                    Color foreground = gc.getForeground();
+                    Color background = gc.getBackground();
+                    gc.setForeground(topColor);
+                    gc.setBackground(bottomColor);
+                    gc.fillGradientRectangle(0, rect.y, 200, rect.height, true);
+                    
+                    // restore colors for subsequent drawing
+                    gc.setForeground(foreground);
+                    gc.setBackground(background);
+                    event.detail &= ~SWT.SELECTED;
+                }
+            }
+        });
+    }
+}
diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/messages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/ui/messages.properties
new file mode 100644 (file)
index 0000000..2071866
--- /dev/null
@@ -0,0 +1 @@
+TizenNativePWComposite_WizardToolTipText=Template name: {0}\nSample location: {1}
\ No newline at end of file
index 7afbfe8..c96e082 100644 (file)
@@ -1,5 +1,5 @@
-EmptyProject.Ctemplate.label=Empty Debian Project
-EmptyProject.Ctemplate.description=Empty Debian Project
+EmptyProject.Ctemplate.label=Empty Platform Project
+EmptyProject.Ctemplate.description=Empty Platform Project
 EmptyProject.basics.label=Advanced Settings
 EmptyProject.basics.description=Advanced properties of a project
 EmptyProject.author.label=Author
index 8e42f4c..1bd95a7 100644 (file)
@@ -1,95 +1,99 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
-               copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
-               id="HelloWorldProject" label="%HelloWorldProject.Ctemplate.label" description="%HelloWorldProject.Ctemplate.description"
-                help="help.html">
-       <property-group id="basics" label="%HelloWorldProject.basics.label" description="%HelloWorldProject.basics.description" type="PAGES-ONLY" help="help.html">
-               <property id="author"
-                       label="%HelloWorldProject.author.label"
-                       description="%HelloWorldProject.author.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.author.default"
-                       hidden="false"
-                       persist="false"/>
-               <property id="copyright"
-                       label="%HelloWorldProject.copyright.label"
-                       description="%HelloWorldProject.copyright.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.copyright.default"
-                       hidden="false"
-                       persist="false"/>
-               <property id="description"
-                       label="%HelloWorldProject.description.label"
-                       description="%HelloWorldProject.description.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.description.default"
-                       hidden="false"
-                       persist="false"/>
-               <property id="vendor"
-                       label="%HelloWorldProject.vendor.label"
-                       description="%HelloWorldProject.vendor.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.vendor.default"
-                       hidden="false"
-                       persist="false"/>
-               <property id="e-mail"
-                       label="%HelloWorldProject.e-mail.label"
-                       description="%HelloWorldProject.e-mail.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.e-mail.default"
-                       hidden="false"
-                       persist="false"/>
-       </property-group>
-       
-       <process type="org.tizen.nativecommon.TizenCreateSourceFolder">
-               <simple name="projectName" value="$(projectName)"/>
-               <simple name="path" value="src"/>
-       </process>
-       
-       <process type="org.eclipse.cdt.core.AddFiles">
-               <simple name="projectName" value="$(projectName)"/>
-               <complex-array name="files">
-                       <element>
-                               <simple name="source" value="src/hello.c"/>
-                               <simple name="target" value="src/hello.c"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>
-                       <element>
-                               <simple name="source" value="debian/rules"/>
-                               <simple name="target" value="debian/rules"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>
-                       <element>
-                               <simple name="source" value="debian/compat"/>
-                               <simple name="target" value="debian/compat"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>
-                       <element>
-                               <simple name="source" value="debian/control"/>
-                               <simple name="target" value="debian/control"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>
-                       <element>
-                               <simple name="source" value="debian/changelog"/>
-                               <simple name="target" value="debian/changelog"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>      
-                       <element>
-                               <simple name="source" value="debian/com.samsung.hello.install"/>
-                               <simple name="target" value="debian/com.samsung.hello.install"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>              
-               </complex-array>
-       </process>
+        copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+        id="HelloWorldProject" label="%HelloWorldProject.Ctemplate.label" description="%HelloWorldProject.Ctemplate.description"
+         help="help.html">
+    <property-group id="basics" label="%HelloWorldProject.basics.label" description="%HelloWorldProject.basics.description" type="PAGES-ONLY" help="help.html">
+        <property id="author"
+            label="%HelloWorldProject.author.label"
+            description="%HelloWorldProject.author.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.author.default"
+            hidden="false"
+            persist="false"/>
+        <property id="copyright"
+            label="%HelloWorldProject.copyright.label"
+            description="%HelloWorldProject.copyright.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.copyright.default"
+            hidden="false"
+            persist="false"/>
+        <property id="description"
+            label="%HelloWorldProject.description.label"
+            description="%HelloWorldProject.description.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.description.default"
+            hidden="false"
+            persist="false"/>
+        <property id="vendor"
+            label="%HelloWorldProject.vendor.label"
+            description="%HelloWorldProject.vendor.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.vendor.default"
+            hidden="false"
+            persist="false"/>
+        <property id="e-mail"
+            label="%HelloWorldProject.e-mail.label"
+            description="%HelloWorldProject.e-mail.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.e-mail.default"
+            hidden="false"
+            persist="false"/>
+    </property-group>
+    
+    <process type="org.tizen.nativecommon.TizenCreateSourceFolder">
+        <simple name="projectName" value="$(projectName)"/>
+        <complex-array name="pathList">
+            <element>
+                <simple name="path" value="src"/>
+            </element>
+        </complex-array>
+    </process>
+    
+    <process type="org.eclipse.cdt.core.AddFiles">
+        <simple name="projectName" value="$(projectName)"/>
+        <complex-array name="files">
+            <element>
+                <simple name="source" value="src/hello.c"/>
+                <simple name="target" value="src/hello.c"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="debian/rules"/>
+                <simple name="target" value="debian/rules"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="debian/compat"/>
+                <simple name="target" value="debian/compat"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="debian/control"/>
+                <simple name="target" value="debian/control"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="debian/changelog"/>
+                <simple name="target" value="debian/changelog"/>
+                <simple name="replaceable" value="true"/>
+            </element>    
+            <element>
+                <simple name="source" value="debian/com.samsung.hello.install"/>
+                <simple name="target" value="debian/com.samsung.hello.install"/>
+                <simple name="replaceable" value="true"/>
+            </element>        
+        </complex-array>
+    </process>
 
-       <process type="org.tizen.nativecommon.SetSBITarget">
-               <simple name="projectName" value="$(projectName)"/>
-       </process>
-       
-       
+    <process type="org.tizen.nativecommon.SetSBITarget">
+        <simple name="projectName" value="$(projectName)"/>
+    </process>
+    
+    
 </template>
index 7afbfe8..c96e082 100644 (file)
@@ -1,5 +1,5 @@
-EmptyProject.Ctemplate.label=Empty Debian Project
-EmptyProject.Ctemplate.description=Empty Debian Project
+EmptyProject.Ctemplate.label=Empty Platform Project
+EmptyProject.Ctemplate.description=Empty Platform Project
 EmptyProject.basics.label=Advanced Settings
 EmptyProject.basics.description=Advanced properties of a project
 EmptyProject.author.label=Author
index 8db3a56..99516aa 100644 (file)
@@ -1,5 +1,5 @@
-com.samsung.hello (1.0.0) unstable; urgency=low
+$(projectName) (0.0.0-1) unstable; urgency=low
 
-  *  Initial Release
+  * initial release
 
- -- Author <E-mail>  Fri, 22 Jul 2011 17:32:27 +0900
\ No newline at end of file
+ -- $(author) <$(e-mail)>  Sat, 24 Mar 2012 17:32:27 +0900
\ No newline at end of file
index 05ebaa0..2a60cb3 100644 (file)
@@ -2,12 +2,10 @@
 #    THIS FILE IS CREATED AUTOMATICALLY. DO NOT DELETE OR MODIFY THIS FILE.
 #################################################################################
 
-Source: com.samsung.hello
-Maintainer: Author <E-mail>
-Standards-Version: 1.0.0
+Source: com.samsung.$(projectName)
+Maintainer: $(author) <$(e-mail)>
+Standards-Version: 0.0.1
 
-Package: com.samsung.hello
-description: none
-Architecture: any
-XB-Permission: 
-XB-RequiredHardware: 
+Package: com.samsung.$(projectName)
+description: $(description)
+Architecture: any
\ No newline at end of file
index 88e033a..5590a02 100644 (file)
@@ -11,30 +11,30 @@ configure-stamp:
        dh_testdir
        # Add here commands to configure the package.
        touch configure-stamp
-       
+
 build: build-stamp
 build-stamp: configure-stamp
        dh_testdir
        # Add here commands to build the package.
        mkdir -p bin
-       $(CC) $(CFLAGS) $(LDFLAGS) src/hello.c -o bin/hello
+       $(CC) $(CFLAGS) $(LDFLAGS) src/$(projectName).c -o bin/$(projectName)
        touch build-stamp
-       
-clean: 
+
+clean:
        dh_testdir
        dh_testroot
        rm -f build-stamp configure-stamp
        # Add here commands to clean up before the build process.
        dh_clean
-       
+
 install: build
        dh_testdir
        dh_testroot
-       dh_clean -k 
+       dh_clean -k
        dh_installdirs
        # Add here commands to install the package.
        mkdir -p debian/tmp/usr/bin
-       cp bin/hello debian/tmp/usr/bin/
+       cp bin/$(projectName) debian/tmp/usr/bin/
 
 # Build architecture-independent files here.
 binary-indep: build install
@@ -43,12 +43,12 @@ binary-indep: build install
 binary-arch: build install
        dh_testdir
        dh_testroot
-       dh_installchangelogs 
+       dh_installchangelogs
        dh_installdocs
        dh_installexamples
        dh_install --sourcedir=debian/tmp
 #   dh_installmenu
-#   dh_installdebconf   
+#   dh_installdebconf
 #   dh_installlogrotate
 #   dh_installemacsen
 #   dh_installpam
@@ -59,12 +59,12 @@ binary-arch: build install
 #   dh_installinfo
        dh_installman
        dh_link
-       dh_strip
+#      dh_strip
        dh_compress
        dh_fixperms
 #   dh_perl
        dh_makeshlibs
-       dh_installdeb 
+       dh_installdeb
 #   dh_shlibdeps
        dh_gencontrol
        dh_md5sums
diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/packaging/hello.spec b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/packaging/hello.spec
new file mode 100644 (file)
index 0000000..95e5905
--- /dev/null
@@ -0,0 +1,34 @@
+Name: com.samsung.$(projectName)
+Version: 0.0.1
+Release: 1
+License: To be filled
+Summary: helloworld application (unstripped)
+Packager: $(author) <$(e-mail)>
+Group: Application
+Source: %{name}-%{version}.tar.gz
+%description
+$(description)
+
+%prep
+%setup -q
+
+%build
+mkdir -p bin
+gcc src/$(projectName).c -o bin/$(projectName)
+touch build-stamp
+
+%install
+echo "INSTALL"
+mkdir -p $RPM_BUILD_ROOT/usr/bin
+cp bin/$(projectName) $RPM_BUILD_ROOT/usr/bin
+
+%clean
+rm -f build-stamp configure-stamp
+
+%files
+%defattr(644, root, root)
+%attr(755, root, root) /usr/bin
+
+%changelog
+* Sat Mar 24 2012 Author <E-mail>
+ - initial release
\ No newline at end of file
index 8e42f4c..0244ab9 100644 (file)
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
-               copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
-               id="HelloWorldProject" label="%HelloWorldProject.Ctemplate.label" description="%HelloWorldProject.Ctemplate.description"
-                help="help.html">
-       <property-group id="basics" label="%HelloWorldProject.basics.label" description="%HelloWorldProject.basics.description" type="PAGES-ONLY" help="help.html">
-               <property id="author"
-                       label="%HelloWorldProject.author.label"
-                       description="%HelloWorldProject.author.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.author.default"
-                       hidden="false"
-                       persist="false"/>
-               <property id="copyright"
-                       label="%HelloWorldProject.copyright.label"
-                       description="%HelloWorldProject.copyright.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.copyright.default"
-                       hidden="false"
-                       persist="false"/>
-               <property id="description"
-                       label="%HelloWorldProject.description.label"
-                       description="%HelloWorldProject.description.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.description.default"
-                       hidden="false"
-                       persist="false"/>
-               <property id="vendor"
-                       label="%HelloWorldProject.vendor.label"
-                       description="%HelloWorldProject.vendor.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.vendor.default"
-                       hidden="false"
-                       persist="false"/>
-               <property id="e-mail"
-                       label="%HelloWorldProject.e-mail.label"
-                       description="%HelloWorldProject.e-mail.description"
-                       type="input"
-                       pattern=".*"
-                       default="%HelloWorldProject.e-mail.default"
-                       hidden="false"
-                       persist="false"/>
-       </property-group>
-       
-       <process type="org.tizen.nativecommon.TizenCreateSourceFolder">
-               <simple name="projectName" value="$(projectName)"/>
-               <simple name="path" value="src"/>
-       </process>
-       
-       <process type="org.eclipse.cdt.core.AddFiles">
-               <simple name="projectName" value="$(projectName)"/>
-               <complex-array name="files">
-                       <element>
-                               <simple name="source" value="src/hello.c"/>
-                               <simple name="target" value="src/hello.c"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>
-                       <element>
-                               <simple name="source" value="debian/rules"/>
-                               <simple name="target" value="debian/rules"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>
-                       <element>
-                               <simple name="source" value="debian/compat"/>
-                               <simple name="target" value="debian/compat"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>
-                       <element>
-                               <simple name="source" value="debian/control"/>
-                               <simple name="target" value="debian/control"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>
-                       <element>
-                               <simple name="source" value="debian/changelog"/>
-                               <simple name="target" value="debian/changelog"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>      
-                       <element>
-                               <simple name="source" value="debian/com.samsung.hello.install"/>
-                               <simple name="target" value="debian/com.samsung.hello.install"/>
-                               <simple name="replaceable" value="true"/>
-                       </element>              
-               </complex-array>
-       </process>
+        copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+        id="HelloWorldProject" label="%HelloWorldProject.Ctemplate.label" description="%HelloWorldProject.Ctemplate.description"
+         help="help.html">
+    <property-group id="basics" label="%HelloWorldProject.basics.label" description="%HelloWorldProject.basics.description" type="PAGES-ONLY" help="help.html">
+        <property id="author"
+            label="%HelloWorldProject.author.label"
+            description="%HelloWorldProject.author.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.author.default"
+            hidden="false"
+            persist="false"/>
+        <property id="copyright"
+            label="%HelloWorldProject.copyright.label"
+            description="%HelloWorldProject.copyright.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.copyright.default"
+            hidden="false"
+            persist="false"/>
+        <property id="description"
+            label="%HelloWorldProject.description.label"
+            description="%HelloWorldProject.description.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.description.default"
+            hidden="false"
+            persist="false"/>
+        <property id="vendor"
+            label="%HelloWorldProject.vendor.label"
+            description="%HelloWorldProject.vendor.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.vendor.default"
+            hidden="false"
+            persist="false"/>
+        <property id="e-mail"
+            label="%HelloWorldProject.e-mail.label"
+            description="%HelloWorldProject.e-mail.description"
+            type="input"
+            pattern=".*"
+            default="%HelloWorldProject.e-mail.default"
+            hidden="false"
+            persist="false"/>
+    </property-group>
+
+    <process type="org.tizen.nativecommon.TizenCreateSourceFolder">
+        <simple name="projectName" value="$(projectName)"/>
+        <complex-array name="pathList">
+            <element>
+                <simple name="path" value="src"/>
+            </element>
+        </complex-array>
+    </process>
+
+    <process type="org.eclipse.cdt.core.AddFiles">
+        <simple name="projectName" value="$(projectName)"/>
+        <complex-array name="files">
+            <element>
+                <simple name="source" value="src/hello.c"/>
+                <simple name="target" value="src/$(projectName).c"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="debian/rules"/>
+                <simple name="target" value="debian/rules"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="debian/compat"/>
+                <simple name="target" value="debian/compat"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="debian/control"/>
+                <simple name="target" value="debian/control"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="debian/changelog"/>
+                <simple name="target" value="debian/changelog"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="debian/com.samsung.hello.install"/>
+                <simple name="target" value="debian/com.samsung.$(projectName).install"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+            <element>
+                <simple name="source" value="packaging/hello.spec"/>
+                <simple name="target" value="packaging/$(projectName).spec"/>
+                <simple name="replaceable" value="true"/>
+            </element>
+        </complex-array>
+    </process>
+
+    <process type="org.tizen.nativecommon.SetSBITarget">
+        <simple name="projectName" value="$(projectName)"/>
+    </process>
+
 
-       <process type="org.tizen.nativecommon.SetSBITarget">
-               <simple name="projectName" value="$(projectName)"/>
-       </process>
-       
-       
 </template>
diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/PlatformProject/.buildproperties.xml b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/PlatformProject/.buildproperties.xml
new file mode 100644 (file)
index 0000000..2dc1f3f
--- /dev/null
@@ -0,0 +1 @@
+<BuildProperty><Project><Name>${CMAKE_TARGET}</Name></Project><Frameworks><Framework>capi-application-app_efl</Framework><Framework>capi-application-app_bundle</Framework><Framework>capi-base-i18n</Framework><Framework>elementary</Framework><Framework>ecore-x</Framework><Framework>ecore</Framework><Framework>evas</Framework><Framework>edje</Framework><Framework>dlog</Framework></Frameworks><Compiler><Type>C</Type><Flags>-Wall</Flags></Compiler><Includes><Path>${CMAKE_SOURCE_DIR}/include</Path></Includes><Linker><Libraries/><Paths/><Flags/></Linker><Symbols/><Debug><Level>g</Level></Debug><Optimization><Level>O0</Level></Optimization></BuildProperty>
\ No newline at end of file
diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/PlatformProject/template.properties b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/PlatformProject/template.properties
new file mode 100644 (file)
index 0000000..260212c
--- /dev/null
@@ -0,0 +1,19 @@
+PlatformProject.Ctemplate.label=Platform Project
+PlatformProject.Ctemplate.description=Platform Project
+PlatformProject.basics.label=Advanced Settings
+PlatformProject.basics.description=Advanced properties of a project
+PlatformProject.author.label=Author
+PlatformProject.author.description=Name of the author
+PlatformProject.author.default=Author
+PlatformProject.copyright.label=Copyright
+PlatformProject.copyright.description=Your copyright notice
+PlatformProject.copyright.default=Your copyright notice
+PlatformProject.vendor.label=Vendor
+PlatformProject.vendor.default=samsung
+PlatformProject.vendor.description=Enter your company or organization.
+PlatformProject.description.default=Platform Project
+PlatformProject.description.description=Enter a description about your application.
+PlatformProject.description.label=Description
+PlatformProject.e-mail.default=E-mail
+PlatformProject.e-mail.description=Enter your email address
+PlatformProject.e-mail.label=E-mail
diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/PlatformProject/template.xml b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/PlatformProject/template.xml
new file mode 100644 (file)
index 0000000..1c162f5
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="Intel Corporation"
+               copyright="Copyright (c) 2007 Intel Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html"
+               id="PlatformProject" label="%PlatformProject.Ctemplate.label" description="%PlatformProject.Ctemplate.description"
+                help="help.html">
+       <property-group id="basics" label="%PlatformProject.basics.label" description="%PlatformProject.basics.description" type="PAGES-ONLY" help="help.html">
+               <property id="author"
+                       label="%PlatformProject.author.label"
+                       description="%PlatformProject.author.description"
+                       type="input"
+                       pattern=".*"
+                       default="%PlatformProject.author.default"
+                       hidden="false"
+                       persist="false"/>
+               <property id="copyright"
+                       label="%PlatformProject.copyright.label"
+                       description="%PlatformProject.copyright.description"
+                       type="input"
+                       pattern=".*"
+                       default="%PlatformProject.copyright.default"
+                       hidden="false"
+                       persist="false"/>
+               <property id="description"
+                       label="%PlatformProject.description.label"
+                       description="%PlatformProject.description.description"
+                       type="input"
+                       pattern=".*"
+                       default="%PlatformProject.description.default"
+                       hidden="false"
+                       persist="false"/>
+               <property id="vendor"
+                       label="%PlatformProject.vendor.label"
+                       description="%PlatformProject.vendor.description"
+                       type="input"
+                       pattern=".*"
+                       default="%PlatformProject.vendor.default"
+                       hidden="false"
+                       persist="false"/>
+               <property id="e-mail"
+                       label="%PlatformProject.e-mail.label"
+                       description="%PlatformProject.e-mail.description"
+                       type="input"
+                       pattern=".*"
+                       default="%PlatformProject.e-mail.default"
+                       hidden="false"
+                       persist="false"/>
+       </property-group>
+
+       
+       <process type="org.tizen.nativecommon.SetSBITarget">
+               <simple name="projectName" value="$(projectName)"/>
+       </process>
+       
+       <process type="org.tizen.nativeplatform.TizenTemplateProcess">
+        <simple name="projectName" value="$(projectName)"/>
+        <simple name="projType" value="org.tizen.nativeide.buildArtefactType.platform"/>
+    </process>
+    
+       <process type="org.tizen.nativeplatform.SetDefaultBuildOptions">
+               <simple name="projectName" value="$(projectName)"/>
+               <complex-array name="optionList">
+                       <element>
+                               <simple name="buildOption" value="--skip-conf-repos"/>                                                  
+                       </element>        
+                       <element>
+                               <simple name="buildOption" value="--include-all"/>                                                      
+                       </element>
+                       <element>
+                               <simple name="buildOption" value="--keep-packs"/>                                                       
+                       </element>
+               </complex-array>
+       </process>      
+       
+</template>
index 741790c..7727aac 100755 (executable)
-#!/bin/bash -x
-
-build_path=${SRCDIR}/build_result
-
-__set_parameter()
-{
-       build_id=${package_name}
-       build_type=N
-       build_result_directory=${build_type}.${build_id}
-       build_result_path="$build_path/$build_result_directory"
-       architecture=x86
-       ide_root_path_name=IDE
-
-       case ${platform} in
-               linux)
-                       archive_platform_name=linux
-                       windowing=gtk
-                       ;;
-               windows)
-                       archive_platform_name=win32
-                       windowing=win32
-                       ;;
-               *)
-                       echo "${platform} is not support yet."
-                       ;;
-       esac
-
-       result_archive_file=${build_id}-${archive_platform_name}.${windowing}.${architecture}.zip
-}
-
-__set_build_parameter()
-{
-       case ${platform} in
-               linux)
-                       reference_ide_path=${ROOTDIR}/indigo-pde/eclipse
-                       ;;
-               windows)
-                       reference_ide_path=${ROOTDIR}/indigo-winpde/eclipse
-                       ;;
-               *)
-                       echo "${platform} is not support yet."
-                       ;;
-       esac
-}
-
-__set_install_parameter()
-{
-       INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${platform}/data
-}
-
-__clean_build_environment()
-{
-       if [ -d $build_path ]
-       then
-               echo "Build result directory : [$build_path]"
-       else
-               echo "Make build result directory [$build_path]"
-               mkdir -p $build_path
-       fi
-
-       echo "Remove legacy build files..."
-       if [ -d ${build_result_path}/${archive_platform_name}.${windowing}.${architecture} ]
-       then
-               rm -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}
-       fi
-       if [ -e ${build_result_path}/${result_archive_file} ]
-       then
-               rm -rf ${build_result_path}/${result_archive_file}
-       fi
-       if [ -d ${build_path}/tmp ]
-       then
-               rm -rf ${build_path}/tmp
-       fi
-
-       if [ -d ${build_path}/buildRepo ]
-       then
-               rm -rf ${build_path}/buildRepo
-       fi
-
-       rm -r ${build_path}/*.xml
-       rm -r ${build_path}/*.properties
-       rm -r ${build_path}/*.clean
-
-
-       if [ -d $build_path/plugins ]
-       then
-               echo "plugins directory recreate..."
-               rm -rf $build_path/plugins
-               mkdir $build_path/plugins
-       else
-               echo "Make plugins directory..."
-               mkdir $build_path/plugins
-       fi
-       if [ -d $build_path/features/ ]
-       then
-               echo "features directory recreate..."
-               rm -rf $build_path/features
-               mkdir $build_path/features
-       else
-               echo "Make features directory..."
-               mkdir $build_path/features
-       fi
-
-}
-
-__copy_build_sources()
-{
-       echo "Copy features from $SRCDIR to $build_path/features"
-       cp -r $SRCDIR/*.feature $build_path/features
-
-       echo "Copy plugins from $SRCDIR to $build_path/plugins"
-       cp -r $SRCDIR/* $build_path/plugins
-       rm -rf $build_path/plugins/*.feature
-}
-
-__copy_dependency_plugins()
-{
-       dependency_plugin_path=${ROOTDIR}/${ide_root_path_name}
-       if [ -d ${dependency_plugin_path} ]
-       then
-               cp -rf ${dependency_plugin_path}/features/* ${build_path}/features/
-               cp -rf ${dependency_plugin_path}/plugins/* ${build_path}/plugins/
-       fi
-}
-
-__make_ant_build_properties_file()
-{
-       builder_path="${SRCDIR}/builder"
-       parent_path_of_based_eclipse=${reference_ide_path}/..
-
-       echo "Make build.properties file..."
-       if [ ! -e $builder_path/build.properties.clean ] ; then
-               echo "ERROR : \"build.properties.clean\" file does not exist..."
-               exit 1
-       fi
-       cp $builder_path/build.properties.clean $build_path
-       cp $builder_path/customTargets.xml $build_path
-
-       if [ -d $reference_ide_path ] 
-       then
-               sed -e "s;\(^buildDirectory=\).*;\1${build_path};g" \
-               -e "s;\(^base=\).*;\1${parent_path_of_based_eclipse};g" \
-               -e "s;\(^baseLocation=\).*;\1${reference_ide_path};g" \
-               -e "s;\(^configs=\).*;\1${archive_platform_name},${windowing},${architecture};g" \
-               -e "s;\(^buildType=\).*;\1${build_type};g" \
-               -e "s;\(^buildId=\).*;\1${build_id};g" \
-               -e "s;\(^archivePrefix=\).*;\1${build_id};g" \
-               < $build_path/build.properties.clean > $build_path/build.properties
-
-       else
-               echo "ERROR : target eclipse is not exist."
-               exit 1
-       fi
-}
-
-__execute_pde_build()
-{
-       echo "Execute Product Ant Builder..."
-       equinox_launcher=`echo org.eclipse.equinox.launcher_*.jar`
-       pde_build=`echo org.eclipse.pde.build_*`
-
-       java -jar ${reference_ide_path}/plugins/$equinox_launcher -application org.eclipse.ant.core.antRunner -buildfile ${reference_ide_path}/plugins/$pde_build/scripts/productBuild/productBuild.xml -Dbuilder=$build_path -Dosgi.locking=none 2>&1
-
-       if [ $? != 0 ];
-       then
-               echo "Build failed..."
-               exit 1
-       fi
-}
-
-__unzip_plugin_pack()
-{
-       echo "unzip to $build_result_path"
-       unzip -a $build_result_path/${result_archive_file} -d $build_result_path/${archive_platform_name}.${windowing}.${architecture}
-}
-
-build_plugins()
-{
-       case ${platform} in
-               linux)
-                       echo "build plugin for ${platform}"
-                       ;;
-               windows)
-                       echo "build plugin for ${platform}"
-                       ;;
-               *)
-                       echo "${platform} is not support yet."
-                       exit 1
-                       ;;
-       esac
-
-       __set_parameter
-       __set_build_parameter
-       __clean_build_environment
-       __copy_build_sources
-       __copy_dependency_plugins
-       __make_ant_build_properties_file
-       __execute_pde_build
-       __unzip_plugin_pack
-
-       echo "Build SUCCESS. You will find SDK IDE in \"${build_result_path}\"."
-}
-
-__clean_packaging_environment()
-{
-
-       if [ -d ${INSTALL_DIR} ]
-       then
-               rm -rf ${INSTALL_DIR}
-       else
-               mkdir -p ${INSTALL_DIR}
-       fi
-}
+#!/bin/bash -xe
 
 __copy_necessary_binaries()
 {
-       echo "add necessary files."
-       ## ex) cp -rf ~~~~/file.file ${INSTALL_DIR}/${ide_root_path_name}/
+    echo "add necessary files."
+    ## ex)
+    ##     ide_root_path_name=IDE
+    ##     cp -rf ~~~~/file.file ${INSTALL_DIR}/${ide_root_path_name}/
 }
 
-packaging_plugins()
+__set_parameter()
 {
-       __set_parameter
-       __set_install_parameter
-
-       __clean_packaging_environment
-       __copy_necessary_binaries
-
-       install_ide_path=${INSTALL_DIR}/${ide_root_path_name}
-       
-       if [ ! -d ${install_ide_path} ]
-       then
-               mkdir -p ${install_ide_path}
-       fi
-
-       cp -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}/${package_name}/* ${install_ide_path}/
+       echo "TARGET_OS : ${TARGET_OS}"
+       build_script_path=${ROOTDIR}/pde-build
 }
 
 # clean
 clean()
 {
-       echo "=========================================CLEAN============================================"
-       make clean
-       rm -rf ${SRCDIR}/*.zip
-       rm -rf ${SRCDIR}/*.tar.gz
-       rm -rf ${build_path}
+    echo "=========================================CLEAN============================================"
+    __set_parameter
+    ${build_script_path}/clean.sh ${package_name}
 }
 
 # build
 build() 
 {
-       echo "=========================================BUILD============================================"
-       pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
-       for pkgname_and_platform in ${pkgname_and_platform_list}
-       do
-               pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
-               package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
-               platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
-       
-               if [ "x${BUILD_TARGET_OS}" = "x${platform}" ]
-               then
-                       build_plugins
-               else
-                       echo ""
-               fi
-       done
+    echo "=========================================BUILD============================================"
+    pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+    for pkgname_and_platform in ${pkgname_and_platform_list}
+    do
+        pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+        package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+        platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+    
+        if [ "x${TARGET_OS}" = "x${platform}" ]
+        then
+            __set_parameter
+            ${build_script_path}/build.sh ${package_name}
+       else
+            echo ""
+        fi
+    done
 }
 
 # install
 install() 
 {
-       pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
-       for pkgname_and_platform in ${pkgname_and_platform_list}
-       do
-               echo "=========================================INSTALL============================================"
-               pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
-               package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
-               platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
-
-               if [ "x${BUILD_TARGET_OS}" = "x${platform}" ]
-               then
-                       packaging_plugins
-               else
-                       echo ""
-               fi
-       done    
+    pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+    for pkgname_and_platform in ${pkgname_and_platform_list}
+    do
+        echo "=========================================INSTALL============================================"
+        pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+        package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+        platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+
+        if [ "x${TARGET_OS}" = "x${platform}" ]
+        then
+            __set_parameter
+               INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${TARGET_OS}/data
+            mkdir -p ${INSTALL_DIR} 
+            __copy_necessary_binaries
+            ${build_script_path}/install.sh ${package_name}
+        else
+            echo ""
+        fi
+    done    
 }
 
 [ "$1" = "clean" ] && clean
 [ "$1" = "build" ] && build
 [ "$1" = "install" ] && install
-exit 0
diff --git a/package/changelog b/package/changelog
new file mode 100644 (file)
index 0000000..b53378f
--- /dev/null
@@ -0,0 +1,96 @@
+* 1.0.46
+- Modified plugin provider and name
+== donghyuk yang <donghyuk.yang@samsung.com> 2013-02-14
+* 1.0.45
+- Fixed bug for comparing GBS version
+== donghyuk yang <donghyuk.yang@samsung.com> 2013-02-08
+* 1.0.44
+- Fixed a bug for cancel action on import dialog
+== donghyuk yang <donghyuk.yang@samsung.com> 2013-01-21
+* 1.0.43
+- Modified export/import rootstrap process
+== donghyuk yang <donghyuk.yang@samsung.com> 2013-01-21
+* 1.0.42
+- Set --include-all option to gbs as default
+== donghyuk yang <donghyuk.yang@samsung.com> 2013-01-18
+* 1.0.41
+- Do not show log on console for unimportant package manager action
+== donghyuk yang <donghyuk.yang@samsung.com> 2013-01-16
+* 1.0.40
+- Added --nodeps --ignorearch option to rpm when installing local package
+== donghyuk yang <donghyuk.yang@samsung.com> 2013-01-16
+* 1.0.39
+- Removed AgentProject template
+== donghyuk yang <donghyuk.yang@samsung.com> 2013-01-14
+* 1.0.38
+- Fixed a bug that modified rootstrap use local path
+== donghee yang <donghee.yang@samsung.com> 2013-01-09
+* 1.0.37
+- Added Boilerplate
+- Added --incremental option to GBS tool as default option
+== donghyuk.yang <donghyuk.yang@samsung.com> 2013-01-04
+* 1.0.36
+- Fixed a bug on gbs version checking
+- Fixed bug that sbi plugin-id does not allow dot(.)
+- Fixed invalid thread access bug when "Build Project"
+- Excluded sources when exporting rootstrap
+== donghee yang <donghee.yang@samsung.com> 2012-12-28
+* 1.0.35
+- Applied New GBS option 
+== donghee yang <donghee.yang@samsung.com> 2012-12-27
+* 1.0.34
+- Add wizard preference page
+== ho.namkoong <ho.namkoong@samsung.com> 2012-12-21
+* 1.0.33
+- Merge branch "develop" into release
+- [develop] Reinitialize SBI after adding and removing rootstrap
+- Fix express mode bug in platform wizard
+- Reinitialize SBI after adding and removing rootstrap
+== donghyuk.yang <donghyuk.yang@samsung.com> 2012-12-18
+* 1.0.32
+- Merge branch "develop" into release
+- [develop] Added property tab for GBS Options
+- [develop] emoved Sample tab from project wizard
+- [develop] Added build config action set
+- [develop] Check to exist GBS tool
+== donghyuk.yang <donghyuk.yang@samsung.com> 2012-12-18
+* 1.0.31
+- Removed launch menu of Package Manager
+== donghyuk.yang <donghyuk.yang@samsung.com> 2012-12-05
+* 1.0.30
+- Removed macos-64 from supported OS
+== donghee yang <donghee.yang@samsung.com> 2012-11-28
+* 1.0.28
+- Merge branch "develop" into release
+== donghyuk.yang <donghyuk.yang@samsung.com> 2012-11-26
+* 1.0.27
+- Hide preference page for git config and added filter for proxy port
+== donghyuk.yang <donghyuk.yang@samsung.com> 2012-11-03
+* 1.0.26
+- Rollback status of package manager before latest merging
+- Fixed a bug for setting rootstrap path to xml file when modify rootstrap
+== donghyuk.yang <donghyuk.yang@samsung.com> 2012-11-03
+* 1.0.25
+- Merged latest changes
+- [develop] Fixed a bug that project from git is not working when using schema in base uri
+- [develop] Check a mismatch architecture between rootstrap and configuration when selecting rootstrap
+- [develop] Changed base directory of user rootstraps to "~/tizen-sdk-data"
+- [develop] Removed double quotation marks from wizard title and description
+= donghyuk.yang <donghyuk.yang@samsung.com> 2012-11-23
+* 1.0.24
+- Added dis upgrade feature to package manager
+- [develop] Modified method for passing environment variables to command launcher
+== donghyuk.yang <donghyuk.yang@samsung.com> 2012-11-22
+* 1.0.23
+- [develop] Added question dialog if rootstrap is not initialized
+- [develop] Do not pass rootstrap name and arch arguments to sbi action script
+== donghyuk.yang <donghyuk.yang@samsung.com> 2012-11-21
+* 1.0.22
+- [develop] Release for test
+== donghee.yang <donghee.yang@samsung.com> 2012-11-21
+* 1.0.21
+- [develop] Applied new Platfrom SDK concept
+== ho.namkoong <ho.namkoong@samsung.com> 2012-11-15 15:39
+* 1.0.20
+- [develop] Create fundamental folder when creating native project
+== ho.namkoong <ho.namkoong@samsung.com> 2012-11-15 15:39
index 827d43c..f2a671e 100644 (file)
@@ -1,19 +1,17 @@
-Package:nativeplatform-eplugin
-Version:0.20.14
-OS:linux
-Build-host-os:linux
-Build-dependency:indigo-pde [linux], base-ide-product [linux], common-eplugin [linux], nativecommon-eplugin [linux]
-Install-dependency:base-ide-product [linux], common-eplugin [linux], nativecommon-eplugin [linux]
+Version:1.0.46
 Source:nativeplatform-eplugin
-Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park, Taeyoung Son
+Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park<yoonki.park@samsung.com>, Hyunsik Noh<hyunsik.noh@samsung.com>, Gun Kim<gune.kim@samsung.com>, Ho Namkoong<ho.namkoong@samsung.com>, Taeyoung Son<taeyoung2.son@samsung.com>
+
+Package:nativeplatform-eplugin
+OS:ubuntu-32
+Build-host-os:ubuntu-32
+Build-dependency:base-ide-product [ubuntu-32], pde-build [ubuntu-32], common-eplugin [ubuntu-32], nativecommon-eplugin [ubuntu-32], nativeappcommon-eplugin [ubuntu-32]
+Install-dependency:base-ide-product [ubuntu-32], common-eplugin [ubuntu-32], nativecommon-eplugin [ubuntu-32]
 Description:Nativeplatform plugin
 
 Package:nativeplatform-eplugin
-Version:0.20.14
-OS:windows
-Build-host-os:linux
-Build-dependency:indigo-winpde [windows], base-ide-product [windows], common-eplugin [windows], nativecommon-eplugin [windows]
-Install-dependency:base-ide-product [windows], common-eplugin [windows], nativecommon-eplugin [windows]
-Source:nativeplatform-eplugin
-Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park, Taeyoung Son
+OS:ubuntu-64
+Build-host-os:ubuntu-32
+Build-dependency:base-ide-product [ubuntu-64], pde-build [ubuntu-64], common-eplugin [ubuntu-64], nativecommon-eplugin [ubuntu-64], nativeappcommon-eplugin [ubuntu-64]
+Install-dependency:base-ide-product [ubuntu-64], common-eplugin [ubuntu-64], nativecommon-eplugin [ubuntu-64]
 Description:Nativeplatform plugin