Package org.csstudio.ui.util.composites
Class ResourceAndContainerGroup
java.lang.Object
org.csstudio.ui.util.composites.ResourceAndContainerGroup
- All Implemented Interfaces:
Listener
Workbench-level composite for resource and container specification by the user. Services such as field validation are
performed by the group. The group can be configured to accept existing resources, or only new resources.
Code is based upon org.eclipse.ui.internal.ide.misc.ResourceAndContainerGroup
in plugin
org.eclipse.ui.ide
.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Problem identifier: Container is empty.static final int
Problem identifier: Invalid resource name.static final int
Problem identifier: No problem.static final int
Problem identifier: Path is invalid.static final int
Problem identifier: Path os occupied.static final int
Problem identifier: Project does not exist.static final int
Problem identifier: Empty resource.static final int
Problem identifier: Resource already exists. -
Constructor Summary
ConstructorDescriptionResourceAndContainerGroup
(Composite parent, Listener client, String resourceFieldLabel, String resourceType) Create an instance of the group to allow the user to enter/select a container and specify a resource name.ResourceAndContainerGroup
(Composite parent, Listener client, String resourceFieldLabel, String resourceType, boolean showClosedProjects) Create an instance of the group to allow the user to enter/select a container and specify a resource name.ResourceAndContainerGroup
(Composite parent, Listener client, String resourceFieldLabel, String resourceType, boolean showClosedProjects, int heightHint) Create an instance of the group to allow the user to enter/select a container and specify a resource name. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns a boolean indicating whether all controls in this group contain valid values.Returns the path of the currently selected container or null if no container has been selected.Return the file extension.Returns an error message indicating the current problem with the value of a control in the group, or an empty message if all controls in the group contain valid values.int
Returns the type of problem with the value of a control in the group.Returns a string that is the path of the currently selected container.void
handleEvent
(Event e) Handles events for all controls in the group.void
setAllowExistingResources
(boolean value) Sets the flag indicating whether existing resources are permitted.void
setContainerFullPath
(IPath path) Sets the value of this page's container.void
setContainerSelectionGroupEnabled
(boolean enabled) Set the embedded container selection group to enabled/disabled.void
setFileExtension
(String fileExtension) Set the file extension.void
setFocus()
Gives focus to the resource name field and selects its contents.void
setResource
(String value) Sets the value of this page's resource name.
-
Field Details
-
PROBLEM_NONE
public static final int PROBLEM_NONEProblem identifier: No problem.- See Also:
-
PROBLEM_RESOURCE_EMPTY
public static final int PROBLEM_RESOURCE_EMPTYProblem identifier: Empty resource.- See Also:
-
PROBLEM_RESOURCE_EXIST
public static final int PROBLEM_RESOURCE_EXISTProblem identifier: Resource already exists.- See Also:
-
PROBLEM_PATH_INVALID
public static final int PROBLEM_PATH_INVALIDProblem identifier: Path is invalid.- See Also:
-
PROBLEM_CONTAINER_EMPTY
public static final int PROBLEM_CONTAINER_EMPTYProblem identifier: Container is empty.- See Also:
-
PROBLEM_PROJECT_DOES_NOT_EXIST
public static final int PROBLEM_PROJECT_DOES_NOT_EXISTProblem identifier: Project does not exist.- See Also:
-
PROBLEM_NAME_INVALID
public static final int PROBLEM_NAME_INVALIDProblem identifier: Invalid resource name.- See Also:
-
PROBLEM_PATH_OCCUPIED
public static final int PROBLEM_PATH_OCCUPIEDProblem identifier: Path os occupied.- See Also:
-
-
Constructor Details
-
ResourceAndContainerGroup
public ResourceAndContainerGroup(Composite parent, Listener client, String resourceFieldLabel, String resourceType) Create an instance of the group to allow the user to enter/select a container and specify a resource name.- Parameters:
parent
- composite widget to parent the groupclient
- object interested in changes to the group's fields valueresourceFieldLabel
- label to use in front of the resource name fieldresourceType
- one word, in lowercase, to describe the resource to the user (file, folder, project) height hint for the container selection widget group
-
ResourceAndContainerGroup
public ResourceAndContainerGroup(Composite parent, Listener client, String resourceFieldLabel, String resourceType, boolean showClosedProjects) Create an instance of the group to allow the user to enter/select a container and specify a resource name.- Parameters:
parent
- composite widget to parent the groupclient
- object interested in changes to the group's fields valueresourceFieldLabel
- label to use in front of the resource name fieldresourceType
- one word, in lowercase, to describe the resource to the user (file, folder, project)showClosedProjects
- whether or not to show closed projects height hint for the container selection widget group
-
ResourceAndContainerGroup
public ResourceAndContainerGroup(Composite parent, Listener client, String resourceFieldLabel, String resourceType, boolean showClosedProjects, int heightHint) Create an instance of the group to allow the user to enter/select a container and specify a resource name.- Parameters:
parent
- composite widget to parent the groupclient
- object interested in changes to the group's fields valueresourceFieldLabel
- label to use in front of the resource name fieldresourceType
- one word, in lowercase, to describe the resource to the user (file, folder, project)showClosedProjects
- whether or not to show closed projectsheightHint
- height hint for the container selection widget group
-
-
Method Details
-
areAllValuesValid
public boolean areAllValuesValid()Returns a boolean indicating whether all controls in this group contain valid values.- Returns:
- boolean
-
getContainerFullPath
Returns the path of the currently selected container or null if no container has been selected. Note that the container may not exist yet if the user entered a new container name in the field.- Returns:
- The full path of the selected container.
-
getProblemMessage
Returns an error message indicating the current problem with the value of a control in the group, or an empty message if all controls in the group contain valid values.- Returns:
- java.lang.String
-
getProblemType
public int getProblemType()Returns the type of problem with the value of a control in the group.- Returns:
- one of the PROBLEM_* constants
-
getResource
Returns a string that is the path of the currently selected container. Returns an empty string if no container has been selected.- Returns:
- The entered resource name.
-
handleEvent
Handles events for all controls in the group.- Specified by:
handleEvent
in interfaceListener
- Parameters:
e
- org.eclipse.swt.widgets.Event
-
setAllowExistingResources
public void setAllowExistingResources(boolean value) Sets the flag indicating whether existing resources are permitted.- Parameters:
value
- Flag that signals of it is allows to enter the names of already existing resources.
-
setContainerFullPath
Sets the value of this page's container.- Parameters:
path
- Full path to the container.
-
setFocus
public void setFocus()Gives focus to the resource name field and selects its contents. -
setResource
Sets the value of this page's resource name.- Parameters:
value
- new value
-
getFileExtension
Return the file extension.- Returns:
- The file extension
-
setFileExtension
Set the file extension.- Parameters:
fileExtension
- The file extension to set
-
setContainerSelectionGroupEnabled
public void setContainerSelectionGroupEnabled(boolean enabled) Set the embedded container selection group to enabled/disabled.- Parameters:
enabled
- true for enabled, false for diabled.
-