Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,34 +227,19 @@ private ContentType createContentType(IConfigurationElement contentTypeCE) throw
private final static IConfigurationElement[] emptyConfArray = new IConfigurationElement[0];

/**
* Gets configuration elements for both "backward compatible" extension point
* org.eclipse.core.runtime.contentTypes
* and "new" extension point controlled by this plugin:
* Gets configuration elements for the extension point controlled by this plugin:
* org.eclipse.core.contenttype.contentTypes
*/
protected IConfigurationElement[] getConfigurationElements() {
IExtensionRegistry registry = RegistryFactory.getRegistry();
if (registry == null) {
return emptyConfArray;
}
IConfigurationElement[] oldConfigElements = emptyConfArray;
IConfigurationElement[] newConfigElements = emptyConfArray;
// "old" extension point
IExtensionPoint oldPoint = registry.getExtensionPoint(IContentConstants.RUNTIME_NAME, PT_CONTENTTYPES);
if (oldPoint != null) {
oldConfigElements = oldPoint.getConfigurationElements();
}
// "new" extension point
IExtensionPoint newPoint = registry.getExtensionPoint(IContentConstants.CONTENT_NAME, PT_CONTENTTYPES);
if (newPoint != null) {
newConfigElements = newPoint.getConfigurationElements();
IExtensionPoint contentTypesPoint = registry.getExtensionPoint(IContentConstants.CONTENT_NAME, PT_CONTENTTYPES);
if (contentTypesPoint == null) {
return emptyConfArray;
}

IConfigurationElement[] allContentTypeCEs = new IConfigurationElement[oldConfigElements.length + newConfigElements.length];
System.arraycopy(oldConfigElements, 0, allContentTypeCEs, 0, oldConfigElements.length);
System.arraycopy(newConfigElements, 0, allContentTypeCEs, oldConfigElements.length, newConfigElements.length);

return allContentTypeCEs;
return contentTypesPoint.getConfigurationElements();
}

private void missingMandatoryAttribute(String messageKey, String argument) throws CoreException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,13 @@ private static class ContentTypeRegistryChangeListener implements IRegistryChang
@Override
public void registryChanged(IRegistryChangeEvent event) {
// no changes related to the content type registry
if (event.getExtensionDeltas(IContentConstants.RUNTIME_NAME, ContentTypeBuilder.PT_CONTENTTYPES).length == 0
&& event.getExtensionDeltas(IContentConstants.CONTENT_NAME,
ContentTypeBuilder.PT_CONTENTTYPES).length == 0) {
if (event.getExtensionDeltas(IContentConstants.CONTENT_NAME, ContentTypeBuilder.PT_CONTENTTYPES).length == 0) {
return;
}
getInstance().invalidate();
}
}

private static IRegistryChangeListener runtimeExtensionListener = new ContentTypeRegistryChangeListener();
private static IRegistryChangeListener contentExtensionListener = new ContentTypeRegistryChangeListener();

private static volatile ContentTypeManager instance;
Expand Down Expand Up @@ -103,9 +100,6 @@ public void addRegistryChangeListener(IExtensionRegistry registry) {
if (registry == null) {
return;
}
// Different instances of listener required. See documentation of
// IExtensionRegistry.addRegistryChangeListener(IRegistryChangeListener, String).
registry.addRegistryChangeListener(runtimeExtensionListener, IContentConstants.RUNTIME_NAME);
registry.addRegistryChangeListener(contentExtensionListener, IContentConstants.CONTENT_NAME);
}

Expand All @@ -123,7 +117,6 @@ public void removeRegistryChangeListener(IExtensionRegistry registry) {
return;
}
getInstance().invalidate();
registry.removeRegistryChangeListener(runtimeExtensionListener);
registry.removeRegistryChangeListener(contentExtensionListener);
}

Expand Down
1 change: 0 additions & 1 deletion runtime/bundles/org.eclipse.core.runtime/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
pluginName = Core Runtime
providerName = Eclipse.org
shutdownHook = Shutdown Hook
contentTypesName = Content Types
preferencesName=Preferences
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.net.URL;
import org.eclipse.core.internal.content.ContentTypeBuilder;
import org.eclipse.core.internal.content.ContentTypeHandler;
import org.eclipse.core.internal.content.IContentConstants;
import org.eclipse.core.internal.content.Util;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
Expand Down Expand Up @@ -168,7 +169,7 @@ public static IPath getExtraPluginLocation() {

private static Bundle installContentTypes(int numberOfLevels, int nodesPerLevel)
throws IOException, BundleException {
TestRegistryChangeListener listener = new TestRegistryChangeListener(Platform.PI_RUNTIME, ContentTypeBuilder.PT_CONTENTTYPES, null, null);
TestRegistryChangeListener listener = new TestRegistryChangeListener(IContentConstants.CONTENT_NAME, ContentTypeBuilder.PT_CONTENTTYPES, null, null);
Bundle installed = null;
listener.register();
try {
Expand All @@ -181,7 +182,7 @@ private static Bundle installContentTypes(int numberOfLevels, int nodesPerLevel)
0x10000)) {
writer.write("<plugin>");
writer.write(eol);
writer.write("<extension point=\"org.eclipse.core.runtime.contentTypes\">");
writer.write("<extension point=\"org.eclipse.core.contenttype.contentTypes\">");
writer.write(eol);
String root = createContentType(writer, 0, null);
createContentTypes(writer, root, 1, numberOfLevels, nodesPerLevel);
Expand Down
Loading