1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-05 08:05:24 +02:00

Bug 161936: [dstore-win] Cannot create remote file

This commit is contained in:
Kushal Munir 2006-11-02 02:51:05 +00:00
parent 4cad0226b2
commit 60c390b79e
2 changed files with 65 additions and 2 deletions

View file

@ -236,9 +236,28 @@ public class SystemNewFileWizard
*/
protected boolean meetsFilterCriteria(ISystemFilterReference selectedFilterRef, IRemoteFile parentFolder, String newAbsName)
{
boolean meets = false;
IRemoteFileSubSystem parentSubSystem = (IRemoteFileSubSystem)selectedFilterRef.getSubSystem();
meets = parentSubSystem.doesFilterMatch(selectedFilterRef.getReferencedFilter(),newAbsName);
ISystemFilter filter = selectedFilterRef.getReferencedFilter();
// if the filter is "*", this represents the Drives filter on Windows
// we can not create a file directly under it since it doesn't actually represent a container
// if we create a new file or folder by right clicking on this filter, the parent folder defaults to the first drive
// that shows up when this filter is resolved. Hence we ignore this filter from the filter matching criteria
String[] strings = filter.getFilterStrings();
if (strings != null) {
for (int idx = 0; idx < strings.length; idx++) {
if (strings[idx].equals("*")) {
return true;
}
}
}
boolean meets = parentSubSystem.doesFilterMatch(filter, newAbsName);
if (!meets)
{
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_CREATE_RESOURCE_NOTVISIBLE);

View file

@ -32,9 +32,12 @@ import java.util.List;
import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.IHost;
@ -271,6 +274,46 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
// -------------------------
// Filter Testing Methods...
// -------------------------
/**
* @see org.eclipse.rse.core.subsystems.SubSystem#doesFilterMatch(org.eclipse.rse.core.filters.ISystemFilter, java.lang.String)
*/
public boolean doesFilterMatch(ISystemFilter filter, String remoteObjectAbsoluteName) {
if (filter.isPromptable() || !doesFilterTypeMatch(filter, remoteObjectAbsoluteName)) {
return false;
}
boolean would = false;
String[] strings = filter.getFilterStrings();
if (strings != null) {
for (int idx = 0; !would && (idx < strings.length); idx++) {
// for "Drives" filter on Windows, only return match if the absolute path is a drive letter
if (strings[idx].equals("*")) {
IPath path = new Path(remoteObjectAbsoluteName);
if (path.segmentCount() == 0) {
return true;
}
else {
return false;
}
}
else if (strings[idx].equals("./*")) {
would = true;
}
else {
would = doesFilterStringMatch(strings[idx], remoteObjectAbsoluteName, filter.areStringsCaseSensitive());
}
}
}
return would;
}
/**
* Return true if the given remote object name will pass the filtering criteria for
@ -340,6 +383,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
else
return true;
}
/**
* Return true if the given filter string lists the contents of the given remote object.
* For example, if given a folder, return true if the given filter string