final SessionManager sessMgr = _app.getSessionManager(); final ISession sess = sessMgr.getActiveSession(); if (sess == null) { return; } ISessionWidget activeSessionWindow = sess.getActiveSessionWindow(); if(null == activeSessionWindow) { throw new IllegalStateException("Active Session with no active window ???"); } ISessionWidget nextSessionWindow = _sessionWindows.getNextSessionWindow(activeSessionWindow); if (false == activeSessionWindow.equals(nextSessionWindow)) { new SelectWidgetCommand(nextSessionWindow).execute(); }
final SessionManager sessMgr = _app.getSessionManager(); final ISession sess = sessMgr.getActiveSession(); if (sess == null) { return; } ISessionWidget activeSessionWindow = sess.getActiveSessionWindow(); if(null == activeSessionWindow) { throw new IllegalStateException("Active Session with no active window ???"); } ISessionWidget previousSessionWindow = _sessionWindows.getPreviousSessionWindow(activeSessionWindow); if (false == activeSessionWindow.equals(previousSessionWindow)) { new SelectWidgetCommand(previousSessionWindow).execute(); }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/WindowManager.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/WindowManager.java
Method name: void activateNextSessionWindow() Method name: void activatePreviousSessionWindow()
Number of AST nodes: 10 Number of AST nodes: 10
1
final SessionManager sessMgr = _app.getSessionManager();
1
final SessionManager sessMgr = _app.getSessionManager();
2
		final ISession sess = sessMgr.getActiveSession();
2
      final ISession sess = sessMgr.getActiveSession();
3
		if (sess == null)
3
      if (sess == null)
4
		{
4
      {
5
         return;
5
         return;
6
		}
6
      }
7
      ISessionWidget activeSessionWindow = sess.getActiveSessionWindow();
7
      ISessionWidget activeSessionWindow = sess.getActiveSessionWindow();
8
      if(null == activeSessionWindow)
8
      if(null == activeSessionWindow)
9
      {
9
      {
10
         throw new IllegalStateException("Active Session with no active window ???");
10
         throw new IllegalStateException("Active Session with no active window ???");
11
      }
11
      }
12
      ISessionWidget nextSessionWindow = _sessionWindows.getNextSessionWindow(activeSessionWindow);
12
      ISessionWidget previousSessionWindow = _sessionWindows.getPreviousSessionWindow(activeSessionWindow);
13
		if (false == activeSessionWindow.equals(nextSessionWindow))
13
      if (false == activeSessionWindow.equals(previousSessionWindow))
14
		{
15
			
14
      {
16
new SelectWidgetCommand(nextSessionWindow).execute();
15
         new SelectWidgetCommand(previousSessionWindow).execute();
17
		}
16
      }
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.9
Clones locationClones are declared in the same class
Number of node comparisons37
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    final SessionManager sessMgr = _app.getSessionManager();
    1
    final SessionManager sessMgr = _app.getSessionManager();
    2
    final ISession sess = sessMgr.getActiveSession();
    2
    final ISession sess = sessMgr.getActiveSession();
    3
    if (sess == null)
    3
    if (sess == null)
    4
    return;
    4
    return;
    5
    ISessionWidget activeSessionWindow = sess.getActiveSessionWindow();
    5
    ISessionWidget activeSessionWindow = sess.getActiveSessionWindow();
    6
    if (null == activeSessionWindow)
    6
    if (null == activeSessionWindow)
    7
    throw new IllegalStateException("Active Session with no active window ???");
    7
    throw new IllegalStateException("Active Session with no active window ???");
    8
    ISessionWidget nextSessionWindow = _sessionWindows.getNextSessionWindow(activeSessionWindow);
    8
    ISessionWidget nextSessionWindow = _sessionWindows.getNextSessionWindow(activeSessionWindow);
    8
    ISessionWidget previousSessionWindow = _sessionWindows.getPreviousSessionWindow(activeSessionWindow);
    Differences
    Expression1Expression2Difference
    nextSessionWindowpreviousSessionWindowVARIABLE_NAME_MISMATCH
    getNextSessionWindowgetPreviousSessionWindowMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression _sessionWindows.getNextSessionWindow(activeSessionWindow) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression _sessionWindows.getPreviousSessionWindow(activeSessionWindow) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    ISessionWidget previousSessionWindow = _sessionWindows.getPreviousSessionWindow(activeSessionWindow);
    9
    if (false == activeSessionWindow.equals(nextSessionWindow))
    9
    if (false == activeSessionWindow.equals(nextSessionWindow))
    9
    if (false == activeSessionWindow.equals(previousSessionWindow))
    Differences
    Expression1Expression2Difference
    nextSessionWindowpreviousSessionWindowVARIABLE_NAME_MISMATCH
    9
    if (false == activeSessionWindow.equals(previousSessionWindow))
    10
    new SelectWidgetCommand(nextSessionWindow).execute();
    10
    new SelectWidgetCommand(nextSessionWindow).execute();
    10
    new SelectWidgetCommand(previousSessionWindow).execute();
    Differences
    Expression1Expression2Difference
    nextSessionWindowpreviousSessionWindowVARIABLE_NAME_MISMATCH
    10
    new SelectWidgetCommand(previousSessionWindow).execute();
    Precondition Violations (2)
    Row Violation
    1Expression _sessionWindows.getNextSessionWindow(activeSessionWindow) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression _sessionWindows.getPreviousSessionWindow(activeSessionWindow) cannot be parameterized, because it has dependencies to/from statements that will be extracted