# HG changeset patch # User Eugene Ostroukhov # Date 1279149526 25200 # Node ID 4bb763ad2b124ecdfdcd6d5102e0e51efe0f412c # Parent a66f421f3a32d08b77290ba4027a880ed7b1459f Bug 3251 - phonegap project - Vibrate text overflows button size diff -r a66f421f3a32 -r 4bb763ad2b12 org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/PreferencesResourceProvider.java --- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/PreferencesResourceProvider.java Wed Jul 14 15:18:37 2010 -0700 +++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/http/handlers/PreferencesResourceProvider.java Wed Jul 14 16:18:46 2010 -0700 @@ -29,6 +29,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.json.simple.JSONObject; +import org.symbian.tools.wrttools.WRTProject; import org.symbian.tools.wrttools.previewer.PreviewerPlugin; import org.symbian.tools.wrttools.previewer.preview.ProjectPreferencesManager; @@ -41,6 +42,12 @@ String sessionId) throws IOException, CoreException { Properties projectPreferences = ProjectPreferencesManager.getProjectProperties(project); + if (!projectPreferences.containsKey("__SYM_NOKIA_EMULATOR_DEVICE")) { + String resolution = new WRTProject(project).getPreferredScreenSize(); + if (resolution != null) { + projectPreferences.put("__SYM_NOKIA_EMULATOR_DEVICE", resolution); + } + } String js = getJS(projectPreferences); try { return new ByteArrayInputStream(js.getBytes("UTF-8")); diff -r a66f421f3a32 -r 4bb763ad2b12 org.symbian.tools.wrttools/plugin.xml --- a/org.symbian.tools.wrttools/plugin.xml Wed Jul 14 15:18:37 2010 -0700 +++ b/org.symbian.tools.wrttools/plugin.xml Wed Jul 14 16:18:46 2010 -0700 @@ -154,7 +154,8 @@ default-js-name="main" icon="icons/phonegap.png" name="PhoneGap Application" - order="2"> + order="2" + screen-size="360x640"> This wizard generates a project based on the PhoneGap library that showcases PhoneGap API usage. PhoneGap applications require WRT 1.1 or newer. @@ -196,8 +197,9 @@ default-html-name="index" default-js-name="basic" icon="icons/main16.gif" + name="Various UI Templates" order="5" - name="Various UI Templates"> + screen-size="360x640"> Includes templates for high-end devices from Forum.Nokia. diff -r a66f421f3a32 -r 4bb763ad2b12 org.symbian.tools.wrttools/projecttemplates/phonegap.zip Binary file org.symbian.tools.wrttools/projecttemplates/phonegap.zip has changed diff -r a66f421f3a32 -r 4bb763ad2b12 org.symbian.tools.wrttools/schema/projectTemplates.exsd --- a/org.symbian.tools.wrttools/schema/projectTemplates.exsd Wed Jul 14 15:18:37 2010 -0700 +++ b/org.symbian.tools.wrttools/schema/projectTemplates.exsd Wed Jul 14 16:18:46 2010 -0700 @@ -1,177 +1,184 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Enter the first release in which this extension point appears.] - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This template is for touch devices + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff -r a66f421f3a32 -r 4bb763ad2b12 org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java --- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java Wed Jul 14 15:18:37 2010 -0700 +++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/WRTProject.java Wed Jul 14 16:18:46 2010 -0700 @@ -39,6 +39,7 @@ private static final IPath PROPERTIES_FILE = new Path(".settings").append(Activator.PLUGIN_ID + ".properties"); private static final String PROP_DEPLOYMENT_TARGET_NAME = "deployment.target.name"; private static final String PROP_DEPLOYMENT_TARGET_TYPE = "deployment.target.type"; + private static final String PROP_PREFERED_SCREEN = "preferred.screen.size"; private final IProject project; public WRTProject(IProject project) { @@ -103,9 +104,7 @@ if (!file.exists()) { file.create(new ByteArrayInputStream(stream.toByteArray()), false, new NullProgressMonitor()); } else { - file - .setContents(new ByteArrayInputStream(stream.toByteArray()), false, true, - new NullProgressMonitor()); + file.setContents(new ByteArrayInputStream(stream.toByteArray()), false, true, new NullProgressMonitor()); } } catch (IOException e) { Activator.log(e); @@ -117,4 +116,18 @@ public IProject getProject() { return project; } + + public void setPreferredScreenSize(String screenSize) { + Properties props = getProps(); + if (screenSize != null) { + props.put(PROP_PREFERED_SCREEN, screenSize); + } else { + props.remove(PROP_PREFERED_SCREEN); + } + saveProperties(props); + } + + public String getPreferredScreenSize() { + return getProps().getProperty(PROP_PREFERED_SCREEN); + } } diff -r a66f421f3a32 -r 4bb763ad2b12 org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/ProjectTemplate.java --- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/ProjectTemplate.java Wed Jul 14 15:18:37 2010 -0700 +++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/ProjectTemplate.java Wed Jul 14 16:18:46 2010 -0700 @@ -40,9 +40,7 @@ public class ProjectTemplate { private static ProjectTemplate[] templates; - private final IConfigurationElement element; - private Image icon; public ProjectTemplate(IConfigurationElement element) { @@ -54,8 +52,7 @@ String path = element.getAttribute("icon"); final ImageDescriptor imageDescriptor; if (path != null) { - imageDescriptor = Activator.imageDescriptorFromPlugin( - element.getNamespaceIdentifier(), path); + imageDescriptor = Activator.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), path); } else { imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); } @@ -78,8 +75,7 @@ } private String[] getLibraryIds() { - IConfigurationElement[] elements = element - .getChildren("requires-library"); + IConfigurationElement[] elements = element.getChildren("requires-library"); String[] ids = new String[elements.length]; for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; @@ -90,8 +86,8 @@ public static ProjectTemplate[] getAllTemplates() { if (templates == null) { - IExtensionPoint point = Platform.getExtensionRegistry() - .getExtensionPoint(Activator.PLUGIN_ID, "projectTemplates"); + 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++) { @@ -117,8 +113,7 @@ return file != null ? file : "index"; } - public WRTProjectFilesWizardPage createWizardPage(WizardContext context, - DataBindingContext bindingContext) { + public WRTProjectFilesWizardPage createWizardPage(WizardContext context, DataBindingContext bindingContext) { try { if (element.getAttribute("wizard-page-factory") != null) { IWizardPageFactory factory = (IWizardPageFactory) element @@ -139,8 +134,7 @@ public URL getProjectContents() { String uri = element.getAttribute("archive"); if (uri != null) { - Bundle bundle = Platform.getBundle(element.getContributor() - .getName()); + Bundle bundle = Platform.getBundle(element.getContributor().getName()); URL resource = bundle.getResource(uri); return resource; } @@ -175,4 +169,8 @@ } return Integer.MAX_VALUE; } + + public String getScreenSize() { + return element.getAttribute("screen-size"); + } } diff -r a66f421f3a32 -r 4bb763ad2b12 org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java --- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java Wed Jul 14 15:18:37 2010 -0700 +++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java Wed Jul 14 16:18:46 2010 -0700 @@ -57,6 +57,7 @@ import org.eclipse.ui.IWorkbench; import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; import org.symbian.tools.wrttools.Activator; +import org.symbian.tools.wrttools.WRTProject; import org.symbian.tools.wrttools.core.ProjectTemplate; import org.symbian.tools.wrttools.core.WRTImages; import org.symbian.tools.wrttools.core.libraries.JSLibrary; @@ -151,7 +152,9 @@ private void populateProject(IProject project, IProgressMonitor monitor) throws CoreException { - URL projectContents = context.getTemplate().getProjectContents(); + ProjectTemplate t = context.getTemplate(); + new WRTProject(project).setPreferredScreenSize(t.getScreenSize()); + URL projectContents = t.getProjectContents(); Map vars = context.getTemplateVars(); ZipInputStream stream = null;