16 * Assumptions/Requirement/Pre-requisites: |
16 * Assumptions/Requirement/Pre-requisites: |
17 * Failures and causes: |
17 * Failures and causes: |
18 */ |
18 */ |
19 package org.symbian.tools.tmw.internal.ui.project; |
19 package org.symbian.tools.tmw.internal.ui.project; |
20 |
20 |
21 import java.lang.reflect.InvocationTargetException; |
|
22 import java.util.Map; |
21 import java.util.Map; |
23 import java.util.TreeMap; |
22 import java.util.TreeMap; |
24 |
23 |
25 import org.eclipse.core.resources.IProject; |
24 import org.eclipse.core.resources.IProject; |
26 import org.eclipse.core.runtime.CoreException; |
25 import org.eclipse.core.runtime.CoreException; |
27 import org.eclipse.core.runtime.IConfigurationElement; |
26 import org.eclipse.core.runtime.IConfigurationElement; |
28 import org.eclipse.core.runtime.IPath; |
27 import org.eclipse.core.runtime.IPath; |
29 import org.eclipse.core.runtime.IProgressMonitor; |
28 import org.eclipse.core.runtime.IProgressMonitor; |
30 import org.eclipse.core.runtime.SubProgressMonitor; |
29 import org.eclipse.core.runtime.SubProgressMonitor; |
31 import org.eclipse.jface.dialogs.ProgressMonitorDialog; |
|
32 import org.eclipse.jface.operation.IRunnableWithProgress; |
30 import org.eclipse.jface.operation.IRunnableWithProgress; |
33 import org.eclipse.jface.resource.ImageDescriptor; |
31 import org.eclipse.jface.resource.ImageDescriptor; |
34 import org.eclipse.swt.graphics.Image; |
32 import org.eclipse.swt.graphics.Image; |
35 import org.eclipse.swt.widgets.Display; |
|
36 import org.eclipse.ui.PlatformUI; |
|
37 import org.eclipse.wst.common.project.facet.core.IProjectFacet; |
33 import org.eclipse.wst.common.project.facet.core.IProjectFacet; |
38 import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; |
34 import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; |
39 import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; |
35 import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; |
40 import org.symbian.tools.tmw.core.TMWCore; |
36 import org.symbian.tools.tmw.core.TMWCore; |
41 import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime; |
37 import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime; |
142 try { |
138 try { |
143 final IPath[] files = templateInstaller.getFiles(); |
139 final IPath[] files = templateInstaller.getFiles(); |
144 monitor.beginTask("Copying project files", files.length * 10); |
140 monitor.beginTask("Copying project files", files.length * 10); |
145 templateInstaller.copyFiles(files, new SubProgressMonitor(monitor, files.length * 10)); |
141 templateInstaller.copyFiles(files, new SubProgressMonitor(monitor, files.length * 10)); |
146 final IRunnableWithProgress action = templateInstaller.getPostCreateAction(); |
142 final IRunnableWithProgress action = templateInstaller.getPostCreateAction(); |
147 if (action != null) { |
143 monitor.done(); |
148 Display.getDefault().asyncExec(new Runnable() { |
144 new PrepareProjectJob(project, action).schedule(); |
149 public void run() { |
|
150 ProgressMonitorDialog dialog = new ProgressMonitorDialog(PlatformUI.getWorkbench() |
|
151 .getActiveWorkbenchWindow().getShell()); |
|
152 try { |
|
153 dialog.run(false, true, action); |
|
154 } catch (InvocationTargetException e) { |
|
155 TMWCoreUI.log(e); |
|
156 } catch (InterruptedException e) { |
|
157 TMWCoreUI.log(e); |
|
158 } |
|
159 } |
|
160 }); |
|
161 } |
|
162 } catch (CoreException e) { |
145 } catch (CoreException e) { |
163 TMWCoreUI.log(e); |
146 TMWCoreUI.log(e); |
164 } finally { |
147 } finally { |
165 templateInstaller.cleanup(); |
148 templateInstaller.cleanup(); |
166 } |
149 } |
167 monitor.done(); |
|
168 } |
150 } |
169 |
151 |
170 public Map<String, String> getDefaultParameterValues() { |
152 public Map<String, String> getDefaultParameterValues() { |
171 if (parameters == null) { |
153 if (parameters == null) { |
172 parameters = new TreeMap<String, String>(); |
154 parameters = new TreeMap<String, String>(); |