Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 301705 - [snippets] improvements for JFace snippet 061
Summary: [snippets] improvements for JFace snippet 061
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Thomas Schindl CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 506942
  Show dependency tree
 
Reported: 2010-02-03 10:37 EST by Tom Hofmann CLA
Modified: 2020-06-02 04:57 EDT (History)
4 users (show)

See Also:


Attachments
Snippet061FakedNativeCellEditor.java.diff (23.78 KB, patch)
2010-02-03 10:37 EST, Tom Hofmann CLA
no flags Details | Diff
Updated Patch (22.35 KB, patch)
2010-04-19 08:31 EDT, Thomas Schindl CLA
no flags Details | Diff
A screenshot showing wrong checkbox images. (68.51 KB, image/jpeg)
2010-04-19 11:58 EDT, Vincent CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hofmann CLA 2010-02-03 10:37:05 EST
Created attachment 158062 [details]
Snippet061FakedNativeCellEditor.java.diff

I have a couple of improvements to the checkbox images rendering code of snippet 061.

The attached patch provides the following:

- class CheckboxImages 
  - independent of singletons (JFaceResources...)
  - uses Control::print to capture the shots 
    (only tested on the win32 platform, however)
  - provides images for the disabled and grayed states

- class SelectableCheckboxCellEditor
  - used instead of BooleanCellEditor
  - provides cell navigation also while editing
  - does not support a tri-state model which would leverage the 
    grayed state

- a couple of additions to the navigation and direct-editing code of 
  the example tree viewer

Things to be done:

- check whether the Control::print code works on all (or at least most) platforms, perhaps provide a fallback to the capture version used before (which will flash a shell quickly).
Comment 1 Boris Bokowski CLA 2010-02-04 14:57:25 EST
Tom, are you still a committer? If not, we'll have to go through the IP process with this.
Comment 2 Tom Hofmann CLA 2010-02-04 15:41:57 EST
Yes (albeit not on the Platform-UI project, only platform-text and jdt-text).
Comment 3 Boris Bokowski CLA 2010-02-04 16:40:51 EST
Great - as long as you are a committer on the same top-level project (Eclipse project) we're fine. Tom (Schindl), can you have a quick look over the snippet to make sure the changes make sense?
Comment 4 Boris Bokowski CLA 2010-02-22 22:29:05 EST
Tom?
Comment 5 Thomas Schindl CLA 2010-03-16 04:54:44 EDT
I'll take the bug and commit it to CVS today
Comment 6 Vincent CLA 2010-04-14 21:35:29 EDT
Hi Tom, would you mind sharing the whole class here? As I tried to merge code from your attachment but what I can see is just a black square instead of nicely looking checkbox in windows platform. Thanks.
Comment 7 Tom Hofmann CLA 2010-04-15 03:08:05 EDT
(In reply to comment #6)
> Hi Tom, would you mind sharing the whole class here? 

Please see http://tkilla.ch/eclipse/

> As I tried to merge code
> from your attachment but what I can see is just a black square instead of
> nicely looking checkbox in windows platform. Thanks.

No idea here...
Comment 8 Vincent CLA 2010-04-19 08:17:29 EDT
Hi Tom, thanks for the sharing. But still, I can't get a proper checkbox image in both windows and linux platform. Would you mind sharing the Snippet061FakedNativeCellEditor.java you have committed? Thanks in advanced.
Comment 9 Thomas Schindl CLA 2010-04-19 08:31:21 EDT
Created attachment 165265 [details]
Updated Patch

But it's not working on OS-X-cocoa 3.5.x where the system goes into an endless event-loop spinning while clicking a Cell-Editor (need to to investigate why)
Comment 10 Vincent CLA 2010-04-19 10:33:58 EDT
Is the above changes just workable on Mac OS? If not, would you mind sharing the Snippet061FakedNativeCellEditor.java with me so that I can help to test on other platforms like windows and linux? Thanks.

By the way, I'm working on an eclipse rcp application which need a native checkbox image. The current approach to generate checkbox images need to open up another shell which is abit weird. Tom's approach is better to print directly on GC.
Comment 11 Thomas Schindl CLA 2010-04-19 10:36:33 EDT
Check out the sources and apply the patch from above. The problem on OS-X is not the print call but something different (not sure though yet what's the problem)
Comment 12 Vincent CLA 2010-04-19 11:58:56 EDT
Created attachment 165308 [details]
A screenshot showing wrong checkbox images.

I have tried on WinXP, here's the screenshot. The checkboxes are all black. And when I click on any cell which is editable, exception will be thrown. 

java.lang.NullPointerException
	at org.eclipse.jface.viewers.ColumnViewerEditor.activateCellEditor(ColumnViewerEditor.java:207)
	at org.eclipse.jface.viewers.ColumnViewerEditor.handleEditorActivationEvent(ColumnViewerEditor.java:443)
	at org.eclipse.jface.viewers.ColumnViewer.triggerEditorActivationEvent(ColumnViewer.java:680)
	at org.eclipse.jface.viewers.ColumnViewer.handleMouseDown(ColumnViewer.java:664)
	at org.eclipse.jface.viewers.ColumnViewer.access$0(ColumnViewer.java:660)
	at org.eclipse.jface.viewers.ColumnViewer$1.mouseDown(ColumnViewer.java:89)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:179)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
	at org.eclipse.jface.snippets.viewers.Snippet061FakedNativeCellEditor.main(Snippet061FakedNativeCellEditor.java:678)
Comment 13 Vincent CLA 2010-04-19 12:01:12 EDT
Hi Tom Schindl, is the checkbox image correct on Mac OS? If yes, do you have any idea about it?
Comment 14 Lars Vogel CLA 2020-06-02 04:57:24 EDT
Please reopen if you plan to provide a Gerrit to improve the snippet