Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [gef-dev] gef4 removing nodes from a graph does not refresh the viewer

Hi Arne, 

can you please ask this (again) in the forum (http://www.eclipse.org/forums/index.php?t=thread&frm_id=81)? It’s the appropriate place where we can further investigate your problem. 

"Technical questions and discussions about using GEF should be posted to the newsgroups. Mailing lists at eclipse.org are intended for use by developers actually working on or otherwise contributing to day-to-day development. The development mailing lists are the way design and implementation issues are discussed and decisions voted on by the committers."

Cheers
Alexander

Am 09.01.2016 um 07:08 schrieb Arne.Adams@xxxxxxxxxxx:

Hi,

I have a adapted the CustomNodeExample to provide context menu for a graph.

I observer, that the graph won't get refreshed, if I only remove nodes and edges, however if I add a node, the graph view does get refreshed.

Here is the code, that changes the contents of the graph

  private static NodeContextMenuEntry includes(Scope scope)
  {
    return new NodeContextMenuEntry("show includes", "hide includes")
    {
      @Override
      protected void offAction(Graph graph, Node scopeNode)
      {
        WorkflowScopeNodeModel scopeNodeModel = (WorkflowScopeNodeModel) NodeModel.get(scopeNode);
        List<Node> nodes = graph.getNodes();
        ListIterator<Node> nodeIter = nodes.listIterator();
        Node hack = null;
        while (nodeIter.hasNext())
        {
          Node n = nodeIter.next();
          if (scopeNodeModel.includeNodes.contains(n))
          {
            hack = n;
            nodeIter.remove();
          }
        }
        ListIterator<Edge> edgeIter = graph.getEdges().listIterator();
        while (edgeIter.hasNext())
        {
          Edge e = edgeIter.next();
          if (scopeNodeModel.includeEdges.contains(e))
          {
            edgeIter.remove();
          }
        }
        // this is a hack - I have no idea, why removing does not update the graph whereas adding does.
        if(null != hack)
        {nodes.add(hack);nodes.remove(hack);}
      }

      @Override
      protected void onAction(Graph graph, Node scopeNode)
      {
        WorkflowScopeNodeModel scopeNodeModel = (WorkflowScopeNodeModel) NodeModel.get(scopeNode);
        List<Node> nodes = graph.getNodes();
        for (Node n : scopeNodeModel.includeNodes)
        {
          nodes.add(n);
        }
        List<Edge> edges = graph.getEdges();
        for (Edge e : scopeNodeModel.includeEdges)
        {
          edges.add(e);
        }
      }
    };
  }

 

If you cannot reproduce the behaviour, I'll post a more complete example.

 

Cheers,

Arne

 
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/gef-dev

--
Dr. Alexander Nyßen
Dipl.-Inform.
Principal Engineer

Telefon: +49 (0) 231 / 98 60-202
Telefax: +49 (0) 231 / 98 60-211
Mobil: +49 (0) 151 /  17396743

http://www.itemis.de 
alexander.nyssen@xxxxxxxxx 

itemis AG
Am Brambusch 15-24
44536 Lünen

Rechtlicher Hinweis:

Amtsgericht Dortmund, HRB 20621

Vorstand: Jens Wagener (Vors.), Wolfgang Neuhaus, Dr. Georg Pietrek, Jens Trompeter, Sebastian Neus

Aufsichtsrat: Prof. Dr. Burkhard Igel (Vors.), Michael Neuhaus, Jennifer Fiorentino



Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


Back to the top