1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 04:55:22 +02:00

231346] fix: [api][regression] No longer able to restrict selection to files only in SystemSelectRemoteFileAction

This commit is contained in:
Xuan Chen 2008-05-20 20:27:48 +00:00
parent 1d590ac654
commit 64d8b908b1

View file

@ -84,7 +84,7 @@ public class SystemSelectRemoteFileAction extends SystemBaseDialogAction
private boolean showPropertySheetDetailsButton = false; private boolean showPropertySheetDetailsButton = false;
private boolean multipleSelectionMode = false; private boolean multipleSelectionMode = false;
private boolean onlyConnection = false; private boolean onlyConnection = false;
private IValidatorRemoteSelection selectionValidator; private IValidatorRemoteSelection clientProvidedSelectionValidator = null;
private List viewerFilters = new ArrayList(); private List viewerFilters = new ArrayList();
private SystemActionViewerFilter customViewerFilter = null; private SystemActionViewerFilter customViewerFilter = null;
private boolean allowFolderSelection = true; private boolean allowFolderSelection = true;
@ -92,10 +92,12 @@ public class SystemSelectRemoteFileAction extends SystemBaseDialogAction
static class RemoteFileSelectionValidator implements IValidatorRemoteSelection static class RemoteFileSelectionValidator implements IValidatorRemoteSelection
{ {
private boolean allowFolderSelect = true; private boolean allowFolderSelect = true;
public RemoteFileSelectionValidator(boolean allowFolderSelection) private IValidatorRemoteSelection previousInChain = null;
public RemoteFileSelectionValidator(boolean allowFolderSelection, IValidatorRemoteSelection previousInChain)
{ {
super(); super();
this.allowFolderSelect = allowFolderSelection; this.allowFolderSelect = allowFolderSelection;
this.previousInChain = previousInChain;
} }
/** /**
@ -117,7 +119,14 @@ public class SystemSelectRemoteFileAction extends SystemBaseDialogAction
if (allowFolderSelect == true) if (allowFolderSelect == true)
{ {
return null; if (previousInChain != null)
{
return previousInChain.isValid(selectedConnection, selectedObjects, remoteAdaptersForSelectedObjects);
}
else
{
return null;
}
} }
for (int i = 0; i < selectedObjects.length; i++) for (int i = 0; i < selectedObjects.length; i++)
@ -134,6 +143,11 @@ public class SystemSelectRemoteFileAction extends SystemBaseDialogAction
} }
} }
if (previousInChain != null)
{
return previousInChain.isValid(selectedConnection, selectedObjects, remoteAdaptersForSelectedObjects);
}
return null; return null;
} }
@ -338,7 +352,7 @@ public class SystemSelectRemoteFileAction extends SystemBaseDialogAction
*/ */
public void setSelectionValidator(IValidatorRemoteSelection selectionValidator) public void setSelectionValidator(IValidatorRemoteSelection selectionValidator)
{ {
this.selectionValidator = selectionValidator; this.clientProvidedSelectionValidator = selectionValidator;
} }
@ -465,7 +479,6 @@ public class SystemSelectRemoteFileAction extends SystemBaseDialogAction
dlg.setMultipleSelectionMode(multipleSelectionMode); dlg.setMultipleSelectionMode(multipleSelectionMode);
dlg.setShowNewConnectionPrompt(showNewConnectionPrompt); dlg.setShowNewConnectionPrompt(showNewConnectionPrompt);
dlg.setSelectionValidator(selectionValidator);
if (systemConnection != null) if (systemConnection != null)
{ {
@ -505,10 +518,8 @@ public class SystemSelectRemoteFileAction extends SystemBaseDialogAction
else else
dlg.enableAddMode(addButtonCallback); dlg.enableAddMode(addButtonCallback);
*/ */
if (selectionValidator == null) IValidatorRemoteSelection selectionValidator = new RemoteFileSelectionValidator(allowFolderSelection, clientProvidedSelectionValidator);
{
selectionValidator = new RemoteFileSelectionValidator(allowFolderSelection);
}
dlg.setSelectionValidator(selectionValidator); dlg.setSelectionValidator(selectionValidator);
/* /*
if (!allowFolderSelection) { if (!allowFolderSelection) {