Search in sources :

Example 31 with Process

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();
        }
    }
}
Also used : AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart)

Example 32 with Process

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;
}
Also used : Process(org.talend.designer.core.ui.editor.process.Process) Date(java.util.Date)

Example 33 with Process

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);
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IEditorReference(org.eclipse.ui.IEditorReference) IProcess2(org.talend.core.model.process.IProcess2) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart)

Example 34 with 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) {
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) AbstractJobletContainer(org.talend.designer.core.ui.editor.jobletcontainer.AbstractJobletContainer) JobletContainer(org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) ArrayList(java.util.ArrayList) ICreateXtextProcessService(org.talend.core.services.ICreateXtextProcessService) Process(org.talend.designer.core.ui.editor.process.Process) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) IProcess2(org.talend.core.model.process.IProcess2) PersistenceException(org.talend.commons.exception.PersistenceException) IElementParameter(org.talend.core.model.process.IElementParameter) ArrayList(java.util.ArrayList) List(java.util.List) IResource(org.eclipse.core.resources.IResource)

Example 35 with Process

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);
        }
    }
}
Also used : IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) IProcess(org.talend.core.model.process.IProcess)

Aggregations

Process (org.talend.designer.core.ui.editor.process.Process)119 Node (org.talend.designer.core.ui.editor.nodes.Node)69 INode (org.talend.core.model.process.INode)48 ArrayList (java.util.ArrayList)45 IComponent (org.talend.core.model.components.IComponent)36 IElementParameter (org.talend.core.model.process.IElementParameter)28 Test (org.junit.Test)26 List (java.util.List)25 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)25 IProcess (org.talend.core.model.process.IProcess)24 Connection (org.talend.designer.core.ui.editor.connections.Connection)24 Property (org.talend.core.model.properties.Property)23 INodeConnector (org.talend.core.model.process.INodeConnector)22 IConnection (org.talend.core.model.process.IConnection)20 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)20 FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)15 ProcessItem (org.talend.core.model.properties.ProcessItem)12 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)11 HashMap (java.util.HashMap)10 Before (org.junit.Before)9