mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Toolchain modification page:
- "no toolchain" handling added - conditional page display (if permitted in prefs)
This commit is contained in:
parent
038a5598b4
commit
1b5b9915d0
8 changed files with 80 additions and 31 deletions
|
@ -596,6 +596,8 @@
|
||||||
value="org.eclipse.cdt.managedbuilder.core.managedBuildNature">
|
value="org.eclipse.cdt.managedbuilder.core.managedBuildNature">
|
||||||
</filter>
|
</filter>
|
||||||
<enabledWhen>
|
<enabledWhen>
|
||||||
|
<and>
|
||||||
|
<test property="org.eclipse.cdt.ui.toolEditEnabled" value="" />
|
||||||
<or>
|
<or>
|
||||||
<instanceof value="org.eclipse.core.resources.IProject"/>
|
<instanceof value="org.eclipse.core.resources.IProject"/>
|
||||||
<instanceof value="org.eclipse.cdt.core.model.ICProject"/>
|
<instanceof value="org.eclipse.cdt.core.model.ICProject"/>
|
||||||
|
@ -611,7 +613,8 @@
|
||||||
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
|
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
|
||||||
<test property="org.eclipse.cdt.ui.isSource" value="" />
|
<test property="org.eclipse.cdt.ui.isSource" value="" />
|
||||||
</and>
|
</and>
|
||||||
</or>
|
</or>
|
||||||
|
</and>
|
||||||
</enabledWhen>
|
</enabledWhen>
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
|
@ -31,6 +31,8 @@ import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
||||||
|
|
||||||
|
private static final String NO_TC = Messages.getString("StdProjectTypeHandler.0"); //$NON-NLS-1$
|
||||||
private static final IToolChain[] r_tcs = ManagedBuildManager.getRealToolChains();
|
private static final IToolChain[] r_tcs = ManagedBuildManager.getRealToolChains();
|
||||||
private static final IBuilder[] r_bs = ManagedBuildManager.getRealBuilders();
|
private static final IBuilder[] r_bs = ManagedBuildManager.getRealBuilders();
|
||||||
private static final ITool[] r_tools = ManagedBuildManager.getRealTools();
|
private static final ITool[] r_tools = ManagedBuildManager.getRealTools();
|
||||||
|
@ -39,6 +41,7 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
||||||
private Button b_dispCompatible;
|
private Button b_dispCompatible;
|
||||||
private Combo c_toolchain;
|
private Combo c_toolchain;
|
||||||
private Combo c_builder;
|
private Combo c_builder;
|
||||||
|
private Button button_edit;
|
||||||
|
|
||||||
private IBuilder[] v_bs;
|
private IBuilder[] v_bs;
|
||||||
private IToolChain[] v_tcs;
|
private IToolChain[] v_tcs;
|
||||||
|
@ -51,10 +54,8 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
||||||
public void createControls(Composite parent) {
|
public void createControls(Composite parent) {
|
||||||
super.createControls(parent);
|
super.createControls(parent);
|
||||||
usercomp.setLayout(new GridLayout(2, false));
|
usercomp.setLayout(new GridLayout(2, false));
|
||||||
|
|
||||||
b_dispCompatible = setupCheck(usercomp, Messages.getString("ToolChainEditTab.0"), 2, GridData.BEGINNING); //$NON-NLS-1$
|
b_dispCompatible = setupCheck(usercomp, Messages.getString("ToolChainEditTab.0"), 2, GridData.BEGINNING); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
setupLabel(usercomp, Messages.getString("ToolChainEditTab.1"), 2, GridData.BEGINNING); //$NON-NLS-1$
|
setupLabel(usercomp, Messages.getString("ToolChainEditTab.1"), 2, GridData.BEGINNING); //$NON-NLS-1$
|
||||||
c_toolchain = new Combo(usercomp, SWT.BORDER);
|
c_toolchain = new Combo(usercomp, SWT.BORDER);
|
||||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
@ -64,10 +65,14 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (fi != null) {
|
if (fi != null) {
|
||||||
int x = c_toolchain.getSelectionIndex();
|
int x = c_toolchain.getSelectionIndex();
|
||||||
IToolChain tc = v_tcs[x];
|
|
||||||
if (tc == null) return;
|
|
||||||
try {
|
try {
|
||||||
fi.changeToolChain(tc, ManagedBuildManager.calculateChildId(tc.getId(), null), tc.getUniqueRealName());
|
if (NO_TC.equals(c_toolchain.getItem(x))) {
|
||||||
|
fi.changeToolChain(null, null, null);
|
||||||
|
} else {
|
||||||
|
IToolChain tc = v_tcs[x];
|
||||||
|
if (tc == null) return;
|
||||||
|
fi.changeToolChain(tc, ManagedBuildManager.calculateChildId(tc.getId(), null), tc.getUniqueRealName());
|
||||||
|
}
|
||||||
} catch (BuildException be) {}
|
} catch (BuildException be) {}
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
|
@ -97,13 +102,13 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
||||||
gd.grabExcessHorizontalSpace = true;
|
gd.grabExcessHorizontalSpace = true;
|
||||||
text.setLayoutData(gd);
|
text.setLayoutData(gd);
|
||||||
|
|
||||||
Button b = new Button(g, SWT.PUSH);
|
button_edit = new Button(g, SWT.PUSH);
|
||||||
GridData gdb = new GridData(GridData.VERTICAL_ALIGN_CENTER);
|
GridData gdb = new GridData(GridData.VERTICAL_ALIGN_CENTER);
|
||||||
gdb.grabExcessHorizontalSpace = false;
|
gdb.grabExcessHorizontalSpace = false;
|
||||||
gdb.horizontalAlignment = SWT.FILL;
|
gdb.horizontalAlignment = SWT.FILL;
|
||||||
gdb.widthHint = 80;
|
gdb.widthHint = 80;
|
||||||
b.setLayoutData(gdb);
|
button_edit.setLayoutData(gdb);
|
||||||
b.addSelectionListener(new SelectionAdapter() {
|
button_edit.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
ToolSelectionDialog d = new ToolSelectionDialog(usercomp.getShell());
|
ToolSelectionDialog d = new ToolSelectionDialog(usercomp.getShell());
|
||||||
d.all = v_tools;
|
d.all = v_tools;
|
||||||
|
@ -119,8 +124,8 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
|
|
||||||
b.setLayoutData(new GridData(GridData.END));
|
button_edit.setLayoutData(new GridData(GridData.END));
|
||||||
b.setText(Messages.getString("ToolChainEditTab.4")); //$NON-NLS-1$
|
button_edit.setText(Messages.getString("ToolChainEditTab.4")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
public void updateData(ICResourceDescription rcfg) {
|
public void updateData(ICResourceDescription rcfg) {
|
||||||
cfg = getCfg(rcfg.getConfiguration());
|
cfg = getCfg(rcfg.getConfiguration());
|
||||||
|
@ -137,9 +142,8 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
||||||
v_tools = new ITool[r_tools.length];
|
v_tools = new ITool[r_tools.length];
|
||||||
|
|
||||||
IToolChain tc = null;
|
IToolChain tc = null;
|
||||||
if (fi != null) {
|
if (fi != null)
|
||||||
tc = ManagedBuildManager.getRealToolChain(fi.getToolChain());
|
tc = ManagedBuildManager.getRealToolChain(fi.getToolChain());
|
||||||
}
|
|
||||||
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int pos = -1;
|
int pos = -1;
|
||||||
|
@ -154,10 +158,26 @@ public class ToolChainEditTab extends AbstractCBuildPropertyTab {
|
||||||
if (r_tcs[i].equals(tc)) pos = cnt;
|
if (r_tcs[i].equals(tc)) pos = cnt;
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
if (pos != -1)
|
// "No toolchain" is enabled for Make projects only.
|
||||||
|
if (!cfg.getBuilder().isManagedBuildOn())
|
||||||
|
c_toolchain.add(NO_TC);
|
||||||
|
if (pos != -1) {
|
||||||
c_toolchain.select(pos);
|
c_toolchain.select(pos);
|
||||||
else
|
c_builder.setEnabled(true);
|
||||||
c_toolchain.setText(EMPTY_STR);
|
button_edit.setEnabled(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (cfg.getBuilder().isManagedBuildOn()) {
|
||||||
|
c_toolchain.setText(EMPTY_STR); // unprobable case
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
fi.changeToolChain(null, null, null);
|
||||||
|
} catch (BuildException e) {}
|
||||||
|
c_toolchain.select(c_toolchain.getItemCount() - 1);
|
||||||
|
}
|
||||||
|
c_builder.setEnabled(false);
|
||||||
|
button_edit.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
IBuilder b = ManagedBuildManager.getRealBuilder(cfg.getBuilder());
|
IBuilder b = ManagedBuildManager.getRealBuilder(cfg.getBuilder());
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
|
|
|
@ -1914,14 +1914,26 @@
|
||||||
id="org.eclipse.cdt.Tester1"
|
id="org.eclipse.cdt.Tester1"
|
||||||
class="org.eclipse.cdt.ui.newui.PropertyTester"
|
class="org.eclipse.cdt.ui.newui.PropertyTester"
|
||||||
namespace="org.eclipse.cdt.ui"
|
namespace="org.eclipse.cdt.ui"
|
||||||
properties="isSource"
|
properties="isSource,toolEditEnabled"
|
||||||
type="org.eclipse.cdt.core.model.ITranslationUnit"/>
|
type="org.eclipse.cdt.core.model.ITranslationUnit"/>
|
||||||
<propertyTester
|
<propertyTester
|
||||||
id="org.eclipse.cdt.Tester2"
|
id="org.eclipse.cdt.Tester2"
|
||||||
class="org.eclipse.cdt.ui.newui.PropertyTester"
|
class="org.eclipse.cdt.ui.newui.PropertyTester"
|
||||||
namespace="org.eclipse.cdt.ui"
|
namespace="org.eclipse.cdt.ui"
|
||||||
properties="isSource"
|
properties="isSource,toolEditEnabled"
|
||||||
type="org.eclipse.core.resources.IFile"/>
|
type="org.eclipse.core.resources.IFile"/>
|
||||||
|
<propertyTester
|
||||||
|
id="org.eclipse.cdt.Tester3"
|
||||||
|
class="org.eclipse.cdt.ui.newui.PropertyTester"
|
||||||
|
namespace="org.eclipse.cdt.ui"
|
||||||
|
properties="toolEditEnabled"
|
||||||
|
type="org.eclipse.cdt.core.model.IResource"/>
|
||||||
|
<propertyTester
|
||||||
|
id="org.eclipse.cdt.Tester4"
|
||||||
|
class="org.eclipse.cdt.ui.newui.PropertyTester"
|
||||||
|
namespace="org.eclipse.cdt.ui"
|
||||||
|
properties="toolEditEnabled"
|
||||||
|
type="org.eclipse.cdt.core.model.ICElement"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.exportWizards">
|
point="org.eclipse.ui.exportWizards">
|
||||||
|
|
|
@ -199,7 +199,8 @@ implements
|
||||||
if (!checkElement()) {
|
if (!checkElement()) {
|
||||||
s = UIMessages.getString("AbstractPage.0"); //$NON-NLS-1$
|
s = UIMessages.getString("AbstractPage.0"); //$NON-NLS-1$
|
||||||
} else if (!isApplicable()) {
|
} else if (!isApplicable()) {
|
||||||
s = UIMessages.getString("AbstractPage.1"); //$NON-NLS-1$
|
return null;
|
||||||
|
// s = UIMessages.getString("AbstractPage.1"); //$NON-NLS-1$
|
||||||
} else if (!isCDTProject(getProject())) {
|
} else if (!isCDTProject(getProject())) {
|
||||||
s = UIMessages.getString("AbstractPage.2"); //$NON-NLS-1$
|
s = UIMessages.getString("AbstractPage.2"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class CDTPrefUtil {
|
||||||
public static final String KEY_MULTI = "properties.multi.config.enable"; //$NON-NLS-1$
|
public static final String KEY_MULTI = "properties.multi.config.enable"; //$NON-NLS-1$
|
||||||
public static final String KEY_DTREE = "properties.data.hierarchy.enable"; //$NON-NLS-1$
|
public static final String KEY_DTREE = "properties.data.hierarchy.enable"; //$NON-NLS-1$
|
||||||
public static final String KEY_NOSAVE = "properties.save.position.disable"; //$NON-NLS-1$
|
public static final String KEY_NOSAVE = "properties.save.position.disable"; //$NON-NLS-1$
|
||||||
|
public static final String KEY_TOOLM = "properties.toolchain.modification.enable"; //$NON-NLS-1$
|
||||||
// string keys
|
// string keys
|
||||||
public static final String KEY_PREFTC = "wizard.preferred.toolchains"; //$NON-NLS-1$
|
public static final String KEY_PREFTC = "wizard.preferred.toolchains"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
|
@ -340,6 +340,7 @@ PropertyPageDefsTab.0=Show <Manage configurations> button
|
||||||
PropertyPageDefsTab.1=Display <Data hierarchy> tab
|
PropertyPageDefsTab.1=Display <Data hierarchy> tab
|
||||||
PropertyPageDefsTab.2=Enable multiple configurations setting
|
PropertyPageDefsTab.2=Enable multiple configurations setting
|
||||||
PropertyPageDefsTab.3=Save property dialog size and position
|
PropertyPageDefsTab.3=Save property dialog size and position
|
||||||
|
PropertyPageDefsTab.4=Display <Toolchain modification> tab
|
||||||
ProjectConvert.convertersList=Converters List
|
ProjectConvert.convertersList=Converters List
|
||||||
|
|
||||||
ScannerConfigOptionsDialog.title=Discovery Options
|
ScannerConfigOptionsDialog.title=Discovery Options
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
||||||
private Button show_mul;
|
private Button show_mul;
|
||||||
private Button show_mng;
|
private Button show_mng;
|
||||||
private Button show_sav;
|
private Button show_sav;
|
||||||
|
private Button show_tool;
|
||||||
|
|
||||||
public void createControls(Composite parent) {
|
public void createControls(Composite parent) {
|
||||||
super.createControls(parent);
|
super.createControls(parent);
|
||||||
|
@ -45,12 +46,17 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
||||||
show_sav.setText(UIMessages.getString("PropertyPageDefsTab.3")); //$NON-NLS-1$
|
show_sav.setText(UIMessages.getString("PropertyPageDefsTab.3")); //$NON-NLS-1$
|
||||||
show_sav.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
show_sav.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
|
show_tool = new Button(usercomp, SWT.CHECK);
|
||||||
|
show_tool.setText(UIMessages.getString("PropertyPageDefsTab.4")); //$NON-NLS-1$
|
||||||
|
show_tool.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
show_tree.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_DTREE));
|
show_tree.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_DTREE));
|
||||||
show_mul.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI));
|
show_mul.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI));
|
||||||
show_mng.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG));
|
show_mng.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG));
|
||||||
show_sav.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSAVE));
|
show_sav.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSAVE));
|
||||||
|
show_tool.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_TOOLM));
|
||||||
|
|
||||||
show_mul.setEnabled(false);
|
show_mul.setVisible(false); // temporary
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void performOK() {
|
protected void performOK() {
|
||||||
|
@ -58,12 +64,14 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MULTI, show_mul.getSelection());
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MULTI, show_mul.getSelection());
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, !show_mng.getSelection());
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, !show_mng.getSelection());
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSAVE, !show_sav.getSelection());
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSAVE, !show_sav.getSelection());
|
||||||
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_TOOLM, show_tool.getSelection());
|
||||||
}
|
}
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
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_mng.setSelection(true);
|
||||||
|
show_tool.setSelection(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); }
|
protected void performApply(ICResourceDescription src, ICResourceDescription dst) { performOK(); }
|
||||||
|
|
|
@ -19,20 +19,23 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
* Checks whether given object is a source file.
|
* Checks whether given object is a source file.
|
||||||
*/
|
*/
|
||||||
public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
|
public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
|
||||||
private static final String KEY = "isSource"; //$NON-NLS-1$
|
private static final String KEY_SRC = "isSource"; //$NON-NLS-1$
|
||||||
|
private static final String KEY_TOOL = "toolEditEnabled"; //$NON-NLS-1$
|
||||||
|
|
||||||
public boolean test(Object receiver, String property, Object[] args,
|
public boolean test(Object receiver, String property, Object[] args,
|
||||||
Object expectedValue) {
|
Object expectedValue) {
|
||||||
if (!KEY.equals(property)) return false;
|
if (KEY_SRC.equals(property)) {
|
||||||
|
if (receiver instanceof ITranslationUnit) {
|
||||||
if (receiver instanceof ITranslationUnit) {
|
return ((ITranslationUnit)receiver).isSourceUnit();
|
||||||
return ((ITranslationUnit)receiver).isSourceUnit();
|
}
|
||||||
|
else if (receiver instanceof IFile) {
|
||||||
|
IFile file = (IFile)receiver;
|
||||||
|
return CoreModel.isValidSourceUnitName(file.getProject(), file.getName());
|
||||||
|
}
|
||||||
|
} else if (KEY_TOOL.equals(property)) {
|
||||||
|
return CDTPrefUtil.getBool(CDTPrefUtil.KEY_TOOLM);
|
||||||
}
|
}
|
||||||
else if (receiver instanceof IFile) {
|
return false;
|
||||||
IFile file = (IFile)receiver;
|
|
||||||
return CoreModel.isValidSourceUnitName(file.getProject(), file.getName());
|
|
||||||
}
|
|
||||||
else return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue