| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 30 | 2 | 3 | 0.981 | class_body_declaration |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 27 | 480 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddDelegateMethodsAction.java |
| 2 | 30 | 521 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java |
| ||||
/*
* (non-Javadoc) Method declared on SelectionDispatchAction
*/
public void run(ITextSelection selection) {
try {
if ( !ActionUtil.isProcessable(getShell(), fEditor))
return;
IJavaElement[] elements = SelectionConverter.codeResolveForked(fEditor, true);
if (elements.length == 1 && (elements[0] instanceof IField)) {
IField field = (IField) elements[0];
run(field.getDeclaringType(), new IField[] {
field
}, true);
return;
}
IJavaElement element = SelectionConverter.getElementAtOffset(fEditor);
if (element != null) {
IType type = (IType) element.getAncestor(IJavaElement.TYPE);
if (type != null) {
if (type.getFields().length > 0) {
run(type, new IField[0], true);
return;
}
}
}
MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddDelegateMethodsAction_not_applicable);
} catch (CoreException e) {
ExceptionHandler.handle(e, getShell(), DIALOG_TITLE, ActionMessages.AddDelegateMethodsAction_error_actionfailed);
}
catch (InvocationTargetException e) {
ExceptionHandler.handle(e, getShell(), DIALOG_TITLE, ActionMessages.AddDelegateMethodsAction_error_actionfailed);
}
catch (InterruptedException e) {
// cancelled
}
}
|
| ||||
/*
* (non-Javadoc) Method declared on SelectionDispatchAction
*/
public void run(ITextSelection selection) {
try {
if ( !ActionUtil.isProcessable(getShell(), fEditor)) {
notifyResult(false);
return;
}
IJavaElement[] elements = SelectionConverter.codeResolveForked(fEditor, true);
if (elements.length == 1 && (elements[0] instanceof IField)) {
IField field = (IField) elements[0];
run(field.getDeclaringType(), new IField[] {
field
}, true);
return;
}
IJavaElement element = SelectionConverter.getElementAtOffset(fEditor);
if (element != null) {
IType type = (IType) element.getAncestor(IJavaElement.TYPE);
if (type != null) {
if (type.getFields().length > 0) {
run(type, new IField[0], true);
return;
}
}
}
MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddGetterSetterAction_not_applicable);
} catch (CoreException e) {
ExceptionHandler.handle(e, getShell(), DIALOG_TITLE, ActionMessages.AddGetterSetterAction_error_actionfailed);
}
catch (InvocationTargetException e) {
ExceptionHandler.handle(e, getShell(), DIALOG_TITLE, ActionMessages.AddGetterSetterAction_error_actionfailed);
}
catch (InterruptedException e) {
// cancelled
}
}
|
| |||
/*
* (non-Javadoc) Method declared on SelectionDispatchAction
*/
public void run(ITextSelection selection) {
try {
if ( !ActionUtil.isProcessable(getShell(), fEditor))
[[#variable908fef40]]
IJavaElement[] elements = SelectionConverter.codeResolveForked(fEditor, true);
if (elements.length == 1 && (elements[0] instanceof IField)) {
IField field = (IField) elements[0];
run(field.getDeclaringType(), new IField[] {
field
}, true);
return;
}
IJavaElement element = SelectionConverter.getElementAtOffset(fEditor);
if (element != null) {
IType type = (IType) element.getAncestor(IJavaElement.TYPE);
if (type != null) {
if (type.getFields().length > 0) {
run(type, new IField[0], true);
return;
}
}
}
MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages. [[#variable59fc5140]]);
}
catch (CoreException e) {
ExceptionHandler.handle(e, getShell(), DIALOG_TITLE, ActionMessages. [[#variable908fef60]]);
}
catch (InvocationTargetException e) {
ExceptionHandler.handle(e, getShell(), DIALOG_TITLE, ActionMessages. [[#variable908fef60]]);
}
catch (InterruptedException e) {
// cancelled
}
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#908fef40]] | {
notifyResult(false);
return;
} |
| 1 | 2 | [[#908fef40]] | return; |
| 2 | 1 | [[#59fc5140]] | AddGetterSetterAction_not_applicable |
| 2 | 2 | [[#59fc5140]] | AddDelegateMethodsAction_not_applicable |
| 3 | 1 | [[#908fef60]] | AddGetterSetterAction_error_actionfailed |
| 3 | 2 | [[#908fef60]] | AddDelegateMethodsAction_error_actionfailed |