if (IFile.class.isInstance(structuredSelection.getFirstElement()))
{
IFile file = (IFile)structuredSelection.getFirstElement();
if (ECORE2ECORE_FILE_EXTENSION.equals(file.getFullPath().getFileExtension()))
{
return
(Ecore2EcoreMappingRoot)EcoreUtil.getObjectByType
(new ResourceSetImpl().getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true).getContents(),
Ecore2EcorePackage.Literals.ECORE2_ECORE_MAPPING_ROOT);
}
}
return null;
if (IFile.class.isInstance(structuredSelection.getFirstElement()))
{
IFile file = (IFile)structuredSelection.getFirstElement();
if (FILE_EXTENSIONS.contains(file.getFullPath().getFileExtension()))
{
return
(EPackage)EcoreUtil.getObjectByType
(new ResourceSetImpl().getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true).getContents(),
EcorePackage.Literals.EPACKAGE);
}
}
return null;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/action/GenerateEcore2XMLActionDelegate.java
|
|
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2ecore/action/MapToEcoreActionDelegate.java
|
Method name: Ecore2EcoreMappingRoot getMappingRoot(IStructuredSelection)
|
|
Method name: EPackage getInputEPackage(IStructuredSelection)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | if (IFile.class.isInstance(structuredSelection.getFirstElement()))↵ | | 1 | if (IFile.class.isInstance(structuredSelection.getFirstElement()))↵
|
2 | {↵ | | 2 | {↵
|
3 | IFile file = (IFile)structuredSelection.getFirstElement();↵ | | 3 | IFile file = (IFile)structuredSelection.getFirstElement();↵
|
4 | ↵ | | |
|
5 | if (ECORE2ECORE_FILE_EXTENSION.equals(file.getFullPath().getFileExtension()))↵ | | 4 | if (FILE_EXTENSIONS.contains(file.getFullPath().getFileExtension()))↵
|
6 | {↵ | | 5 | {↵
|
7 | return ↵ | | 6 | return ↵
|
8 | (Ecore2EcoreMappingRoot)EcoreUtil.getObjectByType↵ | | 7 | (EPackage)EcoreUtil.getObjectByType↵
|
9 | (new ResourceSetImpl().getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true).getContents(), ↵ | | 8 | (new ResourceSetImpl().getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true).getContents(),↵
|
10 | Ecore2EcorePackage.Literals.ECORE2_ECORE_MAPPING_ROOT);↵ | | 9 | EcorePackage.Literals.EPACKAGE);↵
|
11 | }↵ | | 10 | }↵
|
12 | }↵ | | 11 | }↵
|
13 | ↵ | | |
|
14 | return null; | | 12 | return null;
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 0 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 1 |