try { mappingResource.save(null); IFile file = getFile(mappingResource); IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); final IWorkbenchPart activePart = workbenchPage.getActivePart(); if (activePart instanceof ISetSelectionTarget) { final ISelection targetSelection = new StructuredSelection(file); workbenchWindow.getShell().getDisplay().asyncExec(new Runnable() { public void run() { ((ISetSelectionTarget)activePart).selectReveal(targetSelection); } }); } try { workbenchPage.openEditor(new FileEditorInput(file), workbenchWindow.getWorkbench().getEditorRegistry().getDefaultEditor(file.getFullPath().toString()).getId()); } catch (PartInitException pie) { Ecore2EcoreEditorPlugin.INSTANCE.log(pie); } } catch (IOException ioe) { Ecore2EcoreEditorPlugin.INSTANCE.log(ioe); }
try { ecore2xmlResource.save(null); IFile file = getFile(ecore2xmlResource); IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); final IWorkbenchPart activePart = workbenchPage.getActivePart(); if (activePart instanceof ISetSelectionTarget) { final ISelection targetSelection = new StructuredSelection(file); workbenchWindow.getShell().getDisplay().asyncExec(new Runnable() { public void run() { ((ISetSelectionTarget)activePart).selectReveal(targetSelection); } }); } try { workbenchPage.openEditor(new FileEditorInput(file), workbenchWindow.getWorkbench().getEditorRegistry().getDefaultEditor(file.getFullPath().toString()).getId()); } catch (PartInitException pie) { Ecore2XMLUIPlugin.INSTANCE.log(pie); } } catch (IOException ioe) { Ecore2XMLUIPlugin.INSTANCE.log(ioe); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2ecore/action/MapToEcoreActionDelegate.java File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/action/GenerateEcore2XMLActionDelegate.java
Method name: void execute(IProgressMonitor) Method name: void execute(IProgressMonitor)
Number of AST nodes: 10 Number of AST nodes: 10
1
try
1
try
2
                  {
2
              {
3
                    mappingResource.save(null);
3
                ecore2xmlResource.save(null);
4
                    
4
                
5
    
6
                IFile file = getFile(mappingResource);
5
                IFile file = getFile(ecore2xmlResource);
7
                    IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
6
                IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
8
                    
7
                
9
    
10
                final IWorkbenchPart activePart = workbenchPage.getActivePart();
8
                final IWorkbenchPart activePart = workbenchPage.getActivePart();
11
                    if (activePart instanceof ISetSelectionTarget)
9
                if (activePart instanceof ISetSelectionTarget)
12
                    {
10
                {
13
                      final ISelection targetSelection = new StructuredSelection(file);
11
                  final ISelection targetSelection = new StructuredSelection(file);
14
                      workbenchWindow.getShell().getDisplay().asyncExec(new Runnable()
12
                  workbenchWindow.getShell().getDisplay().asyncExec(new Runnable()
15
                        {
13
                    {
16
                          public void run()
14
                    public void run()
17
                          {
15
                    
18
      
16
{
19
                      ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
17
                      ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
20
                     
18
                    }
21
     }
19
     
22
                        });
20
               });
23
       
21
                }
24
             }
22
             
25
    
23
   
26
                try {
24
                try {
27
                      workbenchPage.openEditor(new FileEditorInput(file), workbenchWindow.getWorkbench().getEditorRegistry().getDefaultEditor(file.getFullPath().toString()).getId());                      
25
                  workbenchPage.openEditor(new FileEditorInput(file), workbenchWindow.getWorkbench().getEditorRegistry().getDefaultEditor(file.getFullPath().toString()).getId());                      
28
                    } catch (PartInitException pie) {
26
                } catch (PartInitException pie) {
29
                      Ecore2EcoreEditorPlugin.INSTANCE.log(pie);                      
27
                  Ecore2XMLUIPlugin.INSTANCE.log(pie);                      
30
                    }
28
                
31
   
29
}
32
               }
30
              }
33
                  catch (IOException ioe)
31
              catch (IOException ioe)
34
                  {
32
              
35
    
33
{
36
                Ecore2EcoreEditorPlugin.INSTANCE.log(ioe);
34
                Ecore2XMLUIPlugin.INSTANCE.log(ioe);
37
    
35
                      
38
              }
36
              }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)3.1
Clones locationClones are in different classes having the same super class
Number of node comparisons46
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    try
    11
    try
    9
    try
    Differences
    Expression1Expression2Difference
    mappingResourceecore2xmlResourceVARIABLE_NAME_MISMATCH
    mappingResourceecore2xmlResourceVARIABLE_NAME_MISMATCH
    org.eclipse.emf.mapping.ecore2ecore.presentation.Ecore2EcoreEditorPluginorg.eclipse.emf.mapping.ecore2xml.ui.Ecore2XMLUIPluginSUBCLASS_TYPE_MISMATCH
    org.eclipse.emf.mapping.ecore2ecore.presentation.Ecore2EcoreEditorPluginorg.eclipse.emf.mapping.ecore2xml.ui.Ecore2XMLUIPluginSUBCLASS_TYPE_MISMATCH
    9
    try
    12
    mappingResource.save(null);
    12
    mappingResource.save(null);
    10
    ecore2xmlResource.save(null);
    Differences
    Expression1Expression2Difference
    mappingResourceecore2xmlResourceVARIABLE_NAME_MISMATCH
    10
    ecore2xmlResource.save(null);
    13
    IFile file = getFile(mappingResource);
    13
    IFile file = getFile(mappingResource);
    11
    IFile file = getFile(ecore2xmlResource);
    Differences
    Expression1Expression2Difference
    mappingResourceecore2xmlResourceVARIABLE_NAME_MISMATCH
    11
    IFile file = getFile(ecore2xmlResource);
    14
    IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    12
    IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    15
    final IWorkbenchPart activePart = workbenchPage.getActivePart();
    13
    final IWorkbenchPart activePart = workbenchPage.getActivePart();
    16
    if (activePart instanceof ISetSelectionTarget)
    14
    if (activePart instanceof ISetSelectionTarget)
    17
    final ISelection targetSelection = new StructuredSelection(file);
    15
    final ISelection targetSelection = new StructuredSelection(file);
    18
    workbenchWindow.getShell().getDisplay().asyncExec(new Runnable() {...});
    16
    workbenchWindow.getShell().getDisplay().asyncExec(new Runnable() {...});
    19
    try
    19
    try
    17
    try
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.mapping.ecore2ecore.presentation.Ecore2EcoreEditorPluginorg.eclipse.emf.mapping.ecore2xml.ui.Ecore2XMLUIPluginSUBCLASS_TYPE_MISMATCH
    17
    try
    20
    workbenchPage.openEditor(new FileEditorInput(file), workbenchWindow.getWorkbench().getEditorRegistry().getDefaultEditor(file.getFullPath().toString()).getId());
    18
    workbenchPage.openEditor(new FileEditorInput(file), workbenchWindow.getWorkbench().getEditorRegistry().getDefaultEditor(file.getFullPath().toString()).getId());
    Precondition Violations (0)
    Row Violation