Class EnvironmentTab
- java.lang.Object
-
- org.eclipse.debug.ui.AbstractLaunchConfigurationTab
-
- org.eclipse.debug.ui.EnvironmentTab
-
- All Implemented Interfaces:
IPrototypeAttributesLabelProvider
,ILaunchConfigurationTab
,ILaunchConfigurationTab2
public class EnvironmentTab extends AbstractLaunchConfigurationTab
Launch configuration tab for configuring the environment passed into Runtime.exec(...) when a config is launched.Clients may call
AbstractLaunchConfigurationTab.setHelpContextId(String)
on this tab prior to control creation to alter the default context help associated with this tab.This class may be instantiated.
- Since:
- 3.0
- Restriction:
- This class is not intended to be sub-classed by clients.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
EnvironmentTab.EnvironmentVariableContentProvider
Content provider for the environment tableclass
EnvironmentTab.EnvironmentVariableLabelProvider
Label provider for the environment table
-
Field Summary
Fields Modifier and Type Field Description protected Button
appendEnvironment
protected Button
envAddButton
protected Button
envCopyButton
protected Button
envEditButton
protected TableViewer
environmentTable
protected Button
envPasteButton
protected Button
envRemoveButton
protected Button
envSelectButton
protected String[]
envTableColumnHeaders
protected static String
P_VALUE
protected static String
P_VARIABLE
protected Button
replaceEnvironment
-
Constructor Summary
Constructors Constructor Description EnvironmentTab()
Constructs a new tab with default context help.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activated(ILaunchConfigurationWorkingCopy workingCopy)
This method was added to theILaunchConfigurationTab
interface in the 3.0 release to allow tabs to distinguish between a tab being activated and a tab group be initialized for the first time, from a selected launch configuration.protected boolean
addVariable(org.eclipse.debug.internal.ui.launchConfigurations.EnvironmentVariable variable)
Attempts to add the given variable.protected int
addVariables(List<org.eclipse.debug.internal.ui.launchConfigurations.EnvironmentVariable> variables)
Attempts to add the given variables.protected void
createAppendReplace(Composite parent)
Creates and configures the widgets which allow the user to choose whether the specified environment should be appended to the native environment or if it should completely replace it.void
createControl(Composite parent)
Creates the top level control for this launch configuration tab under the given parent composite.protected void
createEnvironmentTable(Composite parent)
Creates and configures the table that displayed the key/value pairs that comprise the environment.protected void
createTableButtons(Composite parent)
Creates the add/edit/remove buttons for the environment tablevoid
deactivated(ILaunchConfigurationWorkingCopy workingCopy)
This method was added to theILaunchConfigurationTab
interface in the 3.0 release to allow tabs to distinguish between a tab being deactivated and saving its attributes to a launch configuration.String
getId()
Returns this tab's unique identifier ornull
if none.Image
getImage()
Returns the image for this tab, ornull
if noneString
getName()
Returns the name of this tab.protected void
handleEnvAddButtonSelected()
Adds a new environment variable to the table.protected void
handleTableSelectionChanged(SelectionChangedEvent event)
Responds to a selection changed event in the environment tableprotected void
initializeAttributes()
Initialize attributes labels.void
initializeFrom(ILaunchConfiguration configuration)
Initializes this tab's controls with values from the given launch configuration.void
performApply(ILaunchConfigurationWorkingCopy configuration)
Stores the environment in the given configurationvoid
setDefaults(ILaunchConfigurationWorkingCopy configuration)
Initializes the given launch configuration with default values for this tab.protected void
updateAppendReplace()
Updates the enablement of the append/replace widgets.protected void
updateEnvironment(ILaunchConfiguration configuration)
Updates the environment table for the given launch configuration-
Methods inherited from class org.eclipse.debug.ui.AbstractLaunchConfigurationTab
canSave, createCheckButton, createPushButton, createRadioButton, createSeparator, createUpdateJob, createVerticalSpacer, dispose, getAttributeLabel, getAttributesLabelsForPrototype, getControl, getErrorMessage, getHelpContextId, getLaunchConfigurationDialog, getLaunchManager, getMessage, getShell, getUpdateJobDelay, getWarningMessage, isDirty, isValid, launched, scheduleUpdateJob, setAttribute, setControl, setDirty, setErrorMessage, setHelpContextId, setLaunchConfigurationDialog, setMessage, setWarningMessage, updateLaunchConfigurationDialog
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.debug.ui.ILaunchConfigurationTab
OkToLeaveTab, postApply
-
-
-
-
Field Detail
-
environmentTable
protected TableViewer environmentTable
-
envTableColumnHeaders
protected String[] envTableColumnHeaders
-
P_VARIABLE
protected static final String P_VARIABLE
- See Also:
- Constant Field Values
-
P_VALUE
protected static final String P_VALUE
- See Also:
- Constant Field Values
-
envAddButton
protected Button envAddButton
-
envEditButton
protected Button envEditButton
-
envRemoveButton
protected Button envRemoveButton
-
envCopyButton
protected Button envCopyButton
- Since:
- 3.14
-
envPasteButton
protected Button envPasteButton
- Since:
- 3.14
-
appendEnvironment
protected Button appendEnvironment
-
replaceEnvironment
protected Button replaceEnvironment
-
envSelectButton
protected Button envSelectButton
-
-
Method Detail
-
createControl
public void createControl(Composite parent)
Description copied from interface:ILaunchConfigurationTab
Creates the top level control for this launch configuration tab under the given parent composite. This method is called once on tab creation, aftersetLaunchConfigurationDialog
is called.Implementors are responsible for ensuring that the created control can be accessed via
getControl
- Parameters:
parent
- the parent composite
-
createAppendReplace
protected void createAppendReplace(Composite parent)
Creates and configures the widgets which allow the user to choose whether the specified environment should be appended to the native environment or if it should completely replace it.- Parameters:
parent
- the composite in which the widgets should be created
-
updateAppendReplace
protected void updateAppendReplace()
Updates the enablement of the append/replace widgets. The widgets should disable when there are no environment variables specified.
-
createEnvironmentTable
protected void createEnvironmentTable(Composite parent)
Creates and configures the table that displayed the key/value pairs that comprise the environment.- Parameters:
parent
- the composite in which the table should be created
-
handleTableSelectionChanged
protected void handleTableSelectionChanged(SelectionChangedEvent event)
Responds to a selection changed event in the environment table- Parameters:
event
- the selection change event
-
createTableButtons
protected void createTableButtons(Composite parent)
Creates the add/edit/remove buttons for the environment table- Parameters:
parent
- the composite in which the buttons should be created
-
handleEnvAddButtonSelected
protected void handleEnvAddButtonSelected()
Adds a new environment variable to the table.
-
addVariable
protected boolean addVariable(org.eclipse.debug.internal.ui.launchConfigurations.EnvironmentVariable variable)
Attempts to add the given variable. Returns whether the variable was added or not (as when the user answers not to overwrite an existing variable).- Parameters:
variable
- the variable to add- Returns:
- whether the variable was added
-
addVariables
protected int addVariables(List<org.eclipse.debug.internal.ui.launchConfigurations.EnvironmentVariable> variables)
Attempts to add the given variables. Returns the number of variables added (as when the user answers not to overwrite an existing variable).- Parameters:
variables
- the variables to add- Returns:
- the number of variables added
- Since:
- 3.14
-
updateEnvironment
protected void updateEnvironment(ILaunchConfiguration configuration)
Updates the environment table for the given launch configuration- Parameters:
configuration
- the configuration to use as input for the backing table
-
setDefaults
public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
Description copied from interface:ILaunchConfigurationTab
Initializes the given launch configuration with default values for this tab. This method is called when a new launch configuration is created such that the configuration can be initialized with meaningful values. This method may be called before this tab's control is created.- Parameters:
configuration
- launch configuration
-
initializeFrom
public void initializeFrom(ILaunchConfiguration configuration)
Description copied from interface:ILaunchConfigurationTab
Initializes this tab's controls with values from the given launch configuration. This method is called when a configuration is selected to view or edit, after this tab's control has been created.- Parameters:
configuration
- launch configuration
-
performApply
public void performApply(ILaunchConfigurationWorkingCopy configuration)
Stores the environment in the given configuration- Parameters:
configuration
- launch configuration- See Also:
ILaunchConfigurationTab.performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
-
getName
public String getName()
Description copied from interface:ILaunchConfigurationTab
Returns the name of this tab.- Returns:
- the name of this tab
-
getId
public String getId()
Description copied from class:AbstractLaunchConfigurationTab
Returns this tab's unique identifier ornull
if none. By default,null
is returned. Subclasses should override as necessary.Tab identifiers allow contributed tabs to be ordered relative to one another.
- Overrides:
getId
in classAbstractLaunchConfigurationTab
- Returns:
- tab id or
null
- Since:
- 3.3
- See Also:
AbstractLaunchConfigurationTab.getId()
-
getImage
public Image getImage()
Description copied from interface:ILaunchConfigurationTab
Returns the image for this tab, ornull
if none- Specified by:
getImage
in interfaceILaunchConfigurationTab
- Overrides:
getImage
in classAbstractLaunchConfigurationTab
- Returns:
- the image for this tab, or
null
if none - See Also:
ILaunchConfigurationTab.getImage()
-
activated
public void activated(ILaunchConfigurationWorkingCopy workingCopy)
Description copied from class:AbstractLaunchConfigurationTab
This method was added to theILaunchConfigurationTab
interface in the 3.0 release to allow tabs to distinguish between a tab being activated and a tab group be initialized for the first time, from a selected launch configuration. To maintain backwards compatible behavior, the default implementation provided, calls this tab'sinitializeFrom
method. Tabs should override this method as required.The launch tab framework was originally designed to take care of inter tab communication by applying attributes from the active tab to the launch configuration being edited, when a tab is exited, and by initializing a tab when activated. The addition of the methods
activated
anddeactivated
allow tabs to determine the appropriate course of action.- Specified by:
activated
in interfaceILaunchConfigurationTab
- Overrides:
activated
in classAbstractLaunchConfigurationTab
- Parameters:
workingCopy
- the launch configuration being edited- See Also:
ILaunchConfigurationTab.activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
-
deactivated
public void deactivated(ILaunchConfigurationWorkingCopy workingCopy)
Description copied from class:AbstractLaunchConfigurationTab
This method was added to theILaunchConfigurationTab
interface in the 3.0 release to allow tabs to distinguish between a tab being deactivated and saving its attributes to a launch configuration. To maintain backwards compatible behavior, the default implementation provided, calls this tab'sperformApply
method. Tabs should override this method as required.The launch tab framework was originally designed to take care of inter tab communication by applying attributes from the active tab to the launch configuration being edited, when a tab is exited, and by initializing a tab when activated. The addition of the methods
activated
anddeactivated
allow tabs to determine the appropriate course of action.- Specified by:
deactivated
in interfaceILaunchConfigurationTab
- Overrides:
deactivated
in classAbstractLaunchConfigurationTab
- Parameters:
workingCopy
- the launch configuration being edited- See Also:
ILaunchConfigurationTab.deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
-
initializeAttributes
protected void initializeAttributes()
Description copied from class:AbstractLaunchConfigurationTab
Initialize attributes labels.- Overrides:
initializeAttributes
in classAbstractLaunchConfigurationTab
- Since:
- 3.13
-
-