org.eclipse.wst.jsdt.chromium.debug.ui

## Class DialogUtils

- java.lang.Object
- - org.eclipse.wst.jsdt.chromium.debug.ui.DialogUtils

    public class DialogUtils
    extends java.lang.Object

A small set of utility classes that help programming dialog window logic.

### Nested Class Summary

Nested Classes
`static interface` `DialogUtils.BranchVariableGetter` Annotates variable getter methods in interfaces that are used in `mergeBranchVariables(java.lang.Class<VARIABLES>, org.eclipse.wst.jsdt.chromium.debug.ui.DialogUtils.Switcher<?>, VARIABLES...)` methods.
`static class` `DialogUtils.ComboWrapper<E>` A wrapper around Combo that provides logic-level data-oriented access to the control.
`static class` `DialogUtils.ExpressionProcessor<T>` A base class for the source-consumer pair that accepts several values as a consumer, performs a calculation over them and gives it away the result via source interface.
`static interface` `DialogUtils.Gettable<RES>` A basic interface for anything that can give a value.
`static class` `DialogUtils.Message` A user interface message for dialog window.
`static class` `DialogUtils.MessagePriority` Priority of a user interface message.
`static interface` `DialogUtils.NormalExpression<T>` An expression that gets calculated only when its dependencies are all non-error.
`static class` `DialogUtils.OkButtonControl<T>` A general-purpose implementation of OK button vertex.
`static interface` `DialogUtils.OkButtonElements` An access to OK button and related elements of the dialog window from dialog logic part.
`static interface` `DialogUtils.Optional<V>` A primitive approach to "optional" algebraic type.
`static interface` `DialogUtils.OptionalSwitcher<T>` A switcher that is operated by optional expression.
`static interface` `DialogUtils.Scope` A scope for update graph vertices.
`static interface` `DialogUtils.ScopeEnabler` A callback that lets UI to reflect that some scope became enabled/disabled.
`static interface` `DialogUtils.SwitchBase<T>` Base interface for 2 types of switchers.
`static interface` `DialogUtils.Switcher<T>` A switcher that is operated by non-optional expression.
`static class` `DialogUtils.Updater` Helps to conduct update for vertices in a value graph.
`static interface` `DialogUtils.ValueConsumer` Represents consumer vertex for Updater.
`static class` `DialogUtils.ValueProcessor<T>` A basic implementation of object that is both consumer and source.
`static interface` `DialogUtils.ValueSource<T>` Represents source vertex for Updater.

### Field Summary

Fields
`static DialogUtils.Message` `NULL_MESSAGE`

### Constructor Summary

Constructors
Constructor and Description
`DialogUtils()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `addModifyListener(Button button, DialogUtils.ValueSource<?> valueSource, DialogUtils.Updater updater)` Adds a standard modify listener to a button that binds it to updater.
`static void` `addModifyListener(Text textElement, DialogUtils.ValueSource<?> valueSource, DialogUtils.Updater updater)` Adds a standard modify listener to a text element that binds it to updater.
`static DialogUtils.Message` `chooseImportantMessage(java.util.Collection<? extends DialogUtils.Message> messages)`
`static <T> DialogUtils.ValueSource<T>` `createConstant(T constnant, DialogUtils.Updater updater)`
`static <V> DialogUtils.Optional<V>` `createErrorOptional(DialogUtils.Message message)`
`static <V> DialogUtils.Optional<V>` `createErrorOptional(java.util.Set<? extends DialogUtils.Message> messages)`
`static <V> DialogUtils.Optional<V>` `createOptional(V value)`
`static <T> DialogUtils.ValueProcessor<T>` `createProcessor(DialogUtils.Gettable<T> expression)`
`static DialogUtils.ValueSource<? extends DialogUtils.Optional<?>>[]` `dependencies(DialogUtils.ValueSource<? extends DialogUtils.Optional<?>>... sources)`
`static <RES> DialogUtils.Gettable<DialogUtils.Optional<? extends RES>>` `handleErrors(DialogUtils.NormalExpression<RES> expression)` Converts `DialogUtils.NormalExpression` into `DialogUtils.Gettable` and takes responsibility of checking that all dependencies have only normal values.
`static <VARIABLES> VARIABLES` `mergeBranchVariables(java.lang.Class<VARIABLES> variablesType, DialogUtils.OptionalSwitcher<?> switcher, VARIABLES... branches)` For output variables from several branches of switch creates merged variables that could be used outside of the switch.
`static <VARIABLES> VARIABLES` `mergeBranchVariables(java.lang.Class<VARIABLES> variablesType, DialogUtils.Switcher<?> switcher, VARIABLES... branches)` For output variables from several branches of switch creates merged variables that could be used outside of the switch.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### NULL_MESSAGE

    public static final DialogUtils.Message NULL_MESSAGE

### Constructor Detail

#### DialogUtils

    public DialogUtils()

### Method Detail

#### createConstant

    public static <T> DialogUtils.ValueSource<T> createConstant(T constnant,
                                                                DialogUtils.Updater updater)

#### createOptional

    public static <V> DialogUtils.Optional<V> createOptional(V value)

#### createErrorOptional

    public static <V> DialogUtils.Optional<V> createErrorOptional(DialogUtils.Message message)

#### createErrorOptional

    public static <V> DialogUtils.Optional<V> createErrorOptional(java.util.Set<? extends DialogUtils.Message> messages)

#### handleErrors

    public static <RES> DialogUtils.Gettable<DialogUtils.Optional<? extends RES>> handleErrors(DialogUtils.NormalExpression<RES> expression)

Converts `DialogUtils.NormalExpression` into `DialogUtils.Gettable` and takes responsibility of checking that all dependencies have only normal values. Despite `DialogUtils.NormalExpression` being reflection-based interface, this method should be completely type-safe for a programmer and accurately check (statically) that its signatures are consistent (including generic types).

#### dependencies

    public static DialogUtils.ValueSource<? extends DialogUtils.Optional<?>>[] dependencies(DialogUtils.ValueSource<? extends DialogUtils.Optional<?>>... sources)

#### mergeBranchVariables

    public static <VARIABLES> VARIABLES mergeBranchVariables(java.lang.Class<VARIABLES> variablesType,
                                                             DialogUtils.Switcher<?> switcher,
                                                             VARIABLES... branches)

For output variables from several branches of switch creates merged variables that could be used outside of the switch. Variables are provided and returned in form of interface VARIABLES.

Type Parameters:
  `VARIABLES` - an interface that should consist only of no-param getters with `DialogUtils.BranchVariableGetter` annotation that return ValueSource<...> types; must not be a generic type
Parameters:
  `switcher` - the variables get merged from
  `branches` - output variables of all switch branches; should be in the same order branches (aka scopes) are added to the switch
Returns:
  variable sources that could be used outside switch branches

#### mergeBranchVariables

    public static <VARIABLES> VARIABLES mergeBranchVariables(java.lang.Class<VARIABLES> variablesType,
                                                             DialogUtils.OptionalSwitcher<?> switcher,
                                                             VARIABLES... branches)

For output variables from several branches of switch creates merged variables that could be used outside of the switch. Variables are provided and returned in form of interface VARIABLES.

Type Parameters:
  `VARIABLES` - an interface that should consist only of no-param getters with `DialogUtils.BranchVariableGetter` annotation that return ValueSource< [? extends] Optional < ... > > types; must not be a generic type
Parameters:
  `switcher` - the variables get merged from
  `branches` - output variables of all switch branches; should be in the same order branches (aka scopes) are added to the switch
Returns:
  variable sources that could be used outside switch branches

#### chooseImportantMessage

    public static DialogUtils.Message chooseImportantMessage(java.util.Collection<? extends DialogUtils.Message> messages)

#### createProcessor

    public static <T> DialogUtils.ValueProcessor<T> createProcessor(DialogUtils.Gettable<T> expression)

#### addModifyListener

    public static void addModifyListener(Text textElement,
                                         DialogUtils.ValueSource<?> valueSource,
                                         DialogUtils.Updater updater)

Adds a standard modify listener to a text element that binds it to updater.

#### addModifyListener

    public static void addModifyListener(Button button,
                                         DialogUtils.ValueSource<?> valueSource,
                                         DialogUtils.Updater updater)

Adds a standard modify listener to a button that binds it to updater.