Bug 3926 issue copying file with duplicate name (1GF60YK)
I tried to copy a package.html file from one package to another using the "copy" menu entry in the packages view. The destination package already had a file called package.html so I was presented with a "Duplicate names" dialog. The dialog has two radio buttons, one for "replace element" and one for "rename to". Issues: - The replace button is grayed out - "Rename to" is ambiguous. Am I renaming the thing being copied or the file already at the destination. Since I actually wanted to overwrite the file and the rename renames the file being copied, I could not accomplish the task. Note that the copy action from the navigator works as desired. NOTES: KH (6/12/2001 7:11:31 AM) Moving to JUI for comment.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/reorg/JdtMoveAction.java
for (Iterator iter= elements.iterator(); iter.hasNext(); ){
			Object o= iter.next();
			int action= askIfOverwrite(ReorgUtils.getName(o));
			if (action == IDialogConstants.CANCEL_ID)
				return null;
			if (action == IDialogConstants.YES_TO_ALL_ID)	
				return new HashSet(0); 
			if (action == IDialogConstants.NO_ID)		
				result.add(o);	
		}
		return result;
	}
	
	private static int askIfOverwrite(String elementName){
		Shell shell= JavaPlugin.getActiveWorkbenchShell().getShell();
		String title= ReorgMessages.getString("JdtMoveAction.move"); 
		String question= ReorgMessages.getFormattedString("JdtMoveAction.overwrite", elementName);
		
		String[] labels= new String[] {IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
															 IDialogConstants.NO_LABEL,  IDialogConstants.CANCEL_LABEL };
		final MessageDialog dialog = new MessageDialog(shell,	title, null, question, MessageDialog.QUESTION,	labels,  0);
		shell.getDisplay().syncExec(new Runnable() {
			public void run() {
				dialog.open();
			}
		});
		int result = dialog.getReturnCode();
		if (result == 0)
			return IDialogConstants.YES_ID;
		if (result == 1)