author | Eugene Ostroukhov <eugeneo@symbian.org> |
Thu, 11 Feb 2010 16:56:30 -0800 | |
changeset 139 | f0a865ead60b |
parent 119 | be293233cdde |
child 155 | 9f61ecb49625 |
permissions | -rw-r--r-- |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
1 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
3 |
* All rights reserved. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
8 |
* |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
9 |
* Initial Contributors: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
10 |
* Symbian Foundation - initial contribution. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
11 |
* Contributors: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
12 |
* Description: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
13 |
* Overview: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
14 |
* Details: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
15 |
* Platforms/Drives/Compatibility: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
16 |
* Assumptions/Requirement/Pre-requisites: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
17 |
* Failures and causes: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
18 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
19 |
package org.symbian.tools.wrttools.wizards; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
20 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
21 |
import java.io.ByteArrayInputStream; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
22 |
import java.io.ByteArrayOutputStream; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
23 |
import java.io.IOException; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
24 |
import java.io.InputStreamReader; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
25 |
import java.io.OutputStreamWriter; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
26 |
import java.io.Reader; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
27 |
import java.io.Writer; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
28 |
import java.lang.reflect.InvocationTargetException; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
29 |
import java.net.URL; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
30 |
import java.util.HashMap; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
31 |
import java.util.Map; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
32 |
import java.util.zip.ZipEntry; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
33 |
import java.util.zip.ZipInputStream; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
34 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
35 |
import org.apache.velocity.VelocityContext; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
36 |
import org.apache.velocity.app.Velocity; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
37 |
import org.eclipse.core.databinding.DataBindingContext; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
38 |
import org.eclipse.core.resources.IFile; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
39 |
import org.eclipse.core.resources.IFolder; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
40 |
import org.eclipse.core.resources.IProject; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
41 |
import org.eclipse.core.resources.IWorkspaceRunnable; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
42 |
import org.eclipse.core.resources.ResourcesPlugin; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
43 |
import org.eclipse.core.runtime.CoreException; |
33
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
44 |
import org.eclipse.core.runtime.IConfigurationElement; |
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
45 |
import org.eclipse.core.runtime.IExecutableExtension; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
46 |
import org.eclipse.core.runtime.IProgressMonitor; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
47 |
import org.eclipse.core.runtime.IStatus; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
48 |
import org.eclipse.core.runtime.Status; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
49 |
import org.eclipse.core.runtime.SubProgressMonitor; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
50 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
51 |
import org.eclipse.jface.viewers.IStructuredSelection; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
52 |
import org.eclipse.jface.wizard.IWizardPage; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
53 |
import org.eclipse.jface.wizard.Wizard; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
54 |
import org.eclipse.ui.INewWizard; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
55 |
import org.eclipse.ui.IWorkbench; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
56 |
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; |
33
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
57 |
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; |
84
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
58 |
import org.eclipse.wst.jsdt.core.JavaScriptCore; |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
59 |
import org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
60 |
import org.symbian.tools.wrttools.Activator; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
61 |
import org.symbian.tools.wrttools.core.ProjectTemplate; |
84
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
62 |
import org.symbian.tools.wrttools.core.libraries.IWrtIdeContainer; |
11 | 63 |
import org.symbian.tools.wrttools.util.NonClosingStream; |
64 |
import org.symbian.tools.wrttools.util.ProjectUtils; |
|
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
65 |
|
33
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
66 |
public class WrtWidgetWizard extends Wizard implements INewWizard, IExecutableExtension { |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
67 |
private WizardNewProjectCreationPage resourcePage; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
68 |
private WizardContext context; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
69 |
private DataBindingContext bindingContext; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
70 |
private Map<ProjectTemplate, WRTProjectDetailsWizardPage> templateDetails = new HashMap<ProjectTemplate, WRTProjectDetailsWizardPage>(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
71 |
private WRTProjectTemplateWizardPage templatesPage; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
72 |
private WRTProjectFilesWizardPage filesPage; |
33
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
73 |
private IConfigurationElement config; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
74 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
75 |
public WrtWidgetWizard() { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
76 |
setWindowTitle("New WRT Widget"); |
98
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
77 |
setNeedsProgressMonitor(true); |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
78 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
79 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
80 |
public boolean performFinish() { |
139
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
81 |
final IProject[] holder = new IProject[1]; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
82 |
try { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
83 |
getContainer().run(true, true, new IRunnableWithProgress() { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
84 |
public void run(IProgressMonitor monitor) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
85 |
throws InvocationTargetException, InterruptedException { |
139
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
86 |
holder[0] = action(monitor); |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
87 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
88 |
}); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
89 |
} catch (InvocationTargetException e) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
90 |
Activator.log(e); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
91 |
} catch (InterruptedException e) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
92 |
Activator.log(e); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
93 |
} |
33
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
94 |
BasicNewProjectResourceWizard.updatePerspective(config); |
139
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
95 |
if (holder[0] != null) { |
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
96 |
ProjectUtils.focusOn(holder[0]); |
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
97 |
} |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
98 |
return true; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
99 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
100 |
|
139
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
101 |
protected IProject action(IProgressMonitor monitor) { |
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
102 |
final IProject[] holder = new IProject[1]; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
103 |
try { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
104 |
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
105 |
public void run(IProgressMonitor monitor) throws CoreException { |
139
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
106 |
holder[0] = createAndInitProject(monitor); |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
107 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
108 |
}, monitor); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
109 |
} catch (CoreException e) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
110 |
Activator.log(e); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
111 |
} |
139
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
112 |
return holder[0]; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
113 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
114 |
|
139
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
115 |
protected IProject createAndInitProject(IProgressMonitor monitor) |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
116 |
throws CoreException { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
117 |
monitor.beginTask("Creating project", 100); |
22
6297dfe3bd9d
Several bugfixes
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
17
diff
changeset
|
118 |
IProject project = ProjectUtils.createWrtProject(context.getProjectName(), context.getProjectUri(), new SubProgressMonitor(monitor, 30)); |
84
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
119 |
populateProject(project, new SubProgressMonitor(monitor, 30)); |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
120 |
try { |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
121 |
initLibraries(project, context.getTemplate().getLibraryIds(), new SubProgressMonitor(monitor, 40)); |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
122 |
} catch (IOException e) { |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
123 |
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to setup libraries", e)); |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
124 |
} |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
125 |
monitor.done(); |
139
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
119
diff
changeset
|
126 |
return project; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
127 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
128 |
|
84
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
129 |
private void initLibraries(IProject project, String[] libraryIds, IProgressMonitor progressMonitor) throws IOException, CoreException { |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
130 |
if (libraryIds.length == 0) { |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
131 |
progressMonitor.done(); |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
132 |
return; |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
133 |
} |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
134 |
progressMonitor.beginTask("Installing JS libraries", 100); |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
135 |
int perContainer = 90 / libraryIds.length; |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
136 |
for (String string : libraryIds) { |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
137 |
JsGlobalScopeContainerInitializer containerInitializer = JavaScriptCore.getJsGlobalScopeContainerInitializer(string); |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
138 |
if (containerInitializer instanceof IWrtIdeContainer) { |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
139 |
((IWrtIdeContainer) containerInitializer).populateProject(project, new SubProgressMonitor(progressMonitor, perContainer)); |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
140 |
} |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
141 |
} |
98
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
142 |
// IJavaScriptProject js = JavaScriptCore.create(project); |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
143 |
// IIncludePathEntry[] rawIncludepath = js.getRawIncludepath(); |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
144 |
// int preconfigured = rawIncludepath.length; |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
145 |
// IIncludePathEntry[] newIncludepath = new IIncludePathEntry[preconfigured + libraryIds.length]; |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
146 |
// System.arraycopy(rawIncludepath, 0, newIncludepath, 0, preconfigured); |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
147 |
// for (int i = 0; i < libraryIds.length; i++) { |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
148 |
// String string = libraryIds[i]; |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
149 |
// IIncludePathEntry entry = JavaScriptCore.newContainerEntry(new Path(string)); |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
150 |
// newIncludepath[preconfigured + i] = entry; |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
151 |
// } |
b6d252d808df
Nokia validation code is now integrated with WTP framework
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
84
diff
changeset
|
152 |
// js.setRawIncludepath(newIncludepath, new SubProgressMonitor(progressMonitor, 10)); |
84
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
153 |
progressMonitor.done(); |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
154 |
} |
b24e6a27768d
Integrating WRTKit libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
63
diff
changeset
|
155 |
|
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
156 |
private void populateProject(IProject project, IProgressMonitor monitor) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
157 |
throws CoreException { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
158 |
URL projectContents = context.getTemplate().getProjectContents(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
159 |
Map<String, String> vars = context.getTemplateVars(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
160 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
161 |
ZipInputStream stream = null; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
162 |
try { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
163 |
Velocity.init(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
164 |
VelocityContext ctx = new VelocityContext(vars); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
165 |
stream = new ZipInputStream(projectContents.openStream()); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
166 |
monitor.beginTask("Generating project contents", |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
167 |
IProgressMonitor.UNKNOWN); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
168 |
ZipEntry entry; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
169 |
while ((entry = stream.getNextEntry()) != null |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
170 |
&& !monitor.isCanceled()) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
171 |
String name = entry.getName(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
172 |
boolean isVelocity = name.endsWith(".velocitytemplate"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
173 |
if (isVelocity) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
174 |
name = name.substring(0, name.length() |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
175 |
- ".velocitytemplate".length()); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
176 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
177 |
if (name.startsWith("$")) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
178 |
int dotLocation = name.indexOf("."); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
179 |
String template = name.substring(1, |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
180 |
dotLocation > 1 ? dotLocation : name.length()); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
181 |
if (vars.containsKey(template)) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
182 |
name = vars.get(template) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
183 |
+ name.substring(dotLocation > 1 ? dotLocation |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
184 |
: name.length()); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
185 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
186 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
187 |
if (entry.isDirectory()) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
188 |
IFolder folder = project.getFolder(entry.getName()); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
189 |
folder.create(false, true, new SubProgressMonitor(monitor, 1)); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
190 |
} else if (isVelocity) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
191 |
copyTemplate(project, name, stream, (int) entry.getSize(), |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
192 |
ctx, monitor); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
193 |
} else { |
11 | 194 |
ProjectUtils.copyFile(project, name, stream, entry.getSize(), monitor); |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
195 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
196 |
stream.closeEntry(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
197 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
198 |
monitor.done(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
199 |
} catch (Exception e) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
200 |
throw new CoreException(new Status(IStatus.ERROR, |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
201 |
Activator.PLUGIN_ID, "Project creation failed", e)); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
202 |
} finally { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
203 |
if (stream != null) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
204 |
try { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
205 |
stream.close(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
206 |
} catch (IOException e) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
207 |
// Ignore - something really bad happened |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
208 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
209 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
210 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
211 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
212 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
213 |
private void copyTemplate(IProject project, String name, |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
214 |
ZipInputStream stream, int size, VelocityContext ctx, |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
215 |
IProgressMonitor monitor) throws IOException, CoreException { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
216 |
// Templates will not be more then a few megs - we can afford the memory |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
217 |
ByteArrayOutputStream file = new ByteArrayOutputStream(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
218 |
|
11 | 219 |
Reader reader = new InputStreamReader(new NonClosingStream(stream)); |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
220 |
Writer writer = new OutputStreamWriter(file); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
221 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
222 |
Velocity.evaluate(ctx, writer, name, reader); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
223 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
224 |
reader.close(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
225 |
writer.close(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
226 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
227 |
ByteArrayInputStream contents = new ByteArrayInputStream(file |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
228 |
.toByteArray()); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
229 |
IFile f = project.getFile(name); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
230 |
f.create(contents, true, new SubProgressMonitor(monitor, 1)); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
231 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
232 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
233 |
public void init(IWorkbench workbench, IStructuredSelection selection) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
234 |
context = new WizardContext(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
235 |
bindingContext = new DataBindingContext(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
236 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
237 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
238 |
@Override |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
239 |
public void addPages() { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
240 |
resourcePage = new WizardNewProjectCreationPage("Resource"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
241 |
resourcePage |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
242 |
.setDescription("Create a WRT widget project in the workspace or other location"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
243 |
resourcePage.setTitle("Create a New WRT Widget Project"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
244 |
addPage(resourcePage); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
245 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
246 |
templatesPage = new WRTProjectTemplateWizardPage(context, |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
247 |
bindingContext); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
248 |
addPage(templatesPage); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
249 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
250 |
ProjectTemplate[] templates = ProjectTemplate.getAllTemplates(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
251 |
for (ProjectTemplate projectTemplate : templates) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
252 |
WRTProjectDetailsWizardPage page = projectTemplate |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
253 |
.createWizardPage(context, bindingContext); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
254 |
addPage(page); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
255 |
templateDetails.put(projectTemplate, page); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
256 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
257 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
258 |
filesPage = new WRTProjectFilesWizardPage(context, bindingContext); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
259 |
addPage(filesPage); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
260 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
261 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
262 |
@Override |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
263 |
public boolean canFinish() { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
264 |
return super.canFinish() |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
265 |
&& getContainer().getCurrentPage() == filesPage; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
266 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
267 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
268 |
@Override |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
269 |
public IWizardPage getNextPage(IWizardPage page) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
270 |
if (page == resourcePage) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
271 |
context.setProjectName(resourcePage.getProjectName()); |
63
558819056485
Importing WGZ is now supported. Several bugfixes in other areas were made
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
56
diff
changeset
|
272 |
context.setProjectUri(resourcePage.getLocationURI()); |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
273 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
274 |
if (page == templatesPage) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
275 |
ProjectTemplate template = context.getTemplate(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
276 |
if (template != null) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
277 |
WRTProjectDetailsWizardPage activePage = templateDetails |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
278 |
.get(template); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
279 |
for (WRTProjectDetailsWizardPage wizardPage : templateDetails |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
280 |
.values()) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
281 |
wizardPage.setActive(wizardPage == activePage); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
282 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
283 |
bindingContext.updateModels(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
284 |
return activePage; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
285 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
286 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
287 |
if (page instanceof WRTProjectDetailsWizardPage) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
288 |
return filesPage; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
289 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
290 |
return super.getNextPage(page); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
291 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
292 |
|
33
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
293 |
public void setInitializationData(IConfigurationElement config, |
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
294 |
String propertyName, Object data) throws CoreException { |
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
295 |
this.config = config; |
71a6ac16b759
WRT wizards will switch to JS perspective on completion
Eugene Ostroukhov <eostroukhov@symbian.org>
parents:
22
diff
changeset
|
296 |
} |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
297 |
} |