mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug #217052 : custom page's operation is not run on creation of make projects
This commit is contained in:
parent
7c0b0c875a
commit
3c1338a8db
4 changed files with 33 additions and 38 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2007 IBM Corporation and others.
|
* Copyright (c) 2003, 2008 IBM 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
|
||||||
|
@ -193,7 +193,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
private static boolean projectTypesLoaded = false;
|
private static boolean projectTypesLoaded = false;
|
||||||
private static boolean projectTypesLoading = false;
|
private static boolean projectTypesLoading = false;
|
||||||
// Project types defined in the manifest files
|
// Project types defined in the manifest files
|
||||||
public static SortedMap projectTypeMap;
|
public static SortedMap<String, IProjectType> projectTypeMap;
|
||||||
private static List projectTypes;
|
private static List projectTypes;
|
||||||
// Early configuration initialization extension elements
|
// Early configuration initialization extension elements
|
||||||
private static List startUpConfigElements;
|
private static List startUpConfigElements;
|
||||||
|
@ -371,13 +371,13 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
*
|
*
|
||||||
* @return Map
|
* @return Map
|
||||||
*/
|
*/
|
||||||
public static SortedMap getExtensionProjectTypeMap() {
|
public static SortedMap<String, IProjectType> getExtensionProjectTypeMap() {
|
||||||
try {
|
try {
|
||||||
loadExtensions();
|
loadExtensions();
|
||||||
} catch (BuildException e) {
|
} catch (BuildException e) {
|
||||||
}
|
}
|
||||||
if (projectTypeMap == null) {
|
if (projectTypeMap == null) {
|
||||||
projectTypeMap = new TreeMap();
|
projectTypeMap = new TreeMap<String, IProjectType>();
|
||||||
}
|
}
|
||||||
return projectTypeMap;
|
return projectTypeMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Intel Corporation and others.
|
* Copyright (c) 2007, 2008 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
|
||||||
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -91,7 +90,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
Messages.getString("CWizardHandler.4") + //$NON-NLS-1$
|
Messages.getString("CWizardHandler.4") + //$NON-NLS-1$
|
||||||
Messages.getString("CWizardHandler.5"); //$NON-NLS-1$
|
Messages.getString("CWizardHandler.5"); //$NON-NLS-1$
|
||||||
|
|
||||||
protected SortedMap full_tcs = new TreeMap();
|
protected SortedMap<String, IToolChain> full_tcs = new TreeMap<String, IToolChain>();
|
||||||
private String propertyId = null;
|
private String propertyId = null;
|
||||||
private IProjectType pt = null;
|
private IProjectType pt = null;
|
||||||
protected IWizardItemsListListener listener;
|
protected IWizardItemsListListener listener;
|
||||||
|
@ -105,7 +104,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
protected IWizardPage[] customPages;
|
protected IWizardPage[] customPages;
|
||||||
|
|
||||||
protected static final class EntryInfo {
|
protected static final class EntryInfo {
|
||||||
private SortedMap tcs;
|
private SortedMap<String, IToolChain> tcs;
|
||||||
private EntryDescriptor entryDescriptor;
|
private EntryDescriptor entryDescriptor;
|
||||||
private Template template;
|
private Template template;
|
||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
|
@ -116,7 +115,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
private IWizardPage predatingPage;
|
private IWizardPage predatingPage;
|
||||||
private IWizardPage followingPage;
|
private IWizardPage followingPage;
|
||||||
|
|
||||||
public EntryInfo(EntryDescriptor dr, SortedMap _tcs){
|
public EntryInfo(EntryDescriptor dr, SortedMap<String, IToolChain> _tcs){
|
||||||
entryDescriptor = dr;
|
entryDescriptor = dr;
|
||||||
tcs = _tcs;
|
tcs = _tcs;
|
||||||
}
|
}
|
||||||
|
@ -170,13 +169,13 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Template getInitializedTemplate(IWizardPage predatingPage, IWizardPage followingPage, Map map){
|
public Template getInitializedTemplate(IWizardPage predatingPage, IWizardPage followingPage, Map<String, String> map){
|
||||||
getNextPage(predatingPage, followingPage);
|
getNextPage(predatingPage, followingPage);
|
||||||
|
|
||||||
Template template = getTemplate();
|
Template template = getTemplate();
|
||||||
|
|
||||||
if(template != null){
|
if(template != null){
|
||||||
Map/*<String, String>*/ valueStore = template.getValueStore();
|
Map<String, String> valueStore = template.getValueStore();
|
||||||
// valueStore.clear();
|
// valueStore.clear();
|
||||||
for(int i=0; i < templatePages.length; i++) {
|
for(int i=0; i < templatePages.length; i++) {
|
||||||
IWizardPage page = templatePages[i];
|
IWizardPage page = templatePages[i];
|
||||||
|
@ -226,17 +225,14 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
*
|
*
|
||||||
* @return - set of compatible toolchain's IDs
|
* @return - set of compatible toolchain's IDs
|
||||||
*/
|
*/
|
||||||
protected Set tc_filter() {
|
protected Set<String> tc_filter() {
|
||||||
Set full = tcs.keySet();
|
Set<String> full = tcs.keySet();
|
||||||
if (entryDescriptor == null)
|
if (entryDescriptor == null)
|
||||||
return full;
|
return full;
|
||||||
Set out = new LinkedHashSet(full.size());
|
Set<String> out = new LinkedHashSet<String>(full.size());
|
||||||
Iterator it = full.iterator();
|
for (String s : full)
|
||||||
while (it.hasNext()) {
|
|
||||||
String s = (String)it.next();
|
|
||||||
if (isToolChainAcceptable(s))
|
if (isToolChainAcceptable(s))
|
||||||
out.add(s);
|
out.add(s);
|
||||||
}
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,9 +302,9 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
return startingPage;
|
return startingPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getMainPageData() {
|
public Map<String, String> getMainPageData() {
|
||||||
WizardNewProjectCreationPage page = (WizardNewProjectCreationPage)getStartingPage();
|
WizardNewProjectCreationPage page = (WizardNewProjectCreationPage)getStartingPage();
|
||||||
Map data = new HashMap();
|
Map<String, String> data = new HashMap<String, String>();
|
||||||
String projName = page.getProjectName();
|
String projName = page.getProjectName();
|
||||||
projName = projName != null ? projName.trim() : EMPTY_STR;
|
projName = projName != null ? projName.trim() : EMPTY_STR;
|
||||||
data.put("projectName", projName); //$NON-NLS-1$
|
data.put("projectName", projName); //$NON-NLS-1$
|
||||||
|
@ -336,7 +332,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleSelection() {
|
public void handleSelection() {
|
||||||
List preferred = CDTPrefUtil.getPreferredTCs();
|
List<String> preferred = CDTPrefUtil.getPreferredTCs();
|
||||||
|
|
||||||
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);
|
||||||
|
@ -349,12 +345,10 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
);
|
);
|
||||||
table.setToolTipText(tooltip);
|
table.setToolTipText(tooltip);
|
||||||
if (entryInfo != null) {
|
if (entryInfo != null) {
|
||||||
Iterator it = entryInfo.tc_filter().iterator();
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
int position = 0;
|
int position = 0;
|
||||||
while (it.hasNext()) {
|
for (String s : entryInfo.tc_filter()) {
|
||||||
TableItem ti = new TableItem(table, SWT.NONE);
|
TableItem ti = new TableItem(table, SWT.NONE);
|
||||||
String s = (String)it.next();
|
|
||||||
Object obj = full_tcs.get(s);
|
Object obj = full_tcs.get(s);
|
||||||
String id = CDTPrefUtil.NULL;
|
String id = CDTPrefUtil.NULL;
|
||||||
if (obj instanceof IToolChain) {
|
if (obj instanceof IToolChain) {
|
||||||
|
@ -425,7 +419,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
else if (natures.length == 1)
|
else if (natures.length == 1)
|
||||||
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, natures[0]);
|
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, natures[0]);
|
||||||
else {
|
else {
|
||||||
Set x = new TreeSet();
|
TreeSet<String> x = new TreeSet<String>();
|
||||||
for (int i=0; i<natures.length; i++) x.add(natures[i]);
|
for (int i=0; i<natures.length; i++) x.add(natures[i]);
|
||||||
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, x);
|
MBSCustomPageManager.addPageProperty(MBSCustomPageManager.PAGE_ID, MBSCustomPageManager.NATURE, x);
|
||||||
}
|
}
|
||||||
|
@ -441,8 +435,8 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
|
|
||||||
IToolChain[] tcs = getSelectedToolChains();
|
IToolChain[] tcs = getSelectedToolChains();
|
||||||
int n = (tcs == null) ? 0 : tcs.length;
|
int n = (tcs == null) ? 0 : tcs.length;
|
||||||
List x = new ArrayList();
|
ArrayList<IToolChain> x = new ArrayList<IToolChain>();
|
||||||
Set y = new TreeSet();
|
TreeSet<String> y = new TreeSet<String>();
|
||||||
for (int i=0; i<n; i++) {
|
for (int i=0; i<n; i++) {
|
||||||
if (tcs[i] == null) // --- NO TOOLCHAIN ---
|
if (tcs[i] == null) // --- NO TOOLCHAIN ---
|
||||||
continue; // has no custom pages.
|
continue; // has no custom pages.
|
||||||
|
@ -560,9 +554,9 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
if(template == null)
|
if(template == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List configs = new ArrayList();
|
List<IConfiguration> configs = new ArrayList<IConfiguration>();
|
||||||
for(int i = 0; i < cfgs.length; i++){
|
for(int i = 0; i < cfgs.length; i++){
|
||||||
configs.add(cfgs[i].getConfiguration());
|
configs.add((IConfiguration)cfgs[i].getConfiguration());
|
||||||
}
|
}
|
||||||
template.getTemplateInfo().setConfigurations(configs);
|
template.getTemplateInfo().setConfigurations(configs);
|
||||||
|
|
||||||
|
@ -585,7 +579,9 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark preferred toolchains with specific images
|
* Mark preferred toolchains with specific images
|
||||||
|
* @
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void updatePreferred(List prefs) {
|
public void updatePreferred(List prefs) {
|
||||||
int x = table.getItemCount();
|
int x = table.getItemCount();
|
||||||
for (int i=0; i<x; i++) {
|
for (int i=0; i<x; i++) {
|
||||||
|
@ -659,7 +655,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doCustom() {
|
protected void doCustom() {
|
||||||
IRunnableWithProgress[] operations = MBSCustomPageManager.getOperations();
|
IRunnableWithProgress[] operations = MBSCustomPageManager.getOperations();
|
||||||
if(operations != null)
|
if(operations != null)
|
||||||
for(int k = 0; k < operations.length; k++)
|
for(int k = 0; k < operations.length; k++)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Intel Corporation and others.
|
* Copyright (c) 2007, 2008 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
|
||||||
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
@ -44,7 +43,7 @@ public class ManagedBuildWizard extends AbstractCWizard {
|
||||||
IBuildPropertyValue[] vs = bpt.getSupportedValues();
|
IBuildPropertyValue[] vs = bpt.getSupportedValues();
|
||||||
Arrays.sort(vs, BuildListComparator.getInstance());
|
Arrays.sort(vs, BuildListComparator.getInstance());
|
||||||
|
|
||||||
ArrayList items = new ArrayList();
|
ArrayList<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
|
||||||
// new style project types
|
// new style project types
|
||||||
for (int i=0; i<vs.length; i++) {
|
for (int i=0; i<vs.length; i++) {
|
||||||
IToolChain[] tcs = ManagedBuildManager.getExtensionsToolChains(MBSWizardHandler.ARTIFACT, vs[i].getId(), false);
|
IToolChain[] tcs = ManagedBuildManager.getExtensionsToolChains(MBSWizardHandler.ARTIFACT, vs[i].getId(), false);
|
||||||
|
@ -61,10 +60,8 @@ public class ManagedBuildWizard extends AbstractCWizard {
|
||||||
|
|
||||||
// old style project types
|
// old style project types
|
||||||
EntryDescriptor oldsRoot = null;
|
EntryDescriptor oldsRoot = null;
|
||||||
SortedMap sm = ManagedBuildManager.getExtensionProjectTypeMap();
|
SortedMap<String, IProjectType> sm = ManagedBuildManager.getExtensionProjectTypeMap();
|
||||||
Iterator it = sm.keySet().iterator();
|
for (String s : sm.keySet()) {
|
||||||
while(it.hasNext()) {
|
|
||||||
String s = (String)it.next();
|
|
||||||
IProjectType pt = (IProjectType)sm.get(s);
|
IProjectType pt = (IProjectType)sm.get(s);
|
||||||
if (pt.isAbstract() || pt.isSystemObject()) continue;
|
if (pt.isAbstract() || pt.isSystemObject()) continue;
|
||||||
if (supportedOnly && !pt.isSupported()) continue; // not supported
|
if (supportedOnly && !pt.isSupported()) continue; // not supported
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Intel Corporation and others.
|
* Copyright (c) 2007, 2008 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
|
||||||
|
@ -81,6 +81,8 @@ public class STDWizardHandler extends MBSWizardHandler {
|
||||||
mngr.setProjectDescription(project, des);
|
mngr.setProjectDescription(project, des);
|
||||||
|
|
||||||
doPostProcess(project);
|
doPostProcess(project);
|
||||||
|
// process custom pages
|
||||||
|
doCustom();
|
||||||
}
|
}
|
||||||
public boolean canCreateWithoutToolchain() { return true; }
|
public boolean canCreateWithoutToolchain() { return true; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue