blob: bb4a918ec8d6d190c35b302c44c46c5e75c5cd10 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/**
* Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andre Dietisheim - initial API and implementation
*/
package org.eclipse.emf.cdo.ui.internal.branch.item;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.draw2d.IFigure;
import org.eclipse.zest.core.widgets.GraphNode;
import org.eclipse.zest.core.widgets.IContainer;
import java.util.ArrayList;
import java.util.List;
/**
* A node that holds a branch point. It may be connected to a further (single) BranchPointNode by a NewBranchConnection
* to a node in a sub-branch. It may also be connected to a node in the same branch by a SameBranchConnection.
*
* @author Andre Dietisheim
* @see SameBranchConnection
* @see NewBranchConnection
*/
public class BranchPointNode extends AbstractBranchPointNode
{
public BranchPointNode(CDOBranchPoint branchPoint, IContainer graphModel, int style, IFigure figure)
{
super(branchPoint, graphModel, style, figure);
}
public AbstractBranchPointNode getNextOnNewBranch()
{
List<NewBranchConnection> connectionList = getNewBranchSourceConnections();
if (connectionList.size() >= 1)
{
NewBranchConnection connection = connectionList.get(0);
GraphNode node = connection.getDestination();
return (AbstractBranchPointNode)node;
}
return null;
}
public List<NewBranchConnection> getNewBranchSourceConnections()
{
List<NewBranchConnection> connectionList = new ArrayList<NewBranchConnection>();
for (Object sourceConnection : getSourceConnections())
{
if (sourceConnection instanceof NewBranchConnection)
{
connectionList.add((NewBranchConnection)sourceConnection);
}
}
return connectionList;
}
}
|