public void generate(Shell parentShell, IType objectClass) {

        IMethod existingEquals = objectClass.getMethod("equals",
                new String[] { "QObject;" });
        IMethod existingHashCode = objectClass.getMethod("hashCode",
                new String[0]);
        Set excludedMethods = new HashSet();
        if (existingEquals.exists()) {
            excludedMethods.add(existingEquals);
        }
        if (existingHashCode.exists()) {
            excludedMethods.add(existingHashCode);
        }
        try {
            IField[] fields;
            if (PreferenceUtils.getDisplayFieldsOfSuperclasses()) {
                fields = JavaUtils
                        .getNonStaticNonCacheFieldsAndAccessibleNonStaticFieldsOfSuperclasses(objectClass);
            } else {
                fields = JavaUtils.getNonStaticNonCacheFields(objectClass);
            }

            boolean disableAppendSuper = JavaUtils
                    .isDirectSubclassOfObject(objectClass)
                    || !JavaUtils.isEqualsOverriddenInSuperclass(objectClass)
                    || !JavaUtils.isHashCodeOverriddenInSuperclass(objectClass);

            EqualsHashCodeDialog dialog = new EqualsHashCodeDialog(parentShell,
                    "Generate Equals and HashCode", objectClass, fields,
                    excludedMethods, disableAppendSuper);
            int returnCode = dialog.open();
            if (returnCode == Window.OK) {

                if (existingEquals.exists()) {
                    existingEquals.delete(true, null);
                }
                if (existingHashCode.exists()) {
                    existingHashCode.delete(true, null);
                }

                IField[] checkedFields = dialog.getCheckedFields();
                IJavaElement insertPosition = dialog.getElementPosition();
                boolean appendSuper = dialog.getAppendSuper();
                boolean generateComment = dialog.getGenerateComment();
                boolean compareReferences = dialog.getCompareReferences();
                boolean useGettersInsteadOfFields = dialog.getUseGettersInsteadOfFields();
                IInitMultNumbers imNumbers = dialog.getInitMultNumbers();

                IJavaElement created = generateHashCode(parentShell,
                        objectClass, checkedFields, insertPosition,
                        appendSuper, generateComment, imNumbers,
                        useGettersInsteadOfFields);

                created = generateEquals(parentShell, objectClass,
                        checkedFields, created, appendSuper, generateComment,
                        compareReferences, useGettersInsteadOfFields);

                ICompilationUnit cu = objectClass.getCompilationUnit();
                IEditorPart javaEditor = JavaUI.openInEditor(cu);
                JavaUI.revealInEditor(javaEditor, (IJavaElement) created);
            }

        } catch (CoreException e) {
            MessageDialog.openError(parentShell, "Method Generation Failed", e
                    .getMessage());
        }

    }