CloneSet377


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
83260.982type_declarations
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
16431
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/buildpath/CreateFolderOperation.java
28338
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/buildpath/LinkedSourceFolderOperation.java
Clone Instance
1
Line Count
64
Source Line
31
Source File
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/buildpath/CreateFolderOperation.java

public class CreateFolderOperation extends ClasspathModifierOperation {

        private final IClasspathModifierListener fListener;

        private final IClasspathInformationProvider fCPInformationProvider;

    /**
     * Creates a new <code>AddFolderOperation</code>.
     * 
     * @param listener a <code>IClasspathModifierListener</code> that is notified about 
     * changes on classpath entries or <code>null</code> if no such notification is 
     * necessary.
     * @param informationProvider a provider to offer information to the action
     * 
     * @see IClasspathInformationProvider
     * @see ClasspathModifier
     */
        public CreateFolderOperation(IClasspathModifierListener listener, IClasspathInformationProvider informationProvider) {
                super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip, IClasspathInformationProvider.CREATE_FOLDER);
                fListener = listener;
                fCPInformationProvider = informationProvider;
        }

        /**
         * {@inheritDoc}
         */
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                CreateLocalSourceFolderAction action = new CreateLocalSourceFolderAction();
                action.selectionChanged(new StructuredSelection(fCPInformationProvider.getJavaProject()));
                action.run();
                IPackageFragmentRoot createdElement = (IPackageFragmentRoot) action.getCreatedElement();
                if (createdElement == null) {
                        //Wizard was cancled.
                        return;
                }
                try {
                        IResource correspondingResource = createdElement.getCorrespondingResource();
                        List result = new ArrayList();
                        result.add(correspondingResource);
                        if (fListener != null) {
                                List entries = action.getCPListElements();
                                fListener.classpathEntryChanged(entries);
                        }
                fCPInformationProvider.handleResult(result, null, IClasspathInformationProvider.CREATE_FOLDER);
                } catch (JavaModelException e) {
                        if (monitor == null) {
                                fCPInformationProvider.handleResult(Collections.EMPTY_LIST, e, IClasspathInformationProvider.CREATE_FOLDER);
                        }
                        else   {
                                throw new InvocationTargetException(e);
                        }
                  }
        }

        /**
         * {@inheritDoc}
         */
        public boolean isValid(List elements, int[] types) throws JavaModelException {
                return types.length == 1 && types[0] == DialogPackageExplorerActionGroup.JAVA_PROJECT;
        }

        /**
         * {@inheritDoc}
         */
        public String getDescription(int type) {
                return NewWizardMessages.PackageExplorerActionGroup_FormText_createNewSourceFolder;
        }
}




Clone Instance
2
Line Count
83
Source Line
38
Source File
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/buildpath/LinkedSourceFolderOperation.java

/**
 * Operation create a link to a source folder.
 * 
 * @see org.eclipse.jdt.internal.corext.buildpath.ClasspathModifier#createLinkedSourceFolder(ILinkToQuery, IJavaProject, IProgressMonitor)
 */
public class LinkedSourceFolderOperation extends ClasspathModifierOperation {

    private IClasspathModifierListener fListener;

        private IClasspathInformationProvider fCPInformationProvider;

        /**
     * Constructor
     * 
     * @param listener a <code>IClasspathModifierListener</code> that is notified about 
     * changes on classpath entries or <code>null</code> if no such notification is 
     * necessary.
     * @param informationProvider a provider to offer information to the action
     * 
     * @see IClasspathInformationProvider
     * @see ClasspathModifier
     */
    public LinkedSourceFolderOperation(IClasspathModifierListener listener, IClasspathInformationProvider informationProvider) {
        super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Link_tooltip, IClasspathInformationProvider.CREATE_LINK);
                fListener = listener;
                fCPInformationProvider = informationProvider;
    }

    /**
     * Method which runs the actions with a progress monitor.<br>
     * 
     * This operation requires the following query from the provider:
     * <li>ILinkToQuery</li>
     * 
     * @param monitor a progress monitor, can be <code>null</code>
     */
    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        CreateLinkedSourceFolderAction action = new CreateLinkedSourceFolderAction();
                action.selectionChanged(new StructuredSelection(fCPInformationProvider.getJavaProject()));
                action.run();
                IPackageFragmentRoot createdElement = (IPackageFragmentRoot) action.getCreatedElement();
                if (createdElement == null) {
                        //Wizard was cancled.
                        return;
                }
                try {
                        IResource correspondingResource = createdElement.getCorrespondingResource();
                        List result = new ArrayList();
                        result.add(correspondingResource);
                        if (fListener != null) {
                                List entries = action.getCPListElements();
                                fListener.classpathEntryChanged(entries);
                        }
                fCPInformationProvider.handleResult(result, null, IClasspathInformationProvider.CREATE_LINK);
                } catch (JavaModelException e) {
                        if (monitor == null) {
                                fCPInformationProvider.handleResult(Collections.EMPTY_LIST, e, IClasspathInformationProvider.CREATE_LINK);
                        }
                        else   {
                                throw new InvocationTargetException(e);
                        }
                  }
    }

    /**
     * This particular operation is always valid.
     * 
     * @param elements a list of elements
     * @param types an array of types for each element, that is, 
     * the type at position 'i' belongs to the selected element 
     * at position 'i' 
     * 
     * @return <code>true</code> if the operation can be 
     * executed on the provided list of elements, <code>
     * false</code> otherwise.
     * @throws JavaModelException 
     */
    public boolean isValid(List elements, int[] types) throws JavaModelException {
        return types.length == 1 && types[0] == DialogPackageExplorerActionGroup.JAVA_PROJECT;
    }

    /**
     * Get a description for this operation.
     * 
     * @param type the type of the selected object, must be a constant of 
     * <code>DialogPackageExplorerActionGroup</code>.
     * @return a string describing the operation
     */
    public String getDescription(int type) {
        return NewWizardMessages.PackageExplorerActionGroup_FormText_createLinkedFolder;
    }
}




Clone AbstractionParameter Count: 6Parameter Bindings

/**
 * Operation create a link to a source folder.
 * 
 * @see org.eclipse.jdt.internal.corext.buildpath.ClasspathModifier#createLinkedSourceFolder(ILinkToQuery, IJavaProject, IProgressMonitor)
 */
public class [[#variable9d435400]]extends ClasspathModifierOperation {
   [[#variable9d435320]]IClasspathModifierListener fListener;

   [[#variable9d435320]]IClasspathInformationProvider fCPInformationProvider;

  /**
       * Constructor
       * 
       * @param listener a <code>IClasspathModifierListener</code> that is notified about 
       * changes on classpath entries or <code>null</code> if no such notification is 
       * necessary.
       * @param informationProvider a provider to offer information to the action
       * 
       * @see IClasspathInformationProvider
       * @see ClasspathModifier
       */
  /**
       * Creates a new <code>AddFolderOperation</code>.
       * 
       * @param listener a <code>IClasspathModifierListener</code> that is notified about 
       * changes on classpath entries or <code>null</code> if no such notification is 
       * necessary.
       * @param informationProvider a provider to offer information to the action
       * 
       * @see IClasspathInformationProvider
       * @see ClasspathModifier
       */
  public [[#variable9d435400]](IClasspathModifierListener listener, IClasspathInformationProvider informationProvider) {
    super(listener, informationProvider, NewWizardMessages. [[#variable9d4352a0]], IClasspathInformationProvider. [[#variable9d434ee0]]);
    fListener = listener;
    fCPInformationProvider = informationProvider;
  }

  /**
       * Method which runs the actions with a progress monitor.<br>
       * 
       * This operation requires the following query from the provider:
       * <li>ILinkToQuery</li>
       * 
       * @param monitor a progress monitor, can be <code>null</code>
       */
  /**
           * {@inheritDoc}
           */
  public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
     [[#variable9d434e60]] action = new [[#variable9d434e60]]();
    action.selectionChanged(new StructuredSelection(fCPInformationProvider.getJavaProject()));
    action.run();
    IPackageFragmentRoot createdElement = (IPackageFragmentRoot) action.getCreatedElement();
    if (createdElement == null) {
      //Wizard was cancled.
      return;
    }
    try {
      IResource correspondingResource = createdElement.getCorrespondingResource();
      List result = new ArrayList();
      result.add(correspondingResource);
      if (fListener != null) {
        List entries = action.getCPListElements();
        fListener.classpathEntryChanged(entries);
      }
      fCPInformationProvider.handleResult(result, null, IClasspathInformationProvider. [[#variable9d434ee0]]);
    }
    catch (JavaModelException e) {
      if (monitor == null) {
        fCPInformationProvider.handleResult(Collections.EMPTY_LIST, e, IClasspathInformationProvider. [[#variable9d434ee0]]);
      }
      else {
        throw new InvocationTargetException(e);
      }
    }
  }

  /**
       * This particular operation is always valid.
       * 
       * @param elements a list of elements
       * @param types an array of types for each element, that is, 
       * the type at position 'i' belongs to the selected element 
       * at position 'i' 
       * 
       * @return <code>true</code> if the operation can be 
       * executed on the provided list of elements, <code>
       * false</code> otherwise.
       * @throws JavaModelException 
       */
  /**
           * {@inheritDoc}
           */
  public boolean isValid(List elements, int[] types) throws JavaModelException {
    return types.length == 1 && types[0] == DialogPackageExplorerActionGroup.JAVA_PROJECT;
  }

  /**
       * Get a description for this operation.
       * 
       * @param type the type of the selected object, must be a constant of 
       * <code>DialogPackageExplorerActionGroup</code>.
       * @return a string describing the operation
       */
  /**
           * {@inheritDoc}
           */
  public String getDescription(int type) {
    return NewWizardMessages. [[#variable9d435220]];
  }
}


 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#9d435400]]
LinkedSourceFolderOperation 
12[[#9d435400]]
CreateFolderOperation 
21[[#9d435320]]
private 
22[[#9d435320]]
private final 
31[[#9d4352a0]]
NewSourceContainerWorkbookPage_ToolBar_Link_tooltip 
32[[#9d4352a0]]
NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip 
41[[#9d434ee0]]
CREATE_LINK 
42[[#9d434ee0]]
CREATE_FOLDER 
51[[#9d434e60]]
CreateLinkedSourceFolderAction 
52[[#9d434e60]]
CreateLocalSourceFolderAction 
61[[#9d435220]]
PackageExplorerActionGroup_FormText_createLinkedFolder 
62[[#9d435220]]
PackageExplorerActionGroup_FormText_createNewSourceFolder