Bug 181268 - [api] Options for when ok button is enabled in SystemRemoteFileDialog
Summary: [api] Options for when ok button is enabled in SystemRemoteFileDialog
Status: ASSIGNED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: Future   Edit
Assignee: Kevin Doyle CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: api
: 187011 189429 (view as bug list)
Depends on:
Blocks: 231346
  Show dependency tree
 
Reported: 2007-04-05 14:13 EDT by Kevin Doyle CLA
Modified: 2008-05-13 11:03 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Doyle CLA 2007-04-05 14:13:48 EDT
Currently the "ok" button in SystemRemoteFileDialog is always enabled and hence the user can select anything and click "ok".  I think this should be extended so there are methods available to set when the "ok" button should be enabled.

Possible Methods:

setAllowFolderSelection(boolean)
setAllowFileSelection(boolean)
setAllowFileAndFolderSelection(boolean)

This way the dialog can be used for many different purposes.

-----------Enter bugs above this line-----------
TM 2.0M6 Testing
installation : eclipse-SDK-3.3M6
RSE install  : 2.0 Stream Integration Build - I20070405-0600
java.runtime : Sun 1.5.0_11-b03
os.name:     : Windows XP, Service Pack 2
------------------------------------------------
Comment 1 Martin Oberhuber CLA 2007-04-11 17:26:22 EDT
Additionally, I think that SystemRemoteFolderDialog should not even show files but only folders.
Comment 2 David McKnight CLA 2007-04-27 14:32:14 EDT
Martin, the SystemRemoteFolderDialog does not show files (at least in the cases where I've used).  Is there a case where you do see files?
Comment 3 Martin Oberhuber CLA 2007-05-30 13:01:27 EDT
This looks like an API addition to me, or am I mistaken?
I'd prefer getting API changes done before RC3.
Comment 4 Kevin Doyle CLA 2007-06-01 15:45:40 EDT
I've been taking a look at this for Dave and these are the issue's:

SystemResourceSelectionForm, which is used by the SystemRemoteResourceDialog, is in the package org.eclipse.rse.internal.ui.view.  Ideally it shouldn't be in an internal package, but by having it in the rse.ui package we don't have a dependency on rse.subsystems.files.core.  

To validate the selected object is a file or folder we do something like:

adapter.getRemoteType(selectedObjects[i]).equals(ISystemFileRemoteTypes.TYPE_FILE)

ISystemFileRemoteTypes is in rse.subsystems.files.core though, so that can't be done from where SystemResourceSelectionForm is currently.  As Dave told me the idea behind SystemResourceSelectionForm is for selecting any resource, so moving it to files package wouldn't really make sense either.

I looked at IValidatorRemoteSelection next and they require SystemMessage's to be returned if the selection is not valid and return null if the selection is valid.  Since we don't have SystemMessage's for invalid selections I tried using the FileResources.properties in files.ui and a generic SystemMessage.  This would require the validator's to be in the files.ui package because of the dependency on that properties file, which doesn't make much sense since the validator's aren't ui elements.

Even if we used the FileResources.properties and a generic SystemMessages like this:

invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_E);
invalid.makeSubstitution(FileResources.ACTION_SELECT_FILE_TOOLTIP);   

We don't have a good message to use about selecting a folder or archive which is  used in the search dialog for selecting a folder and probably in the Project actions.

Should we defer this till 3.0 or how should we go about this?
Comment 5 David McKnight CLA 2007-06-01 15:55:21 EDT
Adding Dave D for additional opinions.
Comment 6 Martin Oberhuber CLA 2007-06-05 11:21:51 EDT
As discussed on committer meeting 2007-06-05:
Validators can be used for enablement, so this does not require an API change.
Comment 7 David McKnight CLA 2007-06-08 10:26:27 EDT
*** Bug 189429 has been marked as a duplicate of this bug. ***
Comment 8 David McKnight CLA 2007-06-08 10:32:39 EDT
*** Bug 187011 has been marked as a duplicate of this bug. ***
Comment 9 Kevin Doyle CLA 2007-07-12 11:27:39 EDT
As I previously mentioned we don't have any real SystemMessages to use and they are required when the selection is not valid by the selection validator.  

We could use the following Strings and use a generic SystemMessage and pass these strings in:
FileResources.ACTION_SELECT_FILE_TOOLTIP = "Select file from remote system"
FileResources.ACTION_SELECT_DIRECTORY_TOOLTIP = "Select folder from remote system"

Though we don't have one for Select Folder dialog where Archives are usually allowed, so using the string above isn't a good idea for that.

Martin, what do you think?  Should we just defer this to 3.0 or should I use these strings in the places they can be and have the other dialogs just work the way they are now?
Comment 10 Martin Oberhuber CLA 2007-07-12 11:43:59 EDT
I think that in general we should avoid re-using Strings that are meant for something else. This is a hack which could have adverse effects in the future, and is not worth it for now.

I think there's other stuff with higher priority to attack for 2.0.1.
Comment 11 Kevin Doyle CLA 2007-07-12 11:51:06 EDT
Agreed.  Assigning to Future.
Comment 12 Martin Oberhuber CLA 2008-05-13 11:03:22 EDT
(In reply to comment #4)

Kevin it looks like the ability to use a Validator in order to restrict resource selection to certain types (files, folders, particular types of files) is a requirement for fixing the regression in bug 231346.

The IValidatorRemoteSelection is a UI interface, so corresponding implementations require org.eclipse.rse.ui anyways. Does the new SimpleSystemMessage API and its current use help for creating proper Validators that clients can use? - It seems to me, that some pre-defined validator(s) for remote files and folders should live in org.eclipse.rse.files.ui, as a subclass of ValidatorRemoteSelection.

By living in files.ui, the Validator can use the existing SystemMessages or NLS Strings from files.ui.

I could imagine an API Class with a Constructor like this:

new RemoteFileValidator(boolean allowFiles, boolean allowFolders, String filter)