« Return to Thread: How to create "special" DataObjects (myself, not in layer)?

Re: How to create "special" DataObjects (myself, not in layer)?

by AntonioV :: Rate this Message:

Reply to Author | View in Thread

Hi Peter,

I'm not very good at MimeResolvers, so I'm afraid you'll have to resort to a more expert answer.

Anyway here goes my quick & dirty solution: what about creating a sibling file with a well known extension (so it's easily detected with current NBRCP infrastructure), and then build a MultiDataObject from that file as a primary file *and* your XSLT as a secondary file?

I know that having a dummy file around is probably not the best solution but, hey, maybe it's a simpler way to have things done.

Cheers,
Antonio

P.S.: If you're using your XSLT to build a "build.xml" file for Ant, then I think you can probably add a LookupProvider to your Project, and register that in a proper way see:

http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-project-ant/org/netbeans/spi/project/support/ant/GeneratedFilesHelper.html#generateBuildScriptFromStylesheet%28java.lang.String,%20java.net.URL%29

and

http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-project-ant/org/netbeans/api/project/ant/AntBuildExtender.html



epdv wrote:
AntonioV wrote:
> Hi Peter,
>
> I think I don't understand the question. So let me explain what I
> understand:
>
> You have a XML file with ".xml" extension. (You say it's a "config" file,
> what does that mean? Are you using it inside the "nbproject" directory
> integrating it as a part of the "build.xml"?). The contents of the XML file
> do not have a common "root" element (so one file can start with "<invoices>"
> and another can start with "<facturas>").

No nbproject. Even worse, it's an XSLT file which *results* in something
like a config, without anything making it possible to use a MimeResolver.

> What you want to do is to create a DataObject from that file, and then use a
> MultiView to be able to edit it visually.
>
> Am I right?

Yes. I've already thought about using a java implemented mime resolver
(like in "good old times" ;-) ), but AFAIK, declarative resolvers have
higher precedence, so my file will be resolved as an xsl file anyway.
Also, I don't know if NB will work well, if I had to ask for the project
owning the file before mime resolution.

Thanks

Peter

>
> Thanks,
> Antonio
>
>
>
> epdv wrote:
>>
>> Hello!
>>
>> I've got a special xml config file, whose name may even change from
>> project to project. I've already created an ant project type (works :-)
>> ), but now I want to create an XML multiview editor as described here:
>> http://blogs.sun.com/geertjan/entry/visual_editor_part_1.
>>
>> My problem with this is, I'll not be able to declare my config file type
>> in layer, as it is completely project dependent. Worse, there's not even
>> any public or system id which could be used. So, how can I create an
>> XmlMultiViewDataObject from my node's performAction method? BTW, I guess
>> the object has to be created from my FileObject and has to be put into
>> Lookup somehow - how?
>>
>> Kind regards
>>
>> Peter
>>
>>
>>
>

 « Return to Thread: How to create "special" DataObjects (myself, not in layer)?