final Set set= new HashSet(Arrays.asList(fCandidateTypes)); set.removeAll(fTypesToExtract); if (!set.isEmpty()) {
final LinkedList list= new LinkedList(Arrays.asList(fCandidateTypes)); for (final Iterator outer= list.iterator(); outer.hasNext();) { final IType first= (IType) outer.next(); for (final Iterator inner= fTypesToExtract.iterator(); inner.hasNext();) { final IType second= (IType) inner.next(); if (second.getFullyQualifiedName().equals(first.getFullyQualifiedName())) outer.remove(); } } if (!list.isEmpty()) {
	protected void createButtonComposite(final Composite parent) {		final Composite buttons= new Composite(parent, SWT.NONE);		final GridLayout layout= new GridLayout();		layout.marginHeight= 0;		layout.marginWidth= 0;		buttons.setLayout(layout);		buttons.setLayoutData(new GridData(GridData.FILL_VERTICAL));		final Button addButton= new Button(buttons, SWT.PUSH);		addButton.setText(RefactoringMessages.ExtractSupertypeMemberPage_add_button_label);		addButton.setEnabled(isAddTypeEnabled());		addButton.setLayoutData(new GridData());		SWTUtil.setButtonDimensionHint(addButton);		addButton.addSelectionListener(new SelectionAdapter() {			public void widgetSelected(final SelectionEvent event) {				final Set set= new HashSet(Arrays.asList(fCandidateTypes));				set.removeAll(fTypesToExtract);				if (!set.isEmpty()) {					final SupertypeSelectionDialog dialog= new SupertypeSelectionDialog(getShell());					dialog.create();					dialog.setInput(set.toArray());					final int result= dialog.open();					if (result == Window.OK) {						final Object[] objects= dialog.getResult();						for (int index= 0; index < objects.length; index++) {							fTypesToExtract.add(objects[index]);						}						fTableViewer.setInput(fTypesToExtract.toArray());						addButton.setEnabled(isAddTypeEnabled());						handleTypesChanged();					}				}			}		});		final Button removeButton= new Button(buttons, SWT.PUSH);		removeButton.setText(RefactoringMessages.ExtractSupertypeMemberPage_remove_button_label);		removeButton.setEnabled(fCandidateTypes.length > 0 && !fTableViewer.getSelection().isEmpty());		removeButton.setLayoutData(new GridData());		SWTUtil.setButtonDimensionHint(removeButton);		removeButton.addSelectionListener(new SelectionAdapter() {			public void widgetSelected(final SelectionEvent event) {				final IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection();				if (!selection.isEmpty()) {					final IType declaring= getDeclaringType();					for (final Iterator iterator= selection.iterator(); iterator.hasNext();) {						final Object element= iterator.next();						if (!declaring.equals(element))							fTypesToExtract.remove(element);					}					fTableViewer.setInput(fTypesToExtract.toArray());					addButton.setEnabled(isAddTypeEnabled());					handleTypesChanged();				}			}		});		fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {			public void selectionChanged(final SelectionChangedEvent event) {				final IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection();				if (selection.isEmpty()) {					removeButton.setEnabled(false);					return;				} else {					final Object[] elements= selection.toArray();					if (elements.length == 1 && elements[0].equals(getDeclaringType())) {						removeButton.setEnabled(false);						return;					}				}				removeButton.setEnabled(true);			}		});	}