Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » gef4 removing nodes from a graph does not refresh the viewer (gef4 removing nodes from a graph does not refresh the viewer )
gef4 removing nodes from a graph does not refresh the viewer [message #1719588] Sat, 09 January 2016 10:32 Go to next message
Arne Adams is currently offline Arne AdamsFriend
Messages: 2
Registered: January 2016
Junior Member
Hi,
I have a adapted the CustomNodeExample to provide context menu for a graph.

I observe, 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
Re: gef4 removing nodes from a graph does not refresh the viewer [message #1719733 is a reply to message #1719588] Mon, 11 January 2016 17:53 Go to previous message
Alexander Nyssen is currently offline Alexander NyssenFriend
Messages: 235
Registered: July 2009
Location: L√ľnen
Senior Member
Could you provide a standalone example that helps us to reproduce this? Best would be a test case or a patch for the CustomNodeExample with which the issue can be reproduced. Please open a bugzilla and attach the information that may help us to reproduce the issue.

[Updated on: Mon, 11 January 2016 17:53]

Report message to a moderator

Previous Topic:[GEF4] Add node to graph generate UnsupportedOperationException
Next Topic:NPE when a new non empty graph is set in a ZestFxUiView
Goto Forum:
  


Current Time: Mon Sep 24 09:42:28 GMT 2018

Powered by FUDForum. Page generated in 0.01662 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top