mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug #216399 : Implement 3-state checkboxes in Property pages for Multi-config edit
This commit is contained in:
parent
eaea3167f8
commit
80b06c257f
13 changed files with 284 additions and 317 deletions
|
@ -1102,7 +1102,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
try {
|
||||
// Request a value change and set dirty if real change results
|
||||
retOpt = resConfig.setOption(holder, option, value);
|
||||
if (retOpt.getValueHandler().handleValue(
|
||||
if (retOpt != null && retOpt.getValueHandler().handleValue(
|
||||
resConfig,
|
||||
holder,
|
||||
retOpt,
|
||||
|
|
|
@ -55,10 +55,16 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
private static final String[] EMPTY_STR_ARRAY = new String[0];
|
||||
|
||||
protected IConfiguration[] fCfgs = null;
|
||||
private int curr = 0;
|
||||
|
||||
public MultiConfiguration(IConfiguration[] cfs, int mode) {
|
||||
fCfgs = cfs;
|
||||
setStringListMode(mode);
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
if (((Configuration)fCfgs[i]).getConfigurationDescription().isActive()) {
|
||||
curr = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public MultiConfiguration(ICConfigurationDescription[] cfds, int mode) {
|
||||
|
@ -91,8 +97,8 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#calculateTargetTool()
|
||||
*/
|
||||
public ITool calculateTargetTool() {
|
||||
System.out.println("Bad multi access: MultiConfiguration.calculateTargetTool()"); //$NON-NLS-1$
|
||||
return null;
|
||||
System.out.println("Strange multi access: MultiConfiguration.calculateTargetTool()"); //$NON-NLS-1$
|
||||
return curr().calculateTargetTool();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -107,16 +113,16 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createFileInfo(org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IFileInfo createFileInfo(IPath path) {
|
||||
System.out.println("Bad multi access: MultiConfiguration.createFileInfo(1)"); //$NON-NLS-1$
|
||||
return null; // curr().createFileInfo(path);
|
||||
System.out.println("Strange multi access: MultiConfiguration.createFileInfo(1)"); //$NON-NLS-1$
|
||||
return curr().createFileInfo(path);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createFileInfo(org.eclipse.core.runtime.IPath, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public IFileInfo createFileInfo(IPath path, String id, String name) {
|
||||
System.out.println("Bad multi access: MultiConfiguration.createFileInfo(3)"); //$NON-NLS-1$
|
||||
return null; // curr().createFileInfo(path, id, name);
|
||||
System.out.println("Strange multi access: MultiConfiguration.createFileInfo(3)"); //$NON-NLS-1$
|
||||
return curr().createFileInfo(path, id, name);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -183,11 +189,24 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#generateToolCommandLineInfo(java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String[], org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath)
|
||||
*/
|
||||
public IManagedCommandLineInfo generateToolCommandLineInfo(
|
||||
String sourceExtension, String[] flags, String outputFlag,
|
||||
String outputPrefix, String outputName, String[] inputResources,
|
||||
IPath inputLocation, IPath outputLocation) {
|
||||
System.out.println("Bad multi access: MultiConfiguration.generateToolCommandLineInfo()"); //$NON-NLS-1$
|
||||
return null;
|
||||
String sourceExtension,
|
||||
String[] flags,
|
||||
String outputFlag,
|
||||
String outputPrefix,
|
||||
String outputName,
|
||||
String[] inputResources,
|
||||
IPath inputLocation,
|
||||
IPath outputLocation) {
|
||||
System.out.println("Strange multi access: MultiConfiguration.generateToolCommandLineInfo()"); //$NON-NLS-1$
|
||||
return curr().generateToolCommandLineInfo(
|
||||
sourceExtension,
|
||||
flags,
|
||||
outputFlag,
|
||||
outputPrefix,
|
||||
outputName,
|
||||
inputResources,
|
||||
inputLocation,
|
||||
outputLocation);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -330,7 +349,6 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getEditableBuilder()
|
||||
*/
|
||||
public IBuilder getEditableBuilder() {
|
||||
System.out.println("Strange multi access: MultiConfiguration.getEditableBuilder()"); //$NON-NLS-1$
|
||||
return curr().getEditableBuilder();
|
||||
}
|
||||
|
||||
|
@ -378,8 +396,24 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getFilteredTools()
|
||||
*/
|
||||
public ITool[] getFilteredTools() {
|
||||
System.out.println("Strange multi access: MultiConfiguration.getFilteredTools()"); //$NON-NLS-1$
|
||||
return new ITool[0];
|
||||
ITool[] ts = curr().getFilteredTools();
|
||||
/*
|
||||
ITool[] ms = new ITool[ts.length];
|
||||
for (int i=0; i<ts.length; i++) {
|
||||
ArrayList lst = new ArrayList(fCfgs.length);
|
||||
String ext = ts[i].getDefaultInputExtension();
|
||||
for (int j=0; j<fCfgs.length; j++) {
|
||||
ITool t = fCfgs[j].getToolFromInputExtension(ext);
|
||||
if (t != null)
|
||||
lst.add(t);
|
||||
}
|
||||
if (lst.size() > 1)
|
||||
ms[i] = (ITool)new MultiTool(lst, curr);
|
||||
else
|
||||
ms[i] = ts[i];
|
||||
}
|
||||
*/
|
||||
return ts;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -551,7 +585,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
IResourceInfo ris[] = new IResourceInfo[fCfgs.length];
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
ris[i] = fCfgs[i].getResourceInfo(path, exactPath);
|
||||
return new MultiResourceInfo(ris);
|
||||
return new MultiResourceInfo(ris, this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -581,79 +615,77 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
IFolderInfo ris[] = new IFolderInfo[fCfgs.length];
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
ris[i] = fCfgs[i].getRootFolderInfo();
|
||||
return new MultiFolderInfo(ris);
|
||||
return new MultiFolderInfo(ris, this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getSourceEntries()
|
||||
*/
|
||||
public ICSourceEntry[] getSourceEntries() {
|
||||
System.out.println("Bad multi access: MultiConfiguration.getSourceEntries()"); //$NON-NLS-1$
|
||||
return new ICSourceEntry[0];
|
||||
System.out.println("Strange multi access: MultiConfiguration.getSourceEntries()"); //$NON-NLS-1$
|
||||
return curr().getSourceEntries();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTargetTool()
|
||||
*/
|
||||
public ITool getTargetTool() {
|
||||
System.out.println("Bad multi access: MultiConfiguration.getTargetTool()"); //$NON-NLS-1$
|
||||
return null;
|
||||
System.out.println("Strange multi access: MultiConfiguration.getTargetTool()"); //$NON-NLS-1$
|
||||
return curr().getTargetTool();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTool(java.lang.String)
|
||||
*/
|
||||
public ITool getTool(String id) {
|
||||
System.out.println("Bad multi access: MultiConfiguration.getTool()"); //$NON-NLS-1$
|
||||
return null;
|
||||
System.out.println("Strange multi access: MultiConfiguration.getTool()"); //$NON-NLS-1$
|
||||
return curr().getTool(id);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolChain()
|
||||
*/
|
||||
public IToolChain getToolChain() {
|
||||
System.out.println("Bad multi access: MultiConfiguration.getToolChain()"); //$NON-NLS-1$
|
||||
return null;
|
||||
return curr().getToolChain();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolCommand(org.eclipse.cdt.managedbuilder.core.ITool)
|
||||
*/
|
||||
public String getToolCommand(ITool tool) {
|
||||
System.out.println("Strange multi access: MultiConfiguration.getToolCommand()"); //$NON-NLS-1$
|
||||
return EMPTY_STR;
|
||||
return curr().getToolCommand(tool);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolFromInputExtension(java.lang.String)
|
||||
*/
|
||||
public ITool getToolFromInputExtension(String sourceExtension) {
|
||||
System.out.println("Bad multi access: MultiConfiguration.getToolFromInputExtension()"); //$NON-NLS-1$
|
||||
return null;
|
||||
System.out.println("Strange multi access: MultiConfiguration.getToolFromInputExtension()"); //$NON-NLS-1$
|
||||
return curr().getToolFromInputExtension(sourceExtension);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolFromOutputExtension(java.lang.String)
|
||||
*/
|
||||
public ITool getToolFromOutputExtension(String extension) {
|
||||
System.out.println("Bad multi access: MultiConfiguration.getToolFromOutputExtension()"); //$NON-NLS-1$
|
||||
return null;
|
||||
System.out.println("Strange multi access: MultiConfiguration.getToolFromOutputExtension()"); //$NON-NLS-1$
|
||||
return curr().getToolFromOutputExtension(extension);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTools()
|
||||
*/
|
||||
public ITool[] getTools() {
|
||||
System.out.println("Bad multi access: MultiConfiguration.getTools()"); //$NON-NLS-1$
|
||||
return new ITool[0];
|
||||
System.out.println("Strange multi access: MultiConfiguration.getTools()"); //$NON-NLS-1$
|
||||
return curr().getTools();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolsBySuperClassId(java.lang.String)
|
||||
*/
|
||||
public ITool[] getToolsBySuperClassId(String id) {
|
||||
System.out.println("Bad multi access: MultiConfiguration.getToolsBySuperClassId()"); //$NON-NLS-1$
|
||||
return new ITool[0];
|
||||
System.out.println("Strange multi access: MultiConfiguration.getToolsBySuperClassId()"); //$NON-NLS-1$
|
||||
return curr().getToolsBySuperClassId(id);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -661,7 +693,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
*/
|
||||
public String[] getUserObjects(String extension) {
|
||||
System.out.println("Strange multi access: MultiConfiguration.getUserObjects()"); //$NON-NLS-1$
|
||||
return EMPTY_STR_ARRAY;
|
||||
return curr().getUserObjects(extension);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -884,9 +916,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setName(java.lang.String)
|
||||
*/
|
||||
public void setName(String name) {
|
||||
System.out.println("Bad multi access: MultiConfiguration.setName()"); //$NON-NLS-1$
|
||||
}
|
||||
public void setName(String name) {} // do nothing
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setOption(org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption, boolean)
|
||||
|
@ -1028,9 +1058,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#setVersion(org.eclipse.core.runtime.PluginVersionIdentifier)
|
||||
*/
|
||||
public void setVersion(PluginVersionIdentifier version) {
|
||||
System.out.println("Strange multi access: MultiConfiguration.setVersion()"); //$NON-NLS-1$
|
||||
}
|
||||
public void setVersion(PluginVersionIdentifier version) {} // do nothing
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IBuildObjectPropertiesContainer#getBuildProperties()
|
||||
|
@ -1050,7 +1078,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
return true; // all cfgs report true
|
||||
}
|
||||
|
||||
public void setParallelDef(boolean def) {
|
||||
public void setParallelDef(boolean def) {
|
||||
for (int i=0; i<fCfgs.length; i++)
|
||||
if (fCfgs[i] instanceof Configuration)
|
||||
((Configuration)fCfgs[i]).setParallelDef(def);
|
||||
|
@ -1117,7 +1145,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
* @return
|
||||
*/
|
||||
private IConfiguration curr() {
|
||||
return fCfgs[0];
|
||||
return fCfgs[curr];
|
||||
}
|
||||
|
||||
public String getToolOutputPrefix() {
|
||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
|||
|
||||
import org.eclipse.cdt.core.settings.model.extension.CFolderData;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IModificationStatus;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
|
@ -25,8 +26,8 @@ import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
|||
*/
|
||||
public class MultiFolderInfo extends MultiResourceInfo implements IFolderInfo {
|
||||
|
||||
public MultiFolderInfo(IFolderInfo[] ris) {
|
||||
super(ris);
|
||||
public MultiFolderInfo(IFolderInfo[] ris, IConfiguration p) {
|
||||
super(ris, p);
|
||||
fRis = ris;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,9 +39,11 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
|||
|
||||
protected IResourceInfo[] fRis = null;
|
||||
private int activeCfg = 0;
|
||||
IConfiguration parent = null;
|
||||
|
||||
public MultiResourceInfo(IResourceInfo[] ris) {
|
||||
public MultiResourceInfo(IResourceInfo[] ris, IConfiguration _parent) {
|
||||
fRis = ris;
|
||||
parent = _parent;
|
||||
for (int i=0; i<fRis.length; i++) {
|
||||
if (! (fRis[i].getParent() instanceof Configuration))
|
||||
continue;
|
||||
|
@ -81,7 +83,7 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IResourceInfo#getParent()
|
||||
*/
|
||||
public IConfiguration getParent() {
|
||||
return fRis[activeCfg].getParent();
|
||||
return parent;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -223,6 +225,7 @@ public class MultiResourceInfo extends MultiItemsHolder implements
|
|||
throws BuildException {
|
||||
IOption op = null;
|
||||
String ext = parent instanceof ITool ? ((ITool)parent).getDefaultInputExtension() : null;
|
||||
|
||||
String sid = getSuperClassId(option);
|
||||
for (int i=0; i<fRis.length; i++) {
|
||||
ITool[] ts = fRis[i].getTools();
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
|||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
|
@ -34,7 +35,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
|
|||
private static final Color BLUE = CUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_BLUE);
|
||||
|
||||
private Button enable_multi;
|
||||
private Button enable_3state;
|
||||
private Group dGrp;
|
||||
private Group wGrp;
|
||||
private Button d_0;
|
||||
|
@ -52,25 +52,21 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
|
|||
usercomp.setLayout(g);
|
||||
|
||||
Label l = new Label(usercomp, SWT.CENTER | SWT.BORDER);
|
||||
l.setText("* This functionality is experimental *");
|
||||
l.setText(UIMessages.getString("PropertyMultiCfgTab.0")); //$NON-NLS-1$
|
||||
l.setForeground(RED);
|
||||
l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
|
||||
|
||||
enable_multi = new Button(usercomp, SWT.CHECK);
|
||||
enable_multi.setText("Enable multiple configurations setting");
|
||||
enable_multi.setText(UIMessages.getString("PropertyMultiCfgTab.1")); //$NON-NLS-1$
|
||||
enable_multi.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
enable_multi.addSelectionListener(new SelectionAdapter () {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
setStates();
|
||||
}});
|
||||
|
||||
enable_3state = new Button(usercomp, SWT.CHECK);
|
||||
enable_3state.setText("Use 3-state checkboxes where possible");
|
||||
enable_3state.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
dGrp = new Group(usercomp, SWT.NONE);
|
||||
dGrp.setText("String list Display mode");
|
||||
dGrp.setText(UIMessages.getString("PropertyMultiCfgTab.3")); //$NON-NLS-1$
|
||||
dGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
FillLayout fl = new FillLayout(SWT.VERTICAL);
|
||||
fl.spacing = SPACING;
|
||||
|
@ -79,18 +75,18 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
|
|||
|
||||
l = new Label(dGrp, SWT.WRAP | SWT.CENTER);
|
||||
l.setText(
|
||||
"Define how string lists from different configurations\nshould be combined for display, when lists are not equal"
|
||||
UIMessages.getString("PropertyMultiCfgTab.4") //$NON-NLS-1$
|
||||
);
|
||||
l.setForeground(BLUE);
|
||||
d_0 = new Button(dGrp, SWT.RADIO);
|
||||
d_0.setText("Show empty list");
|
||||
d_0.setText(UIMessages.getString("PropertyMultiCfgTab.5")); //$NON-NLS-1$
|
||||
d_1 = new Button(dGrp, SWT.RADIO);
|
||||
d_1.setText("Show common elements (conjunction)");
|
||||
d_1.setText(UIMessages.getString("PropertyMultiCfgTab.6")); //$NON-NLS-1$
|
||||
d_2 = new Button(dGrp, SWT.RADIO);
|
||||
d_2.setText("Show all elements except doubles (disjunction)");
|
||||
d_2.setText(UIMessages.getString("PropertyMultiCfgTab.7")); //$NON-NLS-1$
|
||||
|
||||
wGrp = new Group(usercomp, SWT.NONE);
|
||||
wGrp.setText("String list Write mode");
|
||||
wGrp.setText(UIMessages.getString("PropertyMultiCfgTab.8")); //$NON-NLS-1$
|
||||
wGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
fl = new FillLayout(SWT.VERTICAL);
|
||||
fl.spacing = SPACING;
|
||||
|
@ -99,16 +95,15 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
|
|||
|
||||
l = new Label(wGrp, SWT.WRAP | SWT.CENTER);
|
||||
l.setText(
|
||||
"Define how to save changes in string lists \nfor different configurations"
|
||||
UIMessages.getString("PropertyMultiCfgTab.9") //$NON-NLS-1$
|
||||
);
|
||||
l.setForeground(BLUE);
|
||||
w_0 = new Button(wGrp, SWT.RADIO);
|
||||
w_0.setText("Add/remove/change affected elements, do not touch others");
|
||||
w_0.setText(UIMessages.getString("PropertyMultiCfgTab.10")); //$NON-NLS-1$
|
||||
w_1 = new Button(wGrp, SWT.RADIO);
|
||||
w_1.setText("Replace existing string lists with string list shown to user");
|
||||
w_1.setText(UIMessages.getString("PropertyMultiCfgTab.11")); //$NON-NLS-1$
|
||||
|
||||
enable_multi.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI));
|
||||
enable_3state.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_3STATE));
|
||||
|
||||
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DMODE)) {
|
||||
case CDTPrefUtil.DMODE_EMPTY: d_0.setSelection(true); break;
|
||||
|
@ -128,7 +123,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
|
|||
|
||||
protected void performOK() {
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_MULTI, enable_multi.getSelection());
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_3STATE,enable_3state.getSelection());
|
||||
int x = 0;
|
||||
if (d_0.getSelection())
|
||||
x = CDTPrefUtil.DMODE_EMPTY;
|
||||
|
@ -147,7 +141,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
|
|||
|
||||
protected void performDefaults() {
|
||||
enable_multi.setSelection(false);
|
||||
enable_3state.setSelection(false);
|
||||
d_0.setSelection(false);
|
||||
d_1.setSelection(true);
|
||||
d_2.setSelection(false);
|
||||
|
@ -157,7 +150,6 @@ public class PropertyMultiCfgTab extends AbstractCPropertyTab {
|
|||
|
||||
private void setStates() {
|
||||
boolean b = enable_multi.getSelection();
|
||||
enable_3state.setEnabled(b);
|
||||
d_0.setEnabled(b);
|
||||
d_1.setEnabled(b);
|
||||
d_2.setEnabled(b);
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.eclipse.cdt.newmake.core.IMakeBuilderInfo;
|
|||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.cdt.ui.newui.ICPropertyProvider;
|
||||
import org.eclipse.cdt.ui.newui.TriButton;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||
|
@ -45,11 +44,11 @@ import org.eclipse.swt.widgets.Widget;
|
|||
|
||||
public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
||||
|
||||
private static int TRI_STATES_SIZE = 4;
|
||||
private static final int TRI_STATES_SIZE = 4;
|
||||
// Widgets
|
||||
//3
|
||||
private TriButton b_stopOnError;
|
||||
private TriButton b_parallel;
|
||||
private Button b_stopOnError;
|
||||
private Button b_parallel;
|
||||
|
||||
private Button b_parallelOpt;
|
||||
private Button b_parallelNum;
|
||||
|
@ -91,7 +90,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
gl.marginHeight = 0;
|
||||
c1.setLayout(gl);
|
||||
|
||||
b_stopOnError = setupTri(c1, Messages.getString("BuilderSettingsTab.10"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
b_stopOnError = setupCheck(c1, Messages.getString("BuilderSettingsTab.10"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
|
||||
Composite c2 = new Composite(g3, SWT.NONE);
|
||||
setupControl(c2, 1, GridData.FILL_BOTH);
|
||||
|
@ -101,7 +100,7 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
gl.marginHeight = 0;
|
||||
c2.setLayout(gl);
|
||||
|
||||
b_parallel = setupTri(c2, Messages.getString("BuilderSettingsTab.11"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
b_parallel = setupCheck(c2, Messages.getString("BuilderSettingsTab.11"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
|
||||
Composite c3 = new Composite(g3, SWT.NONE);
|
||||
setupControl(c3, 1, GridData.FILL_BOTH);
|
||||
|
@ -189,11 +188,10 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
* 3: cfg.getInternalBuilderParallel()
|
||||
*/
|
||||
static int[] calc3states(ICPropertyProvider p,
|
||||
TriButton b3,
|
||||
Button b3,
|
||||
IConfiguration c,
|
||||
boolean p0) {
|
||||
if (p.isMultiCfg() &&
|
||||
b3.in3mode() &&
|
||||
c instanceof ICMultiItemsHolder)
|
||||
{
|
||||
IConfiguration[] cfs = (IConfiguration[])((ICMultiItemsHolder)c).getItems();
|
||||
|
@ -208,22 +206,22 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
((Configuration)cfs[0]).getInternalBuilderParallel();
|
||||
for (int i=1; i<cfs.length; i++) {
|
||||
b = cfs[i].getEditableBuilder();
|
||||
if (res[0] != TriButton.UNKNOWN &&
|
||||
if (res[0] != TRI_UNKNOWN &&
|
||||
x[0] != (p0) ? b.isManagedBuildOn() : b.isStopOnError())
|
||||
res[0] = TriButton.UNKNOWN;
|
||||
if (res[1] != TriButton.UNKNOWN &&
|
||||
res[0] = TRI_UNKNOWN;
|
||||
if (res[1] != TRI_UNKNOWN &&
|
||||
x[1] != (p0) ? b.isDefaultBuildCmd() : b.supportsStopOnError(true))
|
||||
res[1] = TriButton.UNKNOWN;
|
||||
if (res[2] != TriButton.UNKNOWN &&
|
||||
res[1] = TRI_UNKNOWN;
|
||||
if (res[2] != TRI_UNKNOWN &&
|
||||
x[2] != (p0) ? b.canKeepEnvironmentVariablesInBuildfile() : b.supportsStopOnError(false))
|
||||
res[2] = TriButton.UNKNOWN;
|
||||
if (res[3] != TriButton.UNKNOWN &&
|
||||
res[2] = TRI_UNKNOWN;
|
||||
if (res[3] != TRI_UNKNOWN &&
|
||||
x[3] != (p0) ? b.keepEnvironmentVariablesInBuildfile() : ((Configuration)cfs[i]).getInternalBuilderParallel())
|
||||
res[3] = TriButton.UNKNOWN;
|
||||
res[3] = TRI_UNKNOWN;
|
||||
}
|
||||
for (int i=0; i<TRI_STATES_SIZE; i++) {
|
||||
if (res[i] != TriButton.UNKNOWN)
|
||||
res[i] = x[i] ? TriButton.YES : TriButton.NO;
|
||||
if (res[i] != TRI_UNKNOWN)
|
||||
res[i] = x[i] ? TRI_YES : TRI_NO;
|
||||
}
|
||||
return res;
|
||||
} else
|
||||
|
@ -239,21 +237,21 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
int[] extStates = calc3states(page, b_stopOnError, icfg, false);
|
||||
|
||||
if (extStates != null) {
|
||||
b_stopOnError.setTriSelection(extStates[0]);
|
||||
setTriSelection(b_stopOnError, extStates[0]);
|
||||
b_stopOnError.setEnabled(
|
||||
extStates[1] == TriButton.YES &&
|
||||
extStates[2] == TriButton.YES);
|
||||
extStates[1] == TRI_YES &&
|
||||
extStates[2] == TRI_YES);
|
||||
} else {
|
||||
b_stopOnError.setSelection(bldr.isStopOnError());
|
||||
setTriSelection(b_stopOnError, bldr.isStopOnError() ? TRI_YES : TRI_NO);
|
||||
b_stopOnError.setEnabled(
|
||||
bldr.supportsStopOnError(true) &&
|
||||
bldr.supportsStopOnError(false));
|
||||
}
|
||||
// parallel
|
||||
if (extStates == null) // no extended states
|
||||
b_parallel.setSelection(getInternalBuilderParallel());
|
||||
setTriSelection(b_parallel, getInternalBuilderParallel() ? TRI_YES : TRI_NO);
|
||||
else
|
||||
b_parallel.setTriSelection(extStates[3]);
|
||||
setTriSelection(b_parallel, extStates[3]);
|
||||
|
||||
b_parallelOpt.setSelection(getParallelDef());
|
||||
b_parallelNum.setSelection(!getParallelDef());
|
||||
|
@ -334,7 +332,6 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
|||
|
||||
boolean val = false;
|
||||
if (b instanceof Button) val = ((Button)b).getSelection();
|
||||
else if (b instanceof TriButton) val = ((TriButton)b).getSelection();
|
||||
|
||||
if (b.getData() instanceof Text) {
|
||||
Text t = (Text)b.getData();
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.ui.properties;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -18,6 +19,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
|
@ -27,7 +29,9 @@ import org.eclipse.cdt.managedbuilder.core.IOption;
|
|||
import org.eclipse.cdt.managedbuilder.core.IOptionApplicability;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.MultiResourceInfo;
|
||||
import org.eclipse.cdt.ui.newui.AbstractPage;
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.DirectoryFieldEditor;
|
||||
|
@ -38,6 +42,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
|
|||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
|
@ -45,6 +50,8 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
private Map fieldsMap = new HashMap();
|
||||
private IOptionCategory category;
|
||||
private IHoldsOptions optionHolder;
|
||||
private IHoldsOptions[] ohs;
|
||||
private int curr;
|
||||
private Map fieldEditorsToParentMap = new HashMap();
|
||||
|
||||
public BuildOptionSettingsUI(AbstractCBuildPropertyTab page,
|
||||
|
@ -54,6 +61,33 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
this.category = _category;
|
||||
this.optionHolder = optionHolder;
|
||||
buildPropPage = page;
|
||||
if (info instanceof MultiItemsHolder) {
|
||||
MultiResourceInfo mri = (MultiResourceInfo)info;
|
||||
IResourceInfo[] ris = (IResourceInfo[])mri.getItems();
|
||||
String id = category.getId();
|
||||
String ext = ((ITool)optionHolder).getDefaultInputExtension();
|
||||
ArrayList lst = new ArrayList();
|
||||
for (int i=0; i<ris.length; i++) {
|
||||
ITool[] ts = ris[i].getTools();
|
||||
for (int j=0; j<ts.length; j++) {
|
||||
IOptionCategory op = ts[j].getOptionCategory(id);
|
||||
if (op != null) {
|
||||
if (ext.equals(ts[j].getDefaultInputExtension()))
|
||||
lst.add(ts[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ohs = (IHoldsOptions[])lst.toArray(new IHoldsOptions[lst.size()]);
|
||||
for (int i=0; i<ohs.length; i++) {
|
||||
if (ohs[i].equals(optionHolder)) {
|
||||
curr = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ohs = null;
|
||||
curr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -129,15 +163,14 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
} break;
|
||||
|
||||
case IOption.BOOLEAN: {
|
||||
class TooltipBooleanFieldEditor extends BooleanFieldEditor {
|
||||
public TooltipBooleanFieldEditor(String name, String labelText, String tooltip, Composite parent, String contextId) {
|
||||
super(name, labelText, parent);
|
||||
getChangeControl(parent).setToolTipText(tooltip);
|
||||
if (!contextId.equals(AbstractPage.EMPTY_STR)) PlatformUI.getWorkbench().getHelpSystem().setHelp(getChangeControl(parent), contextId);
|
||||
}
|
||||
}
|
||||
|
||||
fieldEditor = new TooltipBooleanFieldEditor(optId, opt.getName(), opt.getToolTip(), fieldEditorParent, opt.getContextId());
|
||||
fieldEditor = new TriStateBooleanFieldEditor(
|
||||
optId,
|
||||
opt.getName(),
|
||||
opt.getToolTip(),
|
||||
fieldEditorParent,
|
||||
opt.getContextId(),
|
||||
ohs,
|
||||
curr);
|
||||
} break;
|
||||
|
||||
case IOption.ENUMERATED: {
|
||||
|
@ -362,6 +395,8 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
Iterator iter = fieldsList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
FieldEditor editor = (FieldEditor) iter.next();
|
||||
if (editor instanceof TriStateBooleanFieldEditor)
|
||||
((TriStateBooleanFieldEditor)editor).set3(true);
|
||||
editor.load();
|
||||
}
|
||||
}
|
||||
|
@ -395,9 +430,20 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
if(source instanceof FieldEditor){
|
||||
FieldEditor fe = (FieldEditor)source;
|
||||
|
||||
id = fe.getPreferenceName();
|
||||
if (fe instanceof TriStateBooleanFieldEditor)
|
||||
((TriStateBooleanFieldEditor)fe).set3(false);
|
||||
|
||||
id = fe.getPreferenceName();
|
||||
|
||||
Object[] option = this.getToolSettingsPrefStore().getOption(id);
|
||||
|
||||
if (option == null) {
|
||||
int n = id.lastIndexOf('.');
|
||||
if (n > 0) {
|
||||
id = id.substring(0, n);
|
||||
option = getToolSettingsPrefStore().getOption(id);
|
||||
}
|
||||
}
|
||||
|
||||
if(option != null){
|
||||
changedOption = (IOption)option[1];
|
||||
|
@ -560,4 +606,65 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
((BuildOptionComboFieldEditor)fieldEditor).setOptions(enumValidNames);
|
||||
fieldEditor.load();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
class TriStateBooleanFieldEditor extends BooleanFieldEditor {
|
||||
protected Button button = null;
|
||||
protected IHoldsOptions[] holders = null;
|
||||
private boolean enable3 = true;
|
||||
protected int current = 0;
|
||||
public TriStateBooleanFieldEditor(String name, String labelText, String tooltip, Composite parent, String contextId, IHoldsOptions[] ho, int curr) {
|
||||
super(name, labelText, parent);
|
||||
holders = ho;
|
||||
current = curr;
|
||||
button = (Button)getChangeControl(parent);
|
||||
button.setToolTipText(tooltip);
|
||||
if (!contextId.equals(AbstractPage.EMPTY_STR)) PlatformUI.getWorkbench().getHelpSystem().setHelp(button, contextId);
|
||||
|
||||
}
|
||||
protected void valueChanged(boolean oldValue, boolean newValue) {
|
||||
if (button.getGrayed())
|
||||
button.setGrayed(false);
|
||||
super.valueChanged(!newValue, newValue);
|
||||
}
|
||||
protected void doLoad() {
|
||||
if (enable3 && holders != null && button != null) {
|
||||
String id = getPreferenceName();
|
||||
IOption op = holders[current].getOptionById(id);
|
||||
if (op != null) {
|
||||
if (op.getSuperClass() != null)
|
||||
id = op.getSuperClass().getId();
|
||||
int[] vals = new int[2];
|
||||
for (int i=0; i<holders.length; i++) {
|
||||
op = holders[i].getOptionBySuperClassId(id);
|
||||
try {
|
||||
if (op != null)
|
||||
vals[op.getBooleanValue() ? 1 : 0]++;
|
||||
} catch (BuildException e) {}
|
||||
}
|
||||
boolean value = false;
|
||||
boolean gray = false;
|
||||
if (vals[1] > 0) {
|
||||
value = true;
|
||||
if (vals[0] > 0)
|
||||
gray = true;
|
||||
}
|
||||
button.setGrayed(gray);
|
||||
button.setSelection(value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.doLoad(); // default case
|
||||
}
|
||||
|
||||
void set3(boolean state) {
|
||||
enable3 = state;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import org.eclipse.cdt.managedbuilder.internal.core.Builder;
|
|||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.cdt.ui.newui.TriButton;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
|
@ -41,12 +40,12 @@ import org.eclipse.swt.widgets.Widget;
|
|||
public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
||||
// Widgets
|
||||
//1
|
||||
private TriButton b_useDefault;
|
||||
private Button b_useDefault;
|
||||
private Combo c_builderType;
|
||||
private Text t_buildCmd;
|
||||
//2
|
||||
private TriButton b_genMakefileAuto;
|
||||
private TriButton b_expandVars;
|
||||
private Button b_genMakefileAuto;
|
||||
private Button b_expandVars;
|
||||
//5
|
||||
private Text t_dir;
|
||||
private Button b_dirWsp;
|
||||
|
@ -74,7 +73,7 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
updateButtons();
|
||||
}});
|
||||
|
||||
b_useDefault = setupTri(g1, Messages.getString("BuilderSettingsTab.4"), 3, GridData.BEGINNING); //$NON-NLS-1$
|
||||
b_useDefault = setupCheck(g1, Messages.getString("BuilderSettingsTab.4"), 3, GridData.BEGINNING); //$NON-NLS-1$
|
||||
|
||||
setupLabel(g1, Messages.getString("BuilderSettingsTab.5"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
t_buildCmd = setupBlock(g1, b_useDefault);
|
||||
|
@ -93,8 +92,8 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
Group g2 = setupGroup(usercomp, Messages.getString("BuilderSettingsTab.6"), 2, GridData.FILL_HORIZONTAL); //$NON-NLS-1$
|
||||
((GridLayout)(g2.getLayout())).makeColumnsEqualWidth = true;
|
||||
|
||||
b_genMakefileAuto = setupTri(g2, Messages.getString("BuilderSettingsTab.7"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
b_expandVars = setupTri(g2, Messages.getString("BuilderSettingsTab.8"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
b_genMakefileAuto = setupCheck(g2, Messages.getString("BuilderSettingsTab.7"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
b_expandVars = setupCheck(g2, Messages.getString("BuilderSettingsTab.8"), 1, GridData.BEGINNING); //$NON-NLS-1$
|
||||
|
||||
// Build location group
|
||||
group_dir = setupGroup(usercomp, Messages.getString("BuilderSettingsTab.21"), 2, GridData.FILL_HORIZONTAL); //$NON-NLS-1$
|
||||
|
@ -131,8 +130,11 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
|
||||
b_genMakefileAuto.setEnabled(icfg.supportsBuild(true));
|
||||
if (extStates == null) { // no extended states available
|
||||
b_genMakefileAuto.setGrayed(false);
|
||||
b_genMakefileAuto.setSelection(bldr.isManagedBuildOn());
|
||||
b_useDefault.setGrayed(false);
|
||||
b_useDefault.setSelection(bldr.isDefaultBuildCmd());
|
||||
b_expandVars.setGrayed(false);
|
||||
if(!bldr.canKeepEnvironmentVariablesInBuildfile())
|
||||
b_expandVars.setEnabled(false);
|
||||
else {
|
||||
|
@ -140,13 +142,13 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
b_expandVars.setSelection(!bldr.keepEnvironmentVariablesInBuildfile());
|
||||
}
|
||||
} else {
|
||||
b_genMakefileAuto.setTriSelection(extStates[0]);
|
||||
b_useDefault.setTriSelection(extStates[1]);
|
||||
if(extStates[2] != TriButton.YES)
|
||||
BuildBehaviourTab.setTriSelection(b_genMakefileAuto, extStates[0]);
|
||||
BuildBehaviourTab.setTriSelection(b_useDefault, extStates[1]);
|
||||
if(extStates[2] != BuildBehaviourTab.TRI_YES)
|
||||
b_expandVars.setEnabled(false);
|
||||
else {
|
||||
b_expandVars.setEnabled(true);
|
||||
b_expandVars.setTriSelection(extStates[3]);
|
||||
BuildBehaviourTab.setTriSelection(b_expandVars, extStates[3]);
|
||||
}
|
||||
}
|
||||
c_builderType.select(isInternalBuilderEnabled() ? 1 : 0);
|
||||
|
@ -174,7 +176,8 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
((Control)t_buildCmd.getData()).setEnabled(external & ! b_useDefault.getSelection());
|
||||
|
||||
b_genMakefileAuto.setEnabled(external && icfg.supportsBuild(true));
|
||||
b_expandVars.setEnabled(external && b_genMakefileAuto.getSelection());
|
||||
if (b_expandVars.getEnabled())
|
||||
b_expandVars.setEnabled(external && b_genMakefileAuto.getSelection());
|
||||
|
||||
if (external) {
|
||||
checkPressed(b_useDefault);
|
||||
|
@ -243,7 +246,6 @@ public class BuilderSettingsTab extends AbstractCBuildPropertyTab {
|
|||
|
||||
boolean val = false;
|
||||
if (b instanceof Button) val = ((Button)b).getSelection();
|
||||
else if (b instanceof TriButton) val = ((TriButton)b).getSelection();
|
||||
|
||||
if (b.getData() instanceof Text) {
|
||||
Text t = (Text)b.getData();
|
||||
|
|
|
@ -168,7 +168,11 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
|
|||
}
|
||||
}
|
||||
if (currentSettingsPage == null) {
|
||||
currentSettingsPage = new BuildOptionSettingsUI(this, fInfo, optionHolder, category);
|
||||
currentSettingsPage = new BuildOptionSettingsUI(
|
||||
this,
|
||||
fInfo,
|
||||
optionHolder,
|
||||
category);
|
||||
pages.add(currentSettingsPage);
|
||||
currentSettingsPage.setContainer(this);
|
||||
if (currentSettingsPage.getControl() == null) {
|
||||
|
|
|
@ -91,8 +91,9 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
|||
public static final String WORKSPACE_FILE_DIALOG_ERR = UIMessages.getString("BrowseEntryDialog.wsp.file.dlg.err"); //$NON-NLS-1$
|
||||
public static final String WORKSPACE_DIR_DIALOG_ERR = UIMessages.getString("BrowseEntryDialog.wsp.dir.dlg.err"); //$NON-NLS-1$
|
||||
|
||||
// use 3-state buttons in property pages
|
||||
protected final boolean USE_TRI_STATE = CDTPrefUtil.getBool(CDTPrefUtil.KEY_MULTI) && CDTPrefUtil.getBool(CDTPrefUtil.KEY_3STATE);
|
||||
public static final int TRI_UNKNOWN = 2;
|
||||
public static final int TRI_YES = 1;
|
||||
public static final int TRI_NO = 0;
|
||||
|
||||
protected Composite usercomp; // space where user can create widgets
|
||||
protected Composite buttoncomp; // space for buttons on the right
|
||||
|
@ -321,17 +322,7 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
|||
setupControl(b, span, mode);
|
||||
b.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
checkPressed(event);
|
||||
}});
|
||||
return b;
|
||||
}
|
||||
|
||||
protected TriButton setupTri(Composite c, String name, int span, int mode) {
|
||||
TriButton b = new TriButton(c, 0, USE_TRI_STATE);
|
||||
b.setText(name);
|
||||
setupControl(b, span, mode);
|
||||
b.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
((Button)event.widget).setGrayed(false);
|
||||
checkPressed(event);
|
||||
}});
|
||||
return b;
|
||||
|
@ -535,5 +526,23 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
|||
return fFontMetrics;
|
||||
}
|
||||
|
||||
public static void setTriSelection(Button b, int state) {
|
||||
switch (state) {
|
||||
case TRI_NO:
|
||||
b.setGrayed(false);
|
||||
b.setSelection(false);
|
||||
break;
|
||||
case TRI_YES:
|
||||
b.setGrayed(false);
|
||||
b.setSelection(true);
|
||||
break;
|
||||
case TRI_UNKNOWN:
|
||||
b.setSelection(true);
|
||||
b.setGrayed(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ public class CDTPrefUtil {
|
|||
public static final String KEY_OTHERS = "wizard.group.others.enable"; //$NON-NLS-1$
|
||||
public static final String KEY_NOMNG = "properties.manage.config.disable"; //$NON-NLS-1$
|
||||
public static final String KEY_MULTI = "properties.multi.config.enable"; //$NON-NLS-1$
|
||||
public static final String KEY_3STATE = "properties.multi.3state.enable"; //$NON-NLS-1$
|
||||
public static final String KEY_DTREE = "properties.data.hierarchy.enable"; //$NON-NLS-1$
|
||||
public static final String KEY_NOTOOLM = "properties.toolchain.modification.disable"; //$NON-NLS-1$
|
||||
public static final String KEY_EXPORT = "properties.export.page.enable"; //$NON-NLS-1$
|
||||
|
|
|
@ -338,6 +338,17 @@ ProjectConvert.noConverterErrordialog.title=Project Conversion Error
|
|||
ProjectConvert.noConverterErrordialog.message=There are no converters available to convert the project {0} .
|
||||
|
||||
ProjectConvert.title=Project Converters for {0}
|
||||
PropertyMultiCfgTab.0=* This functionality is experimental *
|
||||
PropertyMultiCfgTab.1=Enable multiple configurations setting
|
||||
PropertyMultiCfgTab.10=Add/remove/change affected elements, do not touch others
|
||||
PropertyMultiCfgTab.11=Replace existing string lists with string list shown to user
|
||||
PropertyMultiCfgTab.3=String list Display mode
|
||||
PropertyMultiCfgTab.4=Define how string lists from different configurations\nshould be combined for display, when lists are not equal
|
||||
PropertyMultiCfgTab.5=Show empty list
|
||||
PropertyMultiCfgTab.6=Show common elements (conjunction)
|
||||
PropertyMultiCfgTab.7=Show all elements except doubles (disjunction)
|
||||
PropertyMultiCfgTab.8=String list Write mode
|
||||
PropertyMultiCfgTab.9=Define how to save changes in string lists \nfor different configurations
|
||||
PropertyPageDefsTab.0=Show <Manage configurations> button
|
||||
PropertyPageDefsTab.1=Display "Data hierarchy" tab
|
||||
PropertyPageDefsTab.10=Display "Export settings" tab
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.newui;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
public class TriButton extends Composite implements SelectionListener {
|
||||
private static final String[] ITEMS = {"No", "Yes"}; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
private static final String QMARK = "?"; //$NON-NLS-1$
|
||||
|
||||
public static final int NO = 0;
|
||||
public static final int YES = 1;
|
||||
public static final int UNKNOWN = 2;
|
||||
|
||||
private boolean triMode = false;
|
||||
private Button button = null;
|
||||
private Combo combo = null;
|
||||
private Label label = null;
|
||||
private List listeners = new LinkedList();
|
||||
|
||||
public TriButton(Composite parent, int style) {
|
||||
this(parent, style, true);
|
||||
}
|
||||
|
||||
public TriButton(Composite parent, int style, boolean _triMode) {
|
||||
super(parent, style);
|
||||
triMode = _triMode;
|
||||
if (triMode) {
|
||||
setLayout(new GridLayout(2, false));
|
||||
combo = new Combo(this, style | SWT.READ_ONLY | SWT.DROP_DOWN);
|
||||
combo.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
combo.setItems(ITEMS);
|
||||
combo.addSelectionListener(this);
|
||||
label = new Label(this, SWT.NONE);
|
||||
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
label.addMouseListener(new MouseListener() {
|
||||
public void mouseDoubleClick(MouseEvent e) {}
|
||||
public void mouseDown(MouseEvent e) {}
|
||||
public void mouseUp(MouseEvent e) {
|
||||
processMouseUp(e);
|
||||
}});
|
||||
} else {
|
||||
setLayout(new GridLayout());
|
||||
button = new Button(this, style | SWT.CHECK);
|
||||
button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
button.addSelectionListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public String getText () {
|
||||
return triMode ? label.getText() : button.getText();
|
||||
}
|
||||
public void setText (String string) {
|
||||
if (triMode) label.setText(string);
|
||||
else button.setText(string);
|
||||
}
|
||||
|
||||
public String getToolTipText () {
|
||||
return triMode ? label.getToolTipText() : button.getToolTipText();
|
||||
}
|
||||
public void setToolTipText (String string) {
|
||||
if (triMode) {
|
||||
label.setToolTipText(string);
|
||||
combo.setToolTipText(string);
|
||||
} else button.setToolTipText(string);
|
||||
}
|
||||
|
||||
public boolean getSelection () {
|
||||
return triMode ? (combo.getSelectionIndex() == YES) : button.getSelection();
|
||||
}
|
||||
public void setSelection (boolean selected) {
|
||||
if (triMode) combo.select(selected ? YES : NO);
|
||||
else button.setSelection(selected);
|
||||
}
|
||||
|
||||
public int getTriSelection () {
|
||||
return triMode ? combo.getSelectionIndex(): (button.getSelection() ? YES : NO);
|
||||
}
|
||||
public void setTriSelection(int selection) {
|
||||
if (selection != NO &&
|
||||
selection != YES &&
|
||||
selection != UNKNOWN)
|
||||
selection = NO;
|
||||
if (triMode) {
|
||||
if (selection == UNKNOWN) {
|
||||
combo.setText(QMARK);
|
||||
combo.select(-1);
|
||||
} else
|
||||
combo.select(selection);
|
||||
}
|
||||
else button.setSelection(selection == 1);
|
||||
}
|
||||
|
||||
public int getAlignment () {
|
||||
return triMode ? label.getAlignment() : button.getAlignment();
|
||||
}
|
||||
public void setAlignment (int alignment) {
|
||||
if (triMode) label.setAlignment(alignment);
|
||||
else button.setAlignment(alignment);
|
||||
}
|
||||
|
||||
public Image getImage () {
|
||||
return triMode ? label.getImage() : button.getImage();
|
||||
}
|
||||
public void setImage (Image image) {
|
||||
if (triMode) label.setImage(image);
|
||||
else button.setImage(image);
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
if (triMode) {
|
||||
label.setEnabled(enabled);
|
||||
combo.setEnabled(enabled);
|
||||
} else button.setEnabled(enabled);
|
||||
}
|
||||
|
||||
public void addSelectionListener (SelectionListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
public void removeSelectionListener (SelectionListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
e.widget = this;
|
||||
Iterator it = listeners.iterator();
|
||||
while (it.hasNext())
|
||||
((SelectionListener)it.next()).widgetDefaultSelected(e);
|
||||
}
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
e.widget = this;
|
||||
Iterator it = listeners.iterator();
|
||||
while (it.hasNext())
|
||||
((SelectionListener)it.next()).widgetSelected(e);
|
||||
}
|
||||
|
||||
private void processMouseUp(MouseEvent me) {
|
||||
int x = combo.getSelectionIndex() + 1;
|
||||
if (x < 0 || x > 2) x = 0;
|
||||
combo.select(x);
|
||||
|
||||
Event e = new Event();
|
||||
e.button = me.button;
|
||||
e.count = me.count;
|
||||
e.data = me.data;
|
||||
e.display = me.display;
|
||||
e.stateMask = me.stateMask;
|
||||
e.time = me.time;
|
||||
e.x = me.x;
|
||||
e.y = me.y;
|
||||
e.type = SWT.Selection;
|
||||
e.doit = true;
|
||||
e.item = this;
|
||||
e.widget = this;
|
||||
SelectionEvent se = new SelectionEvent(e);
|
||||
widgetSelected(se);
|
||||
}
|
||||
|
||||
public boolean in3mode() {
|
||||
return triMode;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue