Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » CalendarCombo Error Handling
CalendarCombo Error Handling [message #65790] Fri, 17 July 2009 17:34 Go to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
If I edit the date in a CalendarCombo directly and enter an invalid
format, the following exception is thrown:

org.eclipse.nebula.widgets.calendarcombo.CalendarDateParseEx ception: Date
format does not match date string in terms of splitter character numbers
at
org.eclipse.nebula.widgets.calendarcombo.DateHelper.slashPar se(DateHelper.java:540)
at
org.eclipse.nebula.widgets.calendarcombo.DateHelper.parse(Da teHelper.java:158)
at
org.eclipse.nebula.widgets.calendarcombo.CalendarCombo.parse TextDate(CalendarCombo.java:943)
at
org.eclipse.nebula.widgets.calendarcombo.CalendarCombo.acces s$7(CalendarCombo.java:923)
at
org.eclipse.nebula.widgets.calendarcombo.CalendarCombo$2.han dleEvent(CalendarCombo.java:454)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
...

How do I catch this exception so I can provide the user with some useful
feedback? My current workaround is to make the CalendarCombo
SWT.READ_ONLY...
Re: CalendarCombo Error Handling [message #468353 is a reply to message #65790] Wed, 05 August 2009 08:27 Go to previous messageGo to next message
Emil Crumhorn is currently offline Emil CrumhornFriend
Messages: 169
Registered: July 2009
Senior Member
Hi Eric,

I've added code to CVS that will let you listen to exceptions (as they are not exceptions I can throw back to the user in any other way).

To listen to date parse exceptions you can now do:

combo.addDateParseExceptionListener(new IDateParseExceptionListener() {
            public void parseExceptionThrown(CalendarDateParseException dateParseException) {
                System.out.println("Date parse exception was thrown: " + dateParseException.getMessage());
            }		    
});


If there is any listeners the normal stacktrace will not be printed out, if there aren't any, then it will be printed out.

The CalendarDateParseException class now also contains a method where you can get the error type if you so wish, check the javadoc.

New code is in CVS, I will update nightly builds later.

Let me know if you spot any issues with any of that.

Regards,
Emil
Re: CalendarCombo Error Handling [message #595833 is a reply to message #65790] Wed, 05 August 2009 08:27 Go to previous message
Emil Crumhorn is currently offline Emil CrumhornFriend
Messages: 169
Registered: July 2009
Senior Member
Hi Eric,

I've added code to CVS that will let you listen to exceptions (as they are not exceptions I can throw back to the user in any other way).

To listen to date parse exceptions you can now do:


combo.addDateParseExceptionListener(new IDateParseExceptionListener() {
public void parseExceptionThrown(CalendarDateParseException dateParseException) {
System.out.println("Date parse exception was thrown: " + dateParseException.getMessage());
}
});


If there is any listeners the normal stacktrace will not be printed out, if there aren't any, then it will be printed out.

The CalendarDateParseException class now also contains a method where you can get the error type if you so wish, check the javadoc.

New code is in CVS, I will update nightly builds later.

Let me know if you spot any issues with any of that.

Regards,
Emil
Previous Topic:[CDateTime] No Selection Events?
Next Topic:Gannt Chart - Date from and Date to
Goto Forum:
  


Current Time: Fri Mar 29 13:45:45 GMT 2024

Powered by FUDForum. Page generated in 0.01982 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top