Search in sources :

Example 1 with ReportComparisonData

use of org.eclipse.linuxtools.internal.perf.ReportComparisonData in project linuxtools by eclipse.

the class ReportComparisonView method setInput.

@Override
public void setInput(Object input) {
    if (input instanceof ICompareInput) {
        fInput = (ICompareInput) input;
        if (fInput.getAncestor() != null || (fInput.getKind() & Differencer.DIRECTION_MASK) != 0) {
            setStyledText(Messages.CompUnsupported);
        } else {
            // get corresponding files
            IPath oldDatum;
            IPath newDatum;
            IProject proj = null;
            if (fInput.getLeft() instanceof ResourceNode) {
                ResourceNode left = (ResourceNode) fInput.getLeft();
                IResource oldData = left.getResource();
                oldDatum = oldData.getLocation();
                proj = oldData.getProject();
            } else {
                IEncodedStreamContentAccessor lStream = (IEncodedStreamContentAccessor) fInput.getLeft();
                oldDatum = generateTempFile(lStream);
            }
            if (fInput.getRight() instanceof ResourceNode) {
                ResourceNode right = (ResourceNode) fInput.getRight();
                IResource newData = right.getResource();
                newDatum = newData.getLocation();
                proj = newData.getProject();
            } else {
                IEncodedStreamContentAccessor rStream = (IEncodedStreamContentAccessor) fInput.getRight();
                newDatum = generateTempFile(rStream);
            }
            String title = MessageFormat.format(Messages.ContentDescription_0, oldDatum.toFile().getName(), newDatum.toFile().getName());
            // create comparison data and run comparison.
            ReportComparisonData diffData;
            if (reverse) {
                diffData = new ReportComparisonData(title, oldDatum, newDatum, proj);
            } else {
                diffData = new ReportComparisonData(title, newDatum, oldDatum, proj);
            }
            diffData.parse();
            setStyledText(diffData.getPerfData());
        }
    }
    fComposite.layout();
}
Also used : ReportComparisonData(org.eclipse.linuxtools.internal.perf.ReportComparisonData) IPath(org.eclipse.core.runtime.IPath) ICompareInput(org.eclipse.compare.structuremergeviewer.ICompareInput) IEncodedStreamContentAccessor(org.eclipse.compare.IEncodedStreamContentAccessor) IProject(org.eclipse.core.resources.IProject) IResource(org.eclipse.core.resources.IResource) ResourceNode(org.eclipse.compare.ResourceNode)

Aggregations

IEncodedStreamContentAccessor (org.eclipse.compare.IEncodedStreamContentAccessor)1 ResourceNode (org.eclipse.compare.ResourceNode)1 ICompareInput (org.eclipse.compare.structuremergeviewer.ICompareInput)1 IProject (org.eclipse.core.resources.IProject)1 IResource (org.eclipse.core.resources.IResource)1 IPath (org.eclipse.core.runtime.IPath)1 ReportComparisonData (org.eclipse.linuxtools.internal.perf.ReportComparisonData)1