try { // Add context menu items to the object tree's session node. // as popup menu IObjectTreeAPI objectTreeApi = session.getSessionInternalFrame() .getObjectTreeAPI(); objectTreeApi.addToPopup(DatabaseObjectType.SESSION, getSmarttoolsMenu(getApplication(), session, true)); return new PluginSessionCallback() { public void sqlInternalFrameOpened( SQLInternalFrame sqlInternalFrame, ISession sess) { // plugin supports Session main window only } public void objectTreeInternalFrameOpened( ObjectTreeInternalFrame objectTreeInternalFrame, ISession sess) { // plugin supports Session main window only } }; } catch (Exception e) { throw new RuntimeException(e); }
try { // Add context menu items to the object tree's session node. // as popup menu IObjectTreeAPI objectTreeApi = session .getSessionInternalFrame().getObjectTreeAPI(); objectTreeApi.addToPopup(DatabaseObjectType.SESSION, getFirebirdManagerMenu(getApplication(), session, true)); return new PluginSessionCallback() { public void sqlInternalFrameOpened( SQLInternalFrame sqlInternalFrame, ISession sess) { // plugin supports Session main window only } public void objectTreeInternalFrameOpened( ObjectTreeInternalFrame objectTreeInternalFrame, ISession sess) { // plugin supports Session main window only } }; } catch (Exception e) { throw new RuntimeException(e); }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/smarttools/src/net/sourceforge/squirrel_sql/plugins/smarttools/SmarttoolsPlugin.java File path: /sql12/plugins/firebirdmanager/src/net/sourceforge/squirrel_sql/plugins/firebirdmanager/FirebirdManagerPlugin.java
Method name: PluginSessionCallback sessionStarted(ISession) Method name: PluginSessionCallback sessionStarted(ISession)
Number of AST nodes: 4 Number of AST nodes: 4
1
try {
1
try {
2
			// Add context menu items to the object tree's session node.
2
				// Add context menu items to the object tree's session node.
3
			// as popup menu
3
				// as popup menu
4
			IObjectTreeAPI objectTreeApi = session
4
				IObjectTreeAPI objectTreeApi = session
5
.getSessionInternalFrame()
5
						.getSessionInternalFrame()
6
					.getObjectTreeAPI();
6
.getObjectTreeAPI();
7
			objectTreeApi.addToPopup(DatabaseObjectType.SESSION,
7
				objectTreeApi.addToPopup(DatabaseObjectType.SESSION,
8
					getSmarttoolsMenu(getApplication(), session, true));
8
						getFirebirdManagerMenu(getApplication(), session, true));
9
			return new PluginSessionCallback() {
9
				return new PluginSessionCallback() {
10
				public void sqlInternalFrameOpened(
10
					public void sqlInternalFrameOpened(
11
						SQLInternalFrame sqlInternalFrame, ISession sess) {
11
							SQLInternalFrame sqlInternalFrame, ISession sess) {
12
					// plugin supports Session main window only
12
						// plugin supports Session main window only
13
				}
13
					}
14
				public void objectTreeInternalFrameOpened(
14
					public void objectTreeInternalFrameOpened(
15
						ObjectTreeInternalFrame objectTreeInternalFrame,
15
							ObjectTreeInternalFrame objectTreeInternalFrame,
16
						ISession sess) {
16
							ISession sess) {
17
					// plugin supports Session main window only
17
						// plugin supports Session main window only
18
				}
18
					}
19
			};
19
				};
20
		} catch (Exception e) {
20
			} catch (Exception e) {
21
			throw new RuntimeException(e);
21
				throw new RuntimeException(e);
22
		}
22
			}
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons16
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)11.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    2
    try
    2
    IObjectTreeAPI objectTreeApi = session.getSessionInternalFrame().getObjectTreeAPI();
    3
    IObjectTreeAPI objectTreeApi = session.getSessionInternalFrame().getObjectTreeAPI();
    3
    objectTreeApi.addToPopup(DatabaseObjectType.SESSION, getSmarttoolsMenu(getApplication(), session, true));
    3
    objectTreeApi.addToPopup(DatabaseObjectType.SESSION, getSmarttoolsMenu(getApplication(), session, true));
    4
    objectTreeApi.addToPopup(DatabaseObjectType.SESSION, getFirebirdManagerMenu(getApplication(), session, true));
    Differences
    Expression1Expression2Difference
    getSmarttoolsMenugetFirebirdManagerMenuMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression getSmarttoolsMenu(getApplication(),session,true) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    • Inline private method getSmarttoolsMenu
    Expression getFirebirdManagerMenu(getApplication(),session,true) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    • Inline private method getFirebirdManagerMenu
    4
    objectTreeApi.addToPopup(DatabaseObjectType.SESSION, getFirebirdManagerMenu(getApplication(), session, true));
    4
    return new PluginSessionCallback() {...};
    5
    return new PluginSessionCallback() {...};
    Precondition Violations (2)
    Row Violation
    1Expression getSmarttoolsMenu(getApplication(),session,true) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression getFirebirdManagerMenu(getApplication(),session,true) is a method call throwing exception(s) that should be caught by a try block that will be extracted