File path: /emf-2.4.1/src/org/eclipse/emf/ecore/presentation/EcoreModelWizard.java | File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/presentation/Ecore2XMLModelWizard.java | |||
Method name: void addPages()
|
Method name: void addPages()
|
|||
Number of AST nodes: 16 | Number of AST nodes: 16 | |||
1 | addPage(newFileCreationPage);↵ | 1 | addPage(newFileCreationPage);↵ | |
2 | // Try and get the resource selection to determine a current directory for the file dialog.↵ | 2 | // Try and get the resource selection to determine a current directory for the file dialog.↵ | |
3 | //↵ | 3 | //↵ | |
4 | if (selection != null && !selection.isEmpty())↵ | 4 | if (selection != null && !selection.isEmpty())↵ | |
5 | {↵ | 5 | {↵ | |
6 | // Get the resource...↵ | 6 | // Get the resource...↵ | |
7 | //↵ | 7 | //↵ | |
8 | Object selectedElement = selection.iterator().next();↵ | 8 | Object selectedElement = selection.iterator().next();↵ | |
9 | if (selectedElement instanceof IResource)↵ | 9 | if (selectedElement instanceof IResource)↵ | |
10 | {↵ | 10 | {↵ | |
11 | // Get the resource parent, if its a file.↵ | 11 | // Get the resource parent, if its a file.↵ | |
12 | //↵ | 12 | //↵ | |
13 | IResource selectedResource = (IResource)selectedElement;↵ | 13 | IResource selectedResource = (IResource)selectedElement;↵ | |
14 | if (selectedResource.getType() == IResource.FILE)↵ | 14 | if (selectedResource.getType() == IResource.FILE)↵ | |
15 | {↵ | 15 | {↵ | |
16 | selectedResource = selectedResource.getParent();↵ | 16 | selectedResource = selectedResource.getParent();↵ | |
17 | }↵ | 17 | }↵ | |
18 | // This gives us a directory...↵ | 18 | // This gives us a directory...↵ | |
19 | //↵ | 19 | //↵ | |
20 | if (selectedResource instanceof IFolder || selectedResource instanceof IProject)↵ | 20 | if (selectedResource instanceof IFolder || selectedResource instanceof IProject)↵ | |
21 | {↵ | 21 | {↵ | |
22 | // Set this for the container.↵ | 22 | // Set this for the container.↵ | |
23 | //↵ | 23 | //↵ | |
24 | newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());↵ | 24 | newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());↵ | |
25 | // Make up a unique new name here.↵ | 25 | // Make up a unique new name here.↵ | |
26 | //↵ | 26 | //↵ | |
27 | String defaultModelBaseFilename = EcoreEditorPlugin.INSTANCE.getString("_UI_EcoreEditorFilenameDefaultBase");↵ | 27 | String defaultModelBaseFilename = Ecore2XMLUIPlugin.INSTANCE.getString("_UI_Ecore2XMLEditorFilenameDefaultBase"); //$NON-NLS-1$↵ | |
28 | String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);↵ | 28 | String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);↵ | |
29 | String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;↵ | 29 | String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; //$NON-NLS-1$↵ | |
30 | for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i)↵ | 30 | for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i)↵ | |
31 | {↵ | 31 | {↵ | |
32 | modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;↵ | 32 | modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; //$NON-NLS-1$↵ | |
33 | }↵ | 33 | }↵ | |
34 | newFileCreationPage.setFileName(modelFilename);↵ | 34 | newFileCreationPage.setFileName(modelFilename);↵ | |
35 | }↵ | 35 | }↵ | |
36 | }↵ | 36 | }↵ | |
37 | }↵ | 37 | }↵ | |
38 | initialObjectCreationPage = new EcoreModelWizardInitialObjectCreationPage("Whatever2"); | 38 | initialObjectCreationPage = new Ecore2XMLModelWizardInitialObjectCreationPage("Whatever2"); | |
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.8 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 54 |
Number of mapped statements | 16 |
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) | 3.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5 | addPage(newFileCreationPage); |
| 5 | addPage(newFileCreationPage); | |||||||||||||
6 | if (selection != null && !selection.isEmpty()) | 6 | if (selection != null && !selection.isEmpty()) | ||||||||||||||
7 | Object selectedElement = selection.iterator().next(); | 7 | Object selectedElement = selection.iterator().next(); | ||||||||||||||
8 | if (selectedElement instanceof IResource) | 8 | if (selectedElement instanceof IResource) | ||||||||||||||
9 | IResource selectedResource = (IResource)selectedElement; | 9 | IResource selectedResource = (IResource)selectedElement; | ||||||||||||||
10 | if (selectedResource.getType() == IResource.FILE) | 10 | if (selectedResource.getType() == IResource.FILE) | ||||||||||||||
11 | selectedResource = selectedResource.getParent(); | 11 | selectedResource = selectedResource.getParent(); | ||||||||||||||
12 | if (selectedResource instanceof IFolder || selectedResource instanceof IProject) | 12 | if (selectedResource instanceof IFolder || selectedResource instanceof IProject) | ||||||||||||||
13 | newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); |
| 13 | newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); | |||||||||||||
14 | String defaultModelBaseFilename = EcoreEditorPlugin.INSTANCE.getString("_UI_EcoreEditorFilenameDefaultBase"); |
| 14 | String defaultModelBaseFilename = Ecore2XMLUIPlugin.INSTANCE.getString("_UI_Ecore2XMLEditorFilenameDefaultBase"); | |||||||||||||
15 | String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); | 15 | String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); | ||||||||||||||
16 | String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; | 16 | String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; | ||||||||||||||
17 | for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) | 17 | for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) | ||||||||||||||
18 | modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; | 18 | modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; | ||||||||||||||
19 | newFileCreationPage.setFileName(modelFilename); |
| 19 | newFileCreationPage.setFileName(modelFilename); | |||||||||||||
20 | initialObjectCreationPage = new EcoreModelWizardInitialObjectCreationPage("Whatever2"); |
| 20 | initialObjectCreationPage = new Ecore2XMLModelWizardInitialObjectCreationPage("Whatever2"); |
Row | Violation |
---|