--- a/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Mac OS X).launch Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools.product/launch/WRT IDE Product (Mac OS X).launch Mon Jul 12 18:29:46 2010 -0700
@@ -21,8 +21,8 @@
<stringAttribute key="product" value="org.symbian.tools.wrttools.product.product"/>
<stringAttribute key="productFile" value="\org.symbian.tools.wrttools.product\wrt-ide.product"/>
<booleanAttribute key="restart" value="false"/>
-<stringAttribute key="selected_target_plugins" value="org.apache.xalan@default:default,org.eclipse.wst.sse.ui.infopop@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.ui.intro@default:default,org.eclipse.osgi@-1:true,org.eclipse.wst.common.environment@default:default,org.apache.commons.codec*1.3.0.v20100106-1700@default:default,org.eclipse.wst.validation.ui@default:default,org.eclipse.debug.ui@default:default,javax.servlet@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.jdom@default:default,org.eclipse.team.ui@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.ui.net@default:default,org.eclipse.core.databinding.property@default:default,org.apache.commons.logging*1.0.4.v200904062259@default:default,org.eclipse.ecf@default:default,org.eclipse.ui.ide@default:default,org.eclipse.debug.core@default:default,org.apache.commons.httpclient*3.1.0.v20080605-1935@default:default,org.eclipse.wst.validation.infopop@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.team.core@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ui.ide.application@default:default,com.jcraft.jsch@default:default,org.eclipse.wst.standard.schemas@default:default,org.eclipse.text@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.help.base@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.wst.jsdt.support.firefox@default:default,org.eclipse.wst.dtd.core@default:default,org.eclipse.ui.browser@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.wst.internet.monitor.core@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.platform@default:default,org.eclipse.swt@default:default,org.eclipse.compare@default:default,org.eclipse.cvs@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.equinox.ds@1:true,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.platform.doc.user@default:default,org.apache.velocity@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.core.contenttype@default:default,org.eclipse.help.webapp@default:default,org.eclipse.equinox.http.servlet@default:default,org.apache.commons.lang@default:default,org.eclipse.wst.internet.cache@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.wst.common.emf@default:default,org.mozilla.xpcom@default:default,org.eclipse.update.core@default:default,org.eclipse.wst.validation@default:default,org.eclipse.wst.xml.ui.infopop@default:default,org.apache.xml.resolver@default:default,org.eclipse.ui.editors@default:default,org.eclipse.core.resources@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.wst.jsdt.web.ui@default:default,org.eclipse.wst.css.ui@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.wst.css.core@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.wst.sse.doc.user@default:default,org.eclipse.core.boot@default:default,org.eclipse.wst.internet.monitor.ui@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.update.scheduler@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.emf.common@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.ui.views@default:default,org.eclipse.wst.jsdt.support.ie@default:default,org.eclipse.core.jobs@default:default,org.apache.bcel@default:default,org.apache.commons.collections@default:default,com.ibm.icu@default:default,org.eclipse.wst.doc.user@default:default,org.eclipse.wst.html.ui.infopop@default:default,org.eclipse.update.configurator@3:true,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.wst.common.infopop@default:default,org.mortbay.jetty.server@default:default,org.apache.log4j@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.equinox.util@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.apache.jasper@default:default,org.eclipse.wst.jsdt.doc@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.wst.sse.core@default:default,org.mozilla.xulrunner.carbon.macosx@default:false,org.eclipse.gef@default:default,org.eclipse.help.appserver@default:default,javax.servlet.jsp@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.wst.jsdt.ui@default:default,org.eclipse.core.net@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.wst.jsdt.web.core@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.core.variables@default:default,org.mortbay.jetty.util@default:default,org.apache.xml.serializer@default:default,org.eclipse.equinox.p2.engine@default:default,javax.xml@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.jsch.core@default:default,org.eclipse.equinox.launcher.cocoa.macosx@default:false,org.apache.lucene.analysis@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.wst.sse.ui@default:default,org.apache.xerces@default:default,org.eclipse.help.ui@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.compare.core@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.equinox.security.ui@default:default,org.mozilla.xulrunner@default:default,org.eclipse.wst.jsdt.core@default:default,org.eclipse.wst.xml.xpath.core@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.eclipse.swt.cocoa.macosx@default:false,org.eclipse.search@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.app@default:default,java_cup.runtime@default:default,org.eclipse.equinox.concurrent@default:default,org.apache.commons.el@default:default,org.eclipse.jface@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.wst.common.ui@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.ui.console@default:default,org.eclipse.jface.text@default:default,org.eclipse.wst.jsdt.manipulation@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.security.macosx@default:false,org.eclipse.ui.forms@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.equinox.common@2:true,org.eclipse.help@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.wst.common.core@default:default,org.eclipse.update.ui@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.wst.common.frameworks.ui@default:default,org.eclipse.osgi.util@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.core.filesystem@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.core.runtime@default:true,org.sat4j.core@default:default,org.eclipse.rcp@default:default,org.apache.lucene@default:default,org.eclipse.jem.util@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.osgi.services@default:default,org.eclipse.emf.edit@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.commands@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.draw2d@default:default,org.sat4j.pb@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.wst.html.core@default:default,org.eclipse.core.databinding@default:default,org.eclipse.ui.cheatsheets@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.chromium.debug.ui@default:default,org.w3c.css@default:default,org.symbian.tools.wrttools.previewer@default:default,org.chromium.debug.core@default:default,org.symbian.tools.wrttools.doc.WebDeveloper@default:default,org.symbian.tools.wrttools.product@default:default,org.symbian.tools.wrttools.debug.core@default:default,org.symbian.tools.wrttools@default:default,org.chromium.sdk@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.equinox.launcher.cocoa.macosx@default:false,org.eclipse.equinox.ds@1:true,org.eclipse.core.boot@default:default,org.eclipse.equinox.p2.director@default:default,javax.xml@default:default,org.eclipse.wst.jsdt.support.firefox@default:default,org.eclipse.team.cvs.core@default:default,org.eclipse.core.jobs@default:default,org.eclipse.compare.core@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.core.contenttype@default:default,org.sat4j.pb@default:default,org.apache.commons.lang@default:default,org.eclipse.core.variables@default:default,org.sat4j.core@default:default,org.eclipse.wst.validation.infopop@default:default,org.eclipse.emf.common@default:default,org.eclipse.wst.validation.ui@default:default,javax.servlet@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.rcp@default:default,org.eclipse.wst.common.frameworks.ui@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.wst.common.infopop@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.wst.internet.monitor.core@default:default,org.eclipse.search@default:default,org.eclipse.wst.standard.schemas@default:default,org.eclipse.ui.browser@default:default,org.apache.xerces@default:default,org.eclipse.equinox.common@2:true,org.mozilla.xulrunner@default:default,org.eclipse.core.runtime.compatibility@default:default,org.apache.velocity@default:default,org.eclipse.swt.cocoa.macosx@default:false,org.eclipse.text@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.apache.xml.resolver@default:default,org.eclipse.ui.presentations.r21@default:default,org.eclipse.team.cvs.ui@default:default,org.eclipse.core.runtime@default:true,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.ui.forms@default:default,org.eclipse.jsch.ui@default:default,javax.servlet.jsp@default:default,org.eclipse.osgi.util@default:default,org.eclipse.debug.core@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.core.filesystem.macosx@default:false,org.mozilla.xpcom@default:default,org.eclipse.wst.validation@default:default,org.eclipse.core.commands@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.update.core@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.wst.xml.ui.infopop@default:default,org.eclipse.team.ui@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.ui.net@default:default,org.eclipse.ecf@default:default,org.eclipse.equinox.http.registry@default:default,org.apache.jasper@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.wst.internet.monitor.ui@default:default,org.eclipse.wst.internet.cache@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.wst.sse.ui.infopop@default:default,org.eclipse.wst.jsdt.ui@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.wst.jsdt.web.core@default:default,org.eclipse.team.cvs.ssh2@default:default,org.eclipse.help.ui@default:default,org.eclipse.ui.views@default:default,org.eclipse.platform.doc.user@default:default,java_cup.runtime@default:default,org.eclipse.ui@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.ui.ide@default:default,org.eclipse.wst.css.ui@default:default,org.eclipse.osgi@-1:true,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.core.resources@default:default,org.mortbay.jetty.util@default:default,org.eclipse.wst.common.ui@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.wst.jsdt.core@default:default,org.eclipse.update.scheduler@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.wst.xml.xpath2.processor@default:default,org.eclipse.draw2d@default:default,org.eclipse.team.core@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.wst.jsdt.web.ui@default:default,org.apache.log4j@default:default,org.eclipse.wst.sse.ui@default:default,org.eclipse.jsch.core@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.jface@default:default,org.eclipse.core.expressions@default:default,org.apache.bcel@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.update.ui@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.wst.xml.xpath.ui@default:default,org.eclipse.wst.jsdt.doc@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.wst.common.core@default:default,org.apache.lucene.analysis@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.core.net@default:default,org.eclipse.ui.ide.application@default:default,org.apache.commons.httpclient*3.1.0.v20080605-1935@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.util@default:default,org.eclipse.ui.workbench.compatibility@default:false,org.eclipse.ui.navigator.resources@default:default,org.eclipse.core.databinding.property@default:default,org.apache.commons.codec*1.3.0.v20100106-1700@default:default,org.eclipse.help.webapp@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.equinox.app@default:default,org.eclipse.equinox.p2.repository@default:default,org.apache.lucene@default:default,org.eclipse.equinox.p2.metadata.generator@default:default,org.eclipse.help.base@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.wst.html.ui.infopop@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.wst.xmleditor.doc.user@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.wst.sse.doc.user@default:default,org.apache.xml.serializer@default:default,org.eclipse.ui.cocoa@default:false,org.apache.xalan@default:default,org.eclipse.wst.html.core@default:default,org.eclipse.debug.ui@default:default,org.mortbay.jetty.server@default:default,org.eclipse.core.databinding@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.osgi.services@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.wst.jsdt.support.ie@default:default,com.jcraft.jsch@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.security.macosx@default:false,org.apache.commons.collections@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,com.ibm.icu@default:default,org.apache.commons.logging*1.0.4.v200904062259@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.cvs@default:default,org.eclipse.help@default:default,org.eclipse.platform@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.jface.text@default:default,org.eclipse.wst.doc.user@default:default,org.jdom@default:default,org.eclipse.swt@default:default,org.eclipse.ui.console@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.update.configurator@3:true,org.eclipse.wst.common.uriresolver@default:default,org.apache.commons.el@default:default,org.eclipse.equinox.security@default:default,org.eclipse.jem.util@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.ui.editors@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.wst.dtd.core@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.wst.xml.xpath.core@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.compare@default:default,org.mozilla.xulrunner.carbon.macosx@default:false,org.eclipse.wst.css.core@default:default,org.eclipse.wst.jsdt.manipulation@default:default,org.eclipse.emf.edit@default:default,org.eclipse.help.appserver@default:default,org.eclipse.ui.intro@default:default,org.eclipse.gef@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.symbian.tools.wrttools.previewer@default:default,org.symbian.tools.wrttools.debug.core@default:default,org.chromium.debug.core@default:default,org.symbian.tools.wrttools.product@default:default,org.symbian.tools.wrttools.doc.WebDeveloper@default:default,org.w3c.css@default:default,org.chromium.debug.ui@default:default,org.symbian.tools.wrttools@default:default,org.chromium.sdk@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
--- a/org.symbian.tools.wrttools/schema/projectTemplates.exsd Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/schema/projectTemplates.exsd Mon Jul 12 18:29:46 2010 -0700
@@ -1,184 +1,177 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.symbian.tools.wrttools.editing.core" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.symbian.tools.wrttools.editing.core" id="projectTemplates" name="WRT application project templates"/>
- </appinfo>
- <documentation>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="projectTemplate"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="projectTemplate">
- <complexType>
- <sequence minOccurs="1" maxOccurs="unbounded">
- <choice>
- <element ref="description"/>
- <element ref="requires-library" minOccurs="0" maxOccurs="unbounded"/>
- </choice>
- </sequence>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="icon" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="resource"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="archive" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="resource"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="id-pattern" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="default-html-name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="default-css-name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="default-js-name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="wizard-page-factory" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.symbian.tools.wrttools.editing.core.wizard.IWizardPageFactory"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="order" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="description" type="string">
- <annotation>
- <appinfo>
- <meta.element translatable="true"/>
- </appinfo>
- </annotation>
- </element>
-
- <element name="requires-library" type="string">
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.symbian.tools.wrttools.editing.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.symbian.tools.wrttools.editing.core" id="projectTemplates" name="WRT application project templates"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="projectTemplate"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="projectTemplate">
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <choice>
+ <element ref="description"/>
+ <element ref="requires-library" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ </sequence>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="archive" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="default-html-name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="default-css-name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="default-js-name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="wizard-page-factory" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.symbian.tools.wrttools.editing.core.wizard.IWizardPageFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="order" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="description" type="string">
+ <annotation>
+ <appinfo>
+ <meta.element translatable="true"/>
+ </appinfo>
+ </annotation>
+ </element>
+
+ <element name="requires-library" type="string">
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/ProjectTemplate.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/ProjectTemplate.java Mon Jul 12 18:29:46 2010 -0700
@@ -35,117 +35,117 @@
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.WRTProjectDetailsWizardPage;
+import org.symbian.tools.wrttools.wizards.WRTProjectFilesWizardPage;
import org.symbian.tools.wrttools.wizards.WizardContext;
public class ProjectTemplate {
- private static ProjectTemplate[] templates;
+ private static ProjectTemplate[] templates;
+
+ private final IConfigurationElement element;
- private final IConfigurationElement element;
+ private Image icon;
+
+ public ProjectTemplate(IConfigurationElement element) {
+ this.element = 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 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 "";
- }
- }
-
+ 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;
- }
+ 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 String getDefaultCssFile() {
- String file = element.getAttribute("default-css-name");
- return file != null ? file : "main";
- }
+ 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 getDefaultJsFile() {
- String file = element.getAttribute("default-js-name");
- return file != null ? file : "main";
- }
+ 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 String getIdFormat() {
- String pattern = element.getAttribute("id-pattern");
- return pattern != null ? pattern : "com.{0}.widget";
- }
+ public String getDefaultHtmlFile() {
+ String file = element.getAttribute("default-html-name");
+ return file != null ? file : "index";
+ }
- public WRTProjectDetailsWizardPage 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 WRTProjectDetailsWizardPage(context, bindingContext);
- }
-
- @Override
- public String toString() {
- return getName();
- }
+ 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);
+ }
- 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;
- }
+ @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()) {
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CompoundValidator.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/CompoundValidator.java Mon Jul 12 18:29:46 2010 -0700
@@ -21,7 +21,7 @@
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.symbian.tools.wrttools.wizards.AbstractDataBindingPage.NonEmptyStringValidator;
+import org.symbian.tools.wrttools.wizards.NonEmptyStringValidator;
public class CompoundValidator implements IValidator {
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/Util.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/util/Util.java Mon Jul 12 18:29:46 2010 -0700
@@ -24,146 +24,163 @@
public class Util {
- public static String removeSpaces(String widgetName) {
- return widgetName != null ? widgetName.replace(" ", "") : null;
- }
+ public static String removeSpaces(String widgetName) {
+ return widgetName != null ? widgetName.replace(" ", "") : "";
+ }
+
+ public static String removeNonAlphaNum(String projectName) {
+ return projectName != null ? projectName
+ .replaceAll("[^a-zA-Z0-9 ]", "") : null;
+ }
+
+ public static void logEvent(Logger log, Level level, Throwable throwable) {
+ if (level == Level.SEVERE) {
+ log.severe(throwable.getLocalizedMessage());
+ if (throwable.getCause() != null) {
+ log.severe(throwable.getCause().toString());
+ }
+ log.severe(throwable.getStackTrace().toString());
+ }
+ if (level == Level.WARNING) {
+ log.warning(throwable.getLocalizedMessage());
+ if (throwable.getCause() != null) {
+ log.warning(throwable.getCause().toString());
+ }
+ log.warning(throwable.getStackTrace().toString());
+ }
+ if (level == Level.INFO) {
+ log.info(throwable.getLocalizedMessage());
+ if (throwable.getCause() != null) {
+ log.info(throwable.getCause().toString());
+ }
+ log.info(throwable.getStackTrace().toString());
+ }
+
+ }
- public static String removeNonAlphaNum(String projectName) {
- return projectName != null ? projectName.replaceAll("[^a-zA-Z0-9 ]", "") : null;
- }
-public static void logEvent(Logger log, Level level, Throwable throwable)
- {
- if (level==Level.SEVERE)
- {
- log.severe(throwable.getLocalizedMessage());
- if(throwable.getCause()!=null)
- log.severe(throwable.getCause().toString());
- log.severe(throwable.getStackTrace().toString());
- }
- if (level==Level.WARNING)
- {
- log.warning(throwable.getLocalizedMessage());
- if(throwable.getCause()!=null)
- log.warning(throwable.getCause().toString());
- log.warning(throwable.getStackTrace().toString());
- }
- if (level==Level.INFO)
- {
- log.info(throwable.getLocalizedMessage());
- if(throwable.getCause()!=null)
- log.info(throwable.getCause().toString());
- log.info(throwable.getStackTrace().toString());
- }
-
- }
-
- public static String replaceChar(String input, char asciiOutChar, char asciiInChar){
- char x;
- int ascii ;
- String outString="";
- int outCharAscii= (asciiOutChar > 127) ? '?' : (char)(asciiOutChar & 0x7F);
- int inCharAscii= (asciiInChar > 127) ? '?' : (char)(asciiInChar & 0x7F);
-
- for (int i = 0; i < input.length(); i++) {
- x = input.charAt(i);
- ascii = (x > 127) ? '?' : (char)(x & 0x7F);
-
- if(ascii==outCharAscii){
- outString=outString+asciiInChar;
- }else{
- outString=outString+x;
- }
-
- }
- return outString;
- }
-
- public static void showData(String s) {
- System.out.println(s);
- }
-
- public static void showData(List<String> listString, String header) {
-
- if(listString!=null&&listString.size()>0) {
- System.out.println("--------"+header+"------");
- for(String s:listString){
- System.out.println(s);
- }
- }else {
- System.out.println("--------Empty/Null "+header+"------");
- }
- }
+ public static String replaceChar(String input, char asciiOutChar,
+ char asciiInChar) {
+ char x;
+ int ascii;
+ String outString = "";
+ int outCharAscii = (asciiOutChar > 127) ? '?'
+ : (char) (asciiOutChar & 0x7F);
+
+ for (int i = 0; i < input.length(); i++) {
+ x = input.charAt(i);
+ ascii = (x > 127) ? '?' : (char) (x & 0x7F);
+
+ if (ascii == outCharAscii) {
+ outString = outString + asciiInChar;
+ } else {
+ outString = outString + x;
+ }
+
+ }
+ return outString;
+ }
+ public static void showData(String s) {
+ System.out.println(s);
+ }
+
+ public static void showData(List<String> listString, String header) {
+
+ if (listString != null && listString.size() > 0) {
+ System.out.println("--------" + header + "------");
+ for (String s : listString) {
+ System.out.println(s);
+ }
+ } else {
+ System.out.println("--------Empty/Null " + header + "------");
+ }
+ }
+
+ /* Validation tests for both Windows & Mac OS */
+ private static String commonValidate(String argName) {
+ if (argName.length() == 0) {
+ return ("Can not be empty");
+ }
- @SuppressWarnings("restriction")
- /* Validation tests for both Windows & Mac OS */
- private static String commonValidate(String argName)
- {
- if (argName.length() == 0 ) {
- return ("Can not be empty");
- }
-
- // filenames starting with dot are not valid for both Widget name & UID
- if ( argName.charAt(0) == '.' ) {
- return("Can not begin with a dot");
- }
+ // filenames starting with dot are not valid for both Widget name & UID
+ if (argName.charAt(0) == '.') {
+ return ("Can not begin with a dot");
+ }
+
+ final char lastChar = argName.charAt(argName.length() - 1);
+ // filenames ending in dot are not valid for both Widget name & UID
+ if (lastChar == '.') {
+ return ("Can not end with dot");
+ }
+
+ return null;
+ }
- final char lastChar = argName.charAt(argName.length()-1);
- // filenames ending in dot are not valid for both Widget name & UID
- if (lastChar == '.') {
- return("Can not end with dot");
- }
-
- return null;
- }
-
+ public static String validateWidgetName(String widgetName) {
+ String strError = null;
+ if ((strError = commonValidate(widgetName)) != null) {
+ return "Invalid Widget name. " + strError;
+ }
+ if (widgetName.indexOf("<") > -1 || widgetName.indexOf(">") > -1) {
+ return ("Invalid Widget name. Angle brackets are not allowed");
+ }
+ final char lastChar = widgetName.charAt(widgetName.length() - 1);
+ // trailing or beginning space is not valid in filenames for Widget name
+ if ((Character.isWhitespace(widgetName.charAt(0)) || Character
+ .isWhitespace(lastChar))) {
+ return ("Invalid Widget name. Beginning or trailing spaces are not allowed");
+ }
- public static String validateWidgetName(String widgetName){
- String strError = null;
- if ((strError = commonValidate(widgetName)) != null)
- return "Invalid Widget name. " + strError;
- if (widgetName.indexOf("<") > -1 || widgetName.indexOf(">") > -1){
- return("Invalid Widget name. Angle brackets are not allowed");
- }
- final char lastChar = widgetName.charAt(widgetName.length()-1);
- // trailing or beginning space is not valid in filenames for Widget name
- if ((Character.isWhitespace(widgetName.charAt(0)) || Character.isWhitespace(lastChar))) {
- return("Invalid Widget name. Beginning or trailing spaces are not allowed");
- }
+ if (widgetName.indexOf('\n') != -1 || widgetName.indexOf('\t') != -1) {
+ return ("Invalid Widget name. newline character is not allowed");
+ }
+
+ return null;
+ }
- if (widgetName.indexOf('\n') != -1 || widgetName.indexOf('\t') != -1 ) {
- return("Invalid Widget name. newline character is not allowed");
- }
-
- return null;
- }
+ public static String validateWidgetID(String widgetID) {
+ String strError = null;
+ if ((strError = commonValidate(widgetID)) != null) {
+ return "Invalid Widget identifier. " + strError;
+ }
- public static String validateWidgetID(String widgetID)
- {
- String strError = null;
- if ((strError = commonValidate(widgetID)) != null)
- return "Invalid Widget identifier. " + strError;
+ // file names with white spaces are not allowed for Widget Identifier
+ // (UID)
+ if (widgetID.indexOf(" ") > -1) {
+ return ("Invalid Widget identifier. Whitespaces are not allowed");
+ }
+
+ if (widgetID.length() > 78) {
+ return ("Invalid Widget identifier. Maximum string length exceeded");
+ }
- // file names with white spaces are not allowed for Widget Identifier (UID)
- if (widgetID.indexOf(" ") > -1 ){
- return("Invalid Widget identifier. Whitespaces are not allowed");
- }
-
- if (widgetID.length() > 78 ) {
- return("Invalid Widget identifier. Maximum string length exceeded");
- }
-
- /* test invalid characters, allows only alphanumeric and '.' for UID*/
- String alphnum = ".0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- for (int i = 0; i < widgetID.length(); i++)
- if (alphnum.indexOf(widgetID.charAt(i),0) == -1) {
- return("Invalid Widget identifier. Only alphanumeric or '.' is allowed");
- }
+ /* test invalid characters, allows only alphanumeric and '.' for UID */
+ String alphnum = ".0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ for (int i = 0; i < widgetID.length(); i++) {
+ if (alphnum.indexOf(widgetID.charAt(i), 0) == -1) {
+ return ("Invalid Widget identifier. Only alphanumeric or '.' is allowed");
+ }
+ }
+
+ if (widgetID.matches(".*[.]{2,}.*")) {
+ return ("Invalid Widget identifier. Consecutive dots are not allowed");
+ }
+
+ return null;
+ }
- if (widgetID.matches(".*[.]{2,}.*")) {
- return("Invalid Widget identifier. Consecutive dots are not allowed");
- }
-
- return null;
- }
+ public static String toProjectName(String widgetId) {
+ if (widgetId == null || widgetId.trim().length() == 0) {
+ return "";
+ }
+ StringBuilder builder = new StringBuilder();
+ for (char c : widgetId.trim().toCharArray()) {
+ if (Character.isJavaIdentifierPart(c)) {
+ builder.append(c);
+ } else {
+ builder.append("_");
+ }
+ }
+ return builder.toString();
+ }
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/AbstractDataBindingPage.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/AbstractDataBindingPage.java Mon Jul 12 18:29:46 2010 -0700
@@ -18,96 +18,20 @@
*/
package org.symbian.tools.wrttools.wizards;
-import java.text.MessageFormat;
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.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.databinding.swt.ISWTObservableValue;
-import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.WizardPage;
-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.Activator;
-import org.symbian.tools.wrttools.util.CompoundValidator;
public abstract class AbstractDataBindingPage extends WizardPage {
- public class NonEmptyStringValidator implements IValidator {
- private final String propertyName;
-
- public NonEmptyStringValidator(String propertyName) {
- this.propertyName = propertyName;
- }
-
- public IStatus validate(Object value) {
- if (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;
- }
- }
-
- protected final WizardContext context;
- protected final DataBindingContext bindingContext;
-
- public AbstractDataBindingPage(WizardContext context,
- DataBindingContext bindingContext, String name, String title,
- ImageDescriptor image, String description) {
- super(name, title, image);
- this.context = context;
- this.bindingContext = bindingContext;
- setDescription(description);
- }
-
- protected boolean isActive() {
- return true;
- }
+ public AbstractDataBindingPage(WizardContext context,
+ DataBindingContext bindingContext, String name, String title,
+ ImageDescriptor image, String description) {
+ super(name, title, image);
+ setDescription(description);
+ }
- protected Text createText(Composite root, String property,
- String propertyName, IValidator... validators) {
- return createText(root, BeansObservables
- .observeValue(context, property), propertyName, validators);
- }
-
- protected Text createTextForExt(Composite root, String property,
- String propertyName) {
- IObservableMap map = BeansObservables.observeMap(context, "extensions");
- IObservableValue entry = Observables.observeMapEntry(map, property,
- String.class);
- return createText(root, entry, propertyName);
- }
-
- private Text createText(Composite root, IObservableValue model,
- String propertyName, 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);
- strategy.setBeforeSetValidator(validators.length == 0 ? validator
- : new CompoundValidator(validator, validators));
- bindingContext.bindValue(view, model, strategy, null);
- return text;
- }
-
- protected static void createLabel(Composite root, String text) {
- Label label = new Label(root, SWT.NONE);
- label.setText(text);
- }
+ protected boolean isActive() {
+ return true;
+ }
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/FlickrProjectDetailsWizardPage.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/FlickrProjectDetailsWizardPage.java Mon Jul 12 18:29:46 2010 -0700
@@ -21,27 +21,29 @@
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.swt.widgets.Composite;
-public class FlickrProjectDetailsWizardPage extends WRTProjectDetailsWizardPage {
+public class FlickrProjectDetailsWizardPage extends WRTProjectFilesWizardPage {
+
+ public FlickrProjectDetailsWizardPage(WizardContext context,
+ DataBindingContext bindingContext) {
+ super(context, bindingContext);
+ }
- public FlickrProjectDetailsWizardPage(WizardContext context,
- DataBindingContext bindingContext) {
- super(context, bindingContext);
- }
-
- @Override
- protected void addTemplateControls(Composite root) {
- context.getExtensions().put("flickrUrl", "http://flickr.com/photos/symbianfoundation");
- createLabel(root, "Flickr URL:");
- createTextForExt(root, "flickrUrl", "Flickr URL");
- createLabel(root, "");
- createLabel(root, "");
-
- }
+ @Override
+ protected void addTemplateControls(Composite root) {
+ context.getExtensions().put("flickrUrl",
+ "http://flickr.com/photos/symbianfoundation");
+ context.createLabel(root, "Flickr URL:");
+ context.createTextForExt(root, "flickrUrl", "Flickr URL",
+ bindingContext, this);
+ context.createLabel(root, "");
+ context.createLabel(root, "");
- public static final class Factory implements IWizardPageFactory {
- public WRTProjectDetailsWizardPage createPage(WizardContext context,
- DataBindingContext bindingContext) {
- return new FlickrProjectDetailsWizardPage(context, bindingContext);
- }
- }
+ }
+
+ public static final class Factory implements IWizardPageFactory {
+ public WRTProjectFilesWizardPage createPage(WizardContext context,
+ DataBindingContext bindingContext) {
+ return new FlickrProjectDetailsWizardPage(context, bindingContext);
+ }
+ }
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/HelloWithWRTKitProjectDetailsWizardPage.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/HelloWithWRTKitProjectDetailsWizardPage.java Mon Jul 12 18:29:46 2010 -0700
@@ -21,21 +21,23 @@
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.swt.widgets.Composite;
-public class HelloWithWRTKitProjectDetailsWizardPage extends WRTProjectDetailsWizardPage {
+public class HelloWithWRTKitProjectDetailsWizardPage extends
+ WRTProjectFilesWizardPage {
+
+ public HelloWithWRTKitProjectDetailsWizardPage(WizardContext context,
+ DataBindingContext bindingContext) {
+ super(context, bindingContext);
+ }
- public HelloWithWRTKitProjectDetailsWizardPage(WizardContext context,
- DataBindingContext bindingContext) {
- super(context, bindingContext);
- }
-
- @Override
- protected void addTemplateControls(Composite root) {
- }
+ @Override
+ protected void addTemplateControls(Composite root) {
+ }
- public static final class Factory implements IWizardPageFactory {
- public WRTProjectDetailsWizardPage createPage(WizardContext context,
- DataBindingContext bindingContext) {
- return new HelloWithWRTKitProjectDetailsWizardPage(context, bindingContext);
- }
- }
+ public static final class Factory implements IWizardPageFactory {
+ public WRTProjectFilesWizardPage createPage(WizardContext context,
+ DataBindingContext bindingContext) {
+ return new HelloWithWRTKitProjectDetailsWizardPage(context,
+ bindingContext);
+ }
+ }
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/IWizardPageFactory.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/IWizardPageFactory.java Mon Jul 12 18:29:46 2010 -0700
@@ -21,5 +21,6 @@
import org.eclipse.core.databinding.DataBindingContext;
public interface IWizardPageFactory {
- WRTProjectDetailsWizardPage createPage(WizardContext context, DataBindingContext bindingContext);
+ WRTProjectFilesWizardPage createPage(WizardContext context,
+ DataBindingContext bindingContext);
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/RssReaderProjectDetailsWizardPage.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/RssReaderProjectDetailsWizardPage.java Mon Jul 12 18:29:46 2010 -0700
@@ -24,33 +24,35 @@
import org.eclipse.swt.widgets.Composite;
public class RssReaderProjectDetailsWizardPage extends
- WRTProjectDetailsWizardPage {
+ WRTProjectFilesWizardPage {
public RssReaderProjectDetailsWizardPage(WizardContext context,
DataBindingContext bindingContext) {
super(context, bindingContext);
}
-
+
@Override
protected void addTemplateControls(Composite root) {
Map<String, String> extensions = context.getExtensions();
extensions.put("feedUrl", "http://twitter.com/statuses/user_timeline/21138778.rss");
extensions.put("feedName", "Symbian Twitter");
-
- createLabel(root, "Feed URL:");
- createTextForExt(root, "feedUrl", "feed URL");
- createLabel(root, "Feed Name:");
- createTextForExt(root, "feedName", "feed name");
- createLabel(root, "");
- createLabel(root, "");
+
+ 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 WRTProjectDetailsWizardPage createPage(WizardContext context,
+ public WRTProjectFilesWizardPage createPage(WizardContext context,
DataBindingContext bindingContext) {
return new RssReaderProjectDetailsWizardPage(context, bindingContext);
}
-
+
}
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectDetailsWizardPage.java Mon Jul 12 18:29:46 2010 -0700
@@ -18,67 +18,272 @@
*/
package org.symbian.tools.wrttools.wizards;
+import java.net.URI;
+
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.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.Button;
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;
-public class WRTProjectDetailsWizardPage extends AbstractDataBindingPage {
- private boolean isActive;
+@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));
+ 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));
- public WRTProjectDetailsWizardPage(WizardContext context, DataBindingContext bindingContext) {
- super(context, bindingContext, "WRTApp", "Application Details", null, "Specify application details");
- }
-
- 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));
- createLabel(root, "Application name:");
-
- createText(root, WizardContext.WIDGET_NAME, "application name", new RegexpValidator("[^\\w\\. ]", "Application name cannot contain {0} character", false));
-
- createLabel(root, "");
- createLabel(root, "This will be the application display name on the device");
- createLabel(root, "");
- createLabel(root, "");
- createLabel(root, "Widget identifier:");
+ context.createLabel(root, "");
+ context.createLabel(root,
+ "This will be the application display name on the device");
+ context.createLabel(root, "");
+ context.createLabel(root, "");
+ context.createLabel(root, "Widget 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 succesful installation of application on the device");
+ context.createLabel(root, "");
+ context.createLabel(root, "");
+
+ createProjectNameGroup(root);
+
+ 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());
- createText(root, WizardContext.WIDGET_ID, "applicatoin identifier", new RegexpValidator("[\\w]*(\\.\\w[\\w]*)*", "{0} is not a valid applicatoin ID", true));
- createLabel(root, "");
- createLabel(root, "This id should be unique for succesful installation of application on the device");
- createLabel(root, "");
- createLabel(root, "");
-
- addTemplateControls(root);
-
- createLabel(root, "");
- Button homeScreen = new Button(root, SWT.CHECK);
- homeScreen.setText("Enable HomeScreen");
-
- IObservableValue view = SWTObservables.observeSelection(homeScreen);
- IObservableValue model = BeansObservables.observeValue(context, WizardContext.HOME_SCREEN);
- bindingContext.bindValue(view, model);
-
- setControl(root);
- }
+ 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
+ * <code>null</code> if a valid project location has not been entered.
+ *
+ * @return the project location URI, or <code>null</code>
+ * @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);
+ }
+ }
+ };
- @Override
- protected boolean isActive() {
- return isActive;
- }
+ /**
+ * 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());
+ }
- public void setActive(boolean isActive) {
- this.isActive = isActive;
- }
+ /**
+ * Returns whether this page's controls currently all contain valid values.
+ *
+ * @return <code>true</code> if all controls are valid, and
+ * <code>false</code> 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;
+ }
+
+ 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);
+ }
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectFilesWizardPage.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectFilesWizardPage.java Mon Jul 12 18:29:46 2010 -0700
@@ -19,30 +19,74 @@
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 {
-
- public WRTProjectFilesWizardPage(WizardContext context, DataBindingContext bindingContext) {
- super(context, bindingContext, "WRTApplicationFiles", "Application Files", null, "Specify application file names");
- }
+ private boolean isActive;
+ protected final DataBindingContext bindingContext;
+ protected final WizardContext context;
- public void createControl(Composite parent) {
- Composite root = new Composite(parent, SWT.NONE);
- WizardPageSupport.create(this, bindingContext);
- root.setLayout(new GridLayout(2, false));
+ 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));
- createLabel(root, "Name of main HTML:");
- createText(root, WizardContext.HTML_FILE, "HTML file name");
- createLabel(root, "Name of CSS file:");
- createText(root, WizardContext.CSS_FILE, "CSS file name");
- createLabel(root, "Name of JavaScript file:");
- createText(root, WizardContext.JS_FILE, "JavaScript file name");
-
- setControl(root);
- }
+ 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;
+ }
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WRTProjectTemplateWizardPage.java Mon Jul 12 18:29:46 2010 -0700
@@ -33,6 +33,7 @@
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;
@@ -42,162 +43,146 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.symbian.tools.wrttools.core.ProjectTemplate;
-@SuppressWarnings("restriction")
-public class WRTProjectTemplateWizardPage extends WizardNewProjectCreationPage {
-
- public class ProjectTemplateLabelProvider extends LabelProvider {
+public class WRTProjectTemplateWizardPage extends WizardPage {
+ public class ProjectTemplateLabelProvider extends LabelProvider {
- @Override
- public Image getImage(Object element) {
- return ((ProjectTemplate) element).getIcon();
- }
+ @Override
+ public Image getImage(Object element) {
+ return ((ProjectTemplate) element).getIcon();
+ }
- @Override
- public String getText(Object element) {
- return ((ProjectTemplate) element).getName();
- }
- }
+ @Override
+ public String getText(Object element) {
+ return ((ProjectTemplate) element).getName();
+ }
+ }
- private TableViewer templates;
- private Text description;
- private final WizardContext context;
- private final DataBindingContext bindingContext;
+ private TableViewer templates;
+ private Text description;
+ private final WizardContext context;
+ private final DataBindingContext bindingContext;
- public WRTProjectTemplateWizardPage(WizardContext context, 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;
+ this.context = context;
+ this.bindingContext = bindingContext;
setDescription("Select project name and template that will be used to populate");
- }
-
- @Override
- protected void createChildControls(Composite c) {
- ProjectTemplate[] allTemplates = ProjectTemplate.getAllTemplates();
+ }
+
+ public void createControl(Composite parent) {
+ ProjectTemplate[] allTemplates = ProjectTemplate.getAllTemplates();
- context.setTemplate(getFirstTemplate(allTemplates));
- Composite composite = new Composite(c, SWT.NONE);
- composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
- FormLayout layout = new FormLayout();
- layout.marginWidth = 5;
- composite.setLayout(layout);
+ 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();
+ 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.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();
+ 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.right = new FormAttachment(100, 0);
descriptionData.width = 50;
- description.setLayoutData(descriptionData);
-
- templates.setContentProvider(new ArrayContentProvider());
- templates.setLabelProvider(new ProjectTemplateLabelProvider());
+ 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);
+ 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);
- }
+ IViewerObservableValue selection = ViewersObservables
+ .observeSingleSelection(templates);
+ IObservableValue property = BeansObservables.observeValue(context,
+ WizardContext.TEMPLATE);
- private ProjectTemplate getFirstTemplate(ProjectTemplate[] allTemplates) {
- ProjectTemplate template = null;
- for (ProjectTemplate projectTemplate : allTemplates) {
- if (template == null || template.getOrder() > projectTemplate.getOrder()) {
- template = projectTemplate;
- }
+ bindingContext.bindValue(selection, property);
+ if (context.getTemplate() != null) {
+ refreshSelection(context.getTemplate());
}
- return template;
+ 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();
- }
+ Display display = getShell().getDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if (isPageComplete()) {
+ IWizardPage nextPage = getWizard().getNextPage(
+ WRTProjectTemplateWizardPage.this);
+ getContainer().showPage(nextPage);
+ }
+ }
+ });
+ }
- @Override
+ protected void refreshSelection(ProjectTemplate template) {
+ if (template != null) {
+ description.setText(template.getDescription());
+ } else {
+ description.setText("");
+ }
+ validatePage();
+ }
+
protected boolean validatePage() {
- boolean parentValidation = super.validatePage();
- if (!parentValidation && getProjectName().trim().length() == 0) {
- setMessage(null);
- setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectNameEmpty);
+ if (templates.getSelection().isEmpty()) {
+ setErrorMessage("Project template is not selected");
+ setPageComplete(false);
return false;
- } else if (parentValidation) {
- if (templates.getSelection().isEmpty()) {
- setErrorMessage("Project template is not selected");
- setPageComplete(false);
- return false;
- } else {
- setErrorMessage(null);
- setPageComplete(true);
- return true;
- }
} else {
- return false;
+ 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();
- }
+ public ProjectTemplate getSelectedProjectTemplate() {
+ IStructuredSelection selection = (IStructuredSelection) templates
+ .getSelection();
+ return (ProjectTemplate) selection.getFirstElement();
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ templates.getControl().setFocus();
+ }
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WizardContext.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WizardContext.java Mon Jul 12 18:29:46 2010 -0700
@@ -20,7 +20,6 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.net.URI;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collections;
@@ -29,262 +28,277 @@
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 PROJECT_URI = "projectUri";
- 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 PROJECT_NAME = "projectName";
- 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 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 htmlFile;
- private String jsFile;
- private String projectName;
- private final PropertyChangeSupport propertySupport = new PropertyChangeSupport(this);
- private ProjectTemplate template;
- private String widgetId;
- private String widgetName;
- private Map<String, String> extensions = new TreeMap<String, String>();
- private URI projectUri;
- private boolean homeScreen;
+ 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<String, String> extensions = new TreeMap<String, String>();
+ private boolean homeScreen;
private Set<JSLibrary> libraries = new HashSet<JSLibrary>();
- public void addPropertyChangeListener(PropertyChangeListener arg0) {
- propertySupport.addPropertyChangeListener(arg0);
- }
-
- public void addPropertyChangeListener(String arg0,
- PropertyChangeListener arg1) {
- propertySupport.addPropertyChangeListener(arg0, arg1);
- }
+ public WizardContext() {
+ setTemplate(getFirstTemplate(ProjectTemplate.getAllTemplates()));
+ }
- public String getCssFile() {
- if (cssFile == null) {
- if (template != null) {
- return template.getDefaultCssFile();
- }
- }
- return cssFile;
- }
+ 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);
+ }
- private String getDefaultWidgetId() {
- if (template != null) {
- return MessageFormat
- .format(template.getIdFormat(), Util.removeSpaces(getWidgetName()));
- } else {
- return null;
- }
- }
+ public String getProjectName() {
+ return (projectName == null ? getDefaultProjectName() : projectName);
+ }
+
+ private String getDefaultProjectName() {
+ return Util.toProjectName(getWidgetName());
+ }
- public String getHtmlFile() {
- if (htmlFile == null) {
- if (template != null) {
- return template.getDefaultHtmlFile();
- }
- }
- return htmlFile;
- }
+ public void setProjectName(String projectName) {
+ String prev = getProjectName();
+ if (projectName.equals(getDefaultProjectName())) {
+ this.projectName = null;
+ } else {
+ this.projectName = projectName;
+ }
+ propertySupport.firePropertyChange(PROJECT_NAME, projectName, prev);
+ }
- public String getJsFile() {
- if (jsFile == null) {
- if (template != null) {
- return template.getDefaultJsFile();
- }
- }
- return jsFile;
- }
-
- public String getProjectName() {
- return projectName;
- }
+ public String getCssFile() {
+ if (cssFile == null) {
+ if (template != null) {
+ return template.getDefaultCssFile();
+ }
+ }
+ return cssFile;
+ }
- public ProjectTemplate getTemplate() {
- return template;
- }
-
- public String getWidgetId() {
- if (widgetId == null) {
- return getDefaultWidgetId();
- }
- return widgetId;
- }
+ private String getDefaultWidgetId() {
+ String name = Util.removeSpaces(getWidgetName());
+ return MessageFormat.format("com.company.{0}", name.length() > 0 ? name
+ : "ApplicationName");
+ }
- public String getWidgetName() {
- return widgetName != null ? widgetName : Util.removeNonAlphaNum(getProjectName());
- }
+ public String getHtmlFile() {
+ if (htmlFile == null) {
+ if (template != null) {
+ return template.getDefaultHtmlFile();
+ }
+ }
+ return htmlFile;
+ }
- public void removePropertyChangeListener(PropertyChangeListener arg0) {
- propertySupport.removePropertyChangeListener(arg0);
- }
+ public String getJsFile() {
+ if (jsFile == null) {
+ if (template != null) {
+ return template.getDefaultJsFile();
+ }
+ }
+ return jsFile;
+ }
- public void removePropertyChangeListener(String arg0,
- PropertyChangeListener arg1) {
- propertySupport.removePropertyChangeListener(arg0, arg1);
- }
+ public ProjectTemplate getTemplate() {
+ return template;
+ }
- 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 String getWidgetId() {
+ if (widgetId == null) {
+ return getDefaultWidgetId();
+ }
+ return widgetId;
+ }
+
+ public String getWidgetName() {
+ return widgetName;
+ }
- 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 removePropertyChangeListener(PropertyChangeListener arg0) {
+ propertySupport.removePropertyChangeListener(arg0);
+ }
+
+ public void removePropertyChangeListener(String arg0,
+ PropertyChangeListener arg1) {
+ propertySupport.removePropertyChangeListener(arg0, arg1);
+ }
- 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 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 setProjectName(String projectName) {
- String prevName = getWidgetName();
- String prevId = getWidgetId();
- String prev = this.projectName;
- this.projectName = projectName;
- propertySupport.firePropertyChange(PROJECT_NAME, projectName, prev);
- if (widgetName == null) {
- propertySupport.firePropertyChange(WIDGET_NAME, getWidgetName(),
- prevName);
- if (widgetId == null) {
- propertySupport.firePropertyChange(WIDGET_ID, getWidgetId(),
- prevId);
- }
- }
- }
+ 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 id = getWidgetId();
- String html = getHtmlFile();
- String js = getJsFile();
- String css = getCssFile();
- ProjectTemplate prev = this.template;
- this.template = template;
- propertySupport.firePropertyChange(TEMPLATE, template, prev);
- if (widgetId == null) {
- propertySupport.firePropertyChange(WIDGET_ID, getWidgetId(), id);
- }
- 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 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);
}
- }
-
- public void setWidgetId(String widgetId) {
- String prev = getWidgetId();
- if (getDefaultWidgetId().equals(widgetId)) {
- widgetId = null;
- }
- this.widgetId = widgetId;
- propertySupport.firePropertyChange(WIDGET_ID, getWidgetId(), prev);
- }
+ if (cssFile == null) {
+ propertySupport.firePropertyChange(CSS_FILE, getCssFile(), css);
+ }
+ if (cssFile == null) {
+ propertySupport.firePropertyChange(LIBRARIES, getLibraries(),
+ libraries);
+ }
+ }
- public void setWidgetName(String widgetName) {
- String prevId = getWidgetId();
- String prev = getWidgetName();
- if (projectName.equals(widgetName)) {
- widgetName = null;
- }
- this.widgetName = widgetName;
- propertySupport.firePropertyChange(WIDGET_NAME, widgetName, prev);
- if (widgetId == null) {
- propertySupport
- .firePropertyChange(WIDGET_ID, getWidgetId(), prevId);
- }
- }
+ 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 setExtensions(Map<String, String> extensions) {
- this.extensions = extensions;
- }
-
- public Map<String, String> getExtensions() {
- return extensions;
- }
+ public void setWidgetName(String widgetName) {
+ String prevPn = getProjectName();
+ String prevId = getWidgetId();
+ String prev = getWidgetName();
+ this.widgetName = widgetName;
+ propertySupport.firePropertyChange(WIDGET_NAME, widgetName, prev);
+ if (widgetId == null) {
+ propertySupport
+ .firePropertyChange(WIDGET_ID, getWidgetId(), prevId);
+ }
+ if (projectName == null) {
+ propertySupport.firePropertyChange(PROJECT_NAME, getProjectName(),
+ prevPn);
+ }
+ }
- public void setProjectUri(URI uri) {
- URI orig = projectUri;
- this.projectUri = uri;
- propertySupport.firePropertyChange(PROJECT_URI, projectUri, orig);
- }
-
- public URI getProjectUri() {
- return projectUri;
- }
-
- public Map<String, String> getTemplateVars() {
- Map<String, String> vars = new TreeMap<String, String>();
-
- 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 void setExtensions(Map<String, String> extensions) {
+ this.extensions = extensions;
+ }
+
+ public Map<String, String> getExtensions() {
+ return extensions;
+ }
+
+ public Map<String, String> getTemplateVars() {
+ Map<String, String> vars = new TreeMap<String, String>();
+
+ 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);
- 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");
- }
+ 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 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 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);
@@ -307,4 +321,42 @@
public Map<String, String> 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);
+ }
+
}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java Fri Jul 09 17:49:55 2010 -0700
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java Mon Jul 12 18:29:46 2010 -0700
@@ -26,6 +26,7 @@
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;
@@ -63,13 +64,15 @@
import org.symbian.tools.wrttools.util.ProjectUtils;
import org.symbian.tools.wrttools.wizards.libraries.WRTProjectLibraryWizardPage;
-public class WrtWidgetWizard extends Wizard implements INewWizard, IExecutableExtension {
+public class WrtWidgetWizard extends Wizard implements INewWizard,
+ IExecutableExtension {
private WizardContext context;
private DataBindingContext bindingContext;
- private final Map<ProjectTemplate, WRTProjectDetailsWizardPage> templateDetails = new HashMap<ProjectTemplate, WRTProjectDetailsWizardPage>();
+ private final Map<ProjectTemplate, WRTProjectFilesWizardPage> templateDetails = new HashMap<ProjectTemplate, WRTProjectFilesWizardPage>();
private WRTProjectTemplateWizardPage templatesPage;
- private WRTProjectFilesWizardPage filesPage;
+ private WRTProjectDetailsWizardPage detailsPage;
private IConfigurationElement config;
+ private WRTProjectLibraryWizardPage librariesPage;
public WrtWidgetWizard() {
setDefaultPageImageDescriptor(WRTImages.newWizardBanner());
@@ -79,10 +82,12 @@
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(monitor);
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ holder[0] = action(locationURI, monitor);
}
});
} catch (InvocationTargetException e) {
@@ -97,12 +102,12 @@
return true;
}
- protected IProject action(IProgressMonitor monitor) {
+ 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(monitor);
+ holder[0] = createAndInitProject(locationURI, monitor);
}
}, monitor);
} catch (CoreException e) {
@@ -111,36 +116,41 @@
return holder[0];
}
- protected IProject createAndInitProject(IProgressMonitor monitor) throws CoreException {
+ protected IProject createAndInitProject(URI locationURI,
+ IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Creating project", 100);
- IProject project = ProjectUtils.createWrtProject(context.getProjectName(), context.getProjectUri(),
- new SubProgressMonitor(monitor, 30));
+ 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));
+ 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));
+ 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<JSLibrary> set, IProgressMonitor progressMonitor)
- throws IOException, CoreException {
+ private void initLibraries(IProject project, Set<JSLibrary> 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));
+ 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 {
+ private void populateProject(IProject project, IProgressMonitor monitor)
+ throws CoreException {
URL projectContents = context.getTemplate().getProjectContents();
Map<String, String> vars = context.getTemplateVars();
@@ -149,34 +159,44 @@
Velocity.init();
VelocityContext ctx = new VelocityContext(vars);
stream = new ZipInputStream(projectContents.openStream());
- monitor.beginTask("Generating project contents", IProgressMonitor.UNKNOWN);
+ monitor.beginTask("Generating project contents",
+ IProgressMonitor.UNKNOWN);
ZipEntry entry;
- while ((entry = stream.getNextEntry()) != null && !monitor.isCanceled()) {
+ 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());
+ 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());
+ 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());
+ 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));
+ folder.create(false, true, new SubProgressMonitor(monitor,
+ 1));
} else if (isVelocity) {
- copyTemplate(project, name, stream, (int) entry.getSize(), ctx, monitor);
+ copyTemplate(project, name, stream, (int) entry.getSize(),
+ ctx, monitor);
} else {
- ProjectUtils.copyFile(project, name, stream, entry.getSize(), monitor);
+ 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));
+ throw new CoreException(new Status(IStatus.ERROR,
+ Activator.PLUGIN_ID, "Project creation failed", e));
} finally {
if (stream != null) {
try {
@@ -188,7 +208,8 @@
}
}
- private void copyTemplate(IProject project, String name, ZipInputStream stream, int size, VelocityContext ctx,
+ 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();
@@ -201,7 +222,8 @@
reader.close();
writer.close();
- ByteArrayInputStream contents = new ByteArrayInputStream(file.toByteArray());
+ ByteArrayInputStream contents = new ByteArrayInputStream(
+ file.toByteArray());
IFile f = project.getFile(name);
f.create(contents, true, new SubProgressMonitor(monitor, 1));
}
@@ -213,50 +235,54 @@
@Override
public void addPages() {
- templatesPage = new WRTProjectTemplateWizardPage(context, bindingContext);
+ detailsPage = new WRTProjectDetailsWizardPage(context, bindingContext);
+ addPage(detailsPage);
+
+ templatesPage = new WRTProjectTemplateWizardPage(context,
+ bindingContext);
addPage(templatesPage);
ProjectTemplate[] templates = ProjectTemplate.getAllTemplates();
for (ProjectTemplate projectTemplate : templates) {
- WRTProjectDetailsWizardPage page = projectTemplate.createWizardPage(context, bindingContext);
+ final WRTProjectFilesWizardPage page = projectTemplate
+ .createWizardPage(context, bindingContext);
addPage(page);
templateDetails.put(projectTemplate, page);
}
- filesPage = new WRTProjectFilesWizardPage(context, bindingContext);
- addPage(filesPage);
-
- addPage(new WRTProjectLibraryWizardPage(context, bindingContext));
+ librariesPage = new WRTProjectLibraryWizardPage(context, bindingContext);
+ addPage(librariesPage);
}
@Override
public boolean canFinish() {
- return super.canFinish() && getContainer().getCurrentPage() == getPages()[getPageCount() - 1];
+ return super.canFinish()
+ && getContainer().getCurrentPage() == getPages()[getPageCount() - 1];
}
@Override
public IWizardPage getNextPage(IWizardPage page) {
if (page == templatesPage) {
- context.setProjectName(templatesPage.getProjectName());
- context.setProjectUri(templatesPage.getLocationURI());
ProjectTemplate template = context.getTemplate();
if (template != null) {
- WRTProjectDetailsWizardPage activePage = templateDetails.get(template);
- for (WRTProjectDetailsWizardPage wizardPage : templateDetails.values()) {
+ WRTProjectFilesWizardPage activePage = templateDetails
+ .get(template);
+ for (WRTProjectFilesWizardPage wizardPage : templateDetails
+ .values()) {
wizardPage.setActive(wizardPage == activePage);
}
bindingContext.updateModels();
return activePage;
}
}
- if (page instanceof WRTProjectDetailsWizardPage) {
- return filesPage;
+ if (page instanceof WRTProjectFilesWizardPage) {
+ return librariesPage;
}
return super.getNextPage(page);
}
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
- throws CoreException {
+ public void setInitializationData(IConfigurationElement config,
+ String propertyName, Object data) throws CoreException {
this.config = config;
}
}