Example usage for org.eclipse.jface.viewers StructuredSelection toList

List of usage examples for org.eclipse.jface.viewers StructuredSelection toList

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers StructuredSelection toList.

Prototype

@Override
    public List toList() 

Source Link

Usage

From source file:org.talend.dataprofiler.core.ui.editor.composite.ComparisonTableViewerDNDDecorate.java

License:Open Source License

@SuppressWarnings("unchecked")
private boolean validateColumnType(StructuredSelection selection, TableViewer targetViewer) {
    if (selection == null) {
        return false;
    }/*from w  ww .  j  a  v a 2s  . c  om*/

    boolean isValidation = true;
    List selectionList = selection.toList();
    if (!allowDuplication) {
        List elements = (List) targetViewer.getInput();
        if (elements != null) {
            for (Object element : elements) {
                if (selectionList.contains(element)) {
                    isValidation = false;
                    break;
                }
            }
        }
    }
    for (Object obj : selectionList) {
        if (!(obj instanceof DBColumnRepNode)) {
            isValidation = false;
            break;
        }
    }
    return isValidation;
}

From source file:org.talend.designer.core.ui.editor.TalendSelectionManager.java

License:Open Source License

private StructuredSelection filterSelection(StructuredSelection selection) {
    List newSelection = new ArrayList(selection.toList());
    for (Object element : selection.toArray()) {
        if (element instanceof SubjobContainerPart) {
            // childrens are NodeContainer part
            newSelection.remove(element);
            List<NodeContainerPart> nodeContainerParts = ((SubjobContainerPart) element).getChildren();
            for (NodeContainerPart nodeContainerPart : nodeContainerParts) {
                for (Object object : nodeContainerPart.getChildren()) {
                    if (object instanceof NodePart) {
                        if (!newSelection.contains(object)) {
                            newSelection.add(object);
                        }//w w w .j a v  a  2s  . co m
                    }
                }
            }
        } else if (element instanceof NoteEditPart) {
            if (!newSelection.contains(element)) {
                newSelection.add(element);
            }
        } else if (!(element instanceof NodePart)) {
            newSelection.remove(element);
        }
    }
    StructuredSelection newList = new StructuredSelection(newSelection);
    return newList;
}

From source file:org.talend.designer.dbmap.managers.UIManager.java

License:Open Source License

/**
 * DOC amaumont Comment method "extractTableEntries".
 * /*  w w  w  .  jav a 2s .  co m*/
 * @param selection
 * @return
 */
@SuppressWarnings("unchecked")
public List<ITableEntry> extractSelectedTableEntries(ISelection selection) {
    StructuredSelection currentSelection = (StructuredSelection) selection;
    return currentSelection.toList();
}