{ /** * This method should be overriden with a domain-specific implementation * that returns the inputs to be added, e.g., by querying the user with a dialog. */ protected Collection<?> getBottomsToAdd() { return null; } /** * This action ignores the selection. */ @Override public void selectionChanged(IAction action, ISelection selection) { // Do nothing } @Override public void run(IAction action) { Collection<?> additions = getBottomsToAdd(); MappingRoot mappingRoot = ((MappingDomain)editingDomain).getMappingRoot(); command = AddCommand.create (editingDomain, mappingRoot, mappingRoot.isTopToBottom() ? //mappingRoot.ePackageMapping().getMapping_Outputs() : //mappingRoot.ePackageMapping().getMapping_Inputs(), MappingPackage.eINSTANCE.getMapping_Outputs() : MappingPackage.eINSTANCE.getMapping_Inputs(), additions); super.run(action); } @Override public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart) { super.setActiveWorkbenchPart(workbenchPart); action.setEnabled(true);
{ /** * This method should be overriden with a domain-specific implementation * that returns the inputs to be added, e.g., by querying the user with a dialog. */ protected Collection<?> getTopsToAdd() { return null; } /** * This action ignores the selection. */ @Override public void selectionChanged(IAction action, ISelection selection) { // Do nothing } @Override public void run(IAction action) { Collection<?> additions = getTopsToAdd(); MappingRoot mappingRoot = ((MappingDomain)editingDomain).getMappingRoot(); command = AddCommand.create (editingDomain, mappingRoot, mappingRoot.isTopToBottom() ? //mappingRoot.ePackageMapping().getMapping_Inputs() : //mappingRoot.ePackageMapping().getMapping_Outputs(), MappingPackage.eINSTANCE.getMapping_Inputs() : MappingPackage.eINSTANCE.getMapping_Outputs(), additions); super.run(action); } @Override public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart) { super.setActiveWorkbenchPart(workbenchPart); action.setEnabled(true);
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/mapping/action/AddRootBottomAction.java File path: /emf-2.4.1/src/org/eclipse/emf/mapping/action/AddRootTopAction.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
{
1
{
2
  /**
2
  /**
3
   * This method should be overriden with a domain-specific implementation 
3
   * This method should be overriden with a domain-specific implementation 
4
   * that returns the inputs to be added, e.g., by querying the user with a dialog.
4
   * that returns the inputs to be added, e.g., by querying the user with a dialog.
5
   */
5
   */
6
  protected Collection<?> getBottomsToAdd()
6
  protected Collection<?> getTopsToAdd()
7
  {
7
  {
8
    return null;
8
    return null;
9
  }
9
  }
10
  /**
10
  /**
11
   * This action ignores the selection.
11
   * This action ignores the selection.
12
   */
12
   */
13
  @Override
13
  @Override
14
  public void selectionChanged(IAction action, ISelection selection) 
14
  public void selectionChanged(IAction action, ISelection selection) 
15
  {
15
  {
16
    // Do nothing
16
    // Do nothing
17
  }
17
  }
18
  @Override
18
  @Override
19
  public void run(IAction action)
19
  public void run(IAction action)
20
  {
20
  {
21
    Collection<?> additions = getBottomsToAdd();
21
    Collection<?> additions = getTopsToAdd();
22
    MappingRoot mappingRoot = ((MappingDomain)editingDomain).getMappingRoot();
22
    MappingRoot mappingRoot = ((MappingDomain)editingDomain).getMappingRoot();
23
    command = AddCommand.create
23
    command = AddCommand.create
24
      (editingDomain, 
24
      (editingDomain, 
25
       mappingRoot, 
25
       mappingRoot, 
26
       mappingRoot.isTopToBottom() ?
26
       mappingRoot.isTopToBottom() ?
27
         //mappingRoot.ePackageMapping().getMapping_Outputs() :
27
         //mappingRoot.ePackageMapping().getMapping_Inputs() :
28
         //mappingRoot.ePackageMapping().getMapping_Inputs(),
28
         //mappingRoot.ePackageMapping().getMapping_Outputs(),
29
         MappingPackage.eINSTANCE.getMapping_Outputs() :
29
         MappingPackage.eINSTANCE.getMapping_Inputs() :
30
         MappingPackage.eINSTANCE.getMapping_Inputs(),
30
         MappingPackage.eINSTANCE.getMapping_Outputs(),
31
       additions);
31
       additions);
32
    super.run(action);
32
    super.run(action);
33
  }
33
  }
34
  @Override
34
  @Override
35
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
35
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
36
  {
36
  {
37
    super.setActiveWorkbenchPart(workbenchPart);
37
    super.setActiveWorkbenchPart(workbenchPart);
38
    action.setEnabled(true);
38
    action.setEnabled(true);
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0