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

[180974] select remote folder action now using SystemRemoteFolderDialog

This commit is contained in:
David McKnight 2007-04-20 17:01:54 +00:00
parent cf79eddb02
commit b08e6ce19e
3 changed files with 77 additions and 8 deletions

View file

@ -18,10 +18,12 @@ package org.eclipse.rse.files.ui.actions;
import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.files.ui.ISystemAddFileListener; import org.eclipse.rse.files.ui.ISystemAddFileListener;
import org.eclipse.rse.files.ui.dialogs.SystemSelectRemoteFileOrFolderDialog; import org.eclipse.rse.files.ui.dialogs.SystemRemoteFileDialog;
import org.eclipse.rse.files.ui.dialogs.SystemRemoteFolderDialog;
import org.eclipse.rse.internal.files.ui.FileResources; import org.eclipse.rse.internal.files.ui.FileResources;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.ui.actions.SystemBaseDialogAction; import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
import org.eclipse.rse.ui.dialogs.SystemRemoteResourceDialog;
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
@ -59,6 +61,7 @@ import org.eclipse.swt.widgets.Shell;
public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction
{ {
private String[] systemTypes; private String[] systemTypes;
private boolean foldersOnly = false;
private IHost systemConnection, outputConnection; private IHost systemConnection, outputConnection;
private IHost rootFolderConnection; private IHost rootFolderConnection;
private IRemoteFile preSelection; private IRemoteFile preSelection;
@ -111,6 +114,11 @@ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction
this.dlgTitle = title; this.dlgTitle = title;
} }
public void setFoldersOnly(boolean flag)
{
this.foldersOnly = flag;
}
/** /**
* Set the message shown at the top of the form * Set the message shown at the top of the form
*/ */
@ -353,6 +361,7 @@ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction
public IRemoteFile getSelectedFolder() public IRemoteFile getSelectedFolder()
{ {
Object o = getValue(); Object o = getValue();
System.out.println("selected = "+o);
if (o instanceof IRemoteFile[]) if (o instanceof IRemoteFile[])
return ((IRemoteFile[])o)[0]; return ((IRemoteFile[])o)[0];
else if (o instanceof IRemoteFile) else if (o instanceof IRemoteFile)
@ -433,20 +442,51 @@ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction
*/ */
protected Dialog createDialog(Shell shell) protected Dialog createDialog(Shell shell)
{ {
SystemRemoteResourceDialog dlg = null;
if (foldersOnly)
{
if (dlgTitle == null)
{
dlg = new SystemRemoteFolderDialog(shell);
}
else
{
dlg = new SystemRemoteFolderDialog(shell, dlgTitle);
}
}
else
{
if (dlgTitle == null)
{
dlg = new SystemRemoteFileDialog(shell);
}
else
{
dlg = new SystemRemoteFileDialog(shell, dlgTitle);
}
}
dlg.setMultipleSelectionMode(multipleSelectionMode);
if (systemConnection != null)
{
dlg.setDefaultSystemConnection(systemConnection, onlyConnection);
}
/*
SystemSelectRemoteFileOrFolderDialog dlg = null; SystemSelectRemoteFileOrFolderDialog dlg = null;
if (dlgTitle == null) if (dlgTitle == null)
dlg = new SystemSelectRemoteFileOrFolderDialog(shell, false); // false => folder vs file mode dlg = new SystemSelectRemoteFileOrFolderDialog(shell, false); // false => folder vs file mode
else else
dlg = new SystemSelectRemoteFileOrFolderDialog(shell, dlgTitle, false); // false => folder vs file mode dlg = new SystemSelectRemoteFileOrFolderDialog(shell, dlgTitle, false); // false => folder vs file mode
dlg.setShowNewConnectionPrompt(showNewConnectionPrompt); dlg.setShowNewConnectionPrompt(showNewConnectionPrompt);
dlg.setMultipleSelectionMode(multipleSelectionMode); dlg.setMultipleSelectionMode(multipleSelectionMode);
dlg.setAllowForMultipleParents(allowForMultipleParents); dlg.setAllowForMultipleParents(allowForMultipleParents);
if (restrictFolders) if (restrictFolders)
dlg.setRestrictFolders(true); dlg.setRestrictFolders(true);
if (message != null)
dlg.setMessage(message);
if (treeTip != null)
dlg.setSelectionTreeToolTipText(treeTip);
if (systemConnection != null) if (systemConnection != null)
{ {
if (onlyConnection) if (onlyConnection)
@ -454,24 +494,39 @@ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction
else else
dlg.setDefaultConnection(systemConnection); dlg.setDefaultConnection(systemConnection);
} }
*/
if (message != null)
dlg.setMessage(message);
if (treeTip != null)
dlg.setSelectionTreeToolTipText(treeTip);
if (systemTypes != null) if (systemTypes != null)
dlg.setSystemTypes(systemTypes); dlg.setSystemTypes(systemTypes);
/*
if (expandDepth != 0) if (expandDepth != 0)
dlg.setAutoExpandDepth(expandDepth); dlg.setAutoExpandDepth(expandDepth);
*/
if (preSelection != null) if (preSelection != null)
dlg.setPreSelection(preSelection); dlg.setPreSelection(preSelection);
/*
else if (rootFolderConnection != null) else if (rootFolderConnection != null)
dlg.setRootFolder(rootFolderConnection, rootFolderAbsPath); dlg.setRootFolder(rootFolderConnection, rootFolderAbsPath);
*/
if (showPropertySheet) if (showPropertySheet)
if (showPropertySheetDetailsButton) if (showPropertySheetDetailsButton)
dlg.setShowPropertySheet(true, showPropertySheetDetailsButtonInitialState); dlg.setShowPropertySheet(true, showPropertySheetDetailsButtonInitialState);
else else
dlg.setShowPropertySheet(true); dlg.setShowPropertySheet(true);
/*
if (addButtonCallback != null) if (addButtonCallback != null)
if ((addLabel!=null) || (addToolTipText!=null)) if ((addLabel!=null) || (addToolTipText!=null))
dlg.enableAddMode(addButtonCallback, addLabel, addToolTipText); dlg.enableAddMode(addButtonCallback, addLabel, addToolTipText);
else else
dlg.enableAddMode(addButtonCallback); dlg.enableAddMode(addButtonCallback);
*/
if (selectionValidator != null) if (selectionValidator != null)
dlg.setSelectionValidator(selectionValidator); dlg.setSelectionValidator(selectionValidator);
@ -483,7 +538,7 @@ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction
*/ */
protected Object getDialogValue(Dialog dlg) protected Object getDialogValue(Dialog dlg)
{ {
SystemSelectRemoteFileOrFolderDialog ourDlg = (SystemSelectRemoteFileOrFolderDialog)dlg; SystemRemoteResourceDialog ourDlg = (SystemRemoteResourceDialog)dlg;
Object outputObject = null; Object outputObject = null;
outputConnection = null; outputConnection = null;
if (!ourDlg.wasCancelled()) if (!ourDlg.wasCancelled())

View file

@ -505,6 +505,7 @@ public class SystemRemoteFolderCombo extends Composite implements ISystemCombo
browseAction = getBrowseAction(getShell()); browseAction = getBrowseAction(getShell());
} }
//if (connection != null) //if (connection != null)
browseAction.setFoldersOnly(true);
browseAction.setHost(connection); browseAction.setHost(connection);
//if (systemTypes != null) //if (systemTypes != null)
browseAction.setSystemTypes(systemTypes); browseAction.setSystemTypes(systemTypes);

View file

@ -411,12 +411,24 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste
protected void handleDestinationBrowseButtonPressed() { protected void handleDestinationBrowseButtonPressed() {
SystemSelectRemoteFolderAction action = new SystemSelectRemoteFolderAction(this.getShell()); SystemSelectRemoteFolderAction action = new SystemSelectRemoteFolderAction(this.getShell());
action.setShowNewConnectionPrompt(true); action.setShowNewConnectionPrompt(true);
action.setFoldersOnly(true);
action.setShowPropertySheet(true, false); action.setShowPropertySheet(true, false);
String destValue = getDestinationValue();
if (destValue != null)
{
IHost host = Utilities.parseForSystemConnection(destValue);
IRemoteFile path = Utilities.parseForIRemoteFile(destValue);
action.setHost(host);
action.setPreSelection(path);
}
action.run(); action.run();
IRemoteFile folder = action.getSelectedFolder(); IRemoteFile folder = action.getSelectedFolder();
if (folder != null) { if (folder != null) {
destinationFolder = new UniFilePlus(folder); destinationFolder = new UniFilePlus(folder);
setDestinationValue(Utilities.getAsString((UniFilePlus) destinationFolder)); destValue = Utilities.getAsString((UniFilePlus)destinationFolder);
setDestinationValue(destValue);
} }
} }
@ -596,6 +608,7 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste
String[] newItems = new String[oldLength + 1]; String[] newItems = new String[oldLength + 1];
System.arraycopy(currentItems, 0, newItems, 0, oldLength); System.arraycopy(currentItems, 0, newItems, 0, oldLength);
newItems[oldLength] = path; newItems[oldLength] = path;
destinationNameField.setText(path);
destinationNameField.setItems(newItems); destinationNameField.setItems(newItems);
selectionIndex = oldLength; selectionIndex = oldLength;
} else { } else {