mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug 379480: changing "command to get compiler specs" does not take
effect
This commit is contained in:
parent
d1e2d46fad
commit
f2bb8b1f6f
3 changed files with 54 additions and 13 deletions
|
@ -10,11 +10,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.internal.ui.language.settings.providers;
|
package org.eclipse.cdt.managedbuilder.internal.ui.language.settings.providers;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
|
||||||
import org.eclipse.cdt.ui.language.settings.providers.AbstractLanguageSettingProviderOptionPage;
|
import org.eclipse.cdt.ui.language.settings.providers.AbstractLanguageSettingProviderOptionPage;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -32,6 +35,8 @@ import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options page for {@link AbstractBuiltinSpecsDetector}.
|
* Options page for {@link AbstractBuiltinSpecsDetector}.
|
||||||
|
*
|
||||||
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
*/
|
*/
|
||||||
public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettingProviderOptionPage {
|
public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettingProviderOptionPage {
|
||||||
private boolean fEditable;
|
private boolean fEditable;
|
||||||
|
@ -152,4 +157,18 @@ public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettin
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performApply(IProgressMonitor monitor) throws CoreException {
|
||||||
|
ILanguageSettingsProvider provider = providerTab.getProvider(providerId);
|
||||||
|
if ((provider instanceof AbstractBuiltinSpecsDetector)) { // basically check for working copy
|
||||||
|
ILanguageSettingsProvider initialProvider = providerTab.getInitialProvider(providerId);
|
||||||
|
if (!(initialProvider instanceof AbstractBuiltinSpecsDetector) || !((AbstractBuiltinSpecsDetector) initialProvider).getCommand().equals(((AbstractBuiltinSpecsDetector) provider).getCommand())) {
|
||||||
|
// clear and reset isExecuted flag
|
||||||
|
((AbstractBuiltinSpecsDetector) provider).clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.performApply(monitor);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
|
||||||
*/
|
*/
|
||||||
private List<ILanguageSettingsProvider> presentedProviders = null;
|
private List<ILanguageSettingsProvider> presentedProviders = null;
|
||||||
private final Map<String, ICOptionPage> optionsPageMap = new HashMap<String, ICOptionPage>();
|
private final Map<String, ICOptionPage> optionsPageMap = new HashMap<String, ICOptionPage>();
|
||||||
private Map<String, List<ILanguageSettingsProvider>> initialProvidersByCfg = new HashMap<String, List<ILanguageSettingsProvider>>();
|
private Map<String/*cfgId*/, List<ILanguageSettingsProvider>> initialProvidersByCfg = new HashMap<String, List<ILanguageSettingsProvider>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label provider for language settings providers displayed by this tab.
|
* Label provider for language settings providers displayed by this tab.
|
||||||
|
@ -169,6 +169,27 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
|
||||||
return findProvider(id, presentedProviders);
|
return findProvider(id, presentedProviders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the provider equal to provider at the point from which editing started.
|
||||||
|
* Used by option pages when there is a need.
|
||||||
|
* @param id - id of the provider.
|
||||||
|
*
|
||||||
|
* @return the initial provider.
|
||||||
|
*/
|
||||||
|
public ILanguageSettingsProvider getInitialProvider(String id) {
|
||||||
|
ILanguageSettingsProvider initialProvider = null;
|
||||||
|
if (page.isForPrefs()) {
|
||||||
|
initialProvider = LanguageSettingsManager.getWorkspaceProvider(id);
|
||||||
|
} else {
|
||||||
|
ICConfigurationDescription cfgDescription = getConfigurationDescription();
|
||||||
|
List<ILanguageSettingsProvider> initialProviders = initialProvidersByCfg.get(cfgDescription.getId());
|
||||||
|
if (initialProviders != null) {
|
||||||
|
initialProvider = findProvider(id, initialProviders);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return initialProvider;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the provider is a working copy and can be modified.
|
* Check if the provider is a working copy and can be modified.
|
||||||
*/
|
*/
|
||||||
|
@ -1136,7 +1157,16 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void performOK() {
|
protected void performOK() {
|
||||||
// Build Settings page
|
// give option pages a chance for provider-specific pre-apply actions
|
||||||
|
Collection<ICOptionPage> optionPages = optionsPageMap.values();
|
||||||
|
for (ICOptionPage op : optionPages) {
|
||||||
|
try {
|
||||||
|
op.performApply(null);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CUIPlugin.log("Error applying options page", e); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (page.isForPrefs()) {
|
if (page.isForPrefs()) {
|
||||||
try {
|
try {
|
||||||
LanguageSettingsManager.setWorkspaceProviders(presentedProviders);
|
LanguageSettingsManager.setWorkspaceProviders(presentedProviders);
|
||||||
|
@ -1149,15 +1179,6 @@ public class LanguageSettingsProviderTab extends AbstractCPropertyTab {
|
||||||
if (masterPropertyPage != null && enableProvidersCheckBox.getEnabled()) {
|
if (masterPropertyPage != null && enableProvidersCheckBox.getEnabled()) {
|
||||||
masterPropertyPage.applyLanguageSettingsProvidersEnabled();
|
masterPropertyPage.applyLanguageSettingsProvidersEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<ICOptionPage> optionPages = optionsPageMap.values();
|
|
||||||
for (ICOptionPage op : optionPages) {
|
|
||||||
try {
|
|
||||||
op.performApply(null);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
CUIPlugin.log("Error applying options page", e); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,12 +22,13 @@ import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsP
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class to implement language settings providers Options page.
|
* Abstract class to implement language settings providers Options page.
|
||||||
|
* @noextend This class is not intended to be subclassed by clients, only internally by CDT.
|
||||||
*
|
*
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractLanguageSettingProviderOptionPage extends AbstractCOptionPage {
|
public abstract class AbstractLanguageSettingProviderOptionPage extends AbstractCOptionPage {
|
||||||
private LanguageSettingsProviderTab providerTab;
|
protected LanguageSettingsProviderTab providerTab;
|
||||||
private String providerId;
|
protected String providerId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the options page with the owning tab and provider ID.
|
* Initialize the options page with the owning tab and provider ID.
|
||||||
|
|
Loading…
Add table
Reference in a new issue