CloneSet169


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
98250.966class_body_declarations[9]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
19891
plugins/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointMoveParticipant.java
29976
plugins/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointRenameParticipant.java
Clone Instance
1
Line Count
98
Source Line
91
Source File
plugins/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointMoveParticipant.java

        /**
         * Returns whether this given element is a valid target for this operation.
         * 
         * @param element
         * @return
         */
        protected abstract boolean accepts(IJavaElement element);

        /* (non-Javadoc)
         * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getName()
         */
        public String getName() {
                return RefactoringMessages.BreakpointRenameParticipant_0;
        }

        /* (non-Javadoc)
         * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#checkConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
         */
        public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException {
                return new RefactoringStatus();
        }

        /* (non-Javadoc)
         * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
         */
        public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
                List changes = new ArrayList();
                IResource resource = getBreakpointContainer();
                IMarker[] markers = resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
                gatherChanges(markers, changes);
                if (changes.size() > 1) {
                        return new CompositeChange(RefactoringMessages.BreakpointRenameParticipant_1, (Change[]) changes.toArray(new Change[changes.size()]));
                }
                else   if (changes.size() == 1) {
                        return (Change) changes.get(0);
                       }
                return null;
        }

        /**
         * Gathers refactoring specific changes. Subclasses must override.
         * 
         * @param breakpoint markers to consider during the change
         * @param list to add changes to 
         * @return changes for this refactoring.
         * @throws CoreException
         * @throws OperationCanceledException
         */
        protected abstract void gatherChanges(IMarker[] markers, List changes)
          throws                                                                      CoreException, OperationCanceledException;

        /**
         * Returns the resource that should be considered when searching for affected breakpoints.
         * 
         * @return resource to search for breakpoint markers.
         */
        protected IResource getBreakpointContainer() {
                return fElement.getResource();
        }

        /**
         * Returns the breakpoint associated with the given marker.
         * 
         * @param marker breakpoint marker
         * @return breakpoint or <code>null</code>
         */
        protected IBreakpoint getBreakpoint(IMarker marker) {
                return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
        }

        /**
         * Creates a specific type of change for a breakpoint that is changing types.
         * 
         * @return type change or <code>null</code>
         */
        protected Change createTypeChange(IJavaBreakpoint breakpoint, IType destType, IType originalType) throws CoreException {
                if (breakpoint instanceof IJavaWatchpoint) {
                        return new WatchpointTypeChange((IJavaWatchpoint) breakpoint, destType, originalType);
                }
                else   if (breakpoint instanceof IJavaClassPrepareBreakpoint) {
                        return new ClassPrepareBreakpointTypeChange((IJavaClassPrepareBreakpoint) breakpoint, destType);
                       }
                       else
                       if (breakpoint instanceof IJavaMethodBreakpoint) {
                        return new MethodBreakpointTypeChange((IJavaMethodBreakpoint) breakpoint, destType);
                       }
                       else
                       if (breakpoint instanceof IJavaExceptionBreakpoint) {
                        return new ExceptionBreakpointTypeChange((IJavaExceptionBreakpoint) breakpoint, destType);
                       }
                       else
                       if (breakpoint instanceof IJavaLineBreakpoint) {
                        return new LineBreakpointTypeChange((IJavaLineBreakpoint) breakpoint, destType);
                       }
                return null;
        }

        /**
         * Returns whether the given target type is contained in the specified container type.
         * 
         * @param container
         * @param target
         * @return
         */
        protected boolean isContained(IJavaElement container, IType type) {
                IJavaElement parent = type;
                while (parent != null) {
                        if (parent.equals(container)) {
                                return true;
                        }
                        parent = parent.getParent();
                }
                return false;
        }


Clone Instance
2
Line Count
99
Source Line
76
Source File
plugins/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointRenameParticipant.java

        /**
         * Returns whether this given element is a valid target for this operation.
         * 
         * @param element
         * @return
         */
        protected abstract boolean accepts(IJavaElement element);

        /* (non-Javadoc)
         * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getName()
         */
        public String getName() {
                return RefactoringMessages.BreakpointRenameParticipant_0;
        }

        /* (non-Javadoc)
         * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#checkConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
         */
        public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException {
                return new RefactoringStatus();
        }

        /* (non-Javadoc)
         * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
         */
        public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
                List changes = new ArrayList();
                IResource resource = getBreakpointContainer();
                IMarker[] markers = resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
                gatherChanges(markers, changes, getArguments().getNewName());
                if (changes.size() > 1) {
                        return new CompositeChange(RefactoringMessages.BreakpointRenameParticipant_1, (Change[]) changes.toArray(new Change[changes.size()]));
                }
                else   if (changes.size() == 1) {
                        return (Change) changes.get(0);
                       }
                return null;
        }

        /**
         * Gathers refactoring specific changes. Subclasses must override.
         * 
         * @param breakpoint markers to consider during the change
         * @param list to add changes to 
         * @param name of the element being renamed
         * @return changes for this refactoring.
         * @throws CoreException
         * @throws OperationCanceledException
         */
        protected abstract void gatherChanges(IMarker[] markers, List changes, String destName)
          throws                                                                                       CoreException, OperationCanceledException;

        /**
         * Returns the resource that should be considered when searching for affected breakpoints.
         * 
         * @return resource to search for breakpoint markers.
         */
        protected IResource getBreakpointContainer() {
                return fElement.getResource();
        }

        /**
         * Returns the breakpoint associated with the given marker.
         * 
         * @param marker breakpoint marker
         * @return breakpoint or <code>null</code>
         */
        protected IBreakpoint getBreakpoint(IMarker marker) {
                return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
        }

        /**
         * Creates a specific type of change for a breakpoint that is changing types.
         * 
         * @return type change or <code>null</code>
         */
        protected Change createTypeChange(IJavaBreakpoint breakpoint, IType destType, IType originalType) throws CoreException {
                if (breakpoint instanceof IJavaWatchpoint) {
                        return new WatchpointTypeChange((IJavaWatchpoint) breakpoint, destType, originalType);
                }
                else   if (breakpoint instanceof IJavaClassPrepareBreakpoint) {
                        return new ClassPrepareBreakpointTypeChange((IJavaClassPrepareBreakpoint) breakpoint, destType);
                       }
                       else
                       if (breakpoint instanceof IJavaMethodBreakpoint) {
                        return new MethodBreakpointTypeChange((IJavaMethodBreakpoint) breakpoint, destType);
                       }
                       else
                       if (breakpoint instanceof IJavaExceptionBreakpoint) {
                        return new ExceptionBreakpointTypeChange((IJavaExceptionBreakpoint) breakpoint, destType);
                       }
                       else
                       if (breakpoint instanceof IJavaLineBreakpoint) {
                        return new LineBreakpointTypeChange((IJavaLineBreakpoint) breakpoint, destType);
                       }
                return null;
        }

        /**
         * Returns whether the given target type is contained in the specified container type.
         * 
         * @param container
         * @param target
         * @return
         */
        protected boolean isContained(IJavaElement container, IType type) {
                IJavaElement parent = type;
                while (parent != null) {
                        if (parent.equals(container)) {
                                return true;
                        }
                        parent = parent.getParent();
                }
                return false;
        }


Clone AbstractionParameter Count: 5Parameter Bindings

/**
         * Returns whether this given element is a valid target for this operation.
         * 
         * @param element
         * @return
         */
protected abstract boolean accepts(IJavaElement element);

/* (non-Javadoc)
         * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getName()
         */
public String getName() {
  return RefactoringMessages.BreakpointRenameParticipant_0;
}

/* (non-Javadoc)
         * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#checkConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
         */
public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException {
  return new RefactoringStatus();
}

/* (non-Javadoc)
         * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
         */
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
  List changes = new ArrayList();
  IResource resource = getBreakpointContainer();
  IMarker[] markers = resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
  gatherChanges( [[#variableb95f01c0]],  [[#variable9d447820]]);
  if (changes.size() > 1) {
    return new CompositeChange(RefactoringMessages.BreakpointRenameParticipant_1, (Change[]) changes.toArray(new Change[changes.size()]));
  }
  else
    if (changes.size() == 1) {
      return (Change) changes.get(0);
    }
  return null;
}

/**
         * Gathers refactoring specific changes. Subclasses must override.
         * 
         * @param breakpoint markers to consider during the change
         * @param list to add changes to 
         * @return changes for this refactoring.
         * @throws CoreException
         * @throws OperationCanceledException
         */
/**
         * Gathers refactoring specific changes. Subclasses must override.
         * 
         * @param breakpoint markers to consider during the change
         * @param list to add changes to 
         * @param name of the element being renamed
         * @return changes for this refactoring.
         * @throws CoreException
         * @throws OperationCanceledException
         */
protected abstract void gatherChanges( [[#variableb95f00a0]], [[#variableb95f0060]]  [[#variableb95f0140]])
  throws CoreException, OperationCanceledException;

/**
         * Returns the resource that should be considered when searching for affected breakpoints.
         * 
         * @return resource to search for breakpoint markers.
         */
protected IResource getBreakpointContainer() {
  return fElement.getResource();
}

/**
         * Returns the breakpoint associated with the given marker.
         * 
         * @param marker breakpoint marker
         * @return breakpoint or <code>null</code>
         */
protected IBreakpoint getBreakpoint(IMarker marker) {
  return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
}

/**
         * Creates a specific type of change for a breakpoint that is changing types.
         * 
         * @return type change or <code>null</code>
         */
protected Change createTypeChange(IJavaBreakpoint breakpoint, IType destType, IType originalType) throws CoreException {
  if (breakpoint instanceof IJavaWatchpoint) {
    return new WatchpointTypeChange((IJavaWatchpoint) breakpoint, destType, originalType);
  }
  else
    if (breakpoint instanceof IJavaClassPrepareBreakpoint) {
      return new ClassPrepareBreakpointTypeChange((IJavaClassPrepareBreakpoint) breakpoint, destType);
    }
    else
      if (breakpoint instanceof IJavaMethodBreakpoint) {
        return new MethodBreakpointTypeChange((IJavaMethodBreakpoint) breakpoint, destType);
      }
      else
        if (breakpoint instanceof IJavaExceptionBreakpoint) {
          return new ExceptionBreakpointTypeChange((IJavaExceptionBreakpoint) breakpoint, destType);
        }
        else
          if (breakpoint instanceof IJavaLineBreakpoint) {
            return new LineBreakpointTypeChange((IJavaLineBreakpoint) breakpoint, destType);
          }
  return null;
}

/**
         * Returns whether the given target type is contained in the specified container type.
         * 
         * @param container
         * @param target
         * @return
         */
protected boolean isContained(IJavaElement container, IType type) {
  IJavaElement parent = type;
  while (parent != null) {
    if (parent.equals(container)) {
      return true;
    }
    parent = parent.getParent();
  }
  return false;
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#b95f01c0]]
markers 
12[[#b95f01c0]]
markers, changes 
21[[#9d447820]]
changes 
22[[#9d447820]]
getArguments().getNewName() 
31[[#b95f00a0]]
IMarker[] markers 
32[[#b95f00a0]]
IMarker[] markers, List changes 
41[[#b95f0060]]
List 
42[[#b95f0060]]
String 
51[[#b95f0140]]
changes 
52[[#b95f0140]]
destName