mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 02:35:37 +02:00
[196938] getting rid of obsolete classes for SystemSelectConnection*
This commit is contained in:
parent
19c1d8e469
commit
f9dc5456f5
11 changed files with 0 additions and 2207 deletions
|
@ -1,68 +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.files.ui.widgets;
|
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
|
||||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
|
||||||
import org.eclipse.rse.ui.widgets.SystemHostCombo;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A connection combo widget for universal connections. Includes remote Linux, Windows and Unix connections,
|
|
||||||
* and Local connections.
|
|
||||||
*/
|
|
||||||
public class SystemRemoteConnectionCombo extends SystemHostCombo {
|
|
||||||
|
|
||||||
private static final String[] SYSTEM_TYPE_IDS = {
|
|
||||||
IRSESystemType.SYSTEMTYPE_LINUX_ID,
|
|
||||||
IRSESystemType.SYSTEMTYPE_LOCAL_ID,
|
|
||||||
IRSESystemType.SYSTEMTYPE_UNIX_ID,
|
|
||||||
IRSESystemType.SYSTEMTYPE_WINDOWS_ID
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor when you want to set the style.
|
|
||||||
* @param parent Parent composite.
|
|
||||||
* @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL.
|
|
||||||
* @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
|
|
||||||
* @param showNewButton true if a New... button is to be included in this composite.
|
|
||||||
*/
|
|
||||||
public SystemRemoteConnectionCombo(Composite parent, int style, IHost defaultConnection, boolean showNewButton) {
|
|
||||||
super(parent, style, SystemWidgetHelpers.getValidSystemTypes(SYSTEM_TYPE_IDS), defaultConnection, showNewButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor when you don't care about the style. Defaults to SWT.NULL.
|
|
||||||
* @param parent Parent composite.
|
|
||||||
* @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
|
|
||||||
* @param showNewButton true if a New... button is to be included in this composite.
|
|
||||||
*/
|
|
||||||
public SystemRemoteConnectionCombo(Composite parent, IHost defaultConnection, boolean showNewButton) {
|
|
||||||
this(parent, SWT.NULL, defaultConnection, showNewButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor when you don't care about the style or default connection, and do want to show the New button.
|
|
||||||
* This is the most common case.
|
|
||||||
* @param parent Parent composite
|
|
||||||
*/
|
|
||||||
public SystemRemoteConnectionCombo(Composite parent) {
|
|
||||||
this(parent, null, true);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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.
|
|
||||||
* <p>
|
|
||||||
* To configure the functionality, call these methods:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #setShowNewConnectionPrompt(boolean)}
|
|
||||||
* <li>{@link #setHost(IHost) or #setDefaultConnection(SystemConnection)}
|
|
||||||
* <li>{@link #setSystemType(IRSESystemType)} or {@link #setSystemTypes(IRSESystemType[])}
|
|
||||||
* <li>{@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)}
|
|
||||||
* <li>{@link #setPreSelection(IRemoteFile)}
|
|
||||||
* <li>{@link #setShowPropertySheet(boolean)}
|
|
||||||
* <li>{@link #enableAddMode(ISystemAddFileListener)}
|
|
||||||
* <li>{@link #setMultipleSelectionMode(boolean)}
|
|
||||||
* <li>{@link #setSelectionValidator(IValidatorRemoteSelection)}
|
|
||||||
* </ul>
|
|
||||||
* <p>
|
|
||||||
* To configure the text on the dialog, call these methods:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #setDialogTitle(String)}
|
|
||||||
* <li>{@link #setMessage(String)}
|
|
||||||
* <li>{@link #setSelectionTreeToolTipText(String)}
|
|
||||||
* </ul>
|
|
||||||
* <p>
|
|
||||||
* After running, call these methods to get the output:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #getSelectedFile()} or {@link #getSelectedFiles()}
|
|
||||||
* <li>{@link #getSelectedConnection()}
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
public class SystemRemoteFileSelectAction extends SystemBaseDialogAction
|
|
||||||
{
|
|
||||||
private IRSESystemType[] systemTypes;
|
|
||||||
private IHost systemConnection, outputConnection;
|
|
||||||
private IRemoteFile preSelection;
|
|
||||||
private String rootFolderAbsPath;
|
|
||||||
private String message, treeTip, dlgTitle;
|
|
||||||
private boolean showPropertySheet = false;
|
|
||||||
private boolean showPropertySheetDetailsButtonInitialState;
|
|
||||||
private boolean showPropertySheetDetailsButton = false;
|
|
||||||
private boolean multipleSelectionMode = false;
|
|
||||||
private boolean onlyConnection = false;
|
|
||||||
private IValidatorRemoteSelection selectionValidator;
|
|
||||||
private SystemActionViewerFilter customViewerFilter = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor that uses default action label and tooltip
|
|
||||||
*
|
|
||||||
* @param shell The shell to hang the dialog off of
|
|
||||||
*/
|
|
||||||
public SystemRemoteFileSelectAction(Shell shell)
|
|
||||||
{
|
|
||||||
this(shell, FileResources.ACTION_SELECT_DIRECTORY_LABEL, FileResources.ACTION_SELECT_DIRECTORY_TOOLTIP);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Constructor when you have your own action label and tooltip
|
|
||||||
*
|
|
||||||
* @param shell The shell to hang the dialog off of
|
|
||||||
* @param label
|
|
||||||
* @param tooltip
|
|
||||||
*/
|
|
||||||
public SystemRemoteFileSelectAction(Shell shell, String label, String tooltip)
|
|
||||||
{
|
|
||||||
super(label, tooltip, null, shell);
|
|
||||||
super.setNeedsProgressMonitor(true); // the default is to include a monitor. Caller can override
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
|
||||||
// CONFIGURATION METHODS...
|
|
||||||
// ------------------------
|
|
||||||
/**
|
|
||||||
* Set the title for the dialog. The default is "Browse for Folder"
|
|
||||||
*/
|
|
||||||
public void setDialogTitle(String title)
|
|
||||||
{
|
|
||||||
this.dlgTitle = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the message shown at the top of the form
|
|
||||||
*/
|
|
||||||
public void setMessage(String message)
|
|
||||||
{
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Set the tooltip text for the remote systems tree from which an item is selected.
|
|
||||||
*/
|
|
||||||
public void setSelectionTreeToolTipText(String tip)
|
|
||||||
{
|
|
||||||
this.treeTip = tip;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the system connection to restrict the user to seeing in the tree.
|
|
||||||
*
|
|
||||||
* @see #setRootFolder(IHost, String)
|
|
||||||
*/
|
|
||||||
public void setHost(IHost conn)
|
|
||||||
{
|
|
||||||
systemConnection = conn;
|
|
||||||
onlyConnection = true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Set the connection to default the selection to
|
|
||||||
*/
|
|
||||||
public void setDefaultConnection(IHost conn)
|
|
||||||
{
|
|
||||||
systemConnection = conn;
|
|
||||||
onlyConnection = false;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Set the system types to restrict what connections the user sees,
|
|
||||||
* and what types of connections they can create.
|
|
||||||
*
|
|
||||||
* @param systemTypes An array of system types, or
|
|
||||||
* <code>null</code> 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
|
|
||||||
* <code>null</code> 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.
|
|
||||||
* <p>
|
|
||||||
* This call effectively transforms the select dialog by:
|
|
||||||
* <ul>
|
|
||||||
* <li>Preventing the user from selecting other connections
|
|
||||||
* <li>Preventing the user from selecting other filter strings
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param connection The connection to the remote system containing the root folder
|
|
||||||
* @param folderAbsolutePath The fully qualified folder to start listing from (eg: "\folder1\folder2")
|
|
||||||
*
|
|
||||||
* @see org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString
|
|
||||||
*/
|
|
||||||
public void setRootFolder(IHost connection, String folderAbsolutePath)
|
|
||||||
{
|
|
||||||
systemConnection = connection;
|
|
||||||
rootFolderAbsPath = folderAbsolutePath;
|
|
||||||
IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(connection);
|
|
||||||
|
|
||||||
if (ss != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
IRemoteFile rootFolder = ss.getRemoteFileObject(rootFolderAbsPath, new NullProgressMonitor());
|
|
||||||
if (rootFolder != null)
|
|
||||||
{
|
|
||||||
setPreSelection(rootFolder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onlyConnection = true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Set the root folder from which to start listing folders.
|
|
||||||
* This version identifies the folder via an IRemoteFile object.
|
|
||||||
* There is another overload that identifies the folder via a connection and folder path.
|
|
||||||
* <p>
|
|
||||||
* This call effectively transforms the select dialog by:
|
|
||||||
* <ul>
|
|
||||||
* <li>Preventing the user from selecting other connections
|
|
||||||
* <li>Preventing the user from selecting other filter strings
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param rootFolder The IRemoteFile object representing the remote folder to start the list from
|
|
||||||
*
|
|
||||||
* @see org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString
|
|
||||||
*/
|
|
||||||
public void setRootFolder(IRemoteFile rootFolder)
|
|
||||||
{
|
|
||||||
setRootFolder(rootFolder.getSystemConnection(),rootFolder.getAbsolutePath());
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Set a file or folder to preselect. This will:
|
|
||||||
* <ul>
|
|
||||||
* <li>Set the parent folder as the root folder
|
|
||||||
* <li>Pre-expand the parent folder
|
|
||||||
* <li>Pre-select the given file or folder after expansion
|
|
||||||
* </ul>
|
|
||||||
* If there is no parent, then we were given a root. In which case we will
|
|
||||||
* <ul>
|
|
||||||
* <li>Force setRestrictFolders to false
|
|
||||||
* <li>Pre-expand the root drives (Windows) or root files (Unix)
|
|
||||||
* <li>Pre-select the given root drive (Windows only)
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
public void setPreSelection(IRemoteFile selection)
|
|
||||||
{
|
|
||||||
preSelection = selection;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable Add mode. This means the OK button is replaced with an Add button, and
|
|
||||||
* the Cancel with a Close button. When Add is pressed, the caller is called back.
|
|
||||||
* The dialog is not exited until Close is pressed.
|
|
||||||
* <p>
|
|
||||||
* 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.
|
|
||||||
* <p>
|
|
||||||
* 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.
|
|
||||||
* <p>
|
|
||||||
* This overload shows a Details>>> button so the user can decide if they want to see the
|
|
||||||
* property sheet.
|
|
||||||
* <p>
|
|
||||||
* @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
|
|
||||||
* <p>
|
|
||||||
* 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)!
|
|
||||||
* <p>
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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.
|
|
||||||
* <p>
|
|
||||||
* To configure the functionality, call these methods:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #setShowNewConnectionPrompt(boolean)}
|
|
||||||
* <li>{@link #setHost(IHost) or #setDefaultConnection(SystemConnection)}
|
|
||||||
* <li>{@link #setSystemType(IRSESystemType)} or {@link #setSystemTypes(IRSESystemType[])}
|
|
||||||
* <li>{@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)}
|
|
||||||
* <li>{@link #setPreSelection(IRemoteFile)}
|
|
||||||
* <li>{@link #setShowPropertySheet(boolean)}
|
|
||||||
* <li>{@link #enableAddMode(ISystemAddFileListener)}
|
|
||||||
* <li>{@link #setMultipleSelectionMode(boolean)}
|
|
||||||
* <li>{@link #setSelectionValidator(IValidatorRemoteSelection)}
|
|
||||||
* </ul>
|
|
||||||
* <p>
|
|
||||||
* To configure the text on the dialog, call these methods:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #setDialogTitle(String)}
|
|
||||||
* <li>{@link #setMessage(String)}
|
|
||||||
* <li>{@link #setSelectionTreeToolTipText(String)}
|
|
||||||
* </ul>
|
|
||||||
* <p>
|
|
||||||
* After running, call these methods to get the output:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #getSelectedFolder()} or {@link #getSelectedFolders()}
|
|
||||||
* <li>{@link #getSelectedConnection()}
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
public class SystemRemoteFolderSelectAction extends
|
|
||||||
SystemRemoteFileSelectAction
|
|
||||||
{
|
|
||||||
public SystemRemoteFolderSelectAction(Shell shell)
|
|
||||||
{
|
|
||||||
super(shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemRemoteFolderSelectAction(Shell shell, String label, String tooltip)
|
|
||||||
{
|
|
||||||
super(shell, label, tooltip);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SystemRemoteResourceDialog createRemoteResourceDialog(Shell shell, String title)
|
|
||||||
{
|
|
||||||
return new SystemRemoteFolderDialog(shell, title);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SystemRemoteResourceDialog createRemoteResourceDialog(Shell shell)
|
|
||||||
{
|
|
||||||
return new SystemRemoteFolderDialog(shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve selected folder object. If multiple folders selected, returns the first.
|
|
||||||
*/
|
|
||||||
public IRemoteFile getSelectedFolder()
|
|
||||||
{
|
|
||||||
Object o = getValue();
|
|
||||||
if (o instanceof IRemoteFile[])
|
|
||||||
return ((IRemoteFile[])o)[0];
|
|
||||||
else if (o instanceof IRemoteFile)
|
|
||||||
return (IRemoteFile)o;
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Retrieve selected folder objects. If no folders selected, returns an array of zero.
|
|
||||||
* If one folder selected returns an array of one.
|
|
||||||
*/
|
|
||||||
public IRemoteFile[] getSelectedFolders()
|
|
||||||
{
|
|
||||||
Object o = getValue();
|
|
||||||
if (o instanceof Object[]) {
|
|
||||||
|
|
||||||
Object[] temp = (Object[])o;
|
|
||||||
|
|
||||||
IRemoteFile[] files = new IRemoteFile[temp.length];
|
|
||||||
|
|
||||||
// ensure all objects are IRemoteFiles
|
|
||||||
for (int i = 0; i < temp.length; i++) {
|
|
||||||
|
|
||||||
if (temp[i] instanceof IRemoteFile) {
|
|
||||||
files[i] = (IRemoteFile)temp[i];
|
|
||||||
}
|
|
||||||
// should never happen
|
|
||||||
else {
|
|
||||||
return new IRemoteFile[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
if (o instanceof IRemoteFile[])
|
|
||||||
return (IRemoteFile[])o;
|
|
||||||
else if (o instanceof IRemoteFile)
|
|
||||||
return new IRemoteFile[] {(IRemoteFile)o};
|
|
||||||
else
|
|
||||||
return new IRemoteFile[0];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,187 +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.internal.ui.actions;
|
|
||||||
|
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
|
||||||
import org.eclipse.rse.internal.ui.SystemResources;
|
|
||||||
import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
|
|
||||||
import org.eclipse.rse.ui.dialogs.SystemSelectConnectionDialog;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use this action to put up a dialog allowing users to select one or
|
|
||||||
* more connections.
|
|
||||||
*/
|
|
||||||
public class SystemSelectConnectionAction extends SystemBaseDialogAction
|
|
||||||
{
|
|
||||||
private boolean multiSelect;
|
|
||||||
private boolean showPropertySheetInitialState;
|
|
||||||
private boolean showPropertySheet;
|
|
||||||
private String message;
|
|
||||||
private boolean showNewConnectionPrompt = true;
|
|
||||||
private IRSESystemType[] systemTypes;
|
|
||||||
private IRSESystemType systemType;
|
|
||||||
private IHost defaultConn;
|
|
||||||
private Object result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public SystemSelectConnectionAction(Shell shell)
|
|
||||||
{
|
|
||||||
super(SystemResources.ACTION_SELECTCONNECTION_LABEL, SystemResources.ACTION_SELECTCONNECTION_TOOLTIP,null, shell);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the connection to default the selection to
|
|
||||||
*/
|
|
||||||
public void setDefaultConnection(IHost conn)
|
|
||||||
{
|
|
||||||
this.defaultConn = 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)
|
|
||||||
{
|
|
||||||
this.systemTypes = 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)
|
|
||||||
{
|
|
||||||
this.systemType = systemType;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Set to true/false if a "New Connection..." special connection is to be shown for creating new connections.
|
|
||||||
* Defaault is true.
|
|
||||||
*/
|
|
||||||
public void setShowNewConnectionPrompt(boolean show)
|
|
||||||
{
|
|
||||||
this.showNewConnectionPrompt = show;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Set the label text shown at the top of the dialog
|
|
||||||
*/
|
|
||||||
public void setInstructionLabel(String message)
|
|
||||||
{
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the property sheet on the right hand side, to show the properties of the
|
|
||||||
* selected object.
|
|
||||||
* <p>
|
|
||||||
* This overload always shows the property sheet
|
|
||||||
* <p>
|
|
||||||
* 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.
|
|
||||||
* <p>
|
|
||||||
* This overload shows a Details>>> button so the user can decide if they want to see the
|
|
||||||
* property sheet.
|
|
||||||
* <p>
|
|
||||||
* @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
|
|
||||||
* <p>
|
|
||||||
* If you turn on multiple selection mode, you must use the getSelectedObjects()
|
|
||||||
* method to retrieve the list of selected objects.
|
|
||||||
* <p>
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -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.
|
|
||||||
* <p>
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,147 +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) - [175262] IHost.getSystemType() should return IRSESystemType
|
|
||||||
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
|
||||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.internal.ui.dialogs;
|
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
|
||||||
import org.eclipse.rse.internal.ui.SystemResources;
|
|
||||||
import org.eclipse.rse.ui.ISystemConnectionFormCaller;
|
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.rse.ui.SystemConnectionForm;
|
|
||||||
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
|
|
||||||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
|
||||||
import org.eclipse.rse.ui.validators.ISystemValidator;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dialog for updating a connection.
|
|
||||||
* THIS DIALOG AND ITS ACTION ARE NO LONGER USED. THEY ARE REPLACED WITH A PROPERTIES DIALOG.
|
|
||||||
*/
|
|
||||||
public class SystemUpdateConnectionDialog extends SystemPromptDialog implements ISystemConnectionFormCaller
|
|
||||||
{
|
|
||||||
protected SystemConnectionForm form;
|
|
||||||
protected String parentHelpId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for SystemUpdateConnectionDialog
|
|
||||||
*/
|
|
||||||
public SystemUpdateConnectionDialog(Shell shell)
|
|
||||||
{
|
|
||||||
super(shell, SystemResources.RESID_CHGCONN_TITLE);
|
|
||||||
parentHelpId = RSEUIPlugin.HELPPREFIX + "dcon0000"; //$NON-NLS-1$
|
|
||||||
getForm();
|
|
||||||
//pack();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overrride this if you want to supply your own form. This may be called
|
|
||||||
* multiple times so please only instantatiate if the form instance variable
|
|
||||||
* is null, and then return the form instance variable.
|
|
||||||
* @see org.eclipse.rse.ui.SystemConnectionForm
|
|
||||||
*/
|
|
||||||
public SystemConnectionForm getForm()
|
|
||||||
{
|
|
||||||
//System.out.println("INSIDE GETFORM");
|
|
||||||
if (form == null)
|
|
||||||
{
|
|
||||||
form = new SystemConnectionForm(getMessageLine(),this);
|
|
||||||
}
|
|
||||||
return form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create message line. Intercept so we can set msg line of form.
|
|
||||||
*/
|
|
||||||
protected ISystemMessageLine createMessageLine(Composite c)
|
|
||||||
{
|
|
||||||
ISystemMessageLine msgLine = super.createMessageLine(c);
|
|
||||||
form.setMessageLine(msgLine);
|
|
||||||
return fMessageLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SystemPromptDialog#getInitialFocusControl()
|
|
||||||
*/
|
|
||||||
protected Control getInitialFocusControl()
|
|
||||||
{
|
|
||||||
Control control = form.getInitialFocusControl();
|
|
||||||
return control;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see SystemPromptDialog#createInner(Composite)
|
|
||||||
*/
|
|
||||||
protected Control createInner(Composite parent)
|
|
||||||
{
|
|
||||||
Control c = form.createContents(parent, SystemConnectionForm.UPDATE_MODE, parentHelpId);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override of parent. Must pass selected object onto the form for initializing fields.
|
|
||||||
* Called by SystemDialogAction's default run() method after dialog instantiated.
|
|
||||||
*/
|
|
||||||
public void setInputObject(Object inputObject)
|
|
||||||
{
|
|
||||||
super.setInputObject(inputObject);
|
|
||||||
form.initializeInputFields((IHost)inputObject);
|
|
||||||
|
|
||||||
IHost conn = (IHost)inputObject;
|
|
||||||
ISystemValidator connectionNameValidators[] = new ISystemValidator[1];
|
|
||||||
connectionNameValidators[0] = SystemConnectionForm.getConnectionNameValidator(conn);
|
|
||||||
form.setConnectionNameValidators(connectionNameValidators);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when user presses OK button.
|
|
||||||
* Return true to close dialog.
|
|
||||||
* Return false to not close dialog.
|
|
||||||
*/
|
|
||||||
protected boolean processOK()
|
|
||||||
{
|
|
||||||
boolean closeDialog = form.verify(true);
|
|
||||||
if (closeDialog)
|
|
||||||
{
|
|
||||||
IHost conn = (IHost)getInputObject();
|
|
||||||
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
|
||||||
sr.updateHost( conn,conn.getSystemType(), form.getConnectionName(),form.getHostName(),
|
|
||||||
form.getConnectionDescription(), form.getDefaultUserId(),
|
|
||||||
form.getUserIdLocation() );
|
|
||||||
}
|
|
||||||
return closeDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// CALLBACKS FROM SYSTEM CONNECTION FORM...
|
|
||||||
// ----------------------------------------
|
|
||||||
/**
|
|
||||||
* Event: the user has selected a system type.
|
|
||||||
*/
|
|
||||||
public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,155 +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) - [168975] Move RSE Events API to Core
|
|
||||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
|
||||||
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
|
|
||||||
********************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.rse.internal.ui.view;
|
|
||||||
|
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
|
||||||
import org.eclipse.rse.ui.internal.model.SystemNewConnectionPromptObject;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This input provider for the System View is used when we want to merely present a
|
|
||||||
* list of existing connections for the user to select from, and optionally include
|
|
||||||
* the New Connection prompting connection. <br>
|
|
||||||
* Used in the {@link org.eclipse.rse.ui.widgets.SystemSelectConnectionForm} class.
|
|
||||||
*/
|
|
||||||
public class SystemViewConnectionSelectionInputProvider extends SystemAbstractAPIProvider
|
|
||||||
{
|
|
||||||
private boolean showNew = true;
|
|
||||||
private SystemNewConnectionPromptObject newConnPrompt;
|
|
||||||
private Object[] newConnPromptArray;
|
|
||||||
private IRSESystemType[] systemTypes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public SystemViewConnectionSelectionInputProvider()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specify if the New Connection prompt is to be shown.
|
|
||||||
* Default is true.
|
|
||||||
*/
|
|
||||||
public void setShowNewConnectionPrompt(boolean show)
|
|
||||||
{
|
|
||||||
this.showNew = show;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Query whether the New Connection prompt is to be shown or not.
|
|
||||||
*/
|
|
||||||
public boolean getShowNewConnectionPrompt()
|
|
||||||
{
|
|
||||||
return showNew;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Set the system types to restrict by
|
|
||||||
*/
|
|
||||||
public void setSystemTypes(IRSESystemType[] systemTypes)
|
|
||||||
{
|
|
||||||
this.systemTypes = systemTypes;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return the system types we are restricted by
|
|
||||||
*/
|
|
||||||
public IRSESystemType[] getSystemTypes()
|
|
||||||
{
|
|
||||||
return systemTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// REQUIRED METHODS...
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.rse.core.model.ISystemViewInputProvider#getSystemViewRoots()
|
|
||||||
*/
|
|
||||||
public Object[] getSystemViewRoots()
|
|
||||||
{
|
|
||||||
//System.out.println("Inside getSystemViewRoots. showNew = "+showNew);
|
|
||||||
IHost[] conns = null;
|
|
||||||
if (systemTypes == null)
|
|
||||||
conns = RSECorePlugin.getTheSystemRegistry().getHosts();
|
|
||||||
else
|
|
||||||
conns = RSECorePlugin.getTheSystemRegistry().getHostsBySystemTypes(systemTypes);
|
|
||||||
if (showNew)
|
|
||||||
{
|
|
||||||
if ((conns == null) || (conns.length == 0))
|
|
||||||
{
|
|
||||||
return getNewConnectionPromptObjectAsArray();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Object[] allChildren = new Object[conns.length+1];
|
|
||||||
allChildren[0] = getNewConnectionPromptObject();
|
|
||||||
for (int idx=0; idx<conns.length; idx++)
|
|
||||||
allChildren[idx+1] = conns[idx];
|
|
||||||
return allChildren;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return conns;
|
|
||||||
}
|
|
||||||
private SystemNewConnectionPromptObject getNewConnectionPromptObject()
|
|
||||||
{
|
|
||||||
if (newConnPrompt == null)
|
|
||||||
newConnPrompt = new SystemNewConnectionPromptObject();
|
|
||||||
if (systemTypes != null)
|
|
||||||
newConnPrompt.setSystemTypes(systemTypes);
|
|
||||||
return newConnPrompt;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object[] getNewConnectionPromptObjectAsArray()
|
|
||||||
{
|
|
||||||
if (newConnPromptArray == null)
|
|
||||||
newConnPromptArray = new Object[1];
|
|
||||||
newConnPromptArray[0] = getNewConnectionPromptObject();
|
|
||||||
return newConnPromptArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.rse.core.model.ISystemViewInputProvider#hasSystemViewRoots()
|
|
||||||
*/
|
|
||||||
public boolean hasSystemViewRoots()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.rse.core.model.ISystemViewInputProvider#showingConnections()
|
|
||||||
*/
|
|
||||||
public boolean showingConnections()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.rse.core.model.ISystemViewInputProvider#getConnectionChildren(org.eclipse.rse.core.model.IHost)
|
|
||||||
*/
|
|
||||||
public Object[] getConnectionChildren(IHost selectedConnection)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.rse.core.model.ISystemViewInputProvider#hasConnectionChildren(org.eclipse.rse.core.model.IHost)
|
|
||||||
*/
|
|
||||||
public boolean hasConnectionChildren(IHost selectedConnection)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -757,27 +757,6 @@ public class SystemWidgetHelpers {
|
||||||
return createPushButton(group, label, listener, tooltip);
|
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 <code>null</code>.
|
|
||||||
* 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
|
* Creates a new listbox instance and sets the default
|
||||||
|
|
|
@ -1,362 +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.dialogs;
|
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
|
||||||
import org.eclipse.rse.core.model.IHost;
|
|
||||||
import org.eclipse.rse.internal.ui.SystemResources;
|
|
||||||
import org.eclipse.rse.ui.ISystemPageCompleteListener;
|
|
||||||
import org.eclipse.rse.ui.SystemBaseForm;
|
|
||||||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
|
||||||
import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
|
|
||||||
import org.eclipse.rse.ui.widgets.SystemSelectConnectionForm;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dialog for allowing users to select an existing connection, or optionally create a new one.
|
|
||||||
* There are a number of methods to configure the dialog so only connections of a particular system type,
|
|
||||||
* or containing subsystems from a particular subsystem factory or class of subsystem factories, are shown.
|
|
||||||
* <p>
|
|
||||||
* Call these methods to configure the functionality of the dialog
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #setHost(IHost) or #setDefaultConnection(SystemConnection)}
|
|
||||||
* <li>{@link #setShowNewConnectionPrompt(boolean)}
|
|
||||||
* <li>{@link #setSystemTypes(IRSESystemType[])}
|
|
||||||
* <li>{@link #setAutoExpandDepth(int)}
|
|
||||||
* <li>{@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)}
|
|
||||||
* <li>{@link #setFileTypes(String[])} or {@link #setFileTypes(String)}
|
|
||||||
* <li>{@link #setShowPropertySheet(boolean)}
|
|
||||||
* <li>{@link #enableAddMode(ISystemAddFileListener)}
|
|
||||||
* <li>{@link #setMultipleSelectionMode(boolean)}
|
|
||||||
* <li>{@link #setSelectionValidator(IValidatorRemoteSelection)}
|
|
||||||
* </ul>
|
|
||||||
* <p>
|
|
||||||
* Call these methods to configure the text on the dialog
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #setMessage(String)}
|
|
||||||
* <li>{@link #setSelectionTreeToolTipText(String)}
|
|
||||||
* </ul>
|
|
||||||
* <p>
|
|
||||||
* After running, call these methods to get the output:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #getSelectedObject()} or {@link #getSelectedObjects()}
|
|
||||||
* <li>{@link #getSelectedConnection()}
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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.
|
|
||||||
* <p>
|
|
||||||
* This overload always shows the property sheet
|
|
||||||
* <p>
|
|
||||||
* 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.
|
|
||||||
* <p>
|
|
||||||
* This overload shows a Details>>> button so the user can decide if they want to see the
|
|
||||||
* property sheet.
|
|
||||||
* <p>
|
|
||||||
* Default is true, false
|
|
||||||
* <p>
|
|
||||||
* @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
|
|
||||||
* <p>
|
|
||||||
* If you turn on multiple selection mode, you must use the getSelectedObjects()
|
|
||||||
* method to retrieve the list of selected objects.
|
|
||||||
* <p>
|
|
||||||
* 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.
|
|
||||||
* <p>
|
|
||||||
* 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.
|
|
||||||
* <p>
|
|
||||||
* Called when user presses DETAILS button.
|
|
||||||
* <p>
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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.
|
|
||||||
* <p>
|
|
||||||
* This form may be used to populate a dialog or a wizard page.
|
|
||||||
* <p>
|
|
||||||
* To configure the functionality, call these methods:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #setShowNewConnectionPrompt(boolean)}
|
|
||||||
* <li>{@link #setDefaultConnection(IHost)}
|
|
||||||
* <li>{@link #setSystemTypes(IRSESystemType[])}
|
|
||||||
* <li>{@link #setShowPropertySheet(boolean)}
|
|
||||||
* <li>{@link #setMultipleSelectionMode(boolean)}
|
|
||||||
* </ul>
|
|
||||||
* <p>
|
|
||||||
* To configure the text on the dialog, call these methods:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #setMessage(String)}
|
|
||||||
* </ul>
|
|
||||||
* <p>
|
|
||||||
* After running, call these methods to get the output:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link #getSelectedConnection()}
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
public class SystemSelectConnectionForm extends SystemBaseForm
|
|
||||||
implements ISelectionChangedListener
|
|
||||||
{
|
|
||||||
protected static final int PROMPT_WIDTH = 200; // The maximum width of the dialog's prompt, in pixels.
|
|
||||||
|
|
||||||
// GUI widgets
|
|
||||||
protected Label verbiageLabel, spacer1, spacer2;
|
|
||||||
protected Text nameEntryValue;
|
|
||||||
protected SystemViewForm tree;
|
|
||||||
protected SystemPropertySheetForm ps;
|
|
||||||
//protected ISystemMessageLine msgLine;
|
|
||||||
protected Composite outerParent, ps_composite;
|
|
||||||
// inputs
|
|
||||||
protected String verbiage = null;
|
|
||||||
protected IRSESystemType[] systemTypes = null;
|
|
||||||
protected IHost defaultConn;
|
|
||||||
protected boolean allowNew = true;
|
|
||||||
protected boolean multipleSelectionMode;
|
|
||||||
protected boolean showPropertySheet = false;
|
|
||||||
protected Vector listeners = new Vector();
|
|
||||||
|
|
||||||
// outputs
|
|
||||||
protected IHost[] outputConnections = null;
|
|
||||||
protected IHost outputConnection = null;
|
|
||||||
// state
|
|
||||||
//protected ResourceBundle rb;
|
|
||||||
protected boolean initDone;
|
|
||||||
protected boolean contentsCreated;
|
|
||||||
|
|
||||||
//protected String errorMessage;
|
|
||||||
//protected Object caller;
|
|
||||||
//protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
|
|
||||||
protected int autoExpandDepth = 0;
|
|
||||||
|
|
||||||
protected Object previousSelection = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
* @param shell The shell hosting this form
|
|
||||||
* @param msgLine A GUI widget capable of writing error messages to.
|
|
||||||
*
|
|
||||||
* @see #setShowNewConnectionPrompt(boolean)
|
|
||||||
* @see #setSystemTypes(IRSESystemType[])
|
|
||||||
*/
|
|
||||||
public SystemSelectConnectionForm(Shell shell, ISystemMessageLine msgLine)
|
|
||||||
{
|
|
||||||
super(shell, msgLine);
|
|
||||||
//this.caller = caller;
|
|
||||||
//callerInstanceOfWizardPage = (caller instanceof WizardPage);
|
|
||||||
//callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
|
|
||||||
|
|
||||||
// set default GUI
|
|
||||||
verbiage = SystemResources.RESID_SELECTCONNECTION_VERBIAGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------
|
|
||||||
// INPUT OR CONFIGURATION METHODS...
|
|
||||||
// ---------------------------------
|
|
||||||
/**
|
|
||||||
* Set the connection to default the selection to
|
|
||||||
*/
|
|
||||||
public void setDefaultConnection(IHost conn)
|
|
||||||
{
|
|
||||||
defaultConn = conn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set to true if we are to allow users to create a new connection. Default is true.
|
|
||||||
*/
|
|
||||||
public void setShowNewConnectionPrompt(boolean show)
|
|
||||||
{
|
|
||||||
allowNew = show;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
this.systemTypes = systemTypes;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Restrict to one 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)
|
|
||||||
{
|
|
||||||
if (systemType==null) setSystemTypes(null);
|
|
||||||
setSystemTypes(new IRSESystemType[] {systemType});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Set the message shown as the text at the top of the form. Default is "Select a connection"
|
|
||||||
*/
|
|
||||||
public void setMessage(String message)
|
|
||||||
{
|
|
||||||
this.verbiage = message;
|
|
||||||
if (verbiageLabel != null)
|
|
||||||
verbiageLabel.setText(message);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Show the property sheet on the right hand side, to show the properties of the
|
|
||||||
* selected connection.
|
|
||||||
* <p>
|
|
||||||
* Default is false
|
|
||||||
*/
|
|
||||||
public void setShowPropertySheet(boolean show)
|
|
||||||
{
|
|
||||||
this.showPropertySheet = show;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set multiple selection mode. Default is single selection mode
|
|
||||||
* <p>
|
|
||||||
* 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<listeners.size(); idx++)
|
|
||||||
tree.addSelectionChangedListener((ISelectionChangedListener)listeners.elementAt(idx));
|
|
||||||
|
|
||||||
// pre-select default connection...
|
|
||||||
if (defaultConn != null)
|
|
||||||
{
|
|
||||||
tree.select(defaultConn, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return composite_prompts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Completes processing of the wizard page or dialog. If this
|
|
||||||
* method returns true, the wizard/dialog will close;
|
|
||||||
* otherwise, it will stay active.
|
|
||||||
*
|
|
||||||
* @return true if no errors
|
|
||||||
*/
|
|
||||||
public boolean verify()
|
|
||||||
{
|
|
||||||
getMessageLine().clearErrorMessage();
|
|
||||||
outputConnection = internalGetConnection();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------
|
|
||||||
// PRIVATE METHODS USED BY US...
|
|
||||||
// -----------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the current connection
|
|
||||||
*/
|
|
||||||
private IHost internalGetConnection()
|
|
||||||
{
|
|
||||||
Object o = tree.getSystemView().getRootParent();
|
|
||||||
if (o instanceof IHost)
|
|
||||||
return ((IHost)o);
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setNameText(String text)
|
|
||||||
{
|
|
||||||
nameEntryValue.setText(text);
|
|
||||||
}
|
|
||||||
private void doInitializeFields()
|
|
||||||
{
|
|
||||||
//setPageComplete();
|
|
||||||
initDone = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------
|
|
||||||
// METHODS FOR SELECTION CHANGED LISTENER INTERFACE...
|
|
||||||
// ---------------------------------------------------
|
|
||||||
/**
|
|
||||||
* User selected something in the tree.
|
|
||||||
*/
|
|
||||||
public void selectionChanged(SelectionChangedEvent e)
|
|
||||||
{
|
|
||||||
ISelection selection = e.getSelection();
|
|
||||||
if (ps != null)
|
|
||||||
ps.selectionChanged(selection);
|
|
||||||
|
|
||||||
outputConnections = null;
|
|
||||||
|
|
||||||
Object[] outputObjects = getSelections(selection);
|
|
||||||
if ((outputObjects!=null) && (outputObjects.length>0) && (outputObjects[0] instanceof IHost))
|
|
||||||
{
|
|
||||||
outputConnections = new IHost[outputObjects.length];
|
|
||||||
for (int idx=0; idx<outputConnections.length; idx++)
|
|
||||||
outputConnections[idx] = (IHost)outputObjects[idx];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((outputConnections != null) && (outputConnections.length>0))
|
|
||||||
{
|
|
||||||
setNameText(outputConnections[0].getAliasName());
|
|
||||||
setPageComplete(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setNameText(""); //$NON-NLS-1$
|
|
||||||
setPageComplete(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return first item currently selected.
|
|
||||||
*/
|
|
||||||
protected Object getFirstSelection(ISelection selection)
|
|
||||||
{
|
|
||||||
IStructuredSelection sSelection = (IStructuredSelection)selection;
|
|
||||||
if (sSelection != null)
|
|
||||||
{
|
|
||||||
Iterator selectionIterator = sSelection.iterator();
|
|
||||||
if (selectionIterator.hasNext())
|
|
||||||
return selectionIterator.next();
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return all items currently selected.
|
|
||||||
*/
|
|
||||||
protected Object[] getSelections(ISelection selection)
|
|
||||||
{
|
|
||||||
IStructuredSelection sSelection = (IStructuredSelection)selection;
|
|
||||||
if (sSelection != null)
|
|
||||||
{
|
|
||||||
Object[] selectedObjects = new Object[sSelection.size()];
|
|
||||||
Iterator selectionIterator = sSelection.iterator();
|
|
||||||
int idx = 0;
|
|
||||||
while (selectionIterator.hasNext())
|
|
||||||
selectedObjects[idx++] = selectionIterator.next();
|
|
||||||
return selectedObjects;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue