| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 116 | 2 | 6 | 0.976 | class_body_declaration |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 115 | 47 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/HistoryListAction.java |
| 2 | 116 | 46 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/typehierarchy/HistoryListAction.java |
| ||||
private class HistoryListDialog extends StatusDialog {
private ListDialogField fHistoryList;
private IStatus fHistoryStatus;
private IMethod fResult;
private HistoryListDialog(Shell shell, IMethod[] elements) {
super(shell);
setTitle(CallHierarchyMessages.HistoryListDialog_title);
String[] buttonLabels = new String[] {
CallHierarchyMessages.HistoryListDialog_remove_button
,
};
IListAdapter adapter = new IListAdapter() {
public void customButtonPressed(ListDialogField field, int index) {
doCustomButtonPressed();
}
public void selectionChanged(ListDialogField field) {
doSelectionChanged();
}
public void doubleClicked(ListDialogField field) {
doDoubleClicked();
}
};
JavaElementLabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_QUALIFIED| JavaElementLabelProvider.SHOW_ROOT);
fHistoryList = new ListDialogField(adapter, buttonLabels, labelProvider);
fHistoryList.setLabelText(CallHierarchyMessages.HistoryListDialog_label);
fHistoryList.setElements(Arrays.asList(elements));
ISelection sel;
if (elements.length > 0) {
sel = new StructuredSelection(elements[0]);
}
else {
sel = new StructuredSelection();
}
fHistoryList.selectElements(sel);
}
/*
* @see Dialog#createDialogArea(Composite)
*/
protected Control createDialogArea(Composite parent) {
initializeDialogUnits(parent);
Composite composite = (Composite) super.createDialogArea(parent);
Composite inner = new Composite(composite, SWT.NONE);
inner.setLayoutData(new GridData(GridData.FILL_BOTH));
inner.setFont(composite.getFont());
LayoutUtil.doDefaultLayout(inner, new DialogField[] {
fHistoryList
}, true, 0, 0);
LayoutUtil.setHeightHint(fHistoryList.getListControl(null), convertHeightInCharsToPixels(12));
LayoutUtil.setHorizontalGrabbing(fHistoryList.getListControl(null));
applyDialogFont(composite);
return composite;
}
/**
* Method doCustomButtonPressed.
*/
private void doCustomButtonPressed() {
fHistoryList.removeElements(fHistoryList.getSelectedElements());
}
private void doDoubleClicked() {
if (fHistoryStatus.isOK()) {
okPressed();
}
}
private void doSelectionChanged() {
StatusInfo status = new StatusInfo();
List selected = fHistoryList.getSelectedElements();
if (selected.size() != 1) {
status.setError(""); //$NON-NLS-1$
fResult = null;
}
else {
fResult = (IMethod) selected.get(0);
}
fHistoryList.enableButton(0, fHistoryList.getSize() > selected.size() && selected.size() != 0);
fHistoryStatus = status;
updateStatus(status);
}
public IMethod getResult() {
return fResult;
}
public IMethod[] getRemaining() {
List elems = fHistoryList.getElements();
return (IMethod[]) elems.toArray(new IMethod[elems.size()]);
}
/*
* @see org.eclipse.jface.window.Window#configureShell(Shell)
*/
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IJavaHelpContextIds.HISTORY_LIST_DIALOG);
}
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#create()
*/
public void create() {
setShellStyle(getShellStyle()| SWT.RESIZE);
super.create();
}
}
|
| ||||
private class HistoryListDialog extends StatusDialog {
private ListDialogField fHistoryList;
private IStatus fHistoryStatus;
private IJavaElement fResult;
private HistoryListDialog(Shell shell, IJavaElement[] elements) {
super(shell);
setTitle(TypeHierarchyMessages.HistoryListDialog_title);
String[] buttonLabels = new String[] {
TypeHierarchyMessages.HistoryListDialog_remove_button
,
};
IListAdapter adapter = new IListAdapter() {
public void customButtonPressed(ListDialogField field, int index) {
doCustomButtonPressed();
}
public void selectionChanged(ListDialogField field) {
doSelectionChanged();
}
public void doubleClicked(ListDialogField field) {
doDoubleClicked();
}
};
JavaElementLabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_QUALIFIED| JavaElementLabelProvider.SHOW_ROOT);
fHistoryList = new ListDialogField(adapter, buttonLabels, labelProvider);
fHistoryList.setLabelText(TypeHierarchyMessages.HistoryListDialog_label);
fHistoryList.setElements(Arrays.asList(elements));
ISelection sel;
if (elements.length > 0) {
sel = new StructuredSelection(elements[0]);
}
else {
sel = new StructuredSelection();
}
fHistoryList.selectElements(sel);
}
/*
* @see Dialog#createDialogArea(Composite)
*/
protected Control createDialogArea(Composite parent) {
initializeDialogUnits(parent);
Composite composite = (Composite) super.createDialogArea(parent);
Composite inner = new Composite(composite, SWT.NONE);
inner.setFont(parent.getFont());
inner.setLayoutData(new GridData(GridData.FILL_BOTH));
LayoutUtil.doDefaultLayout(inner, new DialogField[] {
fHistoryList
}, true, 0, 0);
LayoutUtil.setHeightHint(fHistoryList.getListControl(null), convertHeightInCharsToPixels(12));
LayoutUtil.setHorizontalGrabbing(fHistoryList.getListControl(null));
applyDialogFont(composite);
return composite;
}
/**
* Method doCustomButtonPressed.
*/
private void doCustomButtonPressed() {
fHistoryList.removeElements(fHistoryList.getSelectedElements());
}
private void doDoubleClicked() {
if (fHistoryStatus.isOK()) {
okPressed();
}
}
private void doSelectionChanged() {
StatusInfo status = new StatusInfo();
List selected = fHistoryList.getSelectedElements();
if (selected.size() != 1) {
status.setError(""); //$NON-NLS-1$
fResult = null;
}
else {
fResult = (IJavaElement) selected.get(0);
}
fHistoryList.enableButton(0, fHistoryList.getSize() > selected.size() && selected.size() != 0);
fHistoryStatus = status;
updateStatus(status);
}
public IJavaElement getResult() {
return fResult;
}
public IJavaElement[] getRemaining() {
List elems = fHistoryList.getElements();
return (IJavaElement[]) elems.toArray(new IJavaElement[elems.size()]);
}
/*
* @see org.eclipse.jface.window.Window#configureShell(Shell)
*/
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IJavaHelpContextIds.HISTORY_LIST_DIALOG);
}
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#create()
*/
public void create() {
setShellStyle(getShellStyle()| SWT.RESIZE);
super.create();
}
}
|
| |||
private class HistoryListDialog extends StatusDialog {
private ListDialogField fHistoryList;
private IStatus fHistoryStatus;
private [[#variable92cdfa80]] fResult;
private HistoryListDialog(Shell shell, [[#variable92cdfa80]][] elements) {
super(shell);
setTitle( [[#variable92cdf9c0]].HistoryListDialog_title);
String[] buttonLabels = new String[] {
[[#variable92cdf9c0]].HistoryListDialog_remove_button
,
};
IListAdapter adapter = new IListAdapter() {
public void customButtonPressed(ListDialogField field, int index) {
doCustomButtonPressed();
}
public void selectionChanged(ListDialogField field) {
doSelectionChanged();
}
public void doubleClicked(ListDialogField field) {
doDoubleClicked();
}
};
JavaElementLabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_QUALIFIED|JavaElementLabelProvider.SHOW_ROOT);
fHistoryList = new ListDialogField(adapter, buttonLabels, labelProvider);
fHistoryList.setLabelText( [[#variable92cdf9c0]].HistoryListDialog_label);
fHistoryList.setElements(Arrays.asList(elements));
ISelection sel;
if (elements.length > 0) {
sel = new StructuredSelection(elements[0]);
}
else {
sel = new StructuredSelection();
}
fHistoryList.selectElements(sel);
}
/*
* @see Dialog#createDialogArea(Composite)
*/
protected Control createDialogArea(Composite parent) {
initializeDialogUnits(parent);
Composite composite = (Composite) super.createDialogArea(parent);
Composite inner = new Composite(composite, SWT.NONE);
inner. [[#variable92cdf920]]( [[#variable92cdf8a0]]);
inner. [[#variable92cdf820]]( [[#variable92cdf7a0]]);
LayoutUtil.doDefaultLayout(inner, new DialogField[] {
fHistoryList
}, true, 0, 0);
LayoutUtil.setHeightHint(fHistoryList.getListControl(null), convertHeightInCharsToPixels(12));
LayoutUtil.setHorizontalGrabbing(fHistoryList.getListControl(null));
applyDialogFont(composite);
return composite;
}
/**
* Method doCustomButtonPressed.
*/
private void doCustomButtonPressed() {
fHistoryList.removeElements(fHistoryList.getSelectedElements());
}
private void doDoubleClicked() {
if (fHistoryStatus.isOK()) {
okPressed();
}
}
private void doSelectionChanged() {
StatusInfo status = new StatusInfo();
List selected = fHistoryList.getSelectedElements();
if (selected.size() != 1) {
status.setError(""); //$NON-NLS-1$
fResult = null;
}
else {
fResult = ( [[#variable92cdfa80]]) selected.get(0);
}
fHistoryList.enableButton(0, fHistoryList.getSize() > selected.size() && selected.size() != 0);
fHistoryStatus = status;
updateStatus(status);
}
public [[#variable92cdfa80]] getResult() {
return fResult;
}
public [[#variable92cdfa80]][] getRemaining() {
List elems = fHistoryList.getElements();
return ( [[#variable92cdfa80]][]) elems.toArray(new [[#variable92cdfa80]][elems.size()]);
}
/*
* @see org.eclipse.jface.window.Window#configureShell(Shell)
*/
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IJavaHelpContextIds.HISTORY_LIST_DIALOG);
}
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#create()
*/
public void create() {
setShellStyle(getShellStyle()|SWT.RESIZE);
super.create();
}
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#92cdfa80]] | IJavaElement |
| 1 | 2 | [[#92cdfa80]] | IMethod |
| 2 | 1 | [[#92cdf9c0]] | TypeHierarchyMessages |
| 2 | 2 | [[#92cdf9c0]] | CallHierarchyMessages |
| 3 | 1 | [[#92cdf920]] | setFont |
| 3 | 2 | [[#92cdf920]] | setLayoutData |
| 4 | 1 | [[#92cdf8a0]] | parent.getFont() |
| 4 | 2 | [[#92cdf8a0]] | new GridData(GridData.FILL_BOTH) |
| 5 | 1 | [[#92cdf820]] | setLayoutData |
| 5 | 2 | [[#92cdf820]] | setFont |
| 6 | 1 | [[#92cdf7a0]] | new GridData(GridData.FILL_BOTH) |
| 6 | 2 | [[#92cdf7a0]] | composite.getFont() |