From ecdbf0cd6e722adddf5f9906c55b0b0d61654bf9 Mon Sep 17 00:00:00 2001 From: Sean Evoy Date: Wed, 14 Apr 2004 19:39:22 +0000 Subject: [PATCH] Fix for bugzilla 58164 "Change the tool command "gcc" not resetable" and bugzilla 58497 "Can't create a Managed Project". In the first case, the version testing did not take the qualifier the nightly build adds into account so it thought the plugin version was too high, and in the second, the configuration was not flagged as dirty, so after the reset, the change back was not saved. --- .../core/ManagedBuildManager.java | 18 ++++++++++++++---- .../internal/core/Configuration.java | 1 + .../ui/properties/BuildPropertyPage.java | 7 ++++++- .../ui/properties/FileListControl.java | 19 ++++++++----------- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java index febd9528f9c..0c67bacec7c 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java @@ -71,7 +71,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI public static final String EXTENSION_POINT_ID = "ManagedBuildInfo"; //$NON-NLS-1$ // This is the version of the manifest and project files that - private static final PluginVersionIdentifier buildInfoVersion = new PluginVersionIdentifier("2.0.0"); //$NON-NLS-1$ + private static final PluginVersionIdentifier buildInfoVersion = new PluginVersionIdentifier(2, 0, 0); private static boolean extensionTargetsLoaded = false; private static Map extensionTargetMap; private static List extensionTargets; @@ -455,6 +455,18 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI return new Target(resource, parentTarget); } + private static boolean isVersionCompatible(IPluginDescriptor descriptor) { + // Get the version of the manifest + PluginVersionIdentifier plugin = descriptor.getVersionIdentifier(); + + // We can ignore the qualifier + PluginVersionIdentifier version = new PluginVersionIdentifier(plugin.getMajorComponent(), + plugin.getMinorComponent(), + plugin.getServiceComponent()); + + return(buildInfoVersion.isCompatibleWith(version)); + } + /* (non-Javadoc) * Load the build information for the specified resource from its project * file. Pay attention to the version number too. @@ -492,9 +504,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI // Get those extensions IPluginDescriptor descriptor = ManagedBuilderCorePlugin.getDefault().getDescriptor(); - // Get the version of the manifest - PluginVersionIdentifier version = descriptor.getVersionIdentifier(); - if (version.isGreaterThan(buildInfoVersion)) { + if (!isVersionCompatible(descriptor)) { //The version of the Plug-in is greater than what the manager thinks it understands throw new BuildException(ManagedBuilderCorePlugin.getResourceString("ManagedBuildManager.error.version.higher")); //$NON-NLS-1$ } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java index 8239b6764e5..0ba0e7ab587 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java @@ -412,6 +412,7 @@ public class Configuration extends BuildObject implements IConfiguration { ref.resolveReferences(); } } + isDirty = true; } /** diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java index 461678c2e7c..4ebc143e28b 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildPropertyPage.java @@ -831,8 +831,13 @@ public class BuildPropertyPage extends PropertyPage implements IWorkbenchPropert // Recreate the settings store for the configuration settingsStore = new BuildToolsSettingsStore(getSelectedConfiguration()); - // Reset the category selection and run selection event handler + // Write out the build model info + ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration()); + ManagedBuildManager.saveBuildInfo(getProject(), false); + + // Reset the category or tool selection and run selection event handler selectedCategory = null; + selectedTool = null; handleOptionSelection(); } diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControl.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControl.java index 93ee485af9a..012b7c7a234 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControl.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/FileListControl.java @@ -13,6 +13,7 @@ import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIImages; import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIPlugin; import org.eclipse.core.runtime.IPath; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; @@ -123,11 +124,9 @@ public class FileListControl { private List list; private String compTitle; private SelectionListener selectionListener; - private GridData gdata, tgdata, grid3, grid4, grid2; - // types of dialogs that will be displayed when the add button is pressed. -// public static final int FILE_DIALOG = 0; -// public static final int DIR_DIALOG = 1; -// public static final int TEXT_DIALOG = 2; + private GridData tgdata, grid3, grid4, grid2; + + // The type of browse support that is required private int browseType; private IPath path; private static final String ADD_STR = ManagedBuilderUIPlugin.getResourceString("FileListControl.add"); //$NON-NLS-1$ @@ -171,20 +170,18 @@ public class FileListControl { form1.marginHeight = 0; form1.marginWidth = 0; filePanel.setLayout(form1); - gdata = new GridData(GridData.FILL_BOTH); - gdata.heightHint = 83; - filePanel.setLayoutData(gdata); + filePanel.setLayoutData(new GridData(GridData.FILL_BOTH)); + // title panel Composite titlePanel = new Composite(filePanel, SWT.BORDER); - GridLayout titleform = new GridLayout(); - titleform.numColumns = 2; + GridLayout titleform = new GridLayout(2, false); titleform.horizontalSpacing = 0; titleform.verticalSpacing = 0; titleform.marginHeight = 0; titleform.marginWidth = 0; titlePanel.setLayout(titleform); tgdata = new GridData(GridData.FILL_HORIZONTAL); - tgdata.heightHint = 22; + tgdata.heightHint = IDialogConstants.BUTTON_BAR_HEIGHT; titlePanel.setLayoutData(tgdata); title = new Label(titlePanel, SWT.NONE | SWT.BOLD); this.compTitle = " " + compTitle; //$NON-NLS-1$