diff options
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.hierarchyviewer')
28 files changed, 1716 insertions, 0 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.classpath b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.classpath new file mode 100644 index 000000000..7073f2091 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.classpath @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <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/hierarchyviewer2lib.jar" sourcepath="/hierarchyviewer2lib"/> + <classpathentry combineaccessrules="false" kind="src" path="/ddmlib"/> + <classpathentry combineaccessrules="false" kind="src" path="/ddmuilib"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.project b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.project new file mode 100644 index 000000000..c9e969694 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>plugin-hierarchyviewer</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/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..ea661960a --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,98 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=com.android.annotations.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=com.android.annotations.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled +org.eclipse.jdt.core.compiler.annotation.nullable=com.android.annotations.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentialNullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 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 new file mode 100644 index 000000000..b57d20ca4 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Hierarchy Viewer +Bundle-SymbolicName: com.android.ide.eclipse.hierarchyviewer;singleton:=true +Bundle-Version: 24.3.3.qualifier +Bundle-Activator: com.android.ide.eclipse.hierarchyviewer.HierarchyViewerPlugin +Bundle-Vendor: The Android Open Source Project +Bundle-Localization: plugin +Bundle-ActivationPolicy: lazy +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.ui.console, + com.android.ide.eclipse.ddms, + com.android.ide.eclipse.base +Bundle-ClassPath: ., + libs/hierarchyviewer2lib.jar +Export-Package: com.android.ide.eclipse.hierarchyviewer +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/MODULE_LICENSE_APACHE2 b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/MODULE_LICENSE_APACHE2 new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/MODULE_LICENSE_APACHE2 diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/about.html b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/about.html new file mode 100644 index 000000000..380248c07 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/about.html @@ -0,0 +1,218 @@ +<!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>September 19, 2010</p> +<h3>License</h3> + +<pre>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. + </pre> + +</body> +</html>
\ No newline at end of file diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/about.ini b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/about.ini new file mode 100644 index 000000000..18f6ab010 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/about.ini @@ -0,0 +1,2 @@ +aboutText=%blurb +featureImage=icons/hierarchyviewer-32.png
\ No newline at end of file diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/about.properties b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/about.properties new file mode 100755 index 000000000..207cbbec1 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/about.properties @@ -0,0 +1,7 @@ +blurb=Hierarchy Viewer\n\
+\n\
+Version\: {featureVersion}\n\
+\n\
+(c) Copyright 2010-2011 The Android Open Source Project. All rights reserved.\n\
+Visit http://developer.android.com/sdk/eclipse-adt.html
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/build.properties b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/build.properties new file mode 100644 index 000000000..f7e5d3fa9 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/build.properties @@ -0,0 +1,10 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + icons/,\ + plugin.xml,\ + .,\ + libs/,\ + about.html,\ + about.ini,\ + about.properties diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/device.png b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/device.png Binary files differnew file mode 100644 index 000000000..7dbbbb6a4 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/device.png diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/hierarchyviewer-16.png b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/hierarchyviewer-16.png Binary files differnew file mode 100644 index 000000000..02073d421 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/hierarchyviewer-16.png diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/hierarchyviewer-32.png b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/hierarchyviewer-32.png Binary files differnew file mode 100644 index 000000000..fa21c24dd --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/hierarchyviewer-32.png 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 Binary files differnew file mode 100644 index 000000000..6e517012b --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/pixel-perfect.png 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 Binary files differnew file mode 100644 index 000000000..8f01dda41 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/icons/tree-view.png diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/plugin.xml new file mode 100644 index 000000000..a4c299471 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/plugin.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + point="org.eclipse.ui.views"> + <view + allowMultiple="false" + category="com.android.ide.eclipse.ddms.views.category" + 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/hierarchyviewer-16.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"> + <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/pom.xml b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/pom.xml new file mode 100644 index 000000000..133fe09ae --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/pom.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <version>24.3.3-SNAPSHOT</version> + <artifactId>com.android.ide.eclipse.hierarchyviewer</artifactId> + <packaging>eclipse-plugin</packaging> + <name>hierarchyviewer</name> + + <parent> + <relativePath>../../pom.xml</relativePath> + <groupId>adt.group</groupId> + <artifactId>parent</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> +</project> 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 new file mode 100644 index 000000000..d4a64d008 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPlugin.java @@ -0,0 +1,200 @@ +/* + * 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.AndroidDebugBridge; +import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener; +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 + */ +public class HierarchyViewerPlugin extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "com.android.ide.eclipse.hierarchyviewer"; //$NON-NLS-1$ + + public static final String ADB_LOCATION = PLUGIN_ID + ".adb"; //$NON-NLS-1$ + + // The shared instance + private static HierarchyViewerPlugin sPlugin; + + private Color mRedColor; + + /** + * The constructor + */ + public HierarchyViewerPlugin() { + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + sPlugin = 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(); + mRedColor = 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() { + @Override + public void run() { + errorConsoleStream.setColor(mRedColor); + } + }); + + // set up the ddms log to use the ddms console. + Log.setLogOutput(new ILogOutput() { + @Override + 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); + } + } + + @Override + 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() { + @Override + 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(); + director.startListenForDevices(); + + // make the director receive change in ADB. + AndroidDebugBridge.addDebugBridgeChangeListener(new IDebugBridgeChangeListener() { + @Override + public void bridgeChanged(AndroidDebugBridge bridge) { + director.acquireBridge(bridge); + } + }); + + // get the current ADB if any + director.acquireBridge(AndroidDebugBridge.getBridge()); + + // populate the UI with current devices (if any) in a thread + new Thread() { + @Override + public void run() { + director.populateDeviceSelectionModel(); + } + }.start(); + } + + /* + * (non-Javadoc) + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + @Override + public void stop(BundleContext context) throws Exception { + sPlugin = null; + super.stop(context); + + mRedColor.dispose(); + + HierarchyViewerDirector director = HierarchyViewerDirector.getDirector(); + director.stopListenForDevices(); + director.stopDebugBridge(); + director.terminate(); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static HierarchyViewerPlugin getPlugin() { + return sPlugin; + } + + /** + * 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); //$NON-NLS-1$ + } + + return String.format("[%1$tF %1$tT - %2$s]", c, tag); //$NON-NLS-1$ + } +} 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 000000000..597f7a489 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/HierarchyViewerPluginDirector.java @@ -0,0 +1,122 @@ +/* + * 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.hierarchyviewerlib.HierarchyViewerDirector; +import com.android.hierarchyviewerlib.device.IHvDevice; +import com.android.hierarchyviewerlib.models.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 sDirector = 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(mSchedulingRule); + job.schedule(); + } + + private ISchedulingRule mSchedulingRule = new ISchedulingRule() { + @Override + public boolean contains(ISchedulingRule rule) { + return rule == this; + } + + @Override + 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(IHvDevice 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 000000000..973b30e8e --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/PixelPerfectPespective.java @@ -0,0 +1,62 @@ +/* + * 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"; //$NON-NLS-1$ + + @Override + public void createInitialLayout(IPageLayout layout) { + layout.setEditorAreaVisible(false); + + String editorArea = layout.getEditorArea(); + IFolderLayout folder; + + folder = layout.createFolder("tree", IPageLayout.LEFT, 0.25f, editorArea); //$NON-NLS-1$ + folder.addView(DeviceSelectorView.ID); + folder.addView(PixelPerfectTreeView.ID); + + folder = layout.createFolder("overview", IPageLayout.RIGHT, 0.4f, editorArea); //$NON-NLS-1$ + folder.addView(PixelPerfectView.ID); + + folder = layout.createFolder("main", IPageLayout.RIGHT, 0.35f, editorArea); //$NON-NLS-1$ + 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"); //$NON-NLS-1$ + 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 000000000..b6198d8f8 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/TreeViewPerspective.java @@ -0,0 +1,66 @@ +/* + * 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"; //$NON-NLS-1$ + + @Override + public void createInitialLayout(IPageLayout layout) { + layout.setEditorAreaVisible(false); + + String editorArea = layout.getEditorArea(); + IFolderLayout folder; + + folder = layout.createFolder("properties", IPageLayout.LEFT, 0.10f, editorArea); //$NON-NLS-1$ + folder.addView(DeviceSelectorView.ID); + folder.addView(PropertyView.ID); + + folder = layout.createFolder("main", IPageLayout.RIGHT, 0.24f, "properties"); //$NON-NLS-1$ //$NON-NLS-2$ + folder.addView(TreeViewView.ID); + + folder = layout.createFolder("panel-top", IPageLayout.RIGHT, 0.7f, "main"); //$NON-NLS-1$ //$NON-NLS-2$ + folder.addView(TreeOverviewView.ID); + + + folder = layout.createFolder("panel-bottom", IPageLayout.BOTTOM, 0.5f, "panel-top"); //$NON-NLS-1$ //$NON-NLS-2$ + 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"); //$NON-NLS-1$ + 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 000000000..1905cde1a --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/DeviceSelectorView.java @@ -0,0 +1,119 @@ +/* + * 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"; //$NON-NLS-1$ + + private DeviceSelector mDeviceSelector; + + @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; + } + mDeviceSelector = 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() { + mDeviceSelector.setFocus(); + } + + @Override + public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { + if (perspective.getId().equals(PixelPerfectPespective.ID)) { + mDeviceSelector.setMode(false, true); + placeActions(false, true); + } else if (perspective.getId().equals(TreeViewPerspective.ID)) { + mDeviceSelector.setMode(true, false); + placeActions(true, false); + } else { + mDeviceSelector.setMode(true, true); + placeActions(true, true); + } + } + + @Override + 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 000000000..83cf38b57 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/LayoutView.java @@ -0,0 +1,160 @@ +/* + * 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.ITreeChangeListener; +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 ITreeChangeListener { + + public static final String ID = "com.android.ide.eclipse.hierarchyviewer.views.LayoutView"; //$NON-NLS-1$ + + private LayoutViewer mLayoutViewer; + + private Image mOnBlack; + + private Image mOnWhite; + + private Action mShowExtrasAction = new Action("Show &Extras", Action.AS_CHECK_BOX) { + @Override + public void run() { + mLayoutViewer.setShowExtras(isChecked()); + } + }; + + private Action mLoadAllViewsAction = new Action("Load All &Views") { + @Override + public void run() { + HierarchyViewerDirector.getDirector().loadAllViews(); + mShowExtrasAction.setChecked(true); + mLayoutViewer.setShowExtras(true); + } + }; + + private Action mOnBlackWhiteAction = new Action("Change Background &Color") { + @Override + public void run() { + boolean newValue = !mLayoutViewer.getOnBlack(); + mLayoutViewer.setOnBlack(newValue); + if (newValue) { + setImageDescriptor(ImageDescriptor.createFromImage(mOnWhite)); + } else { + setImageDescriptor(ImageDescriptor.createFromImage(mOnBlack)); + } + } + }; + + @Override + public void createPartControl(Composite parent) { + mShowExtrasAction.setAccelerator(SWT.MOD1 + 'E'); + ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class); + Image image = imageLoader.loadImage("show-extras.png", Display.getDefault()); //$NON-NLS-1$ + mShowExtrasAction.setImageDescriptor(ImageDescriptor.createFromImage(image)); + mShowExtrasAction.setToolTipText("Show images"); + mShowExtrasAction.setEnabled(TreeViewModel.getModel().getTree() != null); + + mOnWhite = imageLoader.loadImage("on-white.png", Display.getDefault()); //$NON-NLS-1$ + mOnBlack = imageLoader.loadImage("on-black.png", Display.getDefault()); //$NON-NLS-1$ + + mOnBlackWhiteAction.setAccelerator(SWT.MOD1 + 'C'); + mOnBlackWhiteAction.setImageDescriptor(ImageDescriptor.createFromImage(mOnWhite)); + mOnBlackWhiteAction.setToolTipText("Change layout viewer background color"); + + mLoadAllViewsAction.setAccelerator(SWT.MOD1 + 'V'); + image = imageLoader.loadImage("load-all-views.png", Display.getDefault()); //$NON-NLS-1$ + mLoadAllViewsAction.setImageDescriptor(ImageDescriptor.createFromImage(image)); + mLoadAllViewsAction.setToolTipText("Load all view images"); + mLoadAllViewsAction.setEnabled(TreeViewModel.getModel().getTree() != null); + + parent.setLayout(new FillLayout()); + + mLayoutViewer = new LayoutViewer(parent); + + placeActions(); + + TreeViewModel.getModel().addTreeChangeListener(this); + } + + public void placeActions() { + IActionBars actionBars = getViewSite().getActionBars(); + + IMenuManager mm = actionBars.getMenuManager(); + mm.removeAll(); + mm.add(mOnBlackWhiteAction); + mm.add(mShowExtrasAction); + mm.add(mLoadAllViewsAction); + + IToolBarManager tm = actionBars.getToolBarManager(); + tm.removeAll(); + tm.add(mOnBlackWhiteAction); + tm.add(mShowExtrasAction); + tm.add(mLoadAllViewsAction); + } + + @Override + public void dispose() { + super.dispose(); + TreeViewModel.getModel().removeTreeChangeListener(this); + } + + @Override + public void setFocus() { + mLayoutViewer.setFocus(); + } + + @Override + public void selectionChanged() { + // pass + } + + @Override + public void treeChanged() { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + mLoadAllViewsAction.setEnabled(TreeViewModel.getModel().getTree() != null); + mShowExtrasAction.setEnabled(TreeViewModel.getModel().getTree() != null); + } + }); + } + + @Override + public void viewportChanged() { + // pass + } + + @Override + 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 000000000..93ad5986a --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/PixelPerfectLoupeView.java @@ -0,0 +1,171 @@ +/* + * 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.IImageChangeListener; +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 IImageChangeListener { + + public static final String ID = + "com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectLoupeView"; //$NON-NLS-1$ + + private PixelPerfectLoupe mPixelPerfectLoupe; + + private Action mShowInLoupeAction = new Action("&Show Overlay", Action.AS_CHECK_BOX) { + @Override + public void run() { + mPixelPerfectLoupe.setShowOverlay(isChecked()); + } + }; + @Override + public void createPartControl(Composite parent) { + mShowInLoupeAction.setAccelerator(SWT.MOD1 + 'S'); + ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class); + Image image = imageLoader.loadImage("show-overlay.png", Display.getDefault()); //$NON-NLS-1$ + mShowInLoupeAction.setImageDescriptor(ImageDescriptor.createFromImage(image)); + mShowInLoupeAction.setToolTipText("Show the overlay in the loupe view"); + mShowInLoupeAction.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); + + mPixelPerfectLoupe = new PixelPerfectLoupe(pixelPerfectLoupeBorder); + mPixelPerfectLoupe.setLayoutData(new GridData(GridData.FILL_BOTH)); + + PixelPerfectPixelPanel pixelPerfectPixelPanel = + new PixelPerfectPixelPanel(pixelPerfectLoupeBorder); + pixelPerfectPixelPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // https://code.google.com/p/android/issues/detail?id=69199 + // Disabled until accessibility issues are fixed + // 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(mShowInLoupeAction); + + IToolBarManager tm = actionBars.getToolBarManager(); + tm.removeAll(); + tm.add(PixelPerfectAutoRefreshAction.getAction()); + tm.add(mShowInLoupeAction); + } + + @Override + public void dispose() { + super.dispose(); + PixelPerfectModel.getModel().removeImageChangeListener(this); + } + + @Override + public void setFocus() { + mPixelPerfectLoupe.setFocus(); + } + + @Override + public void crosshairMoved() { + // pass + } + + @Override + public void treeChanged() { + // pass + } + + @Override + public void imageChanged() { + // pass + } + + @Override + public void imageLoaded() { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + Image overlayImage = PixelPerfectModel.getModel().getOverlayImage(); + mShowInLoupeAction.setEnabled(overlayImage != null); + } + }); + } + + @Override + public void overlayChanged() { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + mShowInLoupeAction + .setEnabled(PixelPerfectModel.getModel().getOverlayImage() != null); + } + }); + } + + @Override + public void overlayTransparencyChanged() { + // pass + } + + @Override + public void selectionChanged() { + // pass + } + + @Override + 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 000000000..f3591f7d4 --- /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"; //$NON-NLS-1$ + + private PixelPerfectTree mPixelPerfectTree; + + @Override + public void createPartControl(Composite parent) { + parent.setLayout(new FillLayout()); + mPixelPerfectTree = 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() { + mPixelPerfectTree.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 000000000..943a6c8af --- /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"; //$NON-NLS-1$ + + private PixelPerfect mPixelPerfect; + + @Override + public void createPartControl(Composite parent) { + parent.setLayout(new FillLayout()); + mPixelPerfect = 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() { + mPixelPerfect.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 000000000..74f50fdb2 --- /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"; //$NON-NLS-1$ + + private PropertyViewer mPropertyViewer; + + @Override + public void createPartControl(Composite parent) { + parent.setLayout(new FillLayout()); + + mPropertyViewer = new PropertyViewer(parent); + } + + @Override + public void setFocus() { + mPropertyViewer.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 000000000..e18771b79 --- /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"; //$NON-NLS-1$ + + private TreeViewOverview mTreeViewOverview; + @Override + public void createPartControl(Composite parent) { + parent.setLayout(new FillLayout()); + + mTreeViewOverview = new TreeViewOverview(parent); + } + + @Override + public void setFocus() { + mTreeViewOverview.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 000000000..98bd909d7 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/src/com/android/ide/eclipse/hierarchyviewer/views/TreeViewView.java @@ -0,0 +1,103 @@ +/* + * 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.DumpDisplayListAction; +import com.android.hierarchyviewerlib.actions.InvalidateAction; +import com.android.hierarchyviewerlib.actions.ProfileNodesAction; +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"; //$NON-NLS-1$ + + private TreeView mTreeView; + + @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()); + + mTreeView = 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()); + mm.add(DumpDisplayListAction.getAction()); + mm.add(ProfileNodesAction.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()); + tm.add(DumpDisplayListAction.getAction()); + tm.add(ProfileNodesAction.getAction()); + } + + + @Override + public void setFocus() { + mTreeView.setFocus(); + } + +} |