KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > rcp > exceptionhandler > wizard > UserCommentPage


1 /*
2  * Created on 24.03.2005
3  */

4 package com.nightlabs.rcp.exceptionhandler.wizard;
5
6 import org.eclipse.swt.SWT;
7 import org.eclipse.swt.events.ModifyEvent;
8 import org.eclipse.swt.events.ModifyListener;
9 import org.eclipse.swt.layout.GridData;
10 import org.eclipse.swt.widgets.Composite;
11 import org.eclipse.swt.widgets.Control;
12 import org.eclipse.swt.widgets.Text;
13
14 import com.nightlabs.rcp.composite.TightWrapperComposite;
15 import com.nightlabs.rcp.wizard.DynamicPathWizardPage;
16 import com.nightlabs.rcp.wizard.DynamicPathWizard;
17
18 /**
19  * @author Simon Lehmann - simon@nightlabs.de
20  */

21 public class UserCommentPage extends DynamicPathWizardPage
22 {
23     private Text textUserComment;
24     
25     
26     
27     /**
28      * @param pageName
29      * @param title
30      */

31     public UserCommentPage()
32     {
33         super(UserCommentPage.class.getName(), "Send Message");
34         setDescription("Create a description for the Exception");
35     }
36
37     /**
38      * @see com.nightlabs.rcp.wizard.DynamicPathWizardPage#createPageContents(org.eclipse.swt.widgets.Composite)
39      */

40     public Control createPageContents(Composite parent)
41     
42     {
43         
44         TightWrapperComposite page = new TightWrapperComposite(parent, SWT.NONE, true);
45         textUserComment = new Text(page, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP);
46         textUserComment.setToolTipText("Enter your comment here");
47         textUserComment.addModifyListener(new ModifyListener() {
48             public void modifyText(ModifyEvent e)
49             {
50                 ((DynamicPathWizard)getWizard()).updateDialog();
51                 ExceptionHandlerWizard wizard = (ExceptionHandlerWizard) getWizard();
52                 ErrorReport errorReport = wizard.getErrorReport();
53                 errorReport.setUserComment(textUserComment.getText());
54             }
55         });
56         textUserComment.setLayoutData(new GridData(GridData.FILL_BOTH));
57         return page;
58     }
59     
60     /**
61      * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
62      */

63     public boolean isPageComplete()
64     {
65         return true;
66         //you should be able to continue without entering text
67

68         //if (textUserComment == null)
69
// return false;
70
//return !"".equals(textUserComment.getText());
71
}
72 }
73
Popular Tags