Bug 582054 - The delete menu in context menu gets disabled on change of perspective.
Summary: The delete menu in context menu gets disabled on change of perspective.
Status: NEW
Alias: None
Product: Incubator
Classification: Eclipse Project
Component: e4 (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: E4 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-12 08:54 EDT by Nandan Pai CLA
Modified: 2023-06-12 08:54 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nandan Pai CLA 2023-06-12 08:54:25 EDT
Hello,
We have added cut/copy/paste/delete menu options within IMenuManager by overriding the menuAboutToShow() method. The CommandContributionItem for Delete item:-
 public CommandContributionItem getDeleteMenuItem() {
        return new CommandContributionItem(
                new CommandContributionItemParameter(PlatformUI.getWorkbench(),
                        "org.eclipse.ui.edit.delete",
                        "org.eclipse.ui.edit.delete", SWT.NONE));
    }

The create Delete action code:-
private IAction createDeleteAction() {
        return new Action() {

            @Override
            public void run() {
                delete();
            }

            @Override
            public boolean isEnabled() {
                return canDelete();
            }
        };
    }

This issue occurs specifically on changing the perspectives from Open perspective popup. The isEnabled() for Delete is never invoked. However, after switching between tabs, the menu gets enabled. It seems that on switching between perspectives, the listener linked to  delete menu gets lost somehow.
Could you please take a look and let me know what can be done.

Kind regards,
Nandan S. Pai