1
/*******************************************************************************
2
* Copyright (c) 2007, 2008 Intel Corporation and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Intel Corporation - initial API and implementation
11
*******************************************************************************/
12
package org.eclipse.cdt.managedbuilder.ui.wizards;
14
import java.lang.reflect.InvocationTargetException;
15
import java.util.ArrayList;
16
import java.util.Arrays;
17
import java.util.HashMap;
18
import java.util.LinkedHashSet;
19
import java.util.List;
22
import java.util.SortedMap;
23
import java.util.TreeMap;
24
import java.util.TreeSet;
26
import org.eclipse.cdt.core.model.CoreModel;
27
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
28
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
29
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
30
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
31
import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
32
import org.eclipse.cdt.internal.ui.wizards.ICDTCommonProjectWizard;
33
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
34
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
35
import org.eclipse.cdt.managedbuilder.core.BuildException;
36
import org.eclipse.cdt.managedbuilder.core.IBuilder;
37
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
38
import org.eclipse.cdt.managedbuilder.core.IProjectType;
39
import org.eclipse.cdt.managedbuilder.core.IToolChain;
40
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
41
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
42
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
43
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
44
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
45
import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
46
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
47
import org.eclipse.cdt.ui.templateengine.IWizardDataPage;
48
import org.eclipse.cdt.ui.templateengine.Template;
49
import org.eclipse.cdt.ui.templateengine.TemplateEngineUI;
50
import org.eclipse.cdt.ui.templateengine.TemplateEngineUIUtil;
51
import org.eclipse.cdt.ui.templateengine.pages.UIWizardPage;
52
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
53
import org.eclipse.cdt.ui.wizards.CWizardHandler;
54
import org.eclipse.cdt.ui.wizards.EntryDescriptor;
55
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
56
import org.eclipse.core.resources.IProject;
57
import org.eclipse.core.runtime.CoreException;
58
import org.eclipse.core.runtime.IProgressMonitor;
59
import org.eclipse.core.runtime.IStatus;
60
import org.eclipse.core.runtime.Status;
61
import org.eclipse.jface.operation.IRunnableWithProgress;
62
import org.eclipse.jface.wizard.IWizard;
63
import org.eclipse.jface.wizard.IWizardPage;
64
import org.eclipse.swt.SWT;
65
import org.eclipse.swt.accessibility.AccessibleAdapter;
66
import org.eclipse.swt.accessibility.AccessibleEvent;
67
import org.eclipse.swt.events.SelectionAdapter;
68
import org.eclipse.swt.events.SelectionEvent;
69
import org.eclipse.swt.widgets.Composite;
70
import org.eclipse.swt.widgets.Table;
71
import org.eclipse.swt.widgets.TableItem;
72
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
75
* This object is created per each Project type
77
* It is responsible for:
78
* - corresponding line in left pane of 1st wizard page
79
* - whole view of right pane, including
82
public class MBSWizardHandler extends CWizardHandler {
83
public static final String ARTIFACT = "org.eclipse.cdt.build.core.buildArtefactType"; //$NON-NLS-1$
84
public static final String EMPTY_STR = ""; //$NON-NLS-1$
86
private static final String PROPERTY = "org.eclipse.cdt.build.core.buildType"; //$NON-NLS-1$
87
private static final String PROP_VAL = PROPERTY + ".debug"; //$NON-NLS-1$
88
private static final String tooltip =
89
Messages.getString("CWizardHandler.1")+ //$NON-NLS-1$
90
Messages.getString("CWizardHandler.2") + //$NON-NLS-1$
91
Messages.getString("CWizardHandler.3") + //$NON-NLS-1$
92
Messages.getString("CWizardHandler.4") + //$NON-NLS-1$
93
Messages.getString("CWizardHandler.5"); //$NON-NLS-1$
95
protected SortedMap<String, IToolChain> full_tcs = new TreeMap<String, IToolChain>();
96
private String propertyId = null;
97
private IProjectType pt = null;
98
protected IWizardItemsListListener listener;
99
protected CDTConfigWizardPage fConfigPage;
100
private IToolChain[] savedToolChains = null;
101
private IWizard wizard;
102
private IWizardPage startingPage;
103
// private EntryDescriptor entryDescriptor = null;
104
private EntryInfo entryInfo;
105
protected CfgHolder[] cfgs = null;
106
protected IWizardPage[] customPages;
109
* Current list of preferred toolchains
111
private List<String> preferredTCs = new ArrayList<String>();
113
protected static final class EntryInfo {
114
private SortedMap<String, IToolChain> tcs;
115
private EntryDescriptor entryDescriptor;
116
private Template template;
117
private boolean initialized;
118
private boolean isValid;
119
private String projectTypeId;
120
private String templateId;
121
private IWizardPage[] templatePages;
122
private IWizardPage predatingPage;
123
private IWizardPage followingPage;
124
private IWizard wizard;
126
public EntryInfo(EntryDescriptor dr, SortedMap<String, IToolChain> _tcs){
127
entryDescriptor = dr;
134
public EntryInfo(EntryDescriptor dr, SortedMap<String, IToolChain> _tcs, IWizard w){
139
public boolean isValid(){
144
public Template getTemplate(){
149
public EntryDescriptor getDescriptor(){
150
return entryDescriptor;
153
private void initialize(){
158
if(entryDescriptor == null)
160
String path[] = entryDescriptor.getPathArray();
161
if(path == null || path.length == 0)
164
projectTypeId = path[0];
165
if(!entryDescriptor.isDefaultForCategory() &&
166
path.length > 1 && (!path[0].equals(ManagedBuildWizard.OTHERS_LABEL))){
167
templateId = path[path.length - 1];
168
Template templates[] = null;
169
if(wizard instanceof ICDTCommonProjectWizard) {
170
ICDTCommonProjectWizard wz = (ICDTCommonProjectWizard)wizard;
171
String[] langIDs = wz.getLanguageIDs();
172
if(langIDs.length > 0) {
173
List<Template> lstTemplates = new ArrayList<Template>();
174
for(int i = 0; i < langIDs.length; ++i) {
175
lstTemplates.addAll(Arrays.asList(TemplateEngineUI.getDefault().
176
getTemplates(projectTypeId, null, langIDs[i])));
178
templates = lstTemplates.toArray(new Template[lstTemplates.size()]);
181
if(null == templates) {
183
TemplateEngineUI.getDefault().
184
getTemplates(projectTypeId);
186
if((null == templates) || (templates.length == 0))
189
for(int i = 0; i < templates.length; i++){
190
if(templates[i].getTemplateId().equals(templateId)){
191
template = templates[i];
206
public Template getInitializedTemplate(IWizardPage predatingPage, IWizardPage followingPage, Map<String, String> map){
207
getNextPage(predatingPage, followingPage);
209
Template template = getTemplate();
211
if(template != null){
212
Map<String, String> valueStore = template.getValueStore();
213
// valueStore.clear();
214
for(int i=0; i < templatePages.length; i++) {
215
IWizardPage page = templatePages[i];
216
if (page instanceof UIWizardPage)
217
valueStore.putAll(((UIWizardPage)page).getPageData());
218
if (page instanceof IWizardDataPage)
219
valueStore.putAll(((IWizardDataPage)page).getPageData());
222
valueStore.putAll(map);
228
public IWizardPage getNextPage(IWizardPage predatingPage, IWizardPage followingPage) {
230
if(this.templatePages == null
231
|| this.predatingPage != predatingPage
232
|| this.followingPage != followingPage){
233
this.predatingPage = predatingPage;
234
this.followingPage = followingPage;
235
if (template != null) {
236
this.templatePages = template.getTemplateWizardPages(predatingPage, followingPage, predatingPage.getWizard());
238
templatePages = new IWizardPage[0];
239
followingPage.setPreviousPage(predatingPage);
243
if(templatePages.length != 0)
244
return templatePages[0];
245
return followingPage;
248
private boolean canFinish(IWizardPage predatingPage, IWizardPage followingPage){
249
getNextPage(predatingPage, followingPage);
250
for(int i = 0; i < templatePages.length; i++){
251
if(!templatePages[i].isPageComplete())
260
* @return - set of compatible toolchain's IDs
262
protected Set<String> tc_filter() {
263
Set<String> full = tcs.keySet();
264
if (entryDescriptor == null)
266
Set<String> out = new LinkedHashSet<String>(full.size());
267
for (String s : full)
268
if (isToolChainAcceptable(s))
274
* Checks whether given toolchain can be displayed
276
* @param tcId - toolchain _NAME_ to check
277
* @return - true if toolchain can be displayed
279
public boolean isToolChainAcceptable(String tcId) {
280
if (template == null || template.getTemplateInfo() == null)
283
String[] ss = template.getTemplateInfo().getToolChainIds();
284
if (ss == null || ss.length == 0)
287
Object ob = tcs.get(tcId);
289
return true; // sic ! This can occur with Other Toolchain only
290
if (!(ob instanceof IToolChain))
293
String id1 = ((IToolChain)ob).getId();
294
IToolChain sup = ((IToolChain)ob).getSuperClass();
295
String id2 = sup == null ? null : sup.getId();
297
for (int i=0; i<ss.length; i++) {
298
if ((ss[i] != null && ss[i].equals(id1)) ||
299
(ss[i] != null && ss[i].equals(id2)))
305
public int getToolChainsCount() {
306
return tc_filter().size();
310
public MBSWizardHandler(IProjectType _pt, Composite p, IWizard w) {
311
super(p, Messages.getString("CWizardHandler.0"), _pt.getName()); //$NON-NLS-1$
316
public MBSWizardHandler(String name, Composite p, IWizard w) {
317
super(p, Messages.getString("CWizardHandler.0"), name); //$NON-NLS-1$
321
public MBSWizardHandler(IBuildPropertyValue val, Composite p, IWizard w) {
322
super(p, Messages.getString("CWizardHandler.0"), val.getName()); //$NON-NLS-1$
323
propertyId = val.getId();
326
private void setWizard(IWizard w) {
328
if (w.getStartingPage() instanceof IWizardItemsListListener)
329
listener = (IWizardItemsListListener)w.getStartingPage();
331
startingPage = w.getStartingPage();
335
protected IWizardPage getStartingPage(){
339
public Map<String, String> getMainPageData() {
340
WizardNewProjectCreationPage page = (WizardNewProjectCreationPage)getStartingPage();
341
Map<String, String> data = new HashMap<String, String>();
342
String projName = page.getProjectName();
343
projName = projName != null ? projName.trim() : EMPTY_STR;
344
data.put("projectName", projName); //$NON-NLS-1$
345
data.put("baseName", getBaseName(projName)); //$NON-NLS-1$
346
data.put("baseNameUpper", getBaseName(projName).toUpperCase() ); //$NON-NLS-1$
347
data.put("baseNameLower", getBaseName(projName).toLowerCase() ); //$NON-NLS-1$
348
String location = page.getLocationPath().toOSString();
350
location = EMPTY_STR;
351
data.put("location", location); //getProjectLocation().toPortableString()); //$NON-NLS-1$
355
private String getBaseName(String name) {
356
String baseName = name;
357
int dot = baseName.lastIndexOf('.');
359
baseName = baseName.substring(dot + 1);
361
dot = baseName.indexOf(' ');
363
baseName = baseName.substring(0, dot);
368
public void handleSelection() {
369
List<String> preferred = CDTPrefUtil.getPreferredTCs();
372
table = new Table(parent, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
373
table.getAccessible().addAccessibleListener(
374
new AccessibleAdapter() {
375
public void getName(AccessibleEvent e) {
376
if (e.result == null)
381
table.setToolTipText(tooltip);
382
if (entryInfo != null) {
385
for (String s : entryInfo.tc_filter()) {
386
TableItem ti = new TableItem(table, SWT.NONE);
387
Object obj = full_tcs.get(s);
388
String id = CDTPrefUtil.NULL;
389
if (obj instanceof IToolChain) {
390
IToolChain tc = (IToolChain)obj;
391
String name = tc.getUniqueRealName();
396
} else { // NULL for -NO TOOLCHAIN-
399
if (position == 0 && preferred.contains(id)) position = counter;
402
if (counter > 0) table.select(position);
404
table.addSelectionListener(new SelectionAdapter() {
405
public void widgetSelected(SelectionEvent e) {
406
handleToolChainSelection();
409
updatePreferred(preferred);
411
table.setVisible(true);
413
if (fConfigPage != null) fConfigPage.pagesLoaded = false;
416
private void handleToolChainSelection() {
418
// Notify listener, if any.
419
if (listener != null)
420
listener.toolChainListChanged(table.getSelectionCount());
423
private void loadCustomPages() {
424
if (! (getWizard() instanceof ICDTCommonProjectWizard))
425
return; // not probable
427
ICDTCommonProjectWizard wz = (ICDTCommonProjectWizard)getWizard();
429
if (customPages == null) {
430
MBSCustomPageManager.init();
431
MBSCustomPageManager.addStockPage(getStartingPage(), CDTMainWizardPage.PAGE_ID);
432
MBSCustomPageManager.addStockPage(getConfigPage(), CDTConfigWizardPage.PAGE_ID);
434
// load all custom pages specified via extensions
436
MBSCustomPageManager.loadExtensions();
437
} catch (BuildException e) { e.printStackTrace(); }
439
customPages = MBSCustomPageManager.getCustomPages();
441
if (customPages == null)
442
customPages = new IWizardPage[0];
444
for (int k = 0; k < customPages.length; k++)
445
customPages[k].setWizard(wz);
447
setCustomPagesFilter(wz);
450
private void setCustomPagesFilter(ICDTCommonProjectWizard wz) {
451
String[] natures = wz.getNatures();
452
if (natures == null || natures.length == 0)
453
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, null);
454
else if (natures.length == 1)
455
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, natures[0]);
457
TreeSet<String> x = new TreeSet<String>();
458
for (int i=0; i<natures.length; i++) x.add(natures[i]);
459
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, x);
461
// Project type can be obtained either from Handler (for old-style projects),
462
// or multiple values will be got from separate ToolChains (for new-style).
463
boolean ptIsNull = (getProjectType() == null);
465
MBSCustomPageManager.addPageProperty(
466
MBSCustomPageManager.PAGE_ID,
467
MBSCustomPageManager.PROJECT_TYPE,
468
getProjectType().getId()
471
IToolChain[] tcs = getSelectedToolChains();
472
int n = (tcs == null) ? 0 : tcs.length;
473
ArrayList<IToolChain> x = new ArrayList<IToolChain>();
474
TreeSet<String> y = new TreeSet<String>();
475
for (int i=0; i<n; i++) {
476
if (tcs[i] == null) // --- NO TOOLCHAIN ---
477
continue; // has no custom pages.
480
IConfiguration cfg = tcs[i].getParent();
483
IProjectType pt = cfg.getProjectType();
487
MBSCustomPageManager.addPageProperty(
488
MBSCustomPageManager.PAGE_ID,
489
MBSCustomPageManager.TOOLCHAIN,
494
MBSCustomPageManager.addPageProperty(
495
MBSCustomPageManager.PAGE_ID,
496
MBSCustomPageManager.PROJECT_TYPE,
499
MBSCustomPageManager.addPageProperty(
500
MBSCustomPageManager.PAGE_ID,
501
MBSCustomPageManager.PROJECT_TYPE,
506
public void handleUnSelection() {
508
table.setVisible(false);
510
if (fConfigPage != null) fConfigPage.pagesLoaded = false;
513
public void addTc(IToolChain tc) {
514
if (tc.isAbstract() || tc.isSystemObject()) return;
515
IConfiguration[] cfgs = null;
516
// New style managed project type. Configurations are referenced via propertyId.
517
if (propertyId != null) {
518
cfgs = ManagedBuildManager.getExtensionConfigurations(tc, ARTIFACT, propertyId);
519
// Old style managewd project type. Configs are obtained via projectType
520
} else if (pt != null) {
521
cfgs = ManagedBuildManager.getExtensionConfigurations(tc, pt);
523
if (cfgs == null || cfgs.length == 0) return;
524
full_tcs.put(tc.getUniqueRealName(), tc);
527
public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
529
monitor.beginTask("", 100); //$NON-NLS-1$
530
setProjectDescription(project, defaults, onFinish, monitor);
531
doTemplatesPostProcess(project);
539
public void convertProject(IProject proj, IProgressMonitor monitor) throws CoreException {
540
setProjectDescription(proj, true, true, monitor);
543
private void setProjectDescription(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
544
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
545
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
546
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
548
cfgs = getCfgItems(false);
549
if (cfgs == null || cfgs.length == 0)
550
cfgs = CDTConfigWizardPage.getDefaultCfgs(this);
552
if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) {
553
throw new CoreException(new Status(IStatus.ERROR,
554
ManagedBuilderUIPlugin.getUniqueIdentifier(),
555
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
557
Configuration cf = (Configuration)cfgs[0].getConfiguration();
558
ManagedProject mProj = new ManagedProject(project, cf.getProjectType());
559
info.setManagedProject(mProj);
561
cfgs = CfgHolder.unique(cfgs);
562
cfgs = CfgHolder.reorder(cfgs);
564
ICConfigurationDescription cfgDebug = null;
565
ICConfigurationDescription cfgFirst = null;
567
int work = 50/cfgs.length;
569
for(int i = 0; i < cfgs.length; i++){
570
cf = (Configuration)cfgs[i].getConfiguration();
571
String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
572
Configuration config = new Configuration(mProj, cf, id, false, true);
573
CConfigurationData data = config.getConfigurationData();
574
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
575
config.setConfigurationDescription(cfgDes);
576
config.exportArtifactInfo();
578
IBuilder bld = config.getEditableBuilder();
579
if (bld != null) { bld.setManagedBuildOn(true); }
581
config.setName(cfgs[i].getName());
582
config.setArtifactName(removeSpaces(project.getName()));
584
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
585
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId()))
587
if (cfgFirst == null) // select at least first configuration
589
monitor.worked(work);
591
mngr.setProjectDescription(project, des);
594
protected void doTemplatesPostProcess(IProject prj) {
595
if(entryInfo == null)
598
Template template = entryInfo.getInitializedTemplate(getStartingPage(), getConfigPage(), getMainPageData());
602
List<IConfiguration> configs = new ArrayList<IConfiguration>();
603
for(int i = 0; i < cfgs.length; i++){
604
configs.add((IConfiguration)cfgs[i].getConfiguration());
606
template.getTemplateInfo().setConfigurations(configs);
608
IStatus[] statuses = template.executeTemplateProcesses(null, false);
609
if (statuses.length == 1 && statuses[0].getException() instanceof ProcessFailureException) {
610
TemplateEngineUIUtil.showError(statuses[0].getMessage(), statuses[0].getException());
614
protected CDTConfigWizardPage getConfigPage() {
615
if (fConfigPage == null) {
616
fConfigPage = new CDTConfigWizardPage(this);
621
public IWizardPage getSpecificPage() {
622
return entryInfo.getNextPage(getStartingPage(), getConfigPage());
626
* Mark preferred toolchains with specific images
630
public void updatePreferred(List<String> prefs) {
631
preferredTCs.clear();
632
int x = table.getItemCount();
633
for (int i=0; i<x; i++) {
634
TableItem ti = table.getItem(i);
635
IToolChain tc = (IToolChain)ti.getData();
636
String id = (tc == null) ? CDTPrefUtil.NULL : tc.getId();
637
if (prefs.contains(id)) {
639
preferredTCs.add(tc.getName());
646
public List<String> getPreferredTCNames() {
650
public String getHeader() { return head; }
651
public boolean isDummy() { return false; }
652
public boolean supportsPreferred() { return true; }
654
public boolean isChanged() {
655
if (savedToolChains == null)
657
IToolChain[] tcs = getSelectedToolChains();
658
if (savedToolChains.length != tcs.length)
660
for (int i=0; i<savedToolChains.length; i++) {
661
boolean found = false;
662
for (int j=0; j<tcs.length; j++) {
663
if (savedToolChains[i] == tcs[j]) {
667
if (!found) return true;
672
public void saveState() {
673
savedToolChains = getSelectedToolChains();
676
// Methods specific for MBSWizardHandler
678
public IToolChain[] getSelectedToolChains() {
679
TableItem[] tis = table.getSelection();
680
if (tis == null || tis.length == 0)
681
return new IToolChain[0];
682
IToolChain[] ts = new IToolChain[tis.length];
683
for (int i=0; i<tis.length; i++) {
684
ts[i] = (IToolChain)tis[i].getData();
688
public int getToolChainsCount() {
689
if (entryInfo == null)
690
return full_tcs.size();
692
return entryInfo.tc_filter().size();
694
public String getPropertyId() {
697
public IProjectType getProjectType() {
700
public IWizard getWizard() {
703
public CfgHolder[] getCfgItems(boolean defaults) {
704
getConfigPage(); // ensure that page is created
705
return fConfigPage.getCfgItems(defaults);
707
public String getErrorMessage() {
708
TableItem[] tis = table.getSelection();
709
if (tis == null || tis.length == 0)
710
return Messages.getString("MBSWizardHandler.0"); //$NON-NLS-1$
714
protected void doCustom(IProject newProject) {
715
IRunnableWithProgress[] operations = MBSCustomPageManager.getOperations();
716
if(operations != null)
717
for(int k = 0; k < operations.length; k++)
719
wizard.getContainer().run(false, true, operations[k]);
720
} catch (InvocationTargetException e) {
721
ManagedBuilderUIPlugin.log(e);
722
} catch (InterruptedException e) {
723
ManagedBuilderUIPlugin.log(e);
727
public void postProcess(IProject newProject, boolean created) {
728
deleteExtraConfigs(newProject);
729
// calls are required only if the project was
730
// created before for <Advanced Settings> feature.
732
doTemplatesPostProcess(newProject);
733
doCustom(newProject);
738
* Deletes configurations
740
* @param newProject - affected project
742
private void deleteExtraConfigs(IProject newProject) {
743
if (isChanged()) return; // no need to delete
744
if (listener != null && listener.isCurrent()) return; // nothing to delete
745
if (fConfigPage == null || !fConfigPage.pagesLoaded) return;
747
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(newProject, true);
748
if (prjd == null) return;
749
ICConfigurationDescription[] all = prjd.getConfigurations();
750
if (all == null) return;
751
CfgHolder[] req = getCfgItems(false);
752
boolean modified = false;
753
for (int i=0; i<all.length; i++) {
754
boolean found = false;
755
for (int j=0; j<req.length; j++) {
756
if (all[i].getName().equals(req[j].getName())) {
762
prjd.removeConfiguration(all[i]);
766
CoreModel.getDefault().setProjectDescription(newProject, prjd);
767
} catch (CoreException e) {}
770
public boolean isApplicable(EntryDescriptor data) {
771
EntryInfo info = new EntryInfo(data, full_tcs, wizard);
772
return info.isValid() && (info.getToolChainsCount() > 0);
775
public void initialize(EntryDescriptor data) throws CoreException {
776
EntryInfo info = new EntryInfo(data, full_tcs, wizard);
778
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderUIPlugin.getUniqueIdentifier(), "inappropriate descriptor")); //$NON-NLS-1$
786
public Object clone() {
787
MBSWizardHandler clone = (MBSWizardHandler)super.clone();
789
clone.propertyId = propertyId;
791
clone.listener = listener;
792
clone.wizard = wizard;
793
clone.entryInfo = entryInfo; // the same !
794
clone.fConfigPage = fConfigPage; // the same !
795
clone.full_tcs = full_tcs; // the same !
800
public boolean canFinish() {
801
if(entryInfo == null)
804
if (!getConfigPage().isCustomPageComplete())
807
if(!entryInfo.canFinish(startingPage, getConfigPage()))
810
if (customPages != null)
811
for (int i=0; i<customPages.length; i++)
812
if (!customPages[i].isPageComplete())
815
return super.canFinish();