mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-20 06:35:50 +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) - [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) - [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) - [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;
|
package org.eclipse.rse.internal.files.ui.actions;
|
||||||
|
@ -105,7 +106,7 @@ public class SystemEditFileAction extends SystemBaseAction {
|
||||||
long storedModifiedStamp = properties.getRemoteFileTimeStamp();
|
long storedModifiedStamp = properties.getRemoteFileTimeStamp();
|
||||||
|
|
||||||
// get updated remoteFile so we get the current remote timestamp
|
// get updated remoteFile so we get the current remote timestamp
|
||||||
//remoteFile.markStale(true);
|
remoteFile.markStale(true);
|
||||||
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
|
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -152,6 +153,12 @@ public class SystemEditFileAction extends SystemBaseAction {
|
||||||
*/
|
*/
|
||||||
protected void process(IRemoteFile remoteFile) {
|
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);
|
SystemEditableRemoteFile editable = SystemRemoteEditManager.getEditableRemoteObject(remoteFile, null);
|
||||||
if (editable == null){
|
if (editable == null){
|
||||||
// case for cancelled operation when user was prompted to save file of different case
|
// case for cancelled operation when user was prompted to save file of different case
|
||||||
|
@ -161,9 +168,10 @@ public class SystemEditFileAction extends SystemBaseAction {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
boolean isCached = isFileCached(editable, remoteFile);
|
||||||
if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
|
if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
|
||||||
{
|
{
|
||||||
if (isFileCached(editable, remoteFile))
|
if (isCached)
|
||||||
{
|
{
|
||||||
editable.openEditor();
|
editable.openEditor();
|
||||||
}
|
}
|
||||||
|
@ -174,10 +182,18 @@ public class SystemEditFileAction extends SystemBaseAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (isCached)
|
||||||
{
|
{
|
||||||
editable.setLocalResourceProperties();
|
editable.setLocalResourceProperties();
|
||||||
editable.openEditor();
|
editable.openEditor();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
|
||||||
|
oJob.schedule();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* David McKnight (IBM) - [224377] "open with" menu does not have "other" option
|
* 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) - [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) - [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;
|
package org.eclipse.rse.internal.files.ui.actions;
|
||||||
|
@ -103,7 +104,8 @@ public class SystemEditFilesAction extends SystemBaseAction {
|
||||||
Object obj = iterator.next();
|
Object obj = iterator.next();
|
||||||
if (obj instanceof IRemoteFile)
|
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();
|
long storedModifiedStamp = properties.getRemoteFileTimeStamp();
|
||||||
|
|
||||||
// get updated remoteFile so we get the current remote timestamp
|
// get updated remoteFile so we get the current remote timestamp
|
||||||
//remoteFile.markStale(true);
|
remoteFile.markStale(true);
|
||||||
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
|
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -169,6 +171,12 @@ public class SystemEditFilesAction extends SystemBaseAction {
|
||||||
*/
|
*/
|
||||||
protected void process(IRemoteFile remoteFile) {
|
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;
|
String editorId = null;
|
||||||
IEditorDescriptor des = getDefaultEditor(remoteFile);
|
IEditorDescriptor des = getDefaultEditor(remoteFile);
|
||||||
if (des != null)
|
if (des != null)
|
||||||
|
@ -189,9 +197,10 @@ public class SystemEditFilesAction extends SystemBaseAction {
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
boolean isCached = isFileCached(editable, remoteFile);
|
||||||
if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
|
if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.OPEN_IN_SAME_PERSPECTIVE)
|
||||||
{
|
{
|
||||||
if (isFileCached(editable, remoteFile))
|
if (isCached)
|
||||||
{
|
{
|
||||||
editable.openEditor();
|
editable.openEditor();
|
||||||
}
|
}
|
||||||
|
@ -202,10 +211,18 @@ public class SystemEditFilesAction extends SystemBaseAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (isCached)
|
||||||
{
|
{
|
||||||
editable.setLocalResourceProperties();
|
editable.setLocalResourceProperties();
|
||||||
editable.openEditor();
|
editable.openEditor();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DownloadAndOpenJob oJob = new DownloadAndOpenJob(editable, false);
|
||||||
|
oJob.schedule();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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) - [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) - [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) - [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;
|
package org.eclipse.rse.internal.files.ui.actions;
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
|
@ -231,6 +232,13 @@ private void createOtherMenuItem(final Menu menu, final IRemoteFile remoteFile)
|
||||||
|
|
||||||
protected void openEditor(IRemoteFile remoteFile, IEditorDescriptor descriptor) {
|
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);
|
SystemEditableRemoteFile editable = SystemRemoteEditManager.getEditableRemoteObject(remoteFile, descriptor);
|
||||||
if (editable == null){
|
if (editable == null){
|
||||||
// case for cancelled operation when user was prompted to save file of different case
|
// 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();
|
long storedModifiedStamp = properties.getRemoteFileTimeStamp();
|
||||||
|
|
||||||
// get updated remoteFile so we get the current remote timestamp
|
// get updated remoteFile so we get the current remote timestamp
|
||||||
//remoteFile.markStale(true);
|
remoteFile.markStale(true);
|
||||||
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
|
IRemoteFileSubSystem subsystem = remoteFile.getParentRemoteFileSubSystem();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue