use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class ShadowProcess method run.
public CsvArray run() throws ProcessorException {
IProcess talendProcess = buildProcess();
IProcessor processor = ProcessorUtilities.getProcessor(talendProcess, null);
processor.setProxyParameters(getProxyParameters());
// try {
// Delete previous Perl generated file
File previousFile = outPath.toFile();
if (previousFile.exists()) {
previousFile.delete();
}
// Process ps = processor.run(process.getContextManager().getDefaultContext(), Processor.NO_STATISTICS,
// Processor.NO_TRACES,Processor.WATCH_ALLOWED);//Old
IContext context = talendProcess.getContextManager().getDefaultContext();
processor.setContext(context);
process = processor.run(IProcessor.NO_STATISTICS, IProcessor.NO_TRACES, null);
ProcessStreamTrashReader.readAndForget(process);
if (!outPath.toFile().exists()) {
//$NON-NLS-1$
throw new ProcessorException(Messages.getString("ShadowProcess.notGeneratedOutputException"));
}
try {
CsvArray array = new CsvArray();
array = array.createFrom(outPath.toFile(), currentProcessEncoding);
return array;
} catch (IOException ioe) {
throw new ProcessorException(ioe);
}
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class MapperManager method removeSelectedAliasInputTable.
public void removeSelectedAliasInputTable() {
InputDataMapTableView currentSelectedDataMapTableView = uiManager.getCurrentSelectedInputTableView();
if (currentSelectedDataMapTableView != null) {
String tableName = currentSelectedDataMapTableView.getDataMapTable().getName();
if (MessageDialog.openConfirm(currentSelectedDataMapTableView.getShell(), //$NON-NLS-1$
Messages.getString("MapperManager.removeInputTableTitle"), Messages.getString("MapperManager.removeInputTableTitleMessage", new Object[] { tableName }))) {
//$NON-NLS-1$
IProcess process = mapperComponent.getProcess();
uiManager.removeInputTableView(currentSelectedDataMapTableView);
uiManager.updateToolbarButtonsStates(Zone.INPUTS);
process.removeUniqueConnectionName(currentSelectedDataMapTableView.getDataMapTable().getName());
uiManager.refreshSqlExpression();
}
}
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class GEFDeleteAction method createDeleteCommand.
@Override
public Command createDeleteCommand(List objects) {
objects = filterSameObject(objectsToDelete);
if (objects.isEmpty()) {
return null;
}
if (!(objects.get(0) instanceof EditPart)) {
return null;
}
EditPart object = (EditPart) objects.get(0);
// for TUP-1015
boolean isConnAttachedJLTriggerComp = false;
ConnectionPart connectionPart = null;
if (object instanceof ConnectionPart) {
connectionPart = (ConnectionPart) object;
} else if (object instanceof ConnLabelEditPart) {
connectionPart = (ConnectionPart) object.getParent();
}
if (connectionPart != null) {
Node srcNode = null;
Object srcModel = connectionPart.getSource().getModel();
if (srcModel instanceof Node) {
srcNode = (Node) srcModel;
}
Node tarNode = null;
Object tarModel = connectionPart.getTarget().getModel();
if (tarModel instanceof Node) {
tarNode = (Node) tarModel;
}
if (srcNode == null || tarNode == null) {
return null;
}
IProcess process = srcNode.getProcess();
if (AbstractProcessProvider.isExtensionProcessForJoblet(process)) {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
if (service != null && (service.isTriggerNode(srcNode) || service.isTriggerNode(tarNode))) {
isConnAttachedJLTriggerComp = true;
}
}
}
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
String preKey = TalendDesignerPrefConstants.NOT_SHOW_WARNING_WHEN_DELETE_LINK_WITH_JOBLETTRIGGERLINKCOMPONENT;
if (isConnAttachedJLTriggerComp && !preferenceStore.getBoolean(preKey)) {
MessageDialogWithToggle jlTriggerConfirmDialog = new MessageDialogWithToggle(null, //$NON-NLS-1$
Messages.getString("GEFDeleteAction.deleteConnectionDialog.title"), // accept the default window icon
null, Messages.getString("GEFDeleteAction.deleteConnectionDialog.msg"), MessageDialog.WARNING, new String[] { //$NON-NLS-1$
IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, //$NON-NLS-1$
Messages.getString("GEFDeleteAction.deleteConnectionDialog.toggleMsg"), preferenceStore.getDefaultBoolean(preKey));
jlTriggerConfirmDialog.setPrefStore(preferenceStore);
jlTriggerConfirmDialog.setPrefKey(preKey);
if (jlTriggerConfirmDialog.open() != IDialogConstants.YES_ID) {
return null;
}
preferenceStore.setValue(preKey, jlTriggerConfirmDialog.getToggleState());
}
List nodeParts = new ArrayList();
List noteParts = new ArrayList();
List others = new ArrayList(objects);
for (Object o : objects) {
if (o instanceof NodePart) {
others.remove(o);
Node model = (Node) ((NodePart) o).getModel();
if (model.getJobletNode() != null) {
continue;
}
if (model.getJunitNode() != null) {
continue;
}
nodeParts.add(o);
} else if (o instanceof NoteEditPart) {
noteParts.add(o);
others.remove(o);
} else if (o instanceof SubjobContainerPart) {
others.remove(o);
SubjobContainerPart subjob = (SubjobContainerPart) o;
for (Iterator iterator = subjob.getChildren().iterator(); iterator.hasNext(); ) {
NodeContainerPart nodeContainerPart = (NodeContainerPart) iterator.next();
if (nodeContainerPart instanceof JobletContainerPart) {
JobletContainer jobletCon = (JobletContainer) ((JobletContainerPart) nodeContainerPart).getModel();
JobletContainerFigure jobletFigure = (JobletContainerFigure) ((JobletContainerPart) nodeContainerPart).getFigure();
if (!jobletCon.isCollapsed()) {
jobletFigure.doCollapse();
}
}
NodePart nodePart = nodeContainerPart.getNodePart();
if (nodePart != null) {
Node model = (Node) nodePart.getModel();
if (model.getJunitNode() != null) {
continue;
}
nodeParts.add(nodePart);
}
}
}
}
if (others.size() == 0) {
// so notes & nodes only
CompoundCommand cpdCmd = new CompoundCommand();
//$NON-NLS-1$
cpdCmd.setLabel(Messages.getString("GEFDeleteAction.DeleteItems"));
if (nodeParts.size() != 0) {
GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE);
deleteReq.setEditParts(nodeParts);
cpdCmd.add(((NodePart) nodeParts.get(0)).getCommand(deleteReq));
}
if (noteParts.size() != 0) {
GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE);
deleteReq.setEditParts(noteParts);
cpdCmd.add(((NoteEditPart) noteParts.get(0)).getCommand(deleteReq));
}
return cpdCmd;
} else {
GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE);
deleteReq.setEditParts(objects);
Command cmd = object.getCommand(deleteReq);
return cmd;
}
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class HTMLDocGenerator method seperateNodes.
/**
* This method is used for seperating all nodes into internal and external.
*
* @param item
* @return
*/
protected List<List> seperateNodes(Item item) {
List<INode> internalNodeComponentList = new ArrayList<INode>();
List<INode> externalNodeComponentList = new ArrayList<INode>();
List<INode> allNodeComponentList = new ArrayList<INode>();
List<List> componentsList = new ArrayList<List>();
IProcess process = null;
boolean isJobletProcessItem = item instanceof JobletProcessItem;
boolean isProcessItem = item instanceof ProcessItem;
if (isProcessItem) {
process = CorePlugin.getDefault().getDesignerCoreService().getProcessFromProcessItem((ProcessItem) item, true);
}
// }
if (process == null) {
return componentsList;
}
List<INode> graphicalNodeList = (List<INode>) process.getGraphicalNodes();
for (INode node : graphicalNodeList) {
// If component is not activate, do not need to get it's information
if (!node.isActivate()) {
continue;
}
allNodeComponentList.add(node);
if (node.getExternalNode() != null) {
externalNodeComponentList.add(node);
} else {
internalNodeComponentList.add(node);
}
}
// Sorts the component list in alpha-order.
Comparator comparator = getComparator();
Collections.sort(allNodeComponentList, comparator);
Collections.sort(internalNodeComponentList, comparator);
Collections.sort(externalNodeComponentList, comparator);
componentsList.add(allNodeComponentList);
componentsList.add(internalNodeComponentList);
componentsList.add(externalNodeComponentList);
if (process instanceof IProcess2) {
((IProcess2) process).dispose();
}
return componentsList;
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class UIManager method refreshVisualMapImage.
private void refreshVisualMapImage() {
AbstractMapComponent mapCom = mapperManager.getAbstractMapComponent();
if (mapCom == null) {
return;
}
INode component = mapCom.getOriginalNode();
if (component != null && component.getExternalNode() != null && component.getExternalNode().getScreenshot() != null) {
byte[] saveImageToData = ImageUtils.saveImageToData(component.getExternalNode().getScreenshot());
IProcess process = component.getProcess();
if (process instanceof IProcess2) {
IProcess2 processtmp = (IProcess2) process;
Item item = processtmp.getProperty().getItem();
if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
processItem.getProcess().getScreenshots().put(component.getUniqueName(), saveImageToData);
} else if (item instanceof JobletProcessItem) {
JobletProcessItem jobletItem = (JobletProcessItem) item;
jobletItem.getJobletProcess().getScreenshots().put(component.getUniqueName(), saveImageToData);
}
}
}
}
Aggregations