Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorAndrew Gvozdev2010-06-15 18:18:42 -0400
committerAndrew Gvozdev2010-06-15 18:18:42 -0400
commitbe678f1ff406a99d321e56a65b0ef5bd5e8e671f (patch)
tree5d3490acc9193d8924d6ce264321928a12249570 /build
parentf0ff969691d062b0f7007b80881cbc9145163f69 (diff)
downloadorg.eclipse.cdt-be678f1ff406a99d321e56a65b0ef5bd5e8e671f.tar.gz
org.eclipse.cdt-be678f1ff406a99d321e56a65b0ef5bd5e8e671f.tar.xz
org.eclipse.cdt-be678f1ff406a99d321e56a65b0ef5bd5e8e671f.zip
bug 206372: [Scanner Discovery] Include path discovery doesn't discard obsolete paths on compiler upgrade
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java76
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/messages.properties9
2 files changed, 85 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java
index c15b3dfb65..d5cff7c662 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java
@@ -31,7 +31,12 @@ import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2Set;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
+import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathInfo;
+import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
import org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@@ -42,6 +47,7 @@ import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
import org.eclipse.cdt.ui.newui.UIMessages;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -52,6 +58,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.SelectionAdapter;
@@ -63,6 +70,7 @@ import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
@@ -221,6 +229,31 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
handleDiscoveryProfileChanged();
}
});
+
+ // "Clear" label
+ @SuppressWarnings("unused")
+ Label clearLabel = ControlFactory.createLabel(autoDiscoveryGroup, Messages.getString("DiscoveryTab.ClearDisoveredEntries")); //$NON-NLS-1$
+
+ // "Clear" button
+ Button clearButton = ControlFactory.createPushButton(autoDiscoveryGroup, Messages.getString("DiscoveryTab.Clear")); //$NON-NLS-1$
+ GridData gd = (GridData) clearButton.getLayoutData();
+ gd.grabExcessHorizontalSpace = false;
+ gd.widthHint = 80;
+ gd.horizontalAlignment = SWT.RIGHT;
+
+ final Shell shell = parent.getShell();
+ clearButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ String title = Messages.getString("DiscoveryTab.ClearEntries"); //$NON-NLS-1$
+ try {
+ clearDiscoveredEntries();
+ MessageDialog.openInformation(shell, title, Messages.getString("DiscoveryTab.DiscoveredEntriesCleared")); //$NON-NLS-1$
+ } catch (CoreException e) {
+ MessageDialog.openError(shell, title, Messages.getString("DiscoveryTab.ErrorClearingEntries") + e.getLocalizedMessage()); //$NON-NLS-1$
+ }
+ }
+ });
}
private void enableAllControls() {
@@ -737,4 +770,47 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
protected void updateButtons() {
// Do nothing. No buttons to update.
}
+
+ private void clearDiscoveredEntries() throws CoreException {
+ CfgInfoContext cfgInfoContext = getContext();
+
+ IConfiguration cfg = cfgInfoContext.getConfiguration();
+ if (cfg==null) {
+ cfg = cfgInfoContext.getResourceInfo().getParent();
+ }
+ if (cfg==null) {
+ Status status = new Status(IStatus.ERROR, ManagedBuilderUIPlugin.getUniqueIdentifier(),
+ "Unexpected cfg=null while trying to clear discovery entries"); //$NON-NLS-1$
+ throw new CoreException(status);
+ }
+
+ IProject project = (IProject) cfg.getOwner();
+
+ DiscoveredPathInfo pathInfo = new DiscoveredPathInfo(project);
+ InfoContext infoContext = cfgInfoContext.toInfoContext();
+
+ // 1. Remove scanner info from .metadata/.plugins/org.eclipse.cdt.make.core/Project.sc
+ DiscoveredScannerInfoStore dsiStore = DiscoveredScannerInfoStore.getInstance();
+ dsiStore.saveDiscoveredScannerInfoToState(project, infoContext, pathInfo);
+
+ // 2. Remove scanner info from CfgDiscoveredPathManager cache and from the Tool
+ CfgDiscoveredPathManager cdpManager = CfgDiscoveredPathManager.getInstance();
+ cdpManager.removeDiscoveredInfo(project, cfgInfoContext);
+
+ // 3. Remove scanner info from SI collector
+ ICfgScannerConfigBuilderInfo2Set info2 = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg);
+ Map<CfgInfoContext, IScannerConfigBuilderInfo2> infoMap2 = info2.getInfoMap();
+ IScannerConfigBuilderInfo2 buildInfo2 = infoMap2.get(cfgInfoContext);
+ if (buildInfo2!=null) {
+ ScannerConfigProfileManager scpManager = ScannerConfigProfileManager.getInstance();
+ String selectedProfileId = buildInfo2.getSelectedProfileId();
+ SCProfileInstance profileInstance = scpManager.getSCProfileInstance(project, infoContext, selectedProfileId);
+
+ IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
+ if (collector instanceof IScannerInfoCollectorCleaner) {
+ ((IScannerInfoCollectorCleaner) collector).deleteAll(project);
+ }
+ buildInfo2 = null;
+ }
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/messages.properties b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/messages.properties
index 19da198d45..51622e0d63 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/messages.properties
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/messages.properties
@@ -53,6 +53,11 @@ DiscoveryTab.5=Tools:
DiscoveryTab.6=No profiles found
DiscoveryTab.7=InfoContexts are different \!
DiscoveryTab.8=Configuration:
+DiscoveryTab.Clear=Clear
+DiscoveryTab.ClearDisoveredEntries=Clear discovered entries now:
+DiscoveryTab.ClearEntries=Clear entries
+DiscoveryTab.DiscoveredEntriesCleared=Discovered entries cleared. Scanner discovery will re-aquire the settings when run (normally during the build).
+DiscoveryTab.ErrorClearingEntries=Error clearing entries:
ToolSelectionDialog.0=Select tools
ToolSelectionDialog.1=Available tools
ToolSelectionDialog.2=Used tools
@@ -99,6 +104,10 @@ PreferredToolchainsTab.2=Make toolchain(s) not preferred
PreferredToolchainsTab.3=Preferred toolchain(s):
ToolSettingsTab.0=Hover over an option to display its tooltip
BuildOptionSettingsUI.0=No tooltip is available for this option
+ScannerConfigOptionsDialog.scGroup.enabled.button=
+ScannerConfigOptionsDialog.scGroup.label=
+ScannerConfigOptionsDialog.scGroup.problemReporting.enabled.button=
+ScannerConfigOptionsDialog.scGroup.selectedProfile.combo=
StdProjectTypeHandler.0=-- Other Toolchain --
StdProjectTypeHandler.2=Default
StdProjectTypeHandler.3=creation Make project: IBuilder is null

Back to the top