Hi Pete. If the binary file type has a unique file extension, you could 
certainly create a Data Object with the appropriate mime type to open the file 
and gain access to some of the typical functions for DataObjects that NetBeans 
enables (copy, rename, delete…)

However, if you don’t need all those things and you just present the user with 
a File Open Dialog to access the file, then you could make your efforts less 
complicated and go a simpler route. You should have a class dedicated to the 
storage and manipulation of your data. You could try to incorporate this 
directly into your table model. I think best practices would be to keep the 
table model as the go-between the table and data for reads/write operations. 
Probably depends on complexity though.

If you go the DataObject route, you would override the Open() method to parse 
your file (your class would extend DataObject). If you don’t, you would do it 
right after you open the file.

I haven’t done a plugin before, but hope this helps.

Regards
Steve
From: Pete Whelpton [mailto:peedee...@gmail.com]
Sent: Saturday, January 13, 2018 9:16 AM
To: users@netbeans.apache.org
Subject: [Module Development] Visual editor for binary file type

Hello - and apologies for what is probably a dumb question.

I am trying to create a Netbeans plugin that allows editing of a binary file 
type (with is basically a two dimensional array) via a Visual Editor containing 
a JTable.

I have a model class that extends AbstractTableModel, and I have followed the 
New File tutorial but I am unsure of where to parse the binary file, and of 
which class the model class be a property of?

Q. Should the model be a property of DataObject or of the VisualElement?

Q. When to parse the binary file?  When DataObject is created, or in one of the 
methods of VisualElement e.g. ComponentOpened ?


Can anybody recommend some similar plugin(s) I could look it to try and help me 
fit these last pieces together?

Many thanks!

Reply via email to