use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class DesignerCoreService method refreshComponentView.
@Override
public void refreshComponentView(Item item) {
try {
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
IEditorReference[] editors = activePage.getEditorReferences();
for (IEditorReference er : editors) {
IEditorPart part = er.getEditor(false);
if (part instanceof AbstractMultiPageTalendEditor) {
AbstractMultiPageTalendEditor editor = (AbstractMultiPageTalendEditor) part;
CommandStack stack = (CommandStack) editor.getTalendEditor().getAdapter(CommandStack.class);
if (stack != null) {
IProcess process = editor.getProcess();
for (final INode processNode : process.getGraphicalNodes()) {
if (processNode instanceof Node) {
checkRepository((Node) processNode, item, stack);
}
}
}
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class UpdateNodeParameterCommand method execute.
@Override
public void execute() {
if (result == null) {
return;
}
Object updateObject = result.getUpdateObject();
if (updateObject == null || (!(updateObject instanceof Node)) || (!(result.getJob() instanceof IProcess))) {
return;
}
// instance of node before might not be good (loaded while check updates needed)
// so get the instance of the node of the current job in this object.
IProcess process = (IProcess) result.getJob();
for (INode node : process.getGraphicalNodes()) {
if (node.getUniqueName().equals(((Node) updateObject).getUniqueName())) {
updateObject = node;
result.setUpdateObject(updateObject);
break;
}
}
IUpdateItemType updateType = result.getUpdateType();
if (updateType instanceof EUpdateItemType) {
switch((EUpdateItemType) updateType) {
case NODE_PROPERTY:
updateProperty();
break;
case NODE_SCHEMA:
updateSchema();
break;
case NODE_QUERY:
updateQuery();
break;
case NODE_SAP_FUNCTION:
updateSAPParameters();
break;
case NODE_SAP_IDOC:
updateSAPIDocParameters();
break;
case NODE_VALIDATION_RULE:
updateValidationRule();
break;
default:
return;
}
}
// else { // for extension
Node node = (Node) updateObject;
if (node.getProcess() instanceof IProcess2) {
PropertyChangeCommand pcc = new PropertyChangeCommand(node, EParameterName.UPDATE_COMPONENTS.getName(), Boolean.TRUE);
boolean executed = false;
if (process instanceof IGEFProcess) {
IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
if (designerCoreUIService != null) {
executed = designerCoreUIService.executeCommand((IGEFProcess) process, pcc);
}
}
if (!executed) {
pcc.execute();
}
}
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class DbGenerationManager method getContextList.
protected List<String> getContextList(DbMapComponent component) {
List<String> contextList = new ArrayList<String>();
IProcess process = component.getProcess();
IContext context = process.getContextManager().getDefaultContext();
List<IContextParameter> paraList = context.getContextParameterList();
for (IContextParameter para : paraList) {
contextList.add(ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + para.getName());
}
return contextList;
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class MapperManager method removeRejectOutput.
public void removeRejectOutput() {
List<DataMapTableView> outputsTablesView = uiManager.getOutputsTablesView();
Iterator<DataMapTableView> iterator = outputsTablesView.iterator();
DataMapTableView outputTable = null;
DataMapTableView toRemove = null;
while (iterator.hasNext()) {
outputTable = iterator.next();
if (outputTable.getDataMapTable() instanceof OutputTable && ((OutputTable) outputTable.getDataMapTable()).isErrorRejectTable()) {
toRemove = outputTable;
iterator.remove();
break;
}
}
if (toRemove != null) {
uiManager.removeOutputTableView(toRemove);
uiManager.updateToolbarButtonsStates(Zone.OUTPUTS);
IProcess process = getAbstractMapComponent().getProcess();
process.removeUniqueConnectionName(toRemove.getDataMapTable().getName());
}
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class MapperManager method addRejectOutput.
public void addRejectOutput() {
String baseName = ERROR_REJECT;
IProcess process = getAbstractMapComponent().getProcess();
String tableName = baseName;
if (!process.checkValidConnectionName(baseName) && process instanceof IProcess2) {
final String uniqueName = ((IProcess2) process).generateUniqueConnectionName("row", baseName);
tableName = uniqueName;
((IProcess2) process).addUniqueConnectionName(uniqueName);
} else if (process instanceof IProcess2) {
tableName = baseName;
((IProcess2) process).addUniqueConnectionName(baseName);
}
IMetadataTable metadataTable = getNewMetadataTable();
metadataTable.setTableName(tableName);
MetadataColumn errorMessageCol = new MetadataColumn();
errorMessageCol.setLabel(ERROR_REJECT_MESSAGE);
errorMessageCol.setTalendType(DesignerPlugin.getDefault().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE));
errorMessageCol.setNullable(true);
errorMessageCol.setOriginalDbColumnName(ERROR_REJECT_MESSAGE);
errorMessageCol.setReadOnly(true);
errorMessageCol.setCustom(true);
errorMessageCol.setCustomId(0);
metadataTable.getListColumns().add(errorMessageCol);
MetadataColumn errorStackTrace = new MetadataColumn();
errorStackTrace.setLabel(ERROR_REJECT_STACK_TRACE);
errorStackTrace.setTalendType(DesignerPlugin.getDefault().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE));
errorStackTrace.setNullable(true);
errorStackTrace.setOriginalDbColumnName(ERROR_REJECT_STACK_TRACE);
errorStackTrace.setReadOnly(true);
errorStackTrace.setCustom(true);
errorStackTrace.setCustomId(1);
metadataTable.getListColumns().add(errorStackTrace);
OutputTable abstractDataMapTable = new OutputTable(this, metadataTable, tableName);
abstractDataMapTable.setErrorRejectTable(true);
abstractDataMapTable.initFromExternalData(null);
TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
DataMapTableView rejectDataMapTableView = uiManager.createNewOutputTableView(null, abstractDataMapTable, tablesZoneViewOutputs);
tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
List<DataMapTableView> outputsTablesView = uiManager.getOutputsTablesView();
int sizeList = outputsTablesView.size();
for (int i = 0; i < sizeList; i++) {
if (i + 1 < sizeList) {
FormData formData = (FormData) outputsTablesView.get(i + 1).getLayoutData();
formData.top = new FormAttachment(outputsTablesView.get(i));
}
}
CustomTableManager.addCustomManagementToTable(uiManager.getOutputMetaEditorView(), true);
tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tablesZoneViewOutputs.layout();
uiManager.moveOutputScrollBarZoneToMax();
uiManager.refreshBackground(true, false);
uiManager.selectDataMapTableView(rejectDataMapTableView, true, false);
}
Aggregations