From b32a66fc95762e1d4bb609214dbc14b1115414ae Mon Sep 17 00:00:00 2001 From: John Eblen Date: Tue, 15 Jul 2014 13:59:36 -0400 Subject: [PATCH 1/5] Bug 439607 - Can't delete directories from synchronized projects Change-Id: I3b8a8aeef6200a92fd5623c259060c3031836809 Signed-off-by: John Eblen --- .../eclipse/remote/internal/jsch/core/JSchProcessBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcessBuilder.java b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcessBuilder.java index 5233ae6584d..7b6bc9fea6f 100644 --- a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcessBuilder.java +++ b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchProcessBuilder.java @@ -194,7 +194,7 @@ public class JSchProcessBuilder extends AbstractRemoteProcessBuilder { private String buildCommand(String cmd, List environment, boolean clearEnv) { StringBuffer sb = new StringBuffer(); if (directory() != null) { - sb.append("cd " + charEscapify(directory().toURI().getPath(), charSet) + "; "); //$NON-NLS-1$ //$NON-NLS-2$ + sb.append("cd " + charEscapify(directory().toURI().getPath(), charSet) + " && "); //$NON-NLS-1$ //$NON-NLS-2$ } if (clearEnv) { sb.append("env -i"); //$NON-NLS-1$ From e87bfd839e53f1739898696334d506c5e04e7e04 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Wed, 23 Jul 2014 09:36:53 +0300 Subject: [PATCH 2/5] Fix build. 4.4milestones repo is gone now and in order to use final 4.4 Tycho 0.20 is needed. Also ignore target/ dirs to get sane output of git status. Change-Id: Iab3a807645c9fce737de5e5a8239d89d0c63eaf3 Signed-off-by: Alexander Kurtakov --- .gitignore | 1 + releng/org.eclipse.remote.build/pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..2f7896d1d13 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/releng/org.eclipse.remote.build/pom.xml b/releng/org.eclipse.remote.build/pom.xml index 5b4d27f9ce5..fc4f0a03159 100644 --- a/releng/org.eclipse.remote.build/pom.xml +++ b/releng/org.eclipse.remote.build/pom.xml @@ -16,9 +16,9 @@ luna - 0.19.0 + 0.20.0 ${tycho-version} - 4.4milestones + 4.4 http://download.eclipse.org/eclipse/updates/${platform-version} 8.4 http://download.eclipse.org/tools/cdt/builds/${cdt-version}/nightly From f2be7491534ba78f88812234996ad23a4610dd6c Mon Sep 17 00:00:00 2001 From: Greg Watson Date: Fri, 1 Aug 2014 11:34:21 -0400 Subject: [PATCH 3/5] Bug 440993 - return a file store for #getStore(IPath) Change-Id: I1f39423a8b667c001c8dec8e4914396546536e64 Signed-off-by: Greg Watson --- .../internal/jsch/core/JSchFileManager.java | 7 ++++++- .../internal/jsch/core/JSchFileSystem.java | 20 +++++++++---------- .../internal/jsch/core/JschFileStore.java | 7 +++---- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileManager.java b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileManager.java index f633b13f951..fb4ea90eee2 100644 --- a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileManager.java +++ b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileManager.java @@ -33,6 +33,7 @@ public class JSchFileManager implements IRemoteFileManager { /** * @since 4.0 */ + @Override public String getDirectorySeparator() { return "/"; //$NON-NLS-1$ } @@ -44,12 +45,13 @@ public class JSchFileManager implements IRemoteFileManager { * org.eclipse.remote.core.IRemoteFileManager#getResource(java.lang. * String) */ + @Override public IFileStore getResource(String pathStr) { IPath path = new Path(pathStr); if (!path.isAbsolute()) { path = new Path(fConnection.getWorkingDirectory()).append(path); } - return new JschFileStore(JSchFileSystem.getURIFor(fConnection.getName(), path.toString())); + return JschFileStore.getInstance(JSchFileSystem.getURIFor(fConnection.getName(), path.toString())); } /* @@ -57,6 +59,7 @@ public class JSchFileManager implements IRemoteFileManager { * * @see org.eclipse.remote.core.IRemoteFileManager#toPath(java.net.URI) */ + @Override public String toPath(URI uri) { return uri.getPath(); } @@ -68,6 +71,7 @@ public class JSchFileManager implements IRemoteFileManager { * org.eclipse.remote.core.IRemoteFileManager#toURI(org.eclipse.core * .runtime.IPath) */ + @Override public URI toURI(IPath path) { try { return JSchFileSystem.getURIFor(fConnection.getName(), path.toString()); @@ -82,6 +86,7 @@ public class JSchFileManager implements IRemoteFileManager { * @see * org.eclipse.remote.core.IRemoteFileManager#toURI(java.lang.String) */ + @Override public URI toURI(String path) { return toURI(new Path(path)); } diff --git a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileSystem.java b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileSystem.java index 98a388fe608..2343b18b789 100644 --- a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileSystem.java +++ b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JSchFileSystem.java @@ -99,6 +99,16 @@ public class JSchFileSystem extends FileSystem { return true; } + /* + * (non-Javadoc) + * + * @see org.eclipse.core.filesystem.provider.FileSystem#getStore(org.eclipse.core.runtime.IPath) + */ + @Override + public IFileStore getStore(IPath path) { + return EFS.getNullFileSystem().getStore(path); + } + /* * (non-Javadoc) * @@ -115,14 +125,4 @@ public class JSchFileSystem extends FileSystem { return EFS.getNullFileSystem().getStore(uri); } } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.filesystem.provider.FileSystem#getStore(org.eclipse.core.runtime.IPath) - */ - @Override - public IFileStore getStore(IPath path) { - return null; - } } \ No newline at end of file diff --git a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JschFileStore.java b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JschFileStore.java index 6493afa25e6..d7af7c41e2f 100644 --- a/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JschFileStore.java +++ b/bundles/org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core/JschFileStore.java @@ -44,8 +44,6 @@ import org.eclipse.remote.internal.jsch.core.commands.PutInfoCommand; import org.eclipse.remote.internal.jsch.core.messages.Messages; public class JschFileStore extends FileStore { - private static Map instanceMap = new HashMap(); - /** * Public factory method for obtaining JschFileStore instances. * @@ -64,11 +62,12 @@ public class JschFileStore extends FileStore { } } - // private final JSchConnection fConnection; + private static Map instanceMap = new HashMap(); + private final IPath fRemotePath; private final URI fURI; - public JschFileStore(URI uri) { + private JschFileStore(URI uri) { fURI = uri; fRemotePath = new Path(uri.getPath()); } From 64c0a2dc84f99ff4894fc7b23a60233990df72c2 Mon Sep 17 00:00:00 2001 From: Greg Watson Date: Tue, 12 Aug 2014 23:09:16 -0400 Subject: [PATCH 4/5] Bug 441597 - Add new folder name dialog Change-Id: I0128deb7a3c6dffef846cd358b77676703532e34 Signed-off-by: Greg Watson --- .../remote/internal/ui/messages/Messages.java | 10 ++ .../internal/ui/messages/messages.properties | 5 + .../widgets/RemoteResourceBrowserWidget.java | 131 +++++++++++++++++- 3 files changed, 139 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/messages/Messages.java b/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/messages/Messages.java index 3537ba51632..dc1fdfaa24f 100644 --- a/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/messages/Messages.java +++ b/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/messages/Messages.java @@ -96,6 +96,16 @@ public class Messages extends NLS { public static String RemoteResourceBrowser_Show_hidden_files; public static String RemoteResourceBrowser_UpOneLevel; + public static String RemoteResourceBrowserWidget_0; + + public static String RemoteResourceBrowserWidget_1; + + public static String RemoteResourceBrowserWidget_2; + + public static String RemoteResourceBrowserWidget_3; + + public static String RemoteResourceBrowserWidget_4; + public static String RemoteResourceBrowserWidget_New_Folder; public static String RemoteResourceBrowserWidget_Unable_to_create_new_folder; diff --git a/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/messages/messages.properties b/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/messages/messages.properties index ec5132aa7ed..9c2f74a5453 100644 --- a/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/messages/messages.properties +++ b/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/internal/ui/messages/messages.properties @@ -57,6 +57,11 @@ RemoteResourceBrowser_newConnection=New... RemoteResourceBrowser_NewFolder=New folder RemoteResourceBrowser_Show_hidden_files=Show hidden files RemoteResourceBrowser_UpOneLevel=Up one level +RemoteResourceBrowserWidget_0=validate input +RemoteResourceBrowserWidget_1=Enter Folder Name +RemoteResourceBrowserWidget_2=Folder name: +RemoteResourceBrowserWidget_3=Folder already exists +RemoteResourceBrowserWidget_4=Please enter a folder name RemoteResourceBrowserWidget_New_Folder=New Folder RemoteResourceBrowserWidget_Unable_to_create_new_folder=Unable to create new folder RemoteUIServices_Configuring_remote_services=Configuring remote services... diff --git a/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteResourceBrowserWidget.java b/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteResourceBrowserWidget.java index c75498445f4..7ed2626699f 100644 --- a/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteResourceBrowserWidget.java +++ b/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteResourceBrowserWidget.java @@ -19,10 +19,15 @@ import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.operation.IRunnableWithProgress; @@ -56,10 +61,12 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.model.WorkbenchLabelProvider; +import org.eclipse.ui.progress.UIJob; /** * Generic file/directory browser for remote resources. @@ -68,6 +75,72 @@ import org.eclipse.ui.model.WorkbenchLabelProvider; * */ public class RemoteResourceBrowserWidget extends Composite { + /** + * Delayed input dialog uses {@link ValidateJob} to create an InputDialog that only validates it's text field after an + * appropriate timeout has occurred. This is to prevent excessive network traffic when checking the existence of a remote + * directory on a target system. + * + * Due to the timing of the validation, it is possible to close the dialog prior to the validation completing. However since the + * validation is only used to check for the existence of a remote file/directory, the worst that can happen is that the user + * will not be notified that the directory already exists. + * + */ + private class DelayedInputDialog extends InputDialog { + public DelayedInputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, + IInputValidator validator) { + super(parentShell, dialogTitle, dialogMessage, initialValue, validator); + } + + @Override + protected void buttonPressed(int buttonId) { + /* + * Cancel the job as soon as the dialog is closed to avoid SWTException + */ + fValidateJob.cancel(); + super.buttonPressed(buttonId); + } + + protected void doValidate() { + super.validateInput(); + } + + @Override + protected void validateInput() { + fValidateJob.cancel(); + if (!getText().getText().equals("")) { //$NON-NLS-1$ + fValidateJob.schedule(VALIDATE_DELAY); + } else { + super.validateInput(); + } + } + } + + /** + * Validation job that will call the {@link DelayedInputDialog#doValidate()} method when run. The job should be scheduled with a + * delay to limit the frequency of validation. + */ + private class ValidateJob extends UIJob { + private DelayedInputDialog fDialog; + + public ValidateJob() { + super(Messages.RemoteResourceBrowserWidget_0); + setSystem(true); + } + + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + fDialog.doValidate(); + return Status.OK_STATUS; + } + + public void setDialog(DelayedInputDialog dialog) { + fDialog = dialog; + } + } + + private static final int VALIDATE_DELAY = 100; + private final ValidateJob fValidateJob = new ValidateJob(); + /** * Browse for files */ @@ -409,7 +482,7 @@ public class RemoteResourceBrowserWidget extends Composite { public void run(IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, 10); String baseName = "newfolder"; //$NON-NLS-1$ - IFileStore path = fConnection.getFileManager().getResource(parent); + final IFileStore path = fConnection.getFileManager().getResource(parent); IFileStore child = path.getChild(baseName); int count = 1; try { @@ -417,13 +490,57 @@ public class RemoteResourceBrowserWidget extends Composite { progress.setWorkRemaining(10); child = path.getChild(baseName + " (" + count++ + ")"); //$NON-NLS-1$//$NON-NLS-2$ } - if (!progress.isCanceled()) { - child.mkdir(EFS.SHALLOW, progress.newChild(10)); - name[0] = child.getName(); + } catch (final CoreException e) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + ErrorDialog.openError(getShell(), Messages.RemoteResourceBrowserWidget_New_Folder, + Messages.RemoteResourceBrowserWidget_Unable_to_create_new_folder, e.getStatus()); + } + }); + } + final IFileStore basePath = child; + final String[] userPath = new String[1]; + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + DelayedInputDialog dialog = new DelayedInputDialog(getShell(), Messages.RemoteResourceBrowserWidget_1, + Messages.RemoteResourceBrowserWidget_2, basePath.getName(), new IInputValidator() { + @Override + public String isValid(String newText) { + if (!newText.equals("")) { //$NON-NLS-1$ + IFileStore newPath = path.getChild(newText); + if (newPath.fetchInfo().exists()) { + return Messages.RemoteResourceBrowserWidget_3; + } + } else { + return Messages.RemoteResourceBrowserWidget_4; + } + return null; + } + }); + fValidateJob.setDialog(dialog); + if (dialog.open() == Dialog.OK) { + userPath[0] = dialog.getValue(); + } + } + }); + if (userPath[0] != null) { + try { + IFileStore newPath = path.getChild(userPath[0]); + if (!progress.isCanceled()) { + newPath.mkdir(EFS.SHALLOW, progress.newChild(10)); + name[0] = newPath.getName(); + } + } catch (final CoreException e) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + ErrorDialog.openError(getShell(), Messages.RemoteResourceBrowserWidget_New_Folder, + Messages.RemoteResourceBrowserWidget_Unable_to_create_new_folder, e.getStatus()); + } + }); } - } catch (CoreException e) { - ErrorDialog.openError(getShell(), Messages.RemoteResourceBrowserWidget_New_Folder, - Messages.RemoteResourceBrowserWidget_Unable_to_create_new_folder, e.getStatus()); } } }; From 94a64a15796b84301257293de0a333a9755cfaae Mon Sep 17 00:00:00 2001 From: Greg Watson Date: Thu, 14 Aug 2014 14:03:03 -0500 Subject: [PATCH 5/5] Change build location. Change-Id: Iac282c66e9e0ef0adebc4f52eedf35329314f4d6 Signed-off-by: Greg Watson --- releng/org.eclipse.remote.build/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/releng/org.eclipse.remote.build/pom.xml b/releng/org.eclipse.remote.build/pom.xml index fc4f0a03159..9690f8c715c 100644 --- a/releng/org.eclipse.remote.build/pom.xml +++ b/releng/org.eclipse.remote.build/pom.xml @@ -15,6 +15,7 @@ Remote Parent + 1.0.1 luna 0.20.0 ${tycho-version} @@ -23,7 +24,7 @@ 8.4 http://download.eclipse.org/tools/cdt/builds/${cdt-version}/nightly http://download.eclipse.org/cbi/updates/license - /home/data/httpd/download.eclipse.org/tools/ptp/builds/remote/${eclipse-release}/nightly + /home/data/httpd/download.eclipse.org/tools/ptp/builds/remote/${remote-release}