Obviously the panels instance doesn't contain the value your looking
for so returns null.

Use the debugger again to see what's there.

Unrelated but your code breaks the encapsulation of the model implementation.

org.omg.uml.modelmanagement.Model child=null;
while (it.hasNext()) {
     child = (org.omg.uml.modelmanagement.Model) it.next();
     projectN=Model.getFacade().getName(child);
}

to this

Object child=null;
while (it.hasNext()) {
     child = it.next();
     projectN=Model.getFacade().getName(child);
}

This will set projectN to the name of the last root element.

You may prefer to use Java 5 style for loops rather than a while loop.

Bob.



2008/4/23 Zoran Jeremic <[EMAIL PROTECTED]>:
> Tom,
>
> Sorry, I didn't see the remaining of your previous email. I have tried with
> the debugger to locate the problem.
>
> The problem is in method getPanel in class TabDepthsProps, which accepts
> DepthsPropPanelModel as c and pp cannot be resolved as debugger shows.
>
> public TabModelTarget getPanel(Class c){
>  TabModelTarget pp=panels.get(c);
>  return pp;
>     }
>
> I hope you can get some idea from this.
>
> Zoran
>
>
>
> Zoran Jeremic <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> What I want here is to get some information about
> software solution presented with tab that I have
> created. The same panel DepthsPropPanelModel is used
> in the case of each type of UML diagrams, as well as
> for a model itself. I want to pick information
> presented in UMLTextArea2 fields for a model from
> DepthsPropPanelPackage which is extended by
> DepthsPropPanelModel, as well as model name (the
> second one I have just resolved).
> Here is what have I done so far:
>
> setProjectValues(){
> Collection root=Model.getFacade().getRootElements();
> String projectN=null;
> if (!root.isEmpty()) {
> Iterator it = root.iterator();
> org.omg.uml.modelmanagement.Model
> child=null;
> while (it.hasNext()) {
> child = (org.omg.uml.modelmanagement.Model)
> it.next();
> projectN=Model.getFacade().getName(child);
>
> }
> setProjectName(projectN);
> TabDepthsProps
> solutionTab=(TabDepthsProps)((DetailsPane)
> ProjectBrowser.getInstance().getDetailsPane()).getTab(TabDepthsProps.class);
> LOG.info(" solutionTab test
> "+solutionTab.getTest());
> if (Model.getFacade().isAModel(child)){
> DepthsPropPanelModel
> dppModel=(DepthsPropPanelModel)
> solutionTab.getPanel(DepthsPropPanelModel.class);
> if (dppModel==null){
> LOG.info("tmt is null");
> }
> String desc=dppModel.getDescription();
> }
>
> dppModel.getDescription shoud give me the value that I
> need, but I'm getting an error because dppModel is
> null.
>
> I hope my explanation was better now.
>
> Thanks
> Zoran
>
> = = = Original message = = =
>
> I don't understand how this correlates with the
> problem you mentioned
> before (how to find a field on a prop panel). It
> sounds like an
> entirely different problem.
>
> More comments inline below:
>
> On Wed, Apr 23, 2008 at 5:47 AM, Zoran Jeremic
>
>
> wrote:
>
> > I have 2 different errors in the following method.
> > public void setProjectValues()
> > if
>
> (Model.getFacade().isAModel(TargetManager.getInstance().getTarget()))
> > LOG.info("setProjectValues 1");
>
> > It works if the model is selected, but if I select
> any other element
> i.e. class
> > diagram it generates the following error:
> > Exception in thread "AWT-EventQueue-0"
> java.lang.IllegalArgumentException:
> > Must have an MDR element supplied. Received a
> >
> org.argouml.uml.diagram.static_structure.ui.UMLClassDiagram
>
> Pretty much everything you need to know is in the
> error message.
> Don't pass diagrams to Model subsystem methods!
> TargetManager.getTarget() can return a variety of
> object types,
> depending on what is selected (as you discovered in
> your
> experimentation). You need to check the type of the
> target returned
> before using it and conditionalize your code
> appropriately.
>
> > If I select model it passes but generates the
> following error when I
> try to
> > access the field description in my tab.
> > Here is the error that I get:
> >
> > 33187 INFO [AWT-EventQueue-0] setProjectValues 5
> (Project.java:69)
> > Exception in thread "AWT-EventQueue-0"
> java.lang.NullPointerException
> > at
> depths.ont.project.Project.setProjectValues(Project.java:70)
>
> There's not enough context to tell what code is
> causing this
> exception. Are you using a debugger to debug these
> problems? The
> fact that you've got logging messages inserted every
> line in your code
> makes me suspicious that you are not. Set your
> debugger to break on
> NullPointerExceptions or set a breakpoint just before
> the failing line
> and look at the execution state. It should be obvious
> what the
> problem is.
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification
> software.
> Free download at http://www.ePrompter.com.
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>  ________________________________
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to