CloneSet125


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
83220.986class_body_declarations[4]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
183377
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/dialogfields/ListDialogField.java
283304
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/dialogfields/TreeListDialogField.java
Clone Instance
1
Line Count
83
Source Line
377
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/dialogfields/ListDialogField.java

        protected Button createButton(Composite parent, String label, SelectionListener listener) {
                Button button = new Button(parent, SWT.PUSH);
                button.setFont(parent.getFont());
                button.setText(label);
                button.addSelectionListener(listener);
                GridData gd = new GridData();
                gd.horizontalAlignment = GridData.FILL;
                gd.grabExcessHorizontalSpace = true;
                gd.verticalAlignment = GridData.BEGINNING;
                gd.widthHint = SWTUtil.getButtonWidthHint(button);

                button.setLayoutData(gd);

                return button;
        }

        private Label createSeparator(Composite parent) {
                Label separator = new Label(parent, SWT.SEPARATOR|  SWT.HORIZONTAL);
                separator.setFont(parent.getFont());
                separator.setVisible(false);
                GridData gd = new GridData();
                gd.horizontalAlignment = GridData.FILL;
                gd.verticalAlignment = GridData.BEGINNING;
                gd.verticalIndent = 4;
                separator.setLayoutData(gd);
                return separator;
        }

        /**
         * Returns the composite containing the buttons. When called the first time, the control
         * will be created.
         * @param parent The parent composite when called the first time, or <code>null</code>
         * after.
         */
        public Composite getButtonBox(Composite parent) {
                if (fButtonsControl == null) {
                        assertCompositeNotNull(parent);

                        SelectionListener listener = new SelectionListener() {
                                 public void widgetDefaultSelected(SelectionEvent e) {
                                         doButtonSelected(e);
                                 }

                                 public void widgetSelected(SelectionEvent e) {
                                         doButtonSelected(e);
                                 }
                                                     };
                        Composite contents = new Composite(parent, SWT.NONE);
                        contents.setFont(parent.getFont());
                        GridLayout layout = new GridLayout();
                        layout.marginWidth = 0;
                        layout.marginHeight = 0;
                        contents.setLayout(layout);

                        if (fButtonLabels != null) {
                                fButtonControls = new Button[fButtonLabels.length];
                                for (int i = 0; i < fButtonLabels.length; i++) {
                                        String currLabel = fButtonLabels[i];
                                        if (currLabel != null) {
                                                fButtonControls[i] = createButton(contents, currLabel, listener);
                                                fButtonControls[i].setEnabled(isEnabled() && fButtonsEnabled[i]);
                                        }
                                        else   {
                                                fButtonControls[i] = null;
                                                createSeparator(contents);
                                        }
                                }
                        }
                        fLastSeparator = createSeparator(contents);

                        updateButtonState();
                        fButtonsControl = contents;
                }

                return fButtonsControl;
        }

        private void doButtonSelected(SelectionEvent e) {
                if (fButtonControls != null) {
                        for (int i = 0; i < fButtonControls.length; i++) {
                                if (e.widget == fButtonControls[i]) {
                                        buttonPressed(i);
                                        return;
                                }
                        }
                }
        }


Clone Instance
2
Line Count
83
Source Line
304
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/dialogfields/TreeListDialogField.java

        protected Button createButton(Composite parent, String label, SelectionListener listener) {
                Button button = new Button(parent, SWT.PUSH);
                button.setFont(parent.getFont());
                button.setText(label);
                button.addSelectionListener(listener);
                GridData gd = new GridData();
                gd.horizontalAlignment = GridData.FILL;
                gd.grabExcessHorizontalSpace = true;
                gd.verticalAlignment = GridData.BEGINNING;
                gd.widthHint = SWTUtil.getButtonWidthHint(button);

                button.setLayoutData(gd);
                return button;
        }

        private Label createSeparator(Composite parent) {
                Label separator = new Label(parent, SWT.NONE);
                separator.setFont(parent.getFont());
                separator.setVisible(false);
                GridData gd = new GridData();
                gd.horizontalAlignment = GridData.FILL;
                gd.verticalAlignment = GridData.BEGINNING;
                gd.heightHint = 4;
                separator.setLayoutData(gd);
                return separator;
        }

        /**
        * Returns the composite containing the buttons. When called the first time, the control
        * will be created.
        * @param parent The parent composite when called the first time, or <code>null</code>
        * after.
        */
        public Composite getButtonBox(Composite parent) {
                if (fButtonsControl == null) {
                        assertCompositeNotNull(parent);

                        SelectionListener listener = new SelectionListener() {
                                 public void widgetDefaultSelected(SelectionEvent e) {
                                         doButtonSelected(e);
                                 }

                                 public void widgetSelected(SelectionEvent e) {
                                         doButtonSelected(e);
                                 }
                                                     };
                        Composite contents = new Composite(parent, SWT.NONE);
                        contents.setFont(parent.getFont());

                        GridLayout layout = new GridLayout();
                        layout.marginWidth = 0;
                        layout.marginHeight = 0;
                        contents.setLayout(layout);

                        if (fButtonLabels != null) {
                                fButtonControls = new Button[fButtonLabels.length];
                                for (int i = 0; i < fButtonLabels.length; i++) {
                                        String currLabel = fButtonLabels[i];
                                        if (currLabel != null) {
                                                fButtonControls[i] = createButton(contents, currLabel, listener);
                                                fButtonControls[i].setEnabled(isEnabled() && fButtonsEnabled[i]);
                                        }
                                        else   {
                                                fButtonControls[i] = null;
                                                createSeparator(contents);
                                        }
                                }
                        }
                        fLastSeparator = createSeparator(contents);

                        updateButtonState();
                        fButtonsControl = contents;
                }

                return fButtonsControl;
        }

        private void doButtonSelected(SelectionEvent e) {
                if (fButtonControls != null) {
                        for (int i = 0; i < fButtonControls.length; i++) {
                                if (e.widget == fButtonControls[i]) {
                                        buttonPressed(i);
                                        return;
                                }
                        }
                }
        }


Clone AbstractionParameter Count: 2Parameter Bindings

protected Button createButton(Composite parent, String label, SelectionListener listener) {
  Button button = new Button(parent, SWT.PUSH);
  button.setFont(parent.getFont());
  button.setText(label);
  button.addSelectionListener(listener);
  GridData gd = new GridData();
  gd.horizontalAlignment = GridData.FILL;
  gd.grabExcessHorizontalSpace = true;
  gd.verticalAlignment = GridData.BEGINNING;
  gd.widthHint = SWTUtil.getButtonWidthHint(button);
  button.setLayoutData(gd);
  return button;
}

private Label createSeparator(Composite parent) {
  Label separator = new Label(parent,  [[#variable616de340]]);
  separator.setFont(parent.getFont());
  separator.setVisible(false);
  GridData gd = new GridData();
  gd.horizontalAlignment = GridData.FILL;
  gd.verticalAlignment = GridData.BEGINNING;
  gd. [[#variable616dfb20]]= 4;
  separator.setLayoutData(gd);
  return separator;
}

/**
         * Returns the composite containing the buttons. When called the first time, the control
         * will be created.
         * @param parent The parent composite when called the first time, or <code>null</code>
         * after.
         */
/**
        * Returns the composite containing the buttons. When called the first time, the control
        * will be created.
        * @param parent The parent composite when called the first time, or <code>null</code>
        * after.
        */
public Composite getButtonBox(Composite parent) {
  if (fButtonsControl == null) {
    assertCompositeNotNull(parent);
    SelectionListener listener = new SelectionListener() {
                                   public void widgetDefaultSelected(SelectionEvent e) {
                                     doButtonSelected(e);
                                   }

                                   public void widgetSelected(SelectionEvent e) {
                                     doButtonSelected(e);
                                   }
                                 };
    Composite contents = new Composite(parent, SWT.NONE);
    contents.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    contents.setLayout(layout);
    if (fButtonLabels != null) {
      fButtonControls = new Button[fButtonLabels.length];
      for (int i = 0; i < fButtonLabels.length; i++) {
        String currLabel = fButtonLabels[i];
        if (currLabel != null) {
          fButtonControls[i] = createButton(contents, currLabel, listener);
          fButtonControls[i].setEnabled(isEnabled() && fButtonsEnabled[i]);
        }
        else {
          fButtonControls[i] = null;
          createSeparator(contents);
        }
      }
    }
    fLastSeparator = createSeparator(contents);
    updateButtonState();
    fButtonsControl = contents;
  }
  return fButtonsControl;
}

private void doButtonSelected(SelectionEvent e) {
  if (fButtonControls != null) {
    for (int i = 0; i < fButtonControls.length; i++) {
      if (e.widget == fButtonControls[i]) {
        buttonPressed(i);
        return;
      }
    }
  }
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#616de340]]
SWT.SEPARATOR|SWT.HORIZONTAL 
12[[#616de340]]
SWT.NONE 
21[[#616dfb20]]
verticalIndent 
22[[#616dfb20]]
heightHint