File path: /emf-2.4.1/src/org/eclipse/emf/ecore/plugin/ContentParserRegistryReader.java | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/plugin/ExtensionParserRegistryReader.java | |||
Method name: boolean readElement(IConfigurationElement, boolean)
|
Method name: boolean readElement(IConfigurationElement, boolean)
|
|||
Number of AST nodes: 13 | Number of AST nodes: 13 | |||
1 | String contentTypeIdentifier = element.getAttribute(ATT_CONTENT_TYPE_IDENTIFIER);↵ | 1 | String type = element.getAttribute(ATT_↵ | |
2 | if (contentTypeIdentifier↵ | 2 | TYPE);↵ | |
3 | == null)↵ | 3 | if (type == null)↵ | |
4 | {↵ | 4 | {↵ | |
5 | logMissingAttribute(element, ATT_CONTENT_TYPE_IDENTIFIER);↵ | 5 | logMissingAttribute(element, ATT_TYPE);↵ | |
6 | }↵ | 6 | }↵ | |
7 | else if (element.getAttribute(ATT_CLASS) == null)↵ | 7 | else if (element.getAttribute(ATT_CLASS) == null)↵ | |
8 | {↵ | 8 | {↵ | |
9 | logMissingAttribute(element, ATT_CLASS);↵ | 9 | logMissingAttribute(element, ATT_CLASS);↵ | |
10 | }↵ | 10 | }↵ | |
11 | else if (add)↵ | 11 | else if (add)↵ | |
12 | {↵ | 12 | {↵ | |
13 | Object previous = Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().put(contentTypeIdentifier, new ResourceFactoryDescriptor(element, ATT_CLASS));↵ | 13 | Object previous = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(type, new ResourceFactoryDescriptor(element, ATT_CLASS));↵ | |
14 | if (previous instanceof ResourceFactoryDescriptor)↵ | 14 | if (previous instanceof ResourceFactoryDescriptor)↵ | |
15 | {↵ | 15 | {↵ | |
16 | ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous;↵ | 16 | ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous;↵ | |
17 | EcorePlugin.INSTANCE.log↵ | 17 | EcorePlugin.INSTANCE.log↵ | |
18 | ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a content parser for '" + contentTypeIdentifier + "'");↵ | 18 | ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register an extension parser for '" + type + "'");↵ | |
19 | }↵ | 19 | }↵ | |
20 | return true;↵ | 20 | return true;↵ | |
21 | }↵ | 21 | }↵ | |
22 | else↵ | 22 | else↵ | |
23 | {↵ | 23 | {↵ | |
24 | Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().remove(contentTypeIdentifier);↵ | 24 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().remove(type);↵ | |
25 | return true;↵ | 25 | return true;↵ | |
26 | } | 26 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 49 |
Number of mapped statements | 13 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | String contentTypeIdentifier = element.getAttribute(ATT_CONTENT_TYPE_IDENTIFIER); |
| 2 | String type = element.getAttribute(ATT_TYPE); | |||||||||||||
3 | if (contentTypeIdentifier == null) |
| 3 | if (type == null) | |||||||||||||
4 | logMissingAttribute(element, ATT_CONTENT_TYPE_IDENTIFIER); |
| 4 | logMissingAttribute(element, ATT_TYPE); | |||||||||||||
5 | else if (element.getAttribute(ATT_CLASS) == null) | 5 | else if (element.getAttribute(ATT_CLASS) == null) | ||||||||||||||
6 | logMissingAttribute(element, ATT_CLASS); | 6 | logMissingAttribute(element, ATT_CLASS); | ||||||||||||||
7 | else if (add) | 7 | else if (add) | ||||||||||||||
8 | Object previous = Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().put(contentTypeIdentifier, new ResourceFactoryDescriptor(element, ATT_CLASS)); |
| 8 | Object previous = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(type, new ResourceFactoryDescriptor(element, ATT_CLASS)); | |||||||||||||
9 | if (previous instanceof ResourceFactoryDescriptor) | 9 | if (previous instanceof ResourceFactoryDescriptor) | ||||||||||||||
10 | ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous; | 10 | ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous; | ||||||||||||||
11 | EcorePlugin.INSTANCE.log("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a content parser for '" + contentTypeIdentifier + "'"); |
| 11 | EcorePlugin.INSTANCE.log("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register an extension parser for '" + type + "'"); | |||||||||||||
12 | return true; | 12 | return true; | ||||||||||||||
else | else | ||||||||||||||||
13 | Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().remove(contentTypeIdentifier); |
| 13 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().remove(type); | |||||||||||||
14 | return true; | 14 | return true; |
Row | Violation |
---|