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;
}
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;
}
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);
}
}
}
}
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);
}
}
Aggregations