if (fc.showSaveDialog(frameMediator.getContainer().getFrame()) == JFileChooser.APPROVE_OPTION) { File destFile = fc.getSelectedFile(); ICalendarStore store = CalendarStoreFactory.getInstance() .getLocaleStore(); Command command = new ExportCalendarCommand( new CalendarCommandReference(store, calendar), destFile); CommandProcessor.getInstance().addOp(command); }
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File location = fc.getSelectedFile(); Profile p = new Profile(location.getName(), location); // add profile to profiles.xml ProfileManager.getInstance().addProfile(p); // add to listmodel model.addElement(p.getName()); // select new item list.setSelectedValue(p.getName(), true); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/main/java/org/columba/calendar/ui/action/ExportCalendarAction.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/profiles/ProfileManagerDialog.java
Method name: void actionPerformed(ActionEvent) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 5 Number of AST nodes: 6
1
if (fc.showSaveDialog(frameMediator.getContainer().getFrame()) == JFileChooser.APPROVE_OPTION) {
1
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
2
			File destFile = fc.getSelectedFile();
2
				File location = fc.getSelectedFile();
3
			ICalendarStore store = CalendarStoreFactory.getInstance()
3
				
4
			.getLocaleStor
4
Profile p = new Profile(location.getName(), location);
5
				// add profile to profiles.xml
5
e();
6
				ProfileManager.getInstance().addProfile(p);
6
			Command command = new ExportCalendarCommand(
7
			
7
					new CalendarCommandReference(store, calendar), destFile);
8
			CommandProcessor.getInstance().addOp(command
8
	// add to listmodel
9
				model.addElement(p.getName());
10
				// select new item
9
);
11
				list.setSelectedValue(p.getName(), true);
10
		}
12
			}
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.5
Clones locationClones are in different classes
Number of node comparisons30
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)35.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    11
    if (fc.showSaveDialog(frameMediator.getContainer().getFrame()) == JFileChooser.APPROVE_OPTION)
    11
    if (fc.showSaveDialog(frameMediator.getContainer().getFrame()) == JFileChooser.APPROVE_OPTION)
    11
    if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    Differences
    Expression1Expression2Difference
    javax.swing.JFrameorg.columba.core.gui.profiles.ProfileManagerDialogSUBCLASS_TYPE_MISMATCH
    frameMediator.getContainer().getFrame()thisTYPE_COMPATIBLE_REPLACEMENT
    showSaveDialogshowOpenDialogMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression fc.showSaveDialog(frameMediator.getContainer().getFrame()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression fc.showOpenDialog(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11
    if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    12
    File destFile = fc.getSelectedFile();
    12
    File destFile = fc.getSelectedFile();
    12
    File location = fc.getSelectedFile();
    Differences
    Expression1Expression2Difference
    destFilelocationVARIABLE_NAME_MISMATCH
    12
    File location = fc.getSelectedFile();
                                                                                                                  
    13
    Profile p = new Profile(location.getName(), location);
    Preondition Violations
    Unmatched statement Profile p=new Profile(location.getName(),location); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13
    Profile p = new Profile(location.getName(), location);
    13
    ICalendarStore store = CalendarStoreFactory.getInstance().getLocaleStore();
                                                                                                                                                              
                                                                                                  
    14
    ProfileManager.getInstance().addProfile(p);
    14
    Command command = new ExportCalendarCommand(new CalendarCommandReference(store, calendar), destFile);
    14
    Command command = new ExportCalendarCommand(new CalendarCommandReference(store, calendar), destFile);
    Preondition Violations
    Unmatched statement Command command=new ExportCalendarCommand(new CalendarCommandReference(store,calendar),destFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                              
                                                                        
    15
    model.addElement(p.getName());
    Preondition Violations
    Unmatched statement model.addElement(p.getName()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    15
    model.addElement(p.getName());
    15
    CommandProcessor.getInstance().addOp(command);
                                                                                                        
                                                                                            
    16
    list.setSelectedValue(p.getName(), true);
    Precondition Violations (5)
    Row Violation
    1Expression fc.showSaveDialog(frameMediator.getContainer().getFrame()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression fc.showOpenDialog(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement Profile p=new Profile(location.getName(),location); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement Command command=new ExportCalendarCommand(new CalendarCommandReference(store,calendar),destFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement model.addElement(p.getName()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted