aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-06-15 14:13:12 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-06-15 14:13:13 -0700
commitfe01f623d81bcc8c53b6e31f581aaab2c28e5546 (patch)
treea49603dd19ee83dc9ff71515507d452e724c59a2
parent97efc1aeffebd840734c6a0ff39fdbad7802ed81 (diff)
parent93fcf4cee5a95dca2427d49a7a73fc8ddac3812c (diff)
downloadsdk-fe01f623d81bcc8c53b6e31f581aaab2c28e5546.zip
sdk-fe01f623d81bcc8c53b6e31f581aaab2c28e5546.tar.gz
sdk-fe01f623d81bcc8c53b6e31f581aaab2c28e5546.tar.bz2
Merge "Project wizard tweaks"
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml17
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/assetstudio/ConfigureAssetSetPage.java1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/actions/NewProjectAction.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java37
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/ActivityPage.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/AppSkeletonPage.java157
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectPage.java47
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizard.java75
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizardState.java10
9 files changed, 108 insertions, 242 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
index c2e65ea..e0ecf7a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
@@ -167,8 +167,6 @@
<category
id="com.android.ide.eclipse.wizards.category"
name="Android" />
-
- <!-- New template-based project wizard -->
<wizard
canFinishEarly="false"
category="com.android.ide.eclipse.wizards.category"
@@ -177,20 +175,7 @@
hasPages="true"
icon="icons/new_adt_project.png"
id="ccom.android.ide.eclipse.adt.project.NewProjectWizard"
- name="Android Application"
- preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective"
- project="true" />
-
- <!-- Old custom-coded project wizard -->
- <wizard
- canFinishEarly="false"
- category="com.android.ide.eclipse.wizards.category"
- class="com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizard"
- finalPerspective="org.eclipse.jdt.ui.JavaPerspective"
- hasPages="true"
- icon="icons/new_adt_project.png"
- id="com.android.ide.eclipse.adt.project.NewProjectWizard.Old"
- name="Android Blank Project"
+ name="Android Application Project"
preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective"
project="true" />
<wizard
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/assetstudio/ConfigureAssetSetPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/assetstudio/ConfigureAssetSetPage.java
index 7bcff46..187120c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/assetstudio/ConfigureAssetSetPage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/assetstudio/ConfigureAssetSetPage.java
@@ -585,6 +585,7 @@ public class ConfigureAssetSetPage extends WizardPage implements SelectionListen
chooseForegroundTab(mImageRadio, mImageForm);
} else if (sourceType == CreateAssetSetWizardState.SourceType.CLIPART) {
chooseForegroundTab(mClipartRadio, mClipartForm);
+ mChooseClipart.setFocus();
} else if (sourceType == CreateAssetSetWizardState.SourceType.TEXT) {
updateFontLabel(mFontButton.getFont());
chooseForegroundTab(mTextRadio, mTextForm);
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/actions/NewProjectAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/actions/NewProjectAction.java
index 6bcc479..38f4768 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/actions/NewProjectAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/actions/NewProjectAction.java
@@ -16,7 +16,7 @@
package com.android.ide.eclipse.adt.internal.wizards.actions;
-import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizard;
+import com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectWizard;
import org.eclipse.jface.action.IAction;
import org.eclipse.ui.IWorkbenchWizard;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java
index 04225ab..ad34309 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java
@@ -16,6 +16,10 @@
package com.android.ide.eclipse.adt.internal.wizards.newproject;
+import static com.android.sdklib.SdkConstants.FN_PROJECT_PROPERTIES;
+import static com.android.sdklib.internal.project.ProjectProperties.PROPERTY_LIBRARY;
+import static org.eclipse.core.resources.IResource.DEPTH_ZERO;
+
import com.android.AndroidConstants;
import com.android.ide.common.layout.LayoutConstants;
import com.android.ide.eclipse.adt.AdtConstants;
@@ -28,12 +32,14 @@ import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
import com.android.ide.eclipse.adt.internal.project.AndroidNature;
import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
import com.android.ide.eclipse.adt.internal.refactorings.extractstring.ExtractStringRefactoring;
+import com.android.ide.eclipse.adt.internal.sdk.ProjectState;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizardState.Mode;
import com.android.io.StreamException;
import com.android.resources.Density;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
+import com.android.sdklib.internal.project.ProjectPropertiesWorkingCopy;
import com.android.sdklib.xml.ManifestData;
import org.eclipse.core.filesystem.EFS;
@@ -53,6 +59,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
@@ -108,6 +115,7 @@ public class NewProjectCreator {
private static final String PARAM_SOURCE = "SOURCE"; //$NON-NLS-1$
private static final String PARAM_SRC_FOLDER = "SRC_FOLDER"; //$NON-NLS-1$
private static final String PARAM_SDK_TARGET = "SDK_TARGET"; //$NON-NLS-1$
+ private static final String PARAM_IS_LIBRARY = "IS_LIBRARY"; //$NON-NLS-1$
private static final String PARAM_MIN_SDK_VERSION = "MIN_SDK_VERSION"; //$NON-NLS-1$
// Warning: The expanded string PARAM_TEST_TARGET_PACKAGE must not contain the
// string "PACKAGE" since it collides with the replacement of PARAM_PACKAGE.
@@ -760,6 +768,31 @@ public class NewProjectCreator {
// Necessary for existing projects and good for new ones to.
ProjectHelper.fixProject(project);
+ Boolean isLibraryProject = parameters.containsKey(PARAM_IS_LIBRARY);
+ if (isLibraryProject != null && isLibraryProject.booleanValue()
+ && Sdk.getCurrent() != null && project.isOpen()) {
+ ProjectState state = Sdk.getProjectState(project);
+ if (state != null) {
+ // make a working copy of the properties
+ ProjectPropertiesWorkingCopy properties =
+ state.getProperties().makeWorkingCopy();
+
+ properties.setProperty(PROPERTY_LIBRARY, Boolean.TRUE.toString());
+ try {
+ properties.save();
+ IResource projectProp = project.findMember(FN_PROJECT_PROPERTIES);
+ if (projectProp != null) {
+ projectProp.refreshLocal(DEPTH_ZERO, new NullProgressMonitor());
+ }
+ } catch (Exception e) {
+ String msg = String.format(
+ "Failed to save %1$s for project %2$s",
+ SdkConstants.FN_PROJECT_PROPERTIES, project.getName());
+ AdtPlugin.log(e, msg);
+ }
+ }
+ }
+
return project;
}
@@ -767,7 +800,8 @@ public class NewProjectCreator {
IProgressMonitor monitor,
IProject project,
IAndroidTarget target,
- ProjectPopulator projectPopulator)
+ ProjectPopulator projectPopulator,
+ boolean isLibrary)
throws CoreException, IOException, StreamException {
NewProjectCreator creator = new NewProjectCreator(null, null);
@@ -777,6 +811,7 @@ public class NewProjectCreator {
parameters.put(PARAM_SRC_FOLDER, SdkConstants.FD_SOURCES);
parameters.put(PARAM_IS_NEW_PROJECT, false);
parameters.put(PARAM_SAMPLE_LOCATION, null);
+ parameters.put(PARAM_IS_LIBRARY, isLibrary);
IWorkspace workspace = ResourcesPlugin.getWorkspace();
final IProjectDescription description = workspace.newProjectDescription(project.getName());
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/ActivityPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/ActivityPage.java
index 1cd0739..edc5f2c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/ActivityPage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/ActivityPage.java
@@ -230,10 +230,6 @@ class ActivityPage extends WizardPage implements SelectionListener {
@Override
public boolean isPageComplete() {
- if (!mValues.createAppSkeleton) {
- return true;
- }
-
// Ensure that the Finish button isn't enabled until
// the user has reached and completed this page
if (!mShown) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/AppSkeletonPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/AppSkeletonPage.java
deleted file mode 100644
index ed45a7b..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/AppSkeletonPage.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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.wizards.templates;
-
-
-import com.android.ide.eclipse.adt.AdtPlugin;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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;
-
-class AppSkeletonPage extends WizardPage implements SelectionListener {
- private final NewProjectWizardState mValues;
-
- private Button mActionBarToggle;
- private Button mAboutToggle;
- private Button mSettingsToggle;
- private Button mPhoneToggle;
- private Button mTabletToggle;
-
- private boolean mIgnore;
- private Button mCreateIconToggle;
-
- AppSkeletonPage(NewProjectWizardState values) {
- super("appSkeletonPage");
- mValues = values;
- setTitle("Configure Application Skeleton");
- setDescription("Select which platforms to target and what to include in the app");
- }
-
- @SuppressWarnings("unused") // SWT constructors have side effects and aren't unused
- @Override
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- setControl(container);
- GridLayout gl_container = new GridLayout(2, false);
- gl_container.horizontalSpacing = 10;
- container.setLayout(gl_container);
- Label targetLabel = new Label(container, SWT.NONE);
- targetLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- targetLabel.setText("Target:");
- mPhoneToggle = new Button(container, SWT.CHECK);
- mPhoneToggle.setSelection(true);
- mPhoneToggle.setText("Phones");
- mPhoneToggle.setEnabled(false);
- mPhoneToggle.addSelectionListener(this);
- new Label(container, SWT.NONE);
- mTabletToggle = new Button(container, SWT.CHECK);
- mTabletToggle.setSelection(true);
- mTabletToggle.setText("Tablets");
- mTabletToggle.setEnabled(false);
- mTabletToggle.addSelectionListener(this);
- new Label(container, SWT.NONE);
- new Label(container, SWT.NONE);
- Label uiLabel = new Label(container, SWT.NONE);
- uiLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- uiLabel.setText("User Interface:");
- mActionBarToggle = new Button(container, SWT.CHECK);
- mActionBarToggle.setSelection(true);
- mActionBarToggle.setText("Action Bar");
- mActionBarToggle.setEnabled(false);
- mActionBarToggle.addSelectionListener(this);
- new Label(container, SWT.NONE);
- mSettingsToggle = new Button(container, SWT.CHECK);
- mSettingsToggle.setSelection(true);
- mSettingsToggle.setText("Settings");
- mSettingsToggle.setEnabled(false);
- mSettingsToggle.addSelectionListener(this);
- new Label(container, SWT.NONE);
- mAboutToggle = new Button(container, SWT.CHECK);
- mAboutToggle.setSelection(true);
- mAboutToggle.setText("About");
- mAboutToggle.setEnabled(false);
- mAboutToggle.addSelectionListener(this);
-
- new Label(container, SWT.NONE);
- mCreateIconToggle = new Button(container, SWT.CHECK);
- mCreateIconToggle.setSelection(mValues.createIcon);
- mCreateIconToggle.setText("Create custom launcher icon");
- mCreateIconToggle.addSelectionListener(this);
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- validatePage();
- }
-
- private void validatePage() {
- IStatus status = null;
-
- if (status == null || status.getSeverity() != IStatus.ERROR) {
- // Ensure that you're choosing at least one UI target
- if (!mValues.phone && !mValues.tablet) {
- status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID,
- "You must choose at least one target (tablet or phone)");
- }
- }
-
- setPageComplete(status == null || status.getSeverity() != IStatus.ERROR);
- if (status != null) {
- setMessage(status.getMessage(),
- status.getSeverity() == IStatus.ERROR
- ? IMessageProvider.ERROR : IMessageProvider.WARNING);
- } else {
- setErrorMessage(null);
- setMessage(null);
- }
- }
-
- // ---- Implements SelectionListener ----
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (mIgnore) {
- return;
- }
-
- Object source = e.getSource();
- if (source == mPhoneToggle) {
- mValues.phone = mPhoneToggle.getSelection();
- } else if (source == mTabletToggle) {
- mValues.tablet = mTabletToggle.getSelection();
- } else if (source == mCreateIconToggle) {
- mValues.createIcon = mCreateIconToggle.getSelection();
- }
-
- validatePage();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectPage.java
index 6e2087a..0025742 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectPage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectPage.java
@@ -84,7 +84,8 @@ public class NewProjectPage extends WizardPage
private boolean mIgnore;
private Combo mBuildSdkCombo;
private Button mChooseSdkButton;
- private Button mSkeletonToggle;
+ private Button mCustomIconToggle;
+ private Button mLibraryToggle;
private Label mHelpIcon;
private Label mTipLabel;
@@ -258,11 +259,19 @@ public class NewProjectPage extends WizardPage
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
- mSkeletonToggle = new Button(container, SWT.CHECK);
- mSkeletonToggle.setSelection(true);
- mSkeletonToggle.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
- mSkeletonToggle.setText("Create Application Skeleton");
- mSkeletonToggle.addSelectionListener(this);
+ mCustomIconToggle = new Button(container, SWT.CHECK);
+ mCustomIconToggle.setSelection(true);
+ mCustomIconToggle.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
+ mCustomIconToggle.setText("Create custom launcher icon");
+ mCustomIconToggle.setSelection(mValues.createIcon);
+ mCustomIconToggle.addSelectionListener(this);
+
+ mLibraryToggle = new Button(container, SWT.CHECK);
+ mLibraryToggle.setSelection(true);
+ mLibraryToggle.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
+ mLibraryToggle.setText("Mark this project as a library");
+ mLibraryToggle.setSelection(mValues.isLibrary);
+ mLibraryToggle.addSelectionListener(this);
Label label = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 4, 1));
@@ -396,12 +405,15 @@ public class NewProjectPage extends WizardPage
// TODO: implement
Integer minSdk = mMinNameToApi.get(mValues.minSdk);
- if (minSdk != null) {
- mValues.iconState.minSdk = minSdk.intValue();
- } else {
- assert false : mValues.minSdk;
+ if (minSdk == null) {
+ try {
+ minSdk = Integer.parseInt(mValues.minSdk);
+ } catch (NumberFormatException nufe) {
+ minSdk = 1;
+ }
}
-
+ mValues.iconState.minSdk = minSdk.intValue();
+ mValues.minSdkLevel = minSdk.intValue();
} else if (source == mBuildSdkCombo) {
mValues.target = getSelectedBuildTarget();
@@ -429,9 +441,10 @@ public class NewProjectPage extends WizardPage
}
}
}
- } else if (source == mSkeletonToggle) {
- mValues.createAppSkeleton = mSkeletonToggle.getSelection();
- mValues.createIcon = mValues.createAppSkeleton;
+ } else if (source == mCustomIconToggle) {
+ mValues.createIcon = mCustomIconToggle.getSelection();
+ } else if (source == mLibraryToggle) {
+ mValues.isLibrary = mLibraryToggle.getSelection();
}
validatePage();
@@ -573,6 +586,12 @@ public class NewProjectPage extends WizardPage
if (mValues.minSdk == null || mValues.minSdk.isEmpty()) {
status = new Status(IStatus.WARNING, AdtPlugin.PLUGIN_ID,
"Select a minimum SDK version");
+ } else {
+ if (mValues.target != null && mValues.target.getVersion().getApiLevel() <
+ mValues.minSdkLevel) {
+ status = new Status(IStatus.WARNING, AdtPlugin.PLUGIN_ID,
+ "The minimum SDK version is higher than the build target version");
+ }
}
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizard.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizard.java
index 2d67086..312fbcf 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizard.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizard.java
@@ -75,9 +75,8 @@ public class NewProjectWizard extends Wizard implements INewWizard {
private IWorkbench mWorkbench;
private UpdateToolsPage mUpdatePage;
private NewProjectPage mMainPage;
- private AppSkeletonPage mAppSkeletonPage;
- private NewTemplatePage mTemplatePage;
private ActivityPage mActivityPage;
+ private NewTemplatePage mTemplatePage;
protected InstallDependencyPage mDependencyPage;
private ConfigureAssetSetPage mIconPage;
private NewProjectWizardState mValues;
@@ -96,7 +95,6 @@ public class NewProjectWizard extends Wizard implements INewWizard {
mValues = new NewProjectWizardState();
mMainPage = new NewProjectPage(mValues);
- mAppSkeletonPage = new AppSkeletonPage(mValues);
mActivityPage = new ActivityPage(mValues);
}
@@ -110,7 +108,6 @@ public class NewProjectWizard extends Wizard implements INewWizard {
}
addPage(mMainPage);
- addPage(mAppSkeletonPage);
addPage(mActivityPage);
}
@@ -124,13 +121,34 @@ public class NewProjectWizard extends Wizard implements INewWizard {
@Override
public IWizardPage getNextPage(IWizardPage page) {
- // If you turn off creating an application, only one page
if (page == mMainPage) {
- if (!mValues.createAppSkeleton) {
- return null;
+ if (mValues.createIcon) {
+ if (mIconPage == null) {
+ // Bundle asset studio wizard to create the launcher icon
+ CreateAssetSetWizardState iconState = mValues.iconState;
+ iconState.type = AssetType.LAUNCHER;
+ iconState.outputName = "ic_launcher"; //$NON-NLS-1$
+ iconState.background = new RGB(0xff, 0xff, 0xff);
+ iconState.foreground = new RGB(0x33, 0xb6, 0xea);
+ iconState.shape = GraphicGenerator.Shape.CIRCLE;
+ iconState.trim = true;
+ iconState.padding = 10;
+ iconState.sourceType = CreateAssetSetWizardState.SourceType.CLIPART;
+ iconState.clipartName = "user.png"; //$NON-NLS-1$
+ mIconPage = new ConfigureAssetSetPage(iconState);
+ mIconPage.setTitle("Configure Launcher Icon");
+ addPage(mIconPage);
+ }
+ return mIconPage;
+ } else {
+ return mActivityPage;
}
}
+ if (page == mIconPage) {
+ return mActivityPage;
+ }
+
if (page == mActivityPage && mValues.createActivity) {
if (mTemplatePage == null) {
NewTemplateWizardState activityValues = mValues.activityValues;
@@ -155,7 +173,7 @@ public class NewProjectWizard extends Wizard implements INewWizard {
return mTemplatePage;
}
- if (page == mTemplatePage ) {
+ if (page == mTemplatePage) {
TemplateMetadata template = mValues.activityValues.getTemplateHandler().getTemplate();
if (template != null
&& !InstallDependencyPage.isInstalled(template.getDependencies())) {
@@ -170,27 +188,7 @@ public class NewProjectWizard extends Wizard implements INewWizard {
if (page == mTemplatePage || !mValues.createActivity && page == mActivityPage
|| page == mDependencyPage) {
- if (mValues.createIcon) {
- if (mIconPage == null) {
- // Bundle asset studio wizard to create the launcher icon
- CreateAssetSetWizardState iconState = mValues.iconState;
- iconState.type = AssetType.LAUNCHER;
- iconState.outputName = "ic_launcher"; //$NON-NLS-1$
- iconState.background = new RGB(0xff, 0xff, 0xff);
- iconState.foreground = new RGB(0x33, 0xb6, 0xea);
- iconState.shape = GraphicGenerator.Shape.CIRCLE;
- iconState.trim = true;
- iconState.padding = 10;
- iconState.sourceType = CreateAssetSetWizardState.SourceType.CLIPART;
- iconState.clipartName = "user.png"; //$NON-NLS-1$
- mIconPage = new ConfigureAssetSetPage(iconState);
- mIconPage.setTitle("Configure Launcher Icon");
- addPage(mIconPage);
- }
- return mIconPage;
- } else {
- return null;
- }
+ return null;
}
return super.getNextPage(page);
@@ -198,10 +196,6 @@ public class NewProjectWizard extends Wizard implements INewWizard {
@Override
public boolean canFinish() {
- if (!mValues.createAppSkeleton) {
- return mMainPage.isPageComplete();
- }
-
// Deal with lazy creation of some pages: these may not be in the page-list yet
// since they are constructed lazily, so consider that option here.
if (mValues.createIcon && (mIconPage == null || !mIconPage.isPageComplete())) {
@@ -276,20 +270,19 @@ public class NewProjectWizard extends Wizard implements INewWizard {
File outputPath = AdtUtils.getAbsolutePath(newProject).toFile();
template.render(outputPath, paramMap);
- if (mValues.createAppSkeleton) {
- if (mValues.createIcon) {
- generateIcons(newProject);
- }
+ if (mValues.createIcon) {
+ generateIcons(newProject);
+ }
- if (mValues.createActivity) {
- generateActivity(template, paramMap, outputPath);
- }
+ if (mValues.createActivity) {
+ generateActivity(template, paramMap, outputPath);
}
}
};
IProgressMonitor monitor = new NullProgressMonitor();
- NewProjectCreator.create(monitor, newProject, mValues.target, projectPopulator);
+ NewProjectCreator.create(monitor, newProject, mValues.target, projectPopulator,
+ mValues.isLibrary);
try {
newProject.refreshLocal(DEPTH_INFINITE, new NullProgressMonitor());
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizardState.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizardState.java
index 1dc81ca..610b1c0 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizardState.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewProjectWizardState.java
@@ -73,19 +73,13 @@ public class NewProjectWizardState {
/** The minimum API level, as a string (if the API is a preview release with a codename) */
public int minSdkLevel;
- /** Whether to create an application skeleton */
- public boolean createAppSkeleton = true;
+ /** Whether this project should be marked as a library project */
+ public boolean isLibrary;
/** Whether to create an activity (if so, the activity state is stored in
* {@link #activityValues}) */
public boolean createActivity = true;
- /** Whether to target phones */
- public boolean phone = true;
-
- /** Whether to target tablets */
- public boolean tablet = true;
-
/** Whether a custom icon should be created instead of just reusing the default (if so,
* the icon wizard state is stored in {@link #iconState}) */
public boolean createIcon = true;