Tutorial #2: oXygen plugin development

This is part 2 of my tu­to­rial se­ries on oxy­gen plu­gin de­ve­lop­ment. If you mis­sed part 1, read it here or check out the code on Git­Hub.


Part 2 of this tu­to­rial is about the EditorChangeListener and how we can use it to enable or disa­ble our cu­stom but­ton on dif­fe­rent file ty­pes. The code can be found in step2 branch in the Git­Hub repo.

Let’s say, our cu­stom but­ton should only be active/enabled/clickable when there is an XML file opened in the cur­rent oXy­gen edi­tor tab.

First, we add an EditorChangeListener with a new func­tion in all it’s change methods:

checkCurrentEditorAndChangeButtonStatus() is a new me­thod to check the cur­rent edi­tor on any change in the oXy­gen edi­tor pa­nes. Ever­y­time we change the cur­rent tab in oXy­gen, close a file or open a new one, the checkCurrentEditorAndChangeButtonStatus() is cal­led to check the cur­rent file URL:

First, we re­treive the cur­rent edi­tor with the me­thod pluginWorkspaceAccess.getCurrentEditorAccess(PluginWorkspace.MAIN_EDITING_AREA) and check whe­ther we have an edi­tor opened or not.

Se­cond, we re­treive the file URL of the cur­rent edi­tor with currentEditor.getEditorLocation() and then check the file ex­ten­sion for .xml ending.

Ba­sed on these checks we eit­her enable or disa­ble the plu­gin demo button.

There’s also some other foo we have to change in or­der to get these chan­ges to work. Check out the whole file CustomButtonPluginExtension.java in the Git­Hub repo in branch step2.


In part 3 we will learn how to check whe­ther the file is opened in aut­hor– or text-mode. Stay tuned…

Custom Toolbar and Button for oXygen XML Editor

In the next couple of weeks I’d like to write some blog­posts and tu­to­ri­als about plu­gin de­ve­lop­ment for the awe­some oXy­gen XML Edi­tor. I’d like to share my ex­pe­ri­en­ces in plu­gin de­ve­lop­ment since tu­to­ri­als and re­sour­ces for this to­pic are rare…

I’ll start off by showing how to add a cu­stom tool­bar with a sim­ple but­ton to the oXy­gen main window.

First of all, we need to down­load the oXy­gen plugins SDK from the oXy­gen Web­site. Create a new Java Pro­ject in your fa­vo­rite IDE (I’m using Eclipse), place the oxygen.jar li­brary from the SDK down­load in your lib/ fol­der and add it to the build path. Also add the Ja­va­doc, that’s quite hel­pful. You can also ac­cess the the do­cu­men­ta­tion on­line.

To start off with plu­gin de­ve­lop­ment, read the oXy­gen ma­nuel chap­ter about plu­gin de­ve­lop­ment. Their blog also of­fers some help.

For ex­ten­ding the oXy­gen main win­dow we need to create a „Works­pace Ac­cess Plu­gin“. A plu­gin al­ways con­sists of the fol­lo­wing sources:

YourDemoPlugin.java
YourDemoPluginExtension.java
plugin.xml

plugin.xml is the plu­gin de­scrip­tor and you can set it up as follows:

The <toolbar> ele­ment de­fi­nes our cu­stom tool­bar with its id attribute.

Next, we need YourDemoPlugin.java which is for con­ve­ni­ence and can re­turn an in­stance of our plu­gin. Haven’t found out what else you can use it for…

And fi­nally, YourDemoPluginExtension.java is the Ex­ten­sion its­elf. Your Plu­gi­n­Ex­ten­sion class al­ways needs to im­ple­ment the plu­gin type in­ter­face, like in our case, the WorkspaceAccessPluginExtension with it’s me­thods applicationStarted() and applicationClosing(). We will use applicationStarted() to add our tool­bar and but­ton to the oXy­gen main win­dow at star­tup time. Take a look at the following:

We add a ToolbarComponentsCustomizer and add a cu­stom JButton if the cur­rently pro­ces­sed tool­bar equals our tool­bar ID in plugin.xml.

For demo re­a­sons I ad­ded a messageDialog with the name of our tool­bar. Feel free to do wha­te­ver you want with the JButton…

Howe­ver, don’t for­get to add your freshly crea­ted GUI com­ponents to the tool­bar with toolbarInfo.setComponents() and name your tool­bar with toolbarInfo.setTitle().

To load the plu­gin in oXy­gen ex­port your Java Pro­ject as a JAR li­brary and go to the oXy­gen in­stal­la­tion di­rec­tory. Open the fol­der plugins/ and create your own plu­gin fol­der DemoButton/. Place the plugin.xml file in­side, create a fol­der lib/ in­side and place the jar file in it. Re­start oXygen.

That’s it… :)

#markupforum2013 Interview

paginaEPUBChecker_markupforumAuf dem letz­ten Mar­kupfo­rum in Stutt­gart (Nov. 2013) habe ich ei­nen Kurz­vor­trag über den pa­gina EPUB-Checker ge­hal­ten, den ich seit ca. 2–3 Jah­ren als Free­ware ent­wickle (der EPUB-Checker ist eine gra­phi­sche Be­nut­zer­ober­flä­che um EPUB-E-Books zu validieren).

Von mei­nem ehe­ma­li­gen HdM-Professor Marko Hed­ler wurde ich (und je­der an­dere Re­fe­rent) nach dem Vor­trag kurz in­ter­viewt. Sehr spon­tan, muss ich er­wäh­nen, um mein Stot­tern zu rechtfertigen ;-)

Oder wie ein Kol­lege so nett meinte: „Du bist im In­ter­net und kommst da nie wie­der raus.“ ;-)

EOFT 2013 Nachlese

Die dies­jäh­rige Eu­ro­pean Out­door Film Tour war mal wie­der ham­mer­mä­ßige Outdoor-Action! Ab­so­lut se­hens­wert und inspirierend!

Auf ei­nige Filme mir be­son­ders gut ge­fal­len ha­ben möchte ich hier kurz hinweisen.

Das wäre zum ei­nen die Doku „The Road From Ka­ra­kol“ von Kyle Demps­ter der im Som­mer 2011 mit dem Fahr­rad al­leine quer durch Kir­gis­tan ge­ra­delt ist. Den ge­sam­ten 25-Minuten-Film kann man sich übri­gens auch auf Youtube anschauen:

Sound­track: Exit­mu­sic – The Mo­dern Age und Lemo­lo­mu­sic – Open Air

Und des­wei­te­ren der Canyoning-Film „The Be­gin­ning“ wel­cher mich als Canyoning-Begeisterten be­son­ders ge­flasht hat. Zu­mal ich in ei­ner der Tessiner-Schluchten („Bog­gera“) im Som­mer selbst erst war. Den Trai­ler gibts hier, den ge­sam­ten Film kann man ab 4 € als VOD über die Web­site kaufen.

War­ren Ver­boom und sein Team ha­ben den wohl ers­ten Canyoning-Film über­haupt ge­dreht und ich kann euch die Voll­ver­sion nur wärms­tens emp­feh­len. Ab­so­lut kras­ser Shiet ;-)

Printlayouts mit CSS3

Tobias-Fischer_Gregor-Fellenz_tekom13_Printlayouts-mit-CSS3Gre­gor und ich ha­ben am 6. No­vem­ber 2013 auf der te­kom Jah­res­ta­gung ei­nen Fach­vor­trag zum Thema „Print­lay­outs mit CSS3“ ge­hal­ten. Den Ta­gungs­band­bei­trag und un­sere Fo­lien gibts nun auch hier auf dem Blog…

Der Vor­trag be­leuch­tet die Kon­zepte des CSS3 Pa­ge­Me­dia­Mo­dule und den ak­tu­el­len Stand der Implementierung.

Wei­ter­le­sen