diff options
author | Roberto Oliveira | 2015-05-21 18:20:15 +0000 |
---|---|---|
committer | Roberto Oliveira | 2015-06-01 10:54:22 +0000 |
commit | f349d010a3b47ab64409c23d5d145f4ed1f6d899 (patch) | |
tree | 9eef0784f9665bbf6d8ca020d84f4b2a8a2f3665 | |
parent | 3da0f1c84c525c2124ea0f145ea69794486daccc (diff) | |
download | org.eclipse.ptp-f349d010a3b47ab64409c23d5d145f4ed1f6d899.tar.gz org.eclipse.ptp-f349d010a3b47ab64409c23d5d145f4ed1f6d899.tar.xz org.eclipse.ptp-f349d010a3b47ab64409c23d5d145f4ed1f6d899.zip |
Bug 467629: Just autocomplete the remote directory field if no project was selected yet.
Change-Id: I58b8b80baa46cb5a711ed715548ecf9c77340371
Signed-off-by: Roberto Oliveira <rdutra@linux.vnet.ibm.com>
-rw-r--r-- | rdt/org.eclipse.ptp.rdt.sync.git.ui/src/org/eclipse/ptp/internal/rdt/sync/git/ui/GitParticipant.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/rdt/org.eclipse.ptp.rdt.sync.git.ui/src/org/eclipse/ptp/internal/rdt/sync/git/ui/GitParticipant.java b/rdt/org.eclipse.ptp.rdt.sync.git.ui/src/org/eclipse/ptp/internal/rdt/sync/git/ui/GitParticipant.java index c2e143fa3..3d361d2ff 100644 --- a/rdt/org.eclipse.ptp.rdt.sync.git.ui/src/org/eclipse/ptp/internal/rdt/sync/git/ui/GitParticipant.java +++ b/rdt/org.eclipse.ptp.rdt.sync.git.ui/src/org/eclipse/ptp/internal/rdt/sync/git/ui/GitParticipant.java @@ -30,6 +30,8 @@ import org.eclipse.remote.ui.IRemoteUIConstants; import org.eclipse.remote.ui.IRemoteUIFileService; import org.eclipse.remote.ui.widgets.RemoteConnectionWidget; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; @@ -48,6 +50,7 @@ import org.eclipse.swt.widgets.Text; */ public class GitParticipant extends AbstractSynchronizeParticipant { private static final String FILE_SCHEME = "file"; //$NON-NLS-1$ + private static final String EMPTY_STRING = ""; //$NON-NLS-1$ private IRemoteConnection fSelectedConnection; @@ -58,6 +61,9 @@ public class GitParticipant extends AbstractSynchronizeParticipant { private RemoteConnectionWidget fRemoteConnectionWidget; private IWizardContainer container; + private boolean fRemoteDirSelected; + private boolean fRemoteDirFocused; + // If false, automatically select "Remote Tools" provider instead of letting the user select the provider. private final boolean showProviderCombo = false; @@ -123,6 +129,20 @@ public class GitParticipant extends AbstractSynchronizeParticipant { // MBSCustomPageManager.addPageProperty(REMOTE_SYNC_WIZARD_PAGE_ID, // PATH_PROPERTY, fLocationText.getText()); update(); + if (fRemoteDirFocused) { + fRemoteDirSelected = true; + } + } + }); + // Listener to control where the focus is when the remote directory value is changed + fLocationText.addFocusListener(new FocusListener() { + @Override + public void focusLost(FocusEvent arg0) { + fRemoteDirFocused = false; + } + @Override + public void focusGained(FocusEvent arg0) { + fRemoteDirFocused = true; } }); handleConnectionSelected(); @@ -146,6 +166,7 @@ public class GitParticipant extends AbstractSynchronizeParticipant { "Project Location (" + fSelectedConnection.getName() + ")", correctPath, IRemoteUIConstants.NONE); //$NON-NLS-1$ //$NON-NLS-2$ if (selectedPath != null) { fLocationText.setText(selectedPath); + fRemoteDirSelected = true; } } } @@ -276,7 +297,14 @@ public class GitParticipant extends AbstractSynchronizeParticipant { @Override public void setProjectName(String projectName) { fProjectName = projectName; - fLocationText.setText(getDefaultPathDisplayString()); + // If remote directory field is empty + if(fLocationText.getText().equals(EMPTY_STRING)) { + fRemoteDirSelected = false; + } + // If remote directory was not selected yet + if (!fRemoteDirSelected) { + fLocationText.setText(getDefaultPathDisplayString()); + } } private void update() { |