if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { if (isDirty()) { changedResources.addAll(editingDomain.getResourceSet().getResources()); } editingDomain.getCommandStack().flush(); updateProblemIndication = false; for (Resource resource : changedResources) { if (resource.isLoaded()) { resource.unload(); try { resource.load(Collections.EMPTY_MAP); } catch (IOException exception) { if (!resourceToDiagnosticMap.containsKey(resource)) { resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); } } } } if (AdapterFactoryEditingDomain.isStale(editorSelection)) { setSelection(StructuredSelection.EMPTY); } updateProblemIndication = true; updateProblemIndication(); }
if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { if (isDirty()) { changedResources.addAll(editingDomain.getResourceSet().getResources()); } editingDomain.getCommandStack().flush(); updateProblemIndication = false; for (Resource resource : changedResources) { if (resource.isLoaded()) { resource.unload(); try { resource.load(Collections.EMPTY_MAP); } catch (IOException exception) { if (!resourceToDiagnosticMap.containsKey(resource)) { resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); } } } } if (AdapterFactoryEditingDomain.isStale(editorSelection)) { setSelection(StructuredSelection.EMPTY); } updateProblemIndication = true; updateProblemIndication(); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/presentation/EcoreEditor.java File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/presentation/Ecore2XMLEditor.java
Method name: void handleChangedResources() Method name: void handleChangedResources()
Number of AST nodes: 14 Number of AST nodes: 14
1
if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict()))
1
if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict()))
2
    {
2
    {
3
      if (isDirty())
3
      if (isDirty())
4
      {
4
      {
5
        changedResources.addAll(editingDomain.getResourceSet().getResources());
5
        changedResources.addAll(editingDomain.getResourceSet().getResources());
6
      }
6
      }
7
      editingDomain.getCommandStack().flush();
7
      editingDomain.getCommandStack().flush();
8
      updateProblemIndication = false;
8
      updateProblemIndication = false;
9
      for (Resource resource : changedResources)
9
      for (Resource resource : changedResources)
10
      {
10
      {
11
        if (resource.isLoaded())
11
        if (resource.isLoaded())
12
        {
12
        {
13
          resource.unload();
13
          resource.unload();
14
          try
14
          try
15
          {
15
          {
16
            resource.load(Collections.EMPTY_MAP);
16
            resource.load(Collections.EMPTY_MAP);
17
          }
17
          }
18
          catch (IOException exception)
18
          catch (IOException exception)
19
          {
19
          {
20
            if (!resourceToDiagnosticMap.containsKey(resource))
20
            if (!resourceToDiagnosticMap.containsKey(resource))
21
            {
21
            {
22
              resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
22
              resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
23
            }
23
            }
24
          }
24
          }
25
        }
25
        }
26
      }
26
      }
27
      if (AdapterFactoryEditingDomain.isStale(editorSelection))
27
      if (AdapterFactoryEditingDomain.isStale(editorSelection))
28
      {
28
      {
29
        setSelection(StructuredSelection.EMPTY);
29
        setSelection(StructuredSelection.EMPTY);
30
      }
30
      }
31
      updateProblemIndication = true;
31
      updateProblemIndication = true;
32
      updateProblemIndication();
32
      updateProblemIndication();
33
    }
33
    }
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)1.2
Clones locationClones are in different classes having the same super class
Number of node comparisons47
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.0
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict()))
    1
    if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict()))
    2
    if (isDirty())
    2
    if (isDirty())
    3
    changedResources.addAll(editingDomain.getResourceSet().getResources());
    3
    changedResources.addAll(editingDomain.getResourceSet().getResources());
    4
    editingDomain.getCommandStack().flush();
    4
    editingDomain.getCommandStack().flush();
    5
    updateProblemIndication = false;
    5
    updateProblemIndication = false;
    6
    for (Resource resource : changedResources)
    6
    for (Resource resource : changedResources)
    7
    if (resource.isLoaded())
    7
    if (resource.isLoaded())
    8
    resource.unload();
    8
    resource.unload();
    9
    try
    9
    try
    10
    resource.load(Collections.EMPTY_MAP);
    10
    resource.load(Collections.EMPTY_MAP);
    11
    if (AdapterFactoryEditingDomain.isStale(editorSelection))
    11
    if (AdapterFactoryEditingDomain.isStale(editorSelection))
    12
    setSelection(StructuredSelection.EMPTY);
    12
    setSelection(StructuredSelection.EMPTY);
    13
    updateProblemIndication = true;
    13
    updateProblemIndication = true;
    14
    updateProblemIndication();
    14
    updateProblemIndication();
    Precondition Violations (0)
    Row Violation