Eclipse Plug-in: SilverStripe Developer Tools

Dec 29, 2013

Tags: , , ,

For the last year or two myself and the development team at Webbuilders Group have been using a plugin for the Eclipse IDE which I wrote primarily to make my day easier with the added bonus that it helps out my co-workers. One day I mentioned SilverStripe Developer Tools (SilverStripe DT) to DesignerX in the SilverStripe irc channel on freenode, when there was a discussion about out IDE's going on, mentioning what I was using and had wrote this plugin that I use all the time, he was immediately interested. Not having seen anything of the plugin and only going on the very basic descriptions of it that I gave in the channel. He suggested that I should release it so others outside the small group I've provided the address of the update site to. Then it dawned on me, t the time there really is no editor that provides proper syntax highlighting for SilverStripe templates little-own full auto complete for the SilverStripe core classes as well as well as handy templates to fill in tens of lines of commonly used code. The plug-in SilverStripe Developer Tools (SilverStripe DT) comes with many very helpful tools and editors for developing for SilverStripe.

wizards new projectOne features is a new project wizard that allows you to create a new project layout that is configured for what type of project your creating module, mysite, or theme. For example a new mysite project will come with a default Page.php, a _config.php as well as all of the basic folder structure for a mysite project (code,  javascript, etc) and for SilverStripe 3.1 it comes with a base config.yml. Each project is also configured and bound to the version of SilverStripe that you are planning to use as your framework, so if you select to use SilverStripe 3.0 (or framework only) you will gain auto completion for SilverStripe 3.0's framework as well as all of the sources including PHPDocs are available when you ctrl click or mouse over a method or property defined in the core of SilverStripe. Needless to say it's been a long time since I've gone to since everything is right there at my finger tips. One of the things that I've always told the other developers (new and old) on our team at Webbuilders Group, "Don't be afraid to go digging through the core" (though there is allot in there that kinda terrifies me). With a new module project for the most part just creates the common directories a module comes with (code, css, javascript, templates, templates/Layout and templates/Includes) as well it creates an empty _config.php.

With a new theme project option comes with a basic or starter theme, that well... it's very basic, other than some basic layout styles and a decent typography stylesheet its a white page with text on it. This theme has been the basis of all of my projects at Webbuilders Group since I first got a usable version of SilverStripe DT running probably about two years ago now. Aside from the odd bug or tweak here and there it has largely remained the same since then. It's not responsive but in the past I've easily adapted the theme for responsive designs as well. Of course from project to project much of the base template code does change based on the design to be sliced but its a good solid start at least it has been for me and my co-workers.

One of the other wizards the plugin comes with allows you to create PHP classes that sub-class or implement other classes or interfaces via a simple ui that allows you to name the class, define it's parent class as well as add interfaces that it implements. Method stubs defined in the interfaces are automatically defined in the created class with @TODO comments to help locate them.

If that wasn't enough, it even has a dev/build viewer so provided you have setup the web path to your project under the project's preferences you can click on the dev/build button in the toolbar or use the keyboard shortcut alt+shift+x, b (on windows) to open the dev/build view and build your site.

highlight 1Finally, and probably one of the best features of the plug-in is the SilverStripe template editor, this editor provides syntax highlighting for SilverStripe template code. The SilverStripe template is validated for HTML (or XML) syntax only unfortunately due mainly to my lack of understanding how validators work in Eclipse. Having the templates validated only has HTML (or XML) does pose one problem, SilverStripe tags produce warnings in Eclipse's Problems view and errors in this view in many circumstances. The highlighter is also SilverStripe version aware so in SilverStripe 3.x projects control blocks will not highlight where as loop and with blocks will (vice versa in 2.x projects).


I have many ideas for where to go with this as time goes on I've got a few things in mind, first and foremost is addressing issues with the SilverStripe 3.1 api changes. Right now when you create a new project or create a new DataObject extension (including Page types) the template used contains public statics for $db, $has_one, $has_many, etc where in 3.1+ these are private. There are some other things I want to do like visually showing deprecated template code rather than simply not highlighting it. As well I do want to make this compatible with Eclipse 4.3.x, which from my initial testing should be "fun". Also on the list is a proper validator but I'm hoping that by pushing this to Github someone else will come up with a great solution for this, I fear it's a bit beyond my limited Java knowledge/experience not to mention the whole thing about the Eclipse API being involved. I've been holding off on many of these changes until I get this blog post done (which I started in January believe it or not, what a crazy year) and get things pushed up to Github.

Along with finally posting this blog article I've released the sources for SilverStripe Developer Tools on Github Here, to install add the following update site to your Eclipse Install manual install archives can also be retrieved from there as well.

5 1

Posted in: Application Release |