summaryrefslogtreecommitdiffstats
path: root/tools/sdkmanager/app
diff options
context:
space:
mode:
authorRaphael <raphael@google.com>2009-06-01 15:45:33 -0700
committerRaphael <raphael@google.com>2009-06-02 11:40:29 -0700
commit36e11cb354f375f462ddfbfee2f764e4d9f89f99 (patch)
tree0277c02ecfa24dce09586c6d19df4bbfc294c1f0 /tools/sdkmanager/app
parent55b47f8d7523ec0686dabb466cbe0620f5946cfa (diff)
downloadandroid_development-36e11cb354f375f462ddfbfee2f764e4d9f89f99.tar.gz
android_development-36e11cb354f375f462ddfbfee2f764e4d9f89f99.tar.bz2
android_development-36e11cb354f375f462ddfbfee2f764e4d9f89f99.zip
SDK Updater: Placeholder pages for about and settings.
These pages are now in the SdkManager project with a mechanism to instantiate them from the UI on demand.
Diffstat (limited to 'tools/sdkmanager/app')
-rw-r--r--tools/sdkmanager/app/src/com/android/sdkmanager/Main.java5
-rwxr-xr-xtools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java72
-rwxr-xr-xtools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/SettingsPage.java109
3 files changed, 186 insertions, 0 deletions
diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/Main.java b/tools/sdkmanager/app/src/com/android/sdkmanager/Main.java
index 94f30628c..26af49824 100644
--- a/tools/sdkmanager/app/src/com/android/sdkmanager/Main.java
+++ b/tools/sdkmanager/app/src/com/android/sdkmanager/Main.java
@@ -29,6 +29,8 @@ import com.android.sdklib.internal.avd.AvdManager.AvdInfo;
import com.android.sdklib.internal.avd.HardwareProperties.HardwareProperty;
import com.android.sdklib.internal.project.ProjectCreator;
import com.android.sdklib.internal.project.ProjectCreator.OutputLevel;
+import com.android.sdkmanager.internal.repository.AboutPage;
+import com.android.sdkmanager.internal.repository.SettingsPage;
import com.android.sdkuilib.repository.UpdaterWindow;
import java.io.File;
@@ -238,8 +240,11 @@ class Main {
private void showMainWindow() {
try {
UpdaterWindow window = new UpdaterWindow(
+ mSdkLog,
mOsSdkFolder,
false /*userCanChangeSdkRoot*/);
+ window.registerPage("Settings", SettingsPage.class);
+ window.registerPage("About", AboutPage.class);
window.open();
} catch (Exception e) {
e.printStackTrace();
diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java b/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java
new file mode 100755
index 000000000..49aad2992
--- /dev/null
+++ b/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdkmanager.internal.repository;
+
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/*
+ * TODO list
+ * - Change version to be a constant pulled from somewhere.
+ */
+
+public class AboutPage extends Composite {
+
+ private Label mLabel;
+
+ /**
+ * Create the composite.
+ * @param parent The parent of the composite.
+ */
+ public AboutPage(Composite parent) {
+ super(parent, SWT.BORDER);
+
+ createContents(this);
+
+ postCreate(); //$hide$
+ }
+
+ private void createContents(Composite parent) {
+ parent.setLayout(new GridLayout(1, false));
+
+ mLabel = new Label(parent, SWT.NONE);
+ mLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true, 1, 1));
+ mLabel.setText("Android SDK Updater.\n\nVersion 0.1.\n\nCopyright (C) 2009 The Android Open Source Project.");
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ // -- Start of internal part ----------
+ // Hide everything down-below from SWT designer
+ //$hide>>$
+
+ /**
+ * Called by the constructor right after {@link #createContents(Composite)}.
+ */
+ private void postCreate() {
+ }
+
+ // End of hiding from SWT Designer
+ //$hide<<$
+}
diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/SettingsPage.java b/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/SettingsPage.java
new file mode 100755
index 000000000..df72cf92b
--- /dev/null
+++ b/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/SettingsPage.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdkmanager.internal.repository;
+
+import org.eclipse.swt.SWT;
+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.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/*
+ * TODO list
+ * - The window should probably set a callback to be notified when settings are changed.
+ * - Actually use the settings.
+ */
+
+public class SettingsPage extends Composite {
+
+ private Group mProxySettingsGroup;
+ private Group mPlaceholderGroup;
+ private Button mApplyButton;
+ private Label mSomeMoreSettings;
+ private Label mProxyServerLabel;
+ private Label mProxyPortLabel;
+ private Text mProxyServerText;
+ private Text mProxyPortText;
+
+ /**
+ * Create the composite.
+ * @param parent The parent of the composite.
+ */
+ public SettingsPage(Composite parent) {
+ super(parent, SWT.BORDER);
+
+ createContents(this);
+
+ mProxySettingsGroup = new Group(this, SWT.NONE);
+ mProxySettingsGroup.setText("Proxy Settings");
+ mProxySettingsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ mProxySettingsGroup.setLayout(new GridLayout(2, false));
+
+ mProxyServerLabel = new Label(mProxySettingsGroup, SWT.NONE);
+ mProxyServerLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ mProxyServerLabel.setText("HTTP Proxy Server");
+
+ mProxyServerText = new Text(mProxySettingsGroup, SWT.BORDER);
+ mProxyServerText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ mProxyPortLabel = new Label(mProxySettingsGroup, SWT.NONE);
+ mProxyPortLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ mProxyPortLabel.setText("HTTP Proxy Port");
+
+ mProxyPortText = new Text(mProxySettingsGroup, SWT.BORDER);
+ mProxyPortText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ mPlaceholderGroup = new Group(this, SWT.NONE);
+ mPlaceholderGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ mPlaceholderGroup.setText("Placeholder");
+ mPlaceholderGroup.setLayout(new GridLayout(1, false));
+
+ mSomeMoreSettings = new Label(mPlaceholderGroup, SWT.NONE);
+ mSomeMoreSettings.setText("Some more settings here");
+
+ mApplyButton = new Button(this, SWT.NONE);
+ mApplyButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ mApplyButton.setText("Apply");
+
+ postCreate(); //$hide$
+ }
+
+ private void createContents(Composite parent) {
+ parent.setLayout(new GridLayout(1, false));
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents subclassing of SWT components
+ }
+
+ // -- Start of internal part ----------
+ // Hide everything down-below from SWT designer
+ //$hide>>$
+
+ /**
+ * Called by the constructor right after {@link #createContents(Composite)}.
+ */
+ private void postCreate() {
+ }
+
+ // End of hiding from SWT Designer
+ //$hide<<$
+}