mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 23:25:26 +02:00
[312362] Editing Unix file after it changes on host edits old data
This commit is contained in:
parent
3327a757dd
commit
d134ffbfbc
3 changed files with 51 additions and 10 deletions
|
@ -17,6 +17,7 @@
|
|||
* David McKnight (IBM) - [224377] "open with" menu does not have "other" option
|
||||
* David McKnight (IBM) - [276103] Files with names in different cases are not handled properly
|
||||
* David McKnight (IBM) - [309813] RSE permits opening of file after access removed
|
||||
* David McKnight (IBM) - [312362] Editing Unix file after it changes on host edits old data
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.files.ui.actions;
|
||||
|
@ -105,7 +106,7 @@ public class SystemEditFileAction extends SystemBaseAction {
|
|||
long storedModifiedStamp = properties.getRemoteFileTimeStamp();
|
||||
|
||||
// get updated remoteFile so we get the current remote timestamp
|
||||
//remoteFile.markStale(true);
|
||||
remoteFile.markStale(true);
|
||||
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
|
||||
try
|
||||
{
|
||||
|
@ -152,6 +153,12 @@ public class SystemEditFileAction extends SystemBaseAction {
|
|||
*/
|
||||
protected void process(IRemoteFile remoteFile) {
|
||||
|
||||
// make sure we're using the latest version of remoteFile
|
||||
try {
|
||||
remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
|
||||
}
|
||||
catch (Exception e){
|
||||
}
|
||||
SystemEditableRemoteFile editable = SystemRemoteEditManager.getEditableRemoteObject(remoteFile, null);
|
||||
if (editable == null){
|
||||
// case for cancelled operation when user was prompted to save file of different case
|
||||
|
@ -161,9 +168,10 @@ public class SystemEditFileAction extends SystemBaseAction {
|
|||
{
|
||||
try
|
||||
{
|
||||
boolean isCached = isFileCached(editable, remoteFile);
|
||||
if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
|
||||
{
|
||||
if (isFileCached(editable, remoteFile))
|
||||
if (isCached)
|
||||
{
|
||||
editable.openEditor();
|
||||
}
|
||||
|
@ -175,8 +183,16 @@ public class SystemEditFileAction extends SystemBaseAction {
|
|||
}
|
||||
else
|
||||
{
|
||||
editable.setLocalResourceProperties();
|
||||
editable.openEditor();
|
||||
if (isCached)
|
||||
{
|
||||
editable.setLocalResourceProperties();
|
||||
editable.openEditor();
|
||||
}
|
||||
else
|
||||
{
|
||||
DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
|
||||
oJob.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* David McKnight (IBM) - [224377] "open with" menu does not have "other" option
|
||||
* David McKnight (IBM) - [276103] Files with names in different cases are not handled properly
|
||||
* David McKnight (IBM) - [309813] RSE permits opening of file after access removed
|
||||
* David McKnight (IBM) - [312362] Editing Unix file after it changes on host edits old data
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.files.ui.actions;
|
||||
|
@ -103,7 +104,8 @@ public class SystemEditFilesAction extends SystemBaseAction {
|
|||
Object obj = iterator.next();
|
||||
if (obj instanceof IRemoteFile)
|
||||
{
|
||||
process((IRemoteFile)obj);
|
||||
IRemoteFile remoteFile = (IRemoteFile)obj;
|
||||
process(remoteFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +127,7 @@ public class SystemEditFilesAction extends SystemBaseAction {
|
|||
long storedModifiedStamp = properties.getRemoteFileTimeStamp();
|
||||
|
||||
// get updated remoteFile so we get the current remote timestamp
|
||||
//remoteFile.markStale(true);
|
||||
remoteFile.markStale(true);
|
||||
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
|
||||
try
|
||||
{
|
||||
|
@ -169,6 +171,12 @@ public class SystemEditFilesAction extends SystemBaseAction {
|
|||
*/
|
||||
protected void process(IRemoteFile remoteFile) {
|
||||
|
||||
// make sure we're using the latest version of remoteFile
|
||||
try {
|
||||
remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
|
||||
}
|
||||
catch (Exception e){
|
||||
}
|
||||
String editorId = null;
|
||||
IEditorDescriptor des = getDefaultEditor(remoteFile);
|
||||
if (des != null)
|
||||
|
@ -189,9 +197,10 @@ public class SystemEditFilesAction extends SystemBaseAction {
|
|||
{
|
||||
try
|
||||
{
|
||||
boolean isCached = isFileCached(editable, remoteFile);
|
||||
if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
|
||||
{
|
||||
if (isFileCached(editable, remoteFile))
|
||||
if (isCached)
|
||||
{
|
||||
editable.openEditor();
|
||||
}
|
||||
|
@ -203,8 +212,16 @@ public class SystemEditFilesAction extends SystemBaseAction {
|
|||
}
|
||||
else
|
||||
{
|
||||
editable.setLocalResourceProperties();
|
||||
editable.openEditor();
|
||||
if (isCached)
|
||||
{
|
||||
editable.setLocalResourceProperties();
|
||||
editable.openEditor();
|
||||
}
|
||||
else
|
||||
{
|
||||
DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
|
||||
oJob.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* David McKnight (IBM) - [277141] System Editor Passed Incorrect Cache Information in Presence of Case-Differentiated-Only filenames
|
||||
* David McKnight (IBM) - [284596] [regression] Open with-> problem when descriptor doesn't match previous
|
||||
* David McKnight (IBM) - [309755] SystemRemoteFileOpenWithMenu.getPreferredEditor(), the listed default editor is not always correct
|
||||
* David McKnight (IBM) - [312362] Editing Unix file after it changes on host edits old data
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.files.ui.actions;
|
||||
import java.text.Collator;
|
||||
|
@ -231,6 +232,13 @@ private void createOtherMenuItem(final Menu menu, final IRemoteFile remoteFile)
|
|||
|
||||
protected void openEditor(IRemoteFile remoteFile, IEditorDescriptor descriptor) {
|
||||
|
||||
// make sure we're using the latest version of remoteFile
|
||||
try {
|
||||
remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
|
||||
}
|
||||
catch (Exception e){
|
||||
}
|
||||
|
||||
SystemEditableRemoteFile editable = SystemRemoteEditManager.getEditableRemoteObject(remoteFile, descriptor);
|
||||
if (editable == null){
|
||||
// case for cancelled operation when user was prompted to save file of different case
|
||||
|
@ -339,7 +347,7 @@ private boolean isFileCached(ISystemEditableRemoteObject editable, IRemoteFile r
|
|||
long storedModifiedStamp = properties.getRemoteFileTimeStamp();
|
||||
|
||||
// get updated remoteFile so we get the current remote timestamp
|
||||
//remoteFile.markStale(true);
|
||||
remoteFile.markStale(true);
|
||||
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue