From 9f2b40cbd948c2e16832541f3b9235bc78124595 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Thu, 12 Jul 2007 14:00:33 +0000 Subject: [PATCH] Fix for 170464: Can't disable binary parser --- .../cdt/core/testplugin/CProjectHelper.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/CProjectHelper.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/CProjectHelper.java index f87a03e4301..ac069cce3f2 100644 --- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/CProjectHelper.java +++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/CProjectHelper.java @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation * Andrew Ferguson (Symbian) * Markus Schorn (Wind River Systems) + * Anton Leherbauer (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.core.testplugin; import java.io.File; @@ -21,6 +22,7 @@ import junit.framework.Assert; import org.eclipse.cdt.core.CCProjectNature; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CProjectNature; +import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.IArchive; @@ -102,6 +104,7 @@ public class CProjectHelper { addNatureToProject(project, CProjectNature.C_NATURE_ID, null); CCorePlugin.getDefault().mapCProjectOwner(project, projectId, false); } + addDefaultBinaryParser(project); newProject[0] = CCorePlugin.getDefault().getCoreModel().create(project); } }, null); @@ -109,6 +112,21 @@ public class CProjectHelper { return newProject[0]; } + /** + * Add the default binary parser if no binary parser configured. + * + * @param project + * @throws CoreException + */ + public static void addDefaultBinaryParser(IProject project) throws CoreException { + ICExtensionReference[] binaryParsers= CCorePlugin.getDefault().getBinaryParserExtensions(project); + if (binaryParsers == null || binaryParsers.length == 0) { + ICProjectDescription desc= CCorePlugin.getDefault().getProjectDescription(project); + desc.getDefaultSettingConfiguration().create(CCorePlugin.BINARY_PARSER_UNIQ_ID, CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID); + CCorePlugin.getDefault().setProjectDescription(project, desc); + } + } + /** * Creates a ICProject. */ @@ -166,6 +184,7 @@ public class CProjectHelper { mngr.setProjectDescription(project, projDes); // CCorePlugin.getDefault().mapCProjectOwner(project, projectId, false); } + addDefaultBinaryParser(project); newProject[0] = CCorePlugin.getDefault().getCoreModel().create(project); } }, null);