CloneSet1026


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
20201.000class_body_declarations[2]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
120147
plugins/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/util/LayoutUtil.java
22077
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/SWTUtil.java
Clone Instance
1
Line Count
20
Source Line
147
Source File
plugins/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/util/LayoutUtil.java

        /**
         * Returns a width hint for a button control.
         * @param button        the button for which to set the dimension hint
         * @return the width hint
         */
        public static int getButtonWidthHint(Button button) {
                button.setFont(JFaceResources.getDialogFont());
                PixelConverter converter = new PixelConverter(button);
                int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
                return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
        }

        /**
         * Sets width and height hint for the button control.
         * <b>Note:</b> This is a NOP if the button's layout data is not
         * an instance of <code>GridData</code>.
         * 
         * @param button        the button for which to set the dimension hint
         */
        public static void setButtonDimensionHint(Button button) {
                Assert.isNotNull(button);
                Object gd = button.getLayoutData();
                if (gd instanceof GridData) {
                        ((GridData) gd).widthHint = getButtonWidthHint(button);
                        ((GridData) gd).horizontalAlignment = GridData.FILL;
                }
        }


Clone Instance
2
Line Count
20
Source Line
77
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/SWTUtil.java

        /**
         * Returns a width hint for a button control.
         */
        public static int getButtonWidthHint(Button button) {
                button.setFont(JFaceResources.getDialogFont());
                PixelConverter converter = new PixelConverter(button);
                int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
                return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
        }

        /**
         * Sets width and height hint for the button control.
         * <b>Note:</b> This is a NOP if the button's layout data is not
         * an instance of <code>GridData</code>.
         * 
         * @param button        the button for which to set the dimension hint
         */
        public static void setButtonDimensionHint(Button button) {
                Assert.isNotNull(button);
                Object gd = button.getLayoutData();
                if (gd instanceof GridData) {
                        ((GridData) gd).widthHint = getButtonWidthHint(button);
                        ((GridData) gd).horizontalAlignment = GridData.FILL;
                }
        }


Clone AbstractionParameter Count: 0Parameter Bindings

/**
         * Returns a width hint for a button control.
         * @param button        the button for which to set the dimension hint
         * @return the width hint
         */
/**
         * Returns a width hint for a button control.
         */
public static int getButtonWidthHint(Button button) {
  button.setFont(JFaceResources.getDialogFont());
  PixelConverter converter = new PixelConverter(button);
  int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
  return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}

/**
         * Sets width and height hint for the button control.
         * <b>Note:</b> This is a NOP if the button's layout data is not
         * an instance of <code>GridData</code>.
         * 
         * @param button        the button for which to set the dimension hint
         */
public static void setButtonDimensionHint(Button button) {
  Assert.isNotNull(button);
  Object gd = button.getLayoutData();
  if (gd instanceof GridData) {
    ((GridData) gd).widthHint = getButtonWidthHint(button);
    ((GridData) gd).horizontalAlignment = GridData.FILL;
  }
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
None