mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-22 08:25:25 +02:00
Bug # 207315 : context ID was ignored for IOption
This commit is contained in:
parent
2a3047e389
commit
055fe6f88f
6 changed files with 89 additions and 9 deletions
|
@ -58,6 +58,7 @@ public interface IOption extends IBuildObject {
|
|||
public static final String COMMAND = "command"; //$NON-NLS-1$
|
||||
public static final String COMMAND_FALSE = "commandFalse"; //$NON-NLS-1$
|
||||
public static final String TOOL_TIP = "tip"; //$NON-NLS-1$
|
||||
public static final String CONTEXT_ID = "contextId"; //$NON-NLS-1$
|
||||
public static final String DEFAULT_VALUE = "defaultValue"; //$NON-NLS-1$
|
||||
public static final String ENUM_VALUE = "enumeratedOptionValue"; //$NON-NLS-1$
|
||||
public static final String IS_DEFAULT = "isDefault"; //$NON-NLS-1$
|
||||
|
@ -241,6 +242,21 @@ public interface IOption extends IBuildObject {
|
|||
*/
|
||||
public void setToolTip(String tooltip);
|
||||
|
||||
/**
|
||||
* Answers a <code>String</code> containing the contextId
|
||||
* associated with the option
|
||||
* @return String
|
||||
*/
|
||||
public String getContextId();
|
||||
|
||||
/**
|
||||
* Sets a <code>String</code> containing the contextId
|
||||
* associated with the option
|
||||
*
|
||||
* @param String
|
||||
*/
|
||||
public void setContextId(String id);
|
||||
|
||||
/**
|
||||
* Answers the user-defined preprocessor symbols.
|
||||
*
|
||||
|
|
|
@ -61,6 +61,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
private String command;
|
||||
private String commandFalse;
|
||||
private String tip;
|
||||
private String contextId;
|
||||
private List enumList;
|
||||
private Map enumCommands;
|
||||
private Map enumNames;
|
||||
|
@ -188,6 +189,9 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
if (option.tip != null) {
|
||||
tip = new String(option.tip);
|
||||
}
|
||||
if (option.contextId != null) {
|
||||
contextId = new String(option.contextId);
|
||||
}
|
||||
if (option.categoryId != null) {
|
||||
categoryId = new String(option.categoryId);
|
||||
}
|
||||
|
@ -322,6 +326,9 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
// Get the tooltip for the option
|
||||
tip = element.getAttribute(TOOL_TIP);
|
||||
|
||||
// Get the contextID for the option
|
||||
contextId = element.getAttribute(CONTEXT_ID);
|
||||
|
||||
// Options hold different types of values
|
||||
String valueTypeStr = element.getAttribute(VALUE_TYPE);
|
||||
if (valueTypeStr != null) {
|
||||
|
@ -442,6 +449,11 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
tip = element.getAttribute(TOOL_TIP);
|
||||
}
|
||||
|
||||
// Get the contextID for the option
|
||||
if (element.getAttribute(CONTEXT_ID) != null) {
|
||||
contextId = element.getAttribute(CONTEXT_ID);
|
||||
}
|
||||
|
||||
// Options hold different types of values
|
||||
if (element.getAttribute(VALUE_TYPE) != null) {
|
||||
String valueTypeStr = element.getAttribute(VALUE_TYPE);
|
||||
|
@ -689,6 +701,9 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
element.setAttribute(TOOL_TIP, tip);
|
||||
}
|
||||
|
||||
if (contextId != null) {
|
||||
element.setAttribute(CONTEXT_ID, contextId);
|
||||
}
|
||||
/*
|
||||
* Note: We store value & value-type as a pair, so we know what type of value we are
|
||||
* dealing with when we read it back in.
|
||||
|
@ -1106,6 +1121,19 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
}
|
||||
return tip;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOption#getContextId()
|
||||
*/
|
||||
public String getContextId() {
|
||||
if (contextId == null) {
|
||||
if (superClass != null) {
|
||||
return superClass.getContextId();
|
||||
} else {
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
}
|
||||
return contextId;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOption#getDefinedSymbols()
|
||||
*/
|
||||
|
@ -1589,7 +1617,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOption#setToolTip(String)
|
||||
*/
|
||||
|
@ -1604,6 +1632,20 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOption#setContextId(String)
|
||||
*/
|
||||
public void setContextId(String id) {
|
||||
if (id == null && contextId == null) return;
|
||||
if (id == null || contextId == null || !id.equals(contextId)) {
|
||||
contextId = id;
|
||||
if(!isExtensionElement()){
|
||||
isDirty = true;
|
||||
rebuildState = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.core.IOption#setResourceFilter(int)
|
||||
*/
|
||||
|
@ -1863,6 +1905,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
command == null &&
|
||||
commandFalse == null &&
|
||||
tip == null &&
|
||||
contextId == null &&
|
||||
enumList == null &&
|
||||
enumCommands == null &&
|
||||
enumNames == null &&
|
||||
|
|
|
@ -333,6 +333,13 @@ public class OptionReference implements IOption {
|
|||
return option.getToolTip();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getContextID()
|
||||
*/
|
||||
public String getContextId() {
|
||||
return option.getContextId();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
|
||||
*/
|
||||
|
@ -805,7 +812,13 @@ public class OptionReference implements IOption {
|
|||
*/
|
||||
public void setToolTip(String tooltip) {
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IOption#setContextId(String)
|
||||
*/
|
||||
public void setContextId(String contextId) {
|
||||
}
|
||||
|
||||
public PluginVersionIdentifier getVersion() {
|
||||
return option.getVersion();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
public class BuildOptionComboFieldEditor extends FieldEditor {
|
||||
|
||||
|
@ -46,13 +47,15 @@ public class BuildOptionComboFieldEditor extends FieldEditor {
|
|||
* @param name
|
||||
* @param label
|
||||
* @param tooltip
|
||||
* @param contextId
|
||||
* @param opts
|
||||
* @param sel
|
||||
* @param parent
|
||||
*/
|
||||
public BuildOptionComboFieldEditor(String name, String label, String tooltip, String [] opts, String sel, Composite parent) {
|
||||
public BuildOptionComboFieldEditor(String name, String label, String tooltip, String contextId, String [] opts, String sel, Composite parent) {
|
||||
this(name, label, opts, sel, parent);
|
||||
setToolTip(tooltip);
|
||||
if (!contextId.equals("")) PlatformUI.getWorkbench().getHelpSystem().setHelp(optionSelector, contextId); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,7 @@ 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.ManagedBuildManager;
|
||||
import org.eclipse.cdt.ui.newui.AbstractPage;
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.DirectoryFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
|
@ -38,6 +39,7 @@ import org.eclipse.swt.events.ModifyEvent;
|
|||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
||||
private Map fieldsMap = new HashMap();
|
||||
|
@ -122,19 +124,20 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
|
||||
stringField.getTextControl(fieldEditorParent).setToolTipText(opt.getToolTip());
|
||||
stringField.getLabelControl(fieldEditorParent).setToolTipText(opt.getToolTip());
|
||||
|
||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(stringField.getTextControl(fieldEditorParent), opt.getContextId());
|
||||
fieldEditor = stringField;
|
||||
} break;
|
||||
|
||||
case IOption.BOOLEAN: {
|
||||
class TooltipBooleanFieldEditor extends BooleanFieldEditor {
|
||||
public TooltipBooleanFieldEditor(String name, String labelText, String tooltip, Composite parent) {
|
||||
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);
|
||||
fieldEditor = new TooltipBooleanFieldEditor(optId, opt.getName(), opt.getToolTip(), fieldEditorParent, opt.getContextId());
|
||||
} break;
|
||||
|
||||
case IOption.ENUMERATED: {
|
||||
|
@ -156,7 +159,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
String[] enumValidNames = new String[enumValidList.size()];
|
||||
enumValidList.copyInto(enumValidNames);
|
||||
|
||||
fieldEditor = new BuildOptionComboFieldEditor(optId, opt.getName(), opt.getToolTip(), enumValidNames, sel, fieldEditorParent);
|
||||
fieldEditor = new BuildOptionComboFieldEditor(optId, opt.getName(), opt.getToolTip(), opt.getContextId(), enumValidNames, sel, fieldEditorParent);
|
||||
} break;
|
||||
|
||||
case IOption.INCLUDE_PATH:
|
||||
|
@ -174,7 +177,7 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
|||
case IOption.UNDEF_LIBRARY_PATHS:
|
||||
case IOption.UNDEF_LIBRARY_FILES:
|
||||
case IOption.UNDEF_MACRO_FILES: {
|
||||
fieldEditor = new FileListControlFieldEditor(optId, opt.getName(), opt.getToolTip(), fieldEditorParent, opt.getBrowseType());
|
||||
fieldEditor = new FileListControlFieldEditor(optId, opt.getName(), opt.getToolTip(), opt.getContextId(), fieldEditorParent, opt.getBrowseType());
|
||||
} break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.eclipse.swt.layout.GridLayout;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
/**
|
||||
* Field editor that uses FileListControl for user input.
|
||||
|
@ -79,11 +79,13 @@ public class FileListControlFieldEditor extends FieldEditor {
|
|||
String name,
|
||||
String labelText,
|
||||
String tooltip,
|
||||
String contextId,
|
||||
Composite parent,
|
||||
int type) {
|
||||
this(name, labelText, parent, type);
|
||||
// can't use setToolTip(tooltip) as label not created yet
|
||||
getLabelControl(parent).setToolTipText(tooltip);
|
||||
if (!contextId.equals("")) PlatformUI.getWorkbench().getHelpSystem().setHelp(list.getListControl(), contextId); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue