Search in sources :

Example 1 with TmfTimeViewAlignmentInfo

use of org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo in project tracecompass by tracecompass.

the class TmfAlignmentSynchronizer method isCandidateForNarrowestView.

private static boolean isCandidateForNarrowestView(TmfView tmfView, TmfTimeViewAlignmentInfo alignmentInfo, int narrowestWidth) {
    ITmfTimeAligned alignedView = (ITmfTimeAligned) tmfView;
    TmfTimeViewAlignmentInfo timeViewAlignmentInfo = alignedView.getTimeViewAlignmentInfo();
    if (timeViewAlignmentInfo == null) {
        return false;
    }
    if (isDisposedView(tmfView)) {
        return false;
    }
    Composite parentComposite = tmfView.getParentComposite();
    boolean isVisible = parentComposite != null && parentComposite.isVisible();
    if (isVisible) {
        if (isViewLocationNear(getViewLocation(tmfView), alignmentInfo.getViewLocation())) {
            int availableWidth = alignedView.getAvailableWidth(getClampedTimeAxisOffset(alignmentInfo));
            availableWidth = getClampedTimeAxisWidth(alignmentInfo, availableWidth);
            boolean isNarrower = availableWidth < narrowestWidth && availableWidth > 0;
            return isNarrower;
        }
    }
    return false;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ITmfTimeAligned(org.eclipse.tracecompass.tmf.ui.views.ITmfTimeAligned) TmfTimeViewAlignmentInfo(org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo) Point(org.eclipse.swt.graphics.Point)

Example 2 with TmfTimeViewAlignmentInfo

use of org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo in project tracecompass by tracecompass.

the class TmfAlignmentSynchronizer method isCandidateForReferenceView.

private static boolean isCandidateForReferenceView(TmfView tmfView, TmfTimeViewAlignmentInfo alignmentInfo, int lowestTimeAxisOffset) {
    ITmfTimeAligned alignedView = (ITmfTimeAligned) tmfView;
    TmfTimeViewAlignmentInfo timeViewAlignmentInfo = alignedView.getTimeViewAlignmentInfo();
    if (timeViewAlignmentInfo == null) {
        return false;
    }
    if (isDisposedView(tmfView)) {
        return false;
    }
    Composite parentComposite = tmfView.getParentComposite();
    boolean isVisible = parentComposite != null && parentComposite.isVisible();
    if (isVisible) {
        boolean isViewLocationNear = isViewLocationNear(alignmentInfo.getViewLocation(), getViewLocation(tmfView));
        boolean isLowestTimeAxisOffset = getClampedTimeAxisOffset(timeViewAlignmentInfo) < lowestTimeAxisOffset;
        if (isViewLocationNear && isLowestTimeAxisOffset) {
            int availableWidth = alignedView.getAvailableWidth(getClampedTimeAxisOffset(timeViewAlignmentInfo));
            availableWidth = getClampedTimeAxisWidth(timeViewAlignmentInfo, availableWidth);
            if (availableWidth > 0) {
                return true;
            }
        }
    }
    return false;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ITmfTimeAligned(org.eclipse.tracecompass.tmf.ui.views.ITmfTimeAligned) TmfTimeViewAlignmentInfo(org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo) Point(org.eclipse.swt.graphics.Point)

Example 3 with TmfTimeViewAlignmentInfo

use of org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo in project tracecompass by tracecompass.

the class TmfAlignmentSynchronizer method performAlignment.

private static void performAlignment(AlignmentOperation info) {
    TmfView referenceView = info.fView;
    if (isDisposedView(referenceView)) {
        return;
    }
    TmfTimeViewAlignmentInfo alignmentInfo = info.fAlignmentInfo;
    // The location of the view might have changed (resize, etc). Update the alignment info.
    alignmentInfo = new TmfTimeViewAlignmentInfo(alignmentInfo.getShell(), getViewLocation(referenceView), getClampedTimeAxisOffset(alignmentInfo));
    TmfView narrowestView = getNarrowestView(alignmentInfo);
    if (narrowestView == null) {
        // No valid view found for this alignment. This could mean that the views for this alignment are now too narrow (width == 0) or that shell is not a workbench window.
        return;
    }
    int narrowestWidth = ((ITmfTimeAligned) narrowestView).getAvailableWidth(getClampedTimeAxisOffset(alignmentInfo));
    narrowestWidth = getClampedTimeAxisWidth(alignmentInfo, narrowestWidth);
    IViewReference[] viewReferences = referenceView.getSite().getPage().getViewReferences();
    for (IViewReference ref : viewReferences) {
        IViewPart view = ref.getView(false);
        if (isTimeAlignedView(view)) {
            TmfView tmfView = (TmfView) view;
            ITmfTimeAligned alignedView = (ITmfTimeAligned) view;
            if (!isDisposedView(tmfView) && isViewLocationNear(getViewLocation(tmfView), alignmentInfo.getViewLocation())) {
                alignedView.performAlign(getClampedTimeAxisOffset(alignmentInfo), narrowestWidth);
            }
        }
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) TmfView(org.eclipse.tracecompass.tmf.ui.views.TmfView) ITmfTimeAligned(org.eclipse.tracecompass.tmf.ui.views.ITmfTimeAligned) IViewReference(org.eclipse.ui.IViewReference) TmfTimeViewAlignmentInfo(org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo) Point(org.eclipse.swt.graphics.Point)

Example 4 with TmfTimeViewAlignmentInfo

use of org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo in project tracecompass by tracecompass.

the class TmfAlignmentSynchronizer method handleViewResized.

/**
 * Handle a view that was just resized.
 *
 * @param view
 *            the view that was resized
 */
public void handleViewResized(TmfView view) {
    if (view.getParentComposite().isDisposed()) {
        return;
    }
    TmfTimeViewAlignmentInfo alignmentInfo = new TmfTimeViewAlignmentInfo(view.getParentComposite().getShell(), getViewLocation(view), 0);
    // Don't use a view that was just resized as a reference view.
    // Otherwise, a view that was just
    // created might use itself as a reference but we want to
    // keep the existing alignment from the other views.
    ITmfTimeAligned referenceView = getReferenceView(alignmentInfo, view);
    if (referenceView != null) {
        queueAlignment(referenceView.getTimeViewAlignmentInfo(), false);
    }
}
Also used : ITmfTimeAligned(org.eclipse.tracecompass.tmf.ui.views.ITmfTimeAligned) TmfTimeViewAlignmentInfo(org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo)

Aggregations

TmfTimeViewAlignmentInfo (org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo)4 ITmfTimeAligned (org.eclipse.tracecompass.tmf.ui.views.ITmfTimeAligned)4 Point (org.eclipse.swt.graphics.Point)3 Composite (org.eclipse.swt.widgets.Composite)2 TmfView (org.eclipse.tracecompass.tmf.ui.views.TmfView)1 IViewPart (org.eclipse.ui.IViewPart)1 IViewReference (org.eclipse.ui.IViewReference)1