Bug 434665 - Add eclipse512.png (was: Target workspace icon is blurry for JUnit Plug-in Test launches)
Summary: Add eclipse512.png (was: Target workspace icon is blurry for JUnit Plug-in Te...
Status: CLOSED WONTFIX
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on: 435222
Blocks:
  Show dependency tree
 
Reported: 2014-05-12 12:27 EDT by Michael Rennie CLA
Modified: 2019-09-01 14:07 EDT (History)
5 users (show)

See Also:


Attachments
screen shot (45.83 KB, image/png)
2014-05-12 12:27 EDT, Michael Rennie CLA
no flags Details
Hack from comment 7 (4.10 KB, patch)
2014-05-19 12:31 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2014-05-12 12:27:44 EDT
Created attachment 242982 [details]
screen shot

Version: Luna (4.4)
Build id: I20140511-2000

See the attached screen shot - the dock icon for a target workspace is blurry.
Comment 1 Curtis Windatt CLA 2014-05-14 15:29:58 EDT
The application launches appear to be the same.  However, it may be related to some mac specific code in the EclipseApplciationLaunchConfiguration

if (!programArgs.contains("-nosplash") && showSplash) { //$NON-NLS-1$
			if (TargetPlatformHelper.getTargetVersion() >= 3.1) {
				programArgs.add(0, "-launcher"); //$NON-NLS-1$

				IPath path = null;
				if (TargetPlatform.getOS().equals("macosx")) { //$NON-NLS-1$
					path = new Path(TargetPlatform.getLocation()).append("Eclipse.app/Contents/MacOS/eclipse"); //$NON-NLS-1$
				} else {
					path = new Path(TargetPlatform.getLocation()).append("eclipse"); //$NON-NLS-1$
					if (TargetPlatform.getOS().equals("win32")) { //$NON-NLS-1$
						path = path.addFileExtension("exe"); //$NON-NLS-1$
					}
				}
Comment 2 Markus Keller CLA 2014-05-15 11:31:33 EDT
Works for me in 4.4.0.I20140513-2000. Both the host and the runtime Eclipse have the same sharp icon in the Dock and in Command+Tab.

Maybe your workspace contains some outdated projects that missed the latest icon updates?
Comment 3 Curtis Windatt CLA 2014-05-15 11:35:11 EDT
(In reply to Markus Keller from comment #2)
> Works for me in 4.4.0.I20140513-2000. Both the host and the runtime Eclipse
> have the same sharp icon in the Dock and in Command+Tab.
> 
> Maybe your workspace contains some outdated projects that missed the latest
> icon updates?

Can you test a JUnit Plug-in Test launch?  I never updated the bug, but when I checked the issue on Mike's machine it only occurred for JUnit launches.
Comment 4 Markus Keller CLA 2014-05-15 12:35:54 EDT
> Can you test a JUnit Plug-in Test launch?

Yup, reproduced with a PDE JUnit launch. And adding these command-line arguments also didn't help:

-Xdock:icon=/Volumes/Eclipse/4.4-I-builds-x86_64/Eclipse.app/Contents/MacOS/../Resources/Eclipse.icns
-launcher
/Volumes/Eclipse/4.4-I-builds-x86_64/Eclipse.app/Contents/MacOS/eclipse


I guess the problem is that the org.eclipse.pde.junit.runtime.uitestapplication doesn't use the -launcher.

In this situation, the fallback uses the windowImages specified in /org.eclipse.sdk/plugin.xml, but these end at eclipse48.png now (bug 432741). Adding e.g. eclipse512.png there fixes the problem.

(The icons are eventually set via Decorations#setImages(..)).
Comment 5 David Williams CLA 2014-05-16 10:14:17 EDT
(In reply to Markus Keller from comment #4)
> > Can you test a JUnit Plug-in Test launch?
> 
> Yup, reproduced with a PDE JUnit launch. And adding these command-line
> arguments also didn't help:
> 
> -Xdock:icon=/Volumes/Eclipse/4.4-I-builds-x86_64/Eclipse.app/Contents/MacOS/.
> ./Resources/Eclipse.icns
> -launcher
> /Volumes/Eclipse/4.4-I-builds-x86_64/Eclipse.app/Contents/MacOS/eclipse
> 
> 
> I guess the problem is that the
> org.eclipse.pde.junit.runtime.uitestapplication doesn't use the -launcher.
> 
> In this situation, the fallback uses the windowImages specified in
> /org.eclipse.sdk/plugin.xml, but these end at eclipse48.png now (bug
> 432741). Adding e.g. eclipse512.png there fixes the problem.
> 
> (The icons are eventually set via Decorations#setImages(..)).

Is there no way for the Eclipse code to use the icns file? It would be better, if it did, not only for this specific case, but because it contains the "double resolution" images for retina displays too ... so long term, ... that would be a superior solution for Mac users.
Comment 6 David Williams CLA 2014-05-16 10:23:44 EDT
(In reply to David Williams from comment #5)

> > 
> > I guess the problem is that the
> > org.eclipse.pde.junit.runtime.uitestapplication doesn't use the -launcher.
> > 
> > In this situation, the fallback uses the windowImages specified in
> > /org.eclipse.sdk/plugin.xml, but these end at eclipse48.png now (bug
> > 432741). Adding e.g. eclipse512.png there fixes the problem.
> > 
> > (The icons are eventually set via Decorations#setImages(..)).
> 
> Is there no way for the Eclipse code to use the icns file? It would be
> better, if it did, not only for this specific case, but because it contains
> the "double resolution" images for retina displays too ... so long term, ...
> that would be a superior solution for Mac users.

I should also mention, if this is a case you know exactly what image/png file you want ... it is still there, in the eclipse sdk plugin, if there was a way to refer to it specifically ... I hesitate to fix by adding to "windowImages" since 

a) that would lose the fix for bug 432741. 
b) I'm still not sure it would work for "EPP packages" since they only specify 3 images, not the 512 one, in their list of "windowImages".
Comment 7 Markus Keller CLA 2014-05-16 12:53:20 EDT
OK, I think I understand the problem: It's not about the launcher executable / Info.plist at all. That one only matters if you launch the Eclipse.app.

It's all about having this in the *VM* args (comment 4 had it as program args):

-Xdock:icon=/<full-path-to>/Eclipse.app/Contents/Resources/Eclipse.icns


New "Eclipse Application" and "JUnit Plug-in Test" launch configurations automagically get the VM arg -Xdock:icon=../Resources/Eclipse.icns

For "Eclipse Application", the relative path works because the default working directory is /<full-path-to>/Eclipse.app/Contents/MacOS.

But for "JUnit Plug-in Test", the default working directory is ${workspace_loc:<project-name>}, which breaks the relative path above. It works if the VM arg is
-Xdock:icon=${eclipse_home}Eclipse.app/Contents/Resources/Eclipse.icns


Now, the trouble is that the default -Xdock:icon=../Resources/Eclipse.icns seems to come from the sdk.product file, so it's not something PDE UI should overwrite. The relative path can only work if the working dir is the default, but PDE JUnit launch configs traditionally have the test project as default $PWD. Also not something that should be changed.

Maybe this could be fixed with an ugly hack somewhere around org.eclipse.pde.launching.JUnitLaunchConfigurationDelegate#collectExecutionArguments(..) that replaces '-Xdock:icon=..' with the "Eclipse Application"'s default working directory.
Comment 8 David Williams CLA 2014-05-18 20:54:42 EDT
(In reply to Markus Keller from comment #7)
> OK, I think I understand the problem: It's not about the launcher executable
> / Info.plist at all. That one only matters if you launch the Eclipse.app.
> 
> It's all about having this in the *VM* args (comment 4 had it as program
> args):
> 
> -Xdock:icon=/<full-path-to>/Eclipse.app/Contents/Resources/Eclipse.icns
> 
> 
> New "Eclipse Application" and "JUnit Plug-in Test" launch configurations
> automagically get the VM arg -Xdock:icon=../Resources/Eclipse.icns
> 
> For "Eclipse Application", the relative path works because the default
> working directory is /<full-path-to>/Eclipse.app/Contents/MacOS.
> 
> But for "JUnit Plug-in Test", the default working directory is
> ${workspace_loc:<project-name>}, which breaks the relative path above. It
> works if the VM arg is
> -Xdock:icon=${eclipse_home}Eclipse.app/Contents/Resources/Eclipse.icns
> 
> 
> Now, the trouble is that the default -Xdock:icon=../Resources/Eclipse.icns
> seems to come from the sdk.product file, so it's not something PDE UI should
> overwrite. The relative path can only work if the working dir is the
> default, but PDE JUnit launch configs traditionally have the test project as
> default $PWD. Also not something that should be changed.
> 
> Maybe this could be fixed with an ugly hack somewhere around
> org.eclipse.pde.launching.
> JUnitLaunchConfigurationDelegate#collectExecutionArguments(..) that replaces
> '-Xdock:icon=..' with the "Eclipse Application"'s default working directory.

Would a slightly less ugly hack be for the launcher to copy the Eclipse.icns file to ${workspace_loc:<project-name>} (or whatever "working location" is)? 

I will admit, though, I would have thought there'd be an API to "getImageResourceFromExecutable" ... for example, if someone is using Luna to develop a "Kepler App" (with Kepler product in runtime target) it seems better to display the "Kepler Icon" for this scenario? 

[Apologies in advance if my comments are over simplistic, since I know nothing about this area :/ ]
Comment 9 Dani Megert CLA 2014-05-19 04:00:32 EDT
(In reply to David Williams from comment #8)
> Would a slightly less ugly hack be for the launcher to copy the Eclipse.icns
> file to ${workspace_loc:<project-name>} (or whatever "working location" is)? 

That would be ugly because you then get outgoing changes on the test projects.

Moving back to PDE to consider comment 7.
Comment 10 Markus Keller CLA 2014-05-19 12:21:52 EDT
(In reply to David Williams from comment #8)
> I will admit, though, I would have thought there'd be an API to
> "getImageResourceFromExecutable" ... for example, if someone is using Luna
> to develop a "Kepler App" (with Kepler product in runtime target) it seems
> better to display the "Kepler Icon" for this scenario? 

There is already such an API -- sort of... It's the combination of the working directory and the -Xdock:icon argument. If they are set correctly, then everything is fine.

But for PDE launch configs, there's usually no "correct" combination, since they don't launch an OS app, but they launch a Java VM. We can compensate for that by tweaking the -Xdock:icon argument. As you've correctly said, such a compensation will fall short if the target is not the same product as the host (the usual case outside of Eclipse platform development).

Or we make the fallback good enough (windowImages, which is actually the primary mechanism on Windows and GTK).
Comment 11 Markus Keller CLA 2014-05-19 12:31:55 EDT
Created attachment 243260 [details]
Hack from comment 7

Here's the hack from comment 7 that checks if the -Xdock:icon argument resolves to an icon file. If there's no file there, then it tries to use the working directory of the host workbench as the basis for the -Xdock:icon argument. 

However, I don't think this is the right solution, because it will only look correct for Eclipse platform developers.

I would not release this, but make the windowImages list in the product complete again and then have the SWT implementation of Decorations#setImages(..) fix the problems you were seeing with "emblems" on Linux.
Comment 12 David Williams CLA 2014-05-19 13:47:51 EDT
(In reply to Markus Keller from comment #11)
> Created attachment 243260 [details]
> Hack from comment 7
> 
> Here's the hack from comment 7 that checks if the -Xdock:icon argument
> resolves to an icon file. If there's no file there, then it tries to use the
> working directory of the host workbench as the basis for the -Xdock:icon
> argument. 
> 
> However, I don't think this is the right solution, because it will only look
> correct for Eclipse platform developers.
> 
> I would not release this, but make the windowImages list in the product
> complete again and then have the SWT implementation of
> Decorations#setImages(..) fix the problems you were seeing with "emblems" on
> Linux.

I opened bug 435222 but would like to hear what they have to say before making any decision. I assume you realize that us adding back the higher res image won't help EPP packages (by far the greatest downloads at Eclipse) ... and even if we convinced them to add 4 images to their list to get a sharper image for this use-case, then all Linux users would lose the "emblem", so would be a bad regression for them. So, as I say in bug 435222 ... we may have a tough choice ... blurry image, or regression for all Linux users (who use EPP packages).
Comment 13 David Williams CLA 2014-05-20 12:21:31 EDT
If you have time/ability, can someone try this scenerio starting with binary Eclipse platform? (and "build it up" from repo to contain jdt and pde). 

I ask because I just noticed in the Mac's "SDK product definition" it had an empty "windowImages list" (literally <windowImages/>) in addition to the later having <macosx icon="icons/Eclipse.icns"/>, etc. 

It probably makes no difference what's so ever ... but ... doesn't seem right to have an empty <windowsImages/> element ... or else both should. 

I was just wondering if it made any observable difference in behavior, or just "ignored junk" in the product definition file. 

http://git.eclipse.org/c/platform/eclipse.platform.releng.aggregator.git/tree/eclipse.platform.releng.tychoeclipsebuilder/sdk/sdk.product#n15
Comment 14 Eclipse Genie CLA 2019-09-01 14:07:52 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.