SessionInternalFrame sif = (SessionInternalFrame) frame; if(sif.getSessionPanel().isSQLTabSelected()) { ((ISQLPanelAction)act).setSQLPanel(sif.getSessionPanel().getSQLPaneAPI()); } else { ((ISQLPanelAction)act).setSQLPanel(null); }
SessionInternalFrame sif = (SessionInternalFrame) frame; if(sif.getSessionPanel().isObjectTreeTabSelected()) { ((IObjectTreeAction)act).setObjectTree(((SessionInternalFrame)frame).getSessionPanel().getObjectTreePanel()); } else { ((IObjectTreeAction)act).setObjectTree(null); }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/action/ActionCollection.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/action/ActionCollection.java
Method name: void activationChanged(IWidget) Method name: void activationChanged(IWidget)
Number of AST nodes: 4 Number of AST nodes: 4
1
SessionInternalFrame sif = (SessionInternalFrame) frame;
1
SessionInternalFrame sif = (SessionInternalFrame) frame;
2
            if(sif.getSessionPanel().isSQLTabSelected())
2
            if(sif.getSessionPanel().isObjectTreeTabSelected())
3
            {
3
            {
4
   				((ISQLPanelAction)act).setSQLPanel(sif.getSessionPanel().getSQLPaneAPI());
4
               ((IObjectTreeAction)act).setObjectTree(((SessionInternalFrame)frame).getSessionPanel().getObjectTreePanel());
5
            }
5
            }
6
            else
6
            else
7
            {
7
            {
8
               ((ISQLPanelAction)act).setSQLPanel(null);
8
               ((IObjectTreeAction)act).setObjectTree(null);
9
            }
9
            }
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.3
Clones locationClones are in the same method
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)18.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    16
    SessionInternalFrame sif = (SessionInternalFrame)frame;
    21
    SessionInternalFrame sif = (SessionInternalFrame)frame;
    17
    if (sif.getSessionPanel().isSQLTabSelected())
    17
    if (sif.getSessionPanel().isSQLTabSelected())
    22
    if (sif.getSessionPanel().isObjectTreeTabSelected())
    Differences
    Expression1Expression2Difference
    isSQLTabSelectedisObjectTreeTabSelectedMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression sif.getSessionPanel().isSQLTabSelected() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression sif.getSessionPanel().isObjectTreeTabSelected() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22
    if (sif.getSessionPanel().isObjectTreeTabSelected())
    18
    ((ISQLPanelAction)act).setSQLPanel(sif.getSessionPanel().getSQLPaneAPI());
    18
    ((ISQLPanelAction)act).setSQLPanel(sif.getSessionPanel().getSQLPaneAPI());
    Preondition Violations
    Unmatched statement ((ISQLPanelAction)act).setSQLPanel(sif.getSessionPanel().getSQLPaneAPI()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                
                                                                                                                                                                                                                                      
    23
    ((IObjectTreeAction)act).setObjectTree(((SessionInternalFrame)frame).getSessionPanel().getObjectTreePanel());
    else
    else
    19
    ((ISQLPanelAction)act).setSQLPanel(null);
    19
    ((ISQLPanelAction)act).setSQLPanel(null);
    24
    ((IObjectTreeAction)act).setObjectTree(null);
    Differences
    Expression1Expression2Difference
    setSQLPanelsetObjectTreeMETHOD_INVOCATION_NAME_MISMATCH
    net.sourceforge.squirrel_sql.client.session.action.ISQLPanelActionnet.sourceforge.squirrel_sql.client.session.action.IObjectTreeActionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ((ISQLPanelAction)act).setSQLPanel(null) is a void method call, and thus it cannot be parameterized
    Expression ((IObjectTreeAction)act).setObjectTree(null) is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction does not match with type net.sourceforge.squirrel_sql.client.session.action.IObjectTreeAction
    • Make classes net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction and net.sourceforge.squirrel_sql.client.session.action.IObjectTreeAction extend a common superclass
    24
    ((IObjectTreeAction)act).setObjectTree(null);
    Precondition Violations (6)
    Row Violation
    1Expression sif.getSessionPanel().isSQLTabSelected() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression sif.getSessionPanel().isObjectTreeTabSelected() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement ((ISQLPanelAction)act).setSQLPanel(sif.getSessionPanel().getSQLPaneAPI()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression ((ISQLPanelAction)act).setSQLPanel(null) is a void method call, and thus it cannot be parameterized
    5Expression ((IObjectTreeAction)act).setObjectTree(null) is a void method call, and thus it cannot be parameterized
    6Type net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction does not match with type net.sourceforge.squirrel_sql.client.session.action.IObjectTreeAction