diff options
| author | Markus Keller | 2014-07-16 18:24:08 +0000 |
|---|---|---|
| committer | Markus Keller | 2014-07-16 18:24:53 +0000 |
| commit | 5420fb1b4fc1a364dee872c2f469c8712e2b5e5e (patch) | |
| tree | 5b9b140049adfc5b9a06a089b9a8d1ed06e8eada | |
| parent | 708bfddad74e7ddcdd83db1ffe6dba1ef707020a (diff) | |
| download | eclipse.platform.ui-5420fb1b4fc1a364dee872c2f469c8712e2b5e5e.tar.gz eclipse.platform.ui-5420fb1b4fc1a364dee872c2f469c8712e2b5e5e.tar.xz eclipse.platform.ui-5420fb1b4fc1a364dee872c2f469c8712e2b5e5e.zip | |
Bug 437398: [ccp] Don't select extension when asking for new file name on pasteI20140722-0800
| -rw-r--r-- | bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java index 5dcd705a1c1..05e9ec9cc72 100644 --- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java +++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -53,6 +53,8 @@ import org.eclipse.jface.window.Window; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -1122,15 +1124,25 @@ public class CopyFilesAndFoldersOperation { } }; + final String initial = getAutoNewNameFor(originalName, workspace).lastSegment().toString(); InputDialog dialog = new InputDialog( messageShell, IDEWorkbenchMessages.CopyFilesAndFoldersOperation_inputDialogTitle, NLS .bind( IDEWorkbenchMessages.CopyFilesAndFoldersOperation_inputDialogMessage, - resource.getName()), getAutoNewNameFor( - originalName, workspace).lastSegment() - .toString(), validator); + resource.getName()), initial, validator) { + + @Override + protected Control createContents(Composite parent) { + Control contents= super.createContents(parent); + int lastIndexOfDot= initial.lastIndexOf('.'); + if (resource instanceof IFile && lastIndexOfDot > 0) { + getText().setSelection(0, lastIndexOfDot); + } + return contents; + } + }; dialog.setBlockOnOpen(true); dialog.open(); if (dialog.getReturnCode() == Window.CANCEL) { |
