aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/features/com.android.ide.eclipse.adt.package/.project17
-rw-r--r--eclipse/features/com.android.ide.eclipse.adt.package/build.properties4
-rw-r--r--eclipse/features/com.android.ide.eclipse.adt.package/feature.xml150
-rw-r--r--eclipse/features/com.android.ide.eclipse.adt.package/p2.inf9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/.project22
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/go.css2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/ide.product48
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/index.html21
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml66
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/plugin_customization.ini7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/splash.bmpbin0 -> 10257 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtUtils.java43
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/SourceRevealer.java43
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java66
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/welcome/AdtStartup.java66
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.base/src/com/android/ide/eclipse/base/InstallDetails.java7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/AdtUtilsTest.java13
25 files changed, 583 insertions, 46 deletions
diff --git a/eclipse/features/com.android.ide.eclipse.adt.package/.project b/eclipse/features/com.android.ide.eclipse.adt.package/.project
new file mode 100644
index 0000000..1024cf0
--- /dev/null
+++ b/eclipse/features/com.android.ide.eclipse.adt.package/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>feature-adt-package</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.adt.package/build.properties b/eclipse/features/com.android.ide.eclipse.adt.package/build.properties
new file mode 100644
index 0000000..36ca16c
--- /dev/null
+++ b/eclipse/features/com.android.ide.eclipse.adt.package/build.properties
@@ -0,0 +1,4 @@
+bin.includes = feature.xml,\
+ p2.inf,\
+ ide.product
+includeLaunchers=false
diff --git a/eclipse/features/com.android.ide.eclipse.adt.package/feature.xml b/eclipse/features/com.android.ide.eclipse.adt.package/feature.xml
new file mode 100644
index 0000000..8bddc8e
--- /dev/null
+++ b/eclipse/features/com.android.ide.eclipse.adt.package/feature.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="com.android.ide.eclipse.adt.package"
+ label="Android IDE Package"
+ version="20.0.0.qualifier"
+ provider-name="The Android Open Source Project"
+ plugin="com.android.ide.eclipse.adt.package">
+
+ <description url="http://developer.android.com">
+ Android Developer Tools
+ </description>
+
+ <copyright>
+ Copyright (C) 2007-2012 The Android Open Source Project
+ </copyright>
+
+ <license url="http://www.eclipse.org/org/documents/epl-v10.php">
+ Note: kxml2-2.3.0.jar is under the BSD license rather ...
+ </license>
+
+ <url>
+ <update label="Android Update Site" url="https://dl-ssl.google.com/android/eclipse/"/>
+ </url>
+
+ <includes
+ id="org.eclipse.platform"
+ version="0.0.0"
+ search-location="both"/>
+
+ <requires>
+ <import feature="org.eclipse.platform"/>
+ <import plugin="org.eclipse.equinox.app"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import feature="org.eclipse.jdt" version="3.7.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ant.core"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.ui.editors"/>
+ <import plugin="org.eclipse.ui.workbench.texteditor"/>
+ <import plugin="org.eclipse.ui.console"/>
+ <import plugin="org.eclipse.core.filesystem"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.ui.forms"/>
+ <import plugin="org.eclipse.ui.browser"/>
+ <import plugin="org.eclipse.ui.views"/>
+ <import plugin="org.eclipse.wst.sse.core"/>
+ <import plugin="org.eclipse.wst.sse.ui"/>
+ <import plugin="org.eclipse.wst.xml.core"/>
+ <import plugin="org.eclipse.wst.xml.ui"/>
+ <import plugin="org.eclipse.jdt.junit"/>
+ <import plugin="org.eclipse.jdt.junit.runtime"/>
+ <import plugin="org.eclipse.ltk.core.refactoring"/>
+ <import plugin="org.eclipse.ltk.ui.refactoring"/>
+ <import plugin="org.eclipse.core.expressions"/>
+ <import feature="org.eclipse.platform"/>
+ <import feature="org.eclipse.jdt" version="3.7.0" match="greaterOrEqual"/>
+ <import feature="org.eclipse.platform"/>
+ <import feature="org.eclipse.jdt" version="3.7.0" match="greaterOrEqual"/>
+ <import feature="org.eclipse.equinox.p2.user.ui"/>
+ <import feature="org.eclipse.help"/>
+ <import feature="org.eclipse.platform"/>
+ <import feature="org.eclipse.rcp" version="3.7.0" match="greaterOrEqual"/>
+ <import feature="org.eclipse.jdt" version="3.7.0" match="greaterOrEqual"/>
+ <import feature="org.eclipse.wst.common_core.feature" version="3.2.3.v201011031800-7B7DFEsF7RZHOaLfS0KpNJ"/>
+ <import feature="org.eclipse.wst.common_ui.feature" version="3.2.3.v201011031800-7C78FPlEdhO_oXWe4k_elbMgT1Lq"/>
+ <import feature="org.eclipse.wst.xml_core.feature" version="3.2.3.v201102160550-7C7OFXcF7RZHQKIkMxMsW_"/>
+ <import feature="org.eclipse.wst.xml_ui.feature" version="3.2.3.v201102160550-7H7AFUWDxumQJOi9ghcTb5YgkwEZ"/>
+ <import plugin="org.eclipse.core.variables"/>
+ <import plugin="org.eclipse.cdt.core"/>
+ <import plugin="org.eclipse.cdt.ui"/>
+ <import plugin="org.eclipse.cdt.managedbuilder.core"/>
+ <import plugin="org.eclipse.cdt.managedbuilder.ui"/>
+ <import plugin="org.eclipse.cdt.debug.core"/>
+ <import plugin="org.eclipse.cdt.debug.ui"/>
+ <import plugin="org.eclipse.cdt.dsf"/>
+ <import plugin="org.eclipse.cdt.dsf.gdb"/>
+ <import plugin="org.eclipse.cdt.dsf.gdb.ui"/>
+ <import plugin="org.eclipse.cdt.launch"/>
+ </requires>
+
+ <plugin
+ id="com.android.ide.eclipse.adt.package"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="true"/>
+
+ <plugin
+ id="com.android.ide.eclipse.adt"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.android.ide.eclipse.base"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.android.ide.eclipse.ddms"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.android.ide.eclipse.gldebugger"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.android.ide.eclipse.hierarchyviewer"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.android.ide.eclipse.traceview"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="overlay.com.android.ide.eclipse.adt.overlay"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.android.ide.eclipse.ndk"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/eclipse/features/com.android.ide.eclipse.adt.package/p2.inf b/eclipse/features/com.android.ide.eclipse.adt.package/p2.inf
new file mode 100644
index 0000000..cabaa55
--- /dev/null
+++ b/eclipse/features/com.android.ide.eclipse.adt.package/p2.inf
@@ -0,0 +1,9 @@
+#tell pde.build not to generate start levels
+org.eclipse.pde.build.append.startlevels=false
+
+requires.1.namespace=org.eclipse.equinox.p2.iu
+requires.1.name=org.eclipse.platform.ide
+requires.1.greedy=true
+
+instructions.configure=\
+org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//dl-ssl.google.com/android/eclipse/,type:0,name:Android Developer Tools Update Site,enabled:true);
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/.project b/eclipse/plugins/com.android.ide.eclipse.adt.package/.project
new file mode 100644
index 0000000..eedf4c6
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>plugin-adt-package</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <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>
+ </natures>
+</projectDescription>
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..752f749
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ADT Package
+Bundle-SymbolicName: com.android.ide.eclipse.adt.package;singleton:=true
+Bundle-Version: 20.0.0.qualifier
+Bundle-Vendor: The Android Open Source Project
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.platform,
+ org.eclipse.equinox.app,
+ org.eclipse.ui.intro
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties b/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties
new file mode 100644
index 0000000..1e6342e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties
@@ -0,0 +1,8 @@
+bin.includes = META-INF/,\
+ plugin.xml,\
+ plugin_customization.ini,\
+ ide.product,\
+ splash.bmp,\
+ introcontent.xml,\
+ go.css,\
+ index.html
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/go.css b/eclipse/plugins/com.android.ide.eclipse.adt.package/go.css
new file mode 100644
index 0000000..15ba70b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/go.css
@@ -0,0 +1,2 @@
+/* Copy of www.google.com/css/go.css */
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,700&subset=latin,cyrillic-ext,greek-ext,cyrillic,greek,vietnamese,latin-ext);@media screen,projection,print{html,input,textarea{font-family:arial,sans-serif}html{line-height:1.54}body.rtl{direction:rtl}body.rtl th{text-align:right}h5,h6,pre,table,input,textarea,code{font-size:1em}address,abbr,cite{font-style:normal}table{border-collapse:collapse;border-spacing:0}th{text-align:left}fieldset,iframe,img{border:0}label input,#nav li a{font-weight:normal}label{display:block;margin:13px 0 3px}q{quotes:none}}@media screen,projection{* html{direction:ltr}*+html{direction:ltr}*+html body.rtl{max-width:none}html{background:#fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAABECAMAAAB3Xq9kAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoyNzA2QjJCMzE5NjQxMUUxOTQ0MEE1NkNFNDk5NjQ2RCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyNzA2QjJCNDE5NjQxMUUxOTQ0MEE1NkNFNDk5NjQ2RCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjI3MDZCMkIxMTk2NDExRTE5NDQwQTU2Q0U0OTk2NDZEIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjI3MDZCMkIyMTk2NDExRTE5NDQwQTU2Q0U0OTk2NDZEIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+AZql4QAAAAZQTFRF7+/v////ZlM36gAAAAJ0Uk5T/wDltzBKAAAAEElEQVR42mJgZBgMkAEgwAASlwBE7N+9ZgAAAABJRU5ErkJggg==) repeat-x;color:#444;font-size:13px;padding-top:5px}body,table,fieldset,#nav{margin:0}body{max-width:1000px;padding:15px}body.rtl h1 img,body.rtl #nav{float:right}body.rtl h1 img{margin:0 0 0 43px}body.rtl #nav ul,body.rtl #nav ol{margin:13px 13px 0 0}* html body.rtl #about li{margin:0 0 0 13px}*+html body.rtl #about li{margin:0 0 0 13px}body.rtl #aux{margin:0 160px 0 0}body.compact{margin:auto;width:740px}*>body.compact{max-width:740px;width:auto}h1,h2,h3,h4,h5,blockquote,q{font-family:'open sans',arial,sans-serif}h1{color:#91959c;font-size:27px;font-weight:300;height:51px;line-height:1.26;margin:0 0 25px;overflow:hidden}h1 img,#nav{float:left}h1 img{margin:0 43px 0 0;position:relative}h1 img[src$='logo_sm.gif']{width:116px}h2,h3,h4,h5{margin:20px 0 10px}h2{font-size:21px}h2:first-child,p+table,table+p{margin-top:0}h3{font-size:16px;line-height:1.56}h4{font-size:14px;line-height:1.57}h6{margin:10px 0 -10px}p,pre,table,form{margin:10px 0}blockquote,ul,ol{margin-bottom:10px;margin-top:10px}blockquote,q{font-style:italic}pre strong,pre b,a strong,a b,a code{color:inherit}pre,code{color:#060;font:13px/1.54 'courier new',courier,monospace}th,td{padding-right:10px;vertical-align:top}fieldset,#about,#nav,#nav ul,#nav ol{padding:0}legend{display:none}label,em,i,#nav li{font-weight:bold}a:link,a:visited{text-decoration:none}a:link{color:#15c}a:visited{color:#7847b2}a:focus,a:hover,a:active{text-decoration:underline}strong,b{color:#000}em,i{font-style:normal}#about,#nav,#nav *{list-style:none}#about{clear:both;font-size:11px;color:#666;line-height:1.8;margin:26px 0 0}#about li{display:inline}#about li:before{content:' · '}#about li:first-child:before{content:none}* html #about li{margin:0 13px 0 0}*+html #about li{margin:0 13px 0 0}#nav{width:142px}#nav ul,#nav ol{margin:10px 0 0 13px}#nav li{margin:0 0 10px}#aux{margin:0 0 0 160px}}@media screen and (max-width:772px){html{background-image:none}body.rtl #nav li{margin-left:10px;margin-right:0}h1,#aux{margin:0 !important}h1{height:auto}h1 img,#nav{float:none !important}h1 img{display:block}#nav{margin-bottom:13px;width:auto !important}#nav ul,#nav ol{display:none}#nav li{display:inline;margin-right:10px}}@media print{h1 img{display:block}a{color:inherit}#nav{display:none}}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/ide.product b/eclipse/plugins/com.android.ide.eclipse.adt.package/ide.product
new file mode 100644
index 0000000..645beaf
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/ide.product
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?pde version="3.5"?>
+
+<product name="Eclipse IDE for Android" uid="com.android.ide.eclipse.adt.package.product" id="com.android.ide.eclipse.adt.package.product" application="org.eclipse.ui.ide.workbench" version="20.0.0.qualifier" useFeatures="true" includeLaunchers="true">
+
+
+ <configIni use="default">
+ </configIni>
+
+ <launcherArgs>
+ <programArgs>-product com.android.ide.eclipse.adt.package.product</programArgs>
+ <programArgsWin>--launcher.XXMaxPermSize 256M</programArgsWin>
+ <vmArgs>-Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m</vmArgs>
+ <vmArgsLin>-XX:MaxPermSize=256m</vmArgsLin>
+ <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
+ </launcherArgs>
+
+ <windowImages/>
+
+ <splash
+ location="com.android.ide.eclipse.adt.package" />
+ <launcher>
+ <solaris/>
+ <win useIco="false">
+ <bmp/>
+ </win>
+ </launcher>
+
+
+ <vm>
+ <linux include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6</linux>
+ <macos include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6</macos>
+ <windows include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6</windows>
+ </vm>
+
+
+ <plugins>
+ </plugins>
+
+ <features>
+ <feature id="com.android.ide.eclipse.adt.package" version="20.0.0.qualifier"/>
+ </features>
+
+ <configurations>
+ <property name="eclipse.product" value="com.android.ide.eclipse.adt.package.product" />
+ </configurations>
+
+</product>
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/index.html b/eclipse/plugins/com.android.ide.eclipse.adt.package/index.html
new file mode 100644
index 0000000..ba9a748
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/index.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+ <html lang="en">
+ <meta charset="utf-8">
+ <title>Eclipse for Android Developers</title>
+ <link rel="stylesheet" href="go.css">
+
+ <body class="compact">
+ <h1>Eclipse for Android Developers</h1>
+
+ <h2>Getting Started</h2>
+ <h2>What's New?</h2>
+ <h2>Documentation</h2>
+ <ul>
+ <li> <a href="http://d.android.com/">Android Developers</a>
+ </ul>
+ <h2>Known Issues</h2>
+
+ <ul id="about">
+ <li>© Android Open Source Project
+ <li>2012
+ </ul>
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml b/eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml
new file mode 100644
index 0000000..65d226f
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<introContent>
+ <page
+ id="root"
+ url="index.html"/>
+ <page
+ id="standbyPageId"
+ url="index.html"/>
+</introContent> \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml
new file mode 100644
index 0000000..3359ee0
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="product"
+ point="org.eclipse.core.runtime.products">
+ <product
+ application="org.eclipse.ui.ide.workbench"
+ name="Eclipse IDE for Android">
+ <property
+ name="preferenceCustomization"
+ value="plugin_customization.ini" />
+ <property
+ name="appName"
+ value="Eclipse IDE for Android" />
+ <property
+ name="introTitle"
+ value="Eclipse IDE for Android" />
+ <property
+ name="introBrandingImage"
+ value="product:eclipse.png" />
+ <property
+ name="introBrandingImageText"
+ value="AOSP" />
+ <property
+ name="startupProgressRect"
+ value="10,250,200,5" />
+ <property
+ name="startupMessageRect"
+ value="10,260,300,30" />
+ <property
+ name="startupForegroundColor"
+ value="AAAAAA" />
+ </product>
+ </extension>
+ <extension
+ point="org.eclipse.ui.intro">
+ <intro
+ class="org.eclipse.ui.intro.config.CustomizableIntroPart"
+ icon="$nl$/icons/image_obj.gif"
+ id="org.eclipse.intro.minimal"
+ label="Android IDE"/>
+ </extension>
+ <extension
+ point="org.eclipse.ui.intro.config">
+ <config
+ content="introcontent.xml"
+ id="org.eclipse.intro.minimal.config"
+ introId="org.eclipse.intro.minimal">
+ <presentation
+ home-page-id="root"
+ standby-page-id="standby">
+ <implementation
+ kind="html">
+ </implementation>
+ </presentation>
+ </config>
+ </extension>
+ <extension
+ point="org.eclipse.ui.intro">
+ <introProductBinding
+ introId="org.eclipse.intro.minimal"
+ productId="com.android.ide.eclipse.adt.package.product">
+ </introProductBinding>
+ </extension>
+</plugin>
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin_customization.ini b/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin_customization.ini
new file mode 100644
index 0000000..50c3948
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin_customization.ini
@@ -0,0 +1,7 @@
+org.eclipse.ui/defaultPerspectiveId=org.eclipse.jdt.ui.JavaPerspective
+org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false
+org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight
+org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true
+org.eclipse.ui.intro/INTRO_THEME = org.eclipse.ui.intro.universal.slate
+org.eclipse.ui.intro.universal/INTRO_ROOT_PAGES=overview,tutorials,samples,whatsnew,migrate,webresources
+org.eclipse.ui.intro.universal/INTRO_DATA = product:introData.xml \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/splash.bmp b/eclipse/plugins/com.android.ide.eclipse.adt.package/splash.bmp
new file mode 100644
index 0000000..80dd82e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/splash.bmp
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtUtils.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtUtils.java
index 40d5e6f..cf79c90 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtUtils.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtUtils.java
@@ -1360,4 +1360,47 @@ public class AdtUtils {
return AdtPlugin.getDisplay() != null
&& AdtPlugin.getDisplay().getThread() == Thread.currentThread();
}
+
+ /**
+ * Replaces any {@code \\uNNNN} references in the given string with the corresponding
+ * unicode characters.
+ *
+ * @param s the string to perform replacements in
+ * @return the string with unicode escapes replaced with actual characters
+ */
+ @NonNull
+ public static String replaceUnicodeEscapes(@NonNull String s) {
+ // Handle unicode escapes
+ if (s.indexOf("\\u") != -1) { //$NON-NLS-1$
+ StringBuilder sb = new StringBuilder(s.length());
+ for (int i = 0, n = s.length(); i < n; i++) {
+ char c = s.charAt(i);
+ if (c == '\\' && i < n - 1) {
+ char next = s.charAt(i + 1);
+ if (next == 'u' && i < n - 5) { // case sensitive
+ String hex = s.substring(i + 2, i + 6);
+ try {
+ int unicodeValue = Integer.parseInt(hex, 16);
+ sb.append((char) unicodeValue);
+ i += 5;
+ continue;
+ } catch (NumberFormatException nufe) {
+ // Invalid escape: Just proceed to literally transcribe it
+ sb.append(c);
+ }
+ } else {
+ sb.append(c);
+ sb.append(next);
+ i++;
+ continue;
+ }
+ } else {
+ sb.append(c);
+ }
+ }
+ s = sb.toString();
+ }
+
+ return s;
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/SourceRevealer.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/SourceRevealer.java
index 85f6992..b1b5390 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/SourceRevealer.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/SourceRevealer.java
@@ -16,6 +16,7 @@
package com.android.ide.eclipse.adt;
+import static com.android.SdkConstants.CLASS_CONSTRUCTOR;
import static com.android.SdkConstants.CONSTRUCTOR_NAME;
import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
@@ -31,8 +32,10 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.SearchEngine;
@@ -138,9 +141,15 @@ public class SourceRevealer implements ISourceRevealer {
// See if the line number looks like it's inside the given method
ISourceRange sourceRange = method.getSourceRange();
IRegion region = AdtUtils.getRegionOfLine(file, lineNumber - 1);
- if (region != null
- && region.getOffset() >= sourceRange.getOffset()
- && region.getOffset() < sourceRange.getOffset()
+ // When fields are initialized with code, this logically belongs
+ // to the constructor, but the line numbers are outside of the
+ // constructor. In this case we'll trust the line number rather
+ // than the method range.
+ boolean isConstructor = fqmn.endsWith(CONSTRUCTOR_NAME);
+ if (isConstructor
+ || region != null
+ && region.getOffset() >= sourceRange.getOffset()
+ && region.getOffset() < sourceRange.getOffset()
+ sourceRange.getLength()) {
// Yes: use the line number instead
if (perspective != null) {
@@ -167,6 +176,29 @@ public class SourceRevealer implements ISourceRevealer {
if (fileMatches.size() > 0) {
return revealLineMatch(fileMatches, fileName, lineNumber, perspective);
} else {
+ // Last ditch effort: attempt to look up the class corresponding to the fqn
+ // and jump to the line there
+ if (fileMatches.isEmpty() && fqmn.indexOf('.') != -1) {
+ String className = fqmn.substring(0, fqmn.lastIndexOf('.'));
+ for (IJavaProject project : BaseProjectHelper.getAndroidProjects(null)) {
+ IType type;
+ try {
+ type = project.findType(className);
+ if (type != null && type.exists()) {
+ IResource resource = type.getResource();
+ if (resource instanceof IFile) {
+ if (perspective != null) {
+ SourceRevealer.switchToPerspective(perspective);
+ }
+ return displayFile((IFile) resource, lineNumber);
+ }
+ }
+ } catch (JavaModelException e) {
+ AdtPlugin.log(e, null);
+ }
+ }
+ }
+
return false;
}
}
@@ -349,6 +381,11 @@ public class SourceRevealer implements ISourceRevealer {
return searchForPattern(fqmn, IJavaSearchConstants.CONSTRUCTOR,
MATCH_IS_METHOD_PREDICATE);
}
+ if (fqmn.endsWith(CLASS_CONSTRUCTOR)) {
+ // Don't try to search for class init methods: Eclipse will throw NPEs if you do
+ return Collections.emptyList();
+ }
+
return searchForPattern(fqmn, IJavaSearchConstants.METHOD, MATCH_IS_METHOD_PREDICATE);
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java
index fe0863c..f3a3d57 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java
@@ -937,7 +937,7 @@ public class BuildHelper {
entry.getPath(), javaProject);
// ignore the system and default_system types as they represent
// libraries that are part of the runtime.
- if (container.getKind() == IClasspathContainer.K_APPLICATION) {
+ if (container != null && container.getKind() == IClasspathContainer.K_APPLICATION) {
IClasspathEntry[] entries = container.getClasspathEntries();
for (IClasspathEntry cpe : entries) {
handleCPE(cpe, javaProject, wsRoot, resMarker);
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java
index 5373002..e5b5a43 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PostCompilerBuilder.java
@@ -732,7 +732,6 @@ public class PostCompilerBuilder extends BaseBuilder {
private static class JarBuilder implements IArchiveBuilder {
private static Pattern R_PATTERN = Pattern.compile("R(\\$.*)?\\.class"); //$NON-NLS-1$
- private static Pattern MANIFEST_PATTERN = Pattern.compile("Manifest(\\$.*)?\\.class"); //$NON-NLS-1$
private static String BUILD_CONFIG_CLASS = "BuildConfig.class"; //$NON-NLS-1$
private final byte[] buffer = new byte[1024];
@@ -757,7 +756,6 @@ public class PostCompilerBuilder extends BaseBuilder {
// Ignore the library's R/Manifest/BuildConfig classes.
if (mAppPackage.equals(packageApp.toString()) &&
(BUILD_CONFIG_CLASS.equals(name) ||
- MANIFEST_PATTERN.matcher(name).matches() ||
R_PATTERN.matcher(name).matches())) {
return;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java
index 9ad2e32..51ae496 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java
@@ -48,10 +48,14 @@ import com.android.manifmerger.MergerLog;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.internal.build.BuildConfigGenerator;
+import com.android.sdklib.internal.build.SymbolLoader;
+import com.android.sdklib.internal.build.SymbolWriter;
import com.android.sdklib.internal.project.ProjectProperties;
import com.android.sdklib.io.FileOp;
import com.android.utils.ILogger;
+import com.android.utils.Pair;
import com.android.xml.AndroidManifest;
+import com.google.common.collect.Lists;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -931,8 +935,8 @@ public class PreCompilerBuilder extends BaseBuilder {
IFolder mainPackageFolder = getGenManifestPackageFolder();
// handle libraries
- ArrayList<IFolder> libResFolders = new ArrayList<IFolder>();
- StringBuilder libJavaPackages = null;
+ ArrayList<IFolder> libResFolders = Lists.newArrayList();
+ ArrayList<Pair<File, String>> libRFiles = Lists.newArrayList();
if (libProjects != null) {
for (IProject lib : libProjects) {
IFolder libResFolder = lib.getFolder(SdkConstants.FD_RES);
@@ -941,31 +945,29 @@ public class PreCompilerBuilder extends BaseBuilder {
}
try {
+ // get the package of the library, and if it's different form the
+ // main project, generate the R class for it too.
String libJavaPackage = AndroidManifest.getPackage(new IFolderWrapper(lib));
if (libJavaPackage.equals(javaPackage) == false) {
- if (libJavaPackages == null) {
- libJavaPackages = new StringBuilder(libJavaPackage);
- } else {
- libJavaPackages.append(":");
- libJavaPackages.append(libJavaPackage);
- }
+
+ IFolder libOutput = BaseProjectHelper.getAndroidOutputFolder(lib);
+ File libOutputFolder = libOutput.getLocation().toFile();
+
+ libRFiles.add(Pair.of(
+ new File(libOutputFolder, "R.txt"),
+ libJavaPackage));
+
}
} catch (Exception e) {
}
}
}
- String libPackages = null;
- if (libJavaPackages != null) {
- libPackages = libJavaPackages.toString();
-
- }
-
String proguardFilePath = proguardFile != null ?
proguardFile.getLocation().toOSString(): null;
execAapt(project, projectTarget, osOutputPath, osResPath, osManifestPath,
- mainPackageFolder, libResFolders, libPackages, isLibrary, proguardFilePath);
+ mainPackageFolder, libResFolders, libRFiles, isLibrary, proguardFilePath);
}
}
@@ -982,16 +984,15 @@ public class PreCompilerBuilder extends BaseBuilder {
* If <var>customJavaPackage</var> is not null, this must match the new destination triggered
* by its value.
* @param libResFolders the list of res folders for the library.
- * @param libraryPackages an optional list of javapackages to replace the main project java
- * package. can be null.
+ * @param libRFiles a list of R files for the libraries.
* @param isLibrary if the project is a library project
* @param proguardFile an optional path to store proguard information
* @throws AbortBuildException
*/
private void execAapt(IProject project, IAndroidTarget projectTarget, String osOutputPath,
String osResPath, String osManifestPath, IFolder packageFolder,
- ArrayList<IFolder> libResFolders, String libraryPackages, boolean isLibrary,
- String proguardFile)
+ ArrayList<IFolder> libResFolders, List<Pair<File, String>> libRFiles,
+ boolean isLibrary, String proguardFile)
throws AbortBuildException {
// We actually need to delete the manifest.java as it may become empty and
@@ -1021,10 +1022,13 @@ public class PreCompilerBuilder extends BaseBuilder {
array.add("--auto-add-overlay"); //$NON-NLS-1$
}
- // there's no need to generate the R class of the libraries if this is a library too.
- if (isLibrary == false && libraryPackages != null) {
- array.add("--extra-packages"); //$NON-NLS-1$
- array.add(libraryPackages);
+ // If a library or has libraries, generate a text version of the R symbols.
+ File outputFolder = BaseProjectHelper.getAndroidOutputFolder(project).getLocation()
+ .toFile();
+
+ if (isLibrary || !libRFiles.isEmpty()) {
+ array.add("--output-text-symbols"); //$NON-NLS-1$
+ array.add(outputFolder.getAbsolutePath());
}
array.add("-J"); //$NON-NLS-1$
@@ -1103,6 +1107,22 @@ public class PreCompilerBuilder extends BaseBuilder {
// abort if exec failed.
throw new AbortBuildException();
}
+
+ // now if the project has libraries, R needs to be created for each libraries
+ if (!libRFiles.isEmpty()) {
+ SymbolLoader symbolValues = new SymbolLoader(new File(outputFolder, "R.txt"));
+ symbolValues.load();
+
+ for (Pair<File, String> libData : libRFiles) {
+ SymbolLoader symbols = new SymbolLoader(libData.getFirst());
+ symbols.load();
+
+ SymbolWriter writer = new SymbolWriter(osOutputPath, libData.getSecond(),
+ symbols, symbolValues);
+ writer.write();
+ }
+ }
+
} catch (IOException e1) {
// something happen while executing the process,
// mark the project and exit
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java
index 0eee47a..c30574b 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ContextPullParser.java
@@ -28,6 +28,7 @@ import static com.android.ide.eclipse.adt.internal.editors.layout.gle2.LayoutMet
import com.android.SdkConstants;
import com.android.ide.common.rendering.api.ILayoutPullParser;
import com.android.ide.common.rendering.api.IProjectCallback;
+import com.android.ide.eclipse.adt.AdtUtils;
import com.android.ide.eclipse.adt.internal.editors.layout.gle2.LayoutMetadata;
import org.kxml2.io.KXmlParser;
@@ -118,6 +119,11 @@ public class ContextPullParser extends KXmlParser implements ILayoutPullParser {
return VALUE_FILL_PARENT;
}
+ // Handle unicode escapes
+ if (value.indexOf('\\') != -1) {
+ value = AdtUtils.replaceUnicodeEscapes(value);
+ }
+
return value;
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java
index 53f1e6b..de09d00 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java
@@ -29,6 +29,7 @@ import static com.android.SdkConstants.VIEW_INCLUDE;
import com.android.ide.common.rendering.api.ILayoutPullParser;
import com.android.ide.common.rendering.api.ViewInfo;
+import com.android.ide.eclipse.adt.AdtUtils;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor;
import com.android.ide.eclipse.adt.internal.editors.layout.gle2.FragmentMenu;
@@ -393,6 +394,11 @@ public class UiElementPullParser extends BasePullParser {
return VALUE_FILL_PARENT;
}
+ // Handle unicode escapes
+ if (value.indexOf('\\') != -1) {
+ value = AdtUtils.replaceUnicodeEscapes(value);
+ }
+
return value;
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
index ed93b73..55cad2b 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
@@ -409,7 +409,7 @@ public class ManifestInfo {
* Returns the minimum SDK version name (which may not be a numeric string, e.g.
* it could be a codename). It will never be null or empty; if no min sdk version
* was specified in the manifest, the return value will be "1". Use
- * {@link #getCodeName()} instead if you want to look up whether there is a code name.
+ * {@link #getMinSdkCodeName()} instead if you want to look up whether there is a code name.
*
* @return the minimum SDK version
*/
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/welcome/AdtStartup.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/welcome/AdtStartup.java
index 5e69e6f..8d8b688 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/welcome/AdtStartup.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/welcome/AdtStartup.java
@@ -31,10 +31,12 @@ import com.android.sdkstats.SdkStatsService;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbench;
@@ -69,6 +71,10 @@ public class AdtStartup implements IStartup, IWindowListener {
@Override
public void earlyStartup() {
+ if (InstallDetails.isAndroidIdePackage()) {
+ useBundledSdk();
+ }
+
if (isFirstTime()) {
showWelcomeWizard();
// Usage statistics are sent after the wizard has run asynchronously (provided the
@@ -82,6 +88,32 @@ public class AdtStartup implements IStartup, IWindowListener {
AdtPlugin.getDefault().workbenchStarted();
}
+ private void useBundledSdk() {
+ String osSdkFolder = AdtPrefs.getPrefs().getOsSdkFolder();
+
+ // sdk path is already set
+ if (osSdkFolder != null && osSdkFolder.length() > 0) {
+ return;
+ }
+
+ // The Android IDE bundle is structured as follows:
+ // root
+ // |--eclipse
+ // |--sdk
+ // So use the SDK folder that is
+ Location install = Platform.getInstallLocation();
+ if (install != null && install.getURL() != null) {
+ String toolsFolder = new File(install.getURL().getFile()).getParent();
+ if (toolsFolder != null) {
+ String osSdkPath = toolsFolder + File.separator + "sdk";
+ if (AdtPlugin.getDefault().checkSdkLocationAndId(osSdkPath,
+ new SdkValidator())) {
+ AdtPrefs.getPrefs().setSdkLocation(new File(osSdkPath));
+ }
+ }
+ }
+ }
+
private boolean isFirstTime() {
// If we already have a known SDK location in our workspace then we know this
// is not the first time this user is running ADT.
@@ -112,22 +144,8 @@ public class AdtStartup implements IStartup, IWindowListener {
if (ok) {
// Verify that the SDK is valid
- ok = AdtPlugin.getDefault().checkSdkLocationAndId(osSdkPath,
- new AdtPlugin.CheckSdkErrorHandler() {
- @Override
- public boolean handleError(
- CheckSdkErrorHandler.Solution solution,
- String message) {
- return false;
- }
-
- @Override
- public boolean handleWarning(
- CheckSdkErrorHandler.Solution solution,
- String message) {
- return true;
- }
- });
+ ok = AdtPlugin.getDefault().checkSdkLocationAndId(
+ osSdkPath, new SdkValidator());
if (ok) {
// Yes, we've seen an SDK location before and we can use it again,
// no need to pester the user with the welcome wizard.
@@ -144,6 +162,22 @@ public class AdtStartup implements IStartup, IWindowListener {
return !mStore.isAdtUsed();
}
+ private static class SdkValidator extends AdtPlugin.CheckSdkErrorHandler {
+ @Override
+ public boolean handleError(
+ CheckSdkErrorHandler.Solution solution,
+ String message) {
+ return false;
+ }
+
+ @Override
+ public boolean handleWarning(
+ CheckSdkErrorHandler.Solution solution,
+ String message) {
+ return true;
+ }
+ }
+
private String getSdkPathFromWindowsRegistry() {
if (SdkConstants.CURRENT_PLATFORM != SdkConstants.PLATFORM_WINDOWS) {
return null;
diff --git a/eclipse/plugins/com.android.ide.eclipse.base/src/com/android/ide/eclipse/base/InstallDetails.java b/eclipse/plugins/com.android.ide.eclipse.base/src/com/android/ide/eclipse/base/InstallDetails.java
index 8c4a4a7..71eccbf 100644
--- a/eclipse/plugins/com.android.ide.eclipse.base/src/com/android/ide/eclipse/base/InstallDetails.java
+++ b/eclipse/plugins/com.android.ide.eclipse.base/src/com/android/ide/eclipse/base/InstallDetails.java
@@ -23,6 +23,7 @@ import org.osgi.framework.Version;
public class InstallDetails {
private static final String ADT_PLUGIN_ID = "com.android.ide.eclipse.adt"; //$NON-NLS-1$
private static final String ECLIPSE_PLATFORM_PLUGIN_ID = "org.eclipse.platform"; //$NON-NLS-1$
+ private static final String ADT_PRODUCT_PLUGIN_ID = "com.android.ide.eclipse.adt.package"; //$NON-NLS-1$
/**
* Returns true if the ADT plugin is available in the current platform. This is useful
@@ -38,4 +39,10 @@ public class InstallDetails {
Bundle b = Platform.getBundle(ECLIPSE_PLATFORM_PLUGIN_ID);
return b == null ? Version.emptyVersion : b.getVersion();
}
+
+ /** Returns true if this is the "Eclipse for Android Developers" product. */
+ public static boolean isAndroidIdePackage() {
+ Bundle b = Platform.getBundle(ADT_PRODUCT_PLUGIN_ID);
+ return b != null;
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/AdtUtilsTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/AdtUtilsTest.java
index e0ebdbc..0d4e02e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/AdtUtilsTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/AdtUtilsTest.java
@@ -174,4 +174,17 @@ public class AdtUtilsTest extends TestCase {
Locale.setDefault(originalDefaultLocale);
}
}
+
+ public void testEscapeUnicodeChars() throws Exception {
+ assertEquals("", AdtUtils.replaceUnicodeEscapes(""));
+ assertEquals("foo bar", AdtUtils.replaceUnicodeEscapes("foo bar"));
+ assertEquals("\u25C0", AdtUtils.replaceUnicodeEscapes("\\u25C0"));
+ assertEquals("!\u25C0\u25C1!", AdtUtils.replaceUnicodeEscapes("!\\u25C0\\u25C1!"));
+ assertEquals("\u1234\\", AdtUtils.replaceUnicodeEscapes("\\u1234\\"));
+
+ assertEquals("\\U25C0", AdtUtils.replaceUnicodeEscapes("\\U25C0")); // no unicode expand
+ assertEquals("\\u25C", AdtUtils.replaceUnicodeEscapes("\\u25C")); // no unicode expand
+ assertEquals("\\\\u25C0", AdtUtils.replaceUnicodeEscapes("\\\\u25C0")); // escaped
+ assertEquals("\\u123\\", AdtUtils.replaceUnicodeEscapes("\\u123\\")); // broken
+ }
}