Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
83 | 2 | 6 | 0.982 | type_declarations |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 64 | 31 | plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/buildpath/CreateFolderOperation.java |
2 | 83 | 38 | plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/buildpath/LinkedSourceFolderOperation.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; } } |
| ||||
/** * 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; } } |
| |||
/** * 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 Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#9d435400]] | LinkedSourceFolderOperation |
1 | 2 | [[#9d435400]] | CreateFolderOperation |
2 | 1 | [[#9d435320]] | private |
2 | 2 | [[#9d435320]] | private final |
3 | 1 | [[#9d4352a0]] | NewSourceContainerWorkbookPage_ToolBar_Link_tooltip |
3 | 2 | [[#9d4352a0]] | NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip |
4 | 1 | [[#9d434ee0]] | CREATE_LINK |
4 | 2 | [[#9d434ee0]] | CREATE_FOLDER |
5 | 1 | [[#9d434e60]] | CreateLinkedSourceFolderAction |
5 | 2 | [[#9d434e60]] | CreateLocalSourceFolderAction |
6 | 1 | [[#9d435220]] | PackageExplorerActionGroup_FormText_createLinkedFolder |
6 | 2 | [[#9d435220]] | PackageExplorerActionGroup_FormText_createNewSourceFolder |