Thanks Geertjan :)
I've made the repo public for the moment, in case anyone wants to take a
look:
https://bitbucket.org/peedeeboy/odyssey-engine-netbeans-solution/src/development/
I can try and knock together a simple application for Q1) if anyone is
interested in helping. It seems like I'm missing something obvious in the
way NBP is designed.
Re: Q4, always opening a file in a specific encoding, I think I've figured
that part out:
* Extend FileEncodingQueryImplementation and override the getEncoding()
method to return the Charset of choice (windows-1252)
* Register this in the DataObject's lookup. I'm using this in the DO
constructor:
CookieSet cookies = getCookieSet();
cookies.assign(FileEncodingQueryImplementation.class,
new NssFileEncodingQueryImplementation());
Not sure about forcing windows line endings yet, but I'll keep trying...
P
On Sun, Sep 30, 2018 at 9:00 AM Geertjan Wielenga
<[email protected]> wrote:
> All these questions are hard to answer theoretically -- i.e., if you have
> something on GitHub that reproduces these problems, someone can look at
> them and help, i.e., create a simple NetBeans Platform application that
> contains these problematic areas and then someone can advise.
>
> Gj
>
> On Sat, Sep 29, 2018 at 2:25 PM Pete Whelpton <[email protected]> wrote:
>
>>
>> Hello all :) Apologies in advance for the newbie NBP questions. I have
>> already been through the NBP API documentation and Netbeans sources, which
>> is how I've got to where I am, but I'm a bit stumped now. Any pointers, no
>> matter how small, gratefully received!
>>
>>
>> 1) Modular approach for project customizers (and sharing settings
>> between Modules)
>>
>> * I have a module suite with a Project module, and two modules for
>> supported File Types, Nss and Tda
>> * In the project module, I have a class that implements
>> AuxillaryProperties and reads/writes a .properties file. This class is
>> registered in the Project Lookup
>> * In the File Type modules, I have registered customizer panels with
>> @ProjectCustomizer.CompositeCategoryProvider.Registration
>>
>> Q1) ProjectUtils.getPreferences() returns null. Why? Looking at
>> the NB source, it seems like the factory creates the backing store by first
>> checking for an implementation of AuxillaryConfiguration in the
>> ProjectLookup, then for AuxillaryProperties. I have an implementation of
>> AuxillaryProperties, so I'm not sure why it doesn't work.
>>
>> I can get the properties by looking up AuxillaryProperties from in
>> Project lookup injected into the customizer panels - but the Netbeans API
>> documentation says not to directly use this interface...
>>
>> Q2) How to save changes for each panel? I think that each panel
>> somehow needs to listen to the okOptionLister and implement its own save
>> operation, but that Listener is up in the Project.
>>
>>
>> 2) My Module Suite will no longer build unless I do a Clean & Build.
>> Regular build fails with the following error:
>>
>> error: Refused to write invalid generated-layer.xml:
>> org.xml.sax.SAXParseException; lineNumber: 174; columnNumber: 43; The
>> element type "file" must be terminated by the matching end-tag "</file>".
>>
>> The only generated-layer.xml file is the one for the Nss module. The
>> XML around line 174 is:
>>
>> <folder name="Preprocessor Directives">
>> <file name="DirectiveInclude.xml">
>> <!--org.peedeeboy.oens.nss--><![CDATA[<!DOCTYPE
>> editor_palette_item PUBLIC '-//NetBeans//Editor Palette Item 1.1//EN' '
>> http://www.netbeans.org/dtds/editor-palette-item-1_1.dtd'>
>> <editor_palette_item version="1.1">
>> <body> <![CDATA[#include "filename"]]]]><![CDATA[>
>> </body>
>> <icon16
>> urlvalue="org/peedeeboy/oens/nss/icons/edit-number.png" />
>> <icon32
>> urlvalue="org/peedeeboy/oens/nss/icons/edit-number.png" />
>>
>> <inline-description><display-name>Include</display-name><tooltip> <![CDATA[
>> Include external .nss
>> script]]]]><![CDATA[></tooltip></inline-description></editor_palette_item>]]></file>
>> </folder>
>>
>>
>> Q3) Why would this fail to be generated correctly on a Build, but not
>> on a Clean and Build?
>>
>>
>> 3) My NSS file type should always be opened/saved in CP-1252 encoding,
>> with Windows line endings
>>
>> Q4) Where to implement this? To try and get some clues, I've been
>> looking through the NB sources for how NB gets the encoding property for
>> Java projects and uses it for reading/writes .java files, but I haven't
>> found it...
>>
>>
>> Thanks and apologies again!
>>
>> P
>>
>