1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

fixes for 154302 - relaying exceptions back from fetch operations

This commit is contained in:
David McKnight 2006-08-25 13:49:00 +00:00
parent e3e179d5a2
commit 400065dc6a
11 changed files with 120 additions and 42 deletions

View file

@ -17,6 +17,7 @@
package samples.ui.propertypages;
import org.eclipse.rse.files.ui.propertypages.SystemAbstractRemoteFilePropertyPageExtensionAction;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.swt.events.SelectionEvent;
@ -196,6 +197,8 @@ public class FolderInfoPropertyPage
*/
private void walkFolder(IRemoteFile currFolder)
{
try
{
IRemoteFile[] folders = currFolder.getParentRemoteFileSubSystem().listFoldersAndFiles(currFolder);
if ((folders != null) && (folders.length>0))
{
@ -216,6 +219,11 @@ public class FolderInfoPropertyPage
}
}
}
}
catch (SystemMessageException e)
{
}
} // end of walkFolder method
} // end of inner class

View file

@ -49,6 +49,7 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType;
import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty;
@ -92,12 +93,19 @@ public class RSEFileStoreRemoteFileWrapper extends FileStore implements IFileSto
}
else
{
IRemoteFile[] children = _subSystem.listFoldersAndFiles(_remoteFile);
names = new String[children.length];
for (int i = 0; i < children.length; i++)
try
{
names[i] = ((IRemoteFile)children[i]).getName();
}
IRemoteFile[] children = _subSystem.listFoldersAndFiles(_remoteFile);
names = new String[children.length];
for (int i = 0; i < children.length; i++)
{
names[i] = ((IRemoteFile)children[i]).getName();
}
}
catch (SystemMessageException e)
{
names = new String[0];
}
}
prefStore.setValue(ISystemPreferencesConstants.SHOWHIDDEN, false);
return names;

View file

@ -141,6 +141,8 @@ public class SystemExtractAction extends SystemBaseAction
public void run(IProgressMonitor monitor)
{
try
{
IRemoteFile[] sources = sourceSS.listFoldersAndFiles(selection);
for (int j = 0; j < sources.length && !monitor.isCanceled(); j++)
{
@ -168,6 +170,12 @@ public class SystemExtractAction extends SystemBaseAction
System.out.println("Could not extract " + sources[j].getAbsolutePath());
}
}
}
catch (SystemMessageException e)
{
SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
dlg.open();
}
}
}

View file

@ -304,16 +304,23 @@ public class UniversalFileTransferUtility
else
{
tempFolder = getTempFileFor(srcFileOrFolder);
IRemoteFile[] children = srcFS.listFoldersAndFiles(srcFileOrFolder);
SystemRemoteResourceSet childSet = new SystemRemoteResourceSet(srcFS, children);
SystemWorkspaceResourceSet childResults = copyRemoteResourcesToWorkspace(childSet, monitor);
if (childResults.hasMessage())
try
{
resultSet.setMessage(childResults.getMessage());
IRemoteFile[] children = srcFS.listFoldersAndFiles(srcFileOrFolder);
SystemRemoteResourceSet childSet = new SystemRemoteResourceSet(srcFS, children);
SystemWorkspaceResourceSet childResults = copyRemoteResourcesToWorkspace(childSet, monitor);
if (childResults.hasMessage())
{
resultSet.setMessage(childResults.getMessage());
}
resultSet.addResource(tempFolder);
}
catch (SystemMessageException e)
{
e.printStackTrace();
}
resultSet.addResource(tempFolder);
}
}
}
@ -461,7 +468,15 @@ public class UniversalFileTransferUtility
else
{
tempFolder = getTempFileFor(srcFileOrFolder);
IRemoteFile[] children = srcFS.listFoldersAndFiles(srcFileOrFolder);
IRemoteFile[] children = null;
try
{
children = srcFS.listFoldersAndFiles(srcFileOrFolder);
}
catch (SystemMessageException e)
{
e.printStackTrace();
}
IResource[] childResources = new IResource[children.length];
if (children != null)

View file

@ -31,6 +31,7 @@ import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType;
import org.eclipse.rse.internal.subsystems.shells.subsystems.RemoteCmdSubSystem;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
@ -562,7 +563,13 @@ public class CommandEntryContentAssistProcessor implements IContentAssistProcess
}
else
{
fileList = workingDirectory.getParentRemoteFileSubSystem().listFoldersAndFiles(workingDirectory, currentText + "*");
try
{
fileList = workingDirectory.getParentRemoteFileSubSystem().listFoldersAndFiles(workingDirectory, currentText + "*");
}
catch (SystemMessageException e)
{
}
}
//_provider.getChildren(workingDirectory);

View file

@ -47,6 +47,7 @@ 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.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.swt.widgets.Display;
@ -321,7 +322,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param context The holder of state information
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context)
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context) throws SystemMessageException
{
String parentPath = null;
if (parent != null) {
@ -329,15 +330,15 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
} else {
parentPath = "/";
}
IHostFile[] results = null;
try
if (!parent.canRead())
{
results = getFilesAndFolders(null, parentPath, fileNameFilter);
}
catch (SystemMessageException e)
{
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_UNREADABLE).makeSubstitution(parentPath);
throw new SystemMessageException(msg);
}
IHostFile[] results = getFilesAndFolders(null, parentPath, fileNameFilter);
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
return farr;

View file

@ -108,38 +108,38 @@ public interface IRemoteFileSubSystem extends ISubSystem{
* Return a list of roots/drives on the remote system.
* This version is called directly by users.
*/
public IRemoteFile[] listRoots() throws InterruptedException;
public IRemoteFile[] listRoots() throws InterruptedException, SystemMessageException;
/**
* Return a list of all remote folders in the given parent folder on the remote system
* @param parent The parent folder to list folders in
*/
public IRemoteFile[] listFolders(IRemoteFile parent);
public IRemoteFile[] listFolders(IRemoteFile parent) throws SystemMessageException;
/**
* Return a full list of remote folders in the given parent folder on the remote system.
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter);
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter) throws SystemMessageException;
/**
* Return a list of all remote files in the given parent folder on the remote system
* @param parent The parent folder to list files in
*/
public IRemoteFile[] listFiles(IRemoteFile parent);
public IRemoteFile[] listFiles(IRemoteFile parent) throws SystemMessageException;
/**
* Return a list of remote files in the given folder, which match the given name pattern.
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter);
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter) throws SystemMessageException;
/**
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent);
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent) throws SystemMessageException;
/**
* Return a list of remote folders and files in the given folder. Only file names are subsettable
@ -147,7 +147,7 @@ public interface IRemoteFileSubSystem extends ISubSystem{
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter);
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter) throws SystemMessageException;
/**
* Return a list of remote folders and files in the given folder.
@ -159,7 +159,7 @@ public interface IRemoteFileSubSystem extends ISubSystem{
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param context The holder of state information
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context);
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context) throws SystemMessageException;
/**
* Return a subsetted list of remote folders in the given parent folder on the remote system.
@ -169,7 +169,7 @@ public interface IRemoteFileSubSystem extends ISubSystem{
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded
* @param context The holder of state information
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context);
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context) throws SystemMessageException;
/**
* Return a list of remote files in the given folder, which match the given name pattern.
@ -179,7 +179,7 @@ public interface IRemoteFileSubSystem extends ISubSystem{
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
* @param context The holder of state information
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context);
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context) throws SystemMessageException;
/**
* Given a search configuration, searches for its results.
* @param searchConfig a search configuration.

View file

@ -608,7 +608,8 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
}
Object[] children = null;
try
{
// if parent exists, get its children according to the filter
if (parent != null && parentExists)
{
@ -668,6 +669,12 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
msg.makeSubstitution(parent.getAbsolutePath());
children[0] = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR, null);
}
}
catch (SystemMessageException e)
{
children = new SystemMessageObject[1];
children[0] = new SystemMessageObject(e.getSystemMessage(), ISystemMessageObject.MSGTYPE_ERROR, null);
}
return children;
}
@ -717,6 +724,8 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
this.monitor = monitor;
RemoteFileFilterString fs = null;
try
{
//System.out.println("Inside internalResolveFilterString for parent '"+parent+"' for filterstring '" + filterString+"'");
if (filterString == null) // this will be the case when we want to support merging of filter strings
{
@ -774,13 +783,20 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
}
else
return new Object[] {
};
};}
catch (SystemMessageException e)
{
SystemMessageObject[] children = new SystemMessageObject[1];
children[0] = new SystemMessageObject(e.getSystemMessage(), ISystemMessageObject.MSGTYPE_ERROR, null);
return children;
}
}
/**
* Do one filter string relative resolve
*/
protected Object[] internalResolveOneFilterString(IProgressMonitor monitor, Object parent, RemoteFileFilterString fs, boolean sort)
throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException
throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException, SystemMessageException
{
currFilterString = fs;
String filterString = fs.toStringNoSwitches();
@ -826,7 +842,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* Return a list of all remote folders in the given parent folder on the remote system
* @param parent The parent folder to list folders in
*/
public IRemoteFile[] listFolders(IRemoteFile parent)
public IRemoteFile[] listFolders(IRemoteFile parent) throws SystemMessageException
{
return listFolders(parent, null);
}
@ -836,7 +852,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter)
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter) throws SystemMessageException
{
RemoteFileFilterString filterString = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration());
filterString.setPath(parent.getAbsolutePath());
@ -853,7 +869,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* Return a list of all remote files in the given parent folder on the remote system
* @param parent The parent folder to list files in
*/
public IRemoteFile[] listFiles(IRemoteFile parent)
public IRemoteFile[] listFiles(IRemoteFile parent) throws SystemMessageException
{
return listFiles(parent, null);
}
@ -863,7 +879,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter)
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter) throws SystemMessageException
{
RemoteFileFilterString filterString = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration());
filterString.setPath(parent.getAbsolutePath());
@ -879,7 +895,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent)
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent) throws SystemMessageException
{
return listFoldersAndFiles(parent, (String) null);
}
@ -892,7 +908,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter)
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter) throws SystemMessageException
{

View file

@ -18,6 +18,7 @@ package org.eclipse.rse.subsystems.files.core.util;
import java.util.Vector;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
@ -78,6 +79,8 @@ public class ValidatorFileUniqueName
isFolder ? RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FOLDERNAME_NOTVALID) :
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILENAME_NOTVALID)
);
try
{
IRemoteFile[] contents = parentFolder.getParentRemoteFileSubSystem().listFoldersAndFiles(parentFolder);
if (contents!=null)
{
@ -86,6 +89,10 @@ public class ValidatorFileUniqueName
names[idx] = contents[idx].getName();
setExistingNamesList(names);
}
}
catch (SystemMessageException e)
{
}
//shell.setCursor(null);
org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(shell, null);

View file

@ -425,6 +425,8 @@ public interface ISystemMessages
public static final String MSG_DOWNLOAD_ALREADY_OPEN_IN_EDITOR = "RSEF5009"; //$NON-NLS-1$
public static final String MSG_UPLOAD_FILE_EXISTS = "RSEF5012"; //$NON-NLS-1$
public static final String MSG_FOLDER_UNREADABLE = "RSEF5020";
// General error message
public static final String MSG_ERROR_GENERAL = "RSEO1002"; //$NON-NLS-1$

View file

@ -1070,6 +1070,12 @@ Contributors:
<LevelOne>Parent folder %1 does not exist. Verify that the correct path was entered.</LevelOne>
<LevelTwo></LevelTwo>
</Message>
<Message ID="5020" Indicator="I">
<LevelOne>Folder %1 is not readable. Cannot expand</LevelOne>
<LevelTwo></LevelTwo>
</Message>
<!-- Import/Export messages -->
<Message ID="5101" Indicator="E">