[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.tmf] Re: ISemanticModelTransformer and virtual nodes.

I am still get an exception thrown in my VirtualNode. Note my VirtualNode is 
not an Eobjetc, which I think is part of the problem. I am essential trying 
to wrap some EObject sin virtual nodes so that I display other things 
beneath the Virtual nodes that are not EObjects.

java.lang.ClassCastException: com.aleri.ccl.xtext.outline.VirtualNode
at 
org.eclipse.xtext.ui.common.editor.outline.transformer.AbstractSemanticModelTransformer.transformSemanticChildNodes(AbstractSemanticModelTransformer.java:61)

Here is the code..


///////////////
public class VirtualNode
{
 public TopStatements myTop;

   public VirtualNode(TopStatements model)
   {
    myTop = model;
   }
   public String getName()
   {
    return "Folder";
   }
}

/////////////
protected List<EObject> getChildren(VirtualNode semanticNode)
{
   List<EObject> result = new ArrayList<EObject>();
   Iterator <TopStatement> it =semanticNode.myTop.getStmts().iterator();
   while(it.hasNext())
   {
    TopStatement st = it.next();
    if(st instanceof CreateModuleStatement)
    {
     result.add(st);
    }
   }
  //result.addAll( semanticNode.myTop.getStmts());
  return result;

 }
 protected List<VirtualNode> getChildren(TopStatements model) {
    List<VirtualNode> result = new ArrayList<VirtualNode>();
    VirtualNode apples = new VirtualNode(model);

    result.add(apples);
    return result;
  }

"Peter Friese" <peter.friese@xxxxxxxxx> wrote in message 
news:h8u6cm$v95$1@xxxxxxxxxxxxxxxxxxxx
> Drew,
>
> drew frantz wrote on Thu, 17 September 2009 16:24
>> Not quite where are Model and ModelImpl coming from? I am guessing they 
>> somehow impl EObject interface below.
>> >
>
>
> Sorry, I guess in your sample they should be called Root vs. RootImpl. 
> I..e they're the name of the parent class in the meta model.