Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Treggiari2005-07-10 03:25:24 +0000
committerLeo Treggiari2005-07-10 03:25:24 +0000
commit07d3cbbf01043e6d5ff4dd4714a6b5a0a52aa60d (patch)
treebbd4996f3e2e89f3f1b2d528d390b274b3f443ab /build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal
parent610f6d0daca723370d76133c3f9d6ea41f35390c (diff)
downloadorg.eclipse.cdt-07d3cbbf01043e6d5ff4dd4714a6b5a0a52aa60d.tar.gz
org.eclipse.cdt-07d3cbbf01043e6d5ff4dd4714a6b5a0a52aa60d.tar.xz
org.eclipse.cdt-07d3cbbf01043e6d5ff4dd4714a6b5a0a52aa60d.zip
Fix problem with trying to access managedBuildInfo before the .cdtbuild file is created
Update how .c extension is added to a converted project Update how the project specific file extensions are obtained Fix problem with resolving options
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java53
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedMakeProject.java43
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java34
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties3
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java15
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java50
7 files changed, 93 insertions, 109 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
index b61a154b890..7bfd97df0a6 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/InputType.java
@@ -683,23 +683,6 @@ public class InputType extends BuildObject implements IInputType {
}
return (IPath[])ins.toArray(new IPath[ins.size()]);
}
-
- /* (non-Javadoc)
- * Returns the project that uses this IInputType
- */
- public IProject getProject(ITool tool) {
- IBuildObject toolParent = tool.getParent();
- if (toolParent != null) {
- if (toolParent instanceof IToolChain) {
- IConfiguration config = ((IToolChain)toolParent).getParent();
- if (config == null) return null;
- return (IProject)config.getOwner();
- } else if (toolParent instanceof IResourceConfiguration) {
- return (IProject)((IResourceConfiguration)toolParent).getOwner();
- }
- }
- return null;
- }
/* (non-Javadoc)
* Memory-safe way to access the list of input orders
@@ -833,23 +816,7 @@ public class InputType extends BuildObject implements IInputType {
// Use content type if specified and registered with Eclipse
IContentType type = getDependencyContentType();
if (type != null) {
- IContentTypeSettings settings = null;
- IProject project = getProject(tool);
- if (project != null) {
- IScopeContext projectScope = new ProjectScope(project);
- try {
- settings = type.getSettings(projectScope);
- } catch (Exception e) {}
- if (settings != null) {
- String[] specs = settings.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
- // TODO: There doesn't seem to be any way to distinguish between these 2 cases:
- // 1. No project specific entries have been set so getFileSpecs returns an empty list
- // 2. There are project specific entries and all of the "default" entries have been removed
- // For now, we have to assume the first case.
- if (specs.length > 0) return specs;
- }
- }
- return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ return ((Tool)tool).getContentTypeFileSpecs(type);
}
return getDependencyExtensionsAttribute();
}
@@ -1049,23 +1016,7 @@ public class InputType extends BuildObject implements IInputType {
// Use content type if specified and registered with Eclipse
IContentType type = getSourceContentType();
if (type != null) {
- IContentTypeSettings settings = null;
- IProject project = getProject(tool);
- if (project != null) {
- IScopeContext projectScope = new ProjectScope(project);
- try {
- settings = type.getSettings(projectScope);
- } catch (Exception e) {}
- if (settings != null) {
- String[] specs = settings.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
- // TODO: There doesn't seem to be any way to distinguish between these 2 cases:
- // 1. No project specific entries have been set so getFileSpecs returns an empty list
- // 2. There are project specific entries and all of the "default" entries have been removed
- // For now, we have to assume the first case.
- if (specs.length > 0) return specs;
- }
- }
- return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ return ((Tool)tool).getContentTypeFileSpecs(type);
}
return getSourceExtensionsAttribute();
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedMakeProject.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedMakeProject.java
index 797d5d1f36c..e16b3c3e0db 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedMakeProject.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedMakeProject.java
@@ -66,28 +66,33 @@ public class ManagedMakeProject implements ICOwner {
private void updateBinaryParsers(ICDescriptor cDescriptor) throws CoreException {
IManagedBuildInfo buildInfo = null;
String[] ids = null;
- try {
- IProject project = cDescriptor.getProject();
- buildInfo = ManagedBuildManager.getBuildInfo(project);
- if (buildInfo != null) {
- IConfiguration config = buildInfo.getDefaultConfiguration();
- if (config == null && buildInfo.getManagedProject() != null) {
- IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
- if (configs != null && configs.length > 0)
- config = configs[0];
- }
- if (config != null) {
- // Get the values from the current configuration
- IToolChain toolChain = config.getToolChain();
- if (toolChain != null) {
- ITargetPlatform targPlatform = toolChain.getTargetPlatform();
- if (targPlatform != null) {
- ids = targPlatform.getBinaryParserList();
- }
+ IProject project = cDescriptor.getProject();
+
+ // If we cannot get the build information, it may be due to the fact that the
+ // build information is yet to be created, due to a synchronization issue
+ // Don't do anything now to the binary parsers because there is nothing meaningful to do.
+ // This routine should be invoked later, when the required build information is available
+ if (!ManagedBuildManager.canGetBuildInfo(project)) return;
+
+ buildInfo = ManagedBuildManager.getBuildInfo(project);
+ if (buildInfo != null) {
+ IConfiguration config = buildInfo.getDefaultConfiguration();
+ if (config == null && buildInfo.getManagedProject() != null) {
+ IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
+ if (configs != null && configs.length > 0)
+ config = configs[0];
+ }
+ if (config != null) {
+ // Get the values from the current configuration
+ IToolChain toolChain = config.getToolChain();
+ if (toolChain != null) {
+ ITargetPlatform targPlatform = toolChain.getTargetPlatform();
+ if (targPlatform != null) {
+ ids = targPlatform.getBinaryParserList();
}
}
}
- } catch (Exception e) {return;}
+ }
cDescriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
if (ids != null) {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
index d64e09b70ef..68d3ea0be99 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
@@ -1527,6 +1527,10 @@ public class Option extends BuildObject implements IOption {
superClassId,
"option", //$NON-NLS-1$
getId());
+ } else {
+ // All of our superclasses must be resolved in order to call
+ // getValueType below.
+ ((Option)superClass).resolveReferences();
}
}
if (categoryId != null) {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java
index 082a3856363..809bdc25f00 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OutputType.java
@@ -419,22 +419,6 @@ public class OutputType extends BuildObject implements IOutputType {
return parent;
}
- /* (non-Javadoc)
- * Returns the project that uses this IOutputType
- */
- public IProject getProject(ITool tool) {
- IProject project = null;
- IBuildObject toolParent = tool.getParent();
- if (toolParent != null) {
- if (toolParent instanceof IToolChain) {
- return (IProject)((IToolChain)toolParent).getParent().getOwner();
- } else if (toolParent instanceof IResourceConfiguration) {
- return (IProject)((IResourceConfiguration)toolParent).getOwner();
- }
- }
- return project;
- }
-
/*
* M O D E L A T T R I B U T E A C C E S S O R S
*/
@@ -662,23 +646,7 @@ public class OutputType extends BuildObject implements IOutputType {
// Use content type if specified and registered with Eclipse
IContentType type = getOutputContentType();
if (type != null) {
- IContentTypeSettings settings = null;
- IProject project = getProject(tool);
- if (project != null) {
- IScopeContext projectScope = new ProjectScope(project);
- try {
- settings = type.getSettings(projectScope);
- } catch (Exception e) {}
- if (settings != null) {
- String[] specs = settings.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
- // TODO: There doesn't seem to be any way to distinguish between these 2 cases:
- // 1. No project specific entries have been set so getFileSpecs returns an empty list
- // 2. There are project specific entries and all of the "default" entries have been removed
- // For now, we have to assume the first case.
- if (specs.length > 0) return specs;
- }
- }
- return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ return ((Tool)tool).getContentTypeFileSpecs(type);
}
return getOutputExtensionsAttribute();
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
index af6b240fcb1..6c8ffdae2fb 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
@@ -48,9 +48,10 @@ ManagedBuildManager.error.manifest.option.category=Option {0} uses a null catego
ManagedBuildManager.error.manifest.option.filter=Option {0} uses an unsupported resourceFilter attribute value. The option was ignored.
ManagedBuildManager.error.manifest.option.valuehandler=Could not load value handler {0} in option {1}.
ManagedBuildManager.error.open_failed_title=Managed Make Project File Error
-ManagedBuildManager.error.open_failed=The Managed Make project file could not be read because of the following error.\n\n{0}\n\nManaged Make functionality will not be available for this project.
+ManagedBuildManager.error.open_failed=The Managed Make project file could not be read because of the following error:\n\n{0}\n\nManaged Make functionality will not be available for this project.
ManagedBuildManager.error.project.version.error=The version number of the project {0} is greater than the Managed Build System version number.
ManagedBuildManager.error.id.nomatch=Error loading Managed Make project information for project {0}. The tool definitions used to create the project are not available.
+ManagedBuildManager.error.project.file.missing=The Managed Make project file for project {0} is missing.
# Makefile Generator Messages
MakefileGenerator.message.start.file=Building file:
MakefileGenerator.message.finish.file=Finished building:
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java
index 1be5cc97fbf..1cb791f8126 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java
@@ -253,13 +253,17 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
private IManagedBuilderMakefileGenerator getInitializedGenerator(IProject project){
IManagedBuilderMakefileGenerator makeGen = (IManagedBuilderMakefileGenerator)fBuildFileGeneratorMap.get(project);
- if(makeGen == null){
- try{
- if(project.hasNature(ManagedCProjectNature.MNG_NATURE_ID)){
+ if (makeGen == null) {
+ try {
+ if (project.hasNature(ManagedCProjectNature.MNG_NATURE_ID)) {
+ // Determine if we can access the build info before actually trying
+ // If not, don't try, to avoid putting up a dialog box warning the user
+ if (!ManagedBuildManager.canGetBuildInfo(project)) return null;
+
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
- if(buildInfo != null){
+ if (buildInfo != null){
IConfiguration defaultCfg = buildInfo.getDefaultConfiguration();
- if(defaultCfg != null){
+ if (defaultCfg != null) {
makeGen = ManagedBuildManager.getBuildfileGenerator(defaultCfg);
makeGen.initialize(project,buildInfo,new NullProgressMonitor());
fBuildFileGeneratorMap.put(project,makeGen);
@@ -267,6 +271,7 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
}
}
} catch (CoreException e){
+ return null;
}
}
return makeGen;
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
index d8f9df51020..a191d116f48 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
@@ -46,6 +46,8 @@ import org.eclipse.cdt.managedbuilder.internal.macros.MacroResolver;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IExtension;
@@ -54,6 +56,9 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PluginVersionIdentifier;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.core.runtime.content.IContentTypeSettings;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -2639,4 +2644,49 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory {
public IConfigurationElement getCurrentMbsVersionConversionElement() {
return currentMbsVersionConversionElement;
}
+
+ public IProject getProject() {
+ IBuildObject toolParent = getParent();
+ if (toolParent != null) {
+ if (toolParent instanceof IToolChain) {
+ IConfiguration config = ((IToolChain)toolParent).getParent();
+ if (config == null) return null;
+ return (IProject)config.getOwner();
+ } else if (toolParent instanceof IResourceConfiguration) {
+ return (IProject)((IResourceConfiguration)toolParent).getOwner();
+ }
+ }
+ return null;
+ }
+
+ public String[] getContentTypeFileSpecs (IContentType type) {
+ String[] globalSpecs = type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ IContentTypeSettings settings = null;
+ IProject project = getProject();
+ if (project != null) {
+ IScopeContext projectScope = new ProjectScope(project);
+ try {
+ settings = type.getSettings(projectScope);
+ } catch (Exception e) {}
+ if (settings != null) {
+ String[] specs = settings.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ if (specs.length > 0) {
+ int total = globalSpecs.length + specs.length;
+ String[] projSpecs = new String[total];
+ int i=0;
+ for (int j=0; j<specs.length; j++) {
+ projSpecs[i] = specs[j];
+ i++;
+ }
+ for (int j=0; j<globalSpecs.length; j++) {
+ projSpecs[i] = globalSpecs[j];
+ i++;
+ }
+ return projSpecs;
+ }
+ }
+ }
+ return globalSpecs;
+ }
+
}

Back to the top