Dialogs
Contents
- Overview
- Choice
- String Input
- Displaying Information
- Files
- Asking Questions
- Reporting Errors and Warnings
- HTML Browser
Overview
When XMF is executing as an Eclipse plugin you can use a variety of operations defined on the xmf object in order to display dialogs. The operations and examples of their use are shown in this document.To top.
Choice
The choice dialog allows you to select a collection of elements from a supplied sequence:xmf.choose("Class","Choose some classes",Root.allContentsOf(Class)->asSeq->sortNamedElements);
![Choice Dialog](Images/Choice.jpg)
Selecting cancel returns null.
To top.
String Input
The string dialog allows you to capture string input:xmf.getString("Name","Type your name","Fred Smith");
![Get String Dialog](Images/GetString.jpg)
Selecting cancel produces null.
To top.
Displaying Information
General information is displayed as follows:xmf.info("Did you know?","Mammals are the only animals with flaps around the ears.");
![Information Dialog](Images/Info.jpg)
Multi-line information can be shown as follows:
xmf.textArea("info","Class Documentation",Class.documentation.doc);
![Multiline Info](Images/Class%20Doc.jpg)
To top.
Files
Navigate to a file:xmf.openFile("c:/tmp/test","*.java","");
![Open File](Images/OpenFile.jpg)
The path to the selected file is returned. The empty string is returned if cancel is selected.
To top.
Asking Questions
You can ask a question as follows:xmf.question("Are mammals the only animals with flaps around the ears?");
![Question Dialog](Images/Question.jpg)
The result is either true or false.
To top.
Reporting Errors and Warnings
xmf.warning("Stop!","You have exceeded your authority!");
![Warning](Images/Warning.jpg)
To top.
HTML Browser
Although not strictly a dialog, you can create abrowser for HTML via XMF using xmf.browser(title,html) when running as an Eclipse plugin. This feature can be useful in order to generate reports.To top.