Patch for CDateTime behaviour [message #54764] |
Sun, 22 June 2008 09:25 |
Eclipse User |
|
|
|
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 |
Thomas Schindl 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 |
Thomas Schindl 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
------------------------------------------------------------ --------
|
|
|
Powered by
FUDForum. Page generated in 0.02858 seconds