use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.
the class ConnTextMovePolicy method getMoveCommand.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.gef.editpolicies.NonResizableEditPolicy#getMoveCommand(org.eclipse.gef.requests.ChangeBoundsRequest)
*/
public Command getMoveCommand(ChangeBoundsRequest request) {
if (((Connection) getHost().getParent().getModel()).isReadOnly()) {
return null;
}
if (getHost().getModel() instanceof ConnectionTrace) {
ConnectionTrace model = (ConnectionTrace) getHost().getModel();
Point delta = request.getMoveDelta();
ConnectionPart edge = (ConnectionPart) getHost().getParent();
MoveConnTraceCommand command = new MoveConnTraceCommand(model, (Figure) edge.getFigure(), delta);
return command;
} else if (getHost().getModel() instanceof ConnectionLabel) {
ConnectionLabel model = (ConnectionLabel) getHost().getModel();
Point delta = request.getMoveDelta();
ConnectionPart edge = (ConnectionPart) getHost().getParent();
List<Element> elements = edge.getModelChildren();
for (Element e : elements) {
if (e instanceof ConnectionResuming) {
MoveConnTextCommand command = new MoveConnTextCommand(model, (ConnectionResuming) e, (Figure) edge.getFigure(), delta);
return command;
}
}
MoveConnTextCommand command = new MoveConnTextCommand(model, null, (Figure) edge.getFigure(), delta);
return command;
}
return null;
}
use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.
the class ConnectionPart method getModelChildren.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
*/
@Override
protected List getModelChildren() {
List<Element> elements;
elements = new ArrayList<Element>();
elements.add(((Connection) getModel()).getConnectionLabel());
elements.add(((Connection) getModel()).getPerformance());
if (((Connection) getModel()).getResuming() != null) {
elements.add(((Connection) getModel()).getResuming());
}
boolean monitorSupport = true;
if (getParent() != null && getRoot() != null) {
EditPart contents = getRoot().getContents();
if (contents.getModel() instanceof IProcess) {
IProcess currentProcess = (IProcess) contents.getModel();
if (ComponentCategory.CATEGORY_4_MAPREDUCE.getName().endsWith(currentProcess.getComponentsType())) {
monitorSupport = false;
}
}
} else {
IProcess currentProcess = ((Connection) getModel()).getSource().getProcess();
if (ComponentCategory.CATEGORY_4_MAPREDUCE.getName().endsWith(currentProcess.getComponentsType())) {
monitorSupport = false;
}
}
if (monitorSupport) {
if (((Connection) getModel()).getConnectionTrace() != null) {
elements.add(((Connection) getModel()).getConnectionTrace());
}
// Add monitor label
if (((Connection) getModel()).isMonitorConnection()) {
elements.add(((Connection) getModel()).getMonitorLabel());
}
}
return elements;
}
use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.
the class DesignerCoreService method refreshComponentView.
@Override
public void refreshComponentView() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewPart view = page.findView(ComponentSettingsView.ID);
if (view == null) {
// don't do anything. before it made the view appear for nothing even in other product like DQ.
return;
}
if (view != null && view instanceof ComponentSettingsView) {
ComponentSettingsView settingView = (ComponentSettingsView) view;
Element element = settingView.getElement();
if (element != null) {
settingView.cleanDisplay();
settingView.setElement(element);
}
}
List<ComponentSettingsView> otherViews = JobTemplateViewsAndProcessUtil.getInstance().getAllViews();
if (otherViews == null || otherViews.isEmpty()) {
return;
}
for (ComponentSettingsView v : otherViews) {
if (v.getParent() != null && !v.getParent().isDisposed()) {
Element elem = v.getElement();
if (elem != null) {
v.cleanDisplay();
v.setElement(elem);
}
}
}
}
use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.
the class JobletUtil method getModifyMap.
public Map<String, List<AbstractJobletContainer>> getModifyMap(List<Element> elem) {
Map<String, List<AbstractJobletContainer>> jobletNodeMap = new HashMap<String, List<AbstractJobletContainer>>();
for (Element element : elem) {
if (element instanceof SubjobContainer) {
for (NodeContainer container : ((SubjobContainer) element).getNodeContainers()) {
if (container instanceof AbstractJobletContainer) {
String processID = container.getNode().getProcess().getId();
if (!jobletNodeMap.containsKey(processID)) {
List<AbstractJobletContainer> nodeList = new ArrayList<AbstractJobletContainer>();
nodeList.add((AbstractJobletContainer) container);
jobletNodeMap.put(processID, nodeList);
} else {
jobletNodeMap.get(processID).add((AbstractJobletContainer) container);
}
}
}
}
}
return jobletNodeMap;
}
use of org.talend.core.model.process.Element in project tdi-studio-se by Talend.
the class ElementParameter2ParameterType method saveElementParameters.
/**
* save the EMF Model's parameters to Element
*
* @param elem
* @param pType
*/
public static void saveElementParameters(Element elem, ParametersType pType) {
EList<ElementParameterType> listParamType = pType.getElementParameter();
listParamType.clear();
Element defaultElement = getDefaultElement(pType);
List<? extends IElementParameter> paramList = elem.getElementParametersWithChildrens();
for (IElementParameter param : paramList) {
ElementParameterType type = getElemeterParameterType(param);
IElementParameter defalutParam = defaultElement.getElementParameter(type.getName());
if (defalutParam != null) {
listParamType.add(type);
}
}
}
Aggregations