CloneSet534


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
33201.000class_body_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
133111
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CleanUpAction.java
233267
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
Clone Instance
1
Line Count
33
Source Line
111
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CleanUpAction.java

        private boolean isEnabled(IStructuredSelection selection) {
                Object[] selected = selection.toArray();
                for (int i = 0; i < selected.length; i++) {
                        try {
                                if (selected[i] instanceof IJavaElement) {
                                        IJavaElement elem = (IJavaElement) selected[i];
                                        if (elem.exists()) {
                                                switch (elem.getElementType()) {
                                                        case IJavaElement.TYPE:
                                                                return elem.getParent().getElementType() == IJavaElement.COMPILATION_UNIT; // for browsing perspective
                                                        case IJavaElement.COMPILATION_UNIT:
                                                                return true;
                                                        case IJavaElement.IMPORT_CONTAINER:
                                                                return true;
                                                        case IJavaElement.PACKAGE_FRAGMENT:
                                                        case IJavaElement.PACKAGE_FRAGMENT_ROOT:
                                                                IPackageFragmentRoot root = (IPackageFragmentRoot) elem.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
                                                                return (root.getKind() == IPackageFragmentRoot.K_SOURCE);
                                                        case IJavaElement.JAVA_PROJECT:
                                                                // https://bugs.eclipse.org/bugs/show_bug.cgi?id=65638
                                                                return true;
                                                      }
                                        }
                                }
                                else   if (selected[i] instanceof LogicalPackage) {
                                        return true;
                                       }
                        } catch (JavaModelException e) {
                                if ( !e.isDoesNotExist()) {
                                        JavaPlugin.log(e);
                                }
                          }
                }
                return false;
        }


Clone Instance
2
Line Count
33
Source Line
267
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java

        private boolean isEnabled(IStructuredSelection selection) {
                Object[] selected = selection.toArray();
                for (int i = 0; i < selected.length; i++) {
                        try {
                                if (selected[i] instanceof IJavaElement) {
                                        IJavaElement elem = (IJavaElement) selected[i];
                                        if (elem.exists()) {
                                                switch (elem.getElementType()) {
                                                        case IJavaElement.TYPE:
                                                                return elem.getParent().getElementType() == IJavaElement.COMPILATION_UNIT; // for browsing perspective
                                                        case IJavaElement.COMPILATION_UNIT:
                                                                return true;
                                                        case IJavaElement.IMPORT_CONTAINER:
                                                                return true;
                                                        case IJavaElement.PACKAGE_FRAGMENT:
                                                        case IJavaElement.PACKAGE_FRAGMENT_ROOT:
                                                                IPackageFragmentRoot root = (IPackageFragmentRoot) elem.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
                                                                return (root.getKind() == IPackageFragmentRoot.K_SOURCE);
                                                        case IJavaElement.JAVA_PROJECT:
                                                                // https://bugs.eclipse.org/bugs/show_bug.cgi?id=65638
                                                                return true;
                                                      }
                                        }
                                }
                                else   if (selected[i] instanceof LogicalPackage) {
                                        return true;
                                       }
                        } catch (JavaModelException e) {
                                if ( !e.isDoesNotExist()) {
                                        JavaPlugin.log(e);
                                }
                          }
                }
                return false;
        }


Clone AbstractionParameter Count: 0Parameter Bindings

private boolean isEnabled(IStructuredSelection selection) {
  Object[] selected = selection.toArray();
  for (int i = 0; i < selected.length; i++) {
    try {
      if (selected[i] instanceof IJavaElement) {
        IJavaElement elem = (IJavaElement) selected[i];
        if (elem.exists()) {
          switch (elem.getElementType()) {
            case IJavaElement.TYPE:
              return elem.getParent().getElementType() == IJavaElement.COMPILATION_UNIT; // for browsing perspective
            case IJavaElement.COMPILATION_UNIT:
              return true;
            case IJavaElement.IMPORT_CONTAINER:
              return true;
            case IJavaElement.PACKAGE_FRAGMENT:
            case IJavaElement.PACKAGE_FRAGMENT_ROOT:
              IPackageFragmentRoot root = (IPackageFragmentRoot) elem.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
              return (root.getKind() == IPackageFragmentRoot.K_SOURCE);
            case IJavaElement.JAVA_PROJECT:
              // https://bugs.eclipse.org/bugs/show_bug.cgi?id=65638
              return true;
          }
        }
      }
      else
        if (selected[i] instanceof LogicalPackage) {
          return true;
        }
    }
    catch (JavaModelException e) {
      if ( !e.isDoesNotExist()) {
        JavaPlugin.log(e);
      }
    }
  }
  return false;
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
None