<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FSWT_JFace_Eclipse%2FJFace_Dialog</id>
		<title>Java/SWT JFace Eclipse/JFace Dialog - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FSWT_JFace_Eclipse%2FJFace_Dialog"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/JFace_Dialog&amp;action=history"/>
		<updated>2026-04-21T18:46:33Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/JFace_Dialog&amp;diff=5706&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/JFace_Dialog&amp;diff=5706&amp;oldid=prev"/>
				<updated>2010-06-01T05:57:04Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 05:57, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/JFace_Dialog&amp;diff=5705&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/SWT_JFace_Eclipse/JFace_Dialog&amp;diff=5705&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== JFace&amp;quot;s ErrorDialog class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.eclipse.core.runtime.*;&lt;br /&gt;
import org.eclipse.jface.dialogs.ErrorDialog;&lt;br /&gt;
import org.eclipse.jface.window.ApplicationWindow;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.events.*;&lt;br /&gt;
import org.eclipse.swt.layout.*;&lt;br /&gt;
import org.eclipse.swt.widgets.*;&lt;br /&gt;
/**&lt;br /&gt;
 * This class demonstrates JFace&amp;quot;s ErrorDialog class&lt;br /&gt;
 */&lt;br /&gt;
public class ShowError extends ApplicationWindow {&lt;br /&gt;
  /**&lt;br /&gt;
   * ShowError constructor&lt;br /&gt;
   */&lt;br /&gt;
  public ShowError() {&lt;br /&gt;
    super(null);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Runs the application&lt;br /&gt;
   */&lt;br /&gt;
  public void run() {&lt;br /&gt;
    // Don&amp;quot;t return from open() until window closes&lt;br /&gt;
    setBlockOnOpen(true);&lt;br /&gt;
    // Open the main window&lt;br /&gt;
    open();&lt;br /&gt;
    // Dispose the display&lt;br /&gt;
    Display.getCurrent().dispose();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Configures the shell&lt;br /&gt;
   * &lt;br /&gt;
   * @param shell the shell&lt;br /&gt;
   */&lt;br /&gt;
  protected void configureShell(Shell shell) {&lt;br /&gt;
    super.configureShell(shell);&lt;br /&gt;
    // Set the title bar text and the size&lt;br /&gt;
    shell.setText(&amp;quot;Show Error&amp;quot;);&lt;br /&gt;
    shell.setSize(400, 400);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the main window&amp;quot;s contents&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the main window&lt;br /&gt;
   * @return Control&lt;br /&gt;
   */&lt;br /&gt;
  protected Control createContents(Composite parent) {&lt;br /&gt;
    Composite composite = new Composite(parent, SWT.NONE);&lt;br /&gt;
    composite.setLayout(new GridLayout(1, false));&lt;br /&gt;
    // Create a big text box to accept error text&lt;br /&gt;
    final Text text = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);&lt;br /&gt;
    text.setLayoutData(new GridData(GridData.FILL_BOTH));&lt;br /&gt;
    // Create the button to launch the error dialog&lt;br /&gt;
    Button show = new Button(composite, SWT.PUSH);&lt;br /&gt;
    show.setText(&amp;quot;Show Error&amp;quot;);&lt;br /&gt;
    show.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        // Create the required Status object&lt;br /&gt;
        Status status = new Status(IStatus.ERROR, &amp;quot;My Plug-in ID&amp;quot;, 0,&lt;br /&gt;
            &amp;quot;Status Error Message&amp;quot;, null);&lt;br /&gt;
        // Display the dialog&lt;br /&gt;
        ErrorDialog.openError(Display.getCurrent().getActiveShell(),&lt;br /&gt;
            &amp;quot;JFace Error&amp;quot;, text.getText(), status);&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    return composite;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * The application entry point&lt;br /&gt;
   * &lt;br /&gt;
   * @param args the command line arguments&lt;br /&gt;
   */&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    new ShowError().run();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== JFace&amp;quot;s IconAndMessageDialog ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.eclipse.jface.window.ApplicationWindow;&lt;br /&gt;
import org.eclipse.swt.*;&lt;br /&gt;
import org.eclipse.swt.events.*;&lt;br /&gt;
import org.eclipse.swt.layout.*;&lt;br /&gt;
import org.eclipse.swt.widgets.*;&lt;br /&gt;
/**&lt;br /&gt;
 * This class demonstrates JFace&amp;quot;s IconAndMessageDialog class&lt;br /&gt;
 */&lt;br /&gt;
public class DumbUser extends ApplicationWindow {&lt;br /&gt;
  /**&lt;br /&gt;
   * DumbUser constructor&lt;br /&gt;
   */&lt;br /&gt;
  public DumbUser() {&lt;br /&gt;
    super(null);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Runs the application&lt;br /&gt;
   */&lt;br /&gt;
  public void run() {&lt;br /&gt;
    // Don&amp;quot;t return from open() until window closes&lt;br /&gt;
    setBlockOnOpen(true);&lt;br /&gt;
    // Open the main window&lt;br /&gt;
    open();&lt;br /&gt;
    // Dispose the display&lt;br /&gt;
    Display.getCurrent().dispose();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the main window&amp;quot;s contents&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the main window&lt;br /&gt;
   * @return Control&lt;br /&gt;
   */&lt;br /&gt;
  protected Control createContents(Composite parent) {&lt;br /&gt;
    Composite composite = new Composite(parent, SWT.NONE);&lt;br /&gt;
    composite.setLayout(new GridLayout(1, true));&lt;br /&gt;
    // Create the button&lt;br /&gt;
    Button show = new Button(composite, SWT.NONE);&lt;br /&gt;
    show.setText(&amp;quot;Show&amp;quot;);&lt;br /&gt;
    final Shell shell = parent.getShell();&lt;br /&gt;
    // Display the dialog&lt;br /&gt;
    show.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        // Create and show the dialog&lt;br /&gt;
        DumbMessageDialog dlg = new DumbMessageDialog(shell);&lt;br /&gt;
        dlg.open();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    parent.pack();&lt;br /&gt;
    return composite;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * The application entry point&lt;br /&gt;
   * &lt;br /&gt;
   * @param args the command line arguments&lt;br /&gt;
   */&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    new DumbUser().run();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
/**&lt;br /&gt;
 * This class demonstrates the IconAndMessageDialog class&lt;br /&gt;
 */&lt;br /&gt;
class DumbMessageDialog extends IconAndMessageDialog {&lt;br /&gt;
  public static final int I_DUNNO_ID = IDialogConstants.CLIENT_ID;&lt;br /&gt;
  public static final String I_DUNNO_LABEL = &amp;quot;I Dunno&amp;quot;;&lt;br /&gt;
  // The image&lt;br /&gt;
  private Image image;&lt;br /&gt;
  // The label for the &amp;quot;hidden&amp;quot; message&lt;br /&gt;
  private Label label;&lt;br /&gt;
  /**&lt;br /&gt;
   * DumbMessageDialog constructor&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the parent shell&lt;br /&gt;
   */&lt;br /&gt;
  public DumbMessageDialog(Shell parent) {&lt;br /&gt;
    super(parent);&lt;br /&gt;
    // Create the image&lt;br /&gt;
    try {&lt;br /&gt;
      image = new Image(parent.getDisplay(), new FileInputStream(&amp;quot;jexp.gif&amp;quot;));&lt;br /&gt;
    } catch (FileNotFoundException e) {}&lt;br /&gt;
    // Set the default message&lt;br /&gt;
    message = &amp;quot;Are you sure you want to do something that dumb?&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Sets the message&lt;br /&gt;
   * &lt;br /&gt;
   * @param message the message&lt;br /&gt;
   */&lt;br /&gt;
  public void setMessage(String message) {&lt;br /&gt;
    this.message = message;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Closes the dialog&lt;br /&gt;
   * &lt;br /&gt;
   * @return boolean&lt;br /&gt;
   */&lt;br /&gt;
  public boolean close() {&lt;br /&gt;
    if (image != null) image.dispose();&lt;br /&gt;
    return super.close();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the dialog area&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the parent composite&lt;br /&gt;
   * @return Control&lt;br /&gt;
   */&lt;br /&gt;
  protected Control createDialogArea(Composite parent) {&lt;br /&gt;
    createMessageArea(parent);&lt;br /&gt;
    // Create a composite to hold the label&lt;br /&gt;
    Composite composite = new Composite(parent, SWT.NONE);&lt;br /&gt;
    GridData data = new GridData(GridData.FILL_BOTH);&lt;br /&gt;
    data.horizontalSpan = 2;&lt;br /&gt;
    composite.setLayoutData(data);&lt;br /&gt;
    composite.setLayout(new FillLayout());&lt;br /&gt;
    // Create the label for the &amp;quot;hidden&amp;quot; message&lt;br /&gt;
    label = new Label(composite, SWT.LEFT);&lt;br /&gt;
    return composite;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the buttons&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the parent composite&lt;br /&gt;
   */&lt;br /&gt;
  protected void createButtonsForButtonBar(Composite parent) {&lt;br /&gt;
    createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL,&lt;br /&gt;
        true);&lt;br /&gt;
    createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);&lt;br /&gt;
    createButton(parent, I_DUNNO_ID, I_DUNNO_LABEL, false);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Handles a button press&lt;br /&gt;
   * &lt;br /&gt;
   * @param buttonId the ID of the pressed button&lt;br /&gt;
   */&lt;br /&gt;
  protected void buttonPressed(int buttonId) {&lt;br /&gt;
    // If they press I Dunno, close the dialog&lt;br /&gt;
    if (buttonId == I_DUNNO_ID) {&lt;br /&gt;
      setReturnCode(buttonId);&lt;br /&gt;
      close();&lt;br /&gt;
    } else {&lt;br /&gt;
      // Otherwise, have some fun&lt;br /&gt;
      label.setText(&amp;quot;Yeah, right. You know nothing.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Gets the image to use&lt;br /&gt;
   */&lt;br /&gt;
  protected Image getImage() {&lt;br /&gt;
    return image;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== JFace&amp;quot;s InputDialog ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.eclipse.jface.dialogs.InputDialog;&lt;br /&gt;
import org.eclipse.jface.dialogs.IInputValidator;&lt;br /&gt;
import org.eclipse.jface.window.*;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.events.*;&lt;br /&gt;
import org.eclipse.swt.layout.*;&lt;br /&gt;
import org.eclipse.swt.widgets.*;&lt;br /&gt;
/**&lt;br /&gt;
 * This class demonstrates JFace&amp;quot;s InputDialog class&lt;br /&gt;
 */&lt;br /&gt;
public class GetInput extends ApplicationWindow {&lt;br /&gt;
  /**&lt;br /&gt;
   * GetInput constructor&lt;br /&gt;
   */&lt;br /&gt;
  public GetInput() {&lt;br /&gt;
    super(null);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Runs the application&lt;br /&gt;
   */&lt;br /&gt;
  public void run() {&lt;br /&gt;
    // Don&amp;quot;t return from open() until window closes&lt;br /&gt;
    setBlockOnOpen(true);&lt;br /&gt;
    // Open the main window&lt;br /&gt;
    open();&lt;br /&gt;
    // Dispose the display&lt;br /&gt;
    Display.getCurrent().dispose();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Configures the shell&lt;br /&gt;
   * &lt;br /&gt;
   * @param shell the shell&lt;br /&gt;
   */&lt;br /&gt;
  protected void configureShell(Shell shell) {&lt;br /&gt;
    super.configureShell(shell);&lt;br /&gt;
    // Set the title bar text&lt;br /&gt;
    shell.setText(&amp;quot;Get Input&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the main window&amp;quot;s contents&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the main window&lt;br /&gt;
   * @return Control&lt;br /&gt;
   */&lt;br /&gt;
  protected Control createContents(Composite parent) {&lt;br /&gt;
    Composite composite = new Composite(parent, SWT.NONE);&lt;br /&gt;
    composite.setLayout(new GridLayout(1, false));&lt;br /&gt;
    // Create a label to display what the user typed in&lt;br /&gt;
    final Label label = new Label(composite, SWT.NONE);&lt;br /&gt;
    label.setText(&amp;quot;This will display the user input from InputDialog&amp;quot;);&lt;br /&gt;
    // Create the button to launch the error dialog&lt;br /&gt;
    Button show = new Button(composite, SWT.PUSH);&lt;br /&gt;
    show.setText(&amp;quot;Get Input&amp;quot;);&lt;br /&gt;
    show.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(),&lt;br /&gt;
            &amp;quot;&amp;quot;, &amp;quot;Enter 5-8 characters&amp;quot;, label.getText(), new LengthValidator());&lt;br /&gt;
        if (dlg.open() == Window.OK) {&lt;br /&gt;
          // User clicked OK; update the label with the input&lt;br /&gt;
          label.setText(dlg.getValue());&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    parent.pack();&lt;br /&gt;
    return composite;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * The application entry point&lt;br /&gt;
   * &lt;br /&gt;
   * @param args the command line arguments&lt;br /&gt;
   */&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    new GetInput().run();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
/**&lt;br /&gt;
 * This class validates a String. It makes sure that the String is between 5 and 8&lt;br /&gt;
 * characters&lt;br /&gt;
 */&lt;br /&gt;
class LengthValidator implements IInputValidator {&lt;br /&gt;
  /**&lt;br /&gt;
   * Validates the String. Returns null for no error, or an error message&lt;br /&gt;
   * &lt;br /&gt;
   * @param newText the String to validate&lt;br /&gt;
   * @return String&lt;br /&gt;
   */&lt;br /&gt;
  public String isValid(String newText) {&lt;br /&gt;
    int len = newText.length();&lt;br /&gt;
    // Determine if input is too short or too long&lt;br /&gt;
    if (len &amp;lt; 5) return &amp;quot;Too short&amp;quot;;&lt;br /&gt;
    if (len &amp;gt; 8) return &amp;quot;Too long&amp;quot;;&lt;br /&gt;
    // Input must be OK&lt;br /&gt;
    return null;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== JFace&amp;quot;s MessageDialog ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.eclipse.jface.dialogs.MessageDialog;&lt;br /&gt;
import org.eclipse.jface.window.ApplicationWindow;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.events.*;&lt;br /&gt;
import org.eclipse.swt.layout.*;&lt;br /&gt;
import org.eclipse.swt.widgets.*;&lt;br /&gt;
/**&lt;br /&gt;
 * This class demonstrates JFace&amp;quot;s MessageDialog class&lt;br /&gt;
 */&lt;br /&gt;
public class SendMessage extends ApplicationWindow {&lt;br /&gt;
  /**&lt;br /&gt;
   * SendMessage constructor&lt;br /&gt;
   */&lt;br /&gt;
  public SendMessage() {&lt;br /&gt;
    super(null);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Runs the application&lt;br /&gt;
   */&lt;br /&gt;
  public void run() {&lt;br /&gt;
    // Don&amp;quot;t return from open() until window closes&lt;br /&gt;
    setBlockOnOpen(true);&lt;br /&gt;
    // Open the main window&lt;br /&gt;
    open();&lt;br /&gt;
    // Dispose the display&lt;br /&gt;
    Display.getCurrent().dispose();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Configures the shell&lt;br /&gt;
   * &lt;br /&gt;
   * @param shell the shell&lt;br /&gt;
   */&lt;br /&gt;
  protected void configureShell(Shell shell) {&lt;br /&gt;
    super.configureShell(shell);&lt;br /&gt;
    // Set the title bar text and the size&lt;br /&gt;
    shell.setText(&amp;quot;Send Message&amp;quot;);&lt;br /&gt;
    shell.setSize(500, 400);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the main window&amp;quot;s contents&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the main window&lt;br /&gt;
   * @return Control&lt;br /&gt;
   */&lt;br /&gt;
  protected Control createContents(Composite parent) {&lt;br /&gt;
    Composite composite = new Composite(parent, SWT.NONE);&lt;br /&gt;
    composite.setLayout(new GridLayout(5, true));&lt;br /&gt;
    // Create a big text box for the message text&lt;br /&gt;
    final Text text = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);&lt;br /&gt;
    GridData data = new GridData(GridData.FILL_BOTH);&lt;br /&gt;
    data.horizontalSpan = 5;&lt;br /&gt;
    text.setLayoutData(data);&lt;br /&gt;
    // Create the Confirm button&lt;br /&gt;
    Button confirm = new Button(composite, SWT.PUSH);&lt;br /&gt;
    confirm.setText(&amp;quot;Confirm&amp;quot;);&lt;br /&gt;
    confirm.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));&lt;br /&gt;
    // Create the Error button&lt;br /&gt;
    Button error = new Button(composite, SWT.PUSH);&lt;br /&gt;
    error.setText(&amp;quot;Error&amp;quot;);&lt;br /&gt;
    error.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));&lt;br /&gt;
    // Create the Information button&lt;br /&gt;
    Button information = new Button(composite, SWT.PUSH);&lt;br /&gt;
    information.setText(&amp;quot;Information&amp;quot;);&lt;br /&gt;
    information.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));&lt;br /&gt;
    // Create the Question button&lt;br /&gt;
    Button question = new Button(composite, SWT.PUSH);&lt;br /&gt;
    question.setText(&amp;quot;Question&amp;quot;);&lt;br /&gt;
    question.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));&lt;br /&gt;
    // Create the Warning button&lt;br /&gt;
    Button warning = new Button(composite, SWT.PUSH);&lt;br /&gt;
    warning.setText(&amp;quot;Warning&amp;quot;);&lt;br /&gt;
    warning.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));&lt;br /&gt;
    // Create the label to display the return value&lt;br /&gt;
    final Label label = new Label(composite, SWT.NONE);&lt;br /&gt;
    data = new GridData(GridData.FILL_HORIZONTAL);&lt;br /&gt;
    data.horizontalSpan = 5;&lt;br /&gt;
    label.setLayoutData(data);&lt;br /&gt;
    // Save ourselves some typing&lt;br /&gt;
    final Shell shell = parent.getShell();&lt;br /&gt;
    // Display a Confirmation dialog&lt;br /&gt;
    confirm.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        boolean b = MessageDialog.openConfirm(shell, &amp;quot;Confirm&amp;quot;, text.getText());&lt;br /&gt;
        label.setText(&amp;quot;Returned &amp;quot; + Boolean.toString(b));&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    // Display an Error dialog&lt;br /&gt;
    error.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        MessageDialog.openError(shell, &amp;quot;Error&amp;quot;, text.getText());&lt;br /&gt;
        label.setText(&amp;quot;Returned void&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    // Display an Information dialog&lt;br /&gt;
    information.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        MessageDialog.openInformation(shell, &amp;quot;Information&amp;quot;, text.getText());&lt;br /&gt;
        label.setText(&amp;quot;Returned void&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    // Display a Question dialog&lt;br /&gt;
    question.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        boolean b = MessageDialog.openQuestion(shell, &amp;quot;Question&amp;quot;, text.getText());&lt;br /&gt;
        label.setText(&amp;quot;Returned &amp;quot; + Boolean.toString(b));&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    // Display a Warning dialog&lt;br /&gt;
    warning.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        MessageDialog.openWarning(shell, &amp;quot;Warning&amp;quot;, text.getText());&lt;br /&gt;
        label.setText(&amp;quot;Returned void&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    return composite;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * The application entry point&lt;br /&gt;
   * &lt;br /&gt;
   * @param args the command line arguments&lt;br /&gt;
   */&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    new SendMessage().run();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== JFace&amp;quot;s ProgressMonitorDialog ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.lang.reflect.InvocationTargetException;&lt;br /&gt;
import org.eclipse.jface.dialogs.*;&lt;br /&gt;
import org.eclipse.jface.window.ApplicationWindow;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.events.*;&lt;br /&gt;
import org.eclipse.swt.layout.*;&lt;br /&gt;
import org.eclipse.swt.widgets.*;&lt;br /&gt;
import org.eclipse.core.runtime.IProgressMonitor;&lt;br /&gt;
import org.eclipse.jface.operation.IRunnableWithProgress;&lt;br /&gt;
/**&lt;br /&gt;
 * This class demonstrates JFace&amp;quot;s ProgressMonitorDialog class&lt;br /&gt;
 */&lt;br /&gt;
public class ShowProgress extends ApplicationWindow {&lt;br /&gt;
  /**&lt;br /&gt;
   * ShowProgress constructor&lt;br /&gt;
   */&lt;br /&gt;
  public ShowProgress() {&lt;br /&gt;
    super(null);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Runs the application&lt;br /&gt;
   */&lt;br /&gt;
  public void run() {&lt;br /&gt;
    // Don&amp;quot;t return from open() until window closes&lt;br /&gt;
    setBlockOnOpen(true);&lt;br /&gt;
    // Open the main window&lt;br /&gt;
    open();&lt;br /&gt;
    // Dispose the display&lt;br /&gt;
    Display.getCurrent().dispose();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Configures the shell&lt;br /&gt;
   * &lt;br /&gt;
   * @param shell the shell&lt;br /&gt;
   */&lt;br /&gt;
  protected void configureShell(Shell shell) {&lt;br /&gt;
    super.configureShell(shell);&lt;br /&gt;
    // Set the title bar text&lt;br /&gt;
    shell.setText(&amp;quot;Show Progress&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the main window&amp;quot;s contents&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the main window&lt;br /&gt;
   * @return Control&lt;br /&gt;
   */&lt;br /&gt;
  protected Control createContents(Composite parent) {&lt;br /&gt;
    Composite composite = new Composite(parent, SWT.NONE);&lt;br /&gt;
    composite.setLayout(new GridLayout(1, true));&lt;br /&gt;
    // Create the indeterminate checkbox&lt;br /&gt;
    final Button indeterminate = new Button(composite, SWT.CHECK);&lt;br /&gt;
    indeterminate.setText(&amp;quot;Indeterminate&amp;quot;);&lt;br /&gt;
    // Create the ShowProgress button&lt;br /&gt;
    Button showProgress = new Button(composite, SWT.NONE);&lt;br /&gt;
    showProgress.setText(&amp;quot;Show Progress&amp;quot;);&lt;br /&gt;
    final Shell shell = parent.getShell();&lt;br /&gt;
    // Display the ProgressMonitorDialog&lt;br /&gt;
    showProgress.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        try {&lt;br /&gt;
          new ProgressMonitorDialog(shell).run(true, true,&lt;br /&gt;
              new LongRunningOperation(indeterminate.getSelection()));&lt;br /&gt;
        } catch (InvocationTargetException e) {&lt;br /&gt;
          MessageDialog.openError(shell, &amp;quot;Error&amp;quot;, e.getMessage());&lt;br /&gt;
        } catch (InterruptedException e) {&lt;br /&gt;
          MessageDialog.openInformation(shell, &amp;quot;Cancelled&amp;quot;, e.getMessage());&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    parent.pack();&lt;br /&gt;
    return composite;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * The application entry point&lt;br /&gt;
   * &lt;br /&gt;
   * @param args the command line arguments&lt;br /&gt;
   */&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    new ShowProgress().run();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * This class represents a long running operation&lt;br /&gt;
 */&lt;br /&gt;
class LongRunningOperation implements IRunnableWithProgress {&lt;br /&gt;
  // The total sleep time&lt;br /&gt;
  private static final int TOTAL_TIME = 10000;&lt;br /&gt;
  // The increment sleep time&lt;br /&gt;
  private static final int INCREMENT = 500;&lt;br /&gt;
  private boolean indeterminate;&lt;br /&gt;
  /**&lt;br /&gt;
   * LongRunningOperation constructor&lt;br /&gt;
   * &lt;br /&gt;
   * @param indeterminate whether the animation is unknown&lt;br /&gt;
   */&lt;br /&gt;
  public LongRunningOperation(boolean indeterminate) {&lt;br /&gt;
    this.indeterminate = indeterminate;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Runs the long running operation&lt;br /&gt;
   * &lt;br /&gt;
   * @param monitor the progress monitor&lt;br /&gt;
   */&lt;br /&gt;
  public void run(IProgressMonitor monitor) throws InvocationTargetException,&lt;br /&gt;
      InterruptedException {&lt;br /&gt;
    monitor.beginTask(&amp;quot;Running long running operation&amp;quot;,&lt;br /&gt;
        indeterminate ? IProgressMonitor.UNKNOWN : TOTAL_TIME);&lt;br /&gt;
    for (int total = 0; total &amp;lt; TOTAL_TIME &amp;amp;&amp;amp; !monitor.isCanceled(); total += INCREMENT) {&lt;br /&gt;
      Thread.sleep(INCREMENT);&lt;br /&gt;
      monitor.worked(INCREMENT);&lt;br /&gt;
      if (total == TOTAL_TIME / 2) monitor.subTask(&amp;quot;Doing second half&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    monitor.done();&lt;br /&gt;
    if (monitor.isCanceled())&lt;br /&gt;
        throw new InterruptedException(&amp;quot;The long running operation was cancelled&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== JFace&amp;quot;s TitleAreaDialog ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import org.eclipse.jface.window.ApplicationWindow;&lt;br /&gt;
import org.eclipse.jface.dialogs.*;&lt;br /&gt;
import org.eclipse.swt.SWT;&lt;br /&gt;
import org.eclipse.swt.events.*;&lt;br /&gt;
import org.eclipse.swt.graphics.*;&lt;br /&gt;
import org.eclipse.swt.layout.*;&lt;br /&gt;
import org.eclipse.swt.widgets.*;&lt;br /&gt;
import java.io.*;&lt;br /&gt;
/**&lt;br /&gt;
 * This class demonstrates JFace&amp;quot;s TitleAreaDialog class&lt;br /&gt;
 */&lt;br /&gt;
public class ShowMyTitleAreaDialog extends ApplicationWindow {&lt;br /&gt;
  /**&lt;br /&gt;
   * ShowCustomDialog constructor&lt;br /&gt;
   */&lt;br /&gt;
  public ShowMyTitleAreaDialog() {&lt;br /&gt;
    super(null);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Runs the application&lt;br /&gt;
   */&lt;br /&gt;
  public void run() {&lt;br /&gt;
    // Don&amp;quot;t return from open() until window closes&lt;br /&gt;
    setBlockOnOpen(true);&lt;br /&gt;
    // Open the main window&lt;br /&gt;
    open();&lt;br /&gt;
    // Dispose the display&lt;br /&gt;
    Display.getCurrent().dispose();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the main window&amp;quot;s contents&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the main window&lt;br /&gt;
   * @return Control&lt;br /&gt;
   */&lt;br /&gt;
  protected Control createContents(Composite parent) {&lt;br /&gt;
    Composite composite = new Composite(parent, SWT.NONE);&lt;br /&gt;
    composite.setLayout(new GridLayout(1, true));&lt;br /&gt;
    // Create the button&lt;br /&gt;
    Button show = new Button(composite, SWT.NONE);&lt;br /&gt;
    show.setText(&amp;quot;Show&amp;quot;);&lt;br /&gt;
    final Shell shell = parent.getShell();&lt;br /&gt;
    // Display the TitleAreaDialog&lt;br /&gt;
    show.addSelectionListener(new SelectionAdapter() {&lt;br /&gt;
      public void widgetSelected(SelectionEvent event) {&lt;br /&gt;
        // Create and show the dialog&lt;br /&gt;
        MyTitleAreaDialog dlg = new MyTitleAreaDialog(shell);&lt;br /&gt;
        dlg.open();&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
    parent.pack();&lt;br /&gt;
    return composite;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * The application entry point&lt;br /&gt;
   * &lt;br /&gt;
   * @param args the command line arguments&lt;br /&gt;
   */&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    new ShowMyTitleAreaDialog().run();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * This class shows an about box, based on TitleAreaDialog&lt;br /&gt;
 */&lt;br /&gt;
class MyTitleAreaDialog extends TitleAreaDialog {&lt;br /&gt;
  // The image to display&lt;br /&gt;
  private Image image;&lt;br /&gt;
  /**&lt;br /&gt;
   * MyTitleAreaDialog constructor&lt;br /&gt;
   * &lt;br /&gt;
   * @param shell the parent shell&lt;br /&gt;
   */&lt;br /&gt;
  public MyTitleAreaDialog(Shell shell) {&lt;br /&gt;
    super(shell);&lt;br /&gt;
    // Create the image&lt;br /&gt;
    try {&lt;br /&gt;
      image = new Image(null, new FileInputStream(&amp;quot;jexp.gif&amp;quot;));&lt;br /&gt;
    } catch (FileNotFoundException e) {&lt;br /&gt;
      // Ignore&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Closes the dialog box Override so we can dispose the image we created&lt;br /&gt;
   */&lt;br /&gt;
  public boolean close() {&lt;br /&gt;
    if (image != null) image.dispose();&lt;br /&gt;
    return super.close();&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the dialog&amp;quot;s contents&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the parent composite&lt;br /&gt;
   * @return Control&lt;br /&gt;
   */&lt;br /&gt;
  protected Control createContents(Composite parent) {&lt;br /&gt;
    Control contents = super.createContents(parent);&lt;br /&gt;
    // Set the title&lt;br /&gt;
    setTitle(&amp;quot;About This Application&amp;quot;);&lt;br /&gt;
    // Set the message&lt;br /&gt;
    setMessage(&amp;quot;This is a JFace dialog&amp;quot;, IMessageProvider.INFORMATION);&lt;br /&gt;
    // Set the image&lt;br /&gt;
    if (image != null) setTitleImage(image);&lt;br /&gt;
    return contents;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the gray area&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the parent composite&lt;br /&gt;
   * @return Control&lt;br /&gt;
   */&lt;br /&gt;
  protected Control createDialogArea(Composite parent) {&lt;br /&gt;
    Composite composite = (Composite) super.createDialogArea(parent);&lt;br /&gt;
    // Create a table&lt;br /&gt;
    Table table = new Table(composite, SWT.FULL_SELECTION | SWT.BORDER);&lt;br /&gt;
    table.setLayoutData(new GridData(GridData.FILL_BOTH));&lt;br /&gt;
    // Create two columns and show&lt;br /&gt;
    TableColumn one = new TableColumn(table, SWT.LEFT);&lt;br /&gt;
    one.setText(&amp;quot;Real Name&amp;quot;);&lt;br /&gt;
    TableColumn two = new TableColumn(table, SWT.LEFT);&lt;br /&gt;
    two.setText(&amp;quot;Preferred Name&amp;quot;);&lt;br /&gt;
    table.setHeaderVisible(true);&lt;br /&gt;
    // Add some data&lt;br /&gt;
    TableItem item = new TableItem(table, SWT.NONE);&lt;br /&gt;
    item.setText(0, &amp;quot;Robert Harris&amp;quot;);&lt;br /&gt;
    item.setText(1, &amp;quot;Bobby&amp;quot;);&lt;br /&gt;
    item = new TableItem(table, SWT.NONE);&lt;br /&gt;
    item.setText(0, &amp;quot;Robert Warner&amp;quot;);&lt;br /&gt;
    item.setText(1, &amp;quot;Rob&amp;quot;);&lt;br /&gt;
    item = new TableItem(table, SWT.NONE);&lt;br /&gt;
    item.setText(0, &amp;quot;Gabor Liptak&amp;quot;);&lt;br /&gt;
    item.setText(1, &amp;quot;Gabor&amp;quot;);&lt;br /&gt;
    one.pack();&lt;br /&gt;
    two.pack();&lt;br /&gt;
    return composite;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates the buttons for the button bar&lt;br /&gt;
   * &lt;br /&gt;
   * @param parent the parent composite&lt;br /&gt;
   */&lt;br /&gt;
  protected void createButtonsForButtonBar(Composite parent) {&lt;br /&gt;
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>