Bug 440301 - EditingSession might not be initialized : NPE in CreateRepresentationAction
Summary: EditingSession might not be initialized : NPE in CreateRepresentationAction
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 1.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on: 437251
Blocks: 437255
  Show dependency tree
 
Reported: 2014-07-24 04:56 EDT by Maxime Porhel CLA
Modified: 2015-12-15 04:10 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Porhel CLA 2014-07-24 04:56:46 EDT
+++ This bug was initially created as a clone of Bug #437251 +++

Steps to reproduce :
- install EcoreTools from http://download.eclipse.org/modeling/emft/ecoretools/updates/milestones/2.0.0RC4a/luna
- restart Eclipse making sure nothing from Sirius is loaded (you should not be in the modeling perspective or have a View from Sirius opened), the bug has been reproduced successfully with the Java perspective
- import a project with a Ecore file (importing ExtLibrary from the examples with the New-> wizard for instance)
- right click on the .ecore file, "Initialize Ecore Diagram"
- go through the steps to create a new representation
result : nothing happens and you have a error which is logged in the error log view.
expected result : the representation is opened

The bug has not been reproduced on Linux systems so far.


NPEs are coming from :
Caused by: java.lang.NullPointerException
 at org.eclipse.sirius.ui.tools.internal.actions.creation.CreateRepresentationAction$1.run(CreateRepresentationAction.java:126)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)


Looking at the code, this action expect an EditingSession to be here but none has been created yet. This is probably a side effect of the lazyness recently introduced.

Workaround in EcoreTools is to explicitely call 
	IEditingSession uiSession = SessionUIManager.INSTANCE
				.getOrCreateUISession(existingSession);
		uiSession.open();
Before reusing the CreateRepresentationAction.
Comment 1 Maxime Porhel CLA 2014-07-24 04:58:19 EDT
See https://git.eclipse.org/r/#/c/30408/ for a first workaround on master (correction done on 1.0.1)
Comment 2 Maxime Porhel CLA 2014-07-24 04:59:06 EDT
(In reply to Maxime Porhel from comment #1)
> See https://git.eclipse.org/r/#/c/30408/ for a first workaround on master
> (correction done on 1.0.1)

Wrong url, please see: https://git.eclipse.org/r/#/c/29988/
Comment 3 Maxime Porhel CLA 2014-07-24 05:01:09 EDT
This only correct the NPE. 

As proposed by Cedric:
> to get rid of this altogether or at least make sure we don't really need to keep > it in sync with Session instances through a specific sessionmanager listener.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=437251#c11
Comment 4 Maxime Porhel CLA 2014-07-24 11:45:30 EDT
The workaround has been submitted on master to avoid potential NPE, see commit ba38f5e030ab4bfd1ede177104a4d3384c93ad5b

See comments on Bug 437251 for the remaining work.
Comment 5 Pierre-Charles David CLA 2015-12-15 04:10:58 EST
Moving out of the 4.0 scope for now, along with all the other issues which were there "by default". This does not mean some of these will not be re-integrated at some point, but for now these issues are not part of the roadmap for 4.0.

If you feel strongly about this removal from 4.0 and/or are ready to sponsor the corresponding work, feel free to comment.