1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug #187538: Preferred toolchains tab is broken

Bug #187586: Restore Defaults button does not work in Prefs
This commit is contained in:
Oleg Krasilnikov 2007-05-18 11:58:12 +00:00
parent 5e53cb742f
commit 438b0cba56
6 changed files with 45 additions and 23 deletions

View file

@ -20,6 +20,8 @@ import org.eclipse.cdt.ui.newui.PageLayout;
import org.eclipse.cdt.ui.newui.UIMessages;
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
import org.eclipse.cdt.ui.wizards.CWizardHandler;
import org.eclipse.cdt.ui.wizards.EntryDescriptor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -66,7 +68,7 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
public void widgetSelected(SelectionEvent e) {
TreeItem[] tis = tree.getSelection();
if (tis == null || tis.length == 0) return;
switchTo((CWizardHandler)tis[0].getData());
switchTo((CWizardHandler)tis[0].getData(), (EntryDescriptor)tis[0].getData(CDTMainWizardPage.DESC));
}});
right = new Composite(c, SWT.NONE);
@ -103,10 +105,12 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
public void widgetSelected(SelectionEvent e) {
if (h_selected != null)
h_selected.setSupportedOnly(show_sup.getSelection());
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup, null, null));
}} );
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup, null, null),
CDTMainWizardPage.getDescriptor(tree));
}});
CDTPrefUtil.readPreferredTCs();
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup, null, null));
switchTo(CDTMainWizardPage.updateData(tree, right, show_sup, null, null),
CDTMainWizardPage.getDescriptor(tree));
}
private void setPref(boolean set) {
@ -123,15 +127,30 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
h_selected.updatePreferred(CDTPrefUtil.getPreferredTCs());
}
private void switchTo(CWizardHandler h) {
if (h == null) return;
// private void switchTo(CWizardHandler h) {
// if (h == null) return;
// if (h_selected != null) h_selected.handleUnSelection();
// h_selected = h;
// right_label.setText(h_selected.getHeader());
// h_selected.setSupportedOnly(show_sup.getSelection());
// h_selected.handleSelection();
// }
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());
}
protected void performOK() {
CDTPrefUtil.savePreferredTCs();
}

View file

@ -142,10 +142,15 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
show_tree.setSelection(false);
// show_mul.setSelection(false);
show_mng.setSelection(true);
show_mng.setSelection(true);
show_tool.setSelection(false);
show_tool.setSelection(true);
show_exp.setSelection(false);
b_0.setSelection(true);
b_1.setSelection(false);
b_2.setSelection(false);
b_3.setSelection(false);
s_0.setSelection(true);
s_1.setSelection(false);
s_2.setSelection(false);
}
protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); }

View file

@ -241,7 +241,9 @@ public class MBSWizardHandler extends CWizardHandler {
return true;
Object ob = tcs.get(tcId);
if (ob == null || !(ob instanceof IToolChain))
if (ob == null)
return true; // sic ! This can occur with Other Toolchain only
if (!(ob instanceof IToolChain))
return false;
String id1 = ((IToolChain)ob).getId();

View file

@ -492,7 +492,7 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
if (canBeVisible()) performCancel();
break;
case ICPropertyTab.DEFAULTS:
if (canBeVisible() && getResDesc() != null) {
if (canBeVisible() /*&& getResDesc() != null*/) {
updateData(getResDesc());
performDefaults();
}

View file

@ -186,6 +186,7 @@ public class BinaryParsTab extends AbstractCPropertyTab {
data[i++] = clone.get(s);
}
tv.setInput(data);
tv.setAllChecked(false);
// set check marks
for (i=0; i<ids.length; i++) {
if (configMap.containsKey(ids[i])) {

View file

@ -62,7 +62,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
private static final String ELEMENT_NAME = "wizard"; //$NON-NLS-1$
private static final String CLASS_NAME = "class"; //$NON-NLS-1$
private static final String HELP_CTX = "org.eclipse.ui.ide.new_project_wizard_page_context"; //$NON-NLS-1$
private static final String DESC = "EntryDescriptor"; //$NON-NLS-1$
public static final String DESC = "EntryDescriptor"; //$NON-NLS-1$
// constants
private static final int SIZING_TEXT_FIELD_WIDTH = 250;
@ -114,7 +114,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
createDynamicGroup(composite);
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()),
getDescriptor());
getDescriptor(tree));
setPageComplete(validatePage());
// Show description on opening
@ -161,7 +161,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
if (h_selected != null)
h_selected.setSupportedOnly(show_sup.getSelection());
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()),
getDescriptor());
getDescriptor(tree));
}} );
// restore settings from preferences
@ -539,18 +539,13 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
}
private EntryDescriptor getDescriptor() {
TreeItem[] sel = tree.getSelection();
public static EntryDescriptor getDescriptor(Tree _tree) {
TreeItem[] sel = _tree.getSelection();
if (sel == null || sel.length == 0)
return null;
return (EntryDescriptor)sel[0].getData(DESC);
return null;
else
return (EntryDescriptor)sel[0].getData(DESC);
}
public void toolChainListChanged(int count) {
setPageComplete(validatePage());