|
10 | 10 | import org.eclipse.core.runtime.CoreException;
|
11 | 11 | import org.eclipse.core.runtime.IPath;
|
12 | 12 | import org.eclipse.core.runtime.IProgressMonitor;
|
| 13 | +import org.eclipse.core.runtime.IStatus; |
13 | 14 | import org.eclipse.core.runtime.Path;
|
| 15 | +import org.eclipse.core.runtime.Status; |
14 | 16 |
|
| 17 | +import io.sloeber.common.Common; |
15 | 18 | import io.sloeber.common.Const;
|
16 | 19 | import io.sloeber.common.InstancePreferences;
|
17 | 20 | import io.sloeber.core.tools.Helpers;
|
@@ -122,12 +125,17 @@ public void createFiles(IProject project, IProgressMonitor monitor) throws CoreE
|
122 | 125 | case CustomTemplate:
|
123 | 126 | IPath folderName = this.myTemPlateFoldername;
|
124 | 127 | String files[] = folderName.toFile().list();
|
125 |
| - for (String file : files) { |
126 |
| - if (!(file.equals(".") || file.equals(".."))) { |
127 |
| - File sourceFile = folderName.append(file).toFile(); |
128 |
| - Helpers.addFileToProject(project, new Path(file), |
129 |
| - Stream.openContentStream(project.getName(), Include, sourceFile.toString(), true), monitor, |
130 |
| - false); |
| 128 | + if (files == null) { |
| 129 | + Common.log(new Status(IStatus.WARNING, Const.CORE_PLUGIN_ID, |
| 130 | + "No files found in template folder :" + folderName, null)); |
| 131 | + } else { |
| 132 | + for (String file : files) { |
| 133 | + if (!(file.equals(".") || file.equals(".."))) { |
| 134 | + File sourceFile = folderName.append(file).toFile(); |
| 135 | + Helpers.addFileToProject(project, new Path(file), |
| 136 | + Stream.openContentStream(project.getName(), Include, sourceFile.toString(), true), |
| 137 | + monitor, false); |
| 138 | + } |
131 | 139 | }
|
132 | 140 | }
|
133 | 141 |
|
|
0 commit comments