use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.
the class ComponentChooseDialog method createQuery.
private void createQuery(Object dragModel, EditPart targetEditPart) {
if (!(dragModel instanceof RepositoryNode && targetEditPart instanceof NodeContainerPart)) {
return;
}
RepositoryNode dragNode = (RepositoryNode) dragModel;
NodeContainerPart nodePart = (NodeContainerPart) targetEditPart;
if (dragNode.getObject().getProperty().getItem() instanceof ConnectionItem) {
ConnectionItem connectionItem = (ConnectionItem) dragNode.getObject().getProperty().getItem();
Command command = getChangeQueryCommand(dragNode, (Node) nodePart.getNodePart().getModel(), connectionItem);
if (command != null) {
execCommandStack(command);
}
}
}
use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.
the class CreateComponentOnLinkHelper method unselectAllConnections.
public static void unselectAllConnections(SubjobContainerPart containerPart) {
List children = containerPart.getChildren();
for (int i = 0; i < children.size(); i++) {
Object object = children.get(i);
if (object instanceof NodeContainerPart) {
NodeContainerPart nodeContainerPart = (NodeContainerPart) object;
Object nodePart = nodeContainerPart.getChildren().get(0);
if (nodePart instanceof NodePart) {
List sourceConnections = ((NodePart) nodePart).getSourceConnections();
for (int j = 0; j < sourceConnections.size(); j++) {
Object connectionPart = sourceConnections.get(j);
if (connectionPart instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) connectionPart;
org.talend.designer.core.ui.editor.connections.Connection conn = (org.talend.designer.core.ui.editor.connections.Connection) connPart.getModel();
ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
if (fig.getLineWidth() != 1) {
fig.setLineWidth(1);
connPart.refresh();
}
}
}
}
}
}
}
use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.
the class CreateComponentOnLinkHelper method getConnectionParts.
public static List<ConnectionPart> getConnectionParts(ProcessPart processPart, Point point, Node node) {
List<ConnectionPart> connectionParts = new ArrayList<ConnectionPart>();
for (Object child : processPart.getChildren()) {
if (child instanceof SubjobContainerPart) {
SubjobContainerPart subJobPart = (SubjobContainerPart) child;
for (Object sChilde : subJobPart.getChildren()) {
if (sChilde instanceof NodeContainerPart) {
NodeContainerPart nodeCPart = (NodeContainerPart) sChilde;
for (Object nChild : nodeCPart.getChildren()) {
if (nChild instanceof NodePart) {
for (Object conn : ((NodePart) nChild).getTargetConnections()) {
if (conn instanceof ConnectionPart && canCreateNodeOnLink((Connection) ((ConnectionPart) conn).getModel(), node)) {
ConnectionPart connPart = (ConnectionPart) conn;
// if (connPart.getFigure() != null &&
// connPart.getFigure().getBounds().contains(point)) {
connectionParts.add((ConnectionPart) conn);
// }
}
}
}
}
}
}
}
}
return connectionParts;
}
use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.
the class CreateComponentOnLinkHelper method selectConnection.
public static void selectConnection(Connection connection, SubjobContainerPart containerPart) {
List children = containerPart.getChildren();
for (int i = 0; i < children.size(); i++) {
Object object = children.get(i);
if (object instanceof NodeContainerPart) {
NodeContainerPart nodeContainerPart = (NodeContainerPart) object;
Object nodePart = nodeContainerPart.getChildren().get(0);
if (nodePart instanceof NodePart) {
List sourceConnections = ((NodePart) nodePart).getSourceConnections();
for (int j = 0; j < sourceConnections.size(); j++) {
Object connectionPart = sourceConnections.get(j);
if (connectionPart instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) connectionPart;
org.talend.designer.core.ui.editor.connections.Connection conn = (org.talend.designer.core.ui.editor.connections.Connection) connPart.getModel();
if (conn.equals(connection)) {
ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
if (fig.getLineWidth() != 2) {
fig.setLineWidth(2);
connPart.refresh();
}
} else {
ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
if (fig.getLineWidth() != 1) {
fig.setLineWidth(1);
connPart.refresh();
}
}
}
}
}
}
}
}
use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tesb-studio-se by Talend.
the class CamelEditorDropTargetListener method handleDrop.
@Override
protected void handleDrop() {
if (!checkSelectionSource()) {
return;
}
updateTargetRequest();
updateTargetEditPart();
if (selectSourceList.get(0) instanceof PaletteEditPart && getTargetRequest() instanceof CreateRequest) {
if (getTargetEditPart() instanceof ProcessPart) {
Object newObject = ((CreateRequest) getTargetRequest()).getNewObject();
if (newObject != null) {
Command command = getCommand();
if (command != null) {
execCommandStack(command);
}
}
}
return;
}
if (isContextSource) {
createContext();
} else {
if (!(getTargetEditPart() instanceof NodeContainerPart)) {
try {
createNewComponent(getCurrentEvent());
} catch (OperationCanceledException e) {
return;
}
}
}
// in case after drag/drop the editor is dirty but can not get focus
if (editor.isDirty()) {
editor.setFocus();
}
this.eraseTargetFeedback();
}
Aggregations