File path: /sql12/plugins/derby/src/net/sourceforge/squirrel_sql/plugins/derby/types/DerbyClobDataTypeComponent.java | File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeBlob.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) DerbyClobDataTypeComponent.this._textComponent;↵ | 5 | JTextComponent _theComponent = (JTextComponent)DataTypeBlob.this._textComponent;↵ | |
6 | String text = _theComponent.getText();↵ | 6 | String text = _theComponent.getText();↵ | |
7 | ↵ | |||
8 | // handle cases of null↵ | 7 | // handle cases of null↵ | |
9 | // The processing is different when nulls are allowed and when they are↵ | 8 | // The processing is different when nulls are allowed and when they are↵ | |
10 | // not.↵ | |||
11 | //↵ | |||
12 | if (DerbyClobDataTypeComponent↵ | 9 | not.↵ | |
10 | //↵ | |||
13 | .this._isNullable) {↵ | 11 | if ( DataTypeBlob.this._isNullable) {↵ | |
14 | // user enters something when field is null↵ | 12 | // user enters something when field is null↵ | |
15 | if (text.equals("<null>")) {↵ | 13 | if (text.equals("<null>")) {↵ | |
16 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | 14 | if ((c==KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | |
17 | // delete when null => original value↵ | 15 | // delete when null => original value↵ | |
18 | DerbyClobDataTypeComponent.this._textComponent.restoreText();↵ | |||
19 | e.consume();↵ | |||
20 | } else {↵ | |||
21 | ↵ | 16 | DataTypeBlob.this._textComponent.restoreText();↵ | |
17 | e.consume();↵ | |||
18 | }↵ | |||
19 | else {↵ | |||
22 | // non-delete when null => clear field and add text↵ | 20 | // non-delete when null => clear field and add text↵ | |
23 | DerbyClobDataTypeComponent.this._textComponent.updateText("");↵ | 21 | DataTypeBlob.this._textComponent.updateText("");↵ | |
24 | // fall through to normal processing of this key stroke↵ | 22 | // fall through to normal processing of this key stroke↵ | |
25 | }↵ | |||
26 | } else {↵ | |||
27 | ↵ | 23 | }↵ | |
24 | }↵ | |||
25 | else {↵ | |||
28 | // check for user deletes last thing in field↵ | 26 | // check for user deletes last thing in field↵ | |
29 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | 27 | if ((c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)) {↵ | |
30 | if (text.length() <= 1) {↵ | 28 | if (text.length() <= 1 ) {↵ | |
31 | // about to delete last thing in field, so replace with↵ | 29 | // about to delete last thing in field, so replace with↵ | |
32 | // null↵ | |||
33 | DerbyClobDataTypeComponent.this._textComponent.updateText("<null>");↵ | |||
34 | e.consume();↵ | |||
35 | }↵ | |||
36 | }↵ | |||
37 | }↵ | |||
38 | } else {↵ | |||
30 | null↵ | |||
31 | DataTypeBlob.this._textComponent.updateText("<null>");↵ | |||
32 | e.consume();↵ | |||
33 | }↵ | |||
34 | }↵ | |||
35 | }↵ | |||
36 | }↵ | |||
37 | else {↵ | |||
39 | // field is not nullable↵ | 38 | // field is not nullable↵ | |
40 | //↵ | 39 | ↵ | |
40 | //↵ | |||
41 | handleNotNullableField(text, c, e, _textComponent);↵ | 41 | handleNotNullableField(text, c, e, _textComponent);↵ | |
42 | } | 42 | } | |
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) | 1.8 |
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.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | char c = e.getKeyChar(); | 1 | char c = e.getKeyChar(); | ||||||||||||
2 | JTextComponent _theComponent = (JTextComponent)DerbyClobDataTypeComponent.this._textComponent; |
| 2 | JTextComponent _theComponent = (JTextComponent)DataTypeBlob.this._textComponent; | |||||||||||
3 | String text = _theComponent.getText(); | 3 | String text = _theComponent.getText(); | ||||||||||||
4 | if (DerbyClobDataTypeComponent.this._isNullable) |
| 4 | if (DataTypeBlob.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 | DerbyClobDataTypeComponent.this._textComponent.restoreText(); |
| 7 | DataTypeBlob.this._textComponent.restoreText(); | |||||||||||
8 | e.consume(); | 8 | e.consume(); | ||||||||||||
else | else | ||||||||||||||
9 | DerbyClobDataTypeComponent.this._textComponent.updateText(""); |
| 9 | DataTypeBlob.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 | DerbyClobDataTypeComponent.this._textComponent.updateText("<null>"); |
| 12 | DataTypeBlob.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 DerbyClobDataTypeComponent cannot be unified with expression DataTypeBlob , 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 DerbyClobDataTypeComponent cannot be unified with expression DataTypeBlob , because common superclass net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent does not declare member(s) private boolean _isNullable |
3 | Expression DerbyClobDataTypeComponent cannot be unified with expression DataTypeBlob , 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 DerbyClobDataTypeComponent cannot be unified with expression DataTypeBlob , 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 DerbyClobDataTypeComponent cannot be unified with expression DataTypeBlob , 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 |