Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

ANSI support can't be disabled via product customization #63

Closed

Description

@iloveeclipse

Follow up on #57 list.

While validating change in #60 I've stumbled over the fact that the "Enable ANSI Support" button in the Console view always shows wrong state. Turned out, the org.eclipse.ui.internal.console.ansi.commands.EnableDisableHandler.updateElement(UIElement, Map) always reads it's own default from plugin.xml (which is true) on first init and sets that default to the preferences... So I wasn't able to disable ANSI support via product preference org.eclipse.ui.console/ANSI_support_enabled=false as expected, because it was always overridden once Console was opened.

I will push a patch in a moment.

@mihnita :FYI

Activity

  1. added
    bug
    on Aug 9, 2022
  2. added this to the 4.25 M3 milestone on Aug 9, 2022
  3. self-assigned this
    on Aug 9, 2022
  4. mihnita commented on Aug 10, 2022

    @mihnita
    Contributor

    always reads it's own default from plugin.xml (which is true) on first init

    Actually, this is not true.

    The stat is handled by Eclipse itself.
    It is what this did:

    <state
    		class="org.eclipse.ui.handlers.RegistryToggleState:true"
    		id="org.eclipse.ui.commands.toggleState">
    </state>
    

    together with the style="toggle" on the menuContribution
    and the command.getState(RegistryToggleState.STATE_ID); "magic"

    So Eclipse itself did the "toggling", and it was only the first time coming from plugin.xml

    The reason this was done is because Eclipse initialized the console "chrome", including the toolbar and the icons in the toolbar without calling any code in the plugin whatsoever.
    So if the element.setChecked was left to updateElement, that only runs very late, when the first output goes to the console and the plugin was activated.

    The visual effect was that if the plugin was disabled and you exited, the next time Eclipse started it was showing the icon enabled. Then you output something, the plugin is activated, the icon is updated (to "disabled" state), and the output was showing the escapes and no styles.
    So the functionality was OK for the disabled state, but the icon was in enabled state until the first run.

    All of that is "standard Eclipse magic"

    This was the bug:
    mihnita/ansi-econsole#45

  5. mihnita commented on Aug 10, 2022

    @mihnita
    Contributor

    So I wasn't able to disable ANSI support via product preference org.eclipse.ui.console/ANSI_support_enabled=false as expected

    That means the standard "toggle" mechanism provided by Eclipse is buggy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions