String path = model.getItem(i); JMenuItem menuItem = new JMenuItem(MiscUtilities.getFileName(path)); menuItem.setActionCommand(path); menuItem.addActionListener(actionListener); menuItem.addMouseListener(mouseListener); menuItem.setIcon(FileCellRenderer.dirIcon); if(sort) menuItems.addElement(menuItem); else { if(menu.getMenuComponentCount() >= maxItems && i != model.getSize() - 1) { JMenu newMenu = new JMenu( jEdit.getProperty("common.more")); menu.add(newMenu); menu = newMenu; } menu.add(menuItem); }
String path = ((BufferHistory.Entry)iter.next()).path; JMenuItem menuItem = new JMenuItem(MiscUtilities .getFileName(path)); menuItem.setActionCommand(path); menuItem.addActionListener(actionListener); menuItem.addMouseListener(mouseListener); menuItem.setIcon(FileCellRenderer.fileIcon); if(sort) menuItems.addElement(menuItem); else { if(menu.getMenuComponentCount() >= maxItems && iter.hasNext()) { JMenu newMenu = new JMenu( jEdit.getProperty("common.more")); menu.add(newMenu); menu = newMenu; } menu.add(menuItem); }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/menu/RecentDirectoriesProvider.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/menu/RecentFilesProvider.java
Method name: void update(JMenu) Method name: void update(JMenu)
Number of AST nodes: 13 Number of AST nodes: 13
1
String path = model.getItem(i);
1
String path = ((BufferHistory.Entry)iter.next()).path;
2
			JMenuItem menuItem = new JMenuItem(MiscUtilities
2
			JMenuItem menuItem = new JMenuItem(MiscUtilities
3
.getFileName(path));
3
				.getFileName(path));
4
			menuItem.setActionCommand(path);
4
			menuItem.setActionCommand(path);
5
			menuItem.addActionListener(actionListener);
5
			menuItem.addActionListener(actionListener);
6
			menuItem.addMouseListener(mouseListener);
6
			menuItem.addMouseListener(mouseListener);
7
			menuItem.setIcon(FileCellRenderer.dirIcon);
7
			menuItem.setIcon(FileCellRenderer.fileIcon);
8
			if(sort)
8
			if(sort)
9
				menuItems.addElement(menuItem);
9
				menuItems.addElement(menuItem);
10
			else
10
			else
11
			{
11
			{
12
				if(menu.getMenuComponentCount() >= maxItems
12
				if(menu.getMenuComponentCount() >= maxItems
13
					&& i != model.getSize() - 1)
13
					&& iter.hasNext())
14
				{
14
				{
15
					JMenu newMenu = new JMenu(
15
					JMenu newMenu = new JMenu(
16
						jEdit.getProperty("common.more"));
16
						jEdit.getProperty("common.more"));
17
					menu.add(newMenu);
17
					menu.add(newMenu);
18
					menu = newMenu;
18
					menu = newMenu;
19
				}
19
				}
20
				menu.add(menuItem);
20
				menu.add(menuItem);
21
			}
21
			}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in different classes
Number of node comparisons49
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)18.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    14
    String path = model.getItem(i);
    14
    String path = model.getItem(i);
    15
    String path = ((BufferHistory.Entry)iter.next()).path;
    Differences
    Expression1Expression2Difference
    model.getItem(i)((BufferHistory.Entry)iter.next()).pathTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ((BufferHistory.Entry)iter.next()).path cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15
    String path = ((BufferHistory.Entry)iter.next()).path;
    15
    JMenuItem menuItem = new JMenuItem(MiscUtilities.getFileName(path));
    16
    JMenuItem menuItem = new JMenuItem(MiscUtilities.getFileName(path));
    16
    menuItem.setActionCommand(path);
    17
    menuItem.setActionCommand(path);
    17
    menuItem.addActionListener(actionListener);
    18
    menuItem.addActionListener(actionListener);
    18
    menuItem.addMouseListener(mouseListener);
    19
    menuItem.addMouseListener(mouseListener);
    19
    menuItem.setIcon(FileCellRenderer.dirIcon);
    19
    menuItem.setIcon(FileCellRenderer.dirIcon);
    20
    menuItem.setIcon(FileCellRenderer.fileIcon);
    Differences
    Expression1Expression2Difference
    dirIconfileIconVARIABLE_NAME_MISMATCH
    20
    menuItem.setIcon(FileCellRenderer.fileIcon);
    20
    if (sort)
    21
    if (sort)
    21
    menuItems.addElement(menuItem);
    22
    menuItems.addElement(menuItem);
    else
    else
    22
    if (menu.getMenuComponentCount() >= maxItems && i != model.getSize() - 1)
    22
    if (menu.getMenuComponentCount() >= maxItems && i != model.getSize() - 1)
    23
    if (menu.getMenuComponentCount() >= maxItems && iter.hasNext())
    Differences
    Expression1Expression2Difference
    i != model.getSize() - 1iter.hasNext()INFIX_RIGHT_OPERAND_MISMATCH
    Preondition Violations
    Expression iter.hasNext() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23
    if (menu.getMenuComponentCount() >= maxItems && iter.hasNext())
    23
    JMenu newMenu = new JMenu(jEdit.getProperty("common.more"));
    24
    JMenu newMenu = new JMenu(jEdit.getProperty("common.more"));
    24
    menu.add(newMenu);
    25
    menu.add(newMenu);
    25
    menu = newMenu;
    26
    menu = newMenu;
    26
    menu.add(menuItem);
    27
    menu.add(menuItem);
    Precondition Violations (2)
    Row Violation
    1Expression ((BufferHistory.Entry)iter.next()).path cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression iter.hasNext() cannot be parameterized, because it has dependencies to/from statements that will be extracted