diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryParserConfig.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryParserConfig.java index abee5402998..eff66ec4fa3 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryParserConfig.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryParserConfig.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. + * Copyright (c) 2000, 2010 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 @@ -10,9 +10,12 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.model; +import org.eclipse.cdt.core.AbstractCExtension; import org.eclipse.cdt.core.IBinaryParser; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; +import org.eclipse.cdt.core.settings.model.util.CExtensionUtil; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; /* * BinaryParserConfig @@ -20,7 +23,7 @@ import org.eclipse.core.runtime.CoreException; public class BinaryParserConfig { private IBinaryParser parser; private final String id; - private final ICExtensionReference ref; + private final ICConfigExtensionReference ref; public BinaryParserConfig(IBinaryParser parser, String id) { this.parser = parser; @@ -28,7 +31,7 @@ public class BinaryParserConfig { this.ref = null; } - public BinaryParserConfig(ICExtensionReference ref) { + public BinaryParserConfig(ICConfigExtensionReference ref) { this.ref = ref; this.id = ref.getID(); } @@ -39,7 +42,12 @@ public class BinaryParserConfig { public IBinaryParser getBinaryParser() throws CoreException { if (parser == null) { - parser = (IBinaryParser)ref.createExtension(); + AbstractCExtension cExtension = null; + IConfigurationElement el = CExtensionUtil.getFirstConfigurationElement(ref, "cextension", false); //$NON-NLS-1$ + cExtension = (AbstractCExtension)el.createExecutableExtension("run"); //$NON-NLS-1$ + cExtension.setExtensionReference(ref); + cExtension.setProject(ref.getConfiguration().getProjectDescription().getProject()); + parser = (IBinaryParser) cExtension; } return parser; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java index 3fbfda0a4c4..ca89c6cbb9a 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 QNX Software Systems and others. + * Copyright (c) 2000, 2010 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 @@ -30,12 +30,8 @@ import java.util.Map; import org.eclipse.cdt.core.CCProjectNature; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.CDescriptorEvent; import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.IBinaryParser; -import org.eclipse.cdt.core.ICDescriptor; -import org.eclipse.cdt.core.ICDescriptorListener; -import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.core.IBinaryParser.IBinaryArchive; import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; @@ -54,9 +50,18 @@ import org.eclipse.cdt.core.model.IProblemRequestor; import org.eclipse.cdt.core.model.ISourceRoot; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.IWorkingCopy; +import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICDescriptionDelta; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener; +import org.eclipse.cdt.core.settings.model.ICSettingObject; import org.eclipse.cdt.internal.core.CCoreInternals; import org.eclipse.cdt.internal.core.LocalProjectScope; import org.eclipse.cdt.internal.core.resources.ResourceLookup; +import org.eclipse.cdt.internal.core.settings.model.CProjectDescription; +import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileStore; @@ -82,7 +87,7 @@ import org.eclipse.core.runtime.content.IContentTypeManager; import org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent; import org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener; -public class CModelManager implements IResourceChangeListener, ICDescriptorListener, IContentTypeChangeListener { +public class CModelManager implements IResourceChangeListener, IContentTypeChangeListener, ICProjectDescriptionListener { public static boolean VERBOSE = false; @@ -149,12 +154,12 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe /** * The list of started BinaryRunners on projects. */ - private HashMap binaryRunners = new HashMap(); + private final Map binaryRunners = new HashMap(); /** * Map of the binary parser for each project. */ - private HashMap binaryParsersMap = new HashMap(); + private final Map binaryParsersMap = Collections.synchronizedMap(new HashMap()); /** * The lis of the SourceMappers on projects. @@ -178,13 +183,18 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe // Register to the workspace; ResourcesPlugin.getWorkspace().addResourceChangeListener(factory, - IResourceChangeEvent.POST_CHANGE - | IResourceChangeEvent.PRE_DELETE - | IResourceChangeEvent.PRE_CLOSE); + IResourceChangeEvent.POST_CHANGE + | IResourceChangeEvent.PRE_DELETE + | IResourceChangeEvent.PRE_CLOSE); // Register the Core Model on the Descriptor // Manager, it needs to know about changes. - CCorePlugin.getDefault().getCDescriptorManager().addDescriptorListener(factory); +// CCorePlugin.getDefault().getCDescriptorManager().addDescriptorListener(factory); + + // Register as project description listener + CProjectDescriptionManager.getInstance().addCProjectDescriptionListener(factory, + CProjectDescriptionEvent.APPLIED); + // Register the Core Model on the ContentTypeManager // it needs to know about changes. Platform.getContentTypeManager().addContentTypeChangeListener(factory); @@ -588,14 +598,15 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe public BinaryParserConfig[] getBinaryParser(IProject project) { BinaryParserConfig[] parsers = binaryParsersMap.get(project); if (parsers == null) { - try { - ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(project, false); - if (cdesc != null) { - ICExtensionReference[] cextensions = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID, true); - if (cextensions.length > 0) { - ArrayList list = new ArrayList(cextensions.length); - for (ICExtensionReference cextension : cextensions) { - BinaryParserConfig config = new BinaryParserConfig(cextension); + ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(project, false); + if (desc != null) { + ICConfigurationDescription cfgDesc = desc.getDefaultSettingConfiguration(); + if (cfgDesc != null) { + ICConfigExtensionReference[] refs = cfgDesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); + if (refs.length > 0) { + ArrayList list = new ArrayList(refs.length); + for (ICConfigExtensionReference ref : refs) { + BinaryParserConfig config = new BinaryParserConfig(ref); list.add(config); } parsers = new BinaryParserConfig[list.size()]; @@ -605,7 +616,6 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe parsers = new BinaryParserConfig[0]; } } - } catch (CoreException e) { } if (parsers == null) { try { @@ -774,7 +784,10 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe } public void removeBinaryRunner(IProject project) { - BinaryRunner runner = binaryRunners.remove(project); + BinaryRunner runner; + synchronized (binaryRunners) { + runner = binaryRunners.remove(project); + } if (runner != null) { runner.stop(); } @@ -879,36 +892,65 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe } } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.ICDescriptorListener#descriptorChanged(org.eclipse.cdt.core.CDescriptorEvent) - */ - public void descriptorChanged(CDescriptorEvent event) { - int flags = event.getFlags(); - if ( (flags & CDescriptorEvent.EXTENSION_CHANGED) != 0) { - ICDescriptor cdesc = event.getDescriptor(); - if (cdesc != null) { - IProject project = cdesc.getProject(); - try { - ICExtensionReference[] newExts = CCorePlugin.getDefault().getBinaryParserExtensions(project); - BinaryParserConfig[] currentConfigs = getBinaryParser(project); - // anything added/removed - if (newExts.length != currentConfigs.length) { - resetBinaryParser(project); - } else { // may reorder - for (int i = 0; i < newExts.length; i++) { - if (!newExts[i].getID().equals(currentConfigs[i].getId())) { + public void handleEvent(CProjectDescriptionEvent event) { + switch(event.getEventType()) { + case CProjectDescriptionEvent.APPLIED: + CProjectDescription newDes = (CProjectDescription)event.getNewCProjectDescription(); + CProjectDescription oldDes = (CProjectDescription)event.getOldCProjectDescription(); + if(oldDes != null && newDes != null) { + ICConfigurationDescription newCfg = newDes.getDefaultSettingConfiguration(); + ICConfigurationDescription oldCfg = oldDes.getDefaultSettingConfiguration(); + int flags = 0; + if(oldCfg != null && newCfg != null){ + if(newCfg.getId().equals(oldCfg.getId())){ + ICDescriptionDelta cfgDelta = findCfgDelta(event.getProjectDelta(), newCfg.getId()); + if(cfgDelta != null){ + flags = cfgDelta.getChangeFlags() & (ICDescriptionDelta.EXT_REF | ICDescriptionDelta.OWNER); + } + } else { + flags = CProjectDescriptionManager.getInstance().calculateDescriptorFlags(newCfg, oldCfg); + } + } + if ((flags & ICDescriptionDelta.EXT_REF) != 0) { + // update binary parsers + IProject project = newDes.getProject(); + try { + ICConfigExtensionReference[] newExts = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project); + BinaryParserConfig[] currentConfigs = binaryParsersMap.get(project); + // anything added/removed + if (currentConfigs != null) { + if (newExts.length != currentConfigs.length) { resetBinaryParser(project); - break; + } else { // may reorder + for (int i = 0; i < newExts.length; i++) { + if (!newExts[i].getID().equals(currentConfigs[i].getId())) { + resetBinaryParser(project); + break; + } + } } } + } catch (CoreException e) { + resetBinaryParser(project); } - } catch (CoreException e) { - resetBinaryParser(project); } } + break; } } + private ICDescriptionDelta findCfgDelta(ICDescriptionDelta delta, String id){ + if(delta == null) + return null; + ICDescriptionDelta children[] = delta.getChildren(); + for(int i = 0; i < children.length; i++){ + ICSettingObject s = children[i].getNewSetting(); + if(s != null && id.equals(s.getId())) + return children[i]; + } + return null; + } + /* (non-Javadoc) * @see org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeListener#contentTypeChanged() */ @@ -1234,14 +1276,18 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe */ public void shutdown() { // Remove ourself from the DescriptorManager. - CCorePlugin.getDefault().getCDescriptorManager().removeDescriptorListener(factory); + CProjectDescriptionManager.getInstance().removeCProjectDescriptionListener(this); +// CCorePlugin.getDefault().getCDescriptorManager().removeDescriptorListener(factory); // Remove ourself from the ContentTypeManager Platform.getContentTypeManager().removeContentTypeChangeListener(factory); // Do any shutdown of services. ResourcesPlugin.getWorkspace().removeResourceChangeListener(factory); - BinaryRunner[] runners = binaryRunners.values().toArray(new BinaryRunner[0]); + BinaryRunner[] runners; + synchronized (binaryRunners) { + runners = binaryRunners.values().toArray(new BinaryRunner[0]); + } for (BinaryRunner runner : runners) { runner.stop(); } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DefaultPathEntryStore.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DefaultPathEntryStore.java index bb8d618842c..3f6e49de5ff 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DefaultPathEntryStore.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DefaultPathEntryStore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 QNX Software Systems and others. + * Copyright (c) 2000, 2010 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 @@ -34,6 +34,7 @@ import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.core.resources.IPathEntryStore; import org.eclipse.cdt.core.resources.IPathEntryStoreListener; import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.core.resources.IProject; @@ -412,4 +413,8 @@ public class DefaultPathEntryStore implements IPathEntryStore, ICDescriptorListe public ICExtensionReference getExtensionReference() { return null; } + + public ICConfigExtensionReference getConfigExtensionReference() { + return null; + } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryStoreProxy.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryStoreProxy.java index aba04325fef..c47e8e4d7a5 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryStoreProxy.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryStoreProxy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 Intel Corporation and others. + * Copyright (c) 2007, 2010 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 @@ -20,6 +20,7 @@ import org.eclipse.cdt.core.resources.IPathEntryStore; import org.eclipse.cdt.core.resources.IPathEntryStoreListener; import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent; import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.internal.core.settings.model.AbstractCExtensionProxy; import org.eclipse.cdt.internal.core.settings.model.ConfigBasedPathEntryStore; @@ -90,6 +91,10 @@ public class PathEntryStoreProxy extends AbstractCExtensionProxy implements IPat return null; } + public ICConfigExtensionReference getConfigExtensionReference() { + return null; + } + public IPathEntry[] getRawPathEntries() throws CoreException { providerRequested(); return fStore.getRawPathEntries(); 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 2f99a3748d9..761ea06d81a 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 @@ -26,6 +26,7 @@ import org.eclipse.cdt.core.resources.IPathEntryStore; import org.eclipse.cdt.core.resources.IPathEntryStoreListener; import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent; import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICExternalSetting; import org.eclipse.cdt.core.settings.model.ICProjectDescription; @@ -100,6 +101,10 @@ public class ConfigBasedPathEntryStore implements IPathEntryStore, ICProjectDesc return null; } + public ICConfigExtensionReference getConfigExtensionReference() { + return null; + } + public IPathEntry[] getRawPathEntries() throws CoreException { ICConfigurationDescription cfg = getIndexCfg(fProject); List[] es = getEntries(fProject, cfg); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/AbstractCExtension.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/AbstractCExtension.java index 55b6e6f709d..0b0438475c3 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/AbstractCExtension.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/AbstractCExtension.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. + * Copyright (c) 2000, 2010 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 @@ -10,15 +10,18 @@ *******************************************************************************/ package org.eclipse.cdt.core; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.PlatformObject; public abstract class AbstractCExtension extends PlatformObject implements ICExtension { private IProject fProject; private ICExtensionReference extensionRef; + private ICConfigExtensionReference fCfgExtensionRef; /** - * Returns the project for which this extrension is defined. + * Returns the project for which this extension is defined. * * @return the project */ @@ -26,11 +29,40 @@ public abstract class AbstractCExtension extends PlatformObject implements ICExt return fProject; } + /** + * May return null! + * @deprecated Use {@link #getConfigExtensionReference()} instead. + */ + @Deprecated public final ICExtensionReference getExtensionReference() { + if (extensionRef == null) { + // try to create one for the sake of backwards compatibility + try { + ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(getProject(), false); + if (cdesc != null) { + ICExtensionReference[] cextensions = cdesc.get(fCfgExtensionRef.getExtensionPoint(), false); + for (ICExtensionReference ref : cextensions) { + if (ref.getID().equals(fCfgExtensionRef.getID())) { + extensionRef = ref; + break; + } + } + } + } catch (CoreException e) { + CCorePlugin.log(e); + } + } return extensionRef; } - + /** + * Returns the extension reference this extension was created from. + * @since 5.2 + */ + public final ICConfigExtensionReference getConfigExtensionReference() { + return fCfgExtensionRef; + } + // internal stuff /** * @noreference This method is not intended to be referenced by clients. @@ -45,4 +77,11 @@ public abstract class AbstractCExtension extends PlatformObject implements ICExt public void setExtensionReference(ICExtensionReference extReference) { extensionRef = extReference; } + + /** + * @noreference This method is not intended to be referenced by clients. + */ + public void setExtensionReference(ICConfigExtensionReference extReference) { + fCfgExtensionRef = extReference; + } } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java index c89fb89777b..4452da5faa0 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -34,6 +34,7 @@ import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.cdt.core.parser.IScannerInfoProvider; import org.eclipse.cdt.core.resources.IConsole; import org.eclipse.cdt.core.resources.IPathEntryVariableManager; +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.ICProjectDescriptionManager; @@ -527,6 +528,10 @@ public class CCorePlugin extends Plugin { return getConsole(consoleID); } + /** + * @deprecated Use {@link #getDefaultBinaryParserExtensions(IProject)} instead. + */ + @Deprecated public ICExtensionReference[] getBinaryParserExtensions(IProject project) throws CoreException { ICExtensionReference ext[] = new ICExtensionReference[0]; if (project != null) { @@ -544,6 +549,24 @@ public class CCorePlugin extends Plugin { return ext; } + /** + * Returns the binary parser extensions for the default settings configuration. + * @since 5.2 + */ + public ICConfigExtensionReference[] getDefaultBinaryParserExtensions(IProject project) throws CoreException { + ICConfigExtensionReference ext[] = new ICConfigExtensionReference[0]; + if (project != null) { + ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(project, false); + if (desc != null) { + ICConfigurationDescription cfgDesc = desc.getDefaultSettingConfiguration(); + if (cfgDesc != null) { + ext = cfgDesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); + } + } + } + return ext; + } + /** * @deprecated - use getBinaryParserExtensions(IProject project) */ diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtension.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtension.java index bf74dbdddc0..d793e44271e 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtension.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtension.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 QNX Software Systems and others. + * Copyright (c) 2000, 2010 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.core; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.core.resources.IProject; /** @@ -19,5 +20,13 @@ import org.eclipse.core.resources.IProject; */ public interface ICExtension { public IProject getProject(); + /** + * @deprecated Use {@link #getConfigExtensionReference()} instead. + */ + @Deprecated public ICExtensionReference getExtensionReference(); + /** + * @since 5.2 + */ + public ICConfigExtensionReference getConfigExtensionReference(); } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptor.java index c7e2ea073db..7025415a4b8 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CConfigBasedDescriptor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Intel Corporation and others. + * Copyright (c) 2007, 2010 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 @@ -160,7 +160,7 @@ final public class CConfigBasedDescriptor implements ICDescriptor { AbstractCExtension cExtension = null; IConfigurationElement el = CExtensionUtil.getFirstConfigurationElement(fCfgExtRef, CEXTENSION_NAME, false); cExtension = (AbstractCExtension)el.createExecutableExtension("run"); //$NON-NLS-1$ - cExtension.setExtensionReference(this); + cExtension.setExtensionReference(fCfgExtRef); cExtension.setProject(getProject()); return cExtension; } diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/DefaultCygwinToolFactory.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/DefaultCygwinToolFactory.java index 5d0920df5f0..d7c7fb72950 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/DefaultCygwinToolFactory.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/DefaultCygwinToolFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2010 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 @@ -13,7 +13,7 @@ package org.eclipse.cdt.utils; import java.io.IOException; import org.eclipse.cdt.core.ICExtension; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -45,7 +45,7 @@ public class DefaultCygwinToolFactory extends DefaultGnuToolFactory implements I } protected IPath getCygPathPath() { - ICExtensionReference ref = fExtension.getExtensionReference(); + ICConfigExtensionReference ref = fExtension.getConfigExtensionReference(); String value = ref.getExtensionData("cygpath"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = "cygpath"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/DefaultGnuToolFactory.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/DefaultGnuToolFactory.java index c761b93776e..568c72ce688 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/DefaultGnuToolFactory.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/DefaultGnuToolFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 QNX Software Systems and others. + * Copyright (c) 2004, 2010 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 @@ -13,7 +13,7 @@ package org.eclipse.cdt.utils; import java.io.IOException; import org.eclipse.cdt.core.ICExtension; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -91,7 +91,7 @@ public class DefaultGnuToolFactory implements IGnuToolFactory { } protected IPath getAddr2linePath() { - ICExtensionReference ref = fExtension.getExtensionReference(); + ICConfigExtensionReference ref = fExtension.getConfigExtensionReference(); String value = ref.getExtensionData("addr2line"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = "addr2line"; //$NON-NLS-1$ @@ -100,7 +100,7 @@ public class DefaultGnuToolFactory implements IGnuToolFactory { } protected IPath getObjdumpPath() { - ICExtensionReference ref = fExtension.getExtensionReference(); + ICConfigExtensionReference ref = fExtension.getConfigExtensionReference(); String value = ref.getExtensionData("objdump"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = "objdump"; //$NON-NLS-1$ @@ -109,7 +109,7 @@ public class DefaultGnuToolFactory implements IGnuToolFactory { } protected String getObjdumpArgs() { - ICExtensionReference ref = fExtension.getExtensionReference(); + ICConfigExtensionReference ref = fExtension.getConfigExtensionReference(); String value = ref.getExtensionData("objdumpArgs"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = ""; //$NON-NLS-1$ @@ -118,7 +118,7 @@ public class DefaultGnuToolFactory implements IGnuToolFactory { } protected IPath getCPPFiltPath() { - ICExtensionReference ref = fExtension.getExtensionReference(); + ICConfigExtensionReference ref = fExtension.getConfigExtensionReference(); String value = ref.getExtensionData("c++filt"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = "c++filt"; //$NON-NLS-1$ @@ -127,7 +127,7 @@ public class DefaultGnuToolFactory implements IGnuToolFactory { } protected IPath getStripPath() { - ICExtensionReference ref = fExtension.getExtensionReference(); + ICConfigExtensionReference ref = fExtension.getConfigExtensionReference(); String value = ref.getExtensionData("strip"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = "strip"; //$NON-NLS-1$ @@ -136,7 +136,7 @@ public class DefaultGnuToolFactory implements IGnuToolFactory { } protected IPath getNMPath() { - ICExtensionReference ref = fExtension.getExtensionReference(); + ICConfigExtensionReference ref = fExtension.getConfigExtensionReference(); String value = ref.getExtensionData("nm"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = "nm"; //$NON-NLS-1$ @@ -145,7 +145,7 @@ public class DefaultGnuToolFactory implements IGnuToolFactory { } protected String getNMArgs() { - ICExtensionReference ref = fExtension.getExtensionReference(); + ICConfigExtensionReference ref = fExtension.getConfigExtensionReference(); String value = ref.getExtensionData("nmArgs"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = ""; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOParser.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOParser.java index 94f9bbda5cc..b3e6e625d27 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOParser.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 QNX Software Systems and others. + * Copyright (c) 2002, 2010 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 @@ -15,7 +15,7 @@ import java.io.IOException; import org.eclipse.cdt.core.AbstractCExtension; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IBinaryParser; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.utils.CPPFilt; import org.eclipse.cdt.utils.macho.AR; import org.eclipse.cdt.utils.macho.MachO; @@ -121,7 +121,7 @@ public class MachOParser extends AbstractCExtension implements IBinaryParser { } protected IPath getCPPFiltPath() { - ICExtensionReference ref = getExtensionReference(); + ICConfigExtensionReference ref = getConfigExtensionReference(); String value = ref.getExtensionData("c++filt"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = "c++filt"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOParser64.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOParser64.java index 42cb90e10bb..fdd2b895f52 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOParser64.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/macho/parser/MachOParser64.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2009 QNX Software Systems and others. + * Copyright (c) 2002, 2010 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 @@ -15,7 +15,7 @@ import java.io.IOException; import org.eclipse.cdt.core.AbstractCExtension; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IBinaryParser; -import org.eclipse.cdt.core.ICExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; import org.eclipse.cdt.utils.CPPFilt; import org.eclipse.cdt.utils.macho.AR; import org.eclipse.cdt.utils.macho.MachO64; @@ -120,7 +120,7 @@ public class MachOParser64 extends AbstractCExtension implements IBinaryParser { @SuppressWarnings("deprecation") protected IPath getCPPFiltPath() { - ICExtensionReference ref = getExtensionReference(); + ICConfigExtensionReference ref = getConfigExtensionReference(); String value = ref.getExtensionData("c++filt"); //$NON-NLS-1$ if (value == null || value.length() == 0) { value = "c++filt"; //$NON-NLS-1$