addWidgetListener(new WidgetAdapter() { public void widgetClosing(WidgetEvent e) { SGATraceInternalFrame.super.internalFrameClosing(_toolBar.isStayOnTop(), _sgaTracePanel.getAutoRefreshPeriod()); _sgaTracePanel.setAutoRefresh(false); } }); Icon icon = _resources.getIcon(getClass(), "frameIcon"); //i18n if (icon != null) { setFrameIcon(icon); } OracleInternalFrameCallback cb = new OracleInternalFrameCallback() { public void createPanelAndToolBar(boolean stayOnTop, int autoRefeshPeriod) { _sgaTracePanel = new SGATracePanel(getSession(), autoRefeshPeriod); _toolBar = new SGATraceToolBar(getSession(), stayOnTop, autoRefeshPeriod); JPanel contentPanel = new JPanel(new BorderLayout()); contentPanel.add(_toolBar, BorderLayout.NORTH); contentPanel.add(_sgaTracePanel, BorderLayout.CENTER); setContentPane(contentPanel); } }; initFromPrefs(PREF_PART_SGA_FRAME, cb);
addWidgetListener(new WidgetAdapter() { public void widgetClosing(WidgetEvent e) { onWidgetClosing(); } }); Icon icon = _resources.getIcon(getClass(), "frameIcon"); //i18n if (icon != null) { setFrameIcon(icon); } OracleInternalFrameCallback cb = new OracleInternalFrameCallback() { public void createPanelAndToolBar(boolean stayOnTop, int autoRefeshPeriod) { _dbOutputPanel = new DBOutputPanel(getSession(), autoRefeshPeriod); _toolBar = new DBOutputToolBar(getSession(), stayOnTop, autoRefeshPeriod); JPanel contentPanel = new JPanel(new BorderLayout()); contentPanel.add(_toolBar, BorderLayout.NORTH); contentPanel.add(_dbOutputPanel, BorderLayout.CENTER); setContentPane(contentPanel); _dbOutputPanel.setAutoRefreshPeriod(autoRefeshPeriod); } }; initFromPrefs(PREF_PART_DB_OUTPUT_FRAME, cb);
Clone fragments detected by clone detection tool
File path: /sql12/plugins/oracle/src/net/sourceforge/squirrel_sql/plugins/oracle/SGAtrace/SGATraceInternalFrame.java File path: /sql12/plugins/oracle/src/net/sourceforge/squirrel_sql/plugins/oracle/dboutput/DBOutputInternalFrame.java
Method name: void createGUI() Method name: void createGUI(ISession)
Number of AST nodes: 6 Number of AST nodes: 6
1
addWidgetListener(new WidgetAdapter()
1
addWidgetListener(new WidgetAdapter()
2
      {
2
      {
3
         public void widgetClosing(WidgetEvent e)
3
         public void widgetClosing(WidgetEvent e)
4
         {
4
         {
5
            SGATraceInternalFrame.super.internalFrameClosing(_toolBar.isStayOnTop(), _sgaTracePanel.getAutoRefreshPeriod());
5
            
6
            _sgaTracePanel.setAutoRefresh(false);
6
onWidgetClosing();
7
         }
7
         }
8
      });
8
      });
9
      Icon icon = _resources.getIcon(getClass(), "frameIcon"); //i18n
9
      Icon icon = _resources.getIcon(getClass(), "frameIcon"); //i18n
10
      if (icon != null)
10
      if (icon != null)
11
      {
11
      {
12
         setFrameIcon(icon);
12
         setFrameIcon(icon);
13
      }
13
      }
14
      OracleInternalFrameCallback cb = new OracleInternalFrameCallback()
14
      OracleInternalFrameCallback cb = new OracleInternalFrameCallback()
15
      {
15
      {
16
         public void createPanelAndToolBar(boolean stayOnTop, int autoRefeshPeriod)
16
         public void createPanelAndToolBar(boolean stayOnTop, int autoRefeshPeriod)
17
         {
17
         {
18
            _sgaTracePanel = new SGATracePanel(getSession(), autoRefeshPeriod);
18
            _dbOutputPanel = new DBOutputPanel(getSession(), autoRefeshPeriod);
19
            _toolBar = new SGATraceToolBar(getSession(), stayOnTop, autoRefeshPeriod);
19
            _toolBar = new DBOutputToolBar(getSession(), stayOnTop, autoRefeshPeriod);
20
            JPanel contentPanel = new JPanel(new BorderLayout());
20
            JPanel contentPanel = new JPanel(new BorderLayout());
21
            contentPanel.add(_toolBar, BorderLayout.NORTH);
21
            contentPanel.add(_toolBar, BorderLayout.NORTH);
22
            contentPanel.add(_sgaTracePanel, BorderLayout.CENTER);
22
            contentPanel.add(_dbOutputPanel, BorderLayout.CENTER);
23
            setContentPane(contentPanel);
23
            setContentPane(contentPanel);
24
            _dbOutputPanel.setAutoRefreshPeriod(autoRefeshPeriod);
24
         }
25
         }
25
      };
26
      };
26
      initFromPrefs(PREF_PART_SGA_FRAME, cb);
27
      initFromPrefs(PREF_PART_DB_OUTPUT_FRAME, cb);
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 comparisons20
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)88.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                                                                                                  
    1
    addWidgetListener(new WidgetAdapter() {...});
    Preondition Violations
    Unmatched statement addWidgetListener(new WidgetAdapter(){ public void widgetClosing( WidgetEvent e){ onWidgetClosing(); } } ); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    1
    addWidgetListener(new WidgetAdapter() {...});
    1
    addWidgetListener(new WidgetAdapter() {...});
    1
    addWidgetListener(new WidgetAdapter() {...});
    Preondition Violations
    Unmatched statement addWidgetListener(new WidgetAdapter(){ public void widgetClosing( WidgetEvent e){ SGATraceInternalFrame.super.internalFrameClosing(_toolBar.isStayOnTop(),_sgaTracePanel.getAutoRefreshPeriod()); _sgaTracePanel.setAutoRefresh(false); } } ); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    2
    Icon icon = _resources.getIcon(getClass(), "frameIcon");
    2
    Icon icon = _resources.getIcon(getClass(), "frameIcon");
    3
    if (icon != null)
    3
    if (icon != null)
    4
    setFrameIcon(icon);
    4
    setFrameIcon(icon);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
    5
    OracleInternalFrameCallback cb = new OracleInternalFrameCallback() {...};
    Preondition Violations
    Unmatched statement OracleInternalFrameCallback cb=new OracleInternalFrameCallback(){ public void createPanelAndToolBar( boolean stayOnTop, int autoRefeshPeriod){ _dbOutputPanel=new DBOutputPanel(getSession(),autoRefeshPeriod); _toolBar=new DBOutputToolBar(getSession(),stayOnTop,autoRefeshPeriod); JPanel contentPanel=new JPanel(new BorderLayout()); contentPanel.add(_toolBar,BorderLayout.NORTH); contentPanel.add(_dbOutputPanel,BorderLayout.CENTER); setContentPane(contentPanel); _dbOutputPanel.setAutoRefreshPeriod(autoRefeshPeriod); } } ; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    OracleInternalFrameCallback cb = new OracleInternalFrameCallback() {...};
    5
    OracleInternalFrameCallback cb = new OracleInternalFrameCallback() {...};
    5
    OracleInternalFrameCallback cb = new OracleInternalFrameCallback() {...};
    Preondition Violations
    Unmatched statement OracleInternalFrameCallback cb=new OracleInternalFrameCallback(){ public void createPanelAndToolBar( boolean stayOnTop, int autoRefeshPeriod){ _sgaTracePanel=new SGATracePanel(getSession(),autoRefeshPeriod); _toolBar=new SGATraceToolBar(getSession(),stayOnTop,autoRefeshPeriod); JPanel contentPanel=new JPanel(new BorderLayout()); contentPanel.add(_toolBar,BorderLayout.NORTH); contentPanel.add(_sgaTracePanel,BorderLayout.CENTER); setContentPane(contentPanel); } } ; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    6
    initFromPrefs(PREF_PART_SGA_FRAME, cb);
    6
    initFromPrefs(PREF_PART_SGA_FRAME, cb);
    6
    initFromPrefs(PREF_PART_DB_OUTPUT_FRAME, cb);
    Differences
    Expression1Expression2Difference
    PREF_PART_SGA_FRAMEPREF_PART_DB_OUTPUT_FRAMEVARIABLE_NAME_MISMATCH
    6
    initFromPrefs(PREF_PART_DB_OUTPUT_FRAME, cb);
    Precondition Violations (4)
    Row Violation
    1Unmatched statement addWidgetListener(new WidgetAdapter(){ public void widgetClosing( WidgetEvent e){ onWidgetClosing(); } } ); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement addWidgetListener(new WidgetAdapter(){ public void widgetClosing( WidgetEvent e){ SGATraceInternalFrame.super.internalFrameClosing(_toolBar.isStayOnTop(),_sgaTracePanel.getAutoRefreshPeriod()); _sgaTracePanel.setAutoRefresh(false); } } ); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement OracleInternalFrameCallback cb=new OracleInternalFrameCallback(){ public void createPanelAndToolBar( boolean stayOnTop, int autoRefeshPeriod){ _dbOutputPanel=new DBOutputPanel(getSession(),autoRefeshPeriod); _toolBar=new DBOutputToolBar(getSession(),stayOnTop,autoRefeshPeriod); JPanel contentPanel=new JPanel(new BorderLayout()); contentPanel.add(_toolBar,BorderLayout.NORTH); contentPanel.add(_dbOutputPanel,BorderLayout.CENTER); setContentPane(contentPanel); _dbOutputPanel.setAutoRefreshPeriod(autoRefeshPeriod); } } ; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement OracleInternalFrameCallback cb=new OracleInternalFrameCallback(){ public void createPanelAndToolBar( boolean stayOnTop, int autoRefeshPeriod){ _sgaTracePanel=new SGATracePanel(getSession(),autoRefeshPeriod); _toolBar=new SGATraceToolBar(getSession(),stayOnTop,autoRefeshPeriod); JPanel contentPanel=new JPanel(new BorderLayout()); contentPanel.add(_toolBar,BorderLayout.NORTH); contentPanel.add(_sgaTracePanel,BorderLayout.CENTER); setContentPane(contentPanel); } } ; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted