On 04.06.2020 10:19, Giuseppe Aruta wrote:
> Indeed I was planning this way: from user's point of view there is no 
> difference.

yup. exactly my point.

> On the other hand, I was thinking about developers who have a project in 
> their eclipse connected to svn (or not) and have a warning that a library is 
> missing whenever they want to compile (right now, a very rare situation)

this would be solved via reflection meaning instantiating classes from a string 
name and running methods derived from string names as well e.g. like

https://stackoverflow.com/questions/3574065/instantiate-a-class-object-with-constructor-that-accepts-a-string-parameter
https://stackoverflow.com/questions/1782598/with-java-reflection-how-to-instantiate-a-new-object-then-call-a-method-on-it

so in your case (just written, down not compiled) roughly

Class<?> cl = Class.forName("com.cadplan.jump.utils.LoadSymbolFiles");
// find constructor with the context argument
Constructor<?> cons = cl.getConstructor(WorkbenchContext.class);
// this is your instance
Object o = cons.newInstance(context);
// find & run the method
Method method = cl.getDeclaredMethod("start");
method.invoke(o);

this way the classes accessed do not have to be present during compile but only 
during runtime. this may throw a lot of exceptions, so make sure to catch them 
properly, easiest with one catches all.

> I can add a readme text file on SVN>CAD plugin>dist folder explaining that 
> VertexSymbol.jar library is required to compile

better put a howto_compile.txt or such in the src folder ;) where devs will 
stumble over it.

> Best regards
> Peppe

ditto.. sunny regards from rainy germany, ede

>
>
> Il giorno mer 3 giu 2020 alle ore 22:20 <edgar.sol...@web.de 
> <mailto:edgar.sol...@web.de>> ha scritto:
>
>     On 03.06.2020 17:32, Giuseppe Aruta wrote:
>     > Hi all,
>     > I want to add VertexSymbolsXXX.jar as depency to CAD plugin.
>     > This is the reason:
>     > Currently, whenever the user saves a new block (CAD toolbar>Block>Save
>     > geometry as block) as file, this can be used also as a point/line symbol
>     > for styling. But, to do that, the user needs to close/restart again OJ.
>     > Adding this dependency and using a few lines of code, a new block will 
> be
>     > automatically available as a symbol without restarting OpenJUMP.
>     > I would like your opinion before to to this change
>
>     could you explain why you want to make it a dependency rather than just 
> detecting if the other extension is installed and run some code only when it 
> is detected?
>
>     ..ede
>
>
>     _______________________________________________
>     Jump-pilot-devel mailing list
>     Jump-pilot-devel@lists.sourceforge.net 
> <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>



_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to