NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to configure plugin properties

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
Andrea Patricelli
Posted via mailing list.





PostPosted: Tue Apr 18, 2017 1:39 pm    Post subject: How to configure plugin properties Reply with quote

Hi all,

I'm developing a custom plugin to connect to a web application.
The plugin needs host, protocol, port and credentials of the web
application to connect to it and then run.
At first startup the plugin asks to the user to insert these values.

Is there a best practice or a kind of "classpath" under which I can put
these properties? I mean a way to package a default file and then read
it without knowing the full path of the file.
Is there a kind of properties directory?

Best regards,
Andrea

--
Dott. Andrea Patricelli
Tel. +39 3204524292

Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173
http://www.tirasa.net

Apache Syncope PMC Member
Back to top
Oliver Rettig
Posted via mailing list.





PostPosted: Wed Apr 19, 2017 4:50 pm    Post subject: How to configure plugin properties Reply with quote

Hi,

I am not sure what exactly you want to do, but maybe this helps:

Inside your netbeans module - in a subfolder with the name "release" of the
folder where is your netbeans module you can save files.

This files are automatically copied with the build process of the module.

In your code you can access thes files by

org.openide.modules.InstalledFileLocator

e.g.

File glaRightSideLabelSetFile = InstalledFileLocator.
getDefault().locate("gla-right-labelset.xml",
"de.orat.gaitlabhd.hdascii.fileType", false);

best regards
Oliver



Quote:
Hi all,

I'm developing a custom plugin to connect to a web application.
The plugin needs host, protocol, port and credentials of the web
application to connect to it and then run.
At first startup the plugin asks to the user to insert these values.

Is there a best practice or a kind of "classpath" under which I can put
these properties? I mean a way to package a default file and then read
it without knowing the full path of the file.
Is there a kind of properties directory?

Best regards,
Andrea
Back to top
Boris Heithecker
Posted via mailing list.





PostPosted: Wed Apr 19, 2017 5:13 pm    Post subject: How to configure plugin properties Reply with quote

If it's only a few string-like properties, you could use NbPreferences.forModule(YourClass.class).... to store and retrieve your properties. It's easy, because you don't have to bother about files, persistences, places and so on. Preferences are persisted by the platform. 
Boris



2017-04-18 15:37 GMT+02:00 Andrea Patricelli <address-removed ([email]address-removed[/email])>:
Quote:
Hi all,

I'm developing a custom plugin to connect to a web application.
The plugin needs host, protocol, port and credentials of the web application to connect to it and then run.
At first startup the plugin asks to the user to insert these values.

Is there a best practice or a kind of "classpath" under which I can put these properties? I mean a way to package a default file and then read it without knowing the full path of the file.
Is there a kind of properties directory?

Best regards,
Andrea

--
Dott. Andrea Patricelli
Tel. [url=tel:%2B39%203204524292]+39 3204524292[/url]

Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel [url=tel:%2B39%200859116307]+39 0859116307[/url] / FAX [url=tel:%2B39%200859111173]+39 0859111173[/url]
http://www.tirasa.net

Apache Syncope PMC Member





--
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Tel.: 0 42 05/ 31 58 34
Back to top
Andrea Patricelli
Posted via mailing list.





PostPosted: Fri Apr 21, 2017 3:27 am    Post subject: How to configure plugin properties Reply with quote

Hi Boris,
That's great, it is what I was looking for!
Best regards,
Andrea

Il 19/04/2017 19:10, Boris Heithecker ha scritto:

Quote:
If it's only a few string-like properties, you could use NbPreferences.forModule(YourClass.class).... to store and retrieve your properties.  It's easy, because you don't have to bother about files, persistences, places and so on. Preferences are persisted by the platform. 
Boris



2017-04-18 15:37 GMT+02:00 Andrea Patricelli <address-removed ([email]address-removed[/email])>:
Quote:
Hi all,

I'm developing a custom plugin to connect to a web application.
The plugin needs host, protocol, port and credentials of the web application to connect to it and then run.
At first startup the plugin asks to the user to insert these values.

Is there a best practice or a kind of "classpath" under which I can put these properties? I mean a way to package a default file and then read it without knowing the full path of the file.
Is there a kind of properties directory?

Best regards,
Andrea

--
Dott. Andrea Patricelli
Tel. [url=tel:%2B39%203204524292]+39 3204524292[/url]

Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel [url=tel:%2B39%200859116307]+39 0859116307[/url] / FAX [url=tel:%2B39%200859111173]+39 0859111173[/url]
http://www.tirasa.net

Apache Syncope PMC Member





--
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Tel.: 0 42 05/ 31 58 34


--
Dott. Andrea Patricelli
Tel. +39 3204524292

Developer @ Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173
http://www.tirasa.net

Apache Syncope PMC Member
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo