adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); // Create the command stack that will notify this editor as commands are executed. // BasicCommandStack commandStack = new BasicCommandStack(); // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. // commandStack.addCommandStackListener (new CommandStackListener() { public void commandStackChanged(final EventObject event) { getContainer().getDisplay().asyncExec (new Runnable() { public void run() { firePropertyChange(IEditorPart.PROP_DIRTY); // Try to select the affected objects. // Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand(); if (mostRecentCommand != null) { setSelectionToViewer(mostRecentCommand.getAffectedObjects()); } if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { propertySheetPage.refresh(); } } }); } }); // Create the editing domain with a special command stack. // editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); // Create the command stack that will notify this editor as commands are executed. // BasicCommandStack commandStack = new BasicCommandStack(); // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. // commandStack.addCommandStackListener (new CommandStackListener() { public void commandStackChanged(final EventObject event) { getContainer().getDisplay().asyncExec (new Runnable() { public void run() { firePropertyChange(IEditorPart.PROP_DIRTY); // Try to select the affected objects. // Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand(); if (mostRecentCommand != null) { setSelectionToViewer(mostRecentCommand.getAffectedObjects()); } if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { propertySheetPage.refresh(); } } }); } }); // Create the editing domain with a special command stack. // editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
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 initializeEditingDomain() Method name: void initializeEditingDomain()
Number of AST nodes: 5 Number of AST nodes: 5
1
adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
1
adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
2
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
2
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
3
    // Create the command stack that will notify this editor as commands are executed.
3
    // Create the command stack that will notify this editor as commands are executed.
4
    //
4
    //
5
    BasicCommandStack commandStack = new BasicCommandStack();
5
    BasicCommandStack commandStack = new BasicCommandStack();
6
    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
6
    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
7
    //
7
    //
8
    commandStack.addCommandStackListener
8
    commandStack.addCommandStackListener
9
      (new CommandStackListener()
9
      (new CommandStackListener()
10
       {
10
       {
11
         public void commandStackChanged(final EventObject event)
11
         public void commandStackChanged(final EventObject event)
12
         {
12
         {
13
           getContainer().getDisplay().asyncExec
13
           getContainer().getDisplay().asyncExec
14
             (new Runnable()
14
             (new Runnable()
15
              {
15
              {
16
                public void run()
16
                public void run()
17
                {
17
                {
18
                  firePropertyChange(IEditorPart.PROP_DIRTY);
18
                  firePropertyChange(IEditorPart.PROP_DIRTY);
19
                  // Try to select the affected objects.
19
                  // Try to select the affected objects.
20
                  //
20
                  //
21
                  Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
21
                  Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
22
                  if (mostRecentCommand != null)
22
                  if (mostRecentCommand != null)
23
                  {
23
                  {
24
                    setSelectionToViewer(mostRecentCommand.getAffectedObjects());
24
                    setSelectionToViewer(mostRecentCommand.getAffectedObjects());
25
                  }
25
                  }
26
                  if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed())
26
                  if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed())
27
                  {
27
                  {
28
                    propertySheetPage.refresh();
28
                    propertySheetPage.refresh();
29
                  }
29
                  }
30
                }
30
                }
31
              });
31
              });
32
         }
32
         }
33
       });
33
       });
34
    // Create the editing domain with a special command stack.
34
    // Create the editing domain with a special command stack.
35
    //
35
    //
36
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
36
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
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)0.0
Clones locationClones are in different classes having the same super class
Number of node comparisons11
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    3
    adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
    4
    adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
    4
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
    5
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
    5
    BasicCommandStack commandStack = new BasicCommandStack();
    6
    BasicCommandStack commandStack = new BasicCommandStack();
    6
    commandStack.addCommandStackListener(new CommandStackListener() {...});
    7
    commandStack.addCommandStackListener(new CommandStackListener() {...});
    7
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
    8
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
    Precondition Violations (0)
    Row Violation