# HG changeset patch # User Eugene Ostroukhov # Date 1282610732 25200 # Node ID 77edd0cbdfe0d737e852f8eb296e780b1df1991f # Parent e2f461f0a9e0bc2c31faa94352ea0d2d34ab8854 Removed old new project wizard diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.tmw.previewer/bin/org/symbian/tools/tmw/previewer/PreviewerPlugin.class Binary file plugins/org.symbian.tools.tmw.previewer/bin/org/symbian/tools/tmw/previewer/PreviewerPlugin.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.tmw.previewer/plugin.xml --- a/plugins/org.symbian.tools.tmw.previewer/plugin.xml Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.tmw.previewer/plugin.xml Mon Aug 23 17:45:32 2010 -0700 @@ -10,7 +10,7 @@ category="org.symbian.tools.tmw" class="org.symbian.tools.tmw.previewer.preview.PreviewView" icon="icons/obj16/preview_view.gif" - id="org.symbian.tools.wrttools.editing.wrtpreview" + id="org.symbian.tools.tmw.preview" name="Preview" restorable="true"> diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java --- a/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.tmw.previewer/src/org/symbian/tools/tmw/previewer/PreviewerPlugin.java Mon Aug 23 17:45:32 2010 -0700 @@ -43,7 +43,7 @@ // The plug-in ID public static final String PLUGIN_ID = "org.symbian.tools.tmw.previewer"; - public static final String PREVIEW_VIEW = "org.symbian.tools.tmw.editing.wrtpreview"; + public static final String PREVIEW_VIEW = "org.symbian.tools.tmw.preview"; public static final boolean DEBUG = Platform.inDebugMode() && Boolean.parseBoolean(Platform.getDebugOption(PLUGIN_ID + "/debug")); diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.tmw.ui/bin/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationWizard.class Binary file plugins/org.symbian.tools.tmw.ui/bin/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationWizard.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.tmw.ui/bin/org/symbian/tools/tmw/ui/project/NewApplicationWizard.class Binary file plugins/org.symbian.tools.tmw.ui/bin/org/symbian/tools/tmw/ui/project/NewApplicationWizard.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.tmw.ui/plugin.xml --- a/plugins/org.symbian.tools.tmw.ui/plugin.xml Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.tmw.ui/plugin.xml Mon Aug 23 17:45:32 2010 -0700 @@ -37,7 +37,7 @@ associatedExtensionId="org.eclipse.wst.jsdt.java.ui.javaContent" menuGroupId="group.new.z" type="new" - wizardId="org.symbian.tools.wrttools.core.wrtwidgetwizard"> + wizardId="org.symbian.tools.tmw.newproject"> facets; - if (project == null) { - facets = Collections.emptySet(); - } else { - facets = project.getProjectFacets(); - } - facetsPage = new NewApplicationFacetsWizardPage(facets, getFacetedProjectWorkingCopy()); - addPage(facetsPage); - templatesPage = new NewApplicationTemplateWizardPage(wizardContext, databindingContext); - addPage(templatesPage); - super.addPages(); - } - - public boolean canFinish() { - return getNextPage(getContainer().getCurrentPage()) == null && this.firstPage.isPageComplete() - && super.canFinish(); - } - - protected NewApplicationDetailsWizardPage createFirstPage() { - firstPage = new NewApplicationDetailsWizardPage(wizardContext, databindingContext); - return firstPage; - } - - @Override - public IWizardPage getNextPage(final IWizardPage page) { - final IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy(); - if (page == this.firstPage) { - fpjwc.setProjectName(getProjectName()); - fpjwc.setProjectLocation(getProjectLocation()); - final IFProjSupport fprojSupport = TMWCore.getFProjSupport(); - IRuntime runtime = fprojSupport.getRuntime(wizardContext.getRuntime()); - fpjwc.setTargetedRuntimes(Collections.singleton(runtime)); - fpjwc.setPrimaryRuntime(runtime); - Set facets = getCurrentFixedFacetVersions(); - facets.addAll(fpjwc.getProjectFacets()); - fpjwc.setProjectFacets(facets); - fpjwc.setFixedProjectFacets(getCurrentFixedFacets()); - } else if (page == this.templatesPage) { - Set facets = getCurrentFixedFacetVersions(); - facets.addAll(fpjwc.getProjectFacets()); - fpjwc.setProjectFacets(facets); - fpjwc.setFixedProjectFacets(getCurrentFixedFacets()); - } - final Collection actions = fpjwc.getProjectFacetActions(); - final Collection toReplace = new HashSet(); - for (Action action : actions) { - if (action.getConfig() == ProjectCreationConfigFactory.CONFIG_STANDIN) { - toReplace.add(action); - } - } - for (Action action : toReplace) { - fpjwc.setProjectFacetActionConfig(action.getProjectFacetVersion().getProjectFacet(), wizardContext); - } - - IWizardPage nextPage = super.getNextPage(page); - return nextPage; - } - - private Set getCurrentFixedFacets() { - final Set fixedFacets = getCurrentFixedFacetVersions(); - final Set facets = new HashSet(); - for (IProjectFacetVersion facet : fixedFacets) { - facets.add(facet.getProjectFacet()); - } - return facets; - } - - private Set getCurrentFixedFacetVersions() { - final IFProjSupport fprojSupport = TMWCore.getFProjSupport(); - Set facets = new HashSet( - fprojSupport.getFixedFacetsVersions(wizardContext.getRuntime())); - if (wizardContext.getTemplate() != null) { - facets.addAll(Arrays.asList(wizardContext.getTemplate().getRequiredFacets())); - } - return facets; - } - - public IWizardPage[] getPages() { - final IProjectTemplate current = wizardContext.getTemplate(); - if (template != current) { - for (INewApplicationWizardPage page : templatePages) { - page.remove(); - page.dispose(); - } - if (current == null) { - template = null; - templatePages = new INewApplicationWizardPage[0]; - } else { - template = current; - templatePages = contributions.createPages(template.getId()); - for (INewApplicationWizardPage page : templatePages) { - page.setWizard(this); - page.init(wizardContext, databindingContext); - } - } - } - final IWizardPage[] base = super.getPages(); - final IWizardPage[] pages = new IWizardPage[base.length + 3 + templatePages.length]; - - pages[0] = this.firstPage; - pages[1] = this.templatesPage; - pages[2] = this.facetsPage; - if (templatePages.length > 0) { - System.arraycopy(templatePages, 0, pages, 3, templatePages.length); - } - System.arraycopy(base, 0, pages, 2, base.length); - - return pages; - } - - protected IPath getProjectLocation() { - return firstPage.getLocationPath(); - } - - protected String getProjectName() { - return wizardContext.getProjectName(); - } - - /** - * Returns the selection that this wizard was launched from. - * - * @return the selection that this wizard was launched from - * @since 1.4 - */ - public IStructuredSelection getSelection() { - return this.selection; - } - - /** - * Returns the workbench that this wizard belongs to. - * - * @return the workbench that this wizard belongs to - * @since 1.4 - */ - public IWorkbench getWorkbench() { - return this.workbench; - } - - public void init(final IWorkbench workbench, final IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - } - - @Override - protected void performFinish(IProgressMonitor monitor) throws CoreException { - monitor.beginTask("Preparing project", 300); - super.performFinish(new SubProgressMonitor(monitor, 20)); - wizardContext.initialize(getFacetedProject().getProject(), new SubProgressMonitor(monitor, 80)); - getFacetedProject().getProject().build(IncrementalProjectBuilder.CLEAN_BUILD, - new SubProgressMonitor(monitor, 100)); - getFacetedProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD, - new SubProgressMonitor(monitor, 100)); - monitor.done(); - } -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/NewApplicationWizard.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/org.symbian.tools.tmw.ui/src/org/symbian/tools/tmw/ui/project/NewApplicationWizard.java Mon Aug 23 17:45:32 2010 -0700 @@ -0,0 +1,231 @@ +/** + * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of the License "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Symbian Foundation - initial contribution. + * Contributors: + * Description: + * Overview: + * Details: + * Platforms/Drives/Compatibility: + * Assumptions/Requirement/Pre-requisites: + * Failures and causes: + */ +package org.symbian.tools.tmw.ui.project; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.resources.IncrementalProjectBuilder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.wst.common.project.facet.core.IFacetedProject; +import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action; +import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy; +import org.eclipse.wst.common.project.facet.core.IProjectFacet; +import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; +import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard; +import org.symbian.tools.tmw.core.TMWCore; +import org.symbian.tools.tmw.core.projects.IFProjSupport; +import org.symbian.tools.tmw.core.runtimes.ProjectCreationConfigFactory; +import org.symbian.tools.tmw.internal.ui.wizard.NewApplicationDetailsWizardPage; +import org.symbian.tools.tmw.internal.ui.wizard.NewApplicationFacetsWizardPage; +import org.symbian.tools.tmw.internal.ui.wizard.NewApplicationTemplateWizardPage; +import org.symbian.tools.tmw.internal.ui.wizard.PageContributions; +import org.symbian.tools.tmw.internal.ui.wizard.WizardContext; + +/** + * @author Eugene Ostroukhov (eugeneo@symbian.org) + */ +public final class NewApplicationWizard extends ModifyFacetedProjectWizard implements INewWizard { + public static final String ID = "org.symbian.tools.tmw.newproject"; + private final PageContributions contributions = new PageContributions(); + private final DataBindingContext databindingContext = new DataBindingContext(); + private NewApplicationFacetsWizardPage facetsPage; + private NewApplicationDetailsWizardPage firstPage; + private IStructuredSelection selection; + private IProjectTemplate template = null; + private INewApplicationWizardPage[] templatePages = new INewApplicationWizardPage[0]; + private NewApplicationTemplateWizardPage templatesPage; + private final WizardContext wizardContext = new WizardContext(); + private IWorkbench workbench; + + public NewApplicationWizard() { + setShowFacetsSelectionPage(false); + } + + public void addPages() { + this.firstPage = createFirstPage(); + addPage(this.firstPage); + final IFacetedProject project = getFacetedProject(); + final Set facets; + if (project == null) { + facets = Collections.emptySet(); + } else { + facets = project.getProjectFacets(); + } + facetsPage = new NewApplicationFacetsWizardPage(facets, getFacetedProjectWorkingCopy()); + addPage(facetsPage); + templatesPage = new NewApplicationTemplateWizardPage(wizardContext, databindingContext); + addPage(templatesPage); + super.addPages(); + } + + public boolean canFinish() { + return getNextPage(getContainer().getCurrentPage()) == null && this.firstPage.isPageComplete() + && super.canFinish(); + } + + protected NewApplicationDetailsWizardPage createFirstPage() { + firstPage = new NewApplicationDetailsWizardPage(wizardContext, databindingContext); + return firstPage; + } + + @Override + public IWizardPage getNextPage(final IWizardPage page) { + final IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy(); + if (page == this.firstPage) { + fpjwc.setProjectName(getProjectName()); + fpjwc.setProjectLocation(getProjectLocation()); + final IFProjSupport fprojSupport = TMWCore.getFProjSupport(); + IRuntime runtime = fprojSupport.getRuntime(wizardContext.getRuntime()); + fpjwc.setTargetedRuntimes(Collections.singleton(runtime)); + fpjwc.setPrimaryRuntime(runtime); + Set facets = getCurrentFixedFacetVersions(); + facets.addAll(fpjwc.getProjectFacets()); + fpjwc.setProjectFacets(facets); + fpjwc.setFixedProjectFacets(getCurrentFixedFacets()); + } else if (page == this.templatesPage) { + Set facets = getCurrentFixedFacetVersions(); + facets.addAll(fpjwc.getProjectFacets()); + fpjwc.setProjectFacets(facets); + fpjwc.setFixedProjectFacets(getCurrentFixedFacets()); + } + final Collection actions = fpjwc.getProjectFacetActions(); + final Collection toReplace = new HashSet(); + for (Action action : actions) { + if (action.getConfig() == ProjectCreationConfigFactory.CONFIG_STANDIN) { + toReplace.add(action); + } + } + for (Action action : toReplace) { + fpjwc.setProjectFacetActionConfig(action.getProjectFacetVersion().getProjectFacet(), wizardContext); + } + + IWizardPage nextPage = super.getNextPage(page); + return nextPage; + } + + private Set getCurrentFixedFacets() { + final Set fixedFacets = getCurrentFixedFacetVersions(); + final Set facets = new HashSet(); + for (IProjectFacetVersion facet : fixedFacets) { + facets.add(facet.getProjectFacet()); + } + return facets; + } + + private Set getCurrentFixedFacetVersions() { + final IFProjSupport fprojSupport = TMWCore.getFProjSupport(); + Set facets = new HashSet( + fprojSupport.getFixedFacetsVersions(wizardContext.getRuntime())); + if (wizardContext.getTemplate() != null) { + facets.addAll(Arrays.asList(wizardContext.getTemplate().getRequiredFacets())); + } + return facets; + } + + public IWizardPage[] getPages() { + final IProjectTemplate current = wizardContext.getTemplate(); + if (template != current) { + for (INewApplicationWizardPage page : templatePages) { + page.remove(); + page.dispose(); + } + if (current == null) { + template = null; + templatePages = new INewApplicationWizardPage[0]; + } else { + template = current; + templatePages = contributions.createPages(template.getId()); + for (INewApplicationWizardPage page : templatePages) { + page.setWizard(this); + page.init(wizardContext, databindingContext); + } + } + } + final IWizardPage[] base = super.getPages(); + final IWizardPage[] pages = new IWizardPage[base.length + 3 + templatePages.length]; + + pages[0] = this.firstPage; + pages[1] = this.templatesPage; + pages[2] = this.facetsPage; + if (templatePages.length > 0) { + System.arraycopy(templatePages, 0, pages, 3, templatePages.length); + } + System.arraycopy(base, 0, pages, 2, base.length); + + return pages; + } + + protected IPath getProjectLocation() { + return firstPage.getLocationPath(); + } + + protected String getProjectName() { + return wizardContext.getProjectName(); + } + + /** + * Returns the selection that this wizard was launched from. + * + * @return the selection that this wizard was launched from + * @since 1.4 + */ + public IStructuredSelection getSelection() { + return this.selection; + } + + /** + * Returns the workbench that this wizard belongs to. + * + * @return the workbench that this wizard belongs to + * @since 1.4 + */ + public IWorkbench getWorkbench() { + return this.workbench; + } + + public void init(final IWorkbench workbench, final IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + } + + @Override + protected void performFinish(IProgressMonitor monitor) throws CoreException { + monitor.beginTask("Preparing project", 300); + super.performFinish(new SubProgressMonitor(monitor, 20)); + wizardContext.initialize(getFacetedProject().getProject(), new SubProgressMonitor(monitor, 80)); + getFacetedProject().getProject().build(IncrementalProjectBuilder.CLEAN_BUILD, + new SubProgressMonitor(monitor, 100)); + getFacetedProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD, + new SubProgressMonitor(monitor, 100)); + monitor.done(); + } +} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools.product/META-INF/MANIFEST.MF --- a/plugins/org.symbian.tools.wrttools.product/META-INF/MANIFEST.MF Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.wrttools.product/META-INF/MANIFEST.MF Mon Aug 23 17:45:32 2010 -0700 @@ -17,6 +17,8 @@ org.eclipse.wst.html.ui;bundle-version="1.0.400", org.eclipse.wst.xml.ui;bundle-version="1.1.0", org.symbian.tools.tmw.previewer;bundle-version="0.9.0", - org.eclipse.ui.intro + org.eclipse.ui.intro, + org.symbian.tools.tmw.ui;bundle-version="1.0.0", + org.eclipse.wst.common.project.facet.ui;bundle-version="1.4.100" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools.product/bin/org/symbian/tools/wrttools/product/actions/NewWRTProjectAction.class Binary file plugins/org.symbian.tools.wrttools.product/bin/org/symbian/tools/wrttools/product/actions/NewWRTProjectAction.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools.product/bin/org/symbian/tools/wrttools/product/perspective/WRTPerspective.class Binary file plugins/org.symbian.tools.wrttools.product/bin/org/symbian/tools/wrttools/product/perspective/WRTPerspective.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools.product/plugin.xml --- a/plugins/org.symbian.tools.wrttools.product/plugin.xml Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.wrttools.product/plugin.xml Mon Aug 23 17:45:32 2010 -0700 @@ -56,7 +56,7 @@ name="Web"> + id="org.symbian.tools.tmw.newproject"> @@ -248,13 +248,13 @@ + id="org.eclipse.ui.navigator.ProjectExplorer"> + id="org.eclipse.ui.navigator.ProjectExplorer"> diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewWRTProjectAction.java --- a/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewWRTProjectAction.java Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/NewWRTProjectAction.java Mon Aug 23 17:45:32 2010 -0700 @@ -8,7 +8,7 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.eclipse.wst.jsdt.ui.actions.AbstractOpenWizardAction; -import org.symbian.tools.wrttools.wizards.WrtWidgetWizard; +import org.symbian.tools.tmw.ui.project.NewApplicationWizard; public class NewWRTProjectAction extends AbstractOpenWizardAction implements IWorkbenchWindowActionDelegate { @@ -29,7 +29,7 @@ @Override protected INewWizard createWizard() throws CoreException { - return new WrtWidgetWizard(); + return new NewApplicationWizard(); } public void dispose() { diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java --- a/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/perspective/WRTPerspective.java Mon Aug 23 17:45:32 2010 -0700 @@ -9,6 +9,7 @@ import org.eclipse.ui.progress.IProgressConstants; import org.eclipse.wst.jsdt.ui.JavaScriptUI; import org.symbian.tools.tmw.previewer.PreviewerPlugin; +import org.symbian.tools.tmw.ui.project.NewApplicationWizard; public class WRTPerspective implements IPerspectiveFactory { @@ -44,7 +45,6 @@ layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER); layout.addShowViewShortcut(JavaScriptUI.ID_SOURCE_VIEW); layout.addShowViewShortcut(JavaScriptUI.ID_JAVADOC_VIEW); - layout.addShowViewShortcut("org.symbian.tools.wrttools.wrtnavigator"); layout.addPerspectiveShortcut(IDebugUIConstants.ID_DEBUG_PERSPECTIVE); @@ -59,7 +59,7 @@ layout.addShowViewShortcut("org.eclipse.wst.common.snippets.internal.ui.SnippetsView"); // new actions - Java project creation wizard - layout.addNewWizardShortcut("org.symbian.tools.wrttools.core.wrtwidgetwizard"); //$NON-NLS-1$ + layout.addNewWizardShortcut(NewApplicationWizard.ID); layout.addNewWizardShortcut("org.eclipse.wst.jsdt.ui.NewJSWizard"); //$NON-NLS-1$ layout.addNewWizardShortcut("org.eclipse.wst.html.ui.internal.wizard.NewHTMLWizard"); //$NON-NLS-1$ layout.addNewWizardShortcut("org.eclipse.wst.css.ui.internal.wizard.NewCSSWizard"); //$NON-NLS-1$ diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/WRTProject.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/WRTProject.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/core/ProjectTemplate.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/core/ProjectTemplate.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/AbstractDataBindingPage.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/AbstractDataBindingPage.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/DatabindingUtils.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/DatabindingUtils.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/HelloWithWRTKitProjectDetailsWizardPage$Factory.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/HelloWithWRTKitProjectDetailsWizardPage$Factory.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/HelloWithWRTKitProjectDetailsWizardPage.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/HelloWithWRTKitProjectDetailsWizardPage.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/IWizardData.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/IWizardData.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/IWizardPageFactory.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/IWizardPageFactory.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/NonEmptyStringValidator.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/NonEmptyStringValidator.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/RssReaderProjectDetailsWizardPage$Factory.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/RssReaderProjectDetailsWizardPage$Factory.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/RssReaderProjectDetailsWizardPage.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/RssReaderProjectDetailsWizardPage.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage$1.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage$1.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage$2.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage$2.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage$ProjectNameValidator.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage$ProjectNameValidator.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectFilesWizardPage.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectFilesWizardPage.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$1.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$1.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$2.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$2.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$3.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$3.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$4.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$4.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$ProjectTemplateLabelProvider.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage$ProjectTemplateLabelProvider.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WizardContext.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WizardContext.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WrtKitLibraryWizardPage.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WrtKitLibraryWizardPage.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WrtWidgetWizard$1.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WrtWidgetWizard$1.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WrtWidgetWizard$2.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WrtWidgetWizard$2.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/libraries/WRTProjectLibraryWizardPage$LibraryCheckStateListener.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/libraries/WRTProjectLibraryWizardPage$LibraryCheckStateListener.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/libraries/WRTProjectLibraryWizardPage.class Binary file plugins/org.symbian.tools.wrttools/bin/org/symbian/tools/wrttools/wizards/libraries/WRTProjectLibraryWizardPage.class has changed diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/plugin.xml --- a/plugins/org.symbian.tools.wrttools/plugin.xml Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.wrttools/plugin.xml Mon Aug 23 17:45:32 2010 -0700 @@ -1,7 +1,6 @@ - @@ -100,41 +99,8 @@ - - - - - - Creates a new Symbian WRT application project using one of the provided - templates - - - - - - - - This wizard generates an empty widget project with a minimal Info.plist, html,css and js. - - - - - - diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/schema/projectTemplates.exsd --- a/plugins/org.symbian.tools.wrttools/schema/projectTemplates.exsd Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This template is for touch devices - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Enter the first release in which this extension point appears.] - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java Mon Aug 23 17:45:32 2010 -0700 @@ -103,7 +103,8 @@ } public IMobileWebRuntime getTargetRuntime() { - return TMWCore.getDefault().getRuntimesManager().getRuntime(WRT11_RUNTIME, WRT11_VERSION); + TMWCore.getDefault(); + return TMWCore.getRuntimesManager().getRuntime(WRT11_RUNTIME, WRT11_VERSION); } private void saveProperties(Properties props) { diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/ProjectTemplate.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/ProjectTemplate.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - **/ -package org.symbian.tools.wrttools.core; - -import java.net.URL; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.TreeSet; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; -import org.osgi.framework.Bundle; -import org.symbian.tools.wrttools.Activator; -import org.symbian.tools.wrttools.core.libraries.JSLibrary; -import org.symbian.tools.wrttools.wizards.IWizardPageFactory; -import org.symbian.tools.wrttools.wizards.WRTProjectFilesWizardPage; -import org.symbian.tools.wrttools.wizards.WizardContext; - -public class ProjectTemplate { - private static ProjectTemplate[] templates; - private final IConfigurationElement element; - private Image icon; - - public ProjectTemplate(IConfigurationElement element) { - this.element = element; - } - - public Image getIcon() { - if (icon == null) { - String path = element.getAttribute("icon"); - final ImageDescriptor imageDescriptor; - if (path != null) { - imageDescriptor = Activator.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), path); - } else { - imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); - } - icon = imageDescriptor.createImage(true); - } - return icon; - } - - public String getName() { - return element.getAttribute("name"); - } - - public String getDescription() { - IConfigurationElement[] children = element.getChildren("description"); - if (children.length == 1) { - return children[0].getValue(); - } else { - return ""; - } - } - - private String[] getLibraryIds() { - IConfigurationElement[] elements = element.getChildren("requires-library"); - String[] ids = new String[elements.length]; - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - ids[i] = element.getValue(); - } - return ids; - } - - public static ProjectTemplate[] getAllTemplates() { - if (templates == null) { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Activator.PLUGIN_ID, - "projectTemplates"); - IConfigurationElement[] elements = point.getConfigurationElements(); - templates = new ProjectTemplate[elements.length]; - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - templates[i] = new ProjectTemplate(element); - } - } - return templates; - } - - public String getDefaultCssFile() { - String file = element.getAttribute("default-css-name"); - return file != null ? file : "main"; - } - - public String getDefaultJsFile() { - String file = element.getAttribute("default-js-name"); - return file != null ? file : "main"; - } - - public String getDefaultHtmlFile() { - String file = element.getAttribute("default-html-name"); - return file != null ? file : "index"; - } - - public WRTProjectFilesWizardPage createWizardPage(WizardContext context, DataBindingContext bindingContext) { - try { - if (element.getAttribute("wizard-page-factory") != null) { - IWizardPageFactory factory = (IWizardPageFactory) element - .createExecutableExtension("wizard-page-factory"); - return factory.createPage(context, bindingContext); - } - } catch (CoreException e) { - Activator.log("Problem with template " + getName(), e); - } - return new WRTProjectFilesWizardPage(context, bindingContext); - } - - @Override - public String toString() { - return getName(); - } - - public URL getProjectContents() { - String uri = element.getAttribute("archive"); - if (uri != null) { - Bundle bundle = Platform.getBundle(element.getContributor().getName()); - URL resource = bundle.getResource(uri); - return resource; - } - return null; - } - - public boolean requires(JSLibrary library) { - for (String id : getLibraryIds()) { - if (library.getId().equals(id)) { - return true; - } - } - return false; - } - - public JSLibrary[] getRequiredLibraries() { - Set ids = new TreeSet(Arrays.asList(getLibraryIds())); - Set libraries = new HashSet(); - JSLibrary[] jsLibraries = Activator.getJSLibraries(); - for (JSLibrary jsLibrary : jsLibraries) { - if (ids.contains(jsLibrary.getId())) { - libraries.add(jsLibrary); - } - } - return libraries.toArray(new JSLibrary[libraries.size()]); - } - - public int getOrder() { - String attribute = element.getAttribute("order"); - if (attribute != null) { - return Integer.parseInt(attribute); - } - return Integer.MAX_VALUE; - } - - public String getScreenSize() { - return element.getAttribute("screen-size"); - } -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/AbstractDataBindingPage.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/AbstractDataBindingPage.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.WizardPage; - -public abstract class AbstractDataBindingPage extends WizardPage { - public AbstractDataBindingPage(WizardContext context, - DataBindingContext bindingContext, String name, String title, - ImageDescriptor image, String description) { - super(name, title, image); - setDescription(description); - } - - protected boolean isActive() { - return true; - } -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/DatabindingUtils.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/DatabindingUtils.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -package org.symbian.tools.wrttools.wizards; - -public class DatabindingUtils { - -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/HelloWithWRTKitProjectDetailsWizardPage.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/HelloWithWRTKitProjectDetailsWizardPage.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.swt.widgets.Composite; - -public class HelloWithWRTKitProjectDetailsWizardPage extends - WRTProjectFilesWizardPage { - - public HelloWithWRTKitProjectDetailsWizardPage(WizardContext context, - DataBindingContext bindingContext) { - super(context, bindingContext); - } - - @Override - protected void addTemplateControls(Composite root) { - } - - public static final class Factory implements IWizardPageFactory { - public WRTProjectFilesWizardPage createPage(WizardContext context, - DataBindingContext bindingContext) { - return new HelloWithWRTKitProjectDetailsWizardPage(context, - bindingContext); - } - } -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/IWizardData.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/IWizardData.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import org.eclipse.jface.wizard.IWizardPage; - -import java.util.Map; - -/** - * An extended interface for {@link IWizardPage} that provides the data - * collected in the page as a {@link Map} of values indexed by field identifier. - */ -public interface IWizardData extends IWizardPage { - - /** - * Returns a java.util.Map of values indexed by field identifier. - * @return java.util.Map - */ - Map getPageValues(); - -} - diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/IWizardPageFactory.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/IWizardPageFactory.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import org.eclipse.core.databinding.DataBindingContext; - -public interface IWizardPageFactory { - WRTProjectFilesWizardPage createPage(WizardContext context, - DataBindingContext bindingContext); -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/NewWrtAppTemplatePage.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/NewWrtAppTemplatePage.java Mon Aug 23 17:20:11 2010 -0700 +++ b/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/NewWrtAppTemplatePage.java Mon Aug 23 17:45:32 2010 -0700 @@ -67,7 +67,7 @@ createLabel(root, ""); IObservableValue view = SWTObservables.observeSelection(homeScreen); - IObservableValue model = context.getParameterObservable(WizardContext.HOME_SCREEN); + IObservableValue model = context.getParameterObservable("homeScreen"); bindingContext.bindValue(view, model); addTemplateControls(root); diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/NonEmptyStringValidator.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/NonEmptyStringValidator.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import java.text.MessageFormat; - -import org.eclipse.core.databinding.validation.IValidator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.symbian.tools.wrttools.Activator; - -public class NonEmptyStringValidator implements IValidator { - private final String propertyName; - private final AbstractDataBindingPage page; - - public NonEmptyStringValidator(String propertyName, AbstractDataBindingPage page) { - this.propertyName = propertyName; - this.page = page; - } - - public IStatus validate(Object value) { - if (page != null && page.isActive()) { - if (value == null || value.toString().trim().length() == 0) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, - MessageFormat.format("Field {0} is empty", - propertyName)); - } - } - return Status.OK_STATUS; - } -} \ No newline at end of file diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/RssReaderProjectDetailsWizardPage.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/RssReaderProjectDetailsWizardPage.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import java.util.Map; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.swt.widgets.Composite; - -public class RssReaderProjectDetailsWizardPage extends - WRTProjectFilesWizardPage { - - public RssReaderProjectDetailsWizardPage(WizardContext context, - DataBindingContext bindingContext) { - super(context, bindingContext); - } - - @Override - protected void addTemplateControls(Composite root) { - Map extensions = context.getExtensions(); - extensions.put("feedUrl", "http://twitter.com/statuses/user_timeline/21138778.rss"); - extensions.put("feedName", "Symbian Twitter"); - - context.createLabel(root, "Feed URL:"); - context.createTextForExt(root, "feedUrl", "feed URL", bindingContext, - this); - context.createLabel(root, "Feed Name:"); - context.createTextForExt(root, "feedName", "feed name", bindingContext, - this); - context.createLabel(root, ""); - context.createLabel(root, ""); - } - - public static final class Factory implements IWizardPageFactory { - public WRTProjectFilesWizardPage createPage(WizardContext context, - DataBindingContext bindingContext) { - return new RssReaderProjectDetailsWizardPage(context, bindingContext); - } - - } - -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,282 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import java.io.File; -import java.net.URI; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.validation.IValidator; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.databinding.wizard.WizardPageSupport; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.wizard.WizardPage; -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.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; -import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; -import org.eclipse.ui.internal.ide.IIDEHelpContextIds; -import org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea; -import org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea.IErrorMessageReporter; -import org.symbian.tools.wrttools.Activator; -import org.symbian.tools.wrttools.util.RegexpValidator; - -@SuppressWarnings("restriction") -public final class WRTProjectDetailsWizardPage extends WizardPage { - public static final class ProjectNameValidator implements IValidator { - - public IStatus validate(Object value) { - IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); - - String projectFieldContents = (String) value; - IStatus nameStatus = workspace.validateName(projectFieldContents, IResource.PROJECT); - if (!nameStatus.isOK()) { - return nameStatus; - } - - IProject handle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectFieldContents); - if (handle.exists()) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, - IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage); - } - return Status.OK_STATUS; - } - - } - - private ProjectContentsLocationArea locationArea; - private final DataBindingContext bindingContext; - private final WizardContext context; - - public WRTProjectDetailsWizardPage(WizardContext context, DataBindingContext bindingContext) { - super("WRTApp"); - setImageDescriptor(null); - setTitle("Application Details"); - setDescription("Specify application details"); - this.context = context; - this.bindingContext = bindingContext; - } - - public void createControl(Composite parent) { - Composite root = new Composite(parent, SWT.NONE); - - initializeDialogUnits(parent); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(root, IIDEHelpContextIds.NEW_PROJECT_WIZARD_PAGE); - - WizardPageSupport.create(this, bindingContext); - root.setLayout(new GridLayout(2, false)); - createProjectNameGroup(root); - - context.createLabel(root, ""); - context.createLabel(root, ""); - context.createLabel(root, "Application identifier:"); - - context.createText(root, WizardContext.WIDGET_ID, "applicatoin identifier", bindingContext, null, - new RegexpValidator("[\\w]*(\\.\\w[\\w]*)*", "{0} is not a valid applicatoin ID", true)); - context.createLabel(root, ""); - context.createLabel(root, "This id should be unique for successful installation of application on the device"); - - context.createLabel(root, ""); - context.createLabel(root, ""); - - context.createLabel(root, "Application name:"); - - context.createText(root, WizardContext.WIDGET_NAME, "application name", bindingContext, null, - new RegexpValidator("[^\\w\\. ]", "Application name cannot contain {0} character", false)); - - context.createLabel(root, ""); - context.createLabel(root, "This will be the application display name on the device"); - - Composite composite = new Composite(root, SWT.NONE); - GridLayout gridLayout = new GridLayout(1, false); - gridLayout.marginWidth = 0; - composite.setLayout(gridLayout); - composite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, true, 2, 1)); - - locationArea = new ProjectContentsLocationArea(getErrorReporter(), composite); - if (context.getProjectName() != null && context.getProjectName().trim().length() > 0) { - locationArea.updateProjectName(context.getProjectName()); - } - - // Scale the button based on the rest of the dialog - setButtonLayoutData(locationArea.getBrowseButton()); - - setPageComplete(validatePage()); - // Show description on opening - setErrorMessage(null); - setMessage(null); - setControl(root); - Dialog.applyDialogFont(root); - } - - /** - * Creates the project name specification controls. - * - * @param parent - * the parent composite - */ - private final void createProjectNameGroup(Composite parent) { - // new project label - Label projectLabel = new Label(parent, SWT.NONE); - projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel); - projectLabel.setFont(parent.getFont()); - - Text projectNameField = context.createText(parent, WizardContext.PROJECT_NAME, "project name", bindingContext, - null, new ProjectNameValidator()); - - projectNameField.setFont(parent.getFont()); - - projectNameField.addListener(SWT.Modify, nameModifyListener); - } - - /** - * Returns the current project location path as entered by the user, or its - * anticipated initial value. Note that if the default has been returned the - * path in a project description used to create a project should not be set. - * - * @return the project location path or its anticipated initial value. - */ - public IPath getLocationPath() { - return new Path(locationArea.getProjectLocation()); - } - - /** - * /** Returns the current project location URI as entered by the user, or - * null if a valid project location has not been entered. - * - * @return the project location URI, or null - * @since 3.2 - */ - public URI getLocationURI() { - return locationArea.getProjectLocationURI(); - } - - private final Listener nameModifyListener = new Listener() { - public void handleEvent(Event e) { - if (isPageComplete()) { - setLocationForSelection(); - boolean valid = validatePage(); - setPageComplete(valid); - } - } - }; - - /** - * Get an error reporter for the receiver. - * - * @return IErrorMessageReporter - */ - private IErrorMessageReporter getErrorReporter() { - return new IErrorMessageReporter() { - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea - * .IErrorMessageReporter#reportError(java.lang.String) - */ - public void reportError(String errorMessage, boolean infoOnly) { - if (infoOnly) { - setMessage(errorMessage, IStatus.INFO); - setErrorMessage(null); - } else { - setErrorMessage(errorMessage); - } - boolean valid = errorMessage == null; - if (valid) { - valid = validatePage(); - } - - setPageComplete(valid); - } - }; - } - - /** - * Set the location to the default location if we are set to useDefaults. - */ - void setLocationForSelection() { - locationArea.updateProjectName(context.getProjectName()); - } - - /** - * Returns whether this page's controls currently all contain valid values. - * - * @return true if all controls are valid, and - * false if at least one is invalid - */ - protected boolean validatePage() { - if (isPageComplete() || context.getProjectName().trim().length() == 0) { - return false; - } - String projectName = context.getProjectName(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - locationArea.setExistingProject(project); - - String validLocationMessage = locationArea.checkValidLocation(); - if (validLocationMessage != null) { // there is no destination location - // given - setErrorMessage(validLocationMessage); - return false; - } - File file = new File(locationArea.getProjectLocationURI()); - if (file.isFile()) { - setErrorMessage(String.format("%s is an existing file", file)); - return false; - } else if (file.isDirectory() && file.listFiles().length > 0) { - setErrorMessage(String.format("%s is a non-empty folder", file)); - return false; - } - - setErrorMessage(null); - setMessage(null); - return true; - } - - /** - * Returns the useDefaults. - * - * @return boolean - */ - public boolean useDefaults() { - return locationArea.isDefault(); - } - - @Override - public void setVisible(boolean visible) { - // TODO Auto-generated method stub - super.setVisible(visible); - setErrorMessage(null); - } -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectFilesWizardPage.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectFilesWizardPage.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.beans.BeansObservables; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.jface.databinding.swt.SWTObservables; -import org.eclipse.jface.databinding.wizard.WizardPageSupport; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -public class WRTProjectFilesWizardPage extends AbstractDataBindingPage { - private boolean isActive; - protected final DataBindingContext bindingContext; - protected final WizardContext context; - - public WRTProjectFilesWizardPage(WizardContext context, - DataBindingContext bindingContext) { - super(context, bindingContext, "WRTApplicationFiles", - "Application Files", null, "Specify application file names"); - this.context = context; - this.bindingContext = bindingContext; - } - - protected void addTemplateControls(Composite root) { - // Subclasses will override - } - - public void createControl(Composite parent) { - Composite root = new Composite(parent, SWT.NONE); - WizardPageSupport.create(this, bindingContext); - root.setLayout(new GridLayout(2, false)); - - context.createLabel(root, "Name of main HTML:"); - context.createText(root, WizardContext.HTML_FILE, "HTML file name", - bindingContext, this); - context.createLabel(root, ""); - context.createLabel(root, ""); - context.createLabel(root, "Name of CSS file:"); - context.createText(root, WizardContext.CSS_FILE, "CSS file name", - bindingContext, this); - context.createLabel(root, ""); - context.createLabel(root, ""); - context.createLabel(root, "Name of JavaScript file:"); - context.createText(root, WizardContext.JS_FILE, "JavaScript file name", - bindingContext, this); - - context.createLabel(root, ""); - Button homeScreen = new Button(root, SWT.CHECK); - homeScreen.setText("Enable HomeScreen"); - - context.createLabel(root, ""); - context.createLabel(root, ""); - - IObservableValue view = SWTObservables.observeSelection(homeScreen); - IObservableValue model = BeansObservables.observeValue(context, - WizardContext.HOME_SCREEN); - bindingContext.bindValue(view, model); - - addTemplateControls(root); - - setControl(root); - } - - @Override - protected boolean isActive() { - return isActive; - } - - public void setActive(boolean isActive) { - this.isActive = isActive; - } -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.beans.BeansObservables; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.jface.databinding.viewers.IViewerObservableValue; -import org.eclipse.jface.databinding.viewers.ViewersObservables; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Text; -import org.symbian.tools.wrttools.core.ProjectTemplate; - -public class WRTProjectTemplateWizardPage extends WizardPage { - public class ProjectTemplateLabelProvider extends LabelProvider { - - @Override - public Image getImage(Object element) { - return ((ProjectTemplate) element).getIcon(); - } - - @Override - public String getText(Object element) { - return ((ProjectTemplate) element).getName(); - } - } - - private TableViewer templates; - private Text description; - private final WizardContext context; - private final DataBindingContext bindingContext; - - public WRTProjectTemplateWizardPage(WizardContext context, - DataBindingContext bindingContext) { - super("Create a New Mobile Web Application"); - setTitle("Create a New Mobile Web Application"); - this.context = context; - this.bindingContext = bindingContext; - setDescription("Select project name and template that will be used to populate"); - } - - public void createControl(Composite parent) { - ProjectTemplate[] allTemplates = ProjectTemplate.getAllTemplates(); - - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, - true, true)); - FormLayout layout = new FormLayout(); - layout.marginWidth = 5; - composite.setLayout(layout); - - templates = new TableViewer(composite, SWT.BORDER | SWT.SINGLE); - FormData templatesData = new FormData(); - templatesData.top = new FormAttachment(0, 0); - templatesData.left = new FormAttachment(0, 0); - templatesData.right = new FormAttachment(40, -2); - templatesData.bottom = new FormAttachment(100, -8); - templates.getControl().setLayoutData(templatesData); - templates.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection) event - .getSelection(); - final ProjectTemplate template = (ProjectTemplate) selection - .getFirstElement(); - refreshSelection(template); - } - }); - templates.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent arg0) { - switchWizardPage(); - } - }); - - description = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.WRAP - | SWT.READ_ONLY); - FormData descriptionData = new FormData(); - descriptionData.top = new FormAttachment(0, 0); - descriptionData.bottom = new FormAttachment(100, -8); - descriptionData.left = new FormAttachment(templates.getControl(), 5); - descriptionData.right = new FormAttachment(100, 0); - descriptionData.width = 50; - description.setLayoutData(descriptionData); - - templates.setContentProvider(new ArrayContentProvider()); - templates.setLabelProvider(new ProjectTemplateLabelProvider()); - templates.setSorter(new ViewerSorter() { - @Override - public int category(Object element) { - return Integer.valueOf(((ProjectTemplate) element).getOrder()); - } - }); - templates.setInput(allTemplates); - - setPageComplete(false); - - IViewerObservableValue selection = ViewersObservables - .observeSingleSelection(templates); - IObservableValue property = BeansObservables.observeValue(context, - WizardContext.TEMPLATE); - - bindingContext.bindValue(selection, property); - if (context.getTemplate() != null) { - refreshSelection(context.getTemplate()); - } - setErrorMessage(null); - setControl(composite); - } - - protected void switchWizardPage() { - Display display = getShell().getDisplay(); - display.asyncExec(new Runnable() { - public void run() { - if (isPageComplete()) { - IWizardPage nextPage = getWizard().getNextPage( - WRTProjectTemplateWizardPage.this); - getContainer().showPage(nextPage); - } - } - }); - } - - protected void refreshSelection(ProjectTemplate template) { - if (template != null) { - description.setText(template.getDescription()); - } else { - description.setText(""); - } - validatePage(); - } - - protected boolean validatePage() { - if (templates.getSelection().isEmpty()) { - setErrorMessage("Project template is not selected"); - setPageComplete(false); - return false; - } else { - setErrorMessage(null); - setPageComplete(true); - return true; - } - } - - public ProjectTemplate getSelectedProjectTemplate() { - IStructuredSelection selection = (IStructuredSelection) templates - .getSelection(); - return (ProjectTemplate) selection.getFirstElement(); - } - - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - templates.getControl().setFocus(); - } -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WizardContext.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WizardContext.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,361 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.beans.BeansObservables; -import org.eclipse.core.databinding.observable.Observables; -import org.eclipse.core.databinding.observable.map.IObservableMap; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.validation.IValidator; -import org.eclipse.jface.databinding.swt.ISWTObservableValue; -import org.eclipse.jface.databinding.swt.SWTObservables; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.symbian.tools.wrttools.core.ProjectTemplate; -import org.symbian.tools.wrttools.core.libraries.JSLibrary; -import org.symbian.tools.wrttools.util.CompoundValidator; -import org.symbian.tools.wrttools.util.Util; - -public class WizardContext { - public static final String CSS_FILE = "cssFile"; - public static final String HTML_FILE = "htmlFile"; - public static final String JS_FILE = "jsFile"; - public static final String TEMPLATE = "template"; - public static final String WIDGET_ID = "widgetId"; - public static final String WIDGET_NAME = "widgetName"; - public static final String HOME_SCREEN = "homeScreen"; - public static final String LIBRARIES = "libraries"; - public static final String PROJECT_NAME = "projectName"; - - private String cssFile; - private String projectName = ""; - private String htmlFile; - private String jsFile; - private final PropertyChangeSupport propertySupport = new PropertyChangeSupport( - this); - private ProjectTemplate template; - private String widgetId; - private String widgetName; - private Map extensions = new TreeMap(); - private boolean homeScreen; - private Set libraries = new HashSet(); - - public WizardContext() { - setTemplate(getFirstTemplate(ProjectTemplate.getAllTemplates())); - } - - private ProjectTemplate getFirstTemplate(ProjectTemplate[] allTemplates) { - ProjectTemplate template = null; - for (ProjectTemplate projectTemplate : allTemplates) { - if (template == null - || template.getOrder() > projectTemplate.getOrder()) { - template = projectTemplate; - } - } - return template; - } - - - public void addPropertyChangeListener(PropertyChangeListener arg0) { - propertySupport.addPropertyChangeListener(arg0); - } - - public void addPropertyChangeListener(String arg0, - PropertyChangeListener arg1) { - propertySupport.addPropertyChangeListener(arg0, arg1); - } - - public String getProjectName() { - return projectName; - } - - public void setProjectName(String projectName) { - String prev = getProjectName(); - String prevId = getWidgetId(); - String prevName = getWidgetName(); - this.projectName = projectName; - propertySupport.firePropertyChange(PROJECT_NAME, getProjectName(), prev); - if (widgetName == null) { - propertySupport.firePropertyChange(WIDGET_NAME, getWidgetName(), prevName); - if (widgetId == null) { - propertySupport.firePropertyChange(WIDGET_ID, getWidgetId(), prevId); - } - } - } - - public String getCssFile() { - if (cssFile == null) { - if (template != null) { - return template.getDefaultCssFile(); - } - } - return cssFile; - } - - private String getDefaultWidgetId() { - String name = Util.removeSpaces(getWidgetName()); - return MessageFormat.format("com.company.{0}", name.length() > 0 ? name - : "ApplicationName"); - } - - public String getHtmlFile() { - if (htmlFile == null) { - if (template != null) { - return template.getDefaultHtmlFile(); - } - } - return htmlFile; - } - - public String getJsFile() { - if (jsFile == null) { - if (template != null) { - return template.getDefaultJsFile(); - } - } - return jsFile; - } - - public ProjectTemplate getTemplate() { - return template; - } - - public String getWidgetId() { - if (widgetId == null) { - return getDefaultWidgetId(); - } - return widgetId; - } - - public String getWidgetName() { - return widgetName == null ? getProjectName() : widgetName; - } - - public void removePropertyChangeListener(PropertyChangeListener arg0) { - propertySupport.removePropertyChangeListener(arg0); - } - - public void removePropertyChangeListener(String arg0, - PropertyChangeListener arg1) { - propertySupport.removePropertyChangeListener(arg0, arg1); - } - - public void setCssFile(String cssFile) { - if (template != null && template.getDefaultCssFile().equals(cssFile)) { - cssFile = null; - } - String prev = this.cssFile; - this.cssFile = cssFile; - propertySupport.firePropertyChange(CSS_FILE, cssFile, prev); - } - - public void setHtmlFile(String htmlFile) { - if (template != null && template.getDefaultHtmlFile().equals(htmlFile)) { - htmlFile = null; - } - String prev = this.htmlFile; - this.htmlFile = htmlFile; - propertySupport.firePropertyChange(HTML_FILE, htmlFile, prev); - } - - public void setJsFile(String jsFile) { - if (template != null && template.getDefaultJsFile().equals(jsFile)) { - jsFile = null; - } - String prev = this.jsFile; - this.jsFile = jsFile; - propertySupport.firePropertyChange(JS_FILE, jsFile, prev); - } - - public void setTemplate(ProjectTemplate template) { - String html = getHtmlFile(); - String js = getJsFile(); - String css = getCssFile(); - ProjectTemplate prev = this.template; - this.template = template; - propertySupport.firePropertyChange(TEMPLATE, template, prev); - if (htmlFile == null) { - propertySupport.firePropertyChange(HTML_FILE, getHtmlFile(), html); - } - if (jsFile == null) { - propertySupport.firePropertyChange(JS_FILE, getJsFile(), js); - } - if (cssFile == null) { - propertySupport.firePropertyChange(CSS_FILE, getCssFile(), css); - } - if (cssFile == null) { - propertySupport.firePropertyChange(LIBRARIES, getLibraries(), - libraries); - } - } - - public void setWidgetId(String widgetId) { - String prev = getWidgetId(); - if (getDefaultWidgetId().equals(widgetId)) { - widgetId = null; - } - this.widgetId = widgetId; - propertySupport.firePropertyChange(WIDGET_ID, getWidgetId(), prev); - } - - public void setWidgetName(String widgetName) { - String prevId = getWidgetId(); - String prev = getWidgetName(); - if (widgetName == getProjectName()) { - this.widgetName = null; - } else { - this.widgetName = widgetName; - } - propertySupport.firePropertyChange(WIDGET_NAME, getWidgetName(), prev); - if (widgetId == null) { - propertySupport - .firePropertyChange(WIDGET_ID, getWidgetId(), prevId); - } - } - - public void setExtensions(Map extensions) { - this.extensions = extensions; - } - - public Map getExtensions() { - return extensions; - } - - public Map getTemplateVars() { - Map vars = new TreeMap(); - - vars.put("widgetName", getWidgetName()); - vars.put("widgetId", getWidgetId()); - vars.put("mainHtml", getHtmlFileName()); - vars.put("mainCss", getCssFileName()); - vars.put("mainJs", getJsFileName()); - vars.put("homeScreen", String.valueOf(isHomeScreen())); - vars.putAll(extensions); - - return vars; - } - - public boolean isHomeScreen() { - return homeScreen; - } - - public void setHomeScreen(boolean homeScreen) { - boolean old = homeScreen; - this.homeScreen = homeScreen; - propertySupport.firePropertyChange(HOME_SCREEN, old, homeScreen); - } - - public String getHtmlFileName() { - return stripExtension(getHtmlFile(), "htm", "html"); - } - - public String getJsFileName() { - return stripExtension(getJsFile(), "js"); - } - - public String getCssFileName() { - return stripExtension(getCssFile(), "css"); - } - - private String stripExtension(String fileName, String... extensions) { - for (String extension : extensions) { - String extensionAndDot = "." + extension; - if (fileName.endsWith(extensionAndDot)) { - return fileName.substring(0, fileName.length() - - extensionAndDot.length()); - } - } - return fileName; - } - - public boolean isRequiredLibrary(JSLibrary element) { - return template != null && template.requires(element); - } - - public Set getLibraries() { - final Set set = new HashSet(libraries); - if (template != null) { - set.addAll(Arrays.asList(template.getRequiredLibraries())); - } - return set; - } - - public void setLibraries(Set libraries) { - Set prev = this.libraries; - this.libraries = libraries; - propertySupport.firePropertyChange(LIBRARIES, prev, libraries); - } - - public Map getLibraryParameters(JSLibrary library) { - return Collections.emptyMap(); - } - - protected Text createText(Composite root, String property, - String propertyName, DataBindingContext bindingContext, - AbstractDataBindingPage page, IValidator... validators) { - return createText(root, BeansObservables.observeValue(this, property), - propertyName, bindingContext, page, validators); - } - - protected Text createTextForExt(Composite root, String property, - String propertyName, DataBindingContext bindingContext, - AbstractDataBindingPage page) { - IObservableMap map = BeansObservables.observeMap(this, "extensions"); - IObservableValue entry = Observables.observeMapEntry(map, property, - String.class); - return createText(root, entry, propertyName, bindingContext, page); - } - - private Text createText(Composite root, IObservableValue model, - String propertyName, DataBindingContext bindingContext, - AbstractDataBindingPage page, IValidator... validators) { - Text text = new Text(root, SWT.BORDER); - text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - ISWTObservableValue view = SWTObservables.observeText(text, SWT.Modify); - UpdateValueStrategy strategy = new UpdateValueStrategy( - UpdateValueStrategy.POLICY_UPDATE); - NonEmptyStringValidator validator = new NonEmptyStringValidator( - propertyName, page); - strategy.setBeforeSetValidator(validators.length == 0 ? validator - : new CompoundValidator(validator, validators)); - bindingContext.bindValue(view, model, strategy, null); - return text; - } - - protected void createLabel(Composite root, String text) { - Label label = new Label(root, SWT.NONE); - label.setText(text); - } - -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtKitLibraryWizardPage.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtKitLibraryWizardPage.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -package org.symbian.tools.wrttools.wizards; - -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.jsdt.core.IIncludePathEntry; -import org.eclipse.wst.jsdt.core.IJavaScriptProject; -import org.eclipse.wst.jsdt.core.JavaScriptCore; -import org.eclipse.wst.jsdt.internal.ui.wizards.dialogfields.DialogField; -import org.eclipse.wst.jsdt.internal.ui.wizards.dialogfields.LayoutUtil; -import org.eclipse.wst.jsdt.ui.wizards.IJsGlobalScopeContainerPage; -import org.eclipse.wst.jsdt.ui.wizards.IJsGlobalScopeContainerPageExtension; -import org.eclipse.wst.jsdt.ui.wizards.IJsGlobalScopeContainerPageExtension2; -import org.eclipse.wst.jsdt.ui.wizards.NewElementWizardPage; - -@SuppressWarnings("restriction") -public class WrtKitLibraryWizardPage extends NewElementWizardPage implements IJsGlobalScopeContainerPage, IJsGlobalScopeContainerPageExtension, IJsGlobalScopeContainerPageExtension2 { - - private static final String CONTAINER_ID="org.symbian.wrtkit"; - - public WrtKitLibraryWizardPage() { - super("WrtKitLib"); - setTitle("WRTKit JavaScript Library"); - } - - public boolean finish() { - return true; - } - - public IIncludePathEntry getSelection() { - System.out.println("Unimplemented method:BaseLibraryWizardPage.getSelection"); - return null; - } - - public void setSelection(IIncludePathEntry containerEntry) { - } - - public void createControl(Composite parent) { - Composite composite= new Composite(parent, SWT.NONE); - composite.setFont(parent.getFont()); - DialogField field = new DialogField(); - - field.setLabelText("Symbian WRTKit library support was added to your project"); - LayoutUtil.doDefaultLayout(composite, new DialogField[] {field }, false, SWT.DEFAULT, SWT.DEFAULT); - Dialog.applyDialogFont(composite); - setControl(composite); - setDescription("Symbian WRTKit Support"); - } - - public void initialize(IJavaScriptProject project, IIncludePathEntry[] currentEntries) { - // nothing to initialize - } - - public IIncludePathEntry[] getNewContainers() { - IIncludePathEntry library = JavaScriptCore.newContainerEntry( new Path(CONTAINER_ID)); - return new IIncludePathEntry[] {library}; - } - -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,291 +0,0 @@ -/** - * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.io.Writer; -import java.lang.reflect.InvocationTargetException; -import java.net.URI; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; -import org.symbian.tools.wrttools.Activator; -import org.symbian.tools.wrttools.WRTProject; -import org.symbian.tools.wrttools.core.ProjectTemplate; -import org.symbian.tools.wrttools.core.WRTImages; -import org.symbian.tools.wrttools.core.libraries.JSLibrary; -import org.symbian.tools.wrttools.util.NonClosingStream; -import org.symbian.tools.wrttools.util.ProjectUtils; -import org.symbian.tools.wrttools.wizards.libraries.WRTProjectLibraryWizardPage; - -public class WrtWidgetWizard extends Wizard implements INewWizard, - IExecutableExtension { - private WizardContext context; - private DataBindingContext bindingContext; - private final Map templateDetails = new HashMap(); - private WRTProjectTemplateWizardPage templatesPage; - private WRTProjectDetailsWizardPage detailsPage; - private IConfigurationElement config; - private WRTProjectLibraryWizardPage librariesPage; - - public WrtWidgetWizard() { - setDefaultPageImageDescriptor(WRTImages.newWizardBanner()); - setWindowTitle("New Mobile Web Application"); - setNeedsProgressMonitor(true); - } - - public boolean performFinish() { - final IProject[] holder = new IProject[1]; - final URI locationURI = detailsPage.getLocationURI(); - try { - getContainer().run(true, true, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - holder[0] = action(locationURI, monitor); - } - }); - } catch (InvocationTargetException e) { - Activator.log(e); - } catch (InterruptedException e) { - Activator.log(e); - } - BasicNewProjectResourceWizard.updatePerspective(config); - if (holder[0] != null) { - ProjectUtils.focusOn(holder[0]); - } - return true; - } - - protected IProject action(final URI locationURI, IProgressMonitor monitor) { - final IProject[] holder = new IProject[1]; - try { - ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - holder[0] = createAndInitProject(locationURI, monitor); - } - }, monitor); - } catch (CoreException e) { - Activator.log(e); - } - return holder[0]; - } - - protected IProject createAndInitProject(URI locationURI, - IProgressMonitor monitor) throws CoreException { - monitor.beginTask("Creating project", 100); - final IProject project = ProjectUtils.createWrtProject(context - .getProjectName(), locationURI, new SubProgressMonitor(monitor, - 30)); - populateProject(project, new SubProgressMonitor(monitor, 30)); - try { - initLibraries(project, context.getLibraries(), - new SubProgressMonitor(monitor, 40)); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, - Activator.PLUGIN_ID, "Failed to setup libraries", e)); - } - monitor.done(); - return project; - } - - private void initLibraries(IProject project, Set set, - IProgressMonitor progressMonitor) throws IOException, CoreException { - if (set.isEmpty()) { - progressMonitor.done(); - return; - } - progressMonitor.beginTask("Installing JS libraries", 100); - int perContainer = 90 / set.size(); - for (JSLibrary library : set) { - library.install(project, context.getLibraryParameters(library), - new SubProgressMonitor(progressMonitor, perContainer)); - } - progressMonitor.done(); - } - - private void populateProject(IProject project, IProgressMonitor monitor) - throws CoreException { - ProjectTemplate t = context.getTemplate(); - new WRTProject(project).setPreferredScreenSize(t.getScreenSize()); - URL projectContents = t.getProjectContents(); - Map vars = context.getTemplateVars(); - - ZipInputStream stream = null; - try { - Velocity.init(); - VelocityContext ctx = new VelocityContext(vars); - stream = new ZipInputStream(projectContents.openStream()); - monitor.beginTask("Generating project contents", - IProgressMonitor.UNKNOWN); - ZipEntry entry; - while ((entry = stream.getNextEntry()) != null - && !monitor.isCanceled()) { - String name = entry.getName(); - boolean isVelocity = name.endsWith(".velocitytemplate"); - if (isVelocity) { - name = name.substring(0, name.length() - - ".velocitytemplate".length()); - } - if (name.startsWith("$")) { - int dotLocation = name.indexOf("."); - String template = name.substring(1, - dotLocation > 1 ? dotLocation : name.length()); - if (vars.containsKey(template)) { - name = vars.get(template) - + name.substring(dotLocation > 1 ? dotLocation - : name.length()); - } - } - if (entry.isDirectory()) { - IFolder folder = project.getFolder(entry.getName()); - folder.create(false, true, new SubProgressMonitor(monitor, - 1)); - } else if (isVelocity) { - copyTemplate(project, name, stream, (int) entry.getSize(), - ctx, monitor); - } else { - ProjectUtils.copyFile(project, name, stream, - entry.getSize(), monitor); - } - stream.closeEntry(); - } - monitor.done(); - } catch (Exception e) { - throw new CoreException(new Status(IStatus.ERROR, - Activator.PLUGIN_ID, "Project creation failed", e)); - } finally { - if (stream != null) { - try { - stream.close(); - } catch (IOException e) { - // Ignore - something really bad happened - } - } - } - } - - private void copyTemplate(IProject project, String name, - ZipInputStream stream, int size, VelocityContext ctx, - IProgressMonitor monitor) throws IOException, CoreException { - // Templates will not be more then a few megs - we can afford the memory - ByteArrayOutputStream file = new ByteArrayOutputStream(); - - Reader reader = new InputStreamReader(new NonClosingStream(stream)); - Writer writer = new OutputStreamWriter(file); - - Velocity.evaluate(ctx, writer, name, reader); - - reader.close(); - writer.close(); - - ByteArrayInputStream contents = new ByteArrayInputStream( - file.toByteArray()); - IFile f = project.getFile(name); - f.create(contents, true, new SubProgressMonitor(monitor, 1)); - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - context = new WizardContext(); - bindingContext = new DataBindingContext(); - } - - @Override - public void addPages() { - detailsPage = new WRTProjectDetailsWizardPage(context, bindingContext); - addPage(detailsPage); - - templatesPage = new WRTProjectTemplateWizardPage(context, - bindingContext); - addPage(templatesPage); - - ProjectTemplate[] templates = ProjectTemplate.getAllTemplates(); - for (ProjectTemplate projectTemplate : templates) { - final WRTProjectFilesWizardPage page = projectTemplate - .createWizardPage(context, bindingContext); - addPage(page); - templateDetails.put(projectTemplate, page); - } - - librariesPage = new WRTProjectLibraryWizardPage(context, bindingContext); - addPage(librariesPage); - } - - @Override - public boolean canFinish() { - return super.canFinish() - && getContainer().getCurrentPage() == getPages()[getPageCount() - 1]; - } - - @Override - public IWizardPage getNextPage(IWizardPage page) { - if (page == templatesPage) { - ProjectTemplate template = context.getTemplate(); - if (template != null) { - WRTProjectFilesWizardPage activePage = templateDetails - .get(template); - for (WRTProjectFilesWizardPage wizardPage : templateDetails - .values()) { - wizardPage.setActive(wizardPage == activePage); - } - bindingContext.updateModels(); - return activePage; - } - } - if (page instanceof WRTProjectFilesWizardPage) { - return librariesPage; - } - return super.getNextPage(page); - } - - public void setInitializationData(IConfigurationElement config, - String propertyName, Object data) throws CoreException { - this.config = config; - } -} diff -r e2f461f0a9e0 -r 77edd0cbdfe0 plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/libraries/WRTProjectLibraryWizardPage.java --- a/plugins/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/libraries/WRTProjectLibraryWizardPage.java Mon Aug 23 17:20:11 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/** - * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Symbian Foundation - initial contribution. - * Contributors: - * Description: - * Overview: - * Details: - * Platforms/Drives/Compatibility: - * Assumptions/Requirement/Pre-requisites: - * Failures and causes: - */ -package org.symbian.tools.wrttools.wizards.libraries; - -import org.eclipse.core.databinding.DataBindingContext; -import org.eclipse.core.databinding.beans.BeansObservables; -import org.eclipse.core.databinding.observable.set.IObservableSet; -import org.eclipse.jface.databinding.viewers.IViewerObservableSet; -import org.eclipse.jface.databinding.viewers.ViewersObservables; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.symbian.tools.wrttools.Activator; -import org.symbian.tools.wrttools.core.libraries.JSLibrary; -import org.symbian.tools.wrttools.wizards.WizardContext; - -public class WRTProjectLibraryWizardPage extends WizardPage { - public static final class LibraryCheckStateListener implements ICheckStateListener { - private final WizardContext context; - - public LibraryCheckStateListener(WizardContext context) { - this.context = context; - } - - public void checkStateChanged(CheckStateChangedEvent event) { - if (!event.getChecked() && context.isRequiredLibrary((JSLibrary) event.getElement())) { - event.getCheckable().setChecked(event.getElement(), true); - } - } - - } - private CheckboxTableViewer list; - private final WizardContext context; - private final DataBindingContext bindingContext; - - public WRTProjectLibraryWizardPage(WizardContext context, DataBindingContext bindingContext) { - super("ProjectLibraries", "WRT Project Libraries", null); - this.context = context; - this.bindingContext = bindingContext; - setDescription("Select libraries to add to your project"); - } - - public void createControl(Composite parent) { - list = CheckboxTableViewer.newCheckList(parent, SWT.BORDER); - list.setLabelProvider(new LibraryLabelProvider()); - list.setContentProvider(new ArrayContentProvider()); - list.setInput(Activator.getJSLibraries()); - list.addCheckStateListener(new LibraryCheckStateListener(context)); - IViewerObservableSet ui = ViewersObservables.observeCheckedElements(list, JSLibrary.class); - IObservableSet model = BeansObservables.observeSet(context, WizardContext.LIBRARIES); - bindingContext.bindSet(model, ui); - setControl(list.getControl()); - } - -}