mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
[268850] - fixed project conversion wizard (patch applied)
This commit is contained in:
parent
b0259c85b9
commit
1ea10c1975
6 changed files with 303 additions and 94 deletions
|
@ -47,6 +47,10 @@ MakeCCWizardSettings.description=Define the project and 'make' builder settings
|
||||||
WizardMakeProjectConversion.title=Convert to C/C++ Make project
|
WizardMakeProjectConversion.title=Convert to C/C++ Make project
|
||||||
WizardMakeProjectConversion.description=Convert a project to a C/C++ project which uses 'make' to build it.
|
WizardMakeProjectConversion.description=Convert a project to a C/C++ project which uses 'make' to build it.
|
||||||
WizardMakeProjectConversion.monitor.convertingToMakeProject=Converting to Make Project...
|
WizardMakeProjectConversion.monitor.convertingToMakeProject=Converting to Make Project...
|
||||||
|
WizardMakeProjectConversion.projectOptions.title=Project options
|
||||||
|
WizardMakeProjectConversion.projectOptions.projectType=Specify project type
|
||||||
|
WizardMakeProjectConversion.projectOptions.projectTypeTable=Project type:
|
||||||
|
WizardMakeProjectConversion.projectOptions.showSuppressed=Show project types and toolchains only if they are supported on the platform
|
||||||
|
|
||||||
MakeWizardUpdate.window_title=Make Project Migration
|
MakeWizardUpdate.window_title=Make Project Migration
|
||||||
MakeWizardUpdatePage.title=Make Project Migration
|
MakeWizardUpdatePage.title=Make Project Migration
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Intel Corporation and others.
|
* Copyright (c) 2007, 2009 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -25,7 +25,10 @@ public class ConvertToMakeWizard extends ConversionWizard {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBuildSystemId() {
|
public String getBuildSystemId() {
|
||||||
return ManagedBuildManager.CFG_DATA_PROVIDER_ID;
|
if (!((ConvertToMakeWizardPage)mainPage).isSetProjectType()) {
|
||||||
|
return ManagedBuildManager.CFG_DATA_PROVIDER_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
* Copyright (c) 2000, 2009 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,16 +12,36 @@
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.ui.newui.AbstractPage;
|
import org.eclipse.cdt.ui.newui.AbstractPage;
|
||||||
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
|
import org.eclipse.cdt.ui.newui.PageLayout;
|
||||||
|
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
||||||
|
import org.eclipse.cdt.ui.wizards.CWizardHandler;
|
||||||
|
import org.eclipse.cdt.ui.wizards.EntryDescriptor;
|
||||||
|
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
|
||||||
import org.eclipse.cdt.ui.wizards.conversion.ConvertProjectWizardPage;
|
import org.eclipse.cdt.ui.wizards.conversion.ConvertProjectWizardPage;
|
||||||
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.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Tree;
|
||||||
|
import org.eclipse.swt.widgets.TreeItem;
|
||||||
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
||||||
|
|
||||||
public class ConvertToMakeWizardPage extends ConvertProjectWizardPage {
|
public class ConvertToMakeWizardPage extends ConvertProjectWizardPage {
|
||||||
|
@ -29,6 +49,15 @@ public class ConvertToMakeWizardPage extends ConvertProjectWizardPage {
|
||||||
private static final String WZ_TITLE = "WizardMakeProjectConversion.title"; //$NON-NLS-1$
|
private static final String WZ_TITLE = "WizardMakeProjectConversion.title"; //$NON-NLS-1$
|
||||||
private static final String WZ_DESC = "WizardMakeProjectConversion.description"; //$NON-NLS-1$
|
private static final String WZ_DESC = "WizardMakeProjectConversion.description"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
protected CWizardHandler h_selected = null;
|
||||||
|
// widgets
|
||||||
|
private Button specifyProjectTypeButton;
|
||||||
|
private Tree tree;
|
||||||
|
private Composite right;
|
||||||
|
private Button show_sup;
|
||||||
|
private Label right_label;
|
||||||
|
private Label left_label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for ConvertToStdMakeProjectWizardPage.
|
* Constructor for ConvertToStdMakeProjectWizardPage.
|
||||||
* @param pageName
|
* @param pageName
|
||||||
|
@ -36,8 +65,153 @@ public class ConvertToMakeWizardPage extends ConvertProjectWizardPage {
|
||||||
public ConvertToMakeWizardPage(String pageName) {
|
public ConvertToMakeWizardPage(String pageName) {
|
||||||
super(pageName);
|
super(pageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void createControl(Composite parent) {
|
||||||
|
super.createControl(parent);
|
||||||
|
IStructuredSelection sel = ((BasicNewResourceWizard) getWizard())
|
||||||
|
.getSelection();
|
||||||
|
if (sel != null) {
|
||||||
|
tableViewer.setCheckedElements(sel.toArray());
|
||||||
|
setPageComplete(validatePage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addToMainPage(Composite container) {
|
||||||
|
super.addToMainPage(container);
|
||||||
|
|
||||||
|
Group optionsGroup = new Group(container, SWT.NONE);
|
||||||
|
optionsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
optionsGroup.setLayout(new GridLayout(1, true));
|
||||||
|
optionsGroup.setText(MakeUIPlugin.getResourceString("WizardMakeProjectConversion.projectOptions.title")); //$NON-NLS-1$
|
||||||
|
Composite c = new Composite(optionsGroup, SWT.NONE);
|
||||||
|
c.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
c.setLayout(new GridLayout(2, true));
|
||||||
|
|
||||||
|
specifyProjectTypeButton = new Button(c, SWT.CHECK);
|
||||||
|
specifyProjectTypeButton.setText(MakeUIPlugin.getResourceString("WizardMakeProjectConversion.projectOptions.projectType")); //$NON-NLS-1$
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
specifyProjectTypeButton.setLayoutData(gd);
|
||||||
|
specifyProjectTypeButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
enableProjectTypeControls(specifyProjectTypeButton
|
||||||
|
.getSelection());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
left_label = new Label(c, SWT.NONE);
|
||||||
|
left_label.setText(MakeUIPlugin.getResourceString("WizardMakeProjectConversion.projectOptions.projectTypeTable")); //$NON-NLS-1$
|
||||||
|
left_label.setFont(container.getFont());
|
||||||
|
left_label.setLayoutData(new GridData(GridData.BEGINNING));
|
||||||
|
|
||||||
|
right_label = new Label(c, SWT.NONE);
|
||||||
|
right_label.setFont(container.getFont());
|
||||||
|
right_label.setLayoutData(new GridData(GridData.BEGINNING));
|
||||||
|
|
||||||
|
tree = new Tree(c, SWT.SINGLE | SWT.BORDER);
|
||||||
|
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
tree.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
TreeItem[] tis = tree.getSelection();
|
||||||
|
if (tis == null || tis.length == 0)
|
||||||
|
return;
|
||||||
|
switchTo((CWizardHandler) tis[0].getData(),
|
||||||
|
(EntryDescriptor) tis[0]
|
||||||
|
.getData(CDTMainWizardPage.DESC));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
right = new Composite(c, SWT.NONE);
|
||||||
|
right.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
right.setLayout(new PageLayout());
|
||||||
|
|
||||||
|
show_sup = new Button(c, SWT.CHECK);
|
||||||
|
show_sup.setSelection(true);
|
||||||
|
show_sup.setText(MakeUIPlugin.getResourceString("WizardMakeProjectConversion.projectOptions.showSuppressed")); //$NON-NLS-1$
|
||||||
|
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
show_sup.setLayoutData(gd);
|
||||||
|
final IWizardItemsListListener filter = new IWizardItemsListListener() {
|
||||||
|
|
||||||
|
// Show only category
|
||||||
|
public List<EntryDescriptor> filterItems(
|
||||||
|
List<? extends EntryDescriptor> items) {
|
||||||
|
List<EntryDescriptor> results = new ArrayList<EntryDescriptor>();
|
||||||
|
|
||||||
|
for (EntryDescriptor entry : items) {
|
||||||
|
if (entry.isCategory()) {
|
||||||
|
results.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCurrent() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toolChainListChanged(int count) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
show_sup.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
if (h_selected != null)
|
||||||
|
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||||
|
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup,
|
||||||
|
filter, null), CDTMainWizardPage.getDescriptor(tree));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
CDTPrefUtil.readPreferredTCs();
|
||||||
|
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup, filter,
|
||||||
|
null), CDTMainWizardPage.getDescriptor(tree));
|
||||||
|
|
||||||
|
specifyProjectTypeButton.setSelection(true);
|
||||||
|
enableProjectTypeControls(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enableProjectTypeControls(boolean enabled) {
|
||||||
|
left_label.setEnabled(enabled);
|
||||||
|
right_label.setEnabled(enabled);
|
||||||
|
tree.setEnabled(enabled);
|
||||||
|
right.setEnabled(enabled);
|
||||||
|
enabledCompositeChildren(right, enabled);
|
||||||
|
show_sup.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enabledCompositeChildren(Composite composite, boolean enabled) {
|
||||||
|
Control[] children = composite.getChildren();
|
||||||
|
for (int i = 0; i < children.length; i++) {
|
||||||
|
children[i].setEnabled(enabled);
|
||||||
|
if (children[i] instanceof Composite) {
|
||||||
|
enabledCompositeChildren((Composite) children[i], enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void switchTo(CWizardHandler h, EntryDescriptor ed) {
|
||||||
|
if (h == null)
|
||||||
|
h = ed.getHandler();
|
||||||
|
try {
|
||||||
|
if (h != null && ed != null)
|
||||||
|
h.initialize(ed);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
h = null;
|
||||||
|
}
|
||||||
|
if (h_selected != null)
|
||||||
|
h_selected.handleUnSelection();
|
||||||
|
h_selected = h;
|
||||||
|
if (h == null)
|
||||||
|
return;
|
||||||
|
right_label.setText(h_selected.getHeader());
|
||||||
|
h_selected.handleSelection();
|
||||||
|
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Method getWzTitleResource returns the correct Title Label for this class
|
* Method getWzTitleResource returns the correct Title Label for this class
|
||||||
* overriding the default in the superclass.
|
* overriding the default in the superclass.
|
||||||
*/
|
*/
|
||||||
|
@ -74,6 +248,9 @@ public class ConvertToMakeWizardPage extends ConvertProjectWizardPage {
|
||||||
ManagedBuilderCorePlugin.getDefault().convertOldStdMakeToNewStyle(project, monitor);
|
ManagedBuilderCorePlugin.getDefault().convertOldStdMakeToNewStyle(project, monitor);
|
||||||
} else {
|
} else {
|
||||||
super.convertProject(project, bsId, new SubProgressMonitor(monitor, 1));
|
super.convertProject(project, bsId, new SubProgressMonitor(monitor, 1));
|
||||||
|
if (isSetProjectType()) {
|
||||||
|
h_selected.convertProject(project, monitor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
monitor.done();
|
monitor.done();
|
||||||
|
@ -87,19 +264,16 @@ public class ConvertToMakeWizardPage extends ConvertProjectWizardPage {
|
||||||
ManagedBuilderCorePlugin.getDefault().convertOldStdMakeToNewStyle(project, monitor);
|
ManagedBuilderCorePlugin.getDefault().convertOldStdMakeToNewStyle(project, monitor);
|
||||||
} else {
|
} else {
|
||||||
super.convertProject(project, new SubProgressMonitor(monitor, 1), projectID);
|
super.convertProject(project, new SubProgressMonitor(monitor, 1), projectID);
|
||||||
|
if (isSetProjectType()) {
|
||||||
|
h_selected.convertProject(project, monitor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createControl(Composite parent) {
|
public boolean isSetProjectType() {
|
||||||
super.createControl(parent);
|
return specifyProjectTypeButton != null && specifyProjectTypeButton.getSelection();
|
||||||
IStructuredSelection sel = ((BasicNewResourceWizard)getWizard()).getSelection();
|
}
|
||||||
if ( sel != null) {
|
|
||||||
tableViewer.setCheckedElements(sel.toArray());
|
|
||||||
setPageComplete(validatePage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -524,54 +524,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
|
public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
|
||||||
try {
|
try {
|
||||||
monitor.beginTask("", 100); //$NON-NLS-1$
|
monitor.beginTask("", 100); //$NON-NLS-1$
|
||||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
setProjectDescription(project, defaults, onFinish, monitor);
|
||||||
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
|
||||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
|
||||||
monitor.worked(10);
|
|
||||||
cfgs = fConfigPage.getCfgItems(false);
|
|
||||||
if (cfgs == null || cfgs.length == 0)
|
|
||||||
cfgs = CDTConfigWizardPage.getDefaultCfgs(this);
|
|
||||||
|
|
||||||
if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) {
|
|
||||||
throw new CoreException(new Status(IStatus.ERROR,
|
|
||||||
ManagedBuilderUIPlugin.getUniqueIdentifier(),
|
|
||||||
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
Configuration cf = (Configuration)cfgs[0].getConfiguration();
|
|
||||||
ManagedProject mProj = new ManagedProject(project, cf.getProjectType());
|
|
||||||
info.setManagedProject(mProj);
|
|
||||||
monitor.worked(10);
|
|
||||||
cfgs = CfgHolder.unique(cfgs);
|
|
||||||
cfgs = CfgHolder.reorder(cfgs);
|
|
||||||
|
|
||||||
ICConfigurationDescription cfgDebug = null;
|
|
||||||
ICConfigurationDescription cfgFirst = null;
|
|
||||||
|
|
||||||
int work = 50/cfgs.length;
|
|
||||||
|
|
||||||
for(int i = 0; i < cfgs.length; i++){
|
|
||||||
cf = (Configuration)cfgs[i].getConfiguration();
|
|
||||||
String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
|
|
||||||
Configuration config = new Configuration(mProj, cf, id, false, true);
|
|
||||||
CConfigurationData data = config.getConfigurationData();
|
|
||||||
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
|
||||||
config.setConfigurationDescription(cfgDes);
|
|
||||||
config.exportArtifactInfo();
|
|
||||||
|
|
||||||
IBuilder bld = config.getEditableBuilder();
|
|
||||||
if (bld != null) { bld.setManagedBuildOn(true); }
|
|
||||||
|
|
||||||
config.setName(cfgs[i].getName());
|
|
||||||
config.setArtifactName(removeSpaces(project.getName()));
|
|
||||||
|
|
||||||
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
|
|
||||||
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId()))
|
|
||||||
cfgDebug = cfgDes;
|
|
||||||
if (cfgFirst == null) // select at least first configuration
|
|
||||||
cfgFirst = cfgDes;
|
|
||||||
monitor.worked(work);
|
|
||||||
}
|
|
||||||
mngr.setProjectDescription(project, des);
|
|
||||||
doTemplatesPostProcess(project);
|
doTemplatesPostProcess(project);
|
||||||
doCustom(project);
|
doCustom(project);
|
||||||
monitor.worked(30);
|
monitor.worked(30);
|
||||||
|
@ -579,6 +532,61 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void convertProject(IProject proj, IProgressMonitor monitor) throws CoreException {
|
||||||
|
setProjectDescription(proj, true, true, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setProjectDescription(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
|
||||||
|
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||||
|
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
||||||
|
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||||
|
monitor.worked(10);
|
||||||
|
cfgs = getCfgItems(false);
|
||||||
|
if (cfgs == null || cfgs.length == 0)
|
||||||
|
cfgs = CDTConfigWizardPage.getDefaultCfgs(this);
|
||||||
|
|
||||||
|
if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) {
|
||||||
|
throw new CoreException(new Status(IStatus.ERROR,
|
||||||
|
ManagedBuilderUIPlugin.getUniqueIdentifier(),
|
||||||
|
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
Configuration cf = (Configuration)cfgs[0].getConfiguration();
|
||||||
|
ManagedProject mProj = new ManagedProject(project, cf.getProjectType());
|
||||||
|
info.setManagedProject(mProj);
|
||||||
|
monitor.worked(10);
|
||||||
|
cfgs = CfgHolder.unique(cfgs);
|
||||||
|
cfgs = CfgHolder.reorder(cfgs);
|
||||||
|
|
||||||
|
ICConfigurationDescription cfgDebug = null;
|
||||||
|
ICConfigurationDescription cfgFirst = null;
|
||||||
|
|
||||||
|
int work = 50/cfgs.length;
|
||||||
|
|
||||||
|
for(int i = 0; i < cfgs.length; i++){
|
||||||
|
cf = (Configuration)cfgs[i].getConfiguration();
|
||||||
|
String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
|
||||||
|
Configuration config = new Configuration(mProj, cf, id, false, true);
|
||||||
|
CConfigurationData data = config.getConfigurationData();
|
||||||
|
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||||
|
config.setConfigurationDescription(cfgDes);
|
||||||
|
config.exportArtifactInfo();
|
||||||
|
|
||||||
|
IBuilder bld = config.getEditableBuilder();
|
||||||
|
if (bld != null) { bld.setManagedBuildOn(true); }
|
||||||
|
|
||||||
|
config.setName(cfgs[i].getName());
|
||||||
|
config.setArtifactName(removeSpaces(project.getName()));
|
||||||
|
|
||||||
|
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
|
||||||
|
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId()))
|
||||||
|
cfgDebug = cfgDes;
|
||||||
|
if (cfgFirst == null) // select at least first configuration
|
||||||
|
cfgFirst = cfgDes;
|
||||||
|
monitor.worked(work);
|
||||||
|
}
|
||||||
|
mngr.setProjectDescription(project, des);
|
||||||
|
}
|
||||||
|
|
||||||
protected void doTemplatesPostProcess(IProject prj) {
|
protected void doTemplatesPostProcess(IProject prj) {
|
||||||
if(entryInfo == null)
|
if(entryInfo == null)
|
||||||
|
|
|
@ -55,37 +55,7 @@ public class STDWizardHandler extends MBSWizardHandler {
|
||||||
try {
|
try {
|
||||||
monitor.beginTask("", 100);//$NON-NLS-1$
|
monitor.beginTask("", 100);//$NON-NLS-1$
|
||||||
|
|
||||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
setProjectDescription(project, defaults, onFinish, monitor);
|
||||||
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
|
||||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
|
||||||
ManagedProject mProj = new ManagedProject(des);
|
|
||||||
info.setManagedProject(mProj);
|
|
||||||
monitor.worked(20);
|
|
||||||
cfgs = CfgHolder.unique(fConfigPage.getCfgItems(defaults));
|
|
||||||
cfgs = CfgHolder.reorder(cfgs);
|
|
||||||
int work = 50/cfgs.length;
|
|
||||||
for (int i=0; i<cfgs.length; i++) {
|
|
||||||
String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
|
|
||||||
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
|
|
||||||
IBuilder bld = cfg.getEditableBuilder();
|
|
||||||
if (bld != null) {
|
|
||||||
if(bld.isInternalBuilder()){
|
|
||||||
IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
|
|
||||||
IBuilder prefBuilder = prefCfg.getBuilder();
|
|
||||||
cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
|
|
||||||
bld = cfg.getEditableBuilder();
|
|
||||||
bld.setBuildPath(null);
|
|
||||||
}
|
|
||||||
bld.setManagedBuildOn(false);
|
|
||||||
} else {
|
|
||||||
System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
cfg.setArtifactName(removeSpaces(project.getName()));
|
|
||||||
CConfigurationData data = cfg.getConfigurationData();
|
|
||||||
des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
|
||||||
monitor.worked(work);
|
|
||||||
}
|
|
||||||
mngr.setProjectDescription(project, des);
|
|
||||||
|
|
||||||
doTemplatesPostProcess(project);
|
doTemplatesPostProcess(project);
|
||||||
doCustom(project);
|
doCustom(project);
|
||||||
|
@ -94,8 +64,47 @@ public class STDWizardHandler extends MBSWizardHandler {
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setProjectDescription(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor)
|
||||||
|
throws CoreException {
|
||||||
|
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||||
|
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
||||||
|
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||||
|
ManagedProject mProj = new ManagedProject(des);
|
||||||
|
info.setManagedProject(mProj);
|
||||||
|
monitor.worked(20);
|
||||||
|
cfgs = CfgHolder.unique(getCfgItems(false));
|
||||||
|
cfgs = CfgHolder.reorder(cfgs);
|
||||||
|
int work = 50/cfgs.length;
|
||||||
|
for (int i=0; i<cfgs.length; i++) {
|
||||||
|
String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
|
||||||
|
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
|
||||||
|
IBuilder bld = cfg.getEditableBuilder();
|
||||||
|
if (bld != null) {
|
||||||
|
if(bld.isInternalBuilder()){
|
||||||
|
IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
|
||||||
|
IBuilder prefBuilder = prefCfg.getBuilder();
|
||||||
|
cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
|
||||||
|
bld = cfg.getEditableBuilder();
|
||||||
|
bld.setBuildPath(null);
|
||||||
|
}
|
||||||
|
bld.setManagedBuildOn(false);
|
||||||
|
} else {
|
||||||
|
System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
cfg.setArtifactName(removeSpaces(project.getName()));
|
||||||
|
CConfigurationData data = cfg.getConfigurationData();
|
||||||
|
des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||||
|
monitor.worked(work);
|
||||||
|
}
|
||||||
|
mngr.setProjectDescription(project, des);
|
||||||
|
}
|
||||||
public boolean canCreateWithoutToolchain() { return true; }
|
public boolean canCreateWithoutToolchain() { return true; }
|
||||||
|
|
||||||
|
public void convertProject(IProject proj, IProgressMonitor monitor) throws CoreException {
|
||||||
|
setProjectDescription(proj, true, true, monitor);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If no toolchains selected by user, use default toolchain
|
* If no toolchains selected by user, use default toolchain
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -188,6 +188,17 @@ public class CWizardHandler implements Cloneable {
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
createProject(proj, defaults, monitor);
|
createProject(proj, defaults, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an already created project
|
||||||
|
*
|
||||||
|
* @param proj - the project to convert
|
||||||
|
*
|
||||||
|
* @throws CoreException
|
||||||
|
* @since 5.1
|
||||||
|
*/
|
||||||
|
public void convertProject(IProject proj, IProgressMonitor monitor) throws CoreException {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return true if settings were changed
|
* @return true if settings were changed
|
||||||
|
|
Loading…
Add table
Reference in a new issue