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