Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] menubuilder and actions

Vitali Diatchkov probaly wrote:
> 
> defaultModalToolProxy is initialized from the ToolProxy constructor.
>
> ToolManager analyzes all tool extensions(as action as modal) and creates a
> ToolProxy for every tool. inside of ToolProxy the default UDIG tool is
> hard-coded and it is a Zoom tool.  It means that if defaultModalToolProxy ==
> null then something went wrong before that even a default Zoom tool was not
> initialized. Are you able to debug? It is the only one right way to find a
> problem. Put the breakpoint inside of processTools() and see how the
> initialization goes.  

I did that and in the loop were the tools are analised, everything runs
properly without exceptions. The ToolProxy is created and added to
action and menu category.

> By the way ToolManager requires safe tools initialization - means catch the
> every iteration inside of processTools() method with a catch(Exception exc)
> and report a problem while other tools are able to be initialized even is
> some tool failed.
> 
> Take a look how default tools are configured in
> net.refractions.udig.tools.default and do the same steps.
> 
> I suspect that ToolProxy constructor throws NPE during initialization your
> tool... 

I loaded also the net.refractions.udig.tools.default project into my
workspace (I am usually using the SDK) in order to be able to see the
way the plugin and the commands were configured.
Now mine is build the same.
If I launch the build with the net.refractions.udig.tools.default
project open, I get no exception, but if I again close the project, the
exception is thrown.

Any idea on this strange behaviour?

Andrea




> 
> 
>> -----Original Message-----
>> From: Andrea Antonello [mailto:andrea.antonello@xxxxxxxxx]
>> Sent: Thursday, April 19, 2007 3:34 PM
>> To: Vitali Diatchkov
>> Cc: 'User-friendly Desktop Internet GIS'
>> Subject: Re: [udig-devel] menubuilder and actions
>>
>> Thanks Vitali,
>> I already checked the processtools method, and if activeModalToolProxy
>> is null, the defaultModalToolProxy is assigned.
>> The problem is, that also defaultModalToolProxy is null, when the method
>> is called. I have no idea where the defaultModalToolProxy comes from. In
>> the ToolManager class it is apparently never instantiated and it also
>> doesn't come from a superclass, since there is only an interface
>> implementation.
>>
>> Any idea where I could look?
>> I'm sure it is my tool to break the thing, but I have no idea about how.
>>
>> What about the categoryID or menupath that has to be set in the extention?
>> Could that be the problem?
>> I  also tried to create a category from its extention point, but no
>> luck. The problem stays.
>>
>> Andrea
>>
>>
>>
>> Vitali Diatchkov probaly wrote:
>>> Hello!
>>> Regarding to activeModalToolProxy - it should not be a null because
>> there is
>>> always one modal tool being active. During initialization of tools the
>>> default tool (which is ZOOM) is set to the activeModalToolProxy member
>> of
>>> ToolManager. So your exception means that something went wrong during
>>> initialization of tools inside of ToolProxy constructor.
>>>
>>> Do you have another exceptions earlier in the log file?
>>>
>>> Take a look into the method ToolManager.processTools(). This method
>>> initializes tools and if YOUR tool (action tool as I understand) was not
>>> initialized properly - all other tools are not initialized because the
>>> exception (NPE probably) is thrown outside of this method.
>>>
>>> So I am pretty sure that wrong configuration of your tool corrupts
>>> initialization of other tools. Please check  this!
>>>
>>> Vitali Diatchkov.
>>>
>>>> -----Original Message-----
>>>> From: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:udig-devel-
>>>> bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Andrea Antonello
>>>> Sent: Thursday, April 19, 2007 3:02 PM
>>>> To: User-friendly Desktop Internet GIS
>>>> Subject: [udig-devel] menubuilder and actions
>>>>
>>>> I am trying to create an Action to be added to a menu created through
>>>> the menubuilder extention.
>>>>
>>>> Mainly I want to create a button that launches a dialog, then the user
>>>> chooses some layer and the action does something.
>>>>
>>>> That said, I first tried to create an ActionTool from the udig
>>>> extention, which is rather easy and seemed to fit my needs.
>>>>
>>>> However when I started udig, i got a nice exception:
>>>> java.lang.NullPointerException
>>>> 	at
>>>>
>> net.refractions.udig.project.ui.internal.tool.display.ToolManager.setActiv
>>>> eTool(ToolManager.java:508)
>>>> 	at
>>>>
>> net.refractions.udig.project.ui.internal.tool.display.ToolManager.setCurre
>>>> ntEditor(ToolManager.java:407)
>>>> 	at
>>>> [ and so on ]
>>>>
>>>> which nicely made appear my tool in the toolbar, but broke every other
>>>> button on the bar, i.e. only my button populated the toolbar. Rather
>>>> aggressive... :)
>>>>
>>>> Since I couldn't figure out why activeModalToolProxy was null at the
>>>> point all this occured, I decided to step over to the menuBuilder and
>>>> create a "normal" Action.
>>>>
>>>> Now I notice that the menubuilder misses the
>>>> protected void makeActions( IWorkbenchWindow window )
>>>> method, which is mandatory to activate and register the actions to the
>>>> workbench.
>>>> Which is the proper way to add my Action, that extends Action and
>>>> implements IAction?
>>>>
>>>> Ciao
>>>> Andrea
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> User-friendly Desktop Internet GIS (uDig)
>>>> http://udig.refractions.net
>>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>>
> 
> 


Back to the top