Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2016-04-21 15:00:38 -0400
committerGerrit Code Review @ Eclipse.org2016-05-13 09:54:29 -0400
commit9fd79b05968022428a26aa0308609cc95e3ad09e (patch)
treebbb331affb24849ee2edbef3bb9c39525c7a691e /build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder
parent7436cb9ae4ae04300dca893bf5dfbc4f92abbe27 (diff)
downloadorg.eclipse.cdt-9fd79b05968022428a26aa0308609cc95e3ad09e.tar.gz
org.eclipse.cdt-9fd79b05968022428a26aa0308609cc95e3ad09e.tar.xz
org.eclipse.cdt-9fd79b05968022428a26aa0308609cc95e3ad09e.zip
Bug 491619 - Choosing a C++ dialect should reindex
- changed gcc builtin settings providers to prefer non-shared - added isIndexerAffected method override to ToolSettingsTab which looks at new isIndexerAffected boolean - add logic to ToolSettingsTab setOptions() method to look for dirty options that return true for isForScannerDiscovery() or are special options that affect include path or defines - add performok method to ToolSettingsTab to look if isIndexerAffected when user hits OK without hitting APPLY - change the message for bringing up the question dialog for end-user to choose whether to reindex or not Change-Id: Icd740caafe638f272b6f1434d5817f2377ffe04a
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolSettingsTab.java78
1 files changed, 73 insertions, 5 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolSettingsTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolSettingsTab.java
index 62ff9a23d9..c0fa34a8ac 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolSettingsTab.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolSettingsTab.java
@@ -31,6 +31,7 @@ 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.MultiConfiguration;
+import org.eclipse.cdt.managedbuilder.internal.core.Option;
import org.eclipse.cdt.managedbuilder.internal.macros.BuildMacroProvider;
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
@@ -98,6 +99,8 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
private int[] defaultWeights = new int[] {4, 1};
private int[] hideTipBoxWeights = new int[] {1, 0};
+ private boolean isIndexerAffected;
+
@Override
public void createControls(Composite par) {
super.createControls(par);
@@ -562,6 +565,9 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
*/
protected void setOption(IOption op1, IOption op2, IHoldsOptions dst, IResourceInfo res){
try {
+ if (op1.isForScannerDiscovery()
+ && ((Option)op1).isDirty())
+ isIndexerAffected = true;
switch (op1.getValueType()) {
case IOption.BOOLEAN :
boolean boolVal = op1.getBooleanValue();
@@ -577,14 +583,9 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
case IOption.STRING :
ManagedBuildManager.setOption(res, dst, op2, op1.getStringValue());
break;
- case IOption.STRING_LIST :
case IOption.INCLUDE_PATH :
case IOption.PREPROCESSOR_SYMBOLS :
- case IOption.LIBRARIES :
- case IOption.OBJECTS :
case IOption.INCLUDE_FILES:
- case IOption.LIBRARY_PATHS:
- case IOption.LIBRARY_FILES:
case IOption.MACRO_FILES:
case IOption.UNDEF_INCLUDE_PATH:
case IOption.UNDEF_PREPROCESSOR_SYMBOLS:
@@ -592,10 +593,21 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
case IOption.UNDEF_LIBRARY_PATHS:
case IOption.UNDEF_LIBRARY_FILES:
case IOption.UNDEF_MACRO_FILES:
+ if (((Option)op1).isDirty())
+ isIndexerAffected = true;
@SuppressWarnings("unchecked")
String[] data = ((List<String>)op1.getValue()).toArray(new String[0]);
ManagedBuildManager.setOption(res, dst, op2, data);
break;
+ case IOption.LIBRARIES :
+ case IOption.LIBRARY_PATHS:
+ case IOption.LIBRARY_FILES:
+ case IOption.STRING_LIST :
+ case IOption.OBJECTS :
+ @SuppressWarnings("unchecked")
+ String[] data2 = ((List<String>)op1.getValue()).toArray(new String[0]);
+ ManagedBuildManager.setOption(res, dst, op2, data2);
+ break;
default :
break;
}
@@ -728,6 +740,7 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
IResourceInfo ri1 = getResCfg(src);
IResourceInfo ri2 = getResCfg(dst);
+ isIndexerAffected = false;
copyHoldsOptions(ri1.getParent().getToolChain(), ri2.getParent().getToolChain(), ri2);
ITool[] t1, t2;
if (ri1 instanceof IFolderInfo){
@@ -748,6 +761,61 @@ public class ToolSettingsTab extends AbstractCBuildPropertyTab implements IPrefe
updateData(getResDesc());
}
+ @Override
+ protected void performOK() {
+ // We need to override performOK so we can determine if any option
+ // was chosen that affects the indexer and the user directly chooses
+ // to press OK instead of Apply.
+ isIndexerAffected = false;
+ if (!isDirty()) {
+ super.performOK();
+ return; // don't bother if already applied
+ }
+ ICResourceDescription res = getResDesc();
+ IResourceInfo info = getResCfg(res);
+ ITool[] t1;
+ if (info instanceof IFolderInfo){
+ t1 = ((IFolderInfo)info).getFilteredTools();
+ } else if (info instanceof IFileInfo) {
+ t1 = ((IFileInfo)info).getToolsToInvoke();
+ } else return;
+ for (ITool t : t1) {
+ IOption op1[] = t.getOptions();
+ for (IOption op : op1) {
+ if (((Option)op).isDirty()) {
+ if (op.isForScannerDiscovery())
+ isIndexerAffected = true;
+ else {
+ try {
+ switch (op.getValueType()) {
+ case IOption.INCLUDE_PATH :
+ case IOption.PREPROCESSOR_SYMBOLS :
+ case IOption.INCLUDE_FILES:
+ case IOption.MACRO_FILES:
+ case IOption.UNDEF_INCLUDE_PATH:
+ case IOption.UNDEF_PREPROCESSOR_SYMBOLS:
+ case IOption.UNDEF_INCLUDE_FILES:
+ case IOption.UNDEF_LIBRARY_PATHS:
+ case IOption.UNDEF_LIBRARY_FILES:
+ case IOption.UNDEF_MACRO_FILES:
+ isIndexerAffected = true;
+ break;
+ }
+ } catch (BuildException e) {
+ // Do nothing
+ }
+ }
+ }
+ }
+ }
+ super.performOK();
+ }
+
+ @Override
+ protected boolean isIndexerAffected() {
+ return isIndexerAffected;
+ }
+
/**
* Computes the correspondence of tools in the copy-from set (<tt>t1</tt>) and the
* copy-to set (<tt>t2</tt>) in an apply operation. The resulting pairs are in the order

Back to the top