1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

fixed dead lock

missing extension point
fix CCorePlugin.log
This commit is contained in:
David Inglis 2004-04-19 15:51:31 +00:00
parent 010da4dcb9
commit 6f06f88155
6 changed files with 207 additions and 50 deletions

View file

@ -1,3 +1,19 @@
2004-04-19 David Inglis
Fixed dead lock - don't fire descriptor events with descriptor lock
* src/org/eclipse/cdt/internal/core/CDescriptor.java
Added missing PathContainerInitializer extension point
* schema/PathEntryContainerInitializer.exsd
* plugin.properties
* plugin.xml
changed log to not wrap core exception in a IStatus but use the IStatus in the exception.
* src/org/eclipse/cdt/core/CCorePlugin.java
2004-04-19 David Inglis
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=58232

View file

@ -25,3 +25,5 @@ CDTGNUAssemblerErrorParser.name=CDT GNU Assembler Error Parser
CDTGNULinkerErrorParser.name=CDT GNU Linker Error Parser
CDTGNUMakeErrorParser.name=CDT GNU Make Error Parser
CDTVisualCErrorParser.name=CDT Visual C Error Parser
PathEntryContainerInitializer=Path Entry Container Initializer

View file

@ -46,6 +46,7 @@
<extension-point id="CLanguage" name="CLanguage" schema="schema/CLanguage.exsd"/>
<extension-point id="CFileType" name="CFileType" schema="schema/CFileType.exsd"/>
<extension-point id="CFileTypeAssociation" name="CFileTypeAssociation" schema="schema/CFileTypeAssociation.exsd"/>
<extension-point id="PathEntryContainerInitializer" name="%PathEntryContainerInitializer" schema="schema/PathEntryContainerInitializer.exsd"/>
<!-- =================================================================================== -->
<!-- Define the list of the Binary Parser provided by the CDT -->
@ -196,32 +197,32 @@
<fileType
name="C Source File"
type="source"
language="org.eclipse.cdt.core.language.c"
id="org.eclipse.cdt.core.fileType.c_source">
id="org.eclipse.cdt.core.fileType.c_source"
language="org.eclipse.cdt.core.language.c">
</fileType>
<fileType
name="C Header File"
type="header"
language="org.eclipse.cdt.core.language.c"
id="org.eclipse.cdt.core.fileType.c_header">
id="org.eclipse.cdt.core.fileType.c_header"
language="org.eclipse.cdt.core.language.c">
</fileType>
<fileType
name="C++ Source File"
type="source"
language="org.eclipse.cdt.core.language.cxx"
id="org.eclipse.cdt.core.fileType.cxx_source">
id="org.eclipse.cdt.core.fileType.cxx_source"
language="org.eclipse.cdt.core.language.cxx">
</fileType>
<fileType
name="C++ Header File"
type="header"
language="org.eclipse.cdt.core.language.cxx"
id="org.eclipse.cdt.core.fileType.cxx_header">
id="org.eclipse.cdt.core.fileType.cxx_header"
language="org.eclipse.cdt.core.language.cxx">
</fileType>
<fileType
name="Assembly Source File"
type="source"
language="org.eclipse.cdt.core.language.asm"
id="org.eclipse.cdt.core.fileType.asm_source">
id="org.eclipse.cdt.core.fileType.asm_source"
language="org.eclipse.cdt.core.language.asm">
</fileType>
</extension>
<extension

View file

@ -0,0 +1,109 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.cdt.core">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.cdt.core" id="pathEntryContainerInitializer" name="%PathEntryContainerInitializer"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="pathEntryContainerInitializer"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="pathEntryContainerInitializer">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appInfo>
<meta.attribute kind="java"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
<documentation>
</documentation>
</annotation>
</schema>

View file

@ -194,7 +194,11 @@ public class CCorePlugin extends Plugin {
}
public static void log(Throwable e) {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$
if ( e instanceof CoreException ) {
log(((CoreException)e).getStatus());
} else {
log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$
}
}
public static void log(IStatus status) {

View file

@ -235,15 +235,24 @@ public class CDescriptor implements ICDescriptor {
}
synchronized public ICExtensionReference create(String extensionPoint, String extension) throws CoreException {
CExtensionReference extRef = createRef(extensionPoint, extension);
if (!isInitializing) {
updateOnDisk();
boolean fireEvent = false;
CExtensionReference extRef;
synchronized (this) {
extRef = createRef(extensionPoint, extension);
if (!isInitializing) {
updateOnDisk();
fireEvent = true;
}
}
if (fireEvent) {
fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.EXTENSION_CHANGED));
}
return extRef;
}
synchronized public void remove(ICExtensionReference ext) throws CoreException {
boolean fireEvent = false;
synchronized (this) {
CExtensionReference extensions[] = (CExtensionReference[]) extMap.get(ext.getExtension());
for (int i = 0; i < extensions.length; i++) {
if (extensions[i] == ext) {
@ -257,23 +266,32 @@ public class CDescriptor implements ICDescriptor {
}
if (!isInitializing) {
updateOnDisk();
fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED,
CDescriptorEvent.EXTENSION_CHANGED));
fireEvent = true;
}
}
}
}
if (fireEvent) {
fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED,
CDescriptorEvent.EXTENSION_CHANGED));
}
}
synchronized public void remove(String extensionPoint) throws CoreException {
CExtensionReference extensions[] = (CExtensionReference[]) extMap.get(extensionPoint);
if (extensions != null) {
extMap.remove(extensionPoint);
if (!isInitializing) {
updateOnDisk();
fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED,
CDescriptorEvent.EXTENSION_CHANGED));
public void remove(String extensionPoint) throws CoreException {
boolean fireEvent = false;
synchronized (this) {
CExtensionReference extensions[] = (CExtensionReference[]) extMap.get(extensionPoint);
if (extensions != null) {
extMap.remove(extensionPoint);
if (!isInitializing) {
updateOnDisk();
fireEvent = true;
}
}
}
if (fireEvent) {
fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.EXTENSION_CHANGED));
}
}
synchronized CExtensionInfo getInfo(CExtensionReference cProjectExtension) {
@ -346,35 +364,42 @@ public class CDescriptor implements ICDescriptor {
fManager.updateDescriptor(this);
}
synchronized void updateFromDisk() throws CoreException {
IPath projectLocation = fProject.getDescription().getLocation();
void updateFromDisk() throws CoreException {
COwner origOwner;
HashMap origExtMap;
HashMap origExtInfoMap;
Document origDataDoc;
synchronized (this) {
IPath projectLocation = fProject.getDescription().getLocation();
if (projectLocation == null) {
projectLocation = getProjectDefaultLocation(fProject);
}
IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
if (!descriptionPath.toFile().exists()) {
updateOnDisk();
return;
}
COwner origOwner = fOwner;
HashMap origExtMap = extMap;
HashMap origExtInfoMap = extInfoMap;
Document origDataDoc = dataDoc;
if (projectLocation == null) {
projectLocation = getProjectDefaultLocation(fProject);
}
IPath descriptionPath = projectLocation.append(DESCRIPTION_FILE_NAME);
if (!descriptionPath.toFile().exists()) {
updateOnDisk();
return;
}
extMap = new HashMap(4);
extInfoMap = new HashMap(4);
dataDoc = null;
origOwner = fOwner;
origExtMap = extMap;
origExtInfoMap = extInfoMap;
origDataDoc = dataDoc;
try {
String ownerId = readCDTProjectFile(descriptionPath);
fOwner = new COwner(fManager.getOwnerConfiguration(ownerId));
} catch (CoreException e) {
CCorePlugin.log(e);
fOwner = origOwner;
extMap = origExtMap;
extInfoMap = origExtInfoMap;
dataDoc = origDataDoc;
extMap = new HashMap(4);
extInfoMap = new HashMap(4);
dataDoc = null;
try {
String ownerId = readCDTProjectFile(descriptionPath);
fOwner = new COwner(fManager.getOwnerConfiguration(ownerId));
} catch (CoreException e) {
CCorePlugin.log(e);
fOwner = origOwner;
extMap = origExtMap;
extInfoMap = origExtInfoMap;
dataDoc = origDataDoc;
}
}
if (!fOwner.equals(origOwner)) {
fManager.fireEvent(new CDescriptorEvent(this, CDescriptorEvent.CDTPROJECT_CHANGED, CDescriptorEvent.OWNER_CHANGED));