PTP
Release 7.0

org.eclipse.ptp.ems.ui
Class EnvManagerConfigWidget

java.lang.Object
  extended by Composite
      extended by org.eclipse.ptp.ems.ui.EnvManagerConfigWidget

public final class EnvManagerConfigWidget
extends Composite

Instances of this class represent a user interface element which provides the following:

Typically, clients will use this control as follows.

  1. Invoke the constructor, setting the IRemoteConnection that will provide access to the remote machine.
  2. Invoke setErrorListener(IErrorListener) in order to display error messages to the user.
  3. As needed, invoke configurationChanged(URI, IRemoteConnection, List) or #setCheckbox(boolean)} to change the appearance of the control.
  4. Finally, invoke isUseEMSChecked(), isManualConfigChecked(), getSelectedElements(), and getConnectionName() to retrieve the contents of the control, or use saveConfiguration(IEnvManagerConfig) to persist all of its settings in a single operation.

Since:
6.0

Constructor Summary
EnvManagerConfigWidget(Composite parent, int style)
          Constructor.
 
Method Summary
 void configurationChanged(URI uri, IRemoteConnection remoteConnection, List<String> selectedItems)
          Re-populates this control to reflect a change in the project's remote location or a change in the selected items.
 String getConnectionName()
           
 String getManualConfigText()
           
 List<String> getSelectedElements()
           
 boolean isManualConfigChecked()
           
 boolean isUseEMSChecked()
           
 void saveConfiguration(IEnvManagerConfig config)
          Stores the current state of this EnvManagerConfigWidget in the given configuration object.
 void setConnection(IRemoteConnection connection)
          Set the remote connection to use when querying for the remote environment
 void setErrorListener(IErrorListener listener)
          Sets the (unique) IErrorListener which will be used to display error messages to the user.
 void setManualConfigCheckbox(boolean checked)
          Sets the state of the "Manually specify environment configuration commands" checkbox.
 void setManualConfigText(String text)
          Sets the contents of the text box which allows the user to enter a custom sequence of environment management commands.
 void setUseEMSCheckbox(boolean checked)
          Sets the state of the "Use an environment management system to customize the remote build environment" checkbox.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvManagerConfigWidget

public EnvManagerConfigWidget(Composite parent,
                              int style)
Constructor.

Parameters:
parent - parent Composite (non-null)
style - the style of widget to construct
Since:
2.0
Method Detail

setConnection

public void setConnection(IRemoteConnection connection)
Set the remote connection to use when querying for the remote environment

Parameters:
connection - IRemoteConnection used to access files and execute shell commands on the remote machine (non- null)
Since:
2.0

setErrorListener

public void setErrorListener(IErrorListener listener)
Sets the (unique) IErrorListener which will be used to display error messages to the user.

Parameters:
listener - IErrorListener used to display error messages to the user, or null

configurationChanged

public void configurationChanged(URI uri,
                                 IRemoteConnection remoteConnection,
                                 List<String> selectedItems)
Re-populates this control to reflect a change in the project's remote location or a change in the selected items.

If the given URI is null, or if it differs from the URI supplied in the previous call to configurationChanged(URI, IRemoteConnection, List), then the elements in the checklist are re-loaded from the remote machine (using IEnvManager.determineAvailableElements(IProgressMonitor)). Otherwise, the items present in the checklist remain the same, but the checked/unchecked state of the items may be changed.

Parameters:
uri - a URI representing the remote location of this project (possibly null)
remoteConnection - IRemoteConnection providing access to the remote machine (non-null)
selectedItems - the items which should be selected in the checklist (non-null)
Since:
2.0

isUseEMSChecked

public boolean isUseEMSChecked()
Returns:
true iff the "Use an environment management system to customize the remote build environment" checkbox is checked
See Also:
setUseEMSCheckbox(boolean)

isManualConfigChecked

public boolean isManualConfigChecked()
Returns:
true iff the "Manually specify environment configuration commands" checkbox is checked

getManualConfigText

public String getManualConfigText()
Returns:
the contents of the text box which allows the user to enter a custom sequence of environment management commands. This set may be empty but is never null.

setManualConfigText

public void setManualConfigText(String text)
Sets the contents of the text box which allows the user to enter a custom sequence of environment management commands.

Parameters:
text - non-null.

getSelectedElements

public List<String> getSelectedElements()
Returns:
the text of the elements which are checked in the checklist. This list may be empty but is never null. It is, in theory, a subset of the strings returned by IEnvManager#determineAvailableElements(org.eclipse.core.runtime.IProgressMonitor).
Since:
2.0

setUseEMSCheckbox

public void setUseEMSCheckbox(boolean checked)
Sets the state of the "Use an environment management system to customize the remote build environment" checkbox.

Parameters:
checked - true iff the "Use an environment management system to customize the remote build environment" checkbox should be checked
See Also:
isUseEMSChecked()

setManualConfigCheckbox

public void setManualConfigCheckbox(boolean checked)
Sets the state of the "Manually specify environment configuration commands" checkbox.

Parameters:
checked - true iff the "Manually specify environment configuration commands" checkbox should be checked
See Also:
isManualConfigChecked()

getConnectionName

public String getConnectionName()
Returns:
the name of the remote environment (possibly null). The remote environment is determined by the IRemoteConnection provided to the constructor or configurationChanged(URI, IRemoteConnection, List), whichever was invoked most recently.

saveConfiguration

public void saveConfiguration(IEnvManagerConfig config)
Stores the current state of this EnvManagerConfigWidget in the given configuration object.

Parameters:
config - non-null

PTP
Release 7.0

Copyright (c) 2011 IBM Corporation and others. All Rights Reserved.