From 99f5c1b2bde21472fbc377461d1139e62880a7f4 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Wed, 14 Jun 2006 15:53:25 +0000 Subject: [PATCH] small bug fixes --- .../UniversalPreferencePage.java | 75 ++++++++++--------- .../UniversalFileTransferUtility.java | 7 +- .../dstore/shell/DStoreShellThread.java | 31 +++++++- 3 files changed, 73 insertions(+), 40 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/UniversalPreferencePage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/UniversalPreferencePage.java index a208feb1cfa..6d936428de5 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/UniversalPreferencePage.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/UniversalPreferencePage.java @@ -776,45 +776,46 @@ public class UniversalPreferencePage public boolean performOk() { super.performOk(); - - // first save the transfer mode registry - Object[] array1 = modeMappings.toArray(); - SystemFileTransferModeMapping[] mappingArray1 = new SystemFileTransferModeMapping[array1.length]; - - for (int i = 0; i < array1.length; i++) { - mappingArray1[i] = (SystemFileTransferModeMapping)(array1[i]); - } + if (modeMappings != null) + { + // first save the transfer mode registry + Object[] array1 = modeMappings.toArray(); + SystemFileTransferModeMapping[] mappingArray1 = new SystemFileTransferModeMapping[array1.length]; - modeRegistry.setModeMappings(mappingArray1); - modeRegistry.saveAssociations(); - - // then save the editor registry - Object[] array2 = editorMappings.toArray(); - FileEditorMapping[] mappingArray2 = new FileEditorMapping[array2.length]; - - for (int j = 0; j < array2.length; j++) { - mappingArray2[j] = (FileEditorMapping)(array2[j]); + for (int i = 0; i < array1.length; i++) { + mappingArray1[i] = (SystemFileTransferModeMapping)(array1[i]); + } + + modeRegistry.setModeMappings(mappingArray1); + modeRegistry.saveAssociations(); + + // then save the editor registry + Object[] array2 = editorMappings.toArray(); + FileEditorMapping[] mappingArray2 = new FileEditorMapping[array2.length]; + + for (int j = 0; j < array2.length; j++) { + mappingArray2[j] = (FileEditorMapping)(array2[j]); + } + + ((EditorRegistry)editorRegistry).setFileEditorMappings(mappingArray2); + ((EditorRegistry)editorRegistry).saveAssociations(); + + // editorRegistry.removePropertyListener(this); + int defaultFileTransferMode = ISystemPreferencesConstants.FILETRANSFERMODE_BINARY; + if (defaultBinaryButton.getSelection()) + { + defaultFileTransferMode = ISystemPreferencesConstants.FILETRANSFERMODE_BINARY; + } + else + { + defaultFileTransferMode = ISystemPreferencesConstants.FILETRANSFERMODE_TEXT; + } + setFileTransferModeDefaultPreference(defaultFileTransferMode); + setDoSuperTransfer(doSuperTransferButton.getSelection()); + setSuperTransferTypePreference(archiveTypeCombo.getText()); + setDownloadBufferSize(downloadBufferSize.getText()); + setUploadBufferSize(uploadBufferSize.getText()); } - - ((EditorRegistry)editorRegistry).setFileEditorMappings(mappingArray2); - ((EditorRegistry)editorRegistry).saveAssociations(); - - // editorRegistry.removePropertyListener(this); - int defaultFileTransferMode = ISystemPreferencesConstants.FILETRANSFERMODE_BINARY; - if (defaultBinaryButton.getSelection()) - { - defaultFileTransferMode = ISystemPreferencesConstants.FILETRANSFERMODE_BINARY; - } - else - { - defaultFileTransferMode = ISystemPreferencesConstants.FILETRANSFERMODE_TEXT; - } - setFileTransferModeDefaultPreference(defaultFileTransferMode); - setDoSuperTransfer(doSuperTransferButton.getSelection()); - setSuperTransferTypePreference(archiveTypeCombo.getText()); - setDownloadBufferSize(downloadBufferSize.getText()); - setUploadBufferSize(uploadBufferSize.getText()); - return true; } diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java index 58345da0ffd..b27f4adcd5e 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java @@ -399,13 +399,18 @@ public class UniversalFileTransferUtility { if (PlatformUI.isWorkbenchRunning()) { - tempFile.refreshLocal(IResource.DEPTH_ONE, monitor); + if (!tempFile.isSynchronized(IResource.DEPTH_ZERO)) + tempFile.refreshLocal(IResource.DEPTH_ZERO, monitor); } } catch (CoreException e) { e.printStackTrace(); } + catch (Exception e) + { + e.printStackTrace(); + } } tempFile = (IFile) getTempFileFor(srcFileOrFolder); diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/shell/DStoreShellThread.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/shell/DStoreShellThread.java index e62152986d6..98ad33e2ea4 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/shell/DStoreShellThread.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/shell/DStoreShellThread.java @@ -41,6 +41,7 @@ public class DStoreShellThread private String[] _envVars; private DataStore _dataStore; private DataElement _status; + private String _invocation; /** * @param cwd initial working directory @@ -56,6 +57,7 @@ public class DStoreShellThread _encoding = encoding; _cwd = cwd; _envVars = envVars; + _invocation = invocation; init(); } @@ -65,8 +67,15 @@ public class DStoreShellThread DataElement contextDir = _dataStore.createObject(null, "directory", (new File(_cwd)).getName(), _cwd); _dataStore.setObject(contextDir); setRemoteEnvironment(contextDir); - - sendShellToMiner(contextDir); + if (_invocation== null || _invocation.equals(">")) + { + sendShellToMiner(contextDir); + } + else + { + sendCommandToMiner(contextDir, _invocation); + + } } public DataElement getStatus() @@ -93,6 +102,24 @@ public class DStoreShellThread } } + protected void sendCommandToMiner(DataElement contextDir, String invocation) + { + DataElement cmdD = getRunCommandDescriptor(contextDir); + + if (cmdD != null) + { + + if (invocation != null && invocation.length() > 0) + { + DataElement arg = _dataStore.createObject(null, "command", invocation); + _status = _dataStore.command(cmdD, arg, contextDir); + } + else + { + _status = _dataStore.command(cmdD, contextDir); + } + } + } /** * Set the environment variables for this connection. For universal this sets them in the * DataStore tree. When a new shell is launched the environment variables are passed to the