File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeClob.java | File path: /sql12/plugins/derby/src/net/sourceforge/squirrel_sql/plugins/derby/types/DerbyClobDataTypeComponent.java | |||
Method name: void keyTyped(KeyEvent)
|
Method name: void keyTyped(KeyEvent)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | char c = e.getKeyChar();↵ | 1 | char c = e.getKeyChar();↵ | |
2 | // as a coding convenience, create a reference to the text component↵ | 2 | // as a coding convenience, create a reference to the text component↵ | |
3 | // that is typecast to JTextComponent. this is not essential, as we↵ | 3 | // that is typecast to JTextComponent. this is not essential, as we↵ | |
4 | // could typecast every reference, but this makes the code cleaner↵ | 4 | // could typecast every reference, but this makes the code cleaner↵ | |
5 | JTextComponent _theComponent = (JTextComponent)DataTypeClob.this._textComponent;↵ | 5 | JTextComponent _theComponent = (JTextComponent) DerbyClobDataTypeComponent.this._textComponent;↵ | |
6 | String text = _theComponent.getText();↵ | 6 | String text = _theComponent.getText();↵ | |
7 | // handle cases of null↵ | 7 | // handle cases of null↵ | |
8 | // The processing is different when nulls are allowed and when they are not.↵ | 8 | // The processing is different when nulls are allowed and when they are↵ | |
9 | //↵ | |||
10 | if ( ↵ | |||
9 | // not.↵ | |||
10 | //↵ | |||
11 | DataTypeClob.this._isNullable) {↵ | 11 | if (DerbyClobDataTypeComponent.this._isNullable) {↵ | |
12 | // user enters something when field is null↵ | 12 | // user enters something when field is null↵ | |
13 | if (text.equals("<null>")) {↵ | 13 | if (text.equals("<null>")) {↵ | |
14 | if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | 14 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | |
15 | // delete when null => original value↵ | 15 | // delete when null => original value↵ | |
16 | DataTypeClob.this._textComponent.restoreText();↵ | 16 | DerbyClobDataTypeComponent.this._textComponent.restoreText();↵ | |
17 | e.consume();↵ | |||
18 | }↵ | |||
19 | else {↵ | |||
20 | ↵ | 17 | e.consume();↵ | |
18 | } else {↵ | |||
21 | // non-delete when null => clear field and add text↵ | 19 | // non-delete when null => clear field and add text↵ | |
22 | DataTypeClob.this._textComponent.updateText("");↵ | 20 | DerbyClobDataTypeComponent.this._textComponent.updateText("");↵ | |
23 | // fall through to normal processing of this key stroke↵ | 21 | // fall through to normal processing of this key stroke↵ | |
24 | }↵ | |||
25 | }↵ | |||
26 | else {↵ | |||
27 | ↵ | 22 | }↵ | |
23 | } else {↵ | |||
28 | // check for user deletes last thing in field↵ | 24 | // check for user deletes last thing in field↵ | |
29 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | 25 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | |
30 | if (text.length() <= 1 ) {↵ | 26 | if (text.length() <= 1) {↵ | |
31 | // about to delete last thing in field, so replace with null↵ | 27 | // about to delete last thing in field, so replace with↵ | |
32 | ↵ | |||
28 | // null↵ | |||
33 | DataTypeClob.this._textComponent.updateText("<null>");↵ | 29 | DerbyClobDataTypeComponent.this._textComponent.updateText("<null>");↵ | |
34 | e.consume();↵ | |||
35 | }↵ | |||
36 | }↵ | |||
37 | }↵ | |||
38 | }↵ | |||
39 | else {↵ | |||
40 | ↵ | 30 | e.consume();↵ | |
31 | }↵ | |||
32 | }↵ | |||
33 | }↵ | |||
34 | } else {↵ | |||
41 | // field is not nullable↵ | 35 | // field is not nullable↵ | |
42 | //↵ | 36 | ↵ | |
43 | ↵ | 37 | //↵ | |
44 | handleNotNullableField(text, c, e, _textComponent);↵ | 38 | handleNotNullableField(text, c, e, _textComponent);↵ | |
45 | } | 39 | } | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 2.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 42 |
Number of mapped statements | 14 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 12.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | char c = e.getKeyChar(); | 1 | char c = e.getKeyChar(); | ||||||||||||
2 | JTextComponent _theComponent = (JTextComponent)DataTypeClob.this._textComponent; |
| 2 | JTextComponent _theComponent = (JTextComponent)DerbyClobDataTypeComponent.this._textComponent; | |||||||||||
3 | String text = _theComponent.getText(); | 3 | String text = _theComponent.getText(); | ||||||||||||
4 | if (DataTypeClob.this._isNullable) |
| 4 | if (DerbyClobDataTypeComponent.this._isNullable) | |||||||||||
5 | if (text.equals("<null>")) | 5 | if (text.equals("<null>")) | ||||||||||||
6 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) | 6 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) | ||||||||||||
7 | DataTypeClob.this._textComponent.restoreText(); |
| 7 | DerbyClobDataTypeComponent.this._textComponent.restoreText(); | |||||||||||
8 | e.consume(); | 8 | e.consume(); | ||||||||||||
else | else | ||||||||||||||
9 | DataTypeClob.this._textComponent.updateText(""); |
| 9 | DerbyClobDataTypeComponent.this._textComponent.updateText(""); | |||||||||||
else | else | ||||||||||||||
10 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) | 10 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) | ||||||||||||
11 | if (text.length() <= 1) | 11 | if (text.length() <= 1) | ||||||||||||
12 | DataTypeClob.this._textComponent.updateText("<null>"); |
| 12 | DerbyClobDataTypeComponent.this._textComponent.updateText("<null>"); | |||||||||||
13 | e.consume(); | 13 | e.consume(); | ||||||||||||
else | else | ||||||||||||||
14 | handleNotNullableField(text, c, e, _textComponent); | 14 | handleNotNullableField(text, c, e, _textComponent); |
Row | Violation |
---|---|
1 | Expression DataTypeClob cannot be unified with expression DerbyClobDataTypeComponent , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IRestorableTextComponent _textComponent |
2 | Expression DataTypeClob cannot be unified with expression DerbyClobDataTypeComponent , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private boolean _isNullable |
3 | Expression DataTypeClob cannot be unified with expression DerbyClobDataTypeComponent , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IRestorableTextComponent _textComponent |
4 | Expression DataTypeClob cannot be unified with expression DerbyClobDataTypeComponent , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IRestorableTextComponent _textComponent |
5 | Expression DataTypeClob cannot be unified with expression DerbyClobDataTypeComponent , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IRestorableTextComponent _textComponent |