use of org.talend.designer.core.ui.editor.nodes.NodePart in project tdi-studio-se by Talend.
the class CreateComponentOnLinkHelper method getConnection.
public static List<Connection> getConnection(SubjobContainerPart containerPart, Point point, Node node) {
List<Connection> connectionList = new ArrayList<Connection>();
List<Connection> connList = new ArrayList<Connection>();
List children = containerPart.getChildren();
for (int i = 0; i < children.size(); i++) {
Object object = children.get(i);
if (object instanceof NodeContainerPart) {
NodeContainerPart nodePart = (NodeContainerPart) object;
Object o = nodePart.getChildren().get(0);
if (o instanceof NodePart) {
List connections = ((NodePart) o).getSourceConnections();
for (int j = 0; j < connections.size(); j++) {
Object connection = connections.get(j);
if (connection instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) connection;
Connection conn = (Connection) connPart.getModel();
if (canCreateNodeOnLink(conn, node)) {
Rectangle bounds = ((ConnectionPart) connection).getFigure().getBounds();
// System.out.println("location:" + point);
if (bounds.contains(point)) {
// System.out.println("bounds:" + bounds);
connectionList.add(conn);
}
if (containsPoint(bounds, point)) {
// System.out.println("contains");
connList.add(conn);
}
}
}
}
}
}
}
if (!connectionList.isEmpty()) {
return connectionList;
} else {
return connList;
}
}
use of org.talend.designer.core.ui.editor.nodes.NodePart in project tdi-studio-se by Talend.
the class SetParallelizationAction method run.
@Override
public void run() {
List editparts = getSelectedObjects();
if (editparts.size() == 1) {
Object o = editparts.get(0);
if (o instanceof NodePart) {
NodePart part = (NodePart) o;
Node node = (Node) part.getModel();
getCommandStack().execute(new SetParallelizationCommand(node));
} else if (o instanceof SubjobContainerPart) {
boolean hasStartNode = false;
List<NodeContainerPart> childNodes = ((SubjobContainerPart) o).getChildren();
for (NodeContainerPart childNode : childNodes) {
NodeContainerPart part = (NodeContainerPart) childNode;
NodeContainer node = (NodeContainer) part.getModel();
if (node.getNode().isStart()) {
hasStartNode = true;
getCommandStack().execute(new SetParallelizationCommand(node.getNode()));
}
}
if (!hasStartNode) {
for (NodeContainerPart childNode : childNodes) {
NodeContainerPart part = (NodeContainerPart) childNode;
NodeContainer node = (NodeContainer) part.getModel();
if (node.getNode().isSubProcessStart()) {
getCommandStack().execute(new SetParallelizationCommand(node.getNode()));
}
}
}
}
}
}
use of org.talend.designer.core.ui.editor.nodes.NodePart in project tdi-studio-se by Talend.
the class SearchComponentAction method run.
@Override
public void run() {
List selection = getSelectedObjects();
Object input = selection.get(0);
if (input instanceof NodePart) {
NodePart part = (NodePart) input;
Node node = (Node) part.getModel();
final String nodeName = node.getComponent().getName();
// System.out.println(nodeName);
ComponentSearcher searcher = new ComponentSearcher(nodeName, getWorkbenchPart().getSite().getShell());
searcher.run();
}
}
use of org.talend.designer.core.ui.editor.nodes.NodePart in project tdi-studio-se by Talend.
the class SearchComponentAction method calculateEnabled.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
*/
@Override
protected boolean calculateEnabled() {
List parts = getSelectedObjects();
if (parts.size() != 1) {
return false;
}
// TESB-17218: Hide for route test case editor
if (PluginUtil.isMediation() || PluginUtil.isRouteTestEditor()) {
return false;
}
Object o = parts.get(0);
if (o instanceof NodePart) {
Node node = (Node) ((NodePart) o).getModel();
if (node.getJobletNode() != null) {
return false;
}
return true;
}
return false;
}
use of org.talend.designer.core.ui.editor.nodes.NodePart in project tdi-studio-se by Talend.
the class SetParallelizationAction method calculateEnabled.
@Override
protected boolean calculateEnabled() {
List parts = getSelectedObjects();
if (parts.isEmpty()) {
return false;
}
if (parts.size() == 1) {
Object o = parts.get(0);
if (o instanceof SubjobContainerPart) {
SubjobContainerPart part = (SubjobContainerPart) o;
SubjobContainer subjob = (SubjobContainer) part.getModel();
if (subjob.getProcess().getComponentsType().equals(ComponentCategory.CATEGORY_4_DI.getName())) {
if (subjob.isDisplayed()) {
return true;
} else {
return false;
}
} else {
return false;
}
} else if (o instanceof NodePart) {
NodePart part = (NodePart) o;
Node node = (Node) part.getModel();
if (node.getProcess().getComponentsType().equals(ComponentCategory.CATEGORY_4_DI.getName())) {
if (node.isStart()) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
return false;
}
Aggregations