mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug # 192810 : selected configurations not saved when changing page
This commit is contained in:
parent
14398ec364
commit
27051c284a
3 changed files with 31 additions and 15 deletions
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
@ -72,6 +73,7 @@ public class CDTConfigWizardPage extends WizardPage {
|
||||||
public boolean isVisible = false;
|
public boolean isVisible = false;
|
||||||
private MBSWizardHandler handler;
|
private MBSWizardHandler handler;
|
||||||
public boolean pagesLoaded = false;
|
public boolean pagesLoaded = false;
|
||||||
|
private IToolChain[] visitedTCs = null;
|
||||||
|
|
||||||
public CDTConfigWizardPage(MBSWizardHandler h) {
|
public CDTConfigWizardPage(MBSWizardHandler h) {
|
||||||
super(UIMessages.getString("CDTConfigWizardPage.0")); //$NON-NLS-1$
|
super(UIMessages.getString("CDTConfigWizardPage.0")); //$NON-NLS-1$
|
||||||
|
@ -232,6 +234,21 @@ public class CDTConfigWizardPage extends WizardPage {
|
||||||
return (CfgHolder[])out.toArray(new CfgHolder[out.size()]);
|
return (CfgHolder[])out.toArray(new CfgHolder[out.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether we've already worked with
|
||||||
|
* given set of selected toolchains
|
||||||
|
*
|
||||||
|
* @return true if toolchain(s) is the same as before
|
||||||
|
*/
|
||||||
|
private boolean isVisited() {
|
||||||
|
if (table == null || handler == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return Arrays.equals(
|
||||||
|
handler.getSelectedToolChains(),
|
||||||
|
visitedTCs);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this page's controls currently all contain valid
|
* Returns whether this page's controls currently all contain valid
|
||||||
* values.
|
* values.
|
||||||
|
@ -240,7 +257,8 @@ public class CDTConfigWizardPage extends WizardPage {
|
||||||
* <code>false</code> if at least one is invalid
|
* <code>false</code> if at least one is invalid
|
||||||
*/
|
*/
|
||||||
public boolean isCustomPageComplete() {
|
public boolean isCustomPageComplete() {
|
||||||
if (!isVisible) return true;
|
if (!isVisited())
|
||||||
|
return true;
|
||||||
|
|
||||||
if (table.getItemCount() == 0) {
|
if (table.getItemCount() == 0) {
|
||||||
errorMessage = UIMessages.getString("CConfigWizardPage.10"); //$NON-NLS-1$
|
errorMessage = UIMessages.getString("CConfigWizardPage.10"); //$NON-NLS-1$
|
||||||
|
@ -262,16 +280,16 @@ public class CDTConfigWizardPage extends WizardPage {
|
||||||
*/
|
*/
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible) {
|
||||||
isVisible = visible;
|
isVisible = visible;
|
||||||
if (visible && handler != null) {
|
if (visible && handler != null && !isVisited()) {
|
||||||
tv.setInput(CfgHolder.unique(getDefaultCfgs(handler)));
|
tv.setInput(CfgHolder.unique(getDefaultCfgs(handler)));
|
||||||
tv.setAllChecked(true);
|
tv.setAllChecked(true);
|
||||||
String s = EMPTY_STR;
|
String s = EMPTY_STR;
|
||||||
IToolChain[] tc = handler.getSelectedToolChains();
|
visitedTCs = handler.getSelectedToolChains();
|
||||||
for (int i=0; i < tc.length; i++) {
|
for (int i=0; i < visitedTCs.length; i++) {
|
||||||
s = s + ((tc[i] == null) ?
|
s = s + ((visitedTCs[i] == null) ?
|
||||||
"" : //$NON-NLS-1$
|
"" : //$NON-NLS-1$
|
||||||
tc[i].getUniqueRealName());
|
visitedTCs[i].getUniqueRealName());
|
||||||
if (i < tc.length - 1) s = s + "\n"; //$NON-NLS-1$
|
if (i < visitedTCs.length - 1) s = s + "\n"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
l_chains.setText(s);
|
l_chains.setText(s);
|
||||||
l_projtype.setText(handler.getName());
|
l_projtype.setText(handler.getName());
|
||||||
|
|
|
@ -203,7 +203,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
return followingPage;
|
return followingPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canFinish(IWizardPage predatingPage, IWizardPage followingPage){
|
private boolean canFinish(IWizardPage predatingPage, IWizardPage followingPage){
|
||||||
getNextPage(predatingPage, followingPage);
|
getNextPage(predatingPage, followingPage);
|
||||||
for(int i = 0; i < templatePages.length; i++){
|
for(int i = 0; i < templatePages.length; i++){
|
||||||
if(!templatePages[i].isPageComplete())
|
if(!templatePages[i].isPageComplete())
|
||||||
|
@ -488,10 +488,6 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
|
|
||||||
public IWizardPage getSpecificPage() {
|
public IWizardPage getSpecificPage() {
|
||||||
return entryInfo.getNextPage(getStartingPage(), getConfigPage());
|
return entryInfo.getNextPage(getStartingPage(), getConfigPage());
|
||||||
// if (fConfigPage == null) {
|
|
||||||
// fConfigPage = new CDTConfigWizardPage(this);
|
|
||||||
// }
|
|
||||||
// return fConfigPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -569,8 +565,6 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
TableItem[] tis = table.getSelection();
|
TableItem[] tis = table.getSelection();
|
||||||
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())
|
|
||||||
return Messages.getString("MBSWizardHandler.1"); //$NON-NLS-1$
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,7 +647,10 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
if(entryInfo == null)
|
if(entryInfo == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!entryInfo.canFinish(getStartingPage(), getConfigPage()))
|
if (!getConfigPage().isCustomPageComplete())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(!entryInfo.canFinish(startingPage, getConfigPage()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return super.canFinich();
|
return super.canFinich();
|
||||||
|
|
|
@ -565,6 +565,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
|
||||||
public void toolChainListChanged(int count) {
|
public void toolChainListChanged(int count) {
|
||||||
setPageComplete(validatePage());
|
setPageComplete(validatePage());
|
||||||
|
getWizard().getContainer().updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCurrent() { return isCurrentPage(); }
|
public boolean isCurrent() { return isCurrentPage(); }
|
||||||
|
|
Loading…
Add table
Reference in a new issue