Package org.bndtools.utils.jface

Source Code of org.bndtools.utils.jface.StatusTreeContentProvider

package org.bndtools.utils.jface;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

public class StatusTreeContentProvider implements ITreeContentProvider {

    public Object[] getElements(Object inputElement) {
        IStatus rootStatus = (IStatus) inputElement;
        if (rootStatus.isMultiStatus()) {
            return rootStatus.getChildren();
        }
        return new Object[] {
            rootStatus
        };
    }

    public void dispose() {}

    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}

    public Object[] getChildren(Object parentElement) {
        IStatus status = (IStatus) parentElement;
        return status.getChildren();
    }

    public Object getParent(Object element) {
        return null;
    }

    public boolean hasChildren(Object element) {
        return element instanceof IStatus && ((IStatus) element).isMultiStatus();
    }

}
TOP

Related Classes of org.bndtools.utils.jface.StatusTreeContentProvider

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.