Skip to content

Commit c2b2e33

Browse files
committed
Fix E4ApplicationTemplate to respect sample content checkbox for icons
When creating a new Eclipse RCP project using the "Eclipse RCP application" template, the icons/ folder was always created in the project structure, even when the "Create sample content (part, menu, command...)" checkbox was unchecked. This violated user expectations and created unnecessary files. With this change the icons folder is now conditionally included based on the checkbox state.
1 parent df089ec commit c2b2e33

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ui/org.eclipse.pde.ui.templates/src/org/eclipse/pde/internal/ui/templates/e4/E4ApplicationTemplate.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private void createProductExtension() throws CoreException {
153153
protected boolean isOkToCreateFolder(File sourceFolder) {
154154
// We copy the files in 'org.eclipse.pde.ui.templates/templates_3.5/E4Application/*/handlers' or 'parts' if content required
155155
String fname = sourceFolder.getName();
156-
if (fname.endsWith("handlers") || fname.endsWith("parts")) { //$NON-NLS-1$//$NON-NLS-2$
156+
if (fname.endsWith("handlers") || fname.endsWith("parts") || fname.equals("icons")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
157157
return getBooleanOption(KEY_CREATE_SAMPLE_CONTENT);
158158
}
159159
return super.isOkToCreateFolder(sourceFolder);
@@ -228,6 +228,9 @@ public IPluginReference[] getDependencies(String schemaVersion) {
228228

229229
@Override
230230
public String[] getNewFiles() {
231-
return new String[] { "icons/", "css/default.css", "Application.e4xmi" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
231+
if (getBooleanOption(KEY_CREATE_SAMPLE_CONTENT)) {
232+
return new String[] { "icons/", "css/default.css", "Application.e4xmi" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
233+
}
234+
return new String[] { "css/default.css", "Application.e4xmi" }; //$NON-NLS-1$ //$NON-NLS-2$
232235
}
233236
}

0 commit comments

Comments
 (0)