aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/features/com.android.ide.eclipse.hierarchyviewer/.project17
-rw-r--r--eclipse/features/com.android.ide.eclipse.hierarchyviewer/build.properties1
-rw-r--r--eclipse/features/com.android.ide.eclipse.hierarchyviewer/feature.xml239
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/Perspective.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.classpath4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/build.properties3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/device.pngbin0 -> 135 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/pixel-perfect.pngbin0 -> 412 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/sample.gifbin983 -> 0 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/tree-view.pngbin0 -> 288 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/plugin.xml93
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java148
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPluginDirector.java120
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/PixelPerfectPespective.java61
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/TreeViewPerspective.java65
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/DeviceSelectorView.java117
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/LayoutView.java155
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectLoupeView.java158
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectTreeView.java61
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectView.java67
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PropertyView.java43
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/SampleView.java120
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/TreeOverviewView.java43
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/TreeViewView.java97
-rwxr-xr-xeclipse/scripts/create_hierarchyviewer_symlinks.sh4
28 files changed, 1489 insertions, 145 deletions
diff --git a/eclipse/features/com.android.ide.eclipse.hierarchyviewer/.project b/eclipse/features/com.android.ide.eclipse.hierarchyviewer/.project
new file mode 100644
index 0000000..6f5c27e
--- /dev/null
+++ b/eclipse/features/com.android.ide.eclipse.hierarchyviewer/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>hierarchyviewer-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/eclipse/features/com.android.ide.eclipse.hierarchyviewer/build.properties b/eclipse/features/com.android.ide.eclipse.hierarchyviewer/build.properties
new file mode 100644
index 0000000..64f93a9
--- /dev/null
+++ b/eclipse/features/com.android.ide.eclipse.hierarchyviewer/build.properties
@@ -0,0 +1 @@
+bin.includes = feature.xml
diff --git a/eclipse/features/com.android.ide.eclipse.hierarchyviewer/feature.xml b/eclipse/features/com.android.ide.eclipse.hierarchyviewer/feature.xml
new file mode 100644
index 0000000..a2f2305
--- /dev/null
+++ b/eclipse/features/com.android.ide.eclipse.hierarchyviewer/feature.xml
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="com.android.ide.eclipse.hierarchyviewer"
+ label="Android Hierarchy Viewer"
+ version="0.9.8.qualifier"
+ provider-name="The Android Open Source Project"
+ plugin="com.android.ide.eclipse.hierarchyviewer">
+
+ <description>
+ Android Hierarchy Viewer.
+ </description>
+
+ <copyright>
+ Copyright (C) 2010 The Android Open Source Project
+ </copyright>
+
+ <license url="http://www.apache.org/licenses/LICENSE-2.0.txt">
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ &quot;License&quot; shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ &quot;Licensor&quot; shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ &quot;Legal Entity&quot; 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,
+ &quot;control&quot; 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.
+
+ &quot;You&quot; (or &quot;Your&quot;) shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ &quot;Source&quot; form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ &quot;Object&quot; 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.
+
+ &quot;Work&quot; 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).
+
+ &quot;Derivative Works&quot; 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.
+
+ &quot;Contribution&quot; 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, &quot;submitted&quot;
+ 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 &quot;Not a Contribution.&quot;
+
+ &quot;Contributor&quot; 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 &quot;NOTICE&quot; 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 &quot;AS IS&quot; 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 &quot;[]&quot;
+ replaced with your own identifying information. (Don&apos;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 &quot;printed page&quot; 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 &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.
+ </license>
+
+ <url>
+ <update label="Android Update Site" url="https://dl-ssl.google.com/android/eclipse/"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.ui.console"/>
+ <import plugin="com.android.ide.eclipse.ddms" match="perfect"/>
+ </requires>
+
+ <plugin
+ id="com.android.ide.eclipse.hierarchyviewer"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
index 25e8d3d..af646d7 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Bundle-ClassPath: .,
Bundle-Activator: com.android.ide.eclipse.adt.AdtPlugin
Bundle-Vendor: The Android Open Source Project
Require-Bundle: com.android.ide.eclipse.ddms,
+ com.android.ide.eclipse.hierarchyviewer,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.debug.core,
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
index 429a7f3..41771f1 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
@@ -46,6 +46,7 @@ import com.android.ide.eclipse.adt.internal.sdk.Sdk.ITargetChangeListener;
import com.android.ide.eclipse.adt.internal.ui.EclipseUiHelper;
import com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard;
import com.android.ide.eclipse.ddms.DdmsPlugin;
+import com.android.ide.eclipse.hierarchyviewer.HierarchyViewerPlugin;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
import com.android.sdkstats.SdkStatsService;
@@ -276,6 +277,7 @@ public class AdtPlugin extends AbstractUIPlugin {
// finally restart adb, in case it's a different version
DdmsPlugin.setAdb(getOsAbsoluteAdb(), true /* startAdb */);
+ HierarchyViewerPlugin.setAdb(getOsAbsoluteAdb(), true /* startAdb */);
// get the SDK location and build id.
if (checkSdkLocationAndId()) {
@@ -297,6 +299,7 @@ public class AdtPlugin extends AbstractUIPlugin {
String osSdkLocation = AdtPrefs.getPrefs().getOsSdkFolder();
if (osSdkLocation.length() > 0) {
DdmsPlugin.setAdb(getOsAbsoluteAdb(), true);
+ HierarchyViewerPlugin.setAdb(getOsAbsoluteAdb(), true);
}
// and give it the debug launcher for android projects
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/Perspective.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/Perspective.java
index b582ee2..77b0188 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/Perspective.java
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/Perspective.java
@@ -29,6 +29,8 @@ import org.eclipse.ui.IPerspectiveFactory;
public class Perspective implements IPerspectiveFactory {
+ public static String ID = "com.android.ide.eclipse.ddms.Perspective";
+
public void createInitialLayout(IPageLayout layout) {
// create a default layout that looks like the stand alone DDMS.
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.classpath b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.classpath
index f3f5310..90a300d 100644
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.classpath
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.classpath
@@ -3,6 +3,8 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="lib" path="libs/hierarchyviewerlib.jar" sourcepath="/ddmlib"/>
+ <classpathentry kind="lib" path="libs/hierarchyviewerlib.jar" sourcepath="/hierarchyviewerlib"/>
+ <classpathentry kind="lib" path="libs/ddmlib.jar" sourcepath="/ddmlib"/>
+ <classpathentry kind="lib" path="libs/ddmuilib.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF
index 716c0f4..6458f58 100644
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF
@@ -2,13 +2,17 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Hierarchy Viewer
Bundle-SymbolicName: com.android.ide.eclipse.hierarchyviewer;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 0.9.8.qualifier
Bundle-Activator: com.android.ide.eclipse.hierarchyviewer.HierarchyViewerPlugin
Bundle-Vendor: The Android Open Source Project
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.console,
+ com.android.ide.eclipse.ddms
Bundle-ClassPath: .,
libs/hierarchyviewerlib.jar,
- libs/hierearchyvieweruilib.jar
+ libs/ddmlib.jar,
+ libs/ddmuilib.jar
+Export-Package: com.android.ide.eclipse.hierarchyviewer
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/build.properties b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/build.properties
index 7fce1ca..a1a2606 100644
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/build.properties
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/build.properties
@@ -4,4 +4,5 @@ bin.includes = META-INF/,\
icons/,\
plugin.xml,\
.,\
- libs/ \ No newline at end of file
+ libs/
+bin.excludes = libs/.gitignore \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/device.png b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/device.png
new file mode 100644
index 0000000..7dbbbb6
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/device.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/pixel-perfect.png b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/pixel-perfect.png
new file mode 100644
index 0000000..6e51701
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/pixel-perfect.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/sample.gif b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/sample.gif
deleted file mode 100644
index 34fb3c9..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/sample.gif
+++ /dev/null
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/tree-view.png b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/tree-view.png
new file mode 100644
index 0000000..8f01dda
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/tree-view.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/plugin.xml
index 06e1f14..b8a6762 100644
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/plugin.xml
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/plugin.xml
@@ -3,28 +3,89 @@
<plugin>
<extension
point="org.eclipse.ui.views">
- <category
- id="com.android.ide.eclipse.ddms.views.category"
- name="Android">
- </category>
<view
+ allowMultiple="false"
category="com.android.ide.eclipse.ddms.views.category"
- class="com.android.ide.eclipse.hierarchyviewer.views.SampleView"
- icon="icons/sample.gif"
- id="com.android.ide.eclipse.hierarchyviewer.views.SampleView"
- name="Sample View">
+ class="com.android.ide.eclipse.hierarchyviewer.views.DeviceSelectorView"
+ icon="icons/device.png"
+ id="com.android.ide.eclipse.hierarchyviewer.views.DeviceSelectorView"
+ name="Windows">
</view>
+ <view
+ allowMultiple="false"
+ category="com.android.ide.eclipse.ddms.views.category"
+ class="com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectView"
+ icon="icons/pixel-perfect.png"
+ id="com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectView"
+ name="Pixel Perfect">
+ </view>
+ <view
+ allowMultiple="false"
+ category="com.android.ide.eclipse.ddms.views.category"
+ class="com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectLoupeView"
+ icon="icons/pixel-perfect.png"
+ id="com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectLoupeView"
+ name="Pixel Perfect Loupe">
+ </view>
+ <view
+ allowMultiple="false"
+ category="com.android.ide.eclipse.ddms.views.category"
+ class="com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectTreeView"
+ icon="icons/pixel-perfect.png"
+ id="com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectTreeView"
+ name="Pixel Perfect Tree">
+ </view>
+ <view
+ allowMultiple="false"
+ category="com.android.ide.eclipse.ddms.views.category"
+ class="com.android.ide.eclipse.hierarchyviewer.views.TreeViewView"
+ icon="icons/tree-view.png"
+ id="com.android.ide.eclipse.hierarchyviewer.views.TreeViewView"
+ name="Tree View">
+ </view>
+ <view
+ allowMultiple="false"
+ category="com.android.ide.eclipse.ddms.views.category"
+ class="com.android.ide.eclipse.hierarchyviewer.views.PropertyView"
+ icon="icons/tree-view.png"
+ id="com.android.ide.eclipse.hierarchyviewer.views.PropertyView"
+ name="View Properties">
+ </view>
+ <view
+ allowMultiple="false"
+ category="com.android.ide.eclipse.ddms.views.category"
+ class="com.android.ide.eclipse.hierarchyviewer.views.TreeOverviewView"
+ icon="icons/tree-view.png"
+ id="com.android.ide.eclipse.hierarchyviewer.views.TreeOverviewView"
+ name="Tree Overview">
+ </view>
+ <view
+ allowMultiple="false"
+ category="com.android.ide.eclipse.ddms.views.category"
+ class="com.android.ide.eclipse.hierarchyviewer.views.LayoutView"
+ icon="icons/tree-view.png"
+ id="com.android.ide.eclipse.hierarchyviewer.views.LayoutView"
+ name="Layout View">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ class="com.android.ide.eclipse.hierarchyviewer.PixelPerfectPespective"
+ icon="icons/pixel-perfect.png"
+ id="com.android.ide.eclipse.hierarchyviewer.PixelPerfectPespective"
+ name="Pixel Perfect"/>
+ <perspective
+ class="com.android.ide.eclipse.hierarchyviewer.TreeViewPerspective"
+ icon="icons/tree-view.png"
+ id="com.android.ide.eclipse.hierarchyviewer.TreeViewPerspective"
+ name="Hierarchy View"/>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="org.eclipse.jdt.ui.JavaPerspective">
- <view
- id="com.android.ide.eclipse.hierarchyviewer.views.SampleView"
- ratio="0.5"
- relationship="right"
- relative="org.eclipse.ui.views.TaskList">
- </view>
+ <perspectiveExtension targetID="org.eclipse.jdt.ui.JavaPerspective">
+ <perspectiveShortcut id="com.android.ide.eclipse.hierarchyviewer.PixelPerfectPespective"/>
+ <perspectiveShortcut id="com.android.ide.eclipse.hierarchyviewer.TreeViewPerspective"/>
</perspectiveExtension>
</extension>
</plugin>
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java
index b6f0ed3..8996cdb 100644
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java
@@ -16,9 +16,25 @@
package com.android.ide.eclipse.hierarchyviewer;
+import com.android.ddmlib.AndroidDebugBridge;
+import com.android.ddmlib.Log;
+import com.android.ddmlib.Log.ILogOutput;
+import com.android.ddmlib.Log.LogLevel;
+import com.android.hierarchyviewerlib.HierarchyViewerDirector;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+import java.util.Calendar;
+
/**
* The activator class controls the plug-in life cycle
*/
@@ -26,18 +42,85 @@ public class HierarchyViewerPlugin extends AbstractUIPlugin {
public static final String PLUGIN_ID = "com.android.ide.eclipse.hierarchyviewer";
+ public static final String ADB_LOCATION = PLUGIN_ID + ".adb";
+
// The shared instance
private static HierarchyViewerPlugin plugin;
+ private Color redColor;
+
/**
* The constructor
*/
public HierarchyViewerPlugin() {
}
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+
+
+ // set the consoles.
+ final MessageConsole messageConsole = new MessageConsole("Hierarchy Viewer", null); // $NON-NLS-1$
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] {
+ messageConsole
+ });
+
+ final MessageConsoleStream consoleStream = messageConsole.newMessageStream();
+ final MessageConsoleStream errorConsoleStream = messageConsole.newMessageStream();
+ redColor = new Color(Display.getDefault(), 0xFF, 0x00, 0x00);
+
+ // because this can be run, in some cases, by a non UI thread, and
+ // because
+ // changing the console properties update the UI, we need to make this
+ // change
+ // in the UI thread.
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ errorConsoleStream.setColor(redColor);
+ }
+ });
+
+ // set up the ddms log to use the ddms console.
+ Log.setLogOutput(new ILogOutput() {
+ public void printLog(LogLevel logLevel, String tag, String message) {
+ if (logLevel.getPriority() >= LogLevel.ERROR.getPriority()) {
+ printToStream(errorConsoleStream, tag, message);
+ ConsolePlugin.getDefault().getConsoleManager().showConsoleView(messageConsole);
+ } else {
+ printToStream(consoleStream, tag, message);
+ }
+ }
+
+ public void printAndPromptLog(final LogLevel logLevel, final String tag,
+ final String message) {
+ printLog(logLevel, tag, message);
+ // dialog box only run in UI thread..
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ Shell shell = Display.getDefault().getActiveShell();
+ if (logLevel == LogLevel.ERROR) {
+ MessageDialog.openError(shell, tag, message);
+ } else {
+ MessageDialog.openWarning(shell, tag, message);
+ }
+ }
+ });
+ }
+
+ });
+
+ final HierarchyViewerDirector director = HierarchyViewerPluginDirector.createDirector();
+
+ new Thread() {
+ @Override
+ public void run() {
+ director.initDebugBridge();
+ director.startListenForDevices();
+ director.populateDeviceSelectionModel();
+ }
+ }.start();
}
/*
@@ -46,9 +129,17 @@ public class HierarchyViewerPlugin extends AbstractUIPlugin {
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
+
+ redColor.dispose();
+
+ HierarchyViewerDirector director = HierarchyViewerDirector.getDirector();
+ director.stopListenForDevices();
+ director.stopDebugBridge();
+ director.terminate();
}
/**
@@ -56,8 +147,63 @@ public class HierarchyViewerPlugin extends AbstractUIPlugin {
*
* @return the shared instance
*/
- public static HierarchyViewerPlugin getDefault() {
+ public static HierarchyViewerPlugin getPlugin() {
return plugin;
}
+ /**
+ * Set the location of the adb executable and optionally starts adb
+ *
+ * @param adb location of adb
+ * @param startAdb flag to start adb
+ */
+ public static void setAdb(String adb, boolean startAdb) {
+ if (adb != null) {
+ // store the location for future ddms only start.
+ plugin.getPreferenceStore().setValue(ADB_LOCATION, adb);
+
+ // starts the server in a thread in case this is blocking.
+ if (startAdb) {
+ new Thread() {
+ @Override
+ public void run() {
+ HierarchyViewerDirector.getDirector().initDebugBridge();
+ HierarchyViewerDirector.getDirector().startListenForDevices();
+ HierarchyViewerDirector.getDirector().populateDeviceSelectionModel();
+ }
+ }.start();
+ }
+ }
+ }
+
+ /**
+ * Prints a message, associated with a project to the specified stream
+ *
+ * @param stream The stream to write to
+ * @param tag The tag associated to the message. Can be null
+ * @param message The message to print.
+ */
+ private static synchronized void printToStream(MessageConsoleStream stream, String tag,
+ String message) {
+ String dateTag = getMessageTag(tag);
+
+ stream.print(dateTag);
+ stream.println(message);
+ }
+
+ /**
+ * Creates a string containing the current date/time, and the tag
+ *
+ * @param tag The tag associated to the message. Can be null
+ * @return The dateTag
+ */
+ private static String getMessageTag(String tag) {
+ Calendar c = Calendar.getInstance();
+
+ if (tag == null) {
+ return String.format("[%1$tF %1$tT]", c);
+ }
+
+ return String.format("[%1$tF %1$tT - %2$s]", c, tag);
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPluginDirector.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPluginDirector.java
new file mode 100644
index 0000000..f1374ae
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPluginDirector.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer;
+
+import com.android.ddmlib.IDevice;
+import com.android.hierarchyviewerlib.HierarchyViewerDirector;
+import com.android.hierarchyviewerlib.device.Window;
+import com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectTreeView;
+import com.android.ide.eclipse.hierarchyviewer.views.PropertyView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+
+public class HierarchyViewerPluginDirector extends HierarchyViewerDirector {
+
+ public static HierarchyViewerDirector createDirector() {
+ return director = new HierarchyViewerPluginDirector();
+ }
+
+ @Override
+ public void executeInBackground(final String taskName, final Runnable task) {
+ Job job = new Job(taskName) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ task.run();
+ return Status.OK_STATUS;
+ }
+ };
+ job.setPriority(Job.SHORT);
+ job.setRule(schedulingRule);
+ job.schedule();
+ }
+
+ private ISchedulingRule schedulingRule = new ISchedulingRule() {
+ public boolean contains(ISchedulingRule rule) {
+ return rule == this;
+ }
+
+ public boolean isConflicting(ISchedulingRule rule) {
+ return rule == this;
+ }
+
+ };
+
+ @Override
+ public String getAdbLocation() {
+ return HierarchyViewerPlugin.getPlugin().getPreferenceStore().getString(
+ HierarchyViewerPlugin.ADB_LOCATION);
+ }
+
+ @Override
+ public void loadViewTreeData(Window window) {
+ super.loadViewTreeData(window);
+
+ // The windows tab hides the property tab, so let's bring the property
+ // tab
+ // forward.
+
+ IWorkbenchWindow[] windows =
+ HierarchyViewerPlugin.getPlugin().getWorkbench().getWorkbenchWindows();
+ for (IWorkbenchWindow currentWindow : windows) {
+ IWorkbenchPage page = currentWindow.getActivePage();
+ if (page.getPerspective().getId().equals(TreeViewPerspective.ID)) {
+ try {
+ IWorkbenchPart part = page.findView(PropertyView.ID);
+ if (part != null) {
+ page.showView(PropertyView.ID);
+ }
+ } catch (PartInitException e) {
+
+ }
+ }
+ }
+ }
+
+ @Override
+ public void loadPixelPerfectData(IDevice device) {
+ super.loadPixelPerfectData(device);
+
+ // The windows tab hides the tree tab, so let's bring the tree tab
+ // forward.
+
+ IWorkbenchWindow[] windows =
+ HierarchyViewerPlugin.getPlugin().getWorkbench().getWorkbenchWindows();
+ for (IWorkbenchWindow window : windows) {
+ IWorkbenchPage page = window.getActivePage();
+ if (page.getPerspective().getId().equals(PixelPerfectPespective.ID)) {
+ try {
+ IWorkbenchPart part = page.findView(PixelPerfectTreeView.ID);
+ if (part != null) {
+ page.showView(PixelPerfectTreeView.ID);
+ }
+ } catch (PartInitException e) {
+
+ }
+ }
+ }
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/PixelPerfectPespective.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/PixelPerfectPespective.java
new file mode 100644
index 0000000..bcaf8f9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/PixelPerfectPespective.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer;
+
+import com.android.ide.eclipse.ddms.Perspective;
+import com.android.ide.eclipse.hierarchyviewer.views.DeviceSelectorView;
+import com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectLoupeView;
+import com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectTreeView;
+import com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectView;
+
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+public class PixelPerfectPespective implements IPerspectiveFactory {
+
+ public static final String ID =
+ "com.android.ide.eclipse.hierarchyviewer.PixelPerfectPespective";
+
+ public void createInitialLayout(IPageLayout layout) {
+ layout.setEditorAreaVisible(false);
+
+ String editorArea = layout.getEditorArea();
+ IFolderLayout folder;
+
+ folder = layout.createFolder("tree", IPageLayout.LEFT, 0.25f, editorArea);
+ folder.addView(DeviceSelectorView.ID);
+ folder.addView(PixelPerfectTreeView.ID);
+
+ folder = layout.createFolder("overview", IPageLayout.RIGHT, 0.4f, editorArea);
+ folder.addView(PixelPerfectView.ID);
+
+ folder = layout.createFolder("main", IPageLayout.RIGHT, 0.35f, editorArea);
+ folder.addView(PixelPerfectLoupeView.ID);
+
+
+ layout.addShowViewShortcut(DeviceSelectorView.ID);
+ layout.addShowViewShortcut(PixelPerfectTreeView.ID);
+ layout.addShowViewShortcut(PixelPerfectLoupeView.ID);
+ layout.addShowViewShortcut(PixelPerfectView.ID);
+
+ layout.addPerspectiveShortcut("org.eclipse.jdt.ui.JavaPerspective");
+ layout.addPerspectiveShortcut(TreeViewPerspective.ID);
+ layout.addPerspectiveShortcut(Perspective.ID);
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/TreeViewPerspective.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/TreeViewPerspective.java
new file mode 100644
index 0000000..7022509
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/TreeViewPerspective.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer;
+
+import com.android.ide.eclipse.ddms.Perspective;
+import com.android.ide.eclipse.hierarchyviewer.views.DeviceSelectorView;
+import com.android.ide.eclipse.hierarchyviewer.views.LayoutView;
+import com.android.ide.eclipse.hierarchyviewer.views.PropertyView;
+import com.android.ide.eclipse.hierarchyviewer.views.TreeOverviewView;
+import com.android.ide.eclipse.hierarchyviewer.views.TreeViewView;
+
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+public class TreeViewPerspective implements IPerspectiveFactory {
+
+ public static final String ID = "com.android.ide.eclipse.hierarchyviewer.TreeViewPerspective";
+
+ public void createInitialLayout(IPageLayout layout) {
+ layout.setEditorAreaVisible(false);
+
+ String editorArea = layout.getEditorArea();
+ IFolderLayout folder;
+
+ folder = layout.createFolder("properties", IPageLayout.LEFT, 0.10f, editorArea);
+ folder.addView(DeviceSelectorView.ID);
+ folder.addView(PropertyView.ID);
+
+ folder = layout.createFolder("main", IPageLayout.RIGHT, 0.24f, "properties");
+ folder.addView(TreeViewView.ID);
+
+ folder = layout.createFolder("panel-top", IPageLayout.RIGHT, 0.7f, "main");
+ folder.addView(TreeOverviewView.ID);
+
+
+ folder = layout.createFolder("panel-bottom", IPageLayout.BOTTOM, 0.5f, "panel-top");
+ folder.addView(LayoutView.ID);
+
+ layout.addShowViewShortcut(DeviceSelectorView.ID);
+ layout.addShowViewShortcut(PropertyView.ID);
+ layout.addShowViewShortcut(TreeOverviewView.ID);
+ layout.addShowViewShortcut(LayoutView.ID);
+ layout.addShowViewShortcut(TreeViewView.ID);
+
+ layout.addPerspectiveShortcut("org.eclipse.jdt.ui.JavaPerspective");
+ layout.addPerspectiveShortcut(PixelPerfectPespective.ID);
+ layout.addPerspectiveShortcut(Perspective.ID);
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/DeviceSelectorView.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/DeviceSelectorView.java
new file mode 100644
index 0000000..c884115
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/DeviceSelectorView.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer.views;
+
+import com.android.hierarchyviewerlib.actions.InspectScreenshotAction;
+import com.android.hierarchyviewerlib.actions.LoadViewHierarchyAction;
+import com.android.hierarchyviewerlib.actions.RefreshWindowsAction;
+import com.android.hierarchyviewerlib.ui.DeviceSelector;
+import com.android.ide.eclipse.hierarchyviewer.PixelPerfectPespective;
+import com.android.ide.eclipse.hierarchyviewer.TreeViewPerspective;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IPerspectiveListener;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.part.ViewPart;
+
+public class DeviceSelectorView extends ViewPart implements IPerspectiveListener {
+
+ public static final String ID =
+ "com.android.ide.eclipse.hierarchyviewer.views.DeviceSelectorView";
+
+ private DeviceSelector deviceSelector;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ parent.setLayout(new FillLayout());
+
+
+ IPerspectiveDescriptor perspective = getViewSite().getPage().getPerspective();
+ boolean doTreeViewStuff = true;
+ boolean doPixelPerfectStuff = true;
+ if (perspective.getId().equals(PixelPerfectPespective.ID)) {
+ doTreeViewStuff = false;
+ } else if (perspective.getId().equals(TreeViewPerspective.ID)) {
+ doPixelPerfectStuff = false;
+ }
+ deviceSelector = new DeviceSelector(parent, doTreeViewStuff, doPixelPerfectStuff);
+
+ placeActions(doTreeViewStuff, doPixelPerfectStuff);
+
+ getViewSite().getWorkbenchWindow().addPerspectiveListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ getViewSite().getWorkbenchWindow().removePerspectiveListener(this);
+ }
+
+ private void placeActions(boolean doTreeViewStuff, boolean doPixelPerfectStuff) {
+ IActionBars actionBars = getViewSite().getActionBars();
+
+ IMenuManager mm = actionBars.getMenuManager();
+ mm.removeAll();
+ mm.add(RefreshWindowsAction.getAction());
+
+ IToolBarManager tm = actionBars.getToolBarManager();
+ tm.removeAll();
+ tm.add(RefreshWindowsAction.getAction());
+
+ if (doTreeViewStuff) {
+ mm.add(LoadViewHierarchyAction.getAction());
+ tm.add(LoadViewHierarchyAction.getAction());
+ }
+ if (doPixelPerfectStuff) {
+ mm.add(InspectScreenshotAction.getAction());
+ tm.add(InspectScreenshotAction.getAction());
+ }
+
+ mm.updateAll(true);
+ tm.update(true);
+ actionBars.updateActionBars();
+ }
+
+ @Override
+ public void setFocus() {
+ deviceSelector.setFocus();
+ }
+
+ public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ if (perspective.getId().equals(PixelPerfectPespective.ID)) {
+ deviceSelector.setMode(false, true);
+ placeActions(false, true);
+ } else if (perspective.getId().equals(TreeViewPerspective.ID)) {
+ deviceSelector.setMode(true, false);
+ placeActions(true, false);
+ } else {
+ deviceSelector.setMode(true, true);
+ placeActions(true, true);
+ }
+ }
+
+ public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective,
+ String changeId) {
+ // pass
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/LayoutView.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/LayoutView.java
new file mode 100644
index 0000000..be401b6
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/LayoutView.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer.views;
+
+import com.android.ddmuilib.ImageLoader;
+import com.android.hierarchyviewerlib.HierarchyViewerDirector;
+import com.android.hierarchyviewerlib.models.TreeViewModel;
+import com.android.hierarchyviewerlib.models.TreeViewModel.TreeChangeListener;
+import com.android.hierarchyviewerlib.ui.LayoutViewer;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.part.ViewPart;
+
+public class LayoutView extends ViewPart implements TreeChangeListener {
+
+ public static final String ID = "com.android.ide.eclipse.hierarchyviewer.views.LayoutView";
+
+ private LayoutViewer layoutViewer;
+
+ private Image onBlack;
+
+ private Image onWhite;
+
+ private Action showExtrasAction = new Action("Show &Extras", Action.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ layoutViewer.setShowExtras(isChecked());
+ }
+ };
+
+ private Action loadAllViewsAction = new Action("Load All &Views") {
+ @Override
+ public void run() {
+ HierarchyViewerDirector.getDirector().loadAllViews();
+ showExtrasAction.setChecked(true);
+ layoutViewer.setShowExtras(true);
+ }
+ };
+
+ private Action onBlackWhiteAction = new Action("Change Background &Color") {
+ @Override
+ public void run() {
+ boolean newValue = !layoutViewer.getOnBlack();
+ layoutViewer.setOnBlack(newValue);
+ if (newValue) {
+ setImageDescriptor(ImageDescriptor.createFromImage(onWhite));
+ } else {
+ setImageDescriptor(ImageDescriptor.createFromImage(onBlack));
+ }
+ }
+ };
+
+ @Override
+ public void createPartControl(Composite parent) {
+ showExtrasAction.setAccelerator(SWT.MOD1 + 'E');
+ ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class);
+ Image image = imageLoader.loadImage("show-extras.png", Display.getDefault());
+ showExtrasAction.setImageDescriptor(ImageDescriptor.createFromImage(image));
+ showExtrasAction.setToolTipText("Show images");
+ showExtrasAction.setEnabled(TreeViewModel.getModel().getTree() != null);
+
+ onWhite = imageLoader.loadImage("on-white.png", Display.getDefault());
+ onBlack = imageLoader.loadImage("on-black.png", Display.getDefault());
+
+ onBlackWhiteAction.setAccelerator(SWT.MOD1 + 'C');
+ onBlackWhiteAction.setImageDescriptor(ImageDescriptor.createFromImage(onWhite));
+ onBlackWhiteAction.setToolTipText("Change layout viewer background color");
+
+ loadAllViewsAction.setAccelerator(SWT.MOD1 + 'V');
+ image = imageLoader.loadImage("load-all-views.png", Display.getDefault());
+ loadAllViewsAction.setImageDescriptor(ImageDescriptor.createFromImage(image));
+ loadAllViewsAction.setToolTipText("Load all view images");
+ loadAllViewsAction.setEnabled(TreeViewModel.getModel().getTree() != null);
+
+ parent.setLayout(new FillLayout());
+
+ layoutViewer = new LayoutViewer(parent);
+
+ placeActions();
+
+ TreeViewModel.getModel().addTreeChangeListener(this);
+ }
+
+ public void placeActions() {
+ IActionBars actionBars = getViewSite().getActionBars();
+
+ IMenuManager mm = actionBars.getMenuManager();
+ mm.removeAll();
+ mm.add(onBlackWhiteAction);
+ mm.add(showExtrasAction);
+ mm.add(loadAllViewsAction);
+
+ IToolBarManager tm = actionBars.getToolBarManager();
+ tm.removeAll();
+ tm.add(onBlackWhiteAction);
+ tm.add(showExtrasAction);
+ tm.add(loadAllViewsAction);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ TreeViewModel.getModel().removeTreeChangeListener(this);
+ }
+
+ @Override
+ public void setFocus() {
+ layoutViewer.setFocus();
+ }
+
+ public void selectionChanged() {
+ // pass
+ }
+
+ public void treeChanged() {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ loadAllViewsAction.setEnabled(TreeViewModel.getModel().getTree() != null);
+ showExtrasAction.setEnabled(TreeViewModel.getModel().getTree() != null);
+ }
+ });
+ }
+
+ public void viewportChanged() {
+ // pass
+ }
+
+ public void zoomChanged() {
+ // pass
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectLoupeView.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectLoupeView.java
new file mode 100644
index 0000000..05777c4
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectLoupeView.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer.views;
+
+import com.android.ddmuilib.ImageLoader;
+import com.android.hierarchyviewerlib.HierarchyViewerDirector;
+import com.android.hierarchyviewerlib.actions.PixelPerfectAutoRefreshAction;
+import com.android.hierarchyviewerlib.models.PixelPerfectModel;
+import com.android.hierarchyviewerlib.models.PixelPerfectModel.ImageChangeListener;
+import com.android.hierarchyviewerlib.ui.PixelPerfectControls;
+import com.android.hierarchyviewerlib.ui.PixelPerfectLoupe;
+import com.android.hierarchyviewerlib.ui.PixelPerfectPixelPanel;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.part.ViewPart;
+
+public class PixelPerfectLoupeView extends ViewPart implements ImageChangeListener {
+
+ public static final String ID =
+ "com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectLoupeView";
+
+ private PixelPerfectLoupe pixelPerfectLoupe;
+
+ private Action showInLoupeAction = new Action("&Show Overlay", Action.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ pixelPerfectLoupe.setShowOverlay(isChecked());
+ }
+ };
+ @Override
+ public void createPartControl(Composite parent) {
+ showInLoupeAction.setAccelerator(SWT.MOD1 + 'S');
+ ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class);
+ Image image = imageLoader.loadImage("show-overlay.png", Display.getDefault());
+ showInLoupeAction.setImageDescriptor(ImageDescriptor.createFromImage(image));
+ showInLoupeAction.setToolTipText("Show the overlay in the loupe view");
+ showInLoupeAction.setEnabled(PixelPerfectModel.getModel().getOverlayImage() != null);
+ PixelPerfectModel.getModel().addImageChangeListener(this);
+
+ GridLayout loupeLayout = new GridLayout();
+ loupeLayout.marginWidth = loupeLayout.marginHeight = 0;
+ loupeLayout.horizontalSpacing = loupeLayout.verticalSpacing = 0;
+ parent.setLayout(loupeLayout);
+
+ Composite pixelPerfectLoupeBorder = new Composite(parent, SWT.BORDER);
+ pixelPerfectLoupeBorder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout pixelPerfectLoupeBorderGridLayout = new GridLayout();
+ pixelPerfectLoupeBorderGridLayout.marginWidth =
+ pixelPerfectLoupeBorderGridLayout.marginHeight = 0;
+ pixelPerfectLoupeBorderGridLayout.horizontalSpacing =
+ pixelPerfectLoupeBorderGridLayout.verticalSpacing = 0;
+ pixelPerfectLoupeBorder.setLayout(pixelPerfectLoupeBorderGridLayout);
+
+ pixelPerfectLoupe = new PixelPerfectLoupe(pixelPerfectLoupeBorder);
+ pixelPerfectLoupe.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ PixelPerfectPixelPanel pixelPerfectPixelPanel =
+ new PixelPerfectPixelPanel(pixelPerfectLoupeBorder);
+ pixelPerfectPixelPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ PixelPerfectControls pixelPerfectControls =
+ new PixelPerfectControls(parent);
+ pixelPerfectControls.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ placeActions();
+ }
+
+ private void placeActions() {
+ IActionBars actionBars = getViewSite().getActionBars();
+
+ IMenuManager mm = actionBars.getMenuManager();
+ mm.removeAll();
+ mm.add(PixelPerfectAutoRefreshAction.getAction());
+ mm.add(showInLoupeAction);
+
+ IToolBarManager tm = actionBars.getToolBarManager();
+ tm.removeAll();
+ tm.add(PixelPerfectAutoRefreshAction.getAction());
+ tm.add(showInLoupeAction);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ PixelPerfectModel.getModel().removeImageChangeListener(this);
+ }
+
+ @Override
+ public void setFocus() {
+ pixelPerfectLoupe.setFocus();
+ }
+
+ public void crosshairMoved() {
+ // pass
+ }
+
+ public void treeChanged() {
+ // pass
+ }
+
+ public void imageChanged() {
+ // pass
+ }
+
+ public void imageLoaded() {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ Image overlayImage = PixelPerfectModel.getModel().getOverlayImage();
+ showInLoupeAction.setEnabled(overlayImage != null);
+ }
+ });
+ }
+
+ public void overlayChanged() {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ showInLoupeAction.setEnabled(PixelPerfectModel.getModel().getOverlayImage() != null);
+ }
+ });
+ }
+
+ public void overlayTransparencyChanged() {
+ // pass
+ }
+
+ public void selectionChanged() {
+ // pass
+ }
+
+ public void zoomChanged() {
+ // pass
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectTreeView.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectTreeView.java
new file mode 100644
index 0000000..811b8fc
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectTreeView.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer.views;
+
+import com.android.hierarchyviewerlib.actions.RefreshPixelPerfectTreeAction;
+import com.android.hierarchyviewerlib.ui.PixelPerfectTree;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.part.ViewPart;
+
+public class PixelPerfectTreeView extends ViewPart {
+
+ public static final String ID =
+ "com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectTreeView";
+
+ private PixelPerfectTree pixelPerfectTree;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ parent.setLayout(new FillLayout());
+ pixelPerfectTree = new PixelPerfectTree(parent);
+
+ placeActions();
+ }
+
+ private void placeActions() {
+ IActionBars actionBars = getViewSite().getActionBars();
+
+ IMenuManager mm = actionBars.getMenuManager();
+ mm.removeAll();
+ mm.add(RefreshPixelPerfectTreeAction.getAction());
+
+ IToolBarManager tm = actionBars.getToolBarManager();
+ tm.removeAll();
+ tm.add(RefreshPixelPerfectTreeAction.getAction());
+ }
+
+ @Override
+ public void setFocus() {
+ pixelPerfectTree.setFocus();
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectView.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectView.java
new file mode 100644
index 0000000..a09eb5c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectView.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer.views;
+
+import com.android.hierarchyviewerlib.actions.LoadOverlayAction;
+import com.android.hierarchyviewerlib.actions.RefreshPixelPerfectAction;
+import com.android.hierarchyviewerlib.actions.SavePixelPerfectAction;
+import com.android.hierarchyviewerlib.ui.PixelPerfect;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.part.ViewPart;
+
+public class PixelPerfectView extends ViewPart {
+
+ public static final String ID =
+ "com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectView";
+
+ private PixelPerfect pixelPerfect;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ parent.setLayout(new FillLayout());
+ pixelPerfect = new PixelPerfect(parent);
+
+ placeActions();
+ }
+
+ private void placeActions() {
+ IActionBars actionBars = getViewSite().getActionBars();
+
+ IMenuManager mm = actionBars.getMenuManager();
+ mm.removeAll();
+ mm.add(SavePixelPerfectAction.getAction(getSite().getShell()));
+ mm.add(RefreshPixelPerfectAction.getAction());
+ mm.add(LoadOverlayAction.getAction(getSite().getShell()));
+
+ IToolBarManager tm = actionBars.getToolBarManager();
+ tm.removeAll();
+ tm.add(SavePixelPerfectAction.getAction(getSite().getShell()));
+ tm.add(RefreshPixelPerfectAction.getAction());
+ tm.add(LoadOverlayAction.getAction(getSite().getShell()));
+ }
+
+ @Override
+ public void setFocus() {
+ pixelPerfect.setFocus();
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PropertyView.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PropertyView.java
new file mode 100644
index 0000000..bd6d462
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PropertyView.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer.views;
+
+import com.android.hierarchyviewerlib.ui.PropertyViewer;
+
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+
+public class PropertyView extends ViewPart {
+
+ public static final String ID = "com.android.ide.eclipse.hierarchyviewer.views.PropertyView";
+
+ private PropertyViewer propertyViewer;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ parent.setLayout(new FillLayout());
+
+ propertyViewer = new PropertyViewer(parent);
+ }
+
+ @Override
+ public void setFocus() {
+ propertyViewer.setFocus();
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/SampleView.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/SampleView.java
deleted file mode 100644
index 13c7ff4..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/SampleView.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer.views;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * This sample class demonstrates how to plug-in a new workbench view. The view
- * shows data obtained from the model. The sample creates a dummy model on the
- * fly, but a real implementation would connect to the model available either in
- * this or another plug-in (e.g. the workspace). The view is connected to the
- * model using a content provider.
- * <p>
- * The view uses a label provider to define how model objects should be
- * presented in the view. Each view can present the same model objects using
- * different labels and icons, if needed. Alternatively, a single label provider
- * can be shared between views in order to ensure that objects of the same type
- * are presented in the same way everywhere.
- * <p>
- */
-
-public class SampleView extends ViewPart {
-
- /**
- * The ID of the view as specified by the extension.
- */
- public static final String ID = "com.android.ide.eclipse.hierarchyviewer.views.SampleView";
-
- private Text text;
-
- /**
- * The constructor.
- */
- public SampleView() {
- }
-
- /**
- * This is a callback that will allow us to create the viewer and initialize
- * it.
- */
- public void createPartControl(Composite parent) {
- parent.setLayout(new FillLayout());
- text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL);
- text.addMouseListener(new MouseListener() {
-
- public void mouseDoubleClick(MouseEvent e) {
- text.setText(text.getText() + "Scheduling\n");
- Job test = new Job("Simple Job") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- text.setText(text.getText() + "SLEEPING\n");
- }
- });
- Thread.sleep(5000);
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- text.setText(text.getText() + "DONE SLEEPING\n");
- }
- });
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return Status.OK_STATUS;
- }
-
- };
- test.schedule();
- text.setText(text.getText() + "Done Scheduling\n");
- }
-
- public void mouseDown(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseUp(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- });
- }
-
- /**
- * Passing the focus request to the viewer's control.
- */
- public void setFocus() {
- text.setFocus();
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/TreeOverviewView.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/TreeOverviewView.java
new file mode 100644
index 0000000..5363c1b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/TreeOverviewView.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer.views;
+
+import com.android.hierarchyviewerlib.ui.TreeViewOverview;
+
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+
+public class TreeOverviewView extends ViewPart {
+
+ public static final String ID =
+ "com.android.ide.eclipse.hierarchyviewer.views.TreeOverviewView";
+
+ private TreeViewOverview treeViewOverview;
+ @Override
+ public void createPartControl(Composite parent) {
+ parent.setLayout(new FillLayout());
+
+ treeViewOverview = new TreeViewOverview(parent);
+ }
+
+ @Override
+ public void setFocus() {
+ treeViewOverview.setFocus();
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/TreeViewView.java b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/TreeViewView.java
new file mode 100644
index 0000000..76d9b54
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/TreeViewView.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2010 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 com.android.ide.eclipse.hierarchyviewer.views;
+
+import com.android.hierarchyviewerlib.actions.CapturePSDAction;
+import com.android.hierarchyviewerlib.actions.DisplayViewAction;
+import com.android.hierarchyviewerlib.actions.InvalidateAction;
+import com.android.hierarchyviewerlib.actions.RefreshViewAction;
+import com.android.hierarchyviewerlib.actions.RequestLayoutAction;
+import com.android.hierarchyviewerlib.actions.SaveTreeViewAction;
+import com.android.hierarchyviewerlib.ui.TreeView;
+import com.android.hierarchyviewerlib.ui.TreeViewControls;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.swt.SWT;
+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.ui.IActionBars;
+import org.eclipse.ui.part.ViewPart;
+
+// Awesome name.
+public class TreeViewView extends ViewPart {
+
+ public static final String ID = "com.android.ide.eclipse.hierarchyviewer.views.TreeViewView";
+
+ private TreeView treeView;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = layout.marginHeight = 0;
+ layout.horizontalSpacing = layout.verticalSpacing = 0;
+ parent.setLayout(layout);
+
+ Composite treeViewContainer = new Composite(parent, SWT.BORDER);
+ treeViewContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
+ treeViewContainer.setLayout(new FillLayout());
+
+ treeView = new TreeView(treeViewContainer);
+
+ TreeViewControls treeViewControls = new TreeViewControls(parent);
+ treeViewControls.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ placeActions();
+ }
+
+ public void placeActions() {
+ IActionBars actionBars = getViewSite().getActionBars();
+
+ IMenuManager mm = actionBars.getMenuManager();
+ mm.removeAll();
+ mm.add(SaveTreeViewAction.getAction(getSite().getShell()));
+ mm.add(CapturePSDAction.getAction(getSite().getShell()));
+ mm.add(new Separator());
+ mm.add(RefreshViewAction.getAction());
+ mm.add(DisplayViewAction.getAction(getSite().getShell()));
+ mm.add(new Separator());
+ mm.add(InvalidateAction.getAction());
+ mm.add(RequestLayoutAction.getAction());
+
+ IToolBarManager tm = actionBars.getToolBarManager();
+ tm.removeAll();
+ tm.add(SaveTreeViewAction.getAction(getSite().getShell()));
+ tm.add(CapturePSDAction.getAction(getSite().getShell()));
+ tm.add(new Separator());
+ tm.add(RefreshViewAction.getAction());
+ tm.add(DisplayViewAction.getAction(getSite().getShell()));
+ tm.add(new Separator());
+ tm.add(InvalidateAction.getAction());
+ tm.add(RequestLayoutAction.getAction());
+ }
+
+
+ @Override
+ public void setFocus() {
+ treeView.setFocus();
+ }
+
+}
diff --git a/eclipse/scripts/create_hierarchyviewer_symlinks.sh b/eclipse/scripts/create_hierarchyviewer_symlinks.sh
index ce7bf4b..f341144 100755
--- a/eclipse/scripts/create_hierarchyviewer_symlinks.sh
+++ b/eclipse/scripts/create_hierarchyviewer_symlinks.sh
@@ -60,10 +60,10 @@ DEST=$BASE/libs
mkdir -p $DEST
-LIBS="hierarchyviewerlib hierarchyvieweruilib"
+LIBS="ddmlib ddmuilib hierarchyviewerlib "
echo "make java libs ..."
make -j3 showcommands $LIBS || die "Hierarchy Viewer: Fail to build one of $LIBS."
for LIB in $LIBS; do
cpfile $DEST out/host/$PLATFORM/framework/$LIB.jar
-done \ No newline at end of file
+done