use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class StatsAndLogsView method getCurrentJob.
/**
* Gets current opened job.
*/
private void getCurrentJob() {
final IEditorPart activeEditor = getSite().getPage().getActiveEditor();
if (activeEditor != null && activeEditor instanceof AbstractMultiPageTalendEditor) {
AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor();
Process process = (Process) talendEditor.getProcess();
if (process != null) {
this.process = process;
this.title = talendEditor.getTitle();
}
}
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method isStorageVersionChanged.
private boolean isStorageVersionChanged(Item refreshedItem, Item currentItem) {
boolean isChanged = false;
if (PluginChecker.isSVNProviderPluginLoaded()) {
if (svnProviderService != null && svnProviderService.isProjectInSvnMode()) {
Process refreshedProcess = new Process(refreshedItem.getProperty());
String refreshedNumStr = svnProviderService.getCurrentSVNRevision(refreshedProcess);
refreshedProcess.dispose();
if (refreshedNumStr != null) {
refreshedNumStr = getFormattedRevisionNumStr(refreshedNumStr);
if (!refreshedNumStr.equals(revisionNumStr)) {
isChanged = true;
}
}
}
} else {
Date currentModifiedDate = currentItem.getProperty().getModificationDate();
Date refreshedModifiedDate = refreshedItem.getProperty().getModificationDate();
isChanged = !currentModifiedDate.equals(refreshedModifiedDate);
}
return isChanged;
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class ActiveProcessTracker method partOpened.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
*/
@Override
public void partOpened(IWorkbenchPart part) {
boolean existedJobOpened = false;
if (part instanceof AbstractMultiPageTalendEditor) {
AbstractMultiPageTalendEditor mpte = (AbstractMultiPageTalendEditor) part;
if (mpte.isJobAlreadyOpened()) {
mpte.updateChildrens();
// close the first editor and keep the new one. (so only one will remain)
IEditorReference[] ref = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findEditors(mpte.getEditorInput(), mpte.getEditorId(), IWorkbenchPage.MATCH_INPUT);
IEditorPart editorPart = ref[0].getEditor(false);
editorPart.doSave(new NullProgressMonitor());
((AbstractMultiPageTalendEditor) editorPart).setKeepPropertyLocked(true);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(editorPart, false);
existedJobOpened = true;
}
} else {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDiagramModelService.class)) {
CorePlugin.getDefault().getDiagramModelService().handleNewEditorAction(part);
}
}
IProcess2 process = getJobFromActivatedEditor(part);
if (part instanceof AbstractMultiPageTalendEditor && process instanceof Process) {
((Process) process).setEditor((AbstractMultiPageTalendEditor) part);
}
if (process != null && currentProcess != process && lastProcessOpened != process) {
lastProcessOpened = process;
addJobInProblemView(process);
} else if (existedJobOpened) {
currentProcess = process;
for (IJobTrackerListener listener : jobTrackerListeners) {
listener.focusOnJob(process);
}
}
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method covertJobscriptOnPageChange.
private void covertJobscriptOnPageChange() {
try {
boolean isDirty = jobletEditor.isDirty();
jobletEditor.doSave(null);
IProcess2 oldProcess = getProcess();
ICreateXtextProcessService n = CorePlugin.getDefault().getCreateXtextProcessService();
Item item = oldProcess.getProperty().getItem();
ProcessType processType = null;
if (item instanceof ProcessItem) {
processType = n.convertDesignerEditorInput(((IFile) jobletEditor.getEditorInput().getAdapter(IResource.class)).getLocation().toOSString(), oldProcess.getProperty());
} else if (item instanceof JobletProcessItem) {
processType = n.convertJobletDesignerEditorInput(((IFile) jobletEditor.getEditorInput().getAdapter(IResource.class)).getLocation().toOSString(), oldProcess.getProperty());
}
if (item instanceof ProcessItem) {
((Process) oldProcess).updateProcess(processType);
} else if (item instanceof JobletProcessItem) {
((Process) oldProcess).updateProcess(processType);
}
oldProcess.getUpdateManager().updateAll();
designerEditor.setDirty(isDirty);
List<Node> nodes = (List<Node>) oldProcess.getGraphicalNodes();
List<Node> newNodes = new ArrayList<Node>();
newNodes.addAll(nodes);
for (Node node : newNodes) {
node.getProcess().checkStartNodes();
node.checkAndRefreshNode();
IElementParameter ep = node.getElementParameter("ACTIVATE");
if (ep != null && ep.getValue().equals(Boolean.FALSE)) {
node.setPropertyValue(EParameterName.ACTIVATE.getName(), true);
node.setPropertyValue(EParameterName.ACTIVATE.getName(), false);
} else if (ep != null && ep.getValue().equals(Boolean.TRUE)) {
node.setPropertyValue(EParameterName.ACTIVATE.getName(), false);
node.setPropertyValue(EParameterName.ACTIVATE.getName(), true);
}
for (IElementParameter param : node.getElementParameters()) {
if (!param.getChildParameters().isEmpty()) {
if (param.getValue() != null && param.getValue() instanceof String && ((String) param.getValue()).contains(":")) {
String[] splited = ((String) param.getValue()).split(":");
String childNameNeeded = splited[0].trim();
String valueChild = TalendQuoteUtils.removeQuotes(splited[1].trim());
if (param.getChildParameters().containsKey(childNameNeeded)) {
param.getChildParameters().get(childNameNeeded).setValue(valueChild);
}
}
}
}
if (node.getNodeContainer() instanceof JobletContainer) {
JobletContainer jc = (JobletContainer) node.getNodeContainer();
if (node.isMapReduceStart()) {
//$NON-NLS-1$
jc.updateState("UPDATE_STATUS", "", jc.getPercentMap(), jc.getPercentReduce());
}
}
}
} catch (PersistenceException e) {
}
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class Connection method setProcessStates.
private void setProcessStates() {
IProcess process = this.getSource().getProcess();
// generate code again.
process.setNeedRegenerateCode(true);
if (process instanceof Process) {
Process process2 = (Process) process;
if (!process2.isDuplicate()) {
// generate data node again.
process2.setProcessModified(true);
}
}
}
Aggregations