Search in sources :

Example 1 with Adaptable

use of name.abuchen.portfolio.model.Adaptable in project portfolio by buchen.

the class SecurityDragListener method getSecurity.

private Security getSecurity() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    if (selection.isEmpty())
        return null;
    Object element = selection.getFirstElement();
    if (element instanceof Security) {
        return (Security) element;
    } else if (element instanceof Adaptable) {
        return ((Adaptable) element).adapt(Security.class);
    } else {
        return null;
    }
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Security(name.abuchen.portfolio.model.Security) Adaptable(name.abuchen.portfolio.model.Adaptable)

Aggregations

Adaptable (name.abuchen.portfolio.model.Adaptable)1 Security (name.abuchen.portfolio.model.Security)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1