Bug 565021 - NPE when triggering CopyFormatAction from custom Tabbar
Summary: NPE when triggering CopyFormatAction from custom Tabbar
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 6.3.1   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2020-07-07 10:27 EDT by Steve Monnier CLA
Modified: 2020-07-08 10:02 EDT (History)
1 user (show)

See Also:


Attachments
Data_0020 (11.49 KB, application/x-zip-compressed)
2020-07-08 05:57 EDT, Steve Monnier CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Monnier CLA 2020-07-07 10:27:04 EDT
On a diagram editor with a custom tabbar that contributed the "Copy format" tabbar action, activating it causes the following NPE:
java.lang.NullPointerException
       at org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction.getDiagramCommandStack(DiagramAction.java:151)
       at org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction.execute(DiagramAction.java:141)
       at org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction.doRun(DiagramAction.java:104)
       at org.eclipse.gmf.runtime.common.ui.action.AbstractActionHandler.run(AbstractActionHandler.java:360)
       at org.eclipse.gmf.runtime.common.ui.action.ActionManager$1.run(ActionManager.java:226)
       at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:71)
       at org.eclipse.gmf.runtime.common.ui.action.ActionManager.run(ActionManager.java:224)
       at org.eclipse.gmf.runtime.common.ui.action.AbstractActionHandler.runWithEvent(AbstractActionHandler.java:378)
       at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
       at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:436)
       ...

Steps to reproduce:
- import DATA_0020 (from the acceptance test examples or from the attached zip)
- this will import the project sample.tabbar.contributor.extension in your workspace
- in this project open the class TabbarContributorSample, in the method "getDiagramElementContributionItem" add "diagramElementContributionItems.add(createCopyFormatContribution(part)); " to the list
- launch a runtime
- open a diagram
- select an element and click on the tabbar action with the tooltip "Copy the format of the selected diagram elements"
-> It should not open a popup with just a message "null" and throw the NPE.
Comment 1 Steve Monnier CLA 2020-07-08 05:57:35 EDT
Created attachment 283538 [details]
Data_0020
Comment 2 Steve Monnier CLA 2020-07-08 05:59:30 EDT
In the attached sample, I have already added the missing code line "diagramElementContributionItems.add(createCopyFormatContribution(part));" that is not in the sample imported for the acceptance test example.