Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF FORMS]Dead loop for 'TreeMasterDetailSWTRenderer'(Using tree master detail in emf forms)
[EMF FORMS]Dead loop for 'TreeMasterDetailSWTRenderer' [message #1785765] Thu, 19 April 2018 12:23 Go to next message
zhang ph is currently offline zhang phFriend
Messages: 43
Registered: March 2017
Member
Hi,
Recently, I use EMF Forms to display my EMF model. I create a butuon in my editor to generate a dialog and use EMF Forms to create tree structure in the dialog, but when I finish the code, I run an eclipse application to do test, I find when I click the button there will be a dead loop for 'TreeMasterDetailSWTRenderer'. Then stackoverflow will appear.

My code is:

protected Control createDialogArea(Composite parent) {
final EObject dummyObject = getDummyEObject();
try {
final Composite content = new Composite(parent, SWT.ON_TOP);
content.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
/* */content.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
content.setLayoutData(GridDataFactory.fillDefaults().create());
final ReferenceService previewRefServ = new DefaultReferenceService();
final ViewModelContext viewModelContext = ViewModelContextFactory.INSTANCE.createViewModelContext(
ViewProviderHelper.getView(target.eContainer(), null), target.eContainer(), previewRefServ);
ECPSWTViewRenderer.INSTANCE.render(content, target.eContainer());
content.layout();
} catch (Exception e) {
e.printStackTrace();
}
parent.layout();
return null;

}

Below is part of debug information:

SafeRunnable.run(ISafeRunnable) line: 173
TreeViewer(Viewer).fireSelectionChanged(SelectionChangedEvent) line: 155
TreeViewer(StructuredViewer).updateSelection(ISelection) line: 2191
TreeViewer(StructuredViewer).setSelection(ISelection, boolean) line: 1728
TreeViewer.setSelection(ISelection, boolean) line: 1077
TreeViewer(Viewer).setSelection(ISelection) line: 383
TreeMasterDetailSWTRenderer.createMasterTree(Composite) line: 421
TreeMasterDetailSWTRenderer.renderControl(SWTGridCell, Composite) line: 303
TreeMasterDetailSWTRenderer(AbstractSWTRenderer<VELEMENT>).render(SWTGridCell, Composite) line: 201
ViewSWTRenderer(ContainerSWTRenderer<VELEMENT>).renderControl(SWTGridCell, Composite) line: 175
ViewSWTRenderer.renderControl(SWTGridCell, Composite) line: 100
ViewSWTRenderer(AbstractSWTRenderer<VELEMENT>).render(SWTGridCell, Composite) line: 201
ECPSWTViewRendererImpl.render(Composite, ViewModelContext) line: 113
TreeMasterDetailSWTRenderer$TreeMasterViewSelectionListener.selectionChanged(SelectionChangedEvent) line: 887
Viewer$1.run() line: 158
SafeRunner.run(ISafeRunnable) line: 42
JFaceUtil$1.run(ISafeRunnable) line: 50
SafeRunnable.run(ISafeRunnable) line: 173
TreeViewer(Viewer).fireSelectionChanged(SelectionChangedEvent) line: 155
TreeViewer(StructuredViewer).updateSelection(ISelection) line: 2191
TreeViewer(StructuredViewer).setSelection(ISelection, boolean) line: 1728
TreeViewer.setSelection(ISelection, boolean) line: 1077
TreeViewer(Viewer).setSelection(ISelection) line: 383
TreeMasterDetailSWTRenderer.createMasterTree(Composite) line: 421
TreeMasterDetailSWTRenderer.renderControl(SWTGridCell, Composite) line: 303
TreeMasterDetailSWTRenderer(AbstractSWTRenderer<VELEMENT>).render(SWTGridCell, Composite) line: 201
ViewSWTRenderer(ContainerSWTRenderer<VELEMENT>).renderControl(SWTGridCell, Composite) line: 175
ViewSWTRenderer.renderControl(SWTGridCell, Composite) line: 100
ViewSWTRenderer(AbstractSWTRenderer<VELEMENT>).render(SWTGridCell, Composite) line: 201
ECPSWTViewRendererImpl.render(Composite, ViewModelContext) line: 113
TreeMasterDetailSWTRenderer$TreeMasterViewSelectionListener.selectionChanged(SelectionChangedEvent) line: 887
Viewer$1.run() line: 158
SafeRunner.run(ISafeRunnable) line: 42
JFaceUtil$1.run(ISafeRunnable) line: 50
SafeRunnable.run(ISafeRunnable) line: 173
TreeViewer(Viewer).fireSelectionChanged(SelectionChangedEvent) line: 155
TreeViewer(StructuredViewer).updateSelection(ISelection) line: 2191
TreeViewer(StructuredViewer).setSelection(ISelection, boolean) line: 1728
TreeViewer.setSelection(ISelection, boolean) line: 1077
TreeViewer(Viewer).setSelection(ISelection) line: 383
TreeMasterDetailSWTRenderer.createMasterTree(Composite) line: 421
TreeMasterDetailSWTRenderer.renderControl(SWTGridCell, Composite) line: 303
TreeMasterDetailSWTRenderer(AbstractSWTRenderer<VELEMENT>).render(SWTGridCell, Composite) line: 201
ViewSWTRenderer(ContainerSWTRenderer<VELEMENT>).renderControl(SWTGridCell, Composite) line: 175
ViewSWTRenderer.renderControl(SWTGridCell, Composite) line: 100
ViewSWTRenderer(AbstractSWTRenderer<VELEMENT>).render(SWTGridCell, Composite) line: 201
ECPSWTViewRendererImpl.render(Composite, ViewModelContext) line: 113
ECPSWTViewRendererImpl.render(Composite, EObject, VView) line: 78
ECPSWTViewRendererImpl.render(Composite, EObject) line: 65
SampleHandler$Test.createDialogArea(Composite) line: 92

From the information, 'TreeMasterDetailSWTRenderer.createMasterTree' is called repeatedly.
Could you give any suggetions about this problem?
Thanks in advance.

[Updated on: Thu, 19 April 2018 12:25]

Report message to a moderator

Re: [EMF FORMS]Dead loop for 'TreeMasterDetailSWTRenderer' [message #1785816 is a reply to message #1785765] Fri, 20 April 2018 09:05 Go to previous messageGo to next message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 82
Registered: December 2013
Member

Hi,

It sounds like you haven't specified a detail view model for the root element of the Tree Master Detail. The root is selected by default and tries to render a further TMD in the detail, and so on.
Take a look here:
https://eclipsesource.com/blogs/tutorials/emf-forms-view-model-elements/#treemasterdetail
This shows how to register a detail view model at the extension point.
<plugin>
   <extension point="org.eclipse.emf.ecp.view.model.provider.xmi.file">
  <file filepath="viewmodels/UserGroup_Detail.view">
       <filter key="detail" value="true">
       </filter>
  </file>
  <file filepath="viewmodels/UserGroup.view">
     <file filepath="viewmodels/User.view">
      </file>
   </file></extension>
</plugin>


Cheers
Johannes


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF FORMS]Dead loop for 'TreeMasterDetailSWTRenderer' [message #1785827 is a reply to message #1785816] Fri, 20 April 2018 10:37 Go to previous messageGo to next message
zhang ph is currently offline zhang phFriend
Messages: 43
Registered: March 2017
Member
Thanks for your reply.
The dead-loop problem is solved! But there still a problem. My viewmodel&plugin.xml and the opened dialog are contained in attachments. When I open the dialog, the treeView cann't be rendered but only the attribute of my Eobject are rendered. I find the viewmodel isn't registered. You can check the attachments for more detail.
Hope for your reply!

[Updated on: Fri, 20 April 2018 10:48]

Report message to a moderator

Re: [EMF FORMS]Dead loop for 'TreeMasterDetailSWTRenderer' [message #1785869 is a reply to message #1785827] Sat, 21 April 2018 09:10 Go to previous messageGo to next message
zhang ph is currently offline zhang phFriend
Messages: 43
Registered: March 2017
Member
Hi,
Sorry to misunderstand your last suggestion, you can ignore the above message.
I have tried your suggetion from the beginning, and the tree view have been shown, But a detailed view must be defined. If I just want to show the treeTable, using this it, what should I do?
Hope for your reply!

[Updated on: Tue, 24 April 2018 08:36]

Report message to a moderator

Re: [EMF FORMS]Dead loop for 'TreeMasterDetailSWTRenderer' [message #1786180 is a reply to message #1785869] Thu, 26 April 2018 14:13 Go to previous message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 79
Registered: September 2016
Member
Hi,

you mean you just want to show the tree without a detail area?

Best regards,
Jonas


--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:[EMF Forms] Question about Table Custom Control
Next Topic:[EMF Forms] What happened to the JavaFX renderer between version 1.7.2 and 1.8.0?
Goto Forum:
  


Current Time: Wed Sep 19 16:19:41 GMT 2018

Powered by FUDForum. Page generated in 0.02196 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top