addCommand seems to cause explorer exception
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Thilo_Rusche
Posted On:   Thursday, October 28, 2004 09:59 AM

I am adding a command to the entities in the usage list of an extension swiftlet with the addCommand method. This is working fine, but when I try to execute the "Show Entity Table..." command on the usage list, the explorer throws a NullPointerException (see below).The offending method call looks like this: EntityList m_UsageList = (EntityList)m_Config.getEntity(ENTITY_USAGE); m_UsageList.addCommand("Unbind", new Command ("unbind", "Unbind", "Unbind this session", true, new UnbindExecutor( this ), true, true )); UnbindExecutor is a simple implementation of the CommandExecutor interface. Any ideas? Please let me know if you    More>>


I am adding a command to the entities in the usage list of an extension swiftlet with the addCommand method. This is working fine, but when I try to execute the "Show Entity Table..." command on the usage list, the explorer throws a NullPointerException (see below).The offending method call looks like this:

			
EntityList m_UsageList = (EntityList)m_Config.getEntity(ENTITY_USAGE);
m_UsageList.addCommand("Unbind", new Command ("unbind", "Unbind", "Unbind this session", true,
new UnbindExecutor( this ), true, true
));


UnbindExecutor is a simple implementation of the CommandExecutor interface.


Any ideas? Please let me know if you require the complete code. Thanks!



			
java.lang.NullPointerException
at javax.swing.ImageIcon. (ImageIcon.java:138)
at com.swiftmq.admin.explorer.EntityTableFrame.createActions(Unknown Source)
at com.swiftmq.admin.explorer.EntityTableFrame.setVisible(Unknown Source)
at com.swiftmq.tools.multiframe.JFrameResourceProxy.setVisible(Unknown Source)
at com.swiftmq.tools.multiframe.MainFrame.addResource(Unknown Source)
at com.swiftmq.admin.explorer.navigator.EntityListNavigatorNode.executeMenuCommand(Unknown Source)
at com.swiftmq.tools.multiframe.NavigatorFrame$3.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
at com.sun.java.swing.plaf.motif.MotifMenuItemUI$MouseInputHandler.mouseReleased(MotifMenuItemUI.java:87)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
   <<Less

Re: addCommand seems to cause explorer exception

Posted By:   Andreas_Mueller  
Posted On:   Friday, October 29, 2004 02:00 AM

Well, that's a bit tricky ;-).


Why don't you just set the entity remove listener? It gets called when the entity is being removed and you are able to vote against deletion by throwing an EntityRemoveException. Everything is automatically then. Here is how it works:


m_UsageList.setEntityRemoveListener(new EntityRemoveListener()
{
public void onEntityRemove(Entity parent, Entity delEntity) throws EntityRemoveException
{
// you code here
}
});
About | Sitemap | Contact