| Re: [dsdp-tm-dev] Re: dsdp-tm-dev Digest, Vol 46, Issue 10 |
Hi Vrushali,
I don't think that dialog allows you to do that by itself. I suspect that we would need a new API in order to control the input that way since, I don't see anything that allows for a custom input provider. A bug should be opened for that.
In the meantime, you could try working around this via the following (although it would have warnings for use of internals):
You could write your own input provider like this:
import org.eclipse.rse.internal.files.ui.view.SystemRemoteFileSelectionInputProvider;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
public class MyFileSelectionInputProvider extends
SystemRemoteFileSelectionInputProvider {
private IRemoteFile _remoteFileInput;
public MyFileSelectionInputProvider(IRemoteFile remoteFileInput){
super(remoteFileInput.getParentRemoteFileSubSystem().getHost());
_remoteFileInput = remoteFileInput;
}
public Object[] getSystemViewRoots() {
return new Object[] {_remoteFileInput};
}
}
Then extend SystemRemoteResourceDialog like this so that your own input provider is used:
public class MyRemoteFileDialog extends SystemRemoteResourceDialog {
public MyRemoteFileDialog(Shell shell, String title, IRemoteFile remoteFileInput) {
super(shell, title, new MyFileSelectionInputProvider(remoteFileInput));
}
public String getVerbiage()
{
return SystemFileResources.RESID_SELECTFILE_VERBIAGE;
}
public String getTreeTip()
{
return SystemFileResources.RESID_SELECTFILE_SELECT_TOOLTIP;
}
public SystemActionViewerFilter getViewerFilter()
{
return null;
}
/**
* Override of parent.
*/
protected Control createContents(Composite parent)
{
Control control = super.createContents(parent);
getSystemTree().addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
handleDoubleClick(event);
}
});
return control;
}
/**
* Handles double clicks in viewer.
* Closes the dialog if a file is double clicked
*/
protected void handleDoubleClick(DoubleClickEvent event)
{
ISystemTree tree = getSystemTree();
IStructuredSelection s = (IStructuredSelection) event.getSelection();
Object element = s.getFirstElement();
if (element == null)
return;
if (isPageComplete() && !tree.isExpandable(element))
{
setReturnCode(OK);
if (processOK())
{
okPressed = true;
close();
}
}
}
}
I hope this helps,
____________________________________
David McKnight
Phone: 905-413-3902 , T/L: 969-3902
Internet: dmcknigh@xxxxxxxxxx
Mail: D1/YFY/8200/TOR
____________________________________
vrushali babar <vrush_com@xxxxxxxxx>
Sent by: dsdp-tm-dev-bounces@xxxxxxxxxxx 26/05/2009 09:04 AM
|
|
| Hi David, I tried preSelection but it expands the location that I pass as a parameter and does not restrict. If the hierarchy is A ---B ----D ----E ----G ---C ----F ----G And allowed location path is A/B/*, It should only display hierarchy for directories/files under A/B/ . Could you tell me where am I going wrong or any other method? Thanks a lot, Vrushali. --- On Fri, 5/22/09, dsdp-tm-dev-request@xxxxxxxxxxx <dsdp-tm-dev-request@xxxxxxxxxxx> wrote:
|