author | Eugene Ostroukhov <eugeneo@symbian.org> |
Thu, 29 Jul 2010 10:00:34 -0700 | |
changeset 458 | 5ff93668b08c |
parent 455 | 5da55957c779 |
child 468 | a05c6e5cc7d9 |
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 |
*/ |
11 | 19 |
package org.symbian.tools.wrttools.util; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
20 |
|
11 | 21 |
import java.io.File; |
63
558819056485
Importing WGZ is now supported. Several bugfixes in other areas were made
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
54
diff
changeset
|
22 |
import java.io.FileInputStream; |
11 | 23 |
import java.io.IOException; |
309
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
308
diff
changeset
|
24 |
import java.io.InputStream; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
25 |
import java.net.URI; |
63
558819056485
Importing WGZ is now supported. Several bugfixes in other areas were made
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
54
diff
changeset
|
26 |
import java.text.MessageFormat; |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
27 |
import java.util.Arrays; |
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:
135
diff
changeset
|
28 |
import java.util.Collection; |
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
135
diff
changeset
|
29 |
import java.util.HashSet; |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
30 |
import java.util.LinkedList; |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
31 |
import java.util.List; |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
32 |
import java.util.TreeSet; |
63
558819056485
Importing WGZ is now supported. Several bugfixes in other areas were made
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
54
diff
changeset
|
33 |
import java.util.zip.ZipEntry; |
11 | 34 |
import java.util.zip.ZipInputStream; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
35 |
|
11 | 36 |
import javax.swing.filechooser.FileSystemView; |
37 |
||
92
e5c37ce1b003
Both WTP and JSDT validation now work
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
82
diff
changeset
|
38 |
import org.eclipse.core.resources.ICommand; |
63
558819056485
Importing WGZ is now supported. Several bugfixes in other areas were made
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
54
diff
changeset
|
39 |
import org.eclipse.core.resources.IContainer; |
11 | 40 |
import org.eclipse.core.resources.IFile; |
63
558819056485
Importing WGZ is now supported. Several bugfixes in other areas were made
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
54
diff
changeset
|
41 |
import org.eclipse.core.resources.IFolder; |
282
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
42 |
import org.eclipse.core.resources.IMarker; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
43 |
import org.eclipse.core.resources.IProject; |
54
5a2cfa9bc743
Nature is used for UI
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
49
diff
changeset
|
44 |
import org.eclipse.core.resources.IProjectDescription; |
63
558819056485
Importing WGZ is now supported. Several bugfixes in other areas were made
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
54
diff
changeset
|
45 |
import org.eclipse.core.resources.IResource; |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
46 |
import org.eclipse.core.resources.IResourceVisitor; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
47 |
import org.eclipse.core.resources.IWorkspace; |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
48 |
import org.eclipse.core.resources.IWorkspaceRunnable; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
49 |
import org.eclipse.core.resources.ResourcesPlugin; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
50 |
import org.eclipse.core.runtime.CoreException; |
63
558819056485
Importing WGZ is now supported. Several bugfixes in other areas were made
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
54
diff
changeset
|
51 |
import org.eclipse.core.runtime.IPath; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
52 |
import org.eclipse.core.runtime.IProgressMonitor; |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
53 |
import org.eclipse.core.runtime.IStatus; |
11 | 54 |
import org.eclipse.core.runtime.NullProgressMonitor; |
63
558819056485
Importing WGZ is now supported. Several bugfixes in other areas were made
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
54
diff
changeset
|
55 |
import org.eclipse.core.runtime.Path; |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
56 |
import org.eclipse.core.runtime.Status; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
57 |
import org.eclipse.core.runtime.SubProgressMonitor; |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
58 |
import org.eclipse.core.runtime.jobs.Job; |
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:
135
diff
changeset
|
59 |
import org.eclipse.jface.viewers.StructuredSelection; |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
60 |
import org.eclipse.swt.widgets.Display; |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
438
diff
changeset
|
61 |
import org.eclipse.ui.IPageLayout; |
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:
135
diff
changeset
|
62 |
import org.eclipse.ui.IViewReference; |
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
135
diff
changeset
|
63 |
import org.eclipse.ui.IWorkbenchPage; |
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
135
diff
changeset
|
64 |
import org.eclipse.ui.IWorkbenchPart; |
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
135
diff
changeset
|
65 |
import org.eclipse.ui.PlatformUI; |
f0a865ead60b
Fixed Bug 1869 - Open index file and select it in navigator after the project is created/imported
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
135
diff
changeset
|
66 |
import org.eclipse.ui.ide.IDE; |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
67 |
import org.eclipse.ui.internal.wizards.datatransfer.TarEntry; |
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:
135
diff
changeset
|
68 |
import org.eclipse.ui.part.ISetSelectionTarget; |
216
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
69 |
import org.eclipse.wst.jsdt.core.IIncludePathEntry; |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
70 |
import org.eclipse.wst.jsdt.core.IJavaScriptProject; |
92
e5c37ce1b003
Both WTP and JSDT validation now work
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
82
diff
changeset
|
71 |
import org.eclipse.wst.jsdt.core.JavaScriptCore; |
216
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
72 |
import org.eclipse.wst.jsdt.core.LibrarySuperType; |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
73 |
import org.eclipse.wst.jsdt.internal.core.JavaProject; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
74 |
import org.eclipse.wst.jsdt.internal.ui.wizards.buildpaths.BuildPathsBlock; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
75 |
import org.eclipse.wst.validation.ValidationFramework; |
11 | 76 |
import org.symbian.tools.wrttools.Activator; |
54
5a2cfa9bc743
Nature is used for UI
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
49
diff
changeset
|
77 |
import org.symbian.tools.wrttools.WidgetProjectNature; |
282
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
78 |
import org.symbian.tools.wrttools.core.packager.WRTPackagerConstants; |
216
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
79 |
import org.symbian.tools.wrttools.wizards.WrtLibraryWizardPage; |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
80 |
|
119
be293233cdde
Some compilation warnings were cleared
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
98
diff
changeset
|
81 |
@SuppressWarnings("restriction") |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
82 |
public class ProjectUtils { |
300
9505af44d7bf
Bug 2480 and bug 2430
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
283
diff
changeset
|
83 |
public static final String EXCLUDE_MARKER_ID = "org.symbian.tools.wrttools.excluded"; |
282
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
84 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
85 |
private static final class FocusOnProjectJob extends Job { |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
86 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
87 |
private final Display display; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
88 |
private final IProject[] projects; |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
89 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
90 |
public FocusOnProjectJob(IProject[] projects, Display display) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
91 |
super("Preparing projects"); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
92 |
this.projects = projects; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
93 |
this.display = display; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
94 |
setRule(this.projects.length == 1 ? projects[0] : projects[0].getWorkspace().getRoot()); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
95 |
setUser(false); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
96 |
} |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
97 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
98 |
@Override |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
99 |
protected IStatus run(IProgressMonitor monitor) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
100 |
try { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
101 |
final Collection<IFile> files = new HashSet<IFile>(projects.length); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
102 |
for (IProject project : projects) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
103 |
String file = CoreUtil.getIndexFile(project); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
104 |
if (file != null) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
105 |
IFile index = project.getFile(file); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
106 |
if (index.isAccessible()) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
107 |
files.add(index); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
108 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
109 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
110 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
111 |
final IFile[] filesArray = files.toArray(new IFile[files.size()]); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
112 |
if (filesArray.length > 0) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
113 |
display.asyncExec(new Runnable() { |
156
5d68e30cba9b
Fixed Bug 1864 - WRTKit content assist is not always available.
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
139
diff
changeset
|
114 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
115 |
public void run() { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
116 |
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow() |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
117 |
.getActivePage(); |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
438
diff
changeset
|
118 |
IViewReference reference = activePage.findViewReference(IPageLayout.ID_PROJECT_EXPLORER); |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
119 |
IWorkbenchPart part = reference.getPart(false); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
120 |
if (part instanceof ISetSelectionTarget) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
121 |
StructuredSelection selection; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
122 |
if (filesArray.length == 1) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
123 |
selection = new StructuredSelection(filesArray[0]); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
124 |
} else { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
125 |
selection = new StructuredSelection(filesArray); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
126 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
127 |
((ISetSelectionTarget) part).selectReveal(selection); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
128 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
129 |
try { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
130 |
IDE.openEditors(activePage, filesArray); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
131 |
ResourcesPlugin.getWorkspace().run(new TouchAllResources(projects), |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
132 |
new NullProgressMonitor()); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
133 |
} catch (CoreException e) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
134 |
Activator.log(e); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
135 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
136 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
137 |
}); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
138 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
139 |
} catch (CoreException e) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
140 |
Activator.log(e); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
141 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
142 |
return Status.OK_STATUS; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
143 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
144 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
145 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
146 |
private static final class TouchAllResources implements IWorkspaceRunnable { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
147 |
private final IProject[] projects; |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
148 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
149 |
public TouchAllResources(IProject[] projects) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
150 |
this.projects = projects; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
151 |
|
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
152 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
153 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
154 |
public void run(IProgressMonitor monitor) throws CoreException { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
155 |
for (IProject project : projects) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
156 |
project.accept(new IResourceVisitor() { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
157 |
public boolean visit(IResource resource) throws CoreException { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
158 |
if (resource.isAccessible() && resource.getType() == IResource.FILE |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
159 |
&& resource.getFileExtension().equals("js")) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
160 |
resource.touch(new NullProgressMonitor()); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
161 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
162 |
return true; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
163 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
164 |
}); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
165 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
166 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
167 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
168 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
169 |
private static final String DEFAULT_APTANA_WORKSPACE = "Aptana Studio Workspace"; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
170 |
private static final Collection<String> EXCLUDED; |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
171 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
172 |
public static final String PREVIEW_FOLDER = "preview"; |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
173 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
174 |
public static final String PREVIEW_FRAME_FILE = "wrt_preview_frame.html"; |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
175 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
176 |
public static final String PREVIEW_MAIN_FILE = "wrt_preview_main.html"; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
177 |
|
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
178 |
static { |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
179 |
EXCLUDED = new TreeSet<String>(Arrays.asList(".project", ProjectUtils.PREVIEW_FOLDER, |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
180 |
ProjectUtils.PREVIEW_FRAME_FILE, ProjectUtils.PREVIEW_MAIN_FILE)); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
181 |
} |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
182 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
183 |
private static boolean accepted(Object object) { |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
184 |
final String name; |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
185 |
if (object instanceof ZipEntry) { |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
186 |
name = ((ZipEntry) object).getName(); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
187 |
} else if (object instanceof TarEntry) { |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
188 |
name = ((TarEntry) object).getName(); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
189 |
} else if (object instanceof File) { |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
190 |
name = ((File) object).getAbsolutePath(); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
191 |
} else { |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
192 |
throw new IllegalArgumentException("Unforeseen entry type: " + object.getClass()); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
193 |
} |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
194 |
IPath path = new Path(name); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
195 |
return isValidProjectFile(path.lastSegment()); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
196 |
} |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
197 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
198 |
public static void addWrtNature(IProject project) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
199 |
if (!hasWrtNature(project)) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
200 |
try { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
201 |
IProjectDescription description = project.getDescription(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
202 |
String[] natureIds = description.getNatureIds(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
203 |
String[] newNatures = new String[natureIds.length + 1]; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
204 |
System.arraycopy(natureIds, 0, newNatures, 1, natureIds.length); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
205 |
newNatures[0] = WidgetProjectNature.ID; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
206 |
description.setNatureIds(newNatures); |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
207 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
208 |
ICommand[] buildSpec = description.getBuildSpec(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
209 |
for (int i = 0; i < buildSpec.length; i++) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
210 |
ICommand command = buildSpec[i]; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
211 |
if (JavaScriptCore.BUILDER_ID.equals(command.getBuilderName())) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
212 |
buildSpec[i] = buildSpec[buildSpec.length - 1]; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
213 |
buildSpec[buildSpec.length - 1] = command; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
214 |
description.setBuildSpec(buildSpec); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
215 |
break; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
216 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
217 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
218 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
219 |
project.setDescription(description, new NullProgressMonitor()); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
220 |
} catch (CoreException e) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
221 |
Activator.log(e); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
222 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
223 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
224 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
225 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
226 |
private static void checkParent(IContainer parent) throws CoreException { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
227 |
if (parent.getType() == IResource.FOLDER && !parent.exists()) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
228 |
checkParent(parent.getParent()); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
229 |
((IFolder) parent).create(false, true, new NullProgressMonitor()); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
230 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
231 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
232 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
233 |
public static void copyFile(IProject project, String name, ZipInputStream stream, long size, |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
234 |
IProgressMonitor monitor) throws CoreException, IOException { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
235 |
IFile file = project.getFile(name); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
236 |
file.create(new NonClosingStream(stream), true, new SubProgressMonitor(monitor, 1)); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
237 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
238 |
|
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
239 |
public static IProject createWrtProject(String name, URI uri, IProgressMonitor monitor) throws CoreException { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
240 |
uri = isDefaultProjectLocation(uri) ? null : uri; |
438
99afbaa8a4bc
Bug 3037 - Delete project and recreation causes javascript parsing problem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
351
diff
changeset
|
241 |
monitor.beginTask("Create project resources", 30); |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
242 |
IWorkspace workspace = ResourcesPlugin.getWorkspace(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
243 |
IProject project = workspace.getRoot().getProject(name); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
244 |
BuildPathsBlock.createProject(project, uri, new SubProgressMonitor(monitor, 10)); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
245 |
BuildPathsBlock.addJavaNature(project, new SubProgressMonitor(monitor, 10)); |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
246 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
247 |
ValidationFramework.getDefault().addValidationBuilder(project); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
248 |
ValidationFramework.getDefault().applyChanges(ValidationFramework.getDefault().getProjectSettings(project), |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
249 |
true); |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
250 |
|
216
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
251 |
IJavaScriptProject jsProject = JavaScriptCore.create(project); |
438
99afbaa8a4bc
Bug 3037 - Delete project and recreation causes javascript parsing problem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
351
diff
changeset
|
252 |
jsProject.setRawIncludepath(null, new SubProgressMonitor(monitor, 5)); // See bug 3037 |
216
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
253 |
final IIncludePathEntry[] includepath = jsProject.getRawIncludepath(); |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
254 |
final IIncludePathEntry[] newIncludePath = new IIncludePathEntry[includepath.length + 1]; |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
255 |
|
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
256 |
System.arraycopy(includepath, 0, newIncludePath, 0, includepath.length); |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
257 |
newIncludePath[includepath.length] = JavaScriptCore.newContainerEntry(new Path( |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
258 |
WrtLibraryWizardPage.CONTAINER_ID)); |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
259 |
|
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
260 |
jsProject.setRawIncludepath(newIncludePath, new SubProgressMonitor(monitor, 5)); |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
261 |
|
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
262 |
LibrarySuperType superType = new LibrarySuperType(new Path(WrtLibraryWizardPage.CONTAINER_ID), jsProject, |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
263 |
"Window"); |
914d053d42b1
Bug 2070 - added code completion for browser objects (window, navigator, etc) and core WRT objects (widget, device)
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
203
diff
changeset
|
264 |
((JavaProject) jsProject).setCommonSuperType(superType); |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
265 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
266 |
addWrtNature(project); |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
267 |
|
283
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
268 |
excludeResources(project); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
269 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
270 |
monitor.done(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
271 |
return project; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
272 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
273 |
|
283
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
274 |
private static void excludeResources(IProject project) { |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
275 |
IFile file = project.getFile(IProjectDescription.DESCRIPTION_FILE_NAME); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
276 |
if (file.exists()) { |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
277 |
exclude(file); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
278 |
} |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
279 |
IFolder settings = project.getFolder(".settings"); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
280 |
if (settings.exists()) { |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
281 |
excludeFolder(settings); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
282 |
exclude(settings); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
283 |
} |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
284 |
} |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
285 |
|
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
286 |
private static void excludeFolder(IFolder folder) { |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
287 |
exclude(folder); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
288 |
try { |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
289 |
IResource[] members = folder.members(); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
290 |
for (IResource resource : members) { |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
291 |
if (resource.getType() == IResource.FOLDER) { |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
292 |
excludeFolder((IFolder) resource); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
293 |
} else { |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
294 |
exclude(resource); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
295 |
} |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
296 |
} |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
297 |
} catch (CoreException e) { |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
298 |
Activator.log(e); |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
299 |
} |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
300 |
} |
c035b31473c1
Configuration files are excluded from packaging
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
282
diff
changeset
|
301 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
302 |
public static List<Object> filterExternalProjectEntries(List<Object> fileSystemObjects) { |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
303 |
List<Object> result = new LinkedList<Object>(); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
304 |
for (Object object : fileSystemObjects) { |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
305 |
if (accepted(object)) { |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
306 |
result.add(object); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
307 |
} |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
308 |
} |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
309 |
return result; |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
310 |
} |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
311 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
312 |
public static void focusOn(IProject... projects) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
313 |
new FocusOnProjectJob(projects, Display.getCurrent()).schedule(50); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
314 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
315 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
316 |
public static String getDefaultAptanaLocation() { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
317 |
File myDocuments = FileSystemView.getFileSystemView().getDefaultDirectory(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
318 |
File file = new File(myDocuments, DEFAULT_APTANA_WORKSPACE); // Windows |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
319 |
if (file.exists()) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
320 |
return file.getAbsolutePath(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
321 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
322 |
file = new File(myDocuments, "Documents" + File.separator + DEFAULT_APTANA_WORKSPACE); // Mac OS X |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
323 |
if (file.exists()) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
324 |
return file.getAbsolutePath(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
325 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
326 |
return ""; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
327 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
328 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
329 |
public static boolean hasWrtNature(IProject project) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
330 |
try { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
331 |
return project.hasNature(WidgetProjectNature.ID); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
332 |
} catch (CoreException e) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
333 |
Activator.log(e); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
334 |
return false; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
335 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
336 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
337 |
|
203
bb3a18c4e037
Refactoring, some messages were updated
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
200
diff
changeset
|
338 |
public static File isWrtProject(File[] contents) { |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
339 |
for (int i = 0; i < contents.length; i++) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
340 |
File file = contents[i]; |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
341 |
if (file.isFile() && file.getName().equalsIgnoreCase(CoreUtil.METADATA_FILE)) { |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
342 |
return file.getParentFile(); |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
343 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
344 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
345 |
return null; |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
346 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
347 |
|
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
348 |
private static boolean isDefaultProjectLocation(URI uri) { |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
349 |
if (uri == null) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
350 |
return true; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
351 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
352 |
File file = new File(uri); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
353 |
IPath project = new Path(file.getAbsolutePath()); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
354 |
IPath workspace = ResourcesPlugin.getWorkspace().getRoot().getLocation(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
355 |
return workspace.isPrefixOf(project); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
356 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
357 |
|
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
358 |
public static boolean isPlist(IResource resource) { |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
359 |
return resource.getType() == IResource.FILE && resource.getName().equalsIgnoreCase(CoreUtil.METADATA_FILE); |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
360 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
361 |
|
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
362 |
private static boolean isValidProjectFile(String fileName) { |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
363 |
return !EXCLUDED.contains(fileName); |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
364 |
} |
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
365 |
|
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
366 |
public static void unzip(String archiveFile, IContainer location, int trimSegments, IProgressMonitor progressMonitor) |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
367 |
throws IOException, CoreException { |
309
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
308
diff
changeset
|
368 |
unzip(new FileInputStream(archiveFile), location, trimSegments, archiveFile, progressMonitor); |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
308
diff
changeset
|
369 |
} |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
308
diff
changeset
|
370 |
|
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
308
diff
changeset
|
371 |
public static void unzip(InputStream in, IContainer location, int trimSegments, String label, |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
308
diff
changeset
|
372 |
IProgressMonitor progressMonitor) throws IOException, CoreException { |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
308
diff
changeset
|
373 |
progressMonitor.beginTask(MessageFormat.format("Unpacking {0}", label), IProgressMonitor.UNKNOWN); |
c01f5ab28a11
Refactored to add extended support for JS Libraries
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
308
diff
changeset
|
374 |
ZipInputStream stream = new ZipInputStream(in); |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
375 |
try { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
376 |
ZipEntry nextEntry; |
351
e317b108976d
Bug 2888 - IDE does not properly explain the reason for failure if the WGZ file is broken
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
349
diff
changeset
|
377 |
int count = 0; |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
378 |
while ((nextEntry = stream.getNextEntry()) != null) { |
351
e317b108976d
Bug 2888 - IDE does not properly explain the reason for failure if the WGZ file is broken
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
349
diff
changeset
|
379 |
count++; |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
380 |
IPath p = new Path(nextEntry.getName()).removeFirstSegments(trimSegments); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
381 |
if (!isIgnored(p) && !nextEntry.isDirectory()) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
382 |
IFile file = location.getFile(p); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
383 |
checkParent(file.getParent()); |
271
4ff7e6f31c66
WGZ import issue was fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
236
diff
changeset
|
384 |
if (file.exists()) { |
4ff7e6f31c66
WGZ import issue was fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
236
diff
changeset
|
385 |
file.setContents(new NonClosingStream(stream), false, true, new SubProgressMonitor( |
4ff7e6f31c66
WGZ import issue was fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
236
diff
changeset
|
386 |
progressMonitor, 1)); |
4ff7e6f31c66
WGZ import issue was fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
236
diff
changeset
|
387 |
} else { |
4ff7e6f31c66
WGZ import issue was fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
236
diff
changeset
|
388 |
file.create(new NonClosingStream(stream), true, new SubProgressMonitor(progressMonitor, 1)); |
4ff7e6f31c66
WGZ import issue was fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
236
diff
changeset
|
389 |
} |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
390 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
391 |
} |
351
e317b108976d
Bug 2888 - IDE does not properly explain the reason for failure if the WGZ file is broken
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
349
diff
changeset
|
392 |
if (count == 0) { |
e317b108976d
Bug 2888 - IDE does not properly explain the reason for failure if the WGZ file is broken
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
349
diff
changeset
|
393 |
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, |
e317b108976d
Bug 2888 - IDE does not properly explain the reason for failure if the WGZ file is broken
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
349
diff
changeset
|
394 |
"Selected archive file does not contain application files")); |
e317b108976d
Bug 2888 - IDE does not properly explain the reason for failure if the WGZ file is broken
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
349
diff
changeset
|
395 |
} |
236
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
396 |
} finally { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
397 |
stream.close(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
398 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
399 |
progressMonitor.done(); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
400 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
401 |
|
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
402 |
private static boolean isIgnored(IPath p) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
403 |
if (p.segmentCount() == 1) { |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
404 |
return IProjectDescription.DESCRIPTION_FILE_NAME.equals(p.lastSegment()); |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
405 |
} |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
406 |
return false; |
167f22364544
Bug 2087 - Import ->WGZ sources lets you import WGZ archive from another WRT launch configuration, but ends up creating an empty folder
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
216
diff
changeset
|
407 |
} |
200
830136ec8316
Wizard can now import projects of any time (i.e. Dreamweaver, WRT IDE) from the filesystem
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
156
diff
changeset
|
408 |
|
282
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
409 |
public static boolean isExcluded(IResource resource) { |
308
c521df56b15d
Bug 2514 - Allow the user to package applications even if there are errors
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
300
diff
changeset
|
410 |
if (!resource.exists()) { |
c521df56b15d
Bug 2514 - Allow the user to package applications even if there are errors
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
300
diff
changeset
|
411 |
return false; |
c521df56b15d
Bug 2514 - Allow the user to package applications even if there are errors
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
300
diff
changeset
|
412 |
} |
282
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
413 |
try { |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
414 |
IMarker[] markers = resource |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
415 |
.findMarkers(EXCLUDE_MARKER_ID, false, IResource.DEPTH_ZERO); |
349
59ccacde8910
Bug 2277 - Project metadata is packaged into WGZ file
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
416 |
IPath path = resource.getProjectRelativePath(); |
59ccacde8910
Bug 2277 - Project metadata is packaged into WGZ file
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
309
diff
changeset
|
417 |
return markers.length != 0 || (path.segmentCount() > 1 && ".settings".equals(path.segment(0))); |
282
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
418 |
} catch (CoreException e) { |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
419 |
Activator.log(e); |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
420 |
return false; |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
421 |
} |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
422 |
|
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
423 |
} |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
424 |
|
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
425 |
public static void exclude(IResource resource) { |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
426 |
try { |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
427 |
resource.createMarker(EXCLUDE_MARKER_ID); |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
428 |
resource.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, Boolean.TRUE.toString()); |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
429 |
} catch (CoreException e) { |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
430 |
Activator.log(e); |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
431 |
} |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
432 |
} |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
433 |
|
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
434 |
public static void include(IResource resource) { |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
435 |
try { |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
436 |
IMarker[] markers = resource |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
437 |
.findMarkers(EXCLUDE_MARKER_ID, false, IResource.DEPTH_ZERO); |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
438 |
resource.setPersistentProperty(WRTPackagerConstants.EXCLUDE_PROPERTY, null); |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
439 |
for (IMarker marker : markers) { |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
440 |
marker.delete(); |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
441 |
} |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
442 |
} catch (CoreException e) { |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
443 |
Activator.log(e); |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
444 |
} |
39bbb3a15d6f
Bug 2341 - Files excluded from widget archive are not clearly marked
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
281
diff
changeset
|
445 |
} |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
446 |
} |