Skip to main content



      Home
Home » Modeling » TMF (Xtext) » An icon for DSL file
An icon for DSL file [message #1844955] Thu, 30 September 2021 14:49 Go to next message
Eclipse UserFriend
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 14:56 Go to previous messageGo to next message
Eclipse UserFriend
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 ?
Re: An icon for DSL file [message #1844959 is a reply to message #1844956] Thu, 30 September 2021 16:32 Go to previous messageGo to next message
Eclipse UserFriend
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 00:18 Go to previous messageGo to next message
Eclipse UserFriend
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 11:28 Go to previous message
Eclipse UserFriend
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:VS Code published mydsl extensions don't work - why?
Goto Forum:
  


Current Time: Tue Jul 01 00:56:15 EDT 2025

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

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

Back to the top