Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Setting own file extension for Graphiti Diagram
Setting own file extension for Graphiti Diagram [message #707255] Mon, 01 August 2011 11:51 Go to next message
Phillipp  is currently offline Phillipp
Messages: 24
Registered: May 2011
Junior Member
Hey since most of the work on my editor is done I would like to have my own extension for the diagram instead of ".diagram". I have found out that you have to redirect the new extension to the contentprovider from graphiti. At least that is what I concluded from this eclipse help site . My problem now is that I can not find out the contentprovider ID.

Thanks for your help!
Re: Setting own file extension for Graphiti Diagram [message #707872 is a reply to message #707255] Tue, 02 August 2011 06:57 Go to previous messageGo to next message
Joerg Reichert is currently offline Joerg Reichert
Messages: 78
Registered: July 2009
Location: Leipzig
Member
Hi Phillipp,

this is defined in the graphiti.ui plugin.xml

The content type with its file extension:
   <extension
         point="org.eclipse.core.contenttype.contentTypes">
      <content-type
            file-extensions="diagram"
            id="org.eclipse.graphiti.content.diagram" 
            name="%_contenttype_diagram">
      </content-type>
   </extension>


and the binding of the content type to the diagram editor:
   <extension
         point="org.eclipse.ui.editors">
 	  <editor
          class="org.eclipse.graphiti.ui.editor.DiagramEditor"
          contributorClass="org.eclipse.graphiti.ui.editor.DiagramEditorActionBarContributor"
          default="true"
          extensions="diagram"
          icon="icons/diagram.gif"
          id="org.eclipse.graphiti.ui.editor.DiagramEditor"
          matchingStrategy="org.eclipse.graphiti.ui.editor.DiagramEditorFactory$DiagramEditorMatchingStrategy"
          name="%_diagram_editor_name">
       <contentTypeBinding
             contentTypeId="org.eclipse.graphiti.content.diagram">
       </contentTypeBinding>
      </editor>
   </extension>


So you have to redefine both extensions in the plugin.xml of your plug-in to use your preferred file extension.

Regards,
Joerg


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com

[Updated on: Tue, 02 August 2011 06:58]

Report message to a moderator

Re: Setting own file extension for Graphiti Diagram [message #711444 is a reply to message #707872] Sat, 06 August 2011 06:16 Go to previous message
Phillipp  is currently offline Phillipp
Messages: 24
Registered: May 2011
Junior Member
Thank you

Edit:

I found out it works for me when I just put a new file-association in my plugin.xml:

<extension
          point="org.eclipse.core.contenttype.contentTypes">
       <file-association
             content-type="org.eclipse.graphiti.content.diagram"
             file-extensions="mynewfavouritediagram"
             file-names="My_Diagram">
       </file-association>
    </extension>

[Updated on: Sat, 06 August 2011 07:26]

Report message to a moderator

Previous Topic:dynamical CreateFeatures ?
Next Topic:Creating a model browser
Goto Forum:
  


Current Time: Sat Oct 25 04:28:13 GMT 2014

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

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