public class SOMChooserDialog
extends org.eclipse.jface.dialogs.Dialog
SystemOperationMode
from a SystemInstance
.
The SOM is created by the user selecting a mode for each modal component. The user must also enter a name for the SOM.
This is done so that a SOM can have an easily identifiable name such as "Departure" instead of
"Spec1_System1_impl_Instance.Mode1,Spec1_System1_impl_Instance.Subcomponent1.Mode2". The name and SOM object can be
retrieved through getSOMName()
and getSOM()
only after open()
has returned
Window.OK
. The name is not stored in the SystemOperationMode
. The expression
getSOM().getName().equals(getSOM().toString())
is true
.blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
Constructor and Description |
---|
SOMChooserDialog(org.eclipse.swt.widgets.Shell parentShell,
SystemInstance systemInstance)
Creates a new dialog that allows the user to compile a
SystemOperationMode
that requires the user to enter a name for the mode. |
SOMChooserDialog(org.eclipse.swt.widgets.Shell parentShell,
SystemInstance systemInstance,
boolean requireName)
Creates a new dialog that allows the user to compile a
SystemOperationMode . |
SOMChooserDialog(org.eclipse.swt.widgets.Shell parentShell,
SystemInstance systemInstance,
java.lang.String SOMName,
java.lang.String SOMPathText)
Creates a new dialog that allows the user to compile a
SystemOperationMode . |
Modifier and Type | Method and Description |
---|---|
static ComponentInstance |
findComponentInstance(ComponentInstance parent,
java.lang.String childName)
Finds a
ComponentInstance that is a direct child of parent with the name of childName . |
static ModeInstance |
findModeInstance(ComponentInstance parent,
java.lang.String modeName)
Finds a
ModeInstance that is a direct child of parent with the name of modeName . |
SystemOperationMode |
getSOM()
Returns the
SystemOperationMode that was generated by the dialog when the user clicked ok. |
java.lang.String |
getSOMName()
Returns the name that the user assigned to the
SystemOperationMode . |
int |
openThreadSafe()
Open the dialog.
|
applyDialogFont, close, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, create, getBlockedHandler, getImage, setBlockedHandler, shortenText
getDefaultImage, getDefaultImages, getDefaultOrientation, getReturnCode, getShell, getWindowManager, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setWindowManager
public SOMChooserDialog(org.eclipse.swt.widgets.Shell parentShell, SystemInstance systemInstance, boolean requireName) throws java.lang.IllegalArgumentException
SystemOperationMode
. Call
openThreadSafe()
after construction to display the dialog.parentShell
- The parent shell, or null
to create a top-level shell.systemInstance
- The system to base the SystemOperationMode
off of.requireName
- If true
, the user must enter an alias for the selected system
operation mode; if false
, no name is necessary.java.lang.IllegalArgumentException
- Thrown if systemInstance
is not modal.public SOMChooserDialog(org.eclipse.swt.widgets.Shell parentShell, SystemInstance systemInstance) throws java.lang.IllegalArgumentException
SystemOperationMode
that requires the user to enter a name for the mode. Call
openThreadSafe()
after construction to display the dialog.parentShell
- The parent shell, or null
to create a top-level shell.systemInstance
- The system to base the SystemOperationMode
off of.java.lang.IllegalArgumentException
- Thrown if systemInstance
is not modal.public SOMChooserDialog(org.eclipse.swt.widgets.Shell parentShell, SystemInstance systemInstance, java.lang.String SOMName, java.lang.String SOMPathText) throws java.lang.IllegalArgumentException
SystemOperationMode
. The modes for each component are preset
based on SOMPathText
. Use this constructor to modify a SystemOperationMode
. Call open()
after construction to display the dialog.parentShell
- The parent shell, or null
to create a top-level shell.systemInstance
- The system to base the SystemOperationMode
off of.SOMName
- The name of the SystemOperationMode
to modify. The name field will be preset with this value.SOMPathText
- The String representation of the SystemOperationMode
to modify. This can be retrieved by calling
SystemOperationMode.toString()
or SystemOperationMode.getName()
.java.lang.IllegalArgumentException
- Thrown if systemInstance
is not modal or if SOMPathText
contains segments
that do not describe a ModeInstance
.public int openThreadSafe()
Window.open()
.public SystemOperationMode getSOM() throws java.lang.IllegalStateException
SystemOperationMode
that was generated by the dialog when the user clicked ok.SystemOperationMode
that applies to the SystemInstance
that was passed to the constructor.java.lang.IllegalStateException
- Thrown if this method was called and open()
has not returned Window.OK
.public java.lang.String getSOMName() throws java.lang.IllegalStateException
SystemOperationMode
.SystemOperationMode
.java.lang.IllegalStateException
- Thrown if this method was called and open()
has not returned Window.OK
.public static ComponentInstance findComponentInstance(ComponentInstance parent, java.lang.String childName)
ComponentInstance
that is a direct child of parent
with the name of childName
.
This is a utility method and is used outside of this class. If there are more uses of this method, we should consider moving it
to a Util class.parent
- The ComponentInstance
to search in.childName
- The ComponentInstance
to search for.ComponentInstance
with the name of childName
or null if it cannot be found.public static ModeInstance findModeInstance(ComponentInstance parent, java.lang.String modeName)
ModeInstance
that is a direct child of parent
with the name of modeName
.
This is a utility method and is used outside of this class. If there are more uses of this method, we should consider moving it
to a Util class.parent
- The ComponentInstance
to search in.modeName
- The ModeInstance
to search for.ModeInstance
with the name of modeName
or null if it cannot be found.