CloneSet102


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
116260.976class_body_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
111547
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/HistoryListAction.java
211646
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/typehierarchy/HistoryListAction.java
Clone Instance
1
Line Count
115
Source Line
47
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/callhierarchy/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();
                }
        }


Clone Instance
2
Line Count
116
Source Line
46
Source File
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 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();
                }
        }


Clone AbstractionParameter Count: 6Parameter Bindings

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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#92cdfa80]]
IJavaElement 
12[[#92cdfa80]]
IMethod 
21[[#92cdf9c0]]
TypeHierarchyMessages 
22[[#92cdf9c0]]
CallHierarchyMessages 
31[[#92cdf920]]
setFont 
32[[#92cdf920]]
setLayoutData 
41[[#92cdf8a0]]
parent.getFont() 
42[[#92cdf8a0]]
new GridData(GridData.FILL_BOTH) 
51[[#92cdf820]]
setLayoutData 
52[[#92cdf820]]
setFont 
61[[#92cdf7a0]]
new GridData(GridData.FILL_BOTH) 
62[[#92cdf7a0]]
composite.getFont()