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; |
21 import java.util.Map; |
22 import java.util.Map; |
22 import java.util.TreeMap; |
23 import java.util.TreeMap; |
23 |
24 |
24 import org.eclipse.core.resources.IProject; |
25 import org.eclipse.core.resources.IProject; |
25 import org.eclipse.core.runtime.CoreException; |
26 import org.eclipse.core.runtime.CoreException; |
26 import org.eclipse.core.runtime.IConfigurationElement; |
27 import org.eclipse.core.runtime.IConfigurationElement; |
27 import org.eclipse.core.runtime.IPath; |
28 import org.eclipse.core.runtime.IPath; |
28 import org.eclipse.core.runtime.IProgressMonitor; |
29 import org.eclipse.core.runtime.IProgressMonitor; |
29 import org.eclipse.core.runtime.SubProgressMonitor; |
30 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.resource.ImageDescriptor; |
33 import org.eclipse.jface.resource.ImageDescriptor; |
31 import org.eclipse.swt.graphics.Image; |
34 import org.eclipse.swt.graphics.Image; |
|
35 import org.eclipse.swt.widgets.Display; |
|
36 import org.eclipse.ui.PlatformUI; |
32 import org.eclipse.wst.common.project.facet.core.IProjectFacet; |
37 import org.eclipse.wst.common.project.facet.core.IProjectFacet; |
33 import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; |
38 import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; |
34 import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; |
39 import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; |
35 import org.symbian.tools.tmw.core.TMWCore; |
40 import org.symbian.tools.tmw.core.TMWCore; |
36 import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime; |
41 import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime; |
136 templateInstaller.prepare(project, context); |
141 templateInstaller.prepare(project, context); |
137 try { |
142 try { |
138 final IPath[] files = templateInstaller.getFiles(); |
143 final IPath[] files = templateInstaller.getFiles(); |
139 monitor.beginTask("Copying project files", files.length * 10); |
144 monitor.beginTask("Copying project files", files.length * 10); |
140 templateInstaller.copyFiles(files, new SubProgressMonitor(monitor, files.length * 10)); |
145 templateInstaller.copyFiles(files, new SubProgressMonitor(monitor, files.length * 10)); |
|
146 final IRunnableWithProgress action = templateInstaller.getPostCreateAction(); |
|
147 if (action != null) { |
|
148 Display.getDefault().asyncExec(new Runnable() { |
|
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 } |
141 } catch (CoreException e) { |
162 } catch (CoreException e) { |
142 TMWCoreUI.log(e); |
163 TMWCoreUI.log(e); |
143 } finally { |
164 } finally { |
144 templateInstaller.cleanup(); |
165 templateInstaller.cleanup(); |
145 } |
166 } |