Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 358204

Summary: [Compatibility] Huge toolbar buttons with EcoreDiagramEditor
Product: [Eclipse Project] Platform Reporter: Nicolas Bros <nicolas.bros>
Component: UIAssignee: Remy Suen <remy.suen>
Status: VERIFIED FIXED QA Contact: Remy Suen <remy.suen>
Severity: normal    
Priority: P3 CC: pwebster, remy.suen
Version: 4.2   
Target Milestone: 4.2 M3   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 331377    
Attachments:
Description Flags
screenshot
none
screenshot 3.7.1
none
ToolBar rendering patch v1 none

Description Nicolas Bros CLA 2011-09-20 04:55:41 EDT
Created attachment 203657 [details]
screenshot

When I open the Ecore Tools diagram editor (org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor), I see huge buttons in the toolbar : see attached screenshot.
Comment 1 Nicolas Bros CLA 2011-09-20 04:57:17 EDT
Version :
Eclipse SDK
Version: 4.1.0
Build id: I20110805-1200
Comment 2 Nicolas Bros CLA 2011-09-20 05:04:27 EDT
Created attachment 203658 [details]
screenshot 3.7.1

For comparison, here is how it looks with Eclipse 3.7.1:
Eclipse SDK
Version: 3.7.1
Build id: M20110909-1335
Comment 3 Remy Suen CLA 2011-09-20 10:17:42 EDT
I appear to get this problem even if I just open a the example 'logic' file editor from the GEF examples.
Comment 4 Eric Moffatt CLA 2011-09-20 10:30:17 EDT
One rough guess might be that there contributions contain non-null text...perhaps we should 'trim' the text and set 'null' if it's empty...
Comment 5 Remy Suen CLA 2011-09-20 13:24:03 EDT
As we're unable to extract the image from the ActionContributionItem, we end up using its text which causes all the other tool items of that tool bar to have the same width as the one with text on it.

Turning such items into opaque model items would resolve this problem. What do you think, Paul?
Comment 6 Remy Suen CLA 2011-09-20 13:34:06 EDT
(In reply to comment #5)
> As we're unable to extract the image from the ActionContributionItem

This is because they're a FileImageDescriptor instead of a URLImageDescriptor.
Comment 7 Remy Suen CLA 2011-09-20 13:50:02 EDT
Created attachment 203703 [details]
ToolBar rendering patch v1

Here is an illustrative patch to point out where the problematic code is.
Comment 8 Paul Webster CLA 2011-09-23 15:31:16 EDT
(In reply to comment #5)
> 
> Turning such items into opaque model items would resolve this problem. What do
> you think, Paul?

Is it not possible to turn a FileImageDescriptor into a URLImageDescriptor?  file://... ?

If we leave them Opaque, they'll work but we won't honour any command related code like an actionDefinitionId or keybinding.

PW
Comment 9 Remy Suen CLA 2011-09-23 16:19:02 EDT
(In reply to comment #8)
> Is it not possible to turn a FileImageDescriptor into a URLImageDescriptor? 
> file://... ?

That wouldn't work because the FID is actually for loading resources within the bundle (using getResourceAsStream(String)). We would have to translate the class into its source bundle and then perform some string manipulation.

I gave up the last time I tried to do this but I don't remember if that was out of frustration of if it was because of a technical reason.
Comment 10 Remy Suen CLA 2011-09-26 09:19:56 EDT
Pushed more reflection code to R4_development. Marking as RESOLVED/FIXED.
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R4_development&id=8475ac8232733c18afbbc987a161dea9d58b0f8e
Comment 11 Remy Suen CLA 2011-10-26 09:23:27 EDT
Verified with I20111025-2000 on Windows XP.

Thanks for testing Eclipse 4, Nicolas!