Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Patch for CDateTime behaviour
Patch for CDateTime behaviour [message #54764] Sun, 22 June 2008 09:25 Go to next message
Eclipse UserFriend
Originally posted by: jprogrammer.gmail.com

Hi I've been using CDateTime in a project I am doing only needing an
editor for editing time only. I found the behaviour when taking away
focus confusing as you adjust the clock and then click out for focus and
the control would revert. Only by clicking the original drop down would
it stick. So I wrote a patch to change the behaviour. It could be
modified to only do this when a time is present.

I also found that the footer control would not be the value of the
current control on opening, I have patched this as well.

Cameron Crothers



Index: src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java
============================================================ =======
RCS file: /cvsroot/technology/org.eclipse.swt.nebula/
org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/ widgets/
cdatetime/CDateTime.java,v
retrieving revision 1.5
diff -u -r1.5 CDateTime.java
--- src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java 16 Nov
2007 21:44:29 -0000 1.5
+++ src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java 22 Jun
2008 09:07:05 -0000
@@ -416,11 +416,7 @@
protected void contentShellEvents(Event event) {
if(isOpen()) {
if(SWT.Deactivate == event.type) {
- Point p = Display.getCurrent
().getCursorLocation();
- Rectangle r = Display.getCurrent().map
(button.getParent(), null, button.getBounds());
- if(r.contains(p)) {
- cancelDate = null;
- }
+ cancelDate = null;
}
}
super.contentShellEvents(event);
Index: src/org/eclipse/nebula/widgets/cdatetime/Picker_Clock_Analog .java
============================================================ =======
RCS file: /cvsroot/technology/org.eclipse.swt.nebula/
org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/ widgets/
cdatetime/Picker_Clock_Analog.java,v
retrieving revision 1.2
diff -u -r1.2 Picker_Clock_Analog.java
--- src/org/eclipse/nebula/widgets/cdatetime/Picker_Clock_Analog .java
11 Oct 2007 20:37:23 -0000 1.2
+++ src/org/eclipse/nebula/widgets/cdatetime/Picker_Clock_Analog .java
22 Jun 2008 09:07:08 -0000
@@ -615,6 +615,8 @@
}

protected void updateSelection() {
- // TODO Auto-generated method stub
+ if(footerButton != null) {
+ footerButton.setSelection(combo.getSelection());
+ }
}
}
\ No newline at end of file
Re: Patch for CDateTime behaviour [message #54791 is a reply to message #54764] Sun, 22 June 2008 10:58 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi Cameron,

Could you please file a bug and attach the patch there?

Tom

Cameron Crothers schrieb:
> Hi I've been using CDateTime in a project I am doing only needing an
> editor for editing time only. I found the behaviour when taking away
> focus confusing as you adjust the clock and then click out for focus and
> the control would revert. Only by clicking the original drop down would
> it stick. So I wrote a patch to change the behaviour. It could be
> modified to only do this when a time is present.
>
> I also found that the footer control would not be the value of the
> current control on opening, I have patched this as well.
>
> Cameron Crothers
>
>
>
> Index: src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java
> ============================================================ =======
> RCS file: /cvsroot/technology/org.eclipse.swt.nebula/
> org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/ widgets/
> cdatetime/CDateTime.java,v
> retrieving revision 1.5
> diff -u -r1.5 CDateTime.java
> --- src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java 16 Nov
> 2007 21:44:29 -0000 1.5
> +++ src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java 22 Jun
> 2008 09:07:05 -0000
> @@ -416,11 +416,7 @@
> protected void contentShellEvents(Event event) {
> if(isOpen()) {
> if(SWT.Deactivate == event.type) {
> - Point p = Display.getCurrent
> ().getCursorLocation();
> - Rectangle r = Display.getCurrent().map
> (button.getParent(), null, button.getBounds());
> - if(r.contains(p)) {
> - cancelDate = null;
> - }
> + cancelDate = null;
> }
> }
> super.contentShellEvents(event);
> Index: src/org/eclipse/nebula/widgets/cdatetime/Picker_Clock_Analog .java
> ============================================================ =======
> RCS file: /cvsroot/technology/org.eclipse.swt.nebula/
> org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/ widgets/
> cdatetime/Picker_Clock_Analog.java,v
> retrieving revision 1.2
> diff -u -r1.2 Picker_Clock_Analog.java
> --- src/org/eclipse/nebula/widgets/cdatetime/Picker_Clock_Analog .java
> 11 Oct 2007 20:37:23 -0000 1.2
> +++ src/org/eclipse/nebula/widgets/cdatetime/Picker_Clock_Analog .java
> 22 Jun 2008 09:07:08 -0000
> @@ -615,6 +615,8 @@
> }
>
> protected void updateSelection() {
> - // TODO Auto-generated method stub
> + if(footerButton != null) {
> + footerButton.setSelection(combo.getSelection());
> + }
> }
> }
> \ No newline at end of file


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Patch for CDateTime behaviour [message #590579 is a reply to message #54764] Sun, 22 June 2008 10:58 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi Cameron,

Could you please file a bug and attach the patch there?

Tom

Cameron Crothers schrieb:
> Hi I've been using CDateTime in a project I am doing only needing an
> editor for editing time only. I found the behaviour when taking away
> focus confusing as you adjust the clock and then click out for focus and
> the control would revert. Only by clicking the original drop down would
> it stick. So I wrote a patch to change the behaviour. It could be
> modified to only do this when a time is present.
>
> I also found that the footer control would not be the value of the
> current control on opening, I have patched this as well.
>
> Cameron Crothers
>
>
>
> Index: src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java
> ============================================================ =======
> RCS file: /cvsroot/technology/org.eclipse.swt.nebula/
> org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/ widgets/
> cdatetime/CDateTime.java,v
> retrieving revision 1.5
> diff -u -r1.5 CDateTime.java
> --- src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java 16 Nov
> 2007 21:44:29 -0000 1.5
> +++ src/org/eclipse/nebula/widgets/cdatetime/CDateTime.java 22 Jun
> 2008 09:07:05 -0000
> @@ -416,11 +416,7 @@
> protected void contentShellEvents(Event event) {
> if(isOpen()) {
> if(SWT.Deactivate == event.type) {
> - Point p = Display.getCurrent
> ().getCursorLocation();
> - Rectangle r = Display.getCurrent().map
> (button.getParent(), null, button.getBounds());
> - if(r.contains(p)) {
> - cancelDate = null;
> - }
> + cancelDate = null;
> }
> }
> super.contentShellEvents(event);
> Index: src/org/eclipse/nebula/widgets/cdatetime/Picker_Clock_Analog .java
> ============================================================ =======
> RCS file: /cvsroot/technology/org.eclipse.swt.nebula/
> org.eclipse.nebula.widgets.cdatetime/src/org/eclipse/nebula/ widgets/
> cdatetime/Picker_Clock_Analog.java,v
> retrieving revision 1.2
> diff -u -r1.2 Picker_Clock_Analog.java
> --- src/org/eclipse/nebula/widgets/cdatetime/Picker_Clock_Analog .java
> 11 Oct 2007 20:37:23 -0000 1.2
> +++ src/org/eclipse/nebula/widgets/cdatetime/Picker_Clock_Analog .java
> 22 Jun 2008 09:07:08 -0000
> @@ -615,6 +615,8 @@
> }
>
> protected void updateSelection() {
> - // TODO Auto-generated method stub
> + if(footerButton != null) {
> + footerButton.setSelection(combo.getSelection());
> + }
> }
> }
> \ No newline at end of file


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Previous Topic:Patch for CDateTime behaviour
Next Topic:Memory leak during GalleryTreeViewer.refresh() method?
Goto Forum:
  


Current Time: Sun Jun 30 09:45:35 GMT 2024

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

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

Back to the top