File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/message/command/OpenAttachmentCommand.java | File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/message/command/SaveAttachmentAsCommand.java | |||
Method name: File getDestinationFile(MimeHeader)
|
Method name: File getDestinationFile(MimeHeader)
|
|||
Number of AST nodes: 22 | Number of AST nodes: 22 | |||
1 | cFileChooser fileChooser;↵ | 1 | cFileChooser fileChooser;↵ | |
2 | if (lastDir == null) {↵ | 2 | if (lastDir == null) {↵ | |
3 | fileChooser = new cFileChooser();↵ | 3 | fileChooser = new cFileChooser();↵ | |
4 | } else {↵ | 4 | } else {↵ | |
5 | fileChooser = new cFileChooser(lastDir);↵ | 5 | fileChooser = new cFileChooser(lastDir);↵ | |
6 | }↵ | |||
7 | ↵ | 6 | }↵ | |
8 | cFileFilter fileFilter = new cFileFilter();↵ | 7 | cFileFilter fileFilter = new cFileFilter();↵ | |
9 | fileFilter.acceptFilesWithProperty(cFileFilter.FILEPROPERTY_FILE);↵ | 8 | fileFilter.acceptFilesWithProperty(cFileFilter.FILEPROPERTY_FILE);↵ | |
10 | fileChooser.setDialogTitle("Save Attachment as ...");↵ | 9 | fileChooser.setDialogTitle("Save Attachment as ...");↵ | |
11 | String fileName = getFilename(header);↵ | 10 | String fileName = getFilename(header);↵ | |
12 | if (fileName != null) {↵ | 11 | if (fileName != null) {↵ | |
13 | fileChooser.forceSelectedFile(new File(fileName));↵ | 12 | fileChooser.forceSelectedFile(new File(fileName));↵ | |
14 | }↵ | |||
15 | ↵ | 13 | }↵ | |
16 | fileChooser.setSelectFilter(fileFilter);↵ | 14 | fileChooser.setSelectFilter(fileFilter);↵ | |
17 | File tempFile = null;↵ | 15 | File tempFile = null;↵ | |
18 | while (true) {↵ | 16 | while (true) {↵ | |
19 | if (fileChooser.showSaveDialog(null) != JFileChooser.APPROVE_OPTION) {↵ | 17 | if (fileChooser.showSaveDialog(null) != JFileChooser.APPROVE_OPTION) {↵ | |
20 | return null;↵ | |||
21 | }↵ | |||
22 | ↵ | 18 | return null;↵ | |
19 | }↵ | |||
23 | tempFile = fileChooser.getSelectedFile();↵ | 20 | tempFile = fileChooser.getSelectedFile();↵ | |
24 | lastDir = tempFile.getParentFile();↵ | 21 | lastDir = tempFile.getParentFile();↵ | |
25 | if (tempFile.exists()) {↵ | 22 | if (tempFile.exists()) {↵ | |
26 | if (JOptionPane.showConfirmDialog(FrameManager.getInstance()↵ | 23 | if (JOptionPane.showConfirmDialog(FrameManager.getInstance()↵ | |
27 | .getActiveFrame(), "Overwrite File?",↵ | 24 | .getActiveFrame(), "Overwrite File?",↵ | |
28 | "Warning", JOptionPane.YES_NO_OPTION,↵ | 25 | "Warning", JOptionPane.YES_NO_OPTION,↵ | |
29 | JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {↵ | 26 | JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {↵ | |
30 | break;↵ | |||
31 | }↵ | |||
32 | } else {↵ | |||
33 | break;↵ | |||
34 | }↵ | |||
35 | }↵ | |||
36 | ↵ | 27 | break;↵ | |
28 | }↵ | |||
29 | } else {↵ | |||
30 | break;↵ | |||
31 | }↵ | |||
32 | }↵ | |||
37 | return tempFile; | 33 | return tempFile; | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.9 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 57 |
Number of mapped statements | 22 |
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) | 11.3 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | cFileChooser fileChooser; | 1 | cFileChooser fileChooser; | |
2 | if (lastDir == null) | 2 | if (lastDir == null) | |
3 | fileChooser = new cFileChooser(); | 3 | fileChooser = new cFileChooser(); | |
else | else | |||
4 | fileChooser = new cFileChooser(lastDir); | 4 | fileChooser = new cFileChooser(lastDir); | |
5 | cFileFilter fileFilter = new cFileFilter(); | 5 | cFileFilter fileFilter = new cFileFilter(); | |
6 | fileFilter.acceptFilesWithProperty(cFileFilter.FILEPROPERTY_FILE); | 6 | fileFilter.acceptFilesWithProperty(cFileFilter.FILEPROPERTY_FILE); | |
7 | fileChooser.setDialogTitle("Save Attachment as ..."); | 7 | fileChooser.setDialogTitle("Save Attachment as ..."); | |
8 | String fileName = getFilename(header); | 8 | String fileName = getFilename(header); | |
9 | if (fileName != null) | 9 | if (fileName != null) | |
10 | fileChooser.forceSelectedFile(new File(fileName)); | 10 | fileChooser.forceSelectedFile(new File(fileName)); | |
11 | fileChooser.setSelectFilter(fileFilter); | 11 | fileChooser.setSelectFilter(fileFilter); | |
12 | File tempFile = null; | 12 | File tempFile = null; | |
13 | while (true) | 13 | while (true) | |
14 | if (fileChooser.showSaveDialog(null) != JFileChooser.APPROVE_OPTION) | 14 | if (fileChooser.showSaveDialog(null) != JFileChooser.APPROVE_OPTION) | |
15 | return null; | 15 | return null; | |
16 | tempFile = fileChooser.getSelectedFile(); | 16 | tempFile = fileChooser.getSelectedFile(); | |
17 | lastDir = tempFile.getParentFile(); | 17 | lastDir = tempFile.getParentFile(); | |
18 | if (tempFile.exists()) | 18 | if (tempFile.exists()) | |
19 | if (JOptionPane.showConfirmDialog(FrameManager.getInstance().getActiveFrame(), "Overwrite File?", "Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) | 19 | if (JOptionPane.showConfirmDialog(FrameManager.getInstance().getActiveFrame(), "Overwrite File?", "Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) | |
20 | break; | 20 | break; | |
else | else | |||
21 | break; | 21 | break; | |
22 | return tempFile; | 22 | return tempFile; |
Row | Violation |
---|