Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » An icon for DSL file
An icon for DSL file [message #1844955] Thu, 30 September 2021 18:49 Go to next message
Márcio Koch is currently offline Márcio KochFriend
Messages: 57
Registered: August 2013
Member
Hi.
Can I set a custom icon for my DSL file? I would like in Eclipse IDE my DSL file (eg myLanguage.dsl) to have a custom icon. This makes it easier to view the DSL file.
Re: An icon for DSL file [message #1844956 is a reply to message #1844955] Thu, 30 September 2021 18:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14101
Registered: July 2009
Senior Member
Hi normally the editor icon (plugin.xml) should be picked when your file content type is associated with editor
Did you try to simply configure icon attribute ?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: An icon for DSL file [message #1844959 is a reply to message #1844956] Thu, 30 September 2021 20:32 Go to previous messageGo to next message
Márcio Koch is currently offline Márcio KochFriend
Messages: 57
Registered: August 2013
Member
Thanks for the reply.
In Eclipse DSL IDE, where exactly I can configure an icon for my .dsl language file?
Re: An icon for DSL file [message #1844962 is a reply to message #1844959] Fri, 01 October 2021 04:18 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7335
Registered: July 2009
Senior Member
Hi

In your UI plugin.xml you could have something like:

    <extension
            point="org.eclipse.ui.editors">
        <editor
              class="org.eclipse.ocl.xtext.oclstdlib.ui.OCLstdlibExecutableExtensionFactory:org.eclipse.xtext.ui.editor.XtextEditor"
              contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
              default="true"
              extensions="oclstdlib"
              icon="icons/OCLModelFile.gif"
              id="org.eclipse.ocl.xtext.oclstdlib.OCLstdlib"
              name="%MF_OCLstdlibEditor">
           <contentTypeBinding contentTypeId="org.eclipse.ocl.xtext.OCLstdlib"/>
        </editor>
    </extension>


(Make sure the icon file / icons folder is exported via build.properties.)

Regards

Ed Willink
Re: An icon for DSL file [message #1844982 is a reply to message #1844962] Fri, 01 October 2021 15:28 Go to previous message
Márcio Koch is currently offline Márcio KochFriend
Messages: 57
Registered: August 2013
Member
Thank you very much.
Now it works, the steps a made was:
1) Create myCustomIcon.png with 16x16 pixel size
2) Add my custom icon into a new folder: /br.com.foo.bar.ui/icons
3) Adding line: icon="icons/myCustomIcon.png" to the /br.com.foo.bar.ui/plugin.xml file as example above
4) Configuring my file /br.com.foo.bar.ui/build.properties:
bin.includes = .,\
META-INF/,\
plugin.xml,\
icons/myCustomIcon.png
Previous Topic:Namespace import no longer works since XText 2.21.0
Next Topic:Xtext 2.26.0.M2 is available
Goto Forum:
  


Current Time: Thu Dec 02 13:39:02 GMT 2021

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

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

Back to the top