mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 23:25:26 +02:00
fixes for 154207 - propagating system message expcetions from service layer to subsystem
This commit is contained in:
parent
3a99dfb5d8
commit
83f451321b
18 changed files with 243 additions and 76 deletions
|
@ -25,20 +25,23 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
import org.eclipse.dstore.core.model.DataElement;
|
||||
import org.eclipse.dstore.core.model.DataStore;
|
||||
import org.eclipse.dstore.core.model.IDataStoreProvider;
|
||||
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.dstore.util.DStoreStatusMonitor;
|
||||
|
||||
public abstract class AbstractDStoreService implements IDStoreService
|
||||
{
|
||||
protected IDataStoreProvider _dataStoreProvider;
|
||||
protected ISystemMessageProvider _msgProvider;
|
||||
protected DataElement _minerElement;
|
||||
protected DStoreStatusMonitor _statusMonitor;
|
||||
protected Map _cmdDescriptorMap;
|
||||
protected DataElement _initializeStatus;
|
||||
|
||||
public AbstractDStoreService(IDataStoreProvider dataStoreProvider)
|
||||
public AbstractDStoreService(IDataStoreProvider dataStoreProvider, ISystemMessageProvider msgProvider)
|
||||
{
|
||||
_dataStoreProvider = dataStoreProvider;
|
||||
_msgProvider = msgProvider;
|
||||
_cmdDescriptorMap = new HashMap();
|
||||
}
|
||||
|
||||
|
@ -307,6 +310,6 @@ public abstract class AbstractDStoreService implements IDStoreService
|
|||
*/
|
||||
public SystemMessage getMessage(String messageID)
|
||||
{
|
||||
return null;
|
||||
return _msgProvider.getMessage(messageID);
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ import java.io.UnsupportedEncodingException;
|
|||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -42,6 +43,7 @@ import org.eclipse.rse.services.clientserver.IServiceConstants;
|
|||
import org.eclipse.rse.services.clientserver.ISystemFileTypes;
|
||||
import org.eclipse.rse.services.clientserver.PathUtility;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.dstore.AbstractDStoreService;
|
||||
|
@ -72,9 +74,9 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
DataStoreResources.FALSE,
|
||||
"2"};
|
||||
|
||||
public DStoreFileService(IDataStoreProvider dataStoreProvider, ISystemFileTypes fileTypeRegistry)
|
||||
public DStoreFileService(IDataStoreProvider dataStoreProvider, ISystemFileTypes fileTypeRegistry, ISystemMessageProvider msgProvider)
|
||||
{
|
||||
super(dataStoreProvider);
|
||||
super(dataStoreProvider, msgProvider);
|
||||
_fileElementMap = new HashMap();
|
||||
_fileTypeRegistry = fileTypeRegistry;
|
||||
}
|
||||
|
@ -461,11 +463,11 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
|
||||
available = bufInputStream.available();
|
||||
}
|
||||
// if (listener.uploadHasFailed())
|
||||
// {
|
||||
// showUploadFailedMessage(listener, source);
|
||||
// }
|
||||
// else
|
||||
// if (listener.uploadHasFailed())
|
||||
// {
|
||||
// showUploadFailedMessage(listener, source);
|
||||
// }
|
||||
// else
|
||||
{
|
||||
transferSuccessful = true;
|
||||
}
|
||||
|
@ -549,7 +551,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
|
||||
|
||||
public boolean download(IProgressMonitor monitor, String remoteParent, String remoteFile, File localFile,
|
||||
boolean isBinary, String encoding)
|
||||
boolean isBinary, String encoding) throws SystemMessageException
|
||||
{
|
||||
DataElement universaltemp = getMinerElement();
|
||||
|
||||
|
@ -653,6 +655,44 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
{
|
||||
}
|
||||
}
|
||||
|
||||
List resultList = remoteElement.getNestedData();
|
||||
DataElement resultChild = null;
|
||||
|
||||
for (int i = 0; i < resultList.size(); i++)
|
||||
{
|
||||
|
||||
resultChild = (DataElement) resultList.get(i);
|
||||
|
||||
if (resultChild.getType().equals(DOWNLOAD_RESULT_SUCCESS_TYPE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultChild.getType().equals(DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION))
|
||||
{
|
||||
localFile.delete();
|
||||
SystemMessage msg = getMessage("RSEF1001").makeSubstitution(DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION);
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
else if (resultChild.getType().equals(DOWNLOAD_RESULT_UNSUPPORTED_ENCODING_EXCEPTION))
|
||||
{
|
||||
//SystemMessage msg = getMessage();
|
||||
//throw new SystemMessageException(msg);
|
||||
//UnsupportedEncodingException e = new UnsupportedEncodingException(resultChild.getName());
|
||||
//UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error reading file " + remotePath, e);
|
||||
//throw new RemoteFileIOException(e);
|
||||
}
|
||||
|
||||
else if (resultChild.getType().equals(DOWNLOAD_RESULT_IO_EXCEPTION))
|
||||
{
|
||||
localFile.delete();
|
||||
SystemMessage msg = getMessage("RSEF1001").makeSubstitution(DOWNLOAD_RESULT_IO_EXCEPTION);
|
||||
throw new SystemMessageException(msg);
|
||||
//IOException e = new IOException(resultChild.getName());
|
||||
//UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error reading file " + remotePath, e);
|
||||
//throw new RemoteFileIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// DownloadListener dlistener = new DownloadListener(shell, monitor, getConnectorService(), status, localFile, remotePath, (long) universalFile.getLength());
|
||||
// try
|
||||
|
@ -795,20 +835,38 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
return getFile(null, ".",".");
|
||||
}
|
||||
|
||||
public IHostFile createFile(IProgressMonitor monitor, String remoteParent, String fileName)
|
||||
public IHostFile createFile(IProgressMonitor monitor, String remoteParent, String fileName) throws SystemMessageException
|
||||
{
|
||||
String remotePath = remoteParent + getSeparator(remoteParent) + fileName;
|
||||
DataElement de = getElementFor(remotePath);
|
||||
dsQueryCommand(monitor, de, C_CREATE_FILE);
|
||||
return new DStoreHostFile(de);
|
||||
|
||||
|
||||
DataElement status = dsStatusCommand(monitor, de, C_CREATE_FILE);
|
||||
|
||||
if (status == null) return null;
|
||||
if (FileSystemMessageUtil.getSourceMessage(status).equals(IServiceConstants.SUCCESS))
|
||||
return new DStoreHostFile(de);
|
||||
else
|
||||
{
|
||||
throw new SystemMessageException(getMessage("RSEF1302").makeSubstitution(remotePath));
|
||||
}
|
||||
}
|
||||
|
||||
public IHostFile createFolder(IProgressMonitor monitor, String remoteParent, String folderName)
|
||||
public IHostFile createFolder(IProgressMonitor monitor, String remoteParent, String folderName) throws SystemMessageException
|
||||
{
|
||||
String remotePath = remoteParent + getSeparator(remoteParent) + folderName;
|
||||
DataElement de = getElementFor(remotePath);
|
||||
dsQueryCommand(monitor, de, C_CREATE_FOLDER);
|
||||
return new DStoreHostFile(de);
|
||||
|
||||
DataElement status = dsStatusCommand(monitor, de, C_CREATE_FOLDER);
|
||||
|
||||
if (status == null) return null;
|
||||
if (FileSystemMessageUtil.getSourceMessage(status).equals(IServiceConstants.SUCCESS))
|
||||
return new DStoreHostFile(de);
|
||||
else
|
||||
{
|
||||
throw new SystemMessageException(getMessage("RSEF1304").makeSubstitution(remotePath));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean delete(IProgressMonitor monitor, String remoteParent, String fileName) throws SystemMessageException
|
||||
|
@ -846,16 +904,24 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
else throw new SystemMessageException(getMessage("RSEF1300").makeSubstitution(FileSystemMessageUtil.getSourceLocation(status)));
|
||||
}
|
||||
|
||||
public boolean rename(IProgressMonitor monitor, String remoteParent, String oldName, String newName)
|
||||
public boolean rename(IProgressMonitor monitor, String remoteParent, String oldName, String newName) throws SystemMessageException
|
||||
{
|
||||
String remotePath = remoteParent + getSeparator(remoteParent) + oldName;
|
||||
DataElement de = getElementFor(remotePath);
|
||||
de.setAttribute(DE.A_SOURCE, newName);
|
||||
dsQueryCommand(monitor, de, C_RENAME);
|
||||
return true;
|
||||
|
||||
DataElement status = dsStatusCommand(monitor, de, C_RENAME);
|
||||
|
||||
if (status == null) return false;
|
||||
if (FileSystemMessageUtil.getSourceMessage(status).equals(IServiceConstants.SUCCESS))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
throw new SystemMessageException(getMessage("RSEF1301").makeSubstitution(FileSystemMessageUtil.getSourceLocation(status)));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean rename(IProgressMonitor monitor, String remoteParent, String oldName, String newName, IHostFile oldFile)
|
||||
public boolean rename(IProgressMonitor monitor, String remoteParent, String oldName, String newName, IHostFile oldFile) throws SystemMessageException
|
||||
{
|
||||
boolean retVal = rename(monitor, remoteParent, oldName, newName);
|
||||
String newPath = remoteParent + getSeparator(remoteParent) + newName;
|
||||
|
@ -863,7 +929,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
return retVal;
|
||||
}
|
||||
|
||||
public boolean move(IProgressMonitor monitor, String srcParent, String srcName, String tgtParent, String tgtName)
|
||||
public boolean move(IProgressMonitor monitor, String srcParent, String srcName, String tgtParent, String tgtName) throws SystemMessageException
|
||||
{
|
||||
// String src = srcParent + getSeparator(srcParent) + srcName;
|
||||
// String tgt = tgtParent + getSeparator(tgtParent) + tgtName;
|
||||
|
@ -977,7 +1043,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
}
|
||||
}
|
||||
|
||||
public boolean copy(IProgressMonitor monitor, String srcParent, String srcName, String tgtParent, String tgtName)
|
||||
public boolean copy(IProgressMonitor monitor, String srcParent, String srcName, String tgtParent, String tgtName) throws SystemMessageException
|
||||
{
|
||||
DataStore ds = getDataStore();
|
||||
String srcRemotePath = srcParent + getSeparator(srcParent) + srcName;
|
||||
|
@ -1001,9 +1067,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
getStatusMonitor(ds).waitForUpdate(status, monitor);
|
||||
|
||||
if (status.getAttribute(DE.A_SOURCE).equals(FAILED)) {
|
||||
|
||||
// String errMsg = status.getAttribute(DE.A_VALUE);
|
||||
|
||||
|
||||
throw new SystemMessageException(getMessage("RSEF1306").makeSubstitution(srcName));
|
||||
/*
|
||||
// for an unexpected error, we don't have an error message from the server
|
||||
if (errMsg.equals(UNEXPECTED_ERROR)) {
|
||||
|
@ -1015,8 +1080,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
|
||||
|
||||
throw new RemoteFileIOException(new Exception(msg));
|
||||
*/
|
||||
return false;
|
||||
/*/
|
||||
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
|
@ -1028,7 +1093,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean copyBatch(IProgressMonitor monitor, String[] srcParents, String[] srcNames, String tgtParent)
|
||||
public boolean copyBatch(IProgressMonitor monitor, String[] srcParents, String[] srcNames, String tgtParent) throws SystemMessageException
|
||||
{
|
||||
DataStore ds = getDataStore();
|
||||
|
||||
|
@ -1051,22 +1116,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
getStatusMonitor(ds).waitForUpdate(status, monitor);
|
||||
|
||||
if (status.getAttribute(DE.A_SOURCE).equals(FAILED)) {
|
||||
|
||||
// String errMsg = status.getAttribute(DE.A_VALUE);
|
||||
|
||||
/*
|
||||
// for an unexpected error, we don't have an error message from the server
|
||||
if (errMsg.equals(UNEXPECTED_ERROR)) {
|
||||
msg = SystemPlugin.getPluginMessage(MSG_ERROR_UNEXPECTED).getLevelOneText();
|
||||
}
|
||||
else {
|
||||
msg = errMsg;
|
||||
}
|
||||
|
||||
|
||||
throw new RemoteFileIOException(new Exception(msg));
|
||||
*/
|
||||
return false;
|
||||
throw new SystemMessageException(getMessage("RSEF1306").makeSubstitution(srcNames[0]));
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
|
|
|
@ -31,6 +31,9 @@ public class DStoreHostFile implements IHostFile
|
|||
public static final int ATTRIBUTE_MODIFIED_DATE=1;
|
||||
public static final int ATTRIBUTE_SIZE = 2;
|
||||
public static final int ATTRIBUTE_CLASSIFICATION =11;
|
||||
public static final int ATTRIBUTE_IS_HIDDEN=3;
|
||||
public static final int ATTRIBUTE_CAN_WRITE=4;
|
||||
public static final int ATTRIBUTE_CAN_READ=5;
|
||||
|
||||
|
||||
protected DataElement _element;
|
||||
|
@ -114,7 +117,15 @@ public class DStoreHostFile implements IHostFile
|
|||
else
|
||||
{
|
||||
|
||||
return name.charAt(0) == '.';
|
||||
if (name.charAt(0) == '.')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
String str = getAttribute(_element.getSource(), ATTRIBUTE_IS_HIDDEN);
|
||||
return(str.equals("true"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,4 +284,15 @@ public class DStoreHostFile implements IHostFile
|
|||
{
|
||||
return _isArchive;
|
||||
}
|
||||
|
||||
public boolean canRead() {
|
||||
String str = getAttribute(_element.getSource(), ATTRIBUTE_CAN_READ);
|
||||
return(str.equals("true"));
|
||||
}
|
||||
|
||||
public boolean canWrite() {
|
||||
String str = getAttribute(_element.getSource(), ATTRIBUTE_CAN_WRITE);
|
||||
return(str.equals("true"));
|
||||
}
|
||||
|
||||
}
|
|
@ -18,14 +18,15 @@ package org.eclipse.rse.services.dstore.rmtservice;
|
|||
|
||||
import org.eclipse.dstore.core.java.IRemoteClassInstance;
|
||||
import org.eclipse.dstore.core.model.IDataStoreProvider;
|
||||
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
|
||||
import org.eclipse.rse.services.dstore.AbstractDStoreService;
|
||||
|
||||
public class DStoreRemoteServiceService extends AbstractDStoreService
|
||||
{
|
||||
|
||||
public DStoreRemoteServiceService(IDataStoreProvider dataStoreProvider)
|
||||
public DStoreRemoteServiceService(IDataStoreProvider dataStoreProvider, ISystemMessageProvider msgProvider)
|
||||
{
|
||||
super(dataStoreProvider);
|
||||
super(dataStoreProvider, msgProvider);
|
||||
}
|
||||
|
||||
protected String getMinerId()
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.dstore.core.model.DataStore;
|
|||
import org.eclipse.dstore.core.model.IDataStoreProvider;
|
||||
import org.eclipse.rse.dstore.universal.miners.filesystem.UniversalFileSystemMiner;
|
||||
import org.eclipse.rse.services.clientserver.SystemSearchString;
|
||||
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
|
||||
import org.eclipse.rse.services.dstore.AbstractDStoreService;
|
||||
import org.eclipse.rse.services.dstore.ServiceResources;
|
||||
import org.eclipse.rse.services.dstore.files.DStoreHostFile;
|
||||
|
@ -36,9 +37,9 @@ import org.eclipse.rse.services.search.ISearchService;
|
|||
|
||||
public class DStoreSearchService extends AbstractDStoreService implements ISearchService
|
||||
{
|
||||
public DStoreSearchService(IDataStoreProvider provider)
|
||||
public DStoreSearchService(IDataStoreProvider provider, ISystemMessageProvider msgProvider)
|
||||
{
|
||||
super(provider);
|
||||
super(provider, msgProvider);
|
||||
}
|
||||
|
||||
public String getName()
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.dstore.core.model.DataStore;
|
|||
import org.eclipse.dstore.core.model.IDataStoreProvider;
|
||||
import org.eclipse.rse.dstore.universal.miners.command.CommandMiner;
|
||||
import org.eclipse.rse.dstore.universal.miners.environment.EnvironmentMiner;
|
||||
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.dstore.AbstractDStoreService;
|
||||
import org.eclipse.rse.services.dstore.ServiceResources;
|
||||
|
@ -40,9 +41,9 @@ public class DStoreShellService extends AbstractDStoreService implements IShellS
|
|||
protected DataElement _envMinerElement;
|
||||
protected DataElement _envMinerStatus;
|
||||
|
||||
public DStoreShellService(IDataStoreProvider dataStoreProvider)
|
||||
public DStoreShellService(IDataStoreProvider dataStoreProvider, ISystemMessageProvider msgProvider)
|
||||
{
|
||||
super(dataStoreProvider);
|
||||
super(dataStoreProvider, msgProvider);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -134,5 +134,15 @@ public class FTPHostFile implements IHostFile
|
|||
{
|
||||
return _isArchive;
|
||||
}
|
||||
|
||||
//TODO implement this
|
||||
public boolean canRead() {
|
||||
return true;
|
||||
}
|
||||
|
||||
//TODO implement this
|
||||
public boolean canWrite() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -117,4 +117,12 @@ public class LocalHostFile implements IHostFile
|
|||
return _isArchive;
|
||||
}
|
||||
|
||||
public boolean canRead() {
|
||||
return _file.canRead();
|
||||
}
|
||||
|
||||
public boolean canWrite() {
|
||||
return _file.canWrite();
|
||||
}
|
||||
|
||||
}
|
|
@ -180,4 +180,14 @@ public class SftpHostFile implements IHostFile {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//TODO implement this
|
||||
public boolean canRead() {
|
||||
return true;
|
||||
}
|
||||
|
||||
//TODO implement this
|
||||
public boolean canWrite() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package org.eclipse.rse.services.clientserver.messages;
|
||||
|
||||
public interface ISystemMessageProvider {
|
||||
public SystemMessage getMessage(String id);
|
||||
}
|
|
@ -26,6 +26,8 @@ public interface IHostFile
|
|||
public boolean isDirectory();
|
||||
public boolean isRoot();
|
||||
public boolean isFile();
|
||||
public boolean canWrite();
|
||||
public boolean canRead();
|
||||
public boolean exists();
|
||||
public boolean isArchive();
|
||||
|
||||
|
|
|
@ -167,8 +167,7 @@ public abstract class AbstractRemoteFile extends RemoteFile implements IRemoteFi
|
|||
|
||||
public boolean isHidden()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
return _hostFile.isHidden();
|
||||
}
|
||||
|
||||
public boolean isVirtual()
|
||||
|
@ -179,14 +178,12 @@ public abstract class AbstractRemoteFile extends RemoteFile implements IRemoteFi
|
|||
|
||||
public boolean canRead()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
return _hostFile.canRead();
|
||||
}
|
||||
|
||||
public boolean canWrite()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
return _hostFile.canWrite();
|
||||
}
|
||||
|
||||
public boolean showReadOnlyProperty()
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
|
|||
import org.eclipse.rse.services.clientserver.SystemSearchString;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.files.IFileService;
|
||||
import org.eclipse.rse.services.files.IHostFile;
|
||||
|
@ -46,6 +47,9 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAda
|
|||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
|
||||
|
||||
|
@ -58,6 +62,21 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
protected IHostFileToRemoteFileAdapter _hostFileToRemoteFileAdapter;
|
||||
protected IRemoteFile _userHome;
|
||||
|
||||
|
||||
public class SystemMessageDialogRunnable implements Runnable
|
||||
{
|
||||
private SystemMessageDialog _dlg;
|
||||
public SystemMessageDialogRunnable(SystemMessageDialog dlg)
|
||||
{
|
||||
_dlg = dlg;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
_dlg.open();
|
||||
}
|
||||
}
|
||||
|
||||
public FileServiceSubSystem(IHost host, IConnectorService connectorService, IFileService hostFileService, IHostFileToRemoteFileAdapter fileAdapter, ISearchService searchService)
|
||||
{
|
||||
super(host, connectorService);
|
||||
|
@ -417,7 +436,8 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
// FIXME: Display message
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -468,7 +488,8 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -487,13 +508,23 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
String remoteFileName = destination.getName();
|
||||
String hostEncoding = getRemoteEncoding(); // default host encoding
|
||||
boolean isBinary = isBinary(encoding, hostEncoding, destination.getAbsolutePath());
|
||||
|
||||
if (!destination.canWrite())
|
||||
{
|
||||
SystemMessage msg = RSEUIPlugin.getPluginMessage("RSEF5003").makeSubstitution(remoteFileName, getHostName());
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
|
||||
dlg.open();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
getFileService().upload(monitor, new File(source), remoteParentPath, remoteFileName, isBinary, encoding, hostEncoding);
|
||||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,7 +540,8 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -524,7 +556,9 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
Display dis = Display.getDefault();
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dis.syncExec(new SystemMessageDialogRunnable(dlg));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -546,7 +580,9 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
Display dis = Display.getDefault();
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dis.syncExec(new SystemMessageDialogRunnable(dlg));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -576,7 +612,9 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
return null;
|
||||
}
|
||||
return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), fileToCreate.getParentRemoteFile(), newFile);
|
||||
}
|
||||
|
@ -593,7 +631,9 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
return null;
|
||||
}
|
||||
return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), folderToCreate.getParentRemoteFile(), newFolder);
|
||||
}
|
||||
|
@ -616,6 +656,8 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
|
@ -639,6 +681,8 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
|
@ -659,7 +703,9 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -679,7 +725,9 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
}
|
||||
catch (SystemMessageException e)
|
||||
{
|
||||
|
||||
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
|
||||
dlg.open();
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSyst
|
|||
import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||
import org.eclipse.rse.subsystems.files.dstore.model.DStoreFileAdapter;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -127,13 +128,13 @@ public class DStoreFileSubSystemConfiguration extends FileServiceSubSystemConfig
|
|||
public IFileService createFileService(IHost host)
|
||||
{
|
||||
DStoreConnectorService connectorService = (DStoreConnectorService)getConnectorService(host);
|
||||
return new DStoreFileService(connectorService, SystemFileTransferModeRegistry.getDefault());
|
||||
return new DStoreFileService(connectorService, SystemFileTransferModeRegistry.getDefault(), RSEUIPlugin.getDefault());
|
||||
}
|
||||
|
||||
public ISearchService createSearchService(IHost host)
|
||||
{
|
||||
DStoreConnectorService connectorService = (DStoreConnectorService)getConnectorService(host);
|
||||
return new DStoreSearchService(connectorService);
|
||||
return new DStoreSearchService(connectorService, RSEUIPlugin.getDefault());
|
||||
}
|
||||
|
||||
public IHostFileToRemoteFileAdapter getHostFileAdapter()
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IServi
|
|||
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystem;
|
||||
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.ShellServiceSubSystemConfiguration;
|
||||
import org.eclipse.rse.subsystems.shells.dstore.model.DStoreServiceCommandShell;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
||||
/**
|
||||
* Provides a factory for generating instances of the class
|
||||
|
@ -63,7 +64,7 @@ public class DStoreShellSubSystemConfiguration extends ShellServiceSubSystemConf
|
|||
public ISubSystem createSubSystemInternal(IHost host)
|
||||
{
|
||||
DStoreConnectorService connectorService = (DStoreConnectorService)getConnectorService(host);
|
||||
ISubSystem subsys = new ShellServiceSubSystem(host, connectorService, new DStoreShellService(connectorService));
|
||||
ISubSystem subsys = new ShellServiceSubSystem(host, connectorService, new DStoreShellService(connectorService, RSEUIPlugin.getDefault()));
|
||||
return subsys;
|
||||
}
|
||||
|
||||
|
@ -87,7 +88,7 @@ public class DStoreShellSubSystemConfiguration extends ShellServiceSubSystemConf
|
|||
|
||||
public IShellService createShellService(IHost host)
|
||||
{
|
||||
return new DStoreShellService((IDataStoreProvider)getConnectorService(host));
|
||||
return new DStoreShellService((IDataStoreProvider)getConnectorService(host), RSEUIPlugin.getDefault());
|
||||
}
|
||||
|
||||
public boolean supportsCommands()
|
||||
|
|
|
@ -82,7 +82,7 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
|||
}
|
||||
else
|
||||
{
|
||||
System.out.println("parsedMsg = null");
|
||||
//System.out.println("parsedMsg = null");
|
||||
}
|
||||
if (event.isError())
|
||||
{
|
||||
|
@ -131,4 +131,4 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -49,6 +49,7 @@ import org.eclipse.rse.model.SystemResourceChangeEvent;
|
|||
import org.eclipse.rse.model.SystemStartHere;
|
||||
import org.eclipse.rse.persistence.IRSEPersistenceManager;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
import org.eclipse.rse.services.clientserver.messages.ISystemMessageProvider;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
|
||||
import org.eclipse.rse.ui.actions.ISystemDynamicPopupMenuExtension;
|
||||
|
@ -68,7 +69,7 @@ import org.osgi.framework.BundleContext;
|
|||
/**
|
||||
* Plugin for the core remote systems support.
|
||||
*/
|
||||
public class RSEUIPlugin extends SystemBasePlugin
|
||||
public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvider
|
||||
{
|
||||
public static final String PLUGIN_ID = "org.eclipse.rse.ui";
|
||||
public static final String HELPPREFIX = "org.eclipse.rse.ui.";
|
||||
|
@ -1354,6 +1355,12 @@ public class RSEUIPlugin extends SystemBasePlugin
|
|||
{
|
||||
return messageFile;
|
||||
}
|
||||
|
||||
public SystemMessage getMessage(String msgId)
|
||||
{
|
||||
return getPluginMessage(msgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a message from this plugin's message file
|
||||
* @param msgId - the ID of the message to retrieve. This is the concatenation of the
|
||||
|
|
|
@ -1020,8 +1020,8 @@ Contributors:
|
|||
<LevelTwo>You do not have write permission to the file %1 on %2. You can open the file in browse (read-only) mode. If you want to edit the file, change file permissions to allow write access to the file.</LevelTwo>
|
||||
</Message>
|
||||
<Message ID="5003" Indicator="E">
|
||||
<LevelOne>File %1 can not be saved on %2. You do not have read access to the file.</LevelOne>
|
||||
<LevelTwo>Change file permissions to ensure you have read access to the file.</LevelTwo>
|
||||
<LevelOne>File %1 can not be saved on %2. You do not have write access to the file.</LevelOne>
|
||||
<LevelTwo>Change file permissions to ensure you have write access to the file.</LevelTwo>
|
||||
</Message>
|
||||
<Message ID="5004" Indicator="E">
|
||||
<LevelOne>File %1 can not be saved on %2. You do not have write access to the file.</LevelOne>
|
||||
|
|
Loading…
Add table
Reference in a new issue