### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.files.ui Index: src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteArchiveSelectAction.java =================================================================== RCS file: src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteArchiveSelectAction.java diff -N src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteArchiveSelectAction.java --- src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteArchiveSelectAction.java 5 Jun 2007 10:54:41 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.internal.files.ui.actions; - -import org.eclipse.rse.files.ui.dialogs.SystemRemoteArchiveDialog; -import org.eclipse.rse.ui.dialogs.SystemRemoteResourceDialog; -import org.eclipse.swt.widgets.Shell; - - - -public class SystemRemoteArchiveSelectAction extends - SystemRemoteFileSelectAction -{ - public SystemRemoteArchiveSelectAction(Shell shell) - { - super(shell); - } - - public SystemRemoteArchiveSelectAction(Shell shell, String label, String tooltip) - { - super(shell, label, tooltip); - } - - protected SystemRemoteResourceDialog createRemoteResourceDialog(Shell shell, String title) - { - return new SystemRemoteArchiveDialog(shell, title); - } - - protected SystemRemoteResourceDialog createRemoteResourceDialog(Shell shell) - { - return new SystemRemoteArchiveDialog(shell); - } -} Index: src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSelectAction.java =================================================================== RCS file: src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSelectAction.java diff -N src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSelectAction.java --- src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSelectAction.java 1 Jun 2007 12:52:15 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,508 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType - * Martin Oberhuber (Wind River) - [190442] made SystemActionViewerFilter API - ********************************************************************************/ - -package org.eclipse.rse.internal.files.ui.actions; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.files.ui.ISystemAddFileListener; -import org.eclipse.rse.files.ui.dialogs.SystemRemoteFileDialog; -import org.eclipse.rse.internal.files.ui.FileResources; -import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; -import org.eclipse.rse.ui.SystemActionViewerFilter; -import org.eclipse.rse.ui.actions.SystemBaseDialogAction; -import org.eclipse.rse.ui.dialogs.SystemRemoteResourceDialog; -import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; -import org.eclipse.swt.widgets.Shell; - - - -/** - * The action for allowing the user to select a remote file. - *
- * To configure the functionality, call these methods: - *
- * To configure the text on the dialog, call these methods: - *
- * After running, call these methods to get the output: - *
null
to allow all registered valid system types.
- * A system type is valid if at least one subsystem configuration
- * is registered against it.
- */
- public void setSystemTypes(IRSESystemType[] systemTypes)
- {
- this.systemTypes = systemTypes;
- }
- /**
- * Convenience method to restrict to a single system type.
- * Same as setSystemTypes(new IRSESystemType[] {systemType})
- *
- * @param systemType The name of the system type to restrict to, or
- * null
to allow all registered valid system types.
- * A system type is valid if at least one subsystem configuration
- * is registered against it.
- */
- public void setSystemType(IRSESystemType systemType)
- {
- if (systemType == null)
- setSystemTypes(null);
- else
- setSystemTypes(new IRSESystemType[] {systemType});
- }
-
- /**
- * Set to true if a "New Connection..." special connection is to be shown for creating new connections
- */
- public void setShowNewConnectionPrompt(boolean show)
- {
- }
-
-
- /**
- * Set the root folder from which to start listing files.
- * This version identifies the folder via a connection object and absolute path.
- * There is another overload that identifies the folder via a single IRemoteFile object.
- * - * This call effectively transforms the select dialog by: - *
- * This call effectively transforms the select dialog by: - *
- * When a library is selected, the caller is called back to decide to enable the Add - * button or not. - */ - public void enableAddMode(ISystemAddFileListener caller) - { - } - /** - * Overloaded method that allows setting the label and tooltip text of the Add button. - * If you pass null for the label, the default is used ("Add"). - */ - public void enableAddMode(ISystemAddFileListener caller, String addLabel, String addToolTipText) - { - enableAddMode(caller); - } - - /** - * Show the property sheet on the right hand side, to show the properties of the - * selected object. - *
- * Default is false - */ - public void setShowPropertySheet(boolean show) - { - this.showPropertySheet = show; - } - /** - * Show the property sheet on the right hand side, to show the properties of the - * selected object. - *
- * This overload shows a Details>>> button so the user can decide if they want to see the - * property sheet. - *
- * @param show True if to show the property sheet within the dialog - * @param initialState True if the property is to be initially displayed, false if it is not - * to be displayed until the user presses the Details button. - */ - public void setShowPropertySheet(boolean show, boolean initialState) - { - setShowPropertySheet(show); - if (show) - { - this.showPropertySheetDetailsButton = true; - this.showPropertySheetDetailsButtonInitialState = initialState; - } - } - - /** - * Set multiple selection mode. Default is single selection mode - *
- * If you turn on multiple selection mode, you must use the getSelectedObjects() - * method to retrieve the list of selected objects. - * - * @see #getSelectedObjects() - */ - public void setMultipleSelectionMode(boolean multiple) - { - this.multipleSelectionMode = multiple; - } - - /* - * Indicates whether to allow selection of objects from differnet parents - */ - public void setAllowForMultipleParents(boolean multiple) - { - } - - /** - * Specify a validator to use when the user selects a remote file or folder. - * This allows you to decide if OK should be enabled or not for that remote file or folder. - */ - public void setSelectionValidator(IValidatorRemoteSelection selectionValidator) - { - this.selectionValidator = selectionValidator; - } - - // ----------------- - // OUTPUT METHODS... - // ----------------- - /** - * Retrieve selected file object. If multiple files selected, returns the first. - */ - public IRemoteFile getSelectedFile() - { - Object o = getValue(); - if (o instanceof IRemoteFile[]) - return ((IRemoteFile[])o)[0]; - else if (o instanceof IRemoteFile) - return (IRemoteFile)o; - else - return null; - } - /** - * Retrieve selected file objects. If no files selected, returns an array of zero. - * If one file selected returns an array of one. - */ - public IRemoteFile[] getSelectedFiles() - { - Object o = getValue(); - if (o instanceof IRemoteFile[]) - return (IRemoteFile[])o; - else if (o instanceof IRemoteFile) - return new IRemoteFile[] {(IRemoteFile)o}; - else if (o instanceof Object[]) - { - Object[] objs= (Object[])o; - IRemoteFile[] files = new IRemoteFile[objs.length]; - for (int i = 0; i < objs.length; i++) - { - files[i]= (IRemoteFile)objs[i]; - } - return files; - } - else - return new IRemoteFile[0]; - } - - - - /** - * Return all selected objects. This method will return an array of one - * unless you have called setMultipleSelectionMode(true)! - *
- * It will always return null if the user cancelled the dialog. - * - * @see #setMultipleSelectionMode(boolean) - */ - public Object[] getSelectedObjects() - { - Object remoteObject = getValue(); - if (remoteObject == null) - return null; - else if (remoteObject instanceof Object[]) - return (Object[])remoteObject; - else if (remoteObject instanceof IRemoteFile[]) - return (Object[])remoteObject; - else - return null; - } - - /** - * Return selected connection - */ - public IHost getSelectedConnection() - { - return outputConnection; - } - - // ------------------- - // INTERNAL METHODS... - // ------------------- - - protected SystemRemoteResourceDialog createRemoteResourceDialog(Shell shell, String title) - { - return new SystemRemoteFileDialog(shell, title); - } - - protected SystemRemoteResourceDialog createRemoteResourceDialog(Shell shell) - { - return new SystemRemoteFileDialog(shell); - } - - /** - * Called by eclipse when user selects this action - */ - protected Dialog createDialog(Shell shell) - { - SystemRemoteResourceDialog dlg = null; - if (dlgTitle == null) - { - dlg = createRemoteResourceDialog(shell); - } - else - { - dlg = createRemoteResourceDialog(shell, dlgTitle); - } - - if (customViewerFilter != null) - { - dlg.setCustomViewerFilter(customViewerFilter); - } - dlg.setMultipleSelectionMode(multipleSelectionMode); - - if (message != null) - dlg.setMessage(message); - if (treeTip != null) - dlg.setSelectionTreeToolTipText(treeTip); - - if (systemConnection != null) - { - dlg.setDefaultSystemConnection(systemConnection, onlyConnection); - } - - if (systemTypes != null) - { - dlg.setSystemTypes(systemTypes); - } - - if (preSelection != null) - { - dlg.setPreSelection(preSelection); - } - - if (showPropertySheet) - { - if (showPropertySheetDetailsButton) - dlg.setShowPropertySheet(true, showPropertySheetDetailsButtonInitialState); - else - dlg.setShowPropertySheet(true); - } - if (selectionValidator != null) - dlg.setSelectionValidator(selectionValidator); - - return dlg; - } - - /** - * Required by parent. We return the selected object - */ - protected Object getDialogValue(Dialog dlg) - { - SystemRemoteResourceDialog ourDlg = (SystemRemoteResourceDialog)dlg; - Object outputObject = null; - outputConnection = null; - if (!ourDlg.wasCancelled()) - { - if (multipleSelectionMode) - outputObject = ourDlg.getSelectedObjects(); - else - outputObject = ourDlg.getSelectedObject(); - outputConnection = ourDlg.getSelectedConnection(); - } - return outputObject; // parent class calls setValue on what we return - } - - public void setCustomViewerFilter(SystemActionViewerFilter filter) - { - customViewerFilter = filter; - } -} \ No newline at end of file Index: src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFolderSelectAction.java =================================================================== RCS file: src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFolderSelectAction.java diff -N src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFolderSelectAction.java --- src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFolderSelectAction.java 1 Jun 2007 12:52:15 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,128 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * Martin Oberhuber (Wind River) - Add Javadoc - ********************************************************************************/ - -package org.eclipse.rse.internal.files.ui.actions; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.files.ui.ISystemAddFileListener; -import org.eclipse.rse.files.ui.dialogs.SystemRemoteFolderDialog; -import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; -import org.eclipse.rse.ui.dialogs.SystemRemoteResourceDialog; -import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; -import org.eclipse.swt.widgets.Shell; - - -/** - * The action for allowing the user to select a remote folder. - *
- * To configure the functionality, call these methods: - *
- * To configure the text on the dialog, call these methods: - *
- * After running, call these methods to get the output: - *
- * Default is false - */ - public void setShowPropertySheet(boolean show) - { - this.showPropertySheet = show; - } - /** - * Show the property sheet on the right hand side, to show the properties of the - * selected object. - *
- * This overload shows a Details>>> button so the user can decide if they want to see the - * property sheet. - *
- * @param show True if show the property sheet within the dialog - * @param initialState True if the property is to be initially displayed, false if it is not - * to be displayed until the user presses the Details button. - */ - public void setShowPropertySheet(boolean show, boolean initialState) - { - this.showPropertySheet = show; - this.showPropertySheetInitialState = initialState; - } - - /** - * Set multiple selection mode. Default is single selection mode - *
- * If you turn on multiple selection mode, you must use the getSelectedObjects() - * method to retrieve the list of selected objects. - *
- * Further, if you turn this on, it has the side effect of allowing the user - * to select any remote object. The assumption being if you are prompting for - * files, you also want to allow the user to select a folder, with the meaning - * being that all files within the folder are implicitly selected. - * - * @see #getSelectedObjects() - */ - public void setMultipleSelectionMode(boolean multiple) - { - this.multiSelect = multiple; - } - - /** - * Return the selected connection in single select mode - */ - public IHost getSystemConnection() - { - if (result instanceof IHost) - return (IHost)result; - else if (result instanceof IHost[]) - return ((IHost[])result)[0]; - else - return null; - } - - - /* (non-Javadoc) - * @see org.eclipse.rse.core.ui.actions.SystemBaseDialogAction#createDialog(org.eclipse.swt.widgets.Shell) - */ - protected Dialog createDialog(Shell shell) - { - SystemSelectConnectionDialog selectDlg = new SystemSelectConnectionDialog(shell); - if (defaultConn != null) - selectDlg.setDefaultConnection(defaultConn); - if (systemTypes != null) - selectDlg.setSystemTypes(systemTypes); - else if (systemType != null) - selectDlg.setSystemType(systemType); - selectDlg.setShowNewConnectionPrompt(showNewConnectionPrompt); - if (message != null) - selectDlg.setInstructionLabel(message); - if (showPropertySheet) - selectDlg.setShowPropertySheet(showPropertySheet,showPropertySheetInitialState); - selectDlg.setMultipleSelectionMode(multiSelect); - return selectDlg; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.ui.actions.SystemBaseDialogAction#getDialogValue(org.eclipse.jface.dialogs.Dialog) - */ - protected Object getDialogValue(Dialog dlg) - { - SystemSelectConnectionDialog selectDlg = (SystemSelectConnectionDialog)dlg; - result = selectDlg.getOutputObject(); - return result; - } - - - -} \ No newline at end of file Index: UI/org/eclipse/rse/internal/ui/actions/SystemUpdateConnectionAction.java =================================================================== RCS file: UI/org/eclipse/rse/internal/ui/actions/SystemUpdateConnectionAction.java diff -N UI/org/eclipse/rse/internal/ui/actions/SystemUpdateConnectionAction.java --- UI/org/eclipse/rse/internal/ui/actions/SystemUpdateConnectionAction.java 5 Jun 2007 11:36:52 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.internal.ui.actions; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.internal.ui.SystemResources; -import org.eclipse.rse.internal.ui.dialogs.SystemUpdateConnectionDialog; -import org.eclipse.rse.ui.ISystemContextMenuConstants; -import org.eclipse.rse.ui.actions.SystemBaseDialogAction; -import org.eclipse.swt.widgets.Shell; - - -/** - * The action that displays the Change Connection dialog - * THIS DIALOG AND ITS ACTION ARE NO LONGER USED. THEY ARE REPLACED WITH A PROPERTIES DIALOG. - */ -public class SystemUpdateConnectionAction extends SystemBaseDialogAction - -{ - - /** - * Constructor for SystemUpdateConnectionAction - */ - public SystemUpdateConnectionAction(Shell parent) - { - super(SystemResources.ACTION_UPDATECONN_LABEL, SystemResources.ACTION_UPDATECONN_TOOLTIP, null, parent); - allowOnMultipleSelection(false); - setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE); - } - - /** - * Called by SystemBaseAction when selection is set. - * Our opportunity to verify we are allowed for this selected type. - */ - public boolean checkObjectType(Object selectedObject) - { - return (selectedObject instanceof IHost); - } - - /** - * If you decide to use the supplied run method as is, - * then you must override this method to create and return - * the dialog that is displayed by the default run method - * implementation. - *
- * If you override run with your own, then
- * simply implement this to return null as it won't be used.
- * @see #run()
- */
- protected Dialog createDialog(Shell parent)
- {
- return new SystemUpdateConnectionDialog(parent);
- }
-
- /**
- * Required by parent but we do not use it so return null;
- */
- protected Object getDialogValue(Dialog dlg)
- {
- return null;
- }
-}
Index: UI/org/eclipse/rse/ui/SystemWidgetHelpers.java
===================================================================
RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java,v
retrieving revision 1.23
diff -u -r1.23 SystemWidgetHelpers.java
--- UI/org/eclipse/rse/ui/SystemWidgetHelpers.java 18 Jul 2007 12:47:41 -0000 1.23
+++ UI/org/eclipse/rse/ui/SystemWidgetHelpers.java 5 Nov 2007 15:18:29 -0000
@@ -757,27 +757,6 @@
return createPushButton(group, label, listener, tooltip);
}
- /**
- * Creates a readonly system type listbox with the given system types.
- * Does NOT create the leading prompt or anything except the listbox.
- *
- * @param group composite to put the listbox into.
- * @param listener object to listen for events. Can be null.
- * @param systemTypes an array of system types to show in this Combo.
- * Must not be null
.
- * Fill this with the result of {@link #getValidSystemTypes(String[])}
- * with a null argument in order to get a combo box with all valid
- * system types.
- * @return listbox containing the given system types
- */
- public static List createSystemTypeListBox(Composite group, Listener listener, IRSESystemType[] systemTypes) {
- List list = createListBox(group, listener, false, null, SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
- list.setItems(getSystemTypeLabels(systemTypes));
- if(list.getItemCount()>0){
- list.select(0);
- }
- return list;
- }
/**
* Creates a new listbox instance and sets the default
Index: UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java
===================================================================
RCS file: UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java
diff -N UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java
--- UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java 25 Apr 2007 20:24:04 -0000 1.11
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,506 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
-import org.eclipse.rse.internal.ui.view.SystemViewConnectionSelectionInputProvider;
-import org.eclipse.rse.internal.ui.view.SystemViewForm;
-import org.eclipse.rse.ui.SystemBaseForm;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-
-/**
- * A reusable form for prompting for a connection. Unlike {@link org.eclipse.rse.ui.widgets.SystemHostCombo},
- * this form uses a list box to show the available connections.
- *
- * This form may be used to populate a dialog or a wizard page. - *
- * To configure the functionality, call these methods: - *
- * To configure the text on the dialog, call these methods: - *
- * After running, call these methods to get the output: - *
- * Default is false - */ - public void setShowPropertySheet(boolean show) - { - this.showPropertySheet = show; - } - - /** - * Set multiple selection mode. Default is single selection mode - *
- * If you turn on multiple selection mode, you must use the getSelectedConnections()
- * method to retrieve the list of selected connections.
- *
- * @see #getSelectedConnections()
- */
- public void setMultipleSelectionMode(boolean multiple)
- {
- this.multipleSelectionMode = multiple;
- }
-
- /**
- * Add a listener to selection change events in the list
- */
- public void addSelectionChangedListener(ISelectionChangedListener l)
- {
- if (tree != null)
- tree.addSelectionChangedListener(l);
- else
- listeners.addElement(l);
- }
- /**
- * Remove a listener for selection change events in the list
- */
- public void removeSelectionChangedListener(ISelectionChangedListener l)
- {
- if (tree != null)
- tree.removeSelectionChangedListener(l);
- else
- listeners.removeElement(l);
- }
-
-
- // ---------------------------------
- // OUTPUT METHODS...
- // ---------------------------------
- /**
- * Return all selected connections.
- * @see #setMultipleSelectionMode(boolean)
- */
- public IHost[] getSelectedConnections()
- {
- return outputConnections;
- }
- /**
- * Return selected connection
- */
- public IHost getSelectedConnection()
- {
- return outputConnection;
- }
-
- /**
- * Return the multiple selection mode current setting
- */
- public boolean getMultipleSelectionMode()
- {
- return multipleSelectionMode;
- }
-
- // -----------------------------------------------------
- // SEMI-PRIVATE METHODS USED BY CALLING DIALOG/WIZARD...
- // -----------------------------------------------------
-
- /**
- * Return control to recieve initial focus
- */
- public Control getInitialFocusControl()
- {
- return tree.getTreeControl();
- }
-
- /**
- * Show or hide the property sheet. This is called after the contents are created when the user
- * toggles the Details button.
- * @param shell Use getShell() in your dialog or wizard page
- * @param contents Use getContents() in your dialog or wizard page
- * @return new state -> true if showing, false if hiding
- */
- public boolean toggleShowPropertySheet(Shell shell, Control contents)
- {
- Point windowSize = shell.getSize();
- Point oldSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- if (showPropertySheet) // hiding?
- {
- ps.dispose();
- spacer1.dispose();
- spacer2.dispose();
- ps_composite.dispose();
- ps = null; spacer1 = spacer2 = null; ps_composite = null;
- ((GridLayout)outerParent.getLayout()).numColumns = 1;
- }
- else // showing?
- {
- //createPropertySheet((Composite)contents, shell);
- ((GridLayout)outerParent.getLayout()).numColumns = 2;
- createPropertySheet(outerParent, shell);
- }
-
- Point newSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- shell.setSize(new Point(windowSize.x + (newSize.x - oldSize.x), windowSize.y));
-
- if (ps != null)
- {
- ISelection s = tree.getSelection();
- if (s != null)
- ps.selectionChanged(s);
- }
-
- showPropertySheet = !showPropertySheet;
- return showPropertySheet;
- }
-
- /**
- * Create the property sheet viewer
- */
- private void createPropertySheet(Composite outerParent, Shell shell)
- {
- ps_composite = SystemWidgetHelpers.createFlushComposite(outerParent, 1);
- ((GridData)ps_composite.getLayoutData()).grabExcessVerticalSpace = true;
- ((GridData)ps_composite.getLayoutData()).verticalAlignment = GridData.FILL;
-
- // SPACER LINES
- spacer1 = SystemWidgetHelpers.createLabel(ps_composite, "", 1); //$NON-NLS-1$
- spacer2 = SystemWidgetHelpers.createLabel(ps_composite, "", 1); //$NON-NLS-1$
- // PROPERTY SHEET VIEWER
- ps = new SystemPropertySheetForm(shell, ps_composite, SWT.BORDER, getMessageLine());
- }
-
- public void dispose()
- {
- if (tree != null)
- {
- tree.removeSelectionChangedListener(this);
- for (int i = 0; i < listeners.size(); i++)
- {
- tree.removeSelectionChangedListener((ISelectionChangedListener)listeners.get(i));
- }
- }
- }
- /**
- * In this method, we populate the given SWT container with widgets and return the container
- * to the caller.
- * @param parent The parent composite
- */
- public Control createContents(Composite parent)
- {
- contentsCreated = true;
-
- outerParent = parent;
- // OUTER COMPOSITE
- //if (showPropertySheet)
- {
- outerParent = SystemWidgetHelpers.createComposite(parent, showPropertySheet ? 2 : 1);
- }
-
- // INNER COMPOSITE
- int gridColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createFlushComposite(outerParent, gridColumns);
-
- // PROPERTY SHEET COMPOSITE
- if (showPropertySheet)
- {
- createPropertySheet(outerParent, getShell());
- }
- else
- {
- //((GridLayout)composite_prompts.getLayout()).margin...
- }
-
- // MESSAGE/VERBIAGE TEXT AT TOP
- verbiageLabel = SystemWidgetHelpers.createVerbiage(composite_prompts, verbiage, gridColumns, false, PROMPT_WIDTH);
- //verbiageLabel = SystemWidgetHelpers.createLabel(composite_prompts, verbiage, gridColumns);
-
- // SPACER LINE
- SystemWidgetHelpers.createLabel(composite_prompts, "", gridColumns); //$NON-NLS-1$
-
- // SELECT OBJECT READONLY TEXT FIELD
- Composite nameComposite = composite_prompts;
- int nameSpan = gridColumns;
- nameEntryValue = SystemWidgetHelpers.createReadonlyTextField(nameComposite);
- ((GridData)nameEntryValue.getLayoutData()).horizontalSpan = nameSpan;
-
- // TREE
- SystemViewConnectionSelectionInputProvider inputProvider = new SystemViewConnectionSelectionInputProvider();
- inputProvider.setShowNewConnectionPrompt(allowNew);
- inputProvider.setSystemTypes(systemTypes);
- tree = new SystemViewForm(getShell(), composite_prompts, SWT.NULL, inputProvider, !multipleSelectionMode, getMessageLine(), gridColumns, 1);
- ((GridData)tree.getLayoutData()).widthHint = PROMPT_WIDTH; // normally its 300
-
- // initialize fields
- if (!initDone)
- doInitializeFields();
-
- // add selection listeners
- tree.addSelectionChangedListener(this);
- if (listeners.size() > 0)
- for (int idx=0; idx
- * Call these methods to configure the functionality of the dialog
- *
- * Call these methods to configure the text on the dialog
- *
- * After running, call these methods to get the output:
- *
- * This overload always shows the property sheet
- *
- * Default is false
- */
- public void setShowPropertySheet(boolean show)
- {
- form.setShowPropertySheet(show);
- }
- /**
- * Show the property sheet on the right hand side, to show the properties of the
- * selected object.
- *
- * This overload shows a Details>>> button so the user can decide if they want to see the
- * property sheet.
- *
- * Default is true, false
- *
- * @param show True if show the property sheet within the dialog
- * @param initialState True if the property is to be initially displayed, false if it is not
- * to be displayed until the user presses the Details button.
- */
- public void setShowPropertySheet(boolean show, boolean initialState)
- {
- if (show)
- {
- form.setShowPropertySheet(initialState);
- setShowDetailsButton(true, !initialState);
- }
- }
-
- /**
- * Set multiple selection mode. Default is single selection mode
- *
- * If you turn on multiple selection mode, you must use the getSelectedObjects()
- * method to retrieve the list of selected objects.
- *
- * Further, if you turn this on, it has the side effect of allowing the user
- * to select any remote object. The assumption being if you are prompting for
- * files, you also want to allow the user to select a folder, with the meaning
- * being that all files within the folder are implicitly selected.
- *
- * @see #getSelectedObjects()
- */
- public void setMultipleSelectionMode(boolean multiple)
- {
- form.setMultipleSelectionMode(multiple);
- }
-
- // ------------------
- // OUTPUT METHODS...
- // ------------------
-
- /**
- * Return selected file or folder
- */
- public Object getSelectedObject()
- {
- if (getOutputObject() instanceof Object[])
- return ((Object[])getOutputObject())[0];
- else
- return getOutputObject();
- }
- /**
- * Return all selected objects. This method will return an array of one
- * unless you have called setMultipleSelectionMode(true)!
- * @see #setMultipleSelectionMode(boolean)
- */
- public Object[] getSelectedObjects()
- {
- if (getOutputObject() instanceof Object[])
- return (Object[])getOutputObject();
- else if (getOutputObject() != null)
- return new Object[] {getOutputObject()};
- else
- return null;
- }
-
- /**
- * Return selected connection
- */
- public IHost getSelectedConnection()
- {
- return form.getSelectedConnection();
- }
- /**
- * Return selected connections in multiple selection mode
- */
- public IHost[] getSelectedConnections()
- {
- return form.getSelectedConnections();
- }
-
- /**
- * Return the multiple selection mode as set by setMultipleSelectionMode(boolean)
- */
- public boolean getMultipleSelectionMode()
- {
- return form.getMultipleSelectionMode();
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
- /**
- * Private method.
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- return form.getInitialFocusControl();
- }
-
- /**
- * Private method.
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- return form.createContents(parent);
- }
-
- /**
- * Private method.
- * Get the contents.
- */
- protected SystemSelectConnectionForm getForm(Shell shell)
- {
- //System.out.println("INSIDE GETFORM");
- //if (form == null)
- //{
- form = new SystemSelectConnectionForm(shell,getMessageLine());
- form.addPageCompleteListener(this);
- // reset output variables just to be safe
- setOutputObject(null);
- //}
- return form;
- }
-
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- ISystemMessageLine msgLine = super.createMessageLine(c);
- if (form != null)
- form.setMessageLine(msgLine);
- return msgLine;
- }
-
-
- /**
- * Private method.
- *
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- boolean closeDialog = form.verify();
- if (closeDialog)
- {
- if (getMultipleSelectionMode())
- setOutputObject(form.getSelectedConnections());
- else
- setOutputObject(form.getSelectedConnection());
- }
- else
- setOutputObject(null);
- return closeDialog;
- }
-
- /**
- * Private method.
- *
- * Called when user presses DETAILS button.
- *
- * Note the text is automatically toggled for us! We need only
- * do whatever the functionality is that we desire
- *
- * @param hideMode the current state of the details toggle, prior to this request. If we return true from
- * this method, this state and the button text will be toggled.
- *
- * @return true if the details state toggle was successful, false if it failed.
- */
- protected boolean processDetails(boolean hideMode)
- {
- form.toggleShowPropertySheet(getShell(), getContents());
- return true;
- }
-
-
- /**
- * We have to override close to ensure that we reset the form to null
- */
- public boolean close()
- {
- if (super.close())
- {
- if (form != null)
- {
- form.dispose();
- }
- form = null;
- return true;
- }
- return false;
- }
-
- /**
- * The callback method.
- * This is called whenever setPageComplete is called by the form code.
- * @see SystemBaseForm#addPageCompleteListener(ISystemPageCompleteListener)
- */
- public void setPageComplete(boolean complete)
- {
- super.setPageComplete(complete);
- }
-}
\ No newline at end of file
- *
- *
- *
- *
- *
- *
- */
-public class SystemSelectConnectionDialog
- extends SystemPromptDialog implements ISystemPageCompleteListener
-{
- public static final boolean FILE_MODE = true;
- public static final boolean FOLDER_MODE = false;
- private SystemSelectConnectionForm form;
-
-
- /**
- * Constructor
- *
- * @param shell The shell to hang the dialog off of
- *
- */
- public SystemSelectConnectionDialog(Shell shell)
- {
- this(shell, SystemResources.RESID_SELECTCONNECTION_TITLE);
- }
- /**
- * Constructor when you want to supply your own title.
- *
- * @param shell The shell to hang the dialog off of
- * @param title The title to give the dialog
- */
- public SystemSelectConnectionDialog(Shell shell, String title)
- {
- super(shell, title);
- super.setBlockOnOpen(true); // always modal
- form = getForm(shell);
- setShowPropertySheet(true, false); // default
- }
-
- // ------------------
- // PUBLIC METHODS...
- // ------------------
- /**
- * Set the connection to default the selection to
- */
- public void setDefaultConnection(IHost conn)
- {
- form.setDefaultConnection(conn);
- }
- /**
- * Restrict to certain system types.
- * @param systemTypes the system types to restrict what connections
- * are shown and what types of connections the user can create.
- */
- public void setSystemTypes(IRSESystemType[] systemTypes)
- {
- form.setSystemTypes(systemTypes);
- }
- /**
- * Restrict to a certain system type.
- * @param systemType the system type to restrict what connections
- * are shown and what types of connections the user can create.
- */
- public void setSystemType(IRSESystemType systemType)
- {
- form.setSystemType(systemType);
- }
- /**
- * Set to true if a "New Connection..." special connection is to be shown for creating new connections
- */
- public void setShowNewConnectionPrompt(boolean show)
- {
- form.setShowNewConnectionPrompt(show);
- }
- /**
- * Set the instruction label shown at the top of the dialog
- */
- public void setInstructionLabel(String message)
- {
- form.setMessage(message);
- }
-
- /**
- * Show the property sheet on the right hand side, to show the properties of the
- * selected object.
- *