Skip to content

When should a Context Menu Button be greyed out and when should it be hidden?

FlorianDecker edited this page Nov 8, 2017 · 1 revision

The addition of solution level .licenseheader files sparked a discussion when a button should be hidden and when it should be greyed out. The following defined behaviour should hopefully be logically sound:

  1. Context menu for a file which is not defined in the "Languages" option

    • Should hide the "Add/Remove LicenseHeader" Buttons
    • Because the current state of the object it is not possible to Add/Remove LicenseHeader. Also it would not make sense to show the "License Headers" option on pictures or files where a license header does not make sense and clutter the context menu.
  2. Context menu for a file which is defined in the "Langues" option but no .licenseheader file exists for the file

    • Should show the "Add/Remove LicenseHeader" buttons
    • Removing a LicenseHeader is possible without a .licenseheader file, so the button should work. While adding a LicenseHeader does not work without a .licenseheader file, it is a nice start point for new user to explain that a .licenseheader file is needed and to add it.
  3. Context menu for solution when no Solution wide .licenseheader file exists

    • Should grey out the "Remove Solution License Header Definition File"
    • Should show the "Add Solution License Header Definition File"
    • The button should be greyed out and not removed because the option is not possible because of the state of clicked item, but because the solution wide .licenseheader file is missing.
  4. Context menu for Solution when the solution wide .licenseheader file already exists

    • Should show the "Remove Solution License Header Definition File"
    • Should grey out "Add Solution License Header Definition File"
    • The button should be greyed out and not removed because the option is not possible because of the state of clicked item, but because the solution wide .licenseheader file already exists.
  5. Context menu for project/folder which contains only files which are not defined in the "Languages" option

    • Should show the "Add/Remove LicenseHeader" Buttons
    • This decision can be discussed further. Theoretically to be consistent with the argumentation 1., 4. and 5., one could argue that the two options should be greyed out, because the commands can not be applied, which is not because of the state of the clicked item, but that of the items inside the project/folder. However, checking all files inside a project/folder could take a considerable amount of time and delay the showing of the context menu.