Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 35147 Details for
Bug 128866
M5: Behavior change when computing the ID of project natures
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for maintaining backward compatibility for IDs with dots
Patch namespace separation backward.txt (text/plain), 5.29 KB, created by
Oleg Besedin
on 2006-02-22 10:52:50 EST
(
hide
)
Description:
Patch for maintaining backward compatibility for IDs with dots
Filename:
MIME Type:
Creator:
Oleg Besedin
Created:
2006-02-22 10:52:50 EST
Size:
5.29 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.tests.runtime >Index: Plugin_Testing/registry/testNamespace/1/plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/1/plugin.xml,v >retrieving revision 1.1 >diff -u -r1.1 plugin.xml >--- Plugin_Testing/registry/testNamespace/1/plugin.xml 16 Feb 2006 02:10:14 -0000 1.1 >+++ Plugin_Testing/registry/testNamespace/1/plugin.xml 22 Feb 2006 15:41:15 -0000 >@@ -1,5 +1,5 @@ > <?xml version="1.0" encoding="UTF-8"?> >-<?eclipse version="3.0"?> >+<?eclipse version="3.2"?> > <plugin id="testNamespace1" name="TestNamespace Plug-in1" version="1.0.0" provider-name=""> > > <extension-point id="org.abc.xptNS1" name="Label xptNS1" schema="schema/xptNS1.exsd"/> >Index: Plugin_Testing/registry/testNamespace/2/plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.runtime/Plugin_Testing/registry/testNamespace/2/plugin.xml,v >retrieving revision 1.1 >diff -u -r1.1 plugin.xml >--- Plugin_Testing/registry/testNamespace/2/plugin.xml 16 Feb 2006 02:10:14 -0000 1.1 >+++ Plugin_Testing/registry/testNamespace/2/plugin.xml 22 Feb 2006 15:41:15 -0000 >@@ -1,5 +1,5 @@ > <?xml version="1.0" encoding="UTF-8"?> >-<?eclipse version="3.0"?> >+<?eclipse version="3.2"?> > <plugin id="testNamespace2" name="TestNamespace Plug-in2" version="1.0.0" provider-name=""> > > <extension-point id="org.abc.xptNS2" name="Label xptNS2" schema="schema/xptNS2.exsd"/> >#P org.eclipse.equinox.registry >Index: src/org/eclipse/core/internal/registry/ExtensionsParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java,v >retrieving revision 1.6 >diff -u -r1.6 ExtensionsParser.java >--- src/org/eclipse/core/internal/registry/ExtensionsParser.java 16 Feb 2006 02:09:24 -0000 1.6 >+++ src/org/eclipse/core/internal/registry/ExtensionsParser.java 22 Feb 2006 15:41:20 -0000 >@@ -134,6 +134,9 @@ > > private Locator locator = null; > >+ // Cache the behavior toggle (true: attempt to extract namespace from qualified IDs) >+ private Boolean extractNamespaces = null; >+ > public ExtensionsParser(MultiStatus status, ExtensionRegistry registry) { > super(); > this.status = status; >@@ -404,7 +407,7 @@ > String simpleId; > String namespaceName; > int simpleIdStart = attrValue.lastIndexOf('.'); >- if (simpleIdStart != -1) { >+ if ((simpleIdStart != -1) && extractNamespace()) { > simpleId = attrValue.substring(simpleIdStart + 1); > namespaceName = attrValue.substring(0, simpleIdStart); > } else { >@@ -473,12 +476,12 @@ > String uniqueId; > String namespaceName; > int simpleIdStart = attrValue.lastIndexOf('.'); >- if (simpleIdStart == -1) { >- namespaceName = contribution.getDefaultNamespace(); >- uniqueId = namespaceName + '.' + attrValue; >- } else { >+ if (simpleIdStart != -1 && extractNamespace()) { > namespaceName = attrValue.substring(0, simpleIdStart); > uniqueId = attrValue; >+ } else { >+ namespaceName = contribution.getDefaultNamespace(); >+ uniqueId = namespaceName + '.' + attrValue; > } > currentExtPoint.setUniqueIdentifier(uniqueId); > currentExtPoint.setNamespace(namespaceName); >@@ -589,7 +592,7 @@ > * for extension points that were renamed between release 2.1 and 3.0. > */ > private Extension[] fixRenamedExtensionPoints(Extension[] extensions) { >- if (extensions == null || (schemaVersion != null && schemaVersion.equals("3.0")) || RegistryProperties.getProperty(NO_EXTENSION_MUNGING) != null) //$NON-NLS-1$ >+ if (extensions == null || versionAtLeast("3.0") || RegistryProperties.getProperty(NO_EXTENSION_MUNGING) != null) //$NON-NLS-1$ > return extensions; > for (int i = 0; i < extensions.length; i++) { > Extension extension = extensions[i]; >@@ -601,4 +604,38 @@ > } > return extensions; > } >+ >+ /** >+ * To preserve backward compatibility, we will only attempt to extract namespace form the name >+ * if Eclipse version specified in the plugin.xml (<?eclipse version="3.2"?>) is at least 3.2. >+ */ >+ private boolean extractNamespace() { >+ if (extractNamespaces == null) >+ extractNamespaces = new Boolean(versionAtLeast("3.2")); >+ return extractNamespaces.booleanValue(); >+ } >+ >+ /** >+ * Makes sense only for plugin.xml versions >= 3.0 (Eclipse version was introduced in 3.0). >+ * Assumes that version is stored as "X1.X2.....XN" where X1 is a major version; X2 is a minor version >+ * and so on. >+ */ >+ private boolean versionAtLeast(String testVersion) { >+ if (schemaVersion == null) >+ return false; >+ >+ String[] testVersions = testVersion.split("\\."); // '.' is a special character in the regular expressions >+ String[] schemaVersions = schemaVersion.split("\\."); >+ int maxCount = Math.min(testVersions.length, schemaVersions.length); >+ >+ for (int i = 0; i < maxCount; i++) { >+ Integer test = Integer.decode(testVersions[i]); >+ Integer schema = Integer.decode(schemaVersions[i]); >+ if (test == null || schema == null) >+ return false; >+ if (schema.compareTo(test) < 0) >+ return false; >+ } >+ return true; >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 128866
:
35147
|
35174