Search in sources :

Example 26 with Problem

use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.

the class ProblemsView method createPartControl.

@Override
public void createPartControl(Composite parent) {
    this.parent = parent;
    CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().addPropertyChangeListener(this);
    parent.setLayout(new FillLayout());
    viewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    final Tree tree = viewer.getTree();
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            Problem problem = (Problem) selection.getFirstElement();
            if (problem != null && problem.isConcrete()) {
                if (problem.getNodeName() != null) {
                    selectInDesigner(problem.getJobInfo(), problem.getNodeName());
                } else if (problem instanceof TalendProblem) {
                    selectInRoutine((TalendProblem) problem);
                }
            }
        }
    });
    TreeColumn column1 = new TreeColumn(tree, SWT.CENTER);
    //$NON-NLS-1$
    column1.setText(Messages.getString("ProblemsView.description"));
    column1.setWidth(400);
    column1.setAlignment(SWT.LEFT);
    column1.setResizable(true);
    TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
    //$NON-NLS-1$
    column2.setText(Messages.getString("ProblemsView.resource"));
    column2.setWidth(400);
    column2.setResizable(true);
    ProblemViewProvider provider = new ProblemViewProvider();
    viewer.setLabelProvider(provider);
    viewer.setContentProvider(provider);
    resetContent();
    IActionBars actionBars = getViewSite().getActionBars();
    initMenu(actionBars.getMenuManager());
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) TalendProblem(org.talend.core.model.process.TalendProblem) TreeColumn(org.eclipse.swt.widgets.TreeColumn) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Tree(org.eclipse.swt.widgets.Tree) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Problem(org.talend.core.model.process.Problem) TalendProblem(org.talend.core.model.process.TalendProblem) FillLayout(org.eclipse.swt.layout.FillLayout) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IActionBars(org.eclipse.ui.IActionBars)

Example 27 with Problem

use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.

the class Problems method removeProblemsByElement.

public static void removeProblemsByElement(Node element) {
    IProcess process = element.getProcess();
    for (Iterator<Problem> iter = problemList.getProblemList().iterator(); iter.hasNext(); ) {
        Problem problem = iter.next();
        if (problem.getJobInfo() != null && (problem.getJobInfo().getJobId().equals(process.getId()) && problem.getJobInfo().getJobVersion().equals(process.getVersion()))) {
            if (problem.getNodeName() != null && (problem.getNodeName().equals(element.getUniqueName()))) {
                iter.remove();
            }
        }
    }
    refreshProblemTreeView();
}
Also used : Problem(org.talend.core.model.process.Problem) IProblem(org.eclipse.jdt.core.compiler.IProblem) TalendProblem(org.talend.core.model.process.TalendProblem) IProcess(org.talend.core.model.process.IProcess)

Example 28 with Problem

use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.

the class Problems method add.

public static void add(ProblemStatus status, Element element, String description) {
    Problem problem = new Problem(element, description, status);
    add(problem);
}
Also used : Problem(org.talend.core.model.process.Problem) IProblem(org.eclipse.jdt.core.compiler.IProblem) TalendProblem(org.talend.core.model.process.TalendProblem)

Example 29 with Problem

use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.

the class Problems method addErrorMark.

public static void addErrorMark() {
    nodeList.clear();
    String befor = "Error in the component's properties:";
    for (IProcess process : openJobs) {
        if (((Process) process).isActivate()) {
            for (INode inode : ((Process) process).getGraphicalNodes()) {
                if (inode instanceof Node) {
                    Node node = (Node) inode;
                    if (problemList.getProblemList().size() > 0) {
                        for (int i = 0; i < problemList.getProblemList().size(); i++) {
                            Problem problem = problemList.getProblemList().get(i);
                            if (node.isActivate()) {
                                if (problem.getStatus().equals(ProblemStatus.ERROR)) {
                                    if (problem instanceof TalendProblem) {
                                        TalendProblem tProblem = (TalendProblem) problem;
                                        if (!tProblem.getJavaUnitName().equals(node.getProcess().getName())) {
                                            continue;
                                        }
                                        if (tProblem.getVersion() != null) {
                                            if (!tProblem.getVersion().equals(node.getProcess().getVersion())) {
                                                continue;
                                            }
                                        }
                                        if (tProblem.getUnitName() != null && tProblem.getUnitName().equals(node.getUniqueName())) {
                                            // nodeList.add(node);
                                            if (nodeList.get(node) != null) {
                                                nodeList.get(node).append("\r\n");
                                                nodeList.get(node).append(tProblem.getDescription());
                                            } else {
                                                nodeList.put(node, new StringBuffer(tProblem.getDescription()));
                                            }
                                        } else {
                                            if (node.isErrorFlag() == true) {
                                                node.setErrorFlag(false);
                                                node.setCompareFlag(false);
                                                node.setErrorInfo(befor + tProblem.getDescription());
                                                //$NON-NLS-1$
                                                node.getNodeError().updateState("UPDATE_STATUS", false);
                                                //$NON-NLS-1$
                                                node.setErrorInfoChange("ERRORINFO", false);
                                            } else {
                                                continue;
                                            }
                                        }
                                    }
                                } else {
                                    if (node.isErrorFlag() == true) {
                                        node.setErrorFlag(false);
                                        node.setCompareFlag(false);
                                        //$NON-NLS-1$
                                        node.setErrorInfoChange("ERRORINFO", false);
                                    } else {
                                        continue;
                                    }
                                }
                            } else {
                                continue;
                            }
                        }
                    } else {
                        if (node.isErrorFlag() == true) {
                            node.setErrorFlag(false);
                            node.setCompareFlag(false);
                            node.setErrorInfo(null);
                            //$NON-NLS-1$
                            node.getNodeError().updateState("UPDATE_STATUS", false);
                            //$NON-NLS-1$
                            node.setErrorInfoChange("ERRORINFO", false);
                        } else {
                            continue;
                        }
                    }
                }
            }
        } else {
            continue;
        }
    }
    Iterator<Entry<Node, StringBuffer>> set = nodeList.entrySet().iterator();
    while (set.hasNext()) {
        Entry<Node, StringBuffer> en = set.next();
        Node node = en.getKey();
        String des = en.getValue().toString();
        if (node.isErrorFlag() == false) {
            node.setErrorFlag(true);
            node.setCompareFlag(false);
            node.setErrorInfo(befor + des);
            //$NON-NLS-1$
            node.getNodeError().updateState("UPDATE_STATUS", false);
            //$NON-NLS-1$
            node.setErrorInfoChange("ERRORINFO", true);
        }
    }
}
Also used : INode(org.talend.core.model.process.INode) Entry(java.util.Map.Entry) TalendProblem(org.talend.core.model.process.TalendProblem) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) Problem(org.talend.core.model.process.Problem) IProblem(org.eclipse.jdt.core.compiler.IProblem) TalendProblem(org.talend.core.model.process.TalendProblem) IProcess(org.talend.core.model.process.IProcess)

Example 30 with Problem

use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.

the class InputDataMapTableView method checkLookupTableProblems.

private void checkLookupTableProblems(boolean stateAtLeastOneHashKey) {
    ProblemsAnalyser problemAnalyser = new ProblemsAnalyser(mapperManager);
    List<Problem> lookupTableProblem = problemAnalyser.getLookupTableProblem(getInputTable(), stateAtLeastOneHashKey);
    if (!lookupTableProblem.isEmpty()) {
        String problemTxt = "";
        for (Problem problem : lookupTableProblem) {
            problemTxt = problemTxt + problem.getDescription();
        }
        warningLabel.setToolTipText(problemTxt);
        nameLabel.setToolTipText(problemTxt);
        // headerComposite.setBackground(ColorProviderMapper.getColor(ColorInfo.COLOR_ENTRY_SEARCH_HIGHLIGHTED));
        headerComposite.setToolTipText(problemTxt);
        warningLabel.setVisible(true);
        warnLabelData.exclude = false;
    } else {
        warningLabel.setVisible(false);
        nameLabel.setToolTipText(getInputTable().getName());
        headerComposite.setToolTipText(null);
        // headerComposite.setBackground(this.getBackground());
        warnLabelData.exclude = true;
    }
    layoutToolBar();
}
Also used : ProblemsAnalyser(org.talend.designer.mapper.utils.problems.ProblemsAnalyser) Problem(org.talend.core.model.process.Problem)

Aggregations

Problem (org.talend.core.model.process.Problem)34 TalendProblem (org.talend.core.model.process.TalendProblem)15 ArrayList (java.util.ArrayList)10 IProblem (org.eclipse.jdt.core.compiler.IProblem)9 PersistenceException (org.talend.commons.exception.PersistenceException)4 IProcess (org.talend.core.model.process.IProcess)4 IFile (org.eclipse.core.resources.IFile)3 CoreException (org.eclipse.core.runtime.CoreException)3 SystemException (org.talend.commons.exception.SystemException)3 Item (org.talend.core.model.properties.Item)3 ITalendSynchronizer (org.talend.designer.codegen.ITalendSynchronizer)3 HashSet (java.util.HashSet)2 List (java.util.List)2 IMarker (org.eclipse.core.resources.IMarker)2 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2 ProblemStatus (org.talend.core.model.process.Problem.ProblemStatus)2 Property (org.talend.core.model.properties.Property)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)2