mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
RESOLVED - bug 234860: New Project Wizard using "folders" for project type selection is totally unintuitive
https://bugs.eclipse.org/bugs/show_bug.cgi?id=234860
This commit is contained in:
parent
00a2461140
commit
91141bd408
8 changed files with 73 additions and 14 deletions
|
@ -3779,13 +3779,7 @@
|
|||
filterPattern=".*"
|
||||
location="$nl$/templates/projecttemplates/HelloWorldCAnsiProject/template.xml"
|
||||
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
|
||||
</template>
|
||||
<template
|
||||
id="org.eclipse.cdt.build.core.templates.EmptyProject"
|
||||
filterPattern=".*"
|
||||
location="$nl$/templates/projecttemplates/EmptyProject/template.xml"
|
||||
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
|
||||
</template>
|
||||
</template>
|
||||
<template
|
||||
id="org.eclipse.cdt.build.core.templates.MakefileHelloWorldCCProject"
|
||||
filterPattern=".*"
|
||||
|
|
|
@ -119,3 +119,5 @@ MBSWizardHandler.0=At least one toolchain should be selected
|
|||
MBSWizardHandler.1=At least one configuration should be selected. Please check needed configurations.
|
||||
CMainWizardPage.1=Show project types and toolchains only if they are supported on the platform
|
||||
CMainWizardPage.2=Edit properties after project creation
|
||||
AbstractCWizard.0=Empty Project
|
||||
|
||||
|
|
|
@ -151,7 +151,8 @@ public class MBSWizardHandler extends CWizardHandler {
|
|||
break;
|
||||
|
||||
projectTypeId = path[0];
|
||||
if(path.length > 1 && (!path[0].equals(ManagedBuildWizard.OTHERS_LABEL))){
|
||||
if(!entryDescriptor.isDefaultForCategory() &&
|
||||
path.length > 1 && (!path[0].equals(ManagedBuildWizard.OTHERS_LABEL))){
|
||||
templateId = path[path.length - 1];
|
||||
Template templates[] = TemplateEngineUI.getDefault().getTemplates(projectTypeId);
|
||||
if(templates.length == 0)
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.swt.graphics.Image;
|
|||
public class ManagedBuildWizard extends AbstractCWizard {
|
||||
private static final Image IMG = CPluginImages.get(CPluginImages.IMG_OBJS_CONTAINER);
|
||||
public static final String OTHERS_LABEL = Messages.getString("CNewWizard.0"); //$NON-NLS-1$
|
||||
public static final String EMPTY_PROJECT = Messages.getString("AbstractCWizard.0"); //$NON-NLS-1$
|
||||
/**
|
||||
* Creates and returns an array of items to be displayed
|
||||
*/
|
||||
|
@ -54,7 +55,13 @@ public class ManagedBuildWizard extends AbstractCWizard {
|
|||
h.addTc(tcs[j]);
|
||||
}
|
||||
if (h.getToolChainsCount() > 0) {
|
||||
// The project category item.
|
||||
items.add(new EntryDescriptor(vs[i].getId(), null, vs[i].getName(), true, h, null));
|
||||
// A default project type for that category -- not using any template.
|
||||
EntryDescriptor entryDescriptor = new EntryDescriptor(vs[i].getId() + ".default", vs[i].getId(),
|
||||
EMPTY_PROJECT, false, h, null);
|
||||
entryDescriptor.setDefaultForCategory(true);
|
||||
items.add(entryDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +109,7 @@ public class ManagedBuildWizard extends AbstractCWizard {
|
|||
} else { // do not group to <Others>
|
||||
pId = null;
|
||||
}
|
||||
items.add(new EntryDescriptor(pt.getId(), pId, pt.getName(), true, h, IMG));
|
||||
items.add(new EntryDescriptor(pt.getId(), pId, pt.getName(), false, h, IMG));
|
||||
}
|
||||
return (EntryDescriptor[])items.toArray(new EntryDescriptor[items.size()]);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.jface.wizard.IWizard;
|
|||
public class StdBuildWizard extends AbstractCWizard {
|
||||
private static final String NAME = Messages.getString("StdBuildWizard.0"); //$NON-NLS-1$
|
||||
private static final String ID = "org.eclipse.cdt.build.makefile.projectType"; //$NON-NLS-1$
|
||||
public static final String EMPTY_PROJECT = Messages.getString("AbstractCWizard.0"); //$NON-NLS-1$
|
||||
|
||||
public EntryDescriptor[] createItems(boolean supportedOnly, IWizard wizard) {
|
||||
STDWizardHandler h = new STDWizardHandler(parent, wizard);
|
||||
|
@ -27,8 +28,13 @@ public class StdBuildWizard extends AbstractCWizard {
|
|||
for (int i=0; i<tcs.length; i++)
|
||||
if (isValid(tcs[i], supportedOnly, wizard))
|
||||
h.addTc(tcs[i]);
|
||||
EntryDescriptor wd = new EntryDescriptor(ID, null, NAME, true, h, null);
|
||||
return new EntryDescriptor[] {wd};
|
||||
EntryDescriptor wd = new EntryDescriptor(ID, null, NAME, true, h, null);
|
||||
|
||||
EntryDescriptor wd2 = new EntryDescriptor(ID + ".default", ID,
|
||||
EMPTY_PROJECT, false, h, null);
|
||||
wd2.setDefaultForCategory(true);
|
||||
|
||||
return new EntryDescriptor[] {wd, wd2};
|
||||
|
||||
// test only: creating items like of Templates
|
||||
/*
|
||||
|
|
|
@ -524,6 +524,7 @@ NewCfgDialog.3=-- not selected --
|
|||
NewCfgDialog.4=Import from projects
|
||||
NewCfgDialog.5=Import predefined
|
||||
CDTMainWizardPage.0=Project name cannot contain '\#' symbol
|
||||
CDTMainWizardPage.1=Project category is selected. Expand the category and select a concrete project type
|
||||
WorkingSetConfigAction.0=Symbols '
|
||||
WorkingSetConfigAction.1=Choose active configs for Working Sets
|
||||
WorkingSetConfigAction.10=-- CURRENT --
|
||||
|
|
|
@ -70,6 +70,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
private Label right_label;
|
||||
|
||||
public CWizardHandler h_selected = null;
|
||||
private Label categorySelectedLabel;
|
||||
|
||||
/**
|
||||
* Creates a new project creation wizard page.
|
||||
|
@ -290,6 +291,18 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
}
|
||||
}
|
||||
}
|
||||
// If there is a EntryDescriptor which is default for category, make sure it
|
||||
// is in the front of the list.
|
||||
for (int i = 0; i < items.size(); ++i)
|
||||
{
|
||||
EntryDescriptor ed = items.get(i);
|
||||
if (ed.isDefaultForCategory())
|
||||
{
|
||||
items.remove(i);
|
||||
items.add(0, ed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// bug # 211935 : allow items filtering.
|
||||
if (ls != null) // NULL means call from prefs
|
||||
|
@ -297,7 +310,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
addItemsToTree(tree, items);
|
||||
|
||||
if (tree.getItemCount() > 0) {
|
||||
TreeItem target = tree.getItem(0);
|
||||
TreeItem target = null;
|
||||
// try to search item which was selected before
|
||||
if (savedStr != null) {
|
||||
TreeItem[] all = tree.getItems();
|
||||
|
@ -308,6 +321,12 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
}
|
||||
}
|
||||
}
|
||||
if (target == null)
|
||||
{
|
||||
target = tree.getItem(0);
|
||||
if (target.getItemCount() != 0)
|
||||
target = target.getItem(0);
|
||||
}
|
||||
tree.setSelection(target);
|
||||
return (CWizardHandler)target.getData();
|
||||
}
|
||||
|
@ -344,7 +363,12 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
found = true;
|
||||
wd1.setParentId(null);
|
||||
CWizardHandler h = wd2.getHandler();
|
||||
if (h == null && !wd1.isCategory())
|
||||
/* If neither wd1 itself, nor its parent (wd2) have a handler
|
||||
* associated with them, and the item is not a category,
|
||||
* then skip it. If it's category, then it's possible that
|
||||
* children will have a handler associated with them.
|
||||
*/
|
||||
if (h == null && wd1.getHandler() == null && !wd1.isCategory())
|
||||
break;
|
||||
|
||||
wd1.setPath(wd2.getPath() + "/" + wd1.getId()); //$NON-NLS-1$
|
||||
|
@ -377,18 +401,35 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
private void switchTo(CWizardHandler h, EntryDescriptor ed) {
|
||||
if (h == null)
|
||||
h = ed.getHandler();
|
||||
if (ed.isCategory())
|
||||
h = null;
|
||||
try {
|
||||
if (h != null && ed != null)
|
||||
h.initialize(ed);
|
||||
} catch (CoreException e) {
|
||||
h = null;
|
||||
h = null;
|
||||
}
|
||||
if (h_selected != null)
|
||||
h_selected.handleUnSelection();
|
||||
h_selected = h;
|
||||
if (h == null)
|
||||
{
|
||||
if (ed != null && ed.isCategory())
|
||||
{
|
||||
if (categorySelectedLabel == null)
|
||||
{
|
||||
categorySelectedLabel = new Label(right, SWT.WRAP);
|
||||
categorySelectedLabel.setText(
|
||||
UIMessages.getString("CDTMainWizardPage.1")); //$NON-NLS-1$
|
||||
right.layout();
|
||||
}
|
||||
categorySelectedLabel.setVisible(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
right_label.setText(h_selected.getHeader());
|
||||
if (categorySelectedLabel != null)
|
||||
categorySelectedLabel.setVisible(false);
|
||||
h_selected.handleSelection();
|
||||
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public final class EntryDescriptor {
|
|||
private CWizardHandler handler = null;
|
||||
private String path = null;
|
||||
private EntryDescriptor parent = null;
|
||||
private boolean isDefaultForCategory = false;
|
||||
|
||||
public EntryDescriptor (String _id, String _par, String _name, boolean _cat, CWizardHandler _h, Image _image) {
|
||||
id = _id;
|
||||
|
@ -82,4 +83,10 @@ public final class EntryDescriptor {
|
|||
public CWizardHandler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
public void setDefaultForCategory(boolean isDefaultForCategory) {
|
||||
this.isDefaultForCategory = isDefaultForCategory;
|
||||
}
|
||||
public boolean isDefaultForCategory() {
|
||||
return isDefaultForCategory;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue