KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Created on 23.03.2005
3  */

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

23 public class ExceptionHandlerEntryPage extends DynamicPathWizardPage
24 {
25     private Composite container;
26
27     private String JavaDoc fill;
28     
29     private Text textErrorMessage;
30
31     private Text textStackTrace;
32     
33     public boolean fflag;
34         
35     
36     public ExceptionHandlerEntryPage()
37     {
38         super(ExceptionHandlerEntryPage.class.getName(), "Exception Handler Wizard");
39         //setDescription("Description");
40

41     }
42
43     /**
44      * @see com.nightlabs.rcp.wizard.DynamicPathWizardPage#createPageContents(org.eclipse.swt.widgets.Composite)
45      */

46     public Control createPageContents(Composite parent)
47     {
48         fflag = false;
49         ExceptionHandlerWizard wizard = (ExceptionHandlerWizard) getWizard();
50         ErrorReport errorReport = wizard.getErrorReport();
51 // setDescription(errorReport.getThrownException().getLocalizedMessage());
52
setDescription(errorReport.getThrownException().getLocalizedMessage() +"\n\n" +
53                 "Hit <Next> to enter comment and send Error Report. Hit <Finish/Cancel> if you don't " +
54                 "want to send Error Report.");
55         TightWrapperComposite epage = new TightWrapperComposite(parent, SWT.NONE, true);
56         epage.setLayoutData(new GridData(GridData.FILL_BOTH));
57         SashForm sform = new SashForm (epage, SWT.VERTICAL);
58         sform.setLayoutData(new GridData(GridData.FILL_BOTH));
59         
60         textErrorMessage = new Text(sform, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY);
61         textErrorMessage.setToolTipText("Error Message");
62         textErrorMessage.setLayoutData(new GridData(GridData.FILL_BOTH));
63         String JavaDoc errorMessage = errorReport.getTriggerException().getLocalizedMessage();
64         if (errorMessage == null)
65             errorReport.getThrownException().getMessage();
66         textErrorMessage.setText(errorMessage == null ? "" : errorMessage);
67         textErrorMessage.addModifyListener(new ModifyListener() {
68             public void modifyText(ModifyEvent e)
69             {
70                 ((DynamicPathWizard)getWizard()).updateDialog();
71             }
72         });
73         
74         
75         textStackTrace = new Text(sform, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
76         textStackTrace.setToolTipText("StackTrace");
77         textStackTrace.setLayoutData(new GridData(GridData.FILL_BOTH));
78         textStackTrace.setText(errorReport.getCurrentTimeAsString()+ "\n" + errorReport.getErrorStackTraceAsString() );
79         textStackTrace.addModifyListener(new ModifyListener() {
80             public void modifyText(ModifyEvent e)
81             {
82                 ((DynamicPathWizard)getWizard()).updateDialog();
83             }
84         });
85         
86         sform.setWeights(new int [] {70,30} );
87         return epage;
88     }
89
90     // /**
91
// * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
92
// */
93
// public boolean isPageComplete()
94
// {
95
// return checkButtonDoNotSend.getSelection();
96
// }
97

98     /**
99      * @see org.eclipse.jface.wizard.WizardPage#getNextPage()
100      */

101     
102     /**
103      *
104      */

105     
106     public void FChangeFlag()
107     {
108         fflag = true;
109     }
110     
111     
112     
113     
114         public IWizardPage getNextPage()
115     {
116         return super.getNextPage();
117     }
118
119 }
120
Popular Tags