package org.eclipse.emf.edit.ui.action; import java.util.Collection; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.edit.command.CopyToClipboardCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.emf.edit.ui.EMFEditUIPlugin; /** * A copy action is implemented by creating a {@link CopyToClipboardCommand}. */ public class CopyAction extends CommandActionHandler { public CopyAction(EditingDomain domain) { super(domain, EMFEditUIPlugin.INSTANCE.getString("_UI_Copy_menu_item")); } public CopyAction() { super(null, EMFEditUIPlugin.INSTANCE.getString("_UI_Copy_menu_item")); } @Override public Command createCommand(Collection<?> selection) { return CopyToClipboardCommand.create(domain, selection); } /** * @deprecated As of EMF 2.1.0, replaced by {@link #setActiveWorkbenchPart}. */ @Deprecated public void setActiveEditor(IEditorPart editorPart) { setActiveWorkbenchPart(editorPart); } /** * @since 2.1.0 */ public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart) { if (workbenchPart instanceof IEditingDomainProvider) { domain = ((IEditingDomainProvider)workbenchPart).getEditingDomain(); } } }
package org.eclipse.emf.edit.ui.action; import java.util.Collection; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.edit.command.CutToClipboardCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.emf.edit.ui.EMFEditUIPlugin; /** * A cut action is implemented by creating a {@link CutToClipboardCommand}. */ public class CutAction extends CommandActionHandler { public CutAction(EditingDomain domain) { super(domain, EMFEditUIPlugin.INSTANCE.getString("_UI_Cut_menu_item")); } public CutAction() { super(null, EMFEditUIPlugin.INSTANCE.getString("_UI_Cut_menu_item")); } @Override public Command createCommand(Collection<?> selection) { return CutToClipboardCommand.create(domain, selection); } /** * @deprecated As of EMF 2.1.0, replaced by {@link #setActiveWorkbenchPart}. */ @Deprecated public void setActiveEditor(IEditorPart editorPart) { setActiveWorkbenchPart(editorPart); } /** * @since 2.1.0 */ public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart) { if (workbenchPart instanceof IEditingDomainProvider) { domain = ((IEditingDomainProvider)workbenchPart).getEditingDomain(); } } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/ui/action/CopyAction.java File path: /emf-2.4.1/src/org/eclipse/emf/edit/ui/action/CutAction.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
package org.eclipse.emf.edit.ui.action;
1
package org.eclipse.emf.edit.ui.action;
2
import java.util.Collection;
2
import java.util.Collection;
3
import org.eclipse.ui.IEditorPart;
3
import org.eclipse.ui.IEditorPart;
4
import org.eclipse.ui.IWorkbenchPart;
4
import org.eclipse.ui.IWorkbenchPart;
5
import org.eclipse.emf.common.command.Command;
5
import org.eclipse.emf.common.command.Command;
6
import org.eclipse.emf.edit.command.CopyToClipboardCommand;
6
import org.eclipse.emf.edit.command.CutToClipboardCommand;
7
import org.eclipse.emf.edit.domain.EditingDomain;
7
import org.eclipse.emf.edit.domain.EditingDomain;
8
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
8
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
9
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
9
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
10
/**
10
/**
11
 * A copy action is implemented by creating a {@link CopyToClipboardCommand}.
11
 * A cut action is implemented by creating a {@link CutToClipboardCommand}.
12
 */
12
 */
13
public class CopyAction extends CommandActionHandler
13
public class CutAction extends CommandActionHandler
14
{
14
{
15
  public CopyAction(EditingDomain domain)
15
  public CutAction(EditingDomain domain)
16
  {
16
  {
17
    super(domain, EMFEditUIPlugin.INSTANCE.getString("_UI_Copy_menu_item"));
17
    super(domain, EMFEditUIPlugin.INSTANCE.getString("_UI_Cut_menu_item"));
18
  }
18
  }
19
  public CopyAction()
19
  public CutAction()
20
  {
20
  {
21
    super(null, EMFEditUIPlugin.INSTANCE.getString("_UI_Copy_menu_item"));
21
    super(null, EMFEditUIPlugin.INSTANCE.getString("_UI_Cut_menu_item"));
22
  }
22
  }
23
  @Override
23
  @Override
24
  public Command createCommand(Collection<?> selection)
24
  public Command createCommand(Collection<?> selection)
25
  {
25
  {
26
    return CopyToClipboardCommand.create(domain, selection);
26
    return CutToClipboardCommand.create(domain, selection);
27
  }
27
  }
28
  /**
28
  /**
29
   * @deprecated As of EMF 2.1.0, replaced by {@link #setActiveWorkbenchPart}.
29
   * @deprecated As of EMF 2.1.0, replaced by {@link #setActiveWorkbenchPart}.
30
   */
30
   */
31
  @Deprecated
31
  @Deprecated
32
  public void setActiveEditor(IEditorPart editorPart)
32
  public void setActiveEditor(IEditorPart editorPart)
33
  {
33
  {
34
    setActiveWorkbenchPart(editorPart);
34
    setActiveWorkbenchPart(editorPart);
35
  }
35
  }
36
  /**
36
  /**
37
   * @since 2.1.0
37
   * @since 2.1.0
38
   */
38
   */
39
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
39
  public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
40
  {
40
  {
41
    if (workbenchPart instanceof IEditingDomainProvider)
41
    if (workbenchPart instanceof IEditingDomainProvider)
42
    {
42
    {
43
      domain = ((IEditingDomainProvider)workbenchPart).getEditingDomain();
43
      domain = ((IEditingDomainProvider)workbenchPart).getEditingDomain();
44
    }
44
    }
45
  }
45
  }
46
}
46
}
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