diff options
author | Siva Velusamy <vsiva@google.com> | 2013-04-10 14:43:12 -0700 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2013-04-10 16:06:41 -0700 |
commit | 69bbb07d4fcb792cf85a45d3a98fce96e5766e9d (patch) | |
tree | 35b364863211baa145181643f55bc6b570b53cf2 /eclipse/plugins | |
parent | fd6393b79bd259be60ccb6299b3113138e17a6be (diff) | |
download | sdk-69bbb07d4fcb792cf85a45d3a98fce96e5766e9d.zip sdk-69bbb07d4fcb792cf85a45d3a98fce96e5766e9d.tar.gz sdk-69bbb07d4fcb792cf85a45d3a98fce96e5766e9d.tar.bz2 |
Use custom form layout for Eclipse intro.
The current intro mechanism suffers from a number of issues
around html rendering. The URL links don't work on a bunch
of different platforms as per bug 41109.
https://code.google.com/p/android/issues/detail?id=41109
This CL uses SWT forms to render a simple page that provides:
1. A button that opens the new project wizard.
2. Links to documentation for first time users.
Change-Id: I9b5cf921b3cceb666e4e181e9e84109597731523
Diffstat (limited to 'eclipse/plugins')
10 files changed, 199 insertions, 301 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/.classpath b/eclipse/plugins/com.android.ide.eclipse.adt.package/.classpath new file mode 100644 index 0000000..522e779 --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/.classpath @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> + diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/.project b/eclipse/plugins/com.android.ide.eclipse.adt.package/.project index eedf4c6..50d3fd1 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt.package/.project +++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/.project @@ -6,6 +6,11 @@ </projects> <buildSpec> <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> <name>org.eclipse.pde.ManifestBuilder</name> <arguments> </arguments> @@ -18,5 +23,6 @@ </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.adt.package/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF index 91594bb..bdbc7ea 100644 --- 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 @@ -7,4 +7,11 @@ 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 + org.eclipse.ui.intro, + org.eclipse.ui.workbench, + org.eclipse.swt, + org.eclipse.core.runtime, + org.eclipse.core.commands, + org.eclipse.ui.forms, + org.eclipse.jface, + com.android.ide.eclipse.adt diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties b/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties index aef2e25..ad2df37 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties +++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties @@ -1,13 +1,13 @@ +source.. = src/ +output.. = bin/ bin.includes = META-INF/,\ plugin.xml,\ + .,\ plugin_customization.ini,\ ide.product,\ adt-about.png,\ about.mappings,\ splash.bmp,\ icons/,\ - index.html,\ - introcontent.xml,\ about.ini,\ - about.properties,\ - welcome.css + about.properties diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/index.html b/eclipse/plugins/com.android.ide.eclipse.adt.package/index.html deleted file mode 100644 index e70fbcb..0000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt.package/index.html +++ /dev/null @@ -1,91 +0,0 @@ -<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <title>Welcome to the Android Developer Tools</title>
- <link rel="stylesheet" type="text/css" href="welcome.css" />
-</head>
-
-<body> - -<div class="wrap"> - - <div class="col-15"> - <h1>Welcome!</h1> - - <p>The <b>Android Developer Tools</b> provide a first-class development - environment for building Android apps. This integrated development environment is - set up with the latest version of the Android platform and system image so you can immediately begin - building apps and running them on the Android emulator.</p> - - - <p>To start a new Android app project:</p> - <ol> - <li>Click <strong>File > New > Android Application Project</strong>. - <br>(If you don't see this option, click <strong>File > New > Other</strong>, - then open the <strong>Android</strong> - folder and select <strong>Android Application Project</strong>.)</li> - <li>Follow the wizard to set up your new Android app project.</li> - </ol> - <p>For a complete walkthrough that shows how to create a new - project and build a simple app, read <a target="_blank" - href="http://developer.android.com/training/basics/firstapp/index.html">Building Your First App</a>.</p> - - <p>To set up a real Android device for testing your app, read - <a target="_blank" href="http://developer.android.com/tools/device.html">Using Hardware Devices</a>. - If you don't have a device and need to use the emulator, read <a - target="_blank" href="http://developer.android.com/tools/devices/index.html" - >Managing Virtual Devices</a>.</p> - - <p>Although your Android SDK already includes the latest version of the platform and system image, - you may later want to install other Android versions or packages such as the - <a target="_blank" href="http://developer.android.com/tools/extras/support-library.html">Android Support Library</a>. - For help installing additional packages, read - <a target="_blank" href="http://developer.android.com/sdk/installing/adding-packages.html">Adding Platforms - and Packages</a>.</p> - - </div> - -</div> - - -<div class="wrap"> - - <div class="col-5"> - <a target="_blank" href="http://developer.android.com/training/basics/firstapp/index.html"> - <div class="feature-box"> - <h2>Build Your First App »</h2> - <p>If you're new to Android, follow this class - to learn the fundamental Android APIs for creating - a user interface that responds to input.</p> - </div> - </a> - </div> - - <div class="col-5"> - <a target="_blank" href="http://developer.android.com/design/index.html"> - <div class="feature-box"> - <h2>Design Your App »</h2> - <p>Before you begin developing your app, be sure you understand - the design patterns that Android users expect from your app.</p> - </div> - </a> - </div> - - <div class="col-5"> - <a target="_blank" href="http://developer.android.com/tools/testing/testing_android.html"> - <div class="feature-box"> - <h2>Test Your App »</h2> - <p>The Android framework provides - tools that help you test every aspect of your app to be sure it behaves - as it should under various conditions.</p> - </div> - </a> - </div> - - -</div> - - -</body> -</html>
\ No newline at end of file diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml b/eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml deleted file mode 100644 index 65d226f..0000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?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 index 5d4a993..6fb6d77 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml +++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml @@ -40,30 +40,15 @@ <extension point="org.eclipse.ui.intro"> <intro - class="org.eclipse.ui.intro.config.CustomizableIntroPart" + class="com.android.ide.eclipse.adt.internal.AdtIntro" icon="icons/adt16.png" - id="org.eclipse.intro.minimal" + id="com.android.ide.eclipse.adt.intro" 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" + introId="com.android.ide.eclipse.adt.intro" productId="com.android.ide.eclipse.adt.package.product"> </introProductBinding> </extension> diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/src/com/android/ide/eclipse/adt/internal/AdtIntro.java b/eclipse/plugins/com.android.ide.eclipse.adt.package/src/com/android/ide/eclipse/adt/internal/AdtIntro.java new file mode 100644 index 0000000..27e758c --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/src/com/android/ide/eclipse/adt/internal/AdtIntro.java @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2013 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.adt.internal; + +import com.android.ide.eclipse.adt.AdtPlugin; +import com.android.ide.eclipse.adt.internal.wizards.actions.NewProjectAction; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.browser.IWebBrowser; +import org.eclipse.ui.browser.IWorkbenchBrowserSupport; +import org.eclipse.ui.forms.events.HyperlinkAdapter; +import org.eclipse.ui.forms.events.HyperlinkEvent; +import org.eclipse.ui.forms.events.IHyperlinkListener; +import org.eclipse.ui.forms.widgets.FormToolkit; +import org.eclipse.ui.forms.widgets.Hyperlink; +import org.eclipse.ui.forms.widgets.ScrolledForm; +import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.ui.intro.IIntroPart; +import org.eclipse.ui.part.IntroPart; + +import java.net.URL; + +public class AdtIntro extends IntroPart implements IIntroPart { + private static final int TEXT_WIDTH = 600; + + private FormToolkit mToolkit; + private ScrolledForm mForm; + + @Override + public void standbyStateChanged(boolean standby) { + } + + @Override + public void createPartControl(Composite parent) { + mToolkit = new FormToolkit(parent.getDisplay()); + mForm = mToolkit.createScrolledForm(parent); + + mForm.setText("Welcome!"); + mToolkit.decorateFormHeading(mForm.getForm()); + mForm.getToolBarManager().update(true); + + //TableWrapLayout layout = new TableWrapLayout(); + //layout.numColumns = 2; + GridLayout layout = new GridLayout(1, false); + mForm.getBody().setLayout(layout); + + createText(mForm.getBody(), + "The Android Developer Tools provide a first-class development environment for " + + "building Android apps. This integrated development environment is set up with " + + "the latest version of the Android platform and system image so you can " + + "immediately begin building apps and running them on the Android emulator." + ); + + Button newProject = mToolkit.createButton(mForm.getBody(), + "New Android Application...", + SWT.PUSH); + newProject.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + NewProjectAction npwAction = new NewProjectAction(); + npwAction.run(null /*action*/); + PlatformUI.getWorkbench().getIntroManager().closeIntro(AdtIntro.this); + } + }); + + Section section = mToolkit.createSection(mForm.getBody(), + Section.SHORT_TITLE_BAR | Section.CLIENT_INDENT); + section.setText("Tutorials"); + + Composite c = mToolkit.createComposite(section); + c.setLayout(new GridLayout(2, false)); + + createHyperlink(c, "Build Your First App", + "http://developer.android.com/training/basics/firstapp/index.html"); + createText(c, "If you're new to Android, follow this class to learn the fundamental " + + "Android APIs for creating a user interface that responds to input."); + + createHyperlink(c, "Design Your App", "http://developer.android.com/design/index.html"); + createText(c, + "Before you begin developing your app, be sure you understand the design patterns " + + "that Android users expect from your app."); + + createHyperlink(c, "Test Your App", + "http://developer.android.com/tools/testing/testing_android.html"); + createText(c, "The Android Framework provides tools that help you test every aspect of " + + "your app to be sure it behaves as expected under various conditions."); + + section.setClient(c); + + mForm.reflow(true); + } + + private void createText(Composite body, String text) { + Label l = mToolkit.createLabel(body, text, SWT.WRAP); + GridData gd = new GridData(); + gd.widthHint = TEXT_WIDTH; + l.setLayoutData(gd); + } + + private void createHyperlink(Composite c, String text, String url) { + Hyperlink link = mToolkit.createHyperlink(c, text, SWT.WRAP); + link.setHref(url); + link.addHyperlinkListener(sHyperLinkListener); + GridData gd = new GridData(); + gd.verticalAlignment = SWT.TOP; + link.setLayoutData(gd); + } + + private static final IHyperlinkListener sHyperLinkListener = new HyperlinkAdapter() { + @Override + public void linkActivated(HyperlinkEvent e) { + if (!(e.getHref() instanceof String)) { + return; + } + + String url = (String) e.getHref(); + if (url.isEmpty()) { + return; + } + + IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport(); + IWebBrowser browser; + try { + browser = support.getExternalBrowser(); + browser.openURL(new URL(url)); + } catch (Exception ex) { + AdtPlugin.log(ex, "Error launching browser for URL: %1$s", url); + } + } + }; + + @Override + public void setFocus() { + mForm.setFocus(); + } + + @Override + public void dispose() { + if (mToolkit != null) { + mToolkit.dispose(); + mToolkit = null; + } + + super.dispose(); + } +} diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/welcome.css b/eclipse/plugins/com.android.ide.eclipse.adt.package/welcome.css deleted file mode 100644 index 9815087..0000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt.package/welcome.css +++ /dev/null @@ -1,176 +0,0 @@ -/* stylesheet for ADT welcome page */
- -html,body {
- background-color:#F9F9F9;
- font:14px/19px sans-serif; - color: #222
- margin:0;
- padding:0;} - -body { - padding:15px; -} - -a:link, a:visited { - color: #258aaf; - text-decoration: none; -} -a:focus, a:hover, a:active { - color: #33B5E5; - text-decoration: none; -} -strong, b { - font-weight:bold; - color: #222; -} -img { - border: none; } - - -h1, h2 { - line-height: 32px; -} -h1 { - color:#33B5E5; - font-size: 28px; - margin: 10px 0 0; - padding:0; -} -h2 { - color:#33B5E5; - font-size: 20px; - margin: 20px 0 20px; - padding:0; -} -h3 { - color:#33B5E5; - font-size: 18px; -} - - -div.feature-box, -a:link div.feature-box, -a:visited div.feature-box { - margin: 20px 0 0; - padding: 15px 0; - width:100%; - border:1px solid transparent; - background-color: rgba(0, 0, 0, 0.05); - -moz-box-shadow: 3px 3px 12px #aaa; - -webkit-box-shadow: 3px 3px 12px #aaa; - box-shadow: 3px 3px 12px #aaa; -} - -a:hover div.feature-box { - border:1px solid #33B5E5; -} -a:active div.feature-box { - -moz-box-shadow: 1px 1px 12px #aaa; - -webkit-box-shadow: 1px 1px 12px #aaa; - box-shadow: 1px 1px 12px #aaa; -} -div.feature-box > * { - margin:15px; -} -div.feature-box h2, -div.feature-box h3 { - color:#33B5E5; - margin-top:0; -} -div.feature-box p { - color:#222; -} - - - - - - - -/********** LAYOUT **************/ - -.wrap { - margin: 0 auto; - width: 100%; - min-width:600px; - max-width:900px; - clear: both; -} -.cols { - height: 1%; - margin: 0 -1.533742331288343558282%; - width: 103.06748466257669%} -*+html .cols { - margin-bottom: 20px; -} -.cols:after { - clear: both; - content: ' '; - display: block; - height: 0; - visibility: hidden; -} -.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, -.col-13, .col-14, .col-15, .col-16 { - float: left; - margin: 0 1.2% 20px 1.7%; -} -* html .col-1, * html .col-2, * html .col-3, * html .col-4, * html .col-5, * html .col-6, * html -.col-7, * html .col-8, * html .col-9, * html .col-10, * html .col-11, * html .col-12, * html -.col-13, * html .col-14, * html .col-15, * html .col-16 { - margin: 0; - margin: 0 1.2% 20px 1.7%; -} -[dir='rtl'] .col-1, [dir='rtl'] .col-2, [dir='rtl'] .col-3, [dir='rtl'] .col-4, [dir='rtl'] .col-5, -[dir='rtl'] .col-6, [dir='rtl'] .col-7, [dir='rtl'] .col-8, [dir='rtl'] .col-9, [dir='rtl'] .col-10, -[dir='rtl'] .col-11, [dir='rtl'] .col-12 { - float: right; -} -.col-1 { - width: 4.16666666666667%; -} -.col-2 { - width: 10.4166666666667%; -} -.col-3 { - width: 16.6666666666667%; -} -.col-4 { - width: 22.9166666666667%; -} -.col-5 { - width: 29.1666666666667%; -} -.col-6 { - width: 35.4166666666667%; -} -.col-7 { - width: 41.6666666666667%; -} -.col-8 { - width: 47.9166666666667%; -} -.col-9 { - width: 55.3333333333333%; -} -.col-10 { - width: 60.4166666666667%; -} -.col-11 { - width: 66.6666666666667%; -} -.col-12 { - width: 72.9166666666667%; -} -.col-13 { - width: 79.1666666666667%; -} -.col-14 { - width: 85.4166666666667%; -} -.col-15 { - width: 91.6666666666667%; -} -.col-16 { - width: 97.9166666666667%; -} diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF index 4fa9be2..c221240 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF +++ b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF @@ -59,7 +59,7 @@ Export-Package: com.android.assetstudiolib;x-friends:="com.android.ide.eclipse.t com.android.ide.common.layout.grid;x-friends:="com.android.ide.eclipse.tests", com.android.ide.common.layout.relative;x-friends:="com.android.ide.eclipse.tests", com.android.ide.common.resources.platform;x-friends:="com.android.ide.eclipse.tests", - com.android.ide.eclipse.adt;x-friends:="com.android.ide.eclipse.tests", + com.android.ide.eclipse.adt;x-friends:="com.android.ide.eclipse.tests,com.android.ide.eclipse.adt.package", com.android.ide.eclipse.adt.internal;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.adt.internal.actions;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.adt.internal.assetstudio;x-friends:="com.android.ide.eclipse.tests", @@ -113,7 +113,7 @@ Export-Package: com.android.assetstudiolib;x-friends:="com.android.ide.eclipse.t com.android.ide.eclipse.adt.internal.ui;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.adt.internal.utils;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.adt.internal.welcome;x-friends:="com.android.ide.eclipse.tests", - com.android.ide.eclipse.adt.internal.wizards.actions;x-friends:="com.android.ide.eclipse.tests", + com.android.ide.eclipse.adt.internal.wizards.actions;x-friends:="com.android.ide.eclipse.tests,com.android.ide.eclipse.adt.package", com.android.ide.eclipse.adt.internal.wizards.export;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.adt.internal.wizards.newproject;x-friends:="com.android.ide.eclipse.tests", com.android.ide.eclipse.adt.internal.wizards.newxmlfile;x-friends:="com.android.ide.eclipse.tests", |