diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CygpathTranslator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CygpathTranslator.java index 0dae0bd6ee2..820df07aac7 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CygpathTranslator.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CygpathTranslator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. + * Copyright (c) 2004, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,7 +20,8 @@ import java.util.List; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IBinaryParser; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.model.CoreModelUtil; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.utils.CygPath; import org.eclipse.cdt.utils.ICygwinToolsFactroy; import org.eclipse.core.resources.IProject; @@ -43,10 +44,10 @@ public class CygpathTranslator { public CygpathTranslator(IProject project) { try { - ICExtensionReference[] parserRef = CCorePlugin.getDefault().getBinaryParserExtensions(project); + ICConfigExtensionReference[] parserRef = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project); for (int i = 0; i < parserRef.length; i++) { try { - IBinaryParser parser = (IBinaryParser)parserRef[i].createExtension(); + IBinaryParser parser = CoreModelUtil.getBinaryParser(parserRef[i]); ICygwinToolsFactroy cygwinToolFactory = (ICygwinToolsFactroy) parser.getAdapter(ICygwinToolsFactroy.class); if (cygwinToolFactory != null) { cygPath = cygwinToolFactory.getCygPath(); diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModelUtil.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModelUtil.java index 90fed85f2e8..e02cd261fe1 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModelUtil.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModelUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2010 QNX Software Systems and others. + * Copyright (c) 2002, 2011 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,17 +18,21 @@ import java.util.List; import java.util.Map; import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.IBinaryParser; import org.eclipse.cdt.core.index.IIndexFileLocation; import org.eclipse.cdt.core.index.IndexLocationFactory; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting; +import org.eclipse.cdt.internal.core.model.BinaryParserConfig; import org.eclipse.cdt.internal.core.resources.ResourceLookup; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; /** @@ -791,4 +795,16 @@ public class CoreModelUtil { cfg.getTargetPlatformSetting().setBinaryParserIds(pids); } } + + /** + * Instantiate binary parser for given extension reference. + * + * @param ref binary parser extension reference + * @return a binary parser instance + * @throws CoreException if the parser could not be created + * @since 5.3 + */ + public static IBinaryParser getBinaryParser(ICConfigExtensionReference ref) throws CoreException { + return new BinaryParserConfig(ref).getBinaryParser(); + } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java index 49e89d40b55..0a8ec1d3ee5 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. + * Copyright (c) 2007, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,8 +16,8 @@ import java.io.StringReader; import java.io.StringWriter; import java.util.Iterator; import java.util.Map; -import java.util.TreeMap; import java.util.Map.Entry; +import java.util.TreeMap; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -31,14 +31,17 @@ import javax.xml.transform.stream.StreamResult; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePreferenceConstants; -import org.eclipse.cdt.core.ICDescriptor; import org.eclipse.cdt.core.language.ProjectLanguageConfiguration; import org.eclipse.cdt.core.language.WorkspaceLanguageConfiguration; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.cdt.internal.core.Util; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Preferences; +import org.eclipse.core.runtime.preferences.DefaultScope; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.osgi.service.prefs.BackingStoreException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -72,8 +75,8 @@ public class LanguageMappingStore { public ProjectLanguageConfiguration decodeMappings(IProject project) throws CoreException { ProjectLanguageConfiguration config = new ProjectLanguageConfiguration(); - ICDescriptor descriptor = getProjectDescription(project); - ICStorageElement rootElement = descriptor.getProjectStorageElement(LANGUAGE_MAPPING_ID); + ICProjectDescription descriptor = getProjectDescription(project, false); + ICStorageElement rootElement = descriptor.getStorage(LANGUAGE_MAPPING_ID, false); if (rootElement == null) { return config; } @@ -106,8 +109,8 @@ public class LanguageMappingStore { return decodedMappings; } - protected ICDescriptor getProjectDescription(IProject project) throws CoreException { - return CCorePlugin.getDefault().getCProjectDescription(project, true); + protected ICProjectDescription getProjectDescription(IProject project, boolean write) throws CoreException { + return CCorePlugin.getDefault().getProjectDescription(project, write); } private Map decodeContentTypeMappings(Element rootElement) throws CoreException { @@ -146,8 +149,8 @@ public class LanguageMappingStore { } public void storeMappings(IProject project, ProjectLanguageConfiguration config) throws CoreException { - ICDescriptor descriptor = getProjectDescription(project); - ICStorageElement rootElement = descriptor.getProjectStorageElement(LANGUAGE_MAPPING_ID); + ICProjectDescription descriptor = getProjectDescription(project, true); + ICStorageElement rootElement = descriptor.getStorage(LANGUAGE_MAPPING_ID, true); // clear all children and settings rootElement.clear(); @@ -155,7 +158,7 @@ public class LanguageMappingStore { addProjectContentTypeMappings(config.getContentTypeMappings(), projectMappings); addFileMappings(config.getFileMappings(), projectMappings); - descriptor.saveProjectData(); + CCorePlugin.getDefault().setProjectDescription(project, descriptor); } private void addProjectContentTypeMappings(Map> contentTypeMappings, ICStorageElement rootElement) { @@ -192,19 +195,25 @@ public class LanguageMappingStore { serializer.transform(source, result); String encodedMappings = buffer.getBuffer().toString(); - Preferences node = CCorePlugin.getDefault().getPluginPreferences(); - node.setValue(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, encodedMappings); - CCorePlugin.getDefault().savePluginPreferences(); + IEclipsePreferences node = new InstanceScope().getNode(CCorePlugin.PLUGIN_ID); + node.put(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, encodedMappings); + node.flush(); } catch (ParserConfigurationException e) { throw new CoreException(Util.createStatus(e)); } catch (TransformerException e) { throw new CoreException(Util.createStatus(e)); + } catch (BackingStoreException e) { + throw new CoreException(Util.createStatus(e)); } } public WorkspaceLanguageConfiguration decodeWorkspaceMappings() throws CoreException { - Preferences node = CCorePlugin.getDefault().getPluginPreferences(); - String encodedMappings = node.getString(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS); + IEclipsePreferences node = new InstanceScope().getNode(CCorePlugin.PLUGIN_ID); + IEclipsePreferences defaultNode = new DefaultScope().getNode(CCorePlugin.PLUGIN_ID); + String encodedMappings = defaultNode.get(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, null); + if (encodedMappings == null) { + encodedMappings = node.get(CCorePreferenceConstants.WORKSPACE_LANGUAGE_MAPPINGS, null); + } WorkspaceLanguageConfiguration config = new WorkspaceLanguageConfiguration(); if (encodedMappings == null || encodedMappings.length() == 0) { diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ConfigBasedPathEntryStore.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ConfigBasedPathEntryStore.java index 1ec699b13f1..804bcd4cc90 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ConfigBasedPathEntryStore.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ConfigBasedPathEntryStore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Intel Corporation and others. + * Copyright (c) 2007, 2011 Intel Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -97,6 +97,7 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc return fProject; } + @Deprecated public ICExtensionReference getExtensionReference() { return null; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/ProjectMap.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/ProjectMap.java index 4314ba398bf..eb46aa7d26e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/ProjectMap.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/doctools/ProjectMap.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 Symbian Software Systems and others. + * Copyright (c) 2008, 2011 Symbian Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,7 +23,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.ICDescriptor; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner; @@ -114,15 +114,17 @@ class ProjectMap { private static Map load(IProject project) throws CoreException { Map result= new HashMap(); - ICDescriptor pd= CCorePlugin.getDefault().getCProjectDescription(project, true); - ICStorageElement e = pd.getProjectStorageElement(ATTRVAL_STORAGEID); - for (ICStorageElement node : e.getChildrenByName(ELEMENT_DOC_COMMENT_OWNER)) { - String commentOwnerID = node.getAttribute(ATTRKEY_DCO_ID); - if(commentOwnerID != null) { - for (ICStorageElement path : node.getChildrenByName(ELEMENT_PATH)) { - String pathValue= path.getAttribute(ATTRKEY_PATH_VALUE); - if(pathValue != null) { - result.put(Path.fromPortableString(pathValue), commentOwnerID); + ICProjectDescription pd= CCorePlugin.getDefault().getProjectDescription(project, false); + ICStorageElement e = pd.getStorage(ATTRVAL_STORAGEID, false); + if (e != null) { + for (ICStorageElement node : e.getChildrenByName(ELEMENT_DOC_COMMENT_OWNER)) { + String commentOwnerID = node.getAttribute(ATTRKEY_DCO_ID); + if(commentOwnerID != null) { + for (ICStorageElement path : node.getChildrenByName(ELEMENT_PATH)) { + String pathValue= path.getAttribute(ATTRKEY_PATH_VALUE); + if(pathValue != null) { + result.put(Path.fromPortableString(pathValue), commentOwnerID); + } } } } @@ -134,10 +136,10 @@ class ProjectMap { * Write the map to the .cproject file */ public void save() throws CoreException { - ICDescriptor pd= CCorePlugin.getDefault().getCProjectDescription(fProject, true); + ICProjectDescription pd= CCorePlugin.getDefault().getProjectDescription(fProject, true); // remove current associations - ICStorageElement data = pd.getProjectStorageElement(ATTRVAL_STORAGEID); + ICStorageElement data = pd.getStorage(ATTRVAL_STORAGEID, true); for (ICStorageElement child : data.getChildren()) data.removeChild(child); @@ -155,6 +157,6 @@ class ProjectMap { } } } - pd.saveProjectData(); + CCorePlugin.getDefault().setProjectDescription(fProject, pd); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractGNUBinaryParserPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractGNUBinaryParserPage.java index 0c311f86930..cead283cc70 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractGNUBinaryParserPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/AbstractGNUBinaryParserPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. + * Copyright (c) 2003, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,7 +36,9 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.utils.ui.controls.ControlFactory; @@ -71,8 +73,15 @@ public abstract class AbstractGNUBinaryParserPage extends AbstractCOptionPage { monitor.beginTask(CUIMessages.BinaryParserPage_task_savingAttributes, 1); IProject proj = getContainer().getProject(); if (proj != null) { - ICExtensionReference[] cext = CCorePlugin.getDefault().getBinaryParserExtensions(proj); - if (cext.length > 0) { + ICConfigExtensionReference[] cext = null; + ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(proj, true); + if (desc != null) { + ICConfigurationDescription cfgDesc = desc.getDefaultSettingConfiguration(); + if (cfgDesc != null) { + cext = cfgDesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); + } + } + if (cext != null && cext.length > 0) { initializeParserId(); for (int i = 0; i < cext.length; i++) { if (cext[i].getID().equals(parserID)) { @@ -86,6 +95,7 @@ public abstract class AbstractGNUBinaryParserPage extends AbstractCOptionPage { } } } + CCorePlugin.getDefault().setProjectDescription(proj, desc); } } else { Preferences store = getContainer().getPreferences(); @@ -243,7 +253,7 @@ public abstract class AbstractGNUBinaryParserPage extends AbstractCOptionPage { IProject proj = getContainer().getProject(); if (proj != null) { try { - ICExtensionReference[] cext = CCorePlugin.getDefault().getBinaryParserExtensions(proj); + ICConfigExtensionReference[] cext = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(proj); if (cext.length > 0) { initializeParserId(); for (int i = 0; i < cext.length; i++) { 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 b09f2abfe7b..53eb77ad978 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2010 IBM Corporation and others. + * Copyright (c) 2003, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -37,7 +37,7 @@ import org.eclipse.ui.PlatformUI; 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.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.utils.ui.controls.ControlFactory; @@ -287,9 +287,9 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { if (getContainer().getProject() != null) { try { - ICExtensionReference[] ref = CCorePlugin.getDefault().getBinaryParserExtensions(getContainer().getProject()); + ICConfigExtensionReference[] ref = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(getContainer().getProject()); initialSelected = new ArrayList(ref.length); - for (ICExtensionReference element : ref) { + for (ICConfigExtensionReference element : ref) { if (configMap.get(element.getID()) != null) { initialSelected.add(configMap.get(element.getID())); elements.add(configMap.get(element.getID())); 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 905397ae00d..c950f5abda8 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2009 IBM Corporation and others. + * Copyright (c) 2003, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,7 +36,9 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.utils.ui.controls.ControlFactory; @@ -77,8 +79,15 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { IProject proj = getContainer().getProject(); if (proj != null) { String parserID = ""; //$NON-NLS-1$ - ICExtensionReference[] cext = CCorePlugin.getDefault().getBinaryParserExtensions(proj); - if (cext.length > 0) { + ICConfigExtensionReference[] cext = null; + ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(proj, true); + if (desc != null) { + ICConfigurationDescription cfgDesc = desc.getDefaultSettingConfiguration(); + if (cfgDesc != null) { + cext = cfgDesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); + } + } + if (cext != null && cext.length > 0) { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$ IConfigurationElement[] infos = point.getConfigurationElements(); for (int i = 0; i < infos.length; i++) { @@ -110,6 +119,7 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { } } } + CCorePlugin.getDefault().setProjectDescription(proj, desc); } } else { Preferences store = getContainer().getPreferences(); @@ -336,7 +346,7 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { IProject proj = getContainer().getProject(); if (proj != null) { try { - ICExtensionReference[] cext = CCorePlugin.getDefault().getBinaryParserExtensions(proj); + ICConfigExtensionReference[] cext = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(proj); if (cext.length > 0) { addr2line = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$; cppfilt = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java index 13d99a13529..31e2dcdcd7b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2009 IBM Corporation and others. + * Copyright (c) 2003, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,7 +36,9 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.utils.ui.controls.ControlFactory; @@ -68,8 +70,15 @@ public class MachOBinaryParserPage extends AbstractCOptionPage { IProject proj = getContainer().getProject(); if (proj != null) { String parserID = ""; //$NON-NLS-1$ - ICExtensionReference[] cext = CCorePlugin.getDefault().getBinaryParserExtensions(proj); - if (cext.length > 0) { + ICConfigExtensionReference[] cext = null; + ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(proj, true); + if (desc != null) { + ICConfigurationDescription cfgDesc = desc.getDefaultSettingConfiguration(); + if (cfgDesc != null) { + cext = cfgDesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); + } + } + if (cext != null && cext.length > 0) { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$ IConfigurationElement[] infos = point.getConfigurationElements(); for (int i = 0; i < infos.length; i++) { @@ -90,6 +99,7 @@ public class MachOBinaryParserPage extends AbstractCOptionPage { } } } + CCorePlugin.getDefault().setProjectDescription(proj, desc); } } else { Preferences store = getContainer().getPreferences(); @@ -188,7 +198,7 @@ public class MachOBinaryParserPage extends AbstractCOptionPage { IProject proj = getContainer().getProject(); if (proj != null) { try { - ICExtensionReference[] cext = CCorePlugin.getDefault().getBinaryParserExtensions(proj); + ICConfigExtensionReference[] cext = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(proj); if (cext.length > 0) { cppfilt = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$ } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java index f718bb9f96a..6961023eae1 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2010 QNX Software Systems and others. + * Copyright (c) 2004, 2011 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,10 +21,11 @@ import java.util.Map; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.core.IBinaryParser; -import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable; import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; +import org.eclipse.cdt.core.model.CoreModelUtil; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint; @@ -729,9 +730,9 @@ public class CDIDebugModel { private static IBinaryExecutable getBinary( IFile file ) throws CoreException { IProject project = file.getProject(); - ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions( project ); + ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions( project ); for( int i = 0; i < binaryParsersExt.length; i++ ) { - IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension(); + IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]); try { IBinaryFile exe = parser.getBinary( file.getLocation() ); if ( exe instanceof IBinaryExecutable ) { diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SolibSearchPathBlock.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SolibSearchPathBlock.java index ccc070b0998..8a7da35746b 100644 --- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SolibSearchPathBlock.java +++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/SolibSearchPathBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 QNX Software Systems and others. + * Copyright (c) 2000, 2011 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,7 +27,8 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IBinaryParser; import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; import org.eclipse.cdt.core.IBinaryParser.IBinaryShared; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.model.CoreModelUtil; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; import org.eclipse.cdt.debug.mi.core.MICoreUtils; @@ -94,6 +95,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu super( parentShell ); } + @Override protected Control createDialogArea( Composite parent ) { Composite composite = (Composite)super.createDialogArea( parent ); @@ -119,6 +121,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu fBrowseButton.setLayoutData( data ); fBrowseButton.addSelectionListener( new SelectionAdapter() { + @Override public void widgetSelected( SelectionEvent evt ) { DirectoryDialog dialog = new DirectoryDialog( AddDirectoryDialog.this.getShell() ); dialog.setMessage( MIUIMessages.getString( "SolibSearchPathBlock.5" ) ); //$NON-NLS-1$ @@ -133,6 +136,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu return composite; } + @Override protected void configureShell( Shell newShell ) { super.configureShell( newShell ); newShell.setText( MIUIMessages.getString( "SolibSearchPathBlock.Add_Directory" ) ); //$NON-NLS-1$ @@ -146,6 +150,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu fValue = ( value != null ) ? new Path( value ) : null; } + @Override protected void buttonPressed( int buttonId ) { if ( buttonId == IDialogConstants.OK_ID ) { setValue( fText.getText() ); @@ -166,6 +171,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu return ( text.trim().length() > 0 ); } + @Override protected Control createButtonBar( Composite parent ) { Control control = super.createButtonBar( parent ); updateOKButton(); @@ -184,6 +190,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu /* (non-Javadoc) * @see org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField#managedButtonPressed(int) */ + @Override protected boolean managedButtonPressed( int index ) { boolean result = super.managedButtonPressed( index ); if ( result ) @@ -194,6 +201,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu /* (non-Javadoc) * @see org.eclipse.cdt.debug.mi.internal.ui.dialogfields.ListDialogField#getManagedButtonState(org.eclipse.jface.viewers.ISelection, int) */ + @Override protected boolean getManagedButtonState( ISelection sel, int index ) { if ( index > 3 ) return getButtonState( sel, index ); @@ -244,6 +252,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu } }; ILabelProvider lp = new LabelProvider() { + @Override public String getText( Object element ) { if ( element instanceof IPath ) return ((IPath)element).toOSString(); @@ -464,6 +473,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu LabelProvider lp = new LabelProvider() { + @Override public String getText( Object element ) { if ( element instanceof File ) return ((File)element).getName(); @@ -529,9 +539,9 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu if ( project != null ) { IPath fullPath = new Path( file.getPath() ); try { - ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions( project ); + ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions( project ); for( int i = 0; i < binaryParsersExt.length; i++ ) { - IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension(); + IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]); try { IBinaryFile bin = parser.getBinary( fullPath ); if ( bin instanceof IBinaryShared ) { @@ -563,9 +573,9 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu if ( project != null ) { IPath fullPath = new Path( file.getPath() ); try { - ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions( project ); + ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions( project ); for( int i = 0; i < binaryParsersExt.length; i++ ) { - IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension(); + IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]); try { IBinaryFile bin = parser.getBinary( fullPath ); return ( bin instanceof IBinaryShared ); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SolibSearchPathBlock.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SolibSearchPathBlock.java index fadcd1b9755..f67d15f0068 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SolibSearchPathBlock.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/SolibSearchPathBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 QNX Software Systems and others. + * Copyright (c) 2000, 2011 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,7 +27,8 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IBinaryParser; import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; import org.eclipse.cdt.core.IBinaryParser.IBinaryShared; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.model.CoreModelUtil; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.internal.ui.dialogfields.DialogField; import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener; @@ -500,7 +501,7 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu dialog.setTitle(LaunchUIMessages.getString("SolibSearchPathBlock.7")); //$NON-NLS-1$ dialog.setMessage(LaunchUIMessages.getString("SolibSearchPathBlock.8")); //$NON-NLS-1$ dialog.setEmptyListMessage(LaunchUIMessages.getString("SolibSearchPathBlock.9")); //$NON-NLS-1$ - dialog.setSorter(new ViewerSorter()); + dialog.setComparator(new ViewerSorter()); dialog.setInput(libs); dialog.setInitialElementSelections(Arrays.asList(fAutoSolibs)); if (dialog.open() == Window.OK) { @@ -555,9 +556,9 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu if (project != null) { IPath fullPath = new Path(file.getPath()); try { - ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions(project); + ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project); for(int i = 0; i < binaryParsersExt.length; i++) { - IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension(); + IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]); try { IBinaryFile bin = parser.getBinary(fullPath); if (bin instanceof IBinaryShared) { @@ -589,9 +590,9 @@ public class SolibSearchPathBlock extends Observable implements IMILaunchConfigu if (project != null) { IPath fullPath = new Path(file.getPath()); try { - ICExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getBinaryParserExtensions(project); + ICConfigExtensionReference[] binaryParsersExt = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project); for(int i = 0; i < binaryParsersExt.length; i++) { - IBinaryParser parser = (IBinaryParser)binaryParsersExt[i].createExtension(); + IBinaryParser parser = CoreModelUtil.getBinaryParser(binaryParsersExt[i]); try { IBinaryFile bin = parser.getBinary(fullPath); return (bin instanceof IBinaryShared); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java index 7cac657e7fa..a422b589825 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Ericsson and others. + * Copyright (c) 2010, 2011 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,12 +27,13 @@ import java.util.regex.Pattern; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IBinaryParser; import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.core.cdtvariables.CdtVariableException; import org.eclipse.cdt.core.cdtvariables.ICdtVariable; import org.eclipse.cdt.core.envvar.IEnvironmentVariable; import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.CoreModelUtil; import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; @@ -137,10 +138,10 @@ public class LaunchUtils { * @return An object representing the binary file. */ public static IBinaryObject verifyBinary(ILaunchConfiguration configuration, IPath exePath) throws CoreException { - ICExtensionReference[] parserRefs = CCorePlugin.getDefault().getBinaryParserExtensions(getCProject(configuration).getProject()); - for (ICExtensionReference parserRef : parserRefs) { + ICConfigExtensionReference[] parserRefs = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(getCProject(configuration).getProject()); + for (ICConfigExtensionReference parserRef : parserRefs) { try { - IBinaryParser parser = (IBinaryParser)parserRef.createExtension(); + IBinaryParser parser = CoreModelUtil.getBinaryParser(parserRef); IBinaryObject exe = (IBinaryObject)parser.getBinary(exePath); if (exe != null) { return exe; diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java index b0bc9664b53..9b2c76ce60f 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/LaunchUtils.java @@ -19,8 +19,9 @@ import java.util.Set; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IBinaryParser; import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; -import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.CoreModelUtil; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICOutputEntry; import org.eclipse.cdt.core.settings.model.ICProjectDescription; @@ -102,10 +103,10 @@ public class LaunchUtils { * @since 6.0 */ public static IBinaryObject getBinary(IProject project, IPath exePath) throws CoreException { - ICExtensionReference[] parserRef = CCorePlugin.getDefault().getBinaryParserExtensions(project); + ICConfigExtensionReference[] parserRef = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project); for (int i = 0; i < parserRef.length; i++) { try { - IBinaryParser parser = (IBinaryParser)parserRef[i].createExtension(); + IBinaryParser parser = CoreModelUtil.getBinaryParser(parserRef[i]); IBinaryObject exe = (IBinaryObject)parser.getBinary(exePath); if (exe != null) { return exe;