|
Lines 134-139
Link Here
|
| 134 |
|
134 |
|
| 135 |
private Locator locator = null; |
135 |
private Locator locator = null; |
| 136 |
|
136 |
|
|
|
137 |
// Cache the behavior toggle (true: attempt to extract namespace from qualified IDs) |
| 138 |
private Boolean extractNamespaces = null; |
| 139 |
|
| 137 |
public ExtensionsParser(MultiStatus status, ExtensionRegistry registry) { |
140 |
public ExtensionsParser(MultiStatus status, ExtensionRegistry registry) { |
| 138 |
super(); |
141 |
super(); |
| 139 |
this.status = status; |
142 |
this.status = status; |
|
Lines 404-410
Link Here
|
| 404 |
String simpleId; |
407 |
String simpleId; |
| 405 |
String namespaceName; |
408 |
String namespaceName; |
| 406 |
int simpleIdStart = attrValue.lastIndexOf('.'); |
409 |
int simpleIdStart = attrValue.lastIndexOf('.'); |
| 407 |
if (simpleIdStart != -1) { |
410 |
if ((simpleIdStart != -1) && extractNamespace()) { |
| 408 |
simpleId = attrValue.substring(simpleIdStart + 1); |
411 |
simpleId = attrValue.substring(simpleIdStart + 1); |
| 409 |
namespaceName = attrValue.substring(0, simpleIdStart); |
412 |
namespaceName = attrValue.substring(0, simpleIdStart); |
| 410 |
} else { |
413 |
} else { |
|
Lines 473-484
Link Here
|
| 473 |
String uniqueId; |
476 |
String uniqueId; |
| 474 |
String namespaceName; |
477 |
String namespaceName; |
| 475 |
int simpleIdStart = attrValue.lastIndexOf('.'); |
478 |
int simpleIdStart = attrValue.lastIndexOf('.'); |
| 476 |
if (simpleIdStart == -1) { |
479 |
if (simpleIdStart != -1 && extractNamespace()) { |
| 477 |
namespaceName = contribution.getDefaultNamespace(); |
|
|
| 478 |
uniqueId = namespaceName + '.' + attrValue; |
| 479 |
} else { |
| 480 |
namespaceName = attrValue.substring(0, simpleIdStart); |
480 |
namespaceName = attrValue.substring(0, simpleIdStart); |
| 481 |
uniqueId = attrValue; |
481 |
uniqueId = attrValue; |
|
|
482 |
} else { |
| 483 |
namespaceName = contribution.getDefaultNamespace(); |
| 484 |
uniqueId = namespaceName + '.' + attrValue; |
| 482 |
} |
485 |
} |
| 483 |
currentExtPoint.setUniqueIdentifier(uniqueId); |
486 |
currentExtPoint.setUniqueIdentifier(uniqueId); |
| 484 |
currentExtPoint.setNamespace(namespaceName); |
487 |
currentExtPoint.setNamespace(namespaceName); |
|
Lines 589-595
Link Here
|
| 589 |
* for extension points that were renamed between release 2.1 and 3.0. |
592 |
* for extension points that were renamed between release 2.1 and 3.0. |
| 590 |
*/ |
593 |
*/ |
| 591 |
private Extension[] fixRenamedExtensionPoints(Extension[] extensions) { |
594 |
private Extension[] fixRenamedExtensionPoints(Extension[] extensions) { |
| 592 |
if (extensions == null || (schemaVersion != null && schemaVersion.equals("3.0")) || RegistryProperties.getProperty(NO_EXTENSION_MUNGING) != null) //$NON-NLS-1$ |
595 |
if (extensions == null || versionAtLeast("3.0") || RegistryProperties.getProperty(NO_EXTENSION_MUNGING) != null) //$NON-NLS-1$ |
| 593 |
return extensions; |
596 |
return extensions; |
| 594 |
for (int i = 0; i < extensions.length; i++) { |
597 |
for (int i = 0; i < extensions.length; i++) { |
| 595 |
Extension extension = extensions[i]; |
598 |
Extension extension = extensions[i]; |
|
Lines 601-604
Link Here
|
| 601 |
} |
604 |
} |
| 602 |
return extensions; |
605 |
return extensions; |
| 603 |
} |
606 |
} |
|
|
607 |
|
| 608 |
/** |
| 609 |
* To preserve backward compatibility, we will only attempt to extract namespace form the name |
| 610 |
* if Eclipse version specified in the plugin.xml (<?eclipse version="3.2"?>) is at least 3.2. |
| 611 |
*/ |
| 612 |
private boolean extractNamespace() { |
| 613 |
if (extractNamespaces == null) |
| 614 |
extractNamespaces = new Boolean(versionAtLeast("3.2")); |
| 615 |
return extractNamespaces.booleanValue(); |
| 616 |
} |
| 617 |
|
| 618 |
/** |
| 619 |
* Makes sense only for plugin.xml versions >= 3.0 (Eclipse version was introduced in 3.0). |
| 620 |
* Assumes that version is stored as "X1.X2.....XN" where X1 is a major version; X2 is a minor version |
| 621 |
* and so on. |
| 622 |
*/ |
| 623 |
private boolean versionAtLeast(String testVersion) { |
| 624 |
if (schemaVersion == null) |
| 625 |
return false; |
| 626 |
|
| 627 |
String[] testVersions = testVersion.split("\\."); // '.' is a special character in the regular expressions |
| 628 |
String[] schemaVersions = schemaVersion.split("\\."); |
| 629 |
int maxCount = Math.min(testVersions.length, schemaVersions.length); |
| 630 |
|
| 631 |
for (int i = 0; i < maxCount; i++) { |
| 632 |
Integer test = Integer.decode(testVersions[i]); |
| 633 |
Integer schema = Integer.decode(schemaVersions[i]); |
| 634 |
if (test == null || schema == null) |
| 635 |
return false; |
| 636 |
if (schema.compareTo(test) < 0) |
| 637 |
return false; |
| 638 |
} |
| 639 |
return true; |
| 640 |
} |
| 604 |
} |
641 |
} |