CloneSet208


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
44250.986statement_sequence[14]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
144125
plugins/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/nls/SourceFirstPackageSelectionDialogField.java
244449
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewContainerWizardPage.java
Clone Instance
1
Line Count
44
Source Line
125
Source File
plugins/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/nls/SourceFirstPackageSelectionDialogField.java

                Class[] acceptedClasses = new Class[] {
                                                        IPackageFragmentRoot.class ,IJavaProject.class
                                                      };
                TypedElementSelectionValidator validator = new TypedElementSelectionValidator(acceptedClasses, false) {
                         public boolean isSelectedValid(Object element) {
                                 try {
                                         if (element instanceof IJavaProject) {
                                                 IJavaProject jproject = (IJavaProject) element;
                                                 IPath path = jproject.getProject().getFullPath();
                                                 return (jproject.findPackageFragmentRoot(path) != null);
                                         }
                                         else   if (element instanceof IPackageFragmentRoot) {
                                                 return (((IPackageFragmentRoot) element).getKind() == IPackageFragmentRoot.K_SOURCE);
                                                }
                                         return true;
                                 } catch (JavaModelException e) {
                                         JavaPlugin.log(e.getStatus()); // just log, no ui in validation
                                   }
                                 return false;
                         }
                                                           };
                acceptedClasses = new Class[] {
                                                IJavaModel.class ,IPackageFragmentRoot.class ,IJavaProject.class
                                              };
                ViewerFilter filter = new TypedViewerFilter(acceptedClasses) {
                         public boolean select(Viewer viewer, Object parent, Object element) {
                                 if (element instanceof IPackageFragmentRoot) {
                                         try {
                                                 return (((IPackageFragmentRoot) element).getKind() == IPackageFragmentRoot.K_SOURCE);
                                         } catch (JavaModelException e) {
                                                 JavaPlugin.log(e.getStatus()); // just log, no ui in validation
                                                 return false;
                                           }
                                 }
                                 return super.select(viewer, parent, element);
                         }
                                      };
                StandardJavaElementContentProvider provider = new StandardJavaElementContentProvider();
                ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
                ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(fShell, labelProvider, provider);
                dialog.setValidator(validator);
                dialog.setSorter(new JavaElementSorter());
                dialog.setTitle(NLSUIMessages.SourceFirstPackageSelectionDialogField_ChooseSourceContainerDialog_title);
                dialog.setMessage(NLSUIMessages.SourceFirstPackageSelectionDialogField_ChooseSourceContainerDialog_description);
                dialog.addFilter(filter);
                dialog.setInput(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
                dialog.setInitialSelection(initElement);


Clone Instance
2
Line Count
44
Source Line
449
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewContainerWizardPage.java

                Class[] acceptedClasses = new Class[] {
                                                        IPackageFragmentRoot.class ,IJavaProject.class
                                                      };
                TypedElementSelectionValidator validator = new TypedElementSelectionValidator(acceptedClasses, false) {
                         public boolean isSelectedValid(Object element) {
                                 try {
                                         if (element instanceof IJavaProject) {
                                                 IJavaProject jproject = (IJavaProject) element;
                                                 IPath path = jproject.getProject().getFullPath();
                                                 return (jproject.findPackageFragmentRoot(path) != null);
                                         }
                                         else   if (element instanceof IPackageFragmentRoot) {
                                                 return (((IPackageFragmentRoot) element).getKind() == IPackageFragmentRoot.K_SOURCE);
                                                }
                                         return true;
                                 } catch (JavaModelException e) {
                                         JavaPlugin.log(e.getStatus()); // just log, no UI in validation
                                   }
                                 return false;
                         }
                                                           };
                acceptedClasses = new Class[] {
                                                IJavaModel.class ,IPackageFragmentRoot.class ,IJavaProject.class
                                              };
                ViewerFilter filter = new TypedViewerFilter(acceptedClasses) {
                         public boolean select(Viewer viewer, Object parent, Object element) {
                                 if (element instanceof IPackageFragmentRoot) {
                                         try {
                                                 return (((IPackageFragmentRoot) element).getKind() == IPackageFragmentRoot.K_SOURCE);
                                         } catch (JavaModelException e) {
                                                 JavaPlugin.log(e.getStatus()); // just log, no UI in validation
                                                 return false;
                                           }
                                 }
                                 return super.select(viewer, parent, element);
                         }
                                      };
                StandardJavaElementContentProvider provider = new StandardJavaElementContentProvider();
                ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
                ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, provider);
                dialog.setValidator(validator);
                dialog.setSorter(new JavaElementSorter());
                dialog.setTitle(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_title);
                dialog.setMessage(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_description);
                dialog.addFilter(filter);
                dialog.setInput(JavaCore.create(fWorkspaceRoot));
                dialog.setInitialSelection(initElement);


Clone AbstractionParameter Count: 5Parameter Bindings

Class[] acceptedClasses = new Class[] {
                                        IPackageFragmentRoot.class ,
                                        IJavaProject.class
                                      };
TypedElementSelectionValidator validator = new TypedElementSelectionValidator(acceptedClasses, false) {
                                             public boolean isSelectedValid(Object element) {
                                               try {
                                                 if (element instanceof IJavaProject) {
                                                   IJavaProject jproject = (IJavaProject) element;
                                                   IPath path = jproject.getProject().getFullPath();
                                                   return (jproject.findPackageFragmentRoot(path) != null);
                                                 }
                                                 else
                                                   if (element instanceof IPackageFragmentRoot) {
                                                     return (((IPackageFragmentRoot) element).getKind() == IPackageFragmentRoot.K_SOURCE);
                                                   }
                                                 return true;
                                               }
                                               catch (JavaModelException e) {
                                                 JavaPlugin.log(e.getStatus()); // just log, no ui in validation // just log, no UI in validation
                                               }
                                               return false;
                                             }
                                           };
acceptedClasses = new Class[] {
                                IJavaModel.class ,
                                IPackageFragmentRoot.class ,
                                IJavaProject.class
                              };
ViewerFilter filter = new TypedViewerFilter(acceptedClasses) {
                        public boolean select(Viewer viewer, Object parent, Object element) {
                          if (element instanceof IPackageFragmentRoot) {
                            try {
                              return (((IPackageFragmentRoot) element).getKind() == IPackageFragmentRoot.K_SOURCE);
                            }
                            catch (JavaModelException e) {
                              JavaPlugin.log(e.getStatus()); // just log, no ui in validation // just log, no UI in validation
                              return false;
                            }
                          }
                          return super.select(viewer, parent, element);
                        }
                      };
StandardJavaElementContentProvider provider = new StandardJavaElementContentProvider();
ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( [[#variableb77ab6e0]], labelProvider, provider);
dialog.setValidator(validator);
dialog.setSorter(new JavaElementSorter());
dialog.setTitle( [[#variableb77ab640]]. [[#variableb77ab5c0]]);
dialog.setMessage( [[#variableb77ab640]]. [[#variableb7c1f620]]);
dialog.addFilter(filter);
dialog.setInput(JavaCore.create( [[#variableb77ab560]]));
dialog.setInitialSelection(initElement);
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#b77ab6e0]]
fShell 
12[[#b77ab6e0]]
getShell() 
21[[#b77ab640]]
NLSUIMessages 
22[[#b77ab640]]
NewWizardMessages 
31[[#b77ab5c0]]
SourceFirstPackageSelectionDialogField_ChooseSourceContainerDialog_title 
32[[#b77ab5c0]]
NewContainerWizardPage_ChooseSourceContainerDialog_title 
41[[#b7c1f620]]
SourceFirstPackageSelectionDialogField_ChooseSourceContainerDialog_description 
42[[#b7c1f620]]
NewContainerWizardPage_ChooseSourceContainerDialog_description 
51[[#b77ab560]]
ResourcesPlugin.getWorkspace().getRoot() 
52[[#b77ab560]]
fWorkspaceRoot