mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug #160012: New Project Wizard rework
This commit is contained in:
parent
1751bb7d63
commit
12e19c8773
16 changed files with 160 additions and 168 deletions
|
@ -64,12 +64,6 @@ WizardConvertMakeProject.name=Convert to a C/C++ Make Project
|
||||||
WizardConvertMakeProject.name1=Convert to a C/C++ Make Project1
|
WizardConvertMakeProject.name1=Convert to a C/C++ Make Project1
|
||||||
WizardConvertMakeProject.description=Convert to a C/C++ Project which uses a simple makefile
|
WizardConvertMakeProject.description=Convert to a C/C++ Project which uses a simple makefile
|
||||||
|
|
||||||
CDTproject=CDT project
|
|
||||||
CDTproject.desc=Create a new language-neutral project
|
|
||||||
CPPproject=C++ project
|
|
||||||
CPPproject.desc=Create a new C++ project
|
|
||||||
Cproject=C project
|
|
||||||
Cproject.desc=Create a new C project
|
|
||||||
Tool.settings=Tool settings
|
Tool.settings=Tool settings
|
||||||
Build.steps=Build steps
|
Build.steps=Build steps
|
||||||
Build.artifact=Build artifact
|
Build.artifact=Build artifact
|
||||||
|
|
|
@ -8,48 +8,6 @@
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.newWizards">
|
point="org.eclipse.ui.newWizards">
|
||||||
<!-- Managed Make Builder Projects -->
|
<!-- Managed Make Builder Projects -->
|
||||||
<wizard
|
|
||||||
canFinishEarly="false"
|
|
||||||
category="org.eclipse.cdt.ui.newCDTWizards"
|
|
||||||
class="org.eclipse.cdt.managedbuilder.ui.wizards.CDTProjectWizard"
|
|
||||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
|
||||||
hasPages="true"
|
|
||||||
icon="icons/elcl16/newmngcc_app.gif"
|
|
||||||
id="org.eclipse.cdt.managedbuilder.ui.wizards.NewCWizard3"
|
|
||||||
name="%CDTproject"
|
|
||||||
project="true">
|
|
||||||
<description>
|
|
||||||
%CDTproject.desc
|
|
||||||
</description>
|
|
||||||
</wizard>
|
|
||||||
<wizard
|
|
||||||
canFinishEarly="false"
|
|
||||||
category="org.eclipse.cdt.ui.newCCWizards"
|
|
||||||
class="org.eclipse.cdt.managedbuilder.ui.wizards.CCProjectWizard"
|
|
||||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
|
||||||
hasPages="true"
|
|
||||||
icon="icons/elcl16/newmngcc_app.gif"
|
|
||||||
id="org.eclipse.cdt.managedbuilder.ui.wizards.NewCWizard1"
|
|
||||||
name="%CPPproject"
|
|
||||||
project="true">
|
|
||||||
<description>
|
|
||||||
%CPPproject.desc
|
|
||||||
</description>
|
|
||||||
</wizard>
|
|
||||||
<wizard
|
|
||||||
canFinishEarly="false"
|
|
||||||
category="org.eclipse.cdt.ui.newCWizards"
|
|
||||||
class="org.eclipse.cdt.managedbuilder.ui.wizards.CProjectWizard"
|
|
||||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
|
||||||
hasPages="true"
|
|
||||||
icon="icons/elcl16/newmngcc_app.gif"
|
|
||||||
id="org.eclipse.cdt.managedbuilder.ui.wizards.NewCWizard2"
|
|
||||||
name="%Cproject"
|
|
||||||
project="true">
|
|
||||||
<description>
|
|
||||||
%Cproject.desc
|
|
||||||
</description>
|
|
||||||
</wizard>
|
|
||||||
<wizard
|
<wizard
|
||||||
category="org.eclipse.cdt.ui.newCWizards"
|
category="org.eclipse.cdt.ui.newCWizards"
|
||||||
class="org.eclipse.cdt.managedbuilder.ui.wizards.ConvertToMakeWizard"
|
class="org.eclipse.cdt.managedbuilder.ui.wizards.ConvertToMakeWizard"
|
||||||
|
|
|
@ -76,9 +76,6 @@ PreferredToolchainsTab.2=Make toolhain(s) unpreferred
|
||||||
StdProjectTypeHandler.0=-- Other Toolchain --
|
StdProjectTypeHandler.0=-- Other Toolchain --
|
||||||
StdProjectTypeHandler.2=Default
|
StdProjectTypeHandler.2=Default
|
||||||
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
||||||
WizardNewProjectCreationPage_nameLabel=
|
|
||||||
WizardNewProjectCreationPage_projectNameEmpty=
|
|
||||||
WizardNewProjectCreationPage_projectExistsMessage=
|
|
||||||
CNewWizard.0=Others
|
CNewWizard.0=Others
|
||||||
CWizardHandler.0=Toolchain:
|
CWizardHandler.0=Toolchain:
|
||||||
CWizardHandler.1=Tool chain is a set of tools\n
|
CWizardHandler.1=Tool chain is a set of tools\n
|
||||||
|
@ -87,11 +84,6 @@ CWizardHandler.3=intended to build your project.\n
|
||||||
CWizardHandler.4=Additional tools, like debugger,\n
|
CWizardHandler.4=Additional tools, like debugger,\n
|
||||||
CWizardHandler.5=can be assotiated with tool chain.
|
CWizardHandler.5=can be assotiated with tool chain.
|
||||||
CWizardHandler.6=Cannot create managed project with NULL configuration
|
CWizardHandler.6=Cannot create managed project with NULL configuration
|
||||||
NewModelProjectWizard.0=CDT project
|
|
||||||
NewModelProjectWizard.1=Create CDT project of selected type
|
|
||||||
NewModelProjectWizard.2=C++ project
|
|
||||||
NewModelProjectWizard.3=Create C++ project of selected type
|
|
||||||
NewModelProjectWizard.4=C project
|
|
||||||
NewModelProjectWizard.5=Create C project of selected type
|
|
||||||
StdBuildWizard.0=Makefile project
|
StdBuildWizard.0=Makefile project
|
||||||
MBSWizardHandler.0=At least one toolchain should be selected
|
MBSWizardHandler.0=At least one toolchain should be selected
|
||||||
|
MBSWizardHandler.1=At least one configuration should be selected. Please check needed configurations.
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
import org.eclipse.cdt.ui.newui.UIMessages;
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
||||||
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
||||||
|
import org.eclipse.cdt.ui.wizards.CDTCommonProjectWizard;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||||
|
@ -83,10 +84,10 @@ public class CDTConfigWizardPage extends WizardPage {
|
||||||
if (pagesLoaded) return;
|
if (pagesLoaded) return;
|
||||||
pagesLoaded = true;
|
pagesLoaded = true;
|
||||||
|
|
||||||
if (! (getWizard() instanceof MBSProjectWizard)) return;
|
if (! (getWizard() instanceof CDTCommonProjectWizard)) return;
|
||||||
MBSProjectWizard wz = (MBSProjectWizard)getWizard();
|
CDTCommonProjectWizard wz = (CDTCommonProjectWizard)getWizard();
|
||||||
|
|
||||||
IWizardPage p = MBSCustomPageManager.getPreviousPage(PAGE_ID);
|
IWizardPage p = getWizard().getStartingPage();
|
||||||
MBSCustomPageManager.init();
|
MBSCustomPageManager.init();
|
||||||
MBSCustomPageManager.addStockPage(p, CDTMainWizardPage.PAGE_ID);
|
MBSCustomPageManager.addStockPage(p, CDTMainWizardPage.PAGE_ID);
|
||||||
MBSCustomPageManager.addStockPage(this, CDTConfigWizardPage.PAGE_ID);
|
MBSCustomPageManager.addStockPage(this, CDTConfigWizardPage.PAGE_ID);
|
||||||
|
@ -315,8 +316,8 @@ public class CDTConfigWizardPage extends WizardPage {
|
||||||
* Edit properties
|
* Edit properties
|
||||||
*/
|
*/
|
||||||
private void advancedDialog() {
|
private void advancedDialog() {
|
||||||
if (getWizard() instanceof MBSProjectWizard) {
|
if (getWizard() instanceof CDTCommonProjectWizard) {
|
||||||
MBSProjectWizard nmWizard = (MBSProjectWizard)getWizard();
|
CDTCommonProjectWizard nmWizard = (CDTCommonProjectWizard)getWizard();
|
||||||
IProject newProject = nmWizard.getProject(true);
|
IProject newProject = nmWizard.getProject(true);
|
||||||
if (newProject != null) {
|
if (newProject != null) {
|
||||||
boolean oldManage = CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG);
|
boolean oldManage = CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG);
|
||||||
|
@ -336,7 +337,7 @@ public class CDTConfigWizardPage extends WizardPage {
|
||||||
return MBSCustomPageManager.getNextPage(PAGE_ID);
|
return MBSCustomPageManager.getNextPage(PAGE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCustomPagesFilter(MBSProjectWizard wz) {
|
private void setCustomPagesFilter(CDTCommonProjectWizard wz) {
|
||||||
String[] natures = wz.getNatures();
|
String[] natures = wz.getNatures();
|
||||||
if (natures == null || natures.length == 0)
|
if (natures == null || natures.length == 0)
|
||||||
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, null);
|
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, null);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
@ -32,13 +33,13 @@ import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
import org.eclipse.cdt.ui.newui.UIMessages;
|
|
||||||
import org.eclipse.cdt.ui.wizards.CWizardHandler;
|
import org.eclipse.cdt.ui.wizards.CWizardHandler;
|
||||||
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
|
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.wizard.IWizard;
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -197,6 +198,9 @@ public class MBSWizardHandler extends CWizardHandler implements ICBuildWizardHan
|
||||||
}
|
}
|
||||||
if (active != null) active.setActive();
|
if (active != null) active.setActive();
|
||||||
coreModel.setProjectDescription(project, des);
|
coreModel.setProjectDescription(project, des);
|
||||||
|
|
||||||
|
// process custom pages
|
||||||
|
doCustom();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IWizardPage getSpecificPage() {
|
public IWizardPage getSpecificPage() {
|
||||||
|
@ -225,6 +229,8 @@ public class MBSWizardHandler extends CWizardHandler implements ICBuildWizardHan
|
||||||
public boolean supportsPreferred() { return true; }
|
public boolean supportsPreferred() { return true; }
|
||||||
|
|
||||||
public boolean isChanged() {
|
public boolean isChanged() {
|
||||||
|
if (savedToolChains == null)
|
||||||
|
return true;
|
||||||
IToolChain[] tcs = getSelectedToolChains();
|
IToolChain[] tcs = getSelectedToolChains();
|
||||||
if (savedToolChains.length != tcs.length)
|
if (savedToolChains.length != tcs.length)
|
||||||
return true;
|
return true;
|
||||||
|
@ -276,8 +282,51 @@ public class MBSWizardHandler extends CWizardHandler implements ICBuildWizardHan
|
||||||
if (tis == null || tis.length == 0)
|
if (tis == null || tis.length == 0)
|
||||||
return Messages.getString("MBSWizardHandler.0"); //$NON-NLS-1$
|
return Messages.getString("MBSWizardHandler.0"); //$NON-NLS-1$
|
||||||
if (fConfigPage != null && fConfigPage.isVisible && !fConfigPage.isCustomPageComplete())
|
if (fConfigPage != null && fConfigPage.isVisible && !fConfigPage.isCustomPageComplete())
|
||||||
return UIMessages.getString("CConfigWizardPage.11"); //$NON-NLS-1$
|
return Messages.getString("MBSWizardHandler.1"); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doCustom() {
|
||||||
|
IRunnableWithProgress[] operations = MBSCustomPageManager.getOperations();
|
||||||
|
if(operations != null)
|
||||||
|
for(int k = 0; k < operations.length; k++)
|
||||||
|
try {
|
||||||
|
wizard.getContainer().run(false, true, operations[k]);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
ManagedBuilderUIPlugin.log(e);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
ManagedBuilderUIPlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postProcess(IProject newProject) {
|
||||||
|
deleteExtraConfigs(newProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteExtraConfigs(IProject newProject) {
|
||||||
|
if (isChanged()) return; // no need to delete
|
||||||
|
if (listener.isCurrent()) return; // nothing to delete
|
||||||
|
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(newProject, true);
|
||||||
|
if (prjd == null) return;
|
||||||
|
ICConfigurationDescription[] all = prjd.getConfigurations();
|
||||||
|
if (all == null) return;
|
||||||
|
CfgHolder[] req = getCfgItems(false);
|
||||||
|
boolean modified = false;
|
||||||
|
for (int i=0; i<all.length; i++) {
|
||||||
|
boolean found = false;
|
||||||
|
for (int j=0; j<req.length; j++) {
|
||||||
|
if (all[i].getName().equals(req[j].getName())) {
|
||||||
|
found = true; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
modified = true;
|
||||||
|
prjd.removeConfiguration(all[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (modified) try {
|
||||||
|
CoreModel.getDefault().setProjectDescription(newProject, prjd);
|
||||||
|
} catch (CoreException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
BIN
core/org.eclipse.cdt.ui/icons/elcl16/newmngc_app.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/elcl16/newmngc_app.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 612 B |
BIN
core/org.eclipse.cdt.ui/icons/elcl16/newmngcc_app.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/elcl16/newmngcc_app.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 630 B |
|
@ -401,3 +401,11 @@ page.c.general=C/C++ General
|
||||||
Configurations.menu=Build configurations
|
Configurations.menu=Build configurations
|
||||||
Index.menu=Index
|
Index.menu=Index
|
||||||
CDTWizard=CDT New Project Wizard
|
CDTWizard=CDT New Project Wizard
|
||||||
|
|
||||||
|
CDTproject=CDT project
|
||||||
|
CDTproject.desc=Create a new language-neutral project
|
||||||
|
CPPproject=C++ project
|
||||||
|
CPPproject.desc=Create a new C++ project
|
||||||
|
Cproject=C project
|
||||||
|
Cproject.desc=Create a new C project
|
||||||
|
|
||||||
|
|
|
@ -483,6 +483,51 @@
|
||||||
%NewWizards.folder.description
|
%NewWizards.folder.description
|
||||||
</description>
|
</description>
|
||||||
</wizard>
|
</wizard>
|
||||||
|
|
||||||
|
<wizard
|
||||||
|
canFinishEarly="false"
|
||||||
|
category="org.eclipse.cdt.ui.newCDTWizards"
|
||||||
|
class="org.eclipse.cdt.ui.wizards.CDTProjectWizard"
|
||||||
|
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||||
|
hasPages="true"
|
||||||
|
icon="icons/elcl16/newmngcc_app.gif"
|
||||||
|
id="org.eclipse.cdt.ui.wizards.NewCWizard3"
|
||||||
|
name="%CDTproject"
|
||||||
|
project="true">
|
||||||
|
<description>
|
||||||
|
%CDTproject.desc
|
||||||
|
</description>
|
||||||
|
</wizard>
|
||||||
|
<wizard
|
||||||
|
canFinishEarly="false"
|
||||||
|
category="org.eclipse.cdt.ui.newCCWizards"
|
||||||
|
class="org.eclipse.cdt.ui.wizards.CCProjectWizard"
|
||||||
|
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||||
|
hasPages="true"
|
||||||
|
icon="icons/elcl16/newmngcc_app.gif"
|
||||||
|
id="org.eclipse.cdt.ui.wizards.NewCWizard1"
|
||||||
|
name="%CPPproject"
|
||||||
|
project="true">
|
||||||
|
<description>
|
||||||
|
%CPPproject.desc
|
||||||
|
</description>
|
||||||
|
</wizard>
|
||||||
|
<wizard
|
||||||
|
canFinishEarly="false"
|
||||||
|
category="org.eclipse.cdt.ui.newCWizards"
|
||||||
|
class="org.eclipse.cdt.ui.wizards.CProjectWizard"
|
||||||
|
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||||
|
hasPages="true"
|
||||||
|
icon="icons/elcl16/newmngcc_app.gif"
|
||||||
|
id="org.eclipse.cdt.ui.wizards.NewCWizard2"
|
||||||
|
name="%Cproject"
|
||||||
|
project="true">
|
||||||
|
<description>
|
||||||
|
%Cproject.desc
|
||||||
|
</description>
|
||||||
|
</wizard>
|
||||||
|
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
<!-- Define the document setup participant for the C/C++ and Assembly Editors -->
|
<!-- Define the document setup participant for the C/C++ and Assembly Editors -->
|
||||||
<extension
|
<extension
|
||||||
|
@ -1244,11 +1289,6 @@
|
||||||
contextId="org.eclipse.cdt.ui.cEditorScope"
|
contextId="org.eclipse.cdt.ui.cEditorScope"
|
||||||
commandId="org.eclipse.cdt.ui.edit.text.c.goto.matching.bracket"
|
commandId="org.eclipse.cdt.ui.edit.text.c.goto.matching.bracket"
|
||||||
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
|
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
|
||||||
<key
|
|
||||||
sequence="M1+E"
|
|
||||||
contextId="org.eclipse.cdt.ui.cEditorScope"
|
|
||||||
commandId="org.eclipse.cdt.ui.edit.text.c.toggle.source.header"
|
|
||||||
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
|
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.commands">
|
point="org.eclipse.ui.commands">
|
||||||
|
@ -1374,12 +1414,6 @@
|
||||||
categoryId="org.eclipse.cdt.ui.category.source"
|
categoryId="org.eclipse.cdt.ui.category.source"
|
||||||
id="org.eclipse.cdt.ui.edit.text.c.goto.matching.bracket">
|
id="org.eclipse.cdt.ui.edit.text.c.goto.matching.bracket">
|
||||||
</command>
|
</command>
|
||||||
<command
|
|
||||||
name="%ActionDefinition.toggleSourceHeader.name"
|
|
||||||
description="%ActionDefinition.toggleSourceHeader.description"
|
|
||||||
categoryId="org.eclipse.cdt.ui.category.source"
|
|
||||||
id="org.eclipse.cdt.ui.edit.text.c.toggle.source.header">
|
|
||||||
</command>
|
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="pdomSearchPage"
|
id="pdomSearchPage"
|
||||||
|
|
|
@ -536,3 +536,9 @@ StdProjectTypeHandler.2=Default
|
||||||
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
||||||
|
|
||||||
CDTConfigWizardPage.0=Select configurations
|
CDTConfigWizardPage.0=Select configurations
|
||||||
|
NewModelProjectWizard.0=CDT project
|
||||||
|
NewModelProjectWizard.1=Create CDT project of selected type
|
||||||
|
NewModelProjectWizard.2=C++ project
|
||||||
|
NewModelProjectWizard.3=Create C++ project of selected type
|
||||||
|
NewModelProjectWizard.4=C project
|
||||||
|
NewModelProjectWizard.5=Create C project of selected type
|
|
@ -8,22 +8,23 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCProjectNature;
|
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class CCProjectWizard extends MBSProjectWizard {
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
|
|
||||||
|
public class CCProjectWizard extends CDTCommonProjectWizard {
|
||||||
|
|
||||||
public CCProjectWizard() {
|
public CCProjectWizard() {
|
||||||
super(Messages.getString("NewModelProjectWizard.2"), Messages.getString("NewModelProjectWizard.3")); //$NON-NLS-1$ //$NON-NLS-2$
|
super(UIMessages.getString("NewModelProjectWizard.2"), UIMessages.getString("NewModelProjectWizard.3")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] getNatures() {
|
public String[] getNatures() {
|
||||||
return new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID };
|
return new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID };
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,23 +9,13 @@
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Intel corp - rework for New Project Model
|
* Intel corp - rework for New Project Model
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
|
||||||
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
|
||||||
import org.eclipse.cdt.ui.wizards.ICWizardHandler;
|
|
||||||
import org.eclipse.cdt.ui.wizards.IWizardWithMemory;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IProjectDescription;
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -45,7 +35,11 @@ import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
||||||
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
|
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
|
||||||
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
||||||
|
|
||||||
public abstract class MBSProjectWizard extends BasicNewResourceWizard
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
|
|
||||||
|
public abstract class CDTCommonProjectWizard extends BasicNewResourceWizard
|
||||||
implements IExecutableExtension, IWizardWithMemory
|
implements IExecutableExtension, IWizardWithMemory
|
||||||
{
|
{
|
||||||
private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$
|
private static final String PREFIX= "CProjectWizard"; //$NON-NLS-1$
|
||||||
|
@ -62,15 +56,14 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
|
|
||||||
public String lastProjectName = null;
|
public String lastProjectName = null;
|
||||||
private ICWizardHandler savedHandler = null;
|
private ICWizardHandler savedHandler = null;
|
||||||
private boolean savedDefaults = false;
|
|
||||||
|
|
||||||
protected List localPages = new ArrayList(); // replacing Wizard.pages since we have to delete them
|
protected List localPages = new ArrayList(); // replacing Wizard.pages since we have to delete them
|
||||||
|
|
||||||
public MBSProjectWizard() {
|
public CDTCommonProjectWizard() {
|
||||||
this(Messages.getString("NewModelProjectWizard.0"),Messages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
this(UIMessages.getString("NewModelProjectWizard.0"),UIMessages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
public MBSProjectWizard(String title, String desc) {
|
public CDTCommonProjectWizard(String title, String desc) {
|
||||||
super();
|
super();
|
||||||
setDialogSettings(CUIPlugin.getDefault().getDialogSettings());
|
setDialogSettings(CUIPlugin.getDefault().getDialogSettings());
|
||||||
setNeedsProgressMonitor(true);
|
setNeedsProgressMonitor(true);
|
||||||
|
@ -83,11 +76,8 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
fMainPage.setTitle(wz_title);
|
fMainPage.setTitle(wz_title);
|
||||||
fMainPage.setDescription(wz_desc);
|
fMainPage.setDescription(wz_desc);
|
||||||
addPage(fMainPage);
|
addPage(fMainPage);
|
||||||
MBSCustomPageManager.init();
|
|
||||||
MBSCustomPageManager.addStockPage(fMainPage, CDTMainWizardPage.PAGE_ID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if user has changed settings since project creation
|
* @return true if user has changed settings since project creation
|
||||||
*/
|
*/
|
||||||
|
@ -101,7 +91,6 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
if (newProject != null && isChanged())
|
if (newProject != null && isChanged())
|
||||||
clearProject();
|
clearProject();
|
||||||
if (newProject == null) {
|
if (newProject == null) {
|
||||||
savedDefaults = defaults;
|
|
||||||
savedHandler = fMainPage.h_selected;
|
savedHandler = fMainPage.h_selected;
|
||||||
savedHandler.saveState();
|
savedHandler.saveState();
|
||||||
lastProjectName = fMainPage.getProjectName();
|
lastProjectName = fMainPage.getProjectName();
|
||||||
|
@ -139,18 +128,9 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean performFinish() {
|
public boolean performFinish() {
|
||||||
// needs delete only if project was
|
|
||||||
// created before and still valid
|
|
||||||
boolean needsDelete = (newProject != null && savedDefaults && !isChanged());
|
|
||||||
// create project if it is not created yet
|
// create project if it is not created yet
|
||||||
if (getProject(fMainPage.isCurrent()) == null) return false;
|
if (getProject(fMainPage.isCurrent()) == null) return false;
|
||||||
// process custom pages
|
fMainPage.h_selected.postProcess(newProject);
|
||||||
doCustom();
|
|
||||||
// project is created with all possible configs
|
|
||||||
// to let user modify all of them. Resulting
|
|
||||||
// project should contain only selected cfgs.
|
|
||||||
if (needsDelete) deleteExtraConfigs();
|
|
||||||
|
|
||||||
BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
|
BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
|
||||||
selectAndReveal(newProject);
|
selectAndReveal(newProject);
|
||||||
return true;
|
return true;
|
||||||
|
@ -161,46 +141,6 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteExtraConfigs() {
|
|
||||||
if (fMainPage.isCurrent()) return; // nothing to delete
|
|
||||||
if (!(fMainPage.h_selected instanceof MBSWizardHandler))
|
|
||||||
return;
|
|
||||||
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(newProject, true);
|
|
||||||
if (prjd == null) return;
|
|
||||||
ICConfigurationDescription[] all = prjd.getConfigurations();
|
|
||||||
if (all == null) return;
|
|
||||||
CfgHolder[] req = ((MBSWizardHandler)fMainPage.h_selected).getCfgItems(false);
|
|
||||||
boolean modified = false;
|
|
||||||
for (int i=0; i<all.length; i++) {
|
|
||||||
boolean found = false;
|
|
||||||
for (int j=0; j<req.length; j++) {
|
|
||||||
if (all[i].getName().equals(req[j].getName())) {
|
|
||||||
found = true; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
modified = true;
|
|
||||||
prjd.removeConfiguration(all[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (modified) try {
|
|
||||||
CoreModel.getDefault().setProjectDescription(newProject, prjd);
|
|
||||||
} catch (CoreException e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doCustom() {
|
|
||||||
IRunnableWithProgress[] operations = MBSCustomPageManager.getOperations();
|
|
||||||
if(operations != null)
|
|
||||||
for(int k = 0; k < operations.length; k++)
|
|
||||||
try {
|
|
||||||
getContainer().run(false, true, operations[k]);
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
ManagedBuilderUIPlugin.log(e);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
ManagedBuilderUIPlugin.log(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
|
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
|
||||||
fConfigElement= config;
|
fConfigElement= config;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +155,7 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
newProject = createIProject(lastProjectName, fMainPage.getProjectLocation());
|
newProject = createIProject(lastProjectName, fMainPage.getProjectLocation());
|
||||||
if (newProject != null)
|
if (newProject != null)
|
||||||
fMainPage.h_selected.createProject(newProject, defaults);
|
fMainPage.h_selected.createProject(newProject, defaults);
|
||||||
} catch (CoreException e) { ManagedBuilderUIPlugin.log(e); }
|
} catch (CoreException e) { CUIPlugin.getDefault().log(e); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -259,7 +199,7 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract IProject continueCreation(IProject prj);
|
protected abstract IProject continueCreation(IProject prj);
|
||||||
protected abstract String[] getNatures();
|
public abstract String[] getNatures();
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
fMainPage.dispose();
|
fMainPage.dispose();
|
|
@ -8,18 +8,19 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
public class CDTProjectWizard extends MBSProjectWizard {
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
|
|
||||||
|
public class CDTProjectWizard extends CDTCommonProjectWizard {
|
||||||
|
|
||||||
public CDTProjectWizard() {
|
public CDTProjectWizard() {
|
||||||
super(Messages.getString("NewModelProjectWizard.0"), Messages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
super(UIMessages.getString("NewModelProjectWizard.0"), UIMessages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] getNatures() {
|
public String[] getNatures() {
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,22 +8,23 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
public class CProjectWizard extends MBSProjectWizard {
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
|
|
||||||
|
public class CProjectWizard extends CDTCommonProjectWizard {
|
||||||
|
|
||||||
public CProjectWizard() {
|
public CProjectWizard() {
|
||||||
super(Messages.getString("NewModelProjectWizard.4"), //$NON-NLS-1$
|
super(UIMessages.getString("NewModelProjectWizard.4"), //$NON-NLS-1$
|
||||||
Messages.getString("NewModelProjectWizard.5")); //$NON-NLS-1$
|
UIMessages.getString("NewModelProjectWizard.5")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] getNatures() {
|
public String[] getNatures() {
|
||||||
return new String[] { CProjectNature.C_NATURE_ID };
|
return new String[] { CProjectNature.C_NATURE_ID };
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class CWizardHandler implements ICWizardHandler {
|
||||||
if (table == null) {
|
if (table == null) {
|
||||||
table = new Table(parent, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
|
table = new Table(parent, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
|
||||||
TableItem ti = new TableItem(table, SWT.NONE);
|
TableItem ti = new TableItem(table, SWT.NONE);
|
||||||
ti.setText("Single item"); //$NON-NLS-1$
|
ti.setText("---"); //$NON-NLS-1$
|
||||||
ti.setImage(IMG0);
|
ti.setImage(IMG0);
|
||||||
table.select(0);
|
table.select(0);
|
||||||
}
|
}
|
||||||
|
@ -97,5 +97,6 @@ public class CWizardHandler implements ICWizardHandler {
|
||||||
throws CoreException {}
|
throws CoreException {}
|
||||||
public boolean isChanged() { return true; }
|
public boolean isChanged() { return true; }
|
||||||
public void saveState() {}
|
public void saveState() {}
|
||||||
|
public void postProcess(IProject proj) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,12 @@ public interface ICWizardHandler {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public void createProject(IProject proj, boolean defaults) throws CoreException;
|
public void createProject(IProject proj, boolean defaults) throws CoreException;
|
||||||
|
/**
|
||||||
|
* Called when Finish button pressed,
|
||||||
|
* even if project was created before.
|
||||||
|
* @param proj
|
||||||
|
*/
|
||||||
|
public void postProcess(IProject proj);
|
||||||
/**
|
/**
|
||||||
* @return true if only supported project types and toolchains are displayed
|
* @return true if only supported project types and toolchains are displayed
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue