deleting a custom resource ...

Development of custom GMAT plugins

deleting a custom resource ...

Postby marchand » Wed Jul 03, 2013 7:22 pm

I've noticed this problem in several plugins, though not all, so I'm curious to know if it's a problem with the plugin source, or if some edits are necessary in the GMAT gui code. The problem is easily duplicated. Edit your startup file and make sure either the DataInterface or Estimation plugins are loaded at startup. Now, if you start GMAT, and navigate to the appropriate folder in the resource tree (say Interfaces), create a new resource (like FileInterface). Now, you should see the newly created resource appear under that folder. Next, right-click on that object and select Delete. You'll get this error:

Code: Select all
**** INTERNAL ERROR **** ResourceTree::GetObjectType() unknown item type: 41750


Now, as I said, not all plugins have this problem. For example, the Formation plugin works just fine, so does the VF13 plugin, and the SQPFmincon plugin. That is to say I can create the corresponding resources and readily delete them whenever I want by right-clicking on the object and selecting delete. I had asked this question previously, using the Estimation plugin as an example, and the answer then was that the Estimation plugin was "alpha" and the development was never completed. Now, clearly the problem also affects the DataInterface plugin, which is a more recent development, so it's not just an isolated incident anymore :^)

If I'm creating my own resource, what determines whether or not I am graphically able to delete the resource? Is it something in the plug-in code? The gui source? both? Any specific methods that control this?
marchand
 
Posts: 86
Joined: Tue Feb 21, 2012 2:42 pm

Re: deleting a custom resource ...

Postby marchand » Wed Jul 03, 2013 8:05 pm

Along those lines, I noticed that I can select "Clone" on the Fileinterface object that is created, and it does in fact create a clone. However, no pop-up menu is available on any of the clones. The menu only shows up on the original item.
marchand
 
Posts: 86
Joined: Tue Feb 21, 2012 2:42 pm

Re: deleting a custom resource ...

Postby marchand » Mon Jul 08, 2013 5:12 pm

Well, it looks like I just answered my own question. When you first add the object to the resource tree, if that object belongs to a GMAT plugin then the ResourceTree::OnAddUserObject method is invoked.
Code: Select all
   EVT_MENU_RANGE(POPUP_ADD_PLUGIN + PLUGIN_BEGIN,        // Plugin objects
                  POPUP_ADD_PLUGIN + PLUGIN_END, ResourceTree::OnAddUserObject)


In that method, you'll see the following line:

Code: Select all
  AppendItem(item, name, iconToUse, -1,
        new GmatTreeItemData(name, GmatTree::USER_DEFINED_OBJECT));


Basically, this line suggests that - currently - any tree item that is part of a plug-in gets labeled as a GmatTree::USER_DEFINED_OBJECT type. How does that affect the inability to delete custom objects? Well, as I said, every time you try to delete an object the ResourceTree::GetObjectType method is called. That method has a case statement that is based on the GmatTree object type. Since there is no case for GmatTree::USER_DEFINED_OBJECT, thus the default action is applied:
Code: Select all
   default:
      objType = Gmat::UNKNOWN_OBJECT;
      MessageInterface::ShowMessage
         ("**** INTERNAL ERROR **** ResourceTree::GetObjectType() unknown item type: %d\n",
          itemType);
      break;
   }


I was able to confirm I can delete the object if there is a case for USER_DEFINED_OBJECT and I assign a type to that object, like Gmat::INTERFACE in my case. Of course, that's not a fix because a GmatTree::USER_DEFINED_OBJECT could potentially be of any Gmat type, like Gmat::INTERFACE, or GMAT::SOLVER, etc.
marchand
 
Posts: 86
Joined: Tue Feb 21, 2012 2:42 pm

Re: deleting a custom resource ...

Postby marchand » Mon Jul 08, 2013 5:16 pm

It is worth noting also that though adding a case to the ResourceTree::GetObjectType method fixes the delete problem, it does not address the missing pop-up menu on any of the object clone's the user might create via the GUI.
marchand
 
Posts: 86
Joined: Tue Feb 21, 2012 2:42 pm

Re: deleting a custom resource ...

Postby jjkparker » Mon Jul 08, 2013 11:57 pm

I can't reply to any of the code-related issues, except to say that the Delete issue with FileInterface you noted is a legitimate bug. I saw some commits come through today to the SourceForge repo that address this; maybe those will be of help.

I don't see the "no pop-up menu" issue though; note that if any windows are open, we disable *some* of the right-click menu (like Delete) because we haven't come up with a way of rigorously making sure that works. If you see this issue more, can you submit a ticket to JIRA about it?
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker
 
Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Re: deleting a custom resource ...

Postby marchand » Sat Aug 10, 2013 1:34 am

I forgot to respond, after you noted the fixes posted, I tired them out and that did seem to fix the problems.
marchand
 
Posts: 86
Joined: Tue Feb 21, 2012 2:42 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron