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/DynamicPackageRegistryReader.java | |||
Method name: boolean readElement(IConfigurationElement, boolean)
|
Method name: boolean readElement(IConfigurationElement, boolean)
|
|||
Number of AST nodes: 15 | Number of AST nodes: 15 | |||
1 | if (element.getName().equals(TAG_PARSER))↵ | 1 | if (element.getName().equals(TAG_RESOURCE))↵ | |
2 | {↵ | 2 | {↵ | |
3 | String contentTypeIdentifier = element.getAttribute(ATT_CONTENT_TYPE_IDENTIFIER);↵ | 3 | String packageURI = element.getAttribute(ATT_↵ | |
4 | if (contentTypeIdentifier↵ | 4 | URI);↵ | |
5 | == null)↵ | 5 | if (packageURI == null)↵ | |
6 | {↵ | 6 | {↵ | |
7 | logMissingAttribute(element, ATT_CONTENT_TYPE_IDENTIFIER);↵ | 7 | logMissingAttribute(element, ATT_URI);↵ | |
8 | }↵ | 8 | }↵ | |
9 | else if (element.getAttribute(ATT_CLASS) == null)↵ | 9 | else if (element.getAttribute(ATT_LOCATION) == null)↵ | |
10 | {↵ | 10 | {↵ | |
11 | logMissingAttribute(element, ATT_CLASS);↵ | 11 | logMissingAttribute(element, ATT_LOCATION);↵ | |
12 | }↵ | 12 | }↵ | |
13 | else if (add)↵ | 13 | else if (add)↵ | |
14 | {↵ | 14 | {↵ | |
15 | Object previous = Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().put(contentTypeIdentifier, new ResourceFactoryDescriptor(element, ATT_CLASS));↵ | 15 | Object previous = EPackage.Registry.INSTANCE.put(packageURI, new EPackageDescriptor.Dynamic(element, ATT_LOCATION));↵ | |
16 | if (previous instanceof ResourceFactoryDescriptor)↵ | 16 | if (previous instanceof PluginClassDescriptor)↵ | |
17 | {↵ | 17 | {↵ | |
18 | ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous;↵ | 18 | PluginClassDescriptor descriptor = (PluginClassDescriptor)previous;↵ | |
19 | EcorePlugin.INSTANCE.log↵ | 19 | EcorePlugin.INSTANCE.log↵ | |
20 | ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a content parser for '" + contentTypeIdentifier + "'");↵ | 20 | ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a package for '" + packageURI + "'");↵ | |
21 | }↵ | 21 | }↵ | |
22 | ↵ | |||
22 | return true;↵ | 23 | return true;↵ | |
23 | }↵ | 24 | }↵ | |
24 | else↵ | 25 | else↵ | |
25 | {↵ | 26 | {↵ | |
26 | Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().remove(contentTypeIdentifier);↵ | 27 | EPackage.Registry.INSTANCE.remove(packageURI);↵ | |
27 | return true;↵ | 28 | return true;↵ | |
28 | }↵ | 29 | }↵ | |
29 | }↵ | 30 | }↵ | |
30 | return false; | 31 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 52 |
Number of mapped statements | 13 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 4.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (element.getName().equals(TAG_PARSER)) |
| 1 | if (element.getName().equals(TAG_RESOURCE)) | ||||||||||||||||
2 | String contentTypeIdentifier = element.getAttribute(ATT_CONTENT_TYPE_IDENTIFIER); |
| 2 | String packageURI = element.getAttribute(ATT_URI); | ||||||||||||||||
3 | if (contentTypeIdentifier == null) |
| 3 | if (packageURI == null) | ||||||||||||||||
4 | logMissingAttribute(element, ATT_CONTENT_TYPE_IDENTIFIER); |
| 4 | logMissingAttribute(element, ATT_URI); | ||||||||||||||||
5 | else if (element.getAttribute(ATT_CLASS) == null) |
| 5 | else if (element.getAttribute(ATT_LOCATION) == null) | ||||||||||||||||
6 | logMissingAttribute(element, ATT_CLASS); |
| 6 | logMissingAttribute(element, ATT_LOCATION); | ||||||||||||||||
7 | else if (add) | 7 | else if (add) | |||||||||||||||||
|
| 8 | Object previous = EPackage.Registry.INSTANCE.put(packageURI, new EPackageDescriptor.Dynamic(element, ATT_LOCATION)); | |||||||||||||||||
8 | Object previous = Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().put(contentTypeIdentifier, new ResourceFactoryDescriptor(element, ATT_CLASS)); |
| | |||||||||||||||||
9 | if (previous instanceof ResourceFactoryDescriptor) |
| 9 | if (previous instanceof PluginClassDescriptor) | ||||||||||||||||
10 | ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous; |
| 10 | PluginClassDescriptor descriptor = (PluginClassDescriptor)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 a package for '" + packageURI + "'"); | ||||||||||||||||
12 | return true; | 12 | return true; | |||||||||||||||||
else | else | |||||||||||||||||||
| 13 | EPackage.Registry.INSTANCE.remove(packageURI); | ||||||||||||||||||
13 | Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().remove(contentTypeIdentifier); | | ||||||||||||||||||
14 | return true; | 14 | return true; | |||||||||||||||||
15 | return false; | 15 | return false; |
Row | Violation |
---|---|
1 | Unmatched statement Object previous=EPackage.Registry.INSTANCE.put(packageURI,new EPackageDescriptor.Dynamic(element,ATT_LOCATION)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement Object previous=Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().put(contentTypeIdentifier,new ResourceFactoryDescriptor(element,ATT_CLASS)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |