--- a/org.symbian.tools.mtw.core/plugin.xml Tue Aug 17 13:40:28 2010 -0700
+++ b/org.symbian.tools.mtw.core/plugin.xml Wed Aug 18 09:30:53 2010 -0700
@@ -110,6 +110,9 @@
<delegate
class="org.symbian.tools.tmw.core.internal.facets.InstallCoreFacetAction">
</delegate>
+ <config-factory
+ class="org.symbian.tools.tmw.core.runtimes.ProjectCreationConfigFactory">
+ </config-factory>
</action>
</project-facet-version>
</extension>
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/facets/InstallCoreFacetAction.java Tue Aug 17 13:40:28 2010 -0700
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/internal/facets/InstallCoreFacetAction.java Wed Aug 18 09:30:53 2010 -0700
@@ -29,7 +29,6 @@
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.core.JavaScriptCore;
import org.eclipse.wst.validation.ValidationFramework;
-import org.symbian.tools.tmw.core.projects.IProjectSetupAction;
public class InstallCoreFacetAction implements IDelegate {
@@ -56,10 +55,6 @@
}
ValidationFramework.getDefault().addValidationBuilder(project);
- IProjectSetupAction action = (IProjectSetupAction) config;
- if (action != null) {
- action.initialize(project, new SubProgressMonitor(monitor, 270));
- }
monitor.done();
}
}
\ No newline at end of file
--- a/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/IProjectSetupAction.java Tue Aug 17 13:40:28 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/**
- * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-package org.symbian.tools.tmw.core.projects;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * This object can be set as facet install config for the core TMW facet
- *
- * @author Eugene Ostroukhov (eugeneo@symbian.org)
- */
-public interface IProjectSetupAction {
- /**
- * Performs project setup. Project will already be configured with
- * validation support and JSDT support.
- */
- void initialize(IProject project, IProgressMonitor monitor);
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/projects/IProjectSetupConfig.java Wed Aug 18 09:30:53 2010 -0700
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.projects;
+
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * This object can be set as facet install config for the core TMW facet
+ *
+ * @author Eugene Ostroukhov (eugeneo@symbian.org)
+ */
+public interface IProjectSetupConfig {
+ /**
+ * Performs project setup. Project will already be configured with
+ * validation support and JSDT support.
+ */
+ void initialize(IProject project, IProgressMonitor monitor);
+
+ /**
+ * Allows the framework to reduce dependence on exact project layout. I.e.
+ * some IDEs may want to introduce separation of the web resources and
+ * JavaScript source files.
+ *
+ * @param project project to add file to
+ * @param name file path relative to application root
+ * @param contents stream with file contents
+ * @param monitor progress monitor
+ * @throws CoreException
+ */
+ IFile addFile(IProject project, IPath name, InputStream contents, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Adds specified file to the list of the JS files that will be included in
+ * the application page
+ * @param file workspace file. Framework is responsible to create proper
+ * application root-relative path
+ */
+ void addIncludedJsFile(IFile file);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/LibraryInstallDelegate.java Wed Aug 18 09:30:53 2010 -0700
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.runtimes;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.symbian.tools.tmw.core.TMWCore;
+import org.symbian.tools.tmw.core.projects.IProjectSetupConfig;
+
+public abstract class LibraryInstallDelegate implements IDelegate {
+
+ public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
+ throws CoreException {
+ if (config instanceof IProjectSetupConfig) {
+ final IProjectSetupConfig setupConfig = (IProjectSetupConfig) config;
+ final IPath basePath = getBasePath(project, setupConfig);
+ final InputStream file = openInputStream();
+ final ZipInputStream stream = new ZipInputStream(file);
+ try {
+ ZipEntry en = stream.getNextEntry();
+ while (en != null) {
+ if (!en.isDirectory()) {
+ final IPath entry = new Path(en.getName());
+ final IFile f = setupConfig.addFile(project, basePath.append(entry), stream,
+ new NullProgressMonitor());
+ if (isIncludeFile(entry)) {
+ setupConfig.addIncludedJsFile(f);
+ }
+
+ }
+ en = stream.getNextEntry();
+ }
+ } catch (IOException e) {
+ TMWCore.log(null, e);
+ } finally {
+ try {
+ file.close();
+ } catch (IOException e) {
+ TMWCore.log(null, e);
+ }
+ }
+ }
+ }
+
+ protected abstract IPath getBasePath(IProject project, IProjectSetupConfig setupConfig);
+
+ protected abstract boolean isIncludeFile(IPath entry);
+
+ protected abstract InputStream openInputStream() throws CoreException;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.mtw.core/src/org/symbian/tools/tmw/core/runtimes/ProjectCreationConfigFactory.java Wed Aug 18 09:30:53 2010 -0700
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.tmw.core.runtimes;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+
+public class ProjectCreationConfigFactory implements IActionConfigFactory {
+ // Basically this is an ugly hack. Our project wizard will replace this config
+ // object with WizardContext
+ public static final Object CONFIG_STANDIN = "standing_config";
+
+ public Object create() throws CoreException {
+ return CONFIG_STANDIN;
+ }
+
+}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/project/ZipInstaller.java Tue Aug 17 13:40:28 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/project/ZipInstaller.java Wed Aug 18 09:30:53 2010 -0700
@@ -172,7 +172,7 @@
if (nm.endsWith(TEMPLATE_FILE_EXTENSION)) {
contents = copyTemplate(project, name, stream, (int) entry.getSize(), ctx, monitor);
} else {
- contents = new NonClosingStream(stream);
+ contents = stream;
}
IFile file = context.addFile(project, name, contents, new SubProgressMonitor(monitor, 10));
if (open) {
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationDetailsWizardPage.java Tue Aug 17 13:40:28 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationDetailsWizardPage.java Wed Aug 18 09:30:53 2010 -0700
@@ -87,10 +87,9 @@
root.setLayout(new GridLayout(2, false));
createProjectNameGroup(root);
- context.createLabel(root, "");
- context.createLabel(root, "");
-
- context.createLabel(root, "Mobile Runtime:");
+ createLabel(root, "");
+ createLabel(root, "");
+ createLabel(root, "Mobile Runtime:");
ComboViewer viewer = new ComboViewer(root);
viewer.setContentProvider(new ArrayContentProvider());
@@ -106,25 +105,25 @@
final IObservableValue observableValue = BeansObservables.observeValue(context, WizardContext.RUNTIME);
bindingContext.bindValue(observeSelection, observableValue);
- context.createLabel(root, "");
- context.createLabel(root, "");
- context.createLabel(root, "Application identifier:");
+ createLabel(root, "");
+ createLabel(root, "");
+ createLabel(root, "Application identifier:");
context.createText(root, WizardContext.WIDGET_ID, "applicatoin identifier", bindingContext, null,
new RegexpValidator("[\\w]*(\\.\\w[\\w]*)*", "{0} is not a valid applicatoin ID", true));
- context.createLabel(root, "");
- context.createLabel(root, "This id should be unique for successful installation of application on the device");
+ createLabel(root, "");
+ createLabel(root, "This id should be unique for successful installation of application on the device");
- context.createLabel(root, "");
- context.createLabel(root, "");
+ createLabel(root, "");
+ createLabel(root, "");
- context.createLabel(root, "Application name:");
+ createLabel(root, "Application name:");
context.createText(root, WizardContext.WIDGET_NAME, "application name", bindingContext, null,
new RegexpValidator("[^\\w\\. ]", "Application name cannot contain {0} character", false));
- context.createLabel(root, "");
- context.createLabel(root, "This will be the application display name on the device");
+ createLabel(root, "");
+ createLabel(root, "This will be the application display name on the device");
Composite composite = new Composite(root, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, false);
@@ -148,6 +147,10 @@
Dialog.applyDialogFont(root);
}
+ private void createLabel(Composite root, String string) {
+ new Label(root, SWT.NONE).setText(string);
+ }
+
/**
* Creates the project name specification controls.
*
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationFacetsWizardPage.java Tue Aug 17 13:40:28 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationFacetsWizardPage.java Wed Aug 18 09:30:53 2010 -0700
@@ -46,7 +46,7 @@
public void handleEvent(final IFacetedProjectEvent event) {
updatePageState();
}
- }, IFacetedProjectEvent.Type.PROJECT_MODIFIED);
+ }, IFacetedProjectEvent.Type.PROJECT_MODIFIED, IFacetedProjectEvent.Type.PROJECT_NAME_CHANGED);
final IRuntimeLifecycleListener runtimeLifecycleListener = new IRuntimeLifecycleListener() {
public void handleEvent(final IRuntimeLifecycleEvent event) {
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationWizard.java Tue Aug 17 13:40:28 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/NewApplicationWizard.java Wed Aug 18 09:30:53 2010 -0700
@@ -18,22 +18,31 @@
*/
package org.symbian.tools.tmw.internal.ui.wizard;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
import org.symbian.tools.tmw.core.TMWCore;
import org.symbian.tools.tmw.core.projects.IFProjSupport;
+import org.symbian.tools.tmw.core.runtimes.ProjectCreationConfigFactory;
import org.symbian.tools.tmw.ui.project.INewApplicationWizardPage;
import org.symbian.tools.tmw.ui.project.IProjectTemplate;
@@ -74,32 +83,69 @@
}
public boolean canFinish() {
- return this.firstPage.isPageComplete() && super.canFinish();
+ return getNextPage(getContainer().getCurrentPage()) == null && this.firstPage.isPageComplete()
+ && super.canFinish();
}
protected NewApplicationDetailsWizardPage createFirstPage() {
firstPage = new NewApplicationDetailsWizardPage(wizardContext, databindingContext);
return firstPage;
}
+
@Override
public IWizardPage getNextPage(final IWizardPage page) {
+ final IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy();
if (page == this.firstPage) {
- final IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy();
fpjwc.setProjectName(getProjectName());
fpjwc.setProjectLocation(getProjectLocation());
final IFProjSupport fprojSupport = TMWCore.getFProjSupport();
IRuntime runtime = fprojSupport.getRuntime(wizardContext.getRuntime());
fpjwc.setTargetedRuntimes(Collections.singleton(runtime));
fpjwc.setPrimaryRuntime(runtime);
- fpjwc.setProjectFacets(fprojSupport.getFixedFacetsVersions(wizardContext.getRuntime()));
- fpjwc.setFixedProjectFacets(fprojSupport.getFixedFacets(wizardContext.getRuntime()));
- fpjwc.setProjectFacetActionConfig(fprojSupport.getTMWFacet(), wizardContext);
+ Set<IProjectFacetVersion> facets = getCurrentFixedFacetVersions();
+ facets.addAll(fpjwc.getProjectFacets());
+ fpjwc.setProjectFacets(facets);
+ fpjwc.setFixedProjectFacets(getCurrentFixedFacets());
+ } else if (page == this.templatesPage) {
+ Set<IProjectFacetVersion> facets = getCurrentFixedFacetVersions();
+ facets.addAll(fpjwc.getProjectFacets());
+ fpjwc.setProjectFacets(facets);
+ fpjwc.setFixedProjectFacets(getCurrentFixedFacets());
+ }
+ final Collection<Action> actions = fpjwc.getProjectFacetActions();
+ final Collection<Action> toReplace = new HashSet<IFacetedProject.Action>();
+ for (Action action : actions) {
+ if (action.getConfig() == ProjectCreationConfigFactory.CONFIG_STANDIN) {
+ toReplace.add(action);
+ }
+ }
+ for (Action action : toReplace) {
+ fpjwc.setProjectFacetActionConfig(action.getProjectFacetVersion().getProjectFacet(), wizardContext);
}
IWizardPage nextPage = super.getNextPage(page);
return nextPage;
}
+ private Set<IProjectFacet> getCurrentFixedFacets() {
+ final Set<IProjectFacetVersion> fixedFacets = getCurrentFixedFacetVersions();
+ final Set<IProjectFacet> facets = new HashSet<IProjectFacet>();
+ for (IProjectFacetVersion facet : fixedFacets) {
+ facets.add(facet.getProjectFacet());
+ }
+ return facets;
+ }
+
+ private Set<IProjectFacetVersion> getCurrentFixedFacetVersions() {
+ final IFProjSupport fprojSupport = TMWCore.getFProjSupport();
+ Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>(
+ fprojSupport.getFixedFacetsVersions(wizardContext.getRuntime()));
+ if (wizardContext.getTemplate() != null) {
+ facets.addAll(Arrays.asList(wizardContext.getTemplate().getRequiredFacets()));
+ }
+ return facets;
+ }
+
public IWizardPage[] getPages() {
final IProjectTemplate current = wizardContext.getTemplate();
if (template != current) {
@@ -165,4 +211,12 @@
this.workbench = workbench;
this.selection = selection;
}
+
+ @Override
+ protected void performFinish(IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask("Preparing project", 100);
+ super.performFinish(new SubProgressMonitor(monitor, 20));
+ wizardContext.initialize(getFacetedProject().getProject(), new SubProgressMonitor(monitor, 80));
+ monitor.done();
+ }
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/WizardContext.java Tue Aug 17 13:40:28 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/internal/ui/wizard/WizardContext.java Wed Aug 18 09:30:53 2010 -0700
@@ -2,17 +2,19 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.io.FilterInputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
+import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
+import java.util.TreeSet;
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.AbstractObservableValue;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.ValueDiff;
@@ -31,7 +33,6 @@
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.tmw.core.TMWCore;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
@@ -58,6 +59,7 @@
private String widgetId;
private String widgetName;
+ private final Collection<String> jsIncludes = new TreeSet<String>();
public WizardContext() {
IMobileWebRuntime[] runtimes = TMWCore.getRuntimesManager().getAllRuntimes();
@@ -73,7 +75,7 @@
if (!file.exists()) {
create(file.getParent());
}
- file.create(contents, false, new SubProgressMonitor(monitor, 100));
+ file.create(new NonClosingStream(contents), false, new SubProgressMonitor(monitor, 100));
monitor.done();
return file;
}
@@ -93,11 +95,6 @@
}
}
- protected void createLabel(Composite root, String text) {
- Label label = new Label(root, SWT.NONE);
- label.setText(text);
- }
-
private Text createText(Composite root, IObservableValue model, String propertyName,
DataBindingContext bindingContext, AbstractDataBindingPage page, IValidator... validators) {
Text text = new Text(root, SWT.BORDER);
@@ -117,13 +114,6 @@
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 IProjectTemplate getDefaultTemplate(IMobileWebRuntime runtime) {
return TMWCoreUI.getProjectTemplateManager().getDefaultTemplate(runtime);
}
@@ -187,6 +177,7 @@
vars.put("widgetName", getWidgetName());
vars.put("widgetId", getWidgetId());
+ vars.put("jsIncludes", jsIncludes);
vars.putAll(extensions);
return vars;
@@ -320,4 +311,20 @@
});
}
}
+
+ private static final class NonClosingStream extends FilterInputStream {
+ private NonClosingStream(InputStream in) {
+ super(in);
+ }
+
+ @Override
+ public void close() throws IOException {
+ // Avoid closing ZIP file
+ }
+ }
+
+
+ public void addIncludedJsFile(IFile file) {
+ jsIncludes.add(file.getProjectRelativePath().makeRelative().toString());
+ }
}
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/project/IProjectTemplateContext.java Tue Aug 17 13:40:28 2010 -0700
+++ b/org.symbian.tools.mtw.ui/src/org/symbian/tools/tmw/ui/project/IProjectTemplateContext.java Wed Aug 18 09:30:53 2010 -0700
@@ -18,15 +18,8 @@
*/
package org.symbian.tools.tmw.ui.project;
-import java.io.InputStream;
-
import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.symbian.tools.tmw.core.projects.IProjectSetupAction;
+import org.symbian.tools.tmw.core.projects.IProjectSetupConfig;
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime;
/**
@@ -34,7 +27,7 @@
*
* @author Eugene Ostroukhov (eugeneo@symbian.org)
*/
-public interface IProjectTemplateContext extends IProjectSetupAction {
+public interface IProjectTemplateContext extends IProjectSetupConfig {
/**
* @return runtime that the project targets
*/
@@ -55,19 +48,6 @@
void putParameter(String key, Object value);
/**
- * Allows the framework to reduce dependance on exact project layout. I.e.
- * some IDEs may want to introduce separation of the web resources and
- * JavaScript source files.
- *
- * @param project project to add file to
- * @param name file path relative to application root
- * @param contents stream with file contents
- * @param monitor progress monitor
- * @throws CoreException
- */
- IFile addFile(IProject project, IPath name, InputStream contents, IProgressMonitor monitor) throws CoreException;
-
- /**
* Allows binding to parameter value from UI.
*
* @param name parameter value
--- a/org.symbian.tools.wrttools/plugin.xml Tue Aug 17 13:40:28 2010 -0700
+++ b/org.symbian.tools.wrttools/plugin.xml Wed Aug 18 09:30:53 2010 -0700
@@ -810,6 +810,16 @@
type="org.symbian.tools.wrttools.wrt"
version="1.1">
</runtime-component-version>
+ <supported>
+ <facet
+ id="symbian.wrtkit"
+ version="1.0">
+ </facet>
+ <runtime-component
+ id="org.symbian.tools.wrttools.wrt"
+ version="1.1">
+ </runtime-component>
+ </supported>
</extension>
<extension
point="org.eclipse.wst.common.project.facet.ui.images">
@@ -869,6 +879,10 @@
name="flickrUrl"
value="http://flickr.com/photos/symbianfoundation">
</default-parameter-value>
+ <required-facet
+ id="symbian.wrtkit"
+ version="1.0">
+ </required-facet>
</template>
<runtime-template
runtime-id="org.symbian.tools.wrttools.wrt"
@@ -901,5 +915,47 @@
template-id="org.symbian.wrt11.flickr">
</template-page>
</extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.facets">
+ <project-facet
+ id="symbian.wrtkit">
+ <label>
+ Symbian WRTKit
+ </label>
+ <description>
+ WRTKit UI library for Symbian WRT
+ </description>
+ <default-version
+ version="1.0">
+ </default-version>
+ </project-facet>
+ <project-facet-version
+ facet="symbian.wrtkit"
+ version="1.0">
+ <constraint>
+ <requires
+ facet="tmw.core"
+ version="[1.0">
+ </requires>
+ </constraint>
+ <action
+ type="install">
+ <delegate
+ class="org.symbian.tools.wrttools.core.libraries.InstallWrtKitDelegate">
+ </delegate>
+ <config-factory
+ class="org.symbian.tools.tmw.core.runtimes.ProjectCreationConfigFactory">
+ </config-factory>
+ </action>
+ </project-facet-version>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.ui.images">
+ <image
+ facet="symbian.wrtkit"
+ path="icons/main16_prev.gif"
+ version="1.0">
+ </image>
+ </extension>
</plugin>
Binary file org.symbian.tools.wrttools/projecttemplates/flickr.zip has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/InstallWrtKitDelegate.java Wed Aug 18 09:30:53 2010 -0700
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.wrttools.core.libraries;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+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.symbian.tools.tmw.core.projects.IProjectSetupConfig;
+import org.symbian.tools.tmw.core.runtimes.LibraryInstallDelegate;
+import org.symbian.tools.wrttools.Activator;
+
+public class InstallWrtKitDelegate extends LibraryInstallDelegate {
+
+ @Override
+ protected boolean isIncludeFile(IPath entry) {
+ return entry.equals(new Path("WRTKit.js"));
+ }
+
+ @Override
+ protected InputStream openInputStream() throws CoreException {
+ try {
+ return FileLocator.openStream(Activator.getDefault().getBundle(),
+ new Path("libraries").append("wrtkit.zip"), true);
+ } catch (IOException e) {
+ throw new CoreException(
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Can't access WRTKit library zip", e));
+ }
+ }
+
+ @Override
+ protected IPath getBasePath(IProject project, IProjectSetupConfig setupConfig) {
+ return new Path("wrtkit");
+ }
+}