diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/BinaryTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/BinaryTests.java index 55a588c62c0..2d5674f26fa 100644 --- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/BinaryTests.java +++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/BinaryTests.java @@ -14,6 +14,7 @@ import junit.framework.TestSuite; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.ICDescriptor; +import org.eclipse.cdt.core.ICDescriptorOperation; import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; @@ -25,6 +26,7 @@ import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; @@ -88,12 +90,14 @@ public class BinaryTests extends TestCase { // since our test require that we can read the debug info from the exe whne must set the GNU elf // binary parser since the default (generic elf binary parser) does not do this. - ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(testProject.getProject()); - desc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); - desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, "org.eclipse.cdt.core.GNU_ELF"); - - // Reset the binary parser the paths may have change. - CCorePlugin.getDefault().getCoreModel().resetBinaryParser(testProject.getProject()); + ICDescriptorOperation op = new ICDescriptorOperation() { + + public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException { + descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); + descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, "org.eclipse.cdt.core.GNU_ELF"); + } + }; + CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(testProject.getProject(), op, null); if (testProject==null) fail("Unable to create project"); diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CPathEntryTest.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CPathEntryTest.java index 5b86c5291da..2a4c523af87 100644 --- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CPathEntryTest.java +++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CPathEntryTest.java @@ -152,7 +152,7 @@ public class CPathEntryTest extends TestCase { // We always have at least two entries: // 1) the default sourceEntry becomes the project // 2) the default outputEntry becomes the project - assertTrue("Expecting 3 pathentries", entries.length == (3 + 2)); + assertTrue("Expecting 5 pathentries", entries.length == (3 + 2)); testProject.setRawPathEntries(null, null); } diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 8fd3941f0d9..1bd542a99b5 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,10 @@ +2004-03-19 David Inglis + Update changing binary parser to use cdescriptor operation and remove call to deprecated call + Added check before changes to prevent uneccessary changes of the .cdtproject file. + * src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java + * src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java + * src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java + 2004-03-19 Hoda Amer Fix for bug#54325 Refactor: Check for name collision diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java index e59a8de2d69..729d4da2e20 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java @@ -7,7 +7,7 @@ * * Contributors: * QNX Software Systems - Initial API and implementation -***********************************************************************/ + ***********************************************************************/ package org.eclipse.cdt.ui.dialogs; import java.util.HashMap; @@ -15,6 +15,7 @@ import java.util.Iterator; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.ICDescriptor; +import org.eclipse.cdt.core.ICDescriptorOperation; import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.internal.ui.CUIMessages; import org.eclipse.cdt.internal.ui.ICHelpContextIds; @@ -40,14 +41,14 @@ import org.eclipse.ui.help.WorkbenchHelp; public class BinaryParserBlock extends AbstractBinaryParserPage { - private static final String PREFIX = "BinaryParserBlock"; // $NON-NLS-1$ //$NON-NLS-1$ - private static final String LABEL = PREFIX + ".label"; // $NON-NLS-1$ //$NON-NLS-1$ - private static final String DESC = PREFIX + ".desc"; // $NON-NLS-1$ //$NON-NLS-1$ + private static final String PREFIX = "BinaryParserBlock"; //$NON-NLS-1$ + private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$ + private static final String DESC = PREFIX + ".desc"; //$NON-NLS-1$ protected Combo comboBox; - private HashMap idMap = new HashMap(); - private String initial; - private Preferences fPrefs; + HashMap idMap = new HashMap(); + String initial; + Preferences fPrefs; public BinaryParserBlock(Preferences prefs) { super(CUIPlugin.getResourceString(LABEL)); @@ -72,6 +73,7 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { gd.grabExcessHorizontalSpace = true; comboBox.setLayoutData(gd); comboBox.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { getContainer().updateContainer(); handleBinaryParserChanged(); @@ -109,29 +111,43 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { monitor = new NullProgressMonitor(); } monitor.beginTask(CUIMessages.getString("BinaryParserBlock.settingBinaryParser"), 2); //$NON-NLS-1$ - String selected = comboBox.getText(); + final String selected = comboBox.getText(); if (selected != null) { - if (initial == null || !selected.equals(initial)) { - if (getContainer().getProject() != null) { - ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(getContainer().getProject()); - desc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); - desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, (String) idMap.get(selected)); - } else { + if (getContainer().getProject() != null) { + ICDescriptorOperation op = new ICDescriptorOperation() { + + public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException { + if (initial == null || !selected.equals(initial)) { + descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); + descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, (String) idMap.get(selected)); + } + monitor.worked(1); + // Give a chance to the contributions to save. + // We have to do it last to make sure the parser id + // is save + // in .cdtproject + ICOptionPage page = getCurrentBinaryParserPage(); + if (page != null) { + page.performApply(new SubProgressMonitor(monitor, 1)); + } + } + }; + CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(getContainer().getProject(), op, monitor); + } else { + if (initial == null || !selected.equals(initial)) { fPrefs.setValue(CCorePlugin.PREF_BINARY_PARSER, (String) idMap.get(selected)); } - initial = selected; + monitor.worked(1); + // Give a chance to the contributions to save. + // We have to do it last to make sure the parser id is save + // in .cdtproject + ICOptionPage page = getCurrentBinaryParserPage(); + if (page != null) { + page.performApply(new SubProgressMonitor(monitor, 1)); + } } + initial = selected; } - monitor.worked(1); - // Give a chance to the contributions to save. - // We have to do it last to make sure the parser id is save - // in .cdtproject - super.performApply(new SubProgressMonitor(monitor, 1)); - - // Reset the binary parser the paths may have change. - if (getContainer().getProject() != null) - CCorePlugin.getDefault().getCoreModel().resetBinaryParser(getContainer().getProject()); - monitor.done(); } @@ -201,4 +217,4 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { return (String) idMap.get(selected); } -} +} \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java index 824c9f82974..bfa6e55ec26 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java @@ -7,7 +7,7 @@ * * Contributors: * QNX Software Systems - Initial API and implementation -***********************************************************************/ + ***********************************************************************/ package org.eclipse.cdt.ui.dialogs; @@ -52,7 +52,9 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { protected Text fCPPFiltCommandText; protected Text fCygPathCommandText; - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor) */ public void performApply(IProgressMonitor monitor) throws CoreException { @@ -67,11 +69,10 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { monitor.beginTask(CUIMessages.getString("BinaryParserPage.task.savingAttributes"), 1); //$NON-NLS-1$ IProject proj = getContainer().getProject(); if (proj != null) { + String parserID = ""; //$NON-NLS-1$ ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj); ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); - if (cext.length == 0) { - // The value was not save yet and we need to save it now - // to apply the changes. Search the extension for our own ID + if (cext.length > 0) { IPluginDescriptor descriptor = CUIPlugin.getDefault().getDescriptor(); IExtensionPoint point = descriptor.getExtensionPoint("BinaryParserPage"); //$NON-NLS-1$ IConfigurationElement[] infos = point.getConfigurationElements(); @@ -80,27 +81,27 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { String clazz = infos[i].getAttribute("class"); //$NON-NLS-1$ String ego = getClass().getName(); if (clazz != null && clazz.equals(ego)) { - cdesc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); - cdesc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, id); + parserID = id; + break; + } + } + for (int i = 0; i < cext.length; i++) { + if (cext[i].getID().equals(parserID)) { + String orig = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$ + if (orig == null || !orig.equals(addr2line)) { + cext[0].setExtensionData("addr2line", addr2line); //$NON-NLS-1$ + } + orig = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$ + if (orig == null || !orig.equals(cppfilt)) { + cext[0].setExtensionData("c++filt", cppfilt); //$NON-NLS-1$ + } + orig = cext[0].getExtensionData("cygpath"); //$NON-NLS-1$ + if (orig == null || !orig.equals(cygpath)) { + cext[0].setExtensionData("cygpath", cygpath); //$NON-NLS-1$ + } } } - // Try again. - cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); } - if (cext.length > 0) { - String orig = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$ - if (orig == null || !orig.equals(addr2line)) { - cext[0].setExtensionData("addr2line", addr2line); //$NON-NLS-1$ - } - orig = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$ - if (orig == null || !orig.equals(cppfilt)) { - cext[0].setExtensionData("c++filt", cppfilt); //$NON-NLS-1$ - } - orig = cext[0].getExtensionData("cygpath"); //$NON-NLS-1$ - if (orig == null || !orig.equals(cygpath)) { - cext[0].setExtensionData("cygpath", cygpath); //$NON-NLS-1$ - } - } } else { Preferences store = getContainer().getPreferences(); if (store != null) { @@ -111,7 +112,9 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { } } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults() */ public void performDefaults() { @@ -143,7 +146,9 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { fCygPathCommandText.setText((cygpath == null || cygpath.length() == 0) ? "cygpath" : cygpath); //$NON-NLS-1$; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { @@ -157,6 +162,7 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { fAddr2LineCommandText = ControlFactory.createTextField(comp, SWT.SINGLE | SWT.BORDER); fAddr2LineCommandText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent evt) { //updateLaunchConfigurationDialog(); } @@ -164,6 +170,7 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { Button button = ControlFactory.createPushButton(comp, CUIMessages.getString("BinaryParserPage.label.browse")); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent evt) { handleAddr2LineButtonSelected(); //updateLaunchConfigurationDialog(); @@ -194,12 +201,14 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { gd = new GridData(GridData.FILL_HORIZONTAL); fCPPFiltCommandText.setLayoutData(gd); fCPPFiltCommandText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent evt) { //updateLaunchConfigurationDialog(); } }); button = ControlFactory.createPushButton(comp, CUIMessages.getString("BinaryParserPage.label.browse")); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent evt) { handleCPPFiltButtonSelected(); //updateLaunchConfigurationDialog(); @@ -230,12 +239,14 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { gd = new GridData(GridData.FILL_HORIZONTAL); fCygPathCommandText.setLayoutData(gd); fCygPathCommandText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent evt) { //updateLaunchConfigurationDialog(); } }); button = ControlFactory.createPushButton(comp, CUIMessages.getString("BinaryParserPage.label.browse")); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent evt) { handleCygPathButtonSelected(); //updateLaunchConfigurationDialog(); @@ -261,4 +272,4 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { performDefaults(); } -} +} \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java index ec392d35cfd..a8124535323 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java @@ -7,7 +7,7 @@ * * Contributors: * QNX Software Systems - Initial API and implementation -***********************************************************************/ + ***********************************************************************/ package org.eclipse.cdt.ui.dialogs; @@ -50,7 +50,9 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage { protected Text fAddr2LineCommandText; protected Text fCPPFiltCommandText; - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor) */ public void performApply(IProgressMonitor monitor) throws CoreException { @@ -64,11 +66,10 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage { monitor.beginTask(CUIMessages.getString("BinaryParserPage.task.savingAttributes"), 1); //$NON-NLS-1$ IProject proj = getContainer().getProject(); if (proj != null) { + String parserID = ""; //$NON-NLS-1$ ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj); ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); - if (cext.length == 0) { - // The value was not save yet and we need to save it now - // to apply the changes. Search the extension for our own ID + if (cext.length > 0) { IPluginDescriptor descriptor = CUIPlugin.getDefault().getDescriptor(); IExtensionPoint point = descriptor.getExtensionPoint("BinaryParserPage"); //$NON-NLS-1$ IConfigurationElement[] infos = point.getConfigurationElements(); @@ -77,23 +78,24 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage { String clazz = infos[i].getAttribute("class"); //$NON-NLS-1$ String ego = getClass().getName(); if (clazz != null && clazz.equals(ego)) { - cdesc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); - cdesc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, id); + parserID = id; + break; + } + } + for (int i = 0; i < cext.length; i++) { + if (cext[i].getID().equals(parserID)) { + + String orig = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$ + if (orig == null || !orig.equals(addr2line)) { + cext[0].setExtensionData("addr2line", addr2line); //$NON-NLS-1$ + } + orig = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$ + if (orig == null || !orig.equals(cppfilt)) { + cext[0].setExtensionData("c++filt", cppfilt); //$NON-NLS-1$ + } } } - // Try again. - cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); } - if (cext.length > 0) { - String orig = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$ - if (orig == null || !orig.equals(addr2line)) { - cext[0].setExtensionData("addr2line", addr2line); //$NON-NLS-1$ - } - orig = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$ - if (orig == null || !orig.equals(cppfilt)) { - cext[0].setExtensionData("c++filt", cppfilt); //$NON-NLS-1$ - } - } } else { Preferences store = getContainer().getPreferences(); if (store != null) { @@ -103,7 +105,9 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage { } } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults() */ public void performDefaults() { @@ -131,7 +135,9 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage { fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt); //$NON-NLS-1$ } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { @@ -145,6 +151,7 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage { fAddr2LineCommandText = ControlFactory.createTextField(comp, SWT.SINGLE | SWT.BORDER); fAddr2LineCommandText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent evt) { //updateLaunchConfigurationDialog(); } @@ -152,6 +159,7 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage { Button button = ControlFactory.createPushButton(comp, CUIMessages.getString("BinaryParserPage.label.browse")); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent evt) { handleAddr2LineButtonSelected(); //updateLaunchConfigurationDialog(); @@ -182,12 +190,14 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage { gd = new GridData(GridData.FILL_HORIZONTAL); fCPPFiltCommandText.setLayoutData(gd); fCPPFiltCommandText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent evt) { //updateLaunchConfigurationDialog(); } }); button = ControlFactory.createPushButton(comp, CUIMessages.getString("BinaryParserPage.label.browse")); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent evt) { handleCPPFiltButtonSelected(); //updateLaunchConfigurationDialog(); @@ -213,4 +223,4 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage { performDefaults(); } -} +} \ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CProjectHelper.java b/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CProjectHelper.java index 93b9edf5abe..61bd39a8a8d 100644 --- a/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CProjectHelper.java +++ b/debug/org.eclipse.cdt.debug.ui.tests/src/org/eclipse/cdt/debug/testplugin/CProjectHelper.java @@ -7,6 +7,7 @@ import java.util.zip.ZipFile; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.ICDescriptor; +import org.eclipse.cdt.core.ICDescriptorOperation; import org.eclipse.cdt.core.model.IArchive; import org.eclipse.cdt.core.model.IArchiveContainer; import org.eclipse.cdt.core.model.IBinary; @@ -53,12 +54,16 @@ public class CProjectHelper { ICProject cproject = CCorePlugin.getDefault().getCoreModel().create(project); /* Try to guess at the correct binary parser.. elf or pe at this point.. */ - String os = System.getProperty("os.name"); - boolean pe=(os.toLowerCase().indexOf("windows")!=-1); - ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(project); - desc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); - desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, pe?"org.eclipse.cdt.core.PE":"org.eclipse.cdt.core.ELF"); - CCorePlugin.getDefault().getCoreModel().resetBinaryParser(project); + ICDescriptorOperation op = new ICDescriptorOperation() { + + public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException { + descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); + String os = System.getProperty("os.name"); + boolean pe=(os.toLowerCase().indexOf("windows")!=-1); + descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, pe?"org.eclipse.cdt.core.PE":"org.eclipse.cdt.core.ELF"); + } + }; + CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(project, op, null); return cproject; }