Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 115693 Details for
Bug 250140
Backport [usability] Save conflict dialog appears when saving files in the editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch dealing with remote file cache
patch.txt (text/plain), 10.83 KB, created by
David McKnight
on 2008-10-21 09:41:24 EDT
(
hide
)
Description:
patch dealing with remote file cache
Filename:
MIME Type:
Creator:
David McKnight
Created:
2008-10-21 09:41:24 EDT
Size:
10.83 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.files.ui >Index: src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java,v >retrieving revision 1.28 >diff -u -r1.28 SystemUniversalTempFileListener.java >--- src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java 2 Jul 2008 15:01:50 -0000 1.28 >+++ src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java 21 Oct 2008 13:40:43 -0000 >@@ -23,6 +23,7 @@ > * Kevin Doyle (IBM) - [204810] Saving file in Eclipse does not update remote file > * Kevin Doyle (IBM) - [210389] Display error dialog when setting file not read-only fails when saving > * David McKnight (IBM) - [235221] Files truncated on exit of Eclipse >+ * David McKnight (IBM) - [250140] Backport [usability] Save conflict dialog appears when saving files in the editor > ********************************************************************************/ > > package org.eclipse.rse.files.ui.resources; >@@ -190,6 +191,8 @@ > remoteFile, false, new NullProgressMonitor()); > } > >+ boolean openEditorAfterUpload = false; >+ > // get associated editable > SystemEditableRemoteFile editable = getEditedFile(remoteFile); > if (editable != null && storedModifiedStamp == 0) >@@ -208,7 +211,15 @@ > { > editable = new SystemEditableRemoteFile(remoteFile); > } >+ >+ openEditorAfterUpload = true; >+ editable.setLocalResourceProperties(); >+ } > >+ upload(fs, remoteFile, tempFile, properties, storedModifiedStamp, editable, monitor); >+ >+ if (openEditorAfterUpload){ >+ // moving this to after the upload because otherwise it queries the remote file and that messes up the timestamps needed by upload > final SystemEditableRemoteFile fEditable = editable; > Display.getDefault().asyncExec(new Runnable() { > public void run() { >@@ -222,7 +233,7 @@ > if (fEditable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN) > { > try { >- fEditable.openEditor(); >+ fEditable.openEditor(); // open e > } > catch (PartInitException e) { > } >@@ -231,10 +242,7 @@ > fEditable.addAsListener(); > } > }); >- editable.setLocalResourceProperties(); > } >- >- upload(fs, remoteFile, tempFile, properties, storedModifiedStamp, editable, monitor); > } > } > catch (SystemMessageException e) { >@@ -254,8 +262,12 @@ > { > try > { >+ // make sure the remote file is the current cached version >+ remoteFile = fs.getRemoteFileObject(remoteFile.getAbsolutePath(), monitor); >+ > // get the remote modified timestamp > long remoteModifiedStamp = remoteFile.getLastModified(); >+ > > boolean remoteFileDeleted = !remoteFile.exists(); > // compare timestamps >@@ -275,7 +287,7 @@ > } > > catch (RemoteFileSecurityException e) >- { >+ { > DisplaySystemMessageAction msgAction = new DisplaySystemMessageAction(e.getSystemMessage()); > Display.getDefault().syncExec(msgAction); > } >@@ -300,9 +312,6 @@ > { > registry.fireEvent(new SystemResourceChangeEvent(parent, ISystemResourceChangeEvents.EVENT_REFRESH, null)); > } >- >- // waiting to make sure the file's timestamp is uptodate >- Thread.sleep(1000); > > // get the remote file object again so that we have a fresh remote timestamp > remoteFile.markStale(true); >#P org.eclipse.rse.services.dstore >Index: src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java,v >retrieving revision 1.74 >diff -u -r1.74 DStoreFileService.java >--- src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 23 Jul 2008 19:01:56 -0000 1.74 >+++ src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 21 Oct 2008 13:40:45 -0000 >@@ -48,6 +48,8 @@ > * Martin Oberhuber (Wind River) - [235463][ftp][dstore] Incorrect case sensitivity reported on windows-remote > * David McKnight (IBM) - [236039][dstore][efs] DStoreInputStream can report EOF too early - clean up how it waits for the local temp file to be created > * David McKnight (IBM) - [240710] [dstore] DStoreFileService.getFile() fails with NPE for valid root files >+ * David McKnight (IBM) - [250140] backport of Save conflict dialog appears when saving files in the editor >+ * David McKnight (IBM) - [250368] Backport [dstore] Remote search doesn't find the right result > *******************************************************************************/ > > package org.eclipse.rse.internal.services.dstore.files; >@@ -74,6 +76,7 @@ > import org.eclipse.dstore.core.model.DataStore; > import org.eclipse.dstore.core.model.DataStoreAttributes; > import org.eclipse.dstore.core.model.DataStoreResources; >+import org.eclipse.dstore.core.model.DataStoreSchema; > import org.eclipse.dstore.core.model.IDataStoreProvider; > import org.eclipse.osgi.util.NLS; > import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants; >@@ -195,8 +198,31 @@ > return IUniversalDataStoreConstants.UNIVERSAL_FILESYSTEM_MINER_ID; > } > >- protected String getByteStreamHandlerId() >+ protected DataElement getMinerElement() >+ { >+ super.getMinerElement(); >+ if (_minerElement == null){ >+ // could be back-level version >+ _minerElement = getMinerElement("com.ibm.etools.systems.universal.miners.UniversalFileSystemMiner"); //$NON-NLS-1$ >+ } >+ return _minerElement; >+ } >+ >+ private boolean isOldIBMMiner() > { >+ if (_minerElement != null){ >+ return _minerElement.getSource().equals("com.ibm.etools.systems.universal.miners.UniversalFileSystemMiner"); //$NON-NLS-1$ >+ } >+ return false; >+ } >+ >+ protected String getByteStreamHandlerId() >+ { >+ if (isOldIBMMiner()) >+ { >+ // if so, use the old id >+ return "com.ibm.etools.systems.universal.miners.UniversalByteStreamHandler"; //$NON-NLS-1$ >+ } > return UniversalByteStreamHandler.class.getName(); > } > >@@ -457,11 +483,27 @@ > boolean transferSuccessful = false; > > long totalBytes = file.length(); >+ >+ DataElement uploadLog = findUploadLog(); >+ String remotePath = remoteParent + getSeparator(remoteParent) + remoteFile; >+ >+ DataStore ds = getDataStore(); >+ DataElement result = ds.find(uploadLog, DE.A_NAME, remotePath,1); >+ if (result == null) >+ { >+ result = ds.createObject(uploadLog, "uploadstatus", remotePath); >+ result.setAttribute(DE.A_SOURCE, "running"); >+ result.setAttribute(DE.A_VALUE, ""); >+ >+ DataElement cmd = getDataStore().findCommandDescriptor(DataStoreSchema.C_SET); >+ >+ DataElement setstatus = ds.command(cmd, uploadLog, true); >+ } > > try > { > String byteStreamHandlerId = getByteStreamHandlerId(); >- String remotePath = remoteParent + getSeparator(remoteParent) + remoteFile; >+ > > // create an empty file and append data to it later > // this handles the case of uploading empty files as well >@@ -473,9 +515,6 @@ > //subMonitor = new SubProgressMonitor(monitor, (int)totalBytes); > } > >- >-// DataElement uploadLog = findUploadLog(); >- findUploadLog(); > // listener = new FileTransferStatusListener(remotePath, shell, monitor, getConnectorService(), ds, uploadLog); > // ds.getDomainNotifier().addDomainListener(listener); > >@@ -583,6 +622,7 @@ > > available = bufInputStream.available(); > } >+ > // if (listener.uploadHasFailed()) > // { > // showUploadFailedMessage(listener, source); >@@ -639,26 +679,18 @@ > { > if (transferSuccessful) > { >- >- >-// try >-// { >-// listener.waitForUpdate(null, 2); >-// >-// } >-// catch (InterruptedException e) >-// { >-// UniversalSystemPlugin.logError(CLASSNAME + " InterruptedException while waiting for command", e); >-// } >- >+ String resultStr = result.getSource(); >+ while (!resultStr.equals("success")) >+ { >+ // sleep until the upload is complete >+ try { >+ Thread.sleep(200); >+ } >+ catch (InterruptedException e){ >+ } >+ resultStr = result.getSource(); >+ } > } >- >- //ds.getDomainNotifier().removeDomainListener(listener); >- >-// if (listener.uploadHasFailed()) >-// { >-// showUploadFailedMessage(listener, source); >-// } > } > } > } >@@ -1130,8 +1162,25 @@ > de = getElementFor(name); > } > >+ > // with 207095, it's possible to get here unconnected such that there is no element > if (de != null) { >+ if (isOldIBMMiner()){ >+ // only accepts filters for file queries >+ if (!de.getType().equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)){ >+ StringBuffer buf = new StringBuffer(remoteParent); >+ String sep = getSeparator(remoteParent); >+ if (sep.length()>0 && !remoteParent.endsWith(sep)) { >+ buf.append(sep); >+ } >+ buf.append(name); >+ String fullPath = buf.toString(); >+ de.setAttribute(DE.A_NAME, fullPath); >+ de.setAttribute(DE.A_VALUE, fullPath); >+ de.setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR); >+ } >+ } >+ > dsQueryCommand(de, null, IUniversalDataStoreConstants.C_QUERY_GET_REMOTE_OBJECT, monitor); > //getFile call should also need to convert this DataElement into a HostFile using > //convertToHostFile() call. This way, this DataElement will be put into _fileMap. >@@ -1152,9 +1201,25 @@ > > // construct default array of commands > String[] queryStrings = new String[remoteParents.length]; >+ boolean oldMiner = isOldIBMMiner(); >+ > for (int i = 0; i < queryStrings.length; i++) > { > queryStrings[i] = IUniversalDataStoreConstants.C_QUERY_GET_REMOTE_OBJECT; >+ if (oldMiner){ >+ if (!subjects[i].getType().equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)){ >+ StringBuffer buf = new StringBuffer(remoteParents[i]); >+ String sep = getSeparator(remoteParents[i]); >+ if (sep.length()>0 && !remoteParents[i].endsWith(sep)) { >+ buf.append(sep); >+ } >+ buf.append(names[i]); >+ String fullPath = buf.toString(); >+ subjects[i].setAttribute(DE.A_NAME, fullPath); >+ subjects[i].setAttribute(DE.A_VALUE, fullPath); >+ subjects[i].setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR); >+ } >+ } > } > > dsQueryCommandMulti(subjects, null, queryStrings, monitor);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 250140
:
114607
|
114795
|
114796
|
115398
|
115401
|
115408
|
115693
|
117341
|
117370