use of org.talend.designer.core.ui.editor.cmd.CreateNoteCommand in project tdi-studio-se by Talend.
the class SubjobContainerLayoutEditPolicy method getCreateCommand.
// ------------------------------------------------------------------------
// Abstract methods from LayoutEditPolicy
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
*/
protected Command getCreateCommand(final CreateRequest request) {
if (((SubjobContainer) getHost().getModel()).isReadOnly()) {
return null;
}
Rectangle constraint = (Rectangle) getConstraintFor(request);
Process linkedProcess = (Process) ((SubjobContainer) getHost().getModel()).getProcess();
Command command = null;
if (Note.class.equals(request.getNewObjectType())) {
command = new CreateNoteCommand(linkedProcess, (Note) request.getNewObject(), constraint.getLocation());
} else if (request.getNewObject() instanceof Node) {
Node node = (Node) request.getNewObject();
NodeContainer nodeContainer = ((Process) node.getProcess()).loadNodeContainer(node, false);
command = new CreateNodeContainerCommand(linkedProcess, nodeContainer, constraint.getLocation());
}
return command;
}
use of org.talend.designer.core.ui.editor.cmd.CreateNoteCommand in project tdi-studio-se by Talend.
the class ProcessLayoutEditPolicy method getCreateCommand.
// ------------------------------------------------------------------------
// Abstract methods from LayoutEditPolicy
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
*/
@Override
protected Command getCreateCommand(final CreateRequest request) {
if (((Process) getHost().getModel()).isReadOnly()) {
return null;
}
Rectangle constraint = (Rectangle) getConstraintFor(request);
Command command = null;
if (Note.class.equals(request.getNewObjectType())) {
command = new CreateNoteCommand((Process) getHost().getModel(), (Note) request.getNewObject(), constraint.getLocation());
} else if (request.getNewObject() instanceof Node) {
Node node = (Node) request.getNewObject();
NodeContainer nodeContainer = ((Process) node.getProcess()).loadNodeContainer(node, false);
command = new CreateNodeContainerCommand((Process) getHost().getModel(), nodeContainer, constraint.getLocation());
}
return command;
}
use of org.talend.designer.core.ui.editor.cmd.CreateNoteCommand in project tdi-studio-se by Talend.
the class JobletContainerLayoutEditPolicy method getCreateCommand.
@Override
protected Command getCreateCommand(CreateRequest request) {
Rectangle constraint = (Rectangle) getConstraintFor(request);
Process linkedProcess = (Process) ((JobletContainer) getHost().getModel()).getNode().getProcess();
Command command = null;
if (Note.class.equals(request.getNewObjectType())) {
command = new CreateNoteCommand(linkedProcess, (Note) request.getNewObject(), constraint.getLocation());
} else if (request.getNewObject() instanceof Node) {
Node node = (Node) request.getNewObject();
NodeContainer nodeContainer = ((Process) node.getProcess()).loadNodeContainer(node, false);
command = new CreateNodeContainerCommand(linkedProcess, nodeContainer, constraint.getLocation());
}
return command;
}
Aggregations