GMF: Model elements disappear in diagram after restarting eclipse

Aus SDQ-Wiki
Wechseln zu: Navigation, Suche

When developing the resource editor we ran into a pretty weird GMF bug. When you create elements in the resource editor they are displayed correctly. Even when you open the diagram again they are shown. The problem occurred when you restarted eclipse. Then the created elements where not shown in the diagram although they where present in the model.

The bug is documented in the eclipse bugzilla. It seems to be a bug in GMF 2.2.

To fix this bug open plugin.xml of your editor and remove the values of the semanticHints attribute of the viewProvider. In our case this meant to replace

   <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider">
      <?gmfgen generated="true"?>
      <viewProvider class="de.uka.ipd.sdq.pcm.gmf.resource.providers.PalladioComponentModelViewProvider">
         <Priority name="Lowest"/>
         <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="ResourceEnvironmentModel"/>
         <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2001,2003,3001,3002"/>
         <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="4002"/>
      </viewProvider>
   </extension>

with the following

   <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider">
      <?gmfgen generated="true"?>
      <viewProvider class="de.uka.ipd.sdq.pcm.gmf.resource.providers.PalladioComponentModelViewProvider">
         <Priority name="Lowest"/>
         <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints=""/>
         <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints=""/>
         <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints=""/>
      </viewProvider>
   </extension>
Keywords: GMFGMF, GMF