Bug 567895 - Different handling of visibleWhen in package- and project-explorer
Summary: Different handling of visibleWhen in package- and project-explorer
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.17   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 427897
  Show dependency tree
 
Reported: 2020-10-15 02:55 EDT by kurt ablinger CLA
Modified: 2020-11-01 09:51 EST (History)
1 user (show)

See Also:


Attachments
update of plugin.xml (4.04 KB, text/plain)
2020-10-20 05:43 EDT, kurt ablinger CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description kurt ablinger CLA 2020-10-15 02:55:13 EDT
Hello,

for contributions to the context-menu the visibleWhen-filter in project-explorer behaves different than in package-explorer:

Items for JavaProjects filtered by '<adapt type="org.eclipse.jdt.core.IJavaProject" />' are shown in pacakge-explorer but not in project-explorer.

Here's a simple menu which you can use to see the different handling on simple- and java-projects in package-/project-explorer:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

  <extension point="org.eclipse.ui.commands" >
    <category name="MISSING MENU"
      id="missing.menu.category" >
    </category>

    <command id="missing.menu.MissingMenuCommand"
      categoryId="com.bsbanksysteme.utils.category"
      name="missing.menu.category"
      description="Test Missing Menu/Items"
      defaultHandler="missing.menu.MissingMenuCommand" >
    </command>
  </extension>

  <extension point="org.eclipse.ui.menus">
    <menuContribution locationURI="popup:org.eclipse.ui.popup.any?before=additions">
      <menu label="MISSING IJavaProject TEST">

        <command label="menuitem always visible" commandId="missing.menu.MissingMenuCommand">
        </command>

        <command label="visibleWhen instanceof IProject" commandId="missing.menu.MissingMenuCommand">
          <visibleWhen checkEnabled="false">
            <iterate ifEmpty="false">
              <instanceof value="org.eclipse.core.resources.IProject" />
            </iterate>
          </visibleWhen>
        </command>

        <command label="visibleWhen adapt IProject" commandId="missing.menu.MissingMenuCommand">
          <visibleWhen checkEnabled="false">
            <iterate ifEmpty="false">
              <adapt type="org.eclipse.core.resources.IProject" />
            </iterate>
          </visibleWhen>
        </command>

        <command label="visibleWhen instanceof IJavaProject" commandId="missing.menu.MissingMenuCommand">
          <visibleWhen checkEnabled="false">
            <iterate ifEmpty="false">
              <instanceof value="org.eclipse.jdt.core.IJavaProject" />
            </iterate>
          </visibleWhen>
        </command>

        <command label="visibleWhen adapt IJavaProject" commandId="missing.menu.MissingMenuCommand">
          <visibleWhen checkEnabled="false">
            <iterate ifEmpty="false">
              <adapt type="org.eclipse.jdt.core.IJavaProject" />
            </iterate>
          </visibleWhen>
        </command>

        <command label="visibleWhen javanature" commandId="missing.menu.MissingMenuCommand">
          <visibleWhen checkEnabled="false">
            <iterate ifEmpty="false">
              <test property="org.eclipse.core.resources.projectNature"
                value="org.eclipse.jdt.core.javanature" />
            </iterate>
          </visibleWhen>
        </command>

      </menu>
    </menuContribution>
  </extension>
</plugin>
Comment 1 kurt ablinger CLA 2020-10-20 05:43:31 EDT
Created attachment 284516 [details]
update of plugin.xml

Trying to find a filter-expression which works in package- and project-explorer the same, I fell about another possible bug.

I try to define an expression which I can use in the visibleWhen-expression of a menu-command.
The expressions is.a.java.project-1 and is.a.java.project-2 (in attached plugin.xml) differ only in the order of
the statements in the OR-tag.

I expected them bring the same result in both explorer views - they don't.
Number 1 does not show up on a java-project in package-explorer - but does in project-explorer on the same java-project.