diff options
author | Sungho Park <chywoo.park@samsung.com> | 2012-02-27 21:19:55 +0900 |
---|---|---|
committer | Sungho Park <chywoo.park@samsung.com> | 2012-02-27 21:19:55 +0900 |
commit | 76116242bead64170dc7cffe4a32290ab8d92d5e (patch) | |
tree | cf68c8225db6c58be87d41b971819e74cbc7f0e9 /org.tizen.nativeplatform | |
download | nativeplatform-eplugin-76116242bead64170dc7cffe4a32290ab8d92d5e.tar.gz nativeplatform-eplugin-76116242bead64170dc7cffe4a32290ab8d92d5e.tar.bz2 nativeplatform-eplugin-76116242bead64170dc7cffe4a32290ab8d92d5e.zip |
Initialize
Diffstat (limited to 'org.tizen.nativeplatform')
107 files changed, 8636 insertions, 0 deletions
diff --git a/org.tizen.nativeplatform/.classpath b/org.tizen.nativeplatform/.classpath new file mode 100644 index 00000000..ad32c83a --- /dev/null +++ b/org.tizen.nativeplatform/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/org.tizen.nativeplatform/.project b/org.tizen.nativeplatform/.project new file mode 100644 index 00000000..7ab51274 --- /dev/null +++ b/org.tizen.nativeplatform/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.tizen.nativeplatform</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/org.tizen.nativeplatform/.settings/org.eclipse.jdt.core.prefs b/org.tizen.nativeplatform/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..26a0e0bf --- /dev/null +++ b/org.tizen.nativeplatform/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Jul 20 14:43:03 KST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/org.tizen.nativeplatform/META-INF/MANIFEST.MF b/org.tizen.nativeplatform/META-INF/MANIFEST.MF new file mode 100644 index 00000000..a6686e15 --- /dev/null +++ b/org.tizen.nativeplatform/META-INF/MANIFEST.MF @@ -0,0 +1,38 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Tizen Native Inhouse +Bundle-SymbolicName: org.tizen.nativeplatform;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Activator: org.tizen.nativeplatform.Activator +Bundle-Vendor: Samsung +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.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" +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.internal.ui.launch, + org.eclipse.cdt.debug.mi.core, + 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.debug.core, + org.eclipse.debug.core.model, + org.eclipse.debug.ui, + org.eclipse.debug.ui.sourcelookup, + org.eclipse.ui, + org.eclipse.ui.dialogs, + org.tizen.common.connection diff --git a/org.tizen.nativeplatform/about.html b/org.tizen.nativeplatform/about.html new file mode 100644 index 00000000..20a744ae --- /dev/null +++ b/org.tizen.nativeplatform/about.html @@ -0,0 +1,26 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>May, 2011</p> +<h3>Tizen SDK</h3> + +<p><a href="https://developer.tizen.org/" target="_blank">Tizen SDK</a> +is a set of Eclipse plug-ins that helps programmers to develop applications for +the mobile platform.</p> + +<h3>License</h3> + +<p>See <a href="about_files/LICENSE-2.0.htm">Apache License, Version 2.0</a>.</p> + +<h3>Note</h3> +<p>jericho-html-3.1.jar, xpp3-1.1.4.jar, xstream-1.3.1.jar are under the Apache license Version 2.0. You can find a copy of the Apache License at <a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a></p> + +</body> +</html>
\ No newline at end of file diff --git a/org.tizen.nativeplatform/about_files/LICENSE-2.0.htm b/org.tizen.nativeplatform/about_files/LICENSE-2.0.htm new file mode 100644 index 00000000..f7ca6564 --- /dev/null +++ b/org.tizen.nativeplatform/about_files/LICENSE-2.0.htm @@ -0,0 +1,191 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html lang="en"> + <head> + <title>Apache License, Version 2.0</title> + + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> + <meta property="og:image" content="http://www.apache.org/images/asf_logo.gif" /> + + <link rel="stylesheet" type="text/css" media="screen" href="/css/style.css"> + <link rel="stylesheet" type="text/css" media="screen" href="/css/code.css"> + + <script type="text/javascript" src="/js/jquery.js"></script> + <script type="text/javascript" src="/js/apache_boot.js"></script> + + + + + <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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. --> + </head> + + <body> + <div id="page" class="container_16"> + <div id="header" class="grid_8"> + <h1>The Apache Software Foundation</h1> + <h2>Apache License, Version 2.0</h2> + </div> + + <div class="clear"></div> + <div id="content" class="grid_16"><div class="section-content"><p>Apache License<br></br>Version 2.0, January 2004<br></br> +<a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a> </p> +<p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p> +<p><strong><a name="definitions">1. Definitions</a></strong>.</p> +<p>"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document.</p> +<p>"Licensor" shall mean the copyright owner or entity authorized by the +copyright owner that is granting the License.</p> +<p>"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.</p> +<p>"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License.</p> +<p>"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation source, +and configuration files.</p> +<p>"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.</p> +<p>"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).</p> +<p>"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.</p> +<p>"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."</p> +<p>"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.</p> +<p><strong><a name="copyright">2. Grant of Copyright License</a></strong>. 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.</p> +<p><strong><a name="patent">3. Grant of Patent License</a></strong>. 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.</p> +<p><strong><a name="redistribution">4. Redistribution</a></strong>. 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:</p> +<ol> +<li> +<p>You must give any other recipients of the Work or Derivative Works a +copy of this License; and</p> +</li> +<li> +<p>You must cause any modified files to carry prominent notices stating +that You changed the files; and</p> +</li> +<li> +<p>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</p> +</li> +<li> +<p>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.</p> +</li> +</ol> +<p><strong><a name="contributions">5. Submission of Contributions</a></strong>. 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.</p> +<p><strong><a name="trademarks">6. Trademarks</a></strong>. 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.</p> +<p><strong><a name="no-warranty">7. Disclaimer of Warranty</a></strong>. 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.</p> +<p><strong><a name="no-liability">8. Limitation of Liability</a></strong>. 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.</p> +<p><strong><a name="additional">9. Accepting Warranty or Additional Liability</a></strong>. +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.</p> +<p>END OF TERMS AND CONDITIONS</p> + + <div class="clear"></div> + + </div> + <div id="copyright" class="container_16"> + <p>Copyright © 2011 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br/>Apache and the Apache feather logo are trademarks of The Apache Software Foundation.</p> + </div> + </body> +</html> diff --git a/org.tizen.nativeplatform/build.properties b/org.tizen.nativeplatform/build.properties new file mode 100644 index 00000000..3b874924 --- /dev/null +++ b/org.tizen.nativeplatform/build.properties @@ -0,0 +1,10 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/,\ + templates/,\ + plugin.properties,\ + about.html,\ + about_files/ diff --git a/org.tizen.nativeplatform/icons/Tizen_Custom_Debian_ConfigurationType_Image.gif b/org.tizen.nativeplatform/icons/Tizen_Custom_Debian_ConfigurationType_Image.gif Binary files differnew file mode 100644 index 00000000..f198283d --- /dev/null +++ b/org.tizen.nativeplatform/icons/Tizen_Custom_Debian_ConfigurationType_Image.gif diff --git a/org.tizen.nativeplatform/icons/Tizen_Custom_Debian_ConfigurationType_Image_Attach.gif b/org.tizen.nativeplatform/icons/Tizen_Custom_Debian_ConfigurationType_Image_Attach.gif Binary files differnew file mode 100644 index 00000000..f198283d --- /dev/null +++ b/org.tizen.nativeplatform/icons/Tizen_Custom_Debian_ConfigurationType_Image_Attach.gif diff --git a/org.tizen.nativeplatform/icons/Tizen_Custom_Debian_ConfigurationType_Image_Core.gif b/org.tizen.nativeplatform/icons/Tizen_Custom_Debian_ConfigurationType_Image_Core.gif Binary files differnew file mode 100644 index 00000000..f198283d --- /dev/null +++ b/org.tizen.nativeplatform/icons/Tizen_Custom_Debian_ConfigurationType_Image_Core.gif diff --git a/org.tizen.nativeplatform/icons/Tizen_Native_Application_ConfigurationType_Image.gif b/org.tizen.nativeplatform/icons/Tizen_Native_Application_ConfigurationType_Image.gif Binary files differnew file mode 100644 index 00000000..f198283d --- /dev/null +++ b/org.tizen.nativeplatform/icons/Tizen_Native_Application_ConfigurationType_Image.gif diff --git a/org.tizen.nativeplatform/icons/Tizen_Native_Application_ConfigurationType_Image_Attach.gif b/org.tizen.nativeplatform/icons/Tizen_Native_Application_ConfigurationType_Image_Attach.gif Binary files differnew file mode 100644 index 00000000..f198283d --- /dev/null +++ b/org.tizen.nativeplatform/icons/Tizen_Native_Application_ConfigurationType_Image_Attach.gif diff --git a/org.tizen.nativeplatform/icons/Tizen_Native_Application_ConfigurationType_Image_Core.gif b/org.tizen.nativeplatform/icons/Tizen_Native_Application_ConfigurationType_Image_Core.gif Binary files differnew file mode 100644 index 00000000..f198283d --- /dev/null +++ b/org.tizen.nativeplatform/icons/Tizen_Native_Application_ConfigurationType_Image_Core.gif diff --git a/org.tizen.nativeplatform/icons/af.png b/org.tizen.nativeplatform/icons/af.png Binary files differnew file mode 100644 index 00000000..bcd0ce8a --- /dev/null +++ b/org.tizen.nativeplatform/icons/af.png diff --git a/org.tizen.nativeplatform/icons/branding/perspective.png b/org.tizen.nativeplatform/icons/branding/perspective.png Binary files differnew file mode 100644 index 00000000..c40edcc5 --- /dev/null +++ b/org.tizen.nativeplatform/icons/branding/perspective.png diff --git a/org.tizen.nativeplatform/icons/build_configs.gif b/org.tizen.nativeplatform/icons/build_configs.gif Binary files differnew file mode 100644 index 00000000..c984fba7 --- /dev/null +++ b/org.tizen.nativeplatform/icons/build_configs.gif diff --git a/org.tizen.nativeplatform/icons/c_app.gif b/org.tizen.nativeplatform/icons/c_app.gif Binary files differnew file mode 100644 index 00000000..504ef509 --- /dev/null +++ b/org.tizen.nativeplatform/icons/c_app.gif diff --git a/org.tizen.nativeplatform/icons/c_file_obj.gif b/org.tizen.nativeplatform/icons/c_file_obj.gif Binary files differnew file mode 100644 index 00000000..bd603cff --- /dev/null +++ b/org.tizen.nativeplatform/icons/c_file_obj.gif diff --git a/org.tizen.nativeplatform/icons/device.gif b/org.tizen.nativeplatform/icons/device.gif Binary files differnew file mode 100644 index 00000000..abedbb00 --- /dev/null +++ b/org.tizen.nativeplatform/icons/device.gif diff --git a/org.tizen.nativeplatform/icons/device_view.gif b/org.tizen.nativeplatform/icons/device_view.gif Binary files differnew file mode 100644 index 00000000..111e3f9e --- /dev/null +++ b/org.tizen.nativeplatform/icons/device_view.gif diff --git a/org.tizen.nativeplatform/icons/directory.gif b/org.tizen.nativeplatform/icons/directory.gif Binary files differnew file mode 100644 index 00000000..5e0cb945 --- /dev/null +++ b/org.tizen.nativeplatform/icons/directory.gif diff --git a/org.tizen.nativeplatform/icons/directory_link.gif b/org.tizen.nativeplatform/icons/directory_link.gif Binary files differnew file mode 100644 index 00000000..ac837477 --- /dev/null +++ b/org.tizen.nativeplatform/icons/directory_link.gif diff --git a/org.tizen.nativeplatform/icons/duchain.gif b/org.tizen.nativeplatform/icons/duchain.gif Binary files differnew file mode 100644 index 00000000..b441cfd8 --- /dev/null +++ b/org.tizen.nativeplatform/icons/duchain.gif diff --git a/org.tizen.nativeplatform/icons/editors/debug.gif b/org.tizen.nativeplatform/icons/editors/debug.gif Binary files differnew file mode 100644 index 00000000..d90a29fe --- /dev/null +++ b/org.tizen.nativeplatform/icons/editors/debug.gif diff --git a/org.tizen.nativeplatform/icons/editors/help.gif b/org.tizen.nativeplatform/icons/editors/help.gif Binary files differnew file mode 100644 index 00000000..ae2c4c0a --- /dev/null +++ b/org.tizen.nativeplatform/icons/editors/help.gif diff --git a/org.tizen.nativeplatform/icons/editors/refresh.gif b/org.tizen.nativeplatform/icons/editors/refresh.gif Binary files differnew file mode 100644 index 00000000..e3831471 --- /dev/null +++ b/org.tizen.nativeplatform/icons/editors/refresh.gif diff --git a/org.tizen.nativeplatform/icons/editors/run.gif b/org.tizen.nativeplatform/icons/editors/run.gif Binary files differnew file mode 100644 index 00000000..57f41022 --- /dev/null +++ b/org.tizen.nativeplatform/icons/editors/run.gif diff --git a/org.tizen.nativeplatform/icons/emulator.gif b/org.tizen.nativeplatform/icons/emulator.gif Binary files differnew file mode 100644 index 00000000..7559ba16 --- /dev/null +++ b/org.tizen.nativeplatform/icons/emulator.gif diff --git a/org.tizen.nativeplatform/icons/external_browser.gif b/org.tizen.nativeplatform/icons/external_browser.gif Binary files differnew file mode 100644 index 00000000..71c98731 --- /dev/null +++ b/org.tizen.nativeplatform/icons/external_browser.gif diff --git a/org.tizen.nativeplatform/icons/file.gif b/org.tizen.nativeplatform/icons/file.gif Binary files differnew file mode 100644 index 00000000..b84737e9 --- /dev/null +++ b/org.tizen.nativeplatform/icons/file.gif diff --git a/org.tizen.nativeplatform/icons/file_link.gif b/org.tizen.nativeplatform/icons/file_link.gif Binary files differnew file mode 100644 index 00000000..e77773d7 --- /dev/null +++ b/org.tizen.nativeplatform/icons/file_link.gif diff --git a/org.tizen.nativeplatform/icons/folder_search.gif b/org.tizen.nativeplatform/icons/folder_search.gif Binary files differnew file mode 100644 index 00000000..0a03c7b4 --- /dev/null +++ b/org.tizen.nativeplatform/icons/folder_search.gif diff --git a/org.tizen.nativeplatform/icons/form_banner.gif b/org.tizen.nativeplatform/icons/form_banner.gif Binary files differnew file mode 100644 index 00000000..aebc0b2a --- /dev/null +++ b/org.tizen.nativeplatform/icons/form_banner.gif diff --git a/org.tizen.nativeplatform/icons/icon_application.png b/org.tizen.nativeplatform/icons/icon_application.png Binary files differnew file mode 100644 index 00000000..ef74fd1f --- /dev/null +++ b/org.tizen.nativeplatform/icons/icon_application.png diff --git a/org.tizen.nativeplatform/icons/import_wizard.png b/org.tizen.nativeplatform/icons/import_wizard.png Binary files differnew file mode 100644 index 00000000..bc567601 --- /dev/null +++ b/org.tizen.nativeplatform/icons/import_wizard.png diff --git a/org.tizen.nativeplatform/icons/large_image.gif b/org.tizen.nativeplatform/icons/large_image.gif Binary files differnew file mode 100644 index 00000000..c5c94ee9 --- /dev/null +++ b/org.tizen.nativeplatform/icons/large_image.gif diff --git a/org.tizen.nativeplatform/icons/list-delete.gif b/org.tizen.nativeplatform/icons/list-delete.gif Binary files differnew file mode 100644 index 00000000..af59a0b1 --- /dev/null +++ b/org.tizen.nativeplatform/icons/list-delete.gif diff --git a/org.tizen.nativeplatform/icons/localization/Error.png b/org.tizen.nativeplatform/icons/localization/Error.png Binary files differnew file mode 100644 index 00000000..f7df6912 --- /dev/null +++ b/org.tizen.nativeplatform/icons/localization/Error.png diff --git a/org.tizen.nativeplatform/icons/localization/POFileEditor_import.gif b/org.tizen.nativeplatform/icons/localization/POFileEditor_import.gif Binary files differnew file mode 100644 index 00000000..37dc14e5 --- /dev/null +++ b/org.tizen.nativeplatform/icons/localization/POFileEditor_import.gif diff --git a/org.tizen.nativeplatform/icons/newc_app.gif b/org.tizen.nativeplatform/icons/newc_app.gif Binary files differnew file mode 100644 index 00000000..5d2ba0f0 --- /dev/null +++ b/org.tizen.nativeplatform/icons/newc_app.gif diff --git a/org.tizen.nativeplatform/icons/package.png b/org.tizen.nativeplatform/icons/package.png Binary files differnew file mode 100644 index 00000000..1d37a5fe --- /dev/null +++ b/org.tizen.nativeplatform/icons/package.png diff --git a/org.tizen.nativeplatform/icons/package_installer.gif b/org.tizen.nativeplatform/icons/package_installer.gif Binary files differnew file mode 100644 index 00000000..f08a7f2d --- /dev/null +++ b/org.tizen.nativeplatform/icons/package_installer.gif diff --git a/org.tizen.nativeplatform/icons/packagelist_to_table.gif b/org.tizen.nativeplatform/icons/packagelist_to_table.gif Binary files differnew file mode 100644 index 00000000..9a92931d --- /dev/null +++ b/org.tizen.nativeplatform/icons/packagelist_to_table.gif diff --git a/org.tizen.nativeplatform/icons/remove.png b/org.tizen.nativeplatform/icons/remove.png Binary files differnew file mode 100644 index 00000000..fd972e9b --- /dev/null +++ b/org.tizen.nativeplatform/icons/remove.png diff --git a/org.tizen.nativeplatform/icons/sample.gif b/org.tizen.nativeplatform/icons/sample.gif Binary files differnew file mode 100644 index 00000000..34fb3c9d --- /dev/null +++ b/org.tizen.nativeplatform/icons/sample.gif diff --git a/org.tizen.nativeplatform/icons/spreadsheet.gif b/org.tizen.nativeplatform/icons/spreadsheet.gif Binary files differnew file mode 100644 index 00000000..33212b20 --- /dev/null +++ b/org.tizen.nativeplatform/icons/spreadsheet.gif diff --git a/org.tizen.nativeplatform/icons/th_horizontal.gif b/org.tizen.nativeplatform/icons/th_horizontal.gif Binary files differnew file mode 100644 index 00000000..f4c14a4e --- /dev/null +++ b/org.tizen.nativeplatform/icons/th_horizontal.gif diff --git a/org.tizen.nativeplatform/plugin.properties b/org.tizen.nativeplatform/plugin.properties new file mode 100644 index 00000000..a1f5f1f6 --- /dev/null +++ b/org.tizen.nativeplatform/plugin.properties @@ -0,0 +1,7 @@ +# Tizen Presentation +SLPPresentation.themelabel = Tizen Presentation +SLPPresentation.themedescription = Colors and fonts used by Tizen +SLPPresentation.editorlabel = Editor +SLPPresentation.editordescription = This font is used by Tizen's editors +SLPPresentation.fontlabel = Tizen C/C++ Editor Text Font +SLPPresentation.fontdescription = The C/C++ editor text font is used by C/C++ editors. diff --git a/org.tizen.nativeplatform/plugin.xml b/org.tizen.nativeplatform/plugin.xml new file mode 100644 index 00000000..643c46c4 --- /dev/null +++ b/org.tizen.nativeplatform/plugin.xml @@ -0,0 +1,702 @@ +<?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> + + <extension + point="org.eclipse.cdt.core.templates"> + <template + filterPattern=".*" + id="org.tizen.nativeapp.templates.custom.debian.EmptyProject" + location="templates/InhouseFrameworkPackages/EmptyProject/template.xml" + projectType="com.samsung.slp.nativeide.buildArtefactType.cdeb"> + </template> + <template + filterPattern=".*" + id="org.tizen.nativeapp.templates.custom.debian.HelloWorldProject" + location="templates/InhouseFrameworkPackages/HelloWorldProject/template.xml" + projectType="com.samsung.slp.nativeide.buildArtefactType.cdeb"> + </template> + <template + filterPattern=".*" + id="org.tizen.nativeapp.templates.custom.debian.EmptyProjectOld" + location="templates/CustomDebianPackages/EmptyProject/template.xml" + projectType="com.samsung.slp.buildArtefactType.custom.debian"> + </template> + <template + filterPattern=".*" + id="org.tizen.nativeapp.templates.custom.debian.HelloWorldProjectOld" + location="templates/CustomDebianPackages/HelloWorldProject/template.xml" + projectType="com.samsung.slp.buildArtefactType.custom.debian"> + </template> + </extension> + + <extension + point="org.eclipse.cdt.core.templateAssociations"> + <template + id="org.tizen.nativeapp.templates.custom.debian.HelloWorldProjectOld"> + <toolChain + id="com.samsung.slp.toolchain.custom.debian"> + </toolChain> + </template> + </extension> + + <extension + point="org.eclipse.ui.commands"> + <command + name="Build System" + id="org.tizen.nativeplatform.pkgInstall.commandid.rootstrapmgr"> + </command> + </extension> + + <extension + point="org.eclipse.ui.handlers"> + <handler + commandId="org.tizen.nativeplatform.pkgInstall.commandid.rootstrapmgr" + class="org.tizen.nativeplatform.pkgInstall.PackageManagerRootstrapHandler"> + </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" + isAbstract="false" + name="[SBOX2] GCC-4.5 Custom Debian" + osList="linux" + superClass="com.samsung.slp.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" + incrementalBuildTarget="build" + name="Tizen Custom Debian Builder"> + </builder> + <tool + id="com.samsung.slp.nativeide.tool.sbi.gnu.archiver.cdeb.base" + superClass="com.samsung.slp.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"> + <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"> + <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"> + <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"> + <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"> + <enablement + type="ALL"> + <false/> + </enablement> + </tool> + </toolChain> + + <projectType + buildArtefactType="com.samsung.slp.nativeide.buildArtefactType.cdeb" + id="com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb" + 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" + name="Tizen-Emulator"> + <toolChain + id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.emulator" + superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.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" + name="Tizen-Device"> + <toolChain + id="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.device" + superClass="com.samsung.slp.nativeide.toolchain.sbi.gcc45sbox2.cdeb.base"> + </toolChain> + </configuration> + </projectType> + </extension> + + <extension + point="org.eclipse.cdt.managedbuilder.core.buildProperties"> + <propertyValue + id="com.samsung.slp.nativeide.buildArtefactType.cdeb" + name="Tizen Custom Debian Project" + property="org.eclipse.cdt.build.core.buildArtefactType"> + </propertyValue> + </extension> + + <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" + mbsVersion="4.0.0" + name="Upgrade Tizen Custom Debian Project, GCC-4.5(SBOX2)" + toId="com.samsung.slp.nativebuild.target.sbi.gcc45sbox2.cdeb"> + </converter> + </extension> +<!-- build end --> + +<!-- wizard start --> + <extension + point="org.eclipse.ui.newWizards"> + <wizard + category="org.tizen.nativeapp.newCategory" + class="org.tizen.nativeplatform.wizards.TizenDebianProjectWizard" + finalPerspective="org.tizen.nativeapp.perspective" + icon="icons/newc_app.gif" + id="org.tizen.nativeapp.newCategory.customWizard" + name="Tizen Custom Debian Project" + preferredPerspectives="org.tizen.nativeapp.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> + </extension> + + <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" + public="true"/> + + <launchConfigurationType + delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForAttach" + id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach" + name="Tizen Custom Debian Project - Attach" + public="true"/> + + <launchConfigurationType + delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore" + id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore" + name="Tizen Custom Debian Project - Coredump" + public="true"/> + </extension> + + <extension + point="org.eclipse.debug.ui.launchConfigurationTypeImages"> + <launchConfigurationTypeImage + icon="icons/Tizen_Custom_Debian_ConfigurationType_Image.gif" + configTypeID="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType" + id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType.image"/> + + <launchConfigurationTypeImage + icon="icons/Tizen_Custom_Debian_ConfigurationType_Image_Attach.gif" + configTypeID="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach" + id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach.image"/> + + <launchConfigurationTypeImage + icon="icons/Tizen_Custom_Debian_ConfigurationType_Image_Core.gif" + configTypeID="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore" + id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore.image"/> + </extension> + + <extension + point="org.eclipse.debug.core.launchDelegates"> + <launchDelegate + 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" + sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator" + sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer" + type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType"/> + + <launchDelegate + 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" + 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" + sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator" + sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer" + type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore"/> + </extension> + + <extension + point="org.eclipse.debug.ui.launchConfigurationTabGroups"> + <launchConfigurationTabGroup + class="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationTabGroup" + id="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationTabGroup" + type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType"/> + + <launchConfigurationTabGroup + class="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationForAttachTabGroup" + id="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationForAttachTabGroup" + type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach"/> + + <launchConfigurationTabGroup + class="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationForCoreTabGroup" + id="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationForCoreTabGroup" + type="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore"/> + </extension> + + <extension + point="org.eclipse.debug.ui.launchConfigurationTabs"> + <tab + id="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab" + group="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationTabGroup" + name="Tizen Custom Debian 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" + group="org.tizen.nativeplatform.launch.ui.TizenDebianLaunchConfigurationForAttachTabGroup" + name="Tizen Custom Debian Project Main Tab" + class="org.tizen.nativeplatform.launch.ui.TizenDebianMainTab"> + <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" + class="org.tizen.nativeplatform.launch.ui.TizenDebianMainCoreTab"> + <associatedDelegate delegate="org.tizen.nativeplatform.launch.TizenDebianLaunchDelegateForCore"/> + </tab> + </extension> + + <extension + point="org.eclipse.core.expressions.propertyTesters"> + <propertyTester + namespace="org.tizen.nativeplatform.launch.ui.shortcut" + properties="isTizenCustomDebianProject, belongTizenCustomDebianProject" + type="org.eclipse.core.resources.IResource" + class="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianPropertyTester" + id="org.tizen.nativeplatform.launch.ui.shortcut.TizenDebianPropertyTester"/> + </extension> + + <extension + point="org.eclipse.debug.ui.launchShortcuts"> + <shortcut + label="Tizen Custom Debian 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> + </contextualLaunch> + <description + mode="run" + description="Runs a Tizen Custom Debian Project"/> + <description + mode="debug" + description="Debugs a Tizen Custom Debian Project"/> + <configurationType + id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType"> + </configurationType> + </shortcut> + + <shortcut + label="Tizen Custom Debian 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> + </contextualLaunch> + <description + mode="debug" + description="Attach Debugs a Tizen Custom Debian Project"/> + <configurationType + id="org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach"> + </configurationType> + </shortcut> + + <shortcut + label="Tizen Custom Debian 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> + </enablement> + </contextualLaunch> + <description + mode="debug" + description="Coredump Debugs a Tizen Custom Debian 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"> + <command + commandId="org.tizen.nativeplatform.pkgInstall.commandid.rootstrapmgr" + icon="icons/package_installer.gif" + tooltip="Launch Package Manager" + id="org.tizen.nativeplatform.pkgInatall.pkgtoolbar.pcommand.rootstrap"> + <visibleWhen + checkEnabled="false"> + <with variable="activeWorkbenchWindow.activePerspective"> + <equals value="org.tizen.nativeapp.perspective"/> + </with> + </visibleWhen> + </command> + </toolbar> + </menuContribution> + </extension> + + <extension + point="org.eclipse.ui.actionSets"> + <actionSet + label="Package Manager ActionSet" + visible="true" + id="org.tizen.nativeplatform.pkginstall.actionset"> + <menu + label="Package Manager" + path="additions" + id="org.tizen.nativeplatform.pkginstall.menuid"> + </menu> + <action + id="org.tizen.nativeplatform.pkginstall.action" + label="Package Manager" + menubarPath="window/additions" + class="org.tizen.nativeplatform.pkgInstall.DialogActionDelegate"> + </action> + </actionSet> + </extension> +<!-- package manager end --> +</plugin> diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/Activator.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/Activator.java new file mode 100644 index 00000000..27866a94 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/Activator.java @@ -0,0 +1,111 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform; + +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; + + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.tizen.nativeplatform"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + 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); + + ProjectTypeManager.registerProjectArtifactType( + PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE, + PlatformProjectDependentBuilder.getInstance(), + PlatformProjectDependentPackager.getInstance(), + true); + + //SLPProjectTypeManager.registerBuilder("SLP Custom Debian Package", CustomDebianProjectDependentBuilder.getInstance() ); + //SLPProjectTypeManager.registerBuilder("SLP Inhouse Framework Package", InhouseFrameworkProjectDependentBuilder.getInstance() ); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} + diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/CustomDebianConfigurationOld.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/CustomDebianConfigurationOld.java new file mode 100644 index 00000000..e81d9987 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/CustomDebianConfigurationOld.java @@ -0,0 +1,183 @@ +/* +* 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 +* +*/ +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.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.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.tizen.nativecommon.build.CommonConfigurationOld; + + + + +@SuppressWarnings("restriction") +public class CustomDebianConfigurationOld extends CommonConfigurationOld +{ + // get compiler flags + public static String getAllCFlags( IConfiguration config ) + { + return getAllCompilerFlags( config, SBI_BASE_C_COMPILER_TOOL_ID ); + } + + + public static String getAllCPPFlags( IConfiguration config ) + { + return getAllCompilerFlags( config, SBI_BASE_CPP_COMPILER_TOOL_ID ); + } + + + protected static String getAllCompilerFlags( IConfiguration config, String compilerId ) { + + ITool compilerTool = config.getToolsBySuperClassId(compilerId)[0]; + + String compilerFlags = ""; + + try { + compilerFlags = compilerTool.getToolFlags(); + + // skip "-c" option and replace double quotes + String[] flags = compilerFlags.split(" "); + compilerFlags = ""; + for( int i = 0; i < flags.length ; i ++ ) { + + if ( flags[i].compareTo("-c") == 0 ) { + continue; + } + + flags[i] = flags[i].replace("\"", "\\\""); + compilerFlags = compilerFlags + " " + flags[i]; + } + } catch (BuildException e) { + e.printStackTrace(); + } + + 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) { + 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); + } 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; + } + + 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; + + for (IToolChain tc : tcs) { + if ( tc.isSystemObject() && !(((ToolChain)tc).isPreferenceToolChain() && !isMng) ) { + // NO TOOLCHAIN + continue; + } + list.add(tc); + } + + 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; + } + } + + IToolChain tc = v_tcs[x]; + if (tc == null) return; + + + foim.setToolChain(tc); + + try { + mod.apply(); + } catch (CoreException e) { + ManagedBuilderUIPlugin.log(e); + } + } +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/CustomDebianProjectDependentBuilderOld.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/CustomDebianProjectDependentBuilderOld.java new file mode 100644 index 00000000..1a1f77bb --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/CustomDebianProjectDependentBuilderOld.java @@ -0,0 +1,129 @@ +/* +* 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 +* +*/ +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.tizen.nativecommon.build.CommonProjectDependentBuilder; +import org.tizen.nativecommon.build.exception.SBIException; + + +public class CustomDebianProjectDependentBuilderOld extends CommonProjectDependentBuilder { + + private static CustomDebianProjectDependentBuilderOld instance = new CustomDebianProjectDependentBuilderOld(); + + public static final CommonProjectDependentBuilder getInstance() { + return instance; + } + + public static final CommonProjectDependentBuilder getInstance(IProject project) { + instance.setProject(project); + return instance; + } + + private CustomDebianProjectDependentBuilderOld() { + super(); + } + + private CustomDebianProjectDependentBuilderOld(IProject project) { + super(project); + } + + @Override + protected String getElfInfoOption() { + return "-s -W"; + } + + @Override + protected String getConfigureOption() { + + String options = String.format(" "); + + return options; + } + + @Override + protected String getMakeOption() { + // TODO Auto-generated method stub + return ""; + } + + @Override + protected String getCleanOption() { + // TODO Auto-generated method stub + return ""; + } + + @Override + public String getTargetID() { + IConfiguration config = getConfiguration(); + return CustomDebianConfigurationOld.getBuildTargetName(config); + } + + @Override + public String getTargetID(IConfiguration config) { + return CustomDebianConfigurationOld.getBuildTargetName(config); + } + + @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 sysroot=""; + try { + sysroot = String.format("-sysroot=%s", getSbi().getRootstrapPath(getTargetID()) ); + } catch (SBIException e) { + e.printStackTrace(); + } + + return gdbOptions + sysroot; + } + + @Override + public void setBuildTargetID(IConfiguration config, String targetId) { + CustomDebianConfigurationOld.setBuildTargetName(config, targetId); + } + + @Override + public void setToolCommand(IConfiguration config, String rootstrapCfgName) { + CustomDebianConfigurationOld.setToolCommand(config, rootstrapCfgName); + } + + @Override + public void changeToolchain(IConfiguration config, + ICResourceDescription cfgd, String toolchainNameInCfg) { + CustomDebianConfigurationOld.changeToolchain(config, cfgd, toolchainNameInCfg); + } + +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformConfigurationEnvVarSupplier.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformConfigurationEnvVarSupplier.java new file mode 100644 index 00000000..eaf3639e --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformConfigurationEnvVarSupplier.java @@ -0,0 +1,62 @@ +/* +* 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 +* +*/ +package org.tizen.nativeplatform.build; + +import java.util.ArrayList; + +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable; +import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier; +import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider; +import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar; + +public class PlatformConfigurationEnvVarSupplier implements + IConfigurationEnvironmentVariableSupplier { + + @Override + public IBuildEnvironmentVariable getVariable(String variableName, + IConfiguration configuration, IEnvironmentVariableProvider provider) { + // set "SBI_SYSROOT" variable + String sysrootPath = PlatformConfigurationManager.getRootstrapPath( configuration ); + return new BuildEnvVar("SBI_SYSROOT", sysrootPath, IBuildEnvironmentVariable.ENVVAR_REPLACE, null ); + } + + @Override + public IBuildEnvironmentVariable[] getVariables( + IConfiguration configuration, IEnvironmentVariableProvider provider) { + + ArrayList<IBuildEnvironmentVariable> list = new ArrayList<IBuildEnvironmentVariable>(); + + // set "SBI_SYSROOT" variable + String sysrootPath = PlatformConfigurationManager.getRootstrapPath( configuration ); + list.add( new BuildEnvVar("SBI_SYSROOT", sysrootPath, IBuildEnvironmentVariable.ENVVAR_REPLACE, null ) ); + return list.toArray( new IBuildEnvironmentVariable[0] ); + } + +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformConfigurationManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformConfigurationManager.java new file mode 100644 index 00000000..66360c7e --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformConfigurationManager.java @@ -0,0 +1,301 @@ +/* +* 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 +* +*/ +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.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.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.tizen.nativecommon.build.CommonConfigurationManager; +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 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"; + + // 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 ); + } + + + 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 ); + } + + + protected static String getAllCompilerFlags( IConfiguration config, String compilerId ) { + + ITool compilerTool = config.getToolsBySuperClassId(compilerId)[0]; + + String compilerFlags = ""; + + try { + compilerFlags = compilerTool.getToolFlags(); + + // skip "-c" option and replace double quotes + String[] flags = compilerFlags.split(" "); + compilerFlags = ""; + for( int i = 0; i < flags.length ; i ++ ) { + + if ( flags[i].compareTo("-c") == 0 ) { + continue; + } + + flags[i] = flags[i].replace("\"", "\\\""); + compilerFlags = compilerFlags + " " + flags[i]; + } + } catch (BuildException e) { + e.printStackTrace(); + } + + 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 ); + 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); + } 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; + } + + 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; + + for (IToolChain tc : tcs) { + if ( tc.isSystemObject() && !(((ToolChain)tc).isPreferenceToolChain() && !isMng) ) { + // NO TOOLCHAIN + continue; + } + list.add(tc); + } + + 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; + } + } + + IToolChain tc = v_tcs[x]; + if (tc == null) return; + + + foim.setToolChain(tc); + + try { + mod.apply(); + } catch (CoreException e) { + ManagedBuilderUIPlugin.log(e); + } + } + + + 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; + } + } + + // 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; + } else { + // set default + if ( config.getName().contains(SBI_DEVICE_CONFIG_SUFFIX) ) { + toolchainID = SBI_ARM_TOOLCHAIN_NAME; + } else { + toolchainID = SBI_I386_TOOLCHAIN_NAME; + } + } + } + + // create target name && update configuration + targetID = sbi.makeTargetID( rootstrapID, toolchainID ); + setBuildTargetName(config, targetID); + + // if target exist, create + if ( !sbi.checkTargetID(targetID)) { + sbi.writeTargetCfgFile(targetID); + } + + return targetID; + } + + + + public static String getRootstrapPath( IConfiguration config ) { + + try { + + // if not exist, update target configuration + String targetID = updateBuildTargetConfiguration( config ); + + // return rootstrap + SmartBuildInterface sbi = SmartBuildInterface.getInstance(); + return sbi.getRootstrapPath(targetID); + + } catch (SBIException e) { + e.printStackTrace(); + return "/"; + } + } +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformMakeGenerator.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformMakeGenerator.java new file mode 100644 index 00000000..2276e207 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformMakeGenerator.java @@ -0,0 +1,208 @@ +/* +* 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 +* +*/ +package org.tizen.nativeplatform.build; +import org.eclipse.cdt.managedbuilder.core.IBuilder; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; +import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceStatus; +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.MultiStatus; +import org.eclipse.core.runtime.Path; +import org.tizen.nativecommon.build.exception.SBIException; + + +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 { + return; + } + + @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) ); + } + + // if Makefile does not exist, regenerate "Makefile" + IFolder configDir = project.getFolder( config.getName() ); + if ( !configDir.exists() ) + return regenerateMakefiles(); + + return new MultiStatus( + ManagedBuilderCorePlugin.getUniqueIdentifier(), + IStatus.OK, + new String(), + null); + } + + @Override + public IPath getBuildWorkingDir() { + // return project folder + if ( topBuildDir != null ) { + return topBuildDir.removeFirstSegments(1).removeLastSegments(1); + } + return null; + } + + @Override + public String getMakefileName() { + return null; + } + + @Override + public void initialize(IProject project, IManagedBuildInfo info, + IProgressMonitor monitor) { + this.project = project; + this.topBuildDir = project.getFolder(info.getConfigurationName()).getFullPath(); + this.config = info.getDefaultConfiguration(); + + return ; + } + + @Override + public boolean isGeneratedResource(IResource resource) { + return false; + } + + @Override + public void regenerateDependencies(boolean force) throws CoreException { + return; + } + + @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) ); + } + + // Check topdir folder exist + topBuildDir = createDirectory(config.getName()); + + return new MultiStatus( + ManagedBuilderCorePlugin.getUniqueIdentifier(), + IStatus.OK, + new String(), + null); + } + + @Override + public void initialize(int buildKind, IConfiguration cfg, IBuilder builder, + IProgressMonitor monitor) { + this.project = cfg.getOwner().getProject(); + this.config = cfg; + topBuildDir = project.getFolder(cfg.getName()).getFullPath(); + } + + + // function for creating directory from GnuMakefileGenerateor + private IPath createDirectory(String dirName) throws CoreException { + // Create or get the handle for the build directory + IFolder folder = project.getFolder(dirName); + + // should be checked later + if (folder.exists()) { + folder.delete(true, null); + } + + if (!folder.exists()) { + // Make sure that parent folders exist + IPath parentPath = (new Path(dirName)).removeLastSegments(1); + // Assume that the parent exists if the path is empty + if (!parentPath.isEmpty()) { + IFolder parent = project.getFolder(parentPath); + if (!parent.exists()) { + createDirectory(parentPath.toString()); + } + } + + // Now make the requested folder + try { + folder.create(true, true, null); + } + catch (CoreException e) { + if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED) + folder.refreshLocal(IResource.DEPTH_ZERO, null); + else + throw e; + } + + // Make sure the folder is marked as derived so it is not added to CM + if (!folder.isDerived()) { + folder.setDerived(true); + } + } + + return folder.getFullPath(); + } + +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectConverter.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectConverter.java new file mode 100644 index 00000000..819f040d --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectConverter.java @@ -0,0 +1,183 @@ +/* +* 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 +* +*/ +package org.tizen.nativeplatform.build; + +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager; +import org.eclipse.cdt.core.settings.model.WriteAccessException; +import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; +import org.eclipse.cdt.managedbuilder.core.IBuildObject; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IConvertManagedBuildObject; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.IProjectType; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.internal.core.Configuration; +import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.tizen.nativecommon.build.SmartBuildInterface; +import org.tizen.nativecommon.build.exception.SBIException; + + +@SuppressWarnings("restriction") +public class PlatformProjectConverter implements IConvertManagedBuildObject { + + IProject project; + ManagedProject mProject; + ICProjectDescription projDesc; + + public PlatformProjectConverter() { + } + + @Override + public IBuildObject convert(IBuildObject buildObj, String fromId, + String toId, boolean isConfirmed) { + + if (buildObj instanceof ManagedProject ) { + mProject = (ManagedProject)buildObj; + project = (IProject)mProject.getOwner(); + ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); + projDesc = mngr.getProjectDescription(project, true); + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo( project ) ; + SmartBuildInterface sbi = SmartBuildInterface.getInstance(); + + // convert project type + IProjectType newProjType = ManagedBuildManager.getProjectType( toId ); + mProject.setProjectType( newProjType ); + mProject.setName(newProjType.getName()); + + try { + // convert Configuration id + for ( IConfiguration config : mProject.getConfigurations() ) { + Configuration c = (Configuration) config; + + IFolder f = project.getFolder(c.getName()); + if (f.exists()) { + f.delete(true, null); + } + + Configuration newConfig = createNewConfiguration( config , toId ); + String newTargetName = getNewBuildTargetName( config , toId ); + + // target name + if (!sbi.checkTargetID(newTargetName)) { + sbi.writeTargetCfgFile(newTargetName); + } + PlatformConfigurationManager.setBuildTargetName(newConfig, newTargetName); + + // remove old configuration + mProject.removeConfiguration(c.getId()); + } + + mngr.setProjectDescription(project, projDesc); + info.setDefaultConfiguration(mProject.getConfigurations()[0].getName()); + + } catch (WriteAccessException e) { + e.printStackTrace(); + } catch (CoreException e) { + e.printStackTrace(); + } catch (SBIException e) { + e.showErrorDialog(); + } + + // update .cproject + ManagedBuildManager.saveBuildInfo( project, true ); + + try { + project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); + } catch (CoreException e) { + e.printStackTrace(); + } + return mProject; + } + + return buildObj; + } + + + protected Configuration createNewConfiguration( IConfiguration config , String toId ) throws WriteAccessException, CoreException { + + Configuration parentConfig = null; + if ( toId.equals(PlatformConfigurationManager.SBI_PROJECT_TYPE_ID) ) { + if ( config.getParent().getId().contains("custom.debian.emulator") ) { + parentConfig = (Configuration)ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_I386_CONFIGRATION_ID ); + } else if ( config.getParent().getId().contains("custom.debian.device") ) { + parentConfig = (Configuration) ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_ARM_CONFIGRATION_ID ); + } else { + parentConfig = (Configuration)ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_ARM_CONFIGRATION_ID ); + } + } else { + parentConfig = (Configuration)ManagedBuildManager.getExtensionConfiguration( PlatformConfigurationManager.SBI_DEFAULT_ARM_CONFIGRATION_ID ); + } + + String id = ManagedBuildManager.calculateChildId( parentConfig.getId(), null); + + Configuration newConfig = new Configuration((ManagedProject)config.getManagedProject(), (Configuration)parentConfig, id, false, true); + + CConfigurationData data = newConfig.getConfigurationData(); + ICConfigurationDescription cfgDes = projDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data); + + newConfig.setConfigurationDescription(cfgDes); + newConfig.exportArtifactInfo(); + newConfig.setName(config.getName()); + newConfig.setArtifactName(config.getArtifactName()); + + return newConfig; + } + + + protected String getNewBuildTargetName( IConfiguration config , String toId ) { + String newTargetName = null; + + if ( toId.equals(PlatformConfigurationManager.SBI_PROJECT_TYPE_ID) ) { + if ( config.getParent().getId().contains("custom.debian.emulator") ) { + newTargetName = SmartBuildInterface.makeTargetID( + PlatformConfigurationManager.SBI_I386_ROOTSTRAP_NAME, + PlatformConfigurationManager.SBI_I386_TOOLCHAIN_NAME) ; + } else if ( config.getParent().getId().contains("custom.debian.device") ) { + newTargetName = SmartBuildInterface.makeTargetID( + PlatformConfigurationManager.SBI_ARM_ROOTSTRAP_NAME, + PlatformConfigurationManager.SBI_ARM_TOOLCHAIN_NAME) ; + } else { + newTargetName = PlatformConfigurationManager.SBI_DEFAULT_TARGET_NAME; + } + } else { + newTargetName = PlatformConfigurationManager.SBI_DEFAULT_TARGET_NAME; + } + + return newTargetName; + } + +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectDependentBuilder.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectDependentBuilder.java new file mode 100644 index 00000000..bf5ce7a2 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectDependentBuilder.java @@ -0,0 +1,130 @@ +/* +* 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 +* +*/ +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.tizen.nativecommon.build.CommonProjectDependentBuilder; +import org.tizen.nativecommon.build.exception.SBIException; + + +public class PlatformProjectDependentBuilder extends CommonProjectDependentBuilder { + + private static PlatformProjectDependentBuilder instance = new PlatformProjectDependentBuilder(); + + public static final CommonProjectDependentBuilder getInstance() { + return instance; + } + + public static final CommonProjectDependentBuilder getInstance(IProject project) { + instance.setProject(project); + return instance; + } + + private PlatformProjectDependentBuilder() { + super(); + } + + private PlatformProjectDependentBuilder(IProject project) { + super(project); + } + + @Override + protected String getElfInfoOption() { + return "-s -W"; + } + + @Override + protected String getConfigureOption() { + + String options = String.format(" "); + + return options; + } + + @Override + protected String getMakeOption() { + // TODO Auto-generated method stub + return ""; + } + + @Override + protected String getCleanOption() { + // TODO Auto-generated method stub + return ""; + } + + @Override + public String getTargetID() { + IConfiguration config = getConfiguration(); + return PlatformConfigurationManager.getBuildTargetName(config); + } + + @Override + public String getTargetID(IConfiguration config) { + return PlatformConfigurationManager.getBuildTargetName(config); + } + + + @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 sysroot=""; + try { + sysroot = String.format("-sysroot=%s", getSbi().getRootstrapPath(getTargetID()) ); + } catch (SBIException e) { + e.printStackTrace(); + } + + return gdbOptions + sysroot; + } + + @Override + public void setBuildTargetID(IConfiguration config, String targetId) { + PlatformConfigurationManager.setBuildTargetName(config, targetId); + } + + @Override + public void setToolCommand(IConfiguration config, String rootstrapCfgName) { + PlatformConfigurationManager.setToolCommand(config, rootstrapCfgName); + } + + @Override + public void changeToolchain(IConfiguration config, + ICResourceDescription cfgd, String toolchainNameInCfg) { + PlatformConfigurationManager.changeToolchain(config, cfgd, toolchainNameInCfg); + } + +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectDependentPackager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectDependentPackager.java new file mode 100644 index 00000000..fb248c34 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/PlatformProjectDependentPackager.java @@ -0,0 +1,149 @@ +/* +* 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 +* +*/ +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.tizen.nativecommon.build.CommonProjectDependentPackager; +import org.tizen.nativecommon.build.exception.SBIException; + + +public class PlatformProjectDependentPackager extends CommonProjectDependentPackager { + + private static PlatformProjectDependentPackager instance = new PlatformProjectDependentPackager(); + + public static final CommonProjectDependentPackager getInstance() { + return instance; + } + + public static final CommonProjectDependentPackager getInstance(IProject project) { + instance.setProject(project); + return instance; + } + + private PlatformProjectDependentPackager() { + super(); + } + + private PlatformProjectDependentPackager(IProject project) { + 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) { + String workingDir = getWorkingDir(config); + + String options = String.format( + "-WORKING_DIR=%s", + workingDir ); + + return options; + } + + public void buildPackage() throws SBIException { + + String targetID = getTargetID(); + String projectDir = getProjectPath(); + String options = getPackageOption(); + + sbi.actionConsole("buildpackage", options, targetID, projectDir, "Packaging" ); + } + + + public void buildPackage(String configName) 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" ); + } + + public void buildPackageDependencyCheck() throws SBIException { + + String targetID = getTargetID(); + String projectDir = getProjectPath(); + String options = getPackageDependencyCheckOption(); + + sbi.actionConsole("checkbuilddeps", options, targetID, projectDir, "Packaging" ); + } + + @Override + public String getTargetID() { + IConfiguration config = getConfiguration(); + return PlatformConfigurationManager.getBuildTargetName(config); + } + + @Override + public String getTargetID(IConfiguration config) { + return PlatformConfigurationManager.getBuildTargetName(config); + } + + @Override + public boolean isDependencyCheckSuppoted() { + return true; + } + + @Override + protected String getPackageDependencyCheckOption() { + return ""; + } + + @Override + public boolean isPackageCheckSuppoted() { + return false; + } + + @Override + public boolean checkPackageFile() { + return false; + } +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegate.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegate.java new file mode 100644 index 00000000..ef01062e --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegate.java @@ -0,0 +1,516 @@ +/* +* 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 +* +*/ +package org.tizen.nativeplatform.launch; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +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.ICDISession; +import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; +import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants; +import org.eclipse.cdt.launch.AbstractCLaunchDelegate; +import org.eclipse.cdt.launch.LaunchUtils; +import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.ui.newui.CDTPropertyManager; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +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.NullProgressMonitor; +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.DebugPlugin; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.core.model.IProcess; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Display; +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.connection.ConnectionPlugin; +import org.tizen.common.connection.debugtools.DebugTool; +import org.tizen.common.util.LocalPortChecker; + +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.TizenLaunchConfigurationConstants; +import org.tizen.nativecommon.launch.TizenLaunchMessages; +import org.tizen.nativecommon.launch.TizenUIThreadForConfirmMessage; +import org.tizen.nativeplatform.Activator; +import org.tizen.sdblib.IDevice; + +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 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 String getPluginID() { + return Activator.PLUGIN_ID; + } + + public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { + if (monitor == null) + monitor = new NullProgressMonitor(); + try { + monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 20); + monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION); + + activateProgressView(); + + verifyDeviceReachability(getProject(config), new SubProgressMonitor(monitor, 8)); + verifyBuildConfiguration(config, mode, new SubProgressMonitor(monitor, 1)); + + if (mode.equals(ILaunchManager.DEBUG_MODE)) { + verifyTizenDebianProjectSettings(config); + setDebugConfigAttributes(config); + setDefaultSourceLocator(launch, config); + IBinaryObject exeFile = getBinaryObject(config); + launchApplicationForDebug(launch, config, exeFile, new SubProgressMonitor(monitor, 10)); + } else { + launchApplicationForRun(config, launch, new SubProgressMonitor(monitor, 10)); + } + } finally { + if (mode.equals(ILaunchManager.DEBUG_MODE)) { + processPostDebug(config); + } else { + if (!launch.isTerminated()) + launch.terminate(); + ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); + launchManager.removeLaunch(launch); + } + monitor.done(); + } + } + + 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 + } + } + 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 + } + } + } + + protected void verifyTizenDebianProjectSettings(ILaunchConfiguration config) throws CoreException { + String appPath = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); + IPath hostPath = getHostPath(appPath, config); + if (hostPath != null) { + if (hostPath.toFile().exists()) + return; + else + newCoreException(TizenDebianLaunchMessages.CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP, null); + } else { + newCoreException(TizenDebianLaunchMessages.CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP, null); + } + } + + protected void verifyBuildConfiguration(ILaunchConfiguration config, String mode, IProgressMonitor monitor) throws CoreException { + // FIXME : Match by deviceType, not buildTargetArchitecture. + IProject project = getProject(config); + String buildConfigName = getBuildConfigName(config); + + IConfiguration configuration = getBuildConfiguration(buildConfigName, project); + //String buildTargetArchitecture = SLPConfigurationManager.getArchitecture(configuration); + //String buildTargetArchitecture = CommonConfigurationOld.getArchitecture(configuration); + String buildTargetArchitecture = CommonConfigurationManager.getArchitecture(configuration); + if (currentDevice.isEmulator()) { + if(!buildTargetArchitecture.equals("i386")) + resolveProblematicConfiguration(config, "i386"); + } else { + if(!buildTargetArchitecture.equals("armel")) + resolveProblematicConfiguration(config, "armel"); + } + } + + protected void resolveProblematicConfiguration(ILaunchConfiguration config, final String arch) throws CoreException { + final IProject project = getProject(config); + Display.getDefault().syncExec(new Runnable() { + public void run() { + selectedConfig = selectBuildConfiguration(project, arch); + } + }); + + if (selectedConfig == null) + newCoreException(TizenLaunchMessages.BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE, null); + + ICProjectDescription projDes = CDTPropertyManager.getProjectDescription(project); + ICConfigurationDescription cDesc = projDes.getConfigurationByName(selectedConfig.getName()); + ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, cDesc.getConfiguration().getId()); + wc.doSave(); + } + + protected IConfiguration selectBuildConfiguration(IProject project, String arch) { + Shell shell = LaunchUIPlugin.getShell(); + + ILabelProvider topprovider = new LabelProvider() { + public String getText(Object element) { + IConfiguration buildConfig = (IConfiguration)element; + return buildConfig.getName(); + } + }; + + ILabelProvider downprovider = new LabelProvider() { + public String getText(Object element) { + IConfiguration buildConfig = (IConfiguration)element; + return buildConfig.getName(); + } + }; + + TwoPaneElementSelector dlg = new TwoPaneElementSelector(shell, topprovider, downprovider); + dlg.setTitle("Select a new build configuration"); //$NON-NLS-1$ + dlg.setMessage("Build configuration doesn't match with current active device.\nSelect a new build configuration to launch"); //$NON-NLS-1$ + + IConfiguration[] configurations = ManagedBuildManager.getBuildInfo(project).getManagedProject().getConfigurations(); + List<IConfiguration> adaptableConfigs = new ArrayList<IConfiguration>(0); + for(IConfiguration c : configurations) { + //String buildTargetArchitecture = SLPConfigurationManager.getArchitecture(c); + //String buildTargetArchitecture = CommonConfigurationOld.getArchitecture(c); + String buildTargetArchitecture = CommonConfigurationManager.getArchitecture(c); + if (buildTargetArchitecture.equals(arch)) + adaptableConfigs.add(c); + } + + dlg.setElements(adaptableConfigs.toArray()); + + if (dlg.open() == Window.OK) { + IConfiguration selectedConfig = (IConfiguration)dlg.getFirstResult(); + return selectedConfig; + } + + return null; + } + + protected IConfiguration getBuildConfiguration(String buildConfigName, IProject project) throws CoreException { + IConfiguration configuration = null; + IConfiguration[] configurations = ManagedBuildManager.getBuildInfo(project).getManagedProject().getConfigurations(); + for (IConfiguration c : configurations) { + if (c.getName().equals(buildConfigName) ) { + configuration = c; + break; + } + } + if (configuration == null) + newCoreException(TizenLaunchMessages.BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE, null); + + return configuration; + } + + protected String getBuildConfigName(ILaunchConfiguration config) throws CoreException { + IProject project = getProject(config); + + String buildConfigName = config.getAttribute(TizenLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_NAME, ""); + + if (buildConfigName.isEmpty()) { + IConfiguration configuration = ManagedBuildManager.getBuildInfo(project).getDefaultConfiguration(); + return configuration.getName(); + } else + return buildConfigName; + } + + + protected boolean resolveProblematicConfiguration(IProject project, IConfiguration problematicConfig, String arch, String mode) { + TizenUIThreadForConfirmMessage runnable = new TizenUIThreadForConfirmMessage(project, problematicConfig, arch, mode); + Display.getDefault().syncExec(runnable); + if(runnable.getResult()) { + ManagedBuildManager.getBuildInfo( project ).setDefaultConfiguration(runnable.getSuitableConfigName()); + return true; + } else { + return false; + } + } + + protected void verifyDeviceReachability(IProject project, IProgressMonitor monitor) throws CoreException { + try { + monitor.beginTask(TizenLaunchMessages.PREPARE_TO_LAUNCH, 1); + monitor.subTask(TizenLaunchMessages.PREPARE_TO_LAUNCH); + + currentDevice = ConnectionPlugin.getDefault().getCurrentDevice(); + if (currentDevice == null) + newCoreException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE, null); + if (currentDevice.isOffline()) + newCoreException(TizenLaunchMessages.CANNOT_CONNECT_TO_DEVICE, null); + } finally { + monitor.done(); + } + } + + protected void launchApplicationForRun(ILaunchConfiguration config, ILaunch launch, + IProgressMonitor monitor) throws CoreException { + try { + monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 10); + monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION); + String envCmd = setEnvironments(config); + String execArg = setArguments(config); + currentDevice.executeShellCommand(envCmd + execArg); + } catch (Exception e) { + newCoreException(TizenLaunchMessages.CANNOT_LAUNCH, e); + } finally { + monitor.done(); + } + } + + protected void launchApplicationForDebug(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException, OperationCanceledException { + try { + monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 10); + monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION); + launchApplicationWithGDBServer(launch, config, new SubProgressMonitor(monitor, 1)); + launchApplicationWithGDBClient(launch, config, exeFile, new SubProgressMonitor(monitor, 1)); + } finally { + monitor.done(); + } + } + + 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; + String execArg = setArguments(config); + String envCmd = setEnvironments(config); + String command = envCmd + gdbserverCmd + " " + execArg; + currentDevice.executeShellCommand(command); + } catch (Exception e) { + newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null); + } finally { + monitor.done(); + } + } + + protected void launchApplicationWithGDBClient(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException { + try { + monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBCLIENT, 1); + monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION_WITH_GDBCLIENT); + + TizenDebugger debugger = new TizenDebugger(); + debugSession = ((ICDIDebugger2)debugger).createSession(launch, exeFile.getPath().toFile(), new SubProgressMonitor(monitor, 1)); + if(debugSession == null) + newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null); + + boolean attrDebuggerStopAtMain = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false); + String attrDebuggerStopAtMainSymbol = null; + if (attrDebuggerStopAtMain) + attrDebuggerStopAtMainSymbol = launch.getLaunchConfiguration().getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); + + ICDITarget[] targetArray = debugSession.getTargets(); + for (int i = 0; i < targetArray.length; i++) { + Process proc = targetArray[i].getProcess(); + IProcess iproc = null; + if (proc != null) + iproc = DebugPlugin.newProcess(launch, proc, exeFile.getName(), null); + IProject project = getProject(config); + CDIDebugModel.newDebugTarget(launch, project, targetArray[i], + "Tizen debugger", + iproc, exeFile, true, false, attrDebuggerStopAtMainSymbol, true); + } + } catch (Exception e) { + newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e); + } finally { + monitor.done(); + } + } + + protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException { + ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); + wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true); + wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, 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 { + localDebugPort = getDebugPort(); + if (localDebugPort < 0) + newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, null); + currentDevice.createForward(localDebugPort, Integer.parseInt(gdbserverPort)); + String localPort = Integer.valueOf(localDebugPort).toString(); + wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort); + wc.doSave(); + } catch (Exception e) { + newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e); + } + } + + protected int getDebugPort() { + int debugPortBase = -1; + if (currentDevice.isEmulator()) + debugPortBase = 26102; + else + debugPortBase = 26202; + + int port = debugPortBase; + while ((port < 65535) && !LocalPortChecker.isPortAvailable(port)) { + port += 10; + } + + if (LocalPortChecker.isPortAvailable(port)) + return port; + else + return -1; + } + + protected String setEnvironments(ILaunchConfiguration config) throws Exception { + String envs = ""; + String[] envArray = getEnvironment(config); + for (String env : envArray) + envs = ENVIRONMENT_SETTING_CMD + env + " && "; + return envs; + } + + protected String setArguments(ILaunchConfiguration config) throws CoreException { + String appPath = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); + String arguments = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); + String executableWithArguments= ""; + if (!arguments.equals("")) + executableWithArguments = appPath + " " + arguments; + else + executableWithArguments = appPath; + return executableWithArguments; + } + + protected void activateProgressView() { + Display.getDefault().syncExec(new Runnable() { + public void run() { + try { + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.ui.views.ProgressView"); + } catch (PartInitException 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); + } + } + + protected void newCoreException(String message, Throwable exception) throws CoreException { + Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, message, exception); + throw new CoreException(status); + } + + protected void refreshResources(IProject project) throws CoreException { + if(!project.isSynchronized(IResource.DEPTH_INFINITE)) + project.refreshLocal(IResource.DEPTH_INFINITE, null); + } + + protected IBinaryObject getBinaryObject(ILaunchConfiguration config) throws CoreException { + String appPath = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); + IPath hostPath = getHostPath(appPath, config); + IBinaryObject binaryObject = LaunchUtils.getBinary(getProject(config), hostPath); + return binaryObject; + } + + protected IProject getProject(ILaunchConfiguration config) throws CoreException { + String projectName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); + if (projectName == null || projectName.equals("")) + newCoreException(TizenDebianLaunchMessages.CANNOT_FIND_PROJECT_NAME, null); + return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + } + + protected IPath getHostPath(String exePath, ILaunchConfiguration config) throws CoreException { + CommonProjectDependentBuilder builder = ProjectTypeManager.getProjectBuilderInstance(getProject(config)); + String targetID = builder.getTargetID(); + + String rootstrapPath = ""; + try { + rootstrapPath = SmartBuildInterface.getInstance().getRootstrapPath(targetID); + } catch (SBIException e) { + newCoreException(TizenDebianLaunchMessages.CANNOT_FIND_HOST_ROOTSTRAP_PATH, e); + } + + if (!rootstrapPath.equals("")) + rootstrapPath = rootstrapPath.concat(exePath); + + return new Path(rootstrapPath); + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForAttach.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForAttach.java new file mode 100644 index 00000000..444ec90d --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForAttach.java @@ -0,0 +1,171 @@ +/* +* 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 +* +*/ +package org.tizen.nativeplatform.launch; + +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.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +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.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.tizen.nativecommon.launch.TizenLaunchConfigurationConstants; +import org.tizen.nativecommon.launch.TizenLaunchMessages; + +public class TizenDebianLaunchDelegateForAttach extends TizenDebianLaunchDelegate { + protected Integer pid = Integer.valueOf(-1); + protected final String ATTACH_OPTION = " --attach "; + + @Override + protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException { + ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); + wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, true); + wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, 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 { + int localDebugPort = getDebugPort(); + if (localDebugPort < 0) + newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, null); + currentDevice.createForward(localDebugPort, Integer.parseInt(gdbserverPort)); + String localPort = Integer.valueOf(localDebugPort).toString(); + wc.setAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, localPort); + wc.doSave(); + } catch (Exception e) { + newCoreException(TizenLaunchMessages.CANNOT_CREATE_FORWARD, e); + } + } + + @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); + + setPID(); + 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 envCmd = setEnvironments(config); + String command = envCmd + gdbserverCmd; + currentDevice.executeShellCommand(command); + } catch (Exception e) { + newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null); + } finally { + monitor.done(); + } + } + + 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 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$ + } + + 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("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(); + + 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); + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForCore.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForCore.java new file mode 100644 index 00000000..de157006 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchDelegateForCore.java @@ -0,0 +1,228 @@ +/* +* 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 +* +*/ +package org.tizen.nativeplatform.launch; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.debug.core.CDIDebugModel; +import org.eclipse.cdt.debug.core.CDebugUtils; +import org.eclipse.cdt.debug.core.ICDIDebugger2; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.core.ICDebugConfiguration; +import org.eclipse.cdt.debug.core.cdi.ICDISession; +import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; +import org.eclipse.cdt.debug.mi.core.GDBCDIDebugger2; +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.OperationCanceledException; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +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.connection.ui.TizenRemoteFileDialog; +import org.tizen.common.connection.ui.TizenRemoteFileDialog.TizenRemoteFileDialogResult; +import org.tizen.nativecommon.launch.TizenLaunchMessages; +import org.tizen.sdblib.FileListingService.FileEntry; +import org.tizen.sdblib.MultiLineReceiver; +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 + protected void setDebugConfigAttributes(ILaunchConfiguration config) throws CoreException { + ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); + 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 { + monitor.beginTask(TizenLaunchMessages.LAUNCH_APPLICATION, 10); + monitor.subTask(TizenLaunchMessages.LAUNCH_APPLICATION); + launchApplicationWithGDBClient(launch, config, exeFile, new SubProgressMonitor(monitor, 10)); + } finally { + monitor.done(); + } + } + + @Override + protected void launchApplicationWithGDBClient(ILaunch launch, ILaunchConfiguration config, IBinaryObject exeFile, IProgressMonitor monitor) throws CoreException { + ILaunchConfigurationWorkingCopy workingCopy = null; + 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, ""); + + if (strPath == null || strPath.length() == 0) { + IProject project = getProject(config); + FileEntry remotePath = promptForCoreFilePath(project, debugConfiguration); + if(remotePath == null) + newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null); + String projectPath = project.getLocation().toOSString(); + String coreFilePath = projectPath + "/core." + project.getName(); + 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); + + File coreFile = new File(coreFilePath.toString()); + IPath corePath = new Path(coreFilePath.toString()); + ICProject cproject = CDebugUtils.verifyCProject(config); + IBinaryObject core = verifyBinary(cproject, corePath); + if (!coreFile.canRead() || !(core.getType() == IBinaryObject.CORE)) + newCoreException(TizenLaunchMessages.INVALID_CORE_FILE, null); + + // Call again the launch delegate with the core file which user has selected. + workingCopy = config.getWorkingCopy(); + workingCopy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, coreFilePath); + workingCopy.launch(ILaunchManager.DEBUG_MODE, new SubProgressMonitor(monitor, 1)); + workingCopy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, ""); + workingCopy.doSave(); + // Coredump debugging finishes here. + return; + } + 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) + newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, null); + + ICDITarget[] targetArray = debugSession.getTargets(); + Process proc = null; + IProcess iproc = null; + for (int i = 0; i < targetArray.length; i++) { + proc = targetArray[i].getProcess(); + + if (proc != null) + iproc = DebugPlugin.newProcess(launch, proc, exeFile.getName(), null); + + IProject project = getProject(config); + CDIDebugModel.newDebugTarget(launch, project, targetArray[i], + "Tizen debugger", + iproc, exeFile, true, false, "false", true); + monitor.worked(1); + } + } catch (Exception e) { + newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT, e); + } finally { + if (workingCopy != null) { + workingCopy.setAttribute( ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, ""); + workingCopy.doSave(); + } + 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); + if (dlg.open() == TizenRemoteFileDialogResult.OK) + coreDir = dlg.getSelectedFileEntry(); + else + coreDir = null; + } + }); + } + return coreDir; + } + + private boolean downloadCoreFile(FileEntry coreDir, String destFilePath, IProgressMonitor monitor) throws IOException { + if (coreDir == null) + return false; + String command = "ls -lt " + coreDir.getFullPath(); + currentDevice.executeShellCommand(command, new MultiLineReceiver() { + @Override + public void processNewLines(String[] lines) { + for (String line : lines) { + if (line.contains("core")) { + executeResult = line.substring(line.indexOf("core")); + break; + } + } + } + }); + + if (!executeResult.startsWith("core")) + return false; + + FileEntry[] coreFiles = coreDir.getFileListingService().getChildren(coreDir, true, null); + FileEntry found = null; + for (FileEntry file : coreFiles) { + if (file.getName().equals(executeResult)) { + found = file; + break; + } + } + + 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 + return false; + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchMessages.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchMessages.java new file mode 100644 index 00000000..35705c82 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchMessages.java @@ -0,0 +1,61 @@ +/* +* 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 +* +*/ +package org.tizen.nativeplatform.launch; + +import org.eclipse.osgi.util.NLS; + +public class TizenDebianLaunchMessages extends NLS { + static { + NLS.initializeMessages(TizenDebianLaunchMessages.class.getName(), TizenDebianLaunchMessages.class); + } + // error messages + public static String CANNOT_FIND_PROJECT_NAME; + public static String CANNOT_CONNECT_TO_DEVICE; + public static String CANNOT_FIND_EXECUTABLE_IN_A_HOST_ROOTSTRAP; + public static String CANNOT_CREATE_PACKAGE; + public static String CANNOT_TRANSFER_FILE; + public static String CANNOT_INSTALL; + public static String CANNOT_LAUNCH; + public static String CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER; + public static String CANNOT_LAUNCH_APPLICATION_WITH_GDBCLIENT; + public static String BUILD_CONFIGURATION_DOES_NOT_MATCH_WITH_CURRENT_DEVICE_TYPE; + public static String CANNOT_FIND_HOST_ROOTSTRAP_PATH; + public static String CANNOT_FIND_DEBIAN_CONTROL_FILE; + public static String CANNOT_FIND_PACKAGE_SECTION_IN_CONTROL_FILE; + public static String OPERATION_CANCELED; + // non-error messages + public static String LAUNCH_APPLICATION; + public static String LAUNCH_APPLICATION_WITH_GDBSERVER; + public static String LAUNCH_APPLICATION_WITH_GDBCLIENT; + public static String PREPARE_TO_LAUNCH; + public static String START_DEPLOY_PROCESS; + public static String CREATE_PACKAGE; + public static String TRANSFER_PACKAGE; + public static String INSTALL_PACKAGE; +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchMessages.properties b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchMessages.properties new file mode 100644 index 00000000..831e591b --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/TizenDebianLaunchMessages.properties @@ -0,0 +1,23 @@ +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. +OPERATION_CANCELED = Operation canceled. + +LAUNCH_APPLICATION = Launching Application... +LAUNCH_APPLICATION_WITH_GDBSERVER = Launching application with GDBServer... +LAUNCH_APPLICATION_WITH_GDBCLIENT = Launching 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... diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationForAttachTabGroup.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationForAttachTabGroup.java new file mode 100644 index 00000000..ef937a50 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationForAttachTabGroup.java @@ -0,0 +1,45 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui; + +import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.debug.ui.sourcelookup.SourceLookupTab; +import org.tizen.nativecommon.launch.ui.TizenDebuggerTab; + + +public class TizenDebianLaunchConfigurationForAttachTabGroup extends AbstractLaunchConfigurationTabGroup { + @Override + public void createTabs(ILaunchConfigurationDialog dialog, String mode) { + ILaunchConfigurationTab[] tabs = null; + tabs = new ILaunchConfigurationTab[] { new TizenDebuggerTab(true), new SourceLookupTab() }; + setTabs(tabs); + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationForCoreTabGroup.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationForCoreTabGroup.java new file mode 100644 index 00000000..2ba3d043 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationForCoreTabGroup.java @@ -0,0 +1,45 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui; + +import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.debug.ui.sourcelookup.SourceLookupTab; +import org.tizen.nativecommon.launch.ui.TizenDebuggerForCoreTab; + + +public class TizenDebianLaunchConfigurationForCoreTabGroup extends AbstractLaunchConfigurationTabGroup { + @Override + public void createTabs(ILaunchConfigurationDialog dialog, String mode) { + ILaunchConfigurationTab[] tabs = null; + tabs = new ILaunchConfigurationTab[] { new TizenDebuggerForCoreTab(), new SourceLookupTab() }; + setTabs(tabs); + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationTabGroup.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationTabGroup.java new file mode 100644 index 00000000..0412fb59 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianLaunchConfigurationTabGroup.java @@ -0,0 +1,50 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui; + +import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.debug.ui.sourcelookup.SourceLookupTab; +import org.tizen.nativecommon.launch.ui.TizenDebuggerTab; + + +public class TizenDebianLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup { + @Override + public void createTabs(ILaunchConfigurationDialog dialog, String mode) { + ILaunchConfigurationTab[] tabs = null; + + if (mode.equals("debug")) + tabs = new ILaunchConfigurationTab[] { new TizenDebuggerTab(false), new SourceLookupTab() }; + else + tabs = new ILaunchConfigurationTab[] {}; + + setTabs(tabs); + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainCoreTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainCoreTab.java new file mode 100644 index 00000000..3aa804b3 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainCoreTab.java @@ -0,0 +1,35 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui; + +public class TizenDebianMainCoreTab extends TizenDebianMainTab { + public TizenDebianMainCoreTab() { + super(true); + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainTab.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainTab.java new file mode 100644 index 00000000..9fab2533 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/TizenDebianMainTab.java @@ -0,0 +1,266 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; +import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; +import org.eclipse.cdt.launch.ui.CMainTab; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +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.FileDialog; +import org.eclipse.swt.widgets.Label; +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.sdblib.FileListingService.FileEntry; +import org.tizen.sdblib.IDevice; + +public class TizenDebianMainTab extends CMainTab { + private Label fProgLabel; + private Text fProgText; + private boolean fSpecifyCoreFile; + private static final String LABEL_TEXT = "Tizen Application Path :"; + 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 = ""; + + public TizenDebianMainTab() { + this(false); + } + + public TizenDebianMainTab(boolean specifyCoreFile) { + fSpecifyCoreFile = specifyCoreFile; + } + + @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); + createExeFileField(comp, 1); + createProjectGroup(comp, 1); + 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 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(LABEL_TEXT); // $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, REMOTE_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, SELECT_AN_APPLICATION, 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); + ICElement cElement = null; + cElement = getContext(configuration, getPlatform(configuration)); + if (cElement != null) + initializeCProject(cElement, configuration); + } + + @Override + public void initializeFrom(ILaunchConfiguration configuration) { + updateProgramFromConfig(configuration); + updateProjectFromConfig(configuration); + if (fSpecifyCoreFile) + updateCoreFromConfig(configuration); + } + + @Override + public boolean isValid(ILaunchConfiguration config) { + setErrorMessage(null); + setMessage(null); + + 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(); + + 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); + } + + return true; + } + + @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); + } + + @Override + protected void updateProgramFromConfig(ILaunchConfiguration config) { + if (fProgText != null) + { + String programName = EMPTY_STRING; + try { + programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING); + } catch (CoreException ce) { + LaunchUIPlugin.log(ce); + } + fProgText.setText(programName); + } + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectAttachLaunchShortcut.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectAttachLaunchShortcut.java new file mode 100644 index 00000000..45891f53 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectAttachLaunchShortcut.java @@ -0,0 +1,252 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui.shortcut; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +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.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.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; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Shell; +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.launch.TizenLaunchConfigurationConstants; +import org.tizen.nativeplatform.Activator; +import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages; + + + + +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 : "; + + public void launch(IProject project, String mode) { + searchAndLaunch(new Object[] {project}, mode); + } + + @Override + public void launch(IEditorPart editor, String mode) { + searchAndLaunch(new Object[] { editor.getEditorInput()}, mode); + } + + @Override + public void launch(ISelection selection, String mode) { + if (selection instanceof IStructuredSelection) { + searchAndLaunch(((IStructuredSelection) selection).toArray(), mode); + } + } + + private void searchAndLaunch(final Object[] elements, String mode) { + if (elements != null && elements.length > 0) { + int nElements = elements.length; + for (int i = 0; i < nElements; i++) { + if (elements[i] instanceof IAdaptable) { + IResource r = (IResource) ((IAdaptable) elements[i]).getAdapter(IResource.class); + if (r != null) { + IProject project = r.getProject(); + if (project != null) { + ILaunchConfiguration config = findLaunchConfiguration(project, mode); + if (config != null) { + DebugUITools.launch(config, mode); + } + } + } + } + } + } + } + + protected ILaunchConfiguration findLaunchConfiguration(IProject project, String mode) { + ILaunchConfiguration configuration = null; + // Set the default debugger based on the active toolchain on the project (if possible) + ICDebugConfiguration debugConfig = null; + ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project); + ICConfigurationDescription configDesc = projDesc.getActiveConfiguration(); + String configId = configDesc.getId(); + ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations(); + int matchLength = 0; + for (int i = 0; i < debugConfigs.length; ++i) { + ICDebugConfiguration dc = debugConfigs[i]; + String[] patterns = dc.getSupportedBuildConfigPatterns(); + if (patterns != null) { + for (int j = 0; j < patterns.length; ++j) { + if (patterns[j].length() > matchLength && configId.matches(patterns[j])) { + debugConfig = dc; + matchLength = patterns[j].length(); + } + } + } + } + + 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]); + } + } + debugConfigs = (ICDebugConfiguration[]) debugList.toArray(new ICDebugConfiguration[0]); + if (debugConfigs.length == 1) + debugConfig = debugConfigs[0]; + else if (debugConfigs.length > 1) + debugConfig = chooseDebugConfig(debugConfigs, mode); + } + + configuration = createConfiguration(project, debugConfig, mode); + + return configuration; + } + + private ICDebugConfiguration chooseDebugConfig(ICDebugConfiguration[] debugConfigs, String mode) { + ILabelProvider provider = new LabelProvider() { + public String getText(Object element) { + if (element == null) { + return ""; //$NON-NLS-1$ + } else if (element instanceof ICDebugConfiguration) { + return ((ICDebugConfiguration) element).getName(); + } + return element.toString(); + } + }; + ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), provider); + dialog.setElements(debugConfigs); + dialog.setTitle(getDebugConfigDialogTitleString(debugConfigs, mode)); + dialog.setMessage(getDebugConfigDialogMessageString(debugConfigs, mode)); + dialog.setMultipleSelection(false); + int result = dialog.open(); + provider.dispose(); + if (result == Window.OK) { + return (ICDebugConfiguration) dialog.getFirstResult(); + } + return null; + } + + 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); + + 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_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_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); + + + ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project); + if (projDes != null) { + String buildConfigID = projDes.getActiveConfiguration().getId(); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, buildConfigID); + } + + // 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()); + page.setDefaults(wc); + + config = wc.doSave(); + } catch (CoreException ce) { + CDebugUIPlugin.log(ce); + } + return config; + } + + private String getProgramName() throws CoreException { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window == null) { + IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows(); + window = windows[0]; + } + 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); + } + + @Override + protected ILaunchConfigurationType getCLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType("org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForAttach"); + } +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectCoredumpLaunchShortcut.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectCoredumpLaunchShortcut.java new file mode 100644 index 00000000..f9f594e6 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectCoredumpLaunchShortcut.java @@ -0,0 +1,251 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui.shortcut; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +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.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.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; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Shell; +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.launch.TizenLaunchConfigurationConstants; +import org.tizen.nativeplatform.Activator; +import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages; + + + + +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 : "; + + public void launch(IProject project, String mode) { + searchAndLaunch(new Object[] {project}, mode); + } + + @Override + public void launch(IEditorPart editor, String mode) { + searchAndLaunch(new Object[] { editor.getEditorInput()}, mode); + } + + @Override + public void launch(ISelection selection, String mode) { + if (selection instanceof IStructuredSelection) { + searchAndLaunch(((IStructuredSelection) selection).toArray(), mode); + } + } + + private void searchAndLaunch(final Object[] elements, String mode) { + if (elements != null && elements.length > 0) { + int nElements = elements.length; + for (int i = 0; i < nElements; i++) { + if (elements[i] instanceof IAdaptable) { + IResource r = (IResource) ((IAdaptable) elements[i]).getAdapter(IResource.class); + if (r != null) { + IProject project = r.getProject(); + if (project != null) { + ILaunchConfiguration config = findLaunchConfiguration(project, mode); + if (config != null) { + DebugUITools.launch(config, mode); + } + } + } + } + } + } + } + + protected ILaunchConfiguration findLaunchConfiguration(IProject project, String mode) { + ILaunchConfiguration configuration = null; + // Set the default debugger based on the active toolchain on the project (if possible) + ICDebugConfiguration debugConfig = null; + ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project); + ICConfigurationDescription configDesc = projDesc.getActiveConfiguration(); + String configId = configDesc.getId(); + ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations(); + int matchLength = 0; + for (int i = 0; i < debugConfigs.length; ++i) { + ICDebugConfiguration dc = debugConfigs[i]; + String[] patterns = dc.getSupportedBuildConfigPatterns(); + if (patterns != null) { + for (int j = 0; j < patterns.length; ++j) { + if (patterns[j].length() > matchLength && configId.matches(patterns[j])) { + debugConfig = dc; + matchLength = patterns[j].length(); + } + } + } + } + + 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]); + } + } + debugConfigs = (ICDebugConfiguration[]) debugList.toArray(new ICDebugConfiguration[0]); + if (debugConfigs.length == 1) + debugConfig = debugConfigs[0]; + else if (debugConfigs.length > 1) + debugConfig = chooseDebugConfig(debugConfigs, mode); + } + + configuration = createConfiguration(project, debugConfig, mode); + + return configuration; + } + + private ICDebugConfiguration chooseDebugConfig(ICDebugConfiguration[] debugConfigs, String mode) { + ILabelProvider provider = new LabelProvider() { + public String getText(Object element) { + if (element == null) { + return ""; //$NON-NLS-1$ + } else if (element instanceof ICDebugConfiguration) { + return ((ICDebugConfiguration) element).getName(); + } + return element.toString(); + } + }; + ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), provider); + dialog.setElements(debugConfigs); + dialog.setTitle(getDebugConfigDialogTitleString(debugConfigs, mode)); + dialog.setMessage(getDebugConfigDialogMessageString(debugConfigs, mode)); + dialog.setMultipleSelection(false); + int result = dialog.open(); + provider.dispose(); + if (result == Window.OK) { + return (ICDebugConfiguration) dialog.getFirstResult(); + } + return null; + } + + 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); + + 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_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_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); + + ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project); + if (projDes != null) { + String buildConfigID = projDes.getActiveConfiguration().getId(); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, buildConfigID); + } + + // 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()); + page.setDefaults(wc); + + config = wc.doSave(); + } catch (CoreException ce) { + CDebugUIPlugin.log(ce); + } + return config; + } + + private String getProgramName() throws CoreException { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window == null) { + IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows(); + window = windows[0]; + } + 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); + } + + @Override + protected ILaunchConfigurationType getCLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType("org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationTypeForCore"); + } +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectLaunchShortcut.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectLaunchShortcut.java new file mode 100644 index 00000000..ee1847f7 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianProjectLaunchShortcut.java @@ -0,0 +1,251 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui.shortcut; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +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.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.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; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Shell; +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.launch.TizenLaunchConfigurationConstants; +import org.tizen.nativeplatform.Activator; +import org.tizen.nativeplatform.launch.TizenDebianLaunchMessages; + + + + +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 : "; + + public void launch(IProject project, String mode) { + searchAndLaunch(new Object[] {project}, mode); + } + + @Override + public void launch(IEditorPart editor, String mode) { + searchAndLaunch(new Object[] { editor.getEditorInput()}, mode); + } + + @Override + public void launch(ISelection selection, String mode) { + if (selection instanceof IStructuredSelection) { + searchAndLaunch(((IStructuredSelection) selection).toArray(), mode); + } + } + + private void searchAndLaunch(final Object[] elements, String mode) { + if (elements != null && elements.length > 0) { + int nElements = elements.length; + for (int i = 0; i < nElements; i++) { + if (elements[i] instanceof IAdaptable) { + IResource r = (IResource) ((IAdaptable) elements[i]).getAdapter(IResource.class); + if (r != null) { + IProject project = r.getProject(); + if (project != null) { + ILaunchConfiguration config = findLaunchConfiguration(project, mode); + if (config != null) { + DebugUITools.launch(config, mode); + } + } + } + } + } + } + } + + protected ILaunchConfiguration findLaunchConfiguration(IProject project, String mode) { + ILaunchConfiguration configuration = null; + // Set the default debugger based on the active toolchain on the project (if possible) + ICDebugConfiguration debugConfig = null; + ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project); + ICConfigurationDescription configDesc = projDesc.getActiveConfiguration(); + String configId = configDesc.getId(); + ICDebugConfiguration[] debugConfigs = CDebugCorePlugin.getDefault().getActiveDebugConfigurations(); + int matchLength = 0; + for (int i = 0; i < debugConfigs.length; ++i) { + ICDebugConfiguration dc = debugConfigs[i]; + String[] patterns = dc.getSupportedBuildConfigPatterns(); + if (patterns != null) { + for (int j = 0; j < patterns.length; ++j) { + if (patterns[j].length() > matchLength && configId.matches(patterns[j])) { + debugConfig = dc; + matchLength = patterns[j].length(); + } + } + } + } + + 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]); + } + } + debugConfigs = (ICDebugConfiguration[]) debugList.toArray(new ICDebugConfiguration[0]); + if (debugConfigs.length == 1) + debugConfig = debugConfigs[0]; + else if (debugConfigs.length > 1) + debugConfig = chooseDebugConfig(debugConfigs, mode); + } + + configuration = createConfiguration(project, debugConfig, mode); + + return configuration; + } + + private ICDebugConfiguration chooseDebugConfig(ICDebugConfiguration[] debugConfigs, String mode) { + ILabelProvider provider = new LabelProvider() { + public String getText(Object element) { + if (element == null) { + return ""; //$NON-NLS-1$ + } else if (element instanceof ICDebugConfiguration) { + return ((ICDebugConfiguration) element).getName(); + } + return element.toString(); + } + }; + ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), provider); + dialog.setElements(debugConfigs); + dialog.setTitle(getDebugConfigDialogTitleString(debugConfigs, mode)); + dialog.setMessage(getDebugConfigDialogMessageString(debugConfigs, mode)); + dialog.setMultipleSelection(false); + int result = dialog.open(); + provider.dispose(); + if (result == Window.OK) { + return (ICDebugConfiguration) dialog.getFirstResult(); + } + return null; + } + + 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); + + 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_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); + + ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project); + if (projDes != null) { + String buildConfigID = projDes.getActiveConfiguration().getId(); + wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, buildConfigID); + } + + // 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()); + page.setDefaults(wc); + + config = wc.doSave(); + } catch (CoreException ce) { + CDebugUIPlugin.log(ce); + } + return config; + } + + private String getProgramName() throws CoreException { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window == null) { + IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows(); + window = windows[0]; + } + 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); + } + + @Override + protected ILaunchConfigurationType getCLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType("org.tizen.nativeplatform.launch.TizenDebianLaunchConfigurationType"); + } +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianPropertyTester.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianPropertyTester.java new file mode 100644 index 00000000..8d72e61e --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenDebianPropertyTester.java @@ -0,0 +1,74 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui.shortcut; + +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.expressions.PropertyTester; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.tizen.nativeplatform.build.PlatformConfigurationManager; + + + + +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 diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenPathInputDialog.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenPathInputDialog.java new file mode 100644 index 00000000..b7904392 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/ui/shortcut/TizenPathInputDialog.java @@ -0,0 +1,284 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.launch.ui.shortcut; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.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.Label; +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.sdblib.FileListingService.FileEntry; +import org.tizen.sdblib.IDevice; + +public class TizenPathInputDialog extends Dialog { + /** + * The title of the dialog. + */ + private String title; + + /** + * The message to display, or <code>null</code> if none. + */ + private String message; + + /** + * The input value; the empty string by default. + */ + private String value = "";//$NON-NLS-1$ + + /** + * Ok button widget. + */ + private Button okButton; + + /** + * Input text widget. + */ + private Text text; + + private String filePath = ""; + + 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 static final String SELECT_A_FILE = "Select a file"; + private static final String SELECT_A_FILE_TO_RUN = "Select a file"; + + public TizenPathInputDialog(Shell parentShell, String dialogTitle, + String dialogMessage, String initialValue) { + super(parentShell); + this.title = dialogTitle; + message = dialogMessage; + if (initialValue == null) { + value = "";//$NON-NLS-1$ + } else { + value = initialValue; + } + } + + /* + * (non-Javadoc) Method declared on Dialog. + */ + protected void buttonPressed(int buttonId) { + if (buttonId == IDialogConstants.OK_ID) { + value = text.getText(); + } else { + value = null; + } + super.buttonPressed(buttonId); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + */ + protected void configureShell(Shell shell) { + super.configureShell(shell); + if (title != null) { + shell.setText(title); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) + */ + protected void createButtonsForButtonBar(Composite parent) { + // create OK and Cancel buttons by default + okButton = createButton(parent, IDialogConstants.OK_ID, + IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, + IDialogConstants.CANCEL_LABEL, false); + //do this here because setting the text will set enablement on the ok + // button + text.setFocus(); + if (value != null) { + text.setText(value); + text.selectAll(); + } + } + + /* + * (non-Javadoc) Method declared on Dialog. + */ + protected Control createDialogArea(Composite parent) { + // create composite + Composite composite = (Composite) super.createDialogArea(parent); + // create message + if (message != null) { + Label label = new Label(composite, SWT.WRAP); + label.setText(message); + 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); + label.setLayoutData(data); + label.setFont(parent.getFont()); + } + + Composite pathComp = new Composite(composite, SWT.NONE); + GridLayout pathLayout = new GridLayout(); + pathLayout.numColumns = 2; + pathComp.setLayout(pathLayout); + text = new Text(pathComp, getInputTextStyle()); + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); + data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); + text.setLayoutData(data); + + Button browseButton; + browseButton = createPushButton(pathComp, REMOTE_BROWSE, null); + browseButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent evt) { + String path = handleBrowseButtonSelected(); + if (path != null) { + text.setText(path); + } + } + }); + applyDialogFont(composite); + return composite; + } + + /** + * Returns the error message label. + * + * @return the error message label + * @deprecated use setErrorMessage(String) instead + */ + protected Label getErrorMessageLabel() { + return null; + } + + /** + * Returns the ok button. + * + * @return the ok button + */ + protected Button getOkButton() { + return okButton; + } + + /** + * Returns the text area. + * + * @return the text area + */ + protected Text getText() { + return text; + } + + /** + * Returns the string typed into this input dialog. + * + * @return the input string + */ + public String getValue() { + return value; + } + + /** + * Returns the style bits that should be used for the input text field. + * Defaults to a single line entry. Subclasses may override. + * + * @return the integer style bits that should be used when creating the + * input text + * + * @since 3.4 + */ + protected int getInputTextStyle() { + return SWT.SINGLE | SWT.BORDER; + } + + public static Button createPushButton(Composite parent, String label, Image image) { + Button button = new Button(parent, SWT.PUSH); + button.setFont(parent.getFont()); + if (image != null) { + button.setImage(image); + } + if (label != null) { + button.setText(label); + } + GridData gd = new GridData(); + button.setLayoutData(gd); + return button; + } + + 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, SELECT_AN_APPLICATION, device, false, DEFAULT_APP_PATH); + if(dlg.open() == TizenRemoteFileDialogResult.OK) { + FileEntry selectedFile = dlg.getSelectedFileEntry(); + filePath = selectedFile.getFullPath(); + } else + filePath = null; + } + }); + } + return filePath; + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/DialogActionDelegate.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/DialogActionDelegate.java new file mode 100644 index 00000000..42ea43f6 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/DialogActionDelegate.java @@ -0,0 +1,106 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.pkgInstall; + +import 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.viewers.ISelection; +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.nativeplatform.build.PlatformConfigurationManager; +import org.tizen.sdblib.IDevice; + +public class DialogActionDelegate implements IWorkbenchWindowActionDelegate { + private IWorkbenchWindow window; + + PackageManager pkgdlg; + String target = null; + boolean enableRootstrap = true; + boolean eanbleTarget = true; + @Override + public void run(IAction arg0) { + // TODO Auto-generated method stub + //DeviceMachine machine = DeviceManager.getSelectedDevice(); + IDevice device = ConnectionPlugin.getDefault().getCurrentDevice(); + if (device == null) { + eanbleTarget = false; + } else { + target = device.getSerialNumber(); + if (target == null) { + eanbleTarget = false; + } + } + + IProject project = CurrentEnabledProject.getCurrentProject(); + if (project == null) { + enableRootstrap = false; + } else { + IConfiguration cfg =ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration(); + IManagedProject managedProject = cfg.getManagedProject(); + String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId(); + if (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE) && + !projectArtifactType.equals(PlatformConfigurationManager.OLD_SLP_CUSTOM_DEBIAN_ARTIFACT_TYPE)) { + enableRootstrap = false; + }else + enableRootstrap = true; + } + + pkgdlg = new PackageManager(window.getShell(), target, enableRootstrap, eanbleTarget); + pkgdlg.open(); + + } + + @Override + public void selectionChanged(IAction arg0, ISelection arg1) { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + // TODO Auto-generated method stub + } + + @Override + public void init(IWorkbenchWindow arg0) { + // TODO Auto-generated method stub + this.window = arg0; + this.enableRootstrap = true; + this.eanbleTarget = true; + } + +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageCommander.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageCommander.java new file mode 100644 index 00000000..a0917945 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageCommander.java @@ -0,0 +1,653 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.pkgInstall; + +import java.io.File; +import java.io.FileWriter; +import java.io.OutputStream; + +import org.tizen.common.util.HostUtil; + +import org.tizen.nativecommon.build.SmartBuildInterface; +import org.tizen.nativecommon.build.exception.SBIException; +import org.tizen.sdblib.IDevice; + +public class PackageCommander { + + private final static SmartBuildInterface sbi = SmartBuildInterface.getInstance(); + private final static int MAX_TIMEOUT = 60000; + private final static int VERIFY_SSHCONN_TIMEOUT = 30000; + + public PackageCommander() { + } + + public static String getCurrentSourceListForRootstrap(String targetID) throws SBIException { + + String result = ""; + + try { + result = sbi.actionStdOut("command", + String.format("-mode=emulate -cmd=\'cat /etc/apt/sources.list\' -path=." ), + targetID, null ); + } catch (SBIException e) { + e.printStackTrace(); + } + + return result.trim(); + } + + public static String getCurrentSourceListForRealTarget(IDevice device, PackageManagerOuputReceiver rec) { + String command = "cat /etc/apt/sources.list"; + String result = ""; + + if (device != null) { + try { + device.executeShellCommand(command, rec, MAX_TIMEOUT); + for (String line : rec.getLog()) { + result = result + line + "\n"; + } + + } catch (Exception e) { + e.printStackTrace(); + } + + if (device.isEmulator()) { + String[] splitResult = result.split("\n"); + if (splitResult.length > 1) { + result = splitResult[1]; + } else if (splitResult.length == 1){ + result = splitResult[0]; + } + } + + } + + return result.trim(); + } + + public static void changeSourceListForRealTarget(String sourceList, IDevice device) { + String command = String.format("echo \"%s\" > /etc/apt/sources.list", sourceList); + + if (device != null) { + try { + device.executeShellCommand(command); + //result = session.run(command, null); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + public static void changeSourceListForRootstrap(String targetID, String sourceList) { + if (targetID == null) { + return; + } + + try { + String rootstrapPath = sbi.getRootstrapPath(targetID); + String sourcesListFile = rootstrapPath + "/etc/apt/sources.list"; + + /** "echo" command is not used on shell.execute() **/ + // String command = String.format("/bin/echo \"%s\" > %s/etc/apt/sources.list", sourceList, rootstrapPath); + + + File file = new File(sourcesListFile); + FileWriter writer = new FileWriter(file); + writer.write(sourceList); + writer.close(); + } catch(SBIException e) { + e.printStackTrace(); + } catch(Exception e1) { + e1.printStackTrace(); + } + } + + public static void resolveDpkgInterruptForRootstrap(String targetID, + OutputStream stdoutStream, OutputStream stderrStream) { + if (targetID == null) { + return; + } + + String command = "dpkg --configure -a"; + + try { + sbi.actionStdOut("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null ); + } catch (SBIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void aptGetUpdateForRootstrap(String targetID, + OutputStream stdoutStream, OutputStream stderrStream) { + if (targetID == null) { + return; + } + + String command = "apt-get update"; + + try { + sbi.actionStream("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null, stdoutStream, stderrStream ); + } catch (SBIException e) { + // TODO Auto-generated catch block + e.setMessage("Failed to update. please check console view."); + e.printStackTrace(); + e.showErrorDialog(); + } + } + + public static boolean verifySshConnectionForRootstrap(String targetID, String remoteAddr) { + String command = "ssh -oStrictHostKeyChecking=no " + remoteAddr + " exit"; + int result = 0; + + if (targetID == null) { + return false; + } + + try { + result = sbi.actionReturnExitValue("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null ); + } catch (SBIException e) { + // TODO Auto-generated catch block + e.setMessage(String.format("Failed to execute \"%s\"", command)); + e.printStackTrace(); + e.showErrorDialog(); + } + + if (result != 0) { + SBIException e = new SBIException( + String.format("Failed to connect \"%s\".", remoteAddr)); + e.showErrorDialog(); + return false; + } + return true; + } + + public static void aptGetUpgradeForRootstrap(String targetID, + OutputStream stdoutStream, OutputStream stderrStream) { + + if (targetID == null) { + return; + } + + String command = "apt-get --force-yes -y dist-upgrade"; + try { + sbi.actionStream("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null, stdoutStream, stderrStream ); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + public static void aptGetInstallForRootstrap(String targetID, String pkgList, + OutputStream stdoutStream, OutputStream stderrStream) { + if (targetID == null) { + return; + } + + String command = String.format("apt-get --force-yes -y install %s", pkgList); + try { + sbi.actionStream("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null, stdoutStream, stderrStream ); + } catch (SBIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + public static void aptGetInstallForTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) { + String command = String.format("apt-get --force-yes -y install %s", pkgName); + + if (device != null) { + try { + device.executeShellCommand(command, rec, MAX_TIMEOUT); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + + public static void dpkgInstallForRootstrap(String targetID, String debList, + OutputStream stdoutStream, OutputStream stderrStream) { + + if (targetID == null) { + return ; + } + + String command = String.format("dpkg -i %s", debList); + try { + sbi.actionStream("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null, stdoutStream, stderrStream ); + } catch (SBIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void aptGetUpdateForRealTarget(IDevice device, PackageManagerOuputReceiver rec) { + String command = "apt-get update"; + + if (device != null) { + try { + device.executeShellCommand(command, rec, MAX_TIMEOUT); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + public static void fixBrokenForRootstrap(String targetID, OutputStream stdoutStream, OutputStream stderrStream) { + + if (targetID == null) { + return ; + } + + String command = "apt-get -f --force-yes -y install"; + try { + sbi.actionStream("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null, stdoutStream, stderrStream ); + } catch (SBIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void fixBrokenForRealTarget(IDevice device, PackageManagerOuputReceiver rec) { + String command = "apt-get -f --force-yes -y install"; + + if (device != null) { + try { + device.executeShellCommand(command, rec, MAX_TIMEOUT); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + public static boolean verifySshConnectionForRealTarget(IDevice device, String remoteAddr, PackageManagerOuputReceiver rec) { + String command = "ssh -oStrictHostKeyChecking=no " + remoteAddr + " exit; echo $?"; + String log = ""; + + if (device != null) { + try { + device.executeShellCommand(command, rec, VERIFY_SSHCONN_TIMEOUT); + String[] logs = rec.getLog(); + log = logs[0]; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + if (log.equals("0")) { + return true; + } else { + SBIException e = new SBIException( + String.format("Failed to connect \"%s\".", remoteAddr)); + e.showErrorDialog(); + return false; + } + } + + + public static void aptGetUpgradeForRealTarget(IDevice device, PackageManagerOuputReceiver rec) { + String command = "apt-get --force-yes -y dist-upgrade"; + + if (device != null) { + try { + device.executeShellCommand(command, rec, MAX_TIMEOUT); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + public static String getArchForDebFile(String debPath) { + String retStr = ""; + + String command = String.format("dpkg --info %s | grep \"Architecture: \"", debPath); + String result = HostUtil.returnExecute(command); + + if (!result.contains("Architecture: ")) { + return retStr; + } + + String[] splitResult = result.split(":"); + + if (splitResult.length < 2 ) { + return retStr; + } + + retStr = splitResult[1].trim(); + + return retStr; + } + + public static String getArchOfRemotePkgForRootstrap(String pkgName, String targetID) { + String retStr = ""; + if (targetID == null) { + return ""; + } + + try { + String command = String.format("apt-cache show %s | grep \"Architecture: \"", pkgName); + String result = sbi.actionStdOut("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null ); + + if (!result.contains("Architecture: ")) { + return retStr; + } + + result = result.split("\n")[0]; + String[] splitResult = result.split(":"); + + if (splitResult.length < 2 ) { + return retStr; + } + + retStr = splitResult[1].trim(); + + } catch (SBIException e) { + // TODO Auto-generated catch block + //e.printStackTrace(); + } + + return retStr; + } + private static String getValue(String header, String key) { + int s_pos = 0; + int e_pos = 0; + String ret = null; + s_pos = header.indexOf(key); + if (s_pos == -1) + return ""; + e_pos = header.indexOf("\n",s_pos); + if (e_pos == -1) { + ret = header.substring(s_pos+key.length()); + } else { + ret = header.substring(s_pos+key.length(), e_pos).trim(); + } + return ret; + } + public static String getArchOfRemotePkgForRealTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) { + String retStr = ""; + String archKey = "Architecture: "; + if (device != null) { + try { + String result = ""; + String command = String.format("apt-cache show %s | grep \"Architecture: \"", pkgName); + device.executeShellCommand(command, rec, MAX_TIMEOUT); + for(String line : rec.getLog()) { + result = result + line + "\n"; + } + //String result = session.run(command, null); + + retStr = getValue(result,archKey); + } catch (Exception e) { + e.printStackTrace(); + } + } + + return retStr; + } + + + public static String getPkgNameForDebFile(String debPath) { + String retStr = ""; + + String command = String.format("dpkg --info %s | grep \"Package: \"", debPath); + String result = HostUtil.returnExecute(command); + + if (!result.contains("Package: ")) { + return retStr; + } + + String[] splitResult = result.split(":"); + + if (splitResult.length < 2 ) { + return retStr; + } + + retStr = splitResult[1].trim(); + + return retStr; + } + + public static String getPkgVerForDebFile(String debPath) { + String retStr = ""; + + String command = String.format("dpkg --info %s | grep \"Version: \"", debPath); + String result = HostUtil.returnExecute(command); + + if (!result.contains("Version:")) { + return retStr; + } + + String[] splitResult = result.split(":"); + + if (splitResult.length < 2 ) { + return retStr; + } + + retStr = splitResult[1].trim(); + + return retStr; + } + + public static String getPkgNewVerForRootstrap(String pkgName, String targetID) { + String retStr = ""; + if (targetID == null) { + return ""; + } + + try { + String command = String.format("apt-cache showpkg %s | grep -A 1 \"Versions:\"", pkgName); + String result = sbi.actionStdOut("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null ); + + if (!result.contains("Versions:")) { + return retStr; + } + + String[] splitResult = result.split("\n"); + + if (splitResult.length < 2 ) { + return retStr; + } + + //splitResult = splitResult[1].split(" ")[0].split(":"); + //retStr = splitResult[splitResult.length-1].trim(); + retStr = splitResult[1].split(" ")[0]; + } catch (SBIException e) { + e.printStackTrace(); + } + return retStr; + } + + public static String getPkgNewVerForRealTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) { + String retStr = ""; + + if (device != null) { + try { + String result = ""; + String command = String.format("apt-cache showpkg %s | grep -A 1 \"Versions:\"", pkgName); + //String result = session.run(command, null); + device.executeShellCommand(command, rec, MAX_TIMEOUT); + + for (String line : rec.getLog()) { + result = result + line + "\n"; + } + + if (!result.contains("Versions:")) { + return retStr; + } + + String[] splitResult = result.split("\n"); + + if (splitResult.length < 2 ) { + return retStr; + } + + //splitResult = splitResult[1].split(" ")[0].split(":"); + retStr = splitResult[1].split(" ")[0]; + //retStr = splitResult[splitResult.length-1].trim(); + + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + return retStr; + } + + + public static String getPkgInstalledVerForRootstrap(String pkgName, String targetID) { + String retStr = ""; + if (targetID == null) { + return ""; + } + + try { + + String command = String.format("dpkg -s %s | grep \"Version: \"", pkgName); + + String result = sbi.actionStdOut("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null ); + + if (!result.contains("Version: ")) { + return retStr; + } + + result = result.replace("\n", " "); + String[] splitResult = result.split(" "); + if (splitResult.length < 2) { + return retStr; + } + + //splitResult = splitResult[1].split(" ")[0].split(":"); + //retStr = splitResult[splitResult.length-1].replace("\n", "").trim(); + retStr = splitResult[1].split(" ")[0]; + } catch (SBIException e) { + e.printStackTrace(); + } + + return retStr; + } + + public static String getPkgInstalledVerForRealTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) { + String archKey = "Version: "; + String retStr = ""; + if (device != null) { + try { + String command = String.format("dpkg -s %s | grep \"Version: \"", pkgName); + String result = ""; + device.executeShellCommand(command, rec, MAX_TIMEOUT); + for (String line : rec.getLog()) { + result = result + line + "\n"; + } + //String result = session.run(command, null); + + retStr = getValue(result,archKey); + + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + return retStr; + } + + public static boolean pkgInstalledSuccessfullyForRootstrap(String pkgName, String targetID) { + boolean ret = false; + + if (targetID == null) { + return ret; + } + + try { + String command = String.format("dpkg -l | grep -w \"%s \" | cut -d\" \" -f1", pkgName); + String result = sbi.actionStdOut("command", + String.format("-mode=emulate -cmd=\'%s\' -path=.", command ), + targetID, null ); + + result = result.trim(); + + if (result.equals("ii")) { + ret = true; + } + + } catch (SBIException e) { + e.printStackTrace(); + } + + return ret; + } + + public static boolean pkgInstalledSuccessfullyForRealTarget(String pkgName, IDevice device, PackageManagerOuputReceiver rec) { + boolean ret = false; + if (device != null) { + try { + String command = String.format("dpkg -l | grep -w \"%s \" | cut -d' ' -f1", pkgName); + device.executeShellCommand(command, rec, MAX_TIMEOUT); + for (String line : rec.getLog()) { + line = line.trim(); + if (line.equals("ii")) { + ret = true; + } + } + + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + return ret; + } +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManager.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManager.java new file mode 100644 index 00000000..aa02f4dc --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManager.java @@ -0,0 +1,1626 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.pkgInstall; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.Iterator; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.console.MessageConsoleStream; + +import org.tizen.common.connection.ConnectionPlugin; +import org.tizen.common.console.ConsoleManager; + + +import org.tizen.nativecommon.build.CheckCancelJob; +import org.tizen.nativecommon.build.CurrentEnabledProject; +import org.tizen.nativecommon.build.SmartBuildInterface; +import org.tizen.nativecommon.build.exception.SBIException; +import org.tizen.nativeplatform.Activator; +import org.tizen.nativeplatform.build.PlatformConfigurationManager; +import org.tizen.sdblib.IDevice; +import org.tizen.sdblib.SyncService; +import org.tizen.sdblib.SyncService.SyncResult; + + +public class PackageManager extends Dialog { + + private TableViewer viewerForRootstrap = null; + private TableViewer viewerForTarget = null; + private static TableViewer currentViewer; + private static String CURRENT_TAB_NAME; + + private static Table tableForRootstrap = null; + private static Table tableForTarget = null; + + private Button addButtonFromFile; + private Button addButtonFromRemote; + private Button installButton; + private Button removeButton; + private Button upgradeButton; + private Button updateButton; + private Button fixBrokenButton; + + private Text repositoryText; + private Text packageListText; + + private static String ROOTSTRAP_TAB_NAME = "Build System"; + private static String TARGET_TAB_NAME = "Device"; + private static String DEB_PATH= "/tmp"; + private static String DEB_COMMAND_INSTALL = "dpkg -i"; + private static String DEB_COMMAND_UPDATEMODE = "/bin/change-booting-mode.sh --update"; + + public Shell shell; + + public String target = null; + private String addPkgListForRemote; + private String repositoryForRemote; + private static String previousFilterPath = null; + private String selectedFileList; + private String configuration; + + private IDevice device; + private Display display = null; + private FileDialog fd; + private TabFolder tabFolder; + private CopyOnWriteArrayList<Package> pkgs = null; + + private boolean enableRootstrapTab = true; + private boolean enableTargetTab = true; + + private final int MAX_TIMEOUT = 60000; + + private SmartBuildInterface sbi = SmartBuildInterface.getInstance(); + + private int tabIndex = 0; + + private MouseListener removeListener = new MouseListener() + { + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + CopyOnWriteArrayList<Package> pkgList = PkgModelProvider.INSTANCE.getPkgs(); + for( Package pkg: pkgList) + { + boolean selected = false; + if (CURRENT_TAB_NAME.equals(ROOTSTRAP_TAB_NAME)) { + selected = pkg.getCheckColumn1(); + } else if (CURRENT_TAB_NAME.equals(TARGET_TAB_NAME)) { + selected = pkg.getCheckColumn2(); + } + if (selected) { + pkgList.remove(pkg); + } + } + if (viewerForRootstrap != null) { + viewerForRootstrap.refresh(); + } + if (viewerForTarget != null) { + viewerForTarget.refresh(); + } + + int recentTableIndex = currentViewer.getTable().getItemCount(); + + for (int i = 0; i < recentTableIndex; i++) { + TableItem item1 = null; + TableItem item2 = null;; + + if (viewerForRootstrap != null) { + item1 = viewerForRootstrap.getTable().getItem(i); + Package pkg = (Package)item1.getData(); + item1.setChecked(pkg.getCheckColumn1()); + } + if (viewerForTarget != null) { + item2 = viewerForTarget.getTable().getItem(i); + Package pkg = (Package)item2.getData(); + item2.setChecked(pkg.getCheckColumn2()); + } + } + } + + @Override + public void mouseUp(MouseEvent e) { + } + + }; + + + protected PackageManager(Shell parentShell, String target) { + super(parentShell); + setBlockOnOpen(false); + this.display = parentShell.getDisplay(); + this.target = target; + this.device = ConnectionPlugin.getDefault().getCurrentDevice(); + } + + protected PackageManager(Shell parentShell, String target, boolean enableRootstrap, boolean enableTarget) { + super(parentShell); + setBlockOnOpen(false); + this.enableRootstrapTab = enableRootstrap; + this.enableTargetTab = enableTarget; + this.display = parentShell.getDisplay(); + + if (enableRootstrap) { + IProject _project = CurrentEnabledProject.getCurrentProject(); + IConfiguration config = ManagedBuildManager.getBuildInfo( _project ).getDefaultConfiguration(); + this.configuration = config.getName(); + } + if (enableTarget) { + this.target = target; + this.device = ConnectionPlugin.getDefault().getCurrentDevice(); + } + } + + protected PackageManager(Shell parentShell, String target, int tabIndex) { + super(parentShell); + setBlockOnOpen(false); + this.display = parentShell.getDisplay(); + this.target = target; + this.device = ConnectionPlugin.getDefault().getCurrentDevice(); + this.tabIndex = tabIndex; + } + + protected void setShellStyle(int newShellStyle) { + int newStyle = newShellStyle & ~SWT.APPLICATION_MODAL; + newStyle |= SWT.MODELESS; + super.setShellStyle(newStyle); + } + + @Override + public boolean close() + { + PkgModelProvider.INSTANCE.getPkgs().clear(); + return super.close(); + } + + protected void createButtonsForButtonBar(Composite parent) + { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true); + } + + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Package Manager"); + newShell.setLocation(100, 100); + newShell.setSize(960, 600); + } + + @Override + protected Control createDialogArea(Composite parent) { + + + Composite composite = new Composite( parent, SWT.None ); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + composite.setLayout(new GridLayout(1, false)); + + if (!enableRootstrapTab && !enableTargetTab) { + createError( composite, "- Any project is not selected and any connection is not connected,\n" + + "- or project is not \"CUSTOM DEBIAN PROJECT\"." ); + } else { + //2nd basement : Sourcelist + update button + createTopComposite( composite ); + //3rd basement : Package text + +, - button + createMiddleComposite( composite ); + //5th basement : tab (upgrade/install button + table) + createBottomComposite( composite ); + } + + return null; + } + + + private void createError( Composite parent, String message ) + { + Composite com = new Composite( parent, SWT.NONE ); + com.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + com.setLayout(new GridLayout(1, false)); + + Label errorLabel = new Label(com, SWT.NONE); + errorLabel.setText(message); + } + + private void createTopComposite( Composite parent ) + { + Composite com = new Composite( parent, SWT.NONE ); + com.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + com.setLayout(new GridLayout(3, false)); + + Label searchLabel = new Label( com, SWT.NONE ); + searchLabel.setText("Source List : "); + + repositoryText = new Text(com, SWT.SINGLE | SWT.BORDER | SWT.SEARCH); + + GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); + gridData.widthHint = 300; + repositoryText.setLayoutData(gridData); + + if (enableRootstrapTab) { + String targetID = getTargetID(); + + try { + repositoryText.setText(PackageCommander.getCurrentSourceListForRootstrap(targetID)); + } catch (SBIException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } else if (enableTargetTab) { + //repositoryText.setText(PackageCommander.getCurrentSourceListForRealTarget(getSession())); + PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver(); + rec.setPrintConsole(false); + repositoryText.setText(PackageCommander.getCurrentSourceListForRealTarget(device, rec)); + } else { + repositoryText.setText(""); + } + + updateButton = new Button( com, SWT.PUSH ); + updateButton.setText("Update "); + updateButton.addMouseListener(new MouseListener(){ + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + repositoryForRemote = repositoryText.getText(); + + if(repositoryForRemote.isEmpty()) { + MessageDialog.openError(shell, "Error", "Repository is empty.\nPlease set repository."); + return; + } + + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); + + try { + dialog.run(true, true, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor.beginTask("apt-get update", -1); + + CheckCancelJob cancelJob = new CheckCancelJob(monitor); + Thread checkCancelThread = new Thread(cancelJob); + checkCancelThread.start(); + + ConsoleManager cm = new ConsoleManager( "Package Installer", true); + cm.clear(); + MessageConsoleStream mcsError = cm.getMessageConsoleStream(true); + MessageConsoleStream mcs = cm.getMessageConsoleStream(false); + PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver(); + rec.setMessageConsoleStream(mcs); + + try { + if (CURRENT_TAB_NAME.equals(ROOTSTRAP_TAB_NAME)) { + String targetID = getTargetID(); + monitor.subTask("changing source list..."); + PackageCommander.changeSourceListForRootstrap(targetID, repositoryForRemote); + + Thread.sleep(500); + + int s = repositoryForRemote.indexOf("ssh://"); + if (s != -1) { + String remoteAddr = repositoryForRemote.substring(s + 6); + int e = remoteAddr.indexOf("/"); + + remoteAddr = remoteAddr.substring(0, e); + monitor.subTask(String.format("verifying connection %s", remoteAddr)); + if (!PackageCommander.verifySshConnectionForRootstrap(targetID, remoteAddr)) { + return; + } + } + + monitor.subTask("apt-get update..."); + PackageCommander.aptGetUpdateForRootstrap(targetID, mcs, mcsError); + + } else if(CURRENT_TAB_NAME.equals(TARGET_TAB_NAME)) { + if (!device.isEmulator()) { + // Change to bootmode with update + String command = DEB_COMMAND_UPDATEMODE; + device.executeShellCommand(command, rec, MAX_TIMEOUT); + } + /** target change source list **/ + monitor.subTask("changing source list..."); + PackageCommander.changeSourceListForRealTarget(repositoryForRemote, device); + + Thread.sleep(500); + + if (!device.isEmulator()) { + // Change to bootmode with update + String command = DEB_COMMAND_UPDATEMODE; + device.executeShellCommand(command, rec, MAX_TIMEOUT); + } + + int s = repositoryForRemote.indexOf("ssh://"); + if (s != -1) { + String remoteAddr = repositoryForRemote.substring(s + 6); + int e = remoteAddr.indexOf("/"); + + remoteAddr = remoteAddr.substring(0, e); + + if (!PackageCommander.verifySshConnectionForRealTarget(device, remoteAddr, rec)) { + return; + } + } + + monitor.subTask("apt-get update..."); + PackageCommander.aptGetUpdateForRealTarget(device, rec); + } + monitor.subTask("updating package informations..."); + updatePkgInfoAfterAptUpdate(); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + checkCancelThread.interrupt(); + //monitor.worked(1); + monitor.done(); + } + }); + } catch (Exception e1) { + e1.printStackTrace(); + } + + currentViewer.refresh(); + } + + @Override + public void mouseUp(MouseEvent e) { + } + + }); + + } + private void createMiddleComposite( Composite parent ) + { + Composite com = new Composite( parent, SWT.NONE ); + com.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + com.setLayout(new GridLayout(4, false)); + + Label targetLabel = new Label( com, SWT.NONE ); + targetLabel.setText("Package Name: "); + + Listener AddPackageEventHandler = new Listener() + { + + @Override + public void handleEvent(Event event) { + switch ( event.type ) + { + /* package is selected for 2 cases + * 1. Edit text in packageListText then input 'Enter' key + * 2. click addButtonFromRemote button + * so, addListener for 2 case for each cases + * then, event type is SWT.Traverse then 1st case + * and, event type is SWT.MouseDown then 2nd case + */ + case SWT.Traverse: + if( event.character == SWT.CR) + { + /* if input is enter key, then we don't want to other process for 'enter key' + * then event.doit variable is set to false + */ + event.doit = false; + } + else + { + /* if input is other key, for example tab or arrow key + * then we do not add package + */ + break; + } + case SWT.MouseDown: + + int oldTableIndex = currentViewer.getTable().getItemCount(); + + addPkgListForRemote = packageListText.getText(); + + if(addPkgListForRemote.isEmpty()) { + MessageDialog.openError(shell, "Error", "Package name is empty.\nPlease input package name for installing"); + return; + } else if(addPkgListForRemote.contains("\"") || addPkgListForRemote.contains("\'") || + addPkgListForRemote.contains(":") || addPkgListForRemote.contains(",") || + addPkgListForRemote.contains(";")) { + MessageDialog.openError(shell, "Error", "Invalid character is found. (\" \' , : ; . )\n" + + "Between package names, delimeter shoud be space character.\n" + + "(ex) sqlite3 sysv-rc sglib-dev perl"); + return; + } + + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); + + try { + dialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor.beginTask("Adding packages to list", -1); + + if (addPkgListForRemote != "") { + addPkgListForRemote = addPkgListForRemote.trim(); + String[] arrPkgs = addPkgListForRemote.split(" "); + for (String pkgName : arrPkgs) { + if (pkgName.isEmpty()) { + continue; + } + monitor.subTask(String.format("Adding %s", pkgName)); + addColumn(currentViewer, pkgName, null, Package.PKGTYPE.REMOTE); + } + } + + monitor.worked(1); + monitor.done(); + } + }); + } catch (Exception e1) { + e1.printStackTrace(); + } + + packageListText.setText(""); + + //currentViewer.refresh(); + if (viewerForRootstrap != null) { + viewerForRootstrap.refresh(); + } + if (viewerForTarget != null) { + viewerForTarget.refresh(); + } + + int recentTableIndex = currentViewer.getTable().getItemCount(); + + for (int i = oldTableIndex; i < recentTableIndex; i++) { + TableItem item1 = null; + TableItem item2 = null;; + + if (viewerForRootstrap != null) { + item1 = viewerForRootstrap.getTable().getItem(i); + Package pkg = (Package)item1.getData(); + item1.setChecked(pkg.getCheckColumn1()); + } + if (viewerForTarget != null) { + item2 = viewerForTarget.getTable().getItem(i); + Package pkg = (Package)item2.getData(); + item2.setChecked(pkg.getCheckColumn2()); + } + } + break; + } + } + }; + + packageListText = new Text(com, SWT.SINGLE | SWT.BORDER | SWT.SEARCH); + packageListText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL + | GridData.HORIZONTAL_ALIGN_FILL)); + packageListText.addListener(SWT.Traverse, AddPackageEventHandler); + + addButtonFromRemote = new Button( com, SWT.PUSH ); + addButtonFromRemote.setImage(new Image(display, + Activator.getImageDescriptor("/icons/packagelist_to_table.gif").getImageData())); + addButtonFromRemote.setToolTipText("Add packages from remote repository"); + addButtonFromRemote.addListener(SWT.MouseDown, AddPackageEventHandler); + + + addButtonFromFile = new Button( com, SWT.PUSH ); + addButtonFromFile.setImage(new Image(display, + Activator.getImageDescriptor("/icons/folder_search.gif").getImageData())); + addButtonFromFile.setToolTipText("Add packages from file system"); + addButtonFromFile.addMouseListener(new MouseListener() + { + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + + int oldTableIndex = currentViewer.getTable().getItemCount(); + + fd = new FileDialog( getShell(), SWT.OPEN|SWT.MULTI); + fd.setText("Select deb file..."); + if (previousFilterPath == null) + fd.setFilterPath(null); + else + fd.setFilterPath(previousFilterPath); + String[] filterExt = { "*.deb" }; + fd.setFilterExtensions(filterExt); + selectedFileList = fd.open(); + + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); + + try { + dialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor.beginTask("Adding packages to list", -1); + if( selectedFileList != null ) + { + String[] files = fd.getFileNames(); + previousFilterPath = fd.getFilterPath(); + for (int i=0, n = files.length; i<n; i++) { + monitor.subTask(String.format("Adding %s", files[i])); + StringBuffer buf = new StringBuffer(); + buf.append(fd.getFilterPath()); + if (buf.charAt(buf.length() -1) != File.separatorChar) { + buf.append(File.separatorChar); + } + buf.append(files[i]); + addColumn( currentViewer, null, buf.toString(), Package.PKGTYPE.LOCAL); + } + } + } + }); + } catch (Exception e1) { + e1.printStackTrace(); + } + + //currentViewer.refresh(); + if (viewerForRootstrap != null) { + viewerForRootstrap.refresh(); + } + if (viewerForTarget != null) { + viewerForTarget.refresh(); + } + + int recentTableIndex = currentViewer.getTable().getItemCount(); + + for (int i = oldTableIndex; i < recentTableIndex; i++) { + TableItem item1 = null; + TableItem item2 = null;; + + if (viewerForRootstrap != null) { + item1 = viewerForRootstrap.getTable().getItem(i); + Package pkg = (Package)item1.getData(); + item1.setChecked(pkg.getCheckColumn1()); + } + if (viewerForTarget != null) { + item2 = viewerForTarget.getTable().getItem(i); + Package pkg = (Package)item2.getData(); + item2.setChecked(pkg.getCheckColumn2()); + } + } + } + + @Override + public void mouseUp(MouseEvent e) { + } + + }); + + } + + private Control getRootstrapTabControl( TabFolder tabFolder ) + { + Composite composite = new Composite( tabFolder, SWT.NONE ); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + composite.setLayout(new GridLayout(1, false)); + + Composite Com = new Composite( composite, SWT.NONE ); + Com.setLayoutData(new GridData(GridData.FILL_HORIZONTAL )); + Com.setLayout(new GridLayout(2, false)); + + Composite leftCom = new Composite( Com, SWT.NONE ); + leftCom.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING)); + leftCom.setLayout(new GridLayout(1, false)); + + Composite rightCom = new Composite( Com, SWT.NONE ); + rightCom.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END)); + //rightCom.setLayout(new GridLayout(4, false)); + rightCom.setLayout(new GridLayout(3, false)); + + Label configurationLabel = new Label(leftCom, SWT.LEFT); + configurationLabel.setText(String.format("Configuration : %s", this.configuration)); + + upgradeButton = new Button( rightCom, SWT.PUSH ); + upgradeButton.setText("Upgrade"); + upgradeButton.addMouseListener(new MouseListener(){ + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + + repositoryForRemote = repositoryText.getText(); + + if(repositoryForRemote.isEmpty()) { + MessageDialog.openError(shell, "Error", "Repository is empty.\nPlease set repository."); + return; + } + + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); + + try { + dialog.run(true, true, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor.beginTask("apt-get upgrade", -1); + + CheckCancelJob cancelJob = new CheckCancelJob(monitor); + Thread checkCancelThread = new Thread(cancelJob); + checkCancelThread.start(); + + ConsoleManager cm = new ConsoleManager( "Package Installer", true); + cm.clear(); + MessageConsoleStream mcsError = cm.getMessageConsoleStream(true); + MessageConsoleStream mcs = cm.getMessageConsoleStream(false); + MessageConsoleStream mcsError1 = cm.getMessageConsoleStream(true); + MessageConsoleStream mcs1 = cm.getMessageConsoleStream(false); + String targetID = getTargetID(); + + monitor.subTask("apt-get -f -y install"); + PackageCommander.fixBrokenForRootstrap(targetID, mcs, mcsError); + + monitor.subTask("apt-get -y dist-upgrade"); + PackageCommander.aptGetUpgradeForRootstrap(targetID, mcs1, mcsError1); + + //monitor.worked(1); + checkCancelThread.interrupt(); + monitor.done(); + } + }); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + @Override + public void mouseUp(MouseEvent e) { + } + + }); + + installButton = new Button( rightCom, SWT.PUSH ); + installButton.setText("Install"); + installButton.addMouseListener(new MouseListener(){ + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + pkgs = getSelectedPkg(PkgModelProvider.INSTANCE.getPkgs()); + + if(pkgs.isEmpty()) { + MessageDialog.openError(shell, "Error", "There is no selected package."); + return; + } + + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); + + try { + dialog.run(true, true, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor.beginTask("Installing package", -1); + + CheckCancelJob cancelJob = new CheckCancelJob(monitor); + Thread checkCancelThread = new Thread(cancelJob); + checkCancelThread.start(); + + try { + String targetID = getTargetID(); + String debPathList = ""; + String debNameList = ""; + String aptPkgList = ""; + + ConsoleManager cm = new ConsoleManager( "Installing packages", true); + cm.clear(); + MessageConsoleStream mcsError = cm.getMessageConsoleStream(true); + MessageConsoleStream mcs = cm.getMessageConsoleStream(false); + MessageConsoleStream mcsError1 = cm.getMessageConsoleStream(true); + MessageConsoleStream mcs1 = cm.getMessageConsoleStream(false); + MessageConsoleStream mcsError2 = cm.getMessageConsoleStream(true); + MessageConsoleStream mcs2 = cm.getMessageConsoleStream(false); + + for (Package pkg : pkgs) { + if (pkg.getPkgType().equals(Package.PKGTYPE.LOCAL)) { + debPathList = debPathList.concat(pkg.getPath() + " "); + debNameList = debNameList.concat(pkg.getName() + " "); + } else if (pkg.getPkgType().equals(Package.PKGTYPE.REMOTE)) { + aptPkgList = aptPkgList.concat(pkg.getName() + " "); + } + } + + if(!aptPkgList.equals("")) { + monitor.subTask("apt-get -f -y install"); + PackageCommander.fixBrokenForRootstrap(targetID, mcs, mcsError); + monitor.subTask(String.format("apt-get install %s", aptPkgList)); + mcs1.write("***** apt-get install *****\n"); + PackageCommander.aptGetInstallForRootstrap(targetID, aptPkgList, mcs1, mcsError1); + } + + + if(!cancelJob.getTerminateChecker() && !debNameList.equals("")) { + monitor.subTask(String.format("dpkg -i %s", debNameList)); + mcs2.write("\n***** dpkg install *****\n"); + PackageCommander.dpkgInstallForRootstrap(targetID, debPathList, mcs2, mcsError2); + /** E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem. **/ + PackageCommander.resolveDpkgInterruptForRootstrap(targetID, mcs2, mcsError2); + } + + for (Package pkg : pkgs) { + String installedVer = PackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), targetID); + pkg.setInstalledVersion1(installedVer); + + if (installedVer.equals("")) { + pkg.setInstallInfo1(Package.INSTALLINFO.NOT_INSTALLED); + } else if (installedVer.equals(pkg.getNewVersion1())) { + if (PackageCommander.pkgInstalledSuccessfullyForRootstrap(pkg.getName(), targetID)) { + pkg.setInstallInfo1(Package.INSTALLINFO.INSTALLED); + } else { + pkg.setInstallInfo1(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED); + } + } else { + pkg.setInstallInfo1(Package.INSTALLINFO.DIFFERENT_VERSION); + } + } + + } catch (IOException e) { + e.printStackTrace(); + } + + //checkCancelThread.interrupt(); + cancelJob.setFinishFlag(true); + monitor.done(); + } + }); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + currentViewer.refresh(); + //removeButtonForLocal.setEnabled(false); + //installButtonForLocal.setEnabled(false); + //localDebs.clear(); + } + + @Override + public void mouseUp(MouseEvent e) { + } + + }); + + /* + fixBrokenButton = new Button( rightCom, SWT.PUSH ); + fixBrokenButton.setText("Fix-Broken"); + fixBrokenButton.addMouseListener(new MouseListener(){ + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); + + try { + dialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor.beginTask("Fix; attempt to correct a system with broken dependencies in place", -1); + monitor.subTask("apt-get -f -y install"); + String targetID = getTargetID(); + ConsoleManager cm = new ConsoleManager( "Fix broken dependencies", true); + cm.clear(); + MessageConsoleStream mcsError = cm.getMessageConsoleStream(true); + MessageConsoleStream mcs = cm.getMessageConsoleStream(false); + PackageCommander.fixBrokenForRootstrap(targetID, mcs, mcsError); + monitor.done(); + } + }); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + + @Override + public void mouseUp(MouseEvent e) { + } + }); + */ + + removeButton = new Button( rightCom, SWT.PUSH ); + removeButton.setToolTipText("Remove checked package from list"); + removeButton.setImage(new Image(display, + Activator.getImageDescriptor("/icons/list-delete.gif").getImageData())); + removeButton.addMouseListener(removeListener); + + bottomTableForRootstrap(composite); + + return composite; + } + + private Control getTargetTabControl( TabFolder tabFolder ) + { + Composite composite = new Composite( tabFolder, SWT.NONE ); + composite.setLayoutData(new GridData(GridData.FILL_VERTICAL)); + composite.setLayout(new GridLayout(1, false)); + + Composite com = new Composite( composite, SWT.NONE ); + com.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + com.setLayout(new GridLayout(2, false)); + + Composite leftCom = new Composite( com, SWT.NONE ); + leftCom.setLayoutData(new GridData( GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING)); + leftCom.setLayout(new GridLayout(1, false)); + + Composite rightCom = new Composite( com, SWT.NONE ); + rightCom.setLayoutData(new GridData( GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END)); + //rightCom.setLayout(new GridLayout(4, false)); + rightCom.setLayout(new GridLayout(3, false)); + + Label configurationLabel = new Label(leftCom, SWT.LEFT); + configurationLabel.setText(String.format("Connection : %s", device.getSerialNumber())); + + upgradeButton = new Button( rightCom, SWT.PUSH ); + upgradeButton.setText("Upgrade"); + upgradeButton.addMouseListener(new MouseListener(){ + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + repositoryForRemote = repositoryText.getText(); + + if(repositoryForRemote.isEmpty()) { + MessageDialog.openError(shell, "Error", "Repository is empty.\nPlease set repository."); + return; + } + + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); + + try { + dialog.run(true, true, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor.beginTask("apt-get upgrade", -1); + + ConsoleManager cm = new ConsoleManager( "Package Installer", true); + cm.clear(); + MessageConsoleStream mcs = cm.getMessageConsoleStream(false); + PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver(); + rec.setMessageConsoleStream(mcs); + + monitor.subTask("apt-get -f -y install"); + PackageCommander.fixBrokenForRealTarget(device, rec); + + monitor.subTask("apt-get -y dist-upgrade"); + PackageCommander.aptGetUpgradeForRealTarget(device, rec); + + monitor.done(); + } + }); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + @Override + public void mouseUp(MouseEvent e) { + } + + }); + + installButton = new Button( rightCom, SWT.PUSH ); + installButton.setText("Install"); + installButton.addMouseListener(new MouseListener(){ + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + pkgs = getSelectedPkg(PkgModelProvider.INSTANCE.getPkgs()); + + if(pkgs.isEmpty()) { + MessageDialog.openError(shell, "Error", "Any package is not selected."); + return; + } + + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); + + try { + dialog.run(true, true, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor.beginTask("Installing deb package", -1); + + try { + String newPath = null; + ConsoleManager cm = new ConsoleManager( "Package Installer", true); + cm.clear(); + MessageConsoleStream mcsError = cm.getMessageConsoleStream(true); + MessageConsoleStream mcs = cm.getMessageConsoleStream(false); + PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver(); + rec.setMessageConsoleStream(mcs); + String command = null; + String localPkgList = ""; + String remotePkgList = ""; + + // Step 1: transfer pkg and make pkg list + for (Package pkg : pkgs) + { + if (pkg.getPkgType().equals(Package.PKGTYPE.LOCAL)) { + String debfile = new File(pkg.getPath()).getName(); + newPath = DEB_PATH + "/" + debfile; + monitor.subTask(String.format("transfer %s to target's %s",pkg.getPath(), newPath)); + if (monitor.isCanceled()) + throw new OperationCanceledException(); + SyncService syncService = device.getSyncService(); + SyncResult syncResult = syncService.pushFile(pkg.getPath(), newPath, SyncService.getNullProgressMonitor()); + if (syncResult.getCode() != SyncService.RESULT_OK) { + mcsError.println("Faild to move file from " + pkg.getPath() + " to " + newPath); + pkg.setInstallInfo2( Package.INSTALLINFO.NOT_INSTALLED); + //viewerForTarget.refresh(); + continue; + } + if (monitor.isCanceled()) + throw new OperationCanceledException(); + + if (localPkgList == "") { + localPkgList = newPath; + } else { + localPkgList = localPkgList + " " + newPath; + } + + } else if (pkg.getPkgType().equals(Package.PKGTYPE.REMOTE)) { + if (remotePkgList == "") { + remotePkgList = pkg.getName(); + } else { + remotePkgList = remotePkgList + " " + pkg.getName(); + } + } + } + + // Step 2: set update mode on device + if (!device.isEmulator()) { + // Change to bootmode with update + command = DEB_COMMAND_UPDATEMODE; + device.executeShellCommand(command, rec, MAX_TIMEOUT); + } + + // Step 3 : apt-get install pkg + if (remotePkgList != "") { + monitor.subTask("apt-get -y -f install"); + PackageCommander.fixBrokenForRealTarget(device, rec); + monitor.subTask(String.format("apt-get install %s", remotePkgList)); + PackageCommander.aptGetInstallForTarget(remotePkgList, device, rec); + } + + if (monitor.isCanceled()) + throw new OperationCanceledException(); + + // Step 4: install deb file + if (localPkgList != "") { + command = DEB_COMMAND_INSTALL + " " + localPkgList; + monitor.subTask(command); + device.executeShellCommand(command, rec, MAX_TIMEOUT); + } + + if (monitor.isCanceled()) + throw new OperationCanceledException(); + + for (Package pkg : pkgs) { + if (monitor.isCanceled()) + throw new OperationCanceledException(); + // update status + rec.setPrintConsole(false); + String installedVer = PackageCommander.getPkgInstalledVerForRealTarget(pkg.getName(), device, rec); + pkg.setInstalledVersion2(installedVer); + + if (installedVer.equals("")) { + pkg.setInstallInfo2(Package.INSTALLINFO.NOT_INSTALLED); + } else if (installedVer.equals(pkg.getNewVersion2())) { + if (PackageCommander.pkgInstalledSuccessfullyForRealTarget(pkg.getName(), device, rec)) { + pkg.setInstallInfo2(Package.INSTALLINFO.INSTALLED); + } else { + pkg.setInstallInfo2(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED); + } + } else { + pkg.setInstallInfo2(Package.INSTALLINFO.DIFFERENT_VERSION); + } + if (monitor.isCanceled()) + throw new OperationCanceledException(); + } + + monitor.done(); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + viewerForTarget.refresh(); + } + + @Override + public void mouseUp(MouseEvent e) { + } + + }); + + /* + fixBrokenButton = new Button( rightCom, SWT.PUSH ); + fixBrokenButton.setText("Fix-Broken"); + fixBrokenButton.addMouseListener(new MouseListener(){ + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); + + try { + dialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor.beginTask("Fix; attempt to correct a system with broken dependencies in place", -1); + monitor.subTask("apt-get -f -y install"); + ConsoleManager cm = new ConsoleManager( "Fix broken dependencies", true); + cm.clear(); + MessageConsoleStream mcs = cm.getMessageConsoleStream(false); + PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver(); + rec.setMessageConsoleStream(mcs); + PackageCommander.fixBrokenForRealTarget(device, rec); + monitor.done(); + } + }); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + + @Override + public void mouseUp(MouseEvent e) { + } + }); + */ + + removeButton = new Button( rightCom, SWT.PUSH ); + removeButton.setToolTipText("Remove checked package from list"); + removeButton.setImage(new Image(display, + Activator.getImageDescriptor("/icons/list-delete.gif").getImageData())); + removeButton.addMouseListener(removeListener); + + bottomTableForTarget(composite); + + return composite; + } + + private void bottomTableForRootstrap( Composite parent ) + { + Composite bottom = new Composite( parent, SWT.NONE ); + bottom.setLayoutData(new GridData(GridData.FILL_BOTH)); + bottom.setLayout(new FillLayout()); + + viewerForRootstrap = new TableViewer( bottom, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK ); + createColumns( parent, viewerForRootstrap, ROOTSTRAP_TAB_NAME ); + tableForRootstrap = viewerForRootstrap.getTable(); + tableForRootstrap.addListener( SWT.Selection, new Listener(){ + + @Override + public void handleEvent(Event event) { + if( event.detail == SWT.CHECK ) + { + Package pkg = (Package)event.item.getData(); + pkg.setCheckColumn1( !pkg.getCheckColumn1() ); + } + } + + }); + + tableForRootstrap.setHeaderVisible(true); + tableForRootstrap.setLinesVisible(true); + + viewerForRootstrap.setContentProvider(new ArrayContentProvider()); + viewerForRootstrap.setInput(PkgModelProvider.INSTANCE.getPkgs()); + + if (tabIndex == 0) { + currentViewer = viewerForRootstrap; + CURRENT_TAB_NAME = ROOTSTRAP_TAB_NAME; + } + } + + private void bottomTableForTarget( Composite parent ) + { + Composite bottom = new Composite( parent, SWT.NONE ); + bottom.setLayoutData(new GridData(GridData.FILL_BOTH)); + bottom.setLayout(new FillLayout()); + + viewerForTarget = new TableViewer( bottom, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK); + createColumns( parent, viewerForTarget, TARGET_TAB_NAME ); + tableForTarget = viewerForTarget.getTable(); + tableForTarget.addListener( SWT.Selection, new Listener(){ + + @Override + public void handleEvent(Event event) { + if( event.detail == SWT.CHECK ) + { + Package pkg = (Package)event.item.getData(); + pkg.setCheckColumn2( !pkg.getCheckColumn2() ); + } + } + + }); + + + tableForTarget.setHeaderVisible(true); + tableForTarget.setLinesVisible(true); + + viewerForTarget.setContentProvider(new ArrayContentProvider()); + viewerForTarget.setInput(PkgModelProvider.INSTANCE.getPkgs()); + + if (tabIndex == 1) { + currentViewer = viewerForTarget; + CURRENT_TAB_NAME = TARGET_TAB_NAME; + } + } + + + private void createBottomComposite( Composite parent ) + { + tabFolder = new TabFolder( parent, SWT.BORDER ); + tabFolder.setLayoutData(new GridData( GridData.FILL_BOTH)); + tabFolder.setLayout(new GridLayout(1, false)); + + tabFolder.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + try { + String tabName = tabFolder.getSelection()[0].getText(); + if (tabName.equals(ROOTSTRAP_TAB_NAME)) { + CURRENT_TAB_NAME = ROOTSTRAP_TAB_NAME; + if (enableRootstrapTab) { + String targetID = getTargetID(); + currentViewer = viewerForRootstrap; + String sourcelist = ""; + if (!sbi.checkTargetID(targetID)) { + MessageDialog.openError(shell, "Error", "Target does not exist. please build project first"); + } else { + sourcelist = PackageCommander.getCurrentSourceListForRootstrap(targetID); + } + repositoryText.setText(sourcelist); + } + + } else if (tabName.equals(TARGET_TAB_NAME)) { + CURRENT_TAB_NAME = TARGET_TAB_NAME; + if (enableTargetTab) { + PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver(); + rec.setPrintConsole(false); + currentViewer = viewerForTarget; + repositoryText.setText(PackageCommander.getCurrentSourceListForRealTarget(device, rec)); + } + } + if (currentViewer != null) { + currentViewer.refresh(); + } + } catch (SBIException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); + + TabItem rootstrapTab = new TabItem( tabFolder, SWT.NULL ); + rootstrapTab.setText(ROOTSTRAP_TAB_NAME); + + if (!enableRootstrapTab) { + rootstrapTab.setControl( errorTab( tabFolder , "- Any project is not selected or project is not \"CUSTOM DEBIAN PROJECT\".")); + tabIndex = 1; + } else { + rootstrapTab.setControl( getRootstrapTabControl( tabFolder )); + } + + TabItem deviceTab = new TabItem( tabFolder, SWT.NULL ); + deviceTab.setText(TARGET_TAB_NAME); + if (!enableTargetTab) { + deviceTab.setControl( errorTab( tabFolder, "- Any device is not connected or selected." )); + tabIndex = 0; + } else { + deviceTab.setControl( getTargetTabControl( tabFolder )); + } + + tabFolder.setSelection(tabIndex); + } + + private Control errorTab(TabFolder tabFolder, String msg) { + Composite composite = new Composite( tabFolder, SWT.NONE ); + composite.setLayoutData(new GridData(GridData.FILL_VERTICAL)); + composite.setLayout(new GridLayout(1, false)); + + Label errorLabel = new Label(composite, SWT.LEFT); + errorLabel.setText(msg); + + return composite; + } + + private void updatePkgInfoAfterAptUpdate() { + CopyOnWriteArrayList<Package> pkgs = PkgModelProvider.INSTANCE.getPkgs(); + + for (Package pkg : pkgs) { + if (pkg.getPkgType().equals(Package.PKGTYPE.REMOTE)) { + if (CURRENT_TAB_NAME.equals(ROOTSTRAP_TAB_NAME)) { + String targetID = getTargetID(); + String newVer = PackageCommander.getPkgNewVerForRootstrap(pkg.getName(), targetID); + if (newVer.equals("")) { + pkg.setInstallInfo1(Package.INSTALLINFO.NOT_FOUND); + pkg.setCheckColumn1(false); + } else if (pkg.getInstalledVersion1().equals("")) { + pkg.setInstallInfo1(Package.INSTALLINFO.NOT_INSTALLED); + } else if (newVer.equals(pkg.getInstalledVersion1())) { + if (PackageCommander.pkgInstalledSuccessfullyForRootstrap(pkg.getName(), targetID)) { + pkg.setInstallInfo1(Package.INSTALLINFO.INSTALLED); + } else { + pkg.setInstallInfo1(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED); + } + } else { + pkg.setInstallInfo1(Package.INSTALLINFO.DIFFERENT_VERSION); + } + pkg.setNewVersion1(newVer); + } else if (CURRENT_TAB_NAME.equals(TARGET_TAB_NAME)) { + PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver(); + rec.setPrintConsole(false); + String newVer = PackageCommander.getPkgNewVerForRealTarget(pkg.getName(), device, rec); + if (newVer.equals("")) { + pkg.setInstallInfo2(Package.INSTALLINFO.NOT_FOUND); + pkg.setCheckColumn2(false); + } else if (pkg.getInstalledVersion2().equals("")) { + pkg.setInstallInfo2(Package.INSTALLINFO.NOT_INSTALLED); + } else if (newVer.equals(pkg.getInstalledVersion2())) { + if (PackageCommander.pkgInstalledSuccessfullyForRealTarget(pkg.getName(), device, rec)) { + pkg.setInstallInfo2(Package.INSTALLINFO.INSTALLED); + } else { + pkg.setInstallInfo2(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED); + } + } else { + pkg.setInstallInfo2(Package.INSTALLINFO.DIFFERENT_VERSION); + } + pkg.setNewVersion2(newVer); + } + } + } + } + + + private boolean addColumn( TableViewer viewer, String pkgName, String debPath, Package.PKGTYPE type ) + { +// viewer.add( debName ); + CopyOnWriteArrayList<Package> pkgs = PkgModelProvider.INSTANCE.getPkgs(); + Iterator<Package> debIter = pkgs.iterator(); + //String targetID = getTargetID(); + String targetID = null; + //ISession session = null; + //IDevice device = null; + + if (enableRootstrapTab) { + targetID = getTargetID(); + } + /* + if (enableTargetTab) { + session = getSession(); + } + */ + + Package pkg; + + if (pkgName == null && debPath != null) { + pkgName = PackageCommander.getPkgNameForDebFile(debPath); + } + + while( debIter.hasNext() ) + { + pkg = debIter.next(); + if( pkg.getName().equals(pkgName)) + return true; + } + + pkg = new Package(); + if (debPath != null) { + pkg.setName(PackageCommander.getPkgNameForDebFile(debPath)); + } else if (pkgName != null) { + pkg.setName(pkgName); + } + + pkg.setTarget( this.target ); + pkg.setPath(debPath); + + String newVerForRootstrap = ""; + String newVerForTarget = ""; + + PackageManagerOuputReceiver rec = new PackageManagerOuputReceiver(); + rec.setPrintConsole(false); + + if (type.equals(Package.PKGTYPE.LOCAL)) { + pkg.setArch1(PackageCommander.getArchForDebFile(debPath)); + pkg.setArch2(PackageCommander.getArchForDebFile(debPath)); + newVerForRootstrap = PackageCommander.getPkgVerForDebFile(debPath); + newVerForTarget = newVerForRootstrap; + pkg.setNewVersion1(newVerForRootstrap); + pkg.setNewVersion2(newVerForRootstrap); + } else { + pkg.setArch1(PackageCommander.getArchOfRemotePkgForRootstrap(pkg.getName(), targetID)); + pkg.setArch2(PackageCommander.getArchOfRemotePkgForRealTarget(pkg.getName(), device, rec)); + newVerForRootstrap = PackageCommander.getPkgNewVerForRootstrap(pkg.getName(), targetID); + rec.cleanLog(); + newVerForTarget = PackageCommander.getPkgNewVerForRealTarget(pkg.getName(), device, rec); + pkg.setNewVersion1(newVerForRootstrap); + pkg.setNewVersion2(newVerForTarget); + } + + String installedVerForRootstrap = PackageCommander.getPkgInstalledVerForRootstrap(pkg.getName(), targetID); + rec.cleanLog(); + String installedVerForRealDevice = PackageCommander.getPkgInstalledVerForRealTarget(pkg.getName(), device, rec); + + pkg.setInstalledVersion1(installedVerForRootstrap); + pkg.setInstalledVersion2(installedVerForRealDevice); + + if (newVerForRootstrap.equals("")) { + pkg.setInstallInfo1(Package.INSTALLINFO.NOT_FOUND); + pkg.setCheckColumn1(false); + } else if (!installedVerForRootstrap.equals("")) { + if (!installedVerForRootstrap.equals(newVerForRootstrap)) { + pkg.setInstallInfo1(Package.INSTALLINFO.DIFFERENT_VERSION); + } else { + if (PackageCommander.pkgInstalledSuccessfullyForRootstrap(pkg.getName(), targetID)) { + pkg.setInstallInfo1(Package.INSTALLINFO.INSTALLED); + } else { + pkg.setInstallInfo1(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED); + } + } + } + + if (newVerForTarget.equals("")) { + pkg.setInstallInfo2(Package.INSTALLINFO.NOT_FOUND); + pkg.setCheckColumn2(false); + } else if (!installedVerForRealDevice.equals("")) { + if (!installedVerForRealDevice.equals(newVerForTarget)) { + pkg.setInstallInfo2(Package.INSTALLINFO.DIFFERENT_VERSION); + } else { + if (PackageCommander.pkgInstalledSuccessfullyForRealTarget(pkg.getName(), device, rec)) { + pkg.setInstallInfo2(Package.INSTALLINFO.INSTALLED); + } else { + pkg.setInstallInfo2(Package.INSTALLINFO.NOT_PROPERLY_INSTALLED); + } + } + } + + pkg.setPkgType(type); + + PkgModelProvider.INSTANCE.getPkgs().add(pkg); + + /* + if (type.equals(Package.PKGTYPE.LOCAL)) { + viewer.refresh(); + } + */ + + return true; + } + + + private void createColumns( Composite parent, final TableViewer viewer, final String type) + { + String[] titles = {"Install Type", "Package Name", "Arch", "New Version", "Installed Version", "Status"}; + int[] bounds = { 120, 180, 60, 200, 200, 160}; + + TableViewerColumn colInstallType = createTableViewerColumn( viewer, titles[0], bounds[0], SWT.NONE); + + colInstallType.setLabelProvider(new ColumnLabelProvider() { + @Override + public String getText(Object element) { + Package pkg = (Package)element; + return pkg.getPkgType().toString(); + } + }); + + TableViewerColumn colPackage = createTableViewerColumn( viewer, titles[1], bounds[1], SWT.NONE); + + colPackage.setLabelProvider(new ColumnLabelProvider() { + @Override + public String getText(Object element) { + Package pkg = (Package)element; + return pkg.getName(); + } + }); + + TableViewerColumn colArch = createTableViewerColumn( viewer, titles[2], bounds[2], SWT.NONE); + + colArch.setLabelProvider(new ColumnLabelProvider() { + @Override + public String getText(Object element) { + Package pkg = (Package)element; + String arch = ""; + if (type.equals(ROOTSTRAP_TAB_NAME)) { + arch = pkg.getArch1(); + } else if (type.equals(TARGET_TAB_NAME)) { + arch = pkg.getArch2(); + } + + return arch; + } + }); + + TableViewerColumn colNewVer = createTableViewerColumn( viewer, titles[3], bounds[3], SWT.NONE); + + colNewVer.setLabelProvider(new ColumnLabelProvider() { + @Override + public String getText(Object element) { + Package pkg = (Package)element; + String newVer = ""; + if (type.equals(ROOTSTRAP_TAB_NAME)) { + newVer = pkg.getNewVersion1(); + } else if (type.equals(TARGET_TAB_NAME)) { + newVer = pkg.getNewVersion2(); + } + + return newVer; + } + }); + + TableViewerColumn colInsVer = createTableViewerColumn( viewer, titles[4], bounds[4], SWT.NONE); + colInsVer.setLabelProvider(new ColumnLabelProvider() { + @Override + public String getText(Object element) { + Package pkg = (Package)element; + String installedVer = ""; + if (type.equals(ROOTSTRAP_TAB_NAME)) { + installedVer = pkg.getInstalledVersion1(); + } else if (type.equals(TARGET_TAB_NAME)) { + installedVer = pkg.getInstalledVersion2(); + } + + return installedVer; + } + }); + + TableViewerColumn colStatus = createTableViewerColumn( viewer, titles[5], bounds[5], SWT.NONE); + + colStatus.setLabelProvider(new ColumnLabelProvider() { + @Override + public String getText(Object element) { + Package pkg = (Package)element; + String status = ""; + if (type.equals(ROOTSTRAP_TAB_NAME)) { + status = pkg.getInstallInfo1().toString(); + } else if (type.equals(TARGET_TAB_NAME)) { + status = pkg.getInstallInfo2().toString(); + } + + return status; + } + }); + } + + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, int Style) { + + final TableViewerColumn viewerColumn = new TableViewerColumn( viewer, Style); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + } + + + private String getTargetID() { + IProject project = CurrentEnabledProject.getCurrentProject(); + IConfiguration config = ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration(); + String targetID = PlatformConfigurationManager.getBuildTargetName(config); + return targetID; + } + + private CopyOnWriteArrayList<Package> getSelectedPkg(CopyOnWriteArrayList<Package> pkgs) { + CopyOnWriteArrayList<Package> _pkgs = new CopyOnWriteArrayList<Package>(); + if (CURRENT_TAB_NAME.equals(ROOTSTRAP_TAB_NAME)) { + for (Package pkg : pkgs) { + if(pkg.getCheckColumn1()) { + _pkgs.add(pkg); + } + } + } else if (CURRENT_TAB_NAME.equals(TARGET_TAB_NAME)) { + for (Package pkg : pkgs) { + if(pkg.getCheckColumn2()) { + _pkgs.add(pkg); + } + } + } + + return _pkgs; + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManagerOuputReceiver.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManagerOuputReceiver.java new file mode 100644 index 00000000..0955cd9b --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManagerOuputReceiver.java @@ -0,0 +1,85 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.pkgInstall; + +import org.eclipse.ui.console.MessageConsoleStream; + +import org.tizen.sdblib.MultiLineReceiver; + +public class PackageManagerOuputReceiver extends MultiLineReceiver { + + public boolean isCancelled = false; + private boolean printConsole = true; + private String[] log = null; + private MessageConsoleStream mcs = null; + + public PackageManagerOuputReceiver() { + super(); + + setTrimLine(false); + } + + public void setMessageConsoleStream(MessageConsoleStream mcs) { + this.mcs = mcs; + } + + public void setPrintConsole(boolean b) { + printConsole = b; + } + + @Override + public void processNewLines(String[] lines) { + if (isCancelled == false) { + //processLogLines(lines); + log = lines; + if (printConsole) { + for (String line : lines) { + if (line.endsWith("\n")) { + mcs.print(line); + } else { + mcs.println(line); + } + } + } + } + } + + public String[] getLog() { + return log; + } + + public void cleanLog() { + log = null; + } + + public boolean isCancelled() { + return isCancelled; + } + +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManagerRootstrapHandler.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManagerRootstrapHandler.java new file mode 100644 index 00000000..a5f72a26 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManagerRootstrapHandler.java @@ -0,0 +1,99 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.pkgInstall; + +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedProject; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IProject; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +import org.tizen.common.connection.ConnectionPlugin; + + +import org.tizen.nativecommon.build.CurrentEnabledProject; +import org.tizen.nativeplatform.build.PlatformConfigurationManager; +import org.tizen.sdblib.IDevice; + +/** + * Our sample handler extends AbstractHandler, an IHandler base class. + * @see org.eclipse.core.commands.IHandler + * @see org.eclipse.core.commands.AbstractHandler + */ +public class PackageManagerRootstrapHandler extends AbstractHandler { + /** + * The constructor. + */ + public PackageManagerRootstrapHandler() { + } + + /** + * the command has been executed, so extract extract the needed information + * from the application context. + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + IDevice device = ConnectionPlugin.getDefault().getCurrentDevice(); + PackageManager pkgdlg; + String target = null; + boolean enableRootstrap = true; + boolean eanbleTarget = true; + + if (device == null) { + eanbleTarget = false; + } else { + target = device.getSerialNumber(); + if (target == null) { + eanbleTarget = false; + } + } + + IProject project = CurrentEnabledProject.getCurrentProject(); + if (project == null) { + enableRootstrap = false; + } else { + IConfiguration cfg =ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration(); + IManagedProject managedProject = cfg.getManagedProject(); + String projectArtifactType = managedProject.getProjectType().getBuildArtefactType().getId(); + if (!projectArtifactType.equals(PlatformConfigurationManager.TIZEN_CUSTOM_DEBIAN_ARTIFACT_TYPE) && + !projectArtifactType.equals(PlatformConfigurationManager.OLD_SLP_CUSTOM_DEBIAN_ARTIFACT_TYPE)) { + enableRootstrap = false; + } + } + + pkgdlg = new PackageManager(window.getShell(), target, enableRootstrap, eanbleTarget); + pkgdlg.open(); + return null; + } +}
\ No newline at end of file diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PkgModelProvider.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PkgModelProvider.java new file mode 100644 index 00000000..a6f0a4b8 --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PkgModelProvider.java @@ -0,0 +1,215 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.pkgInstall; + +import java.util.concurrent.CopyOnWriteArrayList; + +public enum PkgModelProvider { + + INSTANCE; + + private CopyOnWriteArrayList<Package> pkgs; + + private PkgModelProvider() + { + pkgs = new CopyOnWriteArrayList <Package>(); + } + + public CopyOnWriteArrayList<Package> getPkgs() + { + return pkgs; + } +} + +class Package{ + + public static enum INSTALLINFO + { +// READY, SUCCESSED, FAILED, INSTALLED, NOT_INSTALLED + INSTALLED, NOT_INSTALLED, DIFFERENT_VERSION, NOT_FOUND, NOT_PROPERLY_INSTALLED + } + + public static enum PKGTYPE + { + LOCAL, REMOTE + } + private String target = ""; + private String path = ""; + + private String name = ""; + private String arch1 = ""; + private String arch2 = ""; + private String newVersion1 = ""; + private String newVersion2 = ""; + private String installVersion1 = ""; + private String installVersion2 = ""; + private boolean checkColumn1 = true; + private boolean checkColumn2 = true; + private INSTALLINFO installInfo1 = INSTALLINFO.NOT_INSTALLED; + private INSTALLINFO installInfo2 = INSTALLINFO.NOT_INSTALLED; + private PKGTYPE pkgType = PKGTYPE.LOCAL; + +// private Button check1 = new Button( PackageManager.getTable(), SWT.CHECK ); +// private Button check2 = new Button( PackageManager.getTable(), SWT.CHECK ); + + public PKGTYPE getPkgType() + { + return pkgType; + } + + public void setPkgType( PKGTYPE pkgType ) + { + this.pkgType = pkgType; + } + + public void setArch1(String arch) + { + this.arch1 = arch; + } + + public String getArch1() + { + return arch1; + } + + public void setArch2(String arch) + { + this.arch2 = arch; + } + + public String getArch2() + { + return arch2; + } + + public INSTALLINFO getInstallInfo1() + { + return installInfo1; + } + + public void setInstallInfo1( INSTALLINFO installInfo ) + { + this.installInfo1 = installInfo; + } + + public INSTALLINFO getInstallInfo2() + { + return installInfo2; + } + + public void setInstallInfo2( INSTALLINFO installInfo ) + { + this.installInfo2 = installInfo; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public void setInstalledVersion1(String ver) { + this.installVersion1 = ver; + } + public String getInstalledVersion1() { + return installVersion1; + } + + public void setInstalledVersion2(String ver) { + this.installVersion2 = ver; + } + + public String getInstalledVersion2() { + return installVersion2; + } + + public void setNewVersion1(String ver) { + this.newVersion1 = ver; + } + + public String getNewVersion1() { + return newVersion1; + } + + public void setNewVersion2(String ver) { + this.newVersion2 = ver; + } + + public String getNewVersion2() { + return newVersion2; + } + + public boolean getCheckColumn1() + { + return checkColumn1; + } + + public void setCheckColumn1( boolean check ) + { + this.checkColumn1 = check; + } + + public boolean getCheckColumn2() + { + return checkColumn2; + } + + public void setCheckColumn2( boolean check ) + { + this.checkColumn2 = check; + } + +// public Button getCheck1() +// { +// return check1; +// } +// +// public Button getCheck2() +// { +// return check2; +// } +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenDebianMainWizardPage.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenDebianMainWizardPage.java new file mode 100644 index 00000000..4456de3a --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenDebianMainWizardPage.java @@ -0,0 +1,87 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.wizards; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.ui.wizards.CDTMainWizardPage; +import org.eclipse.cdt.ui.wizards.EntryDescriptor; + + +public class TizenDebianMainWizardPage extends CDTMainWizardPage { + + public TizenDebianMainWizardPage(String pageName) { + super(pageName); + // TODO Auto-generated constructor stub + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public List filterItems(List items) { + List<Object> result = new ArrayList<Object>(); + + for(Object item:items) { + if(item instanceof EntryDescriptor) { + EntryDescriptor e = (EntryDescriptor)item; + + // 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")) ) { + result.add(item); + } + + // Deprecated project type + //if(e.getId().equals("com.samsung.slp.buildArtefactType.custom.debian") || + // (e.getParentId() != null && e.getParentId().equals("com.samsung.slp.buildArtefactType.custom.debian") ) ) { + // result.add(item); + //} + } + + } + return result; + } + + @Override + protected boolean validatePage() { + // TODO Auto-generated method stub + boolean result = super.validatePage(); + + if(result == true && super.getMessage() != null) { + if (super.getMessage().equals("Directory with specified name already exists.")) { + super.setMessage(null); + } + } + + return result; + } +} diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenDebianProjectWizard.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenDebianProjectWizard.java new file mode 100644 index 00000000..4e6c6e2f --- /dev/null +++ b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/wizards/TizenDebianProjectWizard.java @@ -0,0 +1,96 @@ +/* +* Inhouse +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Taejun Ha <taejun.ha@samsung.com> +* Jiil Hyoun <jiil.hyoun@samsung.com> +* Donghyuk Yang <donghyuk.yang@samsung.com> +* Hoon Kang <h245.kang@samsung.com> +* DongHee Yang <donghee.yang@samsung.com> +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ +package org.tizen.nativeplatform.wizards; + +import org.eclipse.cdt.core.CCProjectNature; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.CProjectNature; +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +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$ +// WizardConstants.isDebian = true; + } + + @Override + public String[] getNatures() { + return new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID }; + } + + @Override + protected IProject continueCreation(IProject prj) { + if (continueCreationMonitor == null) { + continueCreationMonitor = new NullProgressMonitor(); + } + + try { + 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) {} + finally {continueCreationMonitor.done();} + return prj; + } + + @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"); + addPage(fMainPage); + } + + @Override + public String[] getContentTypeIDs() { + return new String[] { CCorePlugin.CONTENT_TYPE_CXXSOURCE, CCorePlugin.CONTENT_TYPE_CXXHEADER }; + } + + @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 ); + + return prj; + } + +} diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/EmptyProject/.buildproperties.xml b/org.tizen.nativeplatform/templates/CustomDebianPackages/EmptyProject/.buildproperties.xml new file mode 100644 index 00000000..2dc1f3f7 --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/EmptyProject/.buildproperties.xml @@ -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/CustomDebianPackages/EmptyProject/template.properties b/org.tizen.nativeplatform/templates/CustomDebianPackages/EmptyProject/template.properties new file mode 100644 index 00000000..7afbfe8f --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/EmptyProject/template.properties @@ -0,0 +1,19 @@ +EmptyProject.Ctemplate.label=Empty Debian Project +EmptyProject.Ctemplate.description=Empty Debian Project +EmptyProject.basics.label=Advanced Settings +EmptyProject.basics.description=Advanced properties of a project +EmptyProject.author.label=Author +EmptyProject.author.description=Name of the author +EmptyProject.author.default=Author +EmptyProject.copyright.label=Copyright +EmptyProject.copyright.description=Your copyright notice +EmptyProject.copyright.default=Your copyright notice +EmptyProject.vendor.label=Vendor +EmptyProject.vendor.default=samsung +EmptyProject.vendor.description=Enter your company or organization. +EmptyProject.description.default=Empty Project +EmptyProject.description.description=Enter a description about your application. +EmptyProject.description.label=Description +EmptyProject.e-mail.default=E-mail +EmptyProject.e-mail.description=Enter your email address +EmptyProject.e-mail.label=E-mail diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/EmptyProject/template.xml b/org.tizen.nativeplatform/templates/CustomDebianPackages/EmptyProject/template.xml new file mode 100644 index 00000000..e91a503e --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/EmptyProject/template.xml @@ -0,0 +1,55 @@ +<?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="EmptyProject" label="%EmptyProject.Ctemplate.label" description="%EmptyProject.Ctemplate.description" + help="help.html"> + <property-group id="basics" label="%EmptyProject.basics.label" description="%EmptyProject.basics.description" type="PAGES-ONLY" help="help.html"> + <property id="author" + label="%EmptyProject.author.label" + description="%EmptyProject.author.description" + type="input" + pattern=".*" + default="%EmptyProject.author.default" + hidden="false" + persist="false"/> + <property id="copyright" + label="%EmptyProject.copyright.label" + description="%EmptyProject.copyright.description" + type="input" + pattern=".*" + default="%EmptyProject.copyright.default" + hidden="false" + persist="false"/> + <property id="description" + label="%EmptyProject.description.label" + description="%EmptyProject.description.description" + type="input" + pattern=".*" + default="%EmptyProject.description.default" + hidden="false" + persist="false"/> + <property id="vendor" + label="%EmptyProject.vendor.label" + description="%EmptyProject.vendor.description" + type="input" + pattern=".*" + default="%EmptyProject.vendor.default" + hidden="false" + persist="false"/> + <property id="e-mail" + label="%EmptyProject.e-mail.label" + description="%EmptyProject.e-mail.description" + type="input" + pattern=".*" + default="%EmptyProject.e-mail.default" + hidden="false" + persist="false"/> + </property-group> + + + <process type="org.tizen.nativecommon.SetSBITarget"> + <simple name="projectName" value="$(projectName)"/> + </process> + + +</template> diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/.buildproperties.xml b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/.buildproperties.xml new file mode 100644 index 00000000..2dc1f3f7 --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/.buildproperties.xml @@ -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/CustomDebianPackages/HelloWorldProject/Makefile b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/Makefile new file mode 100644 index 00000000..f1ce8207 --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/Makefile @@ -0,0 +1,30 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(CMAKE_VERBOSE_MAKEFILE "ON") +SET(LIB_DIR "${CMAKE_SOURCE_DIR}/lib") +SET(RESOURCE_DIR "${CMAKE_SOURCE_DIR}/res") +SET(DATA_DIR "${CMAKE_SOURCE_DIR}/data") +SET(DEBIAN_DIR "${CMAKE_SOURCE_DIR}/debian") + +INCLUDE(${CDT_CONFIG_DIR}/CMakeLists.target) + +# FIND ALL SOURCE IN A SOURCE DIRECTORY + + +# INSTALL +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) +INSTALL(DIRECTORY ${RESOURCE_DIR}/images DESTINATION res) +INSTALL(DIRECTORY ${RESOURCE_DIR}/etc DESTINATION res) +INSTALL(DIRECTORY ${RESOURCE_DIR}/icons DESTINATION res) +INSTALL(DIRECTORY ${LIB_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}) +INSTALL(DIRECTORY ${DATA_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}) + +# INSTALL DESKTOP FILE +INSTALL(FILES ${DEBIAN_DIR}/desktop DESTINATION /opt/share/applications RENAME ${PACKAGE_NAME}.desktop) + +# INCLUDE FOR BUILD & INSTALL .EDC FILES +ADD_SUBDIRECTORY(res/edje) + +# INCLUDE FOR BUILD & INSTALL .PO FILES +ADD_SUBDIRECTORY(res/locale) + diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/changelog b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/changelog new file mode 100644 index 00000000..8db3a56c --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/changelog @@ -0,0 +1,5 @@ +com.samsung.hello (1.0.0) unstable; urgency=low + + * Initial Release + + -- Author <E-mail> Fri, 22 Jul 2011 17:32:27 +0900
\ No newline at end of file diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/com.samsung.hello.install b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/com.samsung.hello.install new file mode 100644 index 00000000..0b11bef6 --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/com.samsung.hello.install @@ -0,0 +1 @@ +/usr/bin
\ No newline at end of file diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/compat b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/compat new file mode 100644 index 00000000..7813681f --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/compat @@ -0,0 +1 @@ +5
\ No newline at end of file diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/control b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/control new file mode 100644 index 00000000..05ebaa0d --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/control @@ -0,0 +1,13 @@ +################################################################################# +# 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 + +Package: com.samsung.hello +description: none +Architecture: any +XB-Permission: +XB-RequiredHardware: diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/rules b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/rules new file mode 100644 index 00000000..88e033a1 --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/debian/rules @@ -0,0 +1,74 @@ +#!/usr/bin/make -f + +CC?=gcc +CFLAGS?= +LDFLAGS?= + +PKGDIR = debian/PKG + +configure: configure-stamp +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 + touch build-stamp + +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_installdirs + # Add here commands to install the package. + mkdir -p debian/tmp/usr/bin + cp bin/hello debian/tmp/usr/bin/ + +# Build architecture-independent files here. +binary-indep: build install + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb +# dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure
\ No newline at end of file diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/src/hello.c b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/src/hello.c new file mode 100644 index 00000000..5467927a --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/src/hello.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int main(int argc, char *argv[]) +{ + printf("Hello World!"); + return 0; +} + diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/template.properties b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/template.properties new file mode 100644 index 00000000..d47d18a1 --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/template.properties @@ -0,0 +1,19 @@ +HelloWorldProject.Ctemplate.label=Hello World Project +HelloWorldProject.Ctemplate.description=Hello World Project +HelloWorldProject.basics.label=Advanced Settings +HelloWorldProject.basics.description=Advanced properties of a project +HelloWorldProject.author.label=Author +HelloWorldProject.author.description=Name of the author +HelloWorldProject.author.default=Author +HelloWorldProject.copyright.label=Copyright +HelloWorldProject.copyright.description=Your copyright notice +HelloWorldProject.copyright.default=Your copyright notice +HelloWorldProject.vendor.label=Vendor +HelloWorldProject.vendor.default=samsung +HelloWorldProject.vendor.description=Enter your company or organization. +HelloWorldProject.description.default=Hello World Project +HelloWorldProject.description.description=Enter a description about your application. +HelloWorldProject.description.label=Description +HelloWorldProject.e-mail.default=E-mail +HelloWorldProject.e-mail.description=Enter your email address +HelloWorldProject.e-mail.label=E-mail diff --git a/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/template.xml b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/template.xml new file mode 100644 index 00000000..8e42f4ce --- /dev/null +++ b/org.tizen.nativeplatform/templates/CustomDebianPackages/HelloWorldProject/template.xml @@ -0,0 +1,95 @@ +<?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> + + <process type="org.tizen.nativecommon.SetSBITarget"> + <simple name="projectName" value="$(projectName)"/> + </process> + + +</template> diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/EmptyProject/.buildproperties.xml b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/EmptyProject/.buildproperties.xml new file mode 100644 index 00000000..2dc1f3f7 --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/EmptyProject/.buildproperties.xml @@ -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/EmptyProject/template.properties b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/EmptyProject/template.properties new file mode 100644 index 00000000..7afbfe8f --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/EmptyProject/template.properties @@ -0,0 +1,19 @@ +EmptyProject.Ctemplate.label=Empty Debian Project +EmptyProject.Ctemplate.description=Empty Debian Project +EmptyProject.basics.label=Advanced Settings +EmptyProject.basics.description=Advanced properties of a project +EmptyProject.author.label=Author +EmptyProject.author.description=Name of the author +EmptyProject.author.default=Author +EmptyProject.copyright.label=Copyright +EmptyProject.copyright.description=Your copyright notice +EmptyProject.copyright.default=Your copyright notice +EmptyProject.vendor.label=Vendor +EmptyProject.vendor.default=samsung +EmptyProject.vendor.description=Enter your company or organization. +EmptyProject.description.default=Empty Project +EmptyProject.description.description=Enter a description about your application. +EmptyProject.description.label=Description +EmptyProject.e-mail.default=E-mail +EmptyProject.e-mail.description=Enter your email address +EmptyProject.e-mail.label=E-mail diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/EmptyProject/template.xml b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/EmptyProject/template.xml new file mode 100644 index 00000000..e91a503e --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/EmptyProject/template.xml @@ -0,0 +1,55 @@ +<?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="EmptyProject" label="%EmptyProject.Ctemplate.label" description="%EmptyProject.Ctemplate.description" + help="help.html"> + <property-group id="basics" label="%EmptyProject.basics.label" description="%EmptyProject.basics.description" type="PAGES-ONLY" help="help.html"> + <property id="author" + label="%EmptyProject.author.label" + description="%EmptyProject.author.description" + type="input" + pattern=".*" + default="%EmptyProject.author.default" + hidden="false" + persist="false"/> + <property id="copyright" + label="%EmptyProject.copyright.label" + description="%EmptyProject.copyright.description" + type="input" + pattern=".*" + default="%EmptyProject.copyright.default" + hidden="false" + persist="false"/> + <property id="description" + label="%EmptyProject.description.label" + description="%EmptyProject.description.description" + type="input" + pattern=".*" + default="%EmptyProject.description.default" + hidden="false" + persist="false"/> + <property id="vendor" + label="%EmptyProject.vendor.label" + description="%EmptyProject.vendor.description" + type="input" + pattern=".*" + default="%EmptyProject.vendor.default" + hidden="false" + persist="false"/> + <property id="e-mail" + label="%EmptyProject.e-mail.label" + description="%EmptyProject.e-mail.description" + type="input" + pattern=".*" + default="%EmptyProject.e-mail.default" + hidden="false" + persist="false"/> + </property-group> + + + <process type="org.tizen.nativecommon.SetSBITarget"> + <simple name="projectName" value="$(projectName)"/> + </process> + + +</template> diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/.buildproperties.xml b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/.buildproperties.xml new file mode 100644 index 00000000..2dc1f3f7 --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/.buildproperties.xml @@ -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/HelloWorldProject/Makefile b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/Makefile new file mode 100644 index 00000000..f1ce8207 --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/Makefile @@ -0,0 +1,30 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(CMAKE_VERBOSE_MAKEFILE "ON") +SET(LIB_DIR "${CMAKE_SOURCE_DIR}/lib") +SET(RESOURCE_DIR "${CMAKE_SOURCE_DIR}/res") +SET(DATA_DIR "${CMAKE_SOURCE_DIR}/data") +SET(DEBIAN_DIR "${CMAKE_SOURCE_DIR}/debian") + +INCLUDE(${CDT_CONFIG_DIR}/CMakeLists.target) + +# FIND ALL SOURCE IN A SOURCE DIRECTORY + + +# INSTALL +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) +INSTALL(DIRECTORY ${RESOURCE_DIR}/images DESTINATION res) +INSTALL(DIRECTORY ${RESOURCE_DIR}/etc DESTINATION res) +INSTALL(DIRECTORY ${RESOURCE_DIR}/icons DESTINATION res) +INSTALL(DIRECTORY ${LIB_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}) +INSTALL(DIRECTORY ${DATA_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}) + +# INSTALL DESKTOP FILE +INSTALL(FILES ${DEBIAN_DIR}/desktop DESTINATION /opt/share/applications RENAME ${PACKAGE_NAME}.desktop) + +# INCLUDE FOR BUILD & INSTALL .EDC FILES +ADD_SUBDIRECTORY(res/edje) + +# INCLUDE FOR BUILD & INSTALL .PO FILES +ADD_SUBDIRECTORY(res/locale) + diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/changelog b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/changelog new file mode 100644 index 00000000..8db3a56c --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/changelog @@ -0,0 +1,5 @@ +com.samsung.hello (1.0.0) unstable; urgency=low + + * Initial Release + + -- Author <E-mail> Fri, 22 Jul 2011 17:32:27 +0900
\ No newline at end of file diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/com.samsung.hello.install b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/com.samsung.hello.install new file mode 100644 index 00000000..0b11bef6 --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/com.samsung.hello.install @@ -0,0 +1 @@ +/usr/bin
\ No newline at end of file diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/compat b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/compat new file mode 100644 index 00000000..7813681f --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/compat @@ -0,0 +1 @@ +5
\ No newline at end of file diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/control b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/control new file mode 100644 index 00000000..05ebaa0d --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/control @@ -0,0 +1,13 @@ +################################################################################# +# 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 + +Package: com.samsung.hello +description: none +Architecture: any +XB-Permission: +XB-RequiredHardware: diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/rules b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/rules new file mode 100644 index 00000000..88e033a1 --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/debian/rules @@ -0,0 +1,74 @@ +#!/usr/bin/make -f + +CC?=gcc +CFLAGS?= +LDFLAGS?= + +PKGDIR = debian/PKG + +configure: configure-stamp +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 + touch build-stamp + +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_installdirs + # Add here commands to install the package. + mkdir -p debian/tmp/usr/bin + cp bin/hello debian/tmp/usr/bin/ + +# Build architecture-independent files here. +binary-indep: build install + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb +# dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure
\ No newline at end of file diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/src/hello.c b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/src/hello.c new file mode 100644 index 00000000..5467927a --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/src/hello.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int main(int argc, char *argv[]) +{ + printf("Hello World!"); + return 0; +} + diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/template.properties b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/template.properties new file mode 100644 index 00000000..d47d18a1 --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/template.properties @@ -0,0 +1,19 @@ +HelloWorldProject.Ctemplate.label=Hello World Project +HelloWorldProject.Ctemplate.description=Hello World Project +HelloWorldProject.basics.label=Advanced Settings +HelloWorldProject.basics.description=Advanced properties of a project +HelloWorldProject.author.label=Author +HelloWorldProject.author.description=Name of the author +HelloWorldProject.author.default=Author +HelloWorldProject.copyright.label=Copyright +HelloWorldProject.copyright.description=Your copyright notice +HelloWorldProject.copyright.default=Your copyright notice +HelloWorldProject.vendor.label=Vendor +HelloWorldProject.vendor.default=samsung +HelloWorldProject.vendor.description=Enter your company or organization. +HelloWorldProject.description.default=Hello World Project +HelloWorldProject.description.description=Enter a description about your application. +HelloWorldProject.description.label=Description +HelloWorldProject.e-mail.default=E-mail +HelloWorldProject.e-mail.description=Enter your email address +HelloWorldProject.e-mail.label=E-mail diff --git a/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/template.xml b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/template.xml new file mode 100644 index 00000000..8e42f4ce --- /dev/null +++ b/org.tizen.nativeplatform/templates/InhouseFrameworkPackages/HelloWorldProject/template.xml @@ -0,0 +1,95 @@ +<?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> + + <process type="org.tizen.nativecommon.SetSBITarget"> + <simple name="projectName" value="$(projectName)"/> + </process> + + +</template> |