mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 20:05:35 +02:00
Bug #187538: Preferred toolchains tab is broken
Bug #187586: Restore Defaults button does not work in Prefs
This commit is contained in:
parent
5e53cb742f
commit
438b0cba56
6 changed files with 45 additions and 23 deletions
|
@ -20,6 +20,8 @@ import org.eclipse.cdt.ui.newui.PageLayout;
|
||||||
import org.eclipse.cdt.ui.newui.UIMessages;
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
||||||
import org.eclipse.cdt.ui.wizards.CWizardHandler;
|
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.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -66,7 +68,7 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
TreeItem[] tis = tree.getSelection();
|
TreeItem[] tis = tree.getSelection();
|
||||||
if (tis == null || tis.length == 0) return;
|
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);
|
right = new Composite(c, SWT.NONE);
|
||||||
|
@ -103,10 +105,12 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (h_selected != null)
|
if (h_selected != null)
|
||||||
h_selected.setSupportedOnly(show_sup.getSelection());
|
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();
|
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) {
|
private void setPref(boolean set) {
|
||||||
|
@ -123,15 +127,30 @@ public class PreferredToolchainsTab extends AbstractCBuildPropertyTab {
|
||||||
h_selected.updatePreferred(CDTPrefUtil.getPreferredTCs());
|
h_selected.updatePreferred(CDTPrefUtil.getPreferredTCs());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchTo(CWizardHandler h) {
|
// private void switchTo(CWizardHandler h) {
|
||||||
if (h == null) return;
|
// 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();
|
if (h_selected != null) h_selected.handleUnSelection();
|
||||||
h_selected = h;
|
h_selected = h;
|
||||||
|
if (h == null) return;
|
||||||
right_label.setText(h_selected.getHeader());
|
right_label.setText(h_selected.getHeader());
|
||||||
h_selected.handleSelection();
|
h_selected.handleSelection();
|
||||||
h_selected.setSupportedOnly(show_sup.getSelection());
|
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void performOK() {
|
protected void performOK() {
|
||||||
CDTPrefUtil.savePreferredTCs();
|
CDTPrefUtil.savePreferredTCs();
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,10 +142,15 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
||||||
show_tree.setSelection(false);
|
show_tree.setSelection(false);
|
||||||
// show_mul.setSelection(false);
|
// show_mul.setSelection(false);
|
||||||
show_mng.setSelection(true);
|
show_mng.setSelection(true);
|
||||||
show_mng.setSelection(true);
|
show_tool.setSelection(true);
|
||||||
show_tool.setSelection(false);
|
|
||||||
show_exp.setSelection(false);
|
show_exp.setSelection(false);
|
||||||
b_0.setSelection(true);
|
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(); }
|
protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); }
|
||||||
|
|
|
@ -241,7 +241,9 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Object ob = tcs.get(tcId);
|
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;
|
return false;
|
||||||
|
|
||||||
String id1 = ((IToolChain)ob).getId();
|
String id1 = ((IToolChain)ob).getId();
|
||||||
|
|
|
@ -492,7 +492,7 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
||||||
if (canBeVisible()) performCancel();
|
if (canBeVisible()) performCancel();
|
||||||
break;
|
break;
|
||||||
case ICPropertyTab.DEFAULTS:
|
case ICPropertyTab.DEFAULTS:
|
||||||
if (canBeVisible() && getResDesc() != null) {
|
if (canBeVisible() /*&& getResDesc() != null*/) {
|
||||||
updateData(getResDesc());
|
updateData(getResDesc());
|
||||||
performDefaults();
|
performDefaults();
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,6 +186,7 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
data[i++] = clone.get(s);
|
data[i++] = clone.get(s);
|
||||||
}
|
}
|
||||||
tv.setInput(data);
|
tv.setInput(data);
|
||||||
|
tv.setAllChecked(false);
|
||||||
// set check marks
|
// set check marks
|
||||||
for (i=0; i<ids.length; i++) {
|
for (i=0; i<ids.length; i++) {
|
||||||
if (configMap.containsKey(ids[i])) {
|
if (configMap.containsKey(ids[i])) {
|
||||||
|
|
|
@ -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 ELEMENT_NAME = "wizard"; //$NON-NLS-1$
|
||||||
private static final String CLASS_NAME = "class"; //$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 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
|
// constants
|
||||||
private static final int SIZING_TEXT_FIELD_WIDTH = 250;
|
private static final int SIZING_TEXT_FIELD_WIDTH = 250;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
createDynamicGroup(composite);
|
createDynamicGroup(composite);
|
||||||
|
|
||||||
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()),
|
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()),
|
||||||
getDescriptor());
|
getDescriptor(tree));
|
||||||
|
|
||||||
setPageComplete(validatePage());
|
setPageComplete(validatePage());
|
||||||
// Show description on opening
|
// Show description on opening
|
||||||
|
@ -161,7 +161,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
if (h_selected != null)
|
if (h_selected != null)
|
||||||
h_selected.setSupportedOnly(show_sup.getSelection());
|
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||||
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()),
|
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()),
|
||||||
getDescriptor());
|
getDescriptor(tree));
|
||||||
}} );
|
}} );
|
||||||
|
|
||||||
// restore settings from preferences
|
// restore settings from preferences
|
||||||
|
@ -539,19 +539,14 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private EntryDescriptor getDescriptor() {
|
public static EntryDescriptor getDescriptor(Tree _tree) {
|
||||||
|
TreeItem[] sel = _tree.getSelection();
|
||||||
TreeItem[] sel = tree.getSelection();
|
|
||||||
|
|
||||||
if (sel == null || sel.length == 0)
|
if (sel == null || sel.length == 0)
|
||||||
|
return null;
|
||||||
return null;
|
else
|
||||||
|
return (EntryDescriptor)sel[0].getData(DESC);
|
||||||
return (EntryDescriptor)sel[0].getData(DESC);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void toolChainListChanged(int count) {
|
public void toolChainListChanged(int count) {
|
||||||
setPageComplete(validatePage());
|
setPageComplete(validatePage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue