Bug 553694 - ISharedImages don't work with some plugin.xml extension points
Summary: ISharedImages don't work with some plugin.xml extension points
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.13   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.14   Edit
Assignee: Alexander Fedorov CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2019-12-03 07:15 EST by Alexander Levsha CLA
Modified: 2020-05-23 07:36 EDT (History)
2 users (show)

See Also:


Attachments
view icon not showing (18.50 KB, image/png)
2019-12-10 02:14 EST, Alexander Levsha CLA
no flags Details
wizard icon not showing (51.25 KB, image/png)
2019-12-10 02:14 EST, Alexander Levsha CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Levsha CLA 2019-12-03 07:15:37 EST
org.eclipse.ui.newWizards
org.eclipse.ui.views

These extension points do not recognize ISharedImages constants given as icon filenames.
Documentation of these EPs doesn't say anything about ISharedImages support but it used to work in Eclipse release 2018-09 and earlier so i think a report is warranted.
Comment 1 Andrey Loskutov CLA 2019-12-06 11:42:16 EST
Alexander, can you please attach a simple project with the code showing the regression?
Comment 2 Alexander Fedorov CLA 2019-12-06 11:58:17 EST
@Alexander, I do not think it is good idea for the modern Eclipse 4.x evvironment to use ISharedImages constant in the image URL, please consider using platform URL for the image from another bundle.
Comment 3 Andrey Loskutov CLA 2019-12-06 12:04:16 EST
(In reply to Alexander Fedorov from comment #2)
> @Alexander, I do not think it is good idea for the modern Eclipse 4.x
> evvironment to use ISharedImages constant in the image URL, please consider
> using platform URL for the image from another bundle.

Why this? ISharedImages javadoc is saying: "A registry for common images used by the workbench which may be useful to other plug-ins", and it still makes sense for me.
Comment 4 Alexander Fedorov CLA 2019-12-06 13:40:28 EST
(In reply to Andrey Loskutov from comment #3)
> 
> Why this? ISharedImages javadoc is saying: "A registry for common images
> used by the workbench which may be useful to other plug-ins", and it still
> makes sense for me.

Mostly because ISharedImages itself is not really good idea. It is a set of global Image variables that can have "states", and nobody can guarantee its right "state" at the moment: it may be not yet added, or already disposed, or removed for some reason. Can it be worse?
Yes, if we use plugin.xml to mention a value of a constant declared somewhere without possibility to validate anything at compile time.
And we have two ISharedImages in the platform (UI and Team) and extra one in JDT.
Which one of them is more "shared"?
Comment 5 Alexander Levsha CLA 2019-12-10 02:12:16 EST
I'm not sure that binding to concrete paths/bundles that may change in platform URL is better than using API-fied id constants, that are documented both in the interface and extension points and aren't deprecated.

As to the repro example, this is the example with extension points that broke.

<plugin>
    <extension point="org.eclipse.ui.views">
        <view
            id="ru.taximaxim.codekeeper.ui.depcyview"
            name="%view.name.DepcyView"
            class="ru.taximaxim.codekeeper.ui.views.DepcyGraphView"
            icon="IMG_OBJ_ADD" />
    <!-- this icon isn't shown in the view's tab but still shows in the Show View dialog -->
    </extension>
    <extension point="org.eclipse.ui.newWizards">
        <wizard
              canFinishEarly="true"
              category="ru.taximaxim.codekeeper.ui.pgcodekeepercategory"
              class="ru.taximaxim.codekeeper.ui.pgdbproject.NewSQLEditorWizard"
              hasPages="false"
              icon="IMG_OBJ_FILE"
        <!-- this icon isn't shown in the new wizards list -->
              id="ru.taximaxim.codekeeper.ui.newsqleditorwizard"
              name="%wizard.name.newSQLEditorWizard"
              project="false">
            <selection class="org.eclipse.core.resources.IFile" />
        </wizard>
    </extension>
</plugin>

This still works, just for reference.
<plugin>
    <extension point="org.eclipse.ui.menus">
        <menuContribution locationURI="menu:org.eclipse.ui.main.menu">
            <menu
                id="ru.taximaxim.codekeeper.ui.mainmenu.pgcodekeeper"
                label="%menu.label.pgcodekeeper.main">
                <command
                    commandId="ru.taximaxim.codekeeper.ui.command.OpenSQLEditor"
                    icon="IMG_OBJ_FILE"
                    label="%command.commandname.OpenSQLEditor"
                    style="push">
                </command>
            </menu>
        </menuContribution>
    </extension>
</plugin>
Comment 6 Alexander Levsha CLA 2019-12-10 02:14:01 EST
Created attachment 281179 [details]
view icon not showing
Comment 7 Alexander Levsha CLA 2019-12-10 02:14:52 EST
Created attachment 281180 [details]
wizard icon not showing
Comment 8 Alexander Fedorov CLA 2019-12-13 02:39:54 EST
(In reply to Alexander Levsha from comment #5)
> I'm not sure that binding to concrete paths/bundles that may change in
> platform URL is better than using API-fied id constants, that are documented
> both in the interface and extension points and aren't deprecated.
> 

Having both URL and constant value in the same attribute looks questionable - but this is what we have already have in API for years.

You are right, both approaches are quite far from ideal. What I suggest have only one advantage - PDE tools can help with a compile time check for the given target platform. At runtime both approaches will fail.
May be we can introduce some standard platform way to declare "resources" that can be referenced with identifier, like Android ecosystem.

In any case, thanks a lot for report!

BTW, the package name from your example looks impressive.
Comment 9 Eclipse Genie CLA 2019-12-13 05:35:27 EST
New Gerrit change created: https://git.eclipse.org/r/154460
Comment 11 Alexander Fedorov CLA 2020-05-23 07:36:33 EDT
Done for 2019-12  please reopen if it still actual