mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Discovery tab: save - bugfix
This commit is contained in:
parent
c7cf10ab41
commit
52750d5170
2 changed files with 41 additions and 39 deletions
|
@ -54,11 +54,8 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
|
|
||||||
private static final String NAMESPACE = "org.eclipse.cdt.make.ui"; //$NON-NLS-1$
|
private static final String NAMESPACE = "org.eclipse.cdt.make.ui"; //$NON-NLS-1$
|
||||||
private static final String POINT = "DiscoveryProfilePage"; //$NON-NLS-1$
|
private static final String POINT = "DiscoveryProfilePage"; //$NON-NLS-1$
|
||||||
// private static final String NAMESPACE = "org.eclipse.cdt.managedbuilder.ui"; //$NON-NLS-1$
|
|
||||||
// private static final String POINT = "DiscoveryProfileUI"; //$NON-NLS-1$
|
|
||||||
protected static final String PREFIX = "ScannerConfigOptionsDialog"; //$NON-NLS-1$
|
protected static final String PREFIX = "ScannerConfigOptionsDialog"; //$NON-NLS-1$
|
||||||
private static final String PROFILE_PAGE = "profilePage"; //$NON-NLS-1$
|
private static final String PROFILE_PAGE = "profilePage"; //$NON-NLS-1$
|
||||||
// private static final String PROFILE_PATTERN = "profilePattern"; //$NON-NLS-1$
|
|
||||||
private static final String PROFILE_ID = "profileId"; //$NON-NLS-1$
|
private static final String PROFILE_ID = "profileId"; //$NON-NLS-1$
|
||||||
private static final String PROFILE_NAME = "name"; //$NON-NLS-1$
|
private static final String PROFILE_NAME = "name"; //$NON-NLS-1$
|
||||||
private static final String SC_GROUP_LABEL = PREFIX + ".scGroup.label"; //$NON-NLS-1$
|
private static final String SC_GROUP_LABEL = PREFIX + ".scGroup.label"; //$NON-NLS-1$
|
||||||
|
@ -83,7 +80,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
private IScannerConfigBuilderInfo2 buildInfo;
|
private IScannerConfigBuilderInfo2 buildInfo;
|
||||||
private CfgInfoContext iContext;
|
private CfgInfoContext iContext;
|
||||||
private List pagesList = null;
|
private List pagesList = null;
|
||||||
private List profilesList = null;
|
private List visibleProfilesList = null;
|
||||||
private IPath configPath;
|
private IPath configPath;
|
||||||
private AbstractDiscoveryPage[] realPages;
|
private AbstractDiscoveryPage[] realPages;
|
||||||
protected SashForm sashForm;
|
protected SashForm sashForm;
|
||||||
|
@ -169,7 +166,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
profileComboBox.addSelectionListener(new SelectionAdapter() {
|
profileComboBox.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
int x = profileComboBox.getSelectionIndex();
|
int x = profileComboBox.getSelectionIndex();
|
||||||
String s = (String)profilesList.get(x);
|
String s = (String)visibleProfilesList.get(x);
|
||||||
buildInfo.setSelectedProfileId(s);
|
buildInfo.setSelectedProfileId(s);
|
||||||
handleDiscoveryProfileChanged();
|
handleDiscoveryProfileChanged();
|
||||||
}
|
}
|
||||||
|
@ -254,27 +251,24 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
scProblemReportingEnabledButton.setSelection(buildInfo.isProblemReportingEnabled());
|
scProblemReportingEnabledButton.setSelection(buildInfo.isProblemReportingEnabled());
|
||||||
|
|
||||||
profileComboBox.removeAll();
|
profileComboBox.removeAll();
|
||||||
profilesList = buildInfo.getProfileIdList();
|
List profilesList = buildInfo.getProfileIdList();
|
||||||
|
|
||||||
Collections.sort(profilesList, CDTListComparator.getInstance());
|
Collections.sort(profilesList, CDTListComparator.getInstance());
|
||||||
|
visibleProfilesList = new ArrayList(profilesList.size());
|
||||||
realPages = new AbstractDiscoveryPage[profilesList.size()];
|
realPages = new AbstractDiscoveryPage[profilesList.size()];
|
||||||
Iterator it = profilesList.iterator();
|
Iterator it = profilesList.iterator();
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
String savedId = buildInfo.getSelectedProfileId();
|
String savedId = buildInfo.getSelectedProfileId();
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
String profileId = (String)it.next();
|
String profileId = (String)it.next();
|
||||||
if (!cbi.isProfileSupported(iContext, profileId)) continue;
|
if (!cbi.isProfileSupported(iContext, profileId))
|
||||||
|
continue;
|
||||||
|
visibleProfilesList.add(profileId);
|
||||||
String profileName = getProfileName(profileId);
|
String profileName = getProfileName(profileId);
|
||||||
profileComboBox.add(profileName);
|
profileComboBox.add(profileName);
|
||||||
if (profileId.equals(savedId)) pos = counter;
|
if (profileId.equals(savedId))
|
||||||
|
pos = counter;
|
||||||
buildInfo.setSelectedProfileId(profileId); // needs to create page
|
buildInfo.setSelectedProfileId(profileId); // needs to create page
|
||||||
|
|
||||||
for (Iterator it2 = pagesList.iterator(); it2.hasNext(); ) {
|
for (Iterator it2 = pagesList.iterator(); it2.hasNext(); ) {
|
||||||
DiscoveryProfilePageConfiguration p = (DiscoveryProfilePageConfiguration)it2.next();
|
DiscoveryProfilePageConfiguration p = (DiscoveryProfilePageConfiguration)it2.next();
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
|
@ -290,10 +284,11 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
}
|
}
|
||||||
counter ++;
|
counter ++;
|
||||||
}
|
}
|
||||||
buildInfo.setSelectedProfileId(savedId);
|
buildInfo.setSelectedProfileId(savedId);
|
||||||
if (profileComboBox.getItemCount() > 0) profileComboBox.select(pos);
|
if (profileComboBox.getItemCount() > 0)
|
||||||
enableAllControls();
|
profileComboBox.select(pos);
|
||||||
handleDiscoveryProfileChanged();
|
enableAllControls();
|
||||||
|
handleDiscoveryProfileChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDiscoveryProfileChanged() {
|
private void handleDiscoveryProfileChanged() {
|
||||||
|
@ -361,7 +356,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performApply(ICResourceDescription src,ICResourceDescription dst) {
|
public void performApply(ICResourceDescription src,ICResourceDescription dst) {
|
||||||
ICfgScannerConfigBuilderInfo2Set cbi1 =
|
ICfgScannerConfigBuilderInfo2Set cbi1 =
|
||||||
CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(getCfg(src.getConfiguration()));
|
CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(getCfg(src.getConfiguration()));
|
||||||
ICfgScannerConfigBuilderInfo2Set cbi2 =
|
ICfgScannerConfigBuilderInfo2Set cbi2 =
|
||||||
CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(getCfg(dst.getConfiguration()));
|
CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(getCfg(dst.getConfiguration()));
|
||||||
|
@ -377,14 +372,29 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
try {
|
try {
|
||||||
cbi2.applyInfo(ic, bi1);
|
cbi2.applyInfo(ic, bi1);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// System.out.println(Messages.getString("DiscoveryTab.15") + e.getLocalizedMessage()); //$NON-NLS-1$
|
System.out.println(Messages.getString("DiscoveryTab.15") + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// System.out.println(Messages.getString("DiscoveryTab.16")); //$NON-NLS-1$
|
System.out.println(Messages.getString("DiscoveryTab.16")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void performOK() {
|
||||||
|
if (buildInfo == null)
|
||||||
|
return;
|
||||||
|
String savedId = buildInfo.getSelectedProfileId();
|
||||||
|
for (int i=0; i<realPages.length; i++) {
|
||||||
|
if (realPages != null && realPages[i] != null) {
|
||||||
|
String s = (String)visibleProfilesList.get(i);
|
||||||
|
buildInfo.setSelectedProfileId(s);
|
||||||
|
realPages[i].performApply();
|
||||||
|
realPages[i].setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buildInfo.setSelectedProfileId(savedId);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canBeVisible() {
|
public boolean canBeVisible() {
|
||||||
if (page.isForProject() || page.isForPrefs()) return true;
|
if (page.isForProject() || page.isForPrefs()) return true;
|
||||||
// Hide this page for folders and files
|
// Hide this page for folders and files
|
||||||
|
@ -402,22 +412,6 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
public IProject getProject() { return page.getProject(); }
|
public IProject getProject() { return page.getProject(); }
|
||||||
public ICConfigurationDescription getConfiguration() { return getResDesc().getConfiguration(); }
|
public ICConfigurationDescription getConfiguration() { return getResDesc().getConfiguration(); }
|
||||||
|
|
||||||
protected void performOK() {
|
|
||||||
if (buildInfo == null)
|
|
||||||
return;
|
|
||||||
String savedId = buildInfo.getSelectedProfileId();
|
|
||||||
for (int i=0; i<realPages.length; i++) {
|
|
||||||
if (realPages != null && realPages[i] != null) {
|
|
||||||
String s = (String)profilesList.get(i);
|
|
||||||
buildInfo.setSelectedProfileId(s);
|
|
||||||
realPages[i].performApply();
|
|
||||||
realPages[i].setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buildInfo.setSelectedProfileId(savedId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
cbi.setPerRcTypeDiscovery(true);
|
cbi.setPerRcTypeDiscovery(true);
|
||||||
Iterator it = cbi.getInfoMap().keySet().iterator();
|
Iterator it = cbi.getInfoMap().keySet().iterator();
|
||||||
|
|
|
@ -391,7 +391,9 @@ implements
|
||||||
if (! noContentOnPage && displayedConfig) forEach(ICPropertyTab.DEFAULTS);
|
if (! noContentOnPage && displayedConfig) forEach(ICPropertyTab.DEFAULTS);
|
||||||
}
|
}
|
||||||
public void performApply() { performSave(false); }
|
public void performApply() { performSave(false); }
|
||||||
public boolean performOk() { return performSave(true); }
|
public boolean performOk() {
|
||||||
|
return performSave(true);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* The same code used to perform OK and Apply
|
* The same code used to perform OK and Apply
|
||||||
* @param forOk - true means OK, false - Apply
|
* @param forOk - true means OK, false - Apply
|
||||||
|
@ -410,6 +412,12 @@ implements
|
||||||
// ask all tabs to store changes in cfg
|
// ask all tabs to store changes in cfg
|
||||||
if (finalOk) { // OK
|
if (finalOk) { // OK
|
||||||
saveDone = true;
|
saveDone = true;
|
||||||
|
for (int j=0; j<pages.size(); j++) {
|
||||||
|
AbstractPage ap = (AbstractPage)pages.get(j);
|
||||||
|
if (ap.displayedConfig) {
|
||||||
|
ap.forEach(ICPropertyTab.OK, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
ICConfigurationDescription[] olds = prjd.getConfigurations();
|
ICConfigurationDescription[] olds = prjd.getConfigurations();
|
||||||
for (int i=0; i<olds.length; i++) {
|
for (int i=0; i<olds.length; i++) {
|
||||||
resd = getResDesc(olds[i]);
|
resd = getResDesc(olds[i]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue