Author: snjeza
Date: 2011-08-11 09:17:18 -0400 (Thu, 11 Aug 2011)
New Revision: 33815
Modified:
branches/jbosstools-3.2.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
Log:
JBIDE-9514 Project Example project zips that require empty folders (i.e. src folders) need
to be imported properly
Modified:
branches/jbosstools-3.2.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
===================================================================
---
branches/jbosstools-3.2.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2011-08-11
13:16:53 UTC (rev 33814)
+++
branches/jbosstools-3.2.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2011-08-11
13:17:18 UTC (rev 33815)
@@ -584,14 +584,16 @@
Enumeration<? extends ZipEntry> entries = sourceFile.entries();
ZipEntry entry = null;
List<ZipEntry> filesToImport = new ArrayList<ZipEntry>();
+ List<ZipEntry> directories = new ArrayList<ZipEntry>();
String prefix = projectName + "/"; //$NON-NLS-1$
while (entries.hasMoreElements()) {
entry = entries.nextElement();
- if (entry.isDirectory()) {
- continue;
- }
if (entry.getName().startsWith(prefix)) {
- filesToImport.add(entry);
+ if (!entry.isDirectory()) {
+ filesToImport.add(entry);
+ } else {
+ directories.add(entry);
+ }
}
}
@@ -600,6 +602,14 @@
structureProvider, OVERWRITE_ALL_QUERY, filesToImport);
operation.setContext(getActiveShell());
operation.run(monitor);
+ for (ZipEntry directory:directories) {
+ IPath resourcePath = new Path(directory.getName());
+ try {
+ workspace.getRoot().getFolder(resourcePath).create(false, true, null);
+ } catch (Exception e) {
+ ProjectExamplesActivator.log(e);
+ }
+ }
reconfigure(project, monitor);
}
}
@@ -646,14 +656,16 @@
Enumeration<? extends ZipEntry> entries = sourceFile.entries();
ZipEntry entry = null;
List<ZipEntry> filesToImport = new ArrayList<ZipEntry>();
+ List<ZipEntry> directories = new ArrayList<ZipEntry>();
String prefix = projectName + "/"; //$NON-NLS-1$
while (entries.hasMoreElements()) {
entry = entries.nextElement();
- if (entry.isDirectory()) {
- continue;
- }
if (entry.getName().startsWith(prefix)) {
- filesToImport.add(entry);
+ if (!entry.isDirectory()) {
+ filesToImport.add(entry);
+ } else {
+ directories.add(entry);
+ }
}
}
@@ -662,6 +674,14 @@
structureProvider, OVERWRITE_ALL_QUERY, filesToImport);
operation.setContext(getActiveShell());
operation.run(monitor);
+ for (ZipEntry directory:directories) {
+ IPath resourcePath = new Path(directory.getName());
+ try {
+ workspace.getRoot().getFolder(resourcePath).create(false, true, null);
+ } catch (Exception e) {
+ ProjectExamplesActivator.log(e);
+ }
+ }
reconfigure(project, monitor);
}
Show replies by date