summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSungho Park <chywoo.park@samsung.com>2012-02-27 21:19:38 +0900
committerSungho Park <chywoo.park@samsung.com>2012-02-27 21:19:38 +0900
commitcfbb72d16bcace565c28948592ef0017c825bafc (patch)
tree3e04343ffbf4e10c6ef0c3db6b72109b5cfb02a9
downloadcommon-eplugin-cfbb72d16bcace565c28948592ef0017c825bafc.tar.gz
common-eplugin-cfbb72d16bcace565c28948592ef0017c825bafc.tar.bz2
common-eplugin-cfbb72d16bcace565c28948592ef0017c825bafc.zip
Initialize
-rw-r--r--AUTHORS7
-rw-r--r--LICENSE207
-rw-r--r--LICENSE-2.0.htm388
-rw-r--r--NOTICE1
-rw-r--r--builder/build.properties.clean260
-rw-r--r--builder/customTargets.xml187
-rw-r--r--org.tizen.common.connection/.classpath7
-rw-r--r--org.tizen.common.connection/.project34
-rw-r--r--org.tizen.common.connection/META-INF/MANIFEST.MF22
-rw-r--r--org.tizen.common.connection/about.html26
-rw-r--r--org.tizen.common.connection/about_files/LICENSE-2.0.htm191
-rw-r--r--org.tizen.common.connection/build.properties10
-rw-r--r--org.tizen.common.connection/icons/Connection Explorer.gifbin0 -> 1035 bytes
-rw-r--r--org.tizen.common.connection/icons/Emulator_start.gifbin0 -> 614 bytes
-rw-r--r--org.tizen.common.connection/icons/Emulator_stop.gifbin0 -> 1023 bytes
-rw-r--r--org.tizen.common.connection/icons/device.gifbin0 -> 568 bytes
-rw-r--r--org.tizen.common.connection/icons/directory.gifbin0 -> 215 bytes
-rw-r--r--org.tizen.common.connection/icons/directory_link.gifbin0 -> 362 bytes
-rw-r--r--org.tizen.common.connection/icons/emulator.gifbin0 -> 565 bytes
-rw-r--r--org.tizen.common.connection/icons/file.gifbin0 -> 344 bytes
-rw-r--r--org.tizen.common.connection/icons/file_link.gifbin0 -> 576 bytes
-rw-r--r--org.tizen.common.connection/icons/file_other.gifbin0 -> 354 bytes
-rw-r--r--org.tizen.common.connection/icons/info.gifbin0 -> 585 bytes
-rw-r--r--org.tizen.common.connection/icons/log/Add tab.pngbin0 -> 3228 bytes
-rw-r--r--org.tizen.common.connection/icons/log/Clear Log.pngbin0 -> 3225 bytes
-rw-r--r--org.tizen.common.connection/icons/log/Edit tab.pngbin0 -> 3214 bytes
-rw-r--r--org.tizen.common.connection/icons/log/Export Log.pngbin0 -> 3236 bytes
-rw-r--r--org.tizen.common.connection/icons/log/Log View.gifbin0 -> 388 bytes
-rw-r--r--org.tizen.common.connection/icons/log/Remove tab.pngbin0 -> 3348 bytes
-rw-r--r--org.tizen.common.connection/icons/log/d.pngbin0 -> 3176 bytes
-rw-r--r--org.tizen.common.connection/icons/log/e.pngbin0 -> 3117 bytes
-rw-r--r--org.tizen.common.connection/icons/log/i.pngbin0 -> 3137 bytes
-rw-r--r--org.tizen.common.connection/icons/log/v.pngbin0 -> 3102 bytes
-rw-r--r--org.tizen.common.connection/icons/log/w.pngbin0 -> 3233 bytes
-rw-r--r--org.tizen.common.connection/icons/pull.gifbin0 -> 577 bytes
-rw-r--r--org.tizen.common.connection/icons/push.gifbin0 -> 579 bytes
-rw-r--r--org.tizen.common.connection/plugin.xml162
-rw-r--r--org.tizen.common.connection/schema/tools.exsd121
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ConnectionPlugin.java221
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/DdmUiPreferences.java79
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogUtils.java178
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/ITableFocusListener.java38
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/ImageLoader.java207
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/Panel.java49
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/PortFieldEditor.java73
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/SyncProgressMonitor.java55
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/TableHelper.java203
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/actions/ICommonAction.java42
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/actions/ToolItemAction.java68
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/console/DdmConsole.java91
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/console/IDdmConsole.java47
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/debugtools/DebugTool.java85
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java321
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.java43
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.properties8
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerContentProvider.java152
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerLabelProvider.java124
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerPanel.java1118
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/explorer/Messages.java131
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/explorer/messages.properties9
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java317
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/log/LogColors.java27
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java705
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java820
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/properties/ConnectionExplorerInfoPropertyPages.java209
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/properties/ConnectionExplorerPermissionPropertyPages.java170
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/sdblib/dnd/FileEntryDropAdapter.java132
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/sdblib/dnd/FileEntryTransfer.java104
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java409
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java230
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileContentProvider.java132
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileDialog.java329
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileImageLoader.java190
-rw-r--r--org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileLabelProvider.java138
-rw-r--r--org.tizen.common.feature/.project17
-rw-r--r--org.tizen.common.feature/LICENSE-2.0.htm191
-rw-r--r--org.tizen.common.feature/build.properties6
-rw-r--r--org.tizen.common.feature/feature.xml46
-rw-r--r--org.tizen.common.feature/license.html22
-rw-r--r--org.tizen.common.feature/rootfiles/resources/icons/tizen-sdk-ide.icobin0 -> 107078 bytes
-rw-r--r--org.tizen.common/.classpath8
-rw-r--r--org.tizen.common/.project28
-rw-r--r--org.tizen.common/META-INF/MANIFEST.MF30
-rw-r--r--org.tizen.common/OSGI-INF/l10n/bundle.properties3
-rw-r--r--org.tizen.common/about.html41
-rw-r--r--org.tizen.common/about_files/LICENSE-2.0.htm191
-rw-r--r--org.tizen.common/build.properties11
-rw-r--r--org.tizen.common/icons/connected.pngbin0 -> 2419 bytes
-rw-r--r--org.tizen.common/icons/connecting.pngbin0 -> 2547 bytes
-rw-r--r--org.tizen.common/icons/delete.pngbin0 -> 1754 bytes
-rw-r--r--org.tizen.common/icons/disconnected.pngbin0 -> 2195 bytes
-rw-r--r--org.tizen.common/icons/error.pngbin0 -> 1472 bytes
-rw-r--r--org.tizen.common/icons/folder.pngbin0 -> 846 bytes
-rw-r--r--org.tizen.common/icons/hint.pngbin0 -> 1921 bytes
-rw-r--r--org.tizen.common/icons/info.pngbin0 -> 1769 bytes
-rw-r--r--org.tizen.common/icons/library.pngbin0 -> 1856 bytes
-rw-r--r--org.tizen.common/icons/ok.pngbin0 -> 1577 bytes
-rw-r--r--org.tizen.common/icons/printer.pngbin0 -> 1215 bytes
-rw-r--r--org.tizen.common/icons/star.pngbin0 -> 1654 bytes
-rw-r--r--org.tizen.common/icons/terminated.pngbin0 -> 1771 bytes
-rw-r--r--org.tizen.common/icons/warn.pngbin0 -> 2236 bytes
-rw-r--r--org.tizen.common/icons/warn2.pngbin0 -> 1447 bytes
-rw-r--r--org.tizen.common/plugin.xml335
-rw-r--r--org.tizen.common/sdblib.jarbin0 -> 65586 bytes
-rw-r--r--org.tizen.common/src/org/tizen/common/CommonPlugin.java122
-rw-r--r--org.tizen.common/src/org/tizen/common/cache/ColorCache.java106
-rw-r--r--org.tizen.common/src/org/tizen/common/cache/FontCache.java206
-rw-r--r--org.tizen.common/src/org/tizen/common/cache/ImageCache.java105
-rw-r--r--org.tizen.common/src/org/tizen/common/console/AnsicodeAdapter.java225
-rw-r--r--org.tizen.common/src/org/tizen/common/console/ConsoleManager.java271
-rw-r--r--org.tizen.common/src/org/tizen/common/console/ConsoleProcessClosure.java250
-rw-r--r--org.tizen.common/src/org/tizen/common/console/TextStyle.java53
-rw-r--r--org.tizen.common/src/org/tizen/common/control/NotSupportedTypeException.java35
-rw-r--r--org.tizen.common/src/org/tizen/common/control/TableViewCellModifier.java136
-rw-r--r--org.tizen.common/src/org/tizen/common/control/TableViewColumnSorter.java160
-rw-r--r--org.tizen.common/src/org/tizen/common/control/TableViewContentProvider.java50
-rw-r--r--org.tizen.common/src/org/tizen/common/control/TableViewLabelProvider.java121
-rw-r--r--org.tizen.common/src/org/tizen/common/control/TreeViewContentProvider.java69
-rw-r--r--org.tizen.common/src/org/tizen/common/control/TreeViewLabelProvider.java32
-rw-r--r--org.tizen.common/src/org/tizen/common/handler/ClearHandler.java65
-rw-r--r--org.tizen.common/src/org/tizen/common/handler/ClipboardHandler.java51
-rw-r--r--org.tizen.common/src/org/tizen/common/handler/CopyHandler.java101
-rw-r--r--org.tizen.common/src/org/tizen/common/handler/Messages.java49
-rw-r--r--org.tizen.common/src/org/tizen/common/handler/OpenFileHandler.java103
-rw-r--r--org.tizen.common/src/org/tizen/common/handler/OpenPreferencesHandler.java61
-rw-r--r--org.tizen.common/src/org/tizen/common/handler/SaveFileHandler.java139
-rw-r--r--org.tizen.common/src/org/tizen/common/handler/messages.properties10
-rw-r--r--org.tizen.common/src/org/tizen/common/log/Logger.java99
-rw-r--r--org.tizen.common/src/org/tizen/common/manager/ColorCache.java88
-rw-r--r--org.tizen.common/src/org/tizen/common/manager/Messages.java40
-rw-r--r--org.tizen.common/src/org/tizen/common/manager/StatusLineMessageManager.java47
-rw-r--r--org.tizen.common/src/org/tizen/common/manager/messages.properties1
-rw-r--r--org.tizen.common/src/org/tizen/common/model/AbstractTableModel.java180
-rw-r--r--org.tizen.common/src/org/tizen/common/model/AbstractTableVO.java80
-rw-r--r--org.tizen.common/src/org/tizen/common/model/AbstractTreeModel.java102
-rw-r--r--org.tizen.common/src/org/tizen/common/model/AbstractTreeVO.java109
-rw-r--r--org.tizen.common/src/org/tizen/common/model/DefaultTableModel.java43
-rw-r--r--org.tizen.common/src/org/tizen/common/model/DefaultTreeModel.java44
-rw-r--r--org.tizen.common/src/org/tizen/common/model/ITableModel.java45
-rw-r--r--org.tizen.common/src/org/tizen/common/model/ITableVO.java35
-rw-r--r--org.tizen.common/src/org/tizen/common/model/ITreeModel.java42
-rw-r--r--org.tizen.common/src/org/tizen/common/model/ITreeVO.java42
-rw-r--r--org.tizen.common/src/org/tizen/common/model/IVO.java29
-rw-r--r--org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.java47
-rw-r--r--org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.properties6
-rw-r--r--org.tizen.common/src/org/tizen/common/preferences/TizenBasePreferencePage.java125
-rw-r--r--org.tizen.common/src/org/tizen/common/properties/InstallPathConfig.java137
-rw-r--r--org.tizen.common/src/org/tizen/common/queue/Queue.java71
-rw-r--r--org.tizen.common/src/org/tizen/common/swt/ClosableTray.java172
-rw-r--r--org.tizen.common/src/org/tizen/common/swt/PictureLabel.java206
-rw-r--r--org.tizen.common/src/org/tizen/common/swt/TrayWizardPage.java108
-rw-r--r--org.tizen.common/src/org/tizen/common/util/BrowserWrapper.java76
-rw-r--r--org.tizen.common/src/org/tizen/common/util/ControlFileConfig.java87
-rw-r--r--org.tizen.common/src/org/tizen/common/util/DialogUtil.java120
-rw-r--r--org.tizen.common/src/org/tizen/common/util/FileUtil.java187
-rw-r--r--org.tizen.common/src/org/tizen/common/util/HostUtil.java330
-rw-r--r--org.tizen.common/src/org/tizen/common/util/IOUtil.java48
-rw-r--r--org.tizen.common/src/org/tizen/common/util/ImageUtils.java82
-rw-r--r--org.tizen.common/src/org/tizen/common/util/LocalPortChecker.java82
-rw-r--r--org.tizen.common/src/org/tizen/common/util/NotificationType.java56
-rw-r--r--org.tizen.common/src/org/tizen/common/util/NotifierDialog.java316
-rw-r--r--org.tizen.common/src/org/tizen/common/util/OSChecker.java160
-rw-r--r--org.tizen.common/src/org/tizen/common/util/OpenBrowserUtil.java101
-rw-r--r--org.tizen.common/src/org/tizen/common/util/ProcessMonitorThread.java82
-rw-r--r--org.tizen.common/src/org/tizen/common/util/PropertyUtil.java114
-rw-r--r--org.tizen.common/src/org/tizen/common/util/SWTUtil.java203
-rw-r--r--org.tizen.common/src/org/tizen/common/util/ShellParser.java80
-rw-r--r--org.tizen.common/src/org/tizen/common/util/StreamGobbler.java75
-rw-r--r--org.tizen.common/src/org/tizen/common/util/StringUtil.java128
-rw-r--r--org.tizen.common/src/org/tizen/common/util/UpdateManager.java146
-rw-r--r--org.tizen.common/src/org/tizen/common/util/ViewUtil.java108
-rwxr-xr-xpackage/build.linux291
-rw-r--r--package/pkginfo.manifest19
173 files changed, 17115 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 000000000..a2e37efce
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,7 @@
+Hoon Kang <h245.kang@samsung.com>
+Namkoong Ho <ho.namkoong@samsung.com>
+Yongsung Kim <yongsung1.kim@samsung.com>
+Joogwan Kim <joogwan.kim@samsung.com>
+YoonKi Park <yoonki.park@samsung.com>
+Hyunsik.noh <hyunsik.noh@samsung.com>
+HyunGoo Kang <hyungoo1.kang@samsung.com>
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000000000..e2ca7a92c
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,207 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
+
diff --git a/LICENSE-2.0.htm b/LICENSE-2.0.htm
new file mode 100644
index 000000000..e52d995cf
--- /dev/null
+++ b/LICENSE-2.0.htm
@@ -0,0 +1,388 @@
+<!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 &quot;License&quot;); 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 &quot;AS IS&quot; 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">
+ <img src="/images/feather-small.gif" alt="The Apache Software Foundation">
+ <h1>The Apache Software Foundation</h1>
+ <h2>Apache License, Version 2.0</h2>
+ </div>
+ <div id="nav" class="grid_8">
+ <ul>
+ <!-- <li><a href="/" title="Welcome!">Home</a></li> -->
+ <li><a href="/foundation/" title="The Foundation">Foundation</a></li>
+ <li><a href="http://projects.apache.org" title="The Projects">Projects</a></li>
+ <li><a href="http://people.apache.org" title="The People">People</a></li>
+ <li><a href="/foundation/getinvolved.html" title="Get Involved">Get Involved</a></li>
+ <li><a href="/dyn/closer.cgi" title="Download">Download</a></li>
+ <li><a href="/foundation/sponsorship.html" title="Support Apache">Support Apache</a></li>
+ </ul>
+ <p><a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/licenses/">Licenses</a></p>
+ <form name="search" id="search" action="http://www.google.com/search" method="get">
+ <input value="*.apache.org" name="sitesearch" type="hidden"/>
+ <input type="text" name="q" id="query">
+ <input type="submit" id="submit" value="Search">
+ </form>
+ </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>
+<h1 id="apply">APPENDIX: How to apply the Apache License to your work</h1>
+<p>To apply the Apache License to your work, attach the following boilerplate
+notice, with the fields enclosed by brackets "[]" replaced with your own
+identifying information. (Don't include the brackets!) The text should be
+enclosed in the appropriate comment syntax for the file format. We also
+recommend that a file or class name and description of purpose be included
+on the same "printed page" as the copyright notice for easier
+identification within third-party archives.</p>
+<div class="codehilite"><pre> Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+ 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 &quot;AS IS&quot; 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.
+</pre></div></div></div>
+ <div class="clear"></div>
+ </div>
+ <div id="footer" class="container_16">
+ <div class="links grid_16">
+ <div class="grid_3">
+ <h4>Projects</h4>
+ <ul>
+<li><a href="http://httpd.apache.org/" title="Apache Web Server (httpd)">HTTP Server</a></li>
+<li><a href="http://abdera.apache.org/" title="Atom Publishing Protocol Implementation">Abdera</a></li>
+<li><a href="http://activemq.apache.org/" title="Distributed Messaging System">ActiveMQ</a></li>
+<li><a href="http://ant.apache.org/" title="Java-based build tool">Ant</a></li>
+<li><a href="http://apr.apache.org/" title="Apache Portable Runtime libraries">APR</a></li>
+<li><a href="http://archiva.apache.org/" title="Build Artifact Repository Manager">Archiva</a></li>
+<li><a href="http://aries.apache.org/" title="Enterprise OSGi application programming model">Aries</a></li>
+<li><a href="http://avro.apache.org/" title="A Serialization System">Avro</a></li>
+<li><a href="http://axis.apache.org/" title="Java SOAP Engine">Axis</a></li>
+<li><a href="http://buildr.apache.org/" title="Simple and intuitive build system for Java applications">Buildr</a></li>
+<li><a href="http://camel.apache.org/" title="Spring based Integration Framework which implements the Enterprise Integration Patterns">Camel</a></li>
+<li><a href="http://cassandra.apache.org/" title="Highly scalable second-generation distributed database">Cassandra</a></li>
+<li><a href="http://cayenne.apache.org/" title="User-friendly Java ORM with Tools">Cayenne</a></li>
+<li><a href="http://chemistry.apache.org/" title="CMIS (Content Managment Interoperability Services) Clients and Servers">Chemistry</a></li>
+<li><a href="http://click.apache.org/" title="User-friendly page and component oriented web framework">Click</a></li>
+<li><a href="http://cocoon.apache.org/" title="Web development framework: separation of concerns, component-based">Cocoon</a></li>
+<li><a href="http://commons.apache.org/" title="Reusable Java components">Commons</a></li>
+<li><a href="http://continuum.apache.org/" title="Continuous Integration and Build Server">Continuum</a></li>
+<li><a href="http://couchdb.apache.org/" title="RESTful document database">CouchDB</a></li>
+<li><a href="http://cxf.apache.org/" title="Service Framework">CXF</a></li>
+<li><a href="http://db.apache.org/" title="Database access">DB</a></li>
+<li><a href="http://deltacloud.apache.org/" title="RESTful cloud management interface">Deltacloud</a></li>
+<li><a href="http://directory.apache.org/" title="Apache Directory Server">Directory</a></li>
+<li><a href="http://esme.apache.org/" title="Enterprise Social Messaging Environment">ESME</a></li>
+<li><a href="http://felix.apache.org/" title="OSGi Framework and components.">Felix</a></li>
+<li><a href="http://forrest.apache.org/" title="Aggregated multi-channel documentation, separation of concerns">Forrest</a></li>
+<li><a href="http://geronimo.apache.org/" title="Java2, Enterprise Edition (J2EE) container">Geronimo</a></li>
+<li><a href="http://gump.apache.org/" title="Continuous integration of open source projects">Gump</a></li>
+<li><a href="http://hadoop.apache.org/" title="Distributed computing platform">Hadoop</a></li>
+<li><a href="http://hbase.apache.org/" title="Hadoop Database">HBase</a></li>
+<li><a href="http://hive.apache.org/" title="Data warehouse infrastructure using the Hadoop Database">Hive</a></li>
+<li><a href="http://hc.apache.org/" title="Java toolset of low level HTTP components">HttpComponents</a></li>
+<li><a href="http://jackrabbit.apache.org/" title="Content Repository for Java">Jackrabbit</a></li>
+<li><a href="http://jakarta.apache.org/" title="Server-side Java">Jakarta</a></li>
+<li><a href="http://james.apache.org/" title="Java Apache Mail Enterprise Server">James</a></li>
+<li><a href="http://jmeter.apache.org/" title="Java performance and functional testing">JMeter</a></li>
+<li><a href="http://juddi.apache.org/" title="Java implementation of the Universal Description, Discovery, and Integration specification">jUDDI</a></li>
+<li><a href="http://karaf.apache.org/" title="Server-side OSGi distribution">Karaf</a></li>
+<li><a href="http://lenya.apache.org/" title="Content Management System">Lenya</a></li>
+<li><a href="http://libcloud.apache.org/" title="Unified interface to the cloud">Libcloud</a></li>
+<li><a href="http://logging.apache.org/" title="Cross-language logging services">Logging</a></li>
+<li><a href="http://lucene.apache.org/" title="Search engine library">Lucene</a></li>
+<li><a href="http://mahout.apache.org/" title="Scalable machine learning library">Mahout</a></li>
+<li><a href="http://maven.apache.org/" title="Java project management and comprehension tools">Maven</a></li>
+<li><a href="http://mina.apache.org/" title="Multipurpose Infrastructure for Network Application">MINA</a></li>
+<li><a href="http://myfaces.apache.org/" title="JavaServer(tm) Faces implementation and components">MyFaces</a></li>
+<li><a href="http://nutch.apache.org/" title="Open Source Web Search Software">Nutch</a></li>
+<li><a href="http://ode.apache.org/" title="Orchestration Director Engine: Business Process Management (BPM), Process Orchestration and Workflow through service compositioni.">ODE</a></li>
+<li><a href="http://oodt.apache.org/" title="Object Oriented Data Technology (middleware metadata)">OODT</a></li>
+<li><a href="http://ofbiz.apache.org/" title="Open for Business: enterprise automation software">OFBiz</a></li>
+<li><a href="http://openejb.apache.org/" title="OpenEJB: a modular, configurable, and extendable EJB Container System and Server">OpenEJB</a></li>
+<li><a href="http://openjpa.apache.org/" title="OpenJPA: Object Relational Mapping for Java">OpenJPA</a></li>
+<li><a href="http://openwebbeans.apache.org/" title="OpenWebBeans: JSR-299 Context and Dependency Injection for Java EE Platform Implementation">OpenWebBeans</a></li>
+<li><a href="http://pdfbox.apache.org/" title="Java library for working with PDF documents">PDFBox</a></li>
+<li><a href="http://perl.apache.org/" title="Dynamic websites using Perl">Perl</a></li>
+<li><a href="http://pig.apache.org/" title="Platform for analyzing large data sets">Pig</a></li>
+<li><a href="http://pivot.apache.org/" title="Rich Internet applications in Java">Pivot</a></li>
+<li><a href="http://poi.apache.org/" title="Java API for OLE 2 Compound and OOXML Documents">POI</a></li>
+<li><a href="http://portals.apache.org/" title="Portal technology">Portals</a></li>
+<li><a href="http://qpid.apache.org/" title="Multiple language implementation of the latest Advanced Message Queuing Protocol (AMQP)">Qpid</a></li>
+<li><a href="http://river.apache.org/" title="Jini service oriented architecture">River</a></li>
+<li><a href="http://roller.apache.org/" title="Java blog server">Roller</a></li>
+<li><a href="http://santuario.apache.org/" title="XML Security in Java and C++">Santuario</a></li>
+<li><a href="http://servicemix.apache.org/" title="Enterprise Service Bus">ServiceMix</a></li>
+<li><a href="http://shindig.apache.org/" title="Opensocial Reference Implementation">Shindig</a></li>
+<li><a href="http://shiro.apache.org/" title="Powerful and easy-to-use application security framework">Shiro</a></li>
+<li><a href="http://sling.apache.org/" title="Web Framework for JCR Content Repositories">Sling</a></li>
+<li><a href="http://spamassassin.apache.org/" title="Mail filter to identify spam">SpamAssassin</a></li>
+<li><a href="http://stdcxx.apache.org/" title="Apache C++ Standard Library">STDCXX</a></li>
+<li><a href="http://struts.apache.org/" title="Model 2 framework for building Java web applications">Struts</a></li>
+<li><a href="http://subversion.apache.org/" title="Version Control">Subversion</a></li>
+<li><a href="http://synapse.apache.org/" title="Enterprise Service Bus and Mediation Framework">Synapse</a></li>
+<li><a href="http://tapestry.apache.org/" title="Component-based Java Web Application Framework">Tapestry</a></li>
+<li><a href="http://tcl.apache.org/" title="Dynamic websites using TCL">Tcl</a></li>
+<li><a href="http://thrift.apache.org/" title="Framework for scalable cross-language services development">Thrift</a></li>
+<li><a href="http://tika.apache.org" title="Content Analysis and Detection Toolkit">Tika</a></li>
+<li><a href="http://tiles.apache.org/" title="A templating framework for web application user interfaces">Tiles</a></li>
+<li><a href="http://tomcat.apache.org/" title="A Java Servlet and JSP Container">Tomcat</a></li>
+<li><a href="http://trafficserver.apache.org/" title="A fast, scalable and extensible HTTP/1.1 compliant caching proxy server">Traffic Server</a></li>
+<li><a href="http://turbine.apache.org/" title="A Java Servlet Web Application Framework and associated component library">Turbine</a></li>
+<li><a href="http://tuscany.apache.org/" title="An SCA based Service Composition Framework">Tuscany</a></li>
+<li><a href="http://uima.apache.org/" title="Framework and annotators for unstructured information analysis">UIMA</a></li>
+<li><a href="http://velocity.apache.org/" title="A Java Templating Engine">Velocity</a></li>
+<li><a href="http://ws.apache.org/">Web Services</a></li>
+<li><a href="http://whirr.apache.org/" title="Libraries for running Cloud Services">Whirr</a></li>
+<li><a href="http://wicket.apache.org/" title="Component-based Java Web Application Framework.">Wicket</a></li>
+<li><a href="http://xalan.apache.org/" title="XSLT processors in Java and C++">Xalan</a></li>
+<li><a href="http://xerces.apache.org/" title="XML parsers in Java, C++ and Perl">Xerces</a></li>
+<li><a href="http://xml.apache.org/" title="XML solutions focused on the web">XML</a></li>
+<li><a href="http://xmlbeans.apache.org/" title="XML-Java binding tool">XMLBeans</a></li>
+<li><a href="http://xmlgraphics.apache.org/" title="Conversion from XML to graphical output">XML Graphics</a></li>
+<li><a href="http://zookeeper.apache.org/" title="Centralized service for maintaining configuration information">ZooKeeper</a></li>
+</ul>
+ </div>
+ <div class="grid_3">
+ <h4>Foundation</h4>
+ <ul>
+ <li><a href="/foundation/faq.html">FAQ</a></li>
+ <li><a href="/licenses/" title="Overview of the Apache Licenese">Licenses</a></li>
+ <li><a href="/foundation/marks/" title="Apache marks policies and listing">Trademarks</a></li>
+ <li><a href="/foundation/news.html" title="Official news feed of Foundation announcements">News</a></li>
+ <li><a href="/press/" title="Press, Media, and Analyst contact">Press Inquiries</a></li>
+ <li><a href="/foundation/records/" title="Formal corporate records and board meeting minutes">Public Records</a></li>
+ <li><a href="/foundation/sponsorship.html" title="Sponsor the Foundation">Sponsorship</a></li>
+ <li><a href="/foundation/contributing.html" title="Donate to the Foundation">Donations</a></li>
+ <li><a href="/foundation/buy_stuff.html" title="Buy Apache branded merchandise">Buy Stuff</a></li>
+ <li><a href="/foundation/thanks.html" title="Thank you to our Sponsors">Thanks</a></li>
+ <li><a href="/foundation/contact.html" title="Contact Us">Contact</a></li>
+ </ul>
+ </div>
+ <div class="grid_3 suffix_1">
+ <h4>Foundation Projects</h4>
+ <ul>
+ <li><a href="http://attic.apache.org/" title="Inactive projects repository">Attic</a></li>
+ <li><a href="/foundation/conferences.html" title="Meetings of developers and users">Conferences</a></li>
+ <li><a href="http://community.apache.org/" title="Helping newcomers to the ASF">Community Development</a></li>
+ <li><a href="http://incubator.apache.org/" title="Shepherd for new projects">Incubator</a></li>
+ <li><a href="/dev/" title="ASF Infrastructure: Operations and howto documents for PMCs and contributors">Infrastructure</a></li>
+ <li><a href="/jcp/" title="Apache and the Java Community Process">JCP</a></li>
+ <li><a href="http://labs.apache.org/" title="The Innovation Laboratories of the Apache Software Foundation">Labs</a></li>
+ <li><a href="/legal/" title="Legal Affairs">Legal Affairs</a></li>
+ <li><a href="/press/" title="Public Relations">Public Relations</a></li>
+ <li><a href="/security/" title="Security">Security</a></li>
+ <li><a href="/travel/" title="Travel Assistance">Travel Assistance</a></li>
+ </ul>
+ </div>
+
+ <div class="grid_3">
+ <h4>Community</h4>
+ <ul>
+ <li><a href="http://people.apache.org/" title="Apache committer homepages">People</a></li>
+ <li><a href="/memorials/" title="In memoriam of past committers">Memorials</a></li>
+ <li><a href="http://feathercast.org/" title="Apache Podcasts">Feathercast</a></li>
+ <li><a href="http://blogs.apache.org/" title="Apache Project Blogs">Project Blogs</a></li>
+ <li><a href="http://planet.apache.org/committers/" title="Apache Committers' Blogs">PlanetApache</a></li>
+ </ul>
+ </div>
+ <div class="grid_3">
+ <h4>How It Works</h4>
+ <ul>
+ <li><a href="/foundation/how-it-works.html">Introduction</a></li>
+ <li><a href="/foundation/how-it-works.html#meritocracy">Meritocracy</a></li>
+ <li><a href="/foundation/how-it-works.html#structure">Structure</a></li>
+ <li><a href="/foundation/how-it-works.html#roles">Roles</a></li>
+ <li><a href="/foundation/how-it-works.html#management">Collaboration</a></li>
+ <li><a href="/foundation/how-it-works.html#incubator">Incubator</a></li>
+ <li><a href="/foundation/how-it-works.html#other">Other entities</a></li>
+ <li><a href="/foundation/glossary.html">Glossary</a></li>
+ <li><a href="/foundation/voting.html">Voting</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="clear"></div>
+
+ </div>
+ <div id="copyright" class="container_16">
+ <p>Copyright &#169; 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/NOTICE b/NOTICE
new file mode 100644
index 000000000..4297ee335
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
diff --git a/builder/build.properties.clean b/builder/build.properties.clean
new file mode 100644
index 000000000..b402ae463
--- /dev/null
+++ b/builder/build.properties.clean
@@ -0,0 +1,260 @@
+###############################################################################
+# Copyright (c) 2003, 2006 IBM 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
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+#####################
+# Parameters describing how and where to execute the build.
+# Typical users need only update the following properties:
+# baseLocation - where things you are building against are installed
+# bootclasspath - The base jars to compile against (typicaly rt.jar)
+# configs - the list of {os, ws, arch} configurations to build.
+#
+# Of course any of the settings here can be overridden by spec'ing
+# them on the command line (e.g., -DbaseLocation=d:/eclipse
+
+#The type of the top level element we are building, generally "feature"
+topLevelElementType=feature
+#The id of the top level element we are building
+topLevelElementId=org.tizen.common.feature
+
+############# PRODUCT/PACKAGING CONTROL #############
+#product=/com.samsung.freshide/SLPSDK.product
+#runPackager=true
+
+#Set the name of the archive that will result from the product build.
+#archiveNamePrefix=
+
+# The prefix that will be used in the generated archive.
+archivePrefix="Do not touch here."
+
+# The location underwhich all of the build output will be collected.
+collectingFolder=${archivePrefix}
+
+# The list of {os, ws, arch} configurations to build. This
+# value is a '&' separated list of ',' separate triples. For example,
+# configs=win32,win32,x86 & linux,motif,x86
+# By default the value is *,*,*
+configs="Do not touch here."
+#configs=win32, win32, x86 & \
+# win32,win32,x86_64 & \
+# win32,win32,wpf & \
+# linux, gtk, ppc & \
+# linux, gtk, x86 & \
+# linux, gtk, x86_64 & \
+# linux, motif, x86 & \
+# solaris, motif, sparc & \
+# solaris, gtk, sparc & \
+# aix, motif, ppc & \
+# hpux, motif, ia64_32 & \
+# macosx, carbon, ppc & \
+# macosx, carbon, x86 & \
+# macosx, cocoa, ppc & \
+# macosx, cocoa, x86 & \
+# macosx, cocoa, x86_64
+
+# By default PDE creates one archive (result) per entry listed in the configs property.
+# Setting this value to true will cause PDE to only create one output containing all
+# artifacts for all the platforms listed in the configs property.
+# To control the output format for the group, add a "group, group, group - <format>" entry to the
+# archivesFormat.
+#groupConfigurations=true
+
+#The format of the archive. By default a zip is created using antZip.
+#The list can only contain the configuration for which the desired format is different than zip.
+#archivesFormat=win32, win32, x86 - antZip& \
+# linux, gtk, ppc - antZip &\
+# linux, gtk, x86 - antZip& \
+# linux, gtk, x86_64 - antZip& \
+# linux, motif, x86 - antZip& \
+# solaris, motif, sparc - antZip& \
+# solaris, gtk, sparc - antZip& \
+# aix, motif, ppc - antZip& \
+# hpux, motif, PA_RISC - antZip& \
+# macosx, carbon, ppc - antZip
+
+#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles.
+allowBinaryCycles=true
+
+#Sort bundles depenedencies across all features instead of just within a given feature.
+#flattenDependencies = true
+
+#Parallel compilation, requires flattenedDependencies=true
+#parallelCompilation=true
+#parallelThreadCount=
+#parallelThreadsPerProcessor=
+
+#Set to true if you want the output to be ready for an update jar (no site.xml generated)
+#outputUpdateJars = false
+
+#Set to true for Jnlp generation
+#codebase should be a URL that will be used as the root of all relative URLs in the output.
+#generateJnlp=false
+#jnlp.codebase=<codebase url>
+#jnlp.j2se=<j2se version>
+#jnlp.locale=<a locale>
+#jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features
+#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built
+
+#Set to true if you want to sign jars
+#signJars=false
+#sign.alias=<alias>
+#sign.keystore=<keystore location>
+#sign.storepass=<keystore password>
+#sign.keypass=<key password>
+
+#Arguments to send to the zip executable
+#zipargs=
+
+#Arguments to send to the tar executable
+#tarargs=
+
+#Control the creation of a file containing the version included in each configuration - on by default
+#generateVersionsLists=false
+
+############## BUILD NAMING CONTROL ################
+# The directory into which the build elements are fetched and where
+# the build takes place.
+buildDirectory="Do not touch here"
+
+# Type of build. Used in naming the build output. Typically this value is
+# one of I, N, M, S, ...
+buildType="Do not touch here"
+
+# ID of the build. Used in naming the build output.
+buildId="Do not touch here"
+
+# Label for the build. Used in naming the build output
+buildLabel=${buildType}.${buildId}
+
+# Timestamp for the build. Used in naming the build output
+timestamp=007
+
+#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde.
+#The value will only be applied to plugin or features indicating build.properties, qualifier = context
+#forceContextQualifier=<the value for the qualifier>
+
+#Enable / disable the generation of a suffix for the features that use .qualifier.
+#The generated suffix is computed according to the content of the feature
+#generateFeatureVersionSuffix=true
+
+############# BASE CONTROL #############
+# Settings for the base Eclipse components and Java class libraries
+# against which you are building.
+# Base location for anything the build needs to compile against. For example,
+# in most RCP app or a plug-in, the baseLocation should be the location of a previously
+# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack.
+
+base="Do not touch here"
+baseLocation="Do not touch here"
+
+
+#Folder containing repositories whose content is needed to compile against
+#repoBaseLocation=${base}/repos
+#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against
+#transformedRepoLocation=${base}/transformedRepos
+
+#Os/Ws/Arch/nl of the eclipse specified by baseLocation
+baseos=linux
+basews=gtk
+basearch=x86
+
+#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built
+filteredDependencyCheck=false
+
+#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons)
+resolution.devMode=false
+
+#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :)
+#a location is one of:
+#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo
+#- a directory that contains a /plugins or /features subdirectory
+#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml
+#pluginPath=
+
+skipBase=true
+eclipseURL=<url for eclipse download site>
+eclipseBuildId=<Id of Eclipse build to get>
+eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip
+
+
+############# MAP FILE CONTROL ################
+# This section defines CVS tags to use when fetching the map files from the repository.
+# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml
+
+skipMaps=true
+mapsRepo=:pserver:anonymous@example.com/path/to/repo
+mapsRoot=path/to/maps
+mapsCheckoutTag=HEAD
+
+#tagMaps=true
+mapsTagTag=v${buildId}
+
+
+############ REPOSITORY CONTROL ###############
+# This section defines properties parameterizing the repositories where plugins, fragments
+# bundles and features are being obtained from.
+
+# The tags to use when fetching elements to build.
+# By default thebuilder will use whatever is in the maps.
+# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the
+# overriding value
+# For example fetchTag=CVS=HEAD, SVN=v20050101
+# fetchTag=HEAD
+skipFetch=true
+
+
+############# P2 OPTIONS ##############
+#p2.gathering = true
+#p2.compress=true
+
+############# JAVA COMPILER OPTIONS ##############
+# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE
+#bootclasspath=${java.home}/lib/rt.jar
+
+# specific JRE locations to compile against. These values are used to compile bundles specifying a
+# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support
+#CDC-1.0/Foundation-1.0= /path/to/rt.jar
+#CDC-1.1/Foundation-1.1=
+#OSGi/Minimum-1.0=
+#OSGi/Minimum-1.1=
+#JRE-1.1=
+#J2SE-1.2=
+#J2SE-1.3=
+#J2SE-1.4=
+#J2SE-1.5=
+#JavaSE-1.6=
+#PersonalJava-1.1=
+#PersonalJava-1.2=
+#CDC-1.0/PersonalBasis-1.0=
+#CDC-1.0/PersonalJava-1.0=
+#CDC-1.1/PersonalBasis-1.1=
+#CDC-1.1/PersonalJava-1.1=
+
+# Specify the output format of the compiler log when eclipse jdt is used
+logExtension=.log
+
+# Whether or not to include debug info in the output jars
+javacDebugInfo=true
+
+# Whether or not to fail the build if there are compiler errors
+javacFailOnError=true
+
+# Enable or disable verbose mode of the compiler
+javacVerbose=false
+
+# Extra arguments for the compiler. These are specific to the java compiler being used.
+#compilerArg=
+
+# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties
+javacSource=1.6
+
+# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties.
+javacTarget=1.6
+
+
diff --git a/builder/customTargets.xml b/builder/customTargets.xml
new file mode 100644
index 000000000..6a42e92a0
--- /dev/null
+++ b/builder/customTargets.xml
@@ -0,0 +1,187 @@
+<project name="Build specific targets and properties" default="noDefault">
+
+ <!-- ===================================================================== -->
+ <!-- Run a given ${target} on all elements being built -->
+ <!-- Add on <ant> task for each top level element being built. -->
+ <!-- ===================================================================== -->
+ <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/>
+ <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
+
+ <import file="${allElementsFile}" />
+ <target name="allElements">
+ <ant antfile="${genericTargets}" target="${target}">
+ <property name="type" value="${topLevelElementType}"/>
+ <property name="id" value="${topLevelElementId}"/>
+ </ant>
+ </target>
+
+ <target
+ name="assemble.${topLevelElementId}.linux.gtk.x86">
+ <ant antfile="{$assembleScriptName}" dir="${buildDirectory}"/>
+ </target>
+ <target
+ name="assemble.${topLevelElementId}.win32.win32.x86">
+ <ant antfile="{$assembleScriptName}" dir="${buildDirectory}"/>
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- ===================================================================== -->
+ <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
+ <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
+ <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
+ </target>
+
+ <target name="checkLocalBase">
+ <available file="${base}" property="skipBase" />
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Check out map files from correct repository -->
+ <!-- Replace values for mapsCheckoutTag as desired. -->
+ <!-- ===================================================================== -->
+ <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
+ <property name="mapsCheckoutTag" value="HEAD" />
+ <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" />
+ </target>
+
+ <target name="checkLocalMaps">
+ <available property="skipMaps" file="${buildDirectory}/maps" />
+ </target>
+
+ <target name="tagMapFiles" if="tagMaps">
+ <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" />
+ </target>
+
+ <!-- ===================================================================== -->
+
+ <target name="clean" unless="noclean">
+ <antcall target="allElements">
+ <param name="target" value="cleanElement" />
+ </antcall>
+ </target>
+
+ <target name="gatherLogs">
+ <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
+ <antcall target="allElements">
+ <param name="target" value="gatherLogs" />
+ </antcall>
+ <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
+ <fileset dir="${buildDirectory}/features">
+ <include name="**/*.log.zip" />
+ </fileset>
+ </unzip>
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before setup -->
+ <!-- ===================================================================== -->
+ <target name="preSetup">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after setup but before starting the build proper -->
+ <!-- ===================================================================== -->
+ <target name="postSetup">
+ <antcall target="getBaseComponents" />
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before fetching the build elements -->
+ <!-- ===================================================================== -->
+ <target name="preFetch">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after fetching the build elements -->
+ <!-- ===================================================================== -->
+ <target name="postFetch">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before the repositories are being processed -->
+ <!-- ===================================================================== -->
+ <target name="preProcessRepos">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after the repositories have been processed -->
+ <!-- ===================================================================== -->
+ <target name="postProcessRepos">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before generating the build scripts. -->
+ <!-- ===================================================================== -->
+ <target name="preGenerate">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after generating the build scripts. -->
+ <!-- ===================================================================== -->
+ <target name="postGenerate">
+ <antcall target="clean" />
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before running the build.xmls for the elements being built. -->
+ <!-- ===================================================================== -->
+ <target name="preProcess">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after running the build.xmls for the elements being built. -->
+ <!-- ===================================================================== -->
+ <target name="postProcess">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before running assemble. -->
+ <!-- ===================================================================== -->
+ <target name="preAssemble">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after running assemble. -->
+ <!-- ===================================================================== -->
+ <target name="postAssemble">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do before running package. -->
+ <!-- ===================================================================== -->
+ <target name="prePackage">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after running package. -->
+ <!-- ===================================================================== -->
+ <target name="postPackage">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do after the build is done. -->
+ <!-- ===================================================================== -->
+ <target name="postBuild">
+ <antcall target="gatherLogs" />
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do to test the build results -->
+ <!-- ===================================================================== -->
+ <target name="test">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Steps to do to publish the build results -->
+ <!-- ===================================================================== -->
+ <target name="publish">
+ </target>
+
+ <!-- ===================================================================== -->
+ <!-- Default target -->
+ <!-- ===================================================================== -->
+ <target name="noDefault">
+ <echo message="You must specify a target when invoking this file" />
+ </target>
+
+</project>
diff --git a/org.tizen.common.connection/.classpath b/org.tizen.common.connection/.classpath
new file mode 100644
index 000000000..ad32c83a7
--- /dev/null
+++ b/org.tizen.common.connection/.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.common.connection/.project b/org.tizen.common.connection/.project
new file mode 100644
index 000000000..72d66211e
--- /dev/null
+++ b/org.tizen.common.connection/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.tizen.common.connection</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>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.tizen.common.connection/META-INF/MANIFEST.MF b/org.tizen.common.connection/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..c4e0d3928
--- /dev/null
+++ b/org.tizen.common.connection/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tizen Common Connection
+Bundle-SymbolicName: org.tizen.common.connection;singleton:=true
+Bundle-Version: 1.17.0.qualifier
+Bundle-Activator: org.tizen.common.connection.ConnectionPlugin
+Bundle-Vendor: Samsung
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources;bundle-version="3.6.1",
+ org.tizen.common
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Import-Package: org.tizen.common.util
+Bundle-ClassPath: .
+Export-Package: org.tizen.common.connection;
+ uses:="org.eclipse.jface.resource,
+ org.tizen.sdblib,
+ org.eclipse.ui.plugin,
+ org.osgi.framework",
+ org.tizen.common.connection.debugtools,
+ org.tizen.common.connection.ui;uses:="org.tizen.common.connection.log,org.eclipse.ui.part,org.eclipse.swt.widgets"
diff --git a/org.tizen.common.connection/about.html b/org.tizen.common.connection/about.html
new file mode 100644
index 000000000..5c96d4fee
--- /dev/null
+++ b/org.tizen.common.connection/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>sdblib.jar is 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.common.connection/about_files/LICENSE-2.0.htm b/org.tizen.common.connection/about_files/LICENSE-2.0.htm
new file mode 100644
index 000000000..f7ca65649
--- /dev/null
+++ b/org.tizen.common.connection/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 &quot;License&quot;); 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 &quot;AS IS&quot; 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 &#169; 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.common.connection/build.properties b/org.tizen.common.connection/build.properties
new file mode 100644
index 000000000..414cf4bce
--- /dev/null
+++ b/org.tizen.common.connection/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ about.html,\
+ about_files/
+jars.compile.order = .,\
+ sdblib.jar
diff --git a/org.tizen.common.connection/icons/Connection Explorer.gif b/org.tizen.common.connection/icons/Connection Explorer.gif
new file mode 100644
index 000000000..111e3f9ea
--- /dev/null
+++ b/org.tizen.common.connection/icons/Connection Explorer.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/Emulator_start.gif b/org.tizen.common.connection/icons/Emulator_start.gif
new file mode 100644
index 000000000..8737c07bd
--- /dev/null
+++ b/org.tizen.common.connection/icons/Emulator_start.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/Emulator_stop.gif b/org.tizen.common.connection/icons/Emulator_stop.gif
new file mode 100644
index 000000000..60cf40cad
--- /dev/null
+++ b/org.tizen.common.connection/icons/Emulator_stop.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/device.gif b/org.tizen.common.connection/icons/device.gif
new file mode 100644
index 000000000..abedbb007
--- /dev/null
+++ b/org.tizen.common.connection/icons/device.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/directory.gif b/org.tizen.common.connection/icons/directory.gif
new file mode 100644
index 000000000..5e0cb945d
--- /dev/null
+++ b/org.tizen.common.connection/icons/directory.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/directory_link.gif b/org.tizen.common.connection/icons/directory_link.gif
new file mode 100644
index 000000000..ac837477e
--- /dev/null
+++ b/org.tizen.common.connection/icons/directory_link.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/emulator.gif b/org.tizen.common.connection/icons/emulator.gif
new file mode 100644
index 000000000..7559ba162
--- /dev/null
+++ b/org.tizen.common.connection/icons/emulator.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/file.gif b/org.tizen.common.connection/icons/file.gif
new file mode 100644
index 000000000..b84737e90
--- /dev/null
+++ b/org.tizen.common.connection/icons/file.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/file_link.gif b/org.tizen.common.connection/icons/file_link.gif
new file mode 100644
index 000000000..e77773d75
--- /dev/null
+++ b/org.tizen.common.connection/icons/file_link.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/file_other.gif b/org.tizen.common.connection/icons/file_other.gif
new file mode 100644
index 000000000..7ccc6a703
--- /dev/null
+++ b/org.tizen.common.connection/icons/file_other.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/info.gif b/org.tizen.common.connection/icons/info.gif
new file mode 100644
index 000000000..069b382a9
--- /dev/null
+++ b/org.tizen.common.connection/icons/info.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/Add tab.png b/org.tizen.common.connection/icons/log/Add tab.png
new file mode 100644
index 000000000..b07109b79
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/Add tab.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/Clear Log.png b/org.tizen.common.connection/icons/log/Clear Log.png
new file mode 100644
index 000000000..4f542ad11
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/Clear Log.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/Edit tab.png b/org.tizen.common.connection/icons/log/Edit tab.png
new file mode 100644
index 000000000..d13ab48cf
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/Edit tab.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/Export Log.png b/org.tizen.common.connection/icons/log/Export Log.png
new file mode 100644
index 000000000..ee3f1e8a3
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/Export Log.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/Log View.gif b/org.tizen.common.connection/icons/log/Log View.gif
new file mode 100644
index 000000000..9007253b2
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/Log View.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/Remove tab.png b/org.tizen.common.connection/icons/log/Remove tab.png
new file mode 100644
index 000000000..6788fc85b
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/Remove tab.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/d.png b/org.tizen.common.connection/icons/log/d.png
new file mode 100644
index 000000000..9e111cb30
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/d.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/e.png b/org.tizen.common.connection/icons/log/e.png
new file mode 100644
index 000000000..e70bac8dd
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/e.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/i.png b/org.tizen.common.connection/icons/log/i.png
new file mode 100644
index 000000000..1ff78a38c
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/i.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/v.png b/org.tizen.common.connection/icons/log/v.png
new file mode 100644
index 000000000..e630654fe
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/v.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/log/w.png b/org.tizen.common.connection/icons/log/w.png
new file mode 100644
index 000000000..2a6b03b7b
--- /dev/null
+++ b/org.tizen.common.connection/icons/log/w.png
Binary files differ
diff --git a/org.tizen.common.connection/icons/pull.gif b/org.tizen.common.connection/icons/pull.gif
new file mode 100644
index 000000000..c5f68e0c2
--- /dev/null
+++ b/org.tizen.common.connection/icons/pull.gif
Binary files differ
diff --git a/org.tizen.common.connection/icons/push.gif b/org.tizen.common.connection/icons/push.gif
new file mode 100644
index 000000000..cb66cfcd1
--- /dev/null
+++ b/org.tizen.common.connection/icons/push.gif
Binary files differ
diff --git a/org.tizen.common.connection/plugin.xml b/org.tizen.common.connection/plugin.xml
new file mode 100644
index 000000000..89e284e97
--- /dev/null
+++ b/org.tizen.common.connection/plugin.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="org.tizen.common.connection.tools" name="tools" schema="schema/tools.exsd"/>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ name="Tizen"
+ id="org.tizen.nativeapp.viewCategory"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.tizen.nativeapp.viewCategory"
+ class="org.tizen.common.connection.ui.ConnectionExplorer"
+ icon="icons/Connection Explorer.gif"
+ id="org.tizen.common.connection.ui.ConnectionExplorer"
+ name="Connection Explorer"
+ restorable="true">
+ </view>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.tizen.nativeapp.perspective">
+ <view
+ ratio="1"
+ relationship="bottom"
+ relative="org.eclipse.ui.navigator.ProjectExplorer"
+ id="org.tizen.common.connection.ui.ConnectionExplorer">
+ </view>
+ <viewShortcut
+ id="org.tizen.common.connection.ui.ConnectionExplorer">
+ </viewShortcut>
+ </perspectiveExtension>
+ </extension>
+ <extension
+ id="org.tizen.common.connection.ui.filedrop"
+ name="Connection Resource Drop"
+ point="org.eclipse.ui.dropActions">
+ <action
+ class="org.tizen.common.connection.sdblib.dnd.FileEntryDropAdapter"
+ id="org.tizen.common.connection.filedrop">
+ </action>
+
+ </extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ class="org.tizen.common.connection.properties.ConnectionExplorerInfoPropertyPages"
+ id="org.tizen.common.connection.properties.Info"
+ name="Info"
+ nameFilter="*"
+ objectClass="org.tizen.sdblib.FileListingService$FileEntry">
+ </page>
+ <page
+ class="org.tizen.common.connection.properties.ConnectionExplorerPermissionPropertyPages"
+ id="org.tizen.common.connection.properties.Permission"
+ name="Permission"
+ nameFilter="*"
+ objectClass="org.tizen.sdblib.FileListingService$FileEntry">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.tizen.common.connection.delete"
+ contextId="org.tizen.common.connection.delete.context"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="DEL">
+ </key>
+ <key
+ commandId="org.tizen.common.connection.rename"
+ contextId="org.tizen.common.connection.rename.context"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F2">
+ </key>
+ <key
+ commandId="org.tizen.common.connection.refresh"
+ contextId="org.tizen.common.connection.refresh.context"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F5">
+ </key>
+ <key
+ commandId="org.tizen.common.connection.property"
+ contextId="org.tizen.common.connection.property.context"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="ALT+CR">
+ </key>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.tizen.common.connection.delete"
+ name="deleteaction">
+ </command>
+ <command
+ id="org.tizen.common.connection.rename"
+ name="renameaction">
+ </command>
+ <command
+ id="org.tizen.common.connection.refresh"
+ name="refreshaction">
+ </command>
+ <command
+ id="org.tizen.common.connection.property"
+ name="propertyaction">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.contexts">
+ <context
+ id="org.tizen.common.connection.delete.context"
+ name="delete"
+ parentId="org.eclipse.ui.contexts.window">
+ </context>
+ <context
+ id="org.tizen.common.connection.rename.context"
+ name="rename"
+ parentId="org.eclipse.ui.contexts.window">
+ </context>
+ <context
+ id="org.tizen.common.connection.refresh.context"
+ name="refresh"
+ parentId="org.eclipse.ui.contexts.window">
+ </context>
+ <context
+ id="org.tizen.common.connection.property.context"
+ name="property"
+ parentId="org.eclipse.ui.contexts.window">
+ </context>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ name="Log"
+ icon="icons/log/Log View.gif"
+ category="org.tizen.nativeapp.viewCategory"
+ class="org.tizen.common.connection.ui.LogView"
+ id="org.tizen.common.connection.ui.LogView"
+ allowMultiple = "true">
+ </view>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.tizen.nativeapp.perspective">
+ <view
+ id="org.tizen.common.connection.ui.LogView"
+ ratio="1"
+ relationship="stack"
+ relative="org.eclipse.ui.views.TaskList">
+ </view>
+ <viewShortcut
+ id="org.tizen.common.connection.ui.LogView">
+ </viewShortcut>
+ </perspectiveExtension>
+ </extension>
+ </plugin>
diff --git a/org.tizen.common.connection/schema/tools.exsd b/org.tizen.common.connection/schema/tools.exsd
new file mode 100644
index 000000000..6ca7b1c10
--- /dev/null
+++ b/org.tizen.common.connection/schema/tools.exsd
@@ -0,0 +1,121 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="tools" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="tools" id="org.tizen.common.connection.tools" name="Tizen SDK Debug Tools Installation"/>
+ </appinfo>
+ <documentation>
+ This extension allows specification of a tizen sdk debug tools to be installed when launching application under the SDB.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="tools"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="tools">
+ <complexType>
+ <attribute name="packagename" type="string" use="required">
+ <annotation>
+ <documentation>
+ the packagename of tar file
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="sourcepath" type="string" use="required">
+ <annotation>
+ <documentation>
+ the source directory path from tizen sdk install path.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ the tool descriptions
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 1.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ &lt;extension
+ point=&quot;org.tizen.common.connection.tools&quot;&gt;
+ &lt;tools
+ binaryname=&quot;oprofile_armel.tar&quot;
+ sourcepath=&quot;/SDK/develop-tool&quot;
+ architecture=&quot;armel&quot;
+ compressed=&quot;true&quot;
+ description=&quot;oprofile library&quot;&gt;
+&lt;/extension&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ConnectionPlugin.java b/org.tizen.common.connection/src/org/tizen/common/connection/ConnectionPlugin.java
new file mode 100644
index 000000000..dc5cbf606
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ConnectionPlugin.java
@@ -0,0 +1,221 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.RegistryFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.tizen.common.connection.debugtools.DebugTool;
+import org.tizen.common.properties.InstallPathConfig;
+
+import org.tizen.sdblib.FileListingService.FileEntry;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.Log;
+import org.tizen.sdblib.SmartDevelopmentBridge;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ConnectionPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.tizen.common.connection"; //$NON-NLS-1$
+ public static final String ID_LOGS_VIEW = "org.tizen.common.connection.ui.LogView"; //$NON-NLS-1$
+ public static final String ID_CONNECTION_VIEW = "org.tizen.common.connection.ui.ConnectionExplorer";
+ public static final String ID_DEBUGTOOLS_EXTENSION = "org.tizen.common.connection.tools"; //$NON-NLS-1$
+
+ // The shared instance
+ private static ConnectionPlugin plugin;
+
+ private IDevice currentDevice;
+ private final ArrayList<ISelectionListener> listeners = new ArrayList<ISelectionListener>();
+
+ public int os;
+ public static final int LINUX = 0;
+ public static final int WINDOWS = 1;
+
+ /**
+ * Implements for FileEntry changed status.
+ */
+ public interface ISelectionListener {
+
+ /**
+ * Sent when a FileEntry is selected.
+ * @param selectedEntry the selected FileEntry. If null, no FileEntry are selected.
+ */
+ void selectionChanged(FileEntry selectedEntry);
+ }
+
+ /**
+ * The constructor
+ */
+ public ConnectionPlugin() {
+ }
+
+ /*
+ * (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;
+
+ Properties properties = System.getProperties();
+ String value = properties.getProperty("os.name");
+ if (value.contains("Windows"))
+ this.os = WINDOWS;
+ else
+ this.os = LINUX;
+
+ }
+
+ public static synchronized List<DebugTool> getDebugTools(IDevice device) {
+
+ List<DebugTool> toolLists = new ArrayList<DebugTool>();
+
+ IExtensionRegistry x = RegistryFactory.getRegistry();
+ IConfigurationElement[] ces = x.getConfigurationElementsFor(ID_DEBUGTOOLS_EXTENSION);
+
+ for (int i = 0; i < ces.length; ++i) {
+ IConfigurationElement ce = ces[i];
+ if (ce.getName().equals("tools")) {
+ String packagename = ce.getAttribute("packagename");
+ if (packagename == null)
+ continue;
+ String sourcepath = ce.getAttribute("sourcepath");
+ if (sourcepath == null)
+ continue;
+ String description = ce.getAttribute("description");
+
+ Path sourcePath = new Path(InstallPathConfig.getSDKPath() + "/" + sourcepath);
+
+ File packageList = new File(sourcePath.toOSString());
+ for (File f : packageList.listFiles()) {
+ if (f.getName().startsWith(packagename)) {
+ String[] filename = f.getName().split("_");
+ if (filename.length != 3)
+ continue;
+ String version = filename[1];
+ String[] arch = filename[2].split("\\.");
+ if (arch.length != 2)
+ continue;
+ String architecture = arch[0];
+
+ if (device.isEmulator()) {
+ if (!architecture.equals("i386"))
+ continue;
+ } else {
+ if (!architecture.equals("armel"))
+ continue;
+ }
+ DebugTool dt = new DebugTool();
+ dt.setPackagename(packagename);
+ dt.setBinaryname(f.getName());
+ dt.setSourcepath(sourcepath);
+ dt.setDescription(description);
+ dt.setVersion(version);
+ dt.setArchitecture(architecture);
+ toolLists.add(dt);
+ }
+ }
+ }
+ }
+ return toolLists;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ SmartDevelopmentBridge.disconnectBridge();
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ConnectionPlugin getDefault() {
+ return plugin;
+ }
+
+ public void setCurrentDevice(IDevice device) {
+ currentDevice = device;
+ }
+
+ public IDevice getCurrentDevice() {
+ return currentDevice;
+ }
+
+
+ public void addSelectionListener(ISelectionListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeSelectionListener(ISelectionListener listener) {
+ listeners.remove(listener);
+ }
+
+ public void notifySelectionListeners(FileEntry file) {
+
+ ISelectionListener[] listenersCopy = listeners.toArray(
+ new ISelectionListener[listeners.size()]);
+
+ for (ISelectionListener listener : listenersCopy) {
+ try {
+ listener.selectionChanged(file);
+ } catch (Exception e) {
+ Log.e("ConnectionPlugin", e);
+ }
+ }
+ }
+
+ /**
+ * 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 getImageDescriptorFromPlugin(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/DdmUiPreferences.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/DdmUiPreferences.java
new file mode 100644
index 000000000..7bcc81a5b
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/DdmUiPreferences.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Preference entry point for ddmuilib. Allows the lib to access a preference
+ * store (org.eclipse.jface.preference.IPreferenceStore) defined by the
+ * application that includes the lib.
+ */
+public final class DdmUiPreferences {
+
+ public static final int DEFAULT_THREAD_REFRESH_INTERVAL = 4; // seconds
+
+ private static int sThreadRefreshInterval = DEFAULT_THREAD_REFRESH_INTERVAL;
+
+ private static IPreferenceStore mStore;
+
+ private static String sSymbolLocation =""; //$NON-NLS-1$
+ private static String sAddr2LineLocation =""; //$NON-NLS-1$
+ private static String sTraceviewLocation =""; //$NON-NLS-1$
+
+ public static void setStore(IPreferenceStore store) {
+ mStore = store;
+ }
+
+ public static IPreferenceStore getStore() {
+ return mStore;
+ }
+
+ public static int getThreadRefreshInterval() {
+ return sThreadRefreshInterval;
+ }
+
+ public static void setThreadRefreshInterval(int port) {
+ sThreadRefreshInterval = port;
+ }
+
+ static String getSymbolDirectory() {
+ return sSymbolLocation;
+ }
+
+ public static void setSymbolsLocation(String location) {
+ sSymbolLocation = location;
+ }
+
+ static String getAddr2Line() {
+ return sAddr2LineLocation;
+ }
+
+ public static void setAddr2LineLocation(String location) {
+ sAddr2LineLocation = location;
+ }
+
+ public static String getTraceview() {
+ return sTraceviewLocation;
+ }
+
+ public static void setTraceviewLocation(String location) {
+ sTraceviewLocation = location;
+ }
+
+
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogUtils.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogUtils.java
new file mode 100644
index 000000000..9d220354d
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/FileDialogUtils.java
@@ -0,0 +1,178 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Yoonki Park <yoonki.park@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.common.connection.ddmuilib;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.PlatformUI;
+import org.tizen.common.connection.explorer.Messages;
+
+
+public class FileDialogUtils {
+ private static FileDialogUtils instance;
+
+ private FileDialogUtils() { }
+
+ public static FileDialogUtils getInstance() {
+ if (instance == null)
+ instance = new FileDialogUtils();
+ return instance;
+ }
+
+ public int checkOverwrite(final String filename) {
+ final int[] result = new int[1]; // using array since you can't change a final int
+
+ Runnable query = new Runnable() {
+ public void run() {
+ int[] resultId = {
+ IDialogConstants.YES_ID,
+ IDialogConstants.YES_TO_ALL_ID,
+ IDialogConstants.NO_ID,
+ IDialogConstants.CANCEL_ID };
+
+ String[] labels = new String[] {
+ IDialogConstants.YES_LABEL,
+ IDialogConstants.YES_TO_ALL_LABEL,
+ IDialogConstants.NO_LABEL,
+ IDialogConstants.CANCEL_LABEL };
+
+ String msg = NLS.bind(Messages.getString("FileDialogUtils.overrite.message"), filename);
+ MessageDialog dialog = new MessageDialog(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ Messages.getString("FileDialogUtils.overrite.title"),
+ null, msg , MessageDialog.QUESTION, labels, 0);
+ dialog.open();
+ if (dialog.getReturnCode() == SWT.DEFAULT) {
+ // A window close returns SWT.DEFAULT - mapped to a cancel
+ result[0] = IDialogConstants.CANCEL_ID;
+ } else {
+ result[0] = resultId[dialog.getReturnCode()];
+ }
+ }
+ };
+
+ PlatformUI.getWorkbench().getDisplay().syncExec(query);
+ return result[0];
+ }
+ public int confirmDelete(final String filename) {
+ final int[] result = new int[1]; // using array since you can't change a final int
+
+ Runnable query = new Runnable() {
+ public void run() {
+ int[] resultId = {
+ IDialogConstants.YES_ID,
+ IDialogConstants.CANCEL_ID };
+
+ String[] labels = new String[] {
+ IDialogConstants.YES_LABEL,
+ IDialogConstants.CANCEL_LABEL };
+
+ String msg = NLS.bind(Messages.getString("FileDialogUtils.delete.message"), filename);
+ MessageDialog dialog = new MessageDialog(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ Messages.getString("FileDialogUtils.delete.title"),
+ null, msg , MessageDialog.QUESTION, labels, 0);
+ dialog.open();
+ if (dialog.getReturnCode() == SWT.DEFAULT) {
+ // A window close returns SWT.DEFAULT - mapped to a cancel
+ result[0] = IDialogConstants.CANCEL_ID;
+ } else {
+ result[0] = resultId[dialog.getReturnCode()];
+ }
+ }
+ };
+
+ PlatformUI.getWorkbench().getDisplay().syncExec(query);
+ return result[0];
+ }
+
+ public int checkFileOverwrite(final String filename) {
+ final int[] result = new int[1]; // using array since you can't change a final int
+
+ Runnable query = new Runnable() {
+ public void run() {
+ int[] resultId = {
+ IDialogConstants.OK_ID,
+ IDialogConstants.CANCEL_ID };
+
+ String[] labels = new String[] {
+ IDialogConstants.OK_LABEL,
+ IDialogConstants.CANCEL_LABEL };
+
+ String msg = NLS.bind(Messages.getString("FileDialogUtils.overrite.message"), filename);
+ MessageDialog dialog = new MessageDialog(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ Messages.getString("FileDialogUtils.overrite.title"),
+ null, msg , MessageDialog.QUESTION, labels, 0);
+ dialog.open();
+ if (dialog.getReturnCode() == SWT.DEFAULT) {
+ // A window close returns SWT.DEFAULT - mapped to a cancel
+ result[0] = IDialogConstants.CANCEL_ID;
+ } else {
+ result[0] = resultId[dialog.getReturnCode()];
+ }
+ }
+ };
+
+ PlatformUI.getWorkbench().getDisplay().syncExec(query);
+ return result[0];
+ }
+
+ public int checkTabName(final String filename) {
+ final int[] result = new int[1]; // using array since you can't change a final int
+
+ Runnable query = new Runnable() {
+ public void run() {
+ int[] resultId = {
+ IDialogConstants.OK_ID
+ };
+
+ String[] labels = new String[] {
+ IDialogConstants.OK_LABEL
+ };
+
+ String msg = NLS.bind(Messages.getString("FileDialogUtils.tabName.message"), filename);
+ MessageDialog dialog = new MessageDialog(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ Messages.getString("FileDialogUtils.tabName.title"),
+ null, msg , MessageDialog.ERROR, labels, 0);
+ dialog.open();
+ if (dialog.getReturnCode() == SWT.DEFAULT) {
+ // A window close returns SWT.DEFAULT - mapped to a cancel
+ result[0] = IDialogConstants.CANCEL_ID;
+ } else {
+ result[0] = resultId[dialog.getReturnCode()];
+ }
+ }
+ };
+
+ PlatformUI.getWorkbench().getDisplay().syncExec(query);
+ return result[0];
+ }
+
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/ITableFocusListener.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/ITableFocusListener.java
new file mode 100644
index 000000000..d6d5e430e
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/ITableFocusListener.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib;
+
+import org.eclipse.swt.dnd.Clipboard;
+
+/**
+ * An object listening to focus change in Table objects.<br>
+ * For application not relying on a RCP to provide menu changes based on focus,
+ * this class allows to get monitor the focus change of several Table widget
+ * and update the menu action accordingly.
+ */
+public interface ITableFocusListener {
+
+ public interface IFocusedTableActivator {
+ public void copy(Clipboard clipboard);
+
+ public void selectAll();
+ }
+
+ public void focusGained(IFocusedTableActivator activator);
+
+ public void focusLost(IFocusedTableActivator activator);
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/ImageLoader.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/ImageLoader.java
new file mode 100644
index 000000000..24e62a0d2
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/ImageLoader.java
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+
+/**
+ * Class to load images stored in a jar file.
+ * All images are loaded from /images/<var>filename</var>
+ *
+ * Because Java requires to know the jar file in which to load the image from, a class is required
+ * when getting the instance. Instances are cached and associated to the class passed to
+ * {@link #getLoader(Class)}.
+ *
+ * {@link #getDdmUiLibLoader()} use {@link ImageLoader#getClass()} as the class. This is to be used
+ * to load images from ddmuilib.
+ *
+ * Loaded images are stored so that 2 calls with the same filename will return the same object.
+ * This also means that {@link Image} object returned by the loader should never be disposed.
+ *
+ */
+public class ImageLoader {
+
+ private static final String PATH = "/icons/"; //$NON-NLS-1$
+
+ private final HashMap<String, Image> mLoadedImages = new HashMap<String, Image>();
+ private static final HashMap<Class<?>, ImageLoader> mInstances =
+ new HashMap<Class<?>, ImageLoader>();
+ private final Class<?> mClass;
+
+ /**
+ * Private constructor, creating an instance associated with a class.
+ * The class is used to identify which jar file the images are loaded from.
+ */
+ private ImageLoader(Class<?> theClass) {
+ if (theClass == null) {
+ theClass = ImageLoader.class;
+ }
+ mClass = theClass;
+ }
+
+ /**
+ * Returns the {@link ImageLoader} instance to load images from ddmuilib.jar
+ */
+ public static ImageLoader getDdmUiLibLoader() {
+ return getLoader(null);
+ }
+
+ /**
+ * Returns an {@link ImageLoader} to load images based on a given class.
+ *
+ * The loader will load images from the jar from which the class was loaded. using
+ * {@link Class#getResource(String)} and {@link Class#getResourceAsStream(String)}.
+ *
+ * Since all images are loaded using the path /images/<var>filename</var>, any class from the
+ * jar will work. However since the loader is cached and reused when the query provides the same
+ * class instance, and since the loader will also cache the loaded images, it is recommended
+ * to always use the same class for a given Jar file.
+ *
+ */
+ public static ImageLoader getLoader(Class<?> theClass) {
+ ImageLoader instance = mInstances.get(theClass);
+ if (instance == null) {
+ instance = new ImageLoader(theClass);
+ mInstances.put(theClass, instance);
+ }
+
+ return instance;
+ }
+
+ /**
+ * Disposes all images for all instances.
+ * This should only be called when the program exits.
+ */
+ public static void dispose() {
+ for (ImageLoader loader : mInstances.values()) {
+ loader.doDispose();
+ }
+ }
+
+ private synchronized void doDispose() {
+ for (Image image : mLoadedImages.values()) {
+ image.dispose();
+ }
+
+ mLoadedImages.clear();
+ }
+
+ /**
+ * Returns an {@link ImageDescriptor} for a given filename.
+ *
+ * This searches for an image located at /images/<var>filename</var>.
+ *
+ * @param filename the filename of the image to load.
+ */
+ public ImageDescriptor loadDescriptor(String filename) {
+ URL url = mClass.getResource(PATH + filename);
+ // TODO cache in a map
+ return ImageDescriptor.createFromURL(url);
+ }
+
+ /**
+ * Returns an {@link Image} for a given filename.
+ *
+ * This searches for an image located at /images/<var>filename</var>.
+ *
+ * @param filename the filename of the image to load.
+ * @param display the Display object
+ */
+ public synchronized Image loadImage(String filename, Display display) {
+ Image img = mLoadedImages.get(filename);
+ if (img == null) {
+ String tmp = PATH + filename;
+ InputStream imageStream = mClass.getResourceAsStream(tmp);
+
+ if (imageStream != null) {
+ img = new Image(display, imageStream);
+ if (img == null) {
+ throw new NullPointerException("couldn't load " + tmp);
+ }
+
+ mLoadedImages.put(filename, img);
+
+ return img;
+ }
+ }
+
+ return img;
+ }
+
+ /**
+ * Loads an image from a resource. This method used a class to locate the
+ * resources, and then load the filename from /images inside the resources.<br>
+ * Extra parameters allows for creation of a replacement image of the
+ * loading failed.
+ *
+ * @param loader the image loader used.
+ * @param display the Display object
+ * @param fileName the file name
+ * @param width optional width to create replacement Image. If -1, null be
+ * be returned if the loading fails.
+ * @param height optional height to create replacement Image. If -1, null be
+ * be returned if the loading fails.
+ * @param phColor optional color to create replacement Image. If null, Blue
+ * color will be used.
+ * @return a new Image or null if the loading failed and the optional
+ * replacement size was -1
+ */
+ public Image loadImage(Display display, String fileName, int width, int height,
+ Color phColor) {
+
+ Image img = loadImage(fileName, display);
+
+ if (img == null) {
+// Log.w("ddms", "Couldn't load " + fileName);
+ // if we had the extra parameter to create replacement image then we
+ // create and return it.
+ if (width != -1 && height != -1) {
+ return createPlaceHolderArt(display, width, height,
+ phColor != null ? phColor : display
+ .getSystemColor(SWT.COLOR_BLUE));
+ }
+
+ // otherwise, just return null
+ return null;
+ }
+
+ return img;
+ }
+
+ /**
+ * Create place-holder art with the specified color.
+ */
+ public static Image createPlaceHolderArt(Display display, int width,
+ int height, Color color) {
+ Image img = new Image(display, width, height);
+ GC gc = new GC(img);
+ gc.setForeground(color);
+ gc.drawLine(0, 0, width, height);
+ gc.drawLine(0, height - 1, width, -1);
+ gc.dispose();
+ return img;
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/Panel.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/Panel.java
new file mode 100644
index 000000000..912c72dba
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/Panel.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * Base class for our information panels.
+ */
+public abstract class Panel {
+
+ public final Control createPanel(Composite parent) {
+ Control panelControl = createControl(parent);
+
+ postCreation();
+
+ return panelControl;
+ }
+
+ protected abstract void postCreation();
+
+ /**
+ * Creates a control capable of displaying some information. This is
+ * called once, when the application is initializing, from the UI thread.
+ */
+ protected abstract Control createControl(Composite parent);
+
+ /**
+ * Sets the focus to the proper control inside the panel.
+ */
+ public abstract void setFocus();
+}
+
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/PortFieldEditor.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/PortFieldEditor.java
new file mode 100644
index 000000000..5bc8f9e0c
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/PortFieldEditor.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib;
+
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Edit an integer field, validating it as a port number.
+ */
+public class PortFieldEditor extends IntegerFieldEditor {
+
+ public boolean mRecursiveCheck = false;
+
+ public PortFieldEditor(String name, String label, Composite parent) {
+ super(name, label, parent);
+ setValidateStrategy(VALIDATE_ON_KEY_STROKE);
+ }
+
+ /*
+ * Get the current value of the field, as an integer.
+ */
+ public int getCurrentValue() {
+ int val;
+ try {
+ val = Integer.parseInt(getStringValue());
+ }
+ catch (NumberFormatException nfe) {
+ val = -1;
+ }
+ return val;
+ }
+
+ /*
+ * Check the validity of the field.
+ */
+ @Override
+ protected boolean checkState() {
+ if (super.checkState() == false) {
+ return false;
+ }
+ //Log.i("ddms", "check state " + getStringValue());
+ boolean err = false;
+ int val = getCurrentValue();
+ if (val < 1024 || val > 32767) {
+ setErrorMessage("Port must be between 1024 and 32767");
+ err = true;
+ } else {
+ setErrorMessage(null);
+ err = false;
+ }
+ showErrorMessage();
+ return !err;
+ }
+
+ protected void updateCheckState(PortFieldEditor pfe) {
+ pfe.refreshValidState();
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/SyncProgressMonitor.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/SyncProgressMonitor.java
new file mode 100644
index 000000000..aad05b33c
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/SyncProgressMonitor.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.tizen.sdblib.SyncService.ISyncProgressMonitor;
+
+/**
+ * Implementation of the {@link ISyncProgressMonitor} wrapping an Eclipse {@link IProgressMonitor}.
+ */
+public class SyncProgressMonitor implements ISyncProgressMonitor {
+
+ private IProgressMonitor mMonitor;
+ private String mName;
+
+ public SyncProgressMonitor(IProgressMonitor monitor, String name) {
+ mMonitor = monitor;
+ mName = name;
+ }
+
+ public void start(int totalWork) {
+ mMonitor.beginTask(mName, totalWork);
+ }
+
+ public void stop() {
+ mMonitor.done();
+ }
+
+ public void advance(int work) {
+ mMonitor.worked(work);
+ }
+
+ public boolean isCanceled() {
+ return mMonitor.isCanceled();
+ }
+
+ public void startSubTask(String name) {
+ mMonitor.subTask(name);
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/TableHelper.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/TableHelper.java
new file mode 100644
index 000000000..71b4b5a9b
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/TableHelper.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+
+/**
+ * Utility class to help using Table objects.
+ *
+ */
+public final class TableHelper {
+ /**
+ * Create a TableColumn with the specified parameters. If a
+ * <code>PreferenceStore</code> object and a preference entry name String
+ * object are provided then the column will listen to change in its width
+ * and update the preference store accordingly.
+ *
+ * @param parent The Table parent object
+ * @param header The header string
+ * @param style The column style
+ * @param sample_text A sample text to figure out column width if preference
+ * value is missing
+ * @param pref_name The preference entry name for column width
+ * @param prefs The preference store
+ * @return The TableColumn object that was created
+ */
+ public static TableColumn createTableColumn(Table parent, String header,
+ int style, String sample_text, final String pref_name,
+ final IPreferenceStore prefs) {
+
+ // create the column
+ TableColumn col = new TableColumn(parent, style);
+
+ // if there is no pref store or the entry is missing, we use the sample
+ // text and pack the column.
+ // Otherwise we just read the width from the prefs and apply it.
+ if (prefs == null || prefs.contains(pref_name) == false) {
+ col.setText(sample_text);
+ col.pack();
+
+ // init the prefs store with the current value
+ if (prefs != null) {
+ prefs.setValue(pref_name, col.getWidth());
+ }
+ } else {
+ col.setWidth(prefs.getInt(pref_name));
+ }
+
+ // set the header
+ col.setText(header);
+
+ // if there is a pref store and a pref entry name, then we setup a
+ // listener to catch column resize to put store the new width value.
+ if (prefs != null && pref_name != null) {
+ col.addControlListener(new ControlListener() {
+ public void controlMoved(ControlEvent e) {
+ }
+
+ public void controlResized(ControlEvent e) {
+ // get the new width
+ int w = ((TableColumn)e.widget).getWidth();
+
+ // store in pref store
+ prefs.setValue(pref_name, w);
+ }
+ });
+ }
+
+ return col;
+ }
+
+ /**
+ * Create a TreeColumn with the specified parameters. If a
+ * <code>PreferenceStore</code> object and a preference entry name String
+ * object are provided then the column will listen to change in its width
+ * and update the preference store accordingly.
+ *
+ * @param parent The Table parent object
+ * @param header The header string
+ * @param style The column style
+ * @param sample_text A sample text to figure out column width if preference
+ * value is missing
+ * @param pref_name The preference entry name for column width
+ * @param prefs The preference store
+ */
+ public static void createTreeColumn(Tree parent, String header, int style,
+ String sample_text, final String pref_name,
+ final IPreferenceStore prefs) {
+
+ // create the column
+ TreeColumn col = new TreeColumn(parent, style);
+
+ // if there is no pref store or the entry is missing, we use the sample
+ // text and pack the column.
+ // Otherwise we just read the width from the prefs and apply it.
+ if (prefs == null || prefs.contains(pref_name) == false) {
+ col.setText(sample_text);
+ col.pack();
+
+ // init the prefs store with the current value
+ if (prefs != null) {
+ prefs.setValue(pref_name, col.getWidth());
+ }
+ } else {
+ col.setWidth(prefs.getInt(pref_name));
+ }
+
+ // set the header
+ col.setText(header);
+
+ // if there is a pref store and a pref entry name, then we setup a
+ // listener to catch column resize to put store the new width value.
+ if (prefs != null && pref_name != null) {
+ col.addControlListener(new ControlListener() {
+ public void controlMoved(ControlEvent e) {
+ }
+
+ public void controlResized(ControlEvent e) {
+ // get the new width
+ int w = ((TreeColumn)e.widget).getWidth();
+
+ // store in pref store
+ prefs.setValue(pref_name, w);
+ }
+ });
+ }
+ }
+
+ /**
+ * Create a TreeColumn with the specified parameters. If a
+ * <code>PreferenceStore</code> object and a preference entry name String
+ * object are provided then the column will listen to change in its width
+ * and update the preference store accordingly.
+ *
+ * @param parent The Table parent object
+ * @param header The header string
+ * @param style The column style
+ * @param width the width of the column if the preference value is missing
+ * @param pref_name The preference entry name for column width
+ * @param prefs The preference store
+ */
+ public static void createTreeColumn(Tree parent, String header, int style,
+ int width, final String pref_name,
+ final IPreferenceStore prefs) {
+
+ // create the column
+ TreeColumn col = new TreeColumn(parent, style);
+
+ // if there is no pref store or the entry is missing, we use the sample
+ // text and pack the column.
+ // Otherwise we just read the width from the prefs and apply it.
+ if (prefs == null || prefs.contains(pref_name) == false) {
+ col.setWidth(width);
+
+ // init the prefs store with the current value
+ if (prefs != null) {
+ prefs.setValue(pref_name, width);
+ }
+ } else {
+ col.setWidth(prefs.getInt(pref_name));
+ }
+
+ // set the header
+ col.setText(header);
+
+ // if there is a pref store and a pref entry name, then we setup a
+ // listener to catch column resize to put store the new width value.
+ if (prefs != null && pref_name != null) {
+ col.addControlListener(new ControlListener() {
+ public void controlMoved(ControlEvent e) {
+ }
+
+ public void controlResized(ControlEvent e) {
+ // get the new width
+ int w = ((TreeColumn)e.widget).getWidth();
+
+ // store in pref store
+ prefs.setValue(pref_name, w);
+ }
+ });
+ }
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/actions/ICommonAction.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/actions/ICommonAction.java
new file mode 100644
index 000000000..6c66d91a1
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/actions/ICommonAction.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib.actions;
+
+/**
+ * Common interface for basic action handling. This allows the common ui
+ * components to access ToolItem or Action the same way.
+ */
+public interface ICommonAction {
+ /**
+ * Sets the enabled state of this action.
+ * @param enabled <code>true</code> to enable, and
+ * <code>false</code> to disable
+ */
+ public void setEnabled(boolean enabled);
+
+ /**
+ * Sets the checked status of this action.
+ * @param checked the new checked status
+ */
+ public void setChecked(boolean checked);
+
+ /**
+ * Sets the {@link Runnable} that will be executed when the action is triggered.
+ */
+ public void setRunnable(Runnable runnable);
+}
+
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/actions/ToolItemAction.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/actions/ToolItemAction.java
new file mode 100644
index 000000000..073e981b6
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/actions/ToolItemAction.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib.actions;
+
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+/**
+ * Wrapper around {@link ToolItem} to implement {@link ICommonAction}
+ */
+public class ToolItemAction implements ICommonAction {
+ public ToolItem item;
+
+ public ToolItemAction(ToolBar parent, int style) {
+ item = new ToolItem(parent, style);
+ }
+
+ /**
+ * Sets the enabled state of this action.
+ * @param enabled <code>true</code> to enable, and
+ * <code>false</code> to disable
+ * @see ICommonAction#setChecked(boolean)
+ */
+ public void setChecked(boolean checked) {
+ item.setSelection(checked);
+ }
+
+ /**
+ * Sets the enabled state of this action.
+ * @param enabled <code>true</code> to enable, and
+ * <code>false</code> to disable
+ * @see ICommonAction#setEnabled(boolean)
+ */
+ public void setEnabled(boolean enabled) {
+ item.setEnabled(enabled);
+ }
+
+ /**
+ * Sets the {@link Runnable} that will be executed when the action is triggered (through
+ * {@link SelectionListener#widgetSelected(SelectionEvent)} on the wrapped {@link ToolItem}).
+ * @see ICommonAction#setRunnable(Runnable)
+ */
+ public void setRunnable(final Runnable runnable) {
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ runnable.run();
+ }
+ });
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/console/DdmConsole.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/console/DdmConsole.java
new file mode 100644
index 000000000..1281dd937
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/console/DdmConsole.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib.console;
+
+
+/**
+ * Static Console used to ouput messages. By default outputs the message to System.out and
+ * System.err, but can receive a IDdmConsole object which will actually do something.
+ */
+public class DdmConsole {
+
+ private static IDdmConsole mConsole;
+
+ /**
+ * Prints a message to the android console.
+ * @param message the message to print
+ * @param forceDisplay if true, this force the console to be displayed.
+ */
+ public static void printErrorToConsole(String message) {
+ if (mConsole != null) {
+ mConsole.printErrorToConsole(message);
+ } else {
+ System.err.println(message);
+ }
+ }
+
+ /**
+ * Prints several messages to the android console.
+ * @param messages the messages to print
+ * @param forceDisplay if true, this force the console to be displayed.
+ */
+ public static void printErrorToConsole(String[] messages) {
+ if (mConsole != null) {
+ mConsole.printErrorToConsole(messages);
+ } else {
+ for (String message : messages) {
+ System.err.println(message);
+ }
+ }
+ }
+
+ /**
+ * Prints a message to the android console.
+ * @param message the message to print
+ * @param forceDisplay if true, this force the console to be displayed.
+ */
+ public static void printToConsole(String message) {
+ if (mConsole != null) {
+ mConsole.printToConsole(message);
+ } else {
+ System.out.println(message);
+ }
+ }
+
+ /**
+ * Prints several messages to the android console.
+ * @param messages the messages to print
+ * @param forceDisplay if true, this force the console to be displayed.
+ */
+ public static void printToConsole(String[] messages) {
+ if (mConsole != null) {
+ mConsole.printToConsole(messages);
+ } else {
+ for (String message : messages) {
+ System.out.println(message);
+ }
+ }
+ }
+
+ /**
+ * Sets a IDdmConsole to override the default behavior of the console
+ * @param console The new IDdmConsole
+ * **/
+ public static void setConsole(IDdmConsole console) {
+ mConsole = console;
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/console/IDdmConsole.java b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/console/IDdmConsole.java
new file mode 100644
index 000000000..7de8bd11b
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ddmuilib/console/IDdmConsole.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package org.tizen.common.connection.ddmuilib.console;
+
+
+/**
+ * DDMS console interface.
+ */
+public interface IDdmConsole {
+ /**
+ * Prints a message to the android console.
+ * @param message the message to print
+ */
+ public void printErrorToConsole(String message);
+
+ /**
+ * Prints several messages to the android console.
+ * @param messages the messages to print
+ */
+ public void printErrorToConsole(String[] messages);
+
+ /**
+ * Prints a message to the android console.
+ * @param message the message to print
+ */
+ public void printToConsole(String message);
+
+ /**
+ * Prints several messages to the android console.
+ * @param messages the messages to print
+ */
+ public void printToConsole(String[] messages);
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/DebugTool.java b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/DebugTool.java
new file mode 100644
index 000000000..6ed16fdbb
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/DebugTool.java
@@ -0,0 +1,85 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* YoonKi Park <yoonki.park@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.common.connection.debugtools;
+
+import org.tizen.common.properties.InstallPathConfig;
+
+public class DebugTool {
+ public static final String CONTROL_EXTENSION = ".control";
+ public static final String TOOLS_TARGET_PATH = "/home/developer/sdk_tools";
+ public static final String TOOLS_HOST_PATH = InstallPathConfig.getSDKPath();
+
+ private String binaryname;
+ private String packagename;
+ private String sourcepath;
+ private String architecture;
+ private String description;
+ private String version;
+
+ public DebugTool() {
+
+ }
+ public String getBinaryname() {
+ return binaryname;
+ }
+ public String getControlFile() {
+ return "." + this.packagename + CONTROL_EXTENSION;
+ }
+ public String getVersion() {
+ return version;
+ }
+ public void setVersion(String pVersion) {
+ version = pVersion;
+ }
+ public void setBinaryname(String pBinaryname) {
+ binaryname = pBinaryname;
+ }
+ public String getPackagename() {
+ return packagename;
+ }
+ public void setPackagename(String pPackagename) {
+ packagename = pPackagename;
+ }
+ public String getSourcepath() {
+ return sourcepath;
+ }
+ public void setSourcepath(String pSourcepath) {
+ sourcepath = pSourcepath;
+ }
+ public String getArchitecture() {
+ return architecture;
+ }
+ public void setArchitecture(String pArchitecture) {
+ architecture = pArchitecture;
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String pDescription) {
+ description = pDescription;
+ }
+
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java
new file mode 100644
index 000000000..144e688f8
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java
@@ -0,0 +1,321 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* YoonKi Park <yoonki.park@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.common.connection.debugtools;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.log.Logger;
+
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.SdbCommandRejectedException;
+import org.tizen.sdblib.SdbShellProcess;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.SyncResult;
+import org.tizen.sdblib.TimeoutException;
+
+class PackageInstallMonitorDialog extends ProgressMonitorDialog {
+ public PackageInstallMonitorDialog(Shell parent) {
+ super(parent);
+ int shellStyle = getShellStyle();
+ shellStyle &= ~SWT.APPLICATION_MODAL;
+ setShellStyle(shellStyle);
+ }
+}
+
+class InstallProgress implements IRunnableWithProgress {
+
+ private static final String CMD_RESULT_CHECK = "; echo $?";
+
+ private IDevice device = null;
+
+ IProgressMonitor monitor = null;
+
+ private boolean checkDirectory(String dir) throws CoreException {
+ String cmd = "ls " + dir + CMD_RESULT_CHECK;
+ return checkExitCode(cmd, ToolsInstallMessages.CANNOT_CHECK_DIRECTORY);
+ }
+
+
+ private void makeDirectory(String dir) throws CoreException {
+ String cmd = "mkdir -p -m 755 " + dir + CMD_RESULT_CHECK ;
+ String msg = ToolsInstallMessages.CANNOT_CREATE_DIRECTORY;
+
+ if (checkExitCode(cmd, msg) == false)
+ installCoreException(msg, null);
+ }
+
+ private boolean checkExitCode( String cmd, String msg ) throws CoreException
+ {
+ boolean result = false;
+ SdbShellProcess lsProc;
+ BufferedReader br = null;
+ try {
+ lsProc = device.executeShellCommand(cmd);
+ br = new BufferedReader(new InputStreamReader(
+ lsProc.getInputStream()));
+ String lsOut = null;
+ while (null != (lsOut = br.readLine())) {
+ if ("0".equals(lsOut)) {
+ result = true;
+ break;
+ }
+ }
+ } catch (IOException e) {
+ installCoreException(msg, e);
+ Logger.error(msg, e);
+ }finally
+ {
+ if( br != null )
+ try {
+ br.close();
+ } catch (IOException e) {
+ Logger.error("Error to close BufferedReader", e);
+ }
+ }
+ return result;
+ }
+
+ private boolean isInstalled(DebugTool dt) throws CoreException {
+ boolean ret = false;
+ BufferedReader br = null;
+ try {
+
+ SdbShellProcess echoProc = device.executeShellCommand(
+ "cat " + DebugTool.TOOLS_TARGET_PATH + "/" + dt.getControlFile() + CMD_RESULT_CHECK);
+ br = new BufferedReader(new InputStreamReader(
+ echoProc.getInputStream()));
+
+ String lsOut = null;
+ String oldVersion = null;
+ while (null != (lsOut = br.readLine())) {
+ //version:0.0.0
+ if (lsOut.toLowerCase().startsWith("version:")) {
+ oldVersion = lsOut.split(":")[1];
+ }
+
+ if ("0".equals(lsOut)) {
+ String v1 = normalisedVersion(oldVersion, ".", 4);
+ String v2 = normalisedVersion(dt.getVersion(), ".", 4);
+ if (v2.compareTo(v1) > 0) {
+ //TODO : do install and save!
+ ret = false;
+ } else { //same version
+ ret = true;
+ }
+ break;
+ } else
+ ret = false;
+ }
+ } catch (IOException e) {
+ installCoreException(ToolsInstallMessages.CANNOT_CHECK_INSTALLED, e);
+ Logger.error(ToolsInstallMessages.CANNOT_CHECK_INSTALLED, e);
+ } finally {
+ if(br != null)
+ try {
+ br.close();
+ } catch (IOException e) {
+ Logger.error("Error to close BufferedReader", e);
+ }
+ }
+ return ret;
+
+ }
+ private String normalisedVersion(String version, String sep, int maxWidth) {
+ String[] split = Pattern.compile(sep, Pattern.LITERAL).split(version);
+ StringBuilder sb = new StringBuilder();
+ for (String s : split) {
+ sb.append(String.format("%" + maxWidth + 's', s));
+ }
+ return sb.toString();
+ }
+
+ private boolean copyPackage(String source, String destination) {
+ boolean pushResult = false;
+ try {
+ SyncService syncService = device.getSyncService();
+ SyncResult pushSyncResult = syncService.pushFile(source, destination,
+ SyncService.getNullProgressMonitor());
+ if (SyncService.RESULT_OK == pushSyncResult.getCode()) {
+ pushResult = true;
+ }
+ } catch (TimeoutException e) {
+ return false;
+ } catch (SdbCommandRejectedException e) {
+ return false;
+ } catch (IOException e) {
+ return false;
+ }
+ return pushResult;
+ }
+
+ private final void installPackage(DebugTool tool) throws CoreException {
+ String local = DebugTool.TOOLS_HOST_PATH + "/" + tool.getSourcepath() + "/" + tool.getBinaryname();
+ String remote = DebugTool.TOOLS_TARGET_PATH + "/" + tool.getBinaryname();
+
+ // delete old version
+ try {
+ device.executeShellCommand(
+ "cd " + DebugTool.TOOLS_TARGET_PATH + " && rm " + tool.getControlFile());
+ } catch (IOException e) {
+ installCoreException(ToolsInstallMessages.CANNOT_REMOVE_CONTROLFILE, e);
+ Logger.error(ToolsInstallMessages.CANNOT_REMOVE_CONTROLFILE, e);
+ }
+
+
+ boolean isCopied = copyPackage(local, remote);
+ monitor.worked(5);
+ if (isCopied) {
+ try {
+ device.executeShellCommand("rm -rf " + DebugTool.TOOLS_TARGET_PATH + "/" + tool.getPackagename() + ";"
+ + "cd " + DebugTool.TOOLS_TARGET_PATH + " && tar -xzf " + tool.getBinaryname() + ";"
+ + "echo 'version:" + tool.getVersion() + "' >" + DebugTool.TOOLS_TARGET_PATH + "/" + tool.getControlFile() + ";"
+ + "cd " + DebugTool.TOOLS_TARGET_PATH + " && rm " + tool.getBinaryname());
+ } catch (IOException e) {
+ Logger.error("Error after copied " + tool.getPackagename() , e);
+ }
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor pMonitor) throws InvocationTargetException, InterruptedException {
+ final List<DebugTool> debugTools = ConnectionPlugin.getDebugTools(device);
+
+ if (debugTools == null || debugTools.size() == 0)
+ return;
+ boolean isInstalled = false;
+ for (int i = 0; i < debugTools.size(); i++) {
+ DebugTool dt = (DebugTool) debugTools.get(i);
+ try {
+ isInstalled = isInstalled(dt);
+ } catch (CoreException e) {
+ Logger.error("Error to check installed", e);
+ }
+ if (isInstalled == false)
+ break;
+ }
+ if (isInstalled)
+ return;
+
+ this.monitor = pMonitor;
+
+ pMonitor.beginTask(ToolsInstallMessages.DIALOG_INITILIZE, 100);
+ //monitor.subTask("Prepare install");
+
+ // check directory exist
+ try {
+ if (!checkDirectory(DebugTool.TOOLS_TARGET_PATH))
+ makeDirectory(DebugTool.TOOLS_TARGET_PATH);
+ } catch (CoreException e) {
+ Logger.error("Error to check or make directory", e);
+ }
+
+ pMonitor.worked(10);
+
+ // get package list to install
+
+ pMonitor.worked(15);
+
+ // install loop (cp, tar)
+ for (int i=0 ; i<debugTools.size(); i++) {
+ final DebugTool dt = (DebugTool)debugTools.get(i);
+
+ if (device.isEmulator()) {
+ if (!dt.getArchitecture().equals("i386"))
+ continue;
+ }
+ else {
+ if (!dt.getArchitecture().equals("armel"))
+ continue;
+ }
+ Thread thread = new Thread(null, new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ installPackage(dt);
+ } catch (CoreException e) {
+ Logger.error("Error to install tools", e);
+ }
+ }
+ }, "package check and install");
+ thread.start();
+ }
+ pMonitor.done();
+ }
+
+ public void setDevice(IDevice pDevice) {
+ device = pDevice;
+ }
+
+ private void installCoreException(String message, Throwable exception) throws CoreException {
+ Status status = new Status(Status.ERROR, ConnectionPlugin.PLUGIN_ID, message, exception);
+ throw new CoreException(status);
+ }
+}
+
+public class ToolsInstall {
+
+ public static void installPackages(IDevice device) {
+ final IDevice tDevice = device;
+
+ if (tDevice.isOffline()) {
+ return;
+ }
+
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ final PackageInstallMonitorDialog installDialog = new PackageInstallMonitorDialog(
+ Display.getDefault().getActiveShell());
+ try {
+ InstallProgress installProgress = new InstallProgress();
+ installProgress.setDevice(tDevice);
+ installDialog.run(true, false, installProgress);
+ } catch (InvocationTargetException e) {
+ return;
+ } catch (InterruptedException e) {
+ return;
+ }
+ }
+ });
+
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.java b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.java
new file mode 100644
index 000000000..a81a712e0
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.java
@@ -0,0 +1,43 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* YoonKi Park <yoonki.park@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.common.connection.debugtools;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ToolsInstallMessages extends NLS {
+
+ static {
+ NLS.initializeMessages(ToolsInstallMessages.class.getName(), ToolsInstallMessages.class);
+ }
+
+ public static String DIALOG_INITILIZE;
+ public static String CANNOT_CREATE_DIRECTORY;
+ public static String CANNOT_CHECK_DIRECTORY;
+ public static String CANNOT_CHECK_INSTALLED;
+ public static String CANNOT_COPY_FILE;
+ public static String CANNOT_REMOVE_CONTROLFILE;
+
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.properties b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.properties
new file mode 100644
index 000000000..5d8397958
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.properties
@@ -0,0 +1,8 @@
+
+DIALOG_INITILIZE=Connection Explorer is initializing now. It might take few minutes.
+CANNOT_CREATE_DIRECTORY=Cannot create sdk tools directory
+CANNOT_CHECK_DIRECTORY=Cannot check sdk tools directory
+CANNOT_CHECK_INSTALLED=Cannot check installed tools
+CANNOT_COPY_FILE=Cannot copy file
+CANNOT_REMOVE_CONTROLFILE=Cannot copy file
+
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerContentProvider.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerContentProvider.java
new file mode 100644
index 000000000..4aa5e2d27
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerContentProvider.java
@@ -0,0 +1,152 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.explorer;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Tree;
+
+import org.tizen.sdblib.FileListingService;
+import org.tizen.sdblib.FileListingService.FileEntry;
+import org.tizen.sdblib.FileListingService.IListingReceiver;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.SmartDevelopmentBridge;
+
+public class ConnectionExplorerContentProvider implements ITreeContentProvider {
+
+ private TreeViewer viewer;
+ private FileEntry rootEntry;
+
+ private IListingReceiver listingReceiver = new IListingReceiver() {
+ public void setChildren(final FileEntry entry, FileEntry[] children) {
+ final Tree t = viewer.getTree();
+ if (t != null && t.isDisposed() == false) {
+ Display display = t.getDisplay();
+ if (display.isDisposed() == false) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if (t.isDisposed() == false) {
+ // refresh the entry.
+ viewer.refresh(entry);
+ viewer.setExpandedState(entry, true);
+ }
+ }
+ });
+ }
+ }
+ }
+
+ public void refreshEntry(final FileEntry entry) {
+ final Tree t = viewer.getTree();
+ if (t != null && t.isDisposed() == false) {
+ Display display = t.getDisplay();
+ if (display.isDisposed() == false) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if (t.isDisposed() == false) {
+ // refresh the entry.
+ viewer.refresh(entry);
+ }
+ }
+ });
+ }
+ }
+ }
+ };
+
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer pViewer, Object pOldInput, Object pNewInput) {
+ if (pViewer instanceof TreeViewer) {
+ viewer = (TreeViewer) pViewer;
+ }
+ if (pNewInput instanceof FileEntry) {
+ rootEntry = (FileEntry) pNewInput;
+ }
+ }
+
+ @Override
+ public Object[] getChildren(Object arg0) {
+ if (arg0 instanceof FileEntry) {
+ FileEntry parentEntry = (FileEntry) arg0;
+
+ Object[] oldEntries = parentEntry.getCachedChildren();
+ Object[] newEntries = parentEntry.getFileListingService().getChildren(parentEntry,
+ true, listingReceiver);
+
+ if (newEntries != null) {
+ return newEntries;
+ } else {
+ return oldEntries;
+ }
+ }
+ return new Object[0];
+ }
+
+ @Override
+ public Object[] getElements(Object arg0) {
+ IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices();
+ FileEntry[] entries = new FileEntry[ devices.length ];
+ for (int i = 0; i < devices.length; i++) {
+ entries[i] = devices[i].getFileListingService().getRoot();
+ }
+ return entries;
+ }
+
+ @Override
+ public Object getParent(Object arg0) {
+ if (arg0 instanceof FileEntry) {
+ FileEntry entry = (FileEntry) arg0;
+
+ return entry.getParent();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(Object arg0) {
+ if (arg0 instanceof FileEntry) {
+ FileEntry entry = (FileEntry) arg0;
+ if (entry.getType() == FileListingService.TYPE_DIRECTORY_LINK)
+ return true;
+ else if (entry.getType() == FileListingService.TYPE_LINK)
+ return true;
+ else if (entry.getType() == FileListingService.TYPE_DIRECTORY)
+ return true;
+ else if (entry.getType() == FileListingService.TYPE_ROOT_EMULATOR)
+ return true;
+ else if (entry.getType() == FileListingService.TYPE_ROOT_DEVICE)
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerLabelProvider.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerLabelProvider.java
new file mode 100644
index 000000000..3b8c5ca14
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerLabelProvider.java
@@ -0,0 +1,124 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.explorer;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.common.connection.ddmuilib.ImageLoader;
+
+import org.tizen.sdblib.FileListingService;
+import org.tizen.sdblib.FileListingService.FileEntry;
+import org.tizen.sdblib.IDevice;
+
+public class ConnectionExplorerLabelProvider implements ITableLabelProvider {
+
+ private Image fileImage;
+ private Image folderImage;
+ private Image fileLinkImage;
+ private Image folderLinkImage;
+ private Image otherImage;
+ private Image emulatorImage;
+ private Image deviceImage;
+ public static int index;
+
+ public ConnectionExplorerLabelProvider(Display display) {
+ ImageLoader loader = ImageLoader.getDdmUiLibLoader();
+
+ fileImage = loader.loadImage("file.gif", display);
+ folderImage = loader.loadImage("directory.gif", display);
+ fileLinkImage = loader.loadImage("file_link.gif", display);
+ folderLinkImage = loader.loadImage("directory_link.gif", display);
+ otherImage = loader.loadImage("file.gif", display);
+ emulatorImage = loader.loadImage("emulator.gif", display);
+ deviceImage = loader.loadImage("device.gif", display);
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ if (element instanceof FileEntry) {
+ FileEntry entry = (FileEntry) element;
+ switch (entry.getType()) {
+ case FileListingService.TYPE_FILE:
+ return fileImage;
+ case FileListingService.TYPE_LINK:
+ return fileLinkImage;
+ case FileListingService.TYPE_DIRECTORY:
+ return folderImage;
+ case FileListingService.TYPE_DIRECTORY_LINK:
+ return folderLinkImage;
+ case FileListingService.TYPE_ROOT_EMULATOR:
+ return emulatorImage;
+ case FileListingService.TYPE_ROOT_DEVICE:
+ return deviceImage;
+ default:
+ return null;
+ }
+ }
+
+ return otherImage;
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof FileEntry) {
+ FileEntry entry = (FileEntry) element;
+
+ switch (columnIndex) {
+ case 0:
+ return entry.getName();
+ default:
+ return null;
+ }
+ } else if (element instanceof IDevice) {
+ IDevice device = (IDevice) element;
+ return device.getSerialNumber();
+ }
+ return null;
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerPanel.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerPanel.java
new file mode 100644
index 000000000..3f72e4746
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/ConnectionExplorerPanel.java
@@ -0,0 +1,1118 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.explorer;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.part.PluginTransfer;
+import org.eclipse.ui.part.PluginTransferData;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.connection.ConnectionPlugin.ISelectionListener;
+import org.tizen.common.connection.ddmuilib.DdmUiPreferences;
+import org.tizen.common.connection.ddmuilib.FileDialogUtils;
+import org.tizen.common.connection.ddmuilib.Panel;
+import org.tizen.common.connection.ddmuilib.SyncProgressMonitor;
+import org.tizen.common.connection.ddmuilib.TableHelper;
+import org.tizen.common.connection.ddmuilib.console.DdmConsole;
+import org.tizen.common.connection.debugtools.ToolsInstall;
+import org.tizen.common.connection.sdblib.dnd.FileEntryTransfer;
+import org.tizen.common.console.AnsicodeAdapter;
+import org.tizen.common.log.Logger;
+
+import org.tizen.sdblib.FileListingService;
+import org.tizen.sdblib.FileListingService.FileEntry;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.MultiLineReceiver;
+import org.tizen.sdblib.SmartDevelopmentBridge;
+import org.tizen.sdblib.SmartDevelopmentBridge.IDebugBridgeChangeListener;
+import org.tizen.sdblib.SmartDevelopmentBridge.IDeviceChangeListener;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.ISyncProgressMonitor;
+import org.tizen.sdblib.SyncService.SyncResult;
+
+public class ConnectionExplorerPanel extends Panel
+ implements
+ IDeviceChangeListener,
+ IDebugBridgeChangeListener,
+ ISelectionListener {
+
+ private static final String DRAGACTIONID = "org.tizen.common.connection.filedrop";
+ private static final String INVALID_FOR_FILENAME = ";";
+
+ private static final String COLUMN_NAME = "name"; //$NON-NLS-1S
+ private static final String CMD_RESULT_CHECK = "; echo $?";
+
+ private Composite parent;
+ private TreeViewer treeViewer;
+ private Tree tree;
+ private ConnectionExplorerContentProvider mContentProvider;
+
+ private ToolItem pushToolItem;
+ private ToolItem pullToolItem;
+ private ToolItem emulStartToolItem;
+
+ private MenuManager subMenu;
+ private Action actionPush;
+ private Action actionPull;
+ private Action actionRefresh;
+ private Action actionRename;
+ private Action actionProperty;
+ private Action actionDelete;
+
+ private IDevice mCurrentDevice;
+
+ private String defaultSave;
+ // only use on linux system
+ private static final String PATH_SEPARATOR = "/";
+
+ private final ArrayList<IDevice> devicesToExpand = new ArrayList<IDevice>();
+ private final ArrayList<IDevice> devicesList = new ArrayList<IDevice>();
+ private FileEntry currentFileEntry;
+
+ public ConnectionExplorerPanel() {
+ }
+
+
+ @Override
+ protected Control createControl(Composite pParent) {
+ parent = pParent;
+ parent.setLayout(new FillLayout());
+
+ tree = new Tree(parent, SWT.MULTI | SWT.FULL_SELECTION);
+ tree.setHeaderVisible(true);
+
+ IPreferenceStore store = DdmUiPreferences.getStore();
+
+ TableHelper.createTreeColumn(tree, "FileEntry", SWT.LEFT,
+ "abcdefghijklmnopqrstuvwzabcdefghijk", COLUMN_NAME, store); //$NON-NLS-1$
+ tree.setHeaderVisible(true);
+
+ treeViewer = new TreeViewer(tree);
+ mContentProvider = new ConnectionExplorerContentProvider();
+ treeViewer.setContentProvider(mContentProvider);
+ treeViewer.setLabelProvider(new ConnectionExplorerLabelProvider(
+ parent.getDisplay()));
+
+ tree.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ notifyListeners();
+ }
+ });
+
+ // setup drag listener
+ treeViewer.addDragSupport(
+ DND.DROP_MOVE | DND.DROP_COPY,
+ new Transfer[]{PluginTransfer.getInstance(),
+ FileEntryTransfer.getInstance()},
+ new DragSourceListener() {
+
+ @Override
+ public void dragStart(DragSourceEvent e) {
+
+ TreeItem[] items = tree.getSelection();
+
+ for (int i = 0; i < items.length; i++) {
+ Object data = items[i].getData();
+ if (data instanceof FileEntry) {
+ if (((FileEntry) data).isDirectory() == true || ((FileEntry) data).isRoot() == true) {
+ e.doit = false;
+ return;
+ }
+ }
+ }
+ e.doit = true;
+ }
+ @Override
+ public void dragFinished(DragSourceEvent arg0) {
+
+ }
+
+ @Override
+ public void dragSetData(DragSourceEvent e) {
+ // get the selection
+ TreeItem[] items = tree.getSelection();
+ FileEntry[] entries = new FileEntry[items.length];
+
+ for (int i = 0; i < items.length; i++) {
+ Object data = items[i].getData();
+ if (data instanceof FileEntry) {
+ entries[i] = ((FileEntry) data);
+ }
+ }
+
+ if (FileEntryTransfer.getInstance().isSupportedType(
+ e.dataType)) {
+ e.data = entries;
+ } else if (PluginTransfer.getInstance()
+ .isSupportedType(e.dataType)) {
+ byte[] data = FileEntryTransfer.getInstance()
+ .toByteArray(entries);
+ e.data = new PluginTransferData(DRAGACTIONID, data);
+ }
+
+ }
+ });
+
+ // setup drop listener
+ treeViewer.addDropSupport(DND.DROP_COPY | DND.DROP_MOVE,
+ new Transfer[]{FileTransfer.getInstance()},
+ new ViewerDropAdapter(treeViewer) {
+ @Override
+ public boolean performDrop(Object data) {
+ // get the item on which we dropped the item(s)
+ FileEntry target = (FileEntry) getCurrentTarget();
+
+ // in case we drop at the same level as root
+ if (target == null) {
+ return false;
+ }
+
+ // if the target is not a directory, we get the parent
+ // directory
+ if (target.isDirectory() == false) {
+ target = target.getParent();
+ }
+
+ if (target == null) {
+ return false;
+ }
+
+ // get the list of files to drop
+ String[] files = (String[]) data;
+
+ // do the drop
+ pushFiles(files, target);
+
+ // we need to finish with a refresh
+ refresh(target);
+
+ return true;
+ }
+
+ @Override
+ public boolean validateDrop(Object target, int operation,
+ TransferData transferType) {
+ if (target == null) {
+ return false;
+ }
+
+ // convert to the real item
+ FileEntry targetEntry = (FileEntry) target;
+
+ // if the target is not a directory, we get the parent
+ // directory
+ if (targetEntry.isDirectory() == false) {
+ target = targetEntry.getParent();
+ }
+
+ if (target == null) {
+ return false;
+ }
+
+ return true;
+ }
+ });
+
+ return tree;
+ }
+
+ public void setToolItems(ToolItem push, ToolItem pull, ToolItem start) {
+ pushToolItem = push;
+ pullToolItem = pull;
+ emulStartToolItem = start;
+ }
+
+ public void setActions(MenuManager pSubMenu, Action pActionPush, Action pActionPull, Action pActionRefresh,
+ Action pActionRename, Action pActionProperty, Action pActionDelete) {
+ this.subMenu = pSubMenu;
+ this.actionPush = pActionPush;
+ this.actionPull = pActionPull;
+ this.actionRefresh = pActionRefresh;
+ this.actionRename = pActionRename;
+ this.actionProperty = pActionProperty;
+ this.actionDelete = pActionDelete;
+ }
+
+ @Override
+ protected void postCreation() {
+ ConnectionPlugin.getDefault().addSelectionListener(this);
+ SmartDevelopmentBridge sdbBridge = SmartDevelopmentBridge.getBridge();
+ SmartDevelopmentBridge.addDebugBridgeChangeListener(this);
+ SmartDevelopmentBridge.addDeviceChangeListener(this);
+
+ IDevice[] devices = null;
+ if (sdbBridge != null) {
+ devices = sdbBridge.getDevices();
+ }
+ if (devices != null && devices.length != 0) {
+ for (IDevice device : devices) {
+ this.deviceConnected(device);
+ }
+ }
+ }
+
+ /**
+ * Sets the focus to the proper control inside the panel.
+ */
+ @Override
+ public void setFocus() {
+ tree.setFocus();
+ }
+
+ /**
+ * Pull the current selection on the local drive. This method displays a
+ * dialog box to let the user select where to store the file(s) and
+ * folder(s).
+ */
+ public void pullSelection() {
+ // get the selection
+ TreeItem[] items = tree.getSelection();
+
+ // name of the single file pull, or null if we're pulling a directory
+ // or more than one object.
+ String filePullName = null;
+ FileEntry singleEntry = null;
+
+ //Pull the single file
+ if (items.length == 1) {
+ singleEntry = (FileEntry) items[0].getData();
+ if (singleEntry.getType() == FileListingService.TYPE_FILE) {
+ filePullName = singleEntry.getName();
+ }
+ }
+
+ // where do we save by default?
+ String defaultPath = defaultSave;
+ if (defaultPath == null) {
+ defaultPath = System.getProperty("user.home"); //$NON-NLS-1$
+ }
+
+ if (filePullName != null) {
+ FileDialog fileDialog = new FileDialog(parent.getShell(), SWT.SAVE);
+
+ fileDialog.setText("Pull the Selection");
+ fileDialog.setFileName(filePullName);
+ fileDialog.setFilterPath(defaultPath);
+
+ String fileName = fileDialog.open();
+ if (fileName != null) {
+ defaultSave = fileDialog.getFilterPath();
+
+ pullFile(singleEntry, fileName);
+ }
+ } else {
+ DirectoryDialog directoryDialog = new DirectoryDialog(
+ parent.getShell(), SWT.SAVE);
+
+ directoryDialog.setText("Pull the Selection");
+ directoryDialog.setFilterPath(defaultPath);
+
+ String directoryName = directoryDialog.open();
+ if (directoryName != null) {
+ pullSelection(items, directoryName);
+ }
+ }
+ }
+
+ /**
+ * Push new file(s) and folder(s) into the current selection. Current
+ * selection must be single item. If the current selection is not a
+ * directory, the ` directory is used. This method displays a dialog to
+ * let the user choose file to push to the device.
+ */
+ public void pushIntoSelection() {
+ // get the name of the object we're going to pull
+ TreeItem[] items = tree.getSelection();
+
+ if (items.length == 0) {
+ return;
+ }
+
+ FileDialog dlg = new FileDialog(parent.getShell(), SWT.OPEN);
+ String fileName;
+
+ dlg.setText("Push the Files");
+
+ // There should be only one.
+ FileEntry entry = (FileEntry) items[0].getData();
+
+ String defaultPath = defaultSave;
+ if (defaultPath == null) {
+ defaultPath = System.getProperty("user.home"); //$NON-NLS-1$
+ }
+ dlg.setFilterPath(defaultPath);
+
+ fileName = dlg.open();
+ if (fileName != null) {
+ defaultSave = dlg.getFilterPath();
+
+ // we need to figure out the remote path based on the current
+ // selection type.
+ String remotePath;
+ FileEntry toRefresh = entry;
+ if (entry.isDirectory() || entry.isRoot()) {
+ remotePath = entry.getFullPath();
+ } else {
+ toRefresh = entry.getParent();
+ remotePath = toRefresh.getFullPath();
+ }
+
+ pushFile(fileName, remotePath);
+ treeViewer.refresh(toRefresh);
+ }
+ }
+
+ public void addNewFileSelection() {
+ InputDialog addNewDialog = new InputDialog(Display.getCurrent()
+ .getActiveShell(), "New File Resource", "New File Name: ", "",
+ new FileNameValidator());
+ if (addNewDialog.open() != Window.OK)
+ return;
+
+ String fullPath = currentFileEntry.getFullPath();
+
+ TreeItem[] items = tree.getSelection();
+
+ if (items.length != 1) {
+ return;
+ }
+
+ final FileEntry parentEntry = ((FileEntry) items[0].getData())
+ .getParent();
+ // create the touch command
+ String command = "touch " + fullPath + PATH_SEPARATOR + addNewDialog.getValue() + CMD_RESULT_CHECK; //$NON-NLS-1$
+
+ try {
+ mCurrentDevice.executeShellCommand(command,
+ new MultiLineReceiver() {
+
+ @Override
+ public void processNewLines(String[] lines) {
+ if(!lines[lines.length - 1].contains("0"))
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String line : lines) {
+ line = AnsicodeAdapter.getStripAnsiString(line);
+ sb.append(line);
+
+ }
+ Status status = new Status(IStatus.ERROR, "Add File Failed", 0,
+ sb.toString() , null);
+ ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Add File Failed", "A file failed to be added", status);
+
+
+ }
+ }
+ });
+ } catch (IOException e) {
+ Logger.error("failed to do add new file", e);
+ throw new RuntimeException(e);
+ }
+ refresh(parentEntry);
+ }
+
+ public void addNewFolderSelection() {
+ InputDialog addNewDialog = new InputDialog(Display.getCurrent()
+ .getActiveShell(), "New Folder Resource", "New Folder Name: ",
+ "", null);
+ if (addNewDialog.open() != Window.OK)
+ return;
+ String fullPath = currentFileEntry.getFullPath();
+
+ TreeItem[] items = tree.getSelection();
+
+ if (items.length != 1) {
+ return;
+ }
+
+ final FileEntry parentEntry = ((FileEntry) items[0].getData())
+ .getParent();
+ // create the mkdir command
+ String command = "mkdir " + fullPath + PATH_SEPARATOR + addNewDialog.getValue() + CMD_RESULT_CHECK; //$NON-NLS-1$
+ try {
+ mCurrentDevice.executeShellCommand(command,
+ new MultiLineReceiver() {
+
+ @Override
+ public void processNewLines(String[] lines) {
+ if(!lines[lines.length - 1].contains("0"))
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String line : lines) {
+ line = AnsicodeAdapter.getStripAnsiString(line);
+ sb.append(line);
+
+ }
+ Status status = new Status(IStatus.ERROR, "Add Folder Failed", 0,
+ sb.toString() , null);
+ ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Add Folder Failed", "A folder failed to be added", status);
+ }
+ }
+ });
+ } catch (IOException e) {
+ Logger.error("failed to do add new folder", e);
+ throw new RuntimeException(e);
+ }
+ refresh(parentEntry);
+ }
+
+ public void renameSelection() {
+ InputDialog renameDialog = new InputDialog(Display.getCurrent()
+ .getActiveShell(), "Rename Resource", "New name: ",
+ currentFileEntry.getName(), new FileNameValidator());
+ if (renameDialog.open() != Window.OK)
+ return;
+
+ String fullPath = currentFileEntry.getFullPath();
+ int lastIndex = fullPath.lastIndexOf(PATH_SEPARATOR);
+ String newPath = fullPath.substring(0, lastIndex) + PATH_SEPARATOR + renameDialog.getValue();
+
+ TreeItem[] items = tree.getSelection();
+
+ if (items.length != 1) {
+ return;
+ }
+
+ final FileEntry parentEntry = ((FileEntry) items[0].getData())
+ .getParent();
+ // create the mv command
+ String command = "mv " + fullPath + " " + newPath + CMD_RESULT_CHECK; //$NON-NLS-1$
+
+ try {
+ mCurrentDevice.executeShellCommand(command,
+ new MultiLineReceiver() {
+
+ @Override
+ public void processNewLines(String[] lines) {
+ if(!lines[lines.length - 1].contains("0"))
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String line : lines) {
+ line = AnsicodeAdapter.getStripAnsiString(line);
+ sb.append(line);
+
+ }
+ Status status = new Status(IStatus.ERROR, "Rename failed", 0,
+ sb.toString() , null);
+ ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Rename failed", "A selection failed to be renamed",status);
+ }
+ }
+ });
+ } catch (IOException e) {
+ Logger.error("failed to do rename", e);
+ throw new RuntimeException(e);
+ }
+ refresh(parentEntry);
+ }
+
+ public void deleteSelection() {
+ int ret = FileDialogUtils.getInstance().confirmDelete(
+ currentFileEntry.getName());
+ if (ret == IDialogConstants.CANCEL_ID)
+ return;
+
+ TreeItem[] items = tree.getSelection();
+
+ for (TreeItem item : items) {
+ final FileEntry entry = (FileEntry) item.getData();
+ String command = null;
+ // create the delete command
+ if (entry.isDirectory()) {
+ command = "rm -rf " + entry.getFullEscapedPath() + CMD_RESULT_CHECK; //$NON-NLS-1$
+ } else {
+ command = "rm " + entry.getFullEscapedPath() + CMD_RESULT_CHECK; //$NON-NLS-1$
+ }
+
+ try {
+ mCurrentDevice.executeShellCommand(command,
+ new MultiLineReceiver() {
+
+ @Override
+ public void processNewLines(String[] lines) {
+ if(!lines[lines.length - 1].contains("0"))
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String line : lines) {
+ line = AnsicodeAdapter.getStripAnsiString(line);
+ sb.append(line);
+ }
+ Status status = new Status(IStatus.ERROR, "Delete Failed", 0,
+ sb.toString() , null);
+ ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Delete failed", "A selection failed to be deleted", status);
+ }
+ }
+ });
+ } catch (IOException e) {
+ Logger.error("failed to do delete", e);
+ throw new RuntimeException(e);
+
+ }
+ refresh(entry.getParent());
+ }
+
+ }
+
+ /**
+ * Force a full refresh of the explorer.
+ */
+ public void refresh() {
+ treeViewer.refresh(true);
+ }
+
+ /**
+ * Sent when a new {@link SmartDevelopmentBridge} is started.
+ * <p/>
+ * This is sent from a non UI thread.
+ *
+ * @param bridge
+ * the new {@link SmartDevelopmentBridge} object.
+ *
+ * @see IDebugBridgeChangeListener#serverChanged(SmartDevelopmentBridge)
+ */
+ public void bridgeChanged(final SmartDevelopmentBridge bridge) {
+ if (tree.isDisposed() == false) {
+ exec(new Runnable() {
+ public void run() {
+ if (tree.isDisposed() == false) {
+ // set up the data source.
+ treeViewer.setInput(bridge);
+
+ } else {
+ // tree is disposed, we need to do something.
+ // lets remove ourselves from the listener.
+ SmartDevelopmentBridge
+ .removeDebugBridgeChangeListener(ConnectionExplorerPanel.this);
+ SmartDevelopmentBridge
+ .removeDeviceChangeListener(ConnectionExplorerPanel.this);
+ }
+ }
+ });
+ }
+
+ // all current devices are obsolete
+ synchronized (devicesToExpand) {
+ devicesToExpand.clear();
+ }
+ }
+
+ /**
+ * Refresh an entry from a non ui thread.
+ *
+ * @param entry
+ * the entry to refresh.
+ */
+ private void refresh(final FileEntry entry) {
+ Display d = treeViewer.getTree().getDisplay();
+ d.asyncExec(new Runnable() {
+ public void run() {
+ treeViewer.refresh(entry);
+ }
+ });
+ }
+ public void refreshSelection() {
+ if (currentFileEntry == null)
+ return;
+ Display d = treeViewer.getTree().getDisplay();
+ d.asyncExec(new Runnable() {
+ public void run() {
+ treeViewer.refresh(currentFileEntry);
+ }
+ });
+ }
+
+ /**
+ * Pulls the selection from a device.
+ *
+ * @param items
+ * the tree selection the remote file on the device
+ * @param localDirector
+ * the local directory in which to save the files.
+ */
+ private void pullSelection(TreeItem[] items, final String localDirectory) {
+ try {
+ final SyncService sync = mCurrentDevice.getSyncService();
+ if (sync != null) {
+ // make a list of the FileEntry.
+ ArrayList<FileEntry> entries = new ArrayList<FileEntry>();
+ for (TreeItem item : items) {
+ Object data = item.getData();
+ if (data instanceof FileEntry) {
+ entries.add((FileEntry) data);
+ }
+ }
+ final FileEntry[] entryArray = entries
+ .toArray(new FileEntry[entries.size()]);
+
+ // get a progress dialog
+ new ProgressMonitorDialog(parent.getShell()).run(true, true,
+ new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ // create a monitor wrapper around the jface
+ // monitor
+ SyncResult result = sync
+ .pull(entryArray,
+ localDirectory,
+ (ISyncProgressMonitor) new SyncProgressMonitor(
+ monitor,
+ "Pulling file(s) from the device"));
+
+ if (result.getCode() != SyncService.RESULT_OK) {
+ DdmConsole.printErrorToConsole(String
+ .format("Failed to pull selection: %1$s",
+ result.getMessage()));
+ }
+ sync.close();
+ }
+ });
+ }
+ } catch (Exception e) {
+ DdmConsole.printErrorToConsole("Failed to pull selection");
+ DdmConsole.printErrorToConsole(e.getMessage());
+ }
+ }
+
+ /**
+ * Pulls a file from a device.
+ *
+ * @param remote
+ * the remote file on the device
+ * @param local
+ * the destination filepath
+ */
+ private void pullFile(final FileEntry remote, final String local) {
+ try {
+ final SyncService sync = mCurrentDevice.getSyncService();
+ if (sync != null) {
+ new ProgressMonitorDialog(parent.getShell()).run(true, true,
+ new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ SyncResult result = sync
+ .pullFile(
+ remote,
+ local,
+ (ISyncProgressMonitor) new SyncProgressMonitor(
+ monitor,
+ String.format(
+ "Pulling %1$s from the device",
+ remote.getName())));
+ if (result.getCode() != SyncService.RESULT_OK) {
+ DdmConsole.printErrorToConsole(String
+ .format("Failed to pull %1$s: %2$s",
+ remote, result.getMessage()));
+ }
+
+ sync.close();
+ }
+ });
+ }
+ } catch (Exception e) {
+ DdmConsole.printErrorToConsole("Failed to pull selection");
+ DdmConsole.printErrorToConsole(e.getMessage());
+ }
+ }
+
+ /**
+ * Pushes several files and directory into a remote directory.
+ *
+ * @param localFiles
+ * @param remoteDirectory
+ */
+ private void pushFiles(final String[] localFiles,
+ final FileEntry remoteDirectory) {
+ try {
+ final SyncService sync = mCurrentDevice.getSyncService();
+ if (sync != null) {
+ new ProgressMonitorDialog(parent.getShell()).run(true, true,
+ new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ SyncResult result = sync
+ .push(localFiles,
+ remoteDirectory,
+ (ISyncProgressMonitor) new SyncProgressMonitor(
+ monitor,
+ "Pushing file(s) to the device"));
+ if (result.getCode() != SyncService.RESULT_OK) {
+ DdmConsole.printErrorToConsole(String
+ .format("Failed to push the items: %1$s",
+ result.getMessage()));
+ }
+
+ sync.close();
+ }
+ });
+ }
+ } catch (Exception e) {
+ DdmConsole.printErrorToConsole("Failed to push the items");
+ DdmConsole.printErrorToConsole(e.getMessage());
+ }
+ }
+
+ /**
+ * Pushes a file on a device.
+ *
+ * @param local
+ * the local file path of the file to push
+ * @param remoteDirectory
+ * the remote destination directory on the device
+ */
+ private void pushFile(final String local, final String remoteDirectory) {
+ try {
+ final SyncService sync = mCurrentDevice.getSyncService();
+ if (sync != null) {
+ new ProgressMonitorDialog(parent.getShell()).run(true, true,
+ new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ // get the file name
+ String[] segs = local.split(Pattern
+ .quote(File.separator));
+ String name = segs[segs.length - 1];
+ String remoteFile = remoteDirectory + FileListingService.FILE_SEPARATOR + name;
+
+ SyncResult result = sync
+ .pushFile(
+ local,
+ remoteFile,
+ (ISyncProgressMonitor) new SyncProgressMonitor(
+ monitor,
+ String.format(
+ "Pushing %1$s to the device.",
+ name)));
+ if (result.getCode() != SyncService.RESULT_OK) {
+ DdmConsole.printErrorToConsole(String
+ .format("Failed to push %1$s on %2$s: %3$s",
+ name, mCurrentDevice
+ .getSerialNumber(),
+ result.getMessage()));
+ }
+
+ sync.close();
+ }
+ });
+ }
+ } catch (Exception e) {
+ DdmConsole.printErrorToConsole("Failed to push the item(s).");
+ DdmConsole.printErrorToConsole(e.getMessage());
+ }
+ }
+
+ /**
+ * Sent when the a device is connected to the {@link SmartDevelopmentBridge}
+ * .
+ * <p/>
+ * This is sent from a non UI thread.
+ *
+ * @param device
+ * the new device.
+ *
+ * @see IDeviceChangeListener#deviceConnected(IDevice)
+ */
+ public void deviceConnected(IDevice device) {
+ if (device.isOffline())
+ return;
+ devicesList.add(device);
+ ToolsInstall.installPackages(device);
+
+ exec(new Runnable() {
+ public void run() {
+ if (tree.isDisposed() == false) {
+ // refresh all
+ treeViewer.refresh();
+
+ // notify the listener of a possible selection change.
+ notifyListeners();
+ } else {
+ // tree is disposed, we need to do something.
+ // lets remove ourselves from the listener.
+ SmartDevelopmentBridge
+ .removeDebugBridgeChangeListener(ConnectionExplorerPanel.this);
+ SmartDevelopmentBridge
+ .removeDeviceChangeListener(ConnectionExplorerPanel.this);
+ }
+ }
+ });
+
+ synchronized (devicesToExpand) {
+ devicesToExpand.add(device);
+ }
+
+ }
+
+ @Override
+ public void deviceDisconnected(IDevice device) {
+ devicesList.remove(device);
+ exec(new Runnable() {
+ public void run() {
+ if (tree.isDisposed() == false) {
+ // refresh all
+ treeViewer.refresh();
+
+ // notify the listener of a possible selection change.
+ notifyListeners();
+ } else {
+ // tree is disposed, we need to do something.
+ // lets remove ourselves from the listener.
+ SmartDevelopmentBridge
+ .removeDebugBridgeChangeListener(ConnectionExplorerPanel.this);
+ SmartDevelopmentBridge
+ .removeDeviceChangeListener(ConnectionExplorerPanel.this);
+ }
+ }
+ });
+
+ synchronized (devicesToExpand) {
+ devicesToExpand.add(device);
+ }
+ // }
+ }
+
+ @Override
+ public void deviceChanged(IDevice device, int changeMask) {
+ if (changeMask == 1) {
+ devicesList.add(device);
+ ToolsInstall.installPackages(device);
+ exec(new Runnable() {
+ public void run() {
+ if (tree.isDisposed() == false) {
+ // refresh all
+ treeViewer.refresh();
+
+ // notify the listener of a possible selection change.
+ notifyListeners();
+ } else {
+ // tree is disposed, we need to do something.
+ // lets remove ourselves from the listener.
+ SmartDevelopmentBridge
+ .removeDebugBridgeChangeListener(ConnectionExplorerPanel.this);
+ SmartDevelopmentBridge
+ .removeDeviceChangeListener(ConnectionExplorerPanel.this);
+ }
+ }
+ });
+
+ synchronized (devicesToExpand) {
+ devicesToExpand.add(device);
+ }
+ }
+ }
+
+ public ArrayList<IDevice> getDeviceList() {
+ return devicesList;
+ }
+
+ private void exec(Runnable runnable) {
+ if (tree.isDisposed() == false) {
+ try {
+ Display display = tree.getDisplay();
+ display.asyncExec(runnable);
+ } catch (SWTException e) {
+ // tree is disposed, we need to do something. lets remove ourselves
+ // from the listener.
+ SmartDevelopmentBridge
+ .removeDebugBridgeChangeListener(ConnectionExplorerPanel.this);
+ SmartDevelopmentBridge
+ .removeDeviceChangeListener(ConnectionExplorerPanel.this);
+ }
+ }
+ }
+
+ private void notifyListeners() {
+ // get the selection
+ TreeItem[] items = tree.getSelection();
+
+ FileEntry file = null;
+
+ if (items.length != 0) {
+ Object object = items[0].getData();
+ if (object instanceof FileEntry) {
+ file = (FileEntry) object;
+ }
+ }
+ notifySelectionListeners(file);
+ }
+
+ private void notifySelectionListeners(FileEntry file) {
+ if (file != null) {
+ mCurrentDevice = file.getFileListingService().getDevice();
+ } else {
+ IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices();
+ if (devices.length != 0) {
+ mCurrentDevice = devices[0];
+ file = devices[0].getFileListingService().getRoot();
+ for (TreeItem item : tree.getItems()) {
+ if (item.getText().equals(file.getName()))
+ tree.setSelection(item);
+ }
+ } else
+ mCurrentDevice = null;
+ }
+ currentFileEntry = file;
+ ConnectionPlugin.getDefault().setCurrentDevice(mCurrentDevice);
+ ConnectionPlugin.getDefault().notifySelectionListeners(file);
+ setIconEnabled();
+ }
+
+ public TreeViewer getTreeViewer() {
+ return treeViewer;
+ }
+
+ class FileNameValidator implements IInputValidator {
+
+ @Override
+ public String isValid(String newText) {
+ if (newText.contains(INVALID_FOR_FILENAME))
+ return "\"" + INVALID_FOR_FILENAME + "\" is invalid character for file name.";
+ return null;
+ }
+ }
+
+ public void setActionState() {
+ subMenu.setVisible(true);
+ actionPush.setEnabled(true);
+ actionPull.setEnabled(true);
+ actionRename.setEnabled(true);
+ actionRefresh.setEnabled(true);
+ actionDelete.setEnabled(true);
+ actionProperty.setEnabled(true);
+
+ if (currentFileEntry == null) {
+ subMenu.setVisible(false);
+ actionPush.setEnabled(false);
+ actionPull.setEnabled(false);
+ actionRename.setEnabled(false);
+ actionRefresh.setEnabled(false);
+ actionDelete.setEnabled(false);
+ actionProperty.setEnabled(false);
+ return;
+ }
+ if (currentFileEntry.isRoot()) {
+ actionPull.setEnabled(false);
+ actionRename.setEnabled(false);
+ actionDelete.setEnabled(false);
+ return;
+ }
+ if (!currentFileEntry.isDirectory()) {
+ subMenu.setVisible(false);
+ actionPush.setEnabled(false);
+ return;
+ }
+ }
+
+ private void setIconEnabled() {
+ boolean bPush = false;
+ boolean bPull = false;
+
+ if (currentFileEntry == null) {
+ bPush = false;
+ bPull = false;
+ } else {
+ if (currentFileEntry.isRoot()) {
+ bPush = true;
+ bPull = false;
+ } else if (!currentFileEntry.isDirectory()) {
+ bPush = false;
+ bPull = true;
+ } else {
+ bPush = true;
+ bPull = true;
+ }
+ }
+
+ pushToolItem.setEnabled(bPush);
+ pullToolItem.setEnabled(bPull);
+
+ }
+
+ @Override
+ public void selectionChanged(final FileEntry selectedEntry) {
+ if (selectedEntry == null)
+ return;
+
+ if (!selectedEntry.isRoot())
+ return;
+
+ exec(new Runnable() {
+ public void run() {
+ if (tree.isDisposed() == false) {
+ for (TreeItem item : tree.getItems()) {
+ if (item.getText().equals(selectedEntry.getName()))
+ tree.setSelection(item);
+ }
+ } else {
+ // tree is disposed, we need to do something.
+ // lets remove ourselves from the listener.
+ ConnectionPlugin.getDefault().removeSelectionListener(ConnectionExplorerPanel.this);
+ }
+ }
+ });
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/Messages.java b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/Messages.java
new file mode 100644
index 000000000..28a166170
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/Messages.java
@@ -0,0 +1,131 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* YoonKi Park <yoonki.park@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.common.connection.explorer;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "org.tizen.common.connection.explorer.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+
+ public static String getString(String key, Object binding) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+ private static String messageBind(String message, Object[] args, String argZero, String argOne) {
+ int length = message.length();
+ //estimate correct size of string buffer to avoid growth
+ int bufLen = length + (args.length * 5);
+ if (argZero != null)
+ bufLen += argZero.length() - 3;
+ if (argOne != null)
+ bufLen += argOne.length() - 3;
+ StringBuffer buffer = new StringBuffer(bufLen < 0 ? 0 : bufLen);
+ for (int i = 0; i < length; i++) {
+ char c = message.charAt(i);
+ switch (c) {
+ case '{' :
+ int index = message.indexOf('}', i);
+ // if we don't have a matching closing brace then...
+ if (index == -1) {
+ buffer.append(c);
+ break;
+ }
+ i++;
+ if (i >= length) {
+ buffer.append(c);
+ break;
+ }
+ // look for a substitution
+ int number = -1;
+ try {
+ number = Integer.parseInt(message.substring(i, index));
+ } catch (NumberFormatException e) {
+ throw (IllegalArgumentException) new IllegalArgumentException().initCause(e);
+ }
+ if (number == 0 && argZero != null)
+ buffer.append(argZero);
+ else if (number == 1 && argOne != null)
+ buffer.append(argOne);
+ else {
+ if (number >= args.length || number < 0) {
+ buffer.append("<missing argument>"); //$NON-NLS-1$
+ i = index;
+ break;
+ }
+ buffer.append(args[number]);
+ }
+ i = index;
+ break;
+ case '\'' :
+ // if a single quote is the last char on the line then skip it
+ int nextIndex = i + 1;
+ if (nextIndex >= length) {
+ buffer.append(c);
+ break;
+ }
+ char next = message.charAt(nextIndex);
+ // if the next char is another single quote then write out one
+ if (next == '\'') {
+ i++;
+ buffer.append(c);
+ break;
+ }
+ // otherwise we want to read until we get to the next single quote
+ index = message.indexOf('\'', nextIndex);
+ // if there are no more in the string, then skip it
+ if (index == -1) {
+ buffer.append(c);
+ break;
+ }
+ // otherwise write out the chars inside the quotes
+ buffer.append(message.substring(nextIndex, index));
+ i = index;
+ break;
+ default :
+ buffer.append(c);
+ }
+ }
+ return buffer.toString();
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/explorer/messages.properties b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/messages.properties
new file mode 100644
index 000000000..3d54a9c15
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/explorer/messages.properties
@@ -0,0 +1,9 @@
+
+FileDialogUtils.overrite.title=File Exists
+FileDialogUtils.overrite.message=The file {0} already exists. Are you going to overwrite it?
+FileDialogUtils.delete.title=File Delete
+FileDialogUtils.delete.message=Are you going to delete {0}?
+FileDialogUtils.tabName.title=Invalid Name
+FileDialogUtils.tabName.message= "{0}" is already exist!\nPlease fill in the TabName with another.
+FileDialogUtils.update.title=Tizen SDK
+FileDialogUtils.update.message= Updates are available for Tizen SDK. Do you want to install them?
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java
new file mode 100644
index 000000000..be746c826
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/log/AddViewDialog.java
@@ -0,0 +1,317 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.log;
+
+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.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.tizen.common.connection.ddmuilib.FileDialogUtils;
+
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.SmartDevelopmentBridge;
+
+/**
+ * Small dialog box to open new logtab with some options.
+ */
+public class AddViewDialog extends Dialog {
+
+ private static final int DLG_WIDTH = 400;
+ private static final int DLG_HEIGHT = 300;
+
+ private Shell parent;
+
+ private Shell shell;
+
+ private String dialogName = null;
+
+ private boolean bOk = false;
+
+ private LogTab oldTab = null;
+
+ private static final String TEMPNAME = "LogTab-#";
+ private static int cnt = 0;
+
+ private String tabName = null;
+ private String device = null;
+ private String pidKeyword = null;
+ private String tagKeyword = null;
+ private String msgKeyword = null;
+
+ private Text tabNameText;
+ private Text tagText;
+ private Text pidText;
+ private Text msgText;
+ private Button okButton;
+
+ public AddViewDialog(Shell pParent) {
+ super(pParent, SWT.DIALOG_TRIM | SWT.BORDER | SWT.APPLICATION_MODAL);
+ }
+
+ public AddViewDialog(Shell pParent, String deviceName) {
+ super(pParent, SWT.DIALOG_TRIM | SWT.BORDER | SWT.APPLICATION_MODAL);
+ device = deviceName;
+ dialogName = "Add LogTab";
+ }
+
+ public AddViewDialog(Shell pParent, LogTab tab) {
+ super(pParent, SWT.DIALOG_TRIM | SWT.BORDER | SWT.APPLICATION_MODAL);
+ if (tab != null) {
+ dialogName = "Edit LogTab";
+ tabName = tab.getFilterName();
+ if (tab.getFilterDeviceName() == null)
+ return;
+ device = tab.getFilterDeviceName();
+
+ pidKeyword = tab.getPidFilter();
+ tagKeyword = tab.getTagFilter();
+ msgKeyword = tab.getMsgFilter();
+
+ oldTab = tab;
+ }
+ }
+
+ /**
+ * Opens the dialog. The method will return when the user closes the dialog
+ * somehow.
+ *
+ * @return true if ok was pressed, false if cancelled.
+ */
+ public boolean open() {
+ createUI();
+
+ if (parent == null || shell == null) {
+ return false;
+ }
+
+ shell.setMinimumSize(DLG_WIDTH, DLG_HEIGHT);
+ Rectangle r = parent.getBounds();
+ // get the center new top left.
+ int cx = r.x + r.width / 2;
+ int x = cx - DLG_WIDTH / 2;
+ int cy = r.y + r.height / 2;
+ int y = cy - DLG_HEIGHT / 2;
+ shell.setBounds(x, y, DLG_WIDTH, DLG_HEIGHT);
+
+ shell.open();
+
+ Display display = parent.getDisplay();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+
+ return bOk;
+ }
+
+ private void createUI() {
+ parent = getParent();
+ shell = new Shell(parent, getStyle());
+ shell.setText(dialogName);
+
+ shell.setLayout(new GridLayout(1, false));
+
+ shell.addListener(SWT.Close, new Listener() {
+ public void handleEvent(Event event) {
+ }
+ });
+
+ Group top = new Group(shell, SWT.SHADOW_IN);
+ top.setText("LogTab");
+ top.setLayoutData(new GridData(GridData.FILL_BOTH));
+ top.setLayout(new GridLayout(2, false));
+
+ Label l = new Label(top, SWT.NONE);
+ l.setText("Name : ");
+
+ tabNameText = new Text(top, SWT.SINGLE | SWT.BORDER);
+ if (tabName != null)
+ tabNameText.setText(tabName);
+ tabNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ l = new Label(top, SWT.NONE);
+ l.setText("Device : ");
+
+ final Combo dCombo = new Combo(top, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.CENTER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ dCombo.setLayoutData(gd);
+ IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices();
+
+ if (devices.length != 0) {
+ for (IDevice d : devices) {
+ if (d.isOnline())
+ dCombo.add(d.getSerialNumber());
+ }
+
+ if (device != null) {
+ for (int i = 0; i < devices.length; i++) {
+ if (device.equals(devices[i].getSerialNumber())) {
+ dCombo.select(i);
+ break;
+ }
+ }
+ } else {
+ dCombo.select(0);
+ device = dCombo.getItem(0);
+ }
+ }
+
+ Group mid = new Group(shell, SWT.SHADOW_IN);
+ mid.setText("Search Keywords");
+ mid.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mid.setLayout(new GridLayout(2, false));
+
+ l = new Label(mid, SWT.NONE);
+ l.setText("Tag : ");
+
+ tagText = new Text(mid, SWT.SINGLE | SWT.BORDER);
+ if (tagKeyword != null)
+ tagText.setText(tagKeyword);
+ tagText.setMessage("Separated by a space/comma");
+ tagText.setToolTipText("Search Tag Keywords are separated by a space as well as a comma");
+ tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ l = new Label(mid, SWT.NONE);
+ l.setText("Pid : ");
+
+ pidText = new Text(mid, SWT.SINGLE | SWT.BORDER);
+ if (pidKeyword != null)
+ pidText.setText(pidKeyword);
+ pidText.setMessage("Separated by a space/comma");
+ pidText.setToolTipText("Search Pid Keywords are separated by a space as well as a comma");
+ pidText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ l = new Label(mid, SWT.NONE);
+ l.setText("Message : ");
+
+ msgText = new Text(mid, SWT.SINGLE | SWT.BORDER);
+ if (msgKeyword != null)
+ msgText.setText(msgKeyword);
+ msgText.setMessage("Separated by a space/comma");
+ msgText.setToolTipText("Search Message Keywords are separated by a space as well as a comma");
+ msgText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // bottom part with the ok/cancel
+ Composite bottomComp = new Composite(shell, SWT.NONE);
+ bottomComp
+ .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
+ bottomComp.setLayout(new GridLayout(2, true));
+
+ okButton = new Button(bottomComp, SWT.NONE);
+ okButton.setText("OK");
+ okButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String newName = tabNameText.getText();
+ for (LogTab tab : LogPanel.tabs) {
+ if (tab.getFilterName().equals(newName)) {
+ if (oldTab != null && oldTab == tab)
+ continue;
+ int ret = FileDialogUtils.getInstance().checkTabName(newName);
+ if (ret == IDialogConstants.OK_ID)
+ return;
+ }
+ }
+
+ bOk = true;
+
+ if (tabNameText.getText().length() != 0)
+ tabName = tabNameText.getText();
+ else
+ tabName = TEMPNAME + cnt++;
+
+ if (tagText.getText().length() != 0)
+ tagKeyword = tagText.getText();
+ else
+ tagKeyword = null;
+
+ if (pidText.getText().length() != 0)
+ pidKeyword = pidText.getText();
+ else
+ pidKeyword = null;
+
+ if (msgText.getText().length() != 0)
+ msgKeyword = msgText.getText();
+ else
+ msgKeyword = null;
+
+ device = dCombo.getItem(dCombo.getSelectionIndex());
+
+ shell.close();
+ }
+ });
+ shell.setDefaultButton(okButton);
+
+ Button cancelButton = new Button(bottomComp, SWT.NONE);
+ cancelButton.setText("Cancel");
+ cancelButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ shell.close();
+ }
+ });
+
+ }
+
+ public String getName() {
+ return tabName;
+ }
+
+ public String getDevice() {
+ return device;
+ }
+
+ public String getPidKeyword() {
+ return pidKeyword;
+ }
+
+ public String getTagKeyword() {
+ return tagKeyword;
+ }
+
+ public String getMsgKeyword() {
+ return msgKeyword;
+ }
+
+ public void setName(String name) {
+ this.tabName = name;
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogColors.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogColors.java
new file mode 100644
index 000000000..83910f970
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogColors.java
@@ -0,0 +1,27 @@
+package org.tizen.common.connection.log;
+
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
+ */
+
+import org.eclipse.swt.graphics.Color;
+
+public class LogColors {
+ public Color infoColor;
+ public Color debugColor;
+ public Color errorColor;
+ public Color warningColor;
+ public Color verboseColor;
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java
new file mode 100644
index 000000000..b0b10e9b9
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogPanel.java
@@ -0,0 +1,705 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.log;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+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.events.SelectionListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+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.tizen.common.connection.ddmuilib.FileDialogUtils;
+import org.tizen.common.connection.ddmuilib.ITableFocusListener;
+import org.tizen.common.connection.ddmuilib.Panel;
+import org.tizen.common.connection.ddmuilib.ITableFocusListener.IFocusedTableActivator;
+
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.Log.LogLevel;
+import org.tizen.sdblib.SmartDevelopmentBridge;
+import org.tizen.sdblib.SmartDevelopmentBridge.IDeviceChangeListener;
+
+public class LogPanel extends Panel implements IDeviceChangeListener {
+
+ public static final int ENABLE_NOTHING = 0;
+ public static final int ENABLE_DEFAULT = 1;
+ public static final int ENABLE_ALL = 2;
+
+ public static ArrayList<LogTab> tabs = new ArrayList<LogTab>();
+
+ private String defaultLogSave;
+
+ private static int tabCnt = 0;
+ private Composite parent;
+ private TabFolder folders;
+ private Text filterText;
+
+ private LogColors colors;
+
+ private LogTab currentTab;
+ private Action[] levelActions;
+ private Action addAction;
+ private Action removeAction;
+ private Action editAction;
+ private Action exportAction;
+ private Action clearAction;
+
+ /** message data, separated from content for multi line messages */
+ protected static class LogMessageInfo {
+ public LogLevel logLevel;
+ public String pidString;
+ public String tag;
+ public String time;
+ }
+
+ private ITableFocusListener globalListener;
+
+ /** message data, separated from content for multi line messages */
+ protected static class LogMessage {
+ public LogMessageInfo data;
+ public String msg;
+
+ @Override
+ public String toString() {
+ return data.time + ": " + data.logLevel + "/" + data.tag + "(" + data.pidString + "): " + msg;
+ }
+ }
+
+ /**
+ * Create the log panel with some default parameters
+ *
+ * @param colors
+ * The display color object
+ */
+ public LogPanel(LogColors pColors) {
+ colors = pColors;
+ }
+
+ public void setActions(Action[] levels, Action add, Action remove,
+ Action edit, Action export, Action clear) {
+ levelActions = levels;
+ addAction = add;
+ removeAction = remove;
+ editAction = edit;
+ exportAction = export;
+ clearAction = clear;
+ }
+
+ /**
+ * Creates a control capable of displaying some information. This is called
+ * once, when the application is initializing, from the UI thread.
+ */
+ @Override
+ protected Control createControl(Composite p) {
+
+ parent = p;
+
+ // create the tab folder
+ folders = new TabFolder(parent, SWT.NONE);
+ folders.setLayoutData(new GridData(GridData.FILL_BOTH));
+ folders.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+
+ currentTab = getCurrentLogTab();
+ if (currentTab == null)
+ return;
+ currentTab.initTab();
+ currentTab.setLevelIcon(levelActions);
+
+ if (currentTab.isDefault()) {
+ setActionEnabled(LogPanel.ENABLE_DEFAULT);
+ } else {
+ setActionEnabled(LogPanel.ENABLE_ALL);
+ }
+ }
+ });
+
+ SmartDevelopmentBridge.addDeviceChangeListener(this);
+ createDefaultTabs();
+
+ return null;
+ }
+
+ /**
+ *
+ * Create the LogFilters with default devicesd
+ *
+ */
+ private void createDefaultTabs() {
+ SmartDevelopmentBridge sdbBridge = SmartDevelopmentBridge.getBridge();
+ IDevice[] devices = null;
+ if (sdbBridge != null) {
+ devices = sdbBridge.getDevices();
+ }
+
+ if (devices != null) {
+ for (IDevice device : devices) {
+ if (device.isOffline())
+ continue;
+ LogTab dTab = createDefaultTab(device, null);
+ dTab.startLogTab();
+ }
+ }
+ }
+
+ private LogTab createDefaultTab(IDevice device, String tabName) {
+ LogTab tab = createTab(device, null);
+ tab.setDefault();
+ setActionEnabled(LogPanel.ENABLE_DEFAULT);
+ return tab;
+ }
+
+ private LogTab createTab(IDevice device, String tabName) {
+
+ LogTab tab = null;
+ if (tabName == null)
+ tab = new LogTab(device.getSerialNumber(), device, colors);
+ else
+ tab = new LogTab(tabName, device, colors);
+
+ //
+ for (int i = 0; i < tabs.size(); i++) {
+ LogTab oldTab = tabs.get(i);
+ if (oldTab.getFilterName().equals(tab.getFilterName())) {
+ oldTab.stopLogTab(true);
+ tabs.remove(i);
+ tabCnt--;
+ oldTab.dispose();
+ if (!tabs.isEmpty())
+ folders.setSelection(0);
+ }
+ }
+
+ TabItem item = new TabItem(folders, SWT.NONE, tabCnt++);
+
+ item.setText(tab.getFilterName());
+
+ item.setControl(getTabControl(folders, tab));
+ tab.setTab(item);
+
+ folders.setSelection(item);
+ tabs.add(tab);
+
+ if (tab.isDefault()) {
+ setActionEnabled(LogPanel.ENABLE_DEFAULT);
+ } else {
+ setActionEnabled(LogPanel.ENABLE_ALL);
+ }
+ tab.setLevelIcon(levelActions);
+ return tab;
+ }
+
+ private Control getTabControl(TabFolder tabFolder, final LogTab tab) {
+ // Create a composite and add four buttons to it
+
+ Composite composite = new Composite(tabFolder, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+ composite.setLayout(new GridLayout(1, false));
+
+ Composite mid = new Composite(composite, SWT.NONE);
+ mid.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mid.setLayout(new FillLayout());
+
+ final Table table = new Table(mid, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.BORDER_SOLID);
+
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ if (globalListener != null) {
+ addTableToFocusListener(table);
+ }
+
+ ControlListener listener = null;
+ listener = new ControlListener() {
+ public void controlMoved(ControlEvent e) {
+
+ }
+
+ public void controlResized(ControlEvent e) {
+ Rectangle r = table.getClientArea();
+
+ // get the size of all but the last column
+ int total = table.getColumn(0).getWidth();
+ total += table.getColumn(1).getWidth();
+ total += table.getColumn(2).getWidth();
+ total += table.getColumn(3).getWidth();
+
+ if (r.width > total) {
+ table.getColumn(4).setWidth(r.width - total);
+ }
+ }
+ };
+
+ table.addControlListener(listener);
+
+ // then its column
+ TableColumn col = createTableColumn(table, "Time", SWT.LEFT,
+ "00-00 00:00:00.000");
+ col.addControlListener(listener);
+
+ col = createTableColumn(table, "Level", SWT.LEFT, "Verbose");
+ col.addControlListener(listener);
+
+ col = createTableColumn(table, "Pid", SWT.LEFT, "9999999");
+ col.addControlListener(listener);
+
+ col = createTableColumn(table, "Tag", SWT.LEFT, "ABCDEFGHIJK");
+ col.addControlListener(listener);
+
+ col = createTableColumn(table, "Message", SWT.LEFT,
+ "abcdefghijklmnopqrstuvwxyz0123456789");
+ col.setResizable(false);
+
+ Composite bottom = new Composite(composite, SWT.NONE);
+ bottom.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ bottom.setLayout(new GridLayout(3, false));
+
+ final Combo combo = new Combo(bottom, SWT.READ_ONLY);
+ String[] comboItems = {"Pid", "Tag", "Message"};
+ combo.setItems(comboItems);
+ combo.select(2);
+ combo.setToolTipText("Keyword Search: Pid or Tag, Message");
+ combo.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ if (filterText.getText() != null) {
+ int index = combo.getSelectionIndex();
+ if (index != -1)
+ tab.tableRefill(index, filterText.getText());
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ filterText = new Text(bottom, SWT.SINGLE | SWT.BORDER);
+ filterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ filterText.setMessage("Search Keywords from this table are separated by a space as well as a comma");
+ filterText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (filterText.getText() != null) {
+ int index = combo.getSelectionIndex();
+ if (index != -1) {
+ tab.tableRefill(index, filterText.getText());
+ }
+ }
+ }
+ });
+
+ tab.setTable(table);
+ return composite;
+ }
+
+ @Override
+ protected void postCreation() {
+ // pass
+ }
+
+ /**
+ * Sets the focus to the proper object.
+ */
+ @Override
+ public void setFocus() {
+ }
+
+ /**
+ * Copies the current selection of the current filter as multiline text.
+ *
+ * @param clipboard
+ * The clipboard to place the copied content.
+ */
+ public void copy(Clipboard clipboard) {
+ // get the current table and its selection
+ copyTable(clipboard, currentTab.getTable());
+ }
+
+ /**
+ * Selects all lines.
+ */
+ public void selectAll() {
+ currentTab.getTable().selectAll();
+ }
+
+ /**
+ * Sets a TableFocusListener which will be notified when one of the tables
+ * gets or loses focus.
+ *
+ * @param listener
+ */
+ public void setTableFocusListener(ITableFocusListener listener) {
+ // record the global listener, to make sure table created after
+ // this call will still be setup.
+ globalListener = listener;
+
+ for (LogTab tab : tabs) {
+ addTableToFocusListener(tab.getTable());
+ }
+ }
+
+ /**
+ * Sets up a Table object to notify the global Table Focus listener when it
+ * gets or loses the focus.
+ *
+ * @param table
+ * the Table object.
+ */
+ private void addTableToFocusListener(final Table table) {
+ // create the activator for this table
+ final IFocusedTableActivator activator = new IFocusedTableActivator() {
+ public void copy(Clipboard clipboard) {
+ copyTable(clipboard, table);
+ }
+
+ public void selectAll() {
+ table.selectAll();
+ }
+ };
+
+ // add the focus listener on the table to notify the global
+ // listener
+ table.addFocusListener(new FocusListener() {
+ public void focusGained(FocusEvent e) {
+ globalListener.focusGained(activator);
+ }
+
+ public void focusLost(FocusEvent e) {
+ globalListener.focusLost(activator);
+ }
+ });
+ }
+
+ /**
+ * Copies the current selection of a Table into the provided Clipboard, as
+ * multi-line text.
+ *
+ * @param clipboard
+ * The clipboard to place the copied content.
+ * @param table
+ * The table to copy from.
+ */
+ private static void copyTable(Clipboard clipboard, Table table) {
+ int[] selection = table.getSelectionIndices();
+
+ // we need to sort the items to be sure.
+ Arrays.sort(selection);
+
+ // all lines must be concatenated.
+ StringBuilder sb = new StringBuilder();
+
+ // loop on the selection and output the file.
+ for (int i : selection) {
+ TableItem item = table.getItem(i);
+ LogMessage msg = (LogMessage) item.getData();
+ String line = msg.toString();
+ sb.append(line);
+ sb.append('\n');
+ }
+
+ // now add that to the clipboard
+ clipboard.setContents(new Object[] { sb.toString() },
+ new Transfer[] { TextTransfer.getInstance() });
+ }
+
+
+ /**
+ * saves the current selection in a text file.
+ *
+ * @return false if the saving failed.
+ */
+ public boolean save() {
+ if (getCurrentLogTab() == null)
+ return false;
+ FileDialog dlg = new FileDialog(parent.getShell(), SWT.SAVE);
+ String fileName;
+
+ dlg.setText("Export Log");
+ dlg.setFileName(getCurrentLogTab().getFilterName() + "-log.txt");
+ String defaultPath = defaultLogSave;
+ if (defaultPath == null) {
+ defaultPath = System.getProperty("user.home"); //$NON-NLS-1$
+ }
+ dlg.setFilterPath(defaultPath);
+ dlg.setFilterNames(new String[] { "Text Files (*.txt)" });
+ dlg.setFilterExtensions(new String[] { "*.txt" });
+ File check;
+ boolean again;
+ do {
+ again = false;
+ fileName = dlg.open();
+ if (fileName == null)
+ return false;
+ check = new File(fileName);
+ if (check.exists()) {
+ int ret = FileDialogUtils.getInstance().checkFileOverwrite(fileName);
+ if (ret == IDialogConstants.CANCEL_ID)
+ again = true;
+ }
+ } while (again);
+
+ if (fileName != null) {
+ defaultLogSave = dlg.getFilterPath();
+
+ // loop on the selection and output the file.
+ try {
+ FileWriter writer = new FileWriter(fileName);
+
+ for (TableItem item : getCurrentLogTab().getTable().getItems()) {
+ LogMessage msg = (LogMessage) item.getData();
+ String line = msg.toString();
+ writer.write(line);
+ writer.write('\n');
+ }
+ writer.flush();
+
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public void clear() {
+ if (getCurrentLogTab() != null)
+ this.getCurrentLogTab().clear();
+ }
+
+ public void addTab() {
+ if (getCurrentLogTab() == null)
+ return;
+ AddViewDialog dlg = new AddViewDialog(parent.getShell(),
+ getCurrentLogTab().getFilterDeviceName());
+
+ if (dlg.open()) {
+ for (IDevice device : SmartDevelopmentBridge.getBridge()
+ .getDevices()) {
+ if (device.getSerialNumber().equals(dlg.getDevice())) {
+
+ LogTab newTab = createTab(device, dlg.getName());
+
+ newTab.setPidFilter(dlg.getPidKeyword());
+ newTab.setTagFilter(dlg.getTagKeyword());
+ newTab.setMsgFilter(dlg.getMsgKeyword());
+
+ newTab.startLogTab();
+
+ break;
+ }
+ }
+ } else
+ return;
+ }
+
+ public void removeTab() {
+
+ int index = folders.getSelectionIndex();
+ if (index < 0)
+ return;
+ LogTab tab = tabs.get(index);
+ if (tab.isDefault()) {
+ return;
+ }
+ tab.stopLogTab(true);
+ tabs.remove(index);
+ tabCnt--;
+ tab.dispose();
+ if (!tabs.isEmpty())
+ folders.setSelection(0);
+
+ }
+
+ public void editTab() {
+
+ LogTab oldTab = getCurrentLogTab();
+ if (oldTab == null)
+ return;
+ if (oldTab.isDefault()) {
+ return;
+ }
+
+ AddViewDialog dlg = new AddViewDialog(parent.getShell(), oldTab);
+ if (dlg.open()) {
+ for (IDevice device : SmartDevelopmentBridge.getBridge()
+ .getDevices()) {
+ if (device.getSerialNumber().equals(dlg.getDevice())) {
+ boolean bRestart = false;
+ if (!oldTab.getFilterDeviceName().equals(
+ device.getSerialNumber())) {
+ oldTab.stopLogTab(true);
+ oldTab.setDevice(device);
+ bRestart = true;
+ }
+
+ for (TabItem item : folders.getItems()) {
+ if (item.getText().equals(oldTab.getFilterName())) {
+ item.setText(dlg.getName());
+ oldTab.setFilterName(dlg.getName());
+ }
+ }
+
+ oldTab.setPidFilter(dlg.getPidKeyword());
+ oldTab.setTagFilter(dlg.getTagKeyword());
+ oldTab.setMsgFilter(dlg.getMsgKeyword());
+
+ if (bRestart)
+ oldTab.startLogTab();
+ else
+ oldTab.refill();
+ break;
+ }
+ }
+ } else
+ return;
+ }
+
+ public static TableColumn createTableColumn(Table parent, String header,
+ int style, String sampleText) {
+
+ // create the column
+ TableColumn col = new TableColumn(parent, style);
+
+ col.setText(sampleText);
+ col.pack();
+
+ // set the header
+ col.setText(header);
+
+ return col;
+ }
+
+ public LogTab getCurrentLogTab() {
+ if (tabs.size() != 0) {
+ int index = folders.getSelectionIndex();
+ return tabs.get(index);
+ } else
+ return null;
+ }
+
+ public void stopAll() {
+ for (LogTab tab : tabs) {
+ tab.stopLogTab(true);
+ }
+ tabs.clear();
+ tabCnt = 0;
+ folders.dispose();
+ }
+
+ @Override
+ public void deviceConnected(IDevice device) {
+ if (device.isOnline()) {
+ deviceChanged(device, 1);
+ }
+ }
+
+ @Override
+ public void deviceDisconnected(IDevice device) {
+ }
+
+ @Override
+ public void deviceChanged(final IDevice device, int changeMask) {
+ if (changeMask == 1) {
+ if (parent.isDisposed() == false) {
+ Display display = parent.getDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if (folders.isDisposed() == false) {
+ LogTab tab = createDefaultTab(device, null);
+ tab.startLogTab();
+ } else {
+ SmartDevelopmentBridge
+ .removeDeviceChangeListener(LogPanel.this);
+ }
+ }
+ });
+ }
+ }
+ }
+
+ public void setActionEnabled(int enable) {
+
+ if (enable == ENABLE_NOTHING) {
+
+ addAction.setEnabled(false);
+ removeAction.setEnabled(false);
+ editAction.setEnabled(false);
+ exportAction.setEnabled(false);
+ clearAction.setEnabled(false);
+ for (Action a : levelActions) {
+ a.setEnabled(false);
+ }
+ } else if (enable == ENABLE_DEFAULT) {
+ addAction.setEnabled(true);
+ removeAction.setEnabled(false);
+ editAction.setEnabled(false);
+ exportAction.setEnabled(true);
+ clearAction.setEnabled(true);
+ for (Action a : levelActions) {
+ a.setEnabled(true);
+ }
+ } else if (enable == ENABLE_ALL) {
+ addAction.setEnabled(true);
+ removeAction.setEnabled(true);
+ editAction.setEnabled(true);
+ exportAction.setEnabled(true);
+ clearAction.setEnabled(true);
+ for (Action a : levelActions) {
+ a.setEnabled(true);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java
new file mode 100644
index 000000000..5e49a7cfc
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/log/LogTab.java
@@ -0,0 +1,820 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.log;
+
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.tizen.common.connection.log.LogPanel.LogMessage;
+import org.tizen.common.connection.log.LogPanel.LogMessageInfo;
+import org.tizen.common.console.AnsicodeAdapter;
+
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.Log;
+import org.tizen.sdblib.Log.LogLevel;
+import org.tizen.sdblib.MultiLineReceiver;
+
+public class LogTab {
+
+ private static final int STRING_BUFFER_LENGTH = 10000;
+
+ public static final int FILTER_NONE = -1;
+ public static final int FILTER_PID = 0x0;
+ public static final int FILTER_TAG = 0x1;
+ public static final int FILTER_MSG = 0x2;
+ private int filterMode = FILTER_NONE;
+
+ public static final int LEVEL_ALL = 0x1F;
+ public static final int LEVEL_VERBOSE = 0x1;
+ public static final int LEVEL_DEBUG = 0x2;
+ public static final int LEVEL_INFO = 0x4;
+ public static final int LEVEL_WARNING = 0x8;
+ public static final int LEVEL_ERROR = 0x16;
+
+ /**
+ * Single level log level as defined in Log.mLevelChar. Only valid if mMode
+ * is MODE_LEVEL
+ */
+ private int levelMode = LEVEL_ALL;
+
+ private String[] pidFilter = null;
+ private String[] tagFilter = null;
+ private String[] msgFilter = null;
+
+ private String pidFilterString = null;
+ private String tagFilterString = null;
+ private String msgFilterString = null;
+ private String tableFilter = null;
+ private String filterName = null;
+ private IDevice filterDevice = null;
+ private LogTabOuputReceiver logger = null;
+ private LogColors colors;
+
+ private Table table;
+ private TabItem tabItem;
+
+ private static Pattern logPattern = Pattern
+ .compile("^\\[\\s(\\d\\d-\\d\\d\\s\\d\\d:\\d\\d:\\d\\d\\.\\d+)" + //$NON-NLS-1$
+ "\\s+(\\d*):\\s*(\\d+)\\s([VDIWE])/(.+)\\s+\\]$");
+
+ private ArrayList<LogMessage> tableMessages = new ArrayList<LogMessage>();
+ private ArrayList<LogMessage> newMessages = new ArrayList<LogMessage>();
+ private LogMessage[] buffer = new LogMessage[STRING_BUFFER_LENGTH];
+
+ private LogMessageInfo lastMessageInfo = null;
+ private boolean pendingAsyncRefresh = false;
+
+ private boolean isDefault = false;
+ private int removedMessageCount = 0;
+
+ private int indexStart = -1;
+ private int indexEnd = -1;
+
+ public LogTab(String pName, IDevice pDevice, LogColors pColors) {
+ filterName = pName;
+ filterDevice = pDevice;
+ this.colors = pColors;
+ }
+
+ public LogTab() {
+ }
+
+ /** Sets the name of the filter. */
+ public void setFilterName(String name) {
+ filterName = name;
+ }
+
+ public void setPidFilter(String pid) {
+ pidFilterString = pid;
+ if (pid != null)
+ pidFilter = setFilter(pid.split("[\\s\t,]"));
+ else
+ pidFilter = null;
+ }
+
+ public void setTagFilter(String tag) {
+ tagFilterString = tag;
+ if (tag != null)
+ tagFilter = setFilter(tag.split("[\\s\t,]"));
+ else
+ tagFilter = null;
+ }
+
+ public void setMsgFilter(String msg) {
+ msgFilterString = msg;
+ if (msg != null)
+ msgFilter = setFilter(msg.split("[\\s\t,]"));
+ else
+ msgFilter = null;
+ }
+
+ private String[] setFilter(String[] array) {
+ ArrayList<String> result = new ArrayList<String>();
+ for (String s : array) {
+ if (s.length() > 0) {
+ result.add(s);
+ }
+ }
+ return result.toArray(new String[(result.size())]);
+ }
+
+ public String getFilterName() {
+ return filterName;
+ }
+
+ public int getLevelMode() {
+ return levelMode;
+ }
+
+ public String getPidFilter() {
+ return pidFilterString;
+ }
+
+ public String getTagFilter() {
+ return tagFilterString;
+ }
+
+ public String getMsgFilter() {
+ return msgFilterString;
+ }
+
+ public String getFilterDeviceName() {
+ return filterDevice.getSerialNumber();
+ }
+
+ public void setTab(TabItem pTabItem) {
+ tabItem = pTabItem;
+ }
+
+ public void setTable(Table pTable) {
+ table = pTable;
+ }
+
+ public boolean uiReady() {
+ return (table != null && tabItem != null);
+ }
+
+ /**
+ * Returns the UI table object.
+ *
+ * @return
+ */
+ public Table getTable() {
+ return table;
+ }
+
+ public void dispose() {
+ table.dispose();
+ tabItem.dispose();
+ table = null;
+ tabItem = null;
+ }
+
+ public void startLogTab() {
+
+ resetUI(false);
+
+ if (filterDevice != null) {
+
+ // create a new output receiver
+ logger = new LogTabOuputReceiver();
+
+ // start the LogTab in a different thread
+ new Thread(filterDevice.getSerialNumber() + " Logger") { //$NON-NLS-1$
+ @Override
+ public void run() {
+
+ while (filterDevice.isOnline() == false && logger != null && logger.isCancelled == false) {
+ try {
+ sleep(2000);
+ } catch (InterruptedException e) {
+ Log.e("LogTab",
+ "Device is not online or logger is null/cancelled");
+ return;
+ }
+ }
+
+ if (logger == null || logger.isCancelled) {
+ return;
+ }
+
+ try {
+
+ filterDevice.executeShellCommand(
+ "dlogutil -v long *:v", logger, 0 /* timeout */); //$NON-NLS-1$
+ } catch (Exception e) {
+ Log.e("LogTab", e);
+ } finally {
+ logger = null;
+ filterDevice = null;
+ }
+ }
+ } .start();
+ }
+ }
+
+ /** Stop the current LogTab */
+ public void stopLogTab(boolean inUiThread) {
+ if (logger != null) {
+ logger.isCancelled = true;
+
+ logger = null;
+
+ clear();
+
+ resetUI(inUiThread);
+ }
+ }
+
+ public boolean addMessage(LogMessage newMessage, LogMessage oldMessage) {
+ synchronized (tableMessages) {
+ if (oldMessage != null) {
+ int index = tableMessages.indexOf(oldMessage);
+ if (index != -1) {
+ tableMessages.remove(index);
+ removedMessageCount++;
+ }
+
+ index = tableMessages.indexOf(oldMessage);
+ if (index != -1) {
+ tableMessages.remove(index);
+ }
+ }
+
+ boolean filter = accept(newMessage);
+
+ if (filter) {
+ tableMessages.add(newMessage);
+ newMessages.add(newMessage);
+ }
+
+ return filter;
+ }
+ }
+
+ boolean accept(LogMessage logMessage) {
+ if (logMessage == null)
+ return false;
+
+ if (levelMode != LEVEL_ALL) {
+ int a = 0;
+ a = (levelMode & (0x1 << (logMessage.data.logLevel.getPriority() - 2)));
+
+ if (a == 0)
+ return false;
+ }
+
+ if (pidFilter != null || tagFilter != null || msgFilter != null) {
+ if (pidFilter != null) {
+ for (String filter : pidFilter) {
+ if (logMessage.data.pidString.contains(
+ filter))
+ if (tableAccept(logMessage))
+ return true;
+ }
+ }
+
+ if (tagFilter != null) {
+ for (String filter : tagFilter) {
+ if (logMessage.data.tag.toLowerCase().contains(
+ filter.toLowerCase()))
+ if (tableAccept(logMessage))
+ return true;
+ }
+ }
+
+ if (msgFilter != null) {
+ for (String filter : msgFilter) {
+ if (logMessage.msg.toLowerCase().contains(
+ filter.toLowerCase()))
+ if (tableAccept(logMessage))
+ return true;
+ }
+ }
+ return false;
+ }
+ if (tableAccept(logMessage))
+ return true;
+ else
+ return false;
+ }
+
+ public void flush() {
+
+ ScrollBar bar = table.getVerticalBar();
+ boolean scroll = bar.getMaximum() == bar.getSelection() + bar.getThumb();
+
+ int topIndex = table.getTopIndex();
+
+ table.setRedraw(false);
+
+ int totalCount = newMessages.size();
+
+ try {
+ // remove the items of the old messages.
+ for (int i = 0; i < removedMessageCount && table.getItemCount() > 0; i++) {
+ table.remove(0);
+ }
+
+ // add the new items
+ for (int i = 0; i < totalCount; i++) {
+ LogMessage msg = newMessages.get(i);
+ addTableItem(msg);
+ }
+ } catch (SWTException e) {
+ // log the error and keep going. Content of the LogTab
+ // table maybe unexpected
+ // but at least ddms won't crash.
+ Log.e("LogFilter", e);
+ }
+
+ // redraw
+ table.setRedraw(true);
+
+ // scroll if needed, by showing the last item
+ if (scroll) {
+ totalCount = table.getItemCount();
+ if (totalCount > 0) {
+ table.showItem(table.getItem(totalCount - 1));
+ }
+ } else if (removedMessageCount > 0) {
+ // we need to make sure the topIndex is still visible.
+ // Because really old items are removed from the list, this
+ // could make it disappear
+ // if we don't change the scroll value at all.
+
+ topIndex -= removedMessageCount;
+ if (topIndex < 0) {
+ // looks like it disappeared. Lets just show the
+ // first item
+ table.showItem(table.getItem(0));
+ } else {
+ table.showItem(table.getItem(topIndex));
+ }
+ }
+
+ newMessages.clear();
+ removedMessageCount = 0;
+
+ }
+
+ void setColors(LogColors pColors) {
+ colors = pColors;
+ }
+
+ /**
+ * Add a TableItem for the index-th item of the buffer
+ *
+ * @param filter
+ * The index of the table in which to insert the item.
+ */
+ private void addTableItem(LogMessage msg) {
+ TableItem item = new TableItem(table, SWT.NONE);
+ item.setText(0, msg.data.time);
+ // item.setText(1,
+ // new String(new char[]{msg.data.logLevel.getPriorityLetter()}));
+ item.setText(2, msg.data.pidString);
+ item.setText(3, msg.data.tag);
+ item.setText(4, msg.msg);
+
+ // add the buffer index as data
+ item.setData(msg);
+
+ if (msg.data.logLevel == LogLevel.INFO) {
+ item.setForeground(colors.infoColor);
+ item.setText(1, "Info");
+ } else if (msg.data.logLevel == LogLevel.DEBUG) {
+ item.setForeground(colors.debugColor);
+ item.setText(1, "Debug");
+ } else if (msg.data.logLevel == LogLevel.ERROR) {
+ item.setForeground(colors.errorColor);
+ item.setText(1, "Error");
+ } else if (msg.data.logLevel == LogLevel.WARN) {
+ item.setForeground(colors.warningColor);
+ item.setText(1, "Warn");
+ } else if (msg.data.logLevel == LogLevel.WARN) {
+ item.setForeground(colors.verboseColor);
+ item.setText(1, "Verbose");
+ }
+ }
+
+ /**
+ * objects able to receive the output of a remote shell command,
+ * specifically a LogTab command in this case
+ */
+ private final class LogTabOuputReceiver extends MultiLineReceiver {
+
+ public boolean isCancelled = false;
+
+ public LogTabOuputReceiver() {
+ super();
+
+ setTrimLine(false);
+ }
+
+ @Override
+ public void processNewLines(String[] lines) {
+ if (isCancelled == false) {
+ processLogLines(lines);
+ }
+ }
+
+ public boolean isCancelled() {
+ return isCancelled;
+ }
+ }
+
+ /**
+ * Process new Log lines coming from {@link LogCatOuputReceiver}.
+ *
+ * @param lines
+ * the new lines
+ */
+ protected void processLogLines(String[] lines) {
+ // WARNING: this will not work if the string contains more line
+ // than
+ // the buffer holds.
+
+ if (lines.length > STRING_BUFFER_LENGTH) {
+ Log.e("LogTab", "Receiving more lines than STRING_BUFFER_LENGTH");
+ }
+
+ // parse the lines and create LogMessage that are stored in a
+ // temporary list
+ final ArrayList<LogMessage>newMessages = new ArrayList<LogMessage>();
+
+ synchronized (buffer) {
+ for (String line : lines) {
+ line = AnsicodeAdapter.getStripAnsiString(line);
+ // ignore empty lines.
+ if (line.length() > 0) {
+ // check for header lines.
+ Matcher matcher = logPattern.matcher(line);
+ if (matcher.matches()) {
+ // this is a header line, parse the
+ // header and keep it around.
+ lastMessageInfo = new LogMessageInfo();
+
+ lastMessageInfo.time = matcher.group(1);
+ lastMessageInfo.pidString = matcher.group(2);
+ lastMessageInfo.logLevel = LogLevel
+ .getByLetterString(matcher.group(4));
+ lastMessageInfo.tag = matcher.group(5).trim();
+ } else {
+ // This is not a header line.
+ // Create a new LogMessage and process
+ // it.
+ LogMessage mc = new LogMessage();
+
+ if (lastMessageInfo == null) {
+ return;
+ }
+
+ // If someone printed a log message
+ // with
+ // embedded '\n' characters, there
+ // will
+ // one header line followed by
+ // multiple text lines.
+ // Use the last header that we saw.
+ mc.data = lastMessageInfo;
+
+ // tabs seem to display as only 1 tab
+ // so we replace the leading tabs
+ // by 4 spaces.
+ mc.msg = line.replaceAll("\t", " "); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // process the new LogMessage.
+ processNewMessage(mc);
+
+ // store the new LogMessage
+ newMessages.add(mc);
+ }
+ }
+ }
+
+ // if we don't have a pending Runnable that will do the
+ // refresh, we
+ // ask the Display
+ // to run one in the UI thread.
+ if (pendingAsyncRefresh == false) {
+ pendingAsyncRefresh = true;
+
+ try {
+ Display display = table.getDisplay();
+
+ // run in sync because this will update the
+ // buffer start/end indices
+ display.asyncExec(new Runnable() {
+ public void run() {
+ asyncRefresh();
+ }
+ });
+ } catch (SWTException e) {
+ // display is disposed, we're probably
+ // quitting. Let's stop.
+ stopLogTab(false);
+ }
+ }
+ }
+ }
+
+ /**
+ * Processes a new Message.
+ * <p/>
+ * This adds the new message to the buffer, and gives it to the existing
+ * filters.
+ *
+ * @param newMessage
+ */
+ private void processNewMessage(LogMessage newMessage) {
+ // // if we are in auto filtering mode, make sure we have
+ // // a filter for this
+
+ // compute the index where the message goes.
+ // was the buffer empty?
+ int messageIndex = -1;
+ if (indexStart == -1) {
+ indexStart = 0;
+ messageIndex = indexStart;
+ indexEnd = 1;
+ } else {
+ messageIndex = indexEnd;
+
+ // check we aren't overwriting start
+ if (indexEnd == indexStart) {
+ indexStart = (indexStart + 1) % STRING_BUFFER_LENGTH;
+ }
+
+ // increment the next usable slot index
+ indexEnd = (indexEnd + 1) % STRING_BUFFER_LENGTH;
+ }
+
+ LogMessage oldMessage = null;
+
+ // record the message that was there before
+ if (buffer[messageIndex] != null) {
+ oldMessage = buffer[messageIndex];
+ }
+
+ // then add the new one
+ buffer[messageIndex] = newMessage;
+
+ synchronized (tableMessages) {
+ if (oldMessage != null) {
+ if (tableMessages.size() > STRING_BUFFER_LENGTH) {
+ int index = tableMessages.indexOf(oldMessage);
+ if (index != -1) {
+ // TODO check that index will always
+ // be -1 or 0, as only the oldest
+ // message is ever removed.
+ tableMessages.remove(index);
+ removedMessageCount++;
+ }
+ }
+ }
+ }
+
+ boolean filter = accept(newMessage);
+ if (filter) {
+ // at this point the message is accepted, we add it to the
+ // list
+ tableMessages.add(newMessage);
+ newMessages.add(newMessage);
+ }
+
+ }
+
+ /**
+ * Refreshes the UI with new messages.
+ */
+ private void asyncRefresh() {
+ if (table.isDisposed() == false) {
+ synchronized (buffer) {
+ try {
+ // the circular buffer has been updated, let
+ // have the filter flush
+ // their display with the new messages.
+ flush();
+
+ } finally {
+ // the pending refresh is done.
+ pendingAsyncRefresh = false;
+ }
+ }
+ } else {
+ stopLogTab(true);
+ }
+ }
+
+ public void resetUI(boolean inUiThread) {
+
+ // the ui is static we just empty it.
+ if (table.isDisposed() == false) {
+ if (inUiThread) {
+ table.removeAll();
+ } else {
+ Display d = table.getDisplay();
+
+ // run sync as we need to update right now.
+ d.syncExec(new Runnable() {
+ public void run() {
+ if (table.isDisposed() == false) {
+ table.removeAll();
+ }
+ }
+ });
+ }
+ }
+ }
+
+ public void setLevelIcon(Action[] icons) {
+ for (int i = 0; i < 5; i++) {
+ int a = levelMode & (0x1 << i);
+ icons[i].setChecked(a == (int) Math.pow(2, i));
+ }
+ }
+
+ public void initTab() {
+
+ // is it empty
+ if (uiReady() == false) {
+ return;
+ }
+
+ msgClear();
+
+ if (indexStart != -1) {
+ int max = indexEnd;
+ if (indexEnd < indexStart) {
+ max += STRING_BUFFER_LENGTH;
+ }
+
+ for (int i = indexStart; i < max; i++) {
+ int realItemIndex = i % STRING_BUFFER_LENGTH;
+
+ addMessage(buffer[realItemIndex], null /*
+ * old message
+ */);
+ }
+ }
+
+ flush();
+ }
+
+ public void refill() {
+ msgClear();
+
+ synchronized (buffer) {
+ for (LogMessage logMsg : buffer) {
+ if (accept(logMsg)) {
+ tableMessages.add(logMsg);
+ newMessages.add(logMsg);
+ }
+ }
+ }
+ flush();
+ }
+
+ public void tableRefill(int index, String filter) {
+
+
+ tableFilter = filter;
+ filterMode = index;
+
+ newMessages.clear();
+ lastMessageInfo = null;
+ if (table.isDisposed() == false)
+ table.removeAll();
+
+ synchronized (tableMessages) {
+ for (LogMessage logMsg : tableMessages) {
+ if (tableAccept(logMsg)) {
+ newMessages.add(logMsg);
+ }
+ }
+ }
+ flush();
+ }
+
+ boolean tableAccept(LogMessage logMessage) {
+ if (logMessage == null)
+ return false;
+
+ if (tableFilter == null || tableFilter.length() == 0)
+ return true;
+
+ switch(filterMode) {
+ case 0:
+ {
+ String[] filter = tableFilter.split("[\\s\t,]");
+ for (int i = 0; i < filter.length; i++) {
+ if (logMessage.data.pidString.contains(
+ filter[i]))
+ return true;
+ }
+ }
+ break;
+
+ case 1:
+ {
+ String[] filter = tableFilter.split("[\\s\t,]");
+ for (int i = 0; i < filter.length; i++) {
+ if (logMessage.data.tag.toLowerCase().contains(
+ filter[i].toLowerCase()))
+ return true;
+ }
+ }
+ break;
+
+ case 2:
+ {
+ String[] filter = tableFilter.split("[\\s\t,]");
+ for (int i = 0; i < filter.length; i++) {
+ if (logMessage.msg.toLowerCase().contains(
+ filter[i].toLowerCase()))
+ return true;
+ }
+ }
+ break;
+
+ default:
+ return false;
+
+ }
+ return false;
+ }
+
+ public void setLevel(int level, boolean setLevel) {
+ level = (int) Math.pow(2, level);
+ if (setLevel)
+ levelMode |= level;
+ else
+ levelMode &= (~level);
+ }
+
+ public void msgClear() {
+ removedMessageCount = 0;
+ newMessages.clear();
+ lastMessageInfo = null;
+ tableMessages.clear();
+ if (table.isDisposed() == false)
+ table.removeAll();
+ }
+
+ public void clear() {
+ for (int i = 0; i < STRING_BUFFER_LENGTH; i++) {
+ buffer[i] = null;
+ }
+
+ indexStart = -1;
+ indexEnd = -1;
+
+ msgClear();
+ }
+
+ public void setDevice(IDevice device) {
+ filterDevice = device;
+ }
+
+ public void setDefault() {
+ isDefault = true;
+ }
+
+ public boolean isDefault() {
+ return isDefault;
+ }
+
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/properties/ConnectionExplorerInfoPropertyPages.java b/org.tizen.common.connection/src/org/tizen/common/connection/properties/ConnectionExplorerInfoPropertyPages.java
new file mode 100644
index 000000000..4e333b12f
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/properties/ConnectionExplorerInfoPropertyPages.java
@@ -0,0 +1,209 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.properties;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import org.tizen.sdblib.FileListingService;
+import org.tizen.sdblib.FileListingService.FileEntry;
+
+public class ConnectionExplorerInfoPropertyPages extends PropertyPage implements IWorkbenchPropertyPage {
+
+
+ private static final String NAME_TITLE = "Name:";
+ private static final String PATH_TITLE = "Path:";
+ private static final String TYPE_TITLE = "Type:";
+ private static final String SIZE_TITLE = "Size:";
+ private static final String LAST_TITLE = "Last Modified:";
+
+ /**
+ * Constructor for SamplePropertyPage.
+ */
+ public ConnectionExplorerInfoPropertyPages() {
+ super();
+ }
+
+ private void addRtSection(Composite parent) {
+
+ Composite composite = createDefaultComposite(parent);
+
+ //Label for path field
+ Label pathLabel = new Label(composite, SWT.NONE);
+ pathLabel.setText(NAME_TITLE);
+
+ FileEntry f = (FileEntry) getElement().getAdapter(FileEntry.class);
+ Label pathValueText = new Label(composite, SWT.NONE);
+
+ pathValueText.setText(f.getName());
+ }
+
+ private void addFirstSection(Composite parent) {
+
+ Composite composite = createDefaultComposite(parent);
+
+ //Label for path field
+ Label pathLabel = new Label(composite, SWT.NONE);
+ pathLabel.setText(PATH_TITLE);
+
+ FileEntry f = (FileEntry) getElement().getAdapter(FileEntry.class);
+ // Path text field
+ Label pathValueText = new Label(composite, SWT.NONE);
+ pathValueText.setText(f.getFullPath());
+ }
+
+ private void addSeparator(Composite parent) {
+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ separator.setLayoutData(gridData);
+ }
+
+ private void addSecondSection(Composite parent) {
+
+ Composite composite = createDefaultComposite(parent);
+
+ //Label for path field
+ Label pathLabel = new Label(composite, SWT.NONE);
+ pathLabel.setText(TYPE_TITLE);
+
+ FileEntry f = (FileEntry) getElement().getAdapter(FileEntry.class);
+ // Path text field
+ Label pathValueText = new Label(composite, SWT.NONE);
+ pathValueText.setText(getType(f.getType()));
+
+ }
+
+ private void addThirdSection(Composite parent) {
+ Composite composite = createDefaultComposite(parent);
+
+ //Label for path field
+ Label pathLabel = new Label(composite, SWT.NONE);
+ pathLabel.setText(SIZE_TITLE);
+
+ FileEntry f = (FileEntry) getElement().getAdapter(FileEntry.class);
+ // Path text field
+ Label pathValueText = new Label(composite, SWT.NONE);
+ pathValueText.setText(f.getSize() + " bytes");
+ }
+
+
+ private void addFourthSection(Composite parent) {
+ Composite composite = createDefaultComposite(parent);
+
+ //Label for path field
+ Label pathLabel = new Label(composite, SWT.NONE);
+ pathLabel.setText(LAST_TITLE);
+
+ FileEntry f = (FileEntry) getElement().getAdapter(FileEntry.class);
+ // Path text field
+ Label pathValueText = new Label(composite, SWT.NONE);
+ pathValueText.setText(f.getDate() + " " + f.getTime());
+ }
+
+
+ /**
+ * @see PreferencePage#createContents(Composite)
+ */
+ protected Control createContents(Composite parent) {
+ noDefaultAndApplyButton();
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
+ data.grabExcessHorizontalSpace = true;
+ composite.setLayoutData(data);
+
+ FileEntry f = (FileEntry) getElement().getAdapter(FileEntry.class);
+ if (f.getType() == FileListingService.TYPE_ROOT_DEVICE ||
+ f.getType() == FileListingService.TYPE_ROOT_EMULATOR) {
+ addRtSection(composite);
+ } else {
+ addFirstSection(composite);
+ addSecondSection(composite);
+ addThirdSection(composite);
+ addFourthSection(composite);
+ addSeparator(composite);
+ }
+ return composite;
+ }
+
+ private Composite createDefaultComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData(data);
+
+ return composite;
+ }
+
+ public boolean performOk() {
+ return true;
+ }
+
+ private String getType(int type) {
+ switch(type) {
+ case 0:
+ return "File";
+ case 1:
+ return "Diretory";
+
+ case 2:
+ return "Directory Link";
+ case 3:
+ return "Block";
+ case 4:
+ return "Character";
+ case 5:
+ return "Type Link";
+ case 6:
+ return "Socket";
+ case 7:
+ return "Type Fifo";
+ case 8:
+ return "Type Other";
+ case 9:
+ return "Emulator";
+ case 10:
+ return "Device";
+ default:
+ return "Unknown";
+ }
+ }
+
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/properties/ConnectionExplorerPermissionPropertyPages.java b/org.tizen.common.connection/src/org/tizen/common/connection/properties/ConnectionExplorerPermissionPropertyPages.java
new file mode 100644
index 000000000..538a41112
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/properties/ConnectionExplorerPermissionPropertyPages.java
@@ -0,0 +1,170 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.properties;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+import org.tizen.sdblib.FileListingService;
+import org.tizen.sdblib.FileListingService.FileEntry;
+
+public class ConnectionExplorerPermissionPropertyPages extends PropertyPage {
+
+
+ private static final String PERMISSION_TITLE = "Permission:";
+
+ private TableItem itemUser;
+ private TableItem itemGroup;
+ private TableItem itemOther;
+
+
+ /**
+ * Constructor for SamplePropertyPage.
+ */
+ public ConnectionExplorerPermissionPropertyPages() {
+ super();
+
+ }
+
+ private void addFirstSection(Composite parent) {
+
+ FileEntry f = (FileEntry) getElement().getAdapter(FileEntry.class);
+ String permission = f.getPermissions();
+
+ itemUser.setText(1, permission.charAt(1) != '-' ? "O" : "X");
+ itemUser.setText(2, permission.charAt(2) != '-' ? "O" : "X");
+ itemUser.setText(3, permission.charAt(3) != '-' ? "O" : "X");
+
+ itemGroup.setText(1, permission.charAt(4) != '-' ? "O" : "X");
+ itemGroup.setText(2, permission.charAt(5) != '-' ? "O" : "X");
+ itemGroup.setText(3, permission.charAt(6) != '-' ? "O" : "X");
+
+ itemOther.setText(1, permission.charAt(7) != '-' ? "O" : "X");
+ itemOther.setText(2, permission.charAt(8) != '-' ? "O" : "X");
+ itemOther.setText(3, permission.charAt(9) != '-' ? "O" : "X");
+
+
+ }
+
+ private void addSeparator(Composite parent) {
+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ separator.setLayoutData(gridData);
+ }
+
+
+ /**
+ * @see PreferencePage#createContents(Composite)
+ */
+ protected Control createContents(Composite parent) {
+ noDefaultAndApplyButton();
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ composite.setLayoutData(data);
+
+ FileEntry f = (FileEntry) getElement().getAdapter(FileEntry.class);
+ if (f.getType() == FileListingService.TYPE_ROOT_DEVICE ||
+ f.getType() == FileListingService.TYPE_ROOT_EMULATOR) {
+ return composite;
+ }
+ createTable(composite);
+ addFirstSection(composite);
+ addSeparator(composite);
+ return composite;
+ }
+
+ private void createTable(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText(PERMISSION_TITLE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ group.setLayout(layout);
+ GridData data = new GridData();
+ data.horizontalSpan = 1;
+ group.setLayoutData(data);
+
+ Table table = new Table(group, SWT.BORDER);
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 3;
+ gridData.verticalSpan = 3;
+ table.setLayoutData(gridData);
+
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableColumn colMsg = createTableColumn(table, "", SWT.NONE,
+ "EXECUTE");
+ colMsg = createTableColumn(table, "Read", SWT.NONE,
+ "EXECUTE");
+ colMsg = createTableColumn(table, "Write", SWT.NONE,
+ "EXECUTE");
+ colMsg = createTableColumn(table, "Execute", SWT.NONE,
+ "EXECUTE");
+
+
+ itemUser = new TableItem(table, SWT.NONE);
+ itemUser.setText(0, "User");
+
+ itemGroup = new TableItem(table, SWT.NONE);
+ itemGroup.setText(0, "Group");
+
+ itemOther = new TableItem(table, SWT.NONE);
+ itemOther.setText(0, "Other");
+ }
+
+ private TableColumn createTableColumn(Table parent, String header,
+ int style, String sampleText) {
+
+ TableColumn col = new TableColumn(parent, style);
+
+ col.setText(sampleText);
+ col.setResizable(false);
+ col.pack();
+
+ col.setText(header);
+
+ return col;
+ }
+
+
+ public boolean performOk() {
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/sdblib/dnd/FileEntryDropAdapter.java b/org.tizen.common.connection/src/org/tizen/common/connection/sdblib/dnd/FileEntryDropAdapter.java
new file mode 100644
index 000000000..4b5084ac4
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/sdblib/dnd/FileEntryDropAdapter.java
@@ -0,0 +1,132 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Yoonki Park <yoonki.park@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.common.connection.sdblib.dnd;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.ui.part.IDropActionDelegate;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.connection.ddmuilib.FileDialogUtils;
+import org.tizen.common.connection.ddmuilib.console.DdmConsole;
+
+import org.tizen.sdblib.SdbCommandRejectedException;
+import org.tizen.sdblib.SyncService;
+import org.tizen.sdblib.SyncService.ISyncProgressMonitor;
+import org.tizen.sdblib.SyncService.SyncResult;
+import org.tizen.sdblib.TimeoutException;
+
+public class FileEntryDropAdapter implements IDropActionDelegate {
+
+ @Override
+ public boolean run(Object source, Object target) {
+ IResource resource = null;
+
+ if (target instanceof IAdaptable) {
+ target = ((IAdaptable) target).getAdapter(IResource.class);
+ if (target != null && target instanceof IResource) {
+ resource = (IResource) target;
+ if (resource.getType() == IResource.FILE && resource.getParent() != null)
+ resource = resource.getParent();
+ }
+ }
+
+ String[] entries = FileEntryTransfer.getInstance().fromByteArray(
+ (byte[]) source);
+
+ if (entries.length < 1)
+ return false;
+
+ SyncService sync = null;
+ try {
+ sync = ConnectionPlugin.getDefault().getCurrentDevice().getSyncService();
+ } catch (TimeoutException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if (sync != null) {
+ ISyncProgressMonitor monitor = SyncService.getNullProgressMonitor();
+ boolean isAlwayCopy = false;
+
+ for (int i = 0; i < entries.length; i++) {
+ File f = new File(entries[i]);
+ if (resource == null )
+ return false;
+ IPath localPath = resource.getFullPath().append(f.getName());
+ IResource newRes = resource.getWorkspace().getRoot().findMember(localPath);
+
+ String localFilePath = resource.getLocation().append(f.getName()).toOSString();
+
+ if (newRes != null) {
+ if (isAlwayCopy == false) {
+ int ret = FileDialogUtils.getInstance().checkOverwrite(f.getName());
+ switch (ret) {
+ case IDialogConstants.CANCEL_ID :
+ return false;
+ case IDialogConstants.YES_TO_ALL_ID :
+ isAlwayCopy = true;
+ break;
+ case IDialogConstants.NO_ID :
+ continue;
+ default:
+ }
+ }
+ }
+ SyncResult result = sync.pullFile(entries[i], localFilePath , monitor);
+
+ if (result.getCode() != SyncService.RESULT_OK) {
+ DdmConsole.printErrorToConsole(String.format(
+ "Failed to pull %1$s: %2$s",
+ localFilePath, result.getMessage()));
+ continue;
+ } else {
+ if (ResourcesPlugin.getWorkspace().isTreeLocked() == false) {
+ try {
+ resource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/sdblib/dnd/FileEntryTransfer.java b/org.tizen.common.connection/src/org/tizen/common/connection/sdblib/dnd/FileEntryTransfer.java
new file mode 100644
index 000000000..b51fcc7f5
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/sdblib/dnd/FileEntryTransfer.java
@@ -0,0 +1,104 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Yoonki Park <yoonki.park@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.common.connection.sdblib.dnd;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.eclipse.swt.dnd.ByteArrayTransfer;
+
+import org.tizen.sdblib.FileListingService.FileEntry;
+
+public class FileEntryTransfer extends ByteArrayTransfer {
+
+ private static FileEntryTransfer instance = new FileEntryTransfer();
+ private static final String TYPE_NAME = "sdb-transfer-format";
+ private static final int TYPE_ID = registerType(TYPE_NAME);
+
+ private FileEntryTransfer() { }
+
+ public static FileEntryTransfer getInstance() {
+ return instance;
+ }
+ @Override
+ protected int[] getTypeIds() {
+ return new int[] { TYPE_ID };
+ }
+ @Override
+ protected String[] getTypeNames() {
+ return new String[] { TYPE_NAME };
+ }
+
+ public byte[] toByteArray(FileEntry[] entries) {
+ ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
+ DataOutputStream out = new DataOutputStream(byteOut);
+
+ byte[] bytes = null;
+
+ try {
+ out.writeInt(entries.length);
+
+ for (int i = 0; i < entries.length; i++) {
+ FileEntry data = entries[i];
+ if (data instanceof FileEntry) {
+ try {
+ out.writeUTF(((FileEntry) data).getFullPath());
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ out.close();
+ bytes = byteOut.toByteArray();
+ } catch (IOException e) {
+ // when in doubt send nothing
+ }
+ return bytes;
+ }
+
+ public String[] fromByteArray(byte[] bytes) {
+ DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
+ try {
+ int n = in.readInt();
+
+ String[] paths = new String[n];
+ for (int i = 0; i < n; i++) {
+ String path = in.readUTF();
+ paths[i] = path;
+ }
+ return paths;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java b/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java
new file mode 100644
index 000000000..a572d5c37
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java
@@ -0,0 +1,409 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.ui;
+
+import java.io.File;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.contexts.IContextService;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+import org.eclipse.ui.part.ViewPart;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.connection.ddmuilib.ImageLoader;
+import org.tizen.common.connection.explorer.ConnectionExplorerPanel;
+import org.tizen.common.properties.InstallPathConfig;
+import org.tizen.common.util.HostUtil;
+
+
+public class ConnectionExplorer extends ViewPart {
+
+ private ConnectionExplorerPanel panel;
+ private ImageLoader mloader;
+ private ToolBar mToolBar;
+
+ private ToolItem pushToolItem;
+ private ToolItem pullToolItem;
+ private ToolItem emulStartToolItem;
+
+ private MenuManager subMenu;
+ private Action actionAddFolder;
+ private Action actionAddFile;
+ private Action actionPush;
+ private Action actionPull;
+ private Action actionRefresh;
+ private Action actionRename;
+ private Action actionProperty;
+ private Action actionDelete;
+
+ private MenuManager menuMgr;
+ private static ConnectionExplorer explorer;
+
+ private static final String BINARYMESSAGE = "Emulator is not installed or install path is not valid.";
+ private static final String EMULATOR_PATH = InstallPathConfig
+ .getEmulatorPath();
+ private static final String EMULATOR_BATCH = "bin" + File.separatorChar + "emulator-manager.exe";
+ private static final String EMULATOR_BINARY = "bin" + File.separatorChar + "emulator-manager";
+
+ public static ConnectionExplorer gerDefault() {
+ if (explorer == null) {
+ explorer = new ConnectionExplorer();
+ }
+
+ return explorer;
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ mloader = ImageLoader.getDdmUiLibLoader();
+
+ parent.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+ parent.setLayout(new GridLayout(1, false));
+
+ Composite top = new Composite(parent, SWT.NONE);
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 3;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 2;
+
+ top.setLayoutData(gridData);
+ top.setLayout(gridLayout);
+
+ createToolBar(top, gridData);
+
+ Composite bottom = new Composite(parent, SWT.NONE);
+ bottom.setLayoutData(new GridData(GridData.FILL_BOTH));
+ bottom.setLayout(new FillLayout());
+
+ createFileExplorerView(bottom);
+ makeActions();
+ activateContext();
+ initContextMenu();
+
+ panel.setToolItems(pushToolItem, pullToolItem, emulStartToolItem);
+
+ panel.setActions(subMenu, actionPush,
+ actionPull, actionRefresh, actionRename, actionProperty,
+ actionDelete);
+ }
+ private void createFileExplorerView(Composite parent) {
+
+ // device explorer
+ panel = new ConnectionExplorerPanel();
+ panel.createPanel(parent);
+ panel.getTreeViewer().getTree().addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent e) {
+ handleKeyPressed(e);
+ }
+ public void keyReleased(KeyEvent e) {
+ handleKeyPressed(e);
+ }
+ });
+
+ }
+ private void handleKeyPressed(KeyEvent event) {
+
+ if (event.keyCode == SWT.F5) {
+ actionRefresh();
+ } else if (event.keyCode == SWT.F2) {
+ actionRename();
+ } else if (event.keyCode == SWT.DEL) {
+ actionDelete();
+ }
+ if ((event.stateMask == SWT.ALT) && (event.keyCode == SWT.CR)) {
+ actionShowProperty();
+ }
+ }
+ private void actionAddFile() {
+
+ panel.addNewFileSelection();
+ }
+
+ private void actionAddFolder() {
+ panel.addNewFolderSelection();
+ }
+
+ private void actionPush() {
+ panel.pushIntoSelection();
+ }
+
+ private void actionPull() {
+ panel.pullSelection();
+ }
+
+ private void actionRefresh() {
+ panel.refreshSelection();
+ }
+ private void actionDelete() {
+ panel.deleteSelection();
+ }
+ private void actionRename() {
+ panel.renameSelection();
+ }
+ private void actionShowProperty() {
+ PropertyDialogAction pda = new PropertyDialogAction(getSite(),
+ panel.getTreeViewer());
+ pda.run();
+ }
+ /*
+ * make actions
+ */
+ private void makeActions() {
+ subMenu = new MenuManager("Add New..", null);
+
+ actionAddFile = new Action() {
+ public void run() {
+ actionAddFile();
+ }
+ };
+ actionAddFile.setText("Add File");
+
+ actionAddFolder = new Action() {
+ public void run() {
+ actionAddFolder();
+ }
+ };
+ actionAddFolder.setText("Add Folder");
+
+ actionPush = new Action() {
+ public void run() {
+ actionPush();
+ }
+ };
+ actionPush.setText("Push the file");
+
+ actionPull = new Action() {
+ public void run() {
+ actionPull();
+ }
+ };
+ actionPull.setText("Pull the Selection");
+
+ // Add refresh action
+ actionRefresh = new Action() {
+ public void run() {
+ actionRefresh();
+ }
+ };
+ actionRefresh.setText("Refresh");
+ actionRefresh
+ .setActionDefinitionId("org.tizen.common.connection.refresh");
+
+ actionRename = new Action() {
+ public void run() {
+ actionRename();
+ }
+ };
+
+ actionRename.setText("Rename");
+ actionRename
+ .setActionDefinitionId("org.tizen.common.connection.rename");
+
+ actionDelete = new Action() {
+ public void run() {
+ actionDelete();
+ }
+ };
+ actionDelete.setText("Delete");
+ actionDelete
+ .setActionDefinitionId("org.tizen.common.connection.delete");
+
+ actionProperty = new PropertyDialogAction(getSite(),
+ panel.getTreeViewer());
+ actionProperty
+ .setActionDefinitionId("org.tizen.common.connection.property");
+
+ }
+ private void initContextMenu() {
+ // initalize the context menu
+ menuMgr = new MenuManager("Connection Explorer MenuMgr"); //$NON-NLS-1$
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+
+ @Override
+ public void menuAboutToShow(IMenuManager manager) {
+ fillContextMenu(manager);
+ }
+ });
+
+ Menu menu = menuMgr.createContextMenu(panel.getTreeViewer().getTree());
+ panel.getTreeViewer().getTree().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, panel.getTreeViewer());
+
+ menuMgr.addMenuListener(new IMenuListener() {
+ @Override
+ public void menuAboutToShow(IMenuManager manager) {
+ // Remove team menu from our menu
+ IContributionItem[] items = manager.getItems();
+ if (items != null) {
+ for (int i = 0; i < items.length; i++) {
+ IContributionItem item = items[i];
+ if (item.getId() != null) {
+ if (item.getId().equals("team.main")) {
+ manager.remove(item);
+ break;
+ }
+ }
+ }
+ }
+ // Decide whether to enable/disable actions
+ panel.setActionState();
+ }
+ });
+ }
+
+ private void activateContext() {
+
+ IContextService contextService = (IContextService) getSite()
+ .getService(IContextService.class);
+ contextService
+ .activateContext("org.tizen.common.connection.delete.context");
+ contextService
+ .activateContext("org.tizen.common.connection.rename.context");
+ contextService
+ .activateContext("org.tizen.common.connection.refresh.context");
+ contextService
+ .activateContext("org.tizen.common.connection.property.context");
+
+ }
+ private void fillContextMenu(IMenuManager manager) {
+ subMenu.add(actionAddFile);
+ subMenu.add(actionAddFolder);
+ manager.add(subMenu);
+ manager.add(new Separator());
+ manager.add(actionPush);
+ manager.add(actionPull);
+ manager.add(new Separator());
+ manager.add(actionRefresh);
+ manager.add(new Separator());
+ manager.add(actionRename);
+ manager.add(actionDelete);
+ manager.add(new Separator());
+ manager.add(actionProperty);
+ manager.add(new Separator());
+ }
+
+ private void createToolBar(Composite shell, Object layoutData) {
+
+ mToolBar = new ToolBar(shell, SWT.NULL);
+ mToolBar.setLayoutData(layoutData);
+
+ ToolItem item = new ToolItem(mToolBar, SWT.SEPARATOR);
+
+ emulStartToolItem = new ToolItem(mToolBar, SWT.PUSH);
+ emulStartToolItem.setImage(mloader.loadImage("Emulator_start.gif",
+ shell.getDisplay()));
+ emulStartToolItem.setToolTipText("Emulator Manager");
+ emulStartToolItem.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ startEmulatorManager();
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+ });
+ emulStartToolItem.setEnabled(true);
+
+ item = new ToolItem(mToolBar, SWT.SEPARATOR);
+
+ pushToolItem = new ToolItem(mToolBar, SWT.PUSH);
+ pushToolItem
+ .setImage(mloader.loadImage("push.gif", shell.getDisplay()));
+ pushToolItem.setToolTipText("Push the files");
+ pushToolItem.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ panel.pushIntoSelection();
+ }
+ });
+ pushToolItem.setEnabled(false);
+
+ item = new ToolItem(mToolBar, SWT.SEPARATOR);
+
+ pullToolItem = new ToolItem(mToolBar, SWT.PUSH);
+ pullToolItem
+ .setImage(mloader.loadImage("pull.gif", shell.getDisplay()));
+ pullToolItem.setToolTipText("Pull the selection");
+ pullToolItem.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ panel.pullSelection();
+ }
+ });
+ pullToolItem.setEnabled(false);
+ item = new ToolItem(mToolBar, SWT.SEPARATOR);
+
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+ private void startEmulatorManager() throws Exception {
+ String exePath = null;
+ int osType = ConnectionPlugin.getDefault().os;
+ int linuxType = ConnectionPlugin.getDefault().LINUX;
+
+ if (osType == linuxType) {
+ exePath = EMULATOR_PATH + File.separatorChar + EMULATOR_BINARY;
+ } else {
+ exePath = EMULATOR_PATH + File.separatorChar + EMULATOR_BATCH;
+ }
+
+ if (exePath.equals("") || (!exePath.equals("") && !HostUtil.exists(exePath))) {
+ throw new Exception(BINARYMESSAGE);
+ }
+
+ // FIXME : should implement the lines below based on windows system.
+ String command = exePath;
+ if (osType == linuxType) {
+ command = command + " 1>/dev/null 2>/dev/null &";
+
+ HostUtil.execute(command);
+ } else {
+ HostUtil.batchExecute(command, null, new File(EMULATOR_PATH));
+ }
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java b/org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java
new file mode 100644
index 000000000..6c73dad2f
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ui/LogView.java
@@ -0,0 +1,230 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Hyunsik Noh <hyunsik.noh@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.common.connection.ui;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.ViewPart;
+import org.tizen.common.connection.ConnectionPlugin;
+import org.tizen.common.connection.log.LogColors;
+import org.tizen.common.connection.log.LogPanel;
+
+import org.tizen.sdblib.Log.LogLevel;
+
+/**
+ * The log cat view displays log output from the current device selection.
+ *
+ */
+public final class LogView extends ViewPart {
+
+ public static final String ID = "org.tizen.common.connection.ui.LogView"; //$NON-NLS-1$
+
+ private LogPanel logPanel;
+
+ private Action addAction;
+ private Action removeAction;
+ private Action editAction;
+ private Action exportAction;
+ private Action clearAction;
+
+ private Action[] logLevelActions;
+ private String[] logLevelIcons = { "icons/log/v.png", //$NON-NLS-1S
+ "icons/log/d.png", //$NON-NLS-1S
+ "icons/log/i.png", //$NON-NLS-1S
+ "icons/log/w.png", //$NON-NLS-1S
+ "icons/log/e.png", //$NON-NLS-1S
+ };
+
+ private Clipboard clipboard;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ Display d = parent.getDisplay();
+ LogColors colors = new LogColors();
+
+ colors.infoColor = new Color(d, 0, 127, 0);
+ colors.debugColor = new Color(d, 0, 0, 127);
+ colors.errorColor = new Color(d, 255, 0, 0);
+ colors.warningColor = new Color(d, 255, 127, 0);
+ colors.verboseColor = new Color(d, 0, 0, 0);
+
+ addAction = new Action("add Tab") {
+ @Override
+ public void run() {
+ logPanel.addTab();
+ }
+ };
+ addAction.setToolTipText("Add LogTab");
+ addAction.setImageDescriptor(ConnectionPlugin.getImageDescriptorFromPlugin("icons/log/Add tab.png"));
+
+ removeAction = new Action("Remove Tab") {
+ @Override
+ public void run() {
+ logPanel.removeTab();
+ }
+ };
+ removeAction.setToolTipText("Remove LogTab");
+ removeAction.setImageDescriptor(ConnectionPlugin.getImageDescriptorFromPlugin("icons/log/Remove tab.png"));
+
+ editAction = new Action("Edit Tab") {
+ @Override
+ public void run() {
+ logPanel.editTab();
+ }
+ };
+ editAction.setToolTipText("Edit LogTab");
+ editAction.setImageDescriptor(ConnectionPlugin.getImageDescriptorFromPlugin("icons/log/Edit tab.png"));
+
+ exportAction = new Action("Export Log") {
+ @Override
+ public void run() {
+ logPanel.save();
+ }
+ };
+ exportAction.setToolTipText("Export Log");
+ exportAction.setImageDescriptor(
+ ConnectionPlugin.getImageDescriptorFromPlugin("icons/log/Export Log.png")); //$NON-NLS-1$
+
+ clearAction = new Action("Clear Log") {
+ @Override
+ public void run() {
+ logPanel.clear();
+ }
+ };
+ clearAction.setToolTipText("Clear Log");
+ clearAction.setImageDescriptor(
+ ConnectionPlugin.getImageDescriptorFromPlugin("icons/log/Clear Log.png")); //$NON-NLS-1$
+
+ LogLevel[] levels = LogLevel.values();
+ logLevelActions = new Action[logLevelIcons.length];
+ for (int i = 0; i < logLevelActions.length; i++) {
+ String name = levels[i].getStringValue();
+ logLevelActions[i] = new Action(name, IAction.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ // disable the other actions and record
+ // current index
+ for (int i = 0; i < logLevelActions.length; i++) {
+ Action a = logLevelActions[i];
+ if (a == this) {
+ if (logPanel.getCurrentLogTab() != null) {
+ if (a.isChecked())
+ a.setChecked(a.isChecked());
+ logPanel.getCurrentLogTab().setLevel(i , a.isChecked());
+ logPanel.getCurrentLogTab().refill();
+ }
+ }
+ }
+ }
+ };
+ logLevelActions[i].setChecked(true);
+ logLevelActions[i].setToolTipText(name);
+ logLevelActions[i].setImageDescriptor(ConnectionPlugin.getImageDescriptorFromPlugin(logLevelIcons[i]));
+ }
+
+ // now create the log view
+ logPanel = new LogPanel(colors);
+
+ logPanel.setActions(logLevelActions, addAction, removeAction, editAction, exportAction, clearAction);
+ placeActions();
+ logPanel.setActionEnabled(LogPanel.ENABLE_NOTHING);
+ logPanel.createPanel(parent);
+
+ // setup the copy action
+ clipboard = new Clipboard(d);
+ IActionBars actionBars = getViewSite().getActionBars();
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), new Action("Copy") {
+ @Override
+ public void run() {
+ logPanel.copy(clipboard);
+ }
+ });
+
+ // setup the select all action
+ actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), new Action(
+ "Select All") {
+ @Override
+ public void run() {
+ logPanel.selectAll();
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ logPanel.stopAll();
+ }
+
+ @Override
+ public void setFocus() {
+ logPanel.setFocus();
+ }
+
+ /**
+ * Place the actions in the ui.
+ */
+ private void placeActions() {
+ IActionBars actionBars = getViewSite().getActionBars();
+
+ // first in the menu
+ IMenuManager menuManager = actionBars.getMenuManager();
+ menuManager.add(addAction);
+ menuManager.add(removeAction);
+ menuManager.add(editAction);
+ menuManager.add(new Separator());
+ menuManager.add(exportAction);
+ menuManager.add(clearAction);
+ menuManager.add(new Separator());
+
+ // and then in the toolbar
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ toolBarManager.add(new Separator());
+ for (Action a : logLevelActions) {
+ toolBarManager.add(a);
+ }
+ toolBarManager.add(new Separator());
+ toolBarManager.add(addAction);
+ toolBarManager.add(removeAction);
+ toolBarManager.add(editAction);
+ toolBarManager.add(new Separator());
+ toolBarManager.add(exportAction);
+ toolBarManager.add(clearAction);
+ toolBarManager.add(new Separator());
+ }
+
+ public LogPanel getPanel() {
+ return logPanel;
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileContentProvider.java b/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileContentProvider.java
new file mode 100644
index 000000000..164482c15
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileContentProvider.java
@@ -0,0 +1,132 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Yoonki Park <yoonki.park@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.common.connection.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+import org.tizen.sdblib.FileListingService;
+import org.tizen.sdblib.FileListingService.FileEntry;
+
+public class TizenRemoteFileContentProvider implements ITreeContentProvider {
+
+ private boolean isDirOnly = false;
+ private boolean isInitialized = false;
+
+ public void setInitialize(boolean initialize) {
+ isInitialized = initialize;
+ }
+
+ TizenRemoteFileContentProvider(boolean pIsDirOnly) {
+ isDirOnly = pIsDirOnly;
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public Object[] getChildren(Object arg0) {
+ if (arg0 instanceof FileEntry) {
+ FileEntry parent = (FileEntry) arg0;
+ FileEntry[] children = null;
+
+ if (isInitialized == false)
+ children = parent.getCachedChildren();
+ else
+ children = parent.getFileListingService().getChildren(parent, false, null);
+
+ List<FileEntry> entries = new ArrayList<FileEntry>();
+ for (FileEntry child : children) {
+ if (isDirOnly == true) {
+ if (child.isDirectory()) {
+ entries.add(child);
+ }
+ } else {
+ entries.add(child);
+ }
+ }
+ return entries.toArray();
+ } else
+ return new Object[0];
+ }
+
+ @Override
+ public Object[] getElements(Object arg0) {
+ if (arg0 instanceof FileEntry) {
+ FileEntry parent = (FileEntry) arg0;
+ FileEntry[] children = parent.getCachedChildren();
+ List<FileEntry> entries = new ArrayList<FileEntry>();
+ for (FileEntry child : children) {
+ if (isDirOnly == true) {
+ if (child.isDirectory()) {
+ entries.add(child);
+ }
+ } else {
+ entries.add(child);
+ }
+ }
+ return entries.toArray();
+ }
+ return null;
+ }
+
+ @Override
+ public Object getParent(Object arg0) {
+ if (arg0 instanceof FileEntry) {
+ FileEntry entry = (FileEntry) arg0;
+ return entry.getParent();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(Object arg0) {
+ if (arg0 instanceof FileEntry) {
+ FileEntry entry = (FileEntry) arg0;
+ if (entry.getType() == FileListingService.TYPE_DIRECTORY_LINK)
+ return true;
+ else if (entry.getType() == FileListingService.TYPE_LINK)
+ return true;
+ else if (entry.getType() == FileListingService.TYPE_DIRECTORY)
+ return true;
+ else if (entry.getType() == FileListingService.TYPE_ROOT_EMULATOR)
+ return true;
+ else if (entry.getType() == FileListingService.TYPE_ROOT_DEVICE)
+ return true;
+ else
+ return false;
+ }
+ return false;
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileDialog.java b/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileDialog.java
new file mode 100644
index 000000000..d5ec924f9
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileDialog.java
@@ -0,0 +1,329 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Yoonki Park <yoonki.park@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.common.connection.ui;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
+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.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+
+import org.tizen.sdblib.FileListingService.FileEntry;
+import org.tizen.sdblib.IDevice;
+
+public class TizenRemoteFileDialog {
+
+ public enum TizenRemoteFileDialogResult {
+ OK,
+ CANCEL
+ }
+
+ private TizenRemoteFileDialogResult result = TizenRemoteFileDialogResult.CANCEL;
+ private IDevice device;
+ private Shell shell;
+ private Display display;
+ private boolean isDirOnly = false;
+ private Label path;
+ private String defaultPath;
+ private FileEntry selectedDir;
+ private Tree pathTree;
+ private TreeViewer pathTreeViewer;
+
+ TizenRemoteFileContentProvider remoteContentProvider = null;
+
+ public TizenRemoteFileDialog(Shell parent, String dlgTitle, IDevice device,
+ boolean isDirOnly, String defaultPath)
+ throws IllegalArgumentException {
+
+ if (parent == null || device == null)
+ throw new IllegalArgumentException();
+
+ display = parent.getDisplay();
+ shell = createNewShell(parent);
+ shell.setText(dlgTitle);
+ shell.setSize(300, 400);
+
+ this.device = device;
+ this.isDirOnly = isDirOnly;
+
+ if (defaultPath != null)
+ this.defaultPath = defaultPath;
+ else
+ this.defaultPath = "/";
+
+ createControls(shell);
+ }
+
+ public TizenRemoteFileDialogResult open() {
+ shell.open();
+ runEventLoop(shell);
+ return result;
+ }
+
+ public FileEntry getSelectedFileEntry() {
+ return selectedDir;
+ }
+
+ private void createControls(Composite parent) {
+ Composite upper = new Composite(parent, SWT.NONE);
+ setUpperLayout(upper);
+ createPathLabels(upper);
+ createPathTree(upper);
+ fillPathTree();
+ Composite lower = new Composite(parent, SWT.NONE);
+ setLowerLayout(lower);
+ createButtons(lower);
+ }
+
+ private void fillPathTree() {
+ createTreeColumn();
+ createTreeViewer();
+
+ FileEntry root = device.getFileListingService().getRoot();
+ String[] defaultExpandedPath = defaultPath.substring(1).split("/");
+ cacheChild(root, defaultExpandedPath);
+
+ pathTreeViewer.setInput(root);
+ pathTreeViewer.expandAll();
+
+ selectDefaultPath(defaultExpandedPath);
+
+ remoteContentProvider.setInitialize(true);
+ pathTreeViewer.refresh();
+
+ pathTree.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TreeItem[] items = pathTree.getSelection();
+ if (items.length == 1) {
+ Object object = items[0].getData();
+ if (object instanceof FileEntry) {
+ selectedDir = (FileEntry) object;
+ path.setText(selectedDir.getFullPath());
+ }
+ }
+ }
+ });
+ }
+
+ private void selectDefaultPath(String[] defaultExpandedPath) {
+ TreeItem[] items = pathTree.getItems();
+ TreeItem found = null;
+ for (int i = 0; i < defaultExpandedPath.length; i++) {
+ if (found != null)
+ items = found.getItems();
+ for (TreeItem item : items) {
+ Object data = item.getData();
+ if (data instanceof FileEntry) {
+ FileEntry entry = (FileEntry) data;
+ if (entry.getName().equals(defaultExpandedPath[i])) {
+ found = item;
+ break;
+ }
+ }
+ }
+ }
+
+ if (found != null) {
+ pathTree.select(found);
+ Object data = found.getData();
+ if (data instanceof FileEntry) {
+ FileEntry entry = (FileEntry) data;
+ selectedDir = entry;
+ }
+ }
+ }
+
+ private void createTreeViewer() {
+ pathTreeViewer = new TreeViewer(pathTree);
+ remoteContentProvider = new TizenRemoteFileContentProvider(isDirOnly);
+ pathTreeViewer.setContentProvider(remoteContentProvider);
+ ITableLabelProvider remoteLabelProvider = new TizenRemoteFileLabelProvider(display);
+ pathTreeViewer.setLabelProvider(remoteLabelProvider);
+ }
+
+ private void createTreeColumn() {
+ TreeColumn nameColumn = new TreeColumn(pathTree, SWT.LEFT);
+ nameColumn.setText("Name");
+ nameColumn.setWidth(100);
+ }
+
+ private void cacheChild(FileEntry root, String[] defaultExpandedPath) {
+ FileEntry[] children = root.getFileListingService().getChildren(root, true, null);
+ for (String dir : defaultExpandedPath) {
+ for (FileEntry child : children) {
+ if (dir.equals(child.getName())) {
+ children = child.getFileListingService().getChildren(child, true, null);
+ break;
+ }
+ }
+ }
+ }
+
+ private Shell createNewShell(Shell parent) {
+ shell = new Shell(display, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+ setDefaultLayout();
+ return shell;
+ }
+
+ private void setDefaultLayout() {
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ shell.setLayout(layout);
+ }
+
+ private void setUpperLayout(Composite composite) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(data);
+ }
+
+ private void setLowerLayout(Composite composite) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.END;
+ composite.setLayoutData(data);
+ }
+
+ private void createPathLabels(Composite parent) {
+ Label pathLabel = new Label(parent, SWT.NONE);
+ setPathLabelLayout(pathLabel);
+ pathLabel.setText("Path : ");
+
+ path = new Label(parent, SWT.NONE);
+ setPathLayout(path);
+ path.setText(defaultPath);
+ }
+
+ private void setPathLabelLayout(Label label) {
+ GridData data = new GridData();
+ label.setLayoutData(data);
+ }
+
+ private void setPathLayout(Label pPath) {
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ pPath.setLayoutData(data);
+ }
+
+ private void createPathTree(Composite pParent) {
+ pathTree = new Tree(pParent, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
+ setTreeLayout(pathTree);
+ }
+
+ private void setTreeLayout(Tree tree) {
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 2;
+ tree.setLayoutData(data);
+ }
+
+ private void createButtons(Composite parent) {
+ Button okButton = new Button(parent, SWT.PUSH);
+ setOkButtonLayout(okButton);
+ okButton.setText("OK");
+ okButton.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.MouseUp:
+ if (event.button == 1) {
+ result = TizenRemoteFileDialogResult.OK;
+ shell.dispose();
+ }
+ break;
+ default:
+
+ }
+ }
+ });
+
+ Button cancelButton = new Button(parent, SWT.PUSH);
+ setCancelButtonLayout(okButton);
+ cancelButton.setText("Cancel");
+ cancelButton.addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.MouseUp:
+ if (event.button == 1) {
+ result = TizenRemoteFileDialogResult.CANCEL;
+ shell.dispose();
+ }
+ break;
+ default:
+ }
+ }
+ });
+ }
+
+ private void setOkButtonLayout(Button button) {
+ GridData data = new GridData();
+ data.widthHint = 50;
+ button.setLayoutData(data);
+ }
+
+ private void setCancelButtonLayout(Button button) {
+ GridData data = new GridData();
+ data.widthHint = 50;
+ button.setLayoutData(data);
+ }
+
+ private void runEventLoop(Shell loopShell) {
+ Display tmpDisplay = null;
+
+ if (shell == null)
+ tmpDisplay = Display.getCurrent();
+ else
+ tmpDisplay = loopShell.getDisplay();
+
+ while (loopShell != null && !loopShell.isDisposed()) {
+ try {
+ if (!tmpDisplay.readAndDispatch())
+ tmpDisplay.sleep();
+ } catch (SWTException e) {
+ e.printStackTrace();
+ }
+ }
+ display.update();
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileImageLoader.java b/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileImageLoader.java
new file mode 100644
index 000000000..20e8ed8cb
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileImageLoader.java
@@ -0,0 +1,190 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Yoonki Park <yoonki.park@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.common.connection.ui;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+public class TizenRemoteFileImageLoader {
+
+ private static final String PATH = "/icons/"; //$NON-NLS-1$
+
+ private final HashMap<String, Image> mLoadedImages = new HashMap<String, Image>();
+ private static final HashMap<Class<?>, TizenRemoteFileImageLoader> INSTANCES =
+ new HashMap<Class<?>, TizenRemoteFileImageLoader>();
+ private final Class<?> mClass;
+
+ /**
+ * Private constructor, creating an instance associated with a class.
+ * The class is used to identify which jar file the images are loaded from.
+ */
+ private TizenRemoteFileImageLoader(Class<?> theClass) {
+ if (theClass == null) {
+ theClass = TizenRemoteFileImageLoader.class;
+ }
+ mClass = theClass;
+ }
+
+ /**
+ * Returns the {@link ImageLoader} instance to load images from ddmuilib.jar
+ */
+ public static TizenRemoteFileImageLoader getLoader() {
+ return getLoader(null);
+ }
+
+ /**
+ * Returns an {@link ImageLoader} to load images based on a given class.
+ *
+ * The loader will load images from the jar from which the class was loaded. using
+ * {@link Class#getResource(String)} and {@link Class#getResourceAsStream(String)}.
+ *
+ * Since all images are loaded using the path /images/<var>filename</var>, any class from the
+ * jar will work. However since the loader is cached and reused when the query provides the same
+ * class instance, and since the loader will also cache the loaded images, it is recommended
+ * to always use the same class for a given Jar file.
+ *
+ */
+ public static TizenRemoteFileImageLoader getLoader(Class<?> theClass) {
+ TizenRemoteFileImageLoader instance = INSTANCES.get(theClass);
+ if (instance == null) {
+ instance = new TizenRemoteFileImageLoader(theClass);
+ INSTANCES.put(theClass, instance);
+ }
+
+ return instance;
+ }
+
+ /**
+ * Disposes all images for all instances.
+ * This should only be called when the program exits.
+ */
+ public static void dispose() {
+ for (TizenRemoteFileImageLoader loader : INSTANCES.values()) {
+ loader.doDispose();
+ }
+ }
+
+ private synchronized void doDispose() {
+ for (Image image : mLoadedImages.values()) {
+ image.dispose();
+ }
+
+ mLoadedImages.clear();
+ }
+
+ /**
+ * Returns an {@link ImageDescriptor} for a given filename.
+ *
+ * This searches for an image located at /images/<var>filename</var>.
+ *
+ * @param filename the filename of the image to load.
+ */
+ public ImageDescriptor loadDescriptor(String filename) {
+ URL url = mClass.getResource(PATH + filename);
+ // TODO cache in a map
+ return ImageDescriptor.createFromURL(url);
+ }
+
+ /**
+ * Returns an {@link Image} for a given filename.
+ *
+ * This searches for an image located at /images/<var>filename</var>.
+ *
+ * @param filename the filename of the image to load.
+ * @param display the Display object
+ */
+ public synchronized Image loadImage(String filename, Display display) {
+ Image img = mLoadedImages.get(filename);
+ if (img == null) {
+ String tmp = PATH + filename;
+ InputStream imageStream = mClass.getResourceAsStream(tmp);
+
+ if (imageStream != null) {
+ img = new Image(display, imageStream);
+ mLoadedImages.put(filename, img);
+ return img;
+ }
+ }
+ return img;
+ }
+
+ /**
+ * Loads an image from a resource. This method used a class to locate the
+ * resources, and then load the filename from /images inside the resources.<br>
+ * Extra parameters allows for creation of a replacement image of the
+ * loading failed.
+ *
+ * @param loader the image loader used.
+ * @param display the Display object
+ * @param fileName the file name
+ * @param width optional width to create replacement Image. If -1, null be
+ * be returned if the loading fails.
+ * @param height optional height to create replacement Image. If -1, null be
+ * be returned if the loading fails.
+ * @param phColor optional color to create replacement Image. If null, Blue
+ * color will be used.
+ * @return a new Image or null if the loading failed and the optional
+ * replacement size was -1
+ */
+ public Image loadImage(Display display, String fileName, int width, int height,
+ Color phColor) {
+
+ Image img = loadImage(fileName, display);
+
+ if (img == null) {
+ if (width != -1 && height != -1) {
+ return createPlaceHolderArt(display, width, height,
+ phColor != null ? phColor : display
+ .getSystemColor(SWT.COLOR_BLUE));
+ }
+ return null;
+ }
+
+ return img;
+ }
+
+ /**
+ * Create place-holder art with the specified color.
+ */
+ public static Image createPlaceHolderArt(Display display, int width,
+ int height, Color color) {
+ Image img = new Image(display, width, height);
+ GC gc = new GC(img);
+ gc.setForeground(color);
+ gc.drawLine(0, 0, width, height);
+ gc.drawLine(0, height - 1, width, -1);
+ gc.dispose();
+ return img;
+ }
+}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileLabelProvider.java b/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileLabelProvider.java
new file mode 100644
index 000000000..25931bdc6
--- /dev/null
+++ b/org.tizen.common.connection/src/org/tizen/common/connection/ui/TizenRemoteFileLabelProvider.java
@@ -0,0 +1,138 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Hoon Kang <h245.kang@samsung.com>
+* Yoonki Park <yoonki.park@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.common.connection.ui;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+import org.tizen.sdblib.FileListingService;
+import org.tizen.sdblib.FileListingService.FileEntry;
+import org.tizen.sdblib.IDevice;
+
+public class TizenRemoteFileLabelProvider implements ITableLabelProvider {
+
+ private Image mFileImage;
+ private Image mFolderImage;
+ private Image mFileLinkImage;
+ private Image mFolderLinkImage;
+ private Image mOtherImage;
+ private Image mEmulatorImage;
+ private Image mDeviceImage;
+ public static int index;
+
+ public TizenRemoteFileLabelProvider(Display display) {
+ TizenRemoteFileImageLoader loader = TizenRemoteFileImageLoader.getLoader();
+
+ mFileImage = loader.loadImage("file.gif", display);
+ mFolderImage = loader.loadImage("directory.gif", display);
+ mFileLinkImage = loader.loadImage("file_link.gif", display);
+ mFolderLinkImage = loader.loadImage("directory_link.gif", display);
+ mOtherImage = loader.loadImage("file.gif", display);
+ mEmulatorImage = loader.loadImage("emulator.gif", display);
+ mDeviceImage = loader.loadImage("device.gif", display);
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ if (element instanceof FileEntry) {
+ FileEntry entry = (FileEntry) element;
+ switch (entry.getType()) {
+ case FileListingService.TYPE_FILE:
+ return mFileImage;
+ case FileListingService.TYPE_LINK:
+ return mFileLinkImage;
+ case FileListingService.TYPE_DIRECTORY:
+ return mFolderImage;
+ case FileListingService.TYPE_DIRECTORY_LINK:
+ return mFolderLinkImage;
+ case FileListingService.TYPE_ROOT_EMULATOR:
+ return mEmulatorImage;
+ case FileListingService.TYPE_ROOT_DEVICE:
+ return mDeviceImage;
+ default:
+ return mOtherImage;
+ }
+ }
+ // default case return a different image.
+ return mOtherImage;
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof FileEntry) {
+ FileEntry entry = (FileEntry) element;
+
+ switch (columnIndex) {
+ case 0:
+ return entry.getName();
+ case 1:
+ {
+ switch(index) {
+ case 0:
+ return entry.getSize();
+ case 1:
+ return entry.getDate();
+ case 2:
+ return entry.getTime();
+ case 3:
+ return entry.getPermissions();
+ case 4:
+ return entry.getInfo();
+ default:
+ }
+ }
+ default:
+ }
+ } else if (element instanceof IDevice) {
+ IDevice device = (IDevice) element;
+ return device.getSerialNumber();
+ }
+ return null;
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+}
diff --git a/org.tizen.common.feature/.project b/org.tizen.common.feature/.project
new file mode 100644
index 000000000..1443466ed
--- /dev/null
+++ b/org.tizen.common.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.tizen.common.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.tizen.common.feature/LICENSE-2.0.htm b/org.tizen.common.feature/LICENSE-2.0.htm
new file mode 100644
index 000000000..f7ca65649
--- /dev/null
+++ b/org.tizen.common.feature/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 &quot;License&quot;); 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 &quot;AS IS&quot; 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 &#169; 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.common.feature/build.properties b/org.tizen.common.feature/build.properties
new file mode 100644
index 000000000..bee14d1b4
--- /dev/null
+++ b/org.tizen.common.feature/build.properties
@@ -0,0 +1,6 @@
+bin.includes = feature.xml,\
+ license.html,\
+ feature.properties,\
+ epl-v10.html,\
+ LICENSE-2.0.htm
+root = rootfiles
diff --git a/org.tizen.common.feature/feature.xml b/org.tizen.common.feature/feature.xml
new file mode 100644
index 000000000..7ea234da9
--- /dev/null
+++ b/org.tizen.common.feature/feature.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.tizen.common.feature"
+ label="Tizen Common Tools"
+ version="0.20.0.qualifier"
+ provider-name="Samsung"
+ plugin="org.tizen.base.platform"
+ license-feature="org.tizen.base.feature">
+
+ <description>
+ Common library for Tizen SDK.
+ </description>
+
+ <copyright>
+ Copyright (c) 2010-2011, Samsung Electronics Co., LTD. All rights reserved.
+ </copyright>
+
+ <license url="license.html">
+ Tizen SDK
+
+Tizen SDK contains software portions licensed under various open source licenses as well as proprietary components. All open source software portions (&quot;Open Source Software&quot;) are licensed under the open source licenses that accompany such Open Source Software.
+
+The licenses governing the Open Source Software are available at: http://developer.tizen.org/download/tizen_sdk_opensource_license.html
+
+Except for the Open Source Software contained in Tizen SDK, all other software portions contained in Tizen SDK are governed by the terms and conditions of the Tizen Software Development Kit License Agreement, available at: http://developer.tizen.org/download/samsung_sdk_license.html
+
+You may access and download Tizen SDK Open Source Software at: http://developer.tizen.org/download/tizenopensdk.tar.gz
+
+BY CLICKING THE &quot;I AGREE&quot; BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS AND THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT. IF YOU DO NOT AGREE WITH THE OPEN SOURCE SOFTWARE LICENSE TERMS OR THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT, YOU MAY NOT DOWNLOAD OR USE TIZEN SDK.
+ </license>
+
+ <plugin
+ id="org.tizen.common"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.tizen.common.connection"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/org.tizen.common.feature/license.html b/org.tizen.common.feature/license.html
new file mode 100644
index 000000000..25451077f
--- /dev/null
+++ b/org.tizen.common.feature/license.html
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!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>Tizen SOFTWARE DEVELOPMENT KIT (&quot;SDK&quot;) LICENSE AGREEMENT</title>
+</head>
+
+<body lang="EN-US">
+ <p align="center">Tizen SDK</p><br /><br />
+
+Tizen SDK contains software portions licensed under various open source licenses as well as proprietary components. All open source software portions ("Open Source Software") are licensed under the open source licenses that accompany such Open Source Software.<br /><br />
+
+The licenses governing the Open Source Software are available at: <a href="http://developer.tizen.org/download/tizen_sdk_opensource_license.html">http://developer.tizen.org/download/tizen_sdk_opensource_license.html</a><br /><br />
+
+Except for the Open Source Software contained in Tizen SDK, all other software portions contained in Tizen SDK are governed by the terms and conditions of the Tizen Software Development Kit License Agreement, available at: <a href="http://developer.tizen.org/download/samsung_sdk_license.html">http://developer.tizen.org/download/samsung_sdk_license.html</a><br /><br />
+
+You may access and download Tizen SDK Open Source Software at: <a href="http://developer.tizen.org/download/tizenopensdk.tar.gz">http://developer.tizen.org/download/tizenopensdk.tar.gz</a><br /><br />
+
+BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS AND THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT. IF YOU DO NOT AGREE WITH THE OPEN SOURCE SOFTWARE LICENSE TERMS OR THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT, YOU MAY NOT DOWNLOAD OR USE TIZEN SDK.<br /><br />
+</body>
+</html>
diff --git a/org.tizen.common.feature/rootfiles/resources/icons/tizen-sdk-ide.ico b/org.tizen.common.feature/rootfiles/resources/icons/tizen-sdk-ide.ico
new file mode 100644
index 000000000..35e30a873
--- /dev/null
+++ b/org.tizen.common.feature/rootfiles/resources/icons/tizen-sdk-ide.ico
Binary files differ
diff --git a/org.tizen.common/.classpath b/org.tizen.common/.classpath
new file mode 100644
index 000000000..c619f68c7
--- /dev/null
+++ b/org.tizen.common/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="sdblib.jar"/>
+ <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.common/.project b/org.tizen.common/.project
new file mode 100644
index 000000000..b4551d98a
--- /dev/null
+++ b/org.tizen.common/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.tizen.common</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.common/META-INF/MANIFEST.MF b/org.tizen.common/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..10823da4d
--- /dev/null
+++ b/org.tizen.common/META-INF/MANIFEST.MF
@@ -0,0 +1,30 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tizen Common
+Bundle-SymbolicName: org.tizen.common;singleton:=true
+Bundle-Version: 1.17.0.qualifier
+Bundle-Vendor: Samsung
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.ide,
+ org.eclipse.core.resources,
+ org.eclipse.core.filesystem
+Export-Package:
+ org.tizen.sdblib,
+ org.tizen.common.cache,
+ org.tizen.common.console,
+ org.tizen.common.control,
+ org.tizen.common.log,
+ org.tizen.common.manager,
+ org.tizen.common.model,
+ org.tizen.common.properties,
+ org.tizen.common.swt,
+ org.tizen.common.util
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package:
+ org.eclipse.jface.text,
+ org.eclipse.ui.console
+Bundle-Activator: org.tizen.common.CommonPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: sdblib.jar,
+ .
diff --git a/org.tizen.common/OSGI-INF/l10n/bundle.properties b/org.tizen.common/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 000000000..99ec9ad7c
--- /dev/null
+++ b/org.tizen.common/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,3 @@
+activity.name = newXsdDisabler
+activity.name.0 = newDtdDisabler
+activity.name.1 = ValidateMenuItemDisabler \ No newline at end of file
diff --git a/org.tizen.common/about.html b/org.tizen.common/about.html
new file mode 100644
index 000000000..95bb5ff8f
--- /dev/null
+++ b/org.tizen.common/about.html
@@ -0,0 +1,41 @@
+<!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>Third Party Content</h3>
+
+<p>The Content includes items that have been sourced from third parties as set out below. If you did not
+receive this Content directly from the Eclipse Foundation, the following is provided for informational
+purposes only, and you should look to the Redistributor's license for terms and conditions of use.</p>
+
+<h4>Notification Popup Widget</h4>
+<p>
+Custom widget that displays a popup notification dialog in the bottom right corner of your screen(usually above the toolbar on Windows).
+</p>
+
+<p>
+A copy of the license is included in <a href="about_files/epl-v10.html">about_files/epl-v10.html</a>. The home page is located at:
+<ul>
+<a href="http://www.hexapixel.com/">http://www.hexapixel.com/</a>
+</ul>
+</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.tizen.common/about_files/LICENSE-2.0.htm b/org.tizen.common/about_files/LICENSE-2.0.htm
new file mode 100644
index 000000000..f7ca65649
--- /dev/null
+++ b/org.tizen.common/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 &quot;License&quot;); 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 &quot;AS IS&quot; 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 &#169; 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.common/build.properties b/org.tizen.common/build.properties
new file mode 100644
index 000000000..889acffc9
--- /dev/null
+++ b/org.tizen.common/build.properties
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ icons/,\
+ sdblib.jar,\
+ about.html,\
+ about_files/,\
+ plugin.xml
+javacSource = 1.6
+javacTarget = 1.6
diff --git a/org.tizen.common/icons/connected.png b/org.tizen.common/icons/connected.png
new file mode 100644
index 000000000..f2ace41fe
--- /dev/null
+++ b/org.tizen.common/icons/connected.png
Binary files differ
diff --git a/org.tizen.common/icons/connecting.png b/org.tizen.common/icons/connecting.png
new file mode 100644
index 000000000..77512c36f
--- /dev/null
+++ b/org.tizen.common/icons/connecting.png
Binary files differ
diff --git a/org.tizen.common/icons/delete.png b/org.tizen.common/icons/delete.png
new file mode 100644
index 000000000..3e95caa6c
--- /dev/null
+++ b/org.tizen.common/icons/delete.png
Binary files differ
diff --git a/org.tizen.common/icons/disconnected.png b/org.tizen.common/icons/disconnected.png
new file mode 100644
index 000000000..01c7d81a3
--- /dev/null
+++ b/org.tizen.common/icons/disconnected.png
Binary files differ
diff --git a/org.tizen.common/icons/error.png b/org.tizen.common/icons/error.png
new file mode 100644
index 000000000..d70328403
--- /dev/null
+++ b/org.tizen.common/icons/error.png
Binary files differ
diff --git a/org.tizen.common/icons/folder.png b/org.tizen.common/icons/folder.png
new file mode 100644
index 000000000..df0fca9d8
--- /dev/null
+++ b/org.tizen.common/icons/folder.png
Binary files differ
diff --git a/org.tizen.common/icons/hint.png b/org.tizen.common/icons/hint.png
new file mode 100644
index 000000000..c3c07e15d
--- /dev/null
+++ b/org.tizen.common/icons/hint.png
Binary files differ
diff --git a/org.tizen.common/icons/info.png b/org.tizen.common/icons/info.png
new file mode 100644
index 000000000..97ee81dae
--- /dev/null
+++ b/org.tizen.common/icons/info.png
Binary files differ
diff --git a/org.tizen.common/icons/library.png b/org.tizen.common/icons/library.png
new file mode 100644
index 000000000..13342dedc
--- /dev/null
+++ b/org.tizen.common/icons/library.png
Binary files differ
diff --git a/org.tizen.common/icons/ok.png b/org.tizen.common/icons/ok.png
new file mode 100644
index 000000000..454cda50e
--- /dev/null
+++ b/org.tizen.common/icons/ok.png
Binary files differ
diff --git a/org.tizen.common/icons/printer.png b/org.tizen.common/icons/printer.png
new file mode 100644
index 000000000..1a4e1d443
--- /dev/null
+++ b/org.tizen.common/icons/printer.png
Binary files differ
diff --git a/org.tizen.common/icons/star.png b/org.tizen.common/icons/star.png
new file mode 100644
index 000000000..87236ad17
--- /dev/null
+++ b/org.tizen.common/icons/star.png
Binary files differ
diff --git a/org.tizen.common/icons/terminated.png b/org.tizen.common/icons/terminated.png
new file mode 100644
index 000000000..c4f84505d
--- /dev/null
+++ b/org.tizen.common/icons/terminated.png
Binary files differ
diff --git a/org.tizen.common/icons/warn.png b/org.tizen.common/icons/warn.png
new file mode 100644
index 000000000..be589b805
--- /dev/null
+++ b/org.tizen.common/icons/warn.png
Binary files differ
diff --git a/org.tizen.common/icons/warn2.png b/org.tizen.common/icons/warn2.png
new file mode 100644
index 000000000..42d053a9c
--- /dev/null
+++ b/org.tizen.common/icons/warn2.png
Binary files differ
diff --git a/org.tizen.common/plugin.xml b/org.tizen.common/plugin.xml
new file mode 100644
index 000000000..bbe192e0d
--- /dev/null
+++ b/org.tizen.common/plugin.xml
@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.tizen.nativeapp.newCategory"
+ name="Tizen">
+ </category>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.tizen.common.preferences.TizenBasePreferencePage"
+ id="org.tizen.common.preferences.tizencommon"
+ name="Tizen SDK">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.tizen.common.util.UpdateManager">
+ </startup>
+ </extension>
+ <!-- activities start -->
+ <extension
+ point="org.eclipse.ui.activities">
+ <!-- disable rhino lauch shortcuts & wst launch shortcut -->
+ <activity
+ name="Popup UI"
+ description="Popup UI"
+ id="org.tizen.web.launch.DisablePopupMenu">
+ <enabledWhen>
+ <with variable="activeWorkbenchWindow.activePerspective">
+ <and>
+ <not>
+ <equals value="org.tizen.web.ui.perspective.WACwidget"/>
+ </not>
+ <not>
+ <equals value="org.tizen.nativeapp.perspective"/>
+ </not>
+ </and>
+ </with>
+ </enabledWhen>
+ </activity>
+ <activityPatternBinding
+ activityId="org.tizen.web.launch.DisablePopupMenu"
+ pattern="org.eclipse.wst.server.ui/org.eclipse.wst.server.launchShortcut*">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.launch.DisablePopupMenu"
+ pattern="org.eclipse.wst.jsdt.debug.rhino.ui/org.eclipse.wst.jsdt.debug.rhino.ui.launch.shortcut*">
+ </activityPatternBinding>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.activities">
+ <!-- disable CDT launch ui -->
+ <category
+ name="CDT launch UI"
+ description="Disable CDT launch UI when Native App Perspective is activated."
+ id="org.tizen.nativeapp.CDTLaunchUICategory">
+ </category>
+
+ <activity
+ name="CDT Launch UI Elements"
+ description="Launch UI elements from CDT"
+ id="org.tizen.nativeapp.DisableCDTLaunchUIActivity">
+
+ <enabledWhen>
+ <with variable="activeWorkbenchWindow.activePerspective">
+ <and>
+ <not>
+ <equals value="org.tizen.web.ui.perspective.WACwidget"/>
+ </not>
+ <not>
+ <equals value="org.tizen.nativeapp.perspective"/>
+ </not>
+ </and>
+ </with>
+ </enabledWhen>
+ </activity>
+
+ <categoryActivityBinding
+ activityId="org.tizen.nativeapp.DisableCDTLaunchUIActivity"
+ categoryId="org.tizen.nativeapp.CDTLaunchUICategory">
+ </categoryActivityBinding>
+
+ <activityPatternBinding
+ activityId="org.tizen.nativeapp.DisableCDTLaunchUIActivity"
+ pattern="org\.eclipse\.cdt\.launch/org\.eclipse\.cdt\.launch\.launchGroup">
+ </activityPatternBinding>
+
+ <activityPatternBinding
+ activityId="org.tizen.nativeapp.DisableCDTLaunchUIActivity"
+ pattern="org\.eclipse\.cdt\.debug\.core/org\.eclipse\.cdt\.launch\.[a-zA-Z]*LaunchType">
+ </activityPatternBinding>
+
+ <activityPatternBinding
+ activityId="org.tizen.nativeapp.DisableCDTLaunchUIActivity"
+ pattern="org\.eclipse\.cdt\.debug\.ui/org\.eclipse\.cdt\.debug\.ui\.localCShortcut">
+ </activityPatternBinding>
+
+ <!-- disable CDT toolchain editor page -->
+ <category
+ description="Disable CDT Toolchain Editor Page when Tizen Perspective is activated."
+ id="org.tizen.nativeapp.CDTToolChainEditorPageCategory"
+ name="CDT ToolChain Editor Page">
+ </category>
+ <activity
+ description="ToolChain Editor Property Page"
+ id="org.tizen.nativeapp.DisableCDTToolChainEditorPageActivity"
+ name="CDT ToolChain Editor Page Elements">
+ <enabledWhen>
+ <with variable="activeWorkbenchWindow.activePerspective">
+ <and>
+ <not>
+ <equals value="org.tizen.web.ui.perspective.WACwidget"/>
+ </not>
+ <not>
+ <equals value="org.tizen.nativeapp.perspective"/>
+ </not>
+ </and>
+ </with>
+ </enabledWhen>
+ </activity>
+ <categoryActivityBinding
+ activityId="org.tizen.nativeapp.DisableCDTToolChainEditorPageActivity"
+ categoryId="org.tizen.nativeapp.CDTToolChainEditorPageCategory">
+ </categoryActivityBinding>
+ <activityPatternBinding
+ activityId="org.tizen.nativeapp.DisableCDTToolChainEditorPageActivity"
+ pattern="org\.eclipse\.cdt\.managedbuilder\.ui/org\.eclipse\.cdt\.managedbuilder\.ui\.properties\.Page_ToolChain">
+ </activityPatternBinding>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.activities">
+ <!-- disable other new wizards -->
+ <activity
+ id="org.tizen.web.ui.modification.newXsdDisabler"
+ name="%activity.name">
+ </activity>
+ <activityPatternBinding
+ activityId="org.tizen.web.ui.modification.newXsdDisabler"
+ pattern="org.eclipse.wst.xsd.ui/org.eclipse.wst.xsd.ui.internal.wizards.*">
+ </activityPatternBinding>
+
+ <activity
+ id="org.tizen.web.ui.modification.newDtdDisabler"
+ name="%activity.name.0">
+ </activity>
+ <activityPatternBinding
+ activityId="org.tizen.web.ui.modification.newDtdDisabler"
+ pattern="org.eclipse.wst.dtd.ui/org.eclipse.wst.dtd.ui.internal.wizard.*">
+ </activityPatternBinding>
+
+ <activity
+ id="org.tizen.web.ui.modification.ValidateMenuItemDisabler"
+ name="%activity.name.1">
+ </activity>
+ <activityPatternBinding
+ activityId="org.tizen.web.ui.modification.ValidateMenuItemDisabler"
+ pattern="org.eclipse.wst.validation.ui/ValidationAction">
+ </activityPatternBinding>
+
+
+ <activity
+ name="Wizard UI"
+ description="Wizard UI"
+ id="org.tizen.web.DisableWizardsActivity">
+ <enabledWhen>
+ <with variable="activeWorkbenchWindow.activePerspective">
+ <and>
+ <not>
+ <equals value="org.tizen.web.ui.perspective.WACwidget"/>
+ </not>
+ <not>
+ <equals value="org.tizen.nativeapp.perspective"/>
+ </not>
+ </and>
+ </with>
+ </enabledWhen>
+ </activity>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="com\.samsung\.tizen\.guibuilder/com\.samsung\.tizen\.guibuilder\.wizard\.newSgmWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.jdt\.ui/org\.eclipse\.jdt\.ui\.wizards\.JavaProjectWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.ant\.ui/org\.eclipse\.ant\.ui\.wizards\.JavaProjectWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.emf\.importer/org\.eclipse\.emf\.importer\.ui\.EMFProjectWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.emf\.codegen\.ecore\.ui/org\.eclipse\.emf\.codegen\.ecore\.ui\.EmptyProjectWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.jsdt\.ui/org\.eclipse\.wst\.jsdt\.ui\.wizards\.JavaProjectWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.xml\.ui/org\.eclipse\.wst\.xml\.ui\.XMLExampleProjectCreationWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.web\.ui/org\.eclipse\.wst\.web\.ui\.internal\.wizards\.SimpleWebProjectWizard">
+ </activityPatternBinding>
+
+
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.emf\.ecore\.editor/org\.eclipse\.emf\.ecore\.presentation\.EcoreModelWizardID">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.emf\.mapping\.ecore2xml\.ui/org\.eclipse\.emf\.mapping\.ecore2xml\.presentation\.Ecore2XMLModelWizardID">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.emf\.mapping\.ecore2ecore\.editor/org\.eclipse\.emf\.mapping\.ecore2ecore\.presentation\.Ecore2EcoreModelWizardID">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.emf\.importer/org\.eclipse\.emf\.importer\.ui\.EMFModelWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.emf\.importer/org\.eclipse\.emf\.importer\.ui\.EMFProjectWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.jdt\.ui/org\.eclipse\.jdt\.ui\.wizards.*">
+ </activityPatternBinding>
+
+
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.jdt\.junit/org\.eclipse\.jdt\.junit\.wizards.*">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.jdt\.debug\.ui/org\.eclipse\.jdt\.debug\.ui\.snippetEditor\.NewSnippetFileCreationWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.server\.ui/org\.eclipse\.wst\.server\.ui\.new\.server">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.jsdt\.ui/org\.eclipse\.wst\.jsdt\.ui\.wizards\.JavaProjectWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.jsdt\.ui/org\.eclipse\.wst\.jsdt\.ui\.NewJSWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.jst\.jsp\.ui/org\.eclipse\.jst\.jsp\.ui\.internal\.wizard.*">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.html\.ui/org\.eclipse\.wst\.html\.ui\.internal\.wizard\.NewHTMLWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.css\.ui/org\.eclipse\.wst\.css\.ui\.internal\.wizard\.NewCSSWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.emf\.codegen\.ui/org\.eclipse\.emf\.codegen\.ui\.ConvertToJETProjectWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.xsd\.ui/org\.eclipse\.wst\.xsd\.ui\.internal\.wizards\.NewXSDWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.dtd\.ui/org\.eclipse\.wst\.dtd\.ui\.internal\.wizard\.NewDTDWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="json\.editor\.plugin/Json\.newFileWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.xml\.ui/org\.eclipse\.wst\.xml\.ui\.internal\.wizards\.NewXMLWizard">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.DisableWizardsActivity"
+ pattern="org\.eclipse\.wst\.xml\.ui/org\.eclipse\.wst\.xml\.ui\.XMLExampleProjectCreationWizard">
+ </activityPatternBinding>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.activities">
+ <!-- PopupMenus Enabled when tizen Web IDE perspective -->
+ <activity
+ description="PopupMenus"
+ id="org.tizen.web.PopupMenusActivity"
+ name="PopupMenus">
+ <enabledWhen>
+ <with
+ variable="activeWorkbenchWindow.activePerspective">
+ <and>
+ <equals
+ value="org.tizen.web.ui.perspective.WACwidget">
+ </equals>
+ </and>
+ </with>
+ </enabledWhen>
+ </activity>
+ <activityPatternBinding
+ activityId="org.tizen.web.PopupMenusActivity"
+ pattern="org.tizen.web.sign/org.tizen.web.sign.signwidgetaction">
+ </activityPatternBinding>
+ <activityPatternBinding
+ activityId="org.tizen.web.PopupMenusActivity"
+ pattern="org.tizen.web.localization/org.tizen.web.localization.menus.popup.localizationMenu">
+ </activityPatternBinding>
+ </extension>
+ <!-- activities end -->
+</plugin>
diff --git a/org.tizen.common/sdblib.jar b/org.tizen.common/sdblib.jar
new file mode 100644
index 000000000..28a8a0434
--- /dev/null
+++ b/org.tizen.common/sdblib.jar
Binary files differ
diff --git a/org.tizen.common/src/org/tizen/common/CommonPlugin.java b/org.tizen.common/src/org/tizen/common/CommonPlugin.java
new file mode 100644
index 000000000..b337172d8
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/CommonPlugin.java
@@ -0,0 +1,122 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Changhyun Lee <changhyun1.lee@samsung.com>
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common;
+
+import java.io.File;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.tizen.common.preferences.TizenBasePreferencePage;
+import org.tizen.common.properties.InstallPathConfig;
+import org.tizen.common.util.HostUtil;
+import org.tizen.common.util.OSChecker;
+
+import org.tizen.sdblib.SmartDevelopmentBridge;
+
+/**
+ * Log.
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+public class CommonPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.tizen.common"; //$NON-NLS-1$
+ private final static String SDKSUFFIX = File.separatorChar+".TizenSDK"+File.separatorChar+"tizensdkpath";
+ // The shared instance
+ private static CommonPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public CommonPlugin() {
+ SmartDevelopmentBridge.init();
+ String sdbPath = InstallPathConfig.getSDKPath() + File.separator + "SDK" + File.separator +"sdb" + File.separator + "sdb";
+ SmartDevelopmentBridge.createBridge(sdbPath, true);
+ }
+
+ /*
+ * (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;
+ }
+
+ /*
+ * (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 CommonPlugin getDefault() {
+ return plugin;
+ }
+
+ @Override
+
+ protected void initializeDefaultPreferences(IPreferenceStore store) {
+ if (loadSdkPath() != null)
+ store.setDefault(TizenBasePreferencePage.KEY_SDKLOCATION,loadSdkPath());
+ store.setDefault(TizenBasePreferencePage.KEY_SDKUPDATE,TizenBasePreferencePage.VALUE_SDKUPDATE_DEFAULT);
+
+ }
+
+
+ /**
+ * get sdk path
+ */
+ private String loadSdkPath() {
+ String sdkConfig;
+ String sdkPath = null;;
+ if (OSChecker.isWindows())
+ sdkConfig = System.getenv("localappdata") + File.separatorChar + SDKSUFFIX;
+ else
+ sdkConfig= System.getProperty("user.home") + File.separatorChar + SDKSUFFIX;
+
+ if (HostUtil.exists(sdkConfig)) {
+ String contents = HostUtil.getContents(sdkConfig);
+ if (contents != null) {
+ String[] fileContent = contents.split("=");
+ if (fileContent.length == 2) {
+ if (HostUtil.exists(fileContent[1]))
+ sdkPath = fileContent[1];
+ }
+ }
+ }
+ return sdkPath;
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/cache/ColorCache.java b/org.tizen.common/src/org/tizen/common/cache/ColorCache.java
new file mode 100644
index 000000000..fbd1a3659
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/cache/ColorCache.java
@@ -0,0 +1,106 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Changhyun Lee <changhyun1.lee@samsung.com>
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.cache;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Class for caching colors
+ *
+ * @author Emil
+ *
+ */
+public final class ColorCache {
+
+ public static final RGB BLACK = new RGB(0, 0, 0);
+ public static final RGB WHITE = new RGB(255, 255, 255);
+
+ private static Map<RGB, Color> _colorTable;
+ private static ColorCache _instance;
+
+ static {
+ _colorTable = new HashMap<RGB, Color>();
+ new ColorCache();
+ }
+
+ private ColorCache() {
+ _instance = this;
+ }
+
+ public static ColorCache getInstance() {
+ return _instance;
+ }
+
+ /**
+ * Disposes of all colors. DO ONLY CALL THIS WHEN YOU ARE SHUTTING DOWN YOUR
+ * APPLICATION!
+ */
+ public static void disposeColors() {
+ Iterator<Color> e = _colorTable.values().iterator();
+ while (e.hasNext())
+ e.next().dispose();
+
+ _colorTable.clear();
+ }
+
+ public static Color getWhite() {
+ return getColorFromRGB(new RGB(255, 255, 255));
+ }
+
+ public static Color getBlack() {
+ return getColorFromRGB(new RGB(0, 0, 0));
+ }
+
+ public static Color getColorFromRGB(RGB rgb) {
+ Color color = _colorTable.get(rgb);
+
+ if (color == null) {
+ color = new Color(Display.getCurrent(), rgb);
+ _colorTable.put(rgb, color);
+ }
+
+ return color;
+ }
+
+ public static Color getColor(int r, int g, int b) {
+ RGB rgb = new RGB(r, g, b);
+ Color color = _colorTable.get(rgb);
+
+ if (color == null) {
+ color = new Color(Display.getCurrent(), rgb);
+ _colorTable.put(rgb, color);
+ }
+
+ return color;
+ }
+
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/cache/FontCache.java b/org.tizen.common/src/org/tizen/common/cache/FontCache.java
new file mode 100644
index 000000000..ec5b81a51
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/cache/FontCache.java
@@ -0,0 +1,206 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Changhyun Lee <changhyun1.lee@samsung.com>
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Caching class for fonts. Also deals with re-creating fonts should they have been disposed when the
+ * caller asks for a font.
+ *
+ * @author Emil
+ *
+ */
+public class FontCache {
+
+ private static List<OneFont> _existing = new ArrayList<OneFont>();
+
+ /**
+ * Disposes all fonts and clears out the cache. Never call this unless you are shutting down your
+ * code/client/etc.
+ */
+ public static void disposeAll() {
+ for (OneFont of : _existing) {
+ if (of.getFont() != null && !of.getFont().isDisposed()) {
+ of.getFont().dispose();
+ }
+ }
+
+ _existing.clear();
+ }
+
+ /**
+ * Gets a font from existing FontData
+ *
+ * @param fd FontData
+ * @return Font or null on error
+ */
+ public static Font getFont(FontData fd) {
+ try {
+ boolean disposed = false;
+ OneFont toRemove = null;
+ for (OneFont of : _existing) {
+ if (of.matches(fd)) {
+ if (of.getFont().isDisposed()) {
+ disposed = true;
+ toRemove = of;
+ break;
+ }
+
+ return of.getFont();
+ }
+ }
+ if (disposed) {
+ _existing.remove(toRemove);
+ }
+
+ OneFont of = new OneFont(fd);
+ _existing.add(of);
+ return of.getFont();
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ return null;
+ }
+
+ public static int getCount() {
+ return _existing.size();
+ }
+
+ /**
+ * Gets a font from an existing fonts data.
+ *
+ * @param font Font
+ * @return Font or null on error
+ */
+ public static Font getFont(Font font) {
+ try {
+ if (font == null || font.isDisposed()) return null;
+
+ FontData fd = font.getFontData()[0];
+ return getFont(fd);
+
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets a font for a given font name and style.
+ *
+ * @param fontName Name of font
+ * @param height Height of font
+ * @param style Style of font
+ * @return Font or null on error
+ */
+ public static Font getFont(String fontName, int height, int style) {
+ try {
+ boolean disposed = false;
+ OneFont toRemove = null;
+ for (OneFont of : _existing) {
+ if (of.getName().equals(fontName) && of.getHeight() == height && of.getStyle() == style) {
+ if (of.getFont().isDisposed()) {
+ disposed = true;
+ toRemove = of;
+ break;
+ }
+ return of.getFont();
+ }
+ }
+ if (disposed) {
+ _existing.remove(toRemove);
+ }
+
+ OneFont of = new OneFont(fontName, height, style);
+ _existing.add(of);
+ return of.getFont();
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ }
+
+ return null;
+ }
+}
+
+class OneFont {
+
+ private String _name;
+ private int _height;
+ private int _style;
+ private Font _font;
+
+ public OneFont(String name, int height, int style) {
+ _name = name;
+ _height = height;
+ _style = style;
+ _font = new Font(Display.getDefault(), name, height, style);
+ }
+
+ public OneFont(FontData fd) {
+ _name = fd.getName();
+ _height = fd.getHeight();
+ _style = fd.getStyle();
+ _font = new Font(Display.getDefault(), fd);
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public int getHeight() {
+ return _height;
+ }
+
+ public int getStyle() {
+ return _style;
+ }
+
+ public void setFont(Font font) {
+ _font = font;
+ }
+
+ public Font getFont() {
+ return _font;
+ }
+
+ public boolean matches(FontData fd) {
+ return (fd.getName().equals(_name) && fd.getHeight() == _height && fd.getStyle() == _style);
+ }
+
+ @Override
+ public String toString() {
+ return "Font: " + _name + " " + _height + " " + _style;
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/cache/ImageCache.java b/org.tizen.common/src/org/tizen/common/cache/ImageCache.java
new file mode 100644
index 000000000..639a79723
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/cache/ImageCache.java
@@ -0,0 +1,105 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Changhyun Lee <changhyun1.lee@samsung.com>
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.cache;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Class for caching images
+ *
+ * @author Emil
+ */
+public class ImageCache {
+
+ private static HashMap<String, Image> _ImageMap;
+
+ // what path to get to the "icons" directory without actually including it
+ private static final String ICON_ROOT_PATH = "icons/";
+
+ static {
+ _ImageMap = new HashMap<String, Image>();
+ }
+
+ /**
+ * Returns an image that is also cached if it has to be created and does not already exist in the cache.
+ *
+ * @param fileName Filename of image to fetch
+ * @return Image null if it could not be found
+ */
+ public static Image getImage(String fileName) {
+ fileName = ICON_ROOT_PATH + fileName;
+ Image image = _ImageMap.get(fileName);
+ if (image == null) {
+ image = createImage(fileName);
+ _ImageMap.put(fileName, image);
+ }
+ return image;
+ }
+
+ // creates the image, and tries really hard to do so
+ private static Image createImage(String fileName) {
+ ClassLoader classLoader = ImageCache.class.getClassLoader();
+ InputStream is = classLoader.getResourceAsStream(fileName);
+ if (is == null) {
+ // the old way didn't have leading slash, so if we can't find the image stream,
+ // let's see if the old way works.
+ is = classLoader.getResourceAsStream(fileName.substring(1));
+
+ if (is == null) {
+ is = classLoader.getResourceAsStream(fileName);
+ if (is == null) {
+ is = classLoader.getResourceAsStream(fileName.substring(1));
+ if (is == null) { return null; }
+ }
+ }
+ }
+
+ Image img = new Image(Display.getDefault(), is);
+ try {
+ is.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return img;
+ }
+
+ /**
+ * Disposes ALL images that have been cached.
+ */
+ public static void dispose() {
+ Iterator<Image> e = _ImageMap.values().iterator();
+ while (e.hasNext())
+ e.next().dispose();
+
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/console/AnsicodeAdapter.java b/org.tizen.common/src/org/tizen/common/console/AnsicodeAdapter.java
new file mode 100644
index 000000000..73a32ad3b
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/console/AnsicodeAdapter.java
@@ -0,0 +1,225 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Yoonki Park <yoonki.park@samsung.com>
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.console;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.PlatformUI;
+
+public class AnsicodeAdapter {
+ public static final char ESCAPE = '\033'; // ANSI Escape Character that starts commands
+
+ public static final Color BLACK = new Color(PlatformUI.getWorkbench().getDisplay(), 0, 0, 0); //Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
+ public static final Color RED = new Color(PlatformUI.getWorkbench().getDisplay(), 255, 0, 0); //Display.getCurrent().getSystemColor(SWT.COLOR_RED);
+ public static final Color GREEN = new Color(PlatformUI.getWorkbench().getDisplay(), 0, 255, 0); //Display.getCurrent().getSystemColor(SWT.COLOR_GREEN);
+ public static final Color YELLOW = new Color(PlatformUI.getWorkbench().getDisplay(), 255, 255, 0); //Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW);
+ public static final Color BLUE = new Color(PlatformUI.getWorkbench().getDisplay(), 0,0,255); //Display.getCurrent().getSystemColor(SWT.COLOR_BLUE);
+ public static final Color MAGENTA = new Color(PlatformUI.getWorkbench().getDisplay(), 255, 0, 255); //Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA);
+ public static final Color CYAN = new Color(PlatformUI.getWorkbench().getDisplay(), 0,255, 255); //Display.getCurrent().getSystemColor(SWT.COLOR_CYAN);
+ public static final Color WHITE = new Color(PlatformUI.getWorkbench().getDisplay(), 255, 255, 255); //Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
+
+ public static final Color INTENSE_BLACK = new Color(PlatformUI.getWorkbench().getDisplay(), 0, 0, 0); //Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);
+ public static final Color INTENSE_RED = new Color(PlatformUI.getWorkbench().getDisplay(), 139, 0, 0); //Display.getCurrent().getSystemColor(SWT.COLOR_DARK_RED);
+ public static final Color INTENSE_GREEN = new Color(PlatformUI.getWorkbench().getDisplay(), 0, 100, 0);//Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
+ public static final Color INTENSE_YELLOW = new Color(PlatformUI.getWorkbench().getDisplay(), 250,250,210);//Display.getCurrent().getSystemColor(SWT.COLOR_DARK_YELLOW);
+ public static final Color INTENSE_BLUE = new Color(PlatformUI.getWorkbench().getDisplay(), 0,0,139);//Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE);
+ public static final Color INTENSE_MAGENTA = new Color(PlatformUI.getWorkbench().getDisplay(), 139,0,139);//Display.getCurrent().getSystemColor(SWT.COLOR_DARK_MAGENTA);
+ public static final Color INTENSE_CYAN = new Color(PlatformUI.getWorkbench().getDisplay(), 0, 139, 139);//Display.getCurrent().getSystemColor(SWT.COLOR_DARK_CYAN);
+ public static final Color INTENSE_WHITE = new Color(PlatformUI.getWorkbench().getDisplay(), 245, 245, 245);//Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
+
+ private static int[] commands = {'m','n'}; //SGR , DSR
+
+ private static List<TextStyle> parseAnsiString(String ansiString) {
+ char command = 0;
+ List<TextStyle> styles = new ArrayList<TextStyle>();
+ int arrayIndex = 0;
+ StringBuilder sb = new StringBuilder();
+
+ for (int i=0; i<ansiString.length(); i++) {
+ if (ansiString.charAt(i) == ESCAPE) {
+ int min = ansiString.length() ;
+ int startCommand = 0;
+
+ for (int j=0 ; j<commands.length ; j++) {
+ startCommand = ansiString.indexOf(commands[j], i);
+ if (min > startCommand && startCommand > -1) {
+ min = startCommand;
+ }
+ }
+ command=ansiString.charAt(min);
+ startCommand=min;
+
+ if ( startCommand < ansiString.length()) {
+
+ String colorCodes = ansiString.substring(i+2,startCommand);
+ String codes[] = colorCodes.split(";");
+ Color[] colors = getColorAttribute(codes);
+ int styleStart = startCommand+1;
+ int styleEnd = 0;
+ int endEscape = ansiString.indexOf(ESCAPE,styleStart);
+ if (endEscape < 0 ) {
+ styleEnd = ansiString.length();
+ i = ansiString.length();
+ } else {
+ int endCommand = ansiString.indexOf(command,endEscape);
+ if (endCommand < 0 ) {
+ styleEnd = ansiString.length();
+ i = ansiString.length();
+ } else {
+ styleEnd = endEscape;
+ i = endCommand;
+ }
+ }
+ String styleString = null;
+ styleString = ansiString.substring(styleStart, styleEnd);
+
+ TextStyle styleTs = new TextStyle(colors[0],colors[1],styleString);
+
+ if (sb.length() > 0) {
+ TextStyle defaultTs = new TextStyle(BLACK,WHITE, sb.toString());
+ styles.add(arrayIndex++,defaultTs);
+ sb.setLength(0);
+ }
+ styles.add(arrayIndex++,styleTs);
+
+ }
+ }else { //nothing found!
+
+ sb.append(ansiString.charAt(i));
+ }
+ }
+ if (sb.length() > 0) {
+ TextStyle defaultTs = new TextStyle(BLACK,WHITE, sb.toString());
+ styles.add(arrayIndex,defaultTs);
+ }
+ return styles;
+ }
+ private static Color[] getColorAttribute(String codes[]) {
+ boolean brighter = false;
+ Color[] color = {BLACK,WHITE}; //foreground&background
+
+ for (int j = 0; j < codes.length; j++) {
+
+ if (codes[j].length() > 0 && codes[j].matches("[\\d]*")) {
+ int code = Integer.parseInt(codes[j]);
+ if (code == 0)
+ brighter = false;
+ else if (code == 1)
+ brighter = true;
+ else if (code >= 30 && code <= 39) {
+ if (code == 39)
+ color[0] = BLACK; //default foreground color
+ else if (code >= 30 && code <= 37) {
+ color[0] = getColorFromANSICode(code, brighter);
+ brighter = false;
+ }
+ } else if (code >= 40 && code <= 49) {
+ if (code == 49)
+ color[1] = WHITE; //default background color
+ else if (code >= 40 && code <= 47)
+ color[1] = getColorFromANSICode(code, brighter);
+ }
+ }
+ }
+ return color;
+ }
+ private static Color getColorFromANSICode(int code, boolean brighter) {
+ switch (code) {
+ case 30:
+ case 40:
+ if (brighter)
+ return INTENSE_BLACK;
+ else
+ return BLACK;
+ case 31:
+ case 41:
+ if (brighter)
+ return INTENSE_RED;
+ else
+ return RED;
+ case 32:
+ case 42:
+ if (brighter)
+ return INTENSE_GREEN;
+ else
+ return GREEN;
+ case 33:
+ case 43:
+ if (brighter)
+ return INTENSE_YELLOW;
+ else
+ return YELLOW;
+ case 34:
+ case 44:
+ if (brighter)
+ return INTENSE_BLUE;
+ else
+ return BLUE;
+ case 35:
+ case 45:
+ if (brighter)
+ return INTENSE_MAGENTA;
+ else
+ return MAGENTA;
+ case 36:
+ case 46:
+ if (brighter)
+ return INTENSE_CYAN;
+ else
+ return CYAN;
+ case 37:
+ case 47:
+ if (brighter)
+ return INTENSE_WHITE;
+ else
+ return WHITE;
+ default:
+ return null;
+ }
+ }
+ public static String getStripAnsiString(String newLineStr) {
+ List<TextStyle> styles = parseAnsiString(newLineStr);
+ if (styles != null) {
+ StringBuilder sb = new StringBuilder();
+ for (int i=0 ; i<styles.size(); i++) {
+ sb.append(styles.get(i).getStripString());
+ }
+ return sb.toString();
+ }else {
+ return newLineStr;
+ }
+ }
+ public static List<TextStyle> getStringStyles(String newLineStr) {
+ List<TextStyle> styles = parseAnsiString(newLineStr);
+ if (styles != null) {
+ return styles;
+ }else {
+ return null;
+ }
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/console/ConsoleManager.java b/org.tizen.common/src/org/tizen/common/console/ConsoleManager.java
new file mode 100644
index 000000000..ec4871d3b
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/console/ConsoleManager.java
@@ -0,0 +1,271 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Yoonki Park <yoonki.park@samsung.com>
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.console;
+import java.io.IOException;
+import java.lang.reflect.Method;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.IConsoleView;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+
+/**
+ * ConsoleManager.
+ * @author YoonKi Park {@literal <yoonki.park@samsung.com>} (S-Core)
+ * @author GyeongSeok Seo {@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ */
+public class ConsoleManager
+{
+ private IConsoleManager consoleManager;
+ private String consoleName;
+ private boolean consoleFocus;
+ private MessageConsole console;
+ private Display display = Display.getDefault();
+ private MessageConsoleStream colorConsoleStream;
+
+ /**
+ * Constructs a new console manager.
+ *
+ * @param consoleName - the key title
+ * @param focus - true if focus on console, false if not
+ */
+ public ConsoleManager(String consoleName, boolean focus) {
+ this.consoleName = consoleName;
+ this.consoleFocus = focus;
+ this.consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+ this.console = getMessageConsole();
+ }
+
+ /**
+ * Change Console Name.
+ *
+ * @param newName - console Title. It shown console's tab bar.
+ * @author Gyeongseok.seo@samsung.com
+ */
+ public void changeConsolName(String newName) throws NoSuchFieldException, IllegalAccessException {
+ this.consoleName = newName;
+ Runnable runnable = new Runnable() {
+ public void run() {
+ Class<?> cls;
+ Method method;
+ try {
+ cls = Class.forName("org.eclipse.ui.console.AbstractConsole");
+ method = cls.getDeclaredMethod("setName", String.class);
+ method.setAccessible(true);
+ method.invoke(getConsole(), consoleName);
+ } catch (Exception e) {
+ ConsolePlugin.log(e);
+ }
+ }
+ };
+ Display.getDefault().syncExec(runnable);
+ }
+
+ private MessageConsole getMessageConsole(){
+ boolean found = false;
+
+ IConsole[] consoles = consoleManager.getConsoles();
+ for (int i = 0; i < consoles.length; i++) {
+ if (this.consoleName.equals(consoles[i].getName())) {
+ console = (MessageConsole) consoles[i];
+ consoleManager.removeConsoles(new IConsole[] { console });
+ //found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ console = new MessageConsole(this.consoleName, null);
+ consoleManager.addConsoles(new IConsole[] { console });
+ }
+
+ if(this.consoleFocus)
+ consoleManager.showConsoleView(console);
+
+ return console;
+ }
+ public IConsole getConsole() {
+ return console;
+ }
+ /**
+ * Remove a MessageConsole instance specified key title from list, if it is present
+ *
+ * @param sessionId - a key title
+ */
+ public void removeConsole(){
+ MessageConsole console = null;
+
+ IConsole[] consoles = consoleManager.getConsoles();
+ for (int i = 0; i < consoles.length; i++) {
+ if (this.consoleName.equals(consoles[i].getName())) {
+ console = (MessageConsole) consoles[i];
+ consoleManager.removeConsoles(new IConsole[] { console });
+ break;
+ }
+ }
+ }
+
+ /**
+ * Get the output stream of the MessageConsole
+ * @Deprecated
+ * @param isError - character's color is black if true or the color is red if false
+ *
+ * @return the MessageConsoleStream connected to MessageConsole
+ */
+ @Deprecated
+ public MessageConsoleStream getMessageConsoleStream(boolean isError) {
+ final MessageConsoleStream output = this.console.newMessageStream();
+ output.setActivateOnWrite(false);
+
+ final int colorId;
+ if (!isError) {
+ colorId = SWT.COLOR_BLACK;
+ } else {
+ colorId = SWT.COLOR_RED;
+ }
+
+ // we must set the color in the UI thread
+ Runnable runnable = new Runnable() {
+ public void run() {
+ Color color = Display.getCurrent().getSystemColor(colorId);
+ output.setColor(color);
+ }
+ };
+ Display.getDefault().syncExec(runnable);
+
+ return output;
+ }
+ /**
+ * Get the output stream of the MessageConsole
+ *
+ * @return the MessageConsoleStream connected to MessageConsole
+ */
+ public MessageConsoleStream getMessageConsoleStream() {
+ return this.console.newMessageStream();
+ }
+ public void println(String line) {
+ MessageConsoleStream output = this.console.newMessageStream();
+ output.println(line);
+ try {
+ output.close();
+ } catch (IOException e) {
+ ConsolePlugin.log(e);
+ }
+ }
+ public void printProcessStreams(Process process) {
+
+ clear();
+ // waitAndRead while process is running
+ ConsoleProcessClosure closure = new ConsoleProcessClosure(process, this);
+ closure.runBlocking(); // a blocking cal
+ }
+ private void setStringStyle(int fontStyle, Color color) {
+ // font setting
+ colorConsoleStream.setFontStyle(fontStyle);
+
+ // color setting
+ colorConsoleStream.setColor(color);
+ }
+
+ public void print(String line ,int fontStyle, Color color) {
+ colorConsoleStream = console.newMessageStream();
+ display.syncExec(new ConsoleSettingThread(fontStyle, color));
+
+ colorConsoleStream.print(line);
+ try {
+ colorConsoleStream.close();
+ } catch (IOException e) {
+ ConsolePlugin.log(e);
+ }
+ }
+
+ public void println(String line ,int fontStyle, Color color) {
+ colorConsoleStream = console.newMessageStream();
+ display.syncExec(new ConsoleSettingThread(fontStyle, color));
+
+ colorConsoleStream.println(line);
+ try {
+ colorConsoleStream.close();
+ } catch (IOException e) {
+ ConsolePlugin.log(e);
+ }
+ }
+
+ public void clear()
+ {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ IDocument document = console.getDocument();
+ if (document != null) {
+ document.set("");
+ }
+ }
+ };
+ Display.getDefault().syncExec(runnable);
+ }
+ public void show() {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ String id = IConsoleConstants.ID_CONSOLE_VIEW;
+ IConsoleView view = null;
+ try {
+ view = (IConsoleView) page.showView(id);
+ } catch (PartInitException e) {
+ ConsolePlugin.log(e);
+ }
+ view.display(getConsole());
+ }
+ };
+ Display.getDefault().syncExec(runnable);
+ }
+ // setting thread.
+ class ConsoleSettingThread extends Thread {
+ // console text setting value
+ private int fontStyle;
+ private Color color;
+
+ ConsoleSettingThread(int fontStyle, Color color) {
+ this.fontStyle = fontStyle;
+ this.color = color;
+ }
+
+ public void run() {
+ setStringStyle(this.fontStyle, this.color);
+ }
+ }
+}
+
diff --git a/org.tizen.common/src/org/tizen/common/console/ConsoleProcessClosure.java b/org.tizen.common/src/org/tizen/common/console/ConsoleProcessClosure.java
new file mode 100644
index 000000000..a9fa6ed0f
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/console/ConsoleProcessClosure.java
@@ -0,0 +1,250 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Changhyun Lee <changhyun1.lee@samsung.com>
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.console;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+
+
+/**
+ * Bundled state of a launched process including the threads linking the process
+ * in/output to console documents.
+ */
+public class ConsoleProcessClosure {
+
+ /**
+ * Thread which continuously reads from a input stream and pushes the read
+ * data to an output stream which is immediately flushed afterwards.
+ */
+ protected static class ReaderThread extends Thread {
+
+ private InputStream fInputStream;
+ private ConsoleManager fConsole;
+ private boolean fFinished = false;
+ private String lineSeparator;
+ /*
+ * outputStream can be null
+ */
+ public ReaderThread(ThreadGroup group, String name, InputStream in, ConsoleManager out) {
+ super(group, name);
+ fConsole = out;
+ fInputStream = in;
+ setDaemon(true);
+ lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ try {
+ try {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(fInputStream));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ List<TextStyle> ts = AnsicodeAdapter.getStringStyles(line);
+
+ if (ts != null) {
+ for (int i=0 ; i< ts.size() ; i++) {
+ fConsole.print(ts.get(i).getStripString(),SWT.NORMAL,ts.get(i).getForeground());
+ }
+ } else {
+ fConsole.print(line,SWT.NORMAL,AnsicodeAdapter.BLACK);
+ }
+ fConsole.print(lineSeparator,SWT.NORMAL,AnsicodeAdapter.BLACK);
+ }
+ } catch (IOException x) {
+ // ignore
+ } finally {
+ try {
+ fInputStream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ } finally {
+ complete();
+ }
+ }
+
+ public synchronized boolean finished() {
+ return fFinished;
+ }
+
+ public synchronized void waitFor() {
+ while (!fFinished) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+
+ public synchronized void complete() {
+ fFinished = true;
+ notify();
+ }
+
+ public void close() {
+ //TODO : fix me!
+ /*try {
+ fOutputStream.close();
+ } catch (IOException e) {
+ // ignore
+ }*/
+ }
+ }
+
+ protected static int fCounter = 0;
+
+ protected Process fProcess;
+ protected ConsoleManager fConsole;
+
+ protected ReaderThread fOutputReader;
+ protected ReaderThread fErrorReader;
+
+ /**
+ * Creates a process closure and connects the launched process with a
+ * console document.
+ *
+ * @param outputStream
+ * prcess stdout is written to this stream. Can be
+ * <code>null</code>, if not interested in reading the output
+ * @param errorStream
+ * prcess stderr is written to this stream. Can be
+ * <code>null</code>, if not interested in reading the output
+ */
+ public ConsoleProcessClosure(Process process, ConsoleManager console) {
+ fProcess = process;
+ fConsole = console;
+ }
+
+ /**
+ * Live links the launched process with the configured in/out streams using
+ * reader threads.
+ */
+ public void runNonBlocking() {
+ ThreadGroup group = new ThreadGroup("SRuncher" + fCounter++); //$NON-NLS-1$
+
+ InputStream stdin = fProcess.getInputStream();
+ InputStream stderr = fProcess.getErrorStream();
+
+ fOutputReader = new ReaderThread(group, "OutputReader", stdin, fConsole); //$NON-NLS-1$
+ fErrorReader = new ReaderThread(group, "ErrorReader", stderr, fConsole); //$NON-NLS-1$
+
+ fOutputReader.start();
+ fErrorReader.start();
+ }
+
+ public void runBlocking() {
+ runNonBlocking();
+
+ boolean finished = false;
+ while (!finished) {
+ try {
+ fProcess.waitFor();
+ } catch (InterruptedException e) {
+ //System.err.println("Closure exception " +e);
+ }
+ try {
+ fProcess.exitValue();
+ finished = true;
+ } catch (IllegalThreadStateException e) {
+ //System.err.println("Closure exception " +e);
+ }
+ }
+
+ // @@@FIXME: Windows 2000 is screwed; double-check using output threads
+ if (!fOutputReader.finished()) {
+ fOutputReader.waitFor();
+ }
+
+ if (!fErrorReader.finished()) {
+ fErrorReader.waitFor();
+ }
+
+ fOutputReader.close();
+ fErrorReader.close();
+ // it seems that thread termination and stream closing is working
+ // without
+ // any help
+ fProcess = null;
+ fOutputReader = null;
+ fErrorReader = null;
+ }
+
+ public boolean isAlive() {
+ if (fProcess != null) {
+ if (fOutputReader.isAlive() || fErrorReader.isAlive()) {
+ return true;
+ }
+ fProcess = null;
+ fOutputReader.close();
+ fErrorReader.close();
+ fOutputReader = null;
+ fErrorReader = null;
+ }
+ return false;
+ }
+
+ /**
+ * The same functionality as "isAlive()"
+ * but does not affect out streams,
+ * because they can be shared among processes
+ */
+ public boolean isRunning() {
+ if (fProcess != null) {
+ if (fOutputReader.isAlive() || fErrorReader.isAlive()) {
+ return true;
+ }
+ fProcess = null;
+ }
+ return false;
+ }
+ /**
+ * Forces the termination the launched process
+ */
+ public void terminate() {
+ if (fProcess != null) {
+ fProcess.destroy();
+ fProcess = null;
+ }
+ if (!fOutputReader.finished()) {
+ fOutputReader.waitFor();
+ }
+ if (!fErrorReader.finished()) {
+ fErrorReader.waitFor();
+ }
+ fOutputReader.close();
+ fErrorReader.close();
+ fOutputReader = null;
+ fErrorReader = null;
+ }
+}
+
diff --git a/org.tizen.common/src/org/tizen/common/console/TextStyle.java b/org.tizen.common/src/org/tizen/common/console/TextStyle.java
new file mode 100644
index 000000000..d068ef8bf
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/console/TextStyle.java
@@ -0,0 +1,53 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Changhyun Lee <changhyun1.lee@samsung.com>
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.console;
+
+import org.eclipse.swt.graphics.Color;
+
+public class TextStyle {
+ private Color foreground;
+ private Color background;
+ private String stripString;
+
+ TextStyle(Color foreground,Color background,String stripString) {
+ this.foreground = foreground;
+ this.background = background;
+ this.stripString = stripString;
+ }
+
+ public Color getForeground() {
+ return foreground;
+ }
+
+ public Color getBackground() {
+ return background;
+ }
+
+ public String getStripString() {
+ return stripString;
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/control/NotSupportedTypeException.java b/org.tizen.common/src/org/tizen/common/control/NotSupportedTypeException.java
new file mode 100644
index 000000000..64cfa87c8
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/control/NotSupportedTypeException.java
@@ -0,0 +1,35 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.control;
+
+public class NotSupportedTypeException extends Exception {
+
+ public NotSupportedTypeException(){
+ super();
+ }
+ public NotSupportedTypeException(String message){
+ super(message);
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/control/TableViewCellModifier.java b/org.tizen.common/src/org/tizen/common/control/TableViewCellModifier.java
new file mode 100644
index 000000000..6bbc54ede
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/control/TableViewCellModifier.java
@@ -0,0 +1,136 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.control;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.tizen.common.model.ITableVO;
+
+
+/**
+ * This class implements an ICellModifier
+ * An ICellModifier is called when the user modifes a cell in the
+ * tableViewer
+ */
+
+public class TableViewCellModifier implements ICellModifier {
+ private TableViewer viewer;
+ private String[] columnNames;
+ CellEditor[] cellEditors;
+ /**
+ * Constructor
+ * @param TableViewerExample an instance of a TableViewerExample
+ */
+ public TableViewCellModifier(TableViewer viewer) {
+ super();
+ this.viewer = viewer;
+ this.columnNames = getColumnNames();
+ this.viewer.setColumnProperties(columnNames);
+ }
+
+ private String[] getColumnNames() {
+ TableColumn[] columns = viewer.getTable().getColumns();
+ String[] columnNames = new String[columns.length];
+ for(int i=0;i<columnNames.length;i++){
+ columnNames[i] = columns[i].getText();
+ }
+
+ return columnNames;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
+ */
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
+ */
+ public Object getValue(Object element, String property) {
+
+ Object result = null;
+ int idx = getColumnIndex(property);
+ ITableVO vo = (ITableVO)element;
+
+ CellEditor ce = getCellEditor(idx);
+
+ if(ce instanceof ComboBoxCellEditor){
+ result = vo.getColumnValue(idx);
+ }else if(ce instanceof TextCellEditor){
+ result = vo.getColumnValue(idx);
+ }else{
+ result = ""; //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ private CellEditor getCellEditor(int idx) {
+ if(this.cellEditors==null)
+ this.cellEditors = viewer.getCellEditors();
+ return this.cellEditors[idx];
+ }
+
+ private int getColumnIndex(String property) {
+ for(int i=0;i<columnNames.length;i++){
+ if(columnNames[i].equals(property))
+ return i;
+ }
+ return 0;
+ }
+
+ private int getComboIndex(String[] items, Object str) {
+ for(int i=0;i<items.length;i++){
+ if(items[i].equals(str))
+ return i;
+ }
+ return 0;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
+ */
+ public void modify(Object element, String property, Object value) {
+ int idx = getColumnIndex(property);
+ ITableVO vo = (ITableVO)((TableItem) element).getData();
+
+ if(cellEditors[idx] instanceof ComboBoxCellEditor){
+ if((Integer)value < 0)
+ return;
+ else
+ vo.setColumnValue(idx, value);
+ }else if(cellEditors[idx] instanceof TextCellEditor){
+ vo.setColumnValue(idx, value);
+ }
+
+ viewer.update(vo, null);
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/control/TableViewColumnSorter.java b/org.tizen.common/src/org/tizen/common/control/TableViewColumnSorter.java
new file mode 100644
index 000000000..b08a9bc46
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/control/TableViewColumnSorter.java
@@ -0,0 +1,160 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.control;
+
+import java.util.Comparator;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.tizen.common.model.ITableVO;
+
+
+
+
+/**
+ * A viewer sorter is used by a structured viewer to reorder the elements
+ * provided by its content provider. In addition, the TableViewColumnSorter
+ * listens for mouse clicks in the column headers and resorts the table content
+ * based on the column that was selected. Clicking on a column a second time
+ * toggles the sort order.
+ */
+public class TableViewColumnSorter extends ViewerSorter {
+ private static final String COLUMN_INDEX_KEY = "COLUMN_INDEX"; //$NON-NLS-1$
+ private static final String HEADER_TEXT_KEY = "HEADER_TEXT"; //$NON-NLS-1$
+ private static final String TAG_DESCENDING = "â–²"; //$NON-NLS-1$
+ private static final String TAG_ASCENDING = "â–¼"; //$NON-NLS-1$
+
+ private TableViewer viewer;
+ private Table table;
+ private TableColumn[] columns;
+ Cursor waitCursor;
+
+ private Comparator<String> stringComparator = new Comparator<String>(){
+ @Override
+ public int compare(String str1, String str2) {
+ str1=str1==null?"":str1; //$NON-NLS-1$
+ str2=str2==null?"":str2; //$NON-NLS-1$
+ return str1.compareTo(str2);
+ }
+ };
+
+ private Comparator<Integer> numberComparator = new Comparator<Integer>(){
+ @Override
+ public int compare(Integer num1, Integer num2) {
+ return num1>num2?1:(num1==num2?0:-1);
+ }
+ };
+
+ public TableViewColumnSorter(TableViewer viewer) {
+ this.viewer = viewer;
+ this.table = viewer.getTable();
+ this.columns = viewer.getTable().getColumns();
+
+ createCursor();
+ createSelectionListener(columns);
+ }
+
+ private void createCursor(){
+ waitCursor = Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT);
+ }
+
+ public int compare(Viewer viewer, Object object1, Object object2) {
+ TableColumn column = table.getSortColumn();
+
+ int index = -1;
+ if(column==null){
+ return 0;
+ }else{
+ index = (Integer)column.getData(COLUMN_INDEX_KEY);
+ }
+
+ Object target1 = ((ITableVO)object1).getColumnValue(index);
+ Object target2 = ((ITableVO)object2).getColumnValue(index);
+
+ int result = compare(target1, target2);
+
+ if(table.getSortDirection()==SWT.UP)
+ return result;
+ else
+ return -result;
+ }
+
+ public int compare(Object object1, Object object2){
+ if(object1 instanceof Integer){
+ return numberComparator.compare((Integer)object1, (Integer)object2);
+ }else{
+ return stringComparator.compare(object1.toString(), object2.toString());
+ }
+ }
+
+ private void createSelectionListener(TableColumn[] columns) {
+ for (int i = 0; i < columns.length; i++) {
+ columns[i].setData(COLUMN_INDEX_KEY,i);
+ columns[i].setData(HEADER_TEXT_KEY,columns[i].getText());
+ columns[i].addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TableColumn column = (TableColumn)e.getSource();
+ clearColumnHeader(column);
+ renderColumnHeader(column);
+
+ table.setCursor(waitCursor);
+ viewer.refresh();
+ table.setCursor(null);
+ }
+ });
+ }
+ }
+
+ private void renderColumnHeader(TableColumn column){
+ int direction = table.getSortDirection()==SWT.UP?SWT.DOWN:SWT.UP;
+ table.setSortDirection(direction);
+ table.setSortColumn(column);
+
+ String title = (String)column.getData(HEADER_TEXT_KEY);
+ String directionShape = direction==SWT.UP?TAG_DESCENDING:TAG_ASCENDING;
+ column.setText(title+" "+directionShape); //$NON-NLS-1$
+ }
+
+ private void clearColumnHeader(TableColumn column){
+ TableColumn prevColumn = table.getSortColumn();
+
+ if(prevColumn==null){
+ return;
+ }else{
+ prevColumn.setText((String)prevColumn.getData(HEADER_TEXT_KEY));
+ }
+ }
+
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/control/TableViewContentProvider.java b/org.tizen.common/src/org/tizen/common/control/TableViewContentProvider.java
new file mode 100644
index 000000000..2d9038cac
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/control/TableViewContentProvider.java
@@ -0,0 +1,50 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.control;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.tizen.common.model.ITableModel;
+
+
+public class TableViewContentProvider implements IStructuredContentProvider {
+
+ public TableViewContentProvider() {
+ }
+
+ public Object[] getElements(Object model) {
+ return ((ITableModel)model).getDatas();
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object obj, Object obj1) {
+
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/control/TableViewLabelProvider.java b/org.tizen.common/src/org/tizen/common/control/TableViewLabelProvider.java
new file mode 100644
index 000000000..12bfa05cb
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/control/TableViewLabelProvider.java
@@ -0,0 +1,121 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.control;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.graphics.Image;
+import org.tizen.common.model.ITableVO;
+
+
+
+
+
+public class TableViewLabelProvider extends ColumnLabelProvider implements ITableLabelProvider {
+
+ public TableViewLabelProvider() {
+ }
+
+ private TableViewer viewer;
+ CellEditor[] cellEditors;
+
+ public TableViewLabelProvider(TableViewer viewer) {
+ this.viewer = viewer;
+ this.cellEditors = viewer.getCellEditors();
+ }
+
+ private Field[] fields;
+
+ private int getColumnIndex(int columnIndex){
+ return fields.length>columnIndex?columnIndex:fields.length;
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+// private void hasCellEditor(){
+// if(this.cellEditors==null)
+// this.cellEditors = viewer.getCellEditors();
+// }
+
+ private CellEditor getCellEditor(int idx) {
+ if(this.cellEditors==null)
+ return null;
+ else
+ return this.cellEditors[idx];
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ Object obj = null;
+
+ if(element instanceof ITableVO){
+ ITableVO data = (ITableVO)element;
+ if(this.cellEditors != null){
+ CellEditor ce = getCellEditor(columnIndex);
+ if(ce instanceof ComboBoxCellEditor){
+ ComboBoxCellEditor editor = (ComboBoxCellEditor)ce;
+ String items[] = editor.getItems();
+ int idx = (Integer) data.getColumnValue(columnIndex);
+ if(idx<0)
+ obj = null;
+ else if(idx>items.length)
+ obj = items[0];
+ else
+ obj = items[idx];
+ }else{
+ obj = data.getColumnValue(columnIndex);
+ }
+ }else{
+ obj = data.getColumnValue(columnIndex);
+ }
+ }else{
+ if(fields==null)
+ fields = element.getClass().getDeclaredFields();
+
+ int idx = getColumnIndex(columnIndex);
+ String fieldName = fields[idx].getName().substring(0, 1).toUpperCase()
+ + fields[idx].getName().substring(1,fields[idx].getName().length());
+
+ try{
+ Method method = element.getClass().getMethod("get" + fieldName, new Class[] {}); //$NON-NLS-1$
+ obj = method.invoke(element, new Object[] {});
+ }catch(Exception e){
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ return obj==null?"":String.valueOf(obj); //$NON-NLS-1$
+ }
+
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/control/TreeViewContentProvider.java b/org.tizen.common/src/org/tizen/common/control/TreeViewContentProvider.java
new file mode 100644
index 000000000..726fb9390
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/control/TreeViewContentProvider.java
@@ -0,0 +1,69 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.control;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.tizen.common.model.ITreeModel;
+import org.tizen.common.model.ITreeVO;
+
+
+public class TreeViewContentProvider implements ITreeContentProvider {
+
+ public Object[] getChildren(Object element) {
+ if(element instanceof ITreeModel)
+ return ((ITreeModel)element).getDatas();
+ else
+ return ((ITreeVO)element).getChildren();
+ }
+
+ public Object getParent(Object element) {
+ if(element instanceof ITreeModel)
+ return null;
+ else
+ return ((ITreeVO)element).getParent();
+
+ }
+
+ public boolean hasChildren(Object element) {
+ if(element instanceof ITreeModel)
+ return ((ITreeModel)element).size()>0;
+ else
+ return ((ITreeVO)element).hasChildren();
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/control/TreeViewLabelProvider.java b/org.tizen.common/src/org/tizen/common/control/TreeViewLabelProvider.java
new file mode 100644
index 000000000..77bb41387
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/control/TreeViewLabelProvider.java
@@ -0,0 +1,32 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.control;
+
+import org.eclipse.jface.viewers.LabelProvider;
+
+public class TreeViewLabelProvider extends LabelProvider {
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/handler/ClearHandler.java b/org.tizen.common/src/org/tizen/common/handler/ClearHandler.java
new file mode 100644
index 000000000..ba8c72731
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/handler/ClearHandler.java
@@ -0,0 +1,65 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.tizen.common.manager.StatusLineMessageManager;
+import org.tizen.common.model.ITableModel;
+
+
+
+public class ClearHandler extends AbstractHandler {
+ private IViewPart part;
+ private TableViewer viewer;
+ private StatusLineMessageManager statusLine;
+
+ private String message = Messages.ClearHandler_0;
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ part = (IViewPart)HandlerUtil.getActivePart(event);
+ viewer = (TableViewer)part.getSite().getSelectionProvider();
+ statusLine = new StatusLineMessageManager(part);
+
+ clearData();
+ return null;
+ }
+
+ private void clearData() throws ExecutionException {
+ ITableModel model = (ITableModel)viewer.getInput();
+ model.clear();
+ viewer.refresh();
+ statusLine.setMessage(message);
+ }
+
+
+}
+
diff --git a/org.tizen.common/src/org/tizen/common/handler/ClipboardHandler.java b/org.tizen.common/src/org/tizen/common/handler/ClipboardHandler.java
new file mode 100644
index 000000000..e31e5eed2
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/handler/ClipboardHandler.java
@@ -0,0 +1,51 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Superclass for clipboard related handlers providing safe creation and
+ * disposal of the {@link Clipboard}.
+ */
+public abstract class ClipboardHandler extends AbstractHandler {
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Clipboard clipboard = new Clipboard(HandlerUtil.getActiveShell(event)
+ .getDisplay());
+ try {
+ return execute(event, clipboard);
+ } finally {
+ clipboard.dispose();
+ }
+ }
+
+ protected abstract Object execute(ExecutionEvent event, Clipboard clipboard)
+ throws ExecutionException;
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/handler/CopyHandler.java b/org.tizen.common/src/org/tizen/common/handler/CopyHandler.java
new file mode 100644
index 000000000..54d604f79
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/handler/CopyHandler.java
@@ -0,0 +1,101 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.handler;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.ResourceTransfer;
+
+/**
+ * Copy each currently selected object in the Favorites view to the clipboard.
+ */
+public class CopyHandler extends ClipboardHandler {
+ /**
+ * Called by the superclass {@link #execute(ExecutionEvent)} method so that
+ * this method can concentrate on the operation and does not have to manage
+ * clipboard creation and disposal.
+ */
+ public Object execute(ExecutionEvent event, Clipboard clipboard)
+ throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ Object[] objects = ((IStructuredSelection) selection).toArray();
+ if (objects.length > 0) {
+ try {
+ clipboard.setContents(new Object[] { asResources(objects),
+ asText(objects), }, new Transfer[] {
+ ResourceTransfer.getInstance(),
+ TextTransfer.getInstance(), });
+ } catch (SWTError error) {
+ // Copy to clipboard failed.
+ // This happens when another application
+ // is accessing the clipboard while we copy.
+ // Ignore the error.
+ }
+ }
+ }
+ return null;
+ }
+
+ public static IResource[] asResources(Object[] objects) {
+ Collection<IResource> resources = new ArrayList<IResource>(
+ objects.length);
+ for (int i = 0; i < objects.length; i++) {
+ Object each = objects[i];
+ if (each instanceof IAdaptable) {
+ IResource res = (IResource) ((IAdaptable) each)
+ .getAdapter(IResource.class);
+ if (res != null)
+ resources.add(res);
+ }
+ }
+ return resources.toArray(new IResource[resources.size()]);
+ }
+
+ public static String asText(Object[] objects) {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < objects.length; i++) {
+ Object each = objects[i];
+ if (each != null) {
+ buf.append(each.toString());
+ }
+ buf.append(System.getProperty("line.separator")); //$NON-NLS-1$
+ }
+ return buf.toString();
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/handler/Messages.java b/org.tizen.common/src/org/tizen/common/handler/Messages.java
new file mode 100644
index 000000000..7cb9e48ae
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/handler/Messages.java
@@ -0,0 +1,49 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.handler;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.tizen.common.handler.messages"; //$NON-NLS-1$
+ public static String ClearHandler_0;
+ public static String OpenFileHandler_0;
+ public static String OpenFileHandler_2;
+ public static String OpenFileHandler_3;
+ public static String SaveFileHandler_0;
+ public static String SaveFileHandler_1;
+ public static String SaveFileHandler_11;
+ public static String SaveFileHandler_12;
+ public static String SaveFileHandler_4;
+ public static String SaveFileHandler_5;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/handler/OpenFileHandler.java b/org.tizen.common/src/org/tizen/common/handler/OpenFileHandler.java
new file mode 100644
index 000000000..f97b3e066
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/handler/OpenFileHandler.java
@@ -0,0 +1,103 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.ide.IDE;
+import org.tizen.common.manager.StatusLineMessageManager;
+
+
+
+public class OpenFileHandler extends AbstractHandler {
+ private IViewPart part;
+ private String fileName;
+ private Shell shell;
+ private IWorkbenchPage page;
+ private StatusLineMessageManager statusLine;
+
+ private final String title = Messages.OpenFileHandler_0;
+ private final String PARAMETER_ID = "org.tizen.common.command.openFile.parameter"; //$NON-NLS-1$
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ part = (IViewPart)HandlerUtil.getActivePart(event);
+ shell = part.getSite().getShell();
+ page = part.getSite().getPage();
+ statusLine = new StatusLineMessageManager(part);
+
+ String extension = event.getParameter(PARAMETER_ID);
+
+ openFile(extension);
+ return null;
+ }
+
+ private void openFile(String extension) throws ExecutionException {
+ fileName = getLoadFileName(extension);
+ if(fileName==null)
+ return;
+
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(fileName));
+ IFileInfo fileInfo = fileStore.fetchInfo();
+ fileInfo.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true);
+
+ if( fileInfo.isDirectory()||!fileInfo.exists() ){
+ statusLine.setErrorMessage(Messages.OpenFileHandler_2);
+ return;
+ }
+
+ try {
+ IDE.openEditorOnFileStore(page, fileStore);
+ } catch (PartInitException e) {
+ statusLine.setErrorMessage(fileName+ Messages.OpenFileHandler_3);
+ return;
+ }
+
+ }
+
+ private String getLoadFileName(String extension) {
+ String[] extFilter = {"*."+extension}; //$NON-NLS-1$
+
+ FileDialog dialog = new FileDialog(shell, SWT.OPEN);
+ dialog.setFilterExtensions(extFilter);
+ dialog.setText(title);
+ return dialog.open();
+ }
+
+}
+
diff --git a/org.tizen.common/src/org/tizen/common/handler/OpenPreferencesHandler.java b/org.tizen.common/src/org/tizen/common/handler/OpenPreferencesHandler.java
new file mode 100644
index 000000000..32932b811
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/handler/OpenPreferencesHandler.java
@@ -0,0 +1,61 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class OpenPreferencesHandler extends AbstractHandler {
+ private IViewPart part;
+ private Shell shell;
+ private final String PARAMETER_ID = "org.tizen.common.command.setting.parameter"; //$NON-NLS-1$
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ part = (IViewPart)HandlerUtil.getActivePart(event);
+ shell = part.getSite().getShell();
+
+ String preferenceId = event.getParameter(PARAMETER_ID);
+ openPreferences(preferenceId);
+ return null;
+ }
+
+ private void openPreferences(String preferenceId) throws ExecutionException {
+ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell,
+ preferenceId, null, null);
+ dialog.open();
+ }
+
+
+
+}
+
diff --git a/org.tizen.common/src/org/tizen/common/handler/SaveFileHandler.java b/org.tizen.common/src/org/tizen/common/handler/SaveFileHandler.java
new file mode 100644
index 000000000..c703e302d
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/handler/SaveFileHandler.java
@@ -0,0 +1,139 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.handler;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.tizen.common.manager.StatusLineMessageManager;
+import org.tizen.common.model.ITableModel;
+import org.tizen.common.util.DialogUtil;
+
+
+
+public class SaveFileHandler extends AbstractHandler {
+ private IViewPart part;
+ private TableViewer viewer;
+ private String fileName;
+ private Shell shell;
+ private StatusLineMessageManager statusLine;
+
+ private final String title = Messages.SaveFileHandler_0;
+ private final String PARAMETER_ID = "org.tizen.common.command.saveFile.parameter"; //$NON-NLS-1$
+
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ part = (IViewPart)HandlerUtil.getActivePart(event);
+ shell = part.getSite().getShell();
+ statusLine = new StatusLineMessageManager(part);
+
+ viewer = (TableViewer)part.getSite().getSelectionProvider();
+ String extension = event.getParameter(PARAMETER_ID);
+
+ if(!hasRecord())
+ return null;
+
+ try {
+ saveFile(extension);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ private void saveFile(String extension) throws InvocationTargetException, InterruptedException {
+ fileName = getSaveFileName(extension);
+
+ if(fileName==null)
+ return;
+
+ if(!fileName.endsWith("."+extension)) //$NON-NLS-1$
+ fileName= fileName+"."+extension; //$NON-NLS-1$
+
+ if(!(new File(fileName).getParentFile().canWrite())){
+ DialogUtil.openErrorDialog(Messages.SaveFileHandler_4);
+ return;
+ }
+
+ part.getSite().getWorkbenchWindow().run(false, false, new IRunnableWithProgress(){
+ public void run(IProgressMonitor monitor) {
+ monitor.beginTask(Messages.SaveFileHandler_5, 100);
+ writeRecord();
+ monitor.done();
+ }
+ });
+
+ showRecordCount();
+
+ }
+
+ private String getSaveFileName(String extension) {
+ String[] extFilter = {"*."+extension,"*.*"}; //$NON-NLS-1$ //$NON-NLS-2$
+
+ FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+ dialog.setFilterExtensions(extFilter);
+ dialog.setText(title);
+ dialog.setOverwrite(true);
+ dialog.setFileName("untitled."+extension); //$NON-NLS-1$
+ dialog.setFilterPath(System.getProperty("user.home")); //$NON-NLS-1$
+
+ return dialog.open();
+ }
+
+ private void writeRecord() {
+ ITableModel model = (ITableModel) viewer.getInput();
+ model.save(fileName);
+ }
+
+ private void showRecordCount() {
+ int size = ((ITableModel) viewer.getInput()).size();
+ statusLine.setMessage(Messages.SaveFileHandler_1+size+Messages.SaveFileHandler_11 + fileName);
+ }
+
+ private boolean hasRecord() {
+ int size = ((ITableModel) viewer.getInput()).size();
+ if(size==0){
+ statusLine.setErrorMessage(Messages.SaveFileHandler_12);
+ return false;
+ }else
+ statusLine.setErrorMessage(""); //$NON-NLS-1$
+ return true;
+ }
+}
+
diff --git a/org.tizen.common/src/org/tizen/common/handler/messages.properties b/org.tizen.common/src/org/tizen/common/handler/messages.properties
new file mode 100644
index 000000000..f9d98c9af
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/handler/messages.properties
@@ -0,0 +1,10 @@
+ClearHandler_0=All data is cleared
+OpenFileHandler_0=Load File
+OpenFileHandler_2=Input file doesn't exist or isn't a file
+OpenFileHandler_3=isn't opened for internal error
+SaveFileHandler_0=Save File
+SaveFileHandler_1=Total
+SaveFileHandler_11=\ record is saved into
+SaveFileHandler_12=There is no record.
+SaveFileHandler_4=You can store a file into the directory that has write permission. please select another directory
+SaveFileHandler_5=Save File
diff --git a/org.tizen.common/src/org/tizen/common/log/Logger.java b/org.tizen.common/src/org/tizen/common/log/Logger.java
new file mode 100644
index 000000000..6f09f7824
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/log/Logger.java
@@ -0,0 +1,99 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.log;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.tizen.common.CommonPlugin;
+import org.tizen.common.console.ConsoleManager;
+
+
+/**
+ * Logger.
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+public class Logger {
+ private static String loggerName = Logger.class.getName();
+
+ public static void log(IStatus status) {
+ CommonPlugin plugin = CommonPlugin.getDefault();
+ if (plugin != null) {
+ plugin.getLog().log(status);
+ } else {
+ ConsoleManager conManager = new ConsoleManager("Error Log", false);
+ conManager.println(status.getPlugin() + " : " + status.getMessage());
+ }
+ }
+
+ private static String getCallerName() {
+ // Get the stack trace.
+ StackTraceElement stack[] = (new Throwable()).getStackTrace();
+ int ix = 0;
+ // Now search for the first frame before the "Logger" class.
+ while (ix < stack.length) {
+ StackTraceElement frame = stack[ix];
+ String cname = frame.getClassName();
+ if (!cname.equals(loggerName)) {
+ return cname;
+ }
+ ix++;
+ }
+ return "noname";
+ }
+
+ public static void log(Throwable e) {
+ if (e instanceof CoreException) {
+ log(new Status(IStatus.ERROR, getCallerName(), ((CoreException) e).getStatus().getSeverity(), e.getMessage(), e.getCause()));
+ } else {
+ log(new Status(IStatus.ERROR, getCallerName(), e.toString(), e));
+ }
+ }
+
+ public static void info(String message, Object... arguments) {
+ log(new Status(Status.INFO, getCallerName(), getPossiblyFormattedString(message, arguments)));
+ }
+
+ public static void error(Object message, Throwable t) {
+ log(new Status(Status.ERROR, getCallerName(), message.toString(), t));
+ }
+
+ public static void error(String message, Object... arguments) {
+ log(new Status(Status.ERROR, getCallerName(), getPossiblyFormattedString(message, arguments)));
+ }
+
+ public static void warning(String message, Object... arguments) {
+ log(new Status(Status.WARNING, getCallerName(), getPossiblyFormattedString(message, arguments)));
+ }
+
+ private static String getPossiblyFormattedString(String message, Object... arguments) {
+ return arguments.length > 0 ? MessageFormat.format(message, arguments)
+ : message;
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/manager/ColorCache.java b/org.tizen.common/src/org/tizen/common/manager/ColorCache.java
new file mode 100644
index 000000000..3920db1d1
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/manager/ColorCache.java
@@ -0,0 +1,88 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.manager;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+public class ColorCache {
+ private String[] keys;
+ private Color[] colors;
+
+ public ColorCache(String[] keys){
+ if(keys==null||keys.length==0)
+ throw new IllegalArgumentException(Messages.ColorCache_0);
+
+ this.keys = keys;
+ this.colors = new Color[keys.length];
+ }
+
+ private int getIndex(String key){
+ int index = -1;
+ for(int i=0;i<keys.length;i++){
+ if(key!=null&&key.equals(keys[i])){
+ index = i;
+ break;
+ }
+ }
+ return index;
+ }
+
+ public Color getColor(String key){
+ int index = getIndex(key);
+ if(index<0){
+ return null;
+ }else{
+ return colors[index];
+ }
+ }
+
+ public void setColor(String key, RGB rgb){
+ int index = getIndex(key);
+ if(index<0)
+ return;
+
+ Color color = colors[index];
+ if(color!=null){
+ color.dispose();
+ color=null;
+ }
+
+ colors[index] = new Color(Display.getCurrent(),rgb);
+ }
+
+ public void dispose(){
+ for(int i=0;i<colors.length;i++){
+ Color color = colors[i];
+ if(color!=null){
+ color.dispose();
+ color=null;
+ }
+ }
+ }
+
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/manager/Messages.java b/org.tizen.common/src/org/tizen/common/manager/Messages.java
new file mode 100644
index 000000000..f5fa5a835
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/manager/Messages.java
@@ -0,0 +1,40 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.manager;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.tizen.common.manager.messages"; //$NON-NLS-1$
+ public static String ColorCache_0;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/manager/StatusLineMessageManager.java b/org.tizen.common/src/org/tizen/common/manager/StatusLineMessageManager.java
new file mode 100644
index 000000000..77d279e10
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/manager/StatusLineMessageManager.java
@@ -0,0 +1,47 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.manager;
+
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class StatusLineMessageManager{
+ private IViewPart part;
+ private IStatusLineManager manager;
+
+ public StatusLineMessageManager(IWorkbenchPart part){
+ this.part = (IViewPart)part;
+ this.manager = this.part.getViewSite().getActionBars().getStatusLineManager();
+ }
+
+ public void setErrorMessage(String message){
+ manager.setErrorMessage(message);
+ }
+
+ public void setMessage(String message){
+ manager.setMessage(message);
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/manager/messages.properties b/org.tizen.common/src/org/tizen/common/manager/messages.properties
new file mode 100644
index 000000000..19dbd56f4
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/manager/messages.properties
@@ -0,0 +1 @@
+ColorCache_0=Argument must not be null
diff --git a/org.tizen.common/src/org/tizen/common/model/AbstractTableModel.java b/org.tizen.common/src/org/tizen/common/model/AbstractTableModel.java
new file mode 100644
index 000000000..97555e65e
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/AbstractTableModel.java
@@ -0,0 +1,180 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.XMLMemento;
+
+public abstract class AbstractTableModel implements ITableModel {
+ private static final String TAG_ROOT = "root"; //$NON-NLS-1$
+
+ private Collection<AbstractTableVO> inventory = new ArrayList<AbstractTableVO>();
+ protected AbstractTableVO source;
+ private boolean isDirty = false;
+
+ public AbstractTableModel(AbstractTableVO source) {
+ this.source = source;
+
+ }
+
+
+
+ public ITableVO[] getDatas() {
+ if (inventory == null)
+ return null;
+
+ return inventory.toArray(new AbstractTableVO[inventory.size()]);
+ }
+
+ public void add(Collection<AbstractTableVO> datas) {
+ if (datas == null)
+ return;
+
+ inventory.addAll(datas);
+ }
+
+ public int size(){
+ return inventory.size();
+ }
+
+ public void add(AbstractTableVO data) {
+ inventory.add(data);
+ }
+
+ public void remove(Collection<AbstractTableVO> datas) {
+ if (datas == null)
+ return;
+
+ inventory.removeAll(datas);
+ }
+
+ public void remove(AbstractTableVO data) {
+ inventory.remove(data);
+ }
+
+ public void clear() {
+ inventory.clear();
+ }
+
+ public void load(String fileName) {
+ if (inventory==null||source==null)
+ return;
+
+ FileReader reader = null;
+ try {
+ reader = new FileReader(new File(fileName));
+ load(XMLMemento.createReadRoot(reader));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (reader != null)
+ reader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void load(XMLMemento memento) {
+ IMemento[] children = memento.getChildren(getSourceName());
+ AbstractTableVO data = null;
+ String[] fields = source.getColumnNames();
+ for (int i = 0; i < children.length; i++) {
+ data = source.clone();
+ for (int j = 0; j < fields.length; j++) {
+ data.setColumnValue(j, children[i].getString(fields[j]));
+ }
+ add(data);
+ }
+ }
+
+ public void save(String fileName) {
+ if (inventory == null || source == null)
+ return;
+
+ XMLMemento memento = XMLMemento.createWriteRoot(TAG_ROOT);
+ save(memento);
+ FileWriter writer = null;
+ try {
+ writer = new FileWriter(fileName);
+ memento.save(writer);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (writer != null)
+ writer.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void save(XMLMemento memento) {
+ Iterator<AbstractTableVO> iter = inventory.iterator();
+ AbstractTableVO data = null;
+ String[] fields = null;
+
+ while (iter.hasNext()) {
+ data = iter.next();
+ fields = data.getColumnNames();
+ IMemento child = memento.createChild(getSourceName());
+ for (int j = 0; j < fields.length; j++) {
+ child.putString(
+ fields[j],
+ String.valueOf(data.getColumnValue(j)));
+ }
+ }
+
+ }
+
+ public String getSourceName() {
+ return this.source.getClass().getSimpleName();
+ }
+
+ public boolean isDirty(){
+ return this.isDirty;
+ }
+
+ public synchronized void setDirty(boolean isDirty){
+ this.isDirty = isDirty;
+ }
+
+}
+
+
diff --git a/org.tizen.common/src/org/tizen/common/model/AbstractTableVO.java b/org.tizen.common/src/org/tizen/common/model/AbstractTableVO.java
new file mode 100644
index 000000000..8f359a677
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/AbstractTableVO.java
@@ -0,0 +1,80 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+public abstract class AbstractTableVO implements ITableVO{
+ public abstract String[] getColumnNames();
+ public abstract Object getColumnValue(int index);
+ public abstract void setColumnValue(int index, Object value);
+
+ public AbstractTableVO clone(){
+ Object obj = null;
+ try{
+ obj = super.clone();
+ }catch(CloneNotSupportedException e){
+
+ }
+ return (AbstractTableVO)obj;
+ }
+
+ public Object getColumnValue(String columnName){
+ return getColumnValue(getColumnIndex(columnName));
+ }
+
+ public String getColumnName(int index){
+ String[] columnNames = getColumnNames();
+ if(index<0||index>columnNames.length)
+ return null;
+ else
+ return columnNames[index];
+ }
+
+ public int getColumnIndex(String columnName){
+ String[] columnNames = getColumnNames();
+ int index =-1;
+ for(int i=0;i<columnNames.length;i++){
+ if(columnName.equals(columnNames[i])){
+ index = i;
+ break;
+ }
+ }
+ return index;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ String[] fields = getColumnNames();
+ for (int j = 0; j < fields.length; j++) {
+ Object obj = getColumnValue(j);
+ buf.append(obj==null?"":String.valueOf(obj)); //$NON-NLS-1$
+ if(j<fields.length-1)
+ buf.append(","); //$NON-NLS-1$
+ }
+ return buf.toString();
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/model/AbstractTreeModel.java b/org.tizen.common/src/org/tizen/common/model/AbstractTreeModel.java
new file mode 100644
index 000000000..0282ddf99
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/AbstractTreeModel.java
@@ -0,0 +1,102 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.ui.XMLMemento;
+
+public class AbstractTreeModel implements ITreeModel {
+ private static final String TAG_ROOT = "root"; //$NON-NLS-1$
+
+ private Collection<ITreeVO> inventory = new ArrayList<ITreeVO>();
+ protected ITreeVO source;
+ private boolean isDirty = false;
+
+ public AbstractTreeModel(ITreeVO source){
+// if(source.getSuperclass() != ITreeVO.class)
+ this.source = source;
+ }
+
+ public ITreeVO[] getDatas() {
+ if (inventory == null)
+ return null;
+
+ return inventory.toArray(new ITreeVO[inventory.size()]);
+ }
+
+ public void add(Collection<ITreeVO> datas) {
+ if (datas == null)
+ return;
+
+ inventory.addAll(datas);
+ }
+
+ public int size(){
+ return inventory.size();
+ }
+
+ public void add(ITreeVO data) {
+ inventory.add(data);
+ }
+
+ public void remove(Collection<ITreeVO> datas) {
+ if (datas == null)
+ return;
+
+ inventory.removeAll(datas);
+ }
+
+ public void remove(ITreeVO data) {
+ inventory.remove(data);
+ }
+
+ public void clear() {
+ inventory.clear();
+ }
+
+ public void load(String fileName) {
+ }
+
+ private void load(XMLMemento memento) {
+ }
+
+ public void save(String fileName) {
+ }
+
+ private void save(XMLMemento memento) {
+ }
+
+ public String getSourceName() {
+ return this.source.getClass().getSimpleName();
+ }
+
+
+
+}
+
+
diff --git a/org.tizen.common/src/org/tizen/common/model/AbstractTreeVO.java b/org.tizen.common/src/org/tizen/common/model/AbstractTreeVO.java
new file mode 100644
index 000000000..8a7c0f050
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/AbstractTreeVO.java
@@ -0,0 +1,109 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+import java.util.ArrayList;
+
+public abstract class AbstractTreeVO implements ITreeVO{
+
+ private String text;
+ private String description;
+ private Object data = null;
+ private int level = 0;
+
+ private AbstractTreeVO parent;
+ private ArrayList<AbstractTreeVO> children;
+
+ public AbstractTreeVO(AbstractTreeVO parent,String text) {
+ this.parent = parent;
+ this.text = text;
+ this.level = parent==null?1:parent.getLevel()+1;
+ if(parent!=null)
+ parent.addChild(this);
+ children = new ArrayList<AbstractTreeVO>();
+ }
+
+ public AbstractTreeVO(AbstractTreeVO parent) {
+ this(parent,null);
+ }
+
+ public ITreeVO[] getChildren() {
+ return (ITreeVO[])children.toArray(new ITreeVO[children.size()]);
+ }
+
+ public ITreeVO getParent(){
+ return this.parent;
+ }
+
+ public boolean hasChildren() {
+ return children.size()>0;
+ }
+
+ public int size() {
+ return children.size();
+ }
+
+ public void addChild(ITreeVO child) {
+ children.add((AbstractTreeVO)child);
+ }
+
+ public void removeChild(Object child) {
+ children.remove(child);
+ }
+
+ public String toString() {
+ return getText();
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setData(Object data) {
+ this.data = data;
+ }
+
+ public Object getData(){
+ return this.data;
+ }
+
+ public int getLevel(){
+ return this.level;
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/model/DefaultTableModel.java b/org.tizen.common/src/org/tizen/common/model/DefaultTableModel.java
new file mode 100644
index 000000000..d50073748
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/DefaultTableModel.java
@@ -0,0 +1,43 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+
+public class DefaultTableModel extends AbstractTableModel {
+
+ public DefaultTableModel(AbstractTableVO source) {
+ super(source);
+ }
+
+ public String getSourceName() {
+ String str = this.source.getClass().getSimpleName();
+ if(str.endsWith("VO")) //$NON-NLS-1$
+ str = str.substring(0,str.length()-2);
+ return str;
+ }
+}
+
+
diff --git a/org.tizen.common/src/org/tizen/common/model/DefaultTreeModel.java b/org.tizen.common/src/org/tizen/common/model/DefaultTreeModel.java
new file mode 100644
index 000000000..687c3089a
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/DefaultTreeModel.java
@@ -0,0 +1,44 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+
+
+public class DefaultTreeModel extends AbstractTreeModel {
+
+ public DefaultTreeModel(ITreeVO source){
+ super(source);
+ }
+
+ public String getSourceName() {
+ String str = this.source.getClass().getSimpleName();
+ if(str.endsWith("VO")) //$NON-NLS-1$
+ str = str.substring(0,str.length()-2);
+ return str;
+ }
+}
+
+
diff --git a/org.tizen.common/src/org/tizen/common/model/ITableModel.java b/org.tizen.common/src/org/tizen/common/model/ITableModel.java
new file mode 100644
index 000000000..e21b41f51
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/ITableModel.java
@@ -0,0 +1,45 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+import java.util.Collection;
+
+
+public interface ITableModel
+{
+ public void add(AbstractTableVO datas);
+ public void add(Collection<AbstractTableVO> datas);
+ public void remove(AbstractTableVO datas);
+ public void remove(Collection<AbstractTableVO> datas);
+ public ITableVO[] getDatas();
+ public void load(String fileName);
+ public void save(String fileName);
+ public void clear();
+ public int size();
+ public String getSourceName();
+ public boolean isDirty();
+ public void setDirty(boolean isDirty);
+}
diff --git a/org.tizen.common/src/org/tizen/common/model/ITableVO.java b/org.tizen.common/src/org/tizen/common/model/ITableVO.java
new file mode 100644
index 000000000..e8a4592f3
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/ITableVO.java
@@ -0,0 +1,35 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+public interface ITableVO extends IVO{
+ public String[] getColumnNames();
+ public Object getColumnValue(int index);
+ public Object getColumnValue(String columnName);
+ public int getColumnIndex(String columnName);
+ public String getColumnName(int index);
+ public void setColumnValue(int index, Object value);
+}
diff --git a/org.tizen.common/src/org/tizen/common/model/ITreeModel.java b/org.tizen.common/src/org/tizen/common/model/ITreeModel.java
new file mode 100644
index 000000000..50a7a1373
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/ITreeModel.java
@@ -0,0 +1,42 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+import java.util.Collection;
+
+public interface ITreeModel
+{
+ public void add(ITreeVO datas);
+ public void add(Collection<ITreeVO> datas);
+ public void remove(ITreeVO datas);
+ public void remove(Collection<ITreeVO> datas);
+ public ITreeVO[] getDatas();
+ public void load(String fileName);
+ public void save(String fileName);
+ public void clear();
+ public int size();
+ public String getSourceName();
+}
diff --git a/org.tizen.common/src/org/tizen/common/model/ITreeVO.java b/org.tizen.common/src/org/tizen/common/model/ITreeVO.java
new file mode 100644
index 000000000..b0968aaca
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/ITreeVO.java
@@ -0,0 +1,42 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+public interface ITreeVO extends IVO{
+ public ITreeVO[] getChildren();
+ public ITreeVO getParent();
+ public boolean hasChildren();
+ public int size();
+ public void addChild(ITreeVO child);
+ public void removeChild(Object child) ;
+ public String getText();
+ public void setText(String text);
+ public String getDescription();
+ public void setDescription(String description);
+ public void setData(Object data);
+ public Object getData();
+ public int getLevel();
+}
diff --git a/org.tizen.common/src/org/tizen/common/model/IVO.java b/org.tizen.common/src/org/tizen/common/model/IVO.java
new file mode 100644
index 000000000..c49cf134c
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/model/IVO.java
@@ -0,0 +1,29 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.model;
+
+public interface IVO extends Cloneable{
+}
diff --git a/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.java b/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.java
new file mode 100644
index 000000000..e095402de
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.java
@@ -0,0 +1,47 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.preferences;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class PreferenceMessages {
+
+ private static final String BUNDLE_NAME = "org.tizen.common.preferences.PreferenceMessages";//$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+ private PreferenceMessages() {
+ }
+
+ public static String getString( String key ) {
+ try {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch( MissingResourceException e ) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.properties b/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.properties
new file mode 100644
index 000000000..3609acb77
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/preferences/PreferenceMessages.properties
@@ -0,0 +1,6 @@
+TizenPreferencePage.0=General settings for Tizen developement:
+TizenPreferencePage.1=SDK Path settings
+TizenPreferencePage.2=Location :
+TizenPreferencePage.3=SDK Update
+TizenPreferencePage.4=Automatically find new updates and notify me
+
diff --git a/org.tizen.common/src/org/tizen/common/preferences/TizenBasePreferencePage.java b/org.tizen.common/src/org/tizen/common/preferences/TizenBasePreferencePage.java
new file mode 100644
index 000000000..c90b83721
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/preferences/TizenBasePreferencePage.java
@@ -0,0 +1,125 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.preferences;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.tizen.common.CommonPlugin;
+
+
+public class TizenBasePreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage {
+
+ public final static String TIZENSDK_PATH = CommonPlugin.PLUGIN_ID + ".TizenSDKBasePreferencePage"; //$NON-NLS-1$
+
+ public static final String KEY_SDKLOCATION = "sdkpath"; //$NON-NLS-1$
+ public static final String KEY_SDKUPDATE = "sdkupdate"; //$NON-NLS-1$
+ public static final String VALUE_SDKLOCATION_DEFAULT = null;;
+ public static final boolean VALUE_SDKUPDATE_DEFAULT = true;
+
+ public TizenBasePreferencePage() {
+ //super(GRID);
+ setPreferenceStore( CommonPlugin.getDefault().getPreferenceStore() );
+ //getPreferenceStore().addPropertyChangeListener( getPropertyChangeListener() );
+ setDescription( PreferenceMessages.getString( "TizenPreferencePage.0" ) );
+ }
+
+
+ @Override
+ public void init(IWorkbench workbench) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ protected void createFieldEditors() {
+ // TODO Auto-generated method stub
+ Composite composite = getFieldEditorParent();
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout( layout );
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData( data );
+ createSpacer( composite, 1 );
+ createPathSettingPreferences( composite );
+ createSpacer( composite, 1 );
+ createUpdateSettingPreferences( composite );
+ createSpacer( composite, 1 );
+ }
+ protected void createSpacer( Composite composite, int columnSpan ) {
+ Label label = new Label( composite, SWT.NONE );
+ GridData gd = new GridData();
+ gd.horizontalSpan = columnSpan;
+ label.setLayoutData( gd );
+ }
+
+ private void createPathSettingPreferences( Composite parent ) {
+ Composite comp = createGroup( parent, PreferenceMessages.getString( "TizenPreferencePage.1" ),1 ); //$NON-NLS-1$
+ Composite formatComposite = createCompositeEx( comp, 1, GridData.FILL_HORIZONTAL);
+ DirectoryFieldEditor mDirectoryField = new DirectoryFieldEditor(TizenBasePreferencePage.KEY_SDKLOCATION, PreferenceMessages.getString("TizenPreferencePage.2"), formatComposite);
+ addField(mDirectoryField);
+ }
+
+ private void createUpdateSettingPreferences( Composite parent ) {
+ Composite comp = createGroup( parent, PreferenceMessages.getString( "TizenPreferencePage.3" ),1 ); //$NON-NLS-1$
+ Composite formatComposite = createCompositeEx( comp, 1, GridData.FILL_HORIZONTAL);
+ BooleanFieldEditor startupCheckEditor = new BooleanFieldEditor(TizenBasePreferencePage.KEY_SDKUPDATE, PreferenceMessages.getString("TizenPreferencePage.4"), formatComposite);
+ addField(startupCheckEditor);
+ }
+
+ private Composite createCompositeEx(Composite parent, int numColumns, int layoutMode) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setFont(parent.getFont());
+
+ composite.setLayout(new GridLayout(numColumns, true));
+ composite.setLayoutData(new GridData(layoutMode));
+ return composite;
+ }
+ private Group createGroup(Composite parent, String label, int nColumns) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setFont(parent.getFont());
+ group.setText(label);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = nColumns;
+ group.setLayout(layout);
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ return group;
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/properties/InstallPathConfig.java b/org.tizen.common/src/org/tizen/common/properties/InstallPathConfig.java
new file mode 100644
index 000000000..63f9d44c9
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/properties/InstallPathConfig.java
@@ -0,0 +1,137 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.properties;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.tizen.common.util.DialogUtil;
+import org.tizen.common.util.HostUtil;
+import org.tizen.common.util.OSChecker;
+
+
+
+final public class InstallPathConfig {
+
+ private static String sdkInstallPath;
+ private final static String SDKSUFFIX = ".TizenSDK"+File.separatorChar+"tizensdkpath";
+ private final static String EMULATOR_PATH = "Emulator";
+ private final static String INSTALLER_PATH = "InstallManager";
+
+ // Registry Key
+ private static final String REGISTRY_PATH_OF_SHELL_FOLDER = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
+ // public static final String REGISTRY_APP_DATA_OF_SHELL_FOLDER = "AppData";
+ private static final String REGISTRY_LOCAL_APP_DATA_OF_SHELL_FOLDER = "\"Local AppData\"";
+ // Value Column
+ private static final String REG_SZ = "REG_SZ";
+
+ static {
+ // FIXME : don't need the following lines if using environment variable
+ String sdkPath;
+
+ if (OSChecker.isWindows()) {
+ String appdataPath = getRegistryValue(REGISTRY_PATH_OF_SHELL_FOLDER,REGISTRY_LOCAL_APP_DATA_OF_SHELL_FOLDER) ;
+ sdkPath = appdataPath + File.separatorChar + SDKSUFFIX;
+ loadSdkPath(sdkPath);
+ } else if (OSChecker.isLinux() == true || OSChecker.isUnix() == true || OSChecker.isMAC() == true) {
+ sdkPath= System.getProperty("user.home") + File.separatorChar + SDKSUFFIX;
+ loadSdkPath(sdkPath);
+ } else {
+ DialogUtil.openMessageDialog(System.getProperty("os.name") + " is not supported currently.");
+ System.exit(0);
+ }
+ }
+
+ public static String getEmulatorPath(){
+ return sdkInstallPath + File.separatorChar + EMULATOR_PATH;
+ }
+
+ public static String getIDEPath() {
+ // FIXME : can't help but putting the code due to the Web IDE path , It has to be removed soon.
+ return System.getProperty("user.dir");
+ }
+
+ public static String getSDKPath() {
+ return sdkInstallPath;
+ }
+
+ public static String getInstallManagerPath() {
+ return sdkInstallPath + File.separatorChar + INSTALLER_PATH;
+ }
+
+ private static void loadSdkPath(String sdkPath) {
+ if (HostUtil.exists(sdkPath)) {
+ String[] fileContent = HostUtil.getContents(sdkPath).split("=");
+ if (HostUtil.exists(fileContent[1]))
+ sdkInstallPath = fileContent[1];
+ else {
+ DialogUtil.openMessageDialog("Tizen SDK is not installed propertly.");
+ System.exit(0);
+ }
+ } else {
+ DialogUtil.openMessageDialog("Tizen SDK is not installed propertly.");
+ System.exit(0);
+ }
+ }
+ private static String getRegistryValue(String node, String key) {
+ if (!OSChecker.isWindows())
+ return null;
+
+ BufferedReader br = null;
+ String value = "";
+
+ String query = "reg query " + "\"" + node + "\" /v " + key;
+ try {
+ Process process = Runtime.getRuntime().exec(query);
+ String encoding = System.getProperty("sun.jnu.encoding");
+ br = new BufferedReader(new InputStreamReader(process.getInputStream(), encoding));
+
+ String line = null;
+ while((line = br.readLine()) != null) {
+ int index = line.indexOf(REG_SZ);
+ if (index >= 0) {
+ value = line.substring(index + REG_SZ.length()).trim();
+ }
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return value;
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/queue/Queue.java b/org.tizen.common/src/org/tizen/common/queue/Queue.java
new file mode 100644
index 000000000..366aba6dd
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/queue/Queue.java
@@ -0,0 +1,71 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.queue;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+public class Queue<T>{
+
+ private ConcurrentLinkedQueue<T> queue = new ConcurrentLinkedQueue<T>();
+ private boolean waiting = false;
+
+ public synchronized void add(T e){
+ queue.add(e);
+ if(waiting)
+ notify();
+ }
+
+ public synchronized T poll(){
+ while (isEmpty()) {
+ try {
+ waiting = true;
+ wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ waiting = false;
+ return queue.poll();
+ }
+
+ public synchronized void clear(){
+ queue.clear();
+ }
+
+ public boolean isEmpty() {
+ return queue.isEmpty();
+ }
+
+ public int size() {
+ return queue.size();
+ }
+
+ public synchronized void stop() {
+ if (waiting)
+ notify();
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/swt/ClosableTray.java b/org.tizen.common/src/org/tizen/common/swt/ClosableTray.java
new file mode 100644
index 000000000..ec149654f
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/swt/ClosableTray.java
@@ -0,0 +1,172 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.swt;
+
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.dialogs.DialogTray;
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+
+/**
+ * a extended DialogTray class that user can be closing
+ *
+ * @author Jihoon Song {@literal <jihoon80.song@samsung.com>} (S-Core)
+ */
+public abstract class ClosableTray extends DialogTray {
+ private Image closeNormal;
+ private Image closeHover;
+ private Shell shell;
+
+ private void createImages() {
+ Display display = Display.getCurrent();
+ int[] shape = new int[] {
+ 3, 3, 5, 3, 7, 5, 8, 5, 10, 3, 12, 3, 12, 5, 10, 7, 10, 8, 12, 10,
+ 12, 12, 10, 12, 8, 10, 7, 10, 5, 12, 3, 12, 3, 10, 5, 8, 5, 7, 3, 5
+ };
+
+ // create image data
+ Color border = display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
+ Color background = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ Color backgroundHot = new Color(display, new RGB(252, 160, 160));
+ Color transparent = display.getSystemColor(SWT.COLOR_MAGENTA);
+
+ PaletteData palette = new PaletteData(new RGB[] {
+ transparent.getRGB(), border.getRGB(), background.getRGB(), backgroundHot.getRGB()
+ });
+ ImageData data = new ImageData(16, 16, 8, palette);
+ data.transparentPixel = 0;
+
+ // create close image
+ closeNormal = new Image(display, data);
+ closeNormal.setBackground(transparent);
+ GC gc = new GC(closeNormal);
+ gc.setBackground(background);
+ gc.fillPolygon(shape);
+ gc.setForeground(border);
+ gc.drawPolygon(shape);
+ gc.dispose();
+
+ // create hovered close image
+ closeHover = new Image(display, data);
+ closeHover.setBackground(transparent);
+ gc = new GC(closeHover);
+ gc.setBackground(backgroundHot);
+ gc.fillPolygon(shape);
+ gc.setForeground(border);
+ gc.drawPolygon(shape);
+ gc.dispose();
+
+ backgroundHot.dispose();
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ shell = parent.getShell();
+
+ // appearence composite
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = layout.marginHeight = 0;
+ layout.verticalSpacing = 0;
+ container.setLayout(layout);
+ container.addListener(SWT.Dispose, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ dispose();
+ }
+ });
+
+ // top toolbar composite
+ ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
+ tbm.createControl(container);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ gd.grabExcessHorizontalSpace = true;
+ tbm.getControl().setLayoutData(gd);
+
+ // horizontal separator
+ Label separator = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.heightHint = 1;
+ separator.setLayoutData(gd);
+
+ // create external composite
+ createExternalControl(container);
+
+ // create close button image
+ createImages();
+
+ // add close button
+ tbm.add(new ContributionItem() {
+ @Override
+ public void fill(ToolBar parent, int index) {
+ final ToolItem item = new ToolItem(parent, SWT.PUSH);
+ item.setImage(closeNormal);
+ item.setHotImage(closeHover);
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ TrayDialog dialog = (TrayDialog) shell.getData();
+ dialog.closeTray();
+ shell.setFocus();
+ }
+ });
+ }
+ });
+ tbm.update(true);
+
+ return container;
+ }
+
+ public abstract void createExternalControl(Composite parent);
+
+ protected void dispose() {
+ if (closeNormal != null) {
+ closeNormal.dispose();
+ }
+ if (closeHover != null) {
+ closeHover.dispose();
+ }
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/swt/PictureLabel.java b/org.tizen.common/src/org/tizen/common/swt/PictureLabel.java
new file mode 100644
index 000000000..1cda75f87
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/swt/PictureLabel.java
@@ -0,0 +1,206 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.swt;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Reference to http://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm
+ *
+ * @author Jihoon Song {@literal <jihoon80.song@samsung.com>} (S-Core)
+ */
+public class PictureLabel extends Canvas {
+ private Image image;
+ private String text;
+ private boolean selected;
+ private List<ImageClickedListener> imageClickedListeners = new ArrayList<ImageClickedListener>();
+
+ public PictureLabel(Composite parent, int style) {
+ super(parent, style);
+
+ // default background color
+ setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
+
+ // add listener
+ addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {}
+ });
+ addPaintListener(new PaintListener() {
+ public void paintControl(PaintEvent e) {
+ PictureLabel.this.paintControl(e);
+ }
+ });
+ addMouseListener(new MouseAdapter() {
+ public void mouseDown(MouseEvent event) {
+ if (event.button == java.awt.event.MouseEvent.BUTTON1) {
+ PictureLabel.this.mouseDown(event);
+ }
+ }
+ });
+ addMouseTrackListener(new MouseTrackAdapter() {
+ public void mouseEnter(MouseEvent event) {
+ PictureLabel.this.mouseEnter(event);
+ }
+ public void mouseExit(MouseEvent event) {
+ PictureLabel.this.mouseExit(event);
+ }
+ });
+
+ setSelection(false);
+ }
+
+ public void mouseDown(MouseEvent event) {
+ ImageClickedEvent e = new ImageClickedEvent(this, event.x, event.y);
+ setSelection(!selected);
+ for (ImageClickedListener listener : imageClickedListeners) {
+ listener.imageClicked(e);
+ }
+ }
+
+ protected void mouseEnter(MouseEvent event) {
+ setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
+ }
+
+ protected void mouseExit(MouseEvent event) {
+ setBackground(getDisplay().getSystemColor(selected ? SWT.COLOR_GRAY : SWT.COLOR_WHITE));
+ }
+
+ public void setSelection(boolean selected) {
+ this.selected = selected;
+ setBackground(getDisplay().getSystemColor(selected ? SWT.COLOR_GRAY : SWT.COLOR_WHITE));
+ }
+
+ public void addImageClickedListener(ImageClickedListener listener) {
+ imageClickedListeners.add(listener);
+ }
+
+ public void removeImageClickedListener(ImageClickedListener listener) {
+ imageClickedListeners.remove(listener);
+ }
+
+ void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+ int x = 1;
+ int y = 1;
+ int clientAreaWidth = getClientArea().width;
+ int textWidth = gc.stringExtent(text).x;
+ int imageWidth = image.getBounds().width;
+ int imageHeght = image.getBounds().height;
+ int maxWidth = Math.max(Math.max(imageWidth, imageWidth), clientAreaWidth);
+
+ if ((image != null) & (text != null)) {
+ x = 1 + (maxWidth - imageWidth) / 2;
+ gc.drawImage(image, x, y);
+ y = y + imageHeght + 5;
+ x = 1 + (maxWidth - textWidth) / 2;
+ gc.drawText(text, x, y);
+ } else if (image != null) {
+ x = 1 + (maxWidth - imageWidth) / 2;
+ gc.drawImage(image, x, 1);
+ } else if (text != null) {
+ x = 1 + (maxWidth - textWidth) / 2;
+ gc.drawText(text, x, 1);
+ }
+ gc.dispose();
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ public void setImage(Image image) {
+ this.image = image;
+ redraw();
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ redraw();
+ }
+
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ int width = 0;
+ int height = 0;
+ if (image != null && text != null) {
+ GC gc = new GC(this);
+ int textWidth = gc.stringExtent(text).x;
+ int textHeight = gc.stringExtent(text).y;
+ int imageWidth = image.getBounds().width;
+ int imageHeight = image.getBounds().height;
+ gc.dispose();
+ if (imageWidth >= textWidth)
+ width = imageWidth + 2;
+ else
+ width = textWidth + 2;
+ height = textHeight + imageHeight + 7;
+ } else if (image != null) {
+ Rectangle bounds = image.getBounds();
+ width = bounds.width + 2;
+ height = bounds.height + 2;
+ } else if (text != null) {
+ GC gc = new GC(this);
+ Point extent = gc.stringExtent(text);
+ gc.dispose();
+ width = extent.x + 2;
+ height = extent.y + 2;
+ }
+ if (wHint != -1)
+ width = wHint;
+ if (hHint != -1)
+ height = hHint;
+
+ return new Point(width + 2, height + 2);
+ }
+
+ public boolean isSelected() {
+ return selected;
+ }
+}
+
+class ImageClickedEvent extends java.util.EventObject {
+ public int x, y;
+
+ public ImageClickedEvent(Object source, int x, int y) {
+ super(source);
+
+ this.x = x;
+ this.y = y;
+ }
+}
+
+interface ImageClickedListener extends java.util.EventListener {
+ public void imageClicked(ImageClickedEvent event);
+}
diff --git a/org.tizen.common/src/org/tizen/common/swt/TrayWizardPage.java b/org.tizen.common/src/org/tizen/common/swt/TrayWizardPage.java
new file mode 100644
index 000000000..c5c328c9f
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/swt/TrayWizardPage.java
@@ -0,0 +1,108 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.swt;
+
+import org.eclipse.jface.dialogs.DialogTray;
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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;
+
+
+/**
+ * a extended WizardPage class using ClosableTray class
+ *
+ * @author Jihoon Song {@literal <jihoon80.song@samsung.com>} (S-Core)
+ */
+public abstract class TrayWizardPage extends WizardPage {
+
+ protected TrayWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ protected TrayWizardPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ /**
+ * a extended WizardPage class using ClosableTray class
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param buttonText the new text of Button control
+ * @param tray the ClosableTray to show in dialog
+ * @return <b>Control</b> - return created Button control
+ */
+ protected Control createTrayButtonControl(Composite parent, String buttonText, final ClosableTray tray) {
+ Composite child = new Composite(parent, SWT.NONE);
+ child.setLayout(new GridLayout());
+ child.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+
+ Button expandButton = new Button(child, SWT.NONE);
+ expandButton.setText(buttonText);
+ expandButton.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ openClosableTray(tray);
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ return expandButton;
+ }
+
+ /**
+ * open a tray using ClosableTray class. If another tray was opened, open new tray after close the opened tray automatically
+ *
+ * @param tray the ClosableTray to show in dialog
+ * @return <b>Control</b> - return created Button control
+ */
+ protected void openClosableTray(ClosableTray tray) {
+ IWizardContainer wc = getContainer();
+ if (wc instanceof TrayDialog) {
+ TrayDialog wd = (TrayDialog) wc;
+
+ // alreay opened
+ DialogTray currentTray = wd.getTray();
+ if (! (currentTray instanceof ClosableTray)) {
+ if (currentTray != null) {
+ wd.closeTray();
+ }
+ wd.openTray(tray);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/util/BrowserWrapper.java b/org.tizen.common/src/org/tizen/common/util/BrowserWrapper.java
new file mode 100644
index 000000000..87c370476
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/BrowserWrapper.java
@@ -0,0 +1,76 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.util;
+
+import java.io.File;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Adam Kotwasinski, Samsung Electronics, Inc.
+ */
+public class BrowserWrapper {
+ private Browser browser;
+
+ public BrowserWrapper(Composite composite) {
+ browser = new Browser(composite, SWT.NONE);
+ }
+
+ public BrowserWrapper(Composite composite, GridData data) {
+ this(composite, data, SWT.NONE);
+ }
+
+ public BrowserWrapper(Composite composite, GridData data, int style) {
+ browser = new Browser(composite, style);
+ browser.setLayoutData(data);
+ }
+
+ public void setInput(final File f) {
+ browser.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (!browser.isDisposed()) {
+ browser.setUrl(f.getAbsolutePath());
+ }
+ }
+ } );
+ }
+
+ public void setText(String html) {
+ browser.setText(html);
+ }
+
+ public void setFocus() {
+ browser.setFocus();
+ }
+
+ public Browser getBrowser() {
+ return browser;
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/ControlFileConfig.java b/org.tizen.common/src/org/tizen/common/util/ControlFileConfig.java
new file mode 100644
index 000000000..c0cb6f545
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/ControlFileConfig.java
@@ -0,0 +1,87 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.util;
+
+import java.io.File;
+import java.util.Properties;
+
+
+public class ControlFileConfig {
+ private String path;
+ private boolean isExist;
+ private Properties props;
+
+ public ControlFileConfig(String path){
+ this.path = path;
+ if(HostUtil.exists(path)){
+ this.isExist = true;
+ this.props = PropertyUtil.loadProperties(path);
+ }else{
+ this.props = new Properties();
+ }
+ }
+
+ public String getPath(){
+ return this.path;
+ }
+
+ public boolean exists(){
+ return isExist;
+ }
+
+ public String getValue(String key){
+ return props.getProperty(key);
+ }
+
+ public String getValue(String key, String defaultValue){
+ return props.getProperty(key, defaultValue);
+ }
+
+ public boolean getValue(String key, boolean defaultValue){
+ String value = props.getProperty(key, Boolean.toString(defaultValue));
+ return Boolean.parseBoolean(value);
+ }
+
+ public void setValue(String key, String value){
+ props.setProperty(key, value);
+ }
+
+ public void setValue(String key, boolean value){
+ props.setProperty(key, Boolean.toString(value));
+ }
+
+ public boolean store(){
+ File folder = new File(this.path).getParentFile();
+ if(folder==null||!folder.exists())
+ folder.mkdirs();
+
+ this.isExist = PropertyUtil.storeProperties(path, props);
+ return this.isExist;
+ }
+
+
+
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/util/DialogUtil.java b/org.tizen.common/src/org/tizen/common/util/DialogUtil.java
new file mode 100644
index 000000000..3335ba125
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/DialogUtil.java
@@ -0,0 +1,120 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.common.util;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+public abstract class DialogUtil {
+ /**
+ * Open message dialog and show a message
+ *
+ * @param message
+ * a message that is shown in message dialog.
+ * @return none
+ * @exception none
+ */
+ public static void openMessageDialog(String message) {
+ openMessageDialog(new Shell(), message);
+ }
+
+ public static void openMessageDialog(final Shell shell, final String message) {
+ openMessageDialog(shell, "Info", message);
+ }
+
+ public static void openMessageDialog(final Shell shell, final String title, final String message) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ MessageBox dialog = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
+ dialog.setText(title);
+ dialog.setMessage(message);
+ dialog.open();
+ }
+ });
+ }
+
+ public static void openProxyDialog(final String text, String message) {
+ final String msg = message;
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ MessageBox dialog = new MessageBox(new Shell(), SWT.ERROR | SWT.ICON_INFORMATION);
+ dialog.setText(text);
+ dialog.setMessage(msg);
+ dialog.open();
+ }
+ });
+ }
+
+ /**
+ * Open error message dialog and show a error message
+ *
+ * @param message
+ * a error message that is shown in error message dialog.
+ * @return none
+ * @exception none
+ */
+ public static void openErrorDialog(String message) {
+ openErrorDialog(new Shell(), "Error", message);
+ }
+
+ public static void openErrorDialog(final Shell shell, final String title, final String message) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ MessageBox dialog = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
+ dialog.setText(title);
+ dialog.setMessage(message);
+ dialog.open();
+ }
+ });
+ }
+
+ /**
+ * Open question dialog and return the selection of user.
+ *
+ * @param message
+ * a message that is shown in question dialog.
+ * @return int if user select 'yes', return SWT.YES. if user select 'no',
+ * return SWT.NO.
+ */
+ protected static int retValue = 0;
+ private final static Object lockQuestion = new Object();
+ public static int openQuestionDialog(String message) {
+ synchronized (lockQuestion) {
+ final String msg = message;
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ MessageBox dialog = new MessageBox(new Shell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION);
+ dialog.setMessage(msg);
+ retValue = dialog.open();
+ }
+ });
+
+ return retValue;
+ }
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/FileUtil.java b/org.tizen.common/src/org/tizen/common/util/FileUtil.java
new file mode 100644
index 000000000..d778247af
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/FileUtil.java
@@ -0,0 +1,187 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.URI;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileSystem;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+
+/**
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+public class FileUtil {
+ public static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
+
+ private static final int BUFFER_SIZE = 8192;
+
+ /**
+ * write text into given file
+ */
+ public static void writeTextFile(File file, String text, String encoding) throws IOException {
+ BufferedWriter out = null;
+
+ if (encoding == null) { // if encoding is not set then use default encoding
+ encoding = System.getProperty("file.encoding");
+ }
+
+ try {
+ out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), encoding), BUFFER_SIZE);
+ out.write(text.toCharArray(), 0, text.length());
+ out.flush();
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ }
+ }
+
+ /**
+ * read text from given file
+ */
+ public static String readTextFile(File file, String encoding) throws IOException {
+ StringBuilder text = new StringBuilder();
+ char[] buffer = new char[BUFFER_SIZE];
+ BufferedReader in = null;
+
+ if (encoding == null) { // if encoding is not set then use default encoding
+ encoding = System.getProperty("file.encoding");
+ }
+
+ try {
+ in = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding), BUFFER_SIZE);
+ int nRead = 0;
+ while ((nRead = in.read(buffer, 0, buffer.length)) > 0) {
+ text.append(buffer, 0, nRead);
+ }
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+
+ return text.toString();
+ }
+
+ /**
+ * return file extension from given full file name
+ *
+ * @author Jihoon Song {@literal <jihoon80.song@samsung.com>} (S-Core)
+ */
+ public static String getFileExtension(String fullName) {
+ if (fullName == null) {
+ return null;
+ }
+
+ int k = fullName.lastIndexOf(".");
+
+ return (k != -1) ? fullName.substring(k + 1, fullName.length()) : null;
+ }
+
+ /**
+ * return file name without file extension from given full file name
+ *
+ * @author Jihoon Song {@literal <jihoon80.song@samsung.com>} (S-Core)
+ */
+ public static String getFileNameWithoutExtension(String fullName) {
+ if (fullName == null) {
+ return null;
+ }
+
+ int k = fullName.lastIndexOf(".");
+
+ return (k != -1) ? fullName.substring(0, k) : fullName;
+ }
+
+ /**
+ * delete file and its children.
+ *
+ * @author Jihoon Song {@literal <jihoon80.song@samsung.com>} (S-Core)
+ */
+ public static boolean recursiveDelete(File file) {
+ boolean result = true;
+
+ if (file == null) {
+ return false;
+ }
+
+ // delete child
+ if (file.isDirectory()) {
+ File[] children = file.listFiles();
+ for (File child : children) {
+ result &= recursiveDelete(child);
+ }
+ }
+
+ // delete self
+ result &= file.delete();
+
+ return result;
+ }
+
+ /**
+ * copy file or directory using Eclipse File System
+ *
+ * @param source The source URI of the copy.
+ * @param destination The destination URI of the copy.
+ * @param options bit-wise or of option flag constants ({@link EFS#OVERWRITE} or {@link EFS#SHALLOW}).
+ * @param monitor a progress monitor, or <code>null</code> if progress reporting and cancellation are not desired
+ *
+ * @author Jihoon Song {@literal <jihoon80.song@samsung.com>} (S-Core)
+ */
+ public static void copyUsingEFS(URI source, URI destination, int options, IProgressMonitor monitor) throws CoreException {
+ IFileSystem fileSystem = EFS.getLocalFileSystem();
+ fileSystem.getStore(source).copy(fileSystem.getStore(destination), options, monitor);
+ }
+
+ /**
+ * redirect input stream to output stream
+ */
+ public static void redirectStream(InputStream is, OutputStream os) throws IOException {
+ byte[] buffer = new byte[BUFFER_SIZE];
+ BufferedInputStream bin = new BufferedInputStream(is, BUFFER_SIZE);
+ BufferedOutputStream bout = new BufferedOutputStream(os, BUFFER_SIZE);
+ int n = 0;
+ while ((n = bin.read(buffer, 0, buffer.length)) >= 0) {
+ bout.write(buffer, 0, n);
+ }
+ bout.flush();
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/HostUtil.java b/org.tizen.common/src/org/tizen/common/util/HostUtil.java
new file mode 100644
index 000000000..4e2330fc6
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/HostUtil.java
@@ -0,0 +1,330 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.nio.channels.FileChannel;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+
+public abstract class HostUtil{
+
+// public static final String USER = System.getenv("USER");
+// public static final String USER_HOME = System.getenv("HOME");
+ public static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
+ public static final String FILE_SEPARATOR = System.getProperty("file.separator"); //$NON-NLS-1$
+
+ private static final String PROC_PATH = "/proc"; //$NON-NLS-1$
+ private static final String SHELL_COMMAND_LINUX= "/bin/sh"; //$NON-NLS-1$
+ private static final String SHELL_COMMAND_WINDOW= "cmd"; //$NON-NLS-1$
+
+ public static boolean hasProcFile(String pid) {
+ if(pid==null||pid.equals("")) //$NON-NLS-1$
+ return false;
+
+ String pidFile = PROC_PATH+Path.SEPARATOR+pid;
+ return exists(pidFile);
+ }
+ public static boolean isMenuReady(String pid) {
+ if(pid==null||pid.equals("")) //$NON-NLS-1$
+ return false;
+
+ String pidFile = PROC_PATH+Path.SEPARATOR+pid;
+ return exists(pidFile);
+ }
+
+
+ public static String getContents(String filePath) {
+ BufferedReader input = null;
+ StringBuilder contents = new StringBuilder();
+ String line = null;
+
+ try {
+ input = new BufferedReader(new FileReader(filePath));
+ while((line=input.readLine())!=null){
+ contents.append(line);
+ contents.append(LINE_SEPARATOR);
+ }
+ }catch(Exception e) {
+// e.printStackTrace();
+ return null;
+ }finally{
+ if(input!=null)
+ try {
+ input.close();
+ } catch (IOException e) {
+ }
+ }
+
+ return contents.toString().trim();
+ }
+
+ public static boolean isReachable(String ip) {
+ try {
+ return InetAddress.getByName(ip).isReachable(100);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ public static boolean exists(String path) {
+ if(path==null||path.equals("")) //$NON-NLS-1$
+ return false;
+
+ IPath ipath = new Path(path);
+ File file = ipath.toFile();
+
+ if(file!=null&&file.exists())
+ return true;
+ else
+ return false;
+ }
+
+ public static boolean execute(String command){
+ Process proc = null;
+ Runtime runtime = Runtime.getRuntime();
+
+ String[] fullCommand = getCommand(command);
+
+ int i = 0;
+ try {
+ proc= runtime.exec(fullCommand);
+ i = proc.waitFor();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ } finally{
+ System.out.println("HostUtil execute - exit value : " + i);
+ if(proc!=null)
+ proc.destroy();
+ }
+
+ return i==0;
+ }
+
+ public static boolean batchExecute(String command)
+ {
+ String[] fullCommand = getCommand(command);
+
+ Runtime run = Runtime.getRuntime();
+ Process p = null;
+
+ try{
+ p = run.exec(fullCommand);
+ StreamGobbler gb1 = new StreamGobbler(p.getInputStream());
+ StreamGobbler gb2 = new StreamGobbler(p.getErrorStream());
+ gb1.start();
+ gb2.start();
+ }catch(Exception e){
+ e.printStackTrace();
+ return false;
+ }finally{
+ }
+ return true;
+ }
+
+ /**
+ * Don't need for emultor install registration.
+ * using java.lang.Runtime.exec(String[] cmdarray, String[] envp, File dir)
+ * @param command - array containing the command to call and its arguments.
+ * @param envp - array of strings, each element of which has environment variable settings in format name=value.
+ * @param dir - Emultor path.
+ * @return success true, failed false.
+ */
+ public static boolean batchExecute(String command, String[] envp, File dir)
+ {
+ String[] fullCommand = getCommand(command);
+
+ Runtime run = Runtime.getRuntime();
+ Process p = null;
+
+ StreamGobbler gb1 = null;
+ StreamGobbler gb2 = null;
+ try{
+ p = run.exec(fullCommand, envp, dir);
+ gb1 = new StreamGobbler(p.getInputStream());
+ gb2 = new StreamGobbler(p.getErrorStream());
+ gb1.start();
+ gb2.start();
+ }catch(Exception e){
+ e.printStackTrace();
+ return false;
+ }finally{
+ System.out.println(gb1.getResult());
+ System.out.println(gb2.getResult());
+ }
+ return true;
+ }
+
+ public static String returnExecute(String command, String workingDir) {
+ BufferedReader input = null;
+ StringBuilder contents = new StringBuilder();
+ String line = null;
+
+ Process proc = null;
+
+ String[] fullCommand = getCommand(command);
+
+ try {
+ ProcessBuilder pb = new ProcessBuilder();
+ pb.command(fullCommand);
+ if(workingDir != null) {
+ pb.directory(new File(workingDir));
+ }
+ proc = pb.start();
+ input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ while((line=input.readLine())!=null){
+ contents.append(line);
+ contents.append(LINE_SEPARATOR);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ } finally{
+ if(proc!=null)
+ proc.destroy();
+ if(input!=null)
+ try {
+ input.close();
+ } catch (IOException e) {
+ }
+ }
+
+ return contents.toString().trim();
+
+ }
+ public static String returnExecute(String command){
+
+ return returnExecute(command, null);
+ }
+
+ public static String[] getCommand(String command){
+ if(isLinux()){
+ return new String[]{SHELL_COMMAND_LINUX,"-c",command}; //$NON-NLS-1$
+ }else{
+ return new String[]{SHELL_COMMAND_WINDOW,"/c",command}; //$NON-NLS-1$
+ }
+ }
+
+
+ public static boolean createFile(String path, String contents) {
+ BufferedWriter output = null;
+ try {
+ File file = new File(path);
+
+ File folder = file.getParentFile();
+ if(folder!=null)
+ folder.mkdirs();
+
+ file.createNewFile();
+
+ output = new BufferedWriter(new FileWriter(file));
+ output.write(contents);
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }finally{
+ if(output!=null)
+ try {
+ output.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ public static boolean removeFile(String path) {
+ File file = new File(path);
+ if (!file.exists())
+ return false;
+ return file.delete();
+ }
+
+ public static boolean copyFile(String src, String des) throws Exception {
+ boolean canExecute = false;
+ File srcFile=new File(src);
+ File desFile=null;
+ FileInputStream fis=null;
+ FileOutputStream fos=null;
+ FileChannel fcin=null;
+ FileChannel fcout=null;
+
+ canExecute = srcFile.canExecute();
+
+ desFile= new File(des);
+ File paths = new File(desFile.getAbsolutePath().substring(0, desFile.getAbsolutePath().lastIndexOf("/"))); //$NON-NLS-1$
+ if (!paths.exists()) {
+ paths.mkdirs();
+ }
+
+ try {
+ fis= new FileInputStream(srcFile);
+ fos= new FileOutputStream(desFile);
+ fcin= fis.getChannel();
+ fcout= fos.getChannel();
+
+ long size= fcin.size();
+ fcin.transferTo(0, size, fcout);
+ desFile.setExecutable(canExecute);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ throw e;
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw e;
+ }finally{
+ try {
+ fcout.close();
+ fcin.close();
+ fos.close();
+ fis.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean isLinux(){
+ return Platform.getOS().equals(Platform.OS_LINUX);
+ }
+}
+
+
diff --git a/org.tizen.common/src/org/tizen/common/util/IOUtil.java b/org.tizen.common/src/org/tizen/common/util/IOUtil.java
new file mode 100644
index 000000000..0dce62006
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/IOUtil.java
@@ -0,0 +1,48 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * IOUtil
+ * @author Hyeongseok Heo {@literal<hyeongseok.heo@samsung.com>}
+ * @since Dec 9, 2011
+ */
+public class IOUtil {
+
+ public static void close(Closeable closable) {
+ if( null != closable) {
+ try {
+ closable.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/ImageUtils.java b/org.tizen.common/src/org/tizen/common/util/ImageUtils.java
new file mode 100644
index 000000000..c22fd7828
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/ImageUtils.java
@@ -0,0 +1,82 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+
+
+public class ImageUtils {
+ // get ImageDescriptor from Plugin ID (ID -> ImageDescriptor)
+ public static ImageDescriptor getImageDescriptor(String pluginID, String filePath) {
+ URL url = Platform.getBundle(pluginID).getEntry(filePath);
+ return ImageDescriptor.createFromURL(url);
+ }
+
+ // get ImageDescriptor from Activator Plugin (Activator -> ImageDescriptor)
+ public static ImageDescriptor getImageDescriptor(Plugin plugin, String filePath) {
+ URL url = plugin.getBundle().getEntry(filePath); // $NON-NLS-1$
+ return ImageDescriptor.createFromURL(url);
+ }
+
+ // get Image from ImageDescriptor (ImageDescriptor -> Image)
+ public static Image getImage(ImageDescriptor descriptor) {
+ return (descriptor != null) ? descriptor.createImage() : null;
+ }
+
+ // get ImageData from ImageDescriptor (ImageDescriptor -> ImageData)
+ public static ImageData getImageData(ImageDescriptor descriptor) {
+ return (descriptor != null) ? descriptor.getImageData() : null;
+ }
+
+ // get Image from Activator Plugin (Activator -> ImageDescriptor -> Image)
+ public static Image getImage(Plugin plugin, String filePath) {
+ ImageDescriptor descriptor = getImageDescriptor(plugin, filePath);
+ return getImage(descriptor);
+ }
+
+ // get ImageData from Activator Plugin (Activator -> ImageDescriptor -> ImageData)
+ public static ImageData getImageData(Plugin plugin, String filePath) {
+ ImageDescriptor descriptor = getImageDescriptor(plugin, filePath);
+ return getImageData(descriptor);
+ }
+
+ // get Image from Plugin ID (ID -> ImageDescriptor -> Image)
+ public static Image getImage(String pluginID, String filePath) {
+ ImageDescriptor descriptor = getImageDescriptor(pluginID, filePath);
+ return getImage(descriptor);
+ }
+
+ // get Image from Plugin ID (ID -> ImageDescriptor -> ImageData)
+ public static ImageData getImageData(String pluginID, String filePath) {
+ ImageDescriptor descriptor = getImageDescriptor(pluginID, filePath);
+ return getImageData(descriptor);
+ }
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/util/LocalPortChecker.java b/org.tizen.common/src/org/tizen/common/util/LocalPortChecker.java
new file mode 100644
index 000000000..68c3337ed
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/LocalPortChecker.java
@@ -0,0 +1,82 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+
+/**
+ * @author Joogwan Kim {@literal <joogwan.kim@samsung.com>} (S-Core)
+ * <ul>
+ * <li> initial creation
+ * <li> added isPortAvailable method.
+ * </ul>
+ * @author Gyeongseok Seo {@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * <ul>
+ * <li> added getAvailableLocalPort method.
+ * </ul>
+ */
+public class LocalPortChecker {
+ public static boolean isPortAvailable(int port) {
+ if ((port < 0) && (port > 65535))
+ return false;
+
+ ServerSocket socket = null;
+ try {
+ socket = new ServerSocket(port);
+ return true;
+ } catch (IOException e) {
+ return false;
+ } finally {
+ if (socket != null) {
+ try {
+ socket.close();
+ } catch (IOException e) {
+ // do nothing
+ }
+ }
+ }
+ }
+
+ public static int getAvailableLocalPort(int inc,int portBase) {
+ int port = portBase;
+ if (isPortAvailable(port)) {
+ return port;
+ }
+
+ if ( (port+inc) > 65535) {
+ return -1;
+ }
+
+ while ((port < 65535) && !isPortAvailable(port)) {
+ port += inc;
+ }
+
+ if (isPortAvailable(port))
+ return port;
+ else
+ return -1;
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/NotificationType.java b/org.tizen.common/src/org/tizen/common/util/NotificationType.java
new file mode 100644
index 000000000..37a6a9009
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/NotificationType.java
@@ -0,0 +1,56 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import org.eclipse.swt.graphics.Image;
+import org.tizen.common.cache.ImageCache;
+
+
+public enum NotificationType {
+ ERROR(ImageCache.getImage("error.png")),
+ DELETE(ImageCache.getImage("delete.png")),
+ WARN(ImageCache.getImage("warn.png")),
+ SUCCESS(ImageCache.getImage("ok.png")),
+ INFO(ImageCache.getImage("info.png")),
+ LIBRARY(ImageCache.getImage("library.png")),
+ HINT(ImageCache.getImage("hint.png")),
+ PRINTED(ImageCache.getImage("printer.png")),
+ CONNECTION_TERMINATED(ImageCache.getImage("terminated.png")),
+ CONNECTION_FAILED(ImageCache.getImage("connecting.png")),
+ CONNECTED(ImageCache.getImage("connected.png")),
+ DISCONNECTED(ImageCache.getImage("disconnected.png")),
+ TRANSACTION_OK(ImageCache.getImage("ok.png")),
+ TRANSACTION_FAIL(ImageCache.getImage("error.png"));
+
+ private Image _image;
+
+ private NotificationType(Image img) {
+ _image = img;
+ }
+
+ public Image getImage() {
+ return _image;
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/NotifierDialog.java b/org.tizen.common/src/org/tizen/common/util/NotifierDialog.java
new file mode 100644
index 000000000..f76858cf7
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/NotifierDialog.java
@@ -0,0 +1,316 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.common.cache.ColorCache;
+import org.tizen.common.cache.FontCache;
+
+
+public class NotifierDialog {
+
+ // how long the the tray popup is displayed after fading in (in milliseconds)
+ private static final int DISPLAY_TIME = 4500;
+ // how long each tick is when fading in (in ms)
+ private static final int FADE_TIMER = 50;
+ // how long each tick is when fading out (in ms)
+ private static final int FADE_IN_STEP = 30;
+ // how many tick steps we use when fading out
+ private static final int FADE_OUT_STEP = 8;
+
+ // how high the alpha value is when we have finished fading in
+ private static final int FINAL_ALPHA = 225;
+
+ // title foreground color
+ private static Color _titleFgColor = ColorCache.getColor(40, 73, 97);
+ // text foreground color
+ private static Color _fgColor = _titleFgColor;
+
+ // shell gradient background color - top
+ private static Color _bgFgGradient = ColorCache.getColor(226, 239, 249);
+ // shell gradient background color - bottom
+ private static Color _bgBgGradient = ColorCache.getColor(177, 211, 243);
+ // shell border color
+ private static Color _borderColor = ColorCache.getColor(40, 73, 97);
+
+ // contains list of all active popup shells
+ private static List<Shell> _activeShells = new ArrayList<Shell>();
+
+ // image used when drawing
+ private static Image _oldImage;
+
+ private static Shell _shell;
+
+ /**
+ * Creates and shows a notification dialog with a specific title, message and a
+ *
+ * @param title
+ * @param message
+ * @param type
+ */
+ public static void notify(String title, String message, NotificationType type) {
+ _shell = new Shell(Display.getDefault().getActiveShell(), SWT.NO_FOCUS | SWT.NO_TRIM);
+ _shell.setLayout(new FillLayout());
+ _shell.setForeground(_fgColor);
+ _shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
+ _shell.addListener(SWT.Dispose, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ _activeShells.remove(_shell);
+ }
+ });
+
+ final Composite inner = new Composite(_shell, SWT.NONE);
+
+ GridLayout gl = new GridLayout(2, false);
+ gl.marginLeft = 5;
+ gl.marginTop = 0;
+ gl.marginRight = 5;
+ gl.marginBottom = 5;
+
+ inner.setLayout(gl);
+ _shell.addListener(SWT.Resize, new Listener() {
+
+ @Override
+ public void handleEvent(Event e) {
+ try {
+ // get the size of the drawing area
+ Rectangle rect = _shell.getClientArea();
+ // create a new image with that size
+ Image newImage = new Image(Display.getDefault(), Math.max(1, rect.width), rect.height);
+ // create a GC object we can use to draw with
+ GC gc = new GC(newImage);
+
+ // fill background
+ gc.setForeground(_bgFgGradient);
+ gc.setBackground(_bgBgGradient);
+ gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, true);
+
+ // draw shell edge
+ gc.setLineWidth(2);
+ gc.setForeground(_borderColor);
+ gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2);
+ // remember to dipose the GC object!
+ gc.dispose();
+
+ // now set the background image on the shell
+ _shell.setBackgroundImage(newImage);
+
+ // remember/dispose old used iamge
+ if (_oldImage != null) {
+ _oldImage.dispose();
+ }
+ _oldImage = newImage;
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+ });
+
+ GC gc = new GC(_shell);
+
+ String lines[] = message.split("\n");
+ Point longest = null;
+ int typicalHeight = gc.stringExtent("X").y;
+
+ for (String line : lines) {
+ Point extent = gc.stringExtent(line);
+ if (longest == null) {
+ longest = extent;
+ continue;
+ }
+
+ if (extent.x > longest.x) {
+ longest = extent;
+ }
+ }
+ gc.dispose();
+
+ int minHeight = typicalHeight * lines.length;
+
+ CLabel imgLabel = new CLabel(inner, SWT.NONE);
+ imgLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
+ imgLabel.setImage(type.getImage());
+
+ CLabel titleLabel = new CLabel(inner, SWT.NONE);
+ titleLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
+ titleLabel.setText(title);
+ titleLabel.setForeground(_titleFgColor);
+ Font f = titleLabel.getFont();
+ FontData fd = f.getFontData()[0];
+ fd.setStyle(SWT.BOLD);
+ fd.height = 11;
+ titleLabel.setFont(FontCache.getFont(fd));
+
+ Label text = new Label(inner, SWT.WRAP);
+ Font tf = text.getFont();
+ FontData tfd = tf.getFontData()[0];
+ tfd.setStyle(SWT.BOLD);
+ tfd.height = 8;
+ text.setFont(FontCache.getFont(tfd));
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 2;
+ text.setLayoutData(gd);
+ text.setForeground(_fgColor);
+ text.setText(message);
+
+ minHeight = 100;
+
+ _shell.setSize(350, minHeight);
+
+ if (Display.getDefault().getActiveShell() == null || Display.getDefault().getActiveShell().getMonitor() == null) { return; }
+
+ Rectangle clientArea = Display.getDefault().getActiveShell().getMonitor().getClientArea();
+
+ int startX = clientArea.x + clientArea.width - 352;
+ int startY = clientArea.y + clientArea.height - 102;
+
+ // move other shells up
+ if (!_activeShells.isEmpty()) {
+ List<Shell> modifiable = new ArrayList<Shell>(_activeShells);
+ Collections.reverse(modifiable);
+ for (Shell shell : modifiable) {
+ Point curLoc = shell.getLocation();
+ shell.setLocation(curLoc.x, curLoc.y - 100);
+ if (curLoc.y - 100 < 0) {
+ _activeShells.remove(shell);
+ shell.dispose();
+ }
+ }
+ }
+
+ _shell.setLocation(startX, startY);
+ _shell.setAlpha(0);
+ _shell.setVisible(true);
+
+ _activeShells.add(_shell);
+
+ fadeIn(_shell);
+ }
+
+ private static void fadeIn(final Shell _shell) {
+ Runnable run = new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ if (_shell == null || _shell.isDisposed()) { return; }
+
+ int cur = _shell.getAlpha();
+ cur += FADE_IN_STEP;
+
+ if (cur > FINAL_ALPHA) {
+ _shell.setAlpha(FINAL_ALPHA);
+ startTimer(_shell);
+ return;
+ }
+
+ _shell.setAlpha(cur);
+ Display.getDefault().timerExec(FADE_TIMER, this);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ };
+ Display.getDefault().timerExec(FADE_TIMER, run);
+ }
+
+ private static void startTimer(final Shell _shell) {
+ Runnable run = new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ if (_shell == null || _shell.isDisposed()) { return; }
+
+ fadeOut(_shell);
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ };
+ Display.getDefault().timerExec(DISPLAY_TIME, run);
+
+ }
+
+ private static void fadeOut(final Shell _shell) {
+ final Runnable run = new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ if (_shell == null || _shell.isDisposed()) { return; }
+
+ int cur = _shell.getAlpha();
+ cur -= FADE_OUT_STEP;
+
+ if (cur <= 0) {
+ _shell.setAlpha(0);
+ if (_oldImage != null) {
+ _oldImage.dispose();
+ }
+ _shell.dispose();
+ _activeShells.remove(_shell);
+ return;
+ }
+
+ _shell.setAlpha(cur);
+
+ Display.getDefault().timerExec(FADE_TIMER, this);
+
+ } catch (Exception err) {
+ err.printStackTrace();
+ }
+ }
+
+ };
+ Display.getDefault().timerExec(FADE_TIMER, run);
+
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/OSChecker.java b/org.tizen.common/src/org/tizen/common/util/OSChecker.java
new file mode 100644
index 000000000..3331a46ac
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/OSChecker.java
@@ -0,0 +1,160 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+/**
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ * <ul>
+ * <li> initial creation
+ * <li> thanks to Yoon Kyung Koo
+ * </ul>
+ */
+public class OSChecker {
+ //
+ // OS ID constants
+ //
+ public final static int WINDOWS = 0x0001;
+ public final static int MAC = 0x0002;
+ public final static int LINUX = 0x0004;
+ public final static int UNIX = 0x0008;
+ public final static int AIX = 0x0010;
+ public final static int SOLARIS = 0x0020;
+
+ //
+ // Vendor constants
+ //
+ public final static int SUN = 0x0001;
+ public final static int MICROSOFT = 0x0002;
+ public final static int APPLE = 0x0004;
+ public final static int IBM = 0x0008;
+
+ static int osID = 0;
+ static int vendorID = 0;
+
+ /* static initializer */
+ static {
+ /*
+ * OS : arch name version
+ * solaris 7 : sparc Solaris 2.x
+ * redhat 6.2(black) : x86 Linux 2.2.15-2.5.0
+ * redhat 6.2(ibm) : i686 Linux #1 Sat Feb 5 00:28:02 EST 2000.2.2.15-2.5.0
+ * win2000(jdk1.1.8) : x86 Windows NT 5.0
+ * win2000(jdk1.2.2) : x86 Windows NT 5.0
+ * win2000(jdk1.3) : x86 Windows 2000 5.0
+ * Mac OS 9 : PowerPC Mac OS 9
+ * AIX 5.1 : ppc AIX 5.1 (vendor : IBM Corporation)
+ */
+ osID = 0;
+ String osName = System.getProperty("os.name").toUpperCase();
+
+ if (osName.indexOf("WINDOWS") >= 0) {
+ osID |= OSChecker.WINDOWS;
+ } else if (osName.indexOf("MAC") >= 0) {
+ osID |= OSChecker.MAC;
+ } else if (osName.indexOf("LINUX") >= 0) {
+ osID |= OSChecker.LINUX;
+ } else if (osName.indexOf("AIX") >= 0) {
+ osID |= OSChecker.AIX;
+ osID |= OSChecker.UNIX;
+ } else if (osName.indexOf("SOLARIS") >= 0) {
+ osID |= OSChecker.SOLARIS;
+ osID |= OSChecker.UNIX;
+ }
+
+ vendorID = 0;
+ String vendorName = System.getProperty("java.vendor").toUpperCase();
+
+ if (vendorName.indexOf("IBM") >= 0) {
+ vendorID |= OSChecker.IBM;
+ } else if (vendorName.indexOf("MICROSOFT") >= 0) {
+ vendorID |= OSChecker.MICROSOFT;
+ } else if (vendorName.indexOf("APPLE") >= 0) {
+ vendorID |= OSChecker.APPLE;
+ } else if (vendorName.indexOf("SUN") >= 0) {
+ // should check if the vendor is sun in last place
+ // 'cause other vendor can port Sun's VM
+ vendorID |= OSChecker.SUN;
+ }
+ }
+
+ /* querying OS */
+ public static int getOSID() {
+ return osID;
+ }
+
+ public static boolean isWindows() {
+ return ((osID & OSChecker.WINDOWS) > 0);
+ }
+
+ public static boolean isMAC() {
+ return ((osID & OSChecker.MAC) > 0);
+ }
+
+ public static boolean isLinux() {
+ return ((osID & OSChecker.LINUX) > 0);
+ }
+
+ public static boolean isAIX() {
+ return ((osID & OSChecker.AIX) > 0);
+ }
+
+ public static boolean isSolaris() {
+ return ((osID & OSChecker.SOLARIS) > 0);
+ }
+
+ public static boolean isUnix() {
+ return ((osID & OSChecker.UNIX) > 0);
+ }
+
+ public static boolean isUnknownOS() {
+ return (osID == 0);
+ }
+
+ /* querying Vendor */
+ public static int getVendorID() {
+ return vendorID;
+ }
+
+ public static boolean byMicrosoft() {
+ return ((vendorID & OSChecker.MICROSOFT) > 0);
+ }
+
+ public static boolean byIBM() {
+ return ((vendorID & OSChecker.IBM) > 0);
+ }
+
+ public static boolean byApple() {
+ return ((vendorID & OSChecker.APPLE) > 0);
+ }
+
+ public static boolean bySun() {
+ return ((vendorID & OSChecker.SUN) > 0);
+ }
+
+ public static boolean byUnknownVendor() {
+ return (vendorID == 0);
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/OpenBrowserUtil.java b/org.tizen.common/src/org/tizen/common/util/OpenBrowserUtil.java
new file mode 100644
index 000000000..c1123ea78
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/OpenBrowserUtil.java
@@ -0,0 +1,101 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.net.URL;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWebBrowser;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+
+public class OpenBrowserUtil {
+
+ /**
+ * Opens the given url in the browser as choosen in the preferences.
+ *
+ * @param url the URL
+ * @param display the display
+ * @since 3.6
+ */
+ public static void open(final URL url, Display display) {
+ display.syncExec(new Runnable() {
+ public void run() {
+ internalOpen(url, false);
+ }
+ });
+ }
+
+ /**
+ * Opens the given URL in an external browser.
+ *
+ * @param url the URL
+ * @param display the display
+ * @since 3.6
+ */
+ public static void openExternal(final URL url, Display display) {
+ display.syncExec(new Runnable() {
+ public void run() {
+ internalOpen(url, true);
+ }
+ });
+ }
+
+ private static void internalOpen(final URL url, final boolean useExternalBrowser) {
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ //URL helpSystemUrl= PlatformUI.getWorkbench().getHelpSystem().resolve(url.toExternalForm(), true);
+ try {
+ IWorkbenchBrowserSupport browserSupport= PlatformUI.getWorkbench().getBrowserSupport();
+ IWebBrowser browser;
+ if (useExternalBrowser)
+ browser= browserSupport.getExternalBrowser();
+ else
+ browser= browserSupport.createBrowser(null);
+ browser.openURL(url);
+ } catch (PartInitException ex) {
+ MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error", "Opening url failed: " + ex.getMessage());
+ }
+ }
+ });
+ }
+
+ /**
+ * DO NOT REMOVE, used in a product.
+ *
+ * @param url the URL
+ * @param display the display
+ * @param title the title
+ * @deprecated As of 3.6, replaced by {@link #open(URL, Display)}
+ */
+ public static void open(final URL url, Display display, String title) {
+ open(url, display);
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/ProcessMonitorThread.java b/org.tizen.common/src/org/tizen/common/util/ProcessMonitorThread.java
new file mode 100644
index 000000000..c36a71bee
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/ProcessMonitorThread.java
@@ -0,0 +1,82 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ProcessMonitorThread extends Thread {
+
+ private IProgressMonitor monitor;
+ private Process proc;
+ private boolean hasMoreWork;
+
+ public ProcessMonitorThread() {
+ super();
+
+ this.monitor = null;
+ this.proc = null;
+ }
+
+ public ProcessMonitorThread(Process proc, IProgressMonitor monitor) {
+ this();
+
+ this.monitor = monitor;
+ this.proc = proc;
+ }
+
+ @Override
+ /* TODO : Have to need code review soon*/
+ public void run() {
+ this.hasMoreWork = true;
+
+ while(hasMoreWork) {
+ if(monitor.isCanceled()) {
+ if(proc != null) {
+ proc.destroy();
+ }
+ monitor.setCanceled(false);
+ monitor.done();
+ hasMoreWork = false;
+ break;
+ }
+ try {
+ Thread.sleep(100);
+ int exit = proc.exitValue();
+
+ if (exit <= 0 || exit >= 255) {
+ monitor.done();
+ hasMoreWork = false;
+ }
+ } catch (IllegalThreadStateException e) {
+ // TODO Auto-generated catch block
+ hasMoreWork = true;
+ }catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ hasMoreWork = false;
+ }
+ }
+ }
+
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/PropertyUtil.java b/org.tizen.common/src/org/tizen/common/util/PropertyUtil.java
new file mode 100644
index 000000000..2f7ac97b4
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/PropertyUtil.java
@@ -0,0 +1,114 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Properties;
+
+public abstract class PropertyUtil {
+ public static Properties loadProperties(String fileName) {
+ Properties props = new Properties();
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(fileName));
+ String line = "";
+ while((line=reader.readLine()) != null) {
+ if ("".equals(line.trim()))
+ continue;
+ int index = line.indexOf("=");
+ String key =line.substring(0,index);
+ String value = line.substring(index+1);
+ props.setProperty(key, value);
+ }
+ //props.load(reader);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (reader != null)
+ try {
+ reader.close();
+ } catch (IOException e) {
+ }
+ }
+ return props;
+ }
+
+ public static Properties loadProperties(InputStream inputStream) {
+ Properties props = new Properties();
+ try {
+ props.load(inputStream);
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (inputStream != null)
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ }
+ }
+ return props;
+ }
+
+ public static boolean storeProperties(OutputStream outputStream, Properties props) {
+ try {
+ props.store(outputStream, null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ } finally {
+ if (outputStream != null)
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ }
+ }
+ return true;
+ }
+
+ public static boolean storeProperties(String fileName, Properties props) {
+ BufferedWriter writer = null;
+
+ try {
+ writer = new BufferedWriter(new FileWriter(fileName));
+ props.store(writer, null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ } finally {
+ if (writer != null)
+ try {
+ writer.close();
+ } catch (IOException e) {
+ }
+ }
+ return true;
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/SWTUtil.java b/org.tizen.common/src/org/tizen/common/util/SWTUtil.java
new file mode 100644
index 000000000..21c7dc9c7
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/SWTUtil.java
@@ -0,0 +1,203 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+
+
+public class SWTUtil {
+
+ public static final String HTML_EXTENSIONS[] = { "html", "htm", "shtml", "shtm", "xhtml"};
+
+ /**
+ * Creates SWT <code>Text</code> for input limited digit.
+ *
+ * @return <code>Text</code>
+ * @author jihoon80.song@samsung.com, S-Core Inc.
+ */
+ public static Text createNumericText(Composite composite, int style, int limit) {
+ Text text = new Text(composite, style);
+
+ text.setTextLimit(limit);
+
+ text.addVerifyListener(new VerifyListener() {
+ final Pattern pattern = Pattern.compile("[0-9]*"); //$NON-NLS-1$
+ public void verifyText(VerifyEvent e) {
+ Matcher m = pattern.matcher(e.text);
+ if (!m.matches()) {
+ e.doit = false;
+ }
+ }
+ });
+
+ return text;
+ }
+
+ public static Text createNumericText(Composite composite, int limit) {
+ return createNumericText(composite, SWT.BORDER, limit);
+ }
+
+ /**
+ * Creates SWT <code>ScrolledComposite</code>.
+ * @param width the minimum width or 0 for default width (0 is screen width)
+ * @param height the minimum height or 0 for default height (0 is screen height)
+ * @return <code>ScrolledComposite</code>
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+ public static ScrolledComposite createScrolledComposite(Composite parent, int width, int height) {
+ ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+
+ Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
+ if (width == 0) {
+ width = screen.width;
+ }
+
+ if (height == 0) {
+ height = screen.height;
+ }
+
+ sc.setMinSize(width, height);
+ sc.setExpandHorizontal(true);
+ sc.setExpandVertical(true);
+
+ return sc;
+ }
+
+ /**
+ * Get current active editor.
+ *
+ * @return <code>IEditorPart</code>
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+ public static IEditorPart getActiveEditor() {
+ IWorkbenchWindow window = ViewUtil.getWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+
+ if(page == null){
+ return null;
+ }
+
+ IEditorPart editor = page.getActiveEditor();
+ if(editor == null){
+ return null;
+ }
+
+ return editor;
+ }
+
+ /**
+ * Get editor of file extension.
+ *
+ * @return <code>IEditorPart</code>
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+ public static IEditorPart getCurrentEditor(String ext) {
+ if (ext == null) {
+ throw new IllegalArgumentException("extension can't be null");
+ }
+
+ IEditorPart editor = getActiveEditor();
+ if(editor == null || editor.getEditorInput() == null){
+ return null;
+ }
+
+ if (ext.equalsIgnoreCase(FileUtil.getFileExtension(editor.getEditorInput().getName()))) {
+ return editor;
+ }
+
+ return null;
+ }
+
+ /**
+ * Get current HTML Editor.
+ *
+ * @return <code>IEditorPart</code>
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+ public static IEditorPart getCurrentHtmlEditor() {
+ IEditorPart editor = getActiveEditor();
+ if(editor == null || editor.getEditorInput() == null){
+ return null;
+ }
+
+ if (isHtmlFile(editor.getEditorInput().getName())) {
+ return editor;
+ }
+
+ return null;
+ }
+
+ /**
+ * Verify that html file.
+ *
+ * @return <code>boolean</code>
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+ public static boolean isHtmlFile(String fullName) {
+ String fileExt = FileUtil.getFileExtension(fullName);
+ if (fileExt == null) {
+ return false;
+ }
+
+ for (String htmlExt : HTML_EXTENSIONS) {
+ if (htmlExt.equalsIgnoreCase(fileExt)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Get editorReferences.
+ *
+ * @return <code>IEditorReference[]</code>
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+ public static IEditorReference[] getEditorReferences() {
+ IWorkbenchWindow window = ViewUtil.getWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+
+ if(page == null){
+ return null;
+ }
+
+ return page.getEditorReferences();
+ }
+
+} \ No newline at end of file
diff --git a/org.tizen.common/src/org/tizen/common/util/ShellParser.java b/org.tizen.common/src/org/tizen/common/util/ShellParser.java
new file mode 100644
index 000000000..5f868f59d
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/ShellParser.java
@@ -0,0 +1,80 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+public class ShellParser{
+ Process proc = null;
+
+ public ShellParser(Process process) {
+ proc = process;
+ }
+
+ public void setProcess(Process proc) {
+ this.proc = proc;
+ }
+
+ public void parsing() {
+ final StringBuilder contents = new StringBuilder();
+
+ Thread inputThread = new Thread(){
+ public void run() {
+ String line = null;
+ BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ try {
+ while((line=input.readLine())!=null){
+ contents.append(line);
+ contents.append(HostUtil.LINE_SEPARATOR);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ };
+
+ Thread errorThread = new Thread(){
+ public void run() {
+ String line = null;
+ BufferedReader input = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
+ try {
+ while((line=input.readLine())!=null){
+ contents.append(line);
+ contents.append(HostUtil.LINE_SEPARATOR);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ };
+
+ inputThread.start();
+ errorThread.start();
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/StreamGobbler.java b/org.tizen.common/src/org/tizen/common/util/StreamGobbler.java
new file mode 100644
index 000000000..deae67722
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/StreamGobbler.java
@@ -0,0 +1,75 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+
+public class StreamGobbler extends Thread
+{
+ InputStream is;
+ OutputStream os;
+ String result;
+ private static Object synchronizer = new Object();
+
+ public StreamGobbler(InputStream is) {
+ this.is = is;
+ this.os = null;
+ }
+
+ public StreamGobbler(InputStream is, OutputStream os) {
+ this.is = is;
+ this.os = os;
+ }
+
+ public void run()
+ {
+ StringBuffer buffer = new StringBuffer();
+ try {
+ synchronized (synchronizer) {
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ String line;
+ while ( (line = br.readLine()) != null) {
+ buffer.append(line);
+ buffer.append("\n");
+
+ if ( os != null )
+ os.write( (line + "\n").getBytes());
+ }
+ br.close();
+ }
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ } finally {
+ result = buffer.toString();
+ }
+ }
+ public String getResult() {
+ return result;
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/StringUtil.java b/org.tizen.common/src/org/tizen/common/util/StringUtil.java
new file mode 100644
index 000000000..c7ccee27e
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/StringUtil.java
@@ -0,0 +1,128 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ * <ul>
+ * <li> initial creation
+ * <li> added trimToNull method.
+ * </ul>
+ * @author gyeongseok.seo@samsung.com, S-Core Inc.
+ * <ul>
+ * <li> added split method.
+ * </ul>
+ */
+public class StringUtil {
+ public static String trimToNull(String s) {
+ return trimToNull(s, null);
+ }
+
+ public static String trimToNull(String s, String def) {
+ if (s == null) {
+ return def;
+ }
+
+ String t = s.trim();
+ if (t.length() == 0) {
+ return def;
+ }
+
+ return t;
+ }
+
+ public static InputStream stringToInputStream(String src) {
+ if (src == null) {
+ return null;
+ }
+ return new ByteArrayInputStream(src.getBytes());
+ }
+
+ public static String[] split(String s, String delim) {
+ List<String> list = new ArrayList<String>();
+ StringTokenizer st = new StringTokenizer(s, delim);
+ while (st.hasMoreTokens()) {
+ list.add(st.nextToken());
+ }
+
+ return (String[]) list.toArray(new String[0]);
+ }
+
+ public static String getOnlyNumerics(String str) {
+ if (str == null) {
+ return null;
+ }
+
+ char c;
+ StringBuilder sb = new StringBuilder();
+
+ for (int i = 0; i < str.length() ; i++) {
+ c = str.charAt(i);
+ if (Character.isDigit(c)) {
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
+
+ public static String asString(Reader reader) throws IOException {
+ StringBuilder sb = new StringBuilder();
+ int c;
+ while ((c = reader.read()) != -1) {
+ sb.append((char) c);
+ }
+ return sb.toString();
+ }
+ public static String asString(InputStream is) throws IOException{
+ StringBuffer out = new StringBuffer();
+ byte[] b = new byte[4096];
+
+ for (int n; (n = is.read(b)) != -1;)
+ out.append(new String(b,0,n));
+ return out.toString();
+ }
+
+ public static String removeEnd(String str, String remove) {
+ if (isEmpty(str) || isEmpty(remove)) {
+ return str;
+ }
+ if (str.endsWith(remove)) {
+ return str.substring(0, str.length() - remove.length());
+ }
+ return str;
+ }
+
+ public static boolean isEmpty(CharSequence cs) {
+ return cs == null || cs.length() == 0;
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/UpdateManager.java b/org.tizen.common/src/org/tizen/common/util/UpdateManager.java
new file mode 100644
index 000000000..7edaf7445
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/UpdateManager.java
@@ -0,0 +1,146 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import java.io.File;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.tizen.common.CommonPlugin;
+import org.tizen.common.preferences.TizenBasePreferencePage;
+import org.tizen.common.properties.InstallPathConfig;
+
+
+public class UpdateManager implements IStartup {
+ private static final String EXECUTE_INSTALLER_COMMAND = "java -jar InstallManager.jar";
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+
+ @Override
+ public void earlyStartup() {
+ // Check installable package exist.
+ IPreferenceStore prefStore = CommonPlugin.getDefault().getPreferenceStore();
+
+ if(prefStore.getBoolean(TizenBasePreferencePage.KEY_SDKUPDATE))
+ {
+ boolean updatable = isExistUpdatablePackage();
+ if(updatable) {
+ if(askExecuteInstallerDlg()) {
+ executeInstallManger();
+ if (workbench != null) {
+ final Display display = workbench.getDisplay();
+ display.syncExec(new Runnable() {
+ public void run() {
+ if (!display.isDisposed())
+ workbench.close();
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+
+ private boolean isExistUpdatablePackage() {
+ String result = HostUtil.returnExecute(EXECUTE_INSTALLER_COMMAND + " -checkPackageUpdate", InstallPathConfig.getInstallManagerPath());
+ if(result.equals("updatable"))
+ return true;
+ return false;
+ }
+
+ private boolean askExecuteInstallerDlg() {
+ int ret = checkUpdate();
+ if (ret == IDialogConstants.YES_ID)
+ return true;
+ return false;
+ }
+
+ private void executeInstallManger() {
+ returnExecute(EXECUTE_INSTALLER_COMMAND, InstallPathConfig.getInstallManagerPath());
+ }
+
+ public static String returnExecute(String command, String workingDir) {
+ final StringBuilder contents = new StringBuilder();
+
+ Process proc = null;
+
+ String[] fullCommand = HostUtil.getCommand(command);
+
+ try {
+ ProcessBuilder pb = new ProcessBuilder();
+ pb.command(fullCommand);
+ if(workingDir != null) {
+ pb.directory(new File(workingDir));
+ }
+ proc = pb.start();
+
+ ShellParser parser = new ShellParser(proc);
+ parser.parsing();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ } finally{
+ }
+
+ return contents.toString().trim();
+
+ }
+ public int checkUpdate() {
+ final int[] result = new int[1]; // using array since you can't change a final int
+
+ Runnable query = new Runnable() {
+ public void run() {
+ int resultId[] = {
+ IDialogConstants.YES_ID,
+ IDialogConstants.NO_ID };
+
+ String labels[] = new String[] {
+ IDialogConstants.YES_LABEL,
+ IDialogConstants.NO_LABEL };
+
+ MessageDialog dialog = new MessageDialog(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ "Tizen SDK",
+ null,"Updates are available for Tizen SDK. Do you want to install them?" , MessageDialog.QUESTION, labels, 0);
+ dialog.open();
+ if (dialog.getReturnCode() == SWT.DEFAULT) {
+ // A window close returns SWT.DEFAULT - mapped to a cancel
+ result[0] = IDialogConstants.NO_ID;
+ } else {
+ result[0] = resultId[dialog.getReturnCode()];
+ }
+ }
+ };
+
+ PlatformUI.getWorkbench().getDisplay().syncExec(query);
+ return result[0];
+ }
+}
diff --git a/org.tizen.common/src/org/tizen/common/util/ViewUtil.java b/org.tizen.common/src/org/tizen/common/util/ViewUtil.java
new file mode 100644
index 000000000..05a3ae525
--- /dev/null
+++ b/org.tizen.common/src/org/tizen/common/util/ViewUtil.java
@@ -0,0 +1,108 @@
+/*
+* Common
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Kangho Kim <kh5325.kim@samsung.com>
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+package org.tizen.common.util;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Changhyun Lee {@literal <changhyun1.lee@samsung.com>} (S-Core)
+ */
+public class ViewUtil {
+ public static void showView(final String id, boolean sync) {
+ ViewRunnable runnable = new ViewRunnable(id);
+
+ if (sync) {
+ Display.getDefault().syncExec(runnable);
+ } else {
+ Display.getDefault().asyncExec(runnable);
+ }
+ }
+
+ static class ViewRunnable implements Runnable {
+ String id;
+
+ public ViewRunnable(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public void run() {
+ IWorkbenchWindow window = getWorkbenchWindow();
+ if (window == null) {
+ return;
+ }
+
+ try {
+ window.getActivePage().showView(id);
+ } catch (PartInitException e) {
+ MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error", "showView failed: " + e.getMessage());
+ }
+ }
+ }
+
+ public static IViewPart getView(final String id) {
+ return getView(id, true);
+ }
+
+ public static IViewPart getView(final String id, boolean show) {
+ IWorkbenchWindow window = getWorkbenchWindow();
+ if (window == null) {
+ return null;
+ }
+
+ IWorkbenchPage activeWorkbenchPage = window.getActivePage();
+ if (activeWorkbenchPage == null) {
+ return null;
+ }
+
+ IViewPart view = activeWorkbenchPage.findView(id);
+
+ if (view != null && show) {
+ showView(id, true);
+ }
+
+ return view;
+ }
+
+ public static IWorkbenchWindow getWorkbenchWindow() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ if (window == null) {
+ if (workbench.getWorkbenchWindowCount() == 1) {
+ window = workbench.getWorkbenchWindows()[0];
+ }
+ }
+
+ return window;
+ }
+
+} \ No newline at end of file
diff --git a/package/build.linux b/package/build.linux
new file mode 100755
index 000000000..07c4de454
--- /dev/null
+++ b/package/build.linux
@@ -0,0 +1,291 @@
+#!/bin/bash -x
+
+build_path=${SRCDIR}/build_result
+
+__set_parameter()
+{
+ build_id=${package_name}
+ build_type=N
+ build_result_directory=${build_type}.${build_id}
+ build_result_path="$build_path/$build_result_directory"
+ architecture=x86
+ ide_root_path_name=IDE
+
+ case ${platform} in
+ linux)
+ archive_platform_name=linux
+ windowing=gtk
+ ;;
+ windows)
+ archive_platform_name=win32
+ windowing=win32
+ ;;
+ *)
+ echo "${platform} is not support yet."
+ ;;
+ esac
+
+ result_archive_file=${build_id}-${archive_platform_name}.${windowing}.${architecture}.zip
+}
+
+__set_build_parameter()
+{
+ case ${platform} in
+ linux)
+ reference_ide_path=${ROOTDIR}/indigo-pde/eclipse
+ ;;
+ windows)
+ reference_ide_path=${ROOTDIR}/indigo-winpde/eclipse
+ ;;
+ *)
+ echo "${platform} is not support yet."
+ ;;
+ esac
+}
+
+__set_install_parameter()
+{
+ INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${platform}/data
+}
+
+__clean_build_environment()
+{
+ if [ -d $build_path ]
+ then
+ echo "Build result directory : [$build_path]"
+ else
+ echo "Make build result directory [$build_path]"
+ mkdir -p $build_path
+ fi
+
+ echo "Remove legacy build files..."
+ if [ -d ${build_result_path}/${archive_platform_name}.${windowing}.${architecture} ]
+ then
+ rm -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}
+ fi
+ if [ -e ${build_result_path}/${result_archive_file} ]
+ then
+ rm -rf ${build_result_path}/${result_archive_file}
+ fi
+ if [ -d ${build_path}/tmp ]
+ then
+ rm -rf ${build_path}/tmp
+ fi
+
+ if [ -d ${build_path}/buildRepo ]
+ then
+ rm -rf ${build_path}/buildRepo
+ fi
+
+ rm -r ${build_path}/*.xml
+ rm -r ${build_path}/*.properties
+ rm -r ${build_path}/*.clean
+
+
+ if [ -d $build_path/plugins ]
+ then
+ echo "plugins directory recreate..."
+ rm -rf $build_path/plugins
+ mkdir $build_path/plugins
+ else
+ echo "Make plugins directory..."
+ mkdir $build_path/plugins
+ fi
+ if [ -d $build_path/features/ ]
+ then
+ echo "features directory recreate..."
+ rm -rf $build_path/features
+ mkdir $build_path/features
+ else
+ echo "Make features directory..."
+ mkdir $build_path/features
+ fi
+
+}
+
+__copy_build_sources()
+{
+ echo "Copy features from $SRCDIR to $build_path/features"
+ cp -r $SRCDIR/* $build_path/features
+
+ echo "Copy plugins from $SRCDIR to $build_path/plugins"
+ cp -r $SRCDIR/* $build_path/plugins
+}
+
+__copy_dependency_plugins()
+{
+ dependency_plugin_path=${ROOTDIR}/${ide_root_path_name}
+ if [ -d ${dependency_plugin_path} ]
+ then
+ cp -rf ${dependency_plugin_path}/features/* ${build_path}/features/
+ cp -rf ${dependency_plugin_path}/plugins/* ${build_path}/plugins/
+ fi
+}
+
+__make_ant_build_properties_file()
+{
+ builder_path="${SRCDIR}/builder"
+ parent_path_of_based_eclipse=${reference_ide_path}/..
+
+ echo "Make build.properties file..."
+ if [ ! -e $builder_path/build.properties.clean ] ; then
+ echo "ERROR : \"build.properties.clean\" file does not exist..."
+ exit 1
+ fi
+ cp $builder_path/build.properties.clean $build_path
+ cp $builder_path/customTargets.xml $build_path
+
+ if [ -d $reference_ide_path ]
+ then
+ sed -e "s;\(^buildDirectory=\).*;\1${build_path};g" \
+ -e "s;\(^base=\).*;\1${parent_path_of_based_eclipse};g" \
+ -e "s;\(^baseLocation=\).*;\1${reference_ide_path};g" \
+ -e "s;\(^configs=\).*;\1${archive_platform_name},${windowing},${architecture};g" \
+ -e "s;\(^buildType=\).*;\1${build_type};g" \
+ -e "s;\(^buildId=\).*;\1${build_id};g" \
+ -e "s;\(^archivePrefix=\).*;\1${build_id};g" \
+ < $build_path/build.properties.clean > $build_path/build.properties
+
+ else
+ echo "ERROR : target eclipse is not exist."
+ exit 1
+ fi
+}
+
+__execute_pde_build()
+{
+ echo "Execute Product Ant Builder..."
+ equinox_launcher=`echo org.eclipse.equinox.launcher_*.jar`
+ pde_build=`echo org.eclipse.pde.build_*`
+
+ java -jar ${reference_ide_path}/plugins/$equinox_launcher -application org.eclipse.ant.core.antRunner -buildfile ${reference_ide_path}/plugins/$pde_build/scripts/productBuild/productBuild.xml -Dbuilder=$build_path -Dosgi.locking=none 2>&1
+
+ if [ $? != 0 ];
+ then
+ echo "Build failed..."
+ exit 1
+ fi
+}
+
+__unzip_plugin_pack()
+{
+ echo "unzip to $build_result_path"
+ unzip -a $build_result_path/${result_archive_file} -d $build_result_path/${archive_platform_name}.${windowing}.${architecture}
+}
+
+build_plugins()
+{
+ case ${platform} in
+ linux)
+ echo "build plugin for ${platform}"
+ ;;
+ windows)
+ echo "build plugin for ${platform}"
+ ;;
+ *)
+ echo "${platform} is not support yet."
+ exit 1
+ ;;
+ esac
+
+ __set_parameter
+ __set_build_parameter
+ __clean_build_environment
+ __copy_build_sources
+ __copy_dependency_plugins
+ __make_ant_build_properties_file
+ __execute_pde_build
+ __unzip_plugin_pack
+
+ echo "Build SUCCESS. You will find SDK IDE in \"${build_result_path}\"."
+}
+
+__clean_packaging_environment()
+{
+
+ if [ -d ${INSTALL_DIR} ]
+ then
+ rm -rf ${INSTALL_DIR}
+ else
+ mkdir -p ${INSTALL_DIR}
+ fi
+}
+
+__copy_necessary_binaries()
+{
+ echo "add necessary files."
+ ## ex) cp -rf ~~~~/file.file ${INSTALL_DIR}/${ide_root_path_name}/
+}
+
+packaging_plugins()
+{
+ __set_parameter
+ __set_install_parameter
+
+ __clean_packaging_environment
+ __copy_necessary_binaries
+
+ install_ide_path=${INSTALL_DIR}/${ide_root_path_name}
+
+ if [ ! -d ${install_ide_path} ]
+ then
+ mkdir -p ${install_ide_path}
+ fi
+
+ cp -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}/${package_name}/* ${install_ide_path}/
+}
+
+# clean
+clean()
+{
+ echo "=========================================CLEAN============================================"
+ make clean
+ rm -rf ${SRCDIR}/*.zip
+ rm -rf ${SRCDIR}/*.tar.gz
+ rm -rf ${build_path}
+}
+
+# build
+build()
+{
+ echo "=========================================BUILD============================================"
+ pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+ for pkgname_and_platform in ${pkgname_and_platform_list}
+ do
+ pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+ package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+ platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+
+ if [ "x${BUILD_TARGET_OS}" = "x${platform}" ]
+ then
+ build_plugins
+ else
+ echo ""
+ fi
+ done
+}
+
+# install
+install()
+{
+ pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+ for pkgname_and_platform in ${pkgname_and_platform_list}
+ do
+ echo "=========================================INSTALL============================================"
+ pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+ package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+ platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+
+ if [ "x${BUILD_TARGET_OS}" = "x${platform}" ]
+ then
+ packaging_plugins
+ else
+ echo ""
+ fi
+ done
+}
+
+[ "$1" = "clean" ] && clean
+[ "$1" = "build" ] && build
+[ "$1" = "install" ] && install
+exit 0
diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest
new file mode 100644
index 000000000..2bae7c8c2
--- /dev/null
+++ b/package/pkginfo.manifest
@@ -0,0 +1,19 @@
+Package:common-eplugin
+Version:0.20.12
+OS:linux
+Build-host-os:linux
+Build-dependency:indigo-pde [linux], base-ide-product [linux]
+Install-dependency:base-ide-product [linux]
+Source:common-eplugin
+Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Jihoon Song, Ho Namkoong, Taeyoung Son
+Description:Common plugin
+
+Package:common-eplugin
+Version:0.20.12
+OS:windows
+Build-host-os:linux
+Build-dependency:indigo-winpde [windows], base-ide-product [windows]
+Install-dependency:base-ide-product [windows]
+Source:common-eplugin
+Maintainer:Kangho Kim <kh5325.kim@samsung.com>, Jihoon Song, Ho Namkoong, Taeyoung Son
+Description:Common plugin