final MessageDialog message= new MessageDialog(getShell(), RefactoringUIMessages.ChangeExceptionHandler_refactoring, null, RefactoringUIMessages.ExportRefactoringHistoryControl_file_overwrite_query, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
final MessageDialog message= new MessageDialog(getShell(), RefactoringUIMessages.ChangeExceptionHandler_refactoring, null, Messages.format(RefactoringUIMessages.ExportRefactoringHistoryControl_file_overwrite_query, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}, 0);
	private void handleExport(final String caption, final RefactoringDescriptorProxy[] proxies) {		Assert.isNotNull(caption);		Assert.isNotNull(proxies);		RefactoringDescriptorProxy[] writable= proxies;		final FileDialog dialog= new FileDialog(getShell(), SWT.SAVE);		dialog.setText(caption);		dialog.setFilterNames(new String[] { RefactoringUIMessages.ExportRefactoringHistoryControl_file_filter_name, RefactoringUIMessages.ExportRefactoringHistoryControl_wildcard_filter_name });		dialog.setFilterExtensions(new String[] { RefactoringUIMessages.ExportRefactoringHistoryControl_file_filter_extension, RefactoringUIMessages.ExportRefactoringHistoryControl_wildcard_filter_extension });		dialog.setFileName(RefactoringUIMessages.ExportRefactoringHistoryControl_file_default_name);		final String path= dialog.open();		if (path != null) {			final File file= new File(path);			if (file.exists()) {				final MessageDialog message= new MessageDialog(getShell(), RefactoringUIMessages.ChangeExceptionHandler_refactoring, null, RefactoringUIMessages.ExportRefactoringHistoryControl_file_overwrite_query, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL}, 0);				final int result= message.open();				if (result == 0) {					InputStream stream= null;					try {						stream= new BufferedInputStream(new FileInputStream(file));						final RefactoringDescriptorProxy[] existing= RefactoringCore.getRefactoringHistoryService().readRefactoringHistory(stream, RefactoringDescriptor.NONE).getDescriptors();						final Set set= new HashSet();						for (int index= 0; index < existing.length; index++)							set.add(existing[index]);						for (int index= 0; index < proxies.length; index++)							set.add(proxies[index]);						writable= new RefactoringDescriptorProxy[set.size()];						set.toArray(writable);					} catch (FileNotFoundException exception) {						MessageDialog.openError(getShell(), RefactoringUIMessages.ChangeExceptionHandler_refactoring, exception.getLocalizedMessage());					} catch (CoreException exception) {						final Throwable throwable= exception.getStatus().getException();						if (throwable instanceof IOException)							MessageDialog.openError(getShell(), RefactoringUIMessages.ChangeExceptionHandler_refactoring, throwable.getLocalizedMessage());						else							RefactoringUIPlugin.log(exception);					} finally {						if (stream != null) {							try {								stream.close();							} catch (IOException exception) {								// Do nothing							}						}					}				} else if (result == 2)					return;			}			OutputStream stream= null;			try {				stream= new BufferedOutputStream(new FileOutputStream(file));				Arrays.sort(writable, new Comparator() {					public final int compare(final Object first, final Object second) {						final RefactoringDescriptorProxy predecessor= (RefactoringDescriptorProxy) first;						final RefactoringDescriptorProxy successor= (RefactoringDescriptorProxy) second;						return (int) (predecessor.getTimeStamp() - successor.getTimeStamp());					}				});				RefactoringCore.getRefactoringHistoryService().writeRefactoringDescriptors(writable, stream, RefactoringDescriptor.NONE, new NullProgressMonitor());			} catch (CoreException exception) {				final Throwable throwable= exception.getStatus().getException();				if (throwable instanceof IOException)					MessageDialog.openError(getShell(), RefactoringUIMessages.ChangeExceptionHandler_refactoring, throwable.getLocalizedMessage());				else					RefactoringUIPlugin.log(exception);			} catch (FileNotFoundException exception) {				MessageDialog.openError(getShell(), RefactoringUIMessages.ChangeExceptionHandler_refactoring, exception.getLocalizedMessage());			} finally {				if (stream != null) {					try {						stream.close();					} catch (IOException exception) {						// Do nothing					}				}			}		}	}